@ozen-ui/kit 0.6.0 → 0.8.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 (103) hide show
  1. package/Paper/package.json +5 -0
  2. package/__inner__/cjs/components/Alert/Alert.css +0 -5
  3. package/__inner__/cjs/components/Alert/Alert.js +3 -2
  4. package/__inner__/cjs/components/Breadcrumbs/Breadcrumbs.css +4 -0
  5. package/__inner__/cjs/components/Card/Card.css +9 -21
  6. package/__inner__/cjs/components/Card/Card.d.ts +3 -4
  7. package/__inner__/cjs/components/Card/Card.js +11 -1
  8. package/__inner__/cjs/components/Dialog/Dialog.css +0 -2
  9. package/__inner__/cjs/components/Dialog/Dialog.d.ts +21 -1
  10. package/__inner__/cjs/components/Drawer/Drawer.css +0 -1
  11. package/__inner__/cjs/components/Drawer/Drawer.d.ts +23 -1
  12. package/__inner__/cjs/components/Menu/components/MenuItem/MenuItem.js +3 -2
  13. package/__inner__/cjs/components/Modal/Modal.css +8 -11
  14. package/__inner__/cjs/components/Modal/Modal.d.ts +74 -5
  15. package/__inner__/cjs/components/Modal/Modal.js +13 -20
  16. package/__inner__/cjs/components/Modal/components/ModalConsumer.d.ts +5 -0
  17. package/__inner__/cjs/components/Modal/components/ModalConsumer.js +15 -0
  18. package/__inner__/cjs/components/Modal/components/index.d.ts +1 -0
  19. package/__inner__/cjs/components/Modal/components/index.js +4 -0
  20. package/__inner__/cjs/components/Paper/Paper.css +44 -0
  21. package/__inner__/cjs/components/Paper/Paper.d.ts +19 -0
  22. package/__inner__/cjs/components/Paper/Paper.js +25 -0
  23. package/__inner__/cjs/components/Paper/index.d.ts +1 -0
  24. package/__inner__/cjs/components/Paper/index.js +4 -0
  25. package/__inner__/cjs/components/Popover/Popover.css +1 -11
  26. package/__inner__/cjs/components/Popover/Popover.d.ts +2 -3
  27. package/__inner__/cjs/components/Popover/Popover.js +4 -3
  28. package/__inner__/cjs/components/Popover/components/PopoverArrow.js +2 -2
  29. package/__inner__/cjs/components/Popover/components/types.d.ts +0 -3
  30. package/__inner__/cjs/components/Popover/components/types.js +1 -2
  31. package/__inner__/cjs/components/Popover/constants.d.ts +1 -0
  32. package/__inner__/cjs/components/Popover/constants.js +3 -1
  33. package/__inner__/cjs/components/Popover/types.d.ts +8 -4
  34. package/__inner__/cjs/components/Portal/Portal.d.ts +8 -8
  35. package/__inner__/cjs/components/Portal/Portal.js +7 -6
  36. package/__inner__/cjs/components/Snackbar/SnackbarProvider.d.ts +4 -1
  37. package/__inner__/cjs/components/Snackbar/components/Snackbar/Snackbar.d.ts +6 -1
  38. package/__inner__/cjs/components/ThemeProvider/ThemeProvider.d.ts +2 -1
  39. package/__inner__/cjs/components/ThemeProvider/types.d.ts +2 -0
  40. package/__inner__/cjs/components/Tooltip/Tooltip.css +11 -16
  41. package/__inner__/cjs/components/Tooltip/Tooltip.js +1 -2
  42. package/__inner__/cjs/components/Tooltip/constants.d.ts +1 -0
  43. package/__inner__/cjs/components/Tooltip/constants.js +3 -1
  44. package/__inner__/cjs/components/Tooltip/types.d.ts +3 -2
  45. package/__inner__/cjs/components/Typography/Typography.css +36 -0
  46. package/__inner__/cjs/components/Typography/Typography.d.ts +1 -1
  47. package/__inner__/cjs/components/Typography/Typography.js +12 -0
  48. package/__inner__/cjs/hooks/useLockBodyScroll/index.d.ts +1 -0
  49. package/__inner__/cjs/hooks/useLockBodyScroll/index.js +4 -0
  50. package/__inner__/cjs/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +1 -0
  51. package/__inner__/cjs/hooks/useLockBodyScroll/useLockBodyScroll.js +18 -0
  52. package/__inner__/esm/components/Alert/Alert.css +0 -5
  53. package/__inner__/esm/components/Alert/Alert.js +3 -2
  54. package/__inner__/esm/components/Breadcrumbs/Breadcrumbs.css +4 -0
  55. package/__inner__/esm/components/Card/Card.css +9 -21
  56. package/__inner__/esm/components/Card/Card.d.ts +3 -4
  57. package/__inner__/esm/components/Card/Card.js +11 -1
  58. package/__inner__/esm/components/Dialog/Dialog.css +0 -2
  59. package/__inner__/esm/components/Dialog/Dialog.d.ts +21 -1
  60. package/__inner__/esm/components/Drawer/Drawer.css +0 -1
  61. package/__inner__/esm/components/Drawer/Drawer.d.ts +23 -1
  62. package/__inner__/esm/components/Menu/components/MenuItem/MenuItem.js +3 -2
  63. package/__inner__/esm/components/Modal/Modal.css +8 -11
  64. package/__inner__/esm/components/Modal/Modal.d.ts +74 -5
  65. package/__inner__/esm/components/Modal/Modal.js +13 -20
  66. package/__inner__/esm/components/Modal/components/ModalConsumer.d.ts +5 -0
  67. package/__inner__/esm/components/Modal/components/ModalConsumer.js +12 -0
  68. package/__inner__/esm/components/Modal/components/index.d.ts +1 -0
  69. package/__inner__/esm/components/Modal/components/index.js +1 -0
  70. package/__inner__/esm/components/Paper/Paper.css +44 -0
  71. package/__inner__/esm/components/Paper/Paper.d.ts +19 -0
  72. package/__inner__/esm/components/Paper/Paper.js +22 -0
  73. package/__inner__/esm/components/Paper/index.d.ts +1 -0
  74. package/__inner__/esm/components/Paper/index.js +1 -0
  75. package/__inner__/esm/components/Popover/Popover.css +1 -11
  76. package/__inner__/esm/components/Popover/Popover.d.ts +2 -3
  77. package/__inner__/esm/components/Popover/Popover.js +6 -5
  78. package/__inner__/esm/components/Popover/components/PopoverArrow.js +2 -2
  79. package/__inner__/esm/components/Popover/components/types.d.ts +0 -3
  80. package/__inner__/esm/components/Popover/components/types.js +0 -1
  81. package/__inner__/esm/components/Popover/constants.d.ts +1 -0
  82. package/__inner__/esm/components/Popover/constants.js +2 -0
  83. package/__inner__/esm/components/Popover/types.d.ts +8 -4
  84. package/__inner__/esm/components/Portal/Portal.d.ts +8 -8
  85. package/__inner__/esm/components/Portal/Portal.js +7 -6
  86. package/__inner__/esm/components/Snackbar/SnackbarProvider.d.ts +4 -1
  87. package/__inner__/esm/components/Snackbar/components/Snackbar/Snackbar.d.ts +6 -1
  88. package/__inner__/esm/components/ThemeProvider/ThemeProvider.d.ts +2 -1
  89. package/__inner__/esm/components/ThemeProvider/types.d.ts +2 -0
  90. package/__inner__/esm/components/Tooltip/Tooltip.css +11 -16
  91. package/__inner__/esm/components/Tooltip/Tooltip.js +3 -4
  92. package/__inner__/esm/components/Tooltip/constants.d.ts +1 -0
  93. package/__inner__/esm/components/Tooltip/constants.js +2 -0
  94. package/__inner__/esm/components/Tooltip/types.d.ts +3 -2
  95. package/__inner__/esm/components/Typography/Typography.css +36 -0
  96. package/__inner__/esm/components/Typography/Typography.d.ts +1 -1
  97. package/__inner__/esm/components/Typography/Typography.js +12 -0
  98. package/__inner__/esm/hooks/useLockBodyScroll/index.d.ts +1 -0
  99. package/__inner__/esm/hooks/useLockBodyScroll/index.js +1 -0
  100. package/__inner__/esm/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +1 -0
  101. package/__inner__/esm/hooks/useLockBodyScroll/useLockBodyScroll.js +14 -0
  102. package/package.json +1 -1
  103. package/useLockBodyScroll/package.json +5 -0
