@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.
Files changed (67) hide show
  1. package/__inner__/cjs/components/Autocomplete/helper.d.ts +2 -2
  2. package/__inner__/cjs/components/Autocomplete/types.d.ts +1 -1
  3. package/__inner__/cjs/components/ButtonBase/ButtonBase.js +13 -8
  4. package/__inner__/cjs/components/Calendar/components/CalendarGridItem/types.d.ts +1 -1
  5. package/__inner__/cjs/components/DataList/components/DataListOption/DataListOption.css +0 -1
  6. package/__inner__/cjs/components/DataList/constants.d.ts +1 -1
  7. package/__inner__/cjs/components/DataList/constants.js +1 -2
  8. package/__inner__/cjs/components/Dialog/Dialog.d.ts +1 -2
  9. package/__inner__/cjs/components/Drawer/Drawer.d.ts +1 -2
  10. package/__inner__/cjs/components/FieldInput/FieldInput.js +2 -2
  11. package/__inner__/cjs/components/Menu/Menu.js +2 -1
  12. package/__inner__/cjs/components/Modal/Modal.d.ts +1 -2
  13. package/__inner__/cjs/components/Modal/Modal.js +5 -6
  14. package/__inner__/cjs/components/Modal/constants.d.ts +0 -1
  15. package/__inner__/cjs/components/Modal/constants.js +1 -2
  16. package/__inner__/cjs/components/Modal/types.d.ts +0 -3
  17. package/__inner__/cjs/components/Popover/Popover.d.ts +1 -1
  18. package/__inner__/cjs/components/Popover/Popover.js +8 -3
  19. package/__inner__/cjs/components/Popover/constants.d.ts +1 -1
  20. package/__inner__/cjs/components/Popover/constants.js +1 -2
  21. package/__inner__/cjs/components/Popover/types.d.ts +2 -4
  22. package/__inner__/cjs/components/Portal/Portal.js +3 -3
  23. package/__inner__/cjs/components/Portal/constants.d.ts +2 -0
  24. package/__inner__/cjs/components/Portal/constants.js +3 -1
  25. package/__inner__/cjs/components/Portal/types.d.ts +3 -0
  26. package/__inner__/cjs/components/Select/types.d.ts +2 -1
  27. package/__inner__/cjs/components/Snackbar/SnackbarContext.js +1 -4
  28. package/__inner__/cjs/components/Snackbar/components/Snackbar/Snackbar.d.ts +1 -1
  29. package/__inner__/cjs/components/Tooltip/Tooltip.js +11 -11
  30. package/__inner__/cjs/components/Tooltip/constants.d.ts +1 -1
  31. package/__inner__/cjs/components/Tooltip/constants.js +1 -2
  32. package/__inner__/cjs/components/Tooltip/types.d.ts +1 -1
  33. package/__inner__/cjs/hooks/useControlled/useControlled.js +1 -1
  34. package/__inner__/esm/components/Autocomplete/helper.d.ts +2 -2
  35. package/__inner__/esm/components/Autocomplete/types.d.ts +1 -1
  36. package/__inner__/esm/components/ButtonBase/ButtonBase.js +13 -8
  37. package/__inner__/esm/components/Calendar/components/CalendarGridItem/types.d.ts +1 -1
  38. package/__inner__/esm/components/DataList/components/DataListOption/DataListOption.css +0 -1
  39. package/__inner__/esm/components/DataList/constants.d.ts +1 -1
  40. package/__inner__/esm/components/DataList/constants.js +1 -2
  41. package/__inner__/esm/components/Dialog/Dialog.d.ts +1 -2
  42. package/__inner__/esm/components/Drawer/Drawer.d.ts +1 -2
  43. package/__inner__/esm/components/FieldInput/FieldInput.js +2 -2
  44. package/__inner__/esm/components/Menu/Menu.js +2 -1
  45. package/__inner__/esm/components/Modal/Modal.d.ts +1 -2
  46. package/__inner__/esm/components/Modal/Modal.js +6 -7
  47. package/__inner__/esm/components/Modal/constants.d.ts +0 -1
  48. package/__inner__/esm/components/Modal/constants.js +0 -1
  49. package/__inner__/esm/components/Modal/types.d.ts +0 -3
  50. package/__inner__/esm/components/Popover/Popover.d.ts +1 -1
  51. package/__inner__/esm/components/Popover/Popover.js +9 -4
  52. package/__inner__/esm/components/Popover/constants.d.ts +1 -1
  53. package/__inner__/esm/components/Popover/constants.js +1 -2
  54. package/__inner__/esm/components/Popover/types.d.ts +2 -4
  55. package/__inner__/esm/components/Portal/Portal.js +4 -4
  56. package/__inner__/esm/components/Portal/constants.d.ts +2 -0
  57. package/__inner__/esm/components/Portal/constants.js +2 -0
  58. package/__inner__/esm/components/Portal/types.d.ts +3 -0
  59. package/__inner__/esm/components/Select/types.d.ts +2 -1
  60. package/__inner__/esm/components/Snackbar/SnackbarContext.js +1 -4
  61. package/__inner__/esm/components/Snackbar/components/Snackbar/Snackbar.d.ts +1 -1
  62. package/__inner__/esm/components/Tooltip/Tooltip.js +12 -12
  63. package/__inner__/esm/components/Tooltip/constants.d.ts +1 -1
  64. package/__inner__/esm/components/Tooltip/constants.js +1 -2
  65. package/__inner__/esm/components/Tooltip/types.d.ts +1 -1
  66. package/__inner__/esm/hooks/useControlled/useControlled.js +1 -1
  67. package/package.json +6 -6
