@mantine/hooks
Advanced tools
Comparing version 7.1.3 to 7.1.4
@@ -18,3 +18,3 @@ 'use client'; | ||
try { | ||
return JSON.parse(value); | ||
return value && JSON.parse(value); | ||
} catch (e) { | ||
@@ -21,0 +21,0 @@ return value; |
export declare function useDisclosure(initialState?: boolean, callbacks?: { | ||
onOpen?(): void; | ||
onClose?(): void; | ||
onOpen?: () => void; | ||
onClose?: () => void; | ||
}): readonly [boolean, { | ||
@@ -5,0 +5,0 @@ readonly open: () => void; |
/// <reference types="react" /> | ||
export interface UseFocusWithinOptions { | ||
onFocus?(event: FocusEvent): void; | ||
onBlur?(event: FocusEvent): void; | ||
onFocus?: (event: FocusEvent) => void; | ||
onBlur?: (event: FocusEvent) => void; | ||
} | ||
@@ -6,0 +6,0 @@ export declare function useFocusWithin<T extends HTMLElement = any>({ onBlur, onFocus, }?: UseFocusWithinOptions): { |
@@ -8,9 +8,9 @@ export declare const isFixed: (current: number, fixedAt: number) => boolean; | ||
/** Called when element is pinned */ | ||
onPin?(): void; | ||
onPin?: () => void; | ||
/** Called when element is at fixed position */ | ||
onFix?(): void; | ||
onFix?: () => void; | ||
/** Called when element is unpinned */ | ||
onRelease?(): void; | ||
onRelease?: () => void; | ||
} | ||
export declare function useHeadroom({ fixedAt, onPin, onFix, onRelease }?: UseHeadroomInput): boolean; | ||
export {}; |
@@ -10,6 +10,6 @@ export type StorageType = 'localStorage' | 'sessionStorage'; | ||
/** Function to serialize value into string to be save in storage */ | ||
serialize?(value: T): string; | ||
serialize?: (value: T) => string; | ||
/** Function to deserialize string value from storage to value */ | ||
deserialize?(value: string | undefined): T; | ||
deserialize?: (value: string | undefined) => T; | ||
} | ||
export declare function createStorage<T>(type: StorageType, hookName: string): ({ key, defaultValue, getInitialValueInEffect, deserialize, serialize, }: StorageProperties<T>) => readonly [T | undefined, (val: T | ((prevState: T) => T)) => void, () => void]; |
@@ -11,4 +11,4 @@ /// <reference types="react" /> | ||
interface useMoveHandlers { | ||
onScrubStart?(): void; | ||
onScrubEnd?(): void; | ||
onScrubStart?: () => void; | ||
onScrubEnd?: () => void; | ||
} | ||
@@ -15,0 +15,0 @@ export declare function useMove<T extends HTMLElement = HTMLDivElement>(onChange: (value: UseMovePosition) => void, handlers?: useMoveHandlers, dir?: 'ltr' | 'rtl'): { |
@@ -9,5 +9,5 @@ interface UseUncontrolledInput<T> { | ||
/** Controlled state onChange handler */ | ||
onChange?(value: T): void; | ||
onChange?: (value: T) => void; | ||
} | ||
export declare function useUncontrolled<T>({ value, defaultValue, finalValue, onChange, }: UseUncontrolledInput<T>): [T, (value: T) => void, boolean]; | ||
export {}; |
{ | ||
"name": "@mantine/hooks", | ||
"version": "7.1.3", | ||
"version": "7.1.4", | ||
"main": "./cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
535893