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

@elogroup-sereduc/ser-hero-icons-resolver

v1.0.0

Published

Resolve Heroicons 24px outline React components by stable app icon name

Readme

ser-hero-icons-resolver

Biblioteca que expõe um conjunto fixo de ícones Heroicons (variante outline, tamanho 24px) identificados por nomes estáveis em kebab-case ('bell', 'document-text', etc.). Útil quando o nome do ícone vem de configuração, API ou CMS e você precisa renderizar o componente React correspondente.

Instalação

O pacote depende de @heroicons/react e exige React 18+ como peer dependency.

npm install @elogroup-sereduc/ser-hero-icons-resolver @heroicons/react
# ou
yarn add @elogroup-sereduc/ser-hero-icons-resolver @heroicons/react

Uso básico

Resolver pelo nome

getAppOutlineIcon devolve sempre um componente. Se o nome não existir no conjunto, usa o ícone de fallback (home).

import { getAppOutlineIcon } from '@elogroup-sereduc/ser-hero-icons-resolver';

function MenuItem({ iconName }: { iconName: string }) {
  const Icon = getAppOutlineIcon(iconName);
  return (
    <span className="flex items-center gap-2">
      <Icon className="h-5 w-5" aria-hidden />
      {/* … */}
    </span>
  );
}

Verificar se o nome é válido

Para tratar nomes inválidos na UI (mensagem de erro, log, etc.) em vez de mostrar o fallback:

import {
  getAppOutlineIcon,
  isAppOutlineIconName,
} from '@elogroup-sereduc/ser-hero-icons-resolver';

if (!isAppOutlineIconName(config.icon)) {
  console.warn('Ícone desconhecido:', config.icon);
}
const Icon = getAppOutlineIcon(config.icon);

Lista e mapa

  • APP_OUTLINE_ICONS — array de { name, Icon } para montar seletores, documentação interna ou menus.
  • APP_OUTLINE_ICON_BY_NAME — registro nome → componente para acesso direto tipado quando o nome é conhecido em compile time.
import {
  APP_OUTLINE_ICONS,
  APP_OUTLINE_ICON_BY_NAME,
  type AppOutlineIconName,
} from '@elogroup-sereduc/ser-hero-icons-resolver';

const Icon = APP_OUTLINE_ICON_BY_NAME.calendar;

APP_OUTLINE_ICONS.map(({ name, Icon }) => (
  <option key={name} value={name}>
    {name}
  </option>
));

Fallback

  • APP_OUTLINE_FALLBACK_NAME — nome usado quando getAppOutlineIcon não encontra correspondência (atualmente 'home').
  • APP_OUTLINE_FALLBACK_ICON — o mesmo componente do fallback, para uso explícito.

Tipos exportados

| Tipo | Descrição | |------|-----------| | AppOutlineIconName | Union dos nomes válidos (string literals). | | AppOutlineIcon | Tipo do componente de ícone. | | AppOutlineIconEntry | Elemento de APP_OUTLINE_ICONS ({ name, Icon }). |

Build local

yarn install
yarn build

Os artefatos saem em dist/. O script prepublishOnly roda o build antes de publicar.

Licença

MIT