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

wgp-next-shop-ui-lib

v0.2.16

Published

Библиотека UI-компонентов для Next-Shop с поддержкой e-commerce функций

Readme

WGP Next-Shop UI Library

Комплексная библиотека UI-компонентов для создания e-commerce решений на Next.js с поддержкой Elasticsearch и 1C-Битрикс.

📦 Установка

npm install wgp-next-shop-ui-lib

🚀 Быстрый старт

import { ProductCard, Slider, useCart } from 'wgp-next-shop-ui-lib';

function App() {
  const { addItem, items, totalPrice } = useCart();

  const product = {
    id: '1',
    name: 'Товар',
    price: 1000,
    image: '/product.jpg'
  };

  return (
    <div>
      <ProductCard 
        product={product} 
        onAddToCart={addItem}
      />
      <p>Товаров в корзине: {items.length}</p>
      <p>Общая стоимость: {totalPrice} ₽</p>
    </div>
  );
}

🔧 Локальная разработка

Метод 1: npm link (рекомендуемый)

Для удобной разработки без постоянной публикации пакета:

# В папке ui-lib
npm link

# В основном проекте
npm link wgp-next-shop-ui-lib

# Теперь изменения в ui-lib применяются мгновенно!
npm run dev

Отключение npm link

# В основном проекте
npm unlink wgp-next-shop-ui-lib
npm install wgp-next-shop-ui-lib@latest

# В папке ui-lib
npm unlink

Метод 2: Прямой путь в package.json

Альтернативный способ - указать локальный путь:

{
  "dependencies": {
    "wgp-next-shop-ui-lib": "file:./ui-lib"
  }
}

Метод 3: Монорепо с workspace

{
  "workspaces": [
    "ui-lib",
    "apps/*"
  ]
}

📦 Доступные компоненты

Layout

  • Header - Шапка сайта
  • Footer - Подвал сайта
  • Navbar - Навигационное меню
  • Logo - Логотип

Catalog

  • ProductCard - Карточка товара
  • ProductGrid - Сетка товаров
  • CategoryList - Список категорий
  • Filters - Фильтры товаров

Cart

  • Cart - Корзина покупок
  • CartItem - Элемент корзины
  • MiniCart - Мини-корзина

Media

  • Slider - Универсальный слайдер
  • PayList - Список способов оплаты
  • Gallery - Галерея изображений

Common

  • Button - Кнопка с вариантами стилей
  • Modal - Модальное окно
  • Form - Компоненты форм

🎯 Hooks

  • useCart - Управление корзиной
  • useSearch - Поиск товаров
  • useFilters - Фильтрация

🛠 Utils

  • constants - Константы для e-commerce
  • API клиенты и утилиты

📝 Разработка нового компонента

  1. Создайте папку компонента:
mkdir -p src/components/Category/ComponentName
  1. Создайте файл компонента:
'use client';

const ComponentName = ({ 
  // пропсы
}) => {
  return (
    <div>
      {/* JSX */}
    </div>
  );
};

export default ComponentName;
  1. Добавьте экспорт в src/index.js:
export { default as ComponentName } from './components/Category/ComponentName/ComponentName.jsx';
  1. Обновите версию в package.json

  2. Опубликуйте (для продакшена):

npm publish

🔄 Workflow разработки

Локальная разработка

  1. npm link в ui-lib
  2. npm link wgp-next-shop-ui-lib в основном проекте
  3. Разрабатывайте компоненты с hot reload
  4. Тестируйте на /test-components

Уже выполнено:

cd ui-lib && npm link # Создана глобальная ссылка cd .. && npm link wgp-next-shop-ui-lib # Проект связан с локальной версией

Теперь просто разрабатывайте:

1. Редактируйте файлы в ui-lib/src/

2. Изменения сразу видны в браузере

3. Тестируйте на http://localhost:3002/test-components

Быстрое связывание/отвязывание

npm run link:ui # Связать с локальной версией npm run unlink:ui # Вернуться к npm версии

Разработка с автосвязыванием

npm run dev:link # Связать и запустить dev npm run dev:unlink # Отвязать и запустить dev

Публикация

  1. Обновите версию в package.json
  2. npm publish
  3. npm install wgp-next-shop-ui-lib@latest в проектах

🎨 Примеры использования

PayList компонент

import { PayList } from 'wgp-next-shop-ui-lib'

function CheckoutPage() {
  const customMethods = [
    { id: 'card', name: 'Банковская карта', icon: '💳' }
  ];

  return (
    <PayList 
      title="Выберите способ оплаты"
      paymentMethods={customMethods}
      customStyles={{
        container: 'border-2 border-blue-100',
        title: 'text-blue-600'
      }}
      onMethodClick={(method) => {
        console.log('Выбран:', method.name);
      }}
    />
  );
}

ProductCard компонент

import { ProductCard } from 'wgp-next-shop-ui-lib'

function CatalogPage() {
  const product = {
    id: 1,
    name: 'Товар',
    price: 1999,
    images: ['/image.jpg']
  };

  return (
    <ProductCard 
      product={product}
      onAddToCart={(product) => {
        // добавить в корзину
      }}
    />
  );
}

📋 TODO

  • [ ] Добавить больше компонентов Layout
  • [ ] Создать систему тем
  • [ ] Добавить TypeScript определения
  • [ ] Создать Storybook для документации
  • [ ] Добавить тесты компонентов

🤝 Участие в разработке

  1. Форк проекта
  2. Создание ветки для фичи
  3. Локальная разработка с npm link
  4. Тестирование на /test-components
  5. Pull request

Версия: 0.2.7
Автор: IvanPin
Лицензия: ISC

📞 Поддержка