@@ -1,5 +1,5 @@
1
1
  import { __assign, __read, __rest, __spreadArray } from "tslib";
2
- import React, { useCallback, useMemo, useEffect, useRef, useState, forwardRef, } from 'react';
2
+ import React, { useCallback, useMemo, useEffect, useRef, useState, } from 'react';
3
3
  import { usePopper } from 'react-popper';
4
4
  import { CSSTransition } from 'react-transition-group';
5
5
  import './Popover.css';
@@ -10,13 +10,14 @@ import { useMultiRef } from '../../hooks/useMultiRef';
10
10
  import { useThemeProps } from '../../hooks/useThemeProps';
11
11
  import { cn } from '../../utils/classname';
12
12
  import { isKey } from '../../utils/isKey';
13
+ import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
13
14
  import { Portal } from '../Portal';
14
15
  import { PopoverArrow } from './components';
15
- import { POPOVER_DEFAULT_ARROW, POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS, POPOVER_DEFAULT_DISABLE_INTERACTIVE, POPOVER_DEFAULT_DISABLE_RETURN_FOCUS, POPOVER_DEFAULT_OPEN, POPOVER_DEFAULT_PLACEMENT, } from './constants';
16
+ import { POPOVER_DEFAULT_ARROW, POPOVER_DEFAULT_DISABLE_ENFORCE_FOCUS, POPOVER_DEFAULT_DISABLE_INTERACTIVE, POPOVER_DEFAULT_DISABLE_RETURN_FOCUS, POPOVER_DEFAULT_OPEN, POPOVER_DEFAULT_PLACEMENT, POPOVER_DEFAULT_TAG, } from './constants';
16
17
  import { usePopoverManager } from './index';
