@hh.ru/magritte-ui-tree-selector 5.5.80 → 5.5.82

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 (86) hide show
  1. package/Action.d.ts +1 -1
  2. package/Action.js +15 -12
  3. package/Action.js.map +1 -1
  4. package/Item.d.ts +3 -3
  5. package/Item.js +106 -54
  6. package/Item.js.map +1 -1
  7. package/ItemContent.d.ts +2 -2
  8. package/ItemContent.js +69 -15
  9. package/ItemContent.js.map +1 -1
  10. package/ItemsList.d.ts +3 -3
  11. package/ItemsList.js +243 -159
  12. package/ItemsList.js.map +1 -1
  13. package/MobileDelimiter.js +1 -1
  14. package/MobileDelimiter.js.map +1 -1
  15. package/MobileItem.d.ts +2 -2
  16. package/MobileItem.js +26 -5
  17. package/MobileItem.js.map +1 -1
  18. package/MobileItemsList.d.ts +2 -2
  19. package/MobileItemsList.js +259 -132
  20. package/MobileItemsList.js.map +1 -1
  21. package/MobileParentItem.d.ts +3 -3
  22. package/MobileParentItem.js +33 -14
  23. package/MobileParentItem.js.map +1 -1
  24. package/TreeSelector.d.ts +2 -2
  25. package/TreeSelector.js +49 -20
  26. package/TreeSelector.js.map +1 -1
  27. package/TreeSelectorDummy.d.ts +2 -2
  28. package/TreeSelectorDummy.js +178 -109
  29. package/TreeSelectorDummy.js.map +1 -1
  30. package/TreeSelectorItemBase.d.ts +2 -2
  31. package/TreeSelectorItemBase.js +12 -6
  32. package/TreeSelectorItemBase.js.map +1 -1
  33. package/TreeSelectorWrapper.js +38 -24
  34. package/TreeSelectorWrapper.js.map +1 -1
  35. package/collection/treeCollection.d.ts +1 -1
  36. package/collection/treeCollection.js +178 -184
  37. package/collection/treeCollection.js.map +1 -1
  38. package/collection/treeCollectionHelper.d.ts +9 -3
  39. package/collection/treeCollectionHelper.js +68 -105
  40. package/collection/treeCollectionHelper.js.map +1 -1
  41. package/collection/types.d.ts +1 -1
  42. package/index.css +45 -45
  43. package/index.d.ts +9 -9
  44. package/index.js +1 -1
  45. package/index.mock.d.ts +6 -6
  46. package/index.mock.js +14 -6
  47. package/index.mock.js.map +1 -1
  48. package/package.json +23 -22
  49. package/strategy/createSingleValueToggler.d.ts +1 -1
  50. package/strategy/createSingleValueToggler.js +17 -41
  51. package/strategy/createSingleValueToggler.js.map +1 -1
  52. package/strategy/createTreeCollectionToggler.d.ts +3 -3
  53. package/strategy/createTreeCollectionToggler.js +42 -58
  54. package/strategy/createTreeCollectionToggler.js.map +1 -1
  55. package/strategy/dummyToggle.d.ts +1 -1
  56. package/strategy/dummyToggle.js +10 -13
  57. package/strategy/dummyToggle.js.map +1 -1
  58. package/strategy/immutableSelectionStrategy.d.ts +3 -3
  59. package/strategy/immutableSelectionStrategy.js +27 -26
  60. package/strategy/immutableSelectionStrategy.js.map +1 -1
  61. package/strategy/selectionStrategy.d.ts +3 -3
  62. package/strategy/selectionStrategy.js +47 -56
  63. package/strategy/selectionStrategy.js.map +1 -1
  64. package/strategy/types.d.ts +1 -1
  65. package/tree-selector-item-BYBFlI_G.js +5 -0
  66. package/tree-selector-item-BYBFlI_G.js.map +1 -0
  67. package/types.d.ts +2 -2
  68. package/useAnimationTimeout.js +14 -14
  69. package/useAnimationTimeout.js.map +1 -1
  70. package/useDisabled.d.ts +2 -2
  71. package/useDisabled.js +7 -10
  72. package/useDisabled.js.map +1 -1
  73. package/useExpanded.d.ts +2 -2
  74. package/useExpanded.js +65 -54
  75. package/useExpanded.js.map +1 -1
  76. package/useIndeterminate.d.ts +2 -2
  77. package/useIndeterminate.js +17 -18
  78. package/useIndeterminate.js.map +1 -1
  79. package/useRenderInput.d.ts +1 -1
  80. package/useRenderInput.js +44 -32
  81. package/useRenderInput.js.map +1 -1
  82. package/useSelected.d.ts +3 -3
  83. package/useSelected.js +36 -31
  84. package/useSelected.js.map +1 -1
  85. package/tree-selector-item-BOEDcwrO.js +0 -5
  86. package/tree-selector-item-BOEDcwrO.js.map +0 -1
@@ -1,122 +1,85 @@
1
1
  import './../index.css';
2
- import TreeCollection from './treeCollection.js';
2
+ import treeCollection_default from './treeCollection.js';
3
3
 
