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

@codelusitan/ui-components

v0.1.0

Published

Shared React frontend pieces for CodeLusitan apps: the Keycloak/OIDC auth module and common UI components (ADR-0054).

Readme

@codelusitan/ui-components

Shared React pieces for CodeLusitan apps (ADR-0054). Everything is a peer dependency — the app provides React, the router, the OIDC library and so on, so nothing is bundled twice.

Each import path is its own entry, so an app only needs the peers of what it imports:

| Import | Contents | Peers it needs | | --- | --- | --- | | @codelusitan/ui-components/auth | AuthProvider, useAuth, RequireAuth, createOidcConfig, runSilentRenew | react-oidc-context, oidc-client-ts, jwt-decode, react-router-dom | | @codelusitan/ui-components/components | DataTable, LoadingRows, Modal, PageHeader, StatusBadge, TEXT_ROLE_CLASSES, LOG_LEVEL_ROLES | @radix-ui/react-dialog, lucide-react | | @codelusitan/ui-components/stat-card | StatCard, Sparkline | recharts, react-router-dom | | @codelusitan/ui-components/rich-text-editor | RichTextEditor (TipTap) | the @tiptap/* packages | | @codelusitan/ui-components/styles.css | design tokens + .card / .badge / editor styles | tailwindcss v4 |

Auth (Keycloak, authorization-code flow)

import { AuthProvider, RequireAuth, createOidcConfig } from "@codelusitan/ui-components/auth";

const oidcConfig = createOidcConfig({
  clientId: "lusoadmin",
  basePath: "/admin", // "" for an app on its own hostname root
});

<AuthProvider config={oidcConfig} tokenStorageKey="lusoadmin.token" adminRole="platform-admin">
  <RequireAuth requireAdmin loginPath="/login" forbidden={<p>Sem acesso.</p>}>…</RequireAuth>
</AuthProvider>
  • useAuth() returns token, idUser, idTenant, roles, isAdmin, displayName, isLoading, isAuthenticated, login, logout.
  • tokenStorageKey is optional: when set, the access token is mirrored into localStorage under that key (synced during render, on purpose — see the comment in AuthContext.jsx) for an API client that reads it there. A window event auth:expired, dispatched by that client on a 401, sends the user back through login once.
  • silent-renew.html calls runSilentRenew() from /auth.
  • Redirect URIs are ${origin}${basePath}/auth/callback, /login (post-logout) and /silent-renew.html; keep basePath equal to the router's basename and the bundler's base.

Styles (Tailwind v4)

The components use Tailwind utility classes and a few design tokens (bg-surface, rounded-card, brand-*, …). In the app's CSS, after Tailwind:

@import "tailwindcss";
@import "@codelusitan/ui-components/styles.css";
@source "../node_modules/@codelusitan/ui-components/dist";
@custom-variant dark (&:where(.dark, .dark *));

@source is what makes Tailwind find the classes inside the compiled package. The tokens default to LusoAdmin's theme; an app with its own brand overrides them (e.g. --color-brand-600, --color-surface) in its own @theme block after the import.

Development

npm test -w @codelusitan/ui-components    # vitest + jsdom
npm run build -w @codelusitan/ui-components

Publishing is manual (npm publish -w @codelusitan/ui-components, which runs the build first), independent of @codelusitan/genericfunctions.