@salutejs/plasma-new-hope 0.340.0-canary.2314.18974837629.0 → 0.340.0-canary.2314.19043398713.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 (140) hide show
  1. package/cjs/components/Combobox/ComboboxNew/Combobox.js +20 -4
  2. package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  3. package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +319 -1
  4. package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
  5. package/cjs/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js +7 -0
  6. package/cjs/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js.map +1 -1
  7. package/cjs/components/Combobox/ComboboxNew/reducers/treePathReducer.js +14 -2
  8. package/cjs/components/Combobox/ComboboxNew/reducers/treePathReducer.js.map +1 -1
  9. package/cjs/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js +3 -3
  10. package/cjs/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js.map +1 -1
  11. package/cjs/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js +22 -5
  12. package/cjs/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js.map +1 -1
  13. package/cjs/components/Select/Select.js +2 -1
  14. package/cjs/components/Select/Select.js.map +1 -1
  15. package/cjs/components/Select/hooks/useKeyboardNavigation.js +127 -38
  16. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  17. package/cjs/components/Select/reducers/focusedPathReducer.js +7 -0
  18. package/cjs/components/Select/reducers/focusedPathReducer.js.map +1 -1
  19. package/cjs/components/Select/reducers/treePathReducer.js +12 -0
  20. package/cjs/components/Select/reducers/treePathReducer.js.map +1 -1
  21. package/cjs/components/Select/ui/TreeList/TreeList.js +3 -3
  22. package/cjs/components/Select/ui/TreeList/TreeList.js.map +1 -1
  23. package/cjs/components/Select/ui/TreeList/ui/Item/Item.js +22 -5
  24. package/cjs/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -1
  25. package/cjs/index.js +2 -0
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/utils/index.js.map +1 -1
  28. package/cjs/utils/isArraysEqual.js +12 -0
  29. package/cjs/utils/isArraysEqual.js.map +1 -0
  30. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +16 -3
  31. package/emotion/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +312 -0
  32. package/emotion/cjs/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js +7 -0
  33. package/emotion/cjs/components/Combobox/ComboboxNew/reducers/treePathReducer.js +14 -2
  34. package/emotion/cjs/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js +7 -3
  35. package/emotion/cjs/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js +49 -5
  36. package/emotion/cjs/components/Select/Select.js +2 -1
  37. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +156 -44
  38. package/emotion/cjs/components/Select/reducers/focusedPathReducer.js +7 -0
  39. package/emotion/cjs/components/Select/reducers/treePathReducer.js +12 -0
  40. package/emotion/cjs/components/Select/ui/TreeList/TreeList.js +7 -3
  41. package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.js +49 -5
  42. package/emotion/cjs/utils/index.js +4 -0
  43. package/emotion/cjs/utils/isArraysEqual.js +15 -0
  44. package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +16 -3
  45. package/emotion/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +313 -0
  46. package/emotion/es/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js +7 -0
  47. package/emotion/es/components/Combobox/ComboboxNew/reducers/treePathReducer.js +14 -2
  48. package/emotion/es/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js +7 -3
  49. package/emotion/es/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js +50 -6
  50. package/emotion/es/components/Select/Select.js +2 -1
  51. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +157 -44
  52. package/emotion/es/components/Select/reducers/focusedPathReducer.js +7 -0
  53. package/emotion/es/components/Select/reducers/treePathReducer.js +12 -0
  54. package/emotion/es/components/Select/ui/TreeList/TreeList.js +7 -3
  55. package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.js +50 -6
  56. package/emotion/es/utils/index.js +1 -0
  57. package/emotion/es/utils/isArraysEqual.js +5 -0
  58. package/es/components/Combobox/ComboboxNew/Combobox.js +20 -4
  59. package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  60. package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +319 -1
  61. package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
  62. package/es/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js +7 -0
  63. package/es/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js.map +1 -1
  64. package/es/components/Combobox/ComboboxNew/reducers/treePathReducer.js +14 -2
  65. package/es/components/Combobox/ComboboxNew/reducers/treePathReducer.js.map +1 -1
  66. package/es/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js +3 -3
  67. package/es/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js.map +1 -1
  68. package/es/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js +23 -6
  69. package/es/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js.map +1 -1
  70. package/es/components/Select/Select.js +2 -1
  71. package/es/components/Select/Select.js.map +1 -1
  72. package/es/components/Select/hooks/useKeyboardNavigation.js +127 -38
  73. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  74. package/es/components/Select/reducers/focusedPathReducer.js +7 -0
  75. package/es/components/Select/reducers/focusedPathReducer.js.map +1 -1
  76. package/es/components/Select/reducers/treePathReducer.js +12 -0
  77. package/es/components/Select/reducers/treePathReducer.js.map +1 -1
  78. package/es/components/Select/ui/TreeList/TreeList.js +3 -3
  79. package/es/components/Select/ui/TreeList/TreeList.js.map +1 -1
  80. package/es/components/Select/ui/TreeList/ui/Item/Item.js +23 -6
  81. package/es/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -1
  82. package/es/index.js +1 -0
  83. package/es/index.js.map +1 -1
  84. package/es/utils/index.js.map +1 -1
  85. package/es/utils/isArraysEqual.js +8 -0
  86. package/es/utils/isArraysEqual.js.map +1 -0
  87. package/package.json +2 -2
  88. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +16 -3
  89. package/styled-components/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +312 -0
  90. package/styled-components/cjs/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js +7 -0
  91. package/styled-components/cjs/components/Combobox/ComboboxNew/reducers/treePathReducer.js +14 -2
  92. package/styled-components/cjs/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js +7 -3
  93. package/styled-components/cjs/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js +49 -5
  94. package/styled-components/cjs/components/Select/Select.js +2 -1
  95. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +156 -44
  96. package/styled-components/cjs/components/Select/reducers/focusedPathReducer.js +7 -0
  97. package/styled-components/cjs/components/Select/reducers/treePathReducer.js +12 -0
  98. package/styled-components/cjs/components/Select/ui/TreeList/TreeList.js +7 -3
  99. package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.js +49 -5
  100. package/styled-components/cjs/utils/index.js +4 -0
  101. package/styled-components/cjs/utils/isArraysEqual.js +15 -0
  102. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +16 -3
  103. package/styled-components/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +313 -0
  104. package/styled-components/es/components/Combobox/ComboboxNew/reducers/focusedPathReducer.js +7 -0
  105. package/styled-components/es/components/Combobox/ComboboxNew/reducers/treePathReducer.js +14 -2
  106. package/styled-components/es/components/Combobox/ComboboxNew/ui/TreeList/TreeList.js +7 -3
  107. package/styled-components/es/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.js +50 -6
  108. package/styled-components/es/components/Select/Select.js +2 -1
  109. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +157 -44
  110. package/styled-components/es/components/Select/reducers/focusedPathReducer.js +7 -0
  111. package/styled-components/es/components/Select/reducers/treePathReducer.js +12 -0
  112. package/styled-components/es/components/Select/ui/TreeList/TreeList.js +7 -3
  113. package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.js +50 -6
  114. package/styled-components/es/examples/components/Combobox/Combobox.js +0 -7
  115. package/styled-components/es/utils/index.js +1 -0
  116. package/styled-components/es/utils/isArraysEqual.js +5 -0
  117. package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
  118. package/types/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.d.ts +7 -2
  119. package/types/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.d.ts.map +1 -1
  120. package/types/components/Combobox/ComboboxNew/reducers/focusedPathReducer.d.ts +3 -0
  121. package/types/components/Combobox/ComboboxNew/reducers/focusedPathReducer.d.ts.map +1 -1
  122. package/types/components/Combobox/ComboboxNew/reducers/treePathReducer.d.ts +6 -0
  123. package/types/components/Combobox/ComboboxNew/reducers/treePathReducer.d.ts.map +1 -1
  124. package/types/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.d.ts.map +1 -1
  125. package/types/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.types.d.ts +1 -1
  126. package/types/components/Combobox/ComboboxNew/ui/TreeList/ui/Item/Item.types.d.ts.map +1 -1
  127. package/types/components/Select/Select.d.ts.map +1 -1
  128. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -1
  129. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  130. package/types/components/Select/reducers/focusedPathReducer.d.ts +3 -0
  131. package/types/components/Select/reducers/focusedPathReducer.d.ts.map +1 -1
  132. package/types/components/Select/reducers/treePathReducer.d.ts +6 -0
  133. package/types/components/Select/reducers/treePathReducer.d.ts.map +1 -1
  134. package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts.map +1 -1
  135. package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts +1 -1
  136. package/types/components/Select/ui/TreeList/ui/Item/Item.types.d.ts.map +1 -1
  137. package/types/utils/index.d.ts +1 -0
  138. package/types/utils/index.d.ts.map +1 -1
  139. package/types/utils/isArraysEqual.d.ts +2 -0
  140. package/types/utils/isArraysEqual.d.ts.map +1 -0
