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

react-dev-starter-pack

v0.0.74

Published

This package is a union of different helpers. Functions, hooks, components-builders and so on. To use it you should add specific packages to your project: - redux, redux-toolkit, redux-saga - react-hook-form, yup

Downloads

234

Readme

react-starter-kit

This package is a union of different helpers. Functions, hooks, components-builders and so on. To use it you should add specific packages to your project:

  • redux, redux-toolkit, redux-saga
  • react-hook-form, yup

Navigation

Builders

Components-builders

Builders

router

Usage

Argument of function is an object, which specifies route object. Output is an object too, but with some features. You will receive root: '/' field, and root for every object inside, and the value will be name of field. Every child string field will have prefix which is combpination of parent's(obj) fields names.

You can override root. You can disable adding prefixes by adding ! to start of string.

import { builders } from "react-dev-starter-pack";

export const routes = builders.router({
  sandbox: "/sandbox",
  auth: {
    login: "/login",
    password: "/password",
  },
  cabinet: {
    root: '/lk',
    transactions: '/transactions',
    profile: '!/custom-route/profile'  
  },
});

Output

{
    root: '/',
    auth: {
       root: '/auth',
       login: "/auth/login",
       password: "/auth/password",
    },
    sandbox: "/sandbox",
    cabinet: {
       root: '/lk',
       transactions: '/lk/transactions',
       profile: '/custom-route/profile'  
    },
}

Yup

Under the hood yupBuilder has built version of yup, but you shoud to install @types/yup as devDeps.

Usage
export const YUP = builders.yup({
  text: {
    max: () => "Max",
    min: () => "Min",
    req: "Req",
    email: "Email",
  },
  customSchemas: {},
});

Output - Object

| Property | Definition | | :---: | :---: | | instance | equals to import * as yup from 'yup' | | schemas | collection of common schemas + your custom | | resolver | @hookform resolver | | create | equals to yup.object().shape | | create | equals to yup.object().shape | | text | text snippets |

localStorage

This builder is kind of Proxy between developer and localStorage. It has only one parameter - generic type of your localStorage model. It will automatically do JSON.stringify/parse. Also it has full typescript support.

Usage
import {builders} from "react-dev-starter-pack";

export const lcController = builders.localStorage<{
    id: string,
    user: {
        name: string,
        age: number
    }
}>()

| Property | Definition | | :---: | :---: | | get | typed get | | set | typed set | | clear | localStorage.clear() |

api

Makes your function async and awaiting of result. Has try-catch under the hood. Returns Promise<AxiosResponse> Usage

apiBuilder((phone: string) =>
  authAxios.get(`/user?phone_number=${phone}`)
);

component

Error boundary wrapper with custom fallback component.

Usage

export const createFC = builders.component(() => (
  <div>Something went wrong...</div>
));
export default createFc((props:any) => {
    return <div>{{}}</div> // your application will not fall
})

Component builders

I have not finished it yet, so you should to specify styles for overriding like: label.label input.input

Input

InputBuilder. Output is object with different inputs.

export const Input = UIBuilders.InputTextBuilder({
  classNames: {
    elements: {
      input: styles.input,
      label: styles.label,
      error: styles.error,
      wrapper: styles.wrapper,
    },
    state: {
      error: styles.error_state,
    },
  },
  icons: {
    lock: Lock,
    edit: Edit,
    eyeClosed: EyeClosed,
  },
});

Switch

Usage

export const Switch = UIBuilders.SwitchBuilder({
  classNames: {
    input: styles.input,
    circle: styles.circle,
    circleContainer: styles.circleContainer,
    container: styles.container,
  },
});

Use css vars for restyling rect:

--circle-width: 50px;
--padding: 5px;
--border-radius: 40px;

CheckInput

Radio & Checkbox

Usage variant 1

export const CheckInput = UIBuilders.CheckInputBuilder({
  classNames: {
    input: styles.input,
  },
  icons: {
    checkbox: {
      checked: Icons.ui.CheckBoxChecked,
      unchecked: Icons.ui.CheckBoxUnchecked,
    },
    radio: {
      checked: Icons.ui.RadioChecked,
      unchecked: Icons.ui.RadioUnchecked,
    },
  },
});

Usage variant 2

export const PillSwitch = UIBuilders.CheckInputBuilder<"custom", payloadType>({
  classNames: {
    input: styles.input,
  },
  customElement: {
    component: ({ text }) => {
      return <div className={styles.pill}>{text}</div>;
    },
  },
}).group;
.input:checked + .pill {
    background: linear-gradient(180deg, #052DB9 0%, #4B78F2 100%);
    box-shadow: 0px 5px 9px rgba(40, 112, 219, 0.36);
    color: white;
}

.pill {
    width: 131px;
    padding: 10px;
    font-size: 18px;
    transition: .4s;
    text-align: center;
    color: black;
    background: linear-gradient(180deg, #FFFFFF 100%, #FFFFFF 100%);
    border: 1px solid #8FA4B0;
    box-sizing: border-box;
    border-radius: 24px;
}

Hooks