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

sanitas-ui-design-system

v1.2.0

Published

Design System compartido para los microfrontends de Sanitas

Readme

Sanitas UI - Design System

Sistema de diseño compartido para los microfrontends de Sanitas.

Instalación

pnpm add sanitas-ui-design-system

Uso

import { Button } from 'sanitas-ui-design-system/ui'
import 'sanitas-ui-design-system/styles'

export const App = () => {
  return (
    <Button variant="primary" size="large">
      Ingresar
    </Button>
  )
}

Componentes Disponibles

  • Button - Botón con soporte para navegación SPA y enlaces externos

Principios de Clean Code

Este proyecto sigue estrictamente los principios de Clean Code:

1. Nombres Descriptivos

  • Variables y funciones con nombres que revelan intención
  • Constantes en SCREAMING_SNAKE_CASE
  • Tipos exportados con nombres claros
// ✅ Bien
const DEFAULT_VARIANT = 'primary'
export type ButtonVariant = 'primary' | 'secondary' | ...

// ❌ Mal
const d = 'primary'
type BV = 'primary' | 'secondary' | ...

2. Funciones Pequeñas

  • Una función = una responsabilidad
  • Funciones especializadas en lugar de condicionales complejos
// ✅ Bien
const isRouterLinkButton = (props: ButtonProps): props is ButtonAsRouterLink => {
  return 'to' in props && Boolean(props.to)
}

// ❌ Mal
if ('to' in props && props.to && RouterLink) { ... }

3. DRY (Don't Repeat Yourself)

  • Constantes extraídas y reutilizables
  • Maps para evitar if-else repetitivos
// ✅ Bien
const VARIANT_CLASS_MAP: Record<ButtonVariant, string> = {
  primary: 'isPrimary',
  secondary: 'isSecondary',
  // ...
}

// ❌ Mal
if (variant === 'primary') return 'isPrimary'
if (variant === 'secondary') return 'isSecondary'
// ...

4. Código Auto-documentado

  • Eliminar comentarios redundantes
  • El código debe explicarse por sí mismo
// ✅ Bien
const buildClassNames = (variant, size, fullWidth, loading, className) => { ... }

// ❌ Mal
// Construye los nombres de clase
const getClasses = (v, s, fw, l, cn) => { ... }

5. Type Safety

  • TypeScript con tipos estrictos
  • Type guards para discriminated unions
  • Exports de tipos reutilizables
export type ButtonProps = ButtonAsButton | ButtonAsLink | ButtonAsRouterLink
export type ButtonVariant = 'primary' | 'secondary' | ...
export type ButtonSize = 'small' | 'medium' | 'large'

6. Single Responsibility

  • Cada módulo tiene una sola razón para cambiar
  • Separación de concerns (UI, tokens, theme)

7. Imports Explícitos

  • Barrel exports para mejor tree-shaking
  • Subpaths optimizados
// ✅ Recomendado
import { Button } from 'sanitas-ui-design-system/ui'
import { tokens } from 'sanitas-ui-design-system/tokens'

// ✅ También válido
import { Button, tokens } from 'sanitas-ui-design-system'

Exports Disponibles

El paquete ofrece diferentes puntos de entrada para optimizar tree-shaking:

// Componentes UI
import { Button } from 'sanitas-ui-design-system/ui'

// Design Tokens
import { tokens } from 'sanitas-ui-design-system/tokens'

// Iconos
import { icons } from 'sanitas-ui-design-system/icons'

// Estilos CSS
import 'sanitas-ui-design-system/styles'       // Estilos principales
import 'sanitas-ui-design-system/tokens.css'   // Solo tokens CSS
import 'sanitas-ui-design-system/theme.css'    // Solo tema CSS

// Export principal (incluye todo)
import { Button, tokens } from 'sanitas-ui-design-system'

Estructura del Proyecto

src/
├── ui/               # Componentes de UI
│   └── components/   # Componentes React
│       └── Button/
├── tokens/           # Design tokens
├── theme/            # Tema visual
├── icons/            # Iconos
└── styles/           # Estilos globales

Desarrollo

# Instalar dependencias
pnpm install

# Modo desarrollo
pnpm dev

# Build
pnpm build

# Storybook
pnpm storybook

Contribuir

Al agregar nuevos componentes:

  1. Seguir los principios de Clean Code
  2. Crear tests unitarios
  3. Documentar en Storybook
  4. Exportar tipos TypeScript
  5. Usar tokens del design system