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

@elcrm/alert

v0.1.1

Published

React-алерты для elCRM в стиле iOS: Promise API, Confirm, иконки и темы через CSS-переменные.

Readme

@elcrm/alert

React-библиотека алертов для elCRM в стиле iOS: Promise API, Confirm, иконки и кастомизация через CSS-переменные.

npm version license

Установка

npm install @elcrm/alert
# или
bun add @elcrm/alert

Peer-зависимости: react ≥ 18, react-dom ≥ 18.

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

import { Alert } from "@elcrm/alert";
import "@elcrm/alert/style.css";
import "@elcrm/alert/light.css"; // или dark.css

function App() {
    const show = async () => {
        const result = await Alert.Send({
            title: "Заголовок",
            text: "Текст сообщения",
        });
        if (result.confirmed) {
            // подтверждено
        }
    };

    return (
        <>
            <button onClick={show}>Показать</button>
            <Alert.Init />
        </>
    );
}

Обязательно смонтируйте <Alert.Init /> в корне приложения.

API

Alert.Init

Корневой рендер текущего алерта. Добавьте один раз в приложение.

Alert.Send(content, callback?, cancel?)

Показать алерт. Без callback возвращает Promise<AlertResult>; с callback — void (обратная совместимость).

| Поле | Тип | Описание | | ---------------- | --------------------------------------------- | --------------------------------------------- | | title | string | Заголовок | | text | string | Текст | | icon | "success" \| "error" \| "warning" \| "info" | Иконка | | button | string \| AlertButton | Одна кнопка | | buttons | AlertButton[] | Несколько кнопок | | classNames | string | Доп. CSS-классы на overlay | | closeOnOverlay | boolean | Закрытие кликом по фону (по умолчанию true) | | closeOnEscape | boolean | Закрытие по Escape (по умолчанию true) |

type AlertButton = {
    label: string;
    color?: "blue" | "red" | "default";
    action?: "confirm" | "cancel" | string;
    onClick?: () => void;
};

type AlertResult = {
    confirmed: boolean;
    action?: string;
};

Alert.Confirm(content)

Диалог с кнопками «Отмена» / «Подтвердить». Возвращает Promise<boolean>.

const ok = await Alert.Confirm({
    title: "Удалить файл?",
    text: "Это действие нельзя отменить",
    icon: "warning",
});

Примеры

Иконка

await Alert.Send({
    title: "Успех!",
    text: "Файл сохранён",
    icon: "success",
});

Несколько кнопок

const result = await Alert.Send({
    title: "Выберите действие",
    text: "Что сделать с файлом?",
    buttons: [
        { label: "Отмена", action: "cancel", color: "default" },
        { label: "Изменить", action: "edit", color: "blue" },
        { label: "Удалить", action: "delete", color: "red" },
    ],
});
console.log(result.action);

Callback API

Alert.Send(
    { title: "Заголовок", text: "Текст" },
    () => console.log("Подтверждено"),
    () => console.log("Отменено"),
);

Темы и CSS

import "@elcrm/alert/style.css";
import "@elcrm/alert/light.css"; // body[data-theme="light"]
import "@elcrm/alert/dark.css"; // body[data-theme="dark"]
document.body.setAttribute("data-theme", "dark");

| Переменная | Назначение | | ----------------------------- | ----------------- | | --alert-color | Цвет текста | | --alert-overlay | Фон overlay | | --alert-overlay-filter | blur overlay | | --alert-background | Фон окна | | --alert-radius | Скругление | | --alert-shadow | Тень | | --alert-filter | blur окна | | --alert-separator-color | Разделитель | | --alert-button-* | Стили кнопок | | --alert-button-color-blue | Синяя кнопка | | --alert-button-color-red | Красная кнопка | | --alert-button-color-default| Обычная кнопка |

Поведение

  • SSR-безопасно (без DOM не рендерится)
  • Portal в document.body, блокировка скролла
  • ARIA (alertdialog), focus trap, Escape
  • Анимация появления / закрытия (~200 ms)

Лицензия

MIT © MaSkal