indicator-ui 1.0.6 → 1.0.8

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 (47) hide show
  1. package/dist/index.cjs +19 -19
  2. package/dist/index.js +13668 -13440
  3. package/dist/indicator-ui.css +1 -1
  4. package/dist/types/src/hooks/controlsInput/useDrag.d.ts +2 -2
  5. package/dist/types/src/hooks/elementObservers/index.d.ts +1 -0
  6. package/dist/types/src/hooks/elementObservers/useIntersectionObserver.d.ts +2 -2
  7. package/dist/types/src/hooks/elementObservers/useResizeObserver.d.ts +2 -3
  8. package/dist/types/src/hooks/elementObservers/useScrollableParent.d.ts +12 -0
  9. package/dist/types/src/hooks/index.d.ts +2 -1
  10. package/dist/types/src/hooks/modalWindows/useBackdropModal.d.ts +2 -2
  11. package/dist/types/src/hooks/modalWindows/useModal.d.ts +2 -2
  12. package/dist/types/src/hooks/placement/useSmartPlacementResolver.d.ts +4 -4
  13. package/dist/types/src/hooks/simpleElement.d.ts +20 -0
  14. package/dist/types/src/hooks/ui-animations/assets/collapsibleAnimations.d.ts +10 -3
  15. package/dist/types/src/hooks/ui-animations/useBackgroundModalAnim.d.ts +3 -3
  16. package/dist/types/src/hooks/ui-animations/useCarousel.d.ts +3 -3
  17. package/dist/types/src/hooks/ui-animations/useCollapsible.d.ts +57 -10
  18. package/dist/types/src/hooks/ui-animations/useHoverAutoScrollText.d.ts +2 -2
  19. package/dist/types/src/hooks/ui-animations/useModalAnim.d.ts +3 -3
  20. package/dist/types/src/hooks/useInteractiveZone.d.ts +2 -2
  21. package/dist/types/src/hooks/useScroll.d.ts +10 -0
  22. package/dist/types/src/lib/dict/index.d.ts +0 -1
  23. package/dist/types/src/lib/html/getScrollableParent.d.ts +14 -0
  24. package/dist/types/src/lib/html/index.d.ts +2 -0
  25. package/dist/types/src/lib/html/isScrallableElement.d.ts +10 -0
  26. package/dist/types/src/lib/index.d.ts +2 -1
  27. package/dist/types/src/lib/reactComponents/index.d.ts +1 -3
  28. package/dist/types/src/lib/reactComponents/isCustomComponent.d.ts +1 -1
  29. package/dist/types/src/lib/searchParams/toUrlSearchParams.d.ts +1 -0
  30. package/dist/types/src/lib/time/saveFormatDate.d.ts +3 -0
  31. package/dist/types/src/lib/time/saveParseDate.d.ts +1 -0
  32. package/dist/types/src/lib/time/startOfDayUTC.d.ts +1 -0
  33. package/dist/types/src/types/mixins.d.ts +3 -0
  34. package/dist/types/src/ui/Collapse/hooks/index.d.ts +1 -0
  35. package/dist/types/src/ui/Collapse/hooks/useCollapse.d.ts +16 -0
  36. package/dist/types/src/ui/Collapse/index.d.ts +1 -0
  37. package/dist/types/src/ui/Collapse/ui/Collapse.d.ts +58 -0
  38. package/dist/types/src/ui/Collapse/ui/index.d.ts +1 -0
  39. package/dist/types/src/ui/DropdownV2/animations/check.d.ts +10 -0
  40. package/dist/types/src/ui/DropdownV2/animations/index.d.ts +1 -0
  41. package/dist/types/src/ui/index.d.ts +1 -0
  42. package/package.json +1 -1
  43. package/dist/types/src/hooks/simpleRefWork.d.ts +0 -20
  44. package/dist/types/src/lib/dict/isDict.d.ts +0 -1
  45. package/dist/types/src/lib/reactComponents/getCenterElementAttribute.d.ts +0 -6
  46. package/dist/types/src/lib/reactComponents/handleScrollEnd.d.ts +0 -2
  47. /package/dist/types/src/lib/{tsCheck → tsAsserts}/index.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { useSimpleRefElementWork } from '..';
