Socket
Socket
Sign inDemoInstall

@paprika/helpers

Package Overview
Dependencies
12
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/helpers

JavaScript and React helper utilities


Version published
Weekly downloads
7.3K
decreased by-2.34%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

@paprika/helpers


Description

JavaScript and React helper utilities.


Installation

yarn add @paprika/helpers

or with npm:

npm install @paprika/helpers

Usage

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:

  • ShirtSizes
  • AlignTypes
  • deprecated
  • InputValidTypes
  • FocusPropTypes
  • RefOf

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().


  • GitHub source code
  • Create GitHub issue
  • CHANGELOG

FAQs

Last updated on 16 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc