Skip to content

Commit 27b1507

Browse files
2018
1 parent 385e3f4 commit 27b1507

File tree

3 files changed

+89
-38
lines changed

3 files changed

+89
-38
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ The examples are hosted within the docs folder and are ran in the simple app tha
154154

155155
## License
156156

157-
Copyright (c) 2017 HackerOne Inc. and individual contributors. Licensed under MIT license, see [LICENSE](LICENSE) for the full license.
157+
Copyright (c) 2018 HackerOne Inc. and individual contributors. Licensed under MIT license, see [LICENSE](LICENSE) for the full license.

docs-site/bundle.js

Lines changed: 79 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24384,8 +24384,7 @@
2438424384
},
2438524385
/* 416 */
2438624386
/***/ function(module, exports) {
24387-
module.exports = function(hljs) {
24388-
// TODO support filter tags like :javascript, support inline HTML
24387+
module.exports = function(hljs) { // TODO support filter tags like :javascript, support inline HTML
2438924388
return {
2439024389
case_insensitive: true,
2439124390
contains: [
@@ -30325,8 +30324,7 @@
3032530324
},
3032630325
/* 475 */
3032730326
/***/ function(module, exports) {
30328-
module.exports = function(hljs) {
30329-
// Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;
30327+
module.exports = function(hljs) { // Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;
3033030328
var STRINGS = {
3033130329
// PB IDE color: #0080FF (Azure Radiance)
3033230330
className: "string",
@@ -35220,6 +35218,7 @@
3522035218
/**
3522135219
* General datepicker component.
3522235220
*/
35221+
var INPUT_ERR_1 = "Date input not valid.";
3522335222

3522435223
var DatePicker = (function(_React$Component) {
3522535224
_inherits(DatePicker, _React$Component);
@@ -35247,6 +35246,7 @@
3524735246

3524835247
preventOpenOnFocus: false,
3524935248
onYearChange: function onYearChange() {},
35249+
onInputError: function onInputError() {},
3525035250

3525135251
monthsShown: 1,
3525235252
readOnly: false,
@@ -35256,7 +35256,10 @@
3525635256
timeIntervals: 30,
3525735257
timeCaption: "Time",
3525835258
previousMonthButtonLabel: "Previous Month",
35259-
nextMonthButtonLabel: "Next month"
35259+
nextMonthButtonLabel: "Next month",
35260+
renderDayContents: function renderDayContents(date) {
35261+
return date;
35262+
}
3526035263
};
3526135264
}
3526235265
}
@@ -35356,14 +35359,21 @@
3535635359
function() {
3535735360
!skipSetBlur && _this.setBlur();
3535835361

35359-
_this.setState({ inputValue: null, preSelection: null });
35362+
_this.setState({ inputValue: null });
3536035363
}
3536135364
);
3536235365
}
3536335366
}
3536435367
);
3536535368
};
3536635369

35370+
_this.inputOk = function() {
35371+
return (
35372+
(0, _date_utils.isMoment)(_this.state.preSelection) ||
35373+
(0, _date_utils.isDate)(_this.state.preSelection)
35374+
);
35375+
};
35376+
3536735377
_this.isCalendarOpen = function() {
3536835378
return _this.props.open === undefined
3536935379
? _this.state.open &&
@@ -35554,7 +35564,9 @@
3555435564
});
3555535565

3555635566
_this.props.onChange(changedDate);
35557-
_this.setOpen(false);
35567+
if (_this.props.shouldCloseOnSelect) {
35568+
_this.setOpen(false);
35569+
}
3555835570
_this.setState({ inputValue: null });
3555935571
};
3556035572