17
18
  import { PopoverContext } from './PopoverContext';
18
19
  export var cnPopover = cn('Popover');
19
- export var Popover = forwardRef(function (inProps, ref) {
20
+ export var Popover = polymorphicComponentWithRef(function (inProps, ref) {
20
21
  var props = useThemeProps({ props: inProps, name: 'Popover' });
21
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.placement, placement = _f === void 0 ? POPOVER_DEFAULT_PLACEMENT : _f, 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, other = __rest(props, ["arrow", "open", "disableInteractive", "disableEnforceFocus", "disableReturnFocus", "placement", "ignoreClickOutsideRefs", "arrowProps", "anchorRef", "equalAnchorWidth", "offset", "children", "transitionProps", "onClose", "onEnter", "onEntered", "onExit", "onExited", "className", "position", "style", "setUpdate"]);
22
23
  var isClickOutSide = useRef(null);
@@ -140,8 +141,8 @@ export var Popover = forwardRef(function (inProps, ref) {
140
141
  var portalRef = useMultiRef([ref, popoverRef, trapRef, setPopperElement]);
141
142
  return (React.createElement(PopoverContext.Provider, { value: { isTop: isTop } },
142
143
  React.createElement(CSSTransition, __assign({ classNames: cnPopover({ animation: true }), timeout: 120 }, transitionProps, { "in": openState, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, unmountOnExit: true }),
143
- React.createElement(Portal, __assign({}, other, { style: __assign(__assign({}, style), styles.popper), ref: portalRef, className: cnPopover({ disableInteractive: disableInteractive }, [className]) }, attributes.popper),
144
+ React.createElement(Portal, __assign({ as: POPOVER_DEFAULT_TAG, radius: "xs", shadow: "l", background: "main" }, other, { style: __assign(__assign({}, style), styles.popper), ref: portalRef, className: cnPopover({ disableInteractive: disableInteractive }, [className]) }, attributes.popper),
144
145
  children,
145
- arrow && (React.createElement(PopoverArrow, __assign({ size: "s", variant: "light" }, arrowProps, { style: __assign(__assign({}, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.style), styles.arrow), "data-popper-arrow": true })))))));
146
+ arrow && (React.createElement(PopoverArrow, __assign({}, arrowProps, { style: __assign(__assign({}, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.style), styles.arrow), "data-popper-arrow": true })))))));
146
147
  });
147
148
  Popover.displayName = 'Popover';
@@ -2,8 +2,8 @@ import { __assign, __rest } from "tslib";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { cnPopover } from '../Popover';
4
4
  export var PopoverArrow = forwardRef(function (_a, ref) {
5
- var _b = _a.size, size = _b === void 0 ? 's' : _b, className = _a.className, style = _a.style, _c = _a.variant, variant = _c === void 0 ? 'light' : _c, other = __rest(_a, ["size", "className", "style", "variant"]);
6
- return (React.createElement("div", __assign({ className: cnPopover('Arrow', { variant: variant, size: size }, [className]), style: style }, other, { ref: ref }), size === 'xs' ? (React.createElement("svg", { width: "6", height: "12", viewBox: "0 0 6 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
5
+ var _b = _a.size, size = _b === void 0 ? 's' : _b, className = _a.className, style = _a.style, other = __rest(_a, ["size", "className", "style"]);
6
+ return (React.createElement("div", __assign({ className: cnPopover('Arrow', { size: size }, [className]), style: style }, other, { ref: ref }), size === 'xs' ? (React.createElement("svg", { width: "6", height: "12", viewBox: "0 0 6 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
7
7
  React.createElement("path", { d: "M6 12L6 0C6 0 6 1.5 4 3L1.06594 5.20054C0.532609 5.60054 0.532609 6.39946 1.06594 6.79946L4 9C6 10.5 6 12 6 12Z", fill: "currentColor" }))) : (React.createElement("svg", { width: "8", height: "16", viewBox: "0 0 8 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
8
8
  React.createElement("path", { d: "M8 16L8 0C8 0 8 2 5.33333 4L2.13256 6.40058C1.06589 7.20058 1.06589 8.79942 2.13256 9.59942L5.33333 12C8 14 8 16 8 16Z", fill: "currentColor" })))));
9
9
  });
@@ -1,11 +1,8 @@
1
1
  import type { HTMLAttributes, Ref } from 'react';
2
2
  export declare const popoverArrowSizeVariant: readonly ["xs", "s"];
3
3
  export type PopoverArrowSizeVariant = (typeof popoverArrowSizeVariant)[number];
4
- export declare const popoverArrowVariant: readonly ["light", "dark"];
5
- export type PopoverArrowVariant = (typeof popoverArrowVariant)[number];
6
4
  export type PopoverArrowProps = {
7
5
  size?: PopoverArrowSizeVariant;
8
- variant?: PopoverArrowVariant;
9
6
  className?: string;
10
7
  ref?: Ref<HTMLDivElement>;
11
8
  } & HTMLAttributes<HTMLDivElement> & {
@@ -1,2 +1 @@
1
1
  export var popoverArrowSizeVariant = ['xs', 's'];
2
- export var popoverArrowVariant = ['light', 'dark'];
@@ -1,3 +1,4 @@
1
+ export declare const POPOVER_DEFAULT_TAG: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<import("../Paper").PaperBaseProps, "div">;
1
2
  export declare const POPOVER_DEFAULT_ARROW = false;
2
3
  export declare const POPOVER_DEFAULT_OPEN = false;
3
4
  export declare const POPOVER_DEFAULT_DISABLE_INTERACTIVE = false;
@@ -1,3 +1,5 @@
1
+ import { Paper } from '../Paper';
2
+ export var POPOVER_DEFAULT_TAG = Paper;
1
3
  export var POPOVER_DEFAULT_ARROW = false;
2
4
  export var POPOVER_DEFAULT_OPEN = false;
3
5
  export var POPOVER_DEFAULT_DISABLE_INTERACTIVE = false;
@@ -1,16 +1,18 @@
1
- import React from 'react';
2
- import type { RefObject, ComponentPropsWithRef } from 'react';
1
+ import React, { ComponentRef, ElementType } from 'react';
2
+ import type { RefObject } from 'react';
3
3
  import PopperJS from '@popperjs/core';
4
4
  import type { CSSTransitionProps } from 'react-transition-group/CSSTransition';
5
+ import type { PolymorphicComponentPropsWithRef } from '../../utils/polymorphicComponentWithRef';
5
6
  import type { PortalProps } from '../Portal';
6
7
  import type { PopoverArrowProps } from './components';
8
+ import { POPOVER_DEFAULT_TAG } from './constants';
7
9
  export type VirtualElement = {
8
10
  getBoundingClientRect: () => DOMRect;
9
11
  contextElement?: Element;
10
12
  };
11
13
  export declare const popoverPlacementVariant: readonly ["top-start", "top-end", "bottom-start", "bottom-end", "right-start", "right-end", "left-start", "left-end", "auto", "auto-start", "auto-end", "top", "bottom", "right", "left"];
12
14
  export type PopoverPlacementVariant = (typeof popoverPlacementVariant)[number];
13
- export type PopoverProps = {
15
+ export type PopoverBaseProps = {
14
16
  /** Признак по которому компонент будет представлен */
15
17
  open?: boolean;
16
18
  /** Ссылка на элемент, относительно которого будет позиционироваться поповер */
@@ -67,4 +69,6 @@ export type PopoverProps = {
67
69
  setUpdate?: (update: PopperJS.Instance['update'] | null) => void;
68
70
  /** Контейнер для монтирования всплывающего окна */
69
71
  container?: PortalProps['container'];
70
- } & ComponentPropsWithRef<'div'>;
72
+ };
73
+ export type PopoverRef = ComponentRef<typeof POPOVER_DEFAULT_TAG>;
74
+ export type PopoverProps<As extends ElementType = typeof POPOVER_DEFAULT_TAG> = PolymorphicComponentPropsWithRef<PopoverBaseProps, As>;
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import type { ComponentPropsWithRef, ComponentRef } from 'react';
3
- declare const portalEl = "div";
4
- export type PortalRef = ComponentRef<typeof portalEl>;
5
- export type PortalProps = {
1
+ import type { ComponentRef, ElementType } from 'react';
2
+ import { type PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
3
+ export declare const PORTAL_DEFAULT_TAG = "div";
4
+ export type PortalRef = ComponentRef<typeof PORTAL_DEFAULT_TAG>;
5
+ export type PortalBaseProps = {
6
6
  /** Контейнер для монтирования портала */
7
7
  container?: Element | DocumentFragment | null;
8
- } & ComponentPropsWithRef<typeof portalEl>;
9
- export declare const Portal: React.ForwardRefExoticComponent<Omit<PortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
- export {};
8
+ };
9
+ export type PortalProps<As extends ElementType = typeof PORTAL_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<PortalBaseProps, As>;
10
+ export declare const Portal: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<PortalBaseProps, "div">;
@@ -1,16 +1,17 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import React, { forwardRef } from 'react';
2
+ import React from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { useThemeProps } from '../../hooks/useThemeProps';
5
- import { ThemeProvider, useTheme } from '../ThemeProvider';
6
- var portalEl = 'div';
7
- export var Portal = forwardRef(function (inProps, ref) {
5
+ import { polymorphicComponentWithRef, } from '../../utils/polymorphicComponentWithRef';
6
+ import { useTheme, ThemeProvider } from '../ThemeProvider';
7
+ export var PORTAL_DEFAULT_TAG = 'div';
8
+ export var Portal = polymorphicComponentWithRef(function (inProps, ref) {
8
9
  var _a = useThemeProps({
9
10
  props: inProps,
10
11
  name: 'Portal'
11
- }), children = _a.children, container = _a.container, className = _a.className, other = __rest(_a, ["children", "container", "className"]);
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
13
  var theme = useTheme();
13
14
  var portalContainer = container || window.document.body;
14
- return createPortal(React.createElement(ThemeProvider, __assign({ theme: theme, className: className }, other, { ref: ref }), children), portalContainer);
15
+ return createPortal(React.createElement(ThemeProvider, __assign({ theme: theme, className: className, as: Tag }, other, { ref: ref }), children), portalContainer);
15
16
  });
16
17
  Portal.displayName = 'Portal';
@@ -7,4 +7,7 @@ export type SnackbarProviderProps = Partial<SnackbarProps> & SnackbarCommonProps
7
7
  /** Максимальное количество одновременно отображенных сообщений */
8
8
  maxMessages?: number;
9
9
  };
10
- export declare const SnackbarProvider: React.ForwardRefExoticComponent<Omit<SnackbarProviderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ export declare const SnackbarProvider: React.ForwardRefExoticComponent<Partial<SnackbarProps> & SnackbarCommonProps & {
11
+ /** Максимальное количество одновременно отображенных сообщений */
12
+ maxMessages?: number | undefined;
13
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -8,4 +8,9 @@ export type SnackbarProps = PortalProps & {
8
8
  /** Расположение сообщения относительно контейнера */
9
9
  anchorOrigin: SnackbarAnchorOrigin;
10
10
  };
11
- export declare const Snackbar: React.ForwardRefExoticComponent<Omit<SnackbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ export declare const Snackbar: React.ForwardRefExoticComponent<import("../../../Portal").PortalBaseProps & {
12
+ as?: "div" | undefined;
13
+ } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "container"> & {
14
+ /** Расположение сообщения относительно контейнера */
15
+ anchorOrigin: SnackbarAnchorOrigin;
16
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -1,5 +1,5 @@
1
1
  import './ThemeProvider.css';
2
- import React, { ElementType } from 'react';
2
+ import React, { ComponentRef, ElementType } from 'react';
3
3
  import { type PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
4
4
  import type { Theme } from './types';
5
5
  export declare const THEME_DEFAULT_TAG = "div";
@@ -11,4 +11,5 @@ export type ThemeProviderBaseProps = {
11
11
  };
12
12
  export declare const cnThemeProvider: import("@bem-react/classname").ClassNameFormatter;
13
13
  export type ThemeProviderProps<As extends ElementType = typeof THEME_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ThemeProviderBaseProps, As>;
14
+ export type ThemeProviderRef = ComponentRef<typeof THEME_DEFAULT_TAG>;
14
15
  export declare const ThemeProvider: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ThemeProviderBaseProps, "div">;
@@ -27,6 +27,7 @@ import type { LoaderProps } from '../Loader';
27
27
  import type { MenuProps, MenuItemProps, MenuListProps } from '../Menu';
28
28
  import type { ModalProps } from '../Modal';
29
29
  import type { PaginationProps } from '../Pagination';
30
+ import type { PaperProps } from '../Paper';
30
31
  import type { PopoverProps } from '../Popover';
31
32
  import type { PortalProps } from '../Portal';
32
33
  import type { RadioProps } from '../Radio';
@@ -91,6 +92,7 @@ export type Theme = {
91
92
  MenuList?: Partial<MenuListProps>;
92
93
  Modal?: Partial<ModalProps>;
93
94
  Pagination?: Partial<PaginationProps>;
95
+ Paper?: Partial<PaperProps>;
94
96
  Popover?: Partial<PopoverProps>;
95
97
  Portal?: Partial<PortalProps>;
96
98
  Radio?: Partial<RadioProps>;
@@ -1,33 +1,28 @@
1
1
  /* stylelint-disable */
2
- .Popover.Tooltip {
2
+ .Tooltip {
3
3
  max-inline-size: 300px;
4
- box-shadow: var(--shadow-m);
5
4
  }
6
- .Popover.Tooltip_variant_dark {
7
- background: var(--color-background-main-inverse);
8
- color: var(--color-content-primary-inverse);
9
- }
10
- .Popover.Tooltip_variant_light {
11
- background: var(--color-background-main);
12
- color: var(--color-content-primary);
13
- }
14
- .Popover.Tooltip_size_xs {
15
- padding: 8px 12px;
5
+ .Tooltip_size_xs {
6
+ padding: var(--space-s) var(--space-m);
16
7
 
17
8
  font: var(--typography-text-xs-font);
18
9
 
19
10
  letter-spacing: var(--typography-text-xs-letter_spacing, 0);
20
11
 
21
12
  text-transform: var(--typography-text-xs-text_transform, none);
22
- border-radius: var(--border-radius-s);
23
13
  }
24
- .Popover.Tooltip_size_s {
25
- padding: 12px 16px;
14
+ .Tooltip_size_s {
15
+ padding: var(--space-m) var(--space-l);
26
16
 
27
17
  font: var(--typography-text-s-font);
28
18
 
29
19
  letter-spacing: var(--typography-text-s-letter_spacing, 0);
30
20
 
31
21
  text-transform: var(--typography-text-s-text_transform, none);
32
- border-radius: var(--border-radius-m);
22
+ }
23
+ .Tooltip_variant_light {
24
+ color: var(--color-content-primary);
25
+ }
26
+ .Tooltip_variant_dark {
27
+ color: var(--color-content-primary-inverse);
33
28
  }
@@ -1,13 +1,13 @@
1
1
  import { __assign, __read, __rest } from "tslib";
2
2
  import './Tooltip.css';
3
- import React, { forwardRef, useRef, useMemo, useState, useEffect } from 'react';
3
+ import React, { forwardRef, useRef, useMemo, useState, useEffect, } from 'react';
4
4
  import { useControlled } from '../../hooks/useControlled';
5
5
  import { useDebounceCallback } from '../../hooks/useDebounceCallback';
6
6
  import { useMultiRef } from '../../hooks/useMultiRef';
7
7
  import { useThemeProps } from '../../hooks/useThemeProps';
8
8
  import { cn } from '../../utils/classname';
9
9
  import { Popover } from '../Popover';
10
- import { TOOLTIP_DEFAULT_ARROW, TOOLTIP_DEFAULT_DELAY_ENTER, TOOLTIP_DEFAULT_DELAY_LEAVE, TOOLTIP_DEFAULT_DISABLED, TOOLTIP_DEFAULT_OFFSET, TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN, TOOLTIP_DEFAULT_SIZE, TOOLTIP_DEFAULT_TRIGGER, TOOLTIP_DEFAULT_VARIANT, } from './constants';
10
+ import { TOOLTIP_DEFAULT_ARROW, TOOLTIP_DEFAULT_DELAY_ENTER, TOOLTIP_DEFAULT_DELAY_LEAVE, TOOLTIP_DEFAULT_DISABLED, TOOLTIP_DEFAULT_OFFSET, TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN, TOOLTIP_DEFAULT_SIZE, TOOLTIP_DEFAULT_TAG, TOOLTIP_DEFAULT_TRIGGER, TOOLTIP_DEFAULT_VARIANT, } from './constants';
11
11
  export var cnTooltip = cn('Tooltip');
12
12
  export var Tooltip = forwardRef(function (inProps, ref) {
13
13
  var props = useThemeProps({ props: inProps, name: 'Tooltip' });
@@ -111,8 +111,7 @@ export var Tooltip = forwardRef(function (inProps, ref) {
111
111
  ]);
112
112
  return (React.createElement(React.Fragment, null,
113
113
  React.cloneElement(resolveChildren, composeChildrenProps),
114
- React.createElement(Popover, __assign({ anchorRef: anchorRef }, other, { ref: ref, offset: offset, placement: placement, open: openState && !disabled, onClose: handleClose, className: cnTooltip({ size: size, variant: variant }, [className]), disableInteractive: disableInteractive, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, arrow: arrow, arrowProps: {
115
- variant: variant,
114
+ React.createElement(Popover, __assign({ anchorRef: anchorRef, as: TOOLTIP_DEFAULT_TAG, background: variant === 'light' ? 'main' : 'main-inverse', radius: size }, other, { ref: ref, offset: offset, placement: placement, open: openState && !disabled, onClose: handleClose, className: cnTooltip({ size: size, variant: variant }, [className]), disableInteractive: disableInteractive, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, arrow: arrow, arrowProps: {
116
115
  size: size
117
116
  }, disableEnforceFocus: true, disableReturnFocus: true }), label)));
118
117
  });
@@ -1,3 +1,4 @@
1
+ export declare const TOOLTIP_DEFAULT_TAG: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<import("../Paper").PaperBaseProps, "div">;
1
2
  export declare const TOOLTIP_DEFAULT_TRIGGER = "hover";
2
3
  export declare const TOOLTIP_DEFAULT_SIZE = "s";
3
4
  export declare const TOOLTIP_DEFAULT_VARIANT = "dark";
@@ -1,3 +1,5 @@
1
+ import { Paper } from '../Paper';
2
+ export var TOOLTIP_DEFAULT_TAG = Paper;
1
3
  export var TOOLTIP_DEFAULT_TRIGGER = 'hover';
2
4
  export var TOOLTIP_DEFAULT_SIZE = 's';
3
5
  export var TOOLTIP_DEFAULT_VARIANT = 'dark';
@@ -1,5 +1,6 @@
1
1
  import type { Ref, ReactNode, ReactElement, ComponentPropsWithRef } from 'react';
2
- import type { PopoverProps } from '../Popover';
2
+ import type { PopoverBaseProps } from '../Popover';
3
+ import { TOOLTIP_DEFAULT_TAG } from './constants';
3
4
  export declare const tooltipSizeVariant: readonly ["xs", "s"];
4
5
  export type TooltipSizeVariant = (typeof tooltipSizeVariant)[number];
5
6
  export declare const tooltipVariant: readonly ["light", "dark"];
@@ -39,4 +40,4 @@ export type TooltipProps = {
39
40
  'data-testid'?: string;
40
41
  /** Дополнительные CSS-классы */
41
42
  className?: string;
42
- } & Pick<PopoverProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'> & ComponentPropsWithRef<'div'>;
43
+ } & Pick<PopoverBaseProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'> & ComponentPropsWithRef<typeof TOOLTIP_DEFAULT_TAG>;
@@ -56,33 +56,69 @@
56
56
  .Typography_color_actionDark {
57
57
  color: var(--color-content-action-dark);
58
58
  }
59
+ .Typography_color_actionPressed {
60
+ color: var(--color-content-action-pressed);
61
+ }
59
62
  .Typography_color_actionOn {
60
63
  color: var(--color-content-action-on);
61
64
  }
62
65
  .Typography_color_error {
63
66
  color: var(--color-content-error);
64
67
  }
68
+ .Typography_color_errorHover {
69
+ color: var(--color-content-error-hover);
70
+ }
71
+ .Typography_color_errorPressed {
72
+ color: var(--color-content-error-pressed);
73
+ }
65
74
  .Typography_color_errorDark {
66
75
  color: var(--color-content-error-dark);
67
76
  }
68
77
  .Typography_color_warning {
69
78
  color: var(--color-content-warning);
70
79
  }
80
+ .Typography_color_warningHover {
81
+ color: var(--color-content-warning-hover);
82
+ }
83
+ .Typography_color_warningPressed {
84
+ color: var(--color-content-warning-pressed);
85
+ }
71
86
  .Typography_color_warningDark {
72
87
  color: var(--color-content-warning-dark);
73
88
  }
74
89
  .Typography_color_success {
75
90
  color: var(--color-content-success);
76
91
  }
92
+ .Typography_color_successHover {
93
+ color: var(--color-content-success-hover);
94
+ }
95
+ .Typography_color_successPressed {
96
+ color: var(--color-content-success-pressed);
97
+ }
77
98
  .Typography_color_successDark {
78
99
  color: var(--color-content-success-dark);
79
100
  }
80
101
  .Typography_color_info {
81
102
  color: var(--color-content-info);
82
103
  }
104
+ .Typography_color_infoHover {
105
+ color: var(--color-content-info-hover);
106
+ }
107
+ .Typography_color_infoPressed {
108
+ color: var(--color-content-info-pressed);
109
+ }
83
110
  .Typography_color_infoDark {
84
111
  color: var(--color-content-info-dark);
85
112
  }
113
+ .Typography_color_accentMain {
114
+ color: var(--color-content-accent-main);
115
+ }
116
+ .Typography_color_accentPrimary {
117
+ color: var(--color-content-accent-primary);
118
+ }
119
+ .Typography_color_accentDisabled {
120
+ color: var(--color-content-accent-disabled);
121
+ }
86
122
  .Typography_variant_heading-4xl {
87
123
  font: var(--typography-heading-4xl-font);
88
124
  letter-spacing: var(--typography-heading-4xl-letter_spacing, 0);
@@ -7,7 +7,7 @@ export declare const typographyDisplayVariant: readonly ["block", "inline", "inl
7
7
  export type TypographyDisplayVariant = (typeof typographyDisplayVariant)[number];
8
8
  export declare const typographyAlignVariant: readonly ["left", "center", "right"];
9
9
  export type TypographyAlignVariant = (typeof typographyAlignVariant)[number];
10
- export declare const typographyColorVariant: readonly ["primary", "secondary", "tertiary", "disabled", "ghostDisabled", "action", "actionHover", "actionDark", "actionOn", "error", "errorDark", "warning", "warningDark", "success", "successDark", "info", "infoDark", "primaryInverse"];
10
+ export declare const typographyColorVariant: readonly ["primary", "secondary", "tertiary", "disabled", "ghostDisabled", "action", "actionPressed", "actionHover", "actionDark", "actionOn", "error", "errorHover", "errorPressed", "errorDark", "warning", "warningHover", "warningPressed", "warningDark", "success", "successHover", "successDark", "successPressed", "info", "infoHover", "infoPressed", "infoDark", "primaryInverse", "accentMain", "accentPrimary", "accentDisabled"];
11
11
  export type TypographyColorVariant = (typeof typographyColorVariant)[number];
12
12
  export type TypographyBaseProps = {
13
13
  /** Вариант типографики */
@@ -47,18 +47,30 @@ export var typographyColorVariant = [
47
47
  'disabled',
48
48
  'ghostDisabled',
49
49
  'action',
50
+ 'actionPressed',
50
51
  'actionHover',
51
52
  'actionDark',
52
53
  'actionOn',
53
54
  'error',
55
+ 'errorHover',
56
+ 'errorPressed',
54
57
  'errorDark',
55
58
  'warning',
59
+ 'warningHover',
60
+ 'warningPressed',
56
61
  'warningDark',
57
62
  'success',
63
+ 'successHover',
58
64
  'successDark',
65
+ 'successPressed',
59
66
  'info',
67
+ 'infoHover',
68
+ 'infoPressed',
60
69
  'infoDark',
61
70
  'primaryInverse',
71
+ 'accentMain',
72
+ 'accentPrimary',
73
+ 'accentDisabled',
62
74
  ];
63
75
  export var cnTypography = cn('Typography');
64
76
  export var Typography = polymorphicComponentWithRef(function (inProps, ref) {
@@ -0,0 +1 @@
1
+ export * from './useLockBodyScroll';
@@ -0,0 +1 @@
1
+ export * from './useLockBodyScroll';
@@ -0,0 +1 @@
1
+ export declare function useLockBodyScroll(active?: boolean): void;
@@ -0,0 +1,14 @@
1
+ import { useIsomorphicEffect } from '../useIsomorphicEffect';
2
+ export function useLockBodyScroll(active) {
3
+ if (active === void 0) { active = false; }
4
+ useIsomorphicEffect(function () {
5
+ if (!active) {
6
+ return undefined;
7
+ }
8
+ var originalStyle = window.getComputedStyle(document.body).overflow;
9
+ document.body.style.overflow = 'hidden';
10
+ return function () {
11
+ document.body.style.overflow = originalStyle;
12
+ };
13
+ }, [active]);
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozen-ui/kit",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "React component library",
5
5
  "files": [
6
6
  "*"
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/hooks/useLockBodyScroll/index.js",
3
+ "module": "../__inner__/esm/hooks/useLockBodyScroll/index.js",
4
+ "types": "../__inner__/esm/hooks/useLockBodyScroll/index.d.ts"
5
+ }