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

cml-webui-commons

v1.0.2

Published

CodingMonkeyLabs WebUI Commons - A comprehensive React component library with reusable components, hooks, utilities, and design system

Readme

cml-webui-commons

npm version License: MIT

CodingMonkeyLabs WebUI Commons - A comprehensive React component library with authentication, styling, and common utilities. Build modern web applications with a production-ready component library and design system.

Features

  • 🎨 Premium Design System - "Luminous Excellence" design system with SCSS and Tailwind CSS
  • 🔐 Authentication System - Complete auth flow with JWT, RBAC, and permission management
  • 🧩 Reusable Components - Layout, Modal, Form, and UI components
  • 🪝 Custom Hooks - useAuth, usePermission, useRole, and more
  • 📦 State Management - Zustand stores for auth and theme
  • 🌙 Dark Mode - Built-in theme switching with Light, Dark, and Neon themes
  • 🔧 TypeScript - Fully typed with TypeScript
  • Validation - Zod schemas for form validation
  • 🎯 API Client - Configurable Axios client factory with interceptors and token refresh
  • ♻️ Generic & Reusable - Framework-agnostic utilities and helpers

Installation

npm install cml-webui-commons

Quick Start

1. Import Styles

Import the styles in your main entry file:

import 'cml-webui-commons/styles'

2. Configure Tailwind

Extend your Tailwind configuration with the preset:

// tailwind.config.js
import { tailwindPreset } from 'cml-webui-commons/tailwind-preset'

export default {
  presets: [tailwindPreset],
  content: [
    "./index.html",
    "./src/**/*.{js,ts,jsx,tsx}",
    "./node_modules/cml-webui-commons/dist/**/*.js",
  ],
}

3. Setup Authentication

Wrap your app with the AuthProvider:

import { AuthProvider } from 'cml-webui-commons'

function App() {
  return (
    <AuthProvider>
      {/* Your app content */}
    </AuthProvider>
  )
}

4. Use Components

import { Layout, Header, Sidebar, Modal, AuthGuard } from 'cml-webui-commons'

function Dashboard() {
  return (
    <AuthGuard requireAuth>
      <Layout>
        <Header />
        <Sidebar />
        <main>{/* Your content */}</main>
      </Layout>
    </AuthGuard>
  )
}

5. Configure API Client

Create your API clients with the configurable factory:

import { createApiClient } from 'cml-webui-commons'

// Create a client for your API
const apiClient = createApiClient({
  baseURL: 'https://api.example.com/v1',
  refreshTokenUrl: 'https://api.example.com/v1/auth/refresh',
  timeout: 30000,
  onUnauthorized: () => {
    // Custom handler for 401 responses
    console.log('Unauthorized! Redirecting...')
  }
})

// Use the client
const response = await apiClient.get('/users')
const user = await apiClient.post('/users', { name: 'John Doe' })

API Client Features

  • ✅ Automatic bearer token injection from auth store
  • ✅ Automatic token refresh on 401 responses
  • ✅ Custom unauthorized handler
  • ✅ Configurable timeout and headers
  • ✅ TypeScript support with exported types

Core Exports

Components

import {
  // Layout Components
  Layout,
  PageLayout,
  Header,
  Sidebar,

  // Auth Components
  LoginPage,
  AuthGuard,

  // Modals
  Modal,
  AssignRoleModal,
  AssignPermissionModal,

  // UI Security Components
  PasswordStrengthIndicator,
  RoleBadge,
  RoleCard,
  PermissionChip,
  UserStatusBadge,
  UserCard,
  UserTableRow,
} from 'cml-webui-commons'

Hooks

import {
  useAuth,
  usePermissions,
  useRoles,
  useUsers,
} from 'cml-webui-commons'

Services & API

import {
  createApiClient,
  type ApiClientConfig,
  type AxiosInstance,
  type AxiosResponse,
  type AxiosError,
} from 'cml-webui-commons'

Stores (Zustand)

import {
  useAuthStore,
  useThemeStore,
} from 'cml-webui-commons'

Utilities

import { cn } from 'cml-webui-commons'

// Merge class names
const className = cn('base-class', condition && 'conditional-class', 'another-class')

Documentation

For detailed documentation, see the docs folder:

Package Structure

cml-webui-commons/
├── components       # React components
├── hooks           # Custom React hooks
├── services        # API services and client
├── stores          # Zustand stores
├── contexts        # React contexts
├── types           # TypeScript types
├── schemas         # Zod validation schemas
├── utils           # Utility functions
└── styles          # SCSS and Tailwind preset

Examples

Using the Theme Store

import { useThemeStore } from 'cml-webui-commons'

function ThemeToggle() {
  const { theme, toggleTheme } = useThemeStore()

  return (
    <button onClick={toggleTheme}>
      Current theme: {theme}
    </button>
  )
}

Using Auth Hook

import { useAuth } from 'cml-webui-commons'

function UserProfile() {
  const { user, logout } = useAuth()

  return (
    <div>
      <p>Welcome, {user?.name}</p>
      <button onClick={logout}>Logout</button>
    </div>
  )
}

Protected Routes

import { AuthGuard } from 'cml-webui-commons'

function AdminPage() {
  return (
    <AuthGuard requireAuth requiredRoles={['admin']}>
      <div>Admin Only Content</div>
    </AuthGuard>
  )
}

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Requirements

  • React 18.0.0 or 19.0.0
  • React DOM 18.0.0 or 19.0.0
  • React Router DOM 6.0.0 or 7.0.0
  • Node.js >= 20.0.0
  • npm >= 10.0.0

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

MIT © CodingMonkeyLabs

Author

CodingMonkeyLabs

Changelog

See CHANGELOG.md for version history and updates.