@@ -35583,8 +35595,7 @@
3558335595
if (eventKey === "Enter") {
3558435596
event.preventDefault();
3558535597
if (
35586-
((0, _date_utils.isMoment)(_this.state.preSelection) ||
35587-
(0, _date_utils.isDate)(_this.state.preSelection)) &&
35598+
_this.inputOk() &&
3558835599
_this.state.lastPreSelectChange ===
3558935600
PRESELECT_CHANGE_VIA_NAVIGATE
3559035601
) {
@@ -35597,6 +35608,9 @@
3559735608
event.preventDefault();
3559835609

3559935610
_this.setOpen(false);
35611+
if (!_this.inputOk()) {
35612+
_this.props.onInputError({ code: 1, msg: INPUT_ERR_1 });
35613+
}
3560035614
} else if (eventKey === "Tab") {
3560135615
_this.setOpen(false, true);
3560235616
} else if (!_this.props.disabledKeyboardNavigation) {
@@ -35627,7 +35641,12 @@
3562735641
newSelection = (0, _date_utils.addYears)(copy, 1);
3562835642
break;
3562935643
}
35630-
if (!newSelection) return; // Let the input component handle this keydown
35644+
if (!newSelection) {
35645+
if (_this.props.onInputError) {
35646+
_this.props.onInputError({ code: 1, msg: INPUT_ERR_1 });
35647+
}
35648+
return; // Let the input component handle this keydown
35649+
}
3563135650
event.preventDefault();
3563235651
_this.setState({
3563335652
lastPreSelectChange: PRESELECT_CHANGE_VIA_NAVIGATE
@@ -35729,7 +35748,9 @@
3572935748
nextMonthButtonLabel: _this.props.nextMonthButtonLabel,
3573035749
disabledKeyboardNavigation:
3573135750
_this.props.disabledKeyboardNavigation,
35732-
renderCustomHeader: _this.props.renderCustomHeader
35751+
renderCustomHeader: _this.props.renderCustomHeader,
35752+
popperProps: _this.props.popperProps,
35753+
renderDayContents: _this.props.renderDayContents
3573335754
},
3573435755
_this.props.children
3573535756
);
@@ -35874,7 +35895,8 @@
3587435895
),
3587535896
popperContainer: this.props.popperContainer,
3587635897
popperComponent: calendar,
35877-
popperPlacement: this.props.popperPlacement
35898+
popperPlacement: this.props.popperPlacement,
35899+
popperProps: this.props.popperProps
3587835900
});
3587935901
};
3588035902

@@ -35931,6 +35953,7 @@
3593135953
onKeyDown: _propTypes2.default.func,
3593235954
onMonthChange: _propTypes2.default.func,
3593335955
onYearChange: _propTypes2.default.func,
35956+
onInputError: _propTypes2.default.func,
3593435957
open: _propTypes2.default.bool,
3593535958
openToDate: _propTypes2.default.object,
3593635959
peekNextMonth: _propTypes2.default.bool,
@@ -35941,6 +35964,7 @@
3594135964
popperPlacement: _propTypes2.default.oneOf(
3594235965
_popper_component.popperPlacementPositions
3594335966
), // <PopperComponent/> props
35967+
popperProps: _propTypes2.default.object,
3594435968
preventOpenOnFocus: _propTypes2.default.bool,
3594535969
readOnly: _propTypes2.default.bool,
3594635970
required: _propTypes2.default.bool,
@@ -35983,7 +36007,8 @@
3598336007
clearButtonTitle: _propTypes2.default.string,
3598436008
previousMonthButtonLabel: _propTypes2.default.string,
3598536009
nextMonthButtonLabel: _propTypes2.default.string,
35986-
renderCustomHeader: _propTypes2.default.func
36010+
renderCustomHeader: _propTypes2.default.func,
36011+
renderDayContents: _propTypes2.default.func
3598736012
};
3598836013
exports.default = DatePicker;
3598936014

@@ -36836,6 +36861,7 @@
3683636861
endDate: _this.props.endDate,
3683736862
peekNextMonth: _this.props.peekNextMonth,
3683836863
utcOffset: _this.props.utcOffset,
36864+
renderDayContents: _this.props.renderDayContents,
3683936865
disabledKeyboardNavigation:
3684036866
_this.props.disabledKeyboardNavigation
3684136867
})
@@ -37015,7 +37041,8 @@
3701537041
showDisabledMonthNavigation: _propTypes2.default.bool,
3701637042
previousMonthButtonLabel: _propTypes2.default.string,
3701737043
nextMonthButtonLabel: _propTypes2.default.string,
37018-
renderCustomHeader: _propTypes2.default.func
37044+
renderCustomHeader: _propTypes2.default.func,
37045+
renderDayContents: _propTypes2.default.func
3701937046
};
3702037047
exports.default = Calendar;
3702137048

@@ -57925,7 +57952,8 @@
5792557952
dayClassName: _this.props.dayClassName,
5792657953
utcOffset: _this.props.utcOffset,
5792757954
disabledKeyboardNavigation:
57928-
_this.props.disabledKeyboardNavigation
57955+
_this.props.disabledKeyboardNavigation,
57956+
renderDayContents: _this.props.renderDayContents
5792957957
})
5793057958
);
5793157959

@@ -58016,7 +58044,8 @@
5801658044
utcOffset: _propTypes2.default.oneOfType([
5801758045
_propTypes2.default.number,
5801858046
_propTypes2.default.string
58019-
])
58047+
]),
58048+
renderDayContents: _propTypes2.default.func
5802058049
};
5802158050
exports.default = Month;
5802258051

