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-trip-date-arron

v0.0.5

Published

forked from react-trip-date, fixed Day.tsx single-day handleChange bug

Downloads

1

Readme

npm downloads dependencies dev dependencies

React-Trip-Date

A date/range picker for your React applications. it was a package for Tripema.com

  • Multiple Month, Custom Responsive, Number Of Selectable Days
  • Range Picker, Hoverable, Theme base
  • Support Jalali & Gregorian
  • Use Day.js (2KB immutable date and NO moment.js is needed)
  • Bundle size, 30kB (minified + GZipped 9.2 kB)

Demo

Online demo is also available!

OR

To run that demo on your own computer:

  • Clone this repository
  • yarn install
  • yarn start
  • Visit http://localhost:6006/

Getting started

Compatibility

Your project needs to use React 16 or later. If you use older version of React, please refer to the table below to find suitable React-Trip-Date version.

Installation

Add React-Trip-Date to your project by executing npm install react-trip-date or yarn add react-trip-date

if you don't installed styled-components and classnames, you need to install them. npm install styled-components classnames or yarn add styled-components classnames

Usage

Here's an example of basic usage:

import React, { Component } from 'react';
import { DatePicker, RangePicker, theme } from 'react-trip-date';
import {ThemeProvider} from 'styled-components';
const  handleResponsive  =  setNumberOfMonth  =>  {
	let  width  =  document.querySelector('.tp-calendar').clientWidth;
	if  (width  >  900)  {
		setNumberOfMonth(3);
	}  else  if  (width  <  900  &&  width  >  580)  {
		setNumberOfMonth(2);
	}  else  if  (width  <  580)  {
		setNumberOfMonth(1);
	}
};

const  Day = ({  day  }) => {
	return  (
		<>
			<p  className="date">{day.format('DD')}</p>
			<p  className="date">7</p>
		</>
		);
	};
	
class MyApp extends Component {

  onChange = date => console.log(date)

  render() {
    return (
      <ThemeProvider theme={theme}>
        <DatePicker
          handleChange={onChange}
		  selectedDays={['2019-11-06']} //initial selected days
		  jalali={false}
		  numberOfMonths={3}
		  numberOfSelectableDays={3} // number of days you need 
		  disabledDays={['2019-12-02']} //disabeld days
		  responsive={handleResponsive} // custom responsive, when using it, `numberOfMonths` props not working
		  disabledBeforToday={true} 
		  disabled={false} // disable calendar 
		  dayComponent={Day} //custom day component 
		  titleComponent={Title} // custom title of days
        />
      </ThemeProvider>
    );
  }
}

Custom styling

If you don't want to use default React-Trip-Date styling to build upon it, you can import theme by using import { theme } from 'react-trip-date instead and custom it.

User guide

DatePicker

Props

|Prop name|Description|Default value|Example values| |----|----|----|----| |handleChange| is a function that return an array of days|n/a|(days) => console.log('selected days',days)| |selectedDays|the initial array of days|[]|['2019-10-01','2019-11-06']| |jalali|choice jalali or gregorian calendar|false|false/true| |numberOfMonths|number of months you need|1|2| |numberOfSelectableDays|number of days you need | 0/Infiniti| 3 |disabledDays|the disabled days that you don't want clickable|[]|['2019-11-04',2019-12-14]| |responsive|custom responsive is function and have a argument for change number of month, when using it, numberOfMonths props not working ||(setNumberOfMonth => setNumberOfMonth(3))| |disabledBeforToday|disabled days before today|true|true/false| |disabled|disabled date picker|false|true/false| |dayComponent|custom day component|n/a| Day = ({ day }) =><p>{day.format('DD')}</p>| |titleComponent|custom title of days week|n/a|const Title=({source })=>{let titleDay = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']return ({titleDay.map(item=>(<p key={Math.random()}>{item}</p>))})}|

RangePicker

Props

|Prop name|Description|Default value|Example values| |----|----|----|----| |handleChange| is a function that return an array of days|n/a|(days) => console.log('selected days',days)| |selectedDays|the initial range date|{from:'',to:''}|{from:'2019-12-12',to:'2019-12-18'}| |jalali|choice jalali or gregorian calendar|false|false/true| |numberOfMonths|number of months you need|1|2| |hoverable|change range date when user hover day |true|true/false |disabledDays|the disabled days that you don't want clickable|[]|['2019-11-04',2019-12-14]| |responsive|custom responsive is function and have a argument for change number of month, when using it, numberOfMonths props not working |n/a|(setNumberOfMonth => setNumberOfMonth(3))| |disabledBeforToday|disabled days before today|true|true/false| |disabled|disabled date picker|false|true/false| |dayComponent|custom day component|n/a| Day = ({ day }) =><p>{day.format('DD')}</p>| |titleComponent|custom title of days week|n/a|const Title=({source })=>{let titleDay = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']return ({titleDay.map(item=>(<p key={Math.random()}>{item}</p>))})}|

special thanks to:

Contributors

feel free to contribute.

License

The GNU GPLv3 License.