@react-md/utils
Advanced tools
Comparing version 2.0.0-alpha.13 to 2.0.0-alpha.14
@@ -24,3 +24,3 @@ var delegatedEvents = []; | ||
if (!throttle) { | ||
runCallbacks(event); | ||
runCallbacks(event)(); | ||
return; | ||
@@ -27,0 +27,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export { useInteractionModeContext, InteractionModeListener, } from "./InteractionMode"; | ||
export { useUserInteractionMode, useIsUserInteractionMode, InteractionModeListener, } from "./InteractionMode"; | ||
//# sourceMappingURL=index.js.map |
@@ -9,6 +9,16 @@ import React, { createContext, useContext, } from "react"; | ||
*/ | ||
export function useInteractionModeContext() { | ||
export function useUserInteractionMode() { | ||
return useContext(InteractionMode); | ||
} | ||
/** | ||
* Checks if the provided user interaction mode matches the current interaction | ||
* mode within the app. | ||
* | ||
* @param mode The mode to check against. | ||
* @return true if the mode matches. | ||
*/ | ||
export function useIsUserInteractionMode(mode) { | ||
return useUserInteractionMode() === mode; | ||
} | ||
/** | ||
* A component that should be mounted once in your app near the top of the tree | ||
@@ -15,0 +25,0 @@ * to determine the current interaction mode for your app. |
@@ -29,3 +29,3 @@ var __assign = (this && this.__assign) || function () { | ||
function FocusContainer(_a, forwardedRef) { | ||
var children = _a.children, onKeyDown = _a.onKeyDown, _b = _a.component, Component = _b === void 0 ? "div" : _b, _c = _a.defaultFocus, defaultFocus = _c === void 0 ? "first" : _c, _d = _a.disableFocusCache, disableFocusCache = _d === void 0 ? false : _d, _e = _a.disableFocusOnMount, disableFocusOnMount = _e === void 0 ? false : _e, _f = _a.disableFocusOnUnmount, disableFocusOnUnmount = _f === void 0 ? false : _f, _g = _a.disableTabFocusWrap, disableTabFocusWrap = _g === void 0 ? false : _g, _h = _a.unmountFocusFallback, unmountFocusFallback = _h === void 0 ? "" : _h, props = __rest(_a, ["children", "onKeyDown", "component", "defaultFocus", "disableFocusCache", "disableFocusOnMount", "disableFocusOnUnmount", "disableTabFocusWrap", "unmountFocusFallback"]); | ||
var children = _a.children, onKeyDown = _a.onKeyDown, _b = _a.component, Component = _b === void 0 ? "div" : _b, _c = _a.defaultFocus, defaultFocus = _c === void 0 ? "first" : _c, _d = _a.disableFocusCache, disableFocusCache = _d === void 0 ? false : _d, _e = _a.disableFocusOnMount, disableFocusOnMount = _e === void 0 ? false : _e, _f = _a.disableFocusOnMountScroll, disableFocusOnMountScroll = _f === void 0 ? false : _f, _g = _a.disableFocusOnUnmount, disableFocusOnUnmount = _g === void 0 ? false : _g, _h = _a.disableTabFocusWrap, disableTabFocusWrap = _h === void 0 ? false : _h, _j = _a.unmountFocusFallback, unmountFocusFallback = _j === void 0 ? "" : _j, props = __rest(_a, ["children", "onKeyDown", "component", "defaultFocus", "disableFocusCache", "disableFocusOnMount", "disableFocusOnMountScroll", "disableFocusOnUnmount", "disableTabFocusWrap", "unmountFocusFallback"]); | ||
var ref = useRef(null); | ||
@@ -37,3 +37,3 @@ var refHandler = useCallback(function (instance) { | ||
usePreviousFocus(disableFocusOnUnmount, unmountFocusFallback); | ||
useFocusOnMount(ref, defaultFocus, false, disableFocusOnMount); | ||
useFocusOnMount(ref, defaultFocus, disableFocusOnMountScroll, false, disableFocusOnMount); | ||
var handleKeyDown = useTabFocusWrap({ | ||
@@ -40,0 +40,0 @@ disabled: disableTabFocusWrap, |
@@ -11,7 +11,11 @@ import getFocusableElements from "./getFocusableElements"; | ||
* focusable element within the container. | ||
* @param preventScroll Boolean if the focus event should not scroll the element | ||
* into view. This should normally remain `false`, but can be useful if the | ||
* element gets focused while offscreen during a transition. | ||
* @param progamatic Boolean if programatically focusable elements should be | ||
* included as well. | ||
*/ | ||
export default function focusElementWithin(container, focus, programatic, elements) { | ||
export default function focusElementWithin(container, focus, programatic, preventScroll, elements) { | ||
if (programatic === void 0) { programatic = false; } | ||
if (preventScroll === void 0) { preventScroll = false; } | ||
if (!elements || !elements.length) { | ||
@@ -34,4 +38,4 @@ elements = getFocusableElements(container, programatic); | ||
} | ||
el.focus(); | ||
el.focus({ preventScroll: preventScroll }); | ||
} | ||
//# sourceMappingURL=focusElementWithin.js.map |
@@ -43,3 +43,3 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
export default function useKeyboardMovement(_a) { | ||
var onKeyDown = _a.onKeyDown, incrementKeys = _a.incrementKeys, decrementKeys = _a.decrementKeys, jumpToFirstKeys = _a.jumpToFirstKeys, jumpToLastKeys = _a.jumpToLastKeys, _b = _a.stopPropagation, stopPropagation = _b === void 0 ? false : _b, onChange = _a.onChange, items = _a.items, resetTime = _a.resetTime, findMatchIndex = _a.findMatchIndex, focusedIndex = _a.focusedIndex, _c = _a.loopable, loopable = _c === void 0 ? true : _c, _d = _a.searchable, searchable = _d === void 0 ? true : _d, _e = _a.valueKey, valueKey = _e === void 0 ? DEFAULT_VALUE_KEY : _e, _f = _a.getItemValue, getItemValue = _f === void 0 ? DEFAULT_GET_ITEM_VALUE : _f; | ||
var onKeyDown = _a.onKeyDown, incrementKeys = _a.incrementKeys, decrementKeys = _a.decrementKeys, jumpToFirstKeys = _a.jumpToFirstKeys, jumpToLastKeys = _a.jumpToLastKeys, _b = _a.stopPropagation, stopPropagation = _b === void 0 ? true : _b, onChange = _a.onChange, items = _a.items, resetTime = _a.resetTime, findMatchIndex = _a.findMatchIndex, focusedIndex = _a.focusedIndex, _c = _a.loopable, loopable = _c === void 0 ? true : _c, _d = _a.searchable, searchable = _d === void 0 ? true : _d, _e = _a.valueKey, valueKey = _e === void 0 ? DEFAULT_VALUE_KEY : _e, _f = _a.getItemValue, getItemValue = _f === void 0 ? DEFAULT_GET_ITEM_VALUE : _f; | ||
var keys = useMemo(function () { return __spreadArrays(transformKeys(incrementKeys, "increment"), transformKeys(decrementKeys, "decrement"), transformKeys(jumpToFirstKeys, "first"), transformKeys(jumpToLastKeys, "last")); }, [incrementKeys, decrementKeys, jumpToFirstKeys, jumpToLastKeys]); | ||
@@ -46,0 +46,0 @@ var itemRefs = useMemo(function () { return Array.from(items, function () { return ({ current: null }); }); }, [items]); |
@@ -19,2 +19,6 @@ import { useEffect } from "react"; | ||
* focus. | ||
* @param preventScroll Boolean if the focus events should try to prevent the | ||
* default scroll-into-view behavior. This is generally recommended to be kept | ||
* as `false`, but can be useful to enable if the component mounts offscreen | ||
* during a transition. | ||
* @param programatic Boolean if programatically focusable elements should be | ||
@@ -24,3 +28,4 @@ * included instead of only tab focusable. | ||
*/ | ||
export default function useFocusOnMount(refOrInstance, defaultFocus, programatic, disabled) { | ||
export default function useFocusOnMount(refOrInstance, defaultFocus, preventScroll, programatic, disabled) { | ||
if (preventScroll === void 0) { preventScroll = false; } | ||
if (programatic === void 0) { programatic = false; } | ||
@@ -37,4 +42,4 @@ if (disabled === void 0) { disabled = false; } | ||
} | ||
instance.focus(); | ||
focusElementWithin(instance, defaultFocus, programatic); | ||
instance.focus({ preventScroll: preventScroll }); | ||
focusElementWithin(instance, defaultFocus, programatic, preventScroll); | ||
}); | ||
@@ -41,0 +46,0 @@ return function () { |
@@ -26,3 +26,3 @@ "use strict"; | ||
if (!throttle) { | ||
runCallbacks(event); | ||
runCallbacks(event)(); | ||
return; | ||
@@ -29,0 +29,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var InteractionMode_1 = require("./InteractionMode"); | ||
exports.useInteractionModeContext = InteractionMode_1.useInteractionModeContext; | ||
exports.useUserInteractionMode = InteractionMode_1.useUserInteractionMode; | ||
exports.useIsUserInteractionMode = InteractionMode_1.useIsUserInteractionMode; | ||
exports.InteractionModeListener = InteractionMode_1.InteractionModeListener; | ||
//# sourceMappingURL=index.js.map |
@@ -21,7 +21,18 @@ "use strict"; | ||
*/ | ||
function useInteractionModeContext() { | ||
function useUserInteractionMode() { | ||
return react_1.useContext(InteractionMode); | ||
} | ||
exports.useInteractionModeContext = useInteractionModeContext; | ||
exports.useUserInteractionMode = useUserInteractionMode; | ||
/** | ||
* Checks if the provided user interaction mode matches the current interaction | ||
* mode within the app. | ||
* | ||
* @param mode The mode to check against. | ||
* @return true if the mode matches. | ||
*/ | ||
function useIsUserInteractionMode(mode) { | ||
return useUserInteractionMode() === mode; | ||
} | ||
exports.useIsUserInteractionMode = useIsUserInteractionMode; | ||
/** | ||
* A component that should be mounted once in your app near the top of the tree | ||
@@ -28,0 +39,0 @@ * to determine the current interaction mode for your app. |
@@ -41,3 +41,3 @@ "use strict"; | ||
function FocusContainer(_a, forwardedRef) { | ||
var children = _a.children, onKeyDown = _a.onKeyDown, _b = _a.component, Component = _b === void 0 ? "div" : _b, _c = _a.defaultFocus, defaultFocus = _c === void 0 ? "first" : _c, _d = _a.disableFocusCache, disableFocusCache = _d === void 0 ? false : _d, _e = _a.disableFocusOnMount, disableFocusOnMount = _e === void 0 ? false : _e, _f = _a.disableFocusOnUnmount, disableFocusOnUnmount = _f === void 0 ? false : _f, _g = _a.disableTabFocusWrap, disableTabFocusWrap = _g === void 0 ? false : _g, _h = _a.unmountFocusFallback, unmountFocusFallback = _h === void 0 ? "" : _h, props = __rest(_a, ["children", "onKeyDown", "component", "defaultFocus", "disableFocusCache", "disableFocusOnMount", "disableFocusOnUnmount", "disableTabFocusWrap", "unmountFocusFallback"]); | ||
var children = _a.children, onKeyDown = _a.onKeyDown, _b = _a.component, Component = _b === void 0 ? "div" : _b, _c = _a.defaultFocus, defaultFocus = _c === void 0 ? "first" : _c, _d = _a.disableFocusCache, disableFocusCache = _d === void 0 ? false : _d, _e = _a.disableFocusOnMount, disableFocusOnMount = _e === void 0 ? false : _e, _f = _a.disableFocusOnMountScroll, disableFocusOnMountScroll = _f === void 0 ? false : _f, _g = _a.disableFocusOnUnmount, disableFocusOnUnmount = _g === void 0 ? false : _g, _h = _a.disableTabFocusWrap, disableTabFocusWrap = _h === void 0 ? false : _h, _j = _a.unmountFocusFallback, unmountFocusFallback = _j === void 0 ? "" : _j, props = __rest(_a, ["children", "onKeyDown", "component", "defaultFocus", "disableFocusCache", "disableFocusOnMount", "disableFocusOnMountScroll", "disableFocusOnUnmount", "disableTabFocusWrap", "unmountFocusFallback"]); | ||
var ref = react_1.useRef(null); | ||
@@ -49,3 +49,3 @@ var refHandler = react_1.useCallback(function (instance) { | ||
usePreviousFocus_1.default(disableFocusOnUnmount, unmountFocusFallback); | ||
useFocusOnMount_1.default(ref, defaultFocus, false, disableFocusOnMount); | ||
useFocusOnMount_1.default(ref, defaultFocus, disableFocusOnMountScroll, false, disableFocusOnMount); | ||
var handleKeyDown = useTabFocusWrap_1.default({ | ||
@@ -52,0 +52,0 @@ disabled: disableTabFocusWrap, |
@@ -16,7 +16,11 @@ "use strict"; | ||
* focusable element within the container. | ||
* @param preventScroll Boolean if the focus event should not scroll the element | ||
* into view. This should normally remain `false`, but can be useful if the | ||
* element gets focused while offscreen during a transition. | ||
* @param progamatic Boolean if programatically focusable elements should be | ||
* included as well. | ||
*/ | ||
function focusElementWithin(container, focus, programatic, elements) { | ||
function focusElementWithin(container, focus, programatic, preventScroll, elements) { | ||
if (programatic === void 0) { programatic = false; } | ||
if (preventScroll === void 0) { preventScroll = false; } | ||
if (!elements || !elements.length) { | ||
@@ -39,5 +43,5 @@ elements = getFocusableElements_1.default(container, programatic); | ||
} | ||
el.focus(); | ||
el.focus({ preventScroll: preventScroll }); | ||
} | ||
exports.default = focusElementWithin; | ||
//# sourceMappingURL=focusElementWithin.js.map |
@@ -48,3 +48,3 @@ "use strict"; | ||
function useKeyboardMovement(_a) { | ||
var onKeyDown = _a.onKeyDown, incrementKeys = _a.incrementKeys, decrementKeys = _a.decrementKeys, jumpToFirstKeys = _a.jumpToFirstKeys, jumpToLastKeys = _a.jumpToLastKeys, _b = _a.stopPropagation, stopPropagation = _b === void 0 ? false : _b, onChange = _a.onChange, items = _a.items, resetTime = _a.resetTime, findMatchIndex = _a.findMatchIndex, focusedIndex = _a.focusedIndex, _c = _a.loopable, loopable = _c === void 0 ? true : _c, _d = _a.searchable, searchable = _d === void 0 ? true : _d, _e = _a.valueKey, valueKey = _e === void 0 ? utils_1.DEFAULT_VALUE_KEY : _e, _f = _a.getItemValue, getItemValue = _f === void 0 ? utils_1.DEFAULT_GET_ITEM_VALUE : _f; | ||
var onKeyDown = _a.onKeyDown, incrementKeys = _a.incrementKeys, decrementKeys = _a.decrementKeys, jumpToFirstKeys = _a.jumpToFirstKeys, jumpToLastKeys = _a.jumpToLastKeys, _b = _a.stopPropagation, stopPropagation = _b === void 0 ? true : _b, onChange = _a.onChange, items = _a.items, resetTime = _a.resetTime, findMatchIndex = _a.findMatchIndex, focusedIndex = _a.focusedIndex, _c = _a.loopable, loopable = _c === void 0 ? true : _c, _d = _a.searchable, searchable = _d === void 0 ? true : _d, _e = _a.valueKey, valueKey = _e === void 0 ? utils_1.DEFAULT_VALUE_KEY : _e, _f = _a.getItemValue, getItemValue = _f === void 0 ? utils_1.DEFAULT_GET_ITEM_VALUE : _f; | ||
var keys = react_1.useMemo(function () { return __spreadArrays(utils_2.transformKeys(incrementKeys, "increment"), utils_2.transformKeys(decrementKeys, "decrement"), utils_2.transformKeys(jumpToFirstKeys, "first"), utils_2.transformKeys(jumpToLastKeys, "last")); }, [incrementKeys, decrementKeys, jumpToFirstKeys, jumpToLastKeys]); | ||
@@ -51,0 +51,0 @@ var itemRefs = react_1.useMemo(function () { return Array.from(items, function () { return ({ current: null }); }); }, [items]); |
@@ -24,2 +24,6 @@ "use strict"; | ||
* focus. | ||
* @param preventScroll Boolean if the focus events should try to prevent the | ||
* default scroll-into-view behavior. This is generally recommended to be kept | ||
* as `false`, but can be useful to enable if the component mounts offscreen | ||
* during a transition. | ||
* @param programatic Boolean if programatically focusable elements should be | ||
@@ -29,3 +33,4 @@ * included instead of only tab focusable. | ||
*/ | ||
function useFocusOnMount(refOrInstance, defaultFocus, programatic, disabled) { | ||
function useFocusOnMount(refOrInstance, defaultFocus, preventScroll, programatic, disabled) { | ||
if (preventScroll === void 0) { preventScroll = false; } | ||
if (programatic === void 0) { programatic = false; } | ||
@@ -42,4 +47,4 @@ if (disabled === void 0) { disabled = false; } | ||
} | ||
instance.focus(); | ||
focusElementWithin_1.default(instance, defaultFocus, programatic); | ||
instance.focus({ preventScroll: preventScroll }); | ||
focusElementWithin_1.default(instance, defaultFocus, programatic, preventScroll); | ||
}); | ||
@@ -46,0 +51,0 @@ return function () { |
{ | ||
"name": "@react-md/utils", | ||
"version": "2.0.0-alpha.13", | ||
"version": "2.0.0-alpha.14", | ||
"description": "General utils for react-md.", | ||
@@ -45,3 +45,3 @@ "scripts": { | ||
}, | ||
"gitHead": "47959dd8c691deae0310c7cd01b3c275699e6f8c" | ||
"gitHead": "2c22440705bce3fb3cfc5876011e7b3df8be1c03" | ||
} |
@@ -58,3 +58,3 @@ export type DelegatedEventTarget = Window | Document | HTMLElement; | ||
if (!throttle) { | ||
runCallbacks(event); | ||
runCallbacks(event)(); | ||
return; | ||
@@ -61,0 +61,0 @@ } |
export { | ||
useInteractionModeContext, | ||
useUserInteractionMode, | ||
useIsUserInteractionMode, | ||
InteractionModeListener, | ||
} from "./InteractionMode"; | ||
export { UserInteractionMode } from "./useModeDetection"; |
@@ -30,5 +30,5 @@ import defaults from "../defaults"; | ||
query: string, | ||
searchable: T[], | ||
searchable: readonly T[], | ||
options: CaseInsensitiveOptions<T> = {} | ||
): T[] { | ||
): readonly T[] { | ||
const { | ||
@@ -35,0 +35,0 @@ getItemValue, |
@@ -24,5 +24,5 @@ import defaults from "../defaults"; | ||
query: string, | ||
searchable: T[], | ||
searchable: readonly T[], | ||
options: SearchOptions<T> = {} | ||
): T[] { | ||
): readonly T[] { | ||
const { getItemValue, valueKey, trim, ignoreWhitespace } = defaults( | ||
@@ -29,0 +29,0 @@ options, |
@@ -25,3 +25,3 @@ import React, { useCallback, useMemo } from "react"; | ||
*/ | ||
items: D[]; | ||
items: readonly D[]; | ||
@@ -60,3 +60,3 @@ /** | ||
*/ | ||
items: D[]; | ||
items: readonly D[]; | ||
@@ -63,0 +63,0 @@ /** |
@@ -52,5 +52,5 @@ import { mocked } from "ts-jest/utils"; | ||
getFocusableElements.mockClear(); | ||
focusElementWithin(ELEMENT, "first", false, [element1]); | ||
focusElementWithin(ELEMENT, "last", false, [element1]); | ||
focusElementWithin(ELEMENT, ".element", false, [element1]); | ||
focusElementWithin(ELEMENT, "first", false, false, [element1]); | ||
focusElementWithin(ELEMENT, "last", false, false, [element1]); | ||
focusElementWithin(ELEMENT, ".element", false, false, [element1]); | ||
expect(getFocusableElements).not.toBeCalled(); | ||
@@ -69,3 +69,3 @@ | ||
focus1.mockClear(); | ||
focusElementWithin(ELEMENT, "first", false, elements); | ||
focusElementWithin(ELEMENT, "first", false, false, elements); | ||
expect(focus1).toBeCalled(); | ||
@@ -84,3 +84,3 @@ expect(focus2).not.toBeCalled(); | ||
focus3.mockClear(); | ||
focusElementWithin(ELEMENT, "last", false, elements); | ||
focusElementWithin(ELEMENT, "last", false, false, elements); | ||
expect(focus1).not.toBeCalled(); | ||
@@ -109,3 +109,3 @@ expect(focus2).not.toBeCalled(); | ||
focus1.mockClear(); | ||
focusElementWithin(ELEMENT, ".query", false, elements); | ||
focusElementWithin(ELEMENT, ".query", false, false, elements); | ||
expect(focus1).toBeCalled(); | ||
@@ -122,3 +122,3 @@ expect(focus2).not.toBeCalled(); | ||
focus2.mockClear(); | ||
focusElementWithin(ELEMENT, ".query", false, elements); | ||
focusElementWithin(ELEMENT, ".query", false, false, elements); | ||
expect(focus1).not.toBeCalled(); | ||
@@ -135,3 +135,3 @@ expect(focus2).toBeCalled(); | ||
focus3.mockClear(); | ||
focusElementWithin(ELEMENT, ".query", false, elements); | ||
focusElementWithin(ELEMENT, ".query", false, false, elements); | ||
expect(focus1).not.toBeCalled(); | ||
@@ -138,0 +138,0 @@ expect(focus2).not.toBeCalled(); |
@@ -14,2 +14,5 @@ import getFocusableElements from "./getFocusableElements"; | ||
* focusable element within the container. | ||
* @param preventScroll Boolean if the focus event should not scroll the element | ||
* into view. This should normally remain `false`, but can be useful if the | ||
* element gets focused while offscreen during a transition. | ||
* @param progamatic Boolean if programatically focusable elements should be | ||
@@ -22,2 +25,3 @@ * included as well. | ||
programatic: boolean = false, | ||
preventScroll: boolean = false, | ||
elements?: HTMLElement[] | ||
@@ -45,3 +49,3 @@ ): void { | ||
el.focus(); | ||
el.focus({ preventScroll }); | ||
} |
@@ -149,3 +149,3 @@ import { MutableRefObject, useCallback, useMemo } from "react"; | ||
jumpToLastKeys, | ||
stopPropagation = false, | ||
stopPropagation = true, | ||
onChange, | ||
@@ -152,0 +152,0 @@ items, |
@@ -21,2 +21,6 @@ import { useEffect } from "react"; | ||
* focus. | ||
* @param preventScroll Boolean if the focus events should try to prevent the | ||
* default scroll-into-view behavior. This is generally recommended to be kept | ||
* as `false`, but can be useful to enable if the component mounts offscreen | ||
* during a transition. | ||
* @param programatic Boolean if programatically focusable elements should be | ||
@@ -29,2 +33,3 @@ * included instead of only tab focusable. | ||
defaultFocus: Focus, | ||
preventScroll: boolean = false, | ||
programatic: boolean = false, | ||
@@ -44,4 +49,4 @@ disabled: boolean = false | ||
instance.focus(); | ||
focusElementWithin(instance, defaultFocus, programatic); | ||
instance.focus({ preventScroll }); | ||
focusElementWithin(instance, defaultFocus, programatic, preventScroll); | ||
}); | ||
@@ -48,0 +53,0 @@ |
@@ -1,2 +0,2 @@ | ||
export { useInteractionModeContext, InteractionModeListener, } from "./InteractionMode"; | ||
export { useUserInteractionMode, useIsUserInteractionMode, InteractionModeListener, } from "./InteractionMode"; | ||
export { UserInteractionMode } from "./useModeDetection"; |
@@ -6,3 +6,11 @@ import { ReactElement, ReactNode } from "react"; | ||
*/ | ||
export declare function useInteractionModeContext(): UserInteractionMode; | ||
export declare function useUserInteractionMode(): UserInteractionMode; | ||
/** | ||
* Checks if the provided user interaction mode matches the current interaction | ||
* mode within the app. | ||
* | ||
* @param mode The mode to check against. | ||
* @return true if the mode matches. | ||
*/ | ||
export declare function useIsUserInteractionMode(mode: UserInteractionMode): boolean; | ||
export interface InteractionModeListenerProps { | ||
@@ -9,0 +17,0 @@ children: ReactNode; |
@@ -20,2 +20,2 @@ import { SearchOptions } from "./utils"; | ||
*/ | ||
export default function caseInsensitiveFilter<T = unknown>(query: string, searchable: T[], options?: CaseInsensitiveOptions<T>): T[]; | ||
export default function caseInsensitiveFilter<T = unknown>(query: string, searchable: readonly T[], options?: CaseInsensitiveOptions<T>): readonly T[]; |
@@ -14,2 +14,2 @@ import { SearchOptions } from "./utils"; | ||
*/ | ||
export default function fuzzyFilter<T = unknown>(query: string, searchable: T[], options?: SearchOptions<T>): T[]; | ||
export default function fuzzyFilter<T = unknown>(query: string, searchable: readonly T[], options?: SearchOptions<T>): readonly T[]; |
@@ -17,3 +17,3 @@ import React from "react"; | ||
*/ | ||
items: D[]; | ||
items: readonly D[]; | ||
/** | ||
@@ -41,3 +41,3 @@ * The index in the `items` array that the found item appears at. This is | ||
*/ | ||
items: D[]; | ||
items: readonly D[]; | ||
/** | ||
@@ -44,0 +44,0 @@ * A required change event handler that will be called whenever a user types a |
@@ -25,2 +25,9 @@ import React, { ElementType, HTMLAttributes } from "react"; | ||
/** | ||
* Boolean if the element that gets focused on mount should try to not scroll | ||
* the focused element into view which is the default behavior. This should | ||
* normally remain `false`, but it is useful to set to `true` if the | ||
* `FocusContainer` is within a transition that appears offscreen. | ||
*/ | ||
disableFocusOnMountScroll?: boolean; | ||
/** | ||
* The default behavior for the focus container is to attempt to focus the | ||
@@ -27,0 +34,0 @@ * element that was focused before the focus container was mounted since it is |
@@ -11,5 +11,8 @@ export declare type Focus = "first" | "last" | string; | ||
* focusable element within the container. | ||
* @param preventScroll Boolean if the focus event should not scroll the element | ||
* into view. This should normally remain `false`, but can be useful if the | ||
* element gets focused while offscreen during a transition. | ||
* @param progamatic Boolean if programatically focusable elements should be | ||
* included as well. | ||
*/ | ||
export default function focusElementWithin(container: HTMLElement | Document, focus: Focus, programatic?: boolean, elements?: HTMLElement[]): void; | ||
export default function focusElementWithin(container: HTMLElement | Document, focus: Focus, programatic?: boolean, preventScroll?: boolean, elements?: HTMLElement[]): void; |
@@ -18,2 +18,6 @@ import { Focus } from "./focusElementWithin"; | ||
* focus. | ||
* @param preventScroll Boolean if the focus events should try to prevent the | ||
* default scroll-into-view behavior. This is generally recommended to be kept | ||
* as `false`, but can be useful to enable if the component mounts offscreen | ||
* during a transition. | ||
* @param programatic Boolean if programatically focusable elements should be | ||
@@ -23,2 +27,2 @@ * included instead of only tab focusable. | ||
*/ | ||
export default function useFocusOnMount(refOrInstance: RefOrInstance, defaultFocus: Focus, programatic?: boolean, disabled?: boolean): void; | ||
export default function useFocusOnMount(refOrInstance: RefOrInstance, defaultFocus: Focus, preventScroll?: boolean, programatic?: boolean, disabled?: boolean): void; |
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
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
1548787
23773