@@ -11,17 +11,22 @@ export var ButtonBase = polymorphicComponentWithRef(function (inProps, ref) {
11
11
  props: inProps,
12
12
  name: 'Button',
13
13
  });
14
- var _a = props.as, Tag = _a === void 0 ? BUTTON_BASE_DEFAULT_TAG : _a, loading = props.loading, children = props.children, disabled = props.disabled, className = props.className, onClick = props.onClick, unstyled = props.unstyled, other = __rest(props, ["as", "loading", "children", "disabled", "className", "onClick", "unstyled"]);
15
- var handleClick = function (event) {
16
- if (onClick && !disabled && !loading) {
17
- onClick(event);
18
- }
14
+ var _a = props.as, Tag = _a === void 0 ? BUTTON_BASE_DEFAULT_TAG : _a, loadingProp = props.loading, disabledProp = props.disabled, children = props.children, className = props.className, onClick = props.onClick, unstyled = props.unstyled, other = __rest(props, ["as", "loading", "disabled", "children", "className", "onClick", "unstyled"]);
15
+ var loading = Boolean(loadingProp);
16
+ var disabled = Boolean(disabledProp || loadingProp);
17
+ // TODO: подумать на тем, чтобы не блокировать кнопку в «заблокированном состоянии»,
18
+ // чтобы не терять установленный на неё фокус
19
+ var onDisabledClick = function (event) {
20
+ event.preventDefault();
21
+ event.stopPropagation();
22
+ event.nativeEvent.stopImmediatePropagation();
19
23
  };
20
- var isInteractionPrevented = disabled || loading;
21
- return (React.createElement(Tag, __assign({ disabled: isInteractionPrevented, onClick: handleClick, type: "button", className: cnButtonBase({
24
+ return (React.createElement(Tag, __assign({ disabled: disabled, onClick: disabled ? onDisabledClick : onClick }, (disabled && {
25
+ 'aria-disabled': true,
26
+ }), { type: "button", className: cnButtonBase({
22
27
  disabled: disabled,
23
28
  loading: loading,
24
29
  unstyled: unstyled,
25
- }, [className]) }, (isInteractionPrevented && { tabIndex: -1 }), other, { ref: ref }), children));
30
+ }, [className]) }, (disabled && { tabIndex: -1 }), other, { ref: ref }), children));
26
31
  });
27
32
  ButtonBase.displayName = 'ButtonBase';
@@ -1,5 +1,5 @@
1
1
  import type { ComponentRef } from 'react';
2
- import type { DPDayRange } from '@rehookify/datepicker/dist/types/day';
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'>;
@@ -19,7 +19,6 @@
19
19
  .DataListOption_disabled:hover,
20
20
  .DataListOption_disabled:active {
21
21
  cursor: not-allowed;
22
-
23
22
  background-color: unset;
24
23
  }
25
24
 
@@ -1,4 +1,4 @@
1
- export declare const DATA_LIST_DEFAULT_TAG: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<import("../Paper").PaperBaseProps, "div">;
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;
@@ -1,6 +1,5 @@
1
1
  import { LIST_ITEM_DEFAULT_TAG } from '../List/constants';
2
- import { Paper } from '../Paper';
3
- export var DATA_LIST_DEFAULT_TAG = Paper;
2
+ export var DATA_LIST_DEFAULT_TAG = 'div';
4
3
  export var DATA_LIST_DEFAULT_SIZE = 'm';
5
4
  export var DATA_LIST_DEFAULT_OPEN = false;
6
5
  export var 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">, "container"> & React.RefAttributes<HTMLDivElement>>;
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">, "container"> & React.RefAttributes<HTMLDivElement>>;
47
+ } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("../Portal").PortalBaseProps> & React.RefAttributes<HTMLDivElement>>;
@@ -17,7 +17,7 @@ export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
17
17
  name: 'FieldInput',
18
18
  state: 'value',
19
19
  defaultValue: defaultValue,
