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

@net-advantage/jo-ui-color-swatch

v2.1.0

Published

Color swatch selector with fixed 32px swatches and an optional add-color chooser.

Readme

@net-advantage/jo-ui-color-swatch

Color swatch selector with fixed 32px swatches and an optional add-color chooser.

The swatch follows a strict MVVM split. The model decides which colors are visible and how a chosen color is applied. The view-model owns selection and the chooser. The view renders the view-model and hosts ColorPicker for the draft color.

MVVM

flowchart LR
  Props["ColorSwatchProps"] --> ViewModel["useColorSwatchViewModel"]
  Model["color-swatch.model.ts<br/>visible colors and apply"] --> ViewModel
  ViewModel --> View["ColorSwatch.tsx"]
  Metadata["jo-ui-field-metadata"] --> View
  View -->|"select or apply"| ViewModel
  ViewModel -->|"onValueChange"| Host["Host application"]
  Picker["jo-ui-color-picker"] -->|"draft color"| View

| Layer | File | Responsibility | | --- | --- | --- | | Contract | color-swatch.types.ts | Props and view-model | | Model | color-swatch.model.ts | Clamp the visible list and apply a chosen color | | View-model | color-swatch.view-model.ts | Framework-free color swatch observable; own selection, remaining colors, and the chooser | | View | color-swatch.use-view-model.ts | useColorSwatchViewModel reads that observable and owns palette sync and outside-click effects | | View | ColorSwatch.tsx | Render swatches and the chooser from the view-model | | Shared metadata | @net-advantage/jo-ui-field-metadata | Render the label, helper text, spacing, and association IDs |

Models

flowchart TD
  Color["RGB color string"] --> Visible["visible swatches"]
  Color --> Remaining["remaining colors"]
  Visible --> Applied["AppliedSwatch"]
  Remaining --> Applied
  Applied --> ItemVm["ColorSwatchItemViewModel"]
  ItemVm --> ViewModel["ColorSwatchViewModel"]
  • colors and optionalColors are arrays of RGB color strings, such as #1E2A5A.
  • maxVisibleColors limits the first paint. singleColorSelection keeps one visible swatch.
  • AppliedSwatch is the result of choosing a color. In single mode it updates that swatch. A color already visible is selected and is not added again. Otherwise it is appended and removed from the remaining list.
  • If value is not visible, it is promoted into colors; the last visible color moves to optionalColors so the selected value remains available.
  • The chooser is a menu. Its apply label is Apply Color in single mode and Add Color otherwise.
  • label or ariaLabel is required. A visible label is preferred and names the radio group through aria-labelledby. ariaLabel is the group's aria-label when the swatch should not show a label. Passing neither is a compile error. A caller that bypasses the type and passes neither still sees ACCENT COLOUR.
  • Composite label and helper rendering comes from FieldMetadata; the swatch does not own duplicate metadata selectors.
  • labelPlacement accepts top or left; descriptionPlacement accepts below-label or below-control.

Features

  • Displays a selectable color swatch list
  • Supports optional color list added through a reusable color picker chooser
  • maxVisibleColors prop controls how many colors are shown
  • 32px swatch tiles to match Journey admin controls

Structure

  • src: runtime component, model, view-model, default colors, and styles
  • stories: Storybook stories for docs and visual testing

Publish footprint

This package publishes only:

  • dist
  • README.md