@ozen-ui/kit 0.9.1 → 0.9.2
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/Skeleton/index.d.ts +3 -0
- package/__inner__/cjs/components/Skeleton/index.js +7 -0
- package/__inner__/cjs/components/Tooltip/Tooltip.d.ts +2 -3
- package/__inner__/cjs/components/Tooltip/Tooltip.js +2 -1
- package/__inner__/cjs/components/Tooltip/types.d.ts +6 -3
- package/__inner__/cjs/utils/polymorphicComponentWithRef.d.ts +3 -3
- package/__inner__/esm/components/Skeleton/index.d.ts +3 -0
- package/__inner__/esm/components/Skeleton/index.js +3 -0
- package/__inner__/esm/components/Tooltip/Tooltip.d.ts +2 -3
- package/__inner__/esm/components/Tooltip/Tooltip.js +3 -2
- package/__inner__/esm/components/Tooltip/types.d.ts +6 -3
- package/__inner__/esm/utils/polymorphicComponentWithRef.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
+
exports.cnSkeletonTypography = exports.cnSkeleton = exports.cnSkeletonCircular = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
tslib_1.__exportStar(require("./Skeleton"), exports);
|
|
6
|
+
var SkeletonCircular_1 = require("./SkeletonCircular");
|
|
7
|
+
tslib_1.__createBinding(exports, SkeletonCircular_1, "cnSkeletonCircular");
|
|
8
|
+
var SkeletonRectangular_1 = require("./SkeletonRectangular");
|
|
9
|
+
tslib_1.__createBinding(exports, SkeletonRectangular_1, "cnSkeleton");
|
|
10
|
+
var SkeletonTypography_1 = require("./SkeletonTypography");
|
|
11
|
+
tslib_1.__createBinding(exports, SkeletonTypography_1, "cnSkeletonTypography");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './Tooltip.css';
|
|
2
|
-
import
|
|
3
|
-
import type { TooltipProps } from './types';
|
|
2
|
+
import type { TooltipBaseProps } from './types';
|
|
4
3
|
export declare const cnTooltip: import("@bem-react/classname").ClassNameFormatter;
|
|
5
|
-
export declare const Tooltip:
|
|
4
|
+
export declare const Tooltip: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<TooltipBaseProps, "div">;
|
|
@@ -9,10 +9,11 @@ var useDebounceCallback_1 = require("../../hooks/useDebounceCallback");
|
|
|
9
9
|
var useMultiRef_1 = require("../../hooks/useMultiRef");
|
|
10
10
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
11
11
|
var classname_1 = require("../../utils/classname");
|
|
12
|
+
var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
|
|
12
13
|
var Popover_1 = require("../Popover");
|
|
13
14
|
var constants_1 = require("./constants");
|
|
14
15
|
exports.cnTooltip = (0, classname_1.cn)('Tooltip');
|
|
15
|
-
exports.Tooltip = (0,
|
|
16
|
+
exports.Tooltip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
16
17
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Tooltip' });
|
|
17
18
|
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.variant, variant = _c === void 0 ? constants_1.TOOLTIP_DEFAULT_VARIANT : _c, _d = props.offset, offset = _d === void 0 ? constants_1.TOOLTIP_DEFAULT_OFFSET : _d, _e = props.delayEnter, delayEnter = _e === void 0 ? constants_1.TOOLTIP_DEFAULT_DELAY_ENTER : _e, _f = props.delayLeave, delayLeave = _f === void 0 ? constants_1.TOOLTIP_DEFAULT_DELAY_LEAVE : _f, _g = props.arrow, arrow = _g === void 0 ? constants_1.TOOLTIP_DEFAULT_ARROW : _g, _h = props.shouldWrapChildren, shouldWrapChildren = _h === void 0 ? constants_1.TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN : _h, _j = props.disabled, disabled = _j === void 0 ? constants_1.TOOLTIP_DEFAULT_DISABLED : _j, 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 = tslib_1.__rest(props, ["trigger", "size", "variant", "offset", "delayEnter", "delayLeave", "arrow", "shouldWrapChildren", "disabled", "children", "label", "open", "placement", "disableInteractive", "className", "onOpen", "onClose"]);
|
|
18
19
|
var _k = tslib_1.__read((0, react_1.useState)(), 2), delay = _k[0], setDelay = _k[1];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Ref, ReactNode, ReactElement,
|
|
1
|
+
import type { Ref, ReactNode, ReactElement, ComponentRef, ElementType } from 'react';
|
|
2
|
+
import type { PolymorphicComponentPropsWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
2
3
|
import type { PopoverBaseProps } from '../Popover';
|
|
3
4
|
import type { TOOLTIP_DEFAULT_TAG } from './constants';
|
|
4
5
|
export declare const tooltipSizeVariant: readonly ["xs", "s"];
|
|
@@ -7,7 +8,7 @@ export declare const tooltipVariant: readonly ["light", "dark"];
|
|
|
7
8
|
export type TooltipVariant = (typeof tooltipVariant)[number];
|
|
8
9
|
export declare const tooltipTriggerVariant: readonly ["hover", "focus", "click", "hover&focus"];
|
|
9
10
|
export type TooltipTriggerVariant = (typeof tooltipTriggerVariant)[number];
|
|
10
|
-
export type
|
|
11
|
+
export type TooltipBaseProps = {
|
|
11
12
|
/** Признак по которому тултип будет представлен */
|
|
12
13
|
open?: boolean;
|
|
13
14
|
/** Элемент представляющий тултип, здесь может быть иконка, ссылка, кнопка и т.д. */
|
|
@@ -40,4 +41,6 @@ export type TooltipProps = {
|
|
|
40
41
|
'data-testid'?: string;
|
|
41
42
|
/** Дополнительные CSS-классы */
|
|
42
43
|
className?: string;
|
|
43
|
-
} & Pick<PopoverBaseProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'
|
|
44
|
+
} & Pick<PopoverBaseProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'>;
|
|
45
|
+
export type TooltipRef = ComponentRef<typeof TOOLTIP_DEFAULT_TAG>;
|
|
46
|
+
export type TooltipProps<As extends ElementType = typeof TOOLTIP_DEFAULT_TAG> = PolymorphicComponentPropsWithRef<TooltipBaseProps, As>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType, ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
2
2
|
declare const defaultElement = "div";
|
|
3
3
|
export type PolymorphicComponentPropsWithRef<Props, As extends ElementType> = Props & {
|
|
4
4
|
as?: As;
|
|
@@ -7,10 +7,10 @@ export type PolymorphicComponentPropsWithoutRef<Props, As extends ElementType> =
|
|
|
7
7
|
as?: As;
|
|
8
8
|
} & Omit<ComponentPropsWithoutRef<As>, keyof Props>;
|
|
9
9
|
export type PolymorphicComponentRef<As extends ElementType> = ComponentPropsWithRef<As>['ref'];
|
|
10
|
-
type ComponentWithAs<Props, DefaultTag extends ElementType = typeof defaultElement> = <As extends ElementType = DefaultTag>(props: PolymorphicComponentPropsWithRef<Props, As>) =>
|
|
10
|
+
type ComponentWithAs<Props, DefaultTag extends ElementType = typeof defaultElement> = <As extends ElementType = DefaultTag>(props: PolymorphicComponentPropsWithRef<Props, As>) => ReactElement | null;
|
|
11
11
|
export type PolymorphicComponentWithRef<Props, As extends ElementType> = ComponentWithAs<Props, As> & {
|
|
12
12
|
displayName?: string | undefined;
|
|
13
13
|
};
|
|
14
|
-
type ForwardRefWithAs<Props> = <As extends ElementType>(props: PolymorphicComponentPropsWithRef<Props, As>, ref: PolymorphicComponentRef<As>) =>
|
|
14
|
+
type ForwardRefWithAs<Props> = <As extends ElementType>(props: PolymorphicComponentPropsWithRef<Props, As>, ref: PolymorphicComponentRef<As>) => ReactElement | null;
|
|
15
15
|
export declare function polymorphicComponentWithRef<Props, As extends ElementType = typeof defaultElement>(baseComponent: ForwardRefWithAs<Props>): PolymorphicComponentWithRef<Props, As>;
|
|
16
16
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './Tooltip.css';
|
|
2
|
-
import
|
|
3
|
-
import type { TooltipProps } from './types';
|
|
2
|
+
import type { TooltipBaseProps } from './types';
|
|
4
3
|
export declare const cnTooltip: import("@bem-react/classname").ClassNameFormatter;
|
|
5
|
-
export declare const Tooltip:
|
|
4
|
+
export declare const Tooltip: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<TooltipBaseProps, "div">;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import './Tooltip.css';
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { 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
|
+
import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
9
10
|
import { Popover } from '../Popover';
|
|
10
11
|
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
12
|
export var cnTooltip = cn('Tooltip');
|
|
12
|
-
export var Tooltip =
|
|
13
|
+
export var Tooltip = polymorphicComponentWithRef(function (inProps, ref) {
|
|
13
14
|
var props = useThemeProps({ props: inProps, name: 'Tooltip' });
|
|
14
15
|
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.variant, variant = _c === void 0 ? TOOLTIP_DEFAULT_VARIANT : _c, _d = props.offset, offset = _d === void 0 ? TOOLTIP_DEFAULT_OFFSET : _d, _e = props.delayEnter, delayEnter = _e === void 0 ? TOOLTIP_DEFAULT_DELAY_ENTER : _e, _f = props.delayLeave, delayLeave = _f === void 0 ? TOOLTIP_DEFAULT_DELAY_LEAVE : _f, _g = props.arrow, arrow = _g === void 0 ? TOOLTIP_DEFAULT_ARROW : _g, _h = props.shouldWrapChildren, shouldWrapChildren = _h === void 0 ? TOOLTIP_DEFAULT_SHOULD_WRAP_CHILDREN : _h, _j = props.disabled, disabled = _j === void 0 ? TOOLTIP_DEFAULT_DISABLED : _j, 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", "variant", "offset", "delayEnter", "delayLeave", "arrow", "shouldWrapChildren", "disabled", "children", "label", "open", "placement", "disableInteractive", "className", "onOpen", "onClose"]);
|
|
15
16
|
var _k = __read(useState(), 2), delay = _k[0], setDelay = _k[1];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Ref, ReactNode, ReactElement,
|
|
1
|
+
import type { Ref, ReactNode, ReactElement, ComponentRef, ElementType } from 'react';
|
|
2
|
+
import type { PolymorphicComponentPropsWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
2
3
|
import type { PopoverBaseProps } from '../Popover';
|
|
3
4
|
import type { TOOLTIP_DEFAULT_TAG } from './constants';
|
|
4
5
|
export declare const tooltipSizeVariant: readonly ["xs", "s"];
|
|
@@ -7,7 +8,7 @@ export declare const tooltipVariant: readonly ["light", "dark"];
|
|
|
7
8
|
export type TooltipVariant = (typeof tooltipVariant)[number];
|
|
8
9
|
export declare const tooltipTriggerVariant: readonly ["hover", "focus", "click", "hover&focus"];
|
|
9
10
|
export type TooltipTriggerVariant = (typeof tooltipTriggerVariant)[number];
|
|
10
|
-
export type
|
|
11
|
+
export type TooltipBaseProps = {
|
|
11
12
|
/** Признак по которому тултип будет представлен */
|
|
12
13
|
open?: boolean;
|
|
13
14
|
/** Элемент представляющий тултип, здесь может быть иконка, ссылка, кнопка и т.д. */
|
|
@@ -40,4 +41,6 @@ export type TooltipProps = {
|
|
|
40
41
|
'data-testid'?: string;
|
|
41
42
|
/** Дополнительные CSS-классы */
|
|
42
43
|
className?: string;
|
|
43
|
-
} & Pick<PopoverBaseProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'
|
|
44
|
+
} & Pick<PopoverBaseProps, 'offset' | 'placement' | 'arrow' | 'anchorRef' | 'ignoreClickOutsideRefs' | 'disableInteractive' | 'onEnter' | 'onEntered' | 'onExit' | 'onExited' | 'setUpdate'>;
|
|
45
|
+
export type TooltipRef = ComponentRef<typeof TOOLTIP_DEFAULT_TAG>;
|
|
46
|
+
export type TooltipProps<As extends ElementType = typeof TOOLTIP_DEFAULT_TAG> = PolymorphicComponentPropsWithRef<TooltipBaseProps, As>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType, ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
2
2
|
declare const defaultElement = "div";
|
|
3
3
|
export type PolymorphicComponentPropsWithRef<Props, As extends ElementType> = Props & {
|
|
4
4
|
as?: As;
|
|
@@ -7,10 +7,10 @@ export type PolymorphicComponentPropsWithoutRef<Props, As extends ElementType> =
|
|
|
7
7
|
as?: As;
|
|
8
8
|
} & Omit<ComponentPropsWithoutRef<As>, keyof Props>;
|
|
9
9
|
export type PolymorphicComponentRef<As extends ElementType> = ComponentPropsWithRef<As>['ref'];
|
|
10
|
-
type ComponentWithAs<Props, DefaultTag extends ElementType = typeof defaultElement> = <As extends ElementType = DefaultTag>(props: PolymorphicComponentPropsWithRef<Props, As>) =>
|
|
10
|
+
type ComponentWithAs<Props, DefaultTag extends ElementType = typeof defaultElement> = <As extends ElementType = DefaultTag>(props: PolymorphicComponentPropsWithRef<Props, As>) => ReactElement | null;
|
|
11
11
|
export type PolymorphicComponentWithRef<Props, As extends ElementType> = ComponentWithAs<Props, As> & {
|
|
12
12
|
displayName?: string | undefined;
|
|
13
13
|
};
|
|
14
|
-
type ForwardRefWithAs<Props> = <As extends ElementType>(props: PolymorphicComponentPropsWithRef<Props, As>, ref: PolymorphicComponentRef<As>) =>
|
|
14
|
+
type ForwardRefWithAs<Props> = <As extends ElementType>(props: PolymorphicComponentPropsWithRef<Props, As>, ref: PolymorphicComponentRef<As>) => ReactElement | null;
|
|
15
15
|
export declare function polymorphicComponentWithRef<Props, As extends ElementType = typeof defaultElement>(baseComponent: ForwardRefWithAs<Props>): PolymorphicComponentWithRef<Props, As>;
|
|
16
16
|
export {};
|