indicator-ui 1.0.44 → 1.0.46

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 (75) hide show
  1. package/dist/index.cjs +9 -9
  2. package/dist/index.js +7843 -7734
  3. package/dist/indicator-ui.css +1 -1
  4. package/dist/types/src/hooks/elementObservers/index.d.ts +1 -1
  5. package/dist/types/src/hooks/elementObservers/{useIntersectionObserver.d.ts → useIntersectionObserverOld.d.ts} +1 -1
  6. package/dist/types/src/hooks/elementsRefsAdapteers/index.d.ts +1 -0
  7. package/dist/types/src/hooks/elementsRefsAdapteers/useElementRefAdapter.d.ts +3 -0
  8. package/dist/types/src/hooks/index.d.ts +3 -0
  9. package/dist/types/src/hooks/scroll/hooks/index.d.ts +3 -0
  10. package/dist/types/src/hooks/scroll/hooks/useScrollAnchor.d.ts +58 -0
  11. package/dist/types/src/hooks/scroll/hooks/useScrollHandler.d.ts +18 -0
  12. package/dist/types/src/hooks/scroll/hooks/useScrollInfo.d.ts +9 -0
  13. package/dist/types/src/hooks/scroll/index.d.ts +2 -0
  14. package/dist/types/src/hooks/scroll/types/base.d.ts +4 -0
  15. package/dist/types/src/hooks/scroll/types/index.d.ts +3 -0
  16. package/dist/types/src/hooks/scroll/types/scrollAnchor.d.ts +6 -0
  17. package/dist/types/src/hooks/scroll/types/scrollInfo.d.ts +15 -0
  18. package/dist/types/src/hooks/scroll/utils/index.d.ts +1 -0
  19. package/dist/types/src/hooks/simpleElement.d.ts +1 -0
  20. package/dist/types/src/hooks/ui-animations/index.d.ts +0 -1
  21. package/dist/types/src/hooks/useDebouncedInvoker.d.ts +1 -0
  22. package/dist/types/src/hooks/useElementFixedOffset.d.ts +1 -0
  23. package/dist/types/src/hooks/useFormData.d.ts +1 -0
  24. package/dist/types/src/hooks/useIsErrorField.d.ts +1 -0
  25. package/dist/types/src/hooks/useLoading.d.ts +1 -5
  26. package/dist/types/src/hooks/useResettableTimeout.d.ts +5 -2
  27. package/dist/types/src/hooks/useSafeCallback.d.ts +1 -0
  28. package/dist/types/src/hooks/useScroll.d.ts +1 -0
  29. package/dist/types/src/hooks/useScrollIndicators.d.ts +1 -0
  30. package/dist/types/src/hooks/useSmartScroll/hooks/useDragScroll.d.ts +3 -3
  31. package/dist/types/src/hooks/useSmartScroll/hooks/useTouchmove.d.ts +3 -3
  32. package/dist/types/src/hooks/useSmartScroll/hooks/useWheelEvent.d.ts +3 -3
  33. package/dist/types/src/hooks/useSyncedStateRef.d.ts +1 -3
  34. package/dist/types/src/hooks/utils/index.d.ts +6 -0
  35. package/dist/types/src/hooks/utils/useDebounce.d.ts +37 -0
  36. package/dist/types/src/hooks/utils/useIntersectionObserver.d.ts +5 -0
  37. package/dist/types/src/hooks/utils/useLockedCallback.d.ts +26 -0
  38. package/dist/types/src/hooks/utils/useRefAdapter.d.ts +1 -0
  39. package/dist/types/src/hooks/utils/useStableCallbackInvoke.d.ts +5 -0
  40. package/dist/types/src/hooks/utils/useTimeout.d.ts +27 -0
  41. package/dist/types/src/types/mixins.d.ts +9 -4
  42. package/dist/types/src/ui/Breadcrumbs/ui/BreadcrumbButton.d.ts +5 -3
  43. package/dist/types/src/ui/Breadcrumbs/ui/Breadcrumbs.d.ts +4 -3
  44. package/dist/types/src/ui/Buttons/types/ButtonTypes.d.ts +1 -1
  45. package/dist/types/src/ui/Collapse/ui/Collapse.d.ts +2 -1
  46. package/dist/types/src/ui/DropdownV2/ui/DropdownItemV2.d.ts +2 -1
  47. package/dist/types/src/ui/Tag/ui/FilterTag.d.ts +1 -1
  48. package/dist/types/src/ui/Tag/ui/TagCount.d.ts +1 -1
  49. package/dist/types/src/ui/ToggleBase/ui/ToggleBase.d.ts +2 -1
  50. package/dist/types/src/ui/UserPick/ui/UserPick.d.ts +2 -1
  51. package/dist/types/src/ui/index.d.ts +1 -0
  52. package/dist/types/src/ui/visual/ScrollHint/hooks/index.d.ts +1 -0
  53. package/dist/types/src/ui/visual/ScrollHint/hooks/useContainer.d.ts +7 -0
  54. package/dist/types/src/ui/visual/ScrollHint/hooks/useHintPosition.d.ts +13 -0
  55. package/dist/types/src/ui/visual/ScrollHint/hooks/useScrollHint.d.ts +3 -0
  56. package/dist/types/src/ui/visual/ScrollHint/hooks/useScrollListener.d.ts +7 -0
  57. package/dist/types/src/ui/visual/ScrollHint/index.d.ts +1 -0
  58. package/dist/types/src/ui/visual/ScrollHint/styles/components/index.d.ts +1 -0
  59. package/dist/types/src/ui/visual/ScrollHint/styles/index.d.ts +1 -0
  60. package/dist/types/src/ui/visual/ScrollHint/types/index.d.ts +8 -0
  61. package/dist/types/src/ui/visual/ScrollHint/ui/ScrollHint.d.ts +5 -0
  62. package/dist/types/src/ui/visual/ScrollHint/ui/components/Hint.d.ts +4 -0
  63. package/dist/types/src/ui/visual/ScrollHint/ui/components/index.d.ts +1 -0
  64. package/dist/types/src/ui/visual/ScrollHint/ui/index.d.ts +1 -0
  65. package/dist/types/src/ui/visual/ScrollHint/utils/index.d.ts +1 -0
  66. package/dist/types/src/ui/visual/Shimmer/hooks/index.d.ts +1 -0
  67. package/dist/types/src/ui/visual/Shimmer/hooks/useShimmer.d.ts +11 -0
  68. package/dist/types/src/ui/visual/Shimmer/index.d.ts +1 -0
  69. package/dist/types/src/ui/visual/Shimmer/styles/index.d.ts +1 -0
  70. package/dist/types/src/ui/visual/Shimmer/ui/Shimmer.d.ts +5 -0
  71. package/dist/types/src/ui/visual/Shimmer/ui/ShimmerContent.d.ts +5 -0
  72. package/dist/types/src/ui/visual/Shimmer/ui/index.d.ts +1 -0
  73. package/dist/types/src/ui/visual/index.d.ts +1 -0
  74. package/package.json +1 -1
  75. package/dist/types/src/hooks/ui-animations/useShimmer.d.ts +0 -19