1
+ import { useSimpleElement } from '..';
2
2
  type DragStateType = {
3
3
  fromX: number;
4
4
  fromY: number;
@@ -7,7 +7,7 @@ type DragStateType = {
7
7
  status: 'start' | 'moving' | 'end';
8
8
  };
9
9
  type PropsType = [
10
- ref: Parameters<typeof useSimpleRefElementWork>[number],
10
+ ref: Parameters<typeof useSimpleElement>[number],
11
11
  callback: (data: DragStateType) => void,
12
12
  options?: {
13
13
  dropDraggingOnLeave?: boolean;
@@ -1,3 +1,4 @@
1
1
  export * from './useResizeObserver';
2
2
  export * from './useIntersectionObserver';
3
3
  export * from './useResizeWindowObserver';
4
+ export * from './useScrollableParent';
@@ -1,5 +1,5 @@
1
- import { useSimpleRefListElementWork } from '..';
2
- type UseSimpleRefListElementWorkPropsType<T extends HTMLElement> = Parameters<typeof useSimpleRefListElementWork<T>>['0'];
1
+ import { useSimpleElementsList } from '..';
2
+ type UseSimpleRefListElementWorkPropsType<T extends HTMLElement> = Parameters<typeof useSimpleElementsList<T>>['0'];
3
3
  type PropsType<T extends HTMLElement> = [
4
4
  ref: UseSimpleRefListElementWorkPropsType<T>,
5
5
  callback: IntersectionObserverCallback,
@@ -1,7 +1,6 @@
1
- import { useSimpleRefListElementWork } from '..';
2
- type UseSimpleRefListElementWorkPropsType<T extends HTMLElement> = Parameters<typeof useSimpleRefListElementWork<T>>['0'];
1
+ import { SimpleElementType } from '..';
3
2
  type PropsType<T extends HTMLElement> = [
4
- ref: UseSimpleRefListElementWorkPropsType<T>,
3
+ ref: SimpleElementType<T>[] | SimpleElementType<T>,
5
4
  callback: ResizeObserverCallback
6
5
  ];
7
6
  type FunReturnType = {
@@ -0,0 +1,12 @@
1
+ import { SimpleElementType, useResizeObserver, useScroll } from '..';
2
+ type ScrollCallback = Exclude<Parameters<typeof useScroll>[1], undefined>;
3
+ type ResizeCallback = Exclude<Parameters<typeof useResizeObserver>[1], undefined>;
4
+ type PropsType<T extends HTMLElement> = [
5
+ obj: SimpleElementType<T>,
6
+ callbacks?: {
7
+ onResize?: ResizeCallback;
8
+ onScroll?: ScrollCallback;
9
+ }
10
+ ];
11
+ export declare function useScrollableParent<T extends HTMLElement = HTMLElement>(...args: PropsType<T>): void;
12
+ export {};
@@ -17,6 +17,7 @@ export * from './ui-animations';
17
17
  export * from './modalWindows';
18
18
  export * from './controlsInput';
19
19
  export * from './elementObservers';
20
- export * from './simpleRefWork';
20
+ export * from './simpleElement';
21
21
  export * from './placement';
22
22
  export * from './forms';
23
+ export * from './useScroll';
@@ -1,11 +1,11 @@
1
1
  import { RefObject } from 'react';
2
- import { SmartRefType } from '..';
2
+ import { SimpleElementType } from '..';
3
3
  import { useBackgroundModalAnim } from '../ui-animations';
4
4
  type UseBackgroundModalAnimOptionsPropsType = Exclude<Parameters<typeof useBackgroundModalAnim>['1'], undefined>;
5
5
  type OptionsType<C extends HTMLElement = HTMLElement> = UseBackgroundModalAnimOptionsPropsType & {
6
6
  containerClickAreaRef?: RefObject<C | null>;
7
7
  };
8
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
8
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SimpleElementType<T>, options?: OptionsType];
9
9
  /**
10
10
  * Хук для backdrop-модального окна.
11
11
  *
@@ -1,10 +1,10 @@
1
- import { SmartRefType } from '..';
1
+ import { SimpleElementType } from '..';
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: SmartRefType<T>, options?: OptionsType];
7
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SimpleElementType<T>, options?: OptionsType];
8
8
  /**
9
9
  * Хук для модального окна.
10
10
  *
@@ -1,13 +1,13 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { calculateAvailablePosition } from './calculateAvailablePosition';
3
- import { SmartRefType } from '..';
3
+ import { SimpleElementType } from '..';
4
4
  type CalculateAvailablePositionPropsType = Parameters<typeof calculateAvailablePosition>['0'];
5
5
  type NewPlacementPosType = ReturnType<typeof calculateAvailablePosition>;
6
6
  type PropsType = [
7
- ref: SmartRefType<HTMLElement>,
7
+ ref: SimpleElementType<HTMLElement>,
8
8
  options?: Omit<CalculateAvailablePositionPropsType, 'objRect' | 'parentRect' | 'windowRect'> & {
9
- parentRef?: SmartRefType<HTMLElement>;
10
- windowRef?: SmartRefType<HTMLElement>;
9
+ parentRef?: SimpleElementType<HTMLElement>;
10
+ windowRef?: SimpleElementType<HTMLElement>;
11
11
  }
12
12
  ];
13
13
  type FunReturnType = {
@@ -0,0 +1,20 @@
1
+ import { RefObject } from 'react';
2
+ export type SimpleElementType<T extends HTMLElement> = RefObject<T | null> | T | null | undefined | (() => T | null | undefined);
3
+ type SimpleRefElementWorkPropsType<T extends HTMLElement> = [
4
+ ref?: SimpleElementType<T>
5
+ ];
6
+ type SimpleRefElementWorkFunReturnType<T extends HTMLElement> = [
7
+ getObj: () => T | null,
8
+ _getObj: (item: SimpleElementType<T>) => T | null
9
+ ];
10
+ export declare function useSimpleElement<T extends HTMLElement = HTMLElement>(...args: SimpleRefElementWorkPropsType<T>): SimpleRefElementWorkFunReturnType<T>;
11
+ export type SmartRefListType<T extends HTMLElement> = SimpleElementType<T> | Array<SimpleElementType<T>>;
12
+ type SimpleRefListElementWorkPropsType<T extends HTMLElement> = [
13
+ ref?: SmartRefListType<T>
14
+ ];
15
+ type SimpleRefListElementWorkFunReturnType<T extends HTMLElement> = [
16
+ getObjects: () => Array<T | null>,
17
+ _getObjects: (item: SmartRefListType<T>) => Array<T | null>
18
+ ];
19
+ export declare function useSimpleElementsList<T extends HTMLElement = HTMLElement>(...args: SimpleRefListElementWorkPropsType<T>): SimpleRefListElementWorkFunReturnType<T>;
20
+ export {};
@@ -1,4 +1,11 @@
1
- export declare function COLLAPSIBLE_ANIM(): {
2
- appear: (obj: HTMLElement, timeline: gsap.core.Timeline, height: number) => gsap.core.Timeline;
3
- disappear: (obj: HTMLElement, timeline: gsap.core.Timeline, height: number) => gsap.core.Timeline;
1
+ type PropsType = [
2
+ wrapper: HTMLElement,
3
+ content: HTMLElement,
4
+ timeline: gsap.core.Timeline
5
+ ];
6
+ export declare function COLLAPSIBLE_ANIM(...args: PropsType): {
7
+ appear: (height: number) => gsap.core.Timeline;
8
+ disappear: () => gsap.core.Timeline;
9
+ changeHeight: (height: number) => gsap.core.Timeline;
4
10
  };
11
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { BACKDROP_MODAL_ANIMATIONS } from './assets';
3
- import { SmartRefType } from '..';
3
+ import { SimpleElementType } from '..';
4
4
  type OptionsType<T extends HTMLElement = HTMLElement> = {
5
- targetRef?: SmartRefType<T>;
5
+ targetRef?: SimpleElementType<T>;
6
6
  onViewing?: () => void;
7
7
  onHiding?: () => void;
8
8
  backdropClassName?: string;
@@ -13,7 +13,7 @@ type OptionsType<T extends HTMLElement = HTMLElement> = {
13
13
  };
14
14
  backdropColor?: string;
15
15
  };
16
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
16
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SimpleElementType<T>, options?: OptionsType];
17
17
  type AnimationsTypes = keyof ReturnType<typeof BACKDROP_MODAL_ANIMATIONS>;
18
18
  /**
19
19
  * Хук для анимации backdrop-модального окна.
@@ -1,9 +1,9 @@
1
1
  import { CSSProperties } from 'react';
2
- import { SmartRefType } from '..';
2
+ import { SimpleElementType } from '..';
3
3
  import { CAROUSEL_ANIM } from './assets';
4
4
  type PropsType = [
5
- ref: SmartRefType<HTMLElement>,
6
- trackRef: SmartRefType<HTMLElement>
5
+ ref: SimpleElementType<HTMLElement>,
6
+ trackRef: SimpleElementType<HTMLElement>
7
7
  ];
8
8
  type FunReturnType = Pick<ReturnType<typeof CAROUSEL_ANIM>, 'getTrackInitStyle' | 'getObjInitStyle'> & {
9
9
  showEl: (el: number | HTMLElement) => void;
@@ -1,15 +1,62 @@
1
- import { CSSProperties } from 'react';
2
- import { useSimpleRefElementWork } from '..';
3
- type RefType = Parameters<typeof useSimpleRefElementWork>['0'];
4
- type OptionsType = {
5
- initState?: 'open' | 'hide';
1
+ import { default as React } from 'react';
2
+ export type CollapseState = 'open' | 'close';
3
+ type PropsType<W extends HTMLElement, C extends HTMLElement> = {
4
+ initElState?: CollapseState;
5
+ wrapperRef: React.RefObject<W>;
6
+ contentRef: React.RefObject<C>;
6
7
  };
7
- type PropsType = [ref?: RefType, options?: OptionsType];
8
- export declare function useCollapsible(...args: PropsType): {
9
- isOpen: boolean;
8
+ /**
9
+ * Хук React для создания сворачиваемых/разворачиваемых UI элементов с GSAP анимациями.
10
+ *
11
+ * @template W - Тип HTML элемента обёртки (контейнер, высота которого изменяется)
12
+ * @template C - Тип HTML элемента контента (внутреннее содержимое, которое сворачивается/разворачивается)
13
+ *
14
+ * @param {Object} props - Параметры хука
15
+ * @param {CollapseState} [props.initElState='open'] - Начальное состояние элемента ('open' или 'close')
16
+ * @param {React.RefObject<W>} props.wrapperRef - Ref объект для элемента обёртки
17
+ * @param {React.RefObject<C>} props.contentRef - Ref объект для элемента контента
18
+ *
19
+ * @returns {Object} Объект интерфейса хука
20
+ * @returns {CollapseState} returns.elState - Текущее состояние ('open' или 'close') - реактивное значение для рендеринга
21
+ * @returns {Function} returns.getElState - Функция получения последнего состояния - используйте в коллбэках для избежания stale closure
22
+ * @returns {Function} returns.open - Открывает элемент с анимацией
23
+ * @returns {Function} returns.close - Закрывает элемент с анимацией
24
+ * @returns {Function} returns.toggle - Переключает между состояниями открыто/закрыто
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * const wrapperRef = useRef<HTMLDivElement>(null);
29
+ * const contentRef = useRef<HTMLDivElement>(null);
30
+ *
31
+ * const { elState, toggle } = useCollapsible({
32
+ * initElState: 'close',
33
+ * wrapperRef,
34
+ * contentRef
35
+ * });
36
+ *
37
+ * return (
38
+ * <div>
39
+ * <button onClick={toggle}>Переключить</button>
40
+ * <div ref={wrapperRef}>
41
+ * <div ref={contentRef}>
42
+ * Сворачиваемый контент здесь
43
+ * </div>
44
+ * </div>
45
+ * </div>
46
+ * );
47
+ * ```
48
+ *
49
+ * @remarks
50
+ * - Автоматически обрабатывает изменение размера контента через ResizeObserver в открытом состоянии
51
+ * - Использует GSAP для плавных анимаций с адаптивной длительностью на основе высоты контента
52
+ * - Элемент обёртки должен иметь overflow: hidden для предотвращения видимости контента при сворачивании
53
+ * - Ref объекты должны быть созданы через useRef перед вызовом хука
54
+ */
55
+ export declare function useCollapsible<W extends HTMLElement, C extends HTMLElement>(props: PropsType<W, C>): {
56
+ elState: CollapseState;
57
+ getElState: () => CollapseState;
10
58
  open: () => void;
11
- hide: () => void;
59
+ close: () => void;
12
60
  toggle: () => void;
13
- getInitStyle: () => CSSProperties;
14
61
  };
15
62
  export {};
@@ -1,5 +1,5 @@
1
- import { useSimpleRefElementWork } from '..';
2
- type RefType = Parameters<typeof useSimpleRefElementWork>['0'];
1
+ import { useSimpleElement } from '..';
2
+ type RefType = Parameters<typeof useSimpleElement>['0'];
3
3
  type OptionsType = {
4
4
  xSpeed?: number;
5
5
  };
@@ -1,10 +1,10 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { useSmartPlacementResolver } from '../placement/useSmartPlacementResolver';
3
3
  import { MODAL_ANIMATIONS } from './assets';
4
- import { SmartRefType } from '..';
4
+ import { SimpleElementType } from '..';
5
5
  type UseSmartPlacementResolverOptionsType = Exclude<Parameters<typeof useSmartPlacementResolver>['1'], undefined>;
6
6
  type OptionsType<T extends HTMLElement = HTMLElement> = Pick<UseSmartPlacementResolverOptionsType, 'position'> & {
7
- targetRef?: SmartRefType<T>;
7
+ targetRef?: SimpleElementType<T>;
8
8
  onViewing?: () => void;
9
9
  onHiding?: () => void;
10
10
  smartPlacementOptions?: Omit<UseSmartPlacementResolverOptionsType, 'position'>;
@@ -17,7 +17,7 @@ type OptionsType<T extends HTMLElement = HTMLElement> = Pick<UseSmartPlacementRe
17
17
  };
18
18
  backdropColor?: string;
19
19
  };
20
- type PropsType<T extends HTMLElement = HTMLElement> = [ref: SmartRefType<T>, options?: OptionsType];
20
+ type PropsType<T extends HTMLElement = HTMLElement> = [ref: SimpleElementType<T>, options?: OptionsType];
21
21
  type AnimationsTypes = keyof ReturnType<typeof MODAL_ANIMATIONS>;
22
22
  /**
23
23
  * Хук для анимации модального окна.
@@ -1,6 +1,6 @@
1
- import { SmartRefType, SmartRefListType } from '.';
1
+ import { SimpleElementType, SmartRefListType } from '.';
2
2
  type PropsType<T extends HTMLElement> = [
3
- ref: SmartRefType<T>,
3
+ ref: SimpleElementType<T>,
4
4
  callbacks?: {
5
5
  onMissClick?: () => void;
6
6
  onInnerClick?: () => void;
@@ -0,0 +1,10 @@
1
+ import { SimpleElementType } from '.';
2
+ type PropsType<T extends HTMLElement> = [
3
+ obj: SimpleElementType<T>,
4
+ callback?: (ev: Event) => void
5
+ ];
6
+ export declare function useScroll<T extends HTMLElement = HTMLElement>(...args: PropsType<T>): {
7
+ reinit: () => void;
8
+ deinit: () => void;
9
+ };
10
+ export {};
@@ -1,4 +1,3 @@
1
- export { default as isDict } from './isDict';
2
1
  export { default as setDeepValue } from './setDeepValue';
3
2
  export * from './getDeepValue';
4
3
  export * from './compKeyWays';
@@ -0,0 +1,14 @@
1
+ type PropsType = [
2
+ obj: HTMLElement
3
+ ];
4
+ /**
5
+ * Находит первый родительский элемент, который можно прокручивать
6
+ *
7
+ * @param {HTMLElement} obj - HTML-элемент, для которого ищется прокручиваемый родитель
8
+ * @returns {HTMLElement | undefined} Прокручиваемый родительский элемент или undefined
9
+ *
10
+ * @remarks
11
+ * Максимальная глубина поиска: {@link MAX_DEEP}
12
+ */
13
+ export declare function getScrollableParent(...args: PropsType): HTMLElement | undefined;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './getScrollableParent';
2
+ export * from './isScrallableElement';
@@ -0,0 +1,10 @@
1
+ type PropsType = [
2
+ obj: HTMLElement
3
+ ];
4
+ /** Проверяет HTML-элемент на возможность прокрутки по ширине */
5
+ export declare function isScrollableWidthElement(...args: PropsType): boolean;
6
+ /** Проверяет HTML-элемент на возможность прокрутки по высоте */
7
+ export declare function isScrollableHeightElement(...args: PropsType): boolean;
8
+ /** Проверяет HTML-элемент на возможность прокрутки по высоте или ширине */
9
+ export declare function isScrollableElement(...args: PropsType): boolean;
10
+ export {};
@@ -4,4 +4,5 @@ export * from './reactComponents';
4
4
  export * from './time';
5
5
  export * from './animation';
6
6
  export * from './searchParams';
7
- export * from './tsCheck';
7
+ export * from './tsAsserts';
8
+ export * from './html';
@@ -1,3 +1 @@
1
- export { default as handleScrollEnd } from './handleScrollEnd';
2
- export { default as isCustomComponent } from './isCustomComponent';
3
- export * from './getCenterElementAttribute';
1
+ export * from './isCustomComponent';
@@ -1 +1 @@
1
- export default function isCustomComponent(element: React.ReactElement): boolean;
1
+ export declare function isCustomComponent(element: React.ReactElement): boolean;
@@ -1,5 +1,6 @@
1
1
  type BaseFieldType = string | number | boolean | null;
2
2
  type ObjParamsType = Record<string, BaseFieldType | Array<BaseFieldType> | undefined>;
3
+ /** @deprecated */
3
4
  export declare function toURLSearchParams(params: ObjParamsType | string): URLSearchParams;
4
5
  type ClearObjParamsType = Record<string, Array<string> | string>;
5
6
  export declare function toObjURLSearchParamsObj(search: string | URLSearchParams): ClearObjParamsType;
@@ -32,12 +32,15 @@ type SaveFormatDateOptionsBaseType = {
32
32
  * */
33
33
  errorNull?: boolean;
34
34
  };
35
+ /** @deprecated */
35
36
  export declare function saveFormatDate(date: string, options: SaveFormatDateOptionsBaseType & {
36
37
  errorNull?: false;
37
38
  }): string;
39
+ /** @deprecated */
38
40
  export declare function saveFormatDate(date: Date, options: SaveFormatDateOptionsBaseType & {
39
41
  errorNull?: false;
40
42
  }): Date | string;
43
+ /** @deprecated */
41
44
  export declare function saveFormatDate(date: string | Date, options: SaveFormatDateOptionsBaseType & {
42
45
  errorNull: true;
43
46
  }): string | null;
@@ -21,5 +21,6 @@ type SaveParseDateOptionsType = {
21
21
  fromTimeZone?: string;
22
22
  locale?: Pick<Locale, "options" | "formatLong" | "match">;
23
23
  };
24
+ /** @deprecated */
24
25
  export declare function saveParseDate(date: string, { from, locale, fromTimeZone }: SaveParseDateOptionsType): Date | null;
25
26
  export {};
@@ -2,5 +2,6 @@
2
2
  * Функция возвращает старт дня по UTC.
3
3
  *
4
4
  * Она игнорит часовой пояс, то есть она будет искать время 00:00:00 не от вашего часового пояса, а от UTC.
5
+ * @deprecated
5
6
  * */
6
7
  export declare function startOfDayUTC(date: Date | string): Date;
@@ -15,6 +15,9 @@ export type IsTuple<T> = T extends readonly any[] ? number extends T['length'] ?
15
15
  export type NegativeBoolean<T> = T extends true ? false : true;
16
16
  export type NotTuple<T> = NegativeBoolean<IsTuple<T>>;
17
17
  export type BuildTuple<N extends number, T extends any[] = []> = T['length'] extends N ? T : BuildTuple<N, [...T, N]>;
18
+ export type PartialAsNull<T> = (IsObject<T> extends true ? IsArray<T> extends true ? T : {
19
+ [K in keyof T]: T[K] | null;
20
+ } : T);
18
21
  export type Nullable<T> = null | (IsObject<T> extends true ? IsArray<T> extends true ? T : {
19
22
  [K in keyof T]: T[K] | null;
20
23
  } : T);
@@ -0,0 +1 @@
1
+ export * from './useCollapse';
@@ -0,0 +1,16 @@
1
+ import { CollapseState } from '../../../hooks';
2
+ type PropsType = [
3
+ onUpdateState?: (state: CollapseState) => void
4
+ ];
5
+ export declare function useCollapse<WEl extends HTMLElement, CEl extends HTMLElement>(...args: PropsType): {
6
+ actions: {
7
+ elState: CollapseState;
8
+ getElState: () => CollapseState;
9
+ open: () => void;
10
+ close: () => void;
11
+ toggle: () => void;
12
+ };
13
+ wrapperRef: import('react').MutableRefObject<WEl | null>;
14
+ contentRef: import('react').MutableRefObject<CEl | null>;
15
+ };
16
+ export {};
@@ -0,0 +1 @@
1
+ export * from './ui';
@@ -0,0 +1,58 @@
1
+ import { default as React, CSSProperties, ElementType } from 'react';
2
+ import { AsProps } from '../../../types';
3
+ import { CollapseState, useCollapsible } from '../../../hooks';
4
+ type CollapsibleReturnType = ReturnType<typeof useCollapsible>;
5
+ type PropsType<C extends ElementType, W extends ElementType> = AsProps<C, {
6
+ wrapperAs?: W;
7
+ wrapperClassName?: string;
8
+ wrapperStyle?: CSSProperties;
9
+ onUpdateState?: (state: CollapseState) => void;
10
+ }>;
11
+ type RefType = CollapsibleReturnType;
12
+ /**
13
+ * Collapse — полиморфный JSX-компонент, являющийся компонентной реализацией хука `useCollapsible`.
14
+ *
15
+ * Компонент рендерит “обёртку” (`wrapperAs`) и “контент” (`as`), создаёт `ref`-ы для обоих элементов
16
+ * и подключает к ним логику сворачивания/разворачивания (анимации/изменение размеров) через `useCollapsible`.
17
+ *
18
+ * @template C Тип элемента/компонента контента (prop `as`).
19
+ * @template W Тип элемента/компонента обёртки (prop `wrapperAs`).
20
+ *
21
+ * @param {object} props Props компонента.
22
+ * @param {C} [props.as='div'] Элемент/компонент для контента. В него пробрасываются остальные props.
23
+ * @param {W} [props.wrapperAs='div'] Элемент/компонент для обёртки (контейнер с изменяемой высотой).
24
+ * @param {string} [props.wrapperClassName] `className` для обёртки.
25
+ * @param {import('react').CSSProperties} [props.wrapperStyle] `style` для обёртки (будет объединён с `{ overflow: 'hidden' }`).
26
+ * @param {(state: import('@/hooks').CollapseState) => void} [props.onUpdateState]
27
+ * Коллбэк, вызываемый при смене состояния (`'open' | 'close'`).
28
+ *
29
+ * @returns {import('react').ReactElement | null} React-элемент или `null`.
30
+ *
31
+ * @ref
32
+ * Ref (imperative API) возвращает объект действий из `useCollapsible`, например:
33
+ * `open()`, `close()`, `toggle()`, `elState`, `getElState()` и связанные методы.
34
+ *
35
+ * @remarks
36
+ * - `as` и `wrapperAs` должны поддерживать `ref` на `HTMLElement` (обычно intrinsic теги или компоненты с `forwardRef`).
37
+ * - Обёртке принудительно задаётся `overflow: hidden` (плюс ваш `wrapperStyle`) для корректного визуального коллапса.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * const apiRef = useRef<CollapsibleReturnType>(null);
42
+ *
43
+ * <Collapse
44
+ * wrapperAs="div"
45
+ * as="div"
46
+ * wrapperClassName="my-wrapper"
47
+ * wrapperStyle={{ willChange: 'height' }}
48
+ * onUpdateState={(s) => console.log('state:', s)}
49
+ * ref={apiRef}
50
+ * >
51
+ * Контент
52
+ * </Collapse>
53
+ *
54
+ * // apiRef.current?.toggle();
55
+ * ```
56
+ */
57
+ export declare const Collapse: <C extends ElementType, W extends ElementType, WEl extends HTMLElement = React.ElementRef<W> extends HTMLElement ? React.ElementRef<W> : never, CEl extends HTMLElement = React.ElementRef<C> extends HTMLElement ? React.ElementRef<C> : never>(props: PropsType<C, W> & React.RefAttributes<RefType>) => React.ReactElement | null;
58
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Collapse';
@@ -0,0 +1,10 @@
1
+ type PropsType = [
2
+ obj: HTMLElement | SVGElement,
3
+ timeline: gsap.core.Timeline
4
+ ];
5
+ type FunReturnType = {
6
+ appear: () => gsap.core.Timeline;
7
+ disappear: () => gsap.core.Timeline;
8
+ };
9
+ export declare function CHECK_APPEARANCE_ANIM(...args: PropsType): FunReturnType;
10
+ export {};
@@ -0,0 +1 @@
1
+ export * from './check';
@@ -28,3 +28,4 @@ export * from './Dropdown';
28
28
  export * from './formFields';
29
29
  export * from './Breadcrumbs';
30
30
  export * from './DropdownV2';
31
+ export * from './Collapse';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "react-components",
12
12
  "ui-kit"
13
13
  ],
14
- "version": "1.0.6",
14
+ "version": "1.0.8",
15
15
  "exports": {
16
16
  ".": {
17
17
  "types": "./dist/types/index.d.ts",
@@ -1,20 +0,0 @@
1
- import { RefObject } from 'react';
2
- export type SmartRefType<T extends HTMLElement> = RefObject<T | null> | T | null | undefined | (() => T | null | undefined);
3
- type SimpleRefElementWorkPropsType<T extends HTMLElement> = [
4
- ref?: SmartRefType<T>
5
- ];
6
- type SimpleRefElementWorkFunReturnType<T extends HTMLElement> = [
7
- getObj: () => T | null,
8
- _getObj: (item: SmartRefType<T>) => T | null
9
- ];
10
- export declare function useSimpleRefElementWork<T extends HTMLElement = HTMLElement>(...args: SimpleRefElementWorkPropsType<T>): SimpleRefElementWorkFunReturnType<T>;
11
- export type SmartRefListType<T extends HTMLElement> = SmartRefType<T> | Array<SmartRefType<T>>;
12
- type SimpleRefListElementWorkPropsType<T extends HTMLElement> = [
13
- ref?: SmartRefListType<T>
14
- ];
15
- type SimpleRefListElementWorkFunReturnType<T extends HTMLElement> = [
16
- getObjects: () => Array<T | null>,
17
- _getObjects: (item: SmartRefListType<T>) => Array<T | null>
18
- ];
19
- export declare function useSimpleRefListElementWork<T extends HTMLElement = HTMLElement>(...args: SimpleRefListElementWorkPropsType<T>): SimpleRefListElementWorkFunReturnType<T>;
20
- export {};
@@ -1 +0,0 @@
1
- export default function isDict(variable: any): boolean;
@@ -1,6 +0,0 @@
1
- type FunContainerPropsType = HTMLElement | null | undefined;
2
- type FunOptionPropsType = {
3
- key?: string;
4
- };
5
- export declare function getCenterElementAttribute(container: FunContainerPropsType, options?: FunOptionPropsType | undefined): string | null;
6
- export {};
@@ -1,2 +0,0 @@
1
- import { default as React } from 'react';
2
- export default function handleScrollEnd(e: React.UIEvent<HTMLDivElement>, callback: (e: React.UIEvent<HTMLDivElement>) => void): void;