@websolutespa/bom-mixer-hooks 1.8.2 → 1.8.3
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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +30 -16
- package/dist/index.js +174 -192
- package/dist/index.mjs +143 -162
- package/package.json +1 -1
- package/src/index.ts +3 -2
- package/src/useFilters/useFilters.test.ts +1 -1
- package/src/usePageLoading/usePageLoading.ts +64 -0
- package/src/useSearchParams/useSearchParams.ts +17 -52
- package/src/useSearchParamsEncoded/useSearchParamsEncoded.ts +13 -39
- package/src/useSearchParamsQs/useSearchParamsQs.ts +13 -39
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -396,6 +396,20 @@ declare function PageProvider({ children, page }: {
|
|
|
396
396
|
page: IPage;
|
|
397
397
|
}): react_jsx_runtime.JSX.Element;
|
|
398
398
|
|
|
399
|
+
type IPageRoute = {
|
|
400
|
+
pathname: string;
|
|
401
|
+
query: Record<string, string>;
|
|
402
|
+
asPath: string;
|
|
403
|
+
};
|
|
404
|
+
declare function usePageLoading(options?: {
|
|
405
|
+
loading: boolean;
|
|
406
|
+
}): {
|
|
407
|
+
loading: boolean;
|
|
408
|
+
error: void | Error | undefined;
|
|
409
|
+
pageRoute: IPageRoute | undefined;
|
|
410
|
+
previousPageRoute: IPageRoute | undefined;
|
|
411
|
+
};
|
|
412
|
+
|
|
399
413
|
type IPaginationInfo<T = any> = {
|
|
400
414
|
items: T[];
|
|
401
415
|
page: number;
|
|
@@ -434,26 +448,19 @@ declare function getRealSize(element: HTMLElement | null): SizeType;
|
|
|
434
448
|
|
|
435
449
|
declare function useResize(callback: () => unknown, immediate?: boolean): void;
|
|
436
450
|
|
|
437
|
-
type SSRState = {
|
|
438
|
-
isBrowser: boolean;
|
|
439
|
-
isServer: boolean;
|
|
440
|
-
};
|
|
441
|
-
declare const detectIsBrowser: () => boolean;
|
|
442
|
-
declare function useSSR(): SSRState;
|
|
443
|
-
|
|
444
451
|
type Scroll = {
|
|
445
452
|
left: number;
|
|
446
453
|
top: number;
|
|
447
454
|
};
|
|
448
455
|
declare function useScroll(): Scroll;
|
|
449
456
|
|
|
457
|
+
declare function useScrolled(callback?: (top: number, left: number) => boolean): boolean;
|
|
458
|
+
|
|
450
459
|
declare function useScrollTo(offset?: number): (event: React.MouseEvent<HTMLElement>) => void;
|
|
451
460
|
declare function scrollToSelector(selector?: string, offset?: number): void;
|
|
452
461
|
declare function scrollToRelativeY(y?: number, offset?: number): void;
|
|
453
462
|
declare function scrollToY(y?: number): void;
|
|
454
463
|
|
|
455
|
-
declare function useScrolled(callback?: (top: number, left: number) => boolean): boolean;
|
|
456
|
-
|
|
457
464
|
declare function getSearchParams(url: string, key?: string): IParams | string | null;
|
|
458
465
|
declare function updateSearchParams(currentPath: string, params: IParams): {
|
|
459
466
|
pathname: string;
|
|
@@ -462,9 +469,9 @@ declare function updateSearchParams(currentPath: string, params: IParams): {
|
|
|
462
469
|
};
|
|
463
470
|
};
|
|
464
471
|
declare function pushSearchParams(router: NextRouter, params: IParams): void;
|
|
465
|
-
declare function pushSearchParamsSilently(params: IParams): void;
|
|
472
|
+
declare function pushSearchParamsSilently(router: NextRouter, params: IParams): void;
|
|
466
473
|
declare function replaceSearchParams(router: NextRouter, params: IParams): void;
|
|
467
|
-
declare function replaceSearchParamsSilently(params: IParams): void;
|
|
474
|
+
declare function replaceSearchParamsSilently(router: NextRouter, params: IParams): void;
|
|
468
475
|
type IParams = {
|
|
469
476
|
[key: string]: string;
|
|
470
477
|
};
|
|
@@ -489,9 +496,9 @@ declare function updateSearchParamsEncoded(currentPath: string, value: IParamsEn
|
|
|
489
496
|
};
|
|
490
497
|
};
|
|
491
498
|
declare function pushSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
492
|
-
declare function pushSearchParamsEncodedSilently(value: IParamsEncoded, key?: string): void;
|
|
499
|
+
declare function pushSearchParamsEncodedSilently(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
493
500
|
declare function replaceSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
494
|
-
declare function replaceSearchParamsEncodedSilently(value: IParamsEncoded, key?: string): void;
|
|
501
|
+
declare function replaceSearchParamsEncodedSilently(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
495
502
|
type IParamsEncoded = {
|
|
496
503
|
[key: string]: any;
|
|
497
504
|
} | null;
|
|
@@ -518,9 +525,9 @@ declare function updateSearchParamsQs(url: string, value: IParamsQs, key?: strin
|
|
|
518
525
|
query: string;
|
|
519
526
|
};
|
|
520
527
|
declare function pushSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
521
|
-
declare function pushSearchParamsQsSilently(value: IParamsQs, key?: string): void;
|
|
528
|
+
declare function pushSearchParamsQsSilently(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
522
529
|
declare function replaceSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
523
|
-
declare function replaceSearchParamsQsSilently(value: IParamsQs, key?: string): void;
|
|
530
|
+
declare function replaceSearchParamsQsSilently(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
524
531
|
declare function useSearchParamsQs(key?: string): IUseSearchParamsQsResult;
|
|
525
532
|
|
|
526
533
|
type Sorting<T> = {
|
|
@@ -533,6 +540,13 @@ declare function useSorting<T>(items_: T[], callback_: (items: T[], sort?: IEqua
|
|
|
533
540
|
setSort: (sort?: IEquatable) => void;
|
|
534
541
|
};
|
|
535
542
|
|
|
543
|
+
type SSRState = {
|
|
544
|
+
isBrowser: boolean;
|
|
545
|
+
isServer: boolean;
|
|
546
|
+
};
|
|
547
|
+
declare const detectIsBrowser: () => boolean;
|
|
548
|
+
declare function useSSR(): SSRState;
|
|
549
|
+
|
|
536
550
|
/**
|
|
537
551
|
* Like `useRef`, but it returns immutable ref that contains actual value.
|
|
538
552
|
*
|
|
@@ -557,4 +571,4 @@ type WindowSize = {
|
|
|
557
571
|
};
|
|
558
572
|
declare function useWindowSize(): WindowSize;
|
|
559
573
|
|
|
560
|
-
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsEncodedSilently, pushSearchParamsQs, pushSearchParamsQsSilently, pushSearchParamsSilently, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|
|
574
|
+
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPageRoute, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsEncodedSilently, pushSearchParamsQs, pushSearchParamsQsSilently, pushSearchParamsSilently, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePageLoading, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|