indicator-ui 0.1.37 → 0.1.38

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.
@@ -1,10 +1,11 @@
1
1
  import { RefObject } from "react";
2
+ import { SmartRefType } from "../../hooks";
2
3
  import { useBackgroundModalAnim } from "../ui-animations";
3
4
  type UseBackgroundModalAnimOptionsPropsType = Exclude<Parameters<typeof useBackgroundModalAnim>['1'], undefined>;
4
5
  type OptionsType<C extends HTMLElement = HTMLElement> = UseBackgroundModalAnimOptionsPropsType & {
5
6
  containerClickAreaRef?: RefObject<C | null>;
6
7
  };
7
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: RefObject<T | null>, options?: OptionsType];
8
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
8
9
  /**
9
10
  * Хук для backdrop-модального окна.
10
11
  *
@@ -1,10 +1,10 @@
1
- import { RefObject } from "react";
1
+ import { SmartRefType } from "../../hooks";
2
2
  import { useInteractiveZone } from "../useInteractiveZone";
3
3
  import { useModalAnim } from "../ui-animations";
4
4
  type UseModalAnimOptionsPropsType = Exclude<Parameters<typeof useModalAnim>['1'], undefined>;
5
5
  type UseInteractiveZoneOptionsPropsType = Exclude<Parameters<typeof useInteractiveZone>['2'], undefined>;
6
6
  type OptionsType = Pick<UseInteractiveZoneOptionsPropsType, 'addition'> & UseModalAnimOptionsPropsType;
7
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: RefObject<T | null>, options?: OptionsType];
7
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
8
8
  /**
9
9
  * Хук для модального окна.
10
10
  *
@@ -1,12 +1,13 @@
1
- import { CSSProperties, RefObject } from "react";
1
+ import { CSSProperties } from "react";
2
2
  import { calculateAvailablePosition } from "./calculateAvailablePosition";
3
+ import { SmartRefType } from "../../hooks";
3
4
  type CalculateAvailablePositionPropsType = Parameters<typeof calculateAvailablePosition>['0'];
4
5
  type NewPlacementPosType = ReturnType<typeof calculateAvailablePosition>;
5
6
  type PropsType = [
6
- ref: RefObject<HTMLElement | null>,
7
+ ref: SmartRefType<HTMLElement>,
7
8
  options?: Omit<CalculateAvailablePositionPropsType, 'objRect' | 'parentRect' | 'windowRect'> & {
8
- parentRef?: RefObject<HTMLElement | null>;
9
- windowRef?: RefObject<HTMLElement | null>;
9
+ parentRef?: SmartRefType<HTMLElement>;
10
+ windowRef?: SmartRefType<HTMLElement>;
10
11
  }
11
12
  ];
12
13
  type FunReturnType = {
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from "react";
2
- type SmartRefType<T extends HTMLElement> = RefObject<T | null> | T | null | undefined;
2
+ export type SmartRefType<T extends HTMLElement> = RefObject<T | null> | T | null | undefined;
3
3
  type SimpleRefElementWorkPropsType<T extends HTMLElement> = [
4
4
  ref?: SmartRefType<T>
5
5
  ];
@@ -8,7 +8,7 @@ type SimpleRefElementWorkFunReturnType<T extends HTMLElement> = [
8
8
  _getObj: (item: SmartRefType<T>) => T | null
9
9
  ];
10
10
  export declare function useSimpleRefElementWork<T extends HTMLElement = HTMLElement>(...args: SimpleRefElementWorkPropsType<T>): SimpleRefElementWorkFunReturnType<T>;
11
- type SmartRefListType<T extends HTMLElement> = SmartRefType<T> | Array<SmartRefType<T>>;
11
+ export type SmartRefListType<T extends HTMLElement> = SmartRefType<T> | Array<SmartRefType<T>>;
12
12
  type SimpleRefListElementWorkPropsType<T extends HTMLElement> = [
13
13
  ref?: SmartRefListType<T>
14
14
  ];
@@ -1,7 +1,8 @@
1
- import { CSSProperties, RefObject } from "react";
1
+ import { CSSProperties } from "react";
2
2
  import { BACKDROP_MODAL_ANIMATIONS } from "./assets";
3
+ import { SmartRefType } from "../../hooks";
3
4
  type OptionsType<T extends HTMLElement = HTMLElement> = {
4
- targetRef?: RefObject<T | null>;
5
+ targetRef?: SmartRefType<T>;
5
6
  onViewing?: () => void;
6
7
  onHiding?: () => void;
7
8
  backdropClassName?: string;
@@ -12,7 +13,7 @@ type OptionsType<T extends HTMLElement = HTMLElement> = {
12
13
  };
13
14
  backdropColor?: string;
14
15
  };
15
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: RefObject<T | null>, options?: OptionsType];
16
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
16
17
  type AnimationsTypes = keyof ReturnType<typeof BACKDROP_MODAL_ANIMATIONS>;
17
18
  /**
18
19
  * Хук для анимации backdrop-модального окна.
@@ -1,9 +1,10 @@
1
- import { CSSProperties, RefObject } from "react";
1
+ import { CSSProperties } from "react";
2
2
  import { useSmartPlacementResolver } from "../placement/useSmartPlacementResolver";
3
3
  import { MODAL_ANIMATIONS } from "./assets";
4
+ import { SmartRefType } from "../../hooks";
4
5
  type UseSmartPlacementResolverOptionsType = Exclude<Parameters<typeof useSmartPlacementResolver>['1'], undefined>;
5
6
  type OptionsType<T extends HTMLElement = HTMLElement> = Pick<UseSmartPlacementResolverOptionsType, 'position'> & {
6
- targetRef?: RefObject<T | null>;
7
+ targetRef?: SmartRefType<T>;
7
8
  onViewing?: () => void;
8
9
  onHiding?: () => void;
9
10
  smartPlacementOptions?: Omit<UseSmartPlacementResolverOptionsType, 'position'>;
@@ -16,7 +17,7 @@ type OptionsType<T extends HTMLElement = HTMLElement> = Pick<UseSmartPlacementRe
16
17
  };
17
18
  backdropColor?: string;
18
19
  };
19
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: RefObject<T | null>, options?: OptionsType];
20
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
20
21
  type AnimationsTypes = keyof ReturnType<typeof MODAL_ANIMATIONS>;
21
22
  /**
22
23
  * Хук для анимации модального окна.
@@ -1,6 +1,6 @@
1
- import React from "react";
2
- type PropsType<T> = [
3
- ref: React.RefObject<T | null>,
1
+ import { SmartRefType, SmartRefListType } from "../hooks";
2
+ type PropsType<T extends HTMLElement> = [
3
+ ref: SmartRefType<T>,
4
4
  callbacks?: {
5
5
  onMissClick?: () => void;
6
6
  onInnerClick?: () => void;
@@ -9,7 +9,7 @@ type PropsType<T> = [
9
9
  /** Дополнительные элементы для реагирования как и с `ref` */
10
10
  addition?: Array<HTMLElement | null>;
11
11
  /** Элементы, которые будут игнорироваться */
12
- ignore?: Array<HTMLElement | null>;
12
+ ignore?: SmartRefListType<HTMLElement>;
13
13
  }
14
14
  ];
15
15
  /**
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from "react";
1
2
  export type MediaViewerVideoType = {
2
3
  type: 'video';
3
4
  src: string;
@@ -16,4 +17,5 @@ export type MediaViewerPropsType = {
16
17
  * Не показывает элементы, которые находятся не рядом с текущим (curIndex +- 1).
17
18
  * */
18
19
  nearestElementsOnly?: boolean;
20
+ style?: CSSProperties;
19
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indicator-ui",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/src/index.d.ts",
6
6
  "style": "dist/index.css",