@salutejs/plasma-new-hope 0.339.0-canary.2285.18499468890.0 → 0.339.0-canary.2286.18537184906.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 (204) 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 +42 -9
  5. package/cjs/components/Select/Select.js.map +1 -1
  6. package/cjs/components/Select/Select.tokens.js +3 -1
  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 +90 -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 +71 -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_j8xxg4.css +15 -0
  26. package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +89 -0
  27. package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js.map +1 -0
  28. package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +89 -0
  29. package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js.map +1 -0
  30. package/cjs/components/Table/Table.css +19 -0
  31. package/cjs/components/Table/ui/Cell/Cell.css +19 -0
  32. package/cjs/components/Table/ui/EditableCell/EditableCell.css +19 -0
  33. package/cjs/components/Table/ui/HeadCell/HeadCell.css +19 -0
  34. package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +19 -0
  35. package/cjs/components/Tree/utils/traverseTree.js +2 -23
  36. package/cjs/components/Tree/utils/traverseTree.js.map +1 -1
  37. package/cjs/index.css +19 -0
  38. package/cjs/index.js +2 -0
  39. package/cjs/index.js.map +1 -1
  40. package/cjs/utils/deepCopy.js +30 -0
  41. package/cjs/utils/deepCopy.js.map +1 -0
  42. package/cjs/utils/index.js.map +1 -1
  43. package/emotion/cjs/components/Select/Select.js +31 -6
  44. package/emotion/cjs/components/Select/Select.tokens.js +3 -1
  45. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +166 -0
  46. package/emotion/cjs/components/Select/hooks/usePathMaps.js +35 -3
  47. package/emotion/cjs/components/Select/reducers/index.js +1 -0
  48. package/emotion/cjs/components/Select/reducers/treePathReducer.js +98 -0
  49. package/emotion/cjs/components/Select/ui/TreeList/TreeList.js +124 -0
  50. package/emotion/cjs/components/Select/ui/TreeList/TreeList.styles.js +36 -0
  51. package/emotion/cjs/components/Select/ui/TreeList/TreeList.types.js +4 -0
  52. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.js +101 -0
  53. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +186 -0
  54. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.types.js +4 -0
  55. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +112 -0
  56. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +112 -0
  57. package/emotion/cjs/components/Select/ui/index.js +1 -0
  58. package/emotion/cjs/components/Tree/utils/traverseTree.js +2 -60
  59. package/emotion/cjs/examples/components/Select/Select.config.js +24 -24
  60. package/emotion/cjs/utils/deepCopy.js +82 -0
  61. package/emotion/cjs/utils/index.js +4 -0
  62. package/emotion/es/components/Select/Select.js +33 -8
  63. package/emotion/es/components/Select/Select.tokens.js +3 -1
  64. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +166 -0
  65. package/emotion/es/components/Select/hooks/usePathMaps.js +36 -4
  66. package/emotion/es/components/Select/reducers/index.js +1 -0
  67. package/emotion/es/components/Select/reducers/treePathReducer.js +81 -0
  68. package/emotion/es/components/Select/ui/TreeList/TreeList.js +73 -0
  69. package/emotion/es/components/Select/ui/TreeList/TreeList.styles.js +13 -0
  70. package/emotion/es/components/Select/ui/TreeList/TreeList.types.js +1 -0
  71. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.js +50 -0
  72. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +122 -0
  73. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.types.js +1 -0
  74. package/emotion/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +61 -0
  75. package/emotion/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +61 -0
  76. package/emotion/es/components/Select/ui/index.js +1 -0
  77. package/emotion/es/components/Tree/utils/traverseTree.js +1 -59
  78. package/emotion/es/examples/components/Select/Select.config.js +24 -24
  79. package/emotion/es/utils/deepCopy.js +72 -0
  80. package/emotion/es/utils/index.js +1 -0
  81. package/es/components/Pagination/Pagination.css +19 -0
  82. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +19 -0
  83. package/es/components/Select/Select.css +19 -0
  84. package/es/components/Select/Select.js +42 -9
  85. package/es/components/Select/Select.js.map +1 -1
  86. package/es/components/Select/Select.tokens.js +3 -1
  87. package/es/components/Select/Select.tokens.js.map +1 -1
  88. package/es/components/Select/hooks/useKeyboardNavigation.js +185 -1
  89. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  90. package/es/components/Select/hooks/usePathMaps.js +7 -3
  91. package/es/components/Select/hooks/usePathMaps.js.map +1 -1
  92. package/es/components/Select/reducers/treePathReducer.js +82 -0
  93. package/es/components/Select/reducers/treePathReducer.js.map +1 -0
  94. package/es/components/Select/ui/TreeList/TreeList.css +57 -0
  95. package/es/components/Select/ui/TreeList/TreeList.js +82 -0
  96. package/es/components/Select/ui/TreeList/TreeList.js.map +1 -0
  97. package/es/components/Select/ui/TreeList/TreeList.styles.js +25 -0
  98. package/es/components/Select/ui/TreeList/TreeList.styles.js.map +1 -0
  99. package/es/components/Select/ui/TreeList/TreeList.styles_1t38mek.css +2 -0
  100. package/es/components/Select/ui/TreeList/ui/Item/Item.css +54 -0
  101. package/es/components/Select/ui/TreeList/ui/Item/Item.js +63 -0
  102. package/es/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -0
  103. package/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +196 -0
  104. package/es/components/Select/ui/TreeList/ui/Item/Item.styles.js.map +1 -0
  105. package/es/components/Select/ui/TreeList/ui/Item/Item.styles_j8xxg4.css +15 -0
  106. package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +81 -0
  107. package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js.map +1 -0
  108. package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +81 -0
  109. package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js.map +1 -0
  110. package/es/components/Table/Table.css +19 -0
  111. package/es/components/Table/ui/Cell/Cell.css +19 -0
  112. package/es/components/Table/ui/EditableCell/EditableCell.css +19 -0
  113. package/es/components/Table/ui/HeadCell/HeadCell.css +19 -0
  114. package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +19 -0
  115. package/es/components/Tree/utils/traverseTree.js +2 -23
  116. package/es/components/Tree/utils/traverseTree.js.map +1 -1
  117. package/es/index.css +19 -0
  118. package/es/index.js +1 -0
  119. package/es/index.js.map +1 -1
  120. package/es/utils/deepCopy.js +26 -0
  121. package/es/utils/deepCopy.js.map +1 -0
  122. package/es/utils/index.js.map +1 -1
  123. package/package.json +2 -2
  124. package/styled-components/cjs/components/Select/Select.js +31 -6
  125. package/styled-components/cjs/components/Select/Select.tokens.js +3 -1
  126. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +166 -0
  127. package/styled-components/cjs/components/Select/hooks/usePathMaps.js +35 -3
  128. package/styled-components/cjs/components/Select/reducers/index.js +1 -0
  129. package/styled-components/cjs/components/Select/reducers/treePathReducer.js +98 -0
  130. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.js +124 -0
  131. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.styles.js +50 -0
  132. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.types.js +4 -0
  133. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.js +101 -0
  134. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.styles.js +300 -0
  135. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.types.js +4 -0
  136. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +112 -0
  137. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +112 -0
  138. package/styled-components/cjs/components/Select/ui/index.js +1 -0
  139. package/styled-components/cjs/components/Tree/utils/traverseTree.js +2 -60
  140. package/styled-components/cjs/examples/components/Select/Select.config.js +16 -8
  141. package/styled-components/cjs/utils/deepCopy.js +82 -0
  142. package/styled-components/cjs/utils/index.js +4 -0
  143. package/styled-components/es/components/Select/Select.js +33 -8
  144. package/styled-components/es/components/Select/Select.tokens.js +3 -1
  145. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +166 -0
  146. package/styled-components/es/components/Select/hooks/usePathMaps.js +36 -4
  147. package/styled-components/es/components/Select/reducers/index.js +1 -0
  148. package/styled-components/es/components/Select/reducers/treePathReducer.js +81 -0
  149. package/styled-components/es/components/Select/ui/TreeList/TreeList.js +73 -0
  150. package/styled-components/es/components/Select/ui/TreeList/TreeList.styles.js +27 -0
  151. package/styled-components/es/components/Select/ui/TreeList/TreeList.types.js +1 -0
  152. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.js +50 -0
  153. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.styles.js +236 -0
  154. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.types.js +1 -0
  155. package/styled-components/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +61 -0
  156. package/styled-components/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +61 -0
  157. package/styled-components/es/components/Select/ui/index.js +1 -0
  158. package/styled-components/es/components/Tree/utils/traverseTree.js +1 -59
  159. package/styled-components/es/examples/components/Select/Select.config.js +16 -8
  160. package/styled-components/es/utils/deepCopy.js +72 -0
  161. package/styled-components/es/utils/index.js +1 -0
  162. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +12 -0
  163. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts.map +1 -1
  164. package/types/components/Select/Select.d.ts.map +1 -1
  165. package/types/components/Select/Select.tokens.d.ts +2 -0
  166. package/types/components/Select/Select.tokens.d.ts.map +1 -1
  167. package/types/components/Select/Select.types.d.ts +26 -2
  168. package/types/components/Select/Select.types.d.ts.map +1 -1
  169. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +6 -2
  170. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  171. package/types/components/Select/hooks/usePathMaps.d.ts +2 -1
  172. package/types/components/Select/hooks/usePathMaps.d.ts.map +1 -1
  173. package/types/components/Select/reducers/index.d.ts +1 -0
  174. package/types/components/Select/reducers/index.d.ts.map +1 -1
  175. package/types/components/Select/reducers/treePathReducer.d.ts +14 -0
  176. package/types/components/Select/reducers/treePathReducer.d.ts.map +1 -0
  177. package/types/components/Select/ui/TreeList/TreeList.d.ts +4 -0
  178. package/types/components/Select/ui/TreeList/TreeList.d.ts.map +1 -0
  179. package/types/components/Select/ui/TreeList/TreeList.styles.d.ts +6 -0
  180. package/types/components/Select/ui/TreeList/TreeList.styles.d.ts.map +1 -0
  181. package/types/components/Select/ui/TreeList/TreeList.types.d.ts +9 -0
  182. package/types/components/Select/ui/TreeList/TreeList.types.d.ts.map +1 -0
  183. package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts +4 -0
  184. package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts.map +1 -0
  185. package/types/components/Select/ui/TreeList/ui/Item/Item.styles.d.ts +64 -0
  186. package/types/components/Select/ui/TreeList/ui/Item/Item.styles.d.ts.map +1 -0
  187. package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts +14 -0
  188. package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts.map +1 -0
  189. package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.d.ts +4 -0
  190. package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.d.ts.map +1 -0
  191. package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.d.ts +4 -0
  192. package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.d.ts.map +1 -0
  193. package/types/components/Select/ui/index.d.ts +1 -0
  194. package/types/components/Select/ui/index.d.ts.map +1 -1
  195. package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts +12 -0
  196. package/types/components/Table/ui/HeadCell/ui/Filter/Filter.styles.d.ts.map +1 -1
  197. package/types/components/Tree/utils/traverseTree.d.ts.map +1 -1
  198. package/types/examples/components/Select/Select.config.d.ts.map +1 -1
  199. package/types/examples/components/Select/Select.d.ts +12 -0
  200. package/types/examples/components/Select/Select.d.ts.map +1 -1
  201. package/types/utils/deepCopy.d.ts +2 -0
  202. package/types/utils/deepCopy.d.ts.map +1 -0
  203. package/types/utils/index.d.ts +1 -0
  204. package/types/utils/index.d.ts.map +1 -1