@@ -2,11 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
5
6
  var React = require('react');
6
7
  var Select_tokens = require('../../../../Select.tokens.js');
8
+ var index = require('../../../../../../utils/index.js');
7
9
  var treePathReducer = require('../../../../reducers/treePathReducer.js');
8
10
  var Select_context = require('../../../../Select.context.js');
9
11
  var Item_styles = require('./Item.styles.js');
12
+ var isArraysEqual = require('../../../../../../utils/isArraysEqual.js');
13
+ var useDidMountEffect = require('../../../../../../hooks/useDidMountEffect.js');
10
14
  var sizeToIconSize = require('../../../../utils/sizeToIconSize.js');
11
15
 
12
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -17,7 +21,7 @@ var _StyledIndicator, _StyledIndicator2;
17
21
  var Item = function Item(_ref) {
18
22
  var _valueToPathMap$get, _item$items;
19
23
  var item = _ref.item,
20
- index = _ref.index;
24
+ pathToItem = _ref.pathToItem;
21
25
  var label = item.label,
22
26
  value = item.value,
23
27
  disabled = item.disabled,
@@ -40,11 +44,14 @@ var Item = function Item(_ref) {
40
44
  handleCheckboxChange = _useContext.handleCheckboxChange,
41
45
  valueToPathMap = _useContext.valueToPathMap;
42
46
  var itemDisabled = Boolean(disabled || isDisabled);
47
+ var disabledClassName = itemDisabled ? Select_tokens.classes.dropdownItemIsDisabled : undefined;
48
+ var ref = React.useRef(null);
43
49
  var currentItemDepth = (((_valueToPathMap$get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap$get === void 0 ? void 0 : _valueToPathMap$get.length) || 0) - 1;
44
50
  var isCurrentLevelOpened = treePathReducer.keyExists(treePath, valueToPathMap.get(value.toString()) || []);
45
51
  var withArrowInverse = isCurrentLevelOpened ? Select_tokens.classes.arrowInverse : undefined;
46
- var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? Select_tokens.classes.dropdownItemIsFocused : undefined;
52
+ var focusedClass = isArraysEqual.isArraysEqual(pathToItem, focusedPath) ? Select_tokens.classes.dropdownItemIsFocused : undefined;
47
53
  var handleClick = function handleClick(e) {
54
+ if (itemDisabled) return;
48
55
  if (!isLeaf) {
49
56
  dispatchTreePath({
50
57
  type: 'toggled_level',
@@ -60,8 +67,18 @@ var Item = function Item(_ref) {
60
67
  e.stopPropagation();
61
68
  handleCheckboxChange(item);
62
69
  };
70
+ useDidMountEffect.useDidMountEffect(function () {
71
+ if (focusedClass && ref !== null && ref !== void 0 && ref.current) {
72
+ ref.current.scrollIntoView({
73
+ behavior: 'smooth',
74
+ block: 'center',
75
+ inline: 'center'
76
+ });
77
+ }
78
+ }, [focusedClass]);
63
79
  return /*#__PURE__*/React__default.default.createElement(Item_styles.ItemWrapper, null, /*#__PURE__*/React__default.default.createElement(Item_styles.Wrapper, {
64
- className: focusedClass,
80
+ ref: ref,
81
+ className: index.cx(focusedClass, disabledClassName),
65
82
  onClick: handleClick,
66
83
  variant: variant,
67
84
  role: "treeitem"
@@ -120,8 +137,8 @@ var Item = function Item(_ref) {
120
137
  }))), !isLeaf && isCurrentLevelOpened && /*#__PURE__*/React__default.default.createElement(Item_styles.ChildItems, null, (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.map(function (item, index) {
121
138
  return /*#__PURE__*/React__default.default.createElement(Item, {
122
139
  item: item,
123
- index: index,
124
- key: index
140
+ key: item.value,
141
+ pathToItem: [].concat(_rollupPluginBabelHelpers.toConsumableArray(pathToItem), [index])
125
142
  });
126
143
  })));
127
144
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sources":["../../../../../../../src/components/Select/ui/TreeList/ui/Item/Item.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { classes } from 'src/components/Select/Select.tokens';\nimport { sizeToIconSize } from 'src/components/Select/utils';\n\nimport { keyExists } from '../../../../reducers/treePathReducer';\nimport { Context } from '../../../../Select.context';\n\nimport { Props } from './Item.types';\nimport {\n ItemWrapper,\n ChildItems,\n Offset,\n IconWrapper,\n StyledCheckboxWrapper,\n StyledCheckbox,\n StyledIndicator,\n StyledIconDone,\n StyledText,\n StyledWrapper,\n StyledCell,\n DisclosureIconWrapper,\n StyledArrowRight,\n Wrapper,\n StyledArrowLeft,\n} from './Item.styles';\n\nexport const Item: React.FC<Props> = ({ item, index }) => {\n const { label, value, disabled, isDisabled, contentLeft, contentRight } = item;\n\n const isLeaf = !item?.items;\n\n const {\n checked,\n multiselect,\n size,\n variant,\n renderItem,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n _checkboxAppearance,\n focusedPath,\n treePath,\n dispatchTreePath,\n arrowPlacement,\n handleItemClick,\n handleCheckboxChange,\n valueToPathMap,\n } = useContext(Context);\n\n const itemDisabled = Boolean(disabled || isDisabled);\n\n const currentItemDepth = (valueToPathMap.get(item.value.toString())?.length || 0) - 1;\n\n const isCurrentLevelOpened = keyExists(treePath, valueToPathMap.get(value.toString()) || []);\n\n const withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;\n\n const focusedClass =\n currentItemDepth === focusedPath.length - 1 && index === focusedPath?.[currentItemDepth]\n ? classes.dropdownItemIsFocused\n : undefined;\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!isLeaf) {\n dispatchTreePath({ type: 'toggled_level', value: valueToPathMap.get(value.toString()) || [] });\n }\n\n if (handleItemClick) {\n handleItemClick(item, e);\n }\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (itemDisabled) return;\n\n e.stopPropagation();\n\n handleCheckboxChange(item);\n };\n\n return (\n <ItemWrapper>\n <Wrapper className={focusedClass} onClick={handleClick} variant={variant} role=\"treeitem\">\n <Offset depth={currentItemDepth} />\n\n {arrowPlacement === 'left' && (\n <DisclosureIconWrapper visibility={isLeaf ? 'hidden' : 'visible'}>\n <StyledArrowLeft\n size={sizeToIconSize(size, variant)}\n color=\"inherit\"\n className={withArrowInverse}\n />\n </DisclosureIconWrapper>\n )}\n\n {multiselect && (\n <IconWrapper variant={variant}>\n <StyledCheckboxWrapper onClick={(e) => e.stopPropagation()}>\n <StyledCheckbox\n disabled={itemDisabled}\n checked={Boolean(checked.get(item.value))}\n indeterminate={checked.get(item.value) === 'indeterminate'}\n onChange={handleChange}\n appearance={_checkboxAppearance ?? 'default'}\n />\n </StyledCheckboxWrapper>\n </IconWrapper>\n )}\n\n {!multiselect && arrowPlacement === 'right' && (\n <IconWrapper variant={variant}>\n {checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {checked.get(item.value) === 'done' && (\n <StyledIconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n )}\n\n {renderItem ? (\n <StyledText>{renderItem(item)}</StyledText>\n ) : (\n <StyledWrapper disabled={itemDisabled}>\n <StyledCell\n contentLeft={contentLeft}\n contentRight={contentRight}\n // TODO: #1548\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n title={<span>{label}</span>}\n />\n </StyledWrapper>\n )}\n\n {!multiselect && arrowPlacement === 'left' && (\n <IconWrapper variant={variant}>\n {checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {checked.get(item.value) === 'done' && (\n <StyledIconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n )}\n\n {arrowPlacement === 'right' && (\n <DisclosureIconWrapper visibility={isLeaf ? 'hidden' : 'visible'}>\n <StyledArrowRight\n size={sizeToIconSize(size, variant)}\n color=\"inherit\"\n className={withArrowInverse}\n />\n </DisclosureIconWrapper>\n )}\n </Wrapper>\n\n {!isLeaf && isCurrentLevelOpened && (\n <ChildItems>\n {item.items?.map((item, index) => {\n return <Item item={item} index={index} key={index} />;\n })}\n </ChildItems>\n )}\n </ItemWrapper>\n );\n};\n"],"names":["Item","_ref","_valueToPathMap$get","_item$items","item","index","label","value","disabled","isDisabled","contentLeft","contentRight","isLeaf","items","_useContext","useContext","Context","checked","multiselect","size","variant","renderItem","_checkboxAppearance","focusedPath","treePath","dispatchTreePath","arrowPlacement","handleItemClick","handleCheckboxChange","valueToPathMap","itemDisabled","Boolean","currentItemDepth","get","toString","length","isCurrentLevelOpened","keyExists","withArrowInverse","classes","arrowInverse","undefined","focusedClass","dropdownItemIsFocused","handleClick","e","type","handleChange","stopPropagation","React","createElement","ItemWrapper","Wrapper","className","onClick","role","Offset","depth","DisclosureIconWrapper","visibility","StyledArrowLeft","sizeToIconSize","color","IconWrapper","StyledCheckboxWrapper","StyledCheckbox","indeterminate","onChange","appearance","_StyledIndicator","StyledIndicator","view","StyledIconDone","StyledText","StyledWrapper","StyledCell","title","_StyledIndicator2","StyledArrowRight","ChildItems","map","key"],"mappings":";;;;;;;;;;;;;;;;IA0BaA,IAAqB,GAAG,SAAxBA,IAAqBA,CAAAC,IAAA,EAAwB;EAAA,IAAAC,mBAAA,EAAAC,WAAA,CAAA;AAAA,EAAA,IAAlBC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK,CAAA;AAC/C,EAAA,IAAQC,KAAK,GAA6DF,IAAI,CAAtEE,KAAK;IAAEC,KAAK,GAAsDH,IAAI,CAA/DG,KAAK;IAAEC,QAAQ,GAA4CJ,IAAI,CAAxDI,QAAQ;IAAEC,UAAU,GAAgCL,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4E,MAAAA,GAAG,EAAE5E,KAAAA;AAAM,KAAE,CAAC,CAAA;GACxD,CACO,CAEP,CAAC,CAAA;AAEtB;;;;"}
1
+ {"version":3,"file":"Item.js","sources":["../../../../../../../src/components/Select/ui/TreeList/ui/Item/Item.tsx"],"sourcesContent":["import React, { useContext, useRef } from 'react';\nimport { classes } from 'src/components/Select/Select.tokens';\nimport { sizeToIconSize } from 'src/components/Select/utils';\nimport { isArraysEqual, cx } from 'src/utils';\nimport { useDidMountEffect } from 'src/hooks';\n\nimport { keyExists } from '../../../../reducers/treePathReducer';\nimport { Context } from '../../../../Select.context';\n\nimport { Props } from './Item.types';\nimport {\n ItemWrapper,\n ChildItems,\n Offset,\n IconWrapper,\n StyledCheckboxWrapper,\n StyledCheckbox,\n StyledIndicator,\n StyledIconDone,\n StyledText,\n StyledWrapper,\n StyledCell,\n DisclosureIconWrapper,\n StyledArrowRight,\n Wrapper,\n StyledArrowLeft,\n} from './Item.styles';\n\nexport const Item: React.FC<Props> = ({ item, pathToItem }) => {\n const { label, value, disabled, isDisabled, contentLeft, contentRight } = item;\n\n const isLeaf = !item?.items;\n\n const {\n checked,\n multiselect,\n size,\n variant,\n renderItem,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n _checkboxAppearance,\n focusedPath,\n treePath,\n dispatchTreePath,\n arrowPlacement,\n handleItemClick,\n handleCheckboxChange,\n valueToPathMap,\n } = useContext(Context);\n\n const itemDisabled = Boolean(disabled || isDisabled);\n const disabledClassName = itemDisabled ? classes.dropdownItemIsDisabled : undefined;\n\n const ref = useRef<HTMLDivElement | null>(null);\n\n const currentItemDepth = (valueToPathMap.get(item.value.toString())?.length || 0) - 1;\n\n const isCurrentLevelOpened = keyExists(treePath, valueToPathMap.get(value.toString()) || []);\n\n const withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;\n\n const focusedClass = isArraysEqual(pathToItem, focusedPath) ? classes.dropdownItemIsFocused : undefined;\n\n const handleClick = (e: React.MouseEvent<HTMLElement>) => {\n if (itemDisabled) return;\n\n if (!isLeaf) {\n dispatchTreePath({ type: 'toggled_level', value: valueToPathMap.get(value.toString()) || [] });\n }\n\n if (handleItemClick) {\n handleItemClick(item, e);\n }\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (itemDisabled) return;\n\n e.stopPropagation();\n\n handleCheckboxChange(item);\n };\n\n useDidMountEffect(() => {\n if (focusedClass && ref?.current) {\n ref.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, [focusedClass]);\n\n return (\n <ItemWrapper>\n <Wrapper\n ref={ref}\n className={cx(focusedClass, disabledClassName)}\n onClick={handleClick}\n variant={variant}\n role=\"treeitem\"\n >\n <Offset depth={currentItemDepth} />\n\n {arrowPlacement === 'left' && (\n <DisclosureIconWrapper visibility={isLeaf ? 'hidden' : 'visible'}>\n <StyledArrowLeft\n size={sizeToIconSize(size, variant)}\n color=\"inherit\"\n className={withArrowInverse}\n />\n </DisclosureIconWrapper>\n )}\n\n {multiselect && (\n <IconWrapper variant={variant}>\n <StyledCheckboxWrapper onClick={(e) => e.stopPropagation()}>\n <StyledCheckbox\n disabled={itemDisabled}\n checked={Boolean(checked.get(item.value))}\n indeterminate={checked.get(item.value) === 'indeterminate'}\n onChange={handleChange}\n appearance={_checkboxAppearance ?? 'default'}\n />\n </StyledCheckboxWrapper>\n </IconWrapper>\n )}\n\n {!multiselect && arrowPlacement === 'right' && (\n <IconWrapper variant={variant}>\n {checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {checked.get(item.value) === 'done' && (\n <StyledIconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n )}\n\n {renderItem ? (\n <StyledText>{renderItem(item)}</StyledText>\n ) : (\n <StyledWrapper disabled={itemDisabled}>\n <StyledCell\n contentLeft={contentLeft}\n contentRight={contentRight}\n // TODO: #1548\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n title={<span>{label}</span>}\n />\n </StyledWrapper>\n )}\n\n {!multiselect && arrowPlacement === 'left' && (\n <IconWrapper variant={variant}>\n {checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {checked.get(item.value) === 'done' && (\n <StyledIconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n )}\n\n {arrowPlacement === 'right' && (\n <DisclosureIconWrapper visibility={isLeaf ? 'hidden' : 'visible'}>\n <StyledArrowRight\n size={sizeToIconSize(size, variant)}\n color=\"inherit\"\n className={withArrowInverse}\n />\n </DisclosureIconWrapper>\n )}\n </Wrapper>\n\n {!isLeaf && isCurrentLevelOpened && (\n <ChildItems>\n {item.items?.map((item, index) => {\n return <Item item={item} key={item.value} pathToItem={[...pathToItem, index]} />;\n })}\n </ChildItems>\n )}\n </ItemWrapper>\n );\n};\n"],"names":["Item","_ref","_valueToPathMap$get","_item$items","item","pathToItem","label","value","disabled","isDisabled","contentLeft","contentRight","isLeaf","items","_useContext","useContext","Context","checked","multiselect","size","variant","renderItem","_checkboxAppearance","focusedPath","treePath","dispatchTreePath","arrowPlacement","handleItemClick","handleCheckboxChange","valueToPathMap","itemDisabled","Boolean","disabledClassName","classes","dropdownItemIsDisabled","undefined","ref","useRef","currentItemDepth","get","toString","length","isCurrentLevelOpened","keyExists","withArrowInverse","arrowInverse","focusedClass","isArraysEqual","dropdownItemIsFocused","handleClick","e","type","handleChange","stopPropagation","useDidMountEffect","current","scrollIntoView","behavior","block","inline","React","createElement","ItemWrapper","Wrapper","className","cx","onClick","role","Offset","depth","DisclosureIconWrapper","visibility","StyledArrowLeft","sizeToIconSize","color","IconWrapper","StyledCheckboxWrapper","StyledCheckbox","indeterminate","onChange","appearance","_StyledIndicator","StyledIndicator","view","StyledIconDone","StyledText","StyledWrapper","StyledCell","title","_StyledIndicator2","StyledArrowRight","ChildItems","map","index","key","concat","_toConsumableArray"],"mappings":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AAI,EAAEsD,6BAAc,CAACtD,IAAI,EAAEC,OAAO,CAAE;AAACsD,IAAAA,KAAK,EAAC,SAAA;GAAW,CAEjE,CAChB,EAEAhD,cAAc,KAAK,OAAO,iBACvBkC,sBAAA,CAAAC,aAAA,CAACS,iCAAqB,EAAA;AAACC,IAAAA,UAAU,EAAE3D,MAAM,GAAG,QAAQ,GAAG,SAAA;AAAU,GAAA,eAC7DgD,sBAAA,CAAAC,aAAA,CAAC6B,4BAAgB,EAAA;AACbvE,IAAAA,IAAI,EAAEsD,6BAAc,CAACtD,IAAI,EAAEC,OAAO,CAAE;AACpCsD,IAAAA,KAAK,EAAC,SAAS;AACfV,IAAAA,SAAS,EAAEpB,gBAAAA;AAAiB,GAC/B,CACkB,CAEtB,CAAC,EAET,CAAChC,MAAM,IAAI8B,oBAAoB,iBAC5BkB,sBAAA,CAAAC,aAAA,CAAC8B,sBAAU,EAAA,IAAA,EAAA,CAAAxF,WAAA,GACNC,IAAI,CAACS,KAAK,MAAA,IAAA,IAAAV,WAAA,KAAVA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,WAAA,CAAYyF,GAAG,CAAC,UAACxF,IAAI,EAAEyF,KAAK,EAAK;AAC9B,IAAA,oBAAOjC,sBAAA,CAAAC,aAAA,CAAC7D,IAAI,EAAA;AAACI,MAAAA,IAAI,EAAEA,IAAK;MAAC0F,GAAG,EAAE1F,IAAI,CAACG,KAAM;AAACF,MAAAA,UAAU,KAAA0F,MAAA,CAAAC,2CAAA,CAAM3F,UAAU,IAAEwF,KAAK,CAAA,CAAA;AAAE,KAAE,CAAC,CAAA;GACnF,CACO,CAEP,CAAC,CAAA;AAEtB;;;;"}
package/cjs/index.js CHANGED
@@ -40,6 +40,7 @@ var noop = require('./utils/noop.js');
40
40
  var getHeightAsNumber = require('./utils/getHeightAsNumber.js');
41
41
  var createConditionalComponent = require('./utils/createConditionalComponent.js');
42
42
  var deepCopy = require('./utils/deepCopy.js');
43
+ var isArraysEqual = require('./utils/isArraysEqual.js');
43
44
  var fixedForwardRef = require('./utils/fixedForwardRef.js');
44
45
  var getPopoverPlacement = require('./utils/getPopoverPlacement.js');
45
46
  var initialValuesHelper = require('./utils/initialValuesHelper.js');
@@ -376,6 +377,7 @@ exports.noop = noop.noop;
376
377
  exports.getHeightAsNumber = getHeightAsNumber.getHeightAsNumber;
377
378
  exports.createConditionalComponent = createConditionalComponent.createConditionalComponent;
378
379
  exports.deepCopy = deepCopy.deepCopy;
380
+ exports.isArraysEqual = isArraysEqual.isArraysEqual;
379
381
  exports.fixedForwardRef = fixedForwardRef.fixedForwardRef;
380
382
  exports.getPlacement = getPopoverPlacement.getPlacement;
381
383
  exports.getPlacements = getPopoverPlacement.getPlacements;
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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{"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import { CSSProperties } from '@linaria/core';\n\nexport { canUseDOM } from './canUseDOM';\nexport { extractTextFrom } from './extractTextFrom';\nexport { getSizeValueFromProp } from './getSizeValueFromProp';\nexport { IS_REACT_18, safeUseId } from './react';\nexport { isNumber } from './isNumber';\nexport { mergeRefs, setRefList } from './setRefList';\nexport { isEmpty } from './isEmpty';\nexport { createEvent } from './createEvent';\nexport * as constants from './constants';\nexport * from './getPopoverPlacement';\nexport * from './initialValuesHelper';\nexport { noop } from './noop';\nexport { getHeightAsNumber } from './getHeightAsNumber';\nexport { createConditionalComponent } from './createConditionalComponent';\nexport { deepCopy } from './deepCopy';\n\nexport const cx = (...classes: (string | boolean | undefined)[]) => classes.filter((classItem) => classItem).join(' ');\n\nexport const composableStyle = (s: TemplateStringsArray, ...expr: Array<string | number | CSSProperties>): string => {\n let res = '';\n for (let i = 0; i < Math.max(s.length, expr.length); ++i) {\n res += s[i] ?? '';\n res += expr[i] ?? '';\n }\n\n return res;\n};\n\nexport { fixedForwardRef } from './fixedForwardRef';\n"],"names":["cx","_len","arguments","length","classes","Array","_key","filter","classItem","join","composableStyle","s","res","i","Math","max","_s$i","_ref","undefined"],"mappings":";;;;AAkBaA,IAAAA,EAAE,GAAG,SAALA,EAAEA,GAAA;AAAA,EAAA,KAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,OAAO,GAAAC,IAAAA,KAAA,CAAAJ,IAAA,GAAAK,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,EAAA,EAAA;AAAPF,IAAAA,OAAO,CAAAE,IAAA,CAAAJ,GAAAA,SAAA,CAAAI,IAAA,CAAA,CAAA;AAAA,GAAA;AAAA,EAAA,OAAuCF,OAAO,CAACG,MAAM,CAAC,UAACC,SAAS,EAAA;AAAA,IAAA,OAAKA,SAAS,CAAA;AAAA,GAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;AAAA,EAAA;IAEzGC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,CAAuB,EAA8D;EACjH,IAAIC,GAAG,GAAG,EAAE,CAAA;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACJ,CAAC,CAACR,MAAM,EAAAD,SAAA,CAAAC,MAAA,IAAA,CAAA,GAAA,CAAA,GAAAD,SAAA,CAAAC,MAAA,GAAA,CAAa,CAAC,EAAE,EAAEU,CAAC,EAAE;IAAA,IAAAG,IAAA,EAAAC,IAAA,CAAA;AACtDL,IAAAA,GAAG,IAAAI,CAAAA,IAAA,GAAIL,CAAC,CAACE,CAAC,CAAC,MAAA,IAAA,IAAAG,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAI,EAAE,CAAA;IACjBJ,GAAG,IAAA,CAAAK,IAAA,GAASJ,CAAC,YAAAX,SAAA,CAAAC,MAAA,IAADU,CAAC,OAAAK,SAAA,GAAAhB,SAAA,CAADW,CAAC,mBAAAI,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAK,EAAE,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOL,GAAG,CAAA;AACd;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import { CSSProperties } from '@linaria/core';\n\nexport { canUseDOM } from './canUseDOM';\nexport { extractTextFrom } from './extractTextFrom';\nexport { getSizeValueFromProp } from './getSizeValueFromProp';\nexport { IS_REACT_18, safeUseId } from './react';\nexport { isNumber } from './isNumber';\nexport { mergeRefs, setRefList } from './setRefList';\nexport { isEmpty } from './isEmpty';\nexport { createEvent } from './createEvent';\nexport * as constants from './constants';\nexport * from './getPopoverPlacement';\nexport * from './initialValuesHelper';\nexport { noop } from './noop';\nexport { getHeightAsNumber } from './getHeightAsNumber';\nexport { createConditionalComponent } from './createConditionalComponent';\nexport { deepCopy } from './deepCopy';\nexport { isArraysEqual } from './isArraysEqual';\n\nexport const cx = (...classes: (string | boolean | undefined)[]) => classes.filter((classItem) => classItem).join(' ');\n\nexport const composableStyle = (s: TemplateStringsArray, ...expr: Array<string | number | CSSProperties>): string => {\n let res = '';\n for (let i = 0; i < Math.max(s.length, expr.length); ++i) {\n res += s[i] ?? '';\n res += expr[i] ?? '';\n }\n\n return res;\n};\n\nexport { fixedForwardRef } from './fixedForwardRef';\n"],"names":["cx","_len","arguments","length","classes","Array","_key","filter","classItem","join","composableStyle","s","res","i","Math","max","_s$i","_ref","undefined"],"mappings":";;;;AAmBaA,IAAAA,EAAE,GAAG,SAALA,EAAEA,GAAA;AAAA,EAAA,KAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,OAAO,GAAAC,IAAAA,KAAA,CAAAJ,IAAA,GAAAK,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,EAAA,EAAA;AAAPF,IAAAA,OAAO,CAAAE,IAAA,CAAAJ,GAAAA,SAAA,CAAAI,IAAA,CAAA,CAAA;AAAA,GAAA;AAAA,EAAA,OAAuCF,OAAO,CAACG,MAAM,CAAC,UAACC,SAAS,EAAA;AAAA,IAAA,OAAKA,SAAS,CAAA;AAAA,GAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;AAAA,EAAA;IAEzGC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,CAAuB,EAA8D;EACjH,IAAIC,GAAG,GAAG,EAAE,CAAA;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACJ,CAAC,CAACR,MAAM,EAAAD,SAAA,CAAAC,MAAA,IAAA,CAAA,GAAA,CAAA,GAAAD,SAAA,CAAAC,MAAA,GAAA,CAAa,CAAC,EAAE,EAAEU,CAAC,EAAE;IAAA,IAAAG,IAAA,EAAAC,IAAA,CAAA;AACtDL,IAAAA,GAAG,IAAAI,CAAAA,IAAA,GAAIL,CAAC,CAACE,CAAC,CAAC,MAAA,IAAA,IAAAG,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAI,EAAE,CAAA;IACjBJ,GAAG,IAAA,CAAAK,IAAA,GAASJ,CAAC,YAAAX,SAAA,CAAAC,MAAA,IAADU,CAAC,OAAAK,SAAA,GAAAhB,SAAA,CAADW,CAAC,mBAAAI,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAK,EAAE,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOL,GAAG,CAAA;AACd;;;;;"}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isArraysEqual = function isArraysEqual(a, b) {
6
+ return a.length === b.length && a.every(function (val, i) {
7
+ return val === b[i];
8
+ });
9
+ };
10
+
11
+ exports.isArraysEqual = isArraysEqual;
12
+ //# sourceMappingURL=isArraysEqual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isArraysEqual.js","sources":["../../src/utils/isArraysEqual.ts"],"sourcesContent":["export const isArraysEqual = (a: any[], b: any[]) => {\n return a.length === b.length && a.every((val, i) => val === b[i]);\n};\n"],"names":["isArraysEqual","a","b","length","every","val","i"],"mappings":";;;;AAAO,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,CAAQ,EAAEC,CAAQ,EAAK;AACjD,EAAA,OAAOD,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,IAAIF,CAAC,CAACG,KAAK,CAAC,UAACC,GAAG,EAAEC,CAAC,EAAA;AAAA,IAAA,OAAKD,GAAG,KAAKH,CAAC,CAACI,CAAC,CAAC,CAAA;GAAC,CAAA,CAAA;AACrE;;;;"}
@@ -267,7 +267,9 @@ var comboboxRoot = function(Root) {
267
267
  }, [
268
268
  items
269
269
  ]), 3), valueToCheckedMap = _useMemo[0], valueToItemMap = _useMemo[1], valueToPathMap = _useMemo[2];
270
+ // Состояние поля поиска в target
270
271
  var _useState = _sliced_to_array((0, _react.useState)((0, _utils2.getTextValue)(multiple, outerValue, valueToItemMap, renderValue)), 2), textValue = _useState[0], setTextValue = _useState[1];
272
+ // Внутреннее состояние выбранных элементов
271
273
  var _useState1 = _sliced_to_array((0, _react.useState)(multiple ? [] : ''), 2), internalValue = _useState1[0], setInternalValue = _useState1[1];
272
274
  var value = outerValue !== null && outerValue !== undefined ? outerValue : internalValue;
273
275
  var rootRef = (0, _react.useRef)(null);
@@ -306,8 +308,6 @@ var comboboxRoot = function(Root) {
306
308
  return;
307
309
  }
308
310
  handleListToggle(false);
309
- // Возвращаем актуальное значение поля ввода после закрытия выпадающего списка.
310
- setTextValue((0, _utils2.getTextValue)(multiple, value, valueToItemMap, renderValue));
311
311
  }, [
312
312
  floatingPopoverRef,
313
313
  listWrapperRef
@@ -384,6 +384,8 @@ var comboboxRoot = function(Root) {
384
384
  dispatchTreePath({
385
385
  type: 'reset'
386
386
  });
387
+ // Возвращаем актуальное значение поля ввода после закрытия выпадающего списка.
388
+ setTextValue((0, _utils2.getTextValue)(multiple, value, valueToItemMap, renderValue));
387
389
  // Скроллим чипы к левому краю при закрытии компонента
388
390
  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');
389
391
  if (multiple && value.length > 0 && el) {
@@ -546,7 +548,12 @@ var comboboxRoot = function(Root) {
546
548
  multiple: multiple,
547
549
  value: value,
548
550
  textValue: textValue,
549
- valueToItemMap: valueToItemMap
551
+ valueToItemMap: valueToItemMap,
552
+ treePath: treePath,
553
+ dispatchTreePath: dispatchTreePath,
554
+ treeView: treeView,
555
+ valueToPathMap: valueToPathMap,
556
+ items: filteredItems
550
557
  }).onKeyDown;
551
558
  // В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
552
559
  // Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
@@ -611,11 +618,17 @@ var comboboxRoot = function(Root) {
611
618
  // Эффект для раскрытия дерева при поиске.
612
619
  (0, _react.useLayoutEffect)(function() {
613
620
  if (treeView) {
621
+ // Если пользователь выбирает элемент, то выходим из эффекта.
622
+ if (textValue === (0, _utils2.getTextValue)(multiple, value, valueToItemMap, renderValue)) {
623
+ return;
624
+ }
625
+ // Если поле ввода стало пустым, то скрывает все узлы дерева.
614
626
  if (textValue === '') {
615
627
  dispatchTreePath({
616
628
  type: 'reset'
617
629
  });
618
630
  } else {
631
+ // Иначе раскрываем все узлы, когда пользователь начинает вводить текст в поле ввода.
619
632
  dispatchTreePath({
620
633
  type: 'expand_all',
621
634
  value: filteredItems
@@ -20,6 +20,32 @@ _export(exports, {
20
20
  }
21
21
  });
22
22
  var _utils = require("../../../../utils");
23
+ var _reducers = require("../../../Select/reducers");
24
+ function _array_like_to_array(arr, len) {
25
+ if (len == null || len > arr.length) len = arr.length;
26
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
27
+ return arr2;
28
+ }
29
+ function _array_without_holes(arr) {
30
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
31
+ }
32
+ function _iterable_to_array(iter) {
33
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
34
+ }
35
+ function _non_iterable_spread() {
36
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
37
+ }
38
+ function _to_consumable_array(arr) {
39
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
40
+ }
41
+ function _unsupported_iterable_to_array(o, minLen) {
42
+ if (!o) return;
43
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
44
+ var n = Object.prototype.toString.call(o).slice(8, -1);
45
+ if (n === "Object" && o.constructor) n = o.constructor.name;
46
+ if (n === "Map" || n === "Set") return Array.from(n);
47
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
48
+ }
23
49
  var JUMP_SIZE = 10;
24
50
  var keys = {
25
51
  Enter: 'Enter',
@@ -43,6 +69,51 @@ var getItemByFocused = function(focusedPath, focusedToValueMap) {
43
69
  return focusedToValueMap.get(focusedPathAsString);
44
70
  };
45
71
  var useKeyNavigation = function(param) {
72
+ 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, setTextValue = param.setTextValue, multiple = param.multiple, value = param.value, textValue = param.textValue, valueToItemMap = param.valueToItemMap, treePath = param.treePath, dispatchTreePath = param.dispatchTreePath, treeView = param.treeView, valueToPathMap = param.valueToPathMap, items = param.items;
73
+ if (treeView) {
74
+ return keyboardNavigationTree({
75
+ focusedPath: focusedPath,
76
+ dispatchFocusedPath: dispatchFocusedPath,
77
+ path: path,
78
+ dispatchPath: dispatchPath,
79
+ pathMap: pathMap,
80
+ focusedToValueMap: focusedToValueMap,
81
+ handleListToggle: handleListToggle,
82
+ handlePressDown: handlePressDown,
83
+ setTextValue: setTextValue,
84
+ multiple: multiple,
85
+ value: value,
86
+ textValue: textValue,
87
+ valueToItemMap: valueToItemMap,
88
+ treePath: treePath,
89
+ dispatchTreePath: dispatchTreePath,
90
+ treeView: treeView,
91
+ valueToPathMap: valueToPathMap,
92
+ items: items
93
+ });
94
+ }
95
+ return keyboardNavigationDefault({
96
+ focusedPath: focusedPath,
97
+ dispatchFocusedPath: dispatchFocusedPath,
98
+ path: path,
99
+ dispatchPath: dispatchPath,
100
+ pathMap: pathMap,
101
+ focusedToValueMap: focusedToValueMap,
102
+ handleListToggle: handleListToggle,
103
+ handlePressDown: handlePressDown,
104
+ setTextValue: setTextValue,
105
+ multiple: multiple,
106
+ value: value,
107
+ textValue: textValue,
108
+ valueToItemMap: valueToItemMap,
109
+ treePath: treePath,
110
+ dispatchTreePath: dispatchTreePath,
111
+ treeView: treeView,
112
+ valueToPathMap: valueToPathMap,
113
+ items: items
114
+ });
115
+ };
116
+ var keyboardNavigationDefault = function(param) {
46
117
  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, setTextValue = param.setTextValue, multiple = param.multiple, value = param.value, textValue = param.textValue, valueToItemMap = param.valueToItemMap;
47
118
  var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
48
119
  var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[focusedPath.length - 1]) || 0;
@@ -301,3 +372,244 @@ var useKeyNavigation = function(param) {
301
372
  onKeyDown: onKeyDown
302
373
  };
303
374
  };
375
+ var keyboardNavigationTree = function(param) {
376
+ 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, setTextValue = param.setTextValue, multiple = param.multiple, value = param.value, textValue = param.textValue, valueToItemMap = param.valueToItemMap, treePath = param.treePath, dispatchTreePath = param.dispatchTreePath, valueToPathMap = param.valueToPathMap, items = param.items;
377
+ var _currentItem_parent_items, _currentItem_parent;
378
+ var currentItem = getItemByFocused(focusedPath, focusedToValueMap);
379
+ var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
380
+ 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;
381
+ var isValidFocus = function(focusCandidate) {
382
+ if (!Array.isArray(items) || !Array.isArray(focusCandidate)) return false;
383
+ var currentLevel = items;
384
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
385
+ try {
386
+ for(var _iterator = focusCandidate[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
387
+ var index = _step.value;
388
+ if (!Array.isArray(currentLevel) || index >= currentLevel.length) {
389
+ return false;
390
+ }
391
+ var node = currentLevel[index];
392
+ currentLevel = node.items || [];
393
+ }
394
+ } catch (err) {
395
+ _didIteratorError = true;
396
+ _iteratorError = err;
397
+ } finally{
398
+ try {
399
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
400
+ _iterator.return();
401
+ }
402
+ } finally{
403
+ if (_didIteratorError) {
404
+ throw _iteratorError;
405
+ }
406
+ }
407
+ }
408
+ return true;
409
+ };
410
+ var onKeyDown = function(event) {
411
+ switch(event.code){
412
+ case keys.ArrowUp:
413
+ {
414
+ if (path[0]) {
415
+ event.stopPropagation();
416
+ event.preventDefault();
417
+ }
418
+ /**
419
+ * Если список открыт и фокус уже установлен на каком-либо элементе.
420
+ * */ if (focusedPath.length) {
421
+ /**
422
+ * Если это не первый элемент, то нужно вначале найти элемент для фокуса.
423
+ * Т.к. если верхний элемент раскрыт, то и перемещаться нужно не на него,
424
+ * а на его самый нижний дочерний элемент.
425
+ * */ if (currentIndex > 0) {
426
+ var nextFocus = _to_consumable_array(focusedPath.slice(0, -1)).concat([
427
+ currentIndex - 1
428
+ ]);
429
+ for(var i = 0; i <= focusedPath.length; i++){
430
+ var focusedPathAsString = nextFocus.reduce(function(acc, n) {
431
+ return "".concat(acc, "/").concat(n);
432
+ }, '').replace(/^(\/)/, '');
433
+ var item = focusedToValueMap.get(focusedPathAsString);
434
+ var isLevelOpened = (0, _reducers.keyExists)(treePath, valueToPathMap.get(item === null || item === void 0 ? void 0 : item.value.toString()) || []);
435
+ if (isLevelOpened) {
436
+ var _item_items;
437
+ nextFocus = _to_consumable_array(nextFocus).concat([
438
+ ((item === null || item === void 0 ? void 0 : (_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items.length) || 0) - 1
439
+ ]);
440
+ } else {
441
+ break;
442
+ }
443
+ }
444
+ dispatchFocusedPath({
445
+ type: 'set_focus',
446
+ value: nextFocus
447
+ });
448
+ } else {
449
+ /**
450
+ * Если элемент первый, то нужно лишь подняться к его родителю.
451
+ * */ dispatchFocusedPath({
452
+ type: 'return_prev_focus'
453
+ });
454
+ }
455
+ } else {
456
+ /**
457
+ * Если список закрыт, то нужно его открыть и установить фокус на первый элемент.
458
+ * */ dispatchPath({
459
+ type: 'opened_first_level'
460
+ });
461
+ dispatchFocusedPath({
462
+ type: 'set_initial_focus'
463
+ });
464
+ handleListToggle(true);
465
+ }
466
+ break;
467
+ }
468
+ case keys.ArrowDown:
469
+ {
470
+ if (path[0]) {
471
+ event.stopPropagation();
472
+ event.preventDefault();
473
+ }
474
+ /**
475
+ * Если список открыт и фокус уже установлен на каком-либо элементе.
476
+ * */ if (focusedPath.length) {
477
+ /**
478
+ * Заходим сюда если у элемента есть другие вложенные элементы.
479
+ * */ if ((currentItem === null || currentItem === void 0 ? void 0 : currentItem.items) && (currentItem === null || currentItem === void 0 ? void 0 : currentItem.items.length)) {
480
+ var isCurrentLevelOpened = (0, _reducers.keyExists)(treePath, valueToPathMap.get(currentItem.value.toString()) || []);
481
+ /**
482
+ * Если у этого элемента открыт его дочерний список,
483
+ * то устанавливаем фокус на первый элемент из этого списка
484
+ * и сразу же выходим из обработчика события.
485
+ * */ if (isCurrentLevelOpened) {
486
+ dispatchFocusedPath({
487
+ type: 'add_focus',
488
+ value: 0
489
+ });
490
+ break;
491
+ }
492
+ }
493
+ /**
494
+ * Если мы еще не достигли конца списка, то движемся к следующему элементу.
495
+ * */ if (currentIndex + 1 < currentLength) {
496
+ dispatchFocusedPath({
497
+ type: 'change_last_focus',
498
+ value: currentIndex + 1
499
+ });
500
+ } else {
501
+ /**
502
+ * Если же достигли последнего элемента на текущем уровне, то нужно определить,
503
+ * на какой из элементов ниже мы перейдем.
504
+ * Переход фокуса отсюда может быть только на уровни выше, при чем сразу на несколько.
505
+ * */ var focusCandidate = _to_consumable_array(focusedPath);
506
+ var nextFocus1 = null;
507
+ while(focusCandidate.length > 1){
508
+ focusCandidate = _to_consumable_array(focusCandidate.slice(0, -2)).concat([
509
+ (focusCandidate.at(-2) || 0) + 1
510
+ ]);
511
+ if (isValidFocus(focusCandidate)) {
512
+ nextFocus1 = focusCandidate;
513
+ break;
514
+ }
515
+ }
516
+ if (nextFocus1) {
517
+ dispatchFocusedPath({
518
+ type: 'set_focus',
519
+ value: nextFocus1
520
+ });
521
+ } else {
522
+ break;
523
+ }
524
+ }
525
+ } else {
526
+ /**
527
+ * Если список закрыт, то нужно его открыть и установить фокус на первый элемент.
528
+ * */ dispatchPath({
529
+ type: 'opened_first_level'
530
+ });
531
+ dispatchFocusedPath({
532
+ type: 'set_initial_focus'
533
+ });
534
+ handleListToggle(true);
535
+ }
536
+ break;
537
+ }
538
+ case keys.ArrowLeft:
539
+ {
540
+ if (path[0]) {
541
+ event.stopPropagation();
542
+ event.preventDefault();
543
+ if (focusedPath.length) {
544
+ dispatchTreePath({
545
+ type: 'close_level',
546
+ value: valueToPathMap.get((currentItem === null || currentItem === void 0 ? void 0 : currentItem.value.toString()) || '') || []
547
+ });
548
+ }
549
+ }
550
+ break;
551
+ }
552
+ case keys.ArrowRight:
553
+ {
554
+ if (path[0]) {
555
+ event.stopPropagation();
556
+ event.preventDefault();
557
+ if (!focusedPath.length || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.disabled) || !(currentItem === null || currentItem === void 0 ? void 0 : currentItem.items)) {
558
+ break;
559
+ }
560
+ dispatchTreePath({
561
+ type: 'open_level',
562
+ value: valueToPathMap.get(currentItem.value.toString()) || []
563
+ });
564
+ }
565
+ break;
566
+ }
567
+ case keys.Enter:
568
+ {
569
+ event.preventDefault();
570
+ if (!currentItem || (currentItem === null || currentItem === void 0 ? void 0 : currentItem.disabled)) {
571
+ break;
572
+ }
573
+ if (!path[0]) {
574
+ dispatchPath({
575
+ type: 'opened_first_level'
576
+ });
577
+ dispatchFocusedPath({
578
+ type: 'set_initial_focus'
579
+ });
580
+ break;
581
+ }
582
+ handlePressDown(currentItem);
583
+ break;
584
+ }
585
+ case keys.Tab:
586
+ case keys.Escape:
587
+ {
588
+ if (path[0]) {
589
+ handleListToggle(false);
590
+ }
591
+ if (multiple) {
592
+ setTextValue('');
593
+ } else if (textValue !== value) {
594
+ // Проверяем, отличается ли значение в инпуте от выбранного value после нажатия Tab/Enter.
595
+ // Если изменилось, то возвращаем label выбранного айтема.
596
+ // Если нет выбранного элемента, то стираем значение инпута.
597
+ if ((0, _utils.isEmpty)(value)) {
598
+ setTextValue('');
599
+ } else {
600
+ var _valueToItemMap_get;
601
+ setTextValue(((_valueToItemMap_get = valueToItemMap.get(value)) === null || _valueToItemMap_get === void 0 ? void 0 : _valueToItemMap_get.label) || '');
602
+ }
603
+ }
604
+ break;
605
+ }
606
+ default:
607
+ {
608
+ break;
609
+ }
610
+ }
611
+ };
612
+ return {
613
+ onKeyDown: onKeyDown
614
+ };
615
+ };
@@ -39,6 +39,10 @@ function focusedPathReducer(state, action) {
39
39
  {
40
40
  return [];
41
41
  }
42
+ case 'set_focus':
43
+ {
44
+ return action.value;
45
+ }
42
46
  case 'set_initial_focus':
43
47
  {
44
48
  return [
@@ -59,6 +63,9 @@ function focusedPathReducer(state, action) {
59
63
  }
60
64
  case 'return_prev_focus':
61
65
  {
66
+ if (state.length === 1) {
67
+ return state;
68
+ }
62
69
  return state.slice(0, -1);
63
70
  }
64
71
  default: