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

hb-oc-hrnet-modal

v0.0.5

Published

DO NOT USE THIS PACKAGE. This is an exercise and will be deleted. A modal component for React build for HRNet.

Downloads

13

Readme

DO NOT USE THIS MODULE, THIS IS A DEMO/ EXERCISE AND WILL BE DELETED

Exercise module for OC HRNET

Data table React component.

HRNet modal React component

This is a React component that displays a modal. It is a part of the HRNet project. The component is based on the Radix dialog primitive with some wrappers. This allows for easy customization and composition.

This module is tested with Node 21. It should work with Node version >= 18

Usage

You can read the Radix documentation for more information about the primitives : Radix Dialog

Basic usage:

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
} from 'hb-oc-hrnet-modal';
<Dialog>
  <DialogTrigger>Open</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Title</DialogTitle>
      <DialogDescription>
        Description
      </DialogDescription>
    </DialogHeader>
  </DialogContent>
</Dialog>

With controlled state:

const MyComponent = () => {
  const [open, setOpen] = React.useState(false);

  return (
    <div>
      <button onClick={() => setOpen(true)}>Open modal</button>
      <Dialog open={open} onOpenChange={setOpen}>
        <DialogHeader>
          <h2>Modal title</h2>
        </DialogHeader>
        <DialogContent>
          <DialogDescription>
            <p>Modal content</p>
          </DialogDescription>
        </DialogContent>
      </Dialog>
    </div>
  );
};

Styling

The module provides a default css file for basic style. You can import it in your root file:

import 'hb-oc-hrnet-modal/default-styles.css';

It can be overridden by passing custom style or className props to the components.

For wrapper with multiple primitives, a classNames and a styles object props are provided to style the children primitives.

Example using Tailwind:

<Dialog>
  <DialogContent
    classNames={{
      overlay:
        'fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
      content:
        'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
      close:
        'absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground',
    }}
  >
    <DialogHeader className="flex flex-col space-y-1.5 text-center sm:text-left">
      <DialogDescription className="text-sm text-muted-foreground">
        Employee Created!
      </DialogDescription>
    </DialogHeader>
  </DialogContent>
</Dialog>