@paprika/helpers v2.4.2
@paprika/helpers
Description
JavaScript and React helper utilities.
Installation
yarn add @paprika/helpersor with npm:
npm install @paprika/helpersUsage
Import the helper function you want to use by name from the Paprika helpers package:
import { helperFunction } from "@paprika/helpers";Polyfills must be imported directly from their source in the lib folder. For example:
import "@paprika/helpers/lib/polyfills/elementClosest";Contents
callAll(functions[])
Returns a function that will call all functions passed as arguments.
extractChildren(children, types[])
Get a hash table of components from chilren argument where the displayName property of child matches an item provided in the types argument with the keys of the return object matching the items in types.
extractChildrenProps(children, target)
Get the props object from the target argument component type if it exists in children argument.
isDevEnv()
Returns true if NODE_ENV is undefined or "development".
Custom PropTypes
A variety of custom React prop types including:
ShirtSizesAlignTypesdeprecatedInputValidTypesFocusPropTypesRefOf
DOM Functions
getActiveElement()
Returns the element that is currently focussed, even when that element is found within an open web component.
isElementContainsFocus(element)
Returns true if the element that is currently focussed is the element argument, or any descendent of element.
Components
<LockBodyScroll>
Sets body overlow to hidden.
<Portal>
Wrapper for ReactDOM.createPortal.
Hooks
useDebounce(value, delay)
Provides a value after a specified delay.
useForwardDomRef(ref, parentRef)
Set parentRef to ref.
useMountedRef()
Provides a ref with a current value of true if component is (still) mounted.
usePrevious(value)
Provides the previous value of the value argument.
Polyfills
elementClosest
IE polyfill for Element.closest().
elementScroll
IE polyfill for Element.scroll(), Element.scrollTo(), Element.scrollBy().
Links
4 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago