piral-hooks-utils
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

Piral Logo

Piral Hooks Utils · GitHub License npm version tested with jest Gitter Chat

A set of hooks and HOCs for pilets and Piral instances.

Installation

This should only be installed as a dependency (dependencies) as it is only designed mostly for runtime/consumption by Piral or pilets. You could also share it explicitly or implicitly from your Piral instance if you'd like to optimize usage in your pilets. It's not required though as the code provided by it is minimal and tree-shakable.

If you'd love to use yarn:

yarn add piral-hooks-utils

Alternatively, npm works reliably, too:

npm i --save piral-hooks-utils

Included Hooks

The following hooks are included.

useAfterVisible

A hook to indicate something was suddenly visible.

useAsyncReplace

Gives a full async lifecycle in a hook.

useLockBodyScroll

Hook that locks scrolling on the main document.

useOnClickOutside

Hook that detects if a click outside the given reference has been performed.

useOnScreenVisible

Hook that detects if a reference element within the main document is visible.

usePiletApi

Retrieves the Pilet API stored in the provider.

usePrompt

Hook to notify the user in case of potential data loss when performing a page transition (internal or external).

License

Piral is released using the MIT license. For more information see the license file.

Package Sidebar

Install

npm i piral-hooks-utils

Homepage

piral.io

Weekly Downloads

841

Version

1.5.0

License

MIT

Unpacked Size

52.7 kB

Total Files

97

Last publish

Collaborators

  • florianrappl