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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@delibrandev/utils

v1.0.153

Published

A collection of delibran utils.

Readme

INSTALACIÓN

Última versión

npm install @delibrandev/utils@latest

ESTILOS

Uso en index.js del proyecto : import "@delibrandev/utils/src/styles.css";

 --color-primary: #000;
 --color-primary-background: #ece9e4;
 --color-primary-shadow: rgba(182, 182, 182, 0.2);
 --color-secondary: #fff;
 --color-secondary-background: #fefcfa;
 --color-terciary: #979796;
 --color-terciary-2: lightgrey;
 --color-terciary-3: grey;
 --color-success: #00C76C;
 --color-success-background: rgb(0, 199, 108, 0.2);
 --color-pending: #EB9E1A;
 --color-pending-background: rgb(235, 158, 26, 0.2);
 --color-error: #FF5757;
 --color-error-background: rgb(255, 87, 87, 0.2);
 --color-process: #0057FF;
 --color-process-background: rgb(0, 87, 255, 0.2);

COMPONENTS

Uso: import { Componente } from "@delibrandev/utils";

StateLabel

Recibe un valor de estado y devuelve un label con un color y fondo Valores posibles: "pending", "prepared", "paid", "delivered", "inPreparation", "inDelivery", "cancelled". Text no es obligatorio, si se le pasa se usará como texto.

<StateLabel state={state} text={""}/>

TextEditor

Recibe un valor en HTML

Obtienes el valor: document.getElementById(editorId).innerHTML;

<TextEditor initialValue={policy.text} id={editorId}/>

TextArea

Textarea personalizado con título y descripción

<Textarea id={""} placeholder={""} classname={""} label={""} description={""} onChange={callback}/>

Input

Input personalizado con título, descripción y control de errores Valores posibles de validation: "email", "dni", "nif", "telefono", "url", "number".

Revisar suggestions y suggestionsCallback como se usa en TPV > commander > order > header

<Input id={""} type={""} placeholder={""} classname={""} icon={null} iconType={null} iconPositionRight={true} label={""} description={""} defaultValue={""} disabled={false} validation={null} onChange={callback} suggestions={suggestions} suggestionsCallback={handleSuggestion}/>

Input Image

Input que maneja imágenes con un fondo personalizado

<InputImage uniqueId={"logo-ticket"} className={"product-image-featured"} image={null} />

Button

Clases posibles: customButtonColor1, customButtonColor2, customButtonDisabled, customButtonSuccess, customButtonDanger

{<Button text={"Guardar"} icon={null} customClass={""} action={callback} />}

Select

Select personalizado con título, descripción Formato esperado: [{ id: 0, name: "8:00" }].

<Select value={""} values={[]} callback={callback} id={""} label={""} description={""} classname={""} />

Checkbox

Checkbox personalizado con descripción

<Checkbox text={text} clickEvent={()=>null} checked={false} className={""} />

NoImage

Si no existe la imagen (null, undefined o cualquier otro problema), debe cargarse el siguiente componente sustituyendo a la etiqueta img.

<NoImage />

Order components

import { ClientDetails, OrderInfo, OrderNotes, OrderProducts, OrderResume, OrderTimeline, OrderShoppingCart } from "@delibrandev/utils";

CartActions debe pasarse desde los componentes del propio proyecto por ahora.

<OrderInfo data={data} />
<OrderProducts data={data} />
<OrderResume data={data} />
<OrderNotes data={data} />
<ClientDetails data={data} />
<OrderTimeline data={data} />
<OrderShoppingCart data={data} CartActions={CartActions} />

PinPad

Teclado numérico

<PinPad callback={() => null} inputText="Ingrese su pin" />

CardList

Listado de tarjetas (usado en usuarios, equipos.. en login), se espera en el array el campo "fullname" o "name".

<CardList callback={() => null} data={userList} title={"Seleccione el usuario"} icon={<LuUser />}/>

Datatable

import { Datatable } from "@delibrandev/utils";

<Datatable
            identificator={identificator}
            title={""}
            subtitle={""}
            data={addIdKeyIfMissing(data)}
            customHeaders={customHeaders}
            customData={customData}
            sections={sections}
            checkColumn={checkColumn}
            checkedRows={checkedRows}
            handleCheckColumn={handleCheckColumn}
            handleSelectedRows={handleSelectedRows}
          />

Requiere:

const identificator = "unique-name-identificator";

const checkColumn = useSelector((state) => state.aplicationConfig.userConfig.datatable.tables[identificator]?.checkColumn);

const checkedRows = useSelector((state) => state.aplicationConfig.userConfig.datatable.tables[identificator]?.selectedRows);

const handleCheckColumn = () => {
    dispatch(updateDatatableCheckColumn({ table: identificator }));
};

const handleSelectedRows = (updatedSelectedRows = null) => {
    dispatch(updateDatatableSelectedRows({ selectedRows: updatedSelectedRows, table: identificator }));
};

const sections = [
    {text: null, callback: () => null, actions: ["search"], actionsWithSelect: []},
];

const customHeaders = {
    name: "Nombre",
};

const customData = {
    status: (data) => (data === "PUBLISHED" ? <SwitchText defaultChecked /> : <SwitchText />),
};

FUNCIONES

Uso: import { funcion } from "@delibrandev/utils/src/function.js";

getRequiredKeys

Recibe un objeto para evaluar sus valores. Si el valor de la clave es "required" significa que debía contener un valor y no lo tiene. Devolverá todos los que cumplen esa condición.

const obj = {
    identifier: document.getElementById("identifier").value || "required",
    name: document.getElementById("name").value || "required"
}
getRequiredKeys(obj)

addIdKeyIfMissing

Recibe un array con ids customs en sus objetos y genera la clave id en cada uno para normalizarlo. Claves gestionadas: "categoryId", "productId", "catalogId", "discountId", "itemId", "itemGroupId", "optionId", "optionGroupId", "salesChannelId"

const arr = [{
    categoryId: "0001",
    name: "example"
}]
addIdKeyIfMissing(arr)

translateMessage

Recibe un mensaje y lo traduce si lo encuentra en el diccionario, sino lo devuelve tal cual.

translateMessage(cadena)
Devolverá siendo el type (error|warning|success|normal): { called: true, title: "Error", message: cadena, type: "error" };