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 🙏

© 2024 – Pkg Stats / Ryan Hefner

atomicatoms

v1.0.15

Published

A small library for little components based in atomic design

Downloads

42

Readme

Atomic Atoms

A small library for little components based in atomic design

Install

To install the library, run on terminal

npm i atomicatoms

Make sure that you have installed type script loader.

Import

To import an atomicatom in your project

import {button} from 'atomicatoms';

All components

All the components have 3 params in common that you must pass when instanciate the component. This params are:

parent

Is the parent container of component. When the component will be creted, will do into parent.

example:

parent: '#container1'

className

Class name that you would add to component. Separate with space.

example:

className: 'myClass1 myClass2'

events

It's an object with the events that you want to add in the component.

example:

events: {
    click: (e) => 
        console.log('click', e.target.value),
    change: (e) => 
        console.log('change', e.target.value),
}

Container

This component is a little different than the others. Component doesn't accept className and events. The component only creates an array of container that displays into parent.

container({
    type: 'div',
    parent: 'body',        container: ['container1','container2','container3']
});

Button

import {button} from 'atomicatoms';

example:

button({
    parent: '#container1',
    className:'login__button',
    atomicName: 'button', // optional
    text: 'Login',
    events: {
        click: () =>
            console.log('hello world')
    }
});

Radio button

import {radioButton} from 'atomicatoms';

example:

radioButton({
    parent: '.genders',
    className: 'gender__radio',
    atomicName: 'radioButtons', // optional
    list: [{
        name: 'gender',
        text: 'male',
        value: '1',
        checked: true
    },{
        name: 'gender',
        text: 'female',
        value: '2',
        checked: false
    }],
    events: {
        click: (e) => console.log(e.target.parentElement.getValue())
    }
});

Checkbox

import {checkBox} from 'atomicatoms';

example

checkBox({
    parent: '#container1',
    className: 'hello eoo',
    atomicName: 'checkBoxers', // optional
    list: [{
        text: 'hello',
        value: '1',
        checked: true
    },{
        text: 'ssss',
        value: '2',
        checked: true
    }], 
    events: {
        click: (e) => console.log(e.target.parentElement.getValue())
    }
});

Select

import {select} from 'atomicatoms';

example

select({
    parent: '#container1',
    className: 'class',
    atomicName: 'selector', // optional
    options: [{
        text: 'opt1',
        value: '1',
        selected: false
    },{
        text: 'opt2',
        value: '2',
        selected: false
    }],
    events: {
        change: (e) => console.log(e.target.value)
    }
});

Input

import {input} from 'atomicatoms';

example

input({
    parent: '#container1',
    className: 'ssss',
    atomicName: 'input', // optional
    type:'text',
    value:'value',
    placeholder:'Placeholder', 
    events: {
        change: (e) => console.log(e.target.value)
    }
});

Textarea

import {textarea} from 'atomicatoms';

example

input({
    parent: '#container1',
    className: 'ssss',
    atomicName: 'textarea', // optional
    value:'value',
    placeholder:'Placeholder', 
    events: {
        change: (e) => console.log(e.target.value)
    }
});

Img

import {img} from 'atomicatoms';

example

img({
    parent: '.img',
    className: 'myClass',
    atomicName: 'img', // optional
    src:'https://res.cloudinary.com/glovoapp/w_1200,f_auto,q_auto/Stores/gfcwneqwjwva7whbg8oa',
    alt: 'myAlt',
    events: {
        change: (e) => console.log(e.target.value)
    }
});

Link

import {link} from 'atomicatoms';

example

link({
    parent: '#container1',
    className: 'classer',
    atomicName: 'link', // optional
    text: 'My link text',
    href:'https://res.cloudinary.com/glovoapp/w_1200,f_auto,q_auto/Stores/gfcwneqwjwva7whbg8oa',
    title: 'My link title',
    target: '_blank',
    events: {
        change: (e) => console.log(e.target.value)
    }
});

Text

import {text} from 'atomicatoms';

example

text({
    parent: '#container1',
    className: 'ssss',
    atomicName: 'text', // optional
    title: 'My title', 
    type: 'h1',
    events: {
        change: (e) => console.log(e.target.value)
    }
});

List

List component has a data-id to identify each li element.

import {list} from 'atomicatoms';

example

list({
    parent: '#container1',
    className: 'ssss',
    atomicName: 'list', // optional
    list: [{
        text: 'helo',
        id: '1'
    },{
        text: 'uuuu',
        id: '2'
    }], 
    events: {
        click: (e) => console.log(e.target)
    }
});

Events

getData

When this function is triged, all atomicAtoms in document put their data into an object with their atomicName.

example

import {button, getData} from 'atomicAtoms';

button({
    parent: '#container1',
    className:'login__button',
    atomicName: 'button', // optional
    text: 'Login',
    events: {
        click: () => getData()
    }
});

output

{
    checkBox: (2) ["1", "2"]
    input: "value"
    inputFile: ""
    radio: "1"
    select: "1"
    textarea: "value"
}

Thank you :)