20
- }), 2), valueState = _e[0], setValueState = _e[1];
20
+ }), 3), valueState = _e[0], setValueState = _e[1], isControlled = _e[2];
21
21
  var filled = !!valueState || valueState === 0;
22
22
  var required = requiredProp;
23
23
  var disabled = disabledProp;
@@ -47,6 +47,6 @@ export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
47
47
  setFocused(false);
48
48
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
49
49
  }, [onBlur]);
50
- return (React.createElement(Tag, __assign({ className: cnFieldInput({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, value: valueState }, other, { ref: ref }), children));
50
+ return (React.createElement(Tag, __assign({ className: cnFieldInput({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange }, (isControlled ? { value: valueState } : { defaultValue: defaultValue }), other, { ref: ref }), children));
51
51
  });
52
52
  FieldInput.displayName = 'FieldInput';
@@ -5,6 +5,7 @@ import { deprecate } from '@ozen-ui/logger';
5
5
  import { useThemeProps } from '../../hooks/useThemeProps';
6
6
  import { cn } from '../../utils/classname';
7
7
  import { getPaperSizeToFormElement } from '../../utils/getPaperSizeToFormElement';
8
+ import { Paper } from '../Paper';
8
9
  import { Popover } from '../Popover';
9
10
  import { MenuContextConsumer } from './components';
10
11
  import { MENU_DEFAULT_SIZE } from './constants';
@@ -16,7 +17,7 @@ export var Menu = forwardRef(function (inProps, ref) {
16
17
  if (process.env.NODE_ENV !== 'production' && menuListRef) {
17
18
  deprecate('Свойство «menuListRef» устарело. Для замены используйте «menuListProps.ref».');
18
19
  }
19
- return (React.createElement(Popover, __assign({ offset: [0, 4], radius: radius }, other, { open: open, onClose: onClose, className: cnMenu('', [className]), disableEnforceFocus: true, ref: ref }),
20
+ return (React.createElement(Popover, __assign({ as: Paper, offset: [0, 4], radius: radius }, other, { open: open, onClose: onClose, className: cnMenu('', [className]), disableEnforceFocus: true, ref: ref }),
20
21
  React.createElement(MenuContextConsumer, { onClose: onClose, menuListRef: menuListRef, menuListProps: __assign(__assign({ size: size }, menuListProps), { ref: menuListRef || (menuListProps === null || menuListProps === void 0 ? void 0 : menuListProps.ref) }) }, children)));
21
22
  });
22
23
  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">, "container"> & React.RefAttributes<HTMLDivElement>>;
39
+ } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("../Portal").PortalBaseProps> & React.RefAttributes<HTMLDivElement>>;
@@ -12,19 +12,18 @@ import { isKey } from '../../utils/isKey';
12
12
  import { Backdrop } from '../Backdrop';
13
13
  import { Portal } from '../Portal';
14
14
  import { ModalConsumer } from './components';
15
- import { MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE, MODAL_DEFAULT_DISABLE_PORTAL, MODAL_DEFAULT_DISABLE_SCROLL_LOCK, MODAL_DEFAULT_ESCAPE_KEY_DOWN, MODAL_DEFAULT_HIDE_BACKDROP, MODAL_DEFAULT_KEEP_MOUNTED, MODAL_DEFAULT_OPEN, } from './constants';
15
+ import { MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE, MODAL_DEFAULT_DISABLE_SCROLL_LOCK, MODAL_DEFAULT_ESCAPE_KEY_DOWN, MODAL_DEFAULT_HIDE_BACKDROP, MODAL_DEFAULT_KEEP_MOUNTED, MODAL_DEFAULT_OPEN, } from './constants';
16
16
  import { useModalManager } from './index';
17
17
  export var cnModal = cn('Modal');
18
18
  export var Modal = forwardRef(function (_a, ref) {
19
- var _b = _a.open, open = _b === void 0 ? MODAL_DEFAULT_OPEN : _b, _c = _a.keepMounted, keepMounted = _c === void 0 ? MODAL_DEFAULT_KEEP_MOUNTED : _c, _d = _a.hideBackdrop, hideBackdrop = _d === void 0 ? MODAL_DEFAULT_HIDE_BACKDROP : _d, _e = _a.disableScrollLock, disableScrollLock = _e === void 0 ? MODAL_DEFAULT_DISABLE_SCROLL_LOCK : _e, _f = _a.disableClickOutside, disableClickOutside = _f === void 0 ? MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = _a.disableEscapeKeyDown, disableEscapeKeyDown = _g === void 0 ? MODAL_DEFAULT_ESCAPE_KEY_DOWN : _g, _h = _a.disablePortal, disablePortal = _h === void 0 ? MODAL_DEFAULT_DISABLE_PORTAL : _h, 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 = __rest(_a, ["open", "keepMounted", "hideBackdrop", "disableScrollLock", "disableClickOutside", "disableEscapeKeyDown", "disablePortal", "children", "onEnter", "onEntered", "onExit", "onExited", "onClose", "backdropProps", "windowProps", "transitionProps", "className", "ignoreClickOutsideRefs"]);
19
+ var _b = _a.open, open = _b === void 0 ? MODAL_DEFAULT_OPEN : _b, _c = _a.keepMounted, keepMounted = _c === void 0 ? MODAL_DEFAULT_KEEP_MOUNTED : _c, _d = _a.hideBackdrop, hideBackdrop = _d === void 0 ? MODAL_DEFAULT_HIDE_BACKDROP : _d, _e = _a.disableScrollLock, disableScrollLock = _e === void 0 ? MODAL_DEFAULT_DISABLE_SCROLL_LOCK : _e, _f = _a.disableClickOutside, disableClickOutside = _f === void 0 ? MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = _a.disableEscapeKeyDown, disableEscapeKeyDown = _g === void 0 ? 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 = __rest(_a, ["open", "keepMounted", "hideBackdrop", "disableScrollLock", "disableClickOutside", "disableEscapeKeyDown", "children", "onEnter", "onEntered", "onExit", "onExited", "onClose", "backdropProps", "windowProps", "transitionProps", "className", "ignoreClickOutsideRefs"]);
20
20
  var hasBackdrop = !hideBackdrop;
21
21
  var rootRef = useRef(null);
22
22
  var windowInnerRef = useRef(null);
23
23
  var focusedElement = useRef(null);
24
- var _j = __read(useState(false), 2), openState = _j[0], setOpenState = _j[1];
25
- var _k = __read(useState(false), 2), opened = _k[0], setOpened = _k[1];
26
- var _l = useModalManager(windowInnerRef, 1000, openState), isTop = _l.isTop, refsClickOutside = _l.refsClickOutside;
27
- var RootComponent = disablePortal ? 'div' : Portal;
24
+ var _h = __read(useState(false), 2), openState = _h[0], setOpenState = _h[1];
25
+ var _j = __read(useState(false), 2), opened = _j[0], setOpened = _j[1];
26
+ var _k = useModalManager(windowInnerRef, 1000, openState), isTop = _k.isTop, refsClickOutside = _k.refsClickOutside;
28
27
  useClickOutside({
29
28
  refs: __spreadArray(__spreadArray([
30
29
  windowInnerRef
@@ -70,7 +69,7 @@ export var Modal = forwardRef(function (_a, ref) {
70
69
  active: isTop && !disableEscapeKeyDown,
71
70
  });
72
71
  return (React.createElement(CSSTransition, __assign({ classNames: cnModal({ animation: true }), nodeRef: rootRef, timeout: 300 }, transitionProps, { in: openState, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, unmountOnExit: !keepMounted, appear: true }),
73
- React.createElement(RootComponent, __assign({}, other, { className: cnModal({ hidden: keepMounted && !openState, hasBackdrop: hasBackdrop }, [className]), ref: useMultiRef([rootRef, ref]) }),
72
+ React.createElement(Portal, __assign({}, other, { className: cnModal({ hidden: keepMounted && !openState, hasBackdrop: hasBackdrop }, [className]), ref: useMultiRef([rootRef, ref]) }),
74
73
  !hideBackdrop && (React.createElement(Backdrop, __assign({ zIndex: -1, open: openState }, backdropProps, { className: backdropProps === null || backdropProps === void 0 ? void 0 : backdropProps.className }))),
75
74
  React.createElement(ModalConsumer, __assign({}, windowProps, { ref: useMultiRef([windowInnerRef, trapRef, windowProps === null || windowProps === void 0 ? void 0 : windowProps.ref]) }), children))));
76
75
  });
@@ -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;
@@ -4,4 +4,3 @@ export var MODAL_DEFAULT_HIDE_BACKDROP = false;
4
4
  export var MODAL_DEFAULT_DISABLE_SCROLL_LOCK = false;
5
5
  export var MODAL_DEFAULT_DISABLE_CLICK_OUTSIDE = false;
6
6
  export var MODAL_DEFAULT_ESCAPE_KEY_DOWN = false;
7
- export var 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, import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<import("../Paper").PaperBaseProps, "div">>;
4
+ export declare const Popover: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<PopoverBaseProps, "div">;
@@ -1,5 +1,5 @@
1
1
  import { __assign, __read, __rest, __spreadArray } from "tslib";
2
- import React, { useCallback, useMemo, useEffect, useRef, useState, } from 'react';
2
+ import React, { useCallback, useMemo, useEffect, useRef, useState, forwardRef, } from 'react';
3
3
  import { usePopper } from 'react-popper';
4
4
  import { CSSTransition } from 'react-transition-group';
5
5
  import './Popover.css';
@@ -11,6 +11,7 @@ import { useThemeProps } from '../../hooks/useThemeProps';
11
11
  import { cn } from '../../utils/classname';
12
12
  import { isKey } from '../../utils/isKey';
13
13
  import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
14
+ import { Paper } from '../Paper';
14
15
  import { Portal } from '../Portal';
15
16
  import { PopoverArrow } from './components';
16
17
  import { POPOVER_DEFAULT_TAG, POPOVER_DEFAULT_ARROW, POPOVER_DEFAULT_DISABLE_CLICK_OUTSIDE, POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS, POPOVER_DEFAULT_DISABLE_INTERACTIVE, POPOVER_DEFAULT_DISABLE_RETURN_FOCUS, POPOVER_DEFAULT_OPEN, POPOVER_DEFAULT_PLACEMENT, POPOVER_DEFAULT_STRATEGY, POPOVER_DEFAULT_DISABLE_PREVENT_OVERFLOW, } from './constants';
@@ -19,7 +20,11 @@ import { PopoverContext } from './PopoverContext';
19
20
  export var cnPopover = cn('Popover');
20
21
  export var Popover = polymorphicComponentWithRef(function (inProps, ref) {
21
22
  var props = useThemeProps({ props: inProps, name: 'Popover' });
22
- var _a = props.arrow, arrow = _a === void 0 ? POPOVER_DEFAULT_ARROW : _a, _b = props.open, open = _b === void 0 ? POPOVER_DEFAULT_OPEN : _b, _c = props.disableInteractive, disableInteractive = _c === void 0 ? POPOVER_DEFAULT_DISABLE_INTERACTIVE : _c, _d = props.disableEnforceFocus, disableEnforceFocus = _d === void 0 ? POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS : _d, _e = props.disableReturnFocus, disableReturnFocus = _e === void 0 ? POPOVER_DEFAULT_DISABLE_RETURN_FOCUS : _e, _f = props.disableClickOutside, disableClickOutside = _f === void 0 ? POPOVER_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = props.placement, placement = _g === void 0 ? POPOVER_DEFAULT_PLACEMENT : _g, _h = props.strategy, strategy = _h === void 0 ? POPOVER_DEFAULT_STRATEGY : _h, _j = props.disablePreventOverflow, disablePreventOverflow = _j === void 0 ? 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, modifiersProps = props.modifiers, _k = props.as, as = _k === void 0 ? POPOVER_DEFAULT_TAG : _k, other = __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"]);
23
+ var _a = props.arrow, arrow = _a === void 0 ? POPOVER_DEFAULT_ARROW : _a, _b = props.open, open = _b === void 0 ? POPOVER_DEFAULT_OPEN : _b, _c = props.disableInteractive, disableInteractive = _c === void 0 ? POPOVER_DEFAULT_DISABLE_INTERACTIVE : _c, _d = props.disableEnforceFocus, disableEnforceFocus = _d === void 0 ? POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS : _d, _e = props.disableReturnFocus, disableReturnFocus = _e === void 0 ? POPOVER_DEFAULT_DISABLE_RETURN_FOCUS : _e, _f = props.disableClickOutside, disableClickOutside = _f === void 0 ? POPOVER_DEFAULT_DISABLE_CLICK_OUTSIDE : _f, _g = props.placement, placement = _g === void 0 ? POPOVER_DEFAULT_PLACEMENT : _g, _h = props.strategy, strategy = _h === void 0 ? POPOVER_DEFAULT_STRATEGY : _h, _j = props.disablePreventOverflow, disablePreventOverflow = _j === void 0 ? 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 ? POPOVER_DEFAULT_TAG : _k, other = __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"]);
24
+ var Tag = useMemo(function () {
25
+ // eslint-disable-next-line react/display-name
26
+ return forwardRef(function (props, ref) { return (React.createElement(Paper, __assign({ radius: "l", shadow: "m", background: "main" }, props, { as: as, ref: ref }))); });
27
+ }, [as]);
23
28
  var _l = __read(useState(false), 2), openState = _l[0], setOpenState = _l[1];
24
29
  var focusedElement = useRef(null);
25
30
  var popoverRef = useRef(null);
@@ -102,7 +107,7 @@ export var Popover = polymorphicComponentWithRef(function (inProps, ref) {
102
107
  offset: offset,
103
108
  },
104
109
  }
105
- ], __read((modifiersProps || [])), false); }, [offset, equalAnchorWidth, modifiersProps]);
110
+ ], __read((modifiersProp || [])), false); }, [offset, equalAnchorWidth, modifiersProp]);
106
111
  // Якорный элемент или координаты
107
112
  var resolveReferenceElement = useMemo(function () {
108
113
  if (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)
@@ -143,7 +148,7 @@ export var Popover = polymorphicComponentWithRef(function (inProps, ref) {
143
148
  }, [open]);
144
149
  return (React.createElement(PopoverContext.Provider, { value: { isTop: isTop } },
145
150
  React.createElement(CSSTransition, __assign({ nodeRef: popoverRef, classNames: cnPopover({ animation: true }), timeout: 120 }, transitionProps, { in: openState, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, unmountOnExit: true }),
146
- React.createElement(Portal, __assign({ as: as, radius: "l", shadow: "l", background: "main" }, other, { style: __assign(__assign({}, style), styles.popper), ref: portalRef, className: cnPopover({ disableInteractive: disableInteractive }, [className]) }, attributes.popper),
151
+ React.createElement(Portal, __assign({ as: Tag }, other, { style: __assign(__assign({}, style), styles.popper), ref: portalRef, className: cnPopover({ disableInteractive: disableInteractive }, [className]) }, attributes.popper),
147
152
  children,
148
153
  arrow && (React.createElement(PopoverArrow, __assign({}, arrowProps, { style: __assign(__assign({}, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.style), styles.arrow), "data-popper-arrow": true })))))));
149
154
  });
@@ -1,4 +1,4 @@
1
- export declare const POPOVER_DEFAULT_TAG: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<import("../Paper").PaperBaseProps, "div">;
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,5 +1,4 @@
1
- import { Paper } from '../Paper';
2
- export var POPOVER_DEFAULT_TAG = Paper;
1
+ export var POPOVER_DEFAULT_TAG = 'div';
3
2
  export var POPOVER_DEFAULT_ARROW = false;
4
3
  export var POPOVER_DEFAULT_OPEN = false;
5
4
  export var 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 { PortalProps } from '../Portal';
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>;
@@ -4,14 +4,14 @@ import { createPortal } from 'react-dom';
4
4
  import { useThemeProps } from '../../hooks/useThemeProps';
5
5
  import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
6
6
  import { useTheme, ThemeProvider } from '../ThemeProvider';
7
- import { PORTAL_DEFAULT_TAG } from './constants';
7
+ import { PORTAL_DEFAULT_CONTAINER, PORTAL_DEFAULT_DISABLE_PORTAL, PORTAL_DEFAULT_TAG, } from './constants';
8
8
  export var Portal = polymorphicComponentWithRef(function (inProps, ref) {
9
9
  var _a = useThemeProps({
10
10
  props: inProps,
11
11
  name: 'Portal',
12
- }), children = _a.children, container = _a.container, className = _a.className, _b = _a.as, Tag = _b === void 0 ? PORTAL_DEFAULT_TAG : _b, other = __rest(_a, ["children", "container", "className", "as"]);
12
+ }), _b = _a.disablePortal, disablePortal = _b === void 0 ? PORTAL_DEFAULT_DISABLE_PORTAL : _b, _c = _a.as, Tag = _c === void 0 ? PORTAL_DEFAULT_TAG : _c, containerProp = _a.container, children = _a.children, other = __rest(_a, ["disablePortal", "as", "container", "children"]);
13
+ var container = containerProp || PORTAL_DEFAULT_CONTAINER;
13
14
  var theme = useTheme();
14
- var portalContainer = container || window.document.body;
15
- return createPortal(React.createElement(ThemeProvider, __assign({ theme: theme, className: className, as: Tag }, other, { ref: ref }), children), portalContainer);
15
+ return disablePortal ? (React.createElement(Tag, __assign({}, other, { ref: ref }), children)) : (createPortal(React.createElement(ThemeProvider, __assign({ theme: theme, as: Tag }, other, { ref: ref }), children), container));
16
16
  });
17
17
  Portal.displayName = 'Portal';
@@ -1 +1,3 @@
1
1
  export declare const PORTAL_DEFAULT_TAG = "div";
2
+ export declare const PORTAL_DEFAULT_CONTAINER: HTMLElement;
3
+ export declare const PORTAL_DEFAULT_DISABLE_PORTAL = false;
@@ -1 +1,3 @@
1
1
  export var PORTAL_DEFAULT_TAG = 'div';
2
+ export var PORTAL_DEFAULT_CONTAINER = window.document.body;
3
+ export var 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;
@@ -1,8 +1,5 @@
1
1
  import React, { useContext } from 'react';
2
- export var SnackbarContext = React.createContext({
3
- pushMessage: function () { return ''; },
4
- closeMessage: function () { return undefined; },
5
- });
2
+ export var SnackbarContext = React.createContext({});
6
3
  export var useSnackbar = function () { return useContext(SnackbarContext); };
7
4
  // Именованный провайдер
8
5
  if (process.env.NODE_ENV !== 'production') {
@@ -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">, "container"> & {
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>>;
@@ -1,4 +1,4 @@
1
- import { __assign, __read, __rest } from "tslib";
1
+ import { __assign, __read, __rest, __spreadArray } from "tslib";
2
2
  import './Tooltip.css';
3
3
  import React, { useRef, useMemo, useEffect, useState } from 'react';
4
4
  import { deprecate } from '@ozen-ui/logger';
@@ -14,7 +14,7 @@ import { TOOLTIP_DEFAULT_ARROW, TOOLTIP_DEFAULT_DELAY_ENTER, TOOLTIP_DEFAULT_DEL
14
14
  export var cnTooltip = cn('Tooltip');
15
15
  export var Tooltip = polymorphicComponentWithRef(function (inProps, ref) {
16
16
  var props = useThemeProps({ props: inProps, name: 'Tooltip' });
17
- var _a = props.trigger, trigger = _a === void 0 ? TOOLTIP_DEFAULT_TRIGGER : _a, _b = props.size, size = _b === void 0 ? TOOLTIP_DEFAULT_SIZE : _b, _c = props.offset, offset = _c === void 0 ? TOOLTIP_DEFAULT_OFFSET : _c, _d = props.delayEnter, delayEnter = _d === void 0 ? TOOLTIP_DEFAULT_DELAY_ENTER : _d, _e = props.delayLeave, delayLeave = _e === void 0 ? TOOLTIP_DEFAULT_DELAY_LEAVE : _e, _f = props.arrow, arrow = _f === void 0 ? TOOLTIP_DEFAULT_ARROW : _f, _g = props.shouldWrapChildren, shouldWrapChildren = _g === void 0 ? TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN : _g, _h = props.disabled, disabled = _h === void 0 ? TOOLTIP_DEFAULT_DISABLED : _h, _j = props.inverse, inverse = _j === void 0 ? TOOLTIP_DEFAULT_INVERSE : _j, _k = props.as, as = _k === void 0 ? TOOLTIP_DEFAULT_TAG : _k, variant = props.variant, children = props.children, label = props.label, openProp = props.open, placement = props.placement, disableInteractive = props.disableInteractive, className = props.className, onOpen = props.onOpen, onClose = props.onClose, other = __rest(props, ["trigger", "size", "offset", "delayEnter", "delayLeave", "arrow", "shouldWrapChildren", "disabled", "inverse", "as", "variant", "children", "label", "open", "placement", "disableInteractive", "className", "onOpen", "onClose"]);
17
+ var _a = props.trigger, trigger = _a === void 0 ? TOOLTIP_DEFAULT_TRIGGER : _a, _b = props.size, size = _b === void 0 ? TOOLTIP_DEFAULT_SIZE : _b, _c = props.offset, offset = _c === void 0 ? TOOLTIP_DEFAULT_OFFSET : _c, _d = props.delayEnter, delayEnter = _d === void 0 ? TOOLTIP_DEFAULT_DELAY_ENTER : _d, _e = props.delayLeave, delayLeave = _e === void 0 ? TOOLTIP_DEFAULT_DELAY_LEAVE : _e, _f = props.arrow, arrow = _f === void 0 ? TOOLTIP_DEFAULT_ARROW : _f, _g = props.shouldWrapChildren, shouldWrapChildren = _g === void 0 ? TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN : _g, _h = props.disabled, disabled = _h === void 0 ? TOOLTIP_DEFAULT_DISABLED : _h, _j = props.inverse, inverse = _j === void 0 ? TOOLTIP_DEFAULT_INVERSE : _j, _k = props.as, as = _k === void 0 ? 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 = __rest(props, ["trigger", "size", "offset", "delayEnter", "delayLeave", "arrow", "shouldWrapChildren", "disabled", "inverse", "as", "modifiers", "onMouseEnter", "onMouseLeave", "variant", "children", "label", "open", "className", "onOpen", "onClose"]);
18
18
  if (process.env.NODE_ENV !== 'production' && variant) {
19
19
  deprecate('Свойство «variant» устарело. Для замены используйте «inverse».');
20
20
  }
@@ -22,14 +22,14 @@ export var Tooltip = polymorphicComponentWithRef(function (inProps, ref) {
22
22
  var _l = __read(useState(), 2), delay = _l[0], setDelay = _l[1];
23
23
  var _m = __read(useBoolean(), 2), focused = _m[0], setFocused = _m[1];
24
24
  var _o = __read(useBoolean(), 2), hovered = _o[0], setHovered = _o[1];
25
- var modifiers = [
25
+ var modifiers = __spreadArray([
26
26
  {
27
27
  name: 'arrow',
28
28
  options: {
29
29
  padding: size === 'xs' ? 8 : 12,
30
30
  },
31
- },
32
- ];
31
+ }
32
+ ], __read((modifiersProp || [])), false);
33
33
  var _p = __read(useControlled({
34
34
  value: openProp,
35
35
  defaultValue: false,
@@ -62,18 +62,20 @@ export var Tooltip = polymorphicComponentWithRef(function (inProps, ref) {
62
62
  }, [children, shouldWrapChildren]);
63
63
  var childrenProps = resolveChildren.props, childrenRef = resolveChildren.ref;
64
64
  var childrenMultiRef = useMultiRef([anchorRef, childrenRef]);
65
- var handleMouseEnter = function () {
65
+ var handleMouseEnter = function (e) {
66
66
  if (trigger === 'hover' || trigger === 'hover&focus') {
67
67
  setHovered.on();
68
68
  setOpenWithDelay(true);
69
69
  }
70
+ onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
70
71
  };
71
- var handleMouseLeave = function () {
72
+ var handleMouseLeave = function (e) {
72
73
  if (trigger === 'hover' || trigger === 'hover&focus') {
73
74
  setHovered.off();
74
75
  if (!focused)
75
76
  setOpenWithDelay(false);
76
77
  }
78
+ onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
77
79
  };
78
80
  var handleClick = function () {
79
81
  if (trigger === 'click')
@@ -109,11 +111,11 @@ export var Tooltip = polymorphicComponentWithRef(function (inProps, ref) {
109
111
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
110
112
  },
111
113
  onMouseEnter: function (e) {
112
- handleMouseEnter();
114
+ handleMouseEnter(e);
113
115
  onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
114
116
  },
115
117
  onMouseLeave: function (e) {
116
- handleMouseLeave();
118
+ handleMouseLeave(e);
117
119
  onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
118
120
  },
119
121
  };
@@ -129,9 +131,7 @@ export var Tooltip = polymorphicComponentWithRef(function (inProps, ref) {
129
131
  ]);
130
132
  return (React.createElement(React.Fragment, null,
131
133
  React.cloneElement(resolveChildren, composeChildrenProps),
132
- React.createElement(Popover, __assign({ anchorRef: anchorRef, strategy: "absolute", as: as, background: "main" }, (variant === 'dark' && { background: 'main-inverse' }), (inverse && { background: 'main-inverse' }), { radius: size === 'xs' ? 's' : 'l' }, other, { ref: ref, offset: offset, placement: placement, open: openState, onClose: closeWithDelay, className: cnTooltip({ size: size, variant: variant, inverse: inverse }, [className]), disableInteractive: disableInteractive, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, arrow: arrow, arrowProps: {
133
- size: size,
134
- }, modifiers: modifiers, disableEnforceFocus: true, disableReturnFocus: true }),
134
+ React.createElement(Popover, __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: cnTooltip({ size: size, variant: variant, inverse: inverse }, [className]), disableEnforceFocus: true, disableReturnFocus: true }, other, { open: openState, onClose: closeWithDelay, ref: ref }),
135
135
  React.createElement("div", { className: cnTooltip('Content', { size: size, variant: variant, inverse: inverse }) }, label))));
136
136
  });
137
137
  Tooltip.displayName = 'Tooltip';
@@ -1,4 +1,4 @@
1
- export declare const TOOLTIP_DEFAULT_TAG: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<import("../Paper").PaperBaseProps, "div">;
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,5 +1,4 @@
1
- import { Paper } from '../Paper';
2
- export var TOOLTIP_DEFAULT_TAG = Paper;
1
+ export var TOOLTIP_DEFAULT_TAG = 'div';
3
2
  export var TOOLTIP_DEFAULT_TRIGGER = 'hover';
4
3
  export var TOOLTIP_DEFAULT_SIZE = 's';
5
4
  export var 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 & Pick<PopoverBaseProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'>;
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 {};
@@ -35,5 +35,5 @@ export var useControlled = function (_a) {
35
35
  setValue(newValue);
36
36
  }
37
37
  }, []);
38
- return [value, setValueIfUncontrolled, valueProp !== undefined];
38
+ return [value, setValueIfUncontrolled, isControlled];
39
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozen-ui/kit",
3
- "version": "0.55.0",
3
+ "version": "0.57.0",
4
4
  "description": "React component library",
5
5
  "files": [
6
6
  "*"
@@ -23,13 +23,13 @@
23
23
  "@popperjs/core": "^2.11.8",
24
24
  "@rehookify/datepicker": "^6.6.1",
25
25
  "decimal.js": "^10.4.3",
26
- "react-is": "^18.2.0",
26
+ "react-is": "^18.3.1",
27
27
  "react-popper": "^2.3.0",
28
28
  "react-transition-group": "^4.4.5",
29
- "tslib": "^2.6.2",
30
- "@ozen-ui/fonts": "0.55.0",
31
- "@ozen-ui/icons": "0.55.0",
32
- "@ozen-ui/logger": "0.55.0"
29
+ "tslib": "^2.6.3",
30
+ "@ozen-ui/fonts": "0.57.0",
31
+ "@ozen-ui/icons": "0.57.0",
32
+ "@ozen-ui/logger": "0.57.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=17.0.2 <19.0.0",