4
- /**
5
- * Рекурсивно проходит по списку моделей, применяет к каждой модели переданную функцию.
6
- */
7
- const walk = (
8
- /** Дерево для обработки. */
9
- tree,
10
- /** Вызываемая функция. */
11
- callback,
12
- /** Массив моделей родителей от ближнего к дальнему. */
13
- parents) => {
14
- const currentParents = parents ? parents.slice() : [];
15
- tree.forEach((item) => {
16
- callback(item, currentParents);
17
- if (item.items && item.items.length) {
18
- walk(item.items, callback, [item].concat(currentParents));
19
- }
20
- });
4
+ const walk = (tree, callback, parents) => {
5
+ const currentParents = parents ? parents.slice() : [];
6
+ tree.forEach((item) => {
7
+ callback(item, currentParents);
8
+ if (item.items && item.items.length) {
9
+ walk(item.items, callback, [item].concat(currentParents));
10
+ }
11
+ });
21
12
  };
22
- /**
23
- * Возвращает коллекцию, созданную из дерева.
24
- * @param tree
25
- * @param [callback] Функция, вызываемая на каждом элементе.
26
- */
27
13
  const fromTree = (tree, callback) => {
28
- const collection = new TreeCollection();
29
- walk(tree, (item, parents) => {
30
- if (typeof callback === 'function') {
31
- callback(item, parents);
32
- }
33
- collection.addModel(item, parents.length ? parents[0].id : undefined);
34
- });
35
- return collection;
14
+ const collection = new treeCollection_default();
15
+ walk(tree, (item, parents) => {
16
+ if (typeof callback === "function") {
17
+ callback(item, parents);
18
+ }
19
+ collection.addModel(item, parents.length ? parents[0].id : void 0);
20
+ });
21
+ return collection;
36
22
  };
37
- /**
38
- * Возвращает только те ID, которые присутствуют в коллекции
39
- */
40
23
  const filterMissingIds = (collection, ids) => {
41
- const filteredIds = [];
42
- ids.forEach((id) => {
43
- if (collection.getModel(id)) {
44
- filteredIds.push(id);
45
- }
46
- });
47
- return filteredIds;
24
+ const filteredIds = [];
25
+ ids.forEach((id) => {
26
+ if (collection.getModel(id)) {
27
+ filteredIds.push(id);
28
+ }
29
+ });
30
+ return filteredIds;
48
31
  };
49
- /**
50
- * Возвращает ID только тех элементов, у которых нет потомков.
51
- */
52
32
  const filterParents = (collection, ids) => {
53
- return ids.filter((id) => {
54
- return collection.getChildrenIds(id).length === 0;
55
- });
33
+ return ids.filter((id) => {
34
+ return collection.getChildrenIds(id).length === 0;
35
+ });
56
36
  };
57
- /**
58
- * Возвращает новую коллекцию, содержащую элементы, для которых `filterFunction` вернула true.
59
- * Если заматчился дочерний элемент, к результатам добавляются его родители до самого верха.
60
- * Если заматчился родитель, к результатам НЕ добавляются его дочерние элементы (кроме тех,
61
- * что тоже заматчились).
62
- */
63
37
  const filterWithParents = (collection, filterFunction, isMobile) => {
64
- const filteredCollection = new collection.constructor();
65
- const ids = new Set();
66
- collection.walk((model, parents) => {
67
- if (filterFunction(model)) {
68
- ids.add(model.id);
69
- if (!isMobile) {
70
- parents.forEach((parent) => {
71
- ids.add(parent.id);
72
- });
73
- }
74
- }
75
- });
76
- ids.forEach((id) => {
77
- const model = collection.getModel(id);
78
- if (model) {
79
- // В модели с дубликатами у элемента может быть несколько родителей
80
- const parentIds = collection.getParentIdsDuplicates(model.id);
81
- if (parentIds.length && !isMobile) {
82
- parentIds.forEach((parendId) => {
83
- filteredCollection.addModel({ ...model }, parendId);
84
- });
85
- }
86
- else {
87
- filteredCollection.addModel({ ...model });
88
- }
89
- }
90
- });
91
- return filteredCollection;
38
+ const filteredCollection = new collection.constructor();
39
+ const ids = /* @__PURE__ */ new Set();
40
+ collection.walk((model, parents) => {
41
+ if (filterFunction(model)) {
42
+ ids.add(model.id);
43
+ if (!isMobile) {
44
+ parents.forEach((parent) => {
45
+ ids.add(parent.id);
46
+ });
47
+ }
48
+ }
49
+ });
50
+ ids.forEach((id) => {
51
+ const model = collection.getModel(id);
52
+ if (model) {
53
+ const parentIds = collection.getParentIdsDuplicates(model.id);
54
+ if (parentIds.length && !isMobile) {
55
+ parentIds.forEach((parendId) => {
56
+ filteredCollection.addModel({ ...model }, parendId);
57
+ });
58
+ } else {
59
+ filteredCollection.addModel({ ...model });
60
+ }
61
+ }
62
+ });
63
+ return filteredCollection;
92
64
  };
93
- /**
94
- * Возвращает новую коллекцию, содержащую уникальные элементы самого нижнего уровня,
95
- * для которых `filterFunction` вернула true (плоский список).
96
- */
97
65
  const filterUniqueLeavesOnly = (collection, filterFunction) => {
98
- const filteredCollection = new TreeCollection();
99
- collection.walk((model) => {
100
- if (!filteredCollection.getModel(model.id) && !collection.hasChildren(model.id) && filterFunction(model)) {
101
- filteredCollection.addModel({ ...model });
102
- }
103
- });
104
- return filteredCollection;
66
+ const filteredCollection = new treeCollection_default();
67
+ collection.walk((model) => {
68
+ if (!filteredCollection.getModel(model.id) && !collection.hasChildren(model.id) && filterFunction(model)) {
69
+ filteredCollection.addModel({ ...model });
70
+ }
71
+ });
72
+ return filteredCollection;
105
73
  };
106
- /**
107
- * Возвращает элементы из списка, родители которых отсутствуют в этом же списке.
108
- * Полезно для определения минимального набора выбранных элементов (если выбран родитель
109
- * целиком, игнорируем его дочерние элементы)
110
- */
111
74
  const getIdsWithNoParentsInSameList = (collection, ids) => {
112
- const hasChildrenHash = ids.reduce((result, id) => {
113
- result[id] = collection.getChildren(id).length > 0;
114
- return result;
115
- }, {});
116
- return ids.filter((id) => {
117
- const parentIds = collection.getParentIdsDuplicates(id);
118
- return !parentIds.some((id) => hasChildrenHash.hasOwnProperty(id) && hasChildrenHash[id]);
119
- });
75
+ const hasChildrenHash = ids.reduce((result, id) => {
76
+ result[id] = collection.getChildren(id).length > 0;
77
+ return result;
78
+ }, {});
79
+ return ids.filter((id) => {
80
+ const parentIds = collection.getParentIdsDuplicates(id);
81
+ return !parentIds.some((id2) => hasChildrenHash.hasOwnProperty(id2) && hasChildrenHash[id2]);
82
+ });
120
83
  };
121
84
 
122
85
  export { filterMissingIds, filterParents, filterUniqueLeavesOnly, filterWithParents, fromTree, getIdsWithNoParentsInSameList, walk };
@@ -1 +1 @@
1
- {"version":3,"file":"treeCollectionHelper.js","sources":["src/collection/treeCollectionHelper.ts"],"sourcesContent":["import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport {\n AdditionalDefault,\n WalkCallback,\n ModelData,\n TreeFilter,\n TreeModel,\n} from '@hh.ru/magritte-ui-tree-selector/collection/types';\n\n/**\n * Рекурсивно проходит по списку моделей, применяет к каждой модели переданную функцию.\n */\nexport const walk = <Additional extends AdditionalDefault>(\n /** Дерево для обработки. */\n tree: ModelData<Additional>[],\n /** Вызываемая функция. */\n callback: WalkCallback<Additional>,\n /** Массив моделей родителей от ближнего к дальнему. */\n parents?: ModelData<Additional>[]\n): void => {\n const currentParents = parents ? parents.slice() : [];\n tree.forEach((item) => {\n callback(item, currentParents);\n if (item.items && item.items.length) {\n walk(item.items, callback, [item].concat(currentParents));\n }\n });\n};\n\n/**\n * Возвращает коллекцию, созданную из дерева.\n * @param tree\n * @param [callback] Функция, вызываемая на каждом элементе.\n */\nexport const fromTree = <Additional extends AdditionalDefault = never>(\n tree: ModelData<Additional>[],\n callback?: WalkCallback<Additional>\n): TreeCollection<Additional> => {\n const collection = new TreeCollection<Additional>();\n walk(tree, (item, parents): void => {\n if (typeof callback === 'function') {\n callback(item, parents);\n }\n collection.addModel(item, parents.length ? parents[0].id : undefined);\n });\n return collection;\n};\n\n/**\n * Возвращает только те ID, которые присутствуют в коллекции\n */\nexport const filterMissingIds = <Additional extends AdditionalDefault>(\n collection: TreeCollection<Additional>,\n ids: string[]\n): string[] => {\n const filteredIds: string[] = [];\n ids.forEach((id) => {\n if (collection.getModel(id)) {\n filteredIds.push(id);\n }\n });\n return filteredIds;\n};\n\n/**\n * Возвращает ID только тех элементов, у которых нет потомков.\n */\nexport const filterParents = <Additional extends AdditionalDefault>(\n collection: TreeCollection<Additional>,\n ids: string[]\n): string[] => {\n return ids.filter((id) => {\n return collection.getChildrenIds(id).length === 0;\n });\n};\n\n/**\n * Возвращает новую коллекцию, содержащую элементы, для которых `filterFunction` вернула true.\n * Если заматчился дочерний элемент, к результатам добавляются его родители до самого верха.\n * Если заматчился родитель, к результатам НЕ добавляются его дочерние элементы (кроме тех,\n * что тоже заматчились).\n */\nexport const filterWithParents: TreeFilter = (collection, filterFunction, isMobile) => {\n const filteredCollection: typeof collection = new (collection.constructor as typeof TreeCollection)();\n const ids = new Set<TreeModel['id']>();\n collection.walk((model, parents) => {\n if (filterFunction(model)) {\n ids.add(model.id);\n if (!isMobile) {\n parents.forEach((parent) => {\n ids.add(parent.id);\n });\n }\n }\n });\n ids.forEach((id) => {\n const model = collection.getModel(id);\n if (model) {\n // В модели с дубликатами у элемента может быть несколько родителей\n const parentIds = collection.getParentIdsDuplicates(model.id);\n if (parentIds.length && !isMobile) {\n parentIds.forEach((parendId) => {\n filteredCollection.addModel({ ...model }, parendId);\n });\n } else {\n filteredCollection.addModel({ ...model });\n }\n }\n });\n return filteredCollection;\n};\n\n/**\n * Возвращает новую коллекцию, содержащую уникальные элементы самого нижнего уровня,\n * для которых `filterFunction` вернула true (плоский список).\n */\nexport const filterUniqueLeavesOnly: TreeFilter = (collection, filterFunction) => {\n const filteredCollection: typeof collection = new TreeCollection();\n collection.walk((model) => {\n if (!filteredCollection.getModel(model.id) && !collection.hasChildren(model.id) && filterFunction(model)) {\n filteredCollection.addModel({ ...model });\n }\n });\n return filteredCollection;\n};\n\n/**\n * Возвращает элементы из списка, родители которых отсутствуют в этом же списке.\n * Полезно для определения минимального набора выбранных элементов (если выбран родитель\n * целиком, игнорируем его дочерние элементы)\n */\nexport const getIdsWithNoParentsInSameList = <Additional extends AdditionalDefault>(\n collection: TreeCollection<Additional>,\n ids: string[]\n): string[] => {\n const hasChildrenHash = ids.reduce((result: Record<string, boolean>, id) => {\n result[id] = collection.getChildren(id).length > 0;\n return result;\n }, {});\n\n return ids.filter((id) => {\n const parentIds = collection.getParentIdsDuplicates(id);\n return !parentIds.some((id) => hasChildrenHash.hasOwnProperty(id) && hasChildrenHash[id]);\n });\n};\n"],"names":[],"mappings":";;AASA;;AAEG;AACU,MAAA,IAAI,GAAG;AAChB;AACA,IAA6B;AA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CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,eAAe,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9F,KAAC,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"treeCollectionHelper.js","sources":["src/collection/treeCollectionHelper.ts"],"sourcesContent":["import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport {\n AdditionalDefault,\n WalkCallback,\n ModelData,\n TreeFilter,\n TreeModel,\n} from '@hh.ru/magritte-ui-tree-selector/collection/types';\n\n/**\n * Рекурсивно проходит по списку моделей, применяет к каждой модели переданную функцию.\n */\nexport const walk = <Additional extends AdditionalDefault>(\n /** Дерево для обработки. */\n tree: ModelData<Additional>[],\n /** Вызываемая функция. */\n callback: WalkCallback<Additional>,\n /** Массив моделей родителей от ближнего к дальнему. */\n parents?: ModelData<Additional>[]\n): void => {\n const currentParents = parents ? parents.slice() : [];\n tree.forEach((item) => {\n callback(item, currentParents);\n if (item.items && item.items.length) {\n walk(item.items, callback, [item].concat(currentParents));\n }\n });\n};\n\n/**\n * Возвращает коллекцию, созданную из дерева.\n * @param tree\n * @param [callback] Функция, вызываемая на каждом элементе.\n */\nexport const fromTree = <Additional extends AdditionalDefault = never>(\n tree: ModelData<Additional>[],\n callback?: WalkCallback<Additional>\n): TreeCollection<Additional> => {\n const collection = new TreeCollection<Additional>();\n walk(tree, (item, parents): void => {\n if (typeof callback === 'function') {\n callback(item, parents);\n }\n collection.addModel(item, parents.length ? parents[0].id : undefined);\n });\n return collection;\n};\n\n/**\n * Возвращает только те ID, которые присутствуют в коллекции\n */\nexport const filterMissingIds = <Additional extends AdditionalDefault>(\n collection: TreeCollection<Additional>,\n ids: string[]\n): string[] => {\n const filteredIds: string[] = [];\n ids.forEach((id) => {\n if (collection.getModel(id)) {\n filteredIds.push(id);\n }\n });\n return filteredIds;\n};\n\n/**\n * Возвращает ID только тех элементов, у которых нет потомков.\n */\nexport const filterParents = <Additional extends AdditionalDefault>(\n collection: TreeCollection<Additional>,\n ids: string[]\n): string[] => {\n return ids.filter((id) => {\n return collection.getChildrenIds(id).length === 0;\n });\n};\n\n/**\n * Возвращает новую коллекцию, содержащую элементы, для которых `filterFunction` вернула true.\n * Если заматчился дочерний элемент, к результатам добавляются его родители до самого верха.\n * Если заматчился родитель, к результатам НЕ добавляются его дочерние элементы (кроме тех,\n * что тоже заматчились).\n */\nexport const filterWithParents: TreeFilter = (collection, filterFunction, isMobile) => {\n const filteredCollection: typeof collection = new (collection.constructor as typeof TreeCollection)();\n const ids = new Set<TreeModel['id']>();\n collection.walk((model, parents) => {\n if (filterFunction(model)) {\n ids.add(model.id);\n if (!isMobile) {\n parents.forEach((parent) => {\n ids.add(parent.id);\n });\n }\n }\n });\n ids.forEach((id) => {\n const model = collection.getModel(id);\n if (model) {\n // В модели с дубликатами у элемента может быть несколько родителей\n const parentIds = collection.getParentIdsDuplicates(model.id);\n if (parentIds.length && !isMobile) {\n parentIds.forEach((parendId) => {\n filteredCollection.addModel({ ...model }, parendId);\n });\n } else {\n filteredCollection.addModel({ ...model });\n }\n }\n });\n return filteredCollection;\n};\n\n/**\n * Возвращает новую коллекцию, содержащую уникальные элементы самого нижнего уровня,\n * для которых `filterFunction` вернула true (плоский список).\n */\nexport const filterUniqueLeavesOnly: TreeFilter = (collection, filterFunction) => {\n const filteredCollection: typeof collection = new TreeCollection();\n collection.walk((model) => {\n if (!filteredCollection.getModel(model.id) && !collection.hasChildren(model.id) && filterFunction(model)) {\n filteredCollection.addModel({ ...model });\n }\n });\n return filteredCollection;\n};\n\n/**\n * Возвращает элементы из списка, родители которых отсутствуют в этом же списке.\n * Полезно для определения минимального набора выбранных элементов (если выбран родитель\n * целиком, игнорируем его дочерние элементы)\n */\nexport const getIdsWithNoParentsInSameList = <Additional extends AdditionalDefault>(\n collection: TreeCollection<Additional>,\n ids: string[]\n): string[] => {\n const hasChildrenHash = ids.reduce((result: Record<string, boolean>, id) => {\n result[id] = collection.getChildren(id).length > 0;\n return result;\n }, {});\n\n return ids.filter((id) => {\n const parentIds = collection.getParentIdsDuplicates(id);\n return !parentIds.some((id) => hasChildrenHash.hasOwnProperty(id) && hasChildrenHash[id]);\n });\n};\n"],"names":["TreeCollection","id"],"mappings":";;AAYO,MAAM,IAAO,GAAA,CAEhB,IAEA,EAAA,QAAA,EAEA,OACO,KAAA;AACP,EAAA,MAAM,cAAiB,GAAA,OAAA,GAAU,OAAQ,CAAA,KAAA,KAAU,EAAC,CAAA;AACpD,EAAK,IAAA,CAAA,OAAA,CAAQ,CAAC,IAAS,KAAA;AACnB,IAAA,QAAA,CAAS,MAAM,cAAc,CAAA,CAAA;AAC7B,IAAA,IAAI,IAAK,CAAA,KAAA,IAAS,IAAK,CAAA,KAAA,CAAM,MAAQ,EAAA;AACjC,MAAK,IAAA,CAAA,IAAA,CAAK,OAAO,QAAU,EAAA,CAAC,IAAI,CAAE,CAAA,MAAA,CAAO,cAAc,CAAC,CAAA,CAAA;AAAA,KAC5D;AAAA,GACH,CAAA,CAAA;AACL,EAAA;AAOa,MAAA,QAAA,GAAW,CACpB,IAAA,EACA,QAC6B,KAAA;AAC7B,EAAM,MAAA,UAAA,GAAa,IAAIA,sBAA2B,EAAA,CAAA;AAClD,EAAK,IAAA,CAAA,IAAA,EAAM,CAAC,IAAA,EAAM,OAAkB,KAAA;AAChC,IAAI,IAAA,OAAO,aAAa,UAAY,EAAA;AAChC,MAAA,QAAA,CAAS,MAAM,OAAO,CAAA,CAAA;AAAA,KAC1B;AACA,IAAW,UAAA,CAAA,QAAA,CAAS,MAAM,OAAQ,CAAA,MAAA,GAAS,QAAQ,CAAC,CAAA,CAAE,KAAK,KAAS,CAAA,CAAA,CAAA;AAAA,GACvE,CAAA,CAAA;AACD,EAAO,OAAA,UAAA,CAAA;AACX,EAAA;AAKa,MAAA,gBAAA,GAAmB,CAC5B,UAAA,EACA,GACW,KAAA;AACX,EAAA,MAAM,cAAwB,EAAC,CA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AAA;AAAA,GACX,EAAG,EAAE,CAAA,CAAA;AAEL,EAAO,OAAA,GAAA,CAAI,MAAO,CAAA,CAAC,EAAO,KAAA;AACtB,IAAM,MAAA,SAAA,GAAY,UAAW,CAAA,sBAAA,CAAuB,EAAE,CAAA,CAAA;AACtD,IAAO,OAAA,CAAC,SAAU,CAAA,IAAA,CAAK,CAACC,GAAAA,KAAO,eAAgB,CAAA,cAAA,CAAeA,GAAE,CAAA,IAAK,eAAgBA,CAAAA,GAAE,CAAC,CAAA,CAAA;AAAA,GAC3F,CAAA,CAAA;AACL;;;;"}
@@ -1,4 +1,4 @@
1
- import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
1
+ import TreeCollection from '../collection/treeCollection';
2
2
  export interface AdditionalDefault {
3
3
  char?: string;
4
4
  }
package/index.css CHANGED
@@ -1,14 +1,14 @@
1
1
  :root{
2
- --magritte-color-stroke-state-focused-accessible-v26-0-0:#0070ff7a;
2
+ --magritte-color-stroke-state-focused-accessible-v26-0-2:#0070ff7a;
3
3
  }
4
4
 
5
5
  :root{
6
- --magritte-semantic-animation-ease-in-out-100-timing-function-v26-0-0:cubic-bezier(0.25, 0.1, 0.25, 1);
7
- --magritte-semantic-animation-ease-in-out-100-duration-v26-0-0:100ms;
8
- --magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-0:cubic-bezier(0.25, 0.1, 0.25, 1);
9
- --magritte-semantic-animation-ease-in-out-200-duration-v26-0-0:200ms;
6
+ --magritte-semantic-animation-ease-in-out-100-timing-function-v26-0-2:cubic-bezier(0.25, 0.1, 0.25, 1);
7
+ --magritte-semantic-animation-ease-in-out-100-duration-v26-0-2:100ms;
8
+ --magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-2:cubic-bezier(0.25, 0.1, 0.25, 1);
9
+ --magritte-semantic-animation-ease-in-out-200-duration-v26-0-2:200ms;
10
10
  }
11
- @keyframes magritte-fade-in___yS4Ja_5-5-80{
11
+ @keyframes magritte-fade-in___yS4Ja_5-5-82{
12
12
  0%{
13
13
  opacity:0;
14
14
  }
@@ -16,27 +16,27 @@
16
16
  opacity:1;
17
17
  }
18
18
  }
19
- .magritte-item-animation-timeout___pbOyZ_5-5-80{
20
- animation-name:magritte-fade-in___yS4Ja_5-5-80;
21
- animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-0);
19
+ .magritte-item-animation-timeout___pbOyZ_5-5-82{
20
+ animation-name:magritte-fade-in___yS4Ja_5-5-82;
21
+ animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-2);
22
22
  --animation-duration:0ms;
23
23
  animation-duration:var(--animation-duration);
24
24
  }
25
25
  @media (prefers-reduced-motion: no-preference){
26
- .magritte-item-animation-timeout___pbOyZ_5-5-80{
27
- --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v26-0-0);
26
+ .magritte-item-animation-timeout___pbOyZ_5-5-82{
27
+ --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v26-0-2);
28
28
  }
29
29
  }
30
- .magritte-wrapper___GHKV6_5-5-80{
30
+ .magritte-wrapper___GHKV6_5-5-82{
31
31
  display:flex;
32
32
  padding:12px 0;
33
33
  gap:12px;
34
34
  align-items:flex-start;
35
35
  }
36
- .magritte-wrapper___GHKV6_5-5-80.focus-visible{
37
- box-shadow:inset 0 0 0 4px var(--magritte-color-stroke-state-focused-accessible-v26-0-0);
36
+ .magritte-wrapper___GHKV6_5-5-82.focus-visible{
37
+ box-shadow:inset 0 0 0 4px var(--magritte-color-stroke-state-focused-accessible-v26-0-2);
38
38
  }
39
- .magritte-letter___yZOCU_5-5-80{
39
+ .magritte-letter___yZOCU_5-5-82{
40
40
  width:24px;
41
41
  height:24px;
42
42
  display:flex;
@@ -44,82 +44,82 @@
44
44
  justify-content:center;
45
45
  flex-shrink:0;
46
46
  }
47
- .magritte-icon___kO3Fj_5-5-80,
48
- .magritte-space___xTO79_5-5-80{
47
+ .magritte-icon___kO3Fj_5-5-82,
48
+ .magritte-space___xTO79_5-5-82{
49
49
  flex-shrink:0;
50
50
  line-height:0;
51
51
  width:24px;
52
52
  }
53
- .magritte-icon___kO3Fj_5-5-80{
53
+ .magritte-icon___kO3Fj_5-5-82{
54
54
  transform:rotate(0);
55
55
  }
56
- .magritte-wrapperActive___Hwk8p_5-5-80,
57
- .magritte-iconActive___4yrG5_5-5-80{
56
+ .magritte-wrapperActive___Hwk8p_5-5-82,
57
+ .magritte-iconActive___4yrG5_5-5-82{
58
58
  cursor:pointer;
59
59
  }
60
- .magritte-iconUp___mpXV6_5-5-80{
60
+ .magritte-iconUp___mpXV6_5-5-82{
61
61
  transform:rotate(90deg);
62
62
  }
63
63
  @media (prefers-reduced-motion: no-preference){
64
- .magritte-icon___kO3Fj_5-5-80{
64
+ .magritte-icon___kO3Fj_5-5-82{
65
65
  transition-property:transform;
66
- transition-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v26-0-0);
67
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v26-0-0);
66
+ transition-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v26-0-2);
67
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v26-0-2);
68
68
  }
69
69
  }
70
- .magritte-content___ZRc6R_5-5-80{
70
+ .magritte-content___ZRc6R_5-5-82{
71
71
  flex-grow:1;
72
72
  }
73
- .magritte-mobile-item___ynALC_5-5-80{
73
+ .magritte-mobile-item___ynALC_5-5-82{
74
74
  display:flex;
75
75
  gap:12px;
76
76
  flex-wrap:wrap;
77
77
  }
78
- .magritte-with-gap___gbvGO_5-5-80{
78
+ .magritte-with-gap___gbvGO_5-5-82{
79
79
  padding-top:12px;
80
80
  }
81
- .magritte-virtualized-list___qt2E6_5-5-80{
81
+ .magritte-virtualized-list___qt2E6_5-5-82{
82
82
  width:100%;
83
83
  position:relative;
84
84
  will-change:transform;
85
85
  }
86
- .magritte-virtualized-item___qAYVN_5-5-80{
86
+ .magritte-virtualized-item___qAYVN_5-5-82{
87
87
  position:absolute;
88
88
  top:0;
89
89
  left:0;
90
90
  width:100%;
91
91
  }
92
- .magritte-was-expanded___uCFbW_5-5-80{
93
- animation-name:magritte-fade-in___yS4Ja_5-5-80;
94
- animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-0);
92
+ .magritte-was-expanded___uCFbW_5-5-82{
93
+ animation-name:magritte-fade-in___yS4Ja_5-5-82;
94
+ animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-2);
95
95
  --animation-duration:0ms;
96
96
  animation-duration:var(--animation-duration);
97
97
  }
98
98
  @media (prefers-reduced-motion: no-preference){
99
- .magritte-was-expanded___uCFbW_5-5-80{
100
- --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v26-0-0);
99
+ .magritte-was-expanded___uCFbW_5-5-82{
100
+ --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v26-0-2);
101
101
  }
102
102
  }
103
103
 
104
- .magritte-wrapper___EzesX_5-5-80{
104
+ .magritte-wrapper___EzesX_5-5-82{
105
105
  height:100%;
106
106
  position:relative;
107
107
  }
108
- .magritte-scroll-container___wGzfI_5-5-80{
108
+ .magritte-scroll-container___wGzfI_5-5-82{
109
109
  height:100%;
110
110
  overflow:auto;
111
111
  overscroll-behavior:none;
112
112
  scrollbar-width:none;
113
113
  }
114
- .magritte-scroll-container___wGzfI_5-5-80::-webkit-scrollbar{
114
+ .magritte-scroll-container___wGzfI_5-5-82::-webkit-scrollbar{
115
115
  display:none;
116
116
  }
117
117
 
118
118
  :root{
119
- --magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-0:cubic-bezier(0.25, 0.1, 0.25, 1);
120
- --magritte-semantic-animation-ease-in-out-200-duration-v26-0-0:200ms;
119
+ --magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-2:cubic-bezier(0.25, 0.1, 0.25, 1);
120
+ --magritte-semantic-animation-ease-in-out-200-duration-v26-0-2:200ms;
121
121
  }
122
- @keyframes magritte-fade-in___FDoho_5-5-80{
122
+ @keyframes magritte-fade-in___FDoho_5-5-82{
123
123
  0%{
124
124
  opacity:0;
125
125
  }
@@ -127,14 +127,14 @@
127
127
  opacity:1;
128
128
  }
129
129
  }
130
- .magritte-item-animation-timeout___Pdli9_5-5-80{
131
- animation-name:magritte-fade-in___FDoho_5-5-80;
132
- animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-0);
130
+ .magritte-item-animation-timeout___Pdli9_5-5-82{
131
+ animation-name:magritte-fade-in___FDoho_5-5-82;
132
+ animation-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v26-0-2);
133
133
  --animation-duration:0ms;
134
134
  animation-duration:var(--animation-duration);
135
135
  }
136
136
  @media (prefers-reduced-motion: no-preference){
137
- .magritte-item-animation-timeout___Pdli9_5-5-80{
138
- --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v26-0-0);
137
+ .magritte-item-animation-timeout___Pdli9_5-5-82{
138
+ --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v26-0-2);
139
139
  }
140
140
  }
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
2
- import ImmutableSelectionStrategy from '@hh.ru/magritte-ui-tree-selector/strategy/immutableSelectionStrategy';
3
- export * from '@hh.ru/magritte-ui-tree-selector/TreeSelector';
4
- export * from '@hh.ru/magritte-ui-tree-selector/TreeSelectorDummy';
5
- export * from '@hh.ru/magritte-ui-tree-selector/TreeSelectorItemBase';
6
- export * from '@hh.ru/magritte-ui-tree-selector/types';
7
- export * from '@hh.ru/magritte-ui-tree-selector/collection/types';
8
- export * from '@hh.ru/magritte-ui-tree-selector/collection/treeCollectionHelper';
9
- export { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorWrapper';
1
+ import TreeCollection from './collection/treeCollection';
2
+ import ImmutableSelectionStrategy from './strategy/immutableSelectionStrategy';
3
+ export * from './TreeSelector';
4
+ export * from './TreeSelectorDummy';
5
+ export * from './TreeSelectorItemBase';
6
+ export * from './types';
7
+ export * from './collection/types';
8
+ export * from './collection/treeCollectionHelper';
9
+ export { isValidTreeSelectorWrapper } from './TreeSelectorWrapper';
10
10
  export { TreeCollection, ImmutableSelectionStrategy };
package/index.js CHANGED
@@ -26,7 +26,7 @@ import '@hh.ru/magritte-ui-icon/icon';
26
26
  import './Action.js';
27
27
  import '@hh.ru/magritte-ui-checkbox-radio';
28
28
  import '@hh.ru/magritte-ui-typography';
29
- import './tree-selector-item-BOEDcwrO.js';
29
+ import './tree-selector-item-BYBFlI_G.js';
30
30
  import './MobileItemsList.js';
31
31
  import '@hh.ru/magritte-common-func-utils';
32
32
  import '@hh.ru/magritte-ui-cell';
package/index.mock.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { ForwardRefExoticComponent } from 'react';
2
- import TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';
3
- import ImmutableSelectionStrategy from '@hh.ru/magritte-ui-tree-selector/strategy/immutableSelectionStrategy';
4
- export * from '@hh.ru/magritte-ui-tree-selector/types';
5
- export * from '@hh.ru/magritte-ui-tree-selector/collection/types';
6
- export * from '@hh.ru/magritte-ui-tree-selector/collection/treeCollectionHelper';
7
- export { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorWrapper';
2
+ import TreeCollection from './collection/treeCollection';
3
+ import ImmutableSelectionStrategy from './strategy/immutableSelectionStrategy';
4
+ export * from './types';
5
+ export * from './collection/types';
6
+ export * from './collection/treeCollectionHelper';
7
+ export { isValidTreeSelectorWrapper } from './TreeSelectorWrapper';
8
8
  export { TreeCollection, ImmutableSelectionStrategy };
9
9
  export declare const TreeSelector: ForwardRefExoticComponent<Record<string, unknown>>;
10
10
  export declare const TreeSelectorDummy: ForwardRefExoticComponent<Record<string, unknown>>;
package/index.mock.js CHANGED
@@ -25,13 +25,21 @@ import '@hh.ru/magritte-ui-checkbox-radio';
25
25
  import './TreeSelectorItemBase.js';
26
26
  import '@hh.ru/magritte-ui-cell';
27
27
  import '@hh.ru/magritte-ui-typography';
28
- import './tree-selector-item-BOEDcwrO.js';
28
+ import './tree-selector-item-BYBFlI_G.js';
29
29
 
30
- const TreeSelector = mockComponent('TreeSelector', undefined, { withChildren: true });
31
- const TreeSelectorDummy = mockComponent('TreeSelectorDummy', undefined, {
32
- withChildren: true,
33
- });
34
- const TreeSelectorItemBase = mockComponent('TreeSelectorItemBase');
30
+ const TreeSelector = mockComponent(
31
+ "TreeSelector",
32
+ void 0,
33
+ { withChildren: true }
34
+ );
35
+ const TreeSelectorDummy = mockComponent(
36
+ "TreeSelectorDummy",
37
+ void 0,
38
+ {
39
+ withChildren: true
40
+ }
41
+ );
42
+ const TreeSelectorItemBase = mockComponent("TreeSelectorItemBase");
35
43
 
36
44
  export { TreeSelector, TreeSelectorDummy, TreeSelectorItemBase };
37
45
  //# sourceMappingURL=index.mock.js.map
package/index.mock.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { ForwardRefExoticComponent } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport ImmutableSelectionStrategy from '@hh.ru/magritte-ui-tree-selector/strategy/immutableSelectionStrategy';\n\nexport * from '@hh.ru/magritte-ui-tree-selector/types';\nexport * from '@hh.ru/magritte-ui-tree-selector/collection/types';\nexport * from '@hh.ru/magritte-ui-tree-selector/collection/treeCollectionHelper';\nexport { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorWrapper';\nexport { TreeCollection, ImmutableSelectionStrategy };\n\nexport const TreeSelector: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent(\n 'TreeSelector',\n undefined,\n { withChildren: true }\n);\n\nexport const TreeSelectorDummy: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent(\n 'TreeSelectorDummy',\n undefined,\n {\n withChildren: true,\n }\n);\n\nexport const TreeSelectorItemBase = mockComponent('TreeSelectorItemBase');\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYa,MAAA,YAAY,GAAuD,aAAa,CACzF,cAAc,EACd,SAAS,EACT,EAAE,YAAY,EAAE,IAAI,EAAE,EACxB;MAEW,iBAAiB,GAAuD,aAAa,CAC9F,mBAAmB,EACnB,SAAS,EACT;AACI,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA,EACH;MAEW,oBAAoB,GAAG,aAAa,CAAC,sBAAsB;;;;"}
1
+ {"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { ForwardRefExoticComponent } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\nimport TreeCollection from '@hh.ru/magritte-ui-tree-selector/collection/treeCollection';\nimport ImmutableSelectionStrategy from '@hh.ru/magritte-ui-tree-selector/strategy/immutableSelectionStrategy';\n\nexport * from '@hh.ru/magritte-ui-tree-selector/types';\nexport * from '@hh.ru/magritte-ui-tree-selector/collection/types';\nexport * from '@hh.ru/magritte-ui-tree-selector/collection/treeCollectionHelper';\nexport { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector/TreeSelectorWrapper';\nexport { TreeCollection, ImmutableSelectionStrategy };\n\nexport const TreeSelector: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent(\n 'TreeSelector',\n undefined,\n { withChildren: true }\n);\n\nexport const TreeSelectorDummy: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent(\n 'TreeSelectorDummy',\n undefined,\n {\n withChildren: true,\n }\n);\n\nexport const TreeSelectorItemBase = mockComponent('TreeSelectorItemBase');\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,MAAM,YAAmE,GAAA,aAAA;AAAA,EAC5E,cAAA;AAAA,EACA,KAAA,CAAA;AAAA,EACA,EAAE,cAAc,IAAK,EAAA;AACzB,EAAA;AAEO,MAAM,iBAAwE,GAAA,aAAA;AAAA,EACjF,mBAAA;AAAA,EACA,KAAA,CAAA;AAAA,EACA;AAAA,IACI,YAAc,EAAA,IAAA;AAAA,GAClB;AACJ,EAAA;AAEa,MAAA,oBAAA,GAAuB,cAAc,sBAAsB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-tree-selector",
3
- "version": "5.5.80",
3
+ "version": "5.5.82",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -16,29 +16,30 @@
16
16
  "ts-config": "yarn root:ts-config $(pwd)",
17
17
  "ts-check": "yarn root:ts-check $(pwd)",
18
18
  "test": "yarn root:test $(pwd)",
19
+ "test:types": "yarn root:test:types $(pwd)",
19
20
  "watch": "yarn root:watch $(pwd)"
20
21
  },
21
22
  "dependencies": {
22
- "@hh.ru/magritte-common-func-utils": "1.3.16",
23
- "@hh.ru/magritte-common-fuzzy-search": "1.0.10",
24
- "@hh.ru/magritte-common-keyboard": "4.3.6",
25
- "@hh.ru/magritte-common-resize": "0.2.3",
26
- "@hh.ru/magritte-common-use-multiple-refs": "1.1.12",
27
- "@hh.ru/magritte-design-tokens": "26.0.0",
28
- "@hh.ru/magritte-internal-custom-scroll": "2.1.2",
29
- "@hh.ru/magritte-types": "5.0.8",
30
- "@hh.ru/magritte-ui-badge": "4.0.22",
31
- "@hh.ru/magritte-ui-breakpoint": "6.1.2",
32
- "@hh.ru/magritte-ui-card": "8.7.5",
33
- "@hh.ru/magritte-ui-cell": "7.3.2",
34
- "@hh.ru/magritte-ui-checkable-card": "5.1.10",
35
- "@hh.ru/magritte-ui-checkbox-radio": "4.1.39",
36
- "@hh.ru/magritte-ui-icon": "15.1.4",
37
- "@hh.ru/magritte-ui-input": "9.4.51",
38
- "@hh.ru/magritte-ui-mock-component": "1.1.8",
39
- "@hh.ru/magritte-ui-scrollbar": "1.0.38",
40
- "@hh.ru/magritte-ui-spacing": "2.1.30",
41
- "@hh.ru/magritte-ui-typography": "5.3.15",
23
+ "@hh.ru/magritte-common-func-utils": "1.3.17",
24
+ "@hh.ru/magritte-common-fuzzy-search": "1.0.11",
25
+ "@hh.ru/magritte-common-keyboard": "4.3.7",
26
+ "@hh.ru/magritte-common-resize": "0.2.4",
27
+ "@hh.ru/magritte-common-use-multiple-refs": "1.1.13",
28
+ "@hh.ru/magritte-design-tokens": "26.0.2",
29
+ "@hh.ru/magritte-internal-custom-scroll": "2.1.3",
30
+ "@hh.ru/magritte-types": "5.0.9",
31
+ "@hh.ru/magritte-ui-badge": "4.0.24",
32
+ "@hh.ru/magritte-ui-breakpoint": "6.1.3",
33
+ "@hh.ru/magritte-ui-card": "8.7.7",
34
+ "@hh.ru/magritte-ui-cell": "7.3.4",
35
+ "@hh.ru/magritte-ui-checkable-card": "5.1.12",
36
+ "@hh.ru/magritte-ui-checkbox-radio": "4.1.41",
37
+ "@hh.ru/magritte-ui-icon": "15.1.6",
38
+ "@hh.ru/magritte-ui-input": "9.4.53",
39
+ "@hh.ru/magritte-ui-mock-component": "1.1.9",
40
+ "@hh.ru/magritte-ui-scrollbar": "1.0.40",
41
+ "@hh.ru/magritte-ui-spacing": "2.1.32",
42
+ "@hh.ru/magritte-ui-typography": "5.3.17",
42
43
  "@tanstack/react-virtual": "3.8.3"
43
44
  },
44
45
  "peerDependencies": {
@@ -49,5 +50,5 @@
49
50
  "publishConfig": {
50
51
  "access": "public"
51
52
  },
52
- "gitHead": "b0ff5da48fb29d516c8289082560ee1882d16986"
53
+ "gitHead": "33dbaa1dc9b9705e925ffc9f6fcc7a0dc153bd36"
53
54
  }
@@ -1,4 +1,4 @@
1
- import { Toggler } from '@hh.ru/magritte-ui-tree-selector/strategy/types';
1
+ import { Toggler } from '../strategy/types';
2
2
  /**
3
3
  * Создаёт переключатель для набора с возможностью выбора только одного элемента.
4
4
  */