@salutejs/plasma-new-hope 0.339.0-canary.2295.18740219652.0 → 0.339.0-canary.2297.18751153444.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/cjs/components/Pagination/Pagination.css +19 -0
  2. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +19 -0
  3. package/cjs/components/Select/Select.css +19 -0
  4. package/cjs/components/Select/Select.js +44 -9
  5. package/cjs/components/Select/Select.js.map +1 -1
  6. package/cjs/components/Select/Select.tokens.js +2 -0
  7. package/cjs/components/Select/Select.tokens.js.map +1 -1
  8. package/cjs/components/Select/hooks/useKeyboardNavigation.js +185 -1
  9. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  10. package/cjs/components/Select/hooks/usePathMaps.js +7 -3
  11. package/cjs/components/Select/hooks/usePathMaps.js.map +1 -1
  12. package/cjs/components/Select/reducers/treePathReducer.js +87 -0
  13. package/cjs/components/Select/reducers/treePathReducer.js.map +1 -0
  14. package/cjs/components/Select/ui/TreeList/TreeList.css +57 -0
  15. package/cjs/components/Select/ui/TreeList/TreeList.js +96 -0
  16. package/cjs/components/Select/ui/TreeList/TreeList.js.map +1 -0
  17. package/cjs/components/Select/ui/TreeList/TreeList.styles.js +30 -0
  18. package/cjs/components/Select/ui/TreeList/TreeList.styles.js.map +1 -0
  19. package/cjs/components/Select/ui/TreeList/TreeList.styles_1t38mek.css +2 -0
  20. package/cjs/components/Select/ui/TreeList/ui/Item/Item.css +54 -0
  21. package/cjs/components/Select/ui/TreeList/ui/Item/Item.js +130 -0
  22. package/cjs/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -0
  23. package/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +214 -0
  24. package/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js.map +1 -0
  25. package/cjs/components/Select/ui/TreeList/ui/Item/Item.styles_i0dby2.css +15 -0
  26. package/cjs/components/Table/Table.css +19 -0
  27. package/cjs/components/Table/ui/Cell/Cell.css +19 -0
  28. package/cjs/components/Table/ui/EditableCell/EditableCell.css +19 -0
  29. package/cjs/components/Table/ui/HeadCell/HeadCell.css +19 -0
  30. package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +19 -0
  31. package/cjs/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.css +3 -3
  32. package/cjs/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js +1 -1
  33. package/cjs/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js.map +1 -1
  34. package/cjs/components/Tabs/ui/horizontal/HorizontalIconTabItem/{HorizontalIconTabItem.styles_1yj92p8.css → HorizontalIconTabItem.styles_bv5xdd.css} +1 -1
  35. package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.css +6 -6
  36. package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js +1 -1
  37. package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js.map +1 -1
  38. package/{es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles_ohczvf.css → cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles_hklgpq.css} +1 -1
  39. package/cjs/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.css +3 -3
  40. package/cjs/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js +1 -1
  41. package/cjs/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js.map +1 -1
  42. package/cjs/components/Tabs/ui/vertical/VerticalIconTabItem/{VerticalIconTabItem.styles_1vnlsyl.css → VerticalIconTabItem.styles_2xthe5.css} +1 -1
  43. package/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.css +6 -6
  44. package/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js +1 -1
  45. package/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js.map +1 -1
  46. package/{es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles_11xtftz.css → cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles_oqphem.css} +1 -1
  47. package/cjs/components/Tree/utils/traverseTree.js +2 -23
  48. package/cjs/components/Tree/utils/traverseTree.js.map +1 -1
  49. package/cjs/index.css +37 -18
  50. package/cjs/index.js +2 -0
  51. package/cjs/index.js.map +1 -1
  52. package/cjs/utils/deepCopy.js +30 -0
  53. package/cjs/utils/deepCopy.js.map +1 -0
  54. package/cjs/utils/index.js.map +1 -1
  55. package/emotion/cjs/components/Select/Select.js +33 -6
  56. package/emotion/cjs/components/Select/Select.tokens.js +2 -0
  57. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +166 -0
  58. package/emotion/cjs/components/Select/hooks/usePathMaps.js +35 -3
  59. package/emotion/cjs/components/Select/reducers/index.js +1 -0
  60. package/emotion/cjs/components/Select/reducers/treePathReducer.js +98 -0
  61. package/emotion/cjs/components/Select/ui/TreeList/TreeList.js +126 -0
  62. package/emotion/cjs/components/Select/ui/TreeList/TreeList.styles.js +36 -0
  63. package/emotion/cjs/components/Select/ui/TreeList/TreeList.types.js +4 -0
  64. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.js +150 -0
  65. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +186 -0
  66. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.types.js +4 -0
  67. package/emotion/cjs/components/Select/ui/index.js +1 -0
  68. package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js +6 -6
  69. package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js +12 -12
  70. package/emotion/cjs/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js +6 -6
  71. package/emotion/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js +12 -12
  72. package/emotion/cjs/components/Tree/utils/traverseTree.js +2 -60
  73. package/emotion/cjs/examples/components/Select/Select.config.js +24 -24
  74. package/emotion/cjs/examples/components/Tabs/horizontal/HorizontalTabItem.config.js +17 -17
  75. package/emotion/cjs/utils/deepCopy.js +82 -0
  76. package/emotion/cjs/utils/index.js +4 -0
  77. package/emotion/es/components/Select/Select.js +35 -8
  78. package/emotion/es/components/Select/Select.tokens.js +2 -0
  79. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +166 -0
  80. package/emotion/es/components/Select/hooks/usePathMaps.js +36 -4
  81. package/emotion/es/components/Select/reducers/index.js +1 -0
  82. package/emotion/es/components/Select/reducers/treePathReducer.js +81 -0
  83. package/emotion/es/components/Select/ui/TreeList/TreeList.js +75 -0
  84. package/emotion/es/components/Select/ui/TreeList/TreeList.styles.js +13 -0
  85. package/emotion/es/components/Select/ui/TreeList/TreeList.types.js +1 -0
  86. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.js +99 -0
  87. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +122 -0
  88. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.types.js +1 -0
  89. package/emotion/es/components/Select/ui/index.js +1 -0
  90. package/emotion/es/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js +6 -6
  91. package/emotion/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js +12 -12
  92. package/emotion/es/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js +6 -6
  93. package/emotion/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js +12 -12
  94. package/emotion/es/components/Tree/utils/traverseTree.js +1 -59
  95. package/emotion/es/examples/components/Select/Select.config.js +24 -24
  96. package/emotion/es/examples/components/Tabs/horizontal/HorizontalTabItem.config.js +17 -17
  97. package/emotion/es/utils/deepCopy.js +72 -0
  98. package/emotion/es/utils/index.js +1 -0
  99. package/es/components/Pagination/Pagination.css +19 -0
  100. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +19 -0
  101. package/es/components/Select/Select.css +19 -0
  102. package/es/components/Select/Select.js +44 -9
  103. package/es/components/Select/Select.js.map +1 -1
  104. package/es/components/Select/Select.tokens.js +2 -0
  105. package/es/components/Select/Select.tokens.js.map +1 -1
  106. package/es/components/Select/hooks/useKeyboardNavigation.js +185 -1
  107. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  108. package/es/components/Select/hooks/usePathMaps.js +7 -3
  109. package/es/components/Select/hooks/usePathMaps.js.map +1 -1
  110. package/es/components/Select/reducers/treePathReducer.js +82 -0
  111. package/es/components/Select/reducers/treePathReducer.js.map +1 -0
  112. package/es/components/Select/ui/TreeList/TreeList.css +57 -0
  113. package/es/components/Select/ui/TreeList/TreeList.js +88 -0
  114. package/es/components/Select/ui/TreeList/TreeList.js.map +1 -0
  115. package/es/components/Select/ui/TreeList/TreeList.styles.js +25 -0
  116. package/es/components/Select/ui/TreeList/TreeList.styles.js.map +1 -0
  117. package/es/components/Select/ui/TreeList/TreeList.styles_1t38mek.css +2 -0
  118. package/es/components/Select/ui/TreeList/ui/Item/Item.css +54 -0
  119. package/es/components/Select/ui/TreeList/ui/Item/Item.js +122 -0
  120. package/es/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -0
  121. package/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +196 -0
  122. package/es/components/Select/ui/TreeList/ui/Item/Item.styles.js.map +1 -0
  123. package/es/components/Select/ui/TreeList/ui/Item/Item.styles_i0dby2.css +15 -0
  124. package/es/components/Table/Table.css +19 -0
  125. package/es/components/Table/ui/Cell/Cell.css +19 -0
  126. package/es/components/Table/ui/EditableCell/EditableCell.css +19 -0
  127. package/es/components/Table/ui/HeadCell/HeadCell.css +19 -0
  128. package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +19 -0
  129. package/es/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.css +3 -3
  130. package/es/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js +1 -1
  131. package/es/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js.map +1 -1
  132. package/es/components/Tabs/ui/horizontal/HorizontalIconTabItem/{HorizontalIconTabItem.styles_1yj92p8.css → HorizontalIconTabItem.styles_bv5xdd.css} +1 -1
  133. package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.css +6 -6
  134. package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js +1 -1
  135. package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js.map +1 -1
  136. package/{cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles_ohczvf.css → es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles_hklgpq.css} +1 -1
  137. package/es/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.css +3 -3
  138. package/es/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js +1 -1
  139. package/es/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js.map +1 -1
  140. package/es/components/Tabs/ui/vertical/VerticalIconTabItem/{VerticalIconTabItem.styles_1vnlsyl.css → VerticalIconTabItem.styles_2xthe5.css} +1 -1
  141. package/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.css +6 -6
  142. package/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js +1 -1
  143. package/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js.map +1 -1
  144. package/{cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles_11xtftz.css → es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles_oqphem.css} +1 -1
  145. package/es/components/Tree/utils/traverseTree.js +2 -23
  146. package/es/components/Tree/utils/traverseTree.js.map +1 -1
  147. package/es/index.css +37 -18
  148. package/es/index.js +1 -0
  149. package/es/index.js.map +1 -1
  150. package/es/utils/deepCopy.js +26 -0
  151. package/es/utils/deepCopy.js.map +1 -0
  152. package/es/utils/index.js.map +1 -1
  153. package/package.json +4 -4
  154. package/styled-components/cjs/components/Select/Select.js +33 -6
  155. package/styled-components/cjs/components/Select/Select.tokens.js +2 -0
  156. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +166 -0
  157. package/styled-components/cjs/components/Select/hooks/usePathMaps.js +35 -3
  158. package/styled-components/cjs/components/Select/reducers/index.js +1 -0
  159. package/styled-components/cjs/components/Select/reducers/treePathReducer.js +98 -0
  160. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.js +126 -0
  161. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.styles.js +50 -0
  162. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.types.js +4 -0
  163. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.js +150 -0
  164. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +300 -0
  165. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.types.js +4 -0
  166. package/styled-components/cjs/components/Select/ui/index.js +1 -0
  167. package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js +3 -3
  168. package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js +6 -6
  169. package/styled-components/cjs/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js +3 -3
  170. package/styled-components/cjs/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js +6 -6
  171. package/styled-components/cjs/components/Tree/utils/traverseTree.js +2 -60
  172. package/styled-components/cjs/examples/components/Select/Select.config.js +12 -4
  173. package/styled-components/cjs/examples/components/Tabs/horizontal/HorizontalTabItem.config.js +21 -25
  174. package/styled-components/cjs/utils/deepCopy.js +82 -0
  175. package/styled-components/cjs/utils/index.js +4 -0
  176. package/styled-components/es/components/Select/Select.js +35 -8
  177. package/styled-components/es/components/Select/Select.tokens.js +2 -0
  178. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +166 -0
  179. package/styled-components/es/components/Select/hooks/usePathMaps.js +36 -4
  180. package/styled-components/es/components/Select/reducers/index.js +1 -0
  181. package/styled-components/es/components/Select/reducers/treePathReducer.js +81 -0
  182. package/styled-components/es/components/Select/ui/TreeList/TreeList.js +75 -0
  183. package/styled-components/es/components/Select/ui/TreeList/TreeList.styles.js +27 -0
  184. package/styled-components/es/components/Select/ui/TreeList/TreeList.types.js +1 -0
  185. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.js +99 -0
  186. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +236 -0
  187. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.types.js +1 -0
  188. package/styled-components/es/components/Select/ui/index.js +1 -0
  189. package/styled-components/es/components/Tabs/ui/horizontal/HorizontalIconTabItem/HorizontalIconTabItem.styles.js +3 -3
  190. package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.styles.js +6 -6
  191. package/styled-components/es/components/Tabs/ui/vertical/VerticalIconTabItem/VerticalIconTabItem.styles.js +3 -3
  192. package/styled-components/es/components/Tabs/ui/vertical/VerticalTabItem/VerticalTabItem.styles.js +6 -6
  193. package/styled-components/es/components/Tree/utils/traverseTree.js +1 -59
  194. package/styled-components/es/examples/components/Select/Select.config.js +12 -4
  195. package/styled-components/es/examples/components/Tabs/horizontal/HorizontalTabItem.config.js +21 -25
  196. package/styled-components/es/utils/deepCopy.js +72 -0
  197. package/styled-components/es/utils/index.js +1 -0
  198. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +12 -0
  199. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts.map +1 -1
  200. package/types/components/Select/Select.d.ts.map +1 -1
  201. package/types/components/Select/Select.tokens.d.ts +2 -0
  202. package/types/components/Select/Select.tokens.d.ts.map +1 -1
  203. package/types/components/Select/Select.types.d.ts +26 -2
  204. package/types/components/Select/Select.types.d.ts.map +1 -1
  205. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +6 -2
  206. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  207. package/types/components/Select/hooks/usePathMaps.d.ts +2 -1
  208. package/types/components/Select/hooks/usePathMaps.d.ts.map +1 -1
  209. package/types/components/Select/reducers/index.d.ts +1 -0
  210. package/types/components/Select/reducers/index.d.ts.map +1 -1
  211. package/types/components/Select/reducers/treePathReducer.d.ts +14 -0
  212. package/types/components/Select/reducers/treePathReducer.d.ts.map +1 -0
  213. package/types/components/Select/ui/TreeList/TreeList.d.ts +4 -0
  214. package/types/components/Select/ui/TreeList/TreeList.d.ts.map +1 -0
  215. package/types/components/Select/ui/TreeList/TreeList.styles.d.ts +6 -0
  216. package/types/components/Select/ui/TreeList/TreeList.styles.d.ts.map +1 -0
  217. package/types/components/Select/ui/TreeList/TreeList.types.d.ts +11 -0
  218. package/types/components/Select/ui/TreeList/TreeList.types.d.ts.map +1 -0
  219. package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts +4 -0
  220. package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts.map +1 -0
  221. package/types/components/Select/ui/TreeList/ui/Item/Item.styles.d.ts +64 -0
  222. package/types/components/Select/ui/TreeList/ui/Item/Item.styles.d.ts.map +1 -0
  223. package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts +14 -0
  224. package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts.map +1 -0
  225. package/types/components/Select/ui/index.d.ts +1 -0
  226. package/types/components/Select/ui/index.d.ts.map +1 -1
  227. package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts +12 -0
  228. package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts.map +1 -1
  229. package/types/components/Tree/utils/traverseTree.d.ts.map +1 -1
  230. package/types/examples/components/Select/Select.config.d.ts.map +1 -1
  231. package/types/examples/components/Select/Select.d.ts +12 -0
  232. package/types/examples/components/Select/Select.d.ts.map +1 -1
  233. package/types/examples/components/Tabs/horizontal/HorizontalTabItem.config.d.ts.map +1 -1
  234. package/types/utils/deepCopy.d.ts +2 -0
  235. package/types/utils/deepCopy.d.ts.map +1 -0
  236. package/types/utils/index.d.ts +1 -0
  237. package/types/utils/index.d.ts.map +1 -1
