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

@gmoonc/ui

v0.0.2

Published

UI do Goalmoon Ctrl (gmoonc): shell e menu plugáveis para dashboards (React puro, SSR-safe).

Readme

@gmoonc/ui

Pluggable UI components for Goalmoon Ctrl (gmoonc): shell and menu for dashboards (pure React, SSR-safe).

Installation

npm install @gmoonc/ui

CSS Import

Import the required CSS file:

import "@gmoonc/ui/styles.css";

Basic Usage

import { defineConfig } from '@gmoonc/core';
import { GmooncShell } from '@gmoonc/ui';
import '@gmoonc/ui/styles.css';

const config = defineConfig({
  appName: 'My Dashboard',
  menu: [
    { id: 'home', label: 'Home', path: '/app' },
    { 
      id: 'admin', 
      label: 'Admin', 
      path: '/app/admin', 
      roles: ['admin'],
      submenu: [
        { id: 'admin-permissions', label: 'Permissions', path: '/app/admin/permissions' }
      ]
    }
  ]
});

function App() {
  return (
    <GmooncShell
      config={config}
      roles={['admin']}
      activePath="/app/admin/permissions"
      onNavigate={(path) => {
        // Your navigation logic here
        console.log('Navigate to:', path);
      }}
    >
      <div>Dashboard content</div>
    </GmooncShell>
  );
}

Navigation Integration

@gmoonc/ui is framework-agnostic and doesn't depend on any specific routing system. You can integrate it with any framework using the onNavigate and/or renderLink props.

Using onNavigate

<GmooncShell
  config={config}
  onNavigate={(path) => {
    // React Router
    navigate(path);
    
    // Next.js
    router.push(path);
    
    // Other system
    window.location.href = path;
  }}
/>

Using renderLink

For full control over how links are rendered (e.g., React Router Link, Next.js Link):

import { Link } from 'react-router-dom';

<GmooncShell
  config={config}
  activePath={location.pathname}
  renderLink={({ path, label, isActive, onClick }) => (
    <Link 
      to={path} 
      onClick={onClick}
      className={isActive ? 'active' : ''}
    >
      {label}
    </Link>
  )}
/>

Menu Items with Icons

Menu items support optional icons (ReactNode). No default unicode icons are used:

import { Home, Settings } from 'lucide-react';

const config = defineConfig({
  appName: 'My App',
  menu: [
    { 
      id: 'home', 
      label: 'Home', 
      path: '/app',
      icon: <Home size={16} />
    },
    { 
      id: 'settings', 
      label: 'Settings', 
      path: '/app/settings',
      icon: <Settings size={16} />,
      submenu: [
        { 
          id: 'settings-profile', 
          label: 'Profile', 
          path: '/app/settings/profile',
          icon: <User size={16} />
        }
      ]
    }
  ]
});

Active State

The menu automatically highlights active items based on activePath:

  • Exact match: activePath === item.path
  • Child route: activePath starts with item.path + "/"

This ensures parent menu items are highlighted when viewing child pages.

Components

GmooncShell

Main component that combines header, sidebar, and menu.

Props:

  • config: GmooncConfig - App configuration (from @gmoonc/core)
  • roles?: string[] - Current user roles for filtering menu
  • activePath?: string - Active path for highlighting menu item
  • onNavigate?: (path: string) => void - Callback when user clicks menu item
  • renderLink?: (args) => React.ReactNode - Function to render custom links
  • children?: React.ReactNode - Main content
  • headerRight?: React.ReactNode - Content for right side of header
  • logoUrl?: string - Logo image URL
  • logoAlt?: string - Logo alt text
  • titleMobile?: string - Title for mobile view

GmooncMenu

Standalone menu component.

Props:

  • items: GmooncMenuItem[] - Array of menu items
  • roles?: string[] - User roles for filtering
  • activePath?: string - Active path for highlighting
  • onNavigate?: (path: string) => void - Navigation callback
  • renderLink?: (args) => React.ReactNode - Custom link renderer
  • isOpen?: boolean - Whether menu is open (mobile/tablet)
  • onToggle?: () => void - Toggle menu callback
  • onLogoClick?: () => void - Logo click callback
  • logoUrl?: string - Logo image URL
  • logoAlt?: string - Logo alt text

GmooncMenuItem Type

interface GmooncMenuItem {
  id: string;
  label: string;
  path?: string;
  icon?: React.ReactNode;        // Optional icon (no default unicode icons)
  roles?: string[];              // Roles required to see this item
  submenu?: GmooncMenuItem[];   // Nested submenu
  expandIcon?: React.ReactNode;  // Optional icon for submenu expansion
  collapseIcon?: React.ReactNode; // Optional icon for submenu collapse
}

GmooncHeader

Standalone header component.

GmooncSidebar

Standalone sidebar component.

Role-Based Filtering

Menu items are automatically filtered based on user roles:

  • Items without roles are visible to everyone
  • Items with roles are visible only if user has at least one matching role
  • Filtering is applied recursively to submenus
  • Parent items without paths but with visible children appear as collapsible

SSR Safety

All components are SSR-safe and don't access browser APIs at the top level. Any access to window or document is done inside useEffect with appropriate checks.

Framework Agnostic

This package doesn't depend on:

  • Next.js
  • React Router
  • Expo
  • Any other specific framework

It's pure React and works in any React environment (including SSR).

License

MIT