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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@isi-ui7/modal-manager

v0.2.1

Published

Modal stack manager for multi-level modal flows in banking applications.

Readme

@isi-ui7/modal-manager

Stack-based modal manager untuk React — buka/tutup modal berlapis tanpa boilerplate state per komponen.

Fitur

  • Modal stack: beberapa modal bisa terbuka sekaligus (bertumpuk), penutupan LIFO
  • showPage(): buka PageComponent sebagai modal dan await hasilnya (status + data)
  • dismissible: modal bisa ditutup dengan Escape / klik backdrop (opsional)
  • showFull: mode layar penuh tanpa max-width/height
  • initialFocusSelector: tentukan elemen yang difokus saat modal terbuka
  • Tanpa dependensi Carbon — bebas dipakai di semua aplikasi React

Instalasi

pnpm add @isi-ui7/modal-manager react react-dom

Penggunaan

1. Setup Provider

// app/layout.tsx
import { ModalProvider } from "@isi-ui7/modal-manager";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        <ModalProvider>{children}</ModalProvider>
      </body>
    </html>
  );
}

2. Buka modal dari komponen

"use client";
import { useModal } from "@isi-ui7/modal-manager";

export function MyPage() {
  const { open, closeTop } = useModal();

  const handleOpen = () => {
    open(
      <div>
        <h2>Konfirmasi</h2>
        <p>Yakin ingin menghapus?</p>
        <button onClick={closeTop}>Tutup</button>
      </div>,
      { dismissible: true }
    );
  };

  return <button onClick={handleOpen}>Buka Modal</button>;
}

3. Gunakan showPage (await hasil modal)

"use client";
import { showPage } from "@isi-ui7/modal-manager";
import { useModal } from "@isi-ui7/modal-manager";
import type { PageComponent } from "@isi-ui7/modal-manager";

const FormPage: PageComponent = ({ dataParam, onClose }) => (
  <div>
    <h2>Edit {(dataParam?.name as string) ?? ""}</h2>
    <button onClick={() => onClose?.("ok", { saved: true })}>Simpan</button>
    <button onClick={() => onClose?.("cancel")}>Batal</button>
  </div>
);

export function MyList() {
  const modal = useModal();

  const handleEdit = async (row: { name: string }) => {
    const result = await showPage<{ saved: boolean }>(modal, FormPage, {
      dataParam: { name: row.name },
    });
    if (result.status === "ok" && result.data?.saved) {
      console.log("tersimpan");
    }
  };

  return <button onClick={() => handleEdit({ name: "Rekening A" })}>Edit</button>;
}

Props

ModalProvider

| Nama | Tipe | Wajib | Deskripsi | | --- | --- | --- | --- | | children | ReactNode | ya | Konten aplikasi |

useModal() — returns ModalContextType

| Method | Tipe | Deskripsi | | --- | --- | --- | | open | (content, options?) => string | Buka modal baru, kembalikan ID | | closeTop | () => void | Tutup modal paling atas | | closeById | (id: string) => void | Tutup modal berdasarkan ID | | stack | ModalItem[] | Stack modal saat ini (bawah → atas) |

ModalOptions

| Nama | Tipe | Default | Deskripsi | | --- | --- | --- | --- | | id | string | auto | ID eksplisit (opsional) | | dismissible | boolean | true | Tutup dengan Escape / klik backdrop | | showFull | boolean | false | Mode layar penuh | | initialFocusSelector | string | — | CSS selector elemen yang difokus saat buka | | onClose | () => void | — | Callback dipanggil saat modal dihapus dari stack |

showPage<RT>(modal, Component, options?)

| Parameter | Tipe | Deskripsi | | --- | --- | --- | | modal | ModalContextType | Dari useModal() | | Component | PageComponent | Komponen halaman yang dibuka sebagai modal | | options.dataParam | Record<string, unknown> | Data yang diteruskan ke Component | | options.modalOptions | ModalOptions | Opsi modal |

Returns: Promise<T_showPageResult<RT>>{ status, data? }

A11y

  • Focus dikembalikan ke elemen pemicu saat modal ditutup
  • Escape menutup modal jika dismissible: true
  • initialFocusSelector untuk kontrol focus trap eksplisit

Scripts

pnpm build      # Build ke dist/
pnpm lint       # ESLint
pnpm test       # Vitest
pnpm typecheck  # TypeScript check

Catatan

  • Peer deps: React/ReactDOM >=18
  • Tanpa dependensi Carbon — bisa dipakai di aplikasi non-Carbon
  • Komponen yang dibuka sebagai PageComponent harus menggunakan "use client" di Next.js App Router