npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

primereact-lazy

v1.0.0

Published

Simple React Component for reusable, easy and simple Primereact basic components

Downloads

2

Readme

primereact-lazy

Simple React Component for reusable, easy and simple Primereact basic components

NPM JavaScript Style Guide

Install

npm install --save primereact-lazy

Usage - Primereact Growl Alert (Notification/Warning/Info/etc)

import React from 'react'
import { AlertProvider } from 'primereact-lazy'

export function Layout() {
  return (
    <AlertProvider>
      <YourComponentToWrap />
    </AlertProvider>
  )
}

Then inside any of your wrapped Component

import { alertSwitch } from 'primereact-lazy'

const ComponentInProvider = () => {
  const alert = alertSwitch() // method to call growl alert

  return(
    ...
  )

}

export default ComponentInProvider

Usage - Primereact Dialog Confirmation Prompt

import React, { Component } from 'react'

import { DialogProvider } from 'primereact-lazy'

export function Layout() {
  return (
    <DialogProvider>
      <YourComponentToWrap />
    </DialogProvider>
  )
}

Then inside any of your wrapped Component


import { dialogSwitch } from 'primereact-lazy'

const ComponentInProvider = () => {

  const showPrompt = dialogSwitch() //method to call dialog confirmation

  return(
    ...
  )

}

export default ComponentInProvider

then simply call Alert / Dialog Confirmation

//alert

// 1. for single alert
alert.show({
  title: 'Oops',
  message: 'Your message is Oops',
  type: 'error', //accepts error, info, success, warning
})

// 1. multiple alert simultaneuosly
alert.multiple([
  {
    title: 'Attention!',
    message: `You have attempt to edit a file`,
    type: 'warning',
    life: 5000,
  },
  {
    title: 'Error',
    message: `You cannot do that`,
    type: 'error',
    life: 5000,
  },
])

// dialog confirmation

showPrompt({
  header: 'Warning',
  content: 'Initialize ?',
  onConfirm: () => yourOnConfirmHandler(),
})

aditional parameters

  1. AlertProvider
  • sticky (default:false) the alert sticks to screen unless closed manually
  • closable (default:true) alert message is closeable
  • life (default: 3000) timeout for alert until it closed in miliseconds

more info : Link

  1. DialogProvider
    • header (default: '') Title on dialog
    • content (default: null) Content to describe what the dialog intends
    • onConfirm (default: null) Callback function when choosing yes/ok on onconfirmation
    • onCancel (default: null) Callback function when choosing cancel on onconfirmation
    • pos (default: 'center') Position of Dialog Confirmation 'top', 'bottom', 'left', 'right', 'topleft', 'topright', 'bottomleft' or 'bottomright'.
    • okLabel (default: 'Ok') Label on Confirmation Button
    • cancelLabel (default: 'cancel') Label on Cancel Button

more info : Link

License

MIT © Raeneldis A. Sadra