everyday-helper 1.3.0 → 1.3.1
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/dist/index.d.ts +3 -1
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -262,6 +262,8 @@ declare function useEventListener<K extends keyof WindowEventMap>(event: K, hand
|
|
|
262
262
|
|
|
263
263
|
declare const useResizeListener: (callback: () => void, active: boolean) => void;
|
|
264
264
|
|
|
265
|
+
declare function useKeyPress(targetKey: string): boolean;
|
|
266
|
+
|
|
265
267
|
declare const isBrowser: () => boolean;
|
|
266
268
|
declare const safeWindow: () => (Window & typeof globalThis) | undefined;
|
|
267
269
|
|
|
@@ -1249,4 +1251,4 @@ declare const bounceIn: (order?: number, className?: string, style?: CSSProperti
|
|
|
1249
1251
|
style: CSSProperties;
|
|
1250
1252
|
};
|
|
1251
1253
|
|
|
1252
|
-
export { type ClassValue, CookieManager, DateFormats, type DateInput, FormDataBuilder, type PrintStyle, addAsteriskIf, addToDate, animate, areAllValuesComplete, average, bounceIn, capitalize, capitalizeWords, checkArrEquality, chunk, cleanObject, clone, cn, compactArr, compactStr, compareDates, compose, concatIf, constant, convertBase64ToFile, convertFileToBase64, count, countOccurrences, createFormData, createStorage, curry, debounce, deepClone, deepFreeze, deepMerge, delay, difference, endOf, endsWith, entries, eqIgnoreCase, extractBase64FromDataUrl, fadeIn, fileToArrayBuffer, filterObject, first, firstSeveral, flatten, flattenDeep, flip, formatDate, formatDateRange, formatRelativeTime, fromPairs, generateQuery, get, getAge, getDateDifference, getEndpoint, getImageUrl, groupBy, has, hasAzerbaijanCountryCode, identity, includesIgnoreCase, intersection, invert, isBetweenDates, isBrowser, isEmpty, isEqual, isFuture, isLoggedIn, isNotEmpty, isNulOrUndefined, isObject, isPast, isSameDay, isString, isStringSimilar, isToday, isTomorrow, isValidDate, isYesterday, keys, last, lastSeveral, lazyLoad, local, mapKeys, mapValues, max, memoize, merge, min, negate, noop, normalizePhone, normalizeWhitespace, now, omit, once, padEnd, padStart, parseDate, partial, partition, pick, pushIf, rateLimit, reject, repeat, retry, reverse, reverseArr, safeCall, safeWindow, sample, sampleSize, scaleIn, session, set, shuffle, slideInDown, slideInLeft, slideInRight, slideInUp, slugify, sortBy, startOf, startsWith, subtractFromDate, sum, throttle, timeId, tinyId, toCamelCase, toISOString, toKebabCase, toPascalCase, toSnakeCase, toUnixTimestamp, toUpperSnakeCase, trim, trimEnd, trimStart, truncate, tryCatch, tryCatchAsync, unflatten, union, unique, uniqueBy, useAppLocation, useDebounce, useDownloadFile, useEscapeKey, useEventListener, useInterval, useMediaQuery, useMount, useOnlineStatus, useOutsideClick, usePortal, usePrevious, usePrint, useResizeListener, useScrollLock, useToggle, useUnmount, useUpdateEffect, useWindowSize, values, withAzerbaijanCountryCode, without, zip };
|
|
1254
|
+
export { type ClassValue, CookieManager, DateFormats, type DateInput, FormDataBuilder, type PrintStyle, addAsteriskIf, addToDate, animate, areAllValuesComplete, average, bounceIn, capitalize, capitalizeWords, checkArrEquality, chunk, cleanObject, clone, cn, compactArr, compactStr, compareDates, compose, concatIf, constant, convertBase64ToFile, convertFileToBase64, count, countOccurrences, createFormData, createStorage, curry, debounce, deepClone, deepFreeze, deepMerge, delay, difference, endOf, endsWith, entries, eqIgnoreCase, extractBase64FromDataUrl, fadeIn, fileToArrayBuffer, filterObject, first, firstSeveral, flatten, flattenDeep, flip, formatDate, formatDateRange, formatRelativeTime, fromPairs, generateQuery, get, getAge, getDateDifference, getEndpoint, getImageUrl, groupBy, has, hasAzerbaijanCountryCode, identity, includesIgnoreCase, intersection, invert, isBetweenDates, isBrowser, isEmpty, isEqual, isFuture, isLoggedIn, isNotEmpty, isNulOrUndefined, isObject, isPast, isSameDay, isString, isStringSimilar, isToday, isTomorrow, isValidDate, isYesterday, keys, last, lastSeveral, lazyLoad, local, mapKeys, mapValues, max, memoize, merge, min, negate, noop, normalizePhone, normalizeWhitespace, now, omit, once, padEnd, padStart, parseDate, partial, partition, pick, pushIf, rateLimit, reject, repeat, retry, reverse, reverseArr, safeCall, safeWindow, sample, sampleSize, scaleIn, session, set, shuffle, slideInDown, slideInLeft, slideInRight, slideInUp, slugify, sortBy, startOf, startsWith, subtractFromDate, sum, throttle, timeId, tinyId, toCamelCase, toISOString, toKebabCase, toPascalCase, toSnakeCase, toUnixTimestamp, toUpperSnakeCase, trim, trimEnd, trimStart, truncate, tryCatch, tryCatchAsync, unflatten, union, unique, uniqueBy, useAppLocation, useDebounce, useDownloadFile, useEscapeKey, useEventListener, useInterval, useKeyPress, useMediaQuery, useMount, useOnlineStatus, useOutsideClick, usePortal, usePrevious, usePrint, useResizeListener, useScrollLock, useToggle, useUnmount, useUpdateEffect, useWindowSize, values, withAzerbaijanCountryCode, without, zip };
|
package/dist/index.js
CHANGED
|
@@ -754,6 +754,21 @@ var useResizeListener = (callback, active) => {
|
|
|
754
754
|
// src/hooks/useCopyToClipboard.ts
|
|
755
755
|
import { useState as useState5 } from "react";
|
|
756
756
|
|
|
757
|
+
// src/hooks/useKeyPress.ts
|
|
758
|
+
import { useCallback as useCallback4, useState as useState6 } from "react";
|
|
759
|
+
function useKeyPress(targetKey) {
|
|
760
|
+
const [pressed, setPressed] = useState6(false);
|
|
761
|
+
const downHandler = useCallback4((e) => {
|
|
762
|
+
if (e.key === targetKey) setPressed(true);
|
|
763
|
+
}, [targetKey]);
|
|
764
|
+
const upHandler = useCallback4((e) => {
|
|
765
|
+
if (e.key === targetKey) setPressed(false);
|
|
766
|
+
}, [targetKey]);
|
|
767
|
+
useEventListener("keydown", downHandler);
|
|
768
|
+
useEventListener("keyup", upHandler);
|
|
769
|
+
return pressed;
|
|
770
|
+
}
|
|
771
|
+
|
|
757
772
|
// src/utils/common-utils.ts
|
|
758
773
|
function isNulOrUndefined(v) {
|
|
759
774
|
return v === null || v === void 0;
|
|
@@ -1849,6 +1864,7 @@ export {
|
|
|
1849
1864
|
useEscapeKey,
|
|
1850
1865
|
useEventListener,
|
|
1851
1866
|
useInterval,
|
|
1867
|
+
useKeyPress,
|
|
1852
1868
|
useMediaQuery,
|
|
1853
1869
|
useMount,
|
|
1854
1870
|
useOnlineStatus,
|