@@ -58192,6 +58221,7 @@
5819258221
endDate: _this.props.endDate,
5819358222
dayClassName: _this.props.dayClassName,
5819458223
utcOffset: _this.props.utcOffset,
58224+
renderDayContents: _this.props.renderDayContents,
5819558225
disabledKeyboardNavigation:
5819658226
_this.props.disabledKeyboardNavigation
5819758227
});
@@ -58241,7 +58271,8 @@
5824158271
utcOffset: _propTypes2.default.oneOfType([
5824258272
_propTypes2.default.number,
5824358273
_propTypes2.default.string
58244-
])
58274+
]),
58275+
renderDayContents: _propTypes2.default.func
5824558276
};
5824658277
exports.default = Week;
5824758278

@@ -58536,7 +58567,11 @@
5853658567
"aria-label": "day-" + (0, _date_utils.getDate)(this.props.day),
5853758568
role: "option"
5853858569
},
58539-
(0, _date_utils.getDate)(this.props.day)
58570+
this.props.renderDayContents
58571+
? this.props.renderDayContents(
58572+
(0, _date_utils.getDate)(this.props.day)
58573+
)
58574+
: (0, _date_utils.getDate)(this.props.day)
5854058575
);
5854158576
};
5854258577

@@ -58562,7 +58597,8 @@
5856258597
utcOffset: _propTypes2.default.oneOfType([
5856358598
_propTypes2.default.number,
5856458599
_propTypes2.default.string
58565-
])
58600+
]),
58601+
renderDayContents: _propTypes2.default.func
5856658602
};
5856758603
exports.default = Day;
5856858604

@@ -59141,6 +59177,7 @@
5914159177
popperComponent = _props.popperComponent,
5914259178
popperModifiers = _props.popperModifiers,
5914359179
popperPlacement = _props.popperPlacement,
59180+
popperProps = _props.popperProps,
5914459181
targetComponent = _props.targetComponent;
5914559182

5914659183
var popper = void 0;
@@ -59152,7 +59189,13 @@
5915259189
);
5915359190
popper = _react2.default.createElement(
5915459191
_reactPopper.Popper,
59155-
{ modifiers: popperModifiers, placement: popperPlacement },
59192+
_extends(
59193+
{
59194+
modifiers: popperModifiers,
59195+
placement: popperPlacement
59196+
},
59197+
popperProps
59198+
),
5915659199
function(_ref) {
5915759200
var ref = _ref.ref,
5915859201
style = _ref.style,
@@ -59184,25 +59227,21 @@
5918459227
}
5918559228

5918659229
return _react2.default.createElement(
59187-
"div",
59230+
_reactPopper.Manager,
5918859231
null,
5918959232
_react2.default.createElement(
59190-
_reactPopper.Manager,
59233+
_reactPopper.Reference,
5919159234
null,
59192-
_react2.default.createElement(
59193-
_reactPopper.Reference,
59194-
null,
59195-
function(_ref2) {
59196-
var ref = _ref2.ref;
59197-
return _react2.default.createElement(
59198-
"div",
59199-
{ ref: ref, className: "react-datepicker-wrapper" },
59200-
targetComponent
59201-
);
59202-
}
59203-
),
59204-
popper
59205-
)
59235+
function(_ref2) {
59236+
var ref = _ref2.ref;
59237+
return _react2.default.createElement(
59238+
"div",
59239+
{ ref: ref, className: "react-datepicker-wrapper" },
59240+
targetComponent
59241+
);
59242+
}
59243+
),
59244+
popper
5920659245
);
5920759246
};
5920859247

@@ -59219,6 +59258,7 @@
5921959258
boundariesElement: "viewport"
5922059259
}
5922159260
},
59261+
popperProps: {},
5922259262
popperPlacement: "bottom-start"
5922359263
};
5922459264
}
@@ -59235,6 +59275,7 @@
5923559275
popperModifiers: _propTypes2.default.object, // <datepicker/> props
5923659276
popperPlacement: _propTypes2.default.oneOf(popperPlacementPositions), // <datepicker/> props
5923759277
popperContainer: _propTypes2.default.func,
59278+
popperProps: _propTypes2.default.object,
5923859279
targetComponent: _propTypes2.default.element
5923959280
};
5924059281
exports.default = PopperComponent;
@@ -71509,7 +71550,8 @@
7150971550
});
7151071551

7151171552
for (
71512-
var es6Symbols = "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
71553+
var es6Symbols = // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
71554+
"hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(
7151371555
","
7151471556
),
7151571557
j = 0;

docs-site/style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,15 @@ github.com style (c) Vasily Polovnyov <[email protected]>
970970
}
971971
}
972972

973+
@supports (position: sticky) {
974+
.examples__navigation {
975+
overflow-y: scroll;
976+
max-height: 100vh;
977+
position: sticky;
978+
top: 0;
979+
}
980+
}
981+
973982
.examples__navigation-item {
974983
border-bottom: 1px solid #e4e4e4;
975984
}

0 commit comments

Comments
 (0)