@vkontakte/vkui 6.2.0 → 6.2.1
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.
- package/dist/cjs/components/Avatar/Avatar.d.ts +1 -4
- package/dist/cjs/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/cjs/components/ChipsInputBase/ChipsInputBase.js +2 -2
- package/dist/cjs/components/ChipsInputBase/ChipsInputBase.js.map +1 -1
- package/dist/cjs/components/ChipsInputBase/constants.js +2 -3
- package/dist/cjs/components/ChipsInputBase/constants.js.map +1 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.js +4 -5
- package/dist/cjs/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cjs/components/GridAvatar/GridAvatar.js +1 -1
- package/dist/cjs/components/GridAvatar/GridAvatar.js.map +1 -1
- package/dist/cjs/components/Image/Image.d.ts +2 -4
- package/dist/cjs/components/Image/Image.d.ts.map +1 -1
- package/dist/cjs/components/ImageBase/ImageBase.d.ts +1 -4
- package/dist/cjs/components/ImageBase/ImageBase.d.ts.map +1 -1
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.d.ts +4 -38
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.d.ts.map +1 -1
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.js +60 -19
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.js.map +1 -1
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/hooks.d.ts +6 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/hooks.d.ts.map +1 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/hooks.js +37 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/hooks.js.map +1 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/types.d.ts +54 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/types.d.ts.map +1 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/types.js +8 -0
- package/dist/cjs/components/ImageBase/ImageBaseOverlay/types.js.map +1 -0
- package/dist/cjs/components/Popover/Popover.d.ts +2 -2
- package/dist/cjs/components/Popover/Popover.d.ts.map +1 -1
- package/dist/cjs/components/Popover/Popover.js +4 -2
- package/dist/cjs/components/Popover/Popover.js.map +1 -1
- package/dist/cjs/hooks/useEnsuredControl.js +1 -1
- package/dist/cjs/hooks/useEnsuredControl.js.map +1 -1
- package/dist/cjs/lib/tokens/TokensClassProvider.d.ts.map +1 -1
- package/dist/cjs/lib/tokens/TokensClassProvider.js +1 -1
- package/dist/cjs/lib/tokens/TokensClassProvider.js.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -4
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/ChipsInputBase/ChipsInputBase.js +2 -2
- package/dist/components/ChipsInputBase/ChipsInputBase.js.map +1 -1
- package/dist/components/ChipsInputBase/constants.js +2 -3
- package/dist/components/ChipsInputBase/constants.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.js +4 -5
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/GridAvatar/GridAvatar.js +1 -1
- package/dist/components/GridAvatar/GridAvatar.js.map +1 -1
- package/dist/components/Image/Image.d.ts +2 -4
- package/dist/components/Image/Image.d.ts.map +1 -1
- package/dist/components/ImageBase/ImageBase.d.ts +1 -4
- package/dist/components/ImageBase/ImageBase.d.ts.map +1 -1
- package/dist/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.d.ts +4 -38
- package/dist/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.d.ts.map +1 -1
- package/dist/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.js +64 -23
- package/dist/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.js.map +1 -1
- package/dist/components/ImageBase/ImageBaseOverlay/hooks.d.ts +6 -0
- package/dist/components/ImageBase/ImageBaseOverlay/hooks.d.ts.map +1 -0
- package/dist/components/ImageBase/ImageBaseOverlay/hooks.js +26 -0
- package/dist/components/ImageBase/ImageBaseOverlay/hooks.js.map +1 -0
- package/dist/components/ImageBase/ImageBaseOverlay/types.d.ts +54 -0
- package/dist/components/ImageBase/ImageBaseOverlay/types.d.ts.map +1 -0
- package/dist/components/ImageBase/ImageBaseOverlay/types.js +3 -0
- package/dist/components/ImageBase/ImageBaseOverlay/types.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +2 -2
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +4 -2
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components.css +2 -2
- package/dist/components.css.map +1 -1
- package/dist/components.js.tmp +235 -117
- package/dist/cssm/components/Avatar/Avatar.d.ts +1 -4
- package/dist/cssm/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/cssm/components/ChipsInputBase/ChipsInputBase.js +2 -2
- package/dist/cssm/components/ChipsInputBase/ChipsInputBase.js.map +1 -1
- package/dist/cssm/components/ChipsInputBase/constants.js +2 -2
- package/dist/cssm/components/ChipsInputBase/constants.js.map +1 -1
- package/dist/cssm/components/CustomScrollView/CustomScrollView.module.css +2 -0
- package/dist/cssm/components/CustomSelect/CustomSelect.js +4 -4
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/CustomSelectOption/CustomSelectOption.module.css +1 -0
- package/dist/cssm/components/GridAvatar/GridAvatar.js +1 -1
- package/dist/cssm/components/GridAvatar/GridAvatar.js.map +1 -1
- package/dist/cssm/components/Image/Image.d.ts +2 -4
- package/dist/cssm/components/Image/Image.d.ts.map +1 -1
- package/dist/cssm/components/ImageBase/ImageBase.d.ts +1 -4
- package/dist/cssm/components/ImageBase/ImageBase.d.ts.map +1 -1
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.d.ts +4 -38
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.d.ts.map +1 -1
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.js +54 -18
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.js.map +1 -1
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.module.css +10 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/hooks.d.ts +6 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/hooks.d.ts.map +1 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/hooks.js +26 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/hooks.js.map +1 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/types.d.ts +54 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/types.d.ts.map +1 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/types.js +3 -0
- package/dist/cssm/components/ImageBase/ImageBaseOverlay/types.js.map +1 -0
- package/dist/cssm/components/ModalDismissButton/ModalDismissButton.module.css +5 -6
- package/dist/cssm/components/Popover/Popover.d.ts +2 -2
- package/dist/cssm/components/Popover/Popover.d.ts.map +1 -1
- package/dist/cssm/components/Popover/Popover.js +3 -2
- package/dist/cssm/components/Popover/Popover.js.map +1 -1
- package/dist/cssm/hooks/useEnsuredControl.js +1 -1
- package/dist/cssm/hooks/useEnsuredControl.js.map +1 -1
- package/dist/cssm/lib/tokens/TokensClassProvider.d.ts.map +1 -1
- package/dist/cssm/lib/tokens/TokensClassProvider.js +2 -1
- package/dist/cssm/lib/tokens/TokensClassProvider.js.map +1 -1
- package/dist/cssm/lib/tokens/TokensClassProvider.module.css +4 -0
- package/dist/hooks/useEnsuredControl.js +1 -1
- package/dist/hooks/useEnsuredControl.js.map +1 -1
- package/dist/lib/tokens/TokensClassProvider.d.ts.map +1 -1
- package/dist/lib/tokens/TokensClassProvider.js +1 -1
- package/dist/lib/tokens/TokensClassProvider.js.map +1 -1
- package/dist/vkui.css +2 -2
- package/dist/vkui.css.map +1 -1
- package/dist/vkui.js.tmp +235 -117
- package/package.json +1 -1
- package/src/components/ChipsInputBase/ChipsInputBase.tsx +2 -2
- package/src/components/ChipsInputBase/constants.tsx +2 -2
- package/src/components/CustomScrollView/CustomScrollView.module.css +2 -0
- package/src/components/CustomSelect/CustomSelect.tsx +7 -7
- package/src/components/CustomSelectOption/CustomSelectOption.module.css +1 -0
- package/src/components/GridAvatar/GridAvatar.tsx +1 -1
- package/src/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.module.css +10 -0
- package/src/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.tsx +89 -65
- package/src/components/ImageBase/ImageBaseOverlay/hooks.ts +26 -0
- package/src/components/ImageBase/ImageBaseOverlay/types.ts +58 -0
- package/src/components/ModalDismissButton/ModalDismissButton.module.css +5 -6
- package/src/components/Popover/Popover.tsx +3 -0
- package/src/hooks/useEnsuredControl.ts +1 -1
- package/src/lib/tokens/TokensClassProvider.module.css +4 -0
- package/src/lib/tokens/TokensClassProvider.tsx +6 -1
package/dist/vkui.js.tmp
CHANGED
|
@@ -4990,15 +4990,19 @@ var getAppearanceTokenClassNameByPlatform = function(platform, tokensClassNames)
|
|
|
4990
4990
|
return tokensClassName ? tokensClassName : DEFAULT_TOKENS_CLASS_NAMES[platform][appearance];
|
|
4991
4991
|
};
|
|
4992
4992
|
|
|
4993
|
+
;// CONCATENATED MODULE: ./src/lib/tokens/TokensClassProvider.module.css
|
|
4994
|
+
// extracted by mini-css-extract-plugin
|
|
4995
|
+
|
|
4993
4996
|
;// CONCATENATED MODULE: ./src/lib/tokens/TokensClassProvider.tsx
|
|
4994
4997
|
|
|
4995
4998
|
|
|
4996
4999
|
|
|
5000
|
+
|
|
4997
5001
|
var InjectTokenClassNameToChild = function(param) {
|
|
4998
5002
|
var children = param.children;
|
|
4999
5003
|
var tokensClassName = useTokensClassName();
|
|
5000
5004
|
return /*#__PURE__*/ React.cloneElement(children, {
|
|
5001
|
-
className: classNames(tokensClassName, children.props.className)
|
|
5005
|
+
className: classNames(tokensClassName, "vkuiTokensClassProvider--default-color", children.props.className)
|
|
5002
5006
|
});
|
|
5003
5007
|
};
|
|
5004
5008
|
var TokensClassProvider_TokensClassProvider = function(param) {
|
|
@@ -9254,6 +9258,165 @@ function useAppearance_useAppearance() {
|
|
|
9254
9258
|
return appearance !== null && appearance !== void 0 ? appearance : appearance_DEFAULT_APPEARANCE;
|
|
9255
9259
|
}
|
|
9256
9260
|
|
|
9261
|
+
;// CONCATENATED MODULE: ./src/hooks/useFocusWithin.ts
|
|
9262
|
+
function useFocusWithin_array_like_to_array(arr, len) {
|
|
9263
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9264
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9265
|
+
return arr2;
|
|
9266
|
+
}
|
|
9267
|
+
function useFocusWithin_array_with_holes(arr) {
|
|
9268
|
+
if (Array.isArray(arr)) return arr;
|
|
9269
|
+
}
|
|
9270
|
+
function useFocusWithin_iterable_to_array_limit(arr, i) {
|
|
9271
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9272
|
+
if (_i == null) return;
|
|
9273
|
+
var _arr = [];
|
|
9274
|
+
var _n = true;
|
|
9275
|
+
var _d = false;
|
|
9276
|
+
var _s, _e;
|
|
9277
|
+
try {
|
|
9278
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
9279
|
+
_arr.push(_s.value);
|
|
9280
|
+
if (i && _arr.length === i) break;
|
|
9281
|
+
}
|
|
9282
|
+
} catch (err) {
|
|
9283
|
+
_d = true;
|
|
9284
|
+
_e = err;
|
|
9285
|
+
} finally{
|
|
9286
|
+
try {
|
|
9287
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
9288
|
+
} finally{
|
|
9289
|
+
if (_d) throw _e;
|
|
9290
|
+
}
|
|
9291
|
+
}
|
|
9292
|
+
return _arr;
|
|
9293
|
+
}
|
|
9294
|
+
function useFocusWithin_non_iterable_rest() {
|
|
9295
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9296
|
+
}
|
|
9297
|
+
function useFocusWithin_sliced_to_array(arr, i) {
|
|
9298
|
+
return useFocusWithin_array_with_holes(arr) || useFocusWithin_iterable_to_array_limit(arr, i) || useFocusWithin_unsupported_iterable_to_array(arr, i) || useFocusWithin_non_iterable_rest();
|
|
9299
|
+
}
|
|
9300
|
+
function useFocusWithin_unsupported_iterable_to_array(o, minLen) {
|
|
9301
|
+
if (!o) return;
|
|
9302
|
+
if (typeof o === "string") return useFocusWithin_array_like_to_array(o, minLen);
|
|
9303
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9304
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9305
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9306
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useFocusWithin_array_like_to_array(o, minLen);
|
|
9307
|
+
}
|
|
9308
|
+
|
|
9309
|
+
|
|
9310
|
+
|
|
9311
|
+
var isFocusWithin = function(ref, document) {
|
|
9312
|
+
return ref.contains(document.activeElement);
|
|
9313
|
+
};
|
|
9314
|
+
function useFocusWithin_useFocusWithin(ref) {
|
|
9315
|
+
var document = dom_useDOM().document;
|
|
9316
|
+
var _React_useState = useFocusWithin_sliced_to_array(react.useState(function() {
|
|
9317
|
+
return ref.current && document ? isFocusWithin(ref.current, document) : false;
|
|
9318
|
+
}), 2), focusWithin = _React_useState[0], setFocusWithin = _React_useState[1];
|
|
9319
|
+
useIsomorphicLayoutEffect_useIsomorphicLayoutEffect(function handleAutoFocus() {
|
|
9320
|
+
/* istanbul ignore if: невозможный кейс, т.к. в SSR эффекты не вызываются. Проверка на будущее, если вдруг эффект будет вызываться. */ if (!document) {
|
|
9321
|
+
return;
|
|
9322
|
+
}
|
|
9323
|
+
var handleFocusOrBlurEvents = function() {
|
|
9324
|
+
if (ref.current) {
|
|
9325
|
+
setFocusWithin(isFocusWithin(ref.current, document));
|
|
9326
|
+
}
|
|
9327
|
+
};
|
|
9328
|
+
// Вызываем в начале, чтобы проверить autoFocus
|
|
9329
|
+
void handleFocusOrBlurEvents();
|
|
9330
|
+
document.addEventListener('focus', handleFocusOrBlurEvents, {
|
|
9331
|
+
capture: true
|
|
9332
|
+
});
|
|
9333
|
+
document.addEventListener('blur', handleFocusOrBlurEvents, {
|
|
9334
|
+
capture: true
|
|
9335
|
+
});
|
|
9336
|
+
return function() {
|
|
9337
|
+
document.removeEventListener('focus', handleFocusOrBlurEvents, {
|
|
9338
|
+
capture: true
|
|
9339
|
+
});
|
|
9340
|
+
document.removeEventListener('blur', handleFocusOrBlurEvents, {
|
|
9341
|
+
capture: true
|
|
9342
|
+
});
|
|
9343
|
+
};
|
|
9344
|
+
}, []);
|
|
9345
|
+
return focusWithin;
|
|
9346
|
+
}
|
|
9347
|
+
|
|
9348
|
+
;// CONCATENATED MODULE: ./src/components/ImageBase/ImageBaseOverlay/hooks.ts
|
|
9349
|
+
function hooks_array_like_to_array(arr, len) {
|
|
9350
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9351
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9352
|
+
return arr2;
|
|
9353
|
+
}
|
|
9354
|
+
function hooks_array_with_holes(arr) {
|
|
9355
|
+
if (Array.isArray(arr)) return arr;
|
|
9356
|
+
}
|
|
9357
|
+
function hooks_iterable_to_array_limit(arr, i) {
|
|
9358
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9359
|
+
if (_i == null) return;
|
|
9360
|
+
var _arr = [];
|
|
9361
|
+
var _n = true;
|
|
9362
|
+
var _d = false;
|
|
9363
|
+
var _s, _e;
|
|
9364
|
+
try {
|
|
9365
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
9366
|
+
_arr.push(_s.value);
|
|
9367
|
+
if (i && _arr.length === i) break;
|
|
9368
|
+
}
|
|
9369
|
+
} catch (err) {
|
|
9370
|
+
_d = true;
|
|
9371
|
+
_e = err;
|
|
9372
|
+
} finally{
|
|
9373
|
+
try {
|
|
9374
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
9375
|
+
} finally{
|
|
9376
|
+
if (_d) throw _e;
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
return _arr;
|
|
9380
|
+
}
|
|
9381
|
+
function hooks_non_iterable_rest() {
|
|
9382
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9383
|
+
}
|
|
9384
|
+
function hooks_sliced_to_array(arr, i) {
|
|
9385
|
+
return hooks_array_with_holes(arr) || hooks_iterable_to_array_limit(arr, i) || hooks_unsupported_iterable_to_array(arr, i) || hooks_non_iterable_rest();
|
|
9386
|
+
}
|
|
9387
|
+
function hooks_unsupported_iterable_to_array(o, minLen) {
|
|
9388
|
+
if (!o) return;
|
|
9389
|
+
if (typeof o === "string") return hooks_array_like_to_array(o, minLen);
|
|
9390
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9391
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9392
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9393
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return hooks_array_like_to_array(o, minLen);
|
|
9394
|
+
}
|
|
9395
|
+
|
|
9396
|
+
|
|
9397
|
+
|
|
9398
|
+
function useNonInteractiveOverlayProps(rootRef) {
|
|
9399
|
+
var focusWithin = useFocusWithin_useFocusWithin(rootRef);
|
|
9400
|
+
var _React_useState = hooks_sliced_to_array(react.useState(false), 2), nonInteractiveFocusShown = _React_useState[0], setNonInteractiveFocusShown = _React_useState[1];
|
|
9401
|
+
function onClick(event) {
|
|
9402
|
+
if (event.detail > 0) {
|
|
9403
|
+
// Если мы попали на вложенный в оверлей элемент через focus,
|
|
9404
|
+
// то при клике мышкой мы должны начать реагировать на hover-состояние,
|
|
9405
|
+
// даже если фокус всё ещё остался на вложенном элементе (был по нему клик)
|
|
9406
|
+
setNonInteractiveFocusShown(false);
|
|
9407
|
+
}
|
|
9408
|
+
}
|
|
9409
|
+
useIsomorphicLayoutEffect_useIsomorphicLayoutEffect(function() {
|
|
9410
|
+
setNonInteractiveFocusShown(focusWithin);
|
|
9411
|
+
}, [
|
|
9412
|
+
focusWithin
|
|
9413
|
+
]);
|
|
9414
|
+
return {
|
|
9415
|
+
shown: nonInteractiveFocusShown && focusWithin,
|
|
9416
|
+
onClick: onClick
|
|
9417
|
+
};
|
|
9418
|
+
}
|
|
9419
|
+
|
|
9257
9420
|
;// CONCATENATED MODULE: ./src/components/ImageBase/ImageBaseOverlay/ImageBaseOverlay.module.css
|
|
9258
9421
|
// extracted by mini-css-extract-plugin
|
|
9259
9422
|
|
|
@@ -9346,30 +9509,70 @@ function ImageBaseOverlay_object_without_properties_loose(source, excluded) {
|
|
|
9346
9509
|
|
|
9347
9510
|
|
|
9348
9511
|
|
|
9512
|
+
|
|
9513
|
+
|
|
9514
|
+
|
|
9515
|
+
var ImageBaseOverlayInteractive = function(_param) {
|
|
9516
|
+
var children = _param.children, className = _param.className, getRootRef = _param.getRootRef, disableInteractive = _param.disableInteractive, overlayShown = _param.overlayShown, restProps = ImageBaseOverlay_object_without_properties(_param, [
|
|
9517
|
+
"children",
|
|
9518
|
+
"className",
|
|
9519
|
+
"getRootRef",
|
|
9520
|
+
"disableInteractive",
|
|
9521
|
+
"overlayShown"
|
|
9522
|
+
]);
|
|
9523
|
+
var _useFocusVisible = useFocusVisible_useFocusVisible(), focusVisible = _useFocusVisible.focusVisible, focusEvents = ImageBaseOverlay_object_without_properties(_useFocusVisible, [
|
|
9524
|
+
"focusVisible"
|
|
9525
|
+
]);
|
|
9526
|
+
var focusVisibleClassNames = useFocusVisibleClassName_useFocusVisibleClassName({
|
|
9527
|
+
focusVisible: focusVisible,
|
|
9528
|
+
mode: 'inside'
|
|
9529
|
+
});
|
|
9530
|
+
var keyboardHandlers = useKeyboard_useKeyboard();
|
|
9531
|
+
if (false) { var size; }
|
|
9532
|
+
return /*#__PURE__*/ react.createElement("div", ImageBaseOverlay_object_spread(ImageBaseOverlay_object_spread_props(ImageBaseOverlay_object_spread({}, restProps), {
|
|
9533
|
+
tabIndex: 0,
|
|
9534
|
+
role: "button",
|
|
9535
|
+
className: classNames_classNames("vkuiImageBaseOverlay--clickable", (focusVisible || overlayShown) && "vkuiImageBaseOverlay--visible", focusVisibleClassNames, className),
|
|
9536
|
+
ref: getRootRef
|
|
9537
|
+
}), focusEvents, keyboardHandlers), children);
|
|
9538
|
+
};
|
|
9539
|
+
var ImageBaseOverlayNonInteractive = function(_param) {
|
|
9540
|
+
var className = _param.className, getRootRef = _param.getRootRef, disableInteractive = _param.disableInteractive, overlayShownProps = _param.overlayShown, restProps = ImageBaseOverlay_object_without_properties(_param, [
|
|
9541
|
+
"className",
|
|
9542
|
+
"getRootRef",
|
|
9543
|
+
"disableInteractive",
|
|
9544
|
+
"overlayShown"
|
|
9545
|
+
]);
|
|
9546
|
+
var rootRef = useExternRef_useExternRef(getRootRef);
|
|
9547
|
+
var _useNonInteractiveOverlayProps = useNonInteractiveOverlayProps(rootRef), overlayShown = _useNonInteractiveOverlayProps.shown, onOverlayClick = _useNonInteractiveOverlayProps.onClick;
|
|
9548
|
+
return /*#__PURE__*/ react.createElement("div", ImageBaseOverlay_object_spread_props(ImageBaseOverlay_object_spread({}, restProps), {
|
|
9549
|
+
ref: rootRef,
|
|
9550
|
+
className: classNames_classNames((overlayShown || overlayShownProps) && "vkuiImageBaseOverlay--visible", className),
|
|
9551
|
+
onClick: onOverlayClick
|
|
9552
|
+
}));
|
|
9553
|
+
};
|
|
9349
9554
|
/**
|
|
9350
|
-
*
|
|
9555
|
+
* Оверлей над картинкой.
|
|
9351
9556
|
*/ var ImageBaseOverlay = function(_param) {
|
|
9352
|
-
var className = _param.className, themeProp = _param.theme, visibilityProp = _param.visibility,
|
|
9557
|
+
var className = _param.className, themeProp = _param.theme, visibilityProp = _param.visibility, restProps = ImageBaseOverlay_object_without_properties(_param, [
|
|
9353
9558
|
"className",
|
|
9354
9559
|
"theme",
|
|
9355
|
-
"visibility"
|
|
9356
|
-
"children",
|
|
9357
|
-
"onClick"
|
|
9560
|
+
"visibility"
|
|
9358
9561
|
]);
|
|
9359
9562
|
var appearance = useAppearance_useAppearance();
|
|
9360
9563
|
var hasPointer = useAdaptivityHasPointer_useAdaptivityHasPointer();
|
|
9361
9564
|
var theme = themeProp !== null && themeProp !== void 0 ? themeProp : appearance;
|
|
9362
9565
|
var visibility = visibilityProp !== null && visibilityProp !== void 0 ? visibilityProp : hasPointer ? 'on-hover' : 'always';
|
|
9363
|
-
|
|
9364
|
-
var
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
}
|
|
9566
|
+
var commonClassNames = classNames_classNames("vkuiImageBaseOverlay", theme === 'light' && "vkuiImageBaseOverlay--theme-light", theme === 'dark' && "vkuiImageBaseOverlay--theme-dark", className);
|
|
9567
|
+
var commonProps = {
|
|
9568
|
+
className: commonClassNames,
|
|
9569
|
+
overlayShown: visibility === 'always'
|
|
9570
|
+
};
|
|
9571
|
+
// Не делаем деструктуризацию пропа, потому что Typescript не вывозит
|
|
9572
|
+
if (restProps.disableInteractive) {
|
|
9573
|
+
return /*#__PURE__*/ react.createElement(ImageBaseOverlayNonInteractive, ImageBaseOverlay_object_spread({}, restProps, commonProps));
|
|
9574
|
+
}
|
|
9575
|
+
return /*#__PURE__*/ react.createElement(ImageBaseOverlayInteractive, ImageBaseOverlay_object_spread({}, restProps, commonProps));
|
|
9373
9576
|
};
|
|
9374
9577
|
ImageBaseOverlay.displayName = 'ImageBaseOverlay';
|
|
9375
9578
|
|
|
@@ -12582,7 +12785,7 @@ function useEnsuredControl_useCustomEnsuredControl(param) {
|
|
|
12582
12785
|
var value = param.value, defaultValue = param.defaultValue, disabled = param.disabled, onChangeProp = param.onChange;
|
|
12583
12786
|
var isControlled = value !== undefined;
|
|
12584
12787
|
var _React_useState = useEnsuredControl_sliced_to_array(react.useState(defaultValue), 2), localValue = _React_useState[0], setLocalValue = _React_useState[1];
|
|
12585
|
-
var preservedControlledValueRef = react.useRef();
|
|
12788
|
+
var preservedControlledValueRef = react.useRef(value);
|
|
12586
12789
|
useIsomorphicLayoutEffect_useIsomorphicLayoutEffect(function() {
|
|
12587
12790
|
preservedControlledValueRef.current = value;
|
|
12588
12791
|
});
|
|
@@ -19542,93 +19745,6 @@ function ScreenSpinner_object_without_properties_loose(source, excluded) {
|
|
|
19542
19745
|
}, /*#__PURE__*/ React.createElement(Icon, null))));
|
|
19543
19746
|
};
|
|
19544
19747
|
|
|
19545
|
-
;// CONCATENATED MODULE: ./src/hooks/useFocusWithin.ts
|
|
19546
|
-
function useFocusWithin_array_like_to_array(arr, len) {
|
|
19547
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
19548
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
19549
|
-
return arr2;
|
|
19550
|
-
}
|
|
19551
|
-
function useFocusWithin_array_with_holes(arr) {
|
|
19552
|
-
if (Array.isArray(arr)) return arr;
|
|
19553
|
-
}
|
|
19554
|
-
function useFocusWithin_iterable_to_array_limit(arr, i) {
|
|
19555
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
19556
|
-
if (_i == null) return;
|
|
19557
|
-
var _arr = [];
|
|
19558
|
-
var _n = true;
|
|
19559
|
-
var _d = false;
|
|
19560
|
-
var _s, _e;
|
|
19561
|
-
try {
|
|
19562
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
19563
|
-
_arr.push(_s.value);
|
|
19564
|
-
if (i && _arr.length === i) break;
|
|
19565
|
-
}
|
|
19566
|
-
} catch (err) {
|
|
19567
|
-
_d = true;
|
|
19568
|
-
_e = err;
|
|
19569
|
-
} finally{
|
|
19570
|
-
try {
|
|
19571
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
19572
|
-
} finally{
|
|
19573
|
-
if (_d) throw _e;
|
|
19574
|
-
}
|
|
19575
|
-
}
|
|
19576
|
-
return _arr;
|
|
19577
|
-
}
|
|
19578
|
-
function useFocusWithin_non_iterable_rest() {
|
|
19579
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
19580
|
-
}
|
|
19581
|
-
function useFocusWithin_sliced_to_array(arr, i) {
|
|
19582
|
-
return useFocusWithin_array_with_holes(arr) || useFocusWithin_iterable_to_array_limit(arr, i) || useFocusWithin_unsupported_iterable_to_array(arr, i) || useFocusWithin_non_iterable_rest();
|
|
19583
|
-
}
|
|
19584
|
-
function useFocusWithin_unsupported_iterable_to_array(o, minLen) {
|
|
19585
|
-
if (!o) return;
|
|
19586
|
-
if (typeof o === "string") return useFocusWithin_array_like_to_array(o, minLen);
|
|
19587
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
19588
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
19589
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
19590
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useFocusWithin_array_like_to_array(o, minLen);
|
|
19591
|
-
}
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
|
|
19595
|
-
var isFocusWithin = function(ref, document) {
|
|
19596
|
-
return ref.contains(document.activeElement);
|
|
19597
|
-
};
|
|
19598
|
-
function useFocusWithin_useFocusWithin(ref) {
|
|
19599
|
-
var document = dom_useDOM().document;
|
|
19600
|
-
var _React_useState = useFocusWithin_sliced_to_array(react.useState(function() {
|
|
19601
|
-
return ref.current && document ? isFocusWithin(ref.current, document) : false;
|
|
19602
|
-
}), 2), focusWithin = _React_useState[0], setFocusWithin = _React_useState[1];
|
|
19603
|
-
useIsomorphicLayoutEffect_useIsomorphicLayoutEffect(function handleAutoFocus() {
|
|
19604
|
-
/* istanbul ignore if: невозможный кейс, т.к. в SSR эффекты не вызываются. Проверка на будущее, если вдруг эффект будет вызываться. */ if (!document) {
|
|
19605
|
-
return;
|
|
19606
|
-
}
|
|
19607
|
-
var handleFocusOrBlurEvents = function() {
|
|
19608
|
-
if (ref.current) {
|
|
19609
|
-
setFocusWithin(isFocusWithin(ref.current, document));
|
|
19610
|
-
}
|
|
19611
|
-
};
|
|
19612
|
-
// Вызываем в начале, чтобы проверить autoFocus
|
|
19613
|
-
void handleFocusOrBlurEvents();
|
|
19614
|
-
document.addEventListener('focus', handleFocusOrBlurEvents, {
|
|
19615
|
-
capture: true
|
|
19616
|
-
});
|
|
19617
|
-
document.addEventListener('blur', handleFocusOrBlurEvents, {
|
|
19618
|
-
capture: true
|
|
19619
|
-
});
|
|
19620
|
-
return function() {
|
|
19621
|
-
document.removeEventListener('focus', handleFocusOrBlurEvents, {
|
|
19622
|
-
capture: true
|
|
19623
|
-
});
|
|
19624
|
-
document.removeEventListener('blur', handleFocusOrBlurEvents, {
|
|
19625
|
-
capture: true
|
|
19626
|
-
});
|
|
19627
|
-
};
|
|
19628
|
-
}, []);
|
|
19629
|
-
return focusWithin;
|
|
19630
|
-
}
|
|
19631
|
-
|
|
19632
19748
|
;// CONCATENATED MODULE: ./src/hooks/useGlobalEscKeyDown.ts
|
|
19633
19749
|
|
|
19634
19750
|
|
|
@@ -29070,7 +29186,7 @@ var GridAvatar_warn = warnOnce('GridAvatar');
|
|
|
29070
29186
|
"aria-hidden": true
|
|
29071
29187
|
}, src.map(function(url, index) {
|
|
29072
29188
|
return index < MAX_GRID_LENGTH ? /*#__PURE__*/ React.createElement("div", {
|
|
29073
|
-
key:
|
|
29189
|
+
key: index,
|
|
29074
29190
|
className: "vkuiGridAvatar__item",
|
|
29075
29191
|
style: {
|
|
29076
29192
|
backgroundImage: "url(".concat(url, ")")
|
|
@@ -35206,12 +35322,11 @@ function constants_getNewOptionDataDefault(value, label) {
|
|
|
35206
35322
|
};
|
|
35207
35323
|
}
|
|
35208
35324
|
function constants_renderChipDefault(props) {
|
|
35209
|
-
var
|
|
35210
|
-
"disabled",
|
|
35325
|
+
var label = props.label, rest = constants_object_without_properties(props, [
|
|
35211
35326
|
"label"
|
|
35212
35327
|
]);
|
|
35213
35328
|
return /*#__PURE__*/ React.createElement(Chip, constants_object_spread({
|
|
35214
|
-
removable: !disabled
|
|
35329
|
+
removable: !props.disabled
|
|
35215
35330
|
}, rest), label);
|
|
35216
35331
|
}
|
|
35217
35332
|
|
|
@@ -35573,8 +35688,8 @@ var ChipsInputBase_ChipsInputBase = function(_param) {
|
|
|
35573
35688
|
'Component': 'div',
|
|
35574
35689
|
'value': option.value,
|
|
35575
35690
|
'label': option.label,
|
|
35576
|
-
'disabled': disabled,
|
|
35577
|
-
'readOnly': readOnly,
|
|
35691
|
+
'disabled': option.disabled || disabled,
|
|
35692
|
+
'readOnly': option.readOnly || readOnly,
|
|
35578
35693
|
'className': "vkuiChipsInputBase__chip",
|
|
35579
35694
|
'onRemove': handleChipRemove,
|
|
35580
35695
|
// чтобы можно было легче найти этот чип в DOM
|
|
@@ -39632,7 +39747,7 @@ var CustomSelect_defaultOptions = (/* unused pure expression or super */ null &&
|
|
|
39632
39747
|
var scrollToElement = React.useCallback(function(index) {
|
|
39633
39748
|
var center = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
39634
39749
|
var dropdown = scrollBoxRef.current;
|
|
39635
|
-
var item = dropdown ? dropdown.children[index] : null;
|
|
39750
|
+
var item = dropdown && dropdown.firstElementChild ? dropdown.firstElementChild.children[index] : null;
|
|
39636
39751
|
if (!item || !dropdown) {
|
|
39637
39752
|
return;
|
|
39638
39753
|
}
|
|
@@ -39925,11 +40040,10 @@ var CustomSelect_defaultOptions = (/* unused pure expression or super */ null &&
|
|
|
39925
40040
|
x: 0,
|
|
39926
40041
|
y: 0
|
|
39927
40042
|
});
|
|
39928
|
-
var focusOptionOnMouseMove = React.useCallback(function(e) {
|
|
40043
|
+
var focusOptionOnMouseMove = React.useCallback(function(e, index) {
|
|
39929
40044
|
var isMouseChangedPosition = Math.abs(prevMousePositionRef.current.x - e.clientX) >= 1 || Math.abs(prevMousePositionRef.current.y - e.clientY) >= 1;
|
|
39930
40045
|
if (isMouseChangedPosition) {
|
|
39931
|
-
|
|
39932
|
-
focusOptionByIndex(Array.prototype.indexOf.call((_e_currentTarget_parentNode = e.currentTarget.parentNode) === null || _e_currentTarget_parentNode === void 0 ? void 0 : _e_currentTarget_parentNode.children, e.currentTarget), false);
|
|
40046
|
+
focusOptionByIndex(index, false);
|
|
39933
40047
|
}
|
|
39934
40048
|
prevMousePositionRef.current = {
|
|
39935
40049
|
x: e.clientX,
|
|
@@ -39959,7 +40073,9 @@ var CustomSelect_defaultOptions = (/* unused pure expression or super */ null &&
|
|
|
39959
40073
|
// Причём координаты события меняются на пару пикселей по сравнению с прошлым вызовом,
|
|
39960
40074
|
// а значит нельзя на них опираться, чтобы запретить обработку такого события.
|
|
39961
40075
|
// C mousemove такой проблемы нет, что позволяет реализовать поведение при наведении с клавиатуры и при наведении мышью идентично `<select>`.
|
|
39962
|
-
onMouseMove:
|
|
40076
|
+
onMouseMove: function(e) {
|
|
40077
|
+
return focusOptionOnMouseMove(e, index);
|
|
40078
|
+
},
|
|
39963
40079
|
id: "".concat(popupAriaId, "-").concat(option.value)
|
|
39964
40080
|
}));
|
|
39965
40081
|
}, [
|
|
@@ -45233,7 +45349,7 @@ function Popover_unsupported_iterable_to_array(o, minLen) {
|
|
|
45233
45349
|
* @see https://vkcom.github.io/VKUI/#/Popover
|
|
45234
45350
|
*/ var Popover = function(_param) {
|
|
45235
45351
|
var // UsePopoverProps
|
|
45236
|
-
withArrow = _param.arrow, _param_arrowHeight = _param.arrowHeight, arrowHeight = _param_arrowHeight === void 0 ? DEFAULT_ARROW_HEIGHT : _param_arrowHeight, _param_arrowPadding = _param.arrowPadding, arrowPadding = _param_arrowPadding === void 0 ? DEFAULT_ARROW_PADDING : _param_arrowPadding, tmp = _param.placement, expectedPlacement = tmp === void 0 ? 'bottom-start' : tmp, onPlacementChange = _param.onPlacementChange, _param_disableFlipMiddleware = _param.disableFlipMiddleware, disableFlipMiddleware = _param_disableFlipMiddleware === void 0 ? false : _param_disableFlipMiddleware, _param_trigger = _param.trigger, trigger = _param_trigger === void 0 ? 'click' : _param_trigger, content = _param.content, _param_hoverDelay = _param.hoverDelay, hoverDelay = _param_hoverDelay === void 0 ? 150 : _param_hoverDelay, closeAfterClick = _param.closeAfterClick, _param_offsetByMainAxis = _param.offsetByMainAxis, offsetByMainAxis = _param_offsetByMainAxis === void 0 ? 8 : _param_offsetByMainAxis, _param_offsetByCrossAxis = _param.offsetByCrossAxis, offsetByCrossAxis = _param_offsetByCrossAxis === void 0 ? 0 : _param_offsetByCrossAxis, sameWidth = _param.sameWidth, hideWhenReferenceHidden = _param.hideWhenReferenceHidden, disabled = _param.disabled, disableInteractive = _param.disableInteractive, disableCloseOnClickOutside = _param.disableCloseOnClickOutside, disableCloseOnEscKey = _param.disableCloseOnEscKey, _param_keepMounted = _param.keepMounted, keepMounted = _param_keepMounted === void 0 ? false : _param_keepMounted, _param_defaultShown = _param.// uncontrolled
|
|
45352
|
+
withArrow = _param.arrow, _param_arrowHeight = _param.arrowHeight, arrowHeight = _param_arrowHeight === void 0 ? DEFAULT_ARROW_HEIGHT : _param_arrowHeight, _param_arrowPadding = _param.arrowPadding, arrowPadding = _param_arrowPadding === void 0 ? DEFAULT_ARROW_PADDING : _param_arrowPadding, tmp = _param.placement, expectedPlacement = tmp === void 0 ? 'bottom-start' : tmp, onPlacementChange = _param.onPlacementChange, _param_disableFlipMiddleware = _param.disableFlipMiddleware, disableFlipMiddleware = _param_disableFlipMiddleware === void 0 ? false : _param_disableFlipMiddleware, _param_trigger = _param.trigger, trigger = _param_trigger === void 0 ? 'click' : _param_trigger, content = _param.content, _param_hoverDelay = _param.hoverDelay, hoverDelay = _param_hoverDelay === void 0 ? 150 : _param_hoverDelay, closeAfterClick = _param.closeAfterClick, _param_offsetByMainAxis = _param.offsetByMainAxis, offsetByMainAxis = _param_offsetByMainAxis === void 0 ? 8 : _param_offsetByMainAxis, _param_offsetByCrossAxis = _param.offsetByCrossAxis, offsetByCrossAxis = _param_offsetByCrossAxis === void 0 ? 0 : _param_offsetByCrossAxis, sameWidth = _param.sameWidth, hideWhenReferenceHidden = _param.hideWhenReferenceHidden, disabled = _param.disabled, disableInteractive = _param.disableInteractive, disableCloseOnClickOutside = _param.disableCloseOnClickOutside, disableCloseOnEscKey = _param.disableCloseOnEscKey, _param_keepMounted = _param.keepMounted, keepMounted = _param_keepMounted === void 0 ? false : _param_keepMounted, customMiddlewares = _param.customMiddlewares, _param_defaultShown = _param.// uncontrolled
|
|
45237
45353
|
defaultShown, defaultShown = _param_defaultShown === void 0 ? false : _param_defaultShown, // controlled
|
|
45238
45354
|
shownProp = _param.shown, onShownChange = _param.onShownChange, _param_usePortal = _param.// Для AppRootPortal
|
|
45239
45355
|
usePortal, usePortal = _param_usePortal === void 0 ? true : _param_usePortal, // Для FloatingArrow
|
|
@@ -45259,6 +45375,7 @@ function Popover_unsupported_iterable_to_array(o, minLen) {
|
|
|
45259
45375
|
"disableCloseOnClickOutside",
|
|
45260
45376
|
"disableCloseOnEscKey",
|
|
45261
45377
|
"keepMounted",
|
|
45378
|
+
"customMiddlewares",
|
|
45262
45379
|
"defaultShown",
|
|
45263
45380
|
"shown",
|
|
45264
45381
|
"onShownChange",
|
|
@@ -45284,7 +45401,8 @@ function Popover_unsupported_iterable_to_array(o, minLen) {
|
|
|
45284
45401
|
offsetByCrossAxis: offsetByCrossAxis,
|
|
45285
45402
|
sameWidth: sameWidth,
|
|
45286
45403
|
hideWhenReferenceHidden: hideWhenReferenceHidden,
|
|
45287
|
-
disableFlipMiddleware: disableFlipMiddleware
|
|
45404
|
+
disableFlipMiddleware: disableFlipMiddleware,
|
|
45405
|
+
customMiddlewares: customMiddlewares
|
|
45288
45406
|
}), middlewares = _useFloatingMiddlewaresBootstrap.middlewares, strictPlacement = _useFloatingMiddlewaresBootstrap.strictPlacement;
|
|
45289
45407
|
var _useFloatingWithInteractions = useFloatingWithInteractions({
|
|
45290
45408
|
middlewares: middlewares,
|
package/package.json
CHANGED
|
@@ -222,8 +222,8 @@ export const ChipsInputBase = <O extends ChipOption>({
|
|
|
222
222
|
'Component': 'div',
|
|
223
223
|
'value': option.value,
|
|
224
224
|
'label': option.label,
|
|
225
|
-
'disabled': disabled,
|
|
226
|
-
'readOnly': readOnly,
|
|
225
|
+
'disabled': option.disabled || disabled,
|
|
226
|
+
'readOnly': option.readOnly || readOnly,
|
|
227
227
|
'className': styles['ChipsInputBase__chip'],
|
|
228
228
|
'onRemove': handleChipRemove,
|
|
229
229
|
// чтобы можно было легче найти этот чип в DOM
|
|
@@ -26,9 +26,9 @@ export function getNewOptionDataDefault<O extends ChipOption>(
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function renderChipDefault(props: RenderChipProps): React.ReactNode {
|
|
29
|
-
const {
|
|
29
|
+
const { label, ...rest } = props;
|
|
30
30
|
return (
|
|
31
|
-
<Chip removable={!disabled} {...rest}>
|
|
31
|
+
<Chip removable={!props.disabled} {...rest}>
|
|
32
32
|
{label}
|
|
33
33
|
</Chip>
|
|
34
34
|
);
|
|
@@ -321,7 +321,10 @@ export function CustomSelect<OptionInterfaceT extends CustomSelectOptionInterfac
|
|
|
321
321
|
|
|
322
322
|
const scrollToElement = React.useCallback((index: number, center = false) => {
|
|
323
323
|
const dropdown = scrollBoxRef.current;
|
|
324
|
-
const item =
|
|
324
|
+
const item =
|
|
325
|
+
dropdown && dropdown.firstElementChild
|
|
326
|
+
? (dropdown.firstElementChild.children[index] as HTMLElement)
|
|
327
|
+
: null;
|
|
325
328
|
|
|
326
329
|
if (!item || !dropdown) {
|
|
327
330
|
return;
|
|
@@ -632,16 +635,13 @@ export function CustomSelect<OptionInterfaceT extends CustomSelectOptionInterfac
|
|
|
632
635
|
y: React.MouseEvent['clientY'];
|
|
633
636
|
}>({ x: 0, y: 0 });
|
|
634
637
|
const focusOptionOnMouseMove = React.useCallback(
|
|
635
|
-
(e: React.MouseEvent<HTMLElement
|
|
638
|
+
(e: React.MouseEvent<HTMLElement>, index: number) => {
|
|
636
639
|
const isMouseChangedPosition =
|
|
637
640
|
Math.abs(prevMousePositionRef.current.x - e.clientX) >= 1 ||
|
|
638
641
|
Math.abs(prevMousePositionRef.current.y - e.clientY) >= 1;
|
|
639
642
|
|
|
640
643
|
if (isMouseChangedPosition) {
|
|
641
|
-
focusOptionByIndex(
|
|
642
|
-
Array.prototype.indexOf.call(e.currentTarget.parentNode?.children, e.currentTarget),
|
|
643
|
-
false,
|
|
644
|
-
);
|
|
644
|
+
focusOptionByIndex(index, false);
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
prevMousePositionRef.current = { x: e.clientX, y: e.clientY };
|
|
@@ -672,7 +672,7 @@ export function CustomSelect<OptionInterfaceT extends CustomSelectOptionInterfac
|
|
|
672
672
|
// Причём координаты события меняются на пару пикселей по сравнению с прошлым вызовом,
|
|
673
673
|
// а значит нельзя на них опираться, чтобы запретить обработку такого события.
|
|
674
674
|
// C mousemove такой проблемы нет, что позволяет реализовать поведение при наведении с клавиатуры и при наведении мышью идентично `<select>`.
|
|
675
|
-
onMouseMove: focusOptionOnMouseMove,
|
|
675
|
+
onMouseMove: (e) => focusOptionOnMouseMove(e, index),
|
|
676
676
|
id: `${popupAriaId}-${option.value}`,
|
|
677
677
|
})}
|
|
678
678
|
</React.Fragment>
|
|
@@ -20,6 +20,16 @@
|
|
|
20
20
|
opacity: 1;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
@media (--hover-has) {
|
|
24
|
+
.ImageBaseOverlay:hover {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ImageBaseOverlay--clickable {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
.ImageBaseOverlay--theme-light {
|
|
24
34
|
color: var(--vkui--color_icon_accent);
|
|
25
35
|
background-color: var(--vkui--color_avatar_overlay_inverse_alpha);
|