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-light-calendar

v1.0.3

Published

A simple, yet customizable React component for rendering date pickers

Downloads

7

Readme

React-Light-Calendar js-standard-style

A minimalistic calendar picker for React.

Install

$ npm install --save moment # required
$ npm install --save react-light-calendar

Features

  • Controlled Input - to keep it in sync with your app
  • Customizable - Plug your own theme (More themes to come)
  • i18n - Based on your moment configuration

Usage

import Calendar from 'react-light-calendar'

// ...

<Calendar
  date={this.state.selected} // Required: moment instance
  onChange={selected => this.setState({ selected })} // Required: callback function
  theme={...} // Optional: see theming section for more details
  activatedIntervals={[...]} // Optional: see intervals section for more details
  disabledIntervals={[...]} // Optional: see intervals section for more details
/>

Theming

The following object can be passed to custmize your calendar:

const theme = {
  // Header section (displays month)
  // Default:
  // text-transform: uppercase;
  // background-color: rgba(224, 224, 224);
  // border-bottom: 1px solid #d7d8d9;
  // text-align: center;
  // padding: 12px;
  //
  // Non overridable:
  // position: relative;
  header: {
    // ...
  },
  // Each day name
  // Default:
  // font-weight: bold;
  // padding: 12px 0;
  // text-align: center;
  dayName: {
    // ...
  },
  // Day cells that are not within current month range
  // Default:
  // padding: 12px 0;
  // text-align: center;
  // cusor: pointer;
  // border-radius: 2px;
  // color: #a7a8a9;
  outOfMonth: {
    // ...
  },
  // Day cells that are within current month range
  // Default:
  // padding: 12px 0;
  // text-align: center;
  // cusor: pointer;
  // border-radius: 2px;
  // color: #313131;
  currentMonth: {
    // ...
  },
  // Today
  // Default:
  // padding: 12px 0;
  // text-align: center;
  // cusor: pointer;
  // border-radius: 2px;
  // color: #313131;
  // font-style: italic;
  today: {
    // ...
  },
  // Selected date
  // Default:
  // padding: 12px 0;
  // text-align: center;
  // cusor: pointer;
  // border-radius: 2px;
  // color: #fff;
  // background-color: #323a45;
  selected: {
    // ...
  },
  // Disabled days for intervals
  // Default:
  // padding: 12px 0;
  // text-align: center;
  // cusor: not-allowed;
  // border-radius: 2px;
  // color: #ff003c;
  // opacity: .5;
  disabled: {
    // ...
  }
}

Intervals

You can either provide a activatedIntervals or disabledIntervals property to the calendar to restrict available choices. These properties are arrays and contain the following objects:

// Only dates between Feb. 1st (included) and Feb. 14th (included) will be available.
const activatedIntervals = [{
  from: moment('01/02/2017', 'DD/MM/YYYY'),
  to: moment('14/02/2017', 'DD/MM/YYYY')
}]