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-repick

v0.0.2

Published

A collection of React pickers.

Downloads

16

Readme

React Pickers Library

A collection of reusable picker components including a Color Picker, Date Picker, Time Picker, and Date Range Picker. These components are built using React, TypeScript, and Tailwind CSS.

Components

  • ColorPicker: A custom color picker with predefined colors and a color wheel.
  • DatePicker: A date picker to select a single date.
  • TimePicker: A time picker to select a time with AM/PM format.
  • DateRangePicker: A date range picker to select a start and end date.

Installation

To install the Pickers library, add it to your project using npm or yarn:

npm install react-repick
# or
yarn add react-repick
# or
pnpm add react-repick

Usage

ColorPicker

The ColorPicker component allows users to select a color from a predefined set or a color wheel.

import React, { useState } from 'react';
import { ColorPicker } from 'react-repick';

const App: React.FC = () => {
    const [color, setColor] = useState('#ff0000');
    const [showColorPicker, setShowColorPicker] = useState(false);

    return (
        <div>
            <button onClick={() => setShowColorPicker(!showColorPicker)}>
                Toggle Color Picker
            </button>
            <ColorPicker
                color={color}
                onColorChange={setColor}
                show={showColorPicker}
            />
        </div>
    );
};

export default App;

DatePicker

The DatePicker component allows users to select a single date.

import React, { useState } from 'react';
import { DatePicker } from 'react-repick';

const App: React.FC = () => {
    const [selectedDate, setSelectedDate] = useState(new Date());
    const [showDatePicker, setShowDatePicker] = useState(false);

    return (
        <div>
            <button onClick={() => setShowDatePicker(!showDatePicker)}>
                Toggle Date Picker
            </button>
            <DatePicker
                selectedDate={selectedDate}
                onChange={setSelectedDate}
                show={showDatePicker}
                setIsOpen={setShowDatePicker}
            />
        </div>
    );
};

export default App;

TimePicker

The TimePicker component allows users to select a time with AM/PM format.

import React, { useState } from 'react';
import { TimePicker } from 'react-repick';

const App: React.FC = () => {
    const [time, setTime] = useState('12:00 PM');
    const [showTimePicker, setShowTimePicker] = useState(false);

    return (
        <div>
            <button onClick={() => setShowTimePicker(!showTimePicker)}>
                Toggle Time Picker
            </button>
            <TimePicker value={time} onChange={setTime} />
        </div>
    );
};

export default App;

DateRangePicker

The DateRangePicker component allows users to select a start and end date.

import React, { useState } from 'react';
import { DateRangePicker } from 'react-repick';

const App: React.FC = () => {
    const [startDate, setStartDate] = useState<Date | null>(null);
    const [endDate, setEndDate] = useState<Date | null>(null);
    const [showDateRangePicker, setShowDateRangePicker] = useState(false);

    const handleDateChange = (start: Date | null, end: Date | null) => {
        setStartDate(start);
        setEndDate(end);
    };

    return (
        <div>
            <button
                onClick={() => setShowDateRangePicker(!showDateRangePicker)}
            >
                Toggle Date Range Picker
            </button>
            <DateRangePicker
                startDate={startDate}
                endDate={endDate}
                onChange={handleDateChange}
                show={showDateRangePicker}
                onShow={setShowDateRangePicker}
                selectedStartDate={startDate}
                selectedEndDate={endDate}
            />
        </div>
    );
};

export default App;

API

ColorPicker Props

API:

  • color: The current selected color.
  • onColorChange: Callback function to handle color change.
  • show: Boolean to show or hide the color picker.

DatePicker Props

API:

  • selectedDate: The currently selected date.
  • onChange: Callback function to handle date change.
  • show: Boolean to show or hide the date picker.
  • setIsOpen: Callback function to set the visibility of the date picker.

TimePicker Props

API:

  • value: The currently selected time.
  • onChange: Callback function to handle time change.

DateRangePicker Props

API:

  • startDate: The currently selected start date.
  • endDate: The currently selected end date.
  • onChange: Callback function to handle date range change.
  • show: Boolean to show or hide the date range picker.
  • onShow: Callback function to set the visibility of the date range picker.
  • selectedStartDate: The selected start date.
  • selectedEndDate: The selected end date.

License

MIT License