@@ -0,0 +1,82 @@
1
+ // Blazing-fast хелпер для глубокого копирования объектов.
2
+ // Ссылки на функции (React-компоненты) сохраняются.
3
+ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "deepCopy", {
8
+ enumerable: true,
9
+ get: function() {
10
+ return deepCopy;
11
+ }
12
+ });
13
+ function _array_like_to_array(arr, len) {
14
+ if (len == null || len > arr.length) len = arr.length;
15
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
16
+ return arr2;
17
+ }
18
+ function _array_with_holes(arr) {
19
+ if (Array.isArray(arr)) return arr;
20
+ }
21
+ function _iterable_to_array_limit(arr, i) {
22
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
23
+ if (_i == null) return;
24
+ var _arr = [];
25
+ var _n = true;
26
+ var _d = false;
27
+ var _s, _e;
28
+ try {
29
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
30
+ _arr.push(_s.value);
31
+ if (i && _arr.length === i) break;
32
+ }
33
+ } catch (err) {
34
+ _d = true;
35
+ _e = err;
36
+ } finally{
37
+ try {
38
+ if (!_n && _i["return"] != null) _i["return"]();
39
+ } finally{
40
+ if (_d) throw _e;
41
+ }
42
+ }
43
+ return _arr;
44
+ }
45
+ function _non_iterable_rest() {
46
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
47
+ }
48
+ function _sliced_to_array(arr, i) {
49
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
50
+ }
51
+ function _type_of(obj) {
52
+ "@swc/helpers - typeof";
53
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
54
+ }
55
+ function _unsupported_iterable_to_array(o, minLen) {
56
+ if (!o) return;
57
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
58
+ var n = Object.prototype.toString.call(o).slice(8, -1);
59
+ if (n === "Object" && o.constructor) n = o.constructor.name;
60
+ if (n === "Map" || n === "Set") return Array.from(n);
61
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
62
+ }
63
+ var deepCopy = function(obj) {
64
+ if (obj === null || (typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object') {
65
+ return obj;
66
+ }
67
+ if (Array.isArray(obj)) {
68
+ return obj.map(function(item) {
69
+ return deepCopy(item);
70
+ });
71
+ }
72
+ if (obj.$$typeof === Symbol.for('react.element') || obj.$$typeof === Symbol.for('react.fragment') || _type_of(obj === null || obj === void 0 ? void 0 : obj.$$typeof) === 'symbol') {
73
+ return obj;
74
+ }
75
+ return Object.fromEntries(Object.entries(obj).map(function(param) {
76
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
77
+ return [
78
+ key,
79
+ deepCopy(value)
80
+ ];
81
+ }));
82
+ };
@@ -30,6 +30,9 @@ _export(exports, {
30
30
  get cx () {
31
31
  return cx;
32
32
  },
33
+ get deepCopy () {
34
+ return _deepCopy.deepCopy;
35
+ },
33
36
  get extractTextFrom () {
34
37
  return _extractTextFrom.extractTextFrom;
35
38
  },
@@ -75,6 +78,7 @@ _export_star(require("./initialValuesHelper"), exports);
75
78
  var _noop = require("./noop");
76
79
  var _getHeightAsNumber = require("./getHeightAsNumber");
77
80
  var _createConditionalComponent = require("./createConditionalComponent");
81
+ var _deepCopy = require("./deepCopy");
78
82
  var _fixedForwardRef = require("./fixedForwardRef");
79
83
  function _export_star(from, to) {
80
84
  Object.keys(from).forEach(function(k) {
@@ -108,8 +108,8 @@ import { isEmpty, safeUseId } from "../../utils";
108
108
  import { useOutsideClick } from "../../hooks";
109
109
  import { useKeyNavigation, getItemByFocused } from "./hooks/useKeyboardNavigation";
110
110
  import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from "./utils";
111
- import { Inner, Target, VirtualList, SelectAll } from "./ui";
112
- import { pathReducer, focusedPathReducer } from "./reducers";
111
+ import { Inner, Target, VirtualList, SelectAll, TreeList } from "./ui";
112
+ import { pathReducer, focusedPathReducer, treePathReducer } from "./reducers";
113
113
  import { usePathMaps } from "./hooks/usePathMaps";
114
114
  import { Ul, base, ListWrapper } from "./Select.styles";
115
115
  import { FloatingPopover } from "./FloatingPopover";
@@ -121,7 +121,7 @@ import { Context } from "./Select.context";
121
121
  return /*#__PURE__*/ forwardRef(function(props, ref) {
122
122
  var _getItemByFocused;
123
123
  var // eslint-disable-block @typescript-eslint/ban-ts-comment
124
- id = props.id, outerValue = props.value, outerOnChange = props.onChange, _props_target = props.target, target = _props_target === void 0 ? 'textfield-like' : _props_target, items = props.items, _props_placement = props.placement, placement = _props_placement === void 0 ? 'bottom' : _props_placement, label = props.label, labelPlacement = props.labelPlacement, placeholder = props.placeholder, helperText = props.helperText, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_readOnly = props.readOnly, readOnly = _props_readOnly === void 0 ? false : _props_readOnly, outerView = props.view, size = props.size, listOverflow = props.listOverflow, listHeight = props.listHeight, listMaxHeight = props.listMaxHeight, listWidth = props.listWidth, contentLeft = props.contentLeft, onScrollBottom = props.onScrollBottom, onScroll = props.onScroll, chipView = props.chipView, _props_variant = props.variant, variant = _props_variant === void 0 ? 'normal' : _props_variant, portal = props.portal, renderValue = props.renderValue, renderItem = props.renderItem, status = props.status, onItemSelect = props.onItemSelect, separator = props.separator, outerCloseAfterSelect = props.closeAfterSelect, isTargetAmount = props.isTargetAmount, beforeList = props.beforeList, afterList = props.afterList, zIndex = props.zIndex, name = props.name, defaultValue = props.defaultValue, _props_virtual = props.virtual, virtual = _props_virtual === void 0 ? false : _props_virtual, onToggle = props.onToggle, chipType = props.chipType, multiselect = props.multiselect, _props_mode = props.mode, mode = _props_mode === void 0 ? 'default' : _props_mode, chipClickArea = props.chipClickArea, // @ts-ignore
124
+ id = props.id, outerValue = props.value, outerOnChange = props.onChange, _props_target = props.target, target = _props_target === void 0 ? 'textfield-like' : _props_target, items = props.items, _props_treeView = props.treeView, treeView = _props_treeView === void 0 ? false : _props_treeView, _props_arrowPlacement = props.arrowPlacement, arrowPlacement = _props_arrowPlacement === void 0 ? 'left' : _props_arrowPlacement, _props_placement = props.placement, placement = _props_placement === void 0 ? 'bottom' : _props_placement, label = props.label, labelPlacement = props.labelPlacement, placeholder = props.placeholder, helperText = props.helperText, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_readOnly = props.readOnly, readOnly = _props_readOnly === void 0 ? false : _props_readOnly, outerView = props.view, size = props.size, listOverflow = props.listOverflow, listHeight = props.listHeight, listMaxHeight = props.listMaxHeight, listWidth = props.listWidth, contentLeft = props.contentLeft, onScrollBottom = props.onScrollBottom, onScroll = props.onScroll, chipView = props.chipView, _props_variant = props.variant, variant = _props_variant === void 0 ? 'normal' : _props_variant, portal = props.portal, renderValue = props.renderValue, renderItem = props.renderItem, status = props.status, onItemSelect = props.onItemSelect, separator = props.separator, outerCloseAfterSelect = props.closeAfterSelect, isTargetAmount = props.isTargetAmount, beforeList = props.beforeList, afterList = props.afterList, zIndex = props.zIndex, name = props.name, defaultValue = props.defaultValue, _props_virtual = props.virtual, virtual = _props_virtual === void 0 ? false : _props_virtual, onToggle = props.onToggle, chipType = props.chipType, multiselect = props.multiselect, _props_mode = props.mode, mode = _props_mode === void 0 ? 'default' : _props_mode, chipClickArea = props.chipClickArea, // @ts-ignore
125
125
  _offset = props._offset, // Извлекаем пропсы для required и hint, чтобы они не попадали в DOM.
126
126
  // @ts-ignore
127
127
  required = props.required, // @ts-ignore
@@ -142,6 +142,8 @@ import { Context } from "./Select.context";
142
142
  "onChange",
143
143
  "target",
144
144
  "items",
145
+ "treeView",
146
+ "arrowPlacement",
145
147
  "placement",
146
148
  "label",
147
149
  "labelPlacement",
@@ -200,13 +202,14 @@ import { Context } from "./Select.context";
200
202
  items
201
203
  ]);
202
204
  // Создаем структуры для быстрой работы с деревом
203
- var _usePathMaps = _sliced_to_array(usePathMaps(transformedItems), 4), pathMap = _usePathMaps[0], focusedToValueMap = _usePathMaps[1], valueToCheckedMap = _usePathMaps[2], valueToItemMap = _usePathMaps[3];
205
+ var _usePathMaps = _sliced_to_array(usePathMaps(transformedItems), 5), pathMap = _usePathMaps[0], focusedToValueMap = _usePathMaps[1], valueToCheckedMap = _usePathMaps[2], valueToItemMap = _usePathMaps[3], valueToPathMap = _usePathMaps[4];
204
206
  var _useState = _sliced_to_array(useState(props.multiselect ? [] : ''), 2), internalValue = _useState[0], setInternalValue = _useState[1];
205
207
  var value = outerValue !== null && outerValue !== undefined ? outerValue : internalValue;
206
208
  var floatingPopoverRef = useRef(null);
207
209
  // Состояния дерева элементов
208
210
  var _useReducer = _sliced_to_array(useReducer(pathReducer, []), 2), path = _useReducer[0], dispatchPath = _useReducer[1];
209
- var _useReducer1 = _sliced_to_array(useReducer(focusedPathReducer, []), 2), focusedPath = _useReducer1[0], dispatchFocusedPath = _useReducer1[1];
211
+ var _useReducer1 = _sliced_to_array(useReducer(treePathReducer, {}), 2), treePath = _useReducer1[0], dispatchTreePath = _useReducer1[1];
212
+ var _useReducer2 = _sliced_to_array(useReducer(focusedPathReducer, []), 2), focusedPath = _useReducer2[0], dispatchFocusedPath = _useReducer2[1];
210
213
  var _useState1 = _sliced_to_array(useState(valueToCheckedMap), 2), checked = _useState1[0], setChecked = _useState1[1];
211
214
  var isCurrentListOpen = Boolean(path[0]);
212
215
  var activeDescendantItemValue = ((_getItemByFocused = getItemByFocused(focusedPath, focusedToValueMap)) === null || _getItemByFocused === void 0 ? void 0 : _getItemByFocused.value.toString()) || '';
@@ -275,6 +278,9 @@ import { Context } from "./Select.context";
275
278
  dispatchPath({
276
279
  type: 'reset'
277
280
  });
281
+ dispatchTreePath({
282
+ type: 'reset'
283
+ });
278
284
  // Скроллим чипы к левому краю при закрытии компонента
279
285
  var el = rootRef === null || rootRef === void 0 ? void 0 : (_rootRef_current = rootRef.current) === null || _rootRef_current === void 0 ? void 0 : _rootRef_current.querySelector('.input-scrollable-wrapper');
280
286
  if (multiselect && value.length > 0 && el) {
@@ -337,6 +343,9 @@ import { Context } from "./Select.context";
337
343
  dispatchFocusedPath({
338
344
  type: 'reset'
339
345
  });
346
+ dispatchTreePath({
347
+ type: 'reset'
348
+ });
340
349
  }
341
350
  if (onChange) {
342
351
  onChange(newValues, item);
@@ -361,6 +370,9 @@ import { Context } from "./Select.context";
361
370
  dispatchFocusedPath({
362
371
  type: 'reset'
363
372
  });
373
+ dispatchTreePath({
374
+ type: 'reset'
375
+ });
364
376
  }
365
377
  // Закрываем список, если элемент уже выбран.
366
378
  if (mode === 'radio' && isCurrentChecked) {
@@ -398,7 +410,11 @@ import { Context } from "./Select.context";
398
410
  pathMap: pathMap,
399
411
  focusedToValueMap: focusedToValueMap,
400
412
  handleListToggle: handleListToggle,
401
- handlePressDown: handlePressDown
413
+ handlePressDown: handlePressDown,
414
+ treePath: treePath,
415
+ dispatchTreePath: dispatchTreePath,
416
+ treeView: treeView,
417
+ valueToPathMap: valueToPathMap
402
418
  }).onKeyDown;
403
419
  // В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
404
420
  // Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
@@ -473,7 +489,11 @@ import { Context } from "./Select.context";
473
489
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
474
490
  // @ts-ignore
475
491
  // eslint-disable-next-line no-underscore-dangle
476
- _checkboxAppearance: rest._checkboxAppearance
492
+ _checkboxAppearance: rest._checkboxAppearance,
493
+ treePath: treePath,
494
+ dispatchTreePath: dispatchTreePath,
495
+ arrowPlacement: arrowPlacement,
496
+ valueToPathMap: valueToPathMap
477
497
  }
478
498
  }, /*#__PURE__*/ React.createElement(FloatingPopover, {
479
499
  ref: floatingPopoverRef,
@@ -522,7 +542,14 @@ import { Context } from "./Select.context";
522
542
  chipView: chipView,
523
543
  disabled: disabled,
524
544
  readOnly: readOnly
525
- }, rest), /*#__PURE__*/ React.createElement(ListWrapper, {
545
+ }, rest), treeView ? /*#__PURE__*/ React.createElement(TreeList, {
546
+ items: items,
547
+ listMaxHeight: listMaxHeight,
548
+ onScroll: virtual ? undefined : handleScroll,
549
+ virtual: virtual,
550
+ beforeList: beforeList,
551
+ afterList: afterList
552
+ }) : /*#__PURE__*/ React.createElement(ListWrapper, {
526
553
  ref: listWrapperRef,
527
554
  listWidth: listWidth
528
555
  }, /*#__PURE__*/ React.createElement(Ul, {
@@ -33,6 +33,8 @@ export var tokens = {
33
33
  itemDisabledOpacity: '--plasma-select-item-disabled-opacity',
34
34
  itemDisabledColor: '--plasma-select-item-disabled-color',
35
35
  itemIconColor: '--plasma-select-item-icon-color',
36
+ itemGap: '--plasma-select-item-gap',
37
+ itemTreeOffsetWidth: '--plasma-select-item-tree-offset-width',
36
38
  cellPadding: '--plasma-select-cell-padding',
37
39
  cellPaddingLeftContent: '--plasma-select-cell-padding-left-content',
38
40
  cellPaddingContent: '--plasma-select-cell-padding-content',
@@ -1,3 +1,4 @@
1
+ import { keyExists } from "../reducers/treePathReducer";
1
2
  var JUMP_SIZE = 10;
2
3
  export var keys = {
3
4
  Enter: 'Enter',
@@ -21,6 +22,39 @@ export var getItemByFocused = function(focusedPath, focusedToValueMap) {
21
22
  return focusedToValueMap.get(focusedPathAsString);
22
23
  };
23
24
  export var useKeyNavigation = function(param) {
25
+ var focusedPath = param.focusedPath, dispatchFocusedPath = param.dispatchFocusedPath, path = param.path, dispatchPath = param.dispatchPath, pathMap = param.pathMap, focusedToValueMap = param.focusedToValueMap, handleListToggle = param.handleListToggle, handlePressDown = param.handlePressDown, treePath = param.treePath, dispatchTreePath = param.dispatchTreePath, treeView = param.treeView, valueToPathMap = param.valueToPathMap;
26
+ if (treeView) {
27
+ return keyboardNavigationTree({
28
+ focusedPath: focusedPath,
29
+ dispatchFocusedPath: dispatchFocusedPath,
30
+ path: path,
31
+ dispatchPath: dispatchPath,
32
+ pathMap: pathMap,
33
+ focusedToValueMap: focusedToValueMap,
34
+ handleListToggle: handleListToggle,
35
+ handlePressDown: handlePressDown,
36
+ treePath: treePath,
37
+ dispatchTreePath: dispatchTreePath,
38
+ treeView: treeView,
39
+ valueToPathMap: valueToPathMap
40
+ });
41
+ }
42
+ return keyboardNavigationDefault({
43
+ focusedPath: focusedPath,
44
+ dispatchFocusedPath: dispatchFocusedPath,
45
+ path: path,
46
+ dispatchPath: dispatchPath,
47
+ pathMap: pathMap,
48
+ focusedToValueMap: focusedToValueMap,
49
+ handleListToggle: handleListToggle,
50
+ handlePressDown: handlePressDown,
51
+ treePath: treePath,
52
+ dispatchTreePath: dispatchTreePath,
53
+ treeView: treeView,
54
+ valueToPathMap: valueToPathMap
55
+ });
56
+ };
57
+ var keyboardNavigationDefault = function(param) {
24
58
  var focusedPath = param.focusedPath, dispatchFocusedPath = param.dispatchFocusedPath, path = param.path, dispatchPath = param.dispatchPath, pathMap = param.pathMap, focusedToValueMap = param.focusedToValueMap, handleListToggle = param.handleListToggle, handlePressDown = param.handlePressDown;
25
59
  var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
26
60
  var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[focusedPath.length - 1]) || 0;
@@ -285,3 +319,135 @@ export var useKeyNavigation = function(param) {
285
319
  onKeyDown: onKeyDown
286
320
  };
287
321
  };
322
+ var keyboardNavigationTree = function(param) {
323
+ var focusedPath = param.focusedPath, dispatchFocusedPath = param.dispatchFocusedPath, path = param.path, dispatchPath = param.dispatchPath, pathMap = param.pathMap, focusedToValueMap = param.focusedToValueMap, handleListToggle = param.handleListToggle, handlePressDown = param.handlePressDown, treePath = param.treePath, dispatchTreePath = param.dispatchTreePath, valueToPathMap = param.valueToPathMap;
324
+ var _currentItem_parent_items, _currentItem_parent;
325
+ var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
326
+ var currentItem = getItemByFocused(focusedPath, focusedToValueMap);
327
+ var currentLength = (currentItem === null || currentItem === void 0 ? void 0 : (_currentItem_parent = currentItem.parent) === null || _currentItem_parent === void 0 ? void 0 : (_currentItem_parent_items = _currentItem_parent.items) === null || _currentItem_parent_items === void 0 ? void 0 : _currentItem_parent_items.length) || pathMap.get('root') || 0;
328
+ var onKeyDown = function(event) {
329
+ switch(event.code){
330
+ case keys.ArrowUp:
331
+ {
332
+ if (focusedPath.length) {
333
+ if (currentIndex > 0) {
334
+ dispatchFocusedPath({
335
+ type: 'change_last_focus',
336
+ value: currentIndex - 1
337
+ });
338
+ }
339
+ } else {
340
+ dispatchPath({
341
+ type: 'opened_first_level'
342
+ });
343
+ dispatchFocusedPath({
344
+ type: 'set_initial_focus'
345
+ });
346
+ handleListToggle(true);
347
+ }
348
+ break;
349
+ }
350
+ case keys.ArrowDown:
351
+ {
352
+ if (focusedPath.length) {
353
+ if (currentIndex + 1 < currentLength) {
354
+ dispatchFocusedPath({
355
+ type: 'change_last_focus',
356
+ value: currentIndex + 1
357
+ });
358
+ }
359
+ } else {
360
+ dispatchPath({
361
+ type: 'opened_first_level'
362
+ });
363
+ dispatchFocusedPath({
364
+ type: 'set_initial_focus'
365
+ });
366
+ handleListToggle(true);
367
+ }
368
+ break;
369
+ }
370
+ case keys.ArrowLeft:
371
+ {
372
+ if (path[0]) {
373
+ if (focusedPath.length) {
374
+ var isCurrentLevelOpened = keyExists(treePath, valueToPathMap.get((currentItem === null || currentItem === void 0 ? void 0 : currentItem.value.toString()) || '') || []);
375
+ if (isCurrentLevelOpened) {
376
+ dispatchTreePath({
377
+ type: 'toggled_level',
378
+ value: valueToPathMap.get((currentItem === null || currentItem === void 0 ? void 0 : currentItem.value.toString()) || '') || []
379
+ });
380
+ } else if (focusedPath.length === 1) {
381
+ handleListToggle(false);
382
+ } else {
383
+ dispatchFocusedPath({
384
+ type: 'return_prev_focus'
385
+ });
386
+ }
387
+ }
388
+ }
389
+ break;
390
+ }
391
+ case keys.ArrowRight:
392
+ {
393
+ if (path[0]) {
394
+ if (!focusedPath.length) {
395
+ break;
396
+ }
397
+ if ((currentItem === null || currentItem === void 0 ? void 0 : currentItem.disabled) || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.isDisabled)) {
398
+ break;
399
+ }
400
+ if (currentItem === null || currentItem === void 0 ? void 0 : currentItem.items) {
401
+ var isCurrentLevelOpened1 = keyExists(treePath, valueToPathMap.get(currentItem.value.toString()) || []);
402
+ if (isCurrentLevelOpened1) {
403
+ dispatchFocusedPath({
404
+ type: 'add_focus',
405
+ value: 0
406
+ });
407
+ } else {
408
+ dispatchTreePath({
409
+ type: 'toggled_level',
410
+ value: valueToPathMap.get(currentItem.value.toString()) || []
411
+ });
412
+ }
413
+ }
414
+ }
415
+ break;
416
+ }
417
+ case keys.Space:
418
+ case keys.Enter:
419
+ {
420
+ event.preventDefault();
421
+ if (!path[0]) {
422
+ dispatchPath({
423
+ type: 'opened_first_level'
424
+ });
425
+ dispatchFocusedPath({
426
+ type: 'set_initial_focus'
427
+ });
428
+ break;
429
+ }
430
+ if (!currentItem || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.disabled) || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.isDisabled)) {
431
+ break;
432
+ }
433
+ handlePressDown(currentItem);
434
+ break;
435
+ }
436
+ case keys.Tab:
437
+ case keys.Escape:
438
+ {
439
+ if (path[0]) {
440
+ handleListToggle(false);
441
+ }
442
+ break;
443
+ }
444
+ default:
445
+ {
446
+ break;
447
+ }
448
+ }
449
+ };
450
+ return {
451
+ onKeyDown: onKeyDown
452
+ };
453
+ };
@@ -1,23 +1,54 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
+ }
9
+ function _iterable_to_array(iter) {
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
+ }
12
+ function _non_iterable_spread() {
13
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
+ }
15
+ function _to_consumable_array(arr) {
16
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
+ }
18
+ function _unsupported_iterable_to_array(o, minLen) {
19
+ if (!o) return;
20
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
21
+ var n = Object.prototype.toString.call(o).slice(8, -1);
22
+ if (n === "Object" && o.constructor) n = o.constructor.name;
23
+ if (n === "Map" || n === "Set") return Array.from(n);
24
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
+ }
1
26
  import { isEmpty } from "../../../utils";
2
- // Рекурсивно проходим по дереву items и создаем 4 мапы: открытых путей, фокусов, выбранных элементов и айтемов.
27
+ // Рекурсивно проходим по дереву items и создаем мапы для быстрой работы с деревом.
3
28
  export var usePathMaps = function(items) {
4
29
  var pathMap = new Map();
5
30
  var focusedToValueMap = new Map();
6
31
  var valueToCheckedMap = new Map();
7
32
  var valueToItemMap = new Map();
33
+ var valueToPathMap = new Map();
8
34
  pathMap.set('root', (items === null || items === void 0 ? void 0 : items.length) || 0);
9
35
  var rec = function(items) {
10
- var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
36
+ var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '', path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
11
37
  items === null || items === void 0 ? void 0 : items.forEach(function(item, index) {
12
38
  var value = item.value, innerItems = item.items;
13
39
  var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
14
40
  focusedToValueMap.set(currIndex, item);
15
41
  valueToCheckedMap.set(value, false);
42
+ valueToPathMap.set(value.toString(), _to_consumable_array(path).concat([
43
+ value.toString()
44
+ ]));
16
45
  if (isEmpty(innerItems) || !innerItems) {
17
46
  valueToItemMap.set(value, item);
18
47
  } else {
19
48
  pathMap.set(value, innerItems.length);
20
- rec(innerItems, currIndex);
49
+ rec(innerItems, currIndex, _to_consumable_array(path).concat([
50
+ value.toString()
51
+ ]));
21
52
  }
22
53
  });
23
54
  };
@@ -26,6 +57,7 @@ export var usePathMaps = function(items) {
26
57
  pathMap,
27
58
  focusedToValueMap,
28
59
  valueToCheckedMap,
29
- valueToItemMap
60
+ valueToItemMap,
61
+ valueToPathMap
30
62
  ];
31
63
  };
@@ -1,2 +1,3 @@
1
1
  export * from "./pathReducer";
2
2
  export * from "./focusedPathReducer";
3
+ export * from "./treePathReducer";
@@ -0,0 +1,81 @@
1
+ function _type_of(obj) {
2
+ "@swc/helpers - typeof";
3
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4
+ }
5
+ import { deepCopy } from "../../../utils";
6
+ // Утилита для поиска ключа в объекте по пути.
7
+ export var keyExists = function(obj, path) {
8
+ if ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object' || obj === null || !Array.isArray(path)) {
9
+ return false;
10
+ }
11
+ var current = obj;
12
+ for(var i = 0; i < path.length; i++){
13
+ var key = path[i];
14
+ if (current === null || (typeof current === "undefined" ? "undefined" : _type_of(current)) !== 'object' || !(key in current)) {
15
+ return false;
16
+ }
17
+ current = current[key];
18
+ }
19
+ return true;
20
+ };
21
+ function createObjectAtPath(obj, path) {
22
+ if ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object' || obj === null) {
23
+ return;
24
+ }
25
+ var current = obj;
26
+ for(var i = 0; i < path.length; i++){
27
+ var key = path[i];
28
+ if (i === path.length - 1) {
29
+ current[key] = {};
30
+ break;
31
+ }
32
+ if (current[key] === undefined || current[key] === null) {
33
+ current[key] = {};
34
+ }
35
+ current = current[key];
36
+ }
37
+ return obj;
38
+ }
39
+ function removeObjectAtPath(obj, path) {
40
+ if (path.length === 0) {
41
+ return obj;
42
+ }
43
+ var current = obj;
44
+ for(var i = 0; i < path.length; i++){
45
+ var key = path[i];
46
+ if (current === null || (typeof current === "undefined" ? "undefined" : _type_of(current)) !== 'object' || !(key in current)) {
47
+ return obj;
48
+ }
49
+ if (i === path.length - 1) {
50
+ delete current[key];
51
+ break;
52
+ }
53
+ current = current[key];
54
+ }
55
+ return obj;
56
+ }
57
+ export function treePathReducer(state, action) {
58
+ switch(action.type){
59
+ case 'reset':
60
+ {
61
+ return {};
62
+ }
63
+ case 'toggled_level':
64
+ {
65
+ var stateCopy = deepCopy(state);
66
+ var isTargetLevelOpened = keyExists(stateCopy, action.value);
67
+ if (isTargetLevelOpened) {
68
+ // нужно закрыть текущий уровень
69
+ removeObjectAtPath(stateCopy, action.value);
70
+ } else {
71
+ // нужно открыть требуемый уровень
72
+ createObjectAtPath(stateCopy, action.value);
73
+ }
74
+ return stateCopy;
75
+ }
76
+ default:
77
+ {
78
+ return state;
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,75 @@
1
+ import React, { useRef } from "react";
2
+ import { useVirtualizer } from "@tanstack/react-virtual";
3
+ import { getHeightAsNumber } from "../../../../utils";
4
+ import { Item } from "./ui/Item/Item";
5
+ import { ListWrapper, ScrollContainer } from "./TreeList.styles";
6
+ export var TreeList = function(param) {
7
+ var items = param.items, listMaxHeight = param.listMaxHeight, onScroll = param.onScroll, virtual = param.virtual, beforeList = param.beforeList, afterList = param.afterList;
8
+ if (virtual) {
9
+ return /*#__PURE__*/ React.createElement(VirtualTreeList, {
10
+ items: items,
11
+ listMaxHeight: listMaxHeight,
12
+ onScroll: onScroll,
13
+ beforeList: beforeList,
14
+ afterList: afterList
15
+ });
16
+ }
17
+ return /*#__PURE__*/ React.createElement(ListWrapper, null, /*#__PURE__*/ React.createElement(ScrollContainer, {
18
+ listMaxHeight: listMaxHeight,
19
+ onScroll: onScroll
20
+ }, beforeList, items === null || items === void 0 ? void 0 : items.map(function(item, index) {
21
+ return /*#__PURE__*/ React.createElement(Item, {
22
+ key: index,
23
+ index: index,
24
+ item: item
25
+ });
26
+ }), afterList));
27
+ };
28
+ var VirtualTreeList = function(param) {
29
+ var _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, listMaxHeight = param.listMaxHeight, onScroll = param.onScroll, beforeList = param.beforeList, afterList = param.afterList;
30
+ var _virtualItems_;
31
+ var parentRef = useRef(null);
32
+ var virtualizer = useVirtualizer({
33
+ count: items.length,
34
+ getScrollElement: function() {
35
+ return parentRef.current;
36
+ },
37
+ estimateSize: function() {
38
+ return 48;
39
+ }
40
+ });
41
+ var virtualItems = virtualizer.getVirtualItems();
42
+ var _virtualItems__start;
43
+ return /*#__PURE__*/ React.createElement(ListWrapper, null, beforeList, /*#__PURE__*/ React.createElement("div", {
44
+ ref: parentRef,
45
+ style: {
46
+ height: 'auto',
47
+ maxHeight: getHeightAsNumber(listMaxHeight),
48
+ overflowY: 'auto'
49
+ },
50
+ onScroll: onScroll
51
+ }, /*#__PURE__*/ React.createElement("div", {
52
+ style: {
53
+ height: virtualizer.getTotalSize(),
54
+ width: '100%',
55
+ position: 'relative'
56
+ }
57
+ }, /*#__PURE__*/ React.createElement("div", {
58
+ style: {
59
+ position: 'absolute',
60
+ top: 0,
61
+ left: 0,
62
+ width: '100%',
63
+ transform: "translateY(".concat((_virtualItems__start = (_virtualItems_ = virtualItems[0]) === null || _virtualItems_ === void 0 ? void 0 : _virtualItems_.start) !== null && _virtualItems__start !== void 0 ? _virtualItems__start : 0, "px)")
64
+ }
65
+ }, virtualItems.map(function(virtualRow) {
66
+ return /*#__PURE__*/ React.createElement("div", {
67
+ key: virtualRow.key,
68
+ "data-index": virtualRow.index,
69
+ ref: virtualizer.measureElement
70
+ }, /*#__PURE__*/ React.createElement(Item, {
71
+ item: items[virtualRow.index],
72
+ index: virtualRow.index
73
+ }));
74
+ })))), afterList);
75
+ };
@@ -0,0 +1,13 @@
1
+ import styled from "@emotion/styled";
2
+ import { constants, tokens } from "../../Select.tokens";
3
+ export var ListWrapper = /*#__PURE__*/ styled("div", {
4
+ target: "evbtu0r0",
5
+ label: "ListWrapper"
6
+ })("width:100%;padding:calc(var(", tokens.padding, ") + var(", tokens.dropdownBorderWidth, ",0rem));border-radius:var(", tokens.borderRadius, ");box-sizing:border-box;background:var(", constants.background, ");box-shadow:", constants.boxShadow, ",inset 0 0 0 var(", tokens.dropdownBorderWidth, ",0rem) var(", tokens.dropdownBorderColor, ",transparent);", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjLWVtb3Rpb24vY29tcG9uZW50cy9TZWxlY3QvdWkvVHJlZUxpc3QvVHJlZUxpc3Quc3R5bGVzLnRzIiwic291cmNlcyI6WyJzcmMtZW1vdGlvbi9jb21wb25lbnRzL1NlbGVjdC91aS9UcmVlTGlzdC9UcmVlTGlzdC5zdHlsZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgU2VsZWN0UHJvcHMgfSBmcm9tICdzcmMvY29tcG9uZW50cy9TZWxlY3QnO1xuXG5pbXBvcnQgeyBjb25zdGFudHMsIHRva2VucyB9IGZyb20gJy4uLy4uL1NlbGVjdC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgTGlzdFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmc6IGNhbGModmFyKCR7dG9rZW5zLnBhZGRpbmd9KSArIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuICAgIGJvcmRlci1yYWRpdXM6IHZhcigke3Rva2Vucy5ib3JkZXJSYWRpdXN9KTtcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGJhY2tncm91bmQ6IHZhcigke2NvbnN0YW50cy5iYWNrZ3JvdW5kfSk7XG4gICAgYm94LXNoYWRvdzogJHtjb25zdGFudHMuYm94U2hhZG93fSxcbiAgICAgICAgaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmRyb3Bkb3duQm9yZGVyV2lkdGh9LCAwcmVtKSB2YXIoJHt0b2tlbnMuZHJvcGRvd25Cb3JkZXJDb2xvcn0sIHRyYW5zcGFyZW50KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBTY3JvbGxDb250YWluZXIgPSBzdHlsZWQuZGl2PHtcbiAgICBsaXN0TWF4SGVpZ2h0PzogU2VsZWN0UHJvcHNbJ2xpc3RNYXhIZWlnaHQnXTtcbn0+YFxuICAgIG1heC1oZWlnaHQ6ICR7KHsgbGlzdE1heEhlaWdodCB9KSA9PiBsaXN0TWF4SGVpZ2h0IHx8ICdhdXRvJ307XG4gICAgb3ZlcmZsb3cteDogaGlkZGVuO1xuICAgIG92ZXJmbG93LXk6IGF1dG87XG4gICAgYm9yZGVyLXJhZGl1czogY2FsYyh2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSkgLSAwLjEyNXJlbSAtIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLMkIifQ== */");
7
+ export var ScrollContainer = /*#__PURE__*/ styled("div", {
8
+ target: "evbtu0r1",
9
+ label: "ScrollContainer"
10
+ })("max-height:", function(param) {
11
+ var listMaxHeight = param.listMaxHeight;
12
+ return listMaxHeight || 'auto';
13
+ }, ";overflow-x:hidden;overflow-y:auto;border-radius:calc(var(", tokens.borderRadius, ") - 0.125rem - var(", tokens.dropdownBorderWidth, ",0rem));", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjLWVtb3Rpb24vY29tcG9uZW50cy9TZWxlY3QvdWkvVHJlZUxpc3QvVHJlZUxpc3Quc3R5bGVzLnRzIiwic291cmNlcyI6WyJzcmMtZW1vdGlvbi9jb21wb25lbnRzL1NlbGVjdC91aS9UcmVlTGlzdC9UcmVlTGlzdC5zdHlsZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgU2VsZWN0UHJvcHMgfSBmcm9tICdzcmMvY29tcG9uZW50cy9TZWxlY3QnO1xuXG5pbXBvcnQgeyBjb25zdGFudHMsIHRva2VucyB9IGZyb20gJy4uLy4uL1NlbGVjdC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgTGlzdFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmc6IGNhbGModmFyKCR7dG9rZW5zLnBhZGRpbmd9KSArIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuICAgIGJvcmRlci1yYWRpdXM6IHZhcigke3Rva2Vucy5ib3JkZXJSYWRpdXN9KTtcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGJhY2tncm91bmQ6IHZhcigke2NvbnN0YW50cy5iYWNrZ3JvdW5kfSk7XG4gICAgYm94LXNoYWRvdzogJHtjb25zdGFudHMuYm94U2hhZG93fSxcbiAgICAgICAgaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmRyb3Bkb3duQm9yZGVyV2lkdGh9LCAwcmVtKSB2YXIoJHt0b2tlbnMuZHJvcGRvd25Cb3JkZXJDb2xvcn0sIHRyYW5zcGFyZW50KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBTY3JvbGxDb250YWluZXIgPSBzdHlsZWQuZGl2PHtcbiAgICBsaXN0TWF4SGVpZ2h0PzogU2VsZWN0UHJvcHNbJ2xpc3RNYXhIZWlnaHQnXTtcbn0+YFxuICAgIG1heC1oZWlnaHQ6ICR7KHsgbGlzdE1heEhlaWdodCB9KSA9PiBsaXN0TWF4SGVpZ2h0IHx8ICdhdXRvJ307XG4gICAgb3ZlcmZsb3cteDogaGlkZGVuO1xuICAgIG92ZXJmbG93LXk6IGF1dG87XG4gICAgYm9yZGVyLXJhZGl1czogY2FsYyh2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSkgLSAwLjEyNXJlbSAtIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlK0IifQ== */");