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

raro-products-pack

v0.0.3

Published

Mi librería de componentes React

Readme

RARO Products Pack

Libreria de componentes React para construir tarjetas de productos con contador, limite maximo, estado controlado y componentes compuestos.

Instalacion

pnpm add raro-products-pack

Tambien puedes usar npm o yarn:

npm install raro-products-pack
yarn add raro-products-pack

Requiere react y react-dom como peer dependencies (>=18.0.0).

Uso Basico

import { ProductCard } from "raro-products-pack";

const product = {
  id: "1",
  title: "Coffee Mug",
  img: "https://example.com/mug.jpg",
};

export const App = () => {
  return (
    <ProductCard product={product}>
      {() => (
        <>
          <ProductCard.Image />
          <ProductCard.Title />
          <ProductCard.Buttons />
        </>
      )}
    </ProductCard>
  );
};

Ejemplo Completo

import { ProductCard } from "raro-products-pack";

const product = {
  id: "1",
  title: "Product title",
  img: "https://example.com/product.jpg",
};

export const ProductExample = () => {
  return (
    <ProductCard
      product={product}
      className="bg-dark text-white"
      initialValues={{
        count: 4,
        maxCount: 10,
      }}
      onChange={({ product, count }) => {
        console.log(product, count);
      }}
    >
      {({ reset, isMaxCountReached, increasyBy, counter }) => (
        <>
          <ProductCard.Image className="custom-image" />
          <ProductCard.Title className="text-white" />
          <ProductCard.Buttons className="custom-buttons" />

          <button disabled={counter === 4} className="reset-button" onClick={reset}>
            Reset
          </button>

          <button
            disabled={counter === 0}
            className="reset-button"
            onClick={() => increasyBy(-2)}
          >
            -2
          </button>

          <button
            disabled={isMaxCountReached}
            className="reset-button"
            onClick={() => increasyBy(2)}
          >
            +2
          </button>
        </>
      )}
    </ProductCard>
  );
};

Componentes

ProductCard

Componente principal. Maneja el estado del contador y provee el contexto para sus componentes hijos.

| Prop | Tipo | Requerida | Descripcion | | --- | --- | --- | --- | | product | Product | Si | Producto que se mostrara en la tarjeta. | | children | (args: ProductCartHandlers) => ReactNode | Si | Render prop con los handlers y estado del producto. | | className | string | No | Clases CSS adicionales para el contenedor. | | style | CSSProperties | No | Estilos inline para el contenedor. | | onChange | (args: onChangeArgs) => void | No | Callback que se ejecuta cuando cambia el contador. | | value | number | No | Valor controlado del contador. | | initialValues | InitialValues | No | Valores iniciales del contador y limite maximo. |

ProductCard.Image

Muestra la imagen del producto. Si el producto no tiene img, usa una imagen por defecto.

| Prop | Tipo | Requerida | Descripcion | | --- | --- | --- | --- | | className | string | No | Clases CSS adicionales para la imagen. |

ProductCard.Title

Muestra el titulo del producto.

| Prop | Tipo | Requerida | Descripcion | | --- | --- | --- | --- | | className | string | No | Clases CSS adicionales para el titulo. |

ProductCard.Buttons

Muestra los botones - y + junto con el contador actual.

| Prop | Tipo | Requerida | Descripcion | | --- | --- | --- | --- | | className | string | No | Clases CSS adicionales para el contenedor de botones. | | style | CSSProperties | No | Estilos inline para el contenedor de botones. |

Tipos

interface Product {
  id: string;
  title: string;
  img?: string;
}

interface InitialValues {
  count?: number;
  maxCount?: number;
}

interface ProductCartHandlers {
  counter: number;
  isMaxCountReached: boolean;
  product: Product;
  increasyBy: (value: number) => void;
  reset: () => void;
  maxCount?: number;
}

interface onChangeArgs {
  product: Product;
  count: number;
}

Scripts De Desarrollo

pnpm test
pnpm test:watch
pnpm build

Build

El paquete genera archivos CommonJS, ES Modules y declaraciones TypeScript en dist/.

pnpm build

Licencia

ISC