react-day-picker
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -66,4 +66,2 @@ "use strict"; | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
var month = this.state.month; | ||
@@ -74,3 +72,3 @@ | ||
if (_this.props.onNextMonthClick) { | ||
_this.props.onNextMonthClick(_this.state.month); | ||
_this.props.onNextMonthClick(_this.state.month, e); | ||
} | ||
@@ -83,4 +81,2 @@ }); | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
var month = this.state.month; | ||
@@ -91,3 +87,3 @@ | ||
if (_this.props.onPrevMonthClick) { | ||
_this.props.onPrevMonthClick(_this.state.month); | ||
_this.props.onPrevMonthClick(_this.state.month, e); | ||
} | ||
@@ -94,0 +90,0 @@ }); |
{ | ||
"name": "react-day-picker", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Minimalistic date picker component for React and momentjs.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/DayPicker.js", |
@@ -19,3 +19,3 @@ # react-day-picker | ||
This date picker works with modifiers, as in [BEM-like syntax](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/). You set the modifiers as functions returning `true` or `false`. | ||
This date picker works with modifiers, as in [BEM-like syntax](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/). You set the modifiers as functions returning `true` or `false`. | ||
@@ -30,3 +30,3 @@ Modifiers give you a lot of freedom: for example, a `selected` modifier could highlight *a range* of selected days, or a `weekend` modifiers could format the weekend days. | ||
The following component implements the DayPicker and saves the selected day in its own `state`. | ||
The following component implements the DayPicker and saves the selected day in its own `state`. | ||
It also adds the `daypicker__day--today` CSS modifier for today, and a `daypicker__day--selected` CSS modifier to the cell corresponding to the clicked/touched day. | ||
@@ -44,3 +44,3 @@ | ||
var MyDatePicker = React.createClass({ | ||
handleDayTouchTap(day, modifiers, event) { | ||
@@ -58,3 +58,3 @@ this.setState({ selectedDay: day }); | ||
// add the `selected` modifier for the selected day | ||
return this.state.selectedDay | ||
return this.state.selectedDay | ||
&& isSameDay(this.state.selectedDay, day); | ||
@@ -64,3 +64,3 @@ } | ||
return ( | ||
<DayPicker modifiers={ modifiers } | ||
<DayPicker modifiers={ modifiers } | ||
onDayTouchTap={this.handleDayTouchTap} /> | ||
@@ -89,6 +89,6 @@ ); | ||
### Props | ||
### Props | ||
```js | ||
<DayPicker | ||
<DayPicker | ||
initialMonth={Object} | ||
@@ -135,3 +135,3 @@ enableOutsideDays={Boolean} | ||
Use one of these attributes to add an event handler when the user touches/clicks a day. | ||
Use one of these attributes to add an event handler when the user touches/clicks a day. | ||
@@ -147,7 +147,10 @@ * `day <Object>` the touched day (a moment object) | ||
Use this attribute to add an handler when the mouse enters/leaves a day element. | ||
Use this attribute to add an handler when the mouse enters/leaves a day element. | ||
#### onPrevMonthClick `function(month)` | ||
#### onNextMonthClick `function(month)` | ||
#### onPrevMonthClick `function(month, event)` | ||
#### onNextMonthClick `function(month, event)` | ||
* `month <Object>` the current month (a moment object) | ||
* `event <SyntheticEvent>` the click event | ||
Use this attribute to add an handler when the user switch to the previous/next month. | ||
@@ -154,0 +157,0 @@ |
@@ -57,4 +57,2 @@ import React from 'react'; | ||
handleNextMonthClick(e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
const { month } = this.state; | ||
@@ -64,3 +62,3 @@ const nextMonth = month.clone().add(1, 'month'); | ||
if (this.props.onNextMonthClick) { | ||
this.props.onNextMonthClick(this.state.month); | ||
this.props.onNextMonthClick(this.state.month, e); | ||
} | ||
@@ -71,4 +69,2 @@ }); | ||
handlePrevMonthClick(e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
const { month } = this.state; | ||
@@ -78,3 +74,3 @@ const prevMonth = month.clone().subtract(1, 'month'); | ||
if (this.props.onPrevMonthClick) { | ||
this.props.onPrevMonthClick(this.state.month); | ||
this.props.onPrevMonthClick(this.state.month, e); | ||
} | ||
@@ -81,0 +77,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156
411341
1802