@ozen-ui/kit 0.55.0 → 0.57.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.
- package/__inner__/cjs/components/Autocomplete/helper.d.ts +2 -2
- package/__inner__/cjs/components/Autocomplete/types.d.ts +1 -1
- package/__inner__/cjs/components/ButtonBase/ButtonBase.js +13 -8
- package/__inner__/cjs/components/Calendar/components/CalendarGridItem/types.d.ts +1 -1
- package/__inner__/cjs/components/DataList/components/DataListOption/DataListOption.css +0 -1
- package/__inner__/cjs/components/DataList/constants.d.ts +1 -1
- package/__inner__/cjs/components/DataList/constants.js +1 -2
- package/__inner__/cjs/components/Dialog/Dialog.d.ts +1 -2
- package/__inner__/cjs/components/Drawer/Drawer.d.ts +1 -2
- package/__inner__/cjs/components/FieldInput/FieldInput.js +2 -2
- package/__inner__/cjs/components/Menu/Menu.js +2 -1
- package/__inner__/cjs/components/Modal/Modal.d.ts +1 -2
- package/__inner__/cjs/components/Modal/Modal.js +5 -6
- package/__inner__/cjs/components/Modal/constants.d.ts +0 -1
- package/__inner__/cjs/components/Modal/constants.js +1 -2
- package/__inner__/cjs/components/Modal/types.d.ts +0 -3
- package/__inner__/cjs/components/Popover/Popover.d.ts +1 -1
- package/__inner__/cjs/components/Popover/Popover.js +8 -3
- package/__inner__/cjs/components/Popover/constants.d.ts +1 -1
- package/__inner__/cjs/components/Popover/constants.js +1 -2
- package/__inner__/cjs/components/Popover/types.d.ts +2 -4
- package/__inner__/cjs/components/Portal/Portal.js +3 -3
- package/__inner__/cjs/components/Portal/constants.d.ts +2 -0
- package/__inner__/cjs/components/Portal/constants.js +3 -1
- package/__inner__/cjs/components/Portal/types.d.ts +3 -0
- package/__inner__/cjs/components/Select/types.d.ts +2 -1
- package/__inner__/cjs/components/Snackbar/SnackbarContext.js +1 -4
- package/__inner__/cjs/components/Snackbar/components/Snackbar/Snackbar.d.ts +1 -1
- package/__inner__/cjs/components/Tooltip/Tooltip.js +11 -11
- package/__inner__/cjs/components/Tooltip/constants.d.ts +1 -1
- package/__inner__/cjs/components/Tooltip/constants.js +1 -2
- package/__inner__/cjs/components/Tooltip/types.d.ts +1 -1
- package/__inner__/cjs/hooks/useControlled/useControlled.js +1 -1
- package/__inner__/esm/components/Autocomplete/helper.d.ts +2 -2
- package/__inner__/esm/components/Autocomplete/types.d.ts +1 -1
- package/__inner__/esm/components/ButtonBase/ButtonBase.js +13 -8
- package/__inner__/esm/components/Calendar/components/CalendarGridItem/types.d.ts +1 -1
- package/__inner__/esm/components/DataList/components/DataListOption/DataListOption.css +0 -1
- package/__inner__/esm/components/DataList/constants.d.ts +1 -1
- package/__inner__/esm/components/DataList/constants.js +1 -2
- package/__inner__/esm/components/Dialog/Dialog.d.ts +1 -2
- package/__inner__/esm/components/Drawer/Drawer.d.ts +1 -2
- package/__inner__/esm/components/FieldInput/FieldInput.js +2 -2
- package/__inner__/esm/components/Menu/Menu.js +2 -1
- package/__inner__/esm/components/Modal/Modal.d.ts +1 -2
- package/__inner__/esm/components/Modal/Modal.js +6 -7
- package/__inner__/esm/components/Modal/constants.d.ts +0 -1
- package/__inner__/esm/components/Modal/constants.js +0 -1
- package/__inner__/esm/components/Modal/types.d.ts +0 -3
- package/__inner__/esm/components/Popover/Popover.d.ts +1 -1
- package/__inner__/esm/components/Popover/Popover.js +9 -4
- package/__inner__/esm/components/Popover/constants.d.ts +1 -1
- package/__inner__/esm/components/Popover/constants.js +1 -2
- package/__inner__/esm/components/Popover/types.d.ts +2 -4
- package/__inner__/esm/components/Portal/Portal.js +4 -4
- package/__inner__/esm/components/Portal/constants.d.ts +2 -0
- package/__inner__/esm/components/Portal/constants.js +2 -0
- package/__inner__/esm/components/Portal/types.d.ts +3 -0
- package/__inner__/esm/components/Select/types.d.ts +2 -1
- package/__inner__/esm/components/Snackbar/SnackbarContext.js +1 -4
- package/__inner__/esm/components/Snackbar/components/Snackbar/Snackbar.d.ts +1 -1
- package/__inner__/esm/components/Tooltip/Tooltip.js +12 -12
- package/__inner__/esm/components/Tooltip/constants.d.ts +1 -1
- package/__inner__/esm/components/Tooltip/constants.js +1 -2
- package/__inner__/esm/components/Tooltip/types.d.ts +1 -1
- package/__inner__/esm/hooks/useControlled/useControlled.js +1 -1
- package/package.json +6 -6
|
@@ -69,7 +69,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
69
69
|
}) & (OPTION extends {
|
|
70
70
|
disabled: boolean | undefined;
|
|
71
71
|
} ? Record<string, unknown> : {
|
|
72
|
-
getOptionDisabled?:
|
|
72
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
73
73
|
}) & {
|
|
74
74
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
75
75
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -140,7 +140,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
140
140
|
}) & (OPTION extends {
|
|
141
141
|
disabled: boolean | undefined;
|
|
142
142
|
} ? Record<string, unknown> : {
|
|
143
|
-
getOptionDisabled?:
|
|
143
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
144
144
|
}) & {
|
|
145
145
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
146
146
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -99,7 +99,7 @@ export type AutocompleteProps<OPTION = AutocompleteDefaultOption> = {
|
|
|
99
99
|
}) & (OPTION extends {
|
|
100
100
|
disabled: AutocompleteDefaultOption['disabled'];
|
|
101
101
|
} ? Record<string, unknown> : {
|
|
102
|
-
getOptionDisabled?:
|
|
102
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION>;
|
|
103
103
|
});
|
|
104
104
|
export type AutocompleteComponent = <OPTION = AutocompleteDefaultOption>(props: AutocompleteProps<OPTION>) => ReactElement | null;
|
|
105
105
|
export {};
|
|
@@ -14,17 +14,22 @@ exports.ButtonBase = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
|
|
|
14
14
|
props: inProps,
|
|
15
15
|
name: 'Button',
|
|
16
16
|
});
|
|
17
|
-
var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_BASE_DEFAULT_TAG : _a,
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_BASE_DEFAULT_TAG : _a, loadingProp = props.loading, disabledProp = props.disabled, children = props.children, className = props.className, onClick = props.onClick, unstyled = props.unstyled, other = tslib_1.__rest(props, ["as", "loading", "disabled", "children", "className", "onClick", "unstyled"]);
|
|
18
|
+
var loading = Boolean(loadingProp);
|
|
19
|
+
var disabled = Boolean(disabledProp || loadingProp);
|
|
20
|
+
// TODO: подумать на тем, чтобы не блокировать кнопку в «заблокированном состоянии»,
|
|
21
|
+
// чтобы не терять установленный на неё фокус
|
|
22
|
+
var onDisabledClick = function (event) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({ disabled: disabled, onClick: disabled ? onDisabledClick : onClick }, (disabled && {
|
|
28
|
+
'aria-disabled': true,
|
|
29
|
+
}), { type: "button", className: (0, exports.cnButtonBase)({
|
|
25
30
|
disabled: disabled,
|
|
26
31
|
loading: loading,
|
|
27
32
|
unstyled: unstyled,
|
|
28
|
-
}, [className]) }, (
|
|
33
|
+
}, [className]) }, (disabled && { tabIndex: -1 }), other, { ref: ref }), children));
|
|
29
34
|
});
|
|
30
35
|
exports.ButtonBase.displayName = 'ButtonBase';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentRef } from 'react';
|
|
2
|
-
import type { DPDayRange } from '@rehookify/datepicker
|
|
2
|
+
import type { DPDayRange } from '@rehookify/datepicker';
|
|
3
3
|
import type { ExtendableComponentPropsWithRef } from '../../../../types/ExtendableComponentPropsWithRef';
|
|
4
4
|
import type { CalendarSizeVariant } from '../../index';
|
|
5
5
|
export type CalendarGridItemRef = ComponentRef<'button'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DATA_LIST_DEFAULT_TAG
|
|
1
|
+
export declare const DATA_LIST_DEFAULT_TAG = "div";
|
|
2
2
|
export declare const DATA_LIST_DEFAULT_SIZE = "m";
|
|
3
3
|
export declare const DATA_LIST_DEFAULT_OPEN = false;
|
|
4
4
|
export declare const DATA_LIST_OPTION_DEFAULT_DISABLED = false;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DATA_LIST_OPTION_DEFAULT_TAG = exports.DATA_LIST_OPTION_DEFAULT_DISABLED = exports.DATA_LIST_DEFAULT_OPEN = exports.DATA_LIST_DEFAULT_SIZE = exports.DATA_LIST_DEFAULT_TAG = void 0;
|
|
4
4
|
var constants_1 = require("../List/constants");
|
|
5
|
-
|
|
6
|
-
exports.DATA_LIST_DEFAULT_TAG = Paper_1.Paper;
|
|
5
|
+
exports.DATA_LIST_DEFAULT_TAG = 'div';
|
|
7
6
|
exports.DATA_LIST_DEFAULT_SIZE = 'm';
|
|
8
7
|
exports.DATA_LIST_DEFAULT_OPEN = false;
|
|
9
8
|
exports.DATA_LIST_OPTION_DEFAULT_DISABLED = false;
|
|
@@ -41,7 +41,6 @@ export declare const Dialog: React.ForwardRefExoticComponent<{
|
|
|
41
41
|
className?: string | undefined;
|
|
42
42
|
'data-testid'?: string | undefined;
|
|
43
43
|
ignoreClickOutsideRefs?: React.RefObject<HTMLElement>[] | undefined;
|
|
44
|
-
disablePortal?: boolean | undefined;
|
|
45
44
|
} & import("../Portal").PortalBaseProps & {
|
|
46
45
|
as?: "div" | undefined;
|
|
47
|
-
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "
|
|
46
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("../Portal").PortalBaseProps> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -42,7 +42,6 @@ export declare const Drawer: React.ForwardRefExoticComponent<{
|
|
|
42
42
|
className?: string | undefined;
|
|
43
43
|
'data-testid'?: string | undefined;
|
|
44
44
|
ignoreClickOutsideRefs?: React.RefObject<HTMLElement>[] | undefined;
|
|
45
|
-
disablePortal?: boolean | undefined;
|
|
46
45
|
} & import("../Portal").PortalBaseProps & {
|
|
47
46
|
as?: "div" | undefined;
|
|
48
|
-
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "
|
|
47
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("../Portal").PortalBaseProps> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -20,7 +20,7 @@ exports.FieldInput = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
|
|
|
20
20
|
name: 'FieldInput',
|
|
21
21
|
state: 'value',
|
|
22
22
|
defaultValue: defaultValue,
|
|
23
|
-
}),
|
|
23
|
+
}), 3), valueState = _e[0], setValueState = _e[1], isControlled = _e[2];
|
|
24
24
|
var filled = !!valueState || valueState === 0;
|
|
25
25
|
var required = requiredProp;
|
|
26
26
|
var disabled = disabledProp;
|
|
@@ -50,6 +50,6 @@ exports.FieldInput = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
|
|
|
50
50
|
setFocused(false);
|
|
51
51
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
52
52
|
}, [onBlur]);
|
|
53
|
-
return (react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnFieldInput)({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, value: valueState }, other, { ref: ref }), children));
|
|
53
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnFieldInput)({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange }, (isControlled ? { value: valueState } : { defaultValue: defaultValue }), other, { ref: ref }), children));
|
|
54
54
|
});
|
|
55
55
|
exports.FieldInput.displayName = 'FieldInput';
|
|
@@ -8,6 +8,7 @@ var logger_1 = require("@ozen-ui/logger");
|
|
|
8
8
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
9
|
var classname_1 = require("../../utils/classname");
|
|
10
10
|
var getPaperSizeToFormElement_1 = require("../../utils/getPaperSizeToFormElement");
|
|
11
|
+
var Paper_1 = require("../Paper");
|
|
11
12
|
var Popover_1 = require("../Popover");
|
|
12
13
|
var components_1 = require("./components");
|
|
13
14
|
var constants_1 = require("./constants");
|
|
@@ -19,7 +20,7 @@ exports.Menu = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
19
20
|
if (process.env.NODE_ENV !== 'production' && menuListRef) {
|
|
20
21
|
(0, logger_1.deprecate)('Свойство «menuListRef» устарело. Для замены используйте «menuListProps.ref».');
|
|
21
22
|
}
|
|
22
|
-
return (react_1.default.createElement(Popover_1.Popover, tslib_1.__assign({ offset: [0, 4], radius: radius }, other, { open: open, onClose: onClose, className: (0, exports.cnMenu)('', [className]), disableEnforceFocus: true, ref: ref }),
|
|
23
|
+
return (react_1.default.createElement(Popover_1.Popover, tslib_1.__assign({ as: Paper_1.Paper, offset: [0, 4], radius: radius }, other, { open: open, onClose: onClose, className: (0, exports.cnMenu)('', [className]), disableEnforceFocus: true, ref: ref }),
|
|
23
24
|
react_1.default.createElement(components_1.MenuContextConsumer, { onClose: onClose, menuListRef: menuListRef, menuListProps: tslib_1.__assign(tslib_1.__assign({ size: size }, menuListProps), { ref: menuListRef || (menuListProps === null || menuListProps === void 0 ? void 0 : menuListProps.ref) }) }, children)));
|
|
24
25
|
});
|
|
25
26
|
exports.Menu.displayName = 'Menu';
|
|
@@ -34,7 +34,6 @@ export declare const Modal: React.ForwardRefExoticComponent<{
|
|
|
34
34
|
className?: string | undefined;
|
|
35
35
|
'data-testid'?: string | undefined;
|
|
36
36
|
ignoreClickOutsideRefs?: React.RefObject<HTMLElement>[] | undefined;
|
|
37
|
-
disablePortal?: boolean | undefined;
|
|
38
37
|
} & import("../Portal").PortalBaseProps & {
|
|
39
38
|
as?: "div" | undefined;
|
|
40
|
-
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "
|
|
39
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("../Portal").PortalBaseProps> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -19,15 +19,14 @@ var constants_1 = require("./constants");
|
|
|
19
19
|
var index_1 = require("./index");
|
|
20
20
|
exports.cnModal = (0, classname_1.cn)('Modal');
|
|
21
21
|
exports.Modal = (0, react_1.forwardRef)(function (_a, ref) {
|
|
22
|
-
var _b = _a.open, open = _b === void 0 ? constants_1.MODAL_DEFAULT_OPEN : _b, _c = _a.keepMounted, keepMounted = _c === void 0 ? constants_1.MODAL_DEFAULT_KEEP_MOUNTED : _c, _d = _a.hideBackdrop, hideBackdrop = _d === void 0 ? constants_1.MODAL_DEFAULT_HIDE_BACKDROP : _d, _e = _a.disableScrollLock, disableScrollLock = _e === void 0 ? constants_1.MODAL_DEFAULT_DISABLE_SCROLL_LOCK : _e, _f = _a.disableClickOutside, disableClickOutside = _f === void 0 ? constants_1.MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = _a.disableEscapeKeyDown, disableEscapeKeyDown = _g === void 0 ? constants_1.MODAL_DEFAULT_ESCAPE_KEY_DOWN : _g,
|
|
22
|
+
var _b = _a.open, open = _b === void 0 ? constants_1.MODAL_DEFAULT_OPEN : _b, _c = _a.keepMounted, keepMounted = _c === void 0 ? constants_1.MODAL_DEFAULT_KEEP_MOUNTED : _c, _d = _a.hideBackdrop, hideBackdrop = _d === void 0 ? constants_1.MODAL_DEFAULT_HIDE_BACKDROP : _d, _e = _a.disableScrollLock, disableScrollLock = _e === void 0 ? constants_1.MODAL_DEFAULT_DISABLE_SCROLL_LOCK : _e, _f = _a.disableClickOutside, disableClickOutside = _f === void 0 ? constants_1.MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = _a.disableEscapeKeyDown, disableEscapeKeyDown = _g === void 0 ? constants_1.MODAL_DEFAULT_ESCAPE_KEY_DOWN : _g, children = _a.children, onEnter = _a.onEnter, onEntered = _a.onEntered, onExit = _a.onExit, onExitedProp = _a.onExited, onClose = _a.onClose, backdropProps = _a.backdropProps, windowProps = _a.windowProps, transitionProps = _a.transitionProps, className = _a.className, ignoreClickOutsideRefs = _a.ignoreClickOutsideRefs, other = tslib_1.__rest(_a, ["open", "keepMounted", "hideBackdrop", "disableScrollLock", "disableClickOutside", "disableEscapeKeyDown", "children", "onEnter", "onEntered", "onExit", "onExited", "onClose", "backdropProps", "windowProps", "transitionProps", "className", "ignoreClickOutsideRefs"]);
|
|
23
23
|
var hasBackdrop = !hideBackdrop;
|
|
24
24
|
var rootRef = (0, react_1.useRef)(null);
|
|
25
25
|
var windowInnerRef = (0, react_1.useRef)(null);
|
|
26
26
|
var focusedElement = (0, react_1.useRef)(null);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var RootComponent = disablePortal ? 'div' : Portal_1.Portal;
|
|
27
|
+
var _h = tslib_1.__read((0, react_1.useState)(false), 2), openState = _h[0], setOpenState = _h[1];
|
|
28
|
+
var _j = tslib_1.__read((0, react_1.useState)(false), 2), opened = _j[0], setOpened = _j[1];
|
|
29
|
+
var _k = (0, index_1.useModalManager)(windowInnerRef, 1000, openState), isTop = _k.isTop, refsClickOutside = _k.refsClickOutside;
|
|
31
30
|
(0, useClickOutside_1.useClickOutside)({
|
|
32
31
|
refs: tslib_1.__spreadArray(tslib_1.__spreadArray([
|
|
33
32
|
windowInnerRef
|
|
@@ -73,7 +72,7 @@ exports.Modal = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
73
72
|
active: isTop && !disableEscapeKeyDown,
|
|
74
73
|
});
|
|
75
74
|
return (react_1.default.createElement(react_transition_group_1.CSSTransition, tslib_1.__assign({ classNames: (0, exports.cnModal)({ animation: true }), nodeRef: rootRef, timeout: 300 }, transitionProps, { in: openState, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, unmountOnExit: !keepMounted, appear: true }),
|
|
76
|
-
react_1.default.createElement(
|
|
75
|
+
react_1.default.createElement(Portal_1.Portal, tslib_1.__assign({}, other, { className: (0, exports.cnModal)({ hidden: keepMounted && !openState, hasBackdrop: hasBackdrop }, [className]), ref: (0, useMultiRef_1.useMultiRef)([rootRef, ref]) }),
|
|
77
76
|
!hideBackdrop && (react_1.default.createElement(Backdrop_1.Backdrop, tslib_1.__assign({ zIndex: -1, open: openState }, backdropProps, { className: backdropProps === null || backdropProps === void 0 ? void 0 : backdropProps.className }))),
|
|
78
77
|
react_1.default.createElement(components_1.ModalConsumer, tslib_1.__assign({}, windowProps, { ref: (0, useMultiRef_1.useMultiRef)([windowInnerRef, trapRef, windowProps === null || windowProps === void 0 ? void 0 : windowProps.ref]) }), children))));
|
|
79
78
|
});
|
|
@@ -4,4 +4,3 @@ export declare const MODAL_DEFAULT_HIDE_BACKDROP = false;
|
|
|
4
4
|
export declare const MODAL_DEFAULT_DISABLE_SCROLL_LOCK = false;
|
|
5
5
|
export declare const MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE = false;
|
|
6
6
|
export declare const MODAL_DEFAULT_ESCAPE_KEY_DOWN = false;
|
|
7
|
-
export declare const MODAL_DEFAULT_DISABLE_PORTAL = false;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MODAL_DEFAULT_ESCAPE_KEY_DOWN = exports.MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE = exports.MODAL_DEFAULT_DISABLE_SCROLL_LOCK = exports.MODAL_DEFAULT_HIDE_BACKDROP = exports.MODAL_DEFAULT_KEEP_MOUNTED = exports.MODAL_DEFAULT_OPEN = void 0;
|
|
4
4
|
exports.MODAL_DEFAULT_OPEN = false;
|
|
5
5
|
exports.MODAL_DEFAULT_KEEP_MOUNTED = false;
|
|
6
6
|
exports.MODAL_DEFAULT_HIDE_BACKDROP = false;
|
|
7
7
|
exports.MODAL_DEFAULT_DISABLE_SCROLL_LOCK = false;
|
|
8
8
|
exports.MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE = false;
|
|
9
9
|
exports.MODAL_DEFAULT_ESCAPE_KEY_DOWN = false;
|
|
10
|
-
exports.MODAL_DEFAULT_DISABLE_PORTAL = false;
|
|
@@ -51,8 +51,5 @@ export type ModalProps = {
|
|
|
51
51
|
'data-testid'?: string;
|
|
52
52
|
/** Список ссылок на элементы при клике на которые Modal не будет закрываться (см. хук useClickOutside) */
|
|
53
53
|
ignoreClickOutsideRefs?: RefObject<HTMLElement>[];
|
|
54
|
-
/** Если {true} отключает портал для компонента.
|
|
55
|
-
* Подробнее — https://react.dev/reference/react-dom/createPortal. */
|
|
56
|
-
disablePortal?: boolean;
|
|
57
54
|
} & PortalProps;
|
|
58
55
|
export type ModalRef = PortalRef;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './Popover.css';
|
|
2
2
|
import type { PopoverBaseProps } from './types';
|
|
3
3
|
export declare const cnPopover: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
-
export declare const Popover: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<PopoverBaseProps,
|
|
4
|
+
export declare const Popover: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<PopoverBaseProps, "div">;
|
|
@@ -14,6 +14,7 @@ var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
|
14
14
|
var classname_1 = require("../../utils/classname");
|
|
15
15
|
var isKey_1 = require("../../utils/isKey");
|
|
16
16
|
var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
|
|
17
|
+
var Paper_1 = require("../Paper");
|
|
17
18
|
var Portal_1 = require("../Portal");
|
|
18
19
|
var components_1 = require("./components");
|
|
19
20
|
var constants_1 = require("./constants");
|
|
@@ -22,7 +23,11 @@ var PopoverContext_1 = require("./PopoverContext");
|
|
|
22
23
|
exports.cnPopover = (0, classname_1.cn)('Popover');
|
|
23
24
|
exports.Popover = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
24
25
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Popover' });
|
|
25
|
-
var _a = props.arrow, arrow = _a === void 0 ? constants_1.POPOVER_DEFAULT_ARROW : _a, _b = props.open, open = _b === void 0 ? constants_1.POPOVER_DEFAULT_OPEN : _b, _c = props.disableInteractive, disableInteractive = _c === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_INTERACTIVE : _c, _d = props.disableEnforceFocus, disableEnforceFocus = _d === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS : _d, _e = props.disableReturnFocus, disableReturnFocus = _e === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_RETURN_FOCUS : _e, _f = props.disableClickOutside, disableClickOutside = _f === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = props.placement, placement = _g === void 0 ? constants_1.POPOVER_DEFAULT_PLACEMENT : _g, _h = props.strategy, strategy = _h === void 0 ? constants_1.POPOVER_DEFAULT_STRATEGY : _h, _j = props.disablePreventOverflow, disablePreventOverflow = _j === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_PREVENT_OVERFLOW : _j, ignoreClickOutsideRefs = props.ignoreClickOutsideRefs, arrowProps = props.arrowProps, anchorRef = props.anchorRef, equalAnchorWidth = props.equalAnchorWidth, offset = props.offset, children = props.children, transitionProps = props.transitionProps, onClose = props.onClose, onEnter = props.onEnter, onEntered = props.onEntered, onExit = props.onExit, onExitedProp = props.onExited, className = props.className, position = props.position, style = props.style, setUpdate = props.setUpdate,
|
|
26
|
+
var _a = props.arrow, arrow = _a === void 0 ? constants_1.POPOVER_DEFAULT_ARROW : _a, _b = props.open, open = _b === void 0 ? constants_1.POPOVER_DEFAULT_OPEN : _b, _c = props.disableInteractive, disableInteractive = _c === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_INTERACTIVE : _c, _d = props.disableEnforceFocus, disableEnforceFocus = _d === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS : _d, _e = props.disableReturnFocus, disableReturnFocus = _e === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_RETURN_FOCUS : _e, _f = props.disableClickOutside, disableClickOutside = _f === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = props.placement, placement = _g === void 0 ? constants_1.POPOVER_DEFAULT_PLACEMENT : _g, _h = props.strategy, strategy = _h === void 0 ? constants_1.POPOVER_DEFAULT_STRATEGY : _h, _j = props.disablePreventOverflow, disablePreventOverflow = _j === void 0 ? constants_1.POPOVER_DEFAULT_DISABLE_PREVENT_OVERFLOW : _j, ignoreClickOutsideRefs = props.ignoreClickOutsideRefs, arrowProps = props.arrowProps, anchorRef = props.anchorRef, equalAnchorWidth = props.equalAnchorWidth, offset = props.offset, children = props.children, transitionProps = props.transitionProps, onClose = props.onClose, onEnter = props.onEnter, onEntered = props.onEntered, onExit = props.onExit, onExitedProp = props.onExited, className = props.className, position = props.position, style = props.style, setUpdate = props.setUpdate, modifiersProp = props.modifiers, _k = props.as, as = _k === void 0 ? constants_1.POPOVER_DEFAULT_TAG : _k, other = tslib_1.__rest(props, ["arrow", "open", "disableInteractive", "disableEnforceFocus", "disableReturnFocus", "disableClickOutside", "placement", "strategy", "disablePreventOverflow", "ignoreClickOutsideRefs", "arrowProps", "anchorRef", "equalAnchorWidth", "offset", "children", "transitionProps", "onClose", "onEnter", "onEntered", "onExit", "onExited", "className", "position", "style", "setUpdate", "modifiers", "as"]);
|
|
27
|
+
var Tag = (0, react_1.useMemo)(function () {
|
|
28
|
+
// eslint-disable-next-line react/display-name
|
|
29
|
+
return (0, react_1.forwardRef)(function (props, ref) { return (react_1.default.createElement(Paper_1.Paper, tslib_1.__assign({ radius: "l", shadow: "m", background: "main" }, props, { as: as, ref: ref }))); });
|
|
30
|
+
}, [as]);
|
|
26
31
|
var _l = tslib_1.__read((0, react_1.useState)(false), 2), openState = _l[0], setOpenState = _l[1];
|
|
27
32
|
var focusedElement = (0, react_1.useRef)(null);
|
|
28
33
|
var popoverRef = (0, react_1.useRef)(null);
|
|
@@ -105,7 +110,7 @@ exports.Popover = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)
|
|
|
105
110
|
offset: offset,
|
|
106
111
|
},
|
|
107
112
|
}
|
|
108
|
-
], tslib_1.__read((
|
|
113
|
+
], tslib_1.__read((modifiersProp || [])), false); }, [offset, equalAnchorWidth, modifiersProp]);
|
|
109
114
|
// Якорный элемент или координаты
|
|
110
115
|
var resolveReferenceElement = (0, react_1.useMemo)(function () {
|
|
111
116
|
if (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)
|
|
@@ -146,7 +151,7 @@ exports.Popover = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)
|
|
|
146
151
|
}, [open]);
|
|
147
152
|
return (react_1.default.createElement(PopoverContext_1.PopoverContext.Provider, { value: { isTop: isTop } },
|
|
148
153
|
react_1.default.createElement(react_transition_group_1.CSSTransition, tslib_1.__assign({ nodeRef: popoverRef, classNames: (0, exports.cnPopover)({ animation: true }), timeout: 120 }, transitionProps, { in: openState, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, unmountOnExit: true }),
|
|
149
|
-
react_1.default.createElement(Portal_1.Portal, tslib_1.__assign({ as:
|
|
154
|
+
react_1.default.createElement(Portal_1.Portal, tslib_1.__assign({ as: Tag }, other, { style: tslib_1.__assign(tslib_1.__assign({}, style), styles.popper), ref: portalRef, className: (0, exports.cnPopover)({ disableInteractive: disableInteractive }, [className]) }, attributes.popper),
|
|
150
155
|
children,
|
|
151
156
|
arrow && (react_1.default.createElement(components_1.PopoverArrow, tslib_1.__assign({}, arrowProps, { style: tslib_1.__assign(tslib_1.__assign({}, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.style), styles.arrow), "data-popper-arrow": true })))))));
|
|
152
157
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const POPOVER_DEFAULT_TAG
|
|
1
|
+
export declare const POPOVER_DEFAULT_TAG = "div";
|
|
2
2
|
export declare const POPOVER_DEFAULT_ARROW = false;
|
|
3
3
|
export declare const POPOVER_DEFAULT_OPEN = false;
|
|
4
4
|
export declare const POPOVER_DEFAULT_DISABLE_INTERACTIVE = false;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.POPOVER_DEFAULT_DISABLE_PREVENT_OVERFLOW = exports.POPOVER_DEFAULT_STRATEGY = exports.POPOVER_DEFAULT_PLACEMENT = exports.POPOVER_DEFAULT_DISABLE_CLICK_OUTSIDE = exports.POPOVER_DEFAULT_DISABLE_RETURN_FOCUS = exports.POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS = exports.POPOVER_DEFAULT_DISABLE_INTERACTIVE = exports.POPOVER_DEFAULT_OPEN = exports.POPOVER_DEFAULT_ARROW = exports.POPOVER_DEFAULT_TAG = void 0;
|
|
4
|
-
|
|
5
|
-
exports.POPOVER_DEFAULT_TAG = Paper_1.Paper;
|
|
4
|
+
exports.POPOVER_DEFAULT_TAG = 'div';
|
|
6
5
|
exports.POPOVER_DEFAULT_ARROW = false;
|
|
7
6
|
exports.POPOVER_DEFAULT_OPEN = false;
|
|
8
7
|
exports.POPOVER_DEFAULT_DISABLE_INTERACTIVE = false;
|
|
@@ -3,7 +3,7 @@ import type PopperJS from '@popperjs/core';
|
|
|
3
3
|
import type { PopperProps } from 'react-popper';
|
|
4
4
|
import type { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
5
5
|
import type { PolymorphicComponentPropsWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
6
|
-
import type {
|
|
6
|
+
import type { PortalBaseProps } from '../Portal';
|
|
7
7
|
import type { PopoverArrowProps } from './components';
|
|
8
8
|
import type { POPOVER_DEFAULT_TAG } from './constants';
|
|
9
9
|
export type VirtualElement = {
|
|
@@ -71,8 +71,6 @@ export type PopoverBaseProps = {
|
|
|
71
71
|
'data-testid'?: string;
|
|
72
72
|
/** Функция обратного вызова для получения метода по перерасчету расположения компонента Popover */
|
|
73
73
|
setUpdate?(update: PopperJS.Instance['update'] | null): void;
|
|
74
|
-
/** Контейнер для монтирования всплывающего окна */
|
|
75
|
-
container?: PortalProps['container'];
|
|
76
74
|
/** Стратегия позиционирования */
|
|
77
75
|
strategy?: PopoverStrategyVariant;
|
|
78
76
|
/** Если {true} позволяет смещаться по границе якорного элемента компонента */
|
|
@@ -82,6 +80,6 @@ export type PopoverBaseProps = {
|
|
|
82
80
|
* https://popper.js.org/docs/v2/modifiers/#custom-modifiers
|
|
83
81
|
* */
|
|
84
82
|
modifiers?: PopperProps<unknown>['modifiers'];
|
|
85
|
-
};
|
|
83
|
+
} & PortalBaseProps;
|
|
86
84
|
export type PopoverRef = ComponentRef<typeof POPOVER_DEFAULT_TAG>;
|
|
87
85
|
export type PopoverProps<As extends ElementType = typeof POPOVER_DEFAULT_TAG> = PolymorphicComponentPropsWithRef<PopoverBaseProps, As>;
|
|
@@ -12,9 +12,9 @@ exports.Portal = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(
|
|
|
12
12
|
var _a = (0, useThemeProps_1.useThemeProps)({
|
|
13
13
|
props: inProps,
|
|
14
14
|
name: 'Portal',
|
|
15
|
-
}),
|
|
15
|
+
}), _b = _a.disablePortal, disablePortal = _b === void 0 ? constants_1.PORTAL_DEFAULT_DISABLE_PORTAL : _b, _c = _a.as, Tag = _c === void 0 ? constants_1.PORTAL_DEFAULT_TAG : _c, containerProp = _a.container, children = _a.children, other = tslib_1.__rest(_a, ["disablePortal", "as", "container", "children"]);
|
|
16
|
+
var container = containerProp || constants_1.PORTAL_DEFAULT_CONTAINER;
|
|
16
17
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
17
|
-
|
|
18
|
-
return (0, react_dom_1.createPortal)(react_1.default.createElement(ThemeProvider_1.ThemeProvider, tslib_1.__assign({ theme: theme, className: className, as: Tag }, other, { ref: ref }), children), portalContainer);
|
|
18
|
+
return disablePortal ? (react_1.default.createElement(Tag, tslib_1.__assign({}, other, { ref: ref }), children)) : ((0, react_dom_1.createPortal)(react_1.default.createElement(ThemeProvider_1.ThemeProvider, tslib_1.__assign({ theme: theme, as: Tag }, other, { ref: ref }), children), container));
|
|
19
19
|
});
|
|
20
20
|
exports.Portal.displayName = 'Portal';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PORTAL_DEFAULT_TAG = void 0;
|
|
3
|
+
exports.PORTAL_DEFAULT_DISABLE_PORTAL = exports.PORTAL_DEFAULT_CONTAINER = exports.PORTAL_DEFAULT_TAG = void 0;
|
|
4
4
|
exports.PORTAL_DEFAULT_TAG = 'div';
|
|
5
|
+
exports.PORTAL_DEFAULT_CONTAINER = window.document.body;
|
|
6
|
+
exports.PORTAL_DEFAULT_DISABLE_PORTAL = false;
|
|
@@ -5,5 +5,8 @@ export type PortalRef = ComponentRef<typeof PORTAL_DEFAULT_TAG>;
|
|
|
5
5
|
export type PortalBaseProps = {
|
|
6
6
|
/** Контейнер для монтирования портала */
|
|
7
7
|
container?: Element | DocumentFragment | null;
|
|
8
|
+
/** Если {true} отключает портал для компонента.
|
|
9
|
+
* Подробнее — https://react.dev/reference/react-dom/createPortal. */
|
|
10
|
+
disablePortal?: boolean;
|
|
8
11
|
};
|
|
9
12
|
export type PortalProps<As extends ElementType = typeof PORTAL_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<PortalBaseProps, As>;
|
|
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode, SyntheticEvent } from 'react';
|
|
|
2
2
|
import type { ExtendableComponentPropsWithRef } from '../../types/ExtendableComponentPropsWithRef';
|
|
3
3
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
4
|
import type { DataListBaseProps, DataListSelected } from '../DataList';
|
|
5
|
-
import type { SelectInputProps } from './components';
|
|
5
|
+
import type { SelectInputProps, SelectInputRef } from './components';
|
|
6
6
|
export type SelectSizeVariant = FormElementSizeVariant;
|
|
7
7
|
export type SelectLabel = string | number | undefined;
|
|
8
8
|
export type SelectPropLabel<MULTIPLE extends boolean> = (MULTIPLE extends true ? SelectLabel[] : SelectLabel) | undefined;
|
|
@@ -47,6 +47,7 @@ type SelectPropsDeprecated<MULTIPLE extends boolean = false> = {
|
|
|
47
47
|
* */
|
|
48
48
|
menuProps?: Partial<Omit<DataListBaseProps<MULTIPLE>, 'onClose' | 'open' | 'anchorRef' | 'multiple' | 'selected' | 'onSelect'>>;
|
|
49
49
|
};
|
|
50
|
+
export type SelectRef = SelectInputRef;
|
|
50
51
|
export type SelectProps<MULTIPLE extends boolean = false> = ExtendableComponentPropsWithRef<{
|
|
51
52
|
/** Если {true} устанавливает автофокус */
|
|
52
53
|
autoFocus?: boolean;
|
|
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSnackbar = exports.SnackbarContext = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
exports.SnackbarContext = react_1.default.createContext({
|
|
7
|
-
pushMessage: function () { return ''; },
|
|
8
|
-
closeMessage: function () { return undefined; },
|
|
9
|
-
});
|
|
6
|
+
exports.SnackbarContext = react_1.default.createContext({});
|
|
10
7
|
var useSnackbar = function () { return (0, react_1.useContext)(exports.SnackbarContext); };
|
|
11
8
|
exports.useSnackbar = useSnackbar;
|
|
12
9
|
// Именованный провайдер
|
|
@@ -10,7 +10,7 @@ export type SnackbarProps = PortalProps & {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const Snackbar: React.ForwardRefExoticComponent<import("../../../Portal").PortalBaseProps & {
|
|
12
12
|
as?: "div" | undefined;
|
|
13
|
-
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "
|
|
13
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("../../../Portal").PortalBaseProps> & {
|
|
14
14
|
/** Расположение сообщения относительно контейнера */
|
|
15
15
|
anchorOrigin?: SnackbarAnchorOrigin | undefined;
|
|
16
16
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -17,7 +17,7 @@ var constants_1 = require("./constants");
|
|
|
17
17
|
exports.cnTooltip = (0, classname_1.cn)('Tooltip');
|
|
18
18
|
exports.Tooltip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
19
19
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Tooltip' });
|
|
20
|
-
var _a = props.trigger, trigger = _a === void 0 ? constants_1.TOOLTIP_DEFAULT_TRIGGER : _a, _b = props.size, size = _b === void 0 ? constants_1.TOOLTIP_DEFAULT_SIZE : _b, _c = props.offset, offset = _c === void 0 ? constants_1.TOOLTIP_DEFAULT_OFFSET : _c, _d = props.delayEnter, delayEnter = _d === void 0 ? constants_1.TOOLTIP_DEFAULT_DELAY_ENTER : _d, _e = props.delayLeave, delayLeave = _e === void 0 ? constants_1.TOOLTIP_DEFAULT_DELAY_LEAVE : _e, _f = props.arrow, arrow = _f === void 0 ? constants_1.TOOLTIP_DEFAULT_ARROW : _f, _g = props.shouldWrapChildren, shouldWrapChildren = _g === void 0 ? constants_1.TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN : _g, _h = props.disabled, disabled = _h === void 0 ? constants_1.TOOLTIP_DEFAULT_DISABLED : _h, _j = props.inverse, inverse = _j === void 0 ? constants_1.TOOLTIP_DEFAULT_INVERSE : _j, _k = props.as, as = _k === void 0 ? constants_1.TOOLTIP_DEFAULT_TAG : _k,
|
|
20
|
+
var _a = props.trigger, trigger = _a === void 0 ? constants_1.TOOLTIP_DEFAULT_TRIGGER : _a, _b = props.size, size = _b === void 0 ? constants_1.TOOLTIP_DEFAULT_SIZE : _b, _c = props.offset, offset = _c === void 0 ? constants_1.TOOLTIP_DEFAULT_OFFSET : _c, _d = props.delayEnter, delayEnter = _d === void 0 ? constants_1.TOOLTIP_DEFAULT_DELAY_ENTER : _d, _e = props.delayLeave, delayLeave = _e === void 0 ? constants_1.TOOLTIP_DEFAULT_DELAY_LEAVE : _e, _f = props.arrow, arrow = _f === void 0 ? constants_1.TOOLTIP_DEFAULT_ARROW : _f, _g = props.shouldWrapChildren, shouldWrapChildren = _g === void 0 ? constants_1.TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN : _g, _h = props.disabled, disabled = _h === void 0 ? constants_1.TOOLTIP_DEFAULT_DISABLED : _h, _j = props.inverse, inverse = _j === void 0 ? constants_1.TOOLTIP_DEFAULT_INVERSE : _j, _k = props.as, as = _k === void 0 ? constants_1.TOOLTIP_DEFAULT_TAG : _k, modifiersProp = props.modifiers, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, variant = props.variant, children = props.children, label = props.label, openProp = props.open, className = props.className, onOpen = props.onOpen, onClose = props.onClose, other = tslib_1.__rest(props, ["trigger", "size", "offset", "delayEnter", "delayLeave", "arrow", "shouldWrapChildren", "disabled", "inverse", "as", "modifiers", "onMouseEnter", "onMouseLeave", "variant", "children", "label", "open", "className", "onOpen", "onClose"]);
|
|
21
21
|
if (process.env.NODE_ENV !== 'production' && variant) {
|
|
22
22
|
(0, logger_1.deprecate)('Свойство «variant» устарело. Для замены используйте «inverse».');
|
|
23
23
|
}
|
|
@@ -25,14 +25,14 @@ exports.Tooltip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)
|
|
|
25
25
|
var _l = tslib_1.__read((0, react_1.useState)(), 2), delay = _l[0], setDelay = _l[1];
|
|
26
26
|
var _m = tslib_1.__read((0, useBoolean_1.useBoolean)(), 2), focused = _m[0], setFocused = _m[1];
|
|
27
27
|
var _o = tslib_1.__read((0, useBoolean_1.useBoolean)(), 2), hovered = _o[0], setHovered = _o[1];
|
|
28
|
-
var modifiers = [
|
|
28
|
+
var modifiers = tslib_1.__spreadArray([
|
|
29
29
|
{
|
|
30
30
|
name: 'arrow',
|
|
31
31
|
options: {
|
|
32
32
|
padding: size === 'xs' ? 8 : 12,
|
|
33
33
|
},
|
|
34
|
-
}
|
|
35
|
-
];
|
|
34
|
+
}
|
|
35
|
+
], tslib_1.__read((modifiersProp || [])), false);
|
|
36
36
|
var _p = tslib_1.__read((0, useControlled_1.useControlled)({
|
|
37
37
|
value: openProp,
|
|
38
38
|
defaultValue: false,
|
|
@@ -65,18 +65,20 @@ exports.Tooltip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)
|
|
|
65
65
|
}, [children, shouldWrapChildren]);
|
|
66
66
|
var childrenProps = resolveChildren.props, childrenRef = resolveChildren.ref;
|
|
67
67
|
var childrenMultiRef = (0, useMultiRef_1.useMultiRef)([anchorRef, childrenRef]);
|
|
68
|
-
var handleMouseEnter = function () {
|
|
68
|
+
var handleMouseEnter = function (e) {
|
|
69
69
|
if (trigger === 'hover' || trigger === 'hover&focus') {
|
|
70
70
|
setHovered.on();
|
|
71
71
|
setOpenWithDelay(true);
|
|
72
72
|
}
|
|
73
|
+
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
|
|
73
74
|
};
|
|
74
|
-
var handleMouseLeave = function () {
|
|
75
|
+
var handleMouseLeave = function (e) {
|
|
75
76
|
if (trigger === 'hover' || trigger === 'hover&focus') {
|
|
76
77
|
setHovered.off();
|
|
77
78
|
if (!focused)
|
|
78
79
|
setOpenWithDelay(false);
|
|
79
80
|
}
|
|
81
|
+
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
|
|
80
82
|
};
|
|
81
83
|
var handleClick = function () {
|
|
82
84
|
if (trigger === 'click')
|
|
@@ -112,11 +114,11 @@ exports.Tooltip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)
|
|
|
112
114
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
113
115
|
},
|
|
114
116
|
onMouseEnter: function (e) {
|
|
115
|
-
handleMouseEnter();
|
|
117
|
+
handleMouseEnter(e);
|
|
116
118
|
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
|
|
117
119
|
},
|
|
118
120
|
onMouseLeave: function (e) {
|
|
119
|
-
handleMouseLeave();
|
|
121
|
+
handleMouseLeave(e);
|
|
120
122
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
|
|
121
123
|
},
|
|
122
124
|
};
|
|
@@ -132,9 +134,7 @@ exports.Tooltip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)
|
|
|
132
134
|
]);
|
|
133
135
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
134
136
|
react_1.default.cloneElement(resolveChildren, composeChildrenProps),
|
|
135
|
-
react_1.default.createElement(Popover_1.Popover, tslib_1.__assign({
|
|
136
|
-
size: size,
|
|
137
|
-
}, modifiers: modifiers, disableEnforceFocus: true, disableReturnFocus: true }),
|
|
137
|
+
react_1.default.createElement(Popover_1.Popover, tslib_1.__assign({ arrow: arrow, offset: offset, background: "main", strategy: "absolute", arrowProps: { size: size }, anchorRef: anchorRef, modifiers: modifiers, as: as, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, radius: size === 'xs' ? 's' : 'l' }, (inverse && { background: 'main-inverse' }), (variant === 'dark' && { background: 'main-inverse' }), { className: (0, exports.cnTooltip)({ size: size, variant: variant, inverse: inverse }, [className]), disableEnforceFocus: true, disableReturnFocus: true }, other, { open: openState, onClose: closeWithDelay, ref: ref }),
|
|
138
138
|
react_1.default.createElement("div", { className: (0, exports.cnTooltip)('Content', { size: size, variant: variant, inverse: inverse }) }, label))));
|
|
139
139
|
});
|
|
140
140
|
exports.Tooltip.displayName = 'Tooltip';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const TOOLTIP_DEFAULT_TAG
|
|
1
|
+
export declare const TOOLTIP_DEFAULT_TAG = "div";
|
|
2
2
|
export declare const TOOLTIP_DEFAULT_TRIGGER = "hover";
|
|
3
3
|
export declare const TOOLTIP_DEFAULT_SIZE = "s";
|
|
4
4
|
export declare const TOOLTIP_DEFAULT_INVERSE = true;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TOOLTIP_DEFAULT_DISABLED = exports.TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN = exports.TOOLTIP_DEFAULT_ARROW = exports.TOOLTIP_DEFAULT_DELAY_LEAVE = exports.TOOLTIP_DEFAULT_DELAY_ENTER = exports.TOOLTIP_DEFAULT_OFFSET = exports.TOOLTIP_DEFAULT_INVERSE = exports.TOOLTIP_DEFAULT_SIZE = exports.TOOLTIP_DEFAULT_TRIGGER = exports.TOOLTIP_DEFAULT_TAG = void 0;
|
|
4
|
-
|
|
5
|
-
exports.TOOLTIP_DEFAULT_TAG = Paper_1.Paper;
|
|
4
|
+
exports.TOOLTIP_DEFAULT_TAG = 'div';
|
|
6
5
|
exports.TOOLTIP_DEFAULT_TRIGGER = 'hover';
|
|
7
6
|
exports.TOOLTIP_DEFAULT_SIZE = 's';
|
|
8
7
|
exports.TOOLTIP_DEFAULT_INVERSE = true;
|
|
@@ -48,7 +48,7 @@ export type TooltipBaseProps = {
|
|
|
48
48
|
'data-testid'?: string;
|
|
49
49
|
/** Дополнительные CSS-классы */
|
|
50
50
|
className?: string;
|
|
51
|
-
} & TooltipPropsDeprecated &
|
|
51
|
+
} & TooltipPropsDeprecated & Omit<Partial<PopoverBaseProps>, 'onClose' | 'open'>;
|
|
52
52
|
export type TooltipRef = ComponentRef<typeof TOOLTIP_DEFAULT_TAG>;
|
|
53
53
|
export type TooltipProps<As extends ElementType = typeof TOOLTIP_DEFAULT_TAG> = PolymorphicComponentPropsWithRef<TooltipBaseProps, As>;
|
|
54
54
|
export {};
|
|
@@ -69,7 +69,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
69
69
|
}) & (OPTION extends {
|
|
70
70
|
disabled: boolean | undefined;
|
|
71
71
|
} ? Record<string, unknown> : {
|
|
72
|
-
getOptionDisabled?:
|
|
72
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
73
73
|
}) & {
|
|
74
74
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
75
75
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -140,7 +140,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
140
140
|
}) & (OPTION extends {
|
|
141
141
|
disabled: boolean | undefined;
|
|
142
142
|
} ? Record<string, unknown> : {
|
|
143
|
-
getOptionDisabled?:
|
|
143
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
144
144
|
}) & {
|
|
145
145
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
146
146
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -99,7 +99,7 @@ export type AutocompleteProps<OPTION = AutocompleteDefaultOption> = {
|
|
|
99
99
|
}) & (OPTION extends {
|
|
100
100
|
disabled: AutocompleteDefaultOption['disabled'];
|
|
101
101
|
} ? Record<string, unknown> : {
|
|
102
|
-
getOptionDisabled?:
|
|
102
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION>;
|
|
103
103
|
});
|
|
104
104
|
export type AutocompleteComponent = <OPTION = AutocompleteDefaultOption>(props: AutocompleteProps<OPTION>) => ReactElement | null;
|
|
105
105
|
export {};
|