@@ -1,4 +1,4 @@
1
1
  export * from './useResizeObserver';
2
- export * from './useIntersectionObserver';
2
+ export * from './useIntersectionObserverOld';
3
3
  export * from './useResizeWindowObserver';
4
4
  export * from './useScrollableParent';
@@ -10,5 +10,5 @@ type FunReturnType = {
10
10
  clear: () => void;
11
11
  reinitObserver: () => void;
12
12
  };
13
- export declare function useIntersectionObserver<T extends HTMLElement = HTMLElement>(...args: PropsType<T>): FunReturnType;
13
+ export declare function useIntersectionObserverOld<T extends HTMLElement = HTMLElement>(...args: PropsType<T>): FunReturnType;
14
14
  export {};
@@ -0,0 +1 @@
1
+ export * from './useElementRefAdapter';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export type AdapterElementRef<T extends HTMLElement> = React.RefObject<T> | T | null;
3
+ export declare function useElementRefAdapter<T extends HTMLElement>(): (instance: AdapterElementRef<T>) => T | null;
@@ -22,3 +22,6 @@ export * from './simpleElement';
22
22
  export * from './placement';
23
23
  export * from './forms';
24
24
  export * from './useScroll';
25
+ export * from './scroll';
26
+ export * from './utils';
27
+ export * from './elementsRefsAdapteers';
@@ -0,0 +1,3 @@
1
+ export * from './useScrollAnchor';
2
+ export * from './useScrollInfo';
3
+ export * from './useScrollHandler';
@@ -0,0 +1,58 @@
1
+ import { ScrollAnchorCommit, ScrollDirectionOptions } from '../types';
2
+ type CommitScroll<T> = (el: T) => ScrollAnchorCommit;
3
+ type RevertScroll<T> = (el: T, commit: ScrollAnchorCommit) => ScrollAnchorCommit;
4
+ type PropsType = ScrollDirectionOptions;
5
+ type FunReturnType<T> = {
6
+ commitScroll: CommitScroll<T>;
7
+ revertScroll: RevertScroll<T>;
8
+ };
9
+ /**
10
+ * Хук для сохранения визуальной позиции скролла
11
+ * при добавлении элементов в начало списка (prepend) или
12
+ * при изменение размера `layout` между `зоной видимости`
13
+ * и `началом элемента`.
14
+ *
15
+ * Используется в сценариях, когда новый контент вставляется
16
+ * выше текущей видимой области, из-за чего увеличивается
17
+ * scrollHeight, а браузер сохраняет `scrollTop`.
18
+ *
19
+ * Хук компенсирует это смещение, сохраняя пользователя
20
+ * на том же визуальном месте списка.
21
+ *
22
+ * Принцип работы:
23
+ * 1. `commitScroll` — сохраняет текущее состояние скролла и размеры контейнера.
24
+ * 2. В DOM добавляются элементы в начало списка (prepend).
25
+ * 3. `revertScroll` — компенсирует изменение scrollHeight,
26
+ * корректируя scrollTop так, чтобы видимая область не сместилась.
27
+ *
28
+ * ⚠️ ВАЖНО:
29
+ * Между вызовами `commitScroll` и `revertScroll`
30
+ * изменение DOM должно происходить до этапа раскраски,
31
+ * на этапе просчета `layout`.
32
+ *
33
+ * ⚠️ ОГРАНИЧЕНИЕ:
34
+ * Хук предназначен ТОЛЬКО для сценариев добавления элементов
35
+ * в начало списка.
36
+ *
37
+ * @template T HTMLElement или его наследник
38
+ *
39
+ * @param props Параметры компенсации скролла
40
+ *
41
+ * @param props.scrollVerticalDirection
42
+ * Направление компенсации по вертикали.
43
+ * Для prepend-сценариев обычно используется 'bottom' (по умолчанию).
44
+ *
45
+ * @param props.scrollHorizontalDirection
46
+ * Направление компенсации по горизонтали (по умолчанию 'right').
47
+ *
48
+ * @returns Объект с методами управления якорем скролла
49
+ *
50
+ * @returns.commitScroll
51
+ * Сохраняет состояние скролла ДО добавления элементов в начало списка.
52
+ *
53
+ * @returns.revertScroll
54
+ * Восстанавливает позицию скролла ПОСЛЕ добавления элементов,
55
+ * но ДО отрисовки браузером.
56
+ */
57
+ export declare function useScrollAnchor<T extends HTMLElement>(props?: PropsType): FunReturnType<T>;
58
+ export {};
@@ -0,0 +1,18 @@
1
+ import { ScrollInfoEvent, SimpleElementType } from '../..';
2
+ import { ScrollAnchorCommit } from '../types';
3
+ import { useScrollAnchor } from './useScrollAnchor';
4
+ import { useScrollInfo } from './useScrollInfo';
5
+ type ScrollEvent<T extends HTMLElement> = ScrollInfoEvent<T> & {
6
+ commitScroll: () => ScrollAnchorCommit;
7
+ revertScroll: (commit: ScrollAnchorCommit) => ScrollAnchorCommit;
8
+ };
9
+ type Options<T extends HTMLElement> = Parameters<typeof useScrollInfo<T>>[number] | Parameters<typeof useScrollAnchor<T>>[number];
10
+ type Callback<T extends HTMLElement> = (ev: ScrollEvent<T>) => void;
11
+ export declare function useScrollHandler<T extends HTMLElement>(ref: SimpleElementType<T>, callback: Callback<T>, options?: Options<T>): {
12
+ getInfo: () => ScrollInfoEvent<T>;
13
+ getObj: () => T | null;
14
+ commitScroll: () => ScrollAnchorCommit;
15
+ revertScroll: (commit: ScrollAnchorCommit) => ScrollAnchorCommit;
16
+ reinit: () => void;
17
+ };
18
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ScrollDirectionOptions } from '../..';
2
+ import { ScrollInfoEvent } from '../types';
3
+ type Options = ScrollDirectionOptions & {
4
+ nearDelta?: number;
5
+ };
6
+ export declare function useScrollInfo<T extends HTMLElement = HTMLElement>(options?: Options): {
7
+ getInfo: (obj: T) => ScrollInfoEvent<T>;
8
+ };
9
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export type ScrollDirectionOptions = {
2
+ verticalDirection?: 'top' | 'bottom';
3
+ horizontalDirection?: 'left' | 'right';
4
+ };
@@ -0,0 +1,3 @@
1
+ export * from './scrollInfo';
2
+ export * from './scrollAnchor';
3
+ export * from './base';
@@ -0,0 +1,6 @@
1
+ export type ScrollAnchorCommit = {
2
+ scrollLeft: number;
3
+ scrollTop: number;
4
+ scrollHeight: number;
5
+ scrollWidth: number;
6
+ };
@@ -0,0 +1,15 @@
1
+ export type ScrollInfoPosition = 'start' | 'end' | 'near-start' | 'near-end' | 'unknown';
2
+ export type ScrollInfoDirection = 'start' | 'end';
3
+ export type ScrollInfoEvent<T extends HTMLElement> = {
4
+ element: T;
5
+ canScrollVertical: boolean;
6
+ canScrollHorizontal: boolean;
7
+ position: {
8
+ vertical: ScrollInfoPosition;
9
+ horizontal: ScrollInfoPosition;
10
+ };
11
+ direction: {
12
+ vertical: ScrollInfoDirection | undefined;
13
+ horizontal: ScrollInfoDirection | undefined;
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ export declare function assertHTMLElement(el: any): asserts el is HTMLElement;
@@ -7,6 +7,7 @@ type SimpleRefElementWorkFunReturnType<T extends HTMLElement> = [
7
7
  getObj: () => T | null,
8
8
  _getObj: (item: SimpleElementType<T>) => T | null
9
9
  ];
10
+ /** @deprecated Используйте {@link useElementRefAdapter} */
10
11
  export declare function useSimpleElement<T extends HTMLElement = HTMLElement>(...args: SimpleRefElementWorkPropsType<T>): SimpleRefElementWorkFunReturnType<T>;
11
12
  export type SmartRefListType<T extends HTMLElement> = SimpleElementType<T> | Array<SimpleElementType<T>>;
12
13
  type SimpleRefListElementWorkPropsType<T extends HTMLElement> = [
@@ -1,6 +1,5 @@
1
1
  export * from './useModalAnim';
2
2
  export * from './useBackgroundModalAnim';
3
- export * from './useShimmer';
4
3
  export * from './useCollapsible';
5
4
  export * from './useHoverAutoScrollText';
6
5
  export * from './useCarousel';
@@ -1 +1,2 @@
1
+ /** @deprecated Используйте {@link useDebounce} */
1
2
  export declare function useDebouncedInvoker(callback?: () => void, delay?: number): () => void;
@@ -5,5 +5,6 @@ type ElementFixedOffset = {
5
5
  width: number;
6
6
  height: number;
7
7
  };
8
+ /** @deprecated */
8
9
  export declare function useElementFixedOffset(ref: RefObject<HTMLElement>): ElementFixedOffset;
9
10
  export {};
@@ -19,4 +19,5 @@ export type UseFormDataReturnType<T extends Record<string, unknown> = Record<str
19
19
  clearForm: UseFormDataClearFormType;
20
20
  deleteArrayItem: UseFormDataDeleteArrayItemType;
21
21
  };
22
+ /** @deprecated */
22
23
  export declare function useFormData<T extends Record<string, unknown> = Record<string, unknown>>(value?: T): UseFormDataReturnType<T>;
@@ -21,5 +21,6 @@ type PropsType = {
21
21
  additionIsErrorFields?: UseIsErrorFieldIsErrorType;
22
22
  sensitiveSearch?: boolean;
23
23
  };
24
+ /** @deprecated */
24
25
  export declare function useIsErrorField(props?: PropsType): UseIsErrorFieldReturnType;
25
26
  export {};
@@ -1,9 +1,5 @@
1
1
  type FunBaseType = (...args: any) => any;
2
2
  type FunctionGeneric = FunBaseType | FunBaseType[];
3
- type PropsType<T extends FunctionGeneric> = [
4
- fun: T,
5
- initState?: boolean
6
- ];
7
3
  type ActionsType = {
8
4
  startLoading: () => void;
9
5
  stopLoading: () => void;
@@ -56,5 +52,5 @@ type FunReturnType<T extends FunctionGeneric> = [
56
52
  * // С начальным состоянием загрузки
57
53
  * const [loadUser, isLoading] = useLoading(fetchUser, true);
58
54
  */
59
- export declare function useLoading<T extends FunctionGeneric>(...args: PropsType<T>): FunReturnType<T>;
55
+ export declare function useLoading<T extends FunctionGeneric>(fun: T, initState?: boolean): FunReturnType<T>;
60
56
  export {};
@@ -3,6 +3,9 @@ type Timeout = number;
3
3
  type Options = {
4
4
  initExecute?: boolean;
5
5
  };
6
- type PropsType = [fun: Callback, timeout: Timeout, opt?: Options];
7
- export declare function useResettableTimeout(...args: PropsType): void;
6
+ export declare function useResettableTimeout(_fun: Callback, timeout: Timeout, opt?: Options): {
7
+ schedule: (instance: () => void) => void;
8
+ executeAndSchedule: () => Promise<void>;
9
+ clear: () => void;
10
+ };
8
11
  export {};
@@ -2,6 +2,7 @@ type Callback = (...args: any[]) => any;
2
2
  type PropsType = [
3
3
  callback?: Callback
4
4
  ];
5
+ /** @deprecated */
5
6
  export declare function useSafeCallback(...args: PropsType): {
6
7
  getPrevCallback: () => Callback | undefined;
7
8
  getCallback: () => Callback | undefined;
@@ -3,6 +3,7 @@ type PropsType<T extends HTMLElement> = [
3
3
  obj: SimpleElementType<T>,
4
4
  callback?: (ev: Event) => void
5
5
  ];
6
+ /** @deprecated */
6
7
  export declare function useScroll<T extends HTMLElement = HTMLElement>(...args: PropsType<T>): {
7
8
  reinit: () => void;
8
9
  destruct: () => void;
@@ -11,6 +11,7 @@ type PropsType<T extends HTMLElement = HTMLElement, W extends HTMLElement = HTML
11
11
  * Добавляет эффект скролла к элементу. Требует рефки на сам контейнер для скролла и обертку для него.
12
12
  *
13
13
  * Учтите, обертка будет иметь `position: relative;`.
14
+ * @deprecated
14
15
  * */
15
16
  export declare function useScrollIndicators(...args: PropsType): void;
16
17
  export {};
@@ -1,6 +1,6 @@
1
- import { default as React } from 'react';
2
- type PropsType<T> = [
3
- ref: React.RefObject<T | null>,
1
+ import { SimpleElementType } from '../..';
2
+ type PropsType<T extends HTMLElement> = [
3
+ ref: SimpleElementType<T>,
4
4
  options?: {
5
5
  disabled?: boolean;
6
6
  }
@@ -1,6 +1,6 @@
1
- import { default as React } from 'react';
2
- type PropsType<T> = [
3
- ref: React.RefObject<T | null>,
1
+ import { SimpleElementType } from '../..';
2
+ type PropsType<T extends HTMLElement> = [
3
+ ref: SimpleElementType<T>,
4
4
  callbacks?: {
5
5
  onTouchmoveDown?: () => void;
6
6
  onTouchmoveUp?: () => void;
@@ -1,6 +1,6 @@
1
- import { default as React } from 'react';
2
- type PropsType<T> = [
3
- ref: React.RefObject<T | null>,
1
+ import { SimpleElementType } from '../..';
2
+ type PropsType<T extends HTMLElement> = [
3
+ ref: SimpleElementType<T>,
4
4
  callbacks?: {
5
5
  onWheelDown?: () => void;
6
6
  onWheelUp?: () => void;
@@ -1,3 +1 @@
1
- type PropsType<DataType> = [initialValue?: DataType];
2
- export declare function useSyncedStateRef<DataType = unknown>(...args: PropsType<DataType>): readonly [DataType, import('react').Dispatch<import('react').SetStateAction<DataType>>, () => DataType];
3
- export {};
1
+ export declare function useSyncedStateRef<DataType = unknown>(initialValue?: DataType): readonly [DataType, import('react').Dispatch<import('react').SetStateAction<DataType>>, () => DataType];
@@ -0,0 +1,6 @@
1
+ export * from './useTimeout';
2
+ export * from './useDebounce';
3
+ export * from './useLockedCallback';
4
+ export * from './useRefAdapter';
5
+ export * from './useStableCallbackInvoke';
6
+ export * from './useIntersectionObserver';
@@ -0,0 +1,37 @@
1
+ type Args = any[];
2
+ type Callback<TArgs extends Args> = (...args: TArgs) => void;
3
+ /**
4
+ * React-хук, возвращающий debounced-версию функции.
5
+ *
6
+ * Функция будет вызвана только после того, как пройдет `delay` миллисекунд
7
+ * с момента последнего вызова. Каждый новый вызов сбрасывает таймер.
8
+ *
9
+ * Хук корректно:
10
+ * - работает с аргументами через `...args`
11
+ * - обновляет callback без сброса таймера
12
+ * - очищает таймер при размонтировании компонента
13
+ *
14
+ * Подходит для:
15
+ * - обработки ввода пользователя (search, filters)
16
+ * - resize / scroll обработчиков
17
+ * - любых часто вызываемых, но дорогих операций
18
+ *
19
+ * @template TArgs Тип аргументов callback-функции
20
+ *
21
+ * @param callback Функция, выполнение которой нужно задебаунсить
22
+ * @param delay Задержка в миллисекундах
23
+ *
24
+ * @returns Debounced-функция с той же сигнатурой, что и `callback`
25
+ *
26
+ * @example
27
+ * const onChange = useDebounce(
28
+ * (value: string) => {
29
+ * fetchUsers(value)
30
+ * },
31
+ * 300
32
+ * )
33
+ *
34
+ * onChange('hello')
35
+ */
36
+ export declare function useDebounce<TArgs extends Args>(callback: Callback<TArgs>, delay: number): (...args: TArgs) => void;
37
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function useIntersectionObserve(callback: IntersectionObserverCallback, options: IntersectionObserverInit): {
2
+ observe: (target: Element) => void;
3
+ unobserve: (target: Element) => void;
4
+ reinitObserver: () => void;
5
+ };
@@ -0,0 +1,26 @@
1
+ type Args = any[];
2
+ /**
3
+ * React-хук, возвращающий эксклюзивную версию callback-функции.
4
+ *
5
+ * Функция может быть вызвана многократно, но пока выполняется,
6
+ * повторные вызовы будут **игнорироваться**.
7
+ *
8
+ * Полезно для:
9
+ * - кнопок Submit (защита от double click)
10
+ * - async side-effects, которые нельзя выполнять параллельно
11
+ * - любых операций, где нужен mutex на выполнение
12
+ *
13
+ * @template TArgs Тип аргументов callback-функции
14
+ * @param callback Асинхронная или синхронная функция, которую нужно защитить от параллельных вызовов
15
+ * @returns Функцию с той же сигнатурой, но блокирующую повторные вызовы пока выполняется
16
+ *
17
+ * @example
18
+ * const save = useLockedCallback(async (data: string) => {
19
+ * await api.save(data)
20
+ * })
21
+ *
22
+ * save('hello') // выполнится
23
+ * save('world') // проигнорируется, если предыдущий вызов ещё не завершился
24
+ */
25
+ export declare function useLockedCallback<TArgs extends Args>(callback: (...args: TArgs) => Promise<any> | void): (...args: TArgs) => void | Promise<any>;
26
+ export {};
@@ -0,0 +1 @@
1
+ export declare function useRefAdapter<T>(initialValue: T): readonly [() => T, (instance: T) => void];
@@ -0,0 +1,5 @@
1
+ type Fun = (...args: any[]) => any;
2
+ type ReturnType<T extends Fun | undefined> = T extends undefined ? (...args: any[]) => void : T;
3
+ export declare function useStableCallbackInvoke<T extends undefined>(callback: T): ReturnType<T>;
4
+ export declare function useStableCallbackInvoke<T extends Fun>(callback: T): ReturnType<T>;
5
+ export {};
@@ -0,0 +1,27 @@
1
+ type SetTimeoutFn = (callback: () => void, delay?: number) => void;
2
+ type ClearTimeoutFn = () => void;
3
+ /**
4
+ * React-хук для управления единичным таймером.
5
+ *
6
+ * Хук возвращает кортеж `[setTimeout, clearTimeout]`, который позволяет:
7
+ * - установить таймер, который выполнит переданную функцию через заданную задержку
8
+ * - сбросить активный таймер, если он существует
9
+ * - автоматически очищать таймер при размонтировании компонента
10
+ *
11
+ * Повторный вызов `setTimeout` сбрасывает предыдущий таймер.
12
+ *
13
+ * @example
14
+ * const [setTimeout, clearTimeout] = useTimeout()
15
+ *
16
+ * // Таймер сработает через 500 мс
17
+ * setTimeout(() => {
18
+ * console.log('Привет через 500 мс')
19
+ * }, 500)
20
+ *
21
+ * // Сброс таймера
22
+ * clearTimeout()
23
+ *
24
+ * @returns [setTimeout, clearTimeout] — функции для управления таймером
25
+ */
26
+ export declare function useTimeout(): [SetTimeoutFn, ClearTimeoutFn];
27
+ export {};
@@ -20,11 +20,16 @@ export type Undefinable<T> = undefined | (IsObject<T> extends true ? IsArray<T>
20
20
  [K in keyof T]?: T[K] | undefined;
21
21
  } : T);
22
22
  export type Merge<A extends Record<any, any>, B extends Record<any, any>> = Omit<A, keyof B> & B;
23
- export type AsProps<T extends ElementType, P extends Record<string, any> = {}, IR = React.ComponentRef<T>> = Merge<React.ComponentPropsWithoutRef<T>, {
23
+ type ComponentAttributes = {
24
+ [K in PropertyKey]: unknown;
25
+ };
26
+ export type AsProps<T extends ElementType, P extends ComponentAttributes = {}, IR = never> = Merge<React.ComponentPropsWithoutRef<T>, {
24
27
  as?: T;
25
- } & InstanceRefAttributes<IR> & P>;
28
+ } & (IR extends never ? {} : InstanceRefAttributes<IR>) & P>;
29
+ export type ComponentPropsWithoutInstanceRef<T extends ElementType> = Omit<React.ComponentProps<T>, keyof InstanceRefAttributes<T>>;
26
30
  export type InstanceRefAttributes<T> = {
27
- instanceRef?: React.Ref<T>;
31
+ instanceRef?: React.RefObject<T> | React.RefCallback<T> | null;
28
32
  };
29
- export type ComponentPropsWithoutInstanceRef<T extends ElementType> = Omit<React.ComponentProps<T>, keyof InstanceRefAttributes<T>>;
30
33
  export type ComponentInstanceRef<T extends ElementType> = React.ComponentProps<T> extends InstanceRefAttributes<infer Method> ? Method : never;
34
+ export type AcceptsComponentProps<T extends ElementType, P extends ComponentAttributes> = React.ComponentPropsWithoutRef<T> extends P ? T : never;
35
+ export {};
@@ -1,10 +1,12 @@
1
1
  import { default as React, ElementType } from 'react';
2
- import { AsProps, Merge } from '../../../types';
3
- type PropsType<T extends ElementType> = Merge<AsProps<T>, {
2
+ import { AsProps } from '../../../types';
3
+ type PropsType<T extends ElementType> = AsProps<T, {
4
+ text?: React.ReactNode;
5
+ icon?: React.ReactNode;
4
6
  current?: boolean;
5
7
  className?: string;
6
8
  children?: React.ReactNode;
7
9
  type?: 'text' | 'button-primary' | 'button-gray';
8
- }>;
10
+ }, React.ComponentRef<T>>;
9
11
  export declare function BreadcrumbButton<T extends ElementType = 'button'>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
10
12
  export {};
@@ -1,9 +1,10 @@
1
- import { AsProps, Merge } from '../../../types';
1
+ import { AsProps } from '../../../types';
2
2
  import { default as React, ElementType } from 'react';
3
3
  import { Divider } from './Divider';
4
- type PropsType<T extends ElementType> = Merge<AsProps<T>, {
4
+ type PropsType<T extends ElementType> = AsProps<T, {
5
5
  children?: React.ReactNode;
6
+ className?: string;
6
7
  type?: React.ComponentProps<typeof Divider>['type'];
7
- }>;
8
+ }, React.ComponentRef<T>>;
8
9
  export declare function Breadcrumbs<T extends ElementType = 'div'>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -43,4 +43,4 @@ export type ButtonPropsType<T extends React.ElementType> = AsProps<T, {
43
43
  theme?: "light" | "dark" | undefined;
44
44
  isLoading?: boolean;
45
45
  counter?: React.ReactNode;
46
- }>;
46
+ }, React.ComponentProps<'button'>>;
@@ -8,7 +8,8 @@ type PropsType<C extends ElementType, W extends ElementType> = AsProps<C, {
8
8
  wrapperStyle?: CSSProperties;
9
9
  onUpdateState?: (state: CollapseState) => void;
10
10
  initialState?: CollapseState;
11
- }>;
11
+ style?: CSSProperties;
12
+ }, React.ComponentRef<C>>;
12
13
  type RefType = Omit<CollapsibleReturnType, 'getWrapperInitStyle' | 'getContentInitStyle'>;
13
14
  /**
14
15
  * Collapse — полиморфный JSX-компонент, являющийся компонентной реализацией хука `useCollapsible`.
@@ -7,7 +7,8 @@ type PropsType<T extends React.ElementType> = AsProps<T, {
7
7
  avatar?: string;
8
8
  subtitle?: React.ReactNode;
9
9
  icon?: React.ReactNode;
10
+ className?: string;
10
11
  size?: 'small' | 'medium';
11
- }>;
12
+ }, React.ComponentRef<T>>;
12
13
  export declare function DropdownItemV2<T extends React.ElementType = 'li'>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
13
14
  export {};
@@ -7,7 +7,7 @@ type PropsType<T extends React.ElementType> = AsProps<T, {
7
7
  label?: React.ReactNode;
8
8
  onClose?: () => void;
9
9
  active?: boolean;
10
- }>;
10
+ }, React.ComponentRef<T>>;
11
11
  export declare const _FilterTag: <T extends React.ElementType>(props: PropsType<T>, ref: React.Ref<RefType<T>>) => import("react/jsx-runtime").JSX.Element;
12
12
  export declare const FilterTag: <T extends React.ElementType = "button">(props: PropsType<T> & React.RefAttributes<RefType<T>>) => JSX.Element;
13
13
  export {};
@@ -4,6 +4,6 @@ type PropsType<T extends React.ElementType> = AsProps<T, {
4
4
  count?: React.ReactNode;
5
5
  color?: 'gray' | 'color' | 'white';
6
6
  size?: 'small' | 'medium' | 'large';
7
- }>;
7
+ }, React.ComponentRef<T>>;
8
8
  export declare function TagCount<T extends React.ElementType = 'span'>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -9,8 +9,9 @@ type PropsType<T extends React.ElementType> = AsProps<T, {
9
9
  error?: boolean;
10
10
  hover?: boolean;
11
11
  disabled?: boolean;
12
+ className?: string;
12
13
  /** @deprecated */
13
14
  theme?: "light" | "dark";
14
- }>;
15
+ }, React.ComponentRef<T>>;
15
16
  export declare function ToggleBase<T extends React.ElementType>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
16
17
  export {};
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { AsProps } from '../../../types';
2
3
  export type PropsType = AsProps<'div', {
3
4
  /**
@@ -12,5 +13,5 @@ export type PropsType = AsProps<'div', {
12
13
  * */
13
14
  size?: '20' | '24' | '32' | '40' | '48' | '64' | '72' | '80' | '96' | '120' | '144' | '160' | number;
14
15
  disabled?: boolean;
15
- }>;
16
+ }, React.ComponentRef<'div'>>;
16
17
  export declare function UserPick(props: PropsType): import("react/jsx-runtime").JSX.Element;
@@ -29,3 +29,4 @@ export * from './formFields';
29
29
  export * from './Breadcrumbs';
30
30
  export * from './DropdownV2';
31
31
  export * from './Collapse';
32
+ export * from './visual';
@@ -0,0 +1 @@
1
+ export * from './useScrollHint';
@@ -0,0 +1,7 @@
1
+ import { ElementType } from 'react';
2
+ import { InstanceRef, PropsType as _PropsType } from '../types';
3
+ type PropsType<T extends ElementType> = Pick<_PropsType<T>, "instanceRef">;
4
+ export declare function useContainer<T extends ElementType>(props: PropsType<T>): {
5
+ containerRef: import('react').RefObject<InstanceRef<T>>;
6
+ };
7
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ScrollDirectionOptions } from '../../../../hooks';
2
+ type PropsType = ScrollDirectionOptions;
3
+ export declare function useHintPosition(props: PropsType): {
4
+ calcHorizontalHintPosition: (scroll: number, scrollSize: number, clientSize: number) => {
5
+ start: number;
6
+ end: number;
7
+ };
8
+ calcVerticalHintPosition: (scroll: number, scrollSize: number, clientSize: number) => {
9
+ start: number;
10
+ end: number;
11
+ };
12
+ };
13
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ElementType } from 'react';
2
+ import { DefaultElementType, PropsType } from '../types';
3
+ export declare function useScrollHint<T extends ElementType = DefaultElementType>(props: PropsType<T>): {};
@@ -0,0 +1,7 @@
1
+ import { ElementType } from 'react';
2
+ import { useContainer } from './useContainer';
3
+ type PropsType<T extends ElementType> = Pick<ReturnType<typeof useContainer<T>>, 'containerRef'> & {
4
+ onScrollHandler: (ev: Event) => void;
5
+ };
6
+ export declare function useScrollListener<T extends ElementType>(props: PropsType<T>): {};
7
+ export {};
@@ -0,0 +1 @@
1
+ export * from './ui';
@@ -0,0 +1 @@
1
+ export { default as HintStyle } from './Hint.module.scss';
@@ -0,0 +1 @@
1
+ export { default as ScrollHintStyle } from './ScrollHint.module.scss';