@salutejs/plasma-new-hope 0.138.0-canary.1406.10670971125.0 → 0.138.0-canary.1406.10679978473.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +63 -62
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +8 -8
- package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +2 -2
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +63 -62
- package/emotion/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +8 -8
- package/emotion/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +2 -2
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +63 -62
- package/emotion/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +8 -8
- package/emotion/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +2 -2
- package/es/components/Combobox/ComboboxNew/Combobox.js +63 -62
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +8 -8
- package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +2 -2
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +63 -62
- package/styled-components/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +8 -8
- package/styled-components/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +2 -2
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +63 -62
- package/styled-components/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +8 -8
- package/styled-components/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.js +2 -2
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.d.ts +2 -2
- package/types/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.d.ts.map +1 -1
@@ -133,7 +133,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
133
133
|
type: 'reset'
|
134
134
|
});
|
135
135
|
|
136
|
-
// Проверяем, отличается ли значение инпуте от выбранного value после закрытия дропдауна.
|
136
|
+
// Проверяем, отличается ли значение в инпуте от выбранного value после закрытия дропдауна.
|
137
137
|
// Если изменилось, то возвращаем label выбранного айтема.
|
138
138
|
// Если нет выбранного элемента, то стираем значение инпута.
|
139
139
|
if (textValue !== value) {
|
@@ -188,7 +188,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
188
188
|
};
|
189
189
|
|
190
190
|
// Обработчик открытия/закрытия выпадающего списка
|
191
|
-
var
|
191
|
+
var handleListToggle = function handleListToggle(opened) {
|
192
192
|
if (disabled) {
|
193
193
|
return;
|
194
194
|
}
|
@@ -208,44 +208,45 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
208
208
|
|
209
209
|
// Обработчик выбора чекбоксов (только при multiple)
|
210
210
|
var handleCheckboxChange = function handleCheckboxChange(item) {
|
211
|
-
if (multiple) {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
211
|
+
if (!multiple) {
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
var checkedCopy = new Map(checked);
|
215
|
+
if (!checkedCopy.get(item.value)) {
|
216
|
+
checkedCopy.set(item.value, true);
|
217
|
+
(0, _utils3.updateDescendants)(item, checkedCopy, true);
|
218
|
+
} else {
|
219
|
+
checkedCopy.set(item.value, false);
|
220
|
+
(0, _utils3.updateDescendants)(item, checkedCopy, false);
|
221
|
+
}
|
222
|
+
(0, _utils3.updateAncestors)(item, checkedCopy);
|
223
|
+
var newValues = [];
|
224
|
+
valueToItemMap.forEach(function (item, key) {
|
225
|
+
if (checkedCopy.get(key)) {
|
226
|
+
newValues.push(item.value);
|
219
227
|
}
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
newValues.push(item.value);
|
225
|
-
}
|
228
|
+
});
|
229
|
+
if (closeAfterSelect) {
|
230
|
+
dispatchPath({
|
231
|
+
type: 'reset'
|
226
232
|
});
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
+
dispatchFocusedPath({
|
234
|
+
type: 'reset'
|
235
|
+
});
|
236
|
+
}
|
237
|
+
if (onChange) {
|
238
|
+
onChange(newValues);
|
239
|
+
}
|
240
|
+
|
241
|
+
// После выбора/снятия чекбокса скроллим к инпуту
|
242
|
+
setTimeout(function () {
|
243
|
+
if (inputRef.current) {
|
244
|
+
inputRef.current.scrollIntoView({
|
245
|
+
behavior: 'smooth',
|
246
|
+
inline: 'start'
|
233
247
|
});
|
234
248
|
}
|
235
|
-
|
236
|
-
onChange(newValues);
|
237
|
-
}
|
238
|
-
|
239
|
-
// После выбора/снятия чекбокса скроллим к инпуту
|
240
|
-
setTimeout(function () {
|
241
|
-
if (inputRef.current) {
|
242
|
-
inputRef.current.scrollIntoView({
|
243
|
-
behavior: 'smooth',
|
244
|
-
inline: 'start'
|
245
|
-
});
|
246
|
-
}
|
247
|
-
}, 1);
|
248
|
-
}
|
249
|
+
}, 1);
|
249
250
|
};
|
250
251
|
|
251
252
|
// Обработчик клика по айтему выпадающего списка
|
@@ -255,31 +256,31 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
255
256
|
}
|
256
257
|
if (multiple) {
|
257
258
|
handleCheckboxChange(item);
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
if (e) {
|
262
|
+
e.stopPropagation();
|
263
|
+
}
|
264
|
+
var checkedCopy = new Map(checked);
|
265
|
+
var isCurrentChecked = checkedCopy.get(item.value);
|
266
|
+
checkedCopy.forEach(function (_, key) {
|
267
|
+
checkedCopy.set(key, false);
|
268
|
+
});
|
269
|
+
if (!isCurrentChecked) {
|
270
|
+
checkedCopy.set(item.value, 'done');
|
271
|
+
(0, _utils3.updateSingleAncestors)(item, checkedCopy, 'dot');
|
272
|
+
}
|
273
|
+
setTextValue(isCurrentChecked ? '' : item.label);
|
274
|
+
if (closeAfterSelect) {
|
275
|
+
dispatchPath({
|
276
|
+
type: 'reset'
|
266
277
|
});
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
dispatchPath({
|
274
|
-
type: 'reset'
|
275
|
-
});
|
276
|
-
dispatchFocusedPath({
|
277
|
-
type: 'reset'
|
278
|
-
});
|
279
|
-
}
|
280
|
-
if (onChange) {
|
281
|
-
onChange(isCurrentChecked ? '' : item.value);
|
282
|
-
}
|
278
|
+
dispatchFocusedPath({
|
279
|
+
type: 'reset'
|
280
|
+
});
|
281
|
+
}
|
282
|
+
if (onChange) {
|
283
|
+
onChange(isCurrentChecked ? '' : item.value);
|
283
284
|
}
|
284
285
|
};
|
285
286
|
var getChips = function getChips() {
|
@@ -308,7 +309,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
308
309
|
dispatchPath: dispatchPath,
|
309
310
|
pathMap: pathMap,
|
310
311
|
focusedToValueMap: focusedToValueMap,
|
311
|
-
|
312
|
+
handleListToggle: handleListToggle,
|
312
313
|
handlePressDown: handlePressDown,
|
313
314
|
multiselect: multiple,
|
314
315
|
setTextValue: setTextValue
|
@@ -359,7 +360,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
359
360
|
ref: floatingPopoverRef,
|
360
361
|
opened: isCurrentListOpen,
|
361
362
|
onToggle: function onToggle(opened) {
|
362
|
-
return opened &&
|
363
|
+
return opened && handleListToggle(true);
|
363
364
|
},
|
364
365
|
placement: placement,
|
365
366
|
portal: portal,
|
package/styled-components/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js
CHANGED
@@ -33,7 +33,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
33
33
|
dispatchPath = _ref.dispatchPath,
|
34
34
|
pathMap = _ref.pathMap,
|
35
35
|
focusedToValueMap = _ref.focusedToValueMap,
|
36
|
-
|
36
|
+
handleListToggle = _ref.handleListToggle,
|
37
37
|
handlePressDown = _ref.handlePressDown,
|
38
38
|
multiselect = _ref.multiselect,
|
39
39
|
setTextValue = _ref.setTextValue;
|
@@ -62,7 +62,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
62
62
|
dispatchFocusedPath({
|
63
63
|
type: 'set_initial_focus'
|
64
64
|
});
|
65
|
-
|
65
|
+
handleListToggle(true);
|
66
66
|
}
|
67
67
|
if (path[0]) {
|
68
68
|
event.stopPropagation();
|
@@ -91,7 +91,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
91
91
|
dispatchFocusedPath({
|
92
92
|
type: 'set_initial_focus'
|
93
93
|
});
|
94
|
-
|
94
|
+
handleListToggle(true);
|
95
95
|
}
|
96
96
|
if (path[0]) {
|
97
97
|
event.stopPropagation();
|
@@ -116,7 +116,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
116
116
|
}
|
117
117
|
}
|
118
118
|
if (path.length === 1) {
|
119
|
-
|
119
|
+
handleListToggle(false);
|
120
120
|
}
|
121
121
|
}
|
122
122
|
break;
|
@@ -213,7 +213,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
213
213
|
dispatchFocusedPath({
|
214
214
|
type: 'reset'
|
215
215
|
});
|
216
|
-
|
216
|
+
handleListToggle(false);
|
217
217
|
setTextValue('');
|
218
218
|
break;
|
219
219
|
}
|
@@ -225,7 +225,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
225
225
|
dispatchFocusedPath({
|
226
226
|
type: 'reset'
|
227
227
|
});
|
228
|
-
|
228
|
+
handleListToggle(false);
|
229
229
|
break;
|
230
230
|
}
|
231
231
|
case keys.Home:
|
@@ -247,7 +247,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
247
247
|
dispatchFocusedPath({
|
248
248
|
type: 'set_initial_focus'
|
249
249
|
});
|
250
|
-
|
250
|
+
handleListToggle(true);
|
251
251
|
}
|
252
252
|
break;
|
253
253
|
}
|
@@ -271,7 +271,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
271
271
|
type: 'change_last_focus',
|
272
272
|
value: (pathMap.get('root') || 0) - 1
|
273
273
|
});
|
274
|
-
|
274
|
+
handleListToggle(true);
|
275
275
|
}
|
276
276
|
break;
|
277
277
|
}
|
@@ -42,7 +42,7 @@ var Item = exports.Item = function Item(_ref) {
|
|
42
42
|
renderItem = _useContext.renderItem,
|
43
43
|
valueToItemMap = _useContext.valueToItemMap,
|
44
44
|
treeId = _useContext.treeId;
|
45
|
-
var
|
45
|
+
var disabledClassName = disabled ? _Combobox.classes.dropdownItemIsDisabled : undefined;
|
46
46
|
var focusedClass = currentLevel === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentLevel]) ? _Combobox.classes.dropdownItemIsFocused : undefined;
|
47
47
|
var activeClass = value === (path === null || path === void 0 ? void 0 : path[currentLevel + 1]) ? _Combobox.classes.dropdownItemIsActive : undefined;
|
48
48
|
(0, _hooks.useDidMountEffect)(function () {
|
@@ -67,7 +67,7 @@ var Item = exports.Item = function Item(_ref) {
|
|
67
67
|
handleItemClick(item, e);
|
68
68
|
};
|
69
69
|
return /*#__PURE__*/_react["default"].createElement(_Item.Wrapper, {
|
70
|
-
className: (0, _utils2.cx)(
|
70
|
+
className: (0, _utils2.cx)(disabledClassName, focusedClass, activeClass),
|
71
71
|
id: (0, _utils.getItemId)(treeId, value),
|
72
72
|
ref: ref,
|
73
73
|
onClick: handleClick,
|
@@ -124,7 +124,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
124
124
|
type: 'reset'
|
125
125
|
});
|
126
126
|
|
127
|
-
// Проверяем, отличается ли значение инпуте от выбранного value после закрытия дропдауна.
|
127
|
+
// Проверяем, отличается ли значение в инпуте от выбранного value после закрытия дропдауна.
|
128
128
|
// Если изменилось, то возвращаем label выбранного айтема.
|
129
129
|
// Если нет выбранного элемента, то стираем значение инпута.
|
130
130
|
if (textValue !== value) {
|
@@ -179,7 +179,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
179
179
|
};
|
180
180
|
|
181
181
|
// Обработчик открытия/закрытия выпадающего списка
|
182
|
-
var
|
182
|
+
var handleListToggle = function handleListToggle(opened) {
|
183
183
|
if (disabled) {
|
184
184
|
return;
|
185
185
|
}
|
@@ -199,44 +199,45 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
199
199
|
|
200
200
|
// Обработчик выбора чекбоксов (только при multiple)
|
201
201
|
var handleCheckboxChange = function handleCheckboxChange(item) {
|
202
|
-
if (multiple) {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
202
|
+
if (!multiple) {
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
var checkedCopy = new Map(checked);
|
206
|
+
if (!checkedCopy.get(item.value)) {
|
207
|
+
checkedCopy.set(item.value, true);
|
208
|
+
updateDescendants(item, checkedCopy, true);
|
209
|
+
} else {
|
210
|
+
checkedCopy.set(item.value, false);
|
211
|
+
updateDescendants(item, checkedCopy, false);
|
212
|
+
}
|
213
|
+
updateAncestors(item, checkedCopy);
|
214
|
+
var newValues = [];
|
215
|
+
valueToItemMap.forEach(function (item, key) {
|
216
|
+
if (checkedCopy.get(key)) {
|
217
|
+
newValues.push(item.value);
|
210
218
|
}
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
newValues.push(item.value);
|
216
|
-
}
|
219
|
+
});
|
220
|
+
if (closeAfterSelect) {
|
221
|
+
dispatchPath({
|
222
|
+
type: 'reset'
|
217
223
|
});
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
+
dispatchFocusedPath({
|
225
|
+
type: 'reset'
|
226
|
+
});
|
227
|
+
}
|
228
|
+
if (onChange) {
|
229
|
+
onChange(newValues);
|
230
|
+
}
|
231
|
+
|
232
|
+
// После выбора/снятия чекбокса скроллим к инпуту
|
233
|
+
setTimeout(function () {
|
234
|
+
if (inputRef.current) {
|
235
|
+
inputRef.current.scrollIntoView({
|
236
|
+
behavior: 'smooth',
|
237
|
+
inline: 'start'
|
224
238
|
});
|
225
239
|
}
|
226
|
-
|
227
|
-
onChange(newValues);
|
228
|
-
}
|
229
|
-
|
230
|
-
// После выбора/снятия чекбокса скроллим к инпуту
|
231
|
-
setTimeout(function () {
|
232
|
-
if (inputRef.current) {
|
233
|
-
inputRef.current.scrollIntoView({
|
234
|
-
behavior: 'smooth',
|
235
|
-
inline: 'start'
|
236
|
-
});
|
237
|
-
}
|
238
|
-
}, 1);
|
239
|
-
}
|
240
|
+
}, 1);
|
240
241
|
};
|
241
242
|
|
242
243
|
// Обработчик клика по айтему выпадающего списка
|
@@ -246,31 +247,31 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
246
247
|
}
|
247
248
|
if (multiple) {
|
248
249
|
handleCheckboxChange(item);
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
if (e) {
|
253
|
+
e.stopPropagation();
|
254
|
+
}
|
255
|
+
var checkedCopy = new Map(checked);
|
256
|
+
var isCurrentChecked = checkedCopy.get(item.value);
|
257
|
+
checkedCopy.forEach(function (_, key) {
|
258
|
+
checkedCopy.set(key, false);
|
259
|
+
});
|
260
|
+
if (!isCurrentChecked) {
|
261
|
+
checkedCopy.set(item.value, 'done');
|
262
|
+
updateSingleAncestors(item, checkedCopy, 'dot');
|
263
|
+
}
|
264
|
+
setTextValue(isCurrentChecked ? '' : item.label);
|
265
|
+
if (closeAfterSelect) {
|
266
|
+
dispatchPath({
|
267
|
+
type: 'reset'
|
257
268
|
});
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
dispatchPath({
|
265
|
-
type: 'reset'
|
266
|
-
});
|
267
|
-
dispatchFocusedPath({
|
268
|
-
type: 'reset'
|
269
|
-
});
|
270
|
-
}
|
271
|
-
if (onChange) {
|
272
|
-
onChange(isCurrentChecked ? '' : item.value);
|
273
|
-
}
|
269
|
+
dispatchFocusedPath({
|
270
|
+
type: 'reset'
|
271
|
+
});
|
272
|
+
}
|
273
|
+
if (onChange) {
|
274
|
+
onChange(isCurrentChecked ? '' : item.value);
|
274
275
|
}
|
275
276
|
};
|
276
277
|
var getChips = function getChips() {
|
@@ -299,7 +300,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
299
300
|
dispatchPath: dispatchPath,
|
300
301
|
pathMap: pathMap,
|
301
302
|
focusedToValueMap: focusedToValueMap,
|
302
|
-
|
303
|
+
handleListToggle: handleListToggle,
|
303
304
|
handlePressDown: handlePressDown,
|
304
305
|
multiselect: multiple,
|
305
306
|
setTextValue: setTextValue
|
@@ -350,7 +351,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
350
351
|
ref: floatingPopoverRef,
|
351
352
|
opened: isCurrentListOpen,
|
352
353
|
onToggle: function onToggle(opened) {
|
353
|
-
return opened &&
|
354
|
+
return opened && handleListToggle(true);
|
354
355
|
},
|
355
356
|
placement: placement,
|
356
357
|
portal: portal,
|
@@ -27,7 +27,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
27
27
|
dispatchPath = _ref.dispatchPath,
|
28
28
|
pathMap = _ref.pathMap,
|
29
29
|
focusedToValueMap = _ref.focusedToValueMap,
|
30
|
-
|
30
|
+
handleListToggle = _ref.handleListToggle,
|
31
31
|
handlePressDown = _ref.handlePressDown,
|
32
32
|
multiselect = _ref.multiselect,
|
33
33
|
setTextValue = _ref.setTextValue;
|
@@ -56,7 +56,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
56
56
|
dispatchFocusedPath({
|
57
57
|
type: 'set_initial_focus'
|
58
58
|
});
|
59
|
-
|
59
|
+
handleListToggle(true);
|
60
60
|
}
|
61
61
|
if (path[0]) {
|
62
62
|
event.stopPropagation();
|
@@ -85,7 +85,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
85
85
|
dispatchFocusedPath({
|
86
86
|
type: 'set_initial_focus'
|
87
87
|
});
|
88
|
-
|
88
|
+
handleListToggle(true);
|
89
89
|
}
|
90
90
|
if (path[0]) {
|
91
91
|
event.stopPropagation();
|
@@ -110,7 +110,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
110
110
|
}
|
111
111
|
}
|
112
112
|
if (path.length === 1) {
|
113
|
-
|
113
|
+
handleListToggle(false);
|
114
114
|
}
|
115
115
|
}
|
116
116
|
break;
|
@@ -207,7 +207,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
207
207
|
dispatchFocusedPath({
|
208
208
|
type: 'reset'
|
209
209
|
});
|
210
|
-
|
210
|
+
handleListToggle(false);
|
211
211
|
setTextValue('');
|
212
212
|
break;
|
213
213
|
}
|
@@ -219,7 +219,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
219
219
|
dispatchFocusedPath({
|
220
220
|
type: 'reset'
|
221
221
|
});
|
222
|
-
|
222
|
+
handleListToggle(false);
|
223
223
|
break;
|
224
224
|
}
|
225
225
|
case keys.Home:
|
@@ -241,7 +241,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
241
241
|
dispatchFocusedPath({
|
242
242
|
type: 'set_initial_focus'
|
243
243
|
});
|
244
|
-
|
244
|
+
handleListToggle(true);
|
245
245
|
}
|
246
246
|
break;
|
247
247
|
}
|
@@ -265,7 +265,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
265
265
|
type: 'change_last_focus',
|
266
266
|
value: (pathMap.get('root') || 0) - 1
|
267
267
|
});
|
268
|
-
|
268
|
+
handleListToggle(true);
|
269
269
|
}
|
270
270
|
break;
|
271
271
|
}
|
@@ -33,7 +33,7 @@ export var Item = function Item(_ref) {
|
|
33
33
|
renderItem = _useContext.renderItem,
|
34
34
|
valueToItemMap = _useContext.valueToItemMap,
|
35
35
|
treeId = _useContext.treeId;
|
36
|
-
var
|
36
|
+
var disabledClassName = disabled ? classes.dropdownItemIsDisabled : undefined;
|
37
37
|
var focusedClass = currentLevel === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentLevel]) ? classes.dropdownItemIsFocused : undefined;
|
38
38
|
var activeClass = value === (path === null || path === void 0 ? void 0 : path[currentLevel + 1]) ? classes.dropdownItemIsActive : undefined;
|
39
39
|
useDidMountEffect(function () {
|
@@ -58,7 +58,7 @@ export var Item = function Item(_ref) {
|
|
58
58
|
handleItemClick(item, e);
|
59
59
|
};
|
60
60
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
61
|
-
className: cx(
|
61
|
+
className: cx(disabledClassName, focusedClass, activeClass),
|
62
62
|
id: getItemId(treeId, value),
|
63
63
|
ref: ref,
|
64
64
|
onClick: handleClick,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/Combobox/ComboboxNew/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4F,MAAM,OAAO,CAAC;AAIjH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAoB7C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKnE,eAAO,MAAM,OAAO,4BAAgD,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,YAAY,SAAU,UAAU,gBAAgB,EAAE,KAAK,aAAa,EAAE,OAAO,CAAC,CAAC,
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/Combobox/ComboboxNew/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4F,MAAM,OAAO,CAAC;AAIjH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAoB7C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKnE,eAAO,MAAM,OAAO,4BAAgD,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,YAAY,SAAU,UAAU,gBAAgB,EAAE,KAAK,aAAa,EAAE,OAAO,CAAC,CAAC,2FAsYtF,CAAC;AAEP,eAAO,MAAM,cAAc;;;mBAxYQ,UAAU,gBAAgB,EAAE,KAAK,aAAa,EAAE,OAAO,CAAC,CAAC;;;;;;;;;;;;;;;;;;CA6Z3F,CAAC"}
|
@@ -27,7 +27,7 @@ declare type Props = {
|
|
27
27
|
dispatchPath: Dispatch<PathAction>;
|
28
28
|
pathMap: PathMapType;
|
29
29
|
focusedToValueMap: FocusedToValueMapType;
|
30
|
-
|
30
|
+
handleListToggle: (opened: boolean) => void;
|
31
31
|
handlePressDown: (item: ItemOptionTransformed, e?: React.MouseEvent<HTMLElement>) => void;
|
32
32
|
multiselect: ComboboxProps['multiple'];
|
33
33
|
setTextValue: React.Dispatch<React.SetStateAction<string>>;
|
@@ -35,6 +35,6 @@ declare type Props = {
|
|
35
35
|
declare type ReturnedProps = {
|
36
36
|
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
37
37
|
};
|
38
|
-
export declare const useKeyNavigation: ({ focusedPath, dispatchFocusedPath, path, dispatchPath, pathMap, focusedToValueMap,
|
38
|
+
export declare const useKeyNavigation: ({ focusedPath, dispatchFocusedPath, path, dispatchPath, pathMap, focusedToValueMap, handleListToggle, handlePressDown, multiselect, setTextValue, }: Props) => ReturnedProps;
|
39
39
|
export {};
|
40
40
|
//# sourceMappingURL=useKeyboardNavigation.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAInE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;CAchB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gHAI5B,CAAC;AAEF,aAAK,KAAK,GAAG;IACT,WAAW,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACjD,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,EAAE,WAAW,CAAC;IACrB,iBAAiB,EAAE,qBAAqB,CAAC;IACzC,
|
1
|
+
{"version":3,"file":"useKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAInE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;CAchB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gHAI5B,CAAC;AAEF,aAAK,KAAK,GAAG;IACT,WAAW,EAAE,gBAAgB,CAAC;IAC9B,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACjD,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,EAAE,WAAW,CAAC;IACrB,iBAAiB,EAAE,qBAAqB,CAAC;IACzC,gBAAgB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,CAAC,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC1F,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAC9D,CAAC;AAEF,aAAK,aAAa,GAAG;IACjB,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,eAAO,MAAM,gBAAgB,wJAW1B,KAAK,KAAG,aA0PV,CAAC"}
|