@ozen-ui/kit 0.9.0 → 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.
@@ -4,6 +4,7 @@ exports.FieldInput = exports.cnFieldInput = exports.FIELD_INPUT_DEFAULT_TAG = vo
4
4
  var tslib_1 = require("tslib");
5
5
  var react_1 = tslib_1.__importStar(require("react"));
6
6
  var useControlled_1 = require("../../hooks/useControlled");
7
+ var useIsomorphicEffect_1 = require("../../hooks/useIsomorphicEffect");
7
8
  var classname_1 = require("../../utils/classname");
8
9
  var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
9
10
  var FieldControl_1 = require("../FieldControl");
@@ -31,7 +32,7 @@ exports.FieldInput = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
31
32
  disabled = fieldControl.disabled;
32
33
  }
33
34
  }
34
- (0, react_1.useEffect)(function () {
35
+ (0, useIsomorphicEffect_1.useIsomorphicEffect)(function () {
35
36
  setFieldControl(function (prevState) { return (tslib_1.__assign(tslib_1.__assign({}, prevState), { filled: filled, focused: focused, value: valueState })); });
36
37
  }, [filled, focused, valueState]);
37
38
  var handleChange = (0, react_1.useCallback)(function (e) {
@@ -4,6 +4,7 @@ exports.FieldLabel = exports.cnFieldLabel = exports.FIELD_LABEL_DEFAULT_TAG = vo
4
4
  var tslib_1 = require("tslib");
5
5
  require("./FieldLabel.css");
6
6
  var react_1 = tslib_1.__importStar(require("react"));
7
+ var useIsomorphicEffect_1 = require("../../hooks/useIsomorphicEffect");
7
8
  var classname_1 = require("../../utils/classname");
8
9
  var FieldControl_1 = require("../FieldControl");
9
10
  exports.FIELD_LABEL_DEFAULT_TAG = 'span';
@@ -18,7 +19,7 @@ exports.FieldLabel = (0, react_1.forwardRef)(function (_a, ref) {
18
19
  var disabled = disabledProp;
19
20
  var focused = focusedProp;
20
21
  var filled = filledProp;
21
- (0, react_1.useEffect)(function () {
22
+ (0, useIsomorphicEffect_1.useIsomorphicEffect)(function () {
22
23
  setFieldControl(function (prevState) { return (tslib_1.__assign(tslib_1.__assign({}, prevState), { label: children })); });
23
24
  }, [children]);
24
25
  if (!children) {
@@ -43,6 +43,7 @@
43
43
  color: var(--textfield-color);
44
44
  box-sizing: border-box;
45
45
  block-size: var(--textfield-input-height);
46
+ font: inherit;
46
47
  }
47
48
  .InputNumber-Field::placeholder {
48
49
  opacity: 1;
@@ -1 +1,4 @@
1
1
  export * from './Skeleton';
2
+ export { cnSkeletonCircular } from './SkeletonCircular';
3
+ export { cnSkeleton } from './SkeletonRectangular';
4
+ export { cnSkeletonTypography } from './SkeletonTypography';
@@ -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 React from 'react';
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: React.ForwardRefExoticComponent<Omit<TooltipProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
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, react_1.forwardRef)(function (inProps, ref) {
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, ComponentPropsWithRef } from 'react';
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 TooltipProps = {
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'> & ComponentPropsWithRef<typeof TOOLTIP_DEFAULT_TAG>;
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>) => React.ReactElement | null;
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>) => React.ReactElement | null;
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,6 +1,7 @@
1
1
  import { __assign, __read, __rest } from "tslib";
2
- import React, { useCallback, useContext, useState, useEffect } from 'react';
2
+ import React, { useCallback, useContext, useState } from 'react';
3
3
  import { useControlled } from '../../hooks/useControlled';
4
+ import { useIsomorphicEffect } from '../../hooks/useIsomorphicEffect';
4
5
  import { cn } from '../../utils/classname';
5
6
  import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
6
7
  import { FieldControlContext } from '../FieldControl';
@@ -28,7 +29,7 @@ export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
28
29
  disabled = fieldControl.disabled;
29
30
  }
30
31
  }
31
- useEffect(function () {
32
+ useIsomorphicEffect(function () {
32
33
  setFieldControl(function (prevState) { return (__assign(__assign({}, prevState), { filled: filled, focused: focused, value: valueState })); });
33
34
  }, [filled, focused, valueState]);
34
35
  var handleChange = useCallback(function (e) {
@@ -1,6 +1,7 @@
1
1
  import { __assign, __read } from "tslib";
2
2
  import './FieldLabel.css';
3
- import React, { forwardRef, useContext, useEffect } from 'react';
3
+ import React, { forwardRef, useContext } from 'react';
4
+ import { useIsomorphicEffect } from '../../hooks/useIsomorphicEffect';
4
5
  import { cn } from '../../utils/classname';
5
6
  import { FieldControlContext } from '../FieldControl';
6
7
  export var FIELD_LABEL_DEFAULT_TAG = 'span';
@@ -15,7 +16,7 @@ export var FieldLabel = forwardRef(function (_a, ref) {
15
16
  var disabled = disabledProp;
16
17
  var focused = focusedProp;
17
18
  var filled = filledProp;
18
- useEffect(function () {
19
+ useIsomorphicEffect(function () {
19
20
  setFieldControl(function (prevState) { return (__assign(__assign({}, prevState), { label: children })); });
20
21
  }, [children]);
21
22
  if (!children) {
@@ -43,6 +43,7 @@
43
43
  color: var(--textfield-color);
44
44
  box-sizing: border-box;
45
45
  block-size: var(--textfield-input-height);
46
+ font: inherit;
46
47
  }
47
48
  .InputNumber-Field::placeholder {
48
49
  opacity: 1;
@@ -1 +1,4 @@
1
1
  export * from './Skeleton';
2
+ export { cnSkeletonCircular } from './SkeletonCircular';
3
+ export { cnSkeleton } from './SkeletonRectangular';
4
+ export { cnSkeletonTypography } from './SkeletonTypography';
@@ -1 +1,4 @@
1
1
  export * from './Skeleton';
2
+ export { cnSkeletonCircular } from './SkeletonCircular';
3
+ export { cnSkeleton } from './SkeletonRectangular';
4
+ export { cnSkeletonTypography } from './SkeletonTypography';
@@ -1,5 +1,4 @@
1
1
  import './Tooltip.css';
2
- import React from 'react';
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: React.ForwardRefExoticComponent<Omit<TooltipProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
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, { forwardRef, useRef, useMemo, useState, useEffect } from '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 = forwardRef(function (inProps, ref) {
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, ComponentPropsWithRef } from 'react';
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 TooltipProps = {
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'> & ComponentPropsWithRef<typeof TOOLTIP_DEFAULT_TAG>;
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>) => React.ReactElement | null;
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>) => React.ReactElement | null;
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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozen-ui/kit",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "React component library",
5
5
  "files": [
6
6
  "*"