@websolutespa/bom-mixer-hooks 1.8.7 → 1.8.9
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 +12 -0
- package/dist/index.d.ts +42 -2
- package/dist/index.js +376 -141
- package/dist/index.mjs +305 -77
- package/package.json +1 -1
- package/src/index.ts +5 -0
- package/src/useAutosizeTextArea/useAutosizeTextArea.ts +13 -0
- package/src/useBreakpoint/useBreakpoint.default.ts +1 -9
- package/src/useColorScheme/useColorScheme.ts +106 -0
- package/src/useFocusTrap/useFocusTrap.ts +47 -0
- package/src/useGenericContext/useGenericContext.ts +1 -1
- package/src/usePage/usePage.tsx +0 -1
- package/src/useReducedMotion/useReducedMotion.ts +98 -0
- package/src/useReducedMotion/useReducedMotionLocal.ts +19 -0
- package/src/useWindowSize/useWindowSize.test.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-hooks
|
|
2
2
|
|
|
3
|
+
## 1.8.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3a7fc91: Added: useAutosizeTextArea, useColorScheme, useFocusTrap, useReducedMotion
|
|
8
|
+
|
|
9
|
+
## 1.8.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Modified: useGenericContext returning context
|
|
14
|
+
|
|
3
15
|
## 1.8.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ type Api = {
|
|
|
22
22
|
};
|
|
23
23
|
declare function useApi(): Api;
|
|
24
24
|
|
|
25
|
+
declare function useAutosizeTextArea(textAreaRef: HTMLTextAreaElement | null, value: string): void;
|
|
26
|
+
|
|
25
27
|
declare function useBodyScroll(elementRef?: RefObject<HTMLElement> | null, options?: BodyScrollOptions): [boolean, Dispatch<SetStateAction<boolean>>];
|
|
26
28
|
declare function getOwnerPaddingRight(element: Element): number;
|
|
27
29
|
declare function getOwnerScrollbarWidth(element: Element): number;
|
|
@@ -87,6 +89,20 @@ declare function useCollectionApiPut<T = unknown>(pathname: string, payload: unk
|
|
|
87
89
|
declare function useCollectionApiPatch<T = unknown>(pathname: string, payload: unknown, options?: ApiRequestOptions): [T | undefined, boolean, any, react.Dispatch<any>];
|
|
88
90
|
declare function useCollectionApiDelete<T = unknown>(pathname: string, options?: ApiRequestOptions): [T | undefined, boolean, any, react.Dispatch<any>];
|
|
89
91
|
|
|
92
|
+
type ColorScheme = ('light' | 'dark') & string;
|
|
93
|
+
type Props$1 = {
|
|
94
|
+
colorScheme: ColorScheme;
|
|
95
|
+
};
|
|
96
|
+
type Actions$1 = {
|
|
97
|
+
setColorScheme(colorScheme: ColorScheme): void;
|
|
98
|
+
toggleColorScheme(): void;
|
|
99
|
+
};
|
|
100
|
+
type State$1 = Props$1 & {
|
|
101
|
+
actions: Actions$1;
|
|
102
|
+
};
|
|
103
|
+
declare function getPreferredColorScheme(): ColorScheme;
|
|
104
|
+
declare function useColorScheme<T>(selector: (state: State$1) => T): T;
|
|
105
|
+
|
|
90
106
|
declare function useCurrency(currency?: string, locale?: string): (value: number) => string;
|
|
91
107
|
|
|
92
108
|
declare function useCurrentState<S>(initialState: S | (() => S)): CurrentStateType<S>;
|
|
@@ -200,7 +216,12 @@ type UseFiltersResultType<T> = {
|
|
|
200
216
|
itemsWithOmittedKeys: (...keys: string[]) => T[];
|
|
201
217
|
};
|
|
202
218
|
|
|
203
|
-
declare
|
|
219
|
+
declare function useFocusTrap<T extends HTMLElement>(ref: MutableRefObject<T | null>, options?: {
|
|
220
|
+
disabled?: boolean;
|
|
221
|
+
selectors?: string;
|
|
222
|
+
}): [boolean, (value: boolean) => void];
|
|
223
|
+
|
|
224
|
+
declare const createGenericContext: <T>(defaultContext?: T | null) => readonly [() => NonNullable<T>, react.Provider<T | undefined>, react.Context<T | undefined>];
|
|
204
225
|
|
|
205
226
|
/**
|
|
206
227
|
* @desc Made compatible with {GeolocationPositionError} and {PositionError} cause
|
|
@@ -449,6 +470,25 @@ type SizeResult = [SizeType, () => void];
|
|
|
449
470
|
declare function useRealSize<T extends HTMLElement>(ref: MutableRefObject<T | null>): SizeResult;
|
|
450
471
|
declare function getRealSize(element: HTMLElement | null): SizeType;
|
|
451
472
|
|
|
473
|
+
type Props = {
|
|
474
|
+
reducedMotion: boolean;
|
|
475
|
+
};
|
|
476
|
+
type Actions = {
|
|
477
|
+
setReducedMotion(reducedMotion: boolean): void;
|
|
478
|
+
toggleReducedMotion(): void;
|
|
479
|
+
};
|
|
480
|
+
type State = Props & {
|
|
481
|
+
actions: Actions;
|
|
482
|
+
};
|
|
483
|
+
declare function getPreferredReducedMotion(): boolean;
|
|
484
|
+
declare function useReducedMotion<T>(selector: (state: State) => T): T;
|
|
485
|
+
|
|
486
|
+
declare function useReducedMotionLocal(): {
|
|
487
|
+
reducedMotionLocal: boolean;
|
|
488
|
+
setReducedMotionLocal: (reducedMotionLocal: boolean) => void;
|
|
489
|
+
toggleReducedMotionLocal: () => void;
|
|
490
|
+
};
|
|
491
|
+
|
|
452
492
|
declare function useResize(callback: () => unknown, immediate?: boolean): void;
|
|
453
493
|
|
|
454
494
|
type Scroll = {
|
|
@@ -574,4 +614,4 @@ type WindowSize = {
|
|
|
574
614
|
};
|
|
575
615
|
declare function useWindowSize(): WindowSize;
|
|
576
616
|
|
|
577
|
-
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPageRoute, IPageRouteOptions, 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 };
|
|
617
|
+
export { BodyScrollOptions, ClickOutGetContainer, ColorScheme, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPageRoute, IPageRouteOptions, 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, getPreferredColorScheme, getPreferredReducedMotion, 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, useAutosizeTextArea, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useColorScheme, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useFocusTrap, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePageLoading, usePagination, usePortal, usePrevious, useRealSize, useReducedMotion, useReducedMotionLocal, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|