@@ -9,24 +9,55 @@ Object.defineProperty(exports, "usePathMaps", {
9
9
  }
10
10
  });
11
11
  var _utils = require("../../../utils");
12
+ function _array_like_to_array(arr, len) {
13
+ if (len == null || len > arr.length) len = arr.length;
14
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
15
+ return arr2;
16
+ }
17
+ function _array_without_holes(arr) {
18
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
19
+ }
20
+ function _iterable_to_array(iter) {
21
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
22
+ }
23
+ function _non_iterable_spread() {
24
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
25
+ }
26
+ function _to_consumable_array(arr) {
27
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
28
+ }
29
+ function _unsupported_iterable_to_array(o, minLen) {
30
+ if (!o) return;
31
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
32
+ var n = Object.prototype.toString.call(o).slice(8, -1);
33
+ if (n === "Object" && o.constructor) n = o.constructor.name;
34
+ if (n === "Map" || n === "Set") return Array.from(n);
35
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
36
+ }
12
37
  var usePathMaps = function(items) {
13
38
  var pathMap = new Map();
14
39
  var focusedToValueMap = new Map();
15
40
  var valueToCheckedMap = new Map();
16
41
  var valueToItemMap = new Map();
42
+ var valueToPathMap = new Map();
17
43
  pathMap.set('root', (items === null || items === void 0 ? void 0 : items.length) || 0);
18
44
  var rec = function(items) {
19
- var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
45
+ var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '', path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
20
46
  items === null || items === void 0 ? void 0 : items.forEach(function(item, index) {
21
47
  var value = item.value, innerItems = item.items;
22
48
  var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
23
49
  focusedToValueMap.set(currIndex, item);
24
50
  valueToCheckedMap.set(value, false);
51
+ valueToPathMap.set(value.toString(), _to_consumable_array(path).concat([
52
+ value.toString()
53
+ ]));
25
54
  if ((0, _utils.isEmpty)(innerItems) || !innerItems) {
26
55
  valueToItemMap.set(value, item);
27
56
  } else {
28
57
  pathMap.set(value, innerItems.length);
29
- rec(innerItems, currIndex);
58
+ rec(innerItems, currIndex, _to_consumable_array(path).concat([
59
+ value.toString()
60
+ ]));
30
61
  }
31
62
  });
32
63
  };
@@ -35,6 +66,7 @@ var usePathMaps = function(items) {
35
66
  pathMap,
36
67
  focusedToValueMap,
37
68
  valueToCheckedMap,
38
- valueToItemMap
69
+ valueToItemMap,
70
+ valueToPathMap
39
71
  ];
40
72
  };
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  _export_star(require("./pathReducer"), exports);
6
6
  _export_star(require("./focusedPathReducer"), exports);
7
+ _export_star(require("./treePathReducer"), exports);
7
8
  function _export_star(from, to) {
8
9
  Object.keys(from).forEach(function(k) {
9
10
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get keyExists () {
13
+ return keyExists;
14
+ },
15
+ get treePathReducer () {
16
+ return treePathReducer;
17
+ }
18
+ });
19
+ var _utils = require("../../../utils");
20
+ function _type_of(obj) {
21
+ "@swc/helpers - typeof";
22
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
23
+ }
24
+ var keyExists = function(obj, path) {
25
+ if ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object' || obj === null || !Array.isArray(path)) {
26
+ return false;
27
+ }
28
+ var current = obj;
29
+ for(var i = 0; i < path.length; i++){
30
+ var key = path[i];
31
+ if (current === null || (typeof current === "undefined" ? "undefined" : _type_of(current)) !== 'object' || !(key in current)) {
32
+ return false;
33
+ }
34
+ current = current[key];
35
+ }
36
+ return true;
37
+ };
38
+ function createObjectAtPath(obj, path) {
39
+ if ((typeof obj === "undefined" ? "undefined" : _type_of(obj)) !== 'object' || obj === null) {
40
+ return;
41
+ }
42
+ var current = obj;
43
+ for(var i = 0; i < path.length; i++){
44
+ var key = path[i];
45
+ if (i === path.length - 1) {
46
+ current[key] = {};
47
+ break;
48
+ }
49
+ if (current[key] === undefined || current[key] === null) {
50
+ current[key] = {};
51
+ }
52
+ current = current[key];
53
+ }
54
+ return obj;
55
+ }
56
+ function removeObjectAtPath(obj, path) {
57
+ if (path.length === 0) {
58
+ return obj;
59
+ }
60
+ var current = obj;
61
+ for(var i = 0; i < path.length; i++){
62
+ var key = path[i];
63
+ if (current === null || (typeof current === "undefined" ? "undefined" : _type_of(current)) !== 'object' || !(key in current)) {
64
+ return obj;
65
+ }
66
+ if (i === path.length - 1) {
67
+ delete current[key];
68
+ break;
69
+ }
70
+ current = current[key];
71
+ }
72
+ return obj;
73
+ }
74
+ function treePathReducer(state, action) {
75
+ switch(action.type){
76
+ case 'reset':
77
+ {
78
+ return {};
79
+ }
80
+ case 'toggled_level':
81
+ {
82
+ var stateCopy = (0, _utils.deepCopy)(state);
83
+ var isTargetLevelOpened = keyExists(stateCopy, action.value);
84
+ if (isTargetLevelOpened) {
85
+ // нужно закрыть текущий уровень
86
+ removeObjectAtPath(stateCopy, action.value);
87
+ } else {
88
+ // нужно открыть требуемый уровень
89
+ createObjectAtPath(stateCopy, action.value);
90
+ }
91
+ return stateCopy;
92
+ }
93
+ default:
94
+ {
95
+ return state;
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "TreeList", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return TreeList;
9
+ }
10
+ });
11
+ var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
+ var _reactvirtual = require("@tanstack/react-virtual");
13
+ var _utils = require("../../../../utils");
14
+ var _Item = require("./ui/Item/Item");
15
+ var _TreeListstyles = require("./TreeList.styles");
16
+ function _getRequireWildcardCache(nodeInterop) {
17
+ if (typeof WeakMap !== "function") return null;
18
+ var cacheBabelInterop = new WeakMap();
19
+ var cacheNodeInterop = new WeakMap();
20
+ return (_getRequireWildcardCache = function(nodeInterop) {
21
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
22
+ })(nodeInterop);
23
+ }
24
+ function _interop_require_wildcard(obj, nodeInterop) {
25
+ if (!nodeInterop && obj && obj.__esModule) {
26
+ return obj;
27
+ }
28
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
29
+ return {
30
+ default: obj
31
+ };
32
+ }
33
+ var cache = _getRequireWildcardCache(nodeInterop);
34
+ if (cache && cache.has(obj)) {
35
+ return cache.get(obj);
36
+ }
37
+ var newObj = {
38
+ __proto__: null
39
+ };
40
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
+ for(var key in obj){
42
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
43
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
44
+ if (desc && (desc.get || desc.set)) {
45
+ Object.defineProperty(newObj, key, desc);
46
+ } else {
47
+ newObj[key] = obj[key];
48
+ }
49
+ }
50
+ }
51
+ newObj.default = obj;
52
+ if (cache) {
53
+ cache.set(obj, newObj);
54
+ }
55
+ return newObj;
56
+ }
57
+ var TreeList = function(param) {
58
+ var items = param.items, listMaxHeight = param.listMaxHeight, onScroll = param.onScroll, virtual = param.virtual;
59
+ if (virtual) {
60
+ return /*#__PURE__*/ _react.default.createElement(VirtualTreeList, {
61
+ items: items,
62
+ listMaxHeight: listMaxHeight,
63
+ onScroll: onScroll
64
+ });
65
+ }
66
+ return /*#__PURE__*/ _react.default.createElement(_TreeListstyles.ListWrapper, null, /*#__PURE__*/ _react.default.createElement(_TreeListstyles.ScrollContainer, {
67
+ listMaxHeight: listMaxHeight,
68
+ onScroll: onScroll
69
+ }, items === null || items === void 0 ? void 0 : items.map(function(item, index) {
70
+ return /*#__PURE__*/ _react.default.createElement(_Item.Item, {
71
+ key: index,
72
+ index: index,
73
+ item: item
74
+ });
75
+ })));
76
+ };
77
+ var VirtualTreeList = function(param) {
78
+ var _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, listMaxHeight = param.listMaxHeight, onScroll = param.onScroll;
79
+ var _virtualItems_;
80
+ var parentRef = (0, _react.useRef)(null);
81
+ var virtualizer = (0, _reactvirtual.useVirtualizer)({
82
+ count: items.length,
83
+ getScrollElement: function() {
84
+ return parentRef.current;
85
+ },
86
+ estimateSize: function() {
87
+ return 48;
88
+ }
89
+ });
90
+ var virtualItems = virtualizer.getVirtualItems();
91
+ var _virtualItems__start;
92
+ return /*#__PURE__*/ _react.default.createElement(_TreeListstyles.ListWrapper, null, /*#__PURE__*/ _react.default.createElement("div", {
93
+ ref: parentRef,
94
+ style: {
95
+ height: 'auto',
96
+ maxHeight: (0, _utils.getHeightAsNumber)(listMaxHeight),
97
+ overflowY: 'auto'
98
+ },
99
+ onScroll: onScroll
100
+ }, /*#__PURE__*/ _react.default.createElement("div", {
101
+ style: {
102
+ height: virtualizer.getTotalSize(),
103
+ width: '100%',
104
+ position: 'relative'
105
+ }
106
+ }, /*#__PURE__*/ _react.default.createElement("div", {
107
+ style: {
108
+ position: 'absolute',
109
+ top: 0,
110
+ left: 0,
111
+ width: '100%',
112
+ 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)")
113
+ }
114
+ }, virtualItems.map(function(virtualRow) {
115
+ return /*#__PURE__*/ _react.default.createElement("div", {
116
+ key: virtualRow.key,
117
+ "data-index": virtualRow.index,
118
+ ref: virtualizer.measureElement
119
+ }, /*#__PURE__*/ _react.default.createElement(_Item.Item, {
120
+ item: items[virtualRow.index],
121
+ index: virtualRow.index
122
+ }));
123
+ })))));
124
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get ListWrapper () {
13
+ return ListWrapper;
14
+ },
15
+ get ScrollContainer () {
16
+ return ScrollContainer;
17
+ }
18
+ });
19
+ var _styled = /*#__PURE__*/ _interop_require_default(require("@emotion/styled"));
20
+ var _Selecttokens = require("../../Select.tokens");
21
+ function _interop_require_default(obj) {
22
+ return obj && obj.__esModule ? obj : {
23
+ default: obj
24
+ };
25
+ }
26
+ var ListWrapper = (0, /*#__PURE__*/ _styled.default)("div", {
27
+ target: "evbtu0r0",
28
+ label: "ListWrapper"
29
+ })("width:100%;padding:calc(var(", _Selecttokens.tokens.padding, ") + var(", _Selecttokens.tokens.dropdownBorderWidth, ",0rem));border-radius:var(", _Selecttokens.tokens.borderRadius, ");box-sizing:border-box;background:var(", _Selecttokens.constants.background, ");box-shadow:", _Selecttokens.constants.boxShadow, ",inset 0 0 0 var(", _Selecttokens.tokens.dropdownBorderWidth, ",0rem) var(", _Selecttokens.tokens.dropdownBorderColor, ",transparent);", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjLWVtb3Rpb24vY29tcG9uZW50cy9TZWxlY3QvdWkvVHJlZUxpc3QvVHJlZUxpc3Quc3R5bGVzLnRzIiwic291cmNlcyI6WyJzcmMtZW1vdGlvbi9jb21wb25lbnRzL1NlbGVjdC91aS9UcmVlTGlzdC9UcmVlTGlzdC5zdHlsZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgU2VsZWN0UHJvcHMgfSBmcm9tICdzcmMvY29tcG9uZW50cy9TZWxlY3QnO1xuXG5pbXBvcnQgeyBjb25zdGFudHMsIHRva2VucyB9IGZyb20gJy4uLy4uL1NlbGVjdC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgTGlzdFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmc6IGNhbGModmFyKCR7dG9rZW5zLnBhZGRpbmd9KSArIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuICAgIGJvcmRlci1yYWRpdXM6IHZhcigke3Rva2Vucy5ib3JkZXJSYWRpdXN9KTtcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGJhY2tncm91bmQ6IHZhcigke2NvbnN0YW50cy5iYWNrZ3JvdW5kfSk7XG4gICAgYm94LXNoYWRvdzogJHtjb25zdGFudHMuYm94U2hhZG93fSxcbiAgICAgICAgaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmRyb3Bkb3duQm9yZGVyV2lkdGh9LCAwcmVtKSB2YXIoJHt0b2tlbnMuZHJvcGRvd25Cb3JkZXJDb2xvcn0sIHRyYW5zcGFyZW50KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBTY3JvbGxDb250YWluZXIgPSBzdHlsZWQuZGl2PHtcbiAgICBsaXN0TWF4SGVpZ2h0PzogU2VsZWN0UHJvcHNbJ2xpc3RNYXhIZWlnaHQnXTtcbn0+YFxuICAgIG1heC1oZWlnaHQ6ICR7KHsgbGlzdE1heEhlaWdodCB9KSA9PiBsaXN0TWF4SGVpZ2h0IHx8ICdhdXRvJ307XG4gICAgb3ZlcmZsb3cteDogaGlkZGVuO1xuICAgIG92ZXJmbG93LXk6IGF1dG87XG4gICAgYm9yZGVyLXJhZGl1czogY2FsYyh2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSkgLSAwLjEyNXJlbSAtIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLMkIifQ== */");
30
+ var ScrollContainer = (0, /*#__PURE__*/ _styled.default)("div", {
31
+ target: "evbtu0r1",
32
+ label: "ScrollContainer"
33
+ })("max-height:", function(param) {
34
+ var listMaxHeight = param.listMaxHeight;
35
+ return listMaxHeight || 'auto';
36
+ }, ";overflow-x:hidden;overflow-y:auto;border-radius:calc(var(", _Selecttokens.tokens.borderRadius, ") - 0.125rem - var(", _Selecttokens.tokens.dropdownBorderWidth, ",0rem));", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjLWVtb3Rpb24vY29tcG9uZW50cy9TZWxlY3QvdWkvVHJlZUxpc3QvVHJlZUxpc3Quc3R5bGVzLnRzIiwic291cmNlcyI6WyJzcmMtZW1vdGlvbi9jb21wb25lbnRzL1NlbGVjdC91aS9UcmVlTGlzdC9UcmVlTGlzdC5zdHlsZXMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgU2VsZWN0UHJvcHMgfSBmcm9tICdzcmMvY29tcG9uZW50cy9TZWxlY3QnO1xuXG5pbXBvcnQgeyBjb25zdGFudHMsIHRva2VucyB9IGZyb20gJy4uLy4uL1NlbGVjdC50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgTGlzdFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAxMDAlO1xuICAgIHBhZGRpbmc6IGNhbGModmFyKCR7dG9rZW5zLnBhZGRpbmd9KSArIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuICAgIGJvcmRlci1yYWRpdXM6IHZhcigke3Rva2Vucy5ib3JkZXJSYWRpdXN9KTtcbiAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgIGJhY2tncm91bmQ6IHZhcigke2NvbnN0YW50cy5iYWNrZ3JvdW5kfSk7XG4gICAgYm94LXNoYWRvdzogJHtjb25zdGFudHMuYm94U2hhZG93fSxcbiAgICAgICAgaW5zZXQgMCAwIDAgdmFyKCR7dG9rZW5zLmRyb3Bkb3duQm9yZGVyV2lkdGh9LCAwcmVtKSB2YXIoJHt0b2tlbnMuZHJvcGRvd25Cb3JkZXJDb2xvcn0sIHRyYW5zcGFyZW50KTtcbmA7XG5cbmV4cG9ydCBjb25zdCBTY3JvbGxDb250YWluZXIgPSBzdHlsZWQuZGl2PHtcbiAgICBsaXN0TWF4SGVpZ2h0PzogU2VsZWN0UHJvcHNbJ2xpc3RNYXhIZWlnaHQnXTtcbn0+YFxuICAgIG1heC1oZWlnaHQ6ICR7KHsgbGlzdE1heEhlaWdodCB9KSA9PiBsaXN0TWF4SGVpZ2h0IHx8ICdhdXRvJ307XG4gICAgb3ZlcmZsb3cteDogaGlkZGVuO1xuICAgIG92ZXJmbG93LXk6IGF1dG87XG4gICAgYm9yZGVyLXJhZGl1czogY2FsYyh2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSkgLSAwLjEyNXJlbSAtIHZhcigke3Rva2Vucy5kcm9wZG93bkJvcmRlcldpZHRofSwgMHJlbSkpO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlK0IifQ== */");
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Item", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return Item;
9
+ }
10
+ });
11
+ var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
+ var _treePathReducer = require("../../../../reducers/treePathReducer");
13
+ var _Selectcontext = require("../../../../Select.context");
14
+ var _ItemArrowLeft = require("./ui/ItemArrowLeft/ItemArrowLeft");
15
+ var _ItemArrowRight = require("./ui/ItemArrowRight/ItemArrowRight");
16
+ var _Itemstyles = require("./Item.styles");
17
+ function _getRequireWildcardCache(nodeInterop) {
18
+ if (typeof WeakMap !== "function") return null;
19
+ var cacheBabelInterop = new WeakMap();
20
+ var cacheNodeInterop = new WeakMap();
21
+ return (_getRequireWildcardCache = function(nodeInterop) {
22
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
23
+ })(nodeInterop);
24
+ }
25
+ function _interop_require_wildcard(obj, nodeInterop) {
26
+ if (!nodeInterop && obj && obj.__esModule) {
27
+ return obj;
28
+ }
29
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
30
+ return {
31
+ default: obj
32
+ };
33
+ }
34
+ var cache = _getRequireWildcardCache(nodeInterop);
35
+ if (cache && cache.has(obj)) {
36
+ return cache.get(obj);
37
+ }
38
+ var newObj = {
39
+ __proto__: null
40
+ };
41
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
42
+ for(var key in obj){
43
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
44
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
45
+ if (desc && (desc.get || desc.set)) {
46
+ Object.defineProperty(newObj, key, desc);
47
+ } else {
48
+ newObj[key] = obj[key];
49
+ }
50
+ }
51
+ }
52
+ newObj.default = obj;
53
+ if (cache) {
54
+ cache.set(obj, newObj);
55
+ }
56
+ return newObj;
57
+ }
58
+ var Item = function(param) {
59
+ var item = param.item, index = param.index;
60
+ var _item_items;
61
+ var value = item.value, disabled = item.disabled, isDisabled = item.isDisabled;
62
+ var isLeaf = !(item === null || item === void 0 ? void 0 : item.items);
63
+ var _useContext = (0, _react.useContext)(_Selectcontext.Context), treePath = _useContext.treePath, dispatchTreePath = _useContext.dispatchTreePath, arrowPlacement = _useContext.arrowPlacement, handleItemClick = _useContext.handleItemClick, handleCheckboxChange = _useContext.handleCheckboxChange, valueToPathMap = _useContext.valueToPathMap;
64
+ var isCurrentLevelOpened = (0, _treePathReducer.keyExists)(treePath, valueToPathMap.get(value.toString()) || []);
65
+ var itemDisabled = Boolean(disabled || isDisabled);
66
+ var handleClick = function(e) {
67
+ if (!isLeaf) {
68
+ dispatchTreePath({
69
+ type: 'toggled_level',
70
+ value: valueToPathMap.get(value.toString()) || []
71
+ });
72
+ }
73
+ if (handleItemClick) {
74
+ handleItemClick(item, e);
75
+ }
76
+ };
77
+ var handleChange = function(e) {
78
+ if (itemDisabled) return;
79
+ e.stopPropagation();
80
+ handleCheckboxChange(item);
81
+ };
82
+ return /*#__PURE__*/ _react.default.createElement(_Itemstyles.ItemWrapper, null, arrowPlacement === 'left' ? /*#__PURE__*/ _react.default.createElement(_ItemArrowLeft.ItemArrowLeft, {
83
+ item: item,
84
+ onClick: handleClick,
85
+ onChange: handleChange,
86
+ isCurrentLevelOpened: isCurrentLevelOpened,
87
+ index: index
88
+ }) : /*#__PURE__*/ _react.default.createElement(_ItemArrowRight.ItemArrowRight, {
89
+ item: item,
90
+ onClick: handleClick,
91
+ onChange: handleChange,
92
+ isCurrentLevelOpened: isCurrentLevelOpened,
93
+ index: index
94
+ }), !isLeaf && isCurrentLevelOpened && /*#__PURE__*/ _react.default.createElement(_Itemstyles.ChildItems, null, (_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items.map(function(item, index) {
95
+ return /*#__PURE__*/ _react.default.createElement(Item, {
96
+ item: item,
97
+ index: index,
98
+ key: index
99
+ });
100
+ })));
101
+ };