@zendeskgarden/react-datepickers 8.55.0 → 8.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +23 -16
- package/dist/index.esm.js +23 -16
- package/dist/typings/elements/Datepicker/components/Calendar.d.ts +2 -0
- package/dist/typings/elements/DatepickerRange/DatepickerRange.d.ts +1 -0
- package/dist/typings/elements/DatepickerRange/utils/datepicker-range-reducer.d.ts +1 -1
- package/dist/typings/elements/DatepickerRange/utils/useDatepickerRangeContext.d.ts +2 -0
- package/dist/typings/types/index.d.ts +6 -1
- package/dist/typings/utils/calendar-utils.d.ts +1 -2
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -83,7 +83,7 @@ function _defineProperty(obj, key, value) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function _extends$2() {
|
|
86
|
-
_extends$2 = Object.assign
|
|
86
|
+
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
87
87
|
for (var i = 1; i < arguments.length; i++) {
|
|
88
88
|
var source = arguments[i];
|
|
89
89
|
|
|
@@ -96,7 +96,6 @@ function _extends$2() {
|
|
|
96
96
|
|
|
97
97
|
return target;
|
|
98
98
|
};
|
|
99
|
-
|
|
100
99
|
return _extends$2.apply(this, arguments);
|
|
101
100
|
}
|
|
102
101
|
|
|
@@ -419,7 +418,7 @@ function getDate(dirtyDate) {
|
|
|
419
418
|
var COMPONENT_ID$b = 'datepickers.menu';
|
|
420
419
|
var StyledMenu = styled__default["default"].div.attrs({
|
|
421
420
|
'data-garden-id': COMPONENT_ID$b,
|
|
422
|
-
'data-garden-version': '8.
|
|
421
|
+
'data-garden-version': '8.56.0'
|
|
423
422
|
}).withConfig({
|
|
424
423
|
displayName: "StyledMenu",
|
|
425
424
|
componentId: "sc-1npbkk0-0"
|
|
@@ -790,7 +789,7 @@ function getStartOfWeek(locale) {
|
|
|
790
789
|
|
|
791
790
|
var _path$1;
|
|
792
791
|
|
|
793
|
-
function _extends$1() { _extends$1 = Object.assign
|
|
792
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
794
793
|
|
|
795
794
|
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
796
795
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
@@ -808,7 +807,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
808
807
|
|
|
809
808
|
var _path;
|
|
810
809
|
|
|
811
|
-
function _extends() { _extends = Object.assign
|
|
810
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
812
811
|
|
|
813
812
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
814
813
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
@@ -863,18 +862,19 @@ var Calendar$1 = React.forwardRef(function (_ref, ref) {
|
|
|
863
862
|
minValue = _ref.minValue,
|
|
864
863
|
maxValue = _ref.maxValue,
|
|
865
864
|
isCompact = _ref.isCompact,
|
|
866
|
-
locale = _ref.locale
|
|
865
|
+
locale = _ref.locale,
|
|
866
|
+
weekStartsOn = _ref.weekStartsOn;
|
|
867
867
|
var _useDatepickerContext = useDatepickerContext$1(),
|
|
868
868
|
state = _useDatepickerContext.state,
|
|
869
869
|
dispatch = _useDatepickerContext.dispatch;
|
|
870
|
-
var
|
|
870
|
+
var preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
|
|
871
871
|
var monthStartDate = startOfMonth(state.previewDate);
|
|
872
872
|
var monthEndDate = endOfMonth(monthStartDate);
|
|
873
873
|
var startDate = startOfWeek(monthStartDate, {
|
|
874
|
-
weekStartsOn:
|
|
874
|
+
weekStartsOn: preferredWeekStartsOn
|
|
875
875
|
});
|
|
876
876
|
var endDate = endOfWeek(monthEndDate, {
|
|
877
|
-
weekStartsOn:
|
|
877
|
+
weekStartsOn: preferredWeekStartsOn
|
|
878
878
|
});
|
|
879
879
|
var dayLabelFormatter = React.useCallback(function (date) {
|
|
880
880
|
var formatter = new Intl.DateTimeFormat(locale, {
|
|
@@ -3277,7 +3277,7 @@ function retrieveInitialState$1(initialProps) {
|
|
|
3277
3277
|
};
|
|
3278
3278
|
}
|
|
3279
3279
|
|
|
3280
|
-
var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "customParseDate"];
|
|
3280
|
+
var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "weekStartsOn", "customParseDate"];
|
|
3281
3281
|
var Datepicker = React.forwardRef(function (props, calendarRef) {
|
|
3282
3282
|
var children = props.children,
|
|
3283
3283
|
placement = props.placement,
|
|
@@ -3293,6 +3293,7 @@ var Datepicker = React.forwardRef(function (props, calendarRef) {
|
|
|
3293
3293
|
minValue = props.minValue,
|
|
3294
3294
|
maxValue = props.maxValue,
|
|
3295
3295
|
locale = props.locale,
|
|
3296
|
+
weekStartsOn = props.weekStartsOn,
|
|
3296
3297
|
customParseDate = props.customParseDate,
|
|
3297
3298
|
menuProps = _objectWithoutProperties(props, _excluded);
|
|
3298
3299
|
var theme = React.useContext(styled.ThemeContext);
|
|
@@ -3423,7 +3424,8 @@ var Datepicker = React.forwardRef(function (props, calendarRef) {
|
|
|
3423
3424
|
value: value,
|
|
3424
3425
|
minValue: minValue,
|
|
3425
3426
|
maxValue: maxValue,
|
|
3426
|
-
locale: locale
|
|
3427
|
+
locale: locale,
|
|
3428
|
+
weekStartsOn: weekStartsOn
|
|
3427
3429
|
})));
|
|
3428
3430
|
})));
|
|
3429
3431
|
});
|
|
@@ -3433,6 +3435,7 @@ Datepicker.propTypes = {
|
|
|
3433
3435
|
onChange: PropTypes__default["default"].any,
|
|
3434
3436
|
formatDate: PropTypes__default["default"].func,
|
|
3435
3437
|
locale: PropTypes__default["default"].any,
|
|
3438
|
+
weekStartsOn: PropTypes__default["default"].number,
|
|
3436
3439
|
minValue: PropTypes__default["default"].any,
|
|
3437
3440
|
maxValue: PropTypes__default["default"].any,
|
|
3438
3441
|
isCompact: PropTypes__default["default"].bool,
|
|
@@ -3891,6 +3894,7 @@ var Month = React.forwardRef(function (_ref, ref) {
|
|
|
3891
3894
|
state = _useDatepickerRangeCo.state,
|
|
3892
3895
|
dispatch = _useDatepickerRangeCo.dispatch,
|
|
3893
3896
|
locale = _useDatepickerRangeCo.locale,
|
|
3897
|
+
weekStartsOn = _useDatepickerRangeCo.weekStartsOn,
|
|
3894
3898
|
isCompact = _useDatepickerRangeCo.isCompact,
|
|
3895
3899
|
minValue = _useDatepickerRangeCo.minValue,
|
|
3896
3900
|
maxValue = _useDatepickerRangeCo.maxValue,
|
|
@@ -3916,14 +3920,14 @@ var Month = React.forwardRef(function (_ref, ref) {
|
|
|
3916
3920
|
});
|
|
3917
3921
|
return formatter.format(date);
|
|
3918
3922
|
}, [locale]);
|
|
3919
|
-
var
|
|
3923
|
+
var preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
|
|
3920
3924
|
var monthStartDate = startOfMonth(displayDate);
|
|
3921
3925
|
var monthEndDate = endOfMonth(monthStartDate);
|
|
3922
3926
|
var startDate = startOfWeek(monthStartDate, {
|
|
3923
|
-
weekStartsOn:
|
|
3927
|
+
weekStartsOn: preferredWeekStartsOn
|
|
3924
3928
|
});
|
|
3925
3929
|
var endDate = endOfWeek(monthEndDate, {
|
|
3926
|
-
weekStartsOn:
|
|
3930
|
+
weekStartsOn: preferredWeekStartsOn
|
|
3927
3931
|
});
|
|
3928
3932
|
var dayLabels = eachDayOfInterval({
|
|
3929
3933
|
start: startDate,
|
|
@@ -4117,7 +4121,7 @@ var Calendar = React.forwardRef(function (props, ref) {
|
|
|
4117
4121
|
return React__default["default"].createElement(StyledRangeCalendar, _extends$2({
|
|
4118
4122
|
ref: ref,
|
|
4119
4123
|
"data-garden-id": "datepickers.range",
|
|
4120
|
-
"data-garden-version": '8.
|
|
4124
|
+
"data-garden-version": '8.56.0'
|
|
4121
4125
|
}, props), React__default["default"].createElement(Month, {
|
|
4122
4126
|
displayDate: state.previewDate,
|
|
4123
4127
|
isNextHidden: true
|
|
@@ -4131,6 +4135,7 @@ Calendar.displayName = 'DatepickerRange.Calendar';
|
|
|
4131
4135
|
var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
4132
4136
|
var startValue = props.startValue,
|
|
4133
4137
|
locale = props.locale,
|
|
4138
|
+
weekStartsOn = props.weekStartsOn,
|
|
4134
4139
|
formatDate = props.formatDate,
|
|
4135
4140
|
endValue = props.endValue,
|
|
4136
4141
|
onChange = props.onChange,
|
|
@@ -4180,6 +4185,7 @@ var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
|
4180
4185
|
dispatch: dispatch,
|
|
4181
4186
|
isCompact: isCompact,
|
|
4182
4187
|
locale: locale,
|
|
4188
|
+
weekStartsOn: weekStartsOn,
|
|
4183
4189
|
minValue: minValue,
|
|
4184
4190
|
maxValue: maxValue,
|
|
4185
4191
|
startValue: startValue,
|
|
@@ -4189,13 +4195,14 @@ var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
|
4189
4195
|
endInputRef: endInputRef,
|
|
4190
4196
|
customParseDate: customParseDate
|
|
4191
4197
|
};
|
|
4192
|
-
}, [state, dispatch, isCompact, locale, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
|
|
4198
|
+
}, [state, dispatch, isCompact, locale, weekStartsOn, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
|
|
4193
4199
|
return React__default["default"].createElement(DatepickerRangeContext.Provider, {
|
|
4194
4200
|
value: value
|
|
4195
4201
|
}, children);
|
|
4196
4202
|
};
|
|
4197
4203
|
DatepickerRangeComponent.propTypes = {
|
|
4198
4204
|
locale: PropTypes__default["default"].string,
|
|
4205
|
+
weekStartsOn: PropTypes__default["default"].number,
|
|
4199
4206
|
startValue: PropTypes__default["default"].instanceOf(Date),
|
|
4200
4207
|
endValue: PropTypes__default["default"].instanceOf(Date),
|
|
4201
4208
|
minValue: PropTypes__default["default"].instanceOf(Date),
|
package/dist/index.esm.js
CHANGED
|
@@ -55,7 +55,7 @@ function _defineProperty(obj, key, value) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function _extends$2() {
|
|
58
|
-
_extends$2 = Object.assign
|
|
58
|
+
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
59
59
|
for (var i = 1; i < arguments.length; i++) {
|
|
60
60
|
var source = arguments[i];
|
|
61
61
|
|
|
@@ -68,7 +68,6 @@ function _extends$2() {
|
|
|
68
68
|
|
|
69
69
|
return target;
|
|
70
70
|
};
|
|
71
|
-
|
|
72
71
|
return _extends$2.apply(this, arguments);
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -391,7 +390,7 @@ function getDate(dirtyDate) {
|
|
|
391
390
|
var COMPONENT_ID$b = 'datepickers.menu';
|
|
392
391
|
var StyledMenu = styled.div.attrs({
|
|
393
392
|
'data-garden-id': COMPONENT_ID$b,
|
|
394
|
-
'data-garden-version': '8.
|
|
393
|
+
'data-garden-version': '8.56.0'
|
|
395
394
|
}).withConfig({
|
|
396
395
|
displayName: "StyledMenu",
|
|
397
396
|
componentId: "sc-1npbkk0-0"
|
|
@@ -762,7 +761,7 @@ function getStartOfWeek(locale) {
|
|
|
762
761
|
|
|
763
762
|
var _path$1;
|
|
764
763
|
|
|
765
|
-
function _extends$1() { _extends$1 = Object.assign
|
|
764
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
766
765
|
|
|
767
766
|
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
768
767
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
@@ -780,7 +779,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
780
779
|
|
|
781
780
|
var _path;
|
|
782
781
|
|
|
783
|
-
function _extends() { _extends = Object.assign
|
|
782
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
784
783
|
|
|
785
784
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
786
785
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
@@ -835,18 +834,19 @@ var Calendar$1 = forwardRef(function (_ref, ref) {
|
|
|
835
834
|
minValue = _ref.minValue,
|
|
836
835
|
maxValue = _ref.maxValue,
|
|
837
836
|
isCompact = _ref.isCompact,
|
|
838
|
-
locale = _ref.locale
|
|
837
|
+
locale = _ref.locale,
|
|
838
|
+
weekStartsOn = _ref.weekStartsOn;
|
|
839
839
|
var _useDatepickerContext = useDatepickerContext$1(),
|
|
840
840
|
state = _useDatepickerContext.state,
|
|
841
841
|
dispatch = _useDatepickerContext.dispatch;
|
|
842
|
-
var
|
|
842
|
+
var preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
|
|
843
843
|
var monthStartDate = startOfMonth(state.previewDate);
|
|
844
844
|
var monthEndDate = endOfMonth(monthStartDate);
|
|
845
845
|
var startDate = startOfWeek(monthStartDate, {
|
|
846
|
-
weekStartsOn:
|
|
846
|
+
weekStartsOn: preferredWeekStartsOn
|
|
847
847
|
});
|
|
848
848
|
var endDate = endOfWeek(monthEndDate, {
|
|
849
|
-
weekStartsOn:
|
|
849
|
+
weekStartsOn: preferredWeekStartsOn
|
|
850
850
|
});
|
|
851
851
|
var dayLabelFormatter = useCallback(function (date) {
|
|
852
852
|
var formatter = new Intl.DateTimeFormat(locale, {
|
|
@@ -3249,7 +3249,7 @@ function retrieveInitialState$1(initialProps) {
|
|
|
3249
3249
|
};
|
|
3250
3250
|
}
|
|
3251
3251
|
|
|
3252
|
-
var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "customParseDate"];
|
|
3252
|
+
var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "weekStartsOn", "customParseDate"];
|
|
3253
3253
|
var Datepicker = forwardRef(function (props, calendarRef) {
|
|
3254
3254
|
var children = props.children,
|
|
3255
3255
|
placement = props.placement,
|
|
@@ -3265,6 +3265,7 @@ var Datepicker = forwardRef(function (props, calendarRef) {
|
|
|
3265
3265
|
minValue = props.minValue,
|
|
3266
3266
|
maxValue = props.maxValue,
|
|
3267
3267
|
locale = props.locale,
|
|
3268
|
+
weekStartsOn = props.weekStartsOn,
|
|
3268
3269
|
customParseDate = props.customParseDate,
|
|
3269
3270
|
menuProps = _objectWithoutProperties(props, _excluded);
|
|
3270
3271
|
var theme = useContext(ThemeContext);
|
|
@@ -3395,7 +3396,8 @@ var Datepicker = forwardRef(function (props, calendarRef) {
|
|
|
3395
3396
|
value: value,
|
|
3396
3397
|
minValue: minValue,
|
|
3397
3398
|
maxValue: maxValue,
|
|
3398
|
-
locale: locale
|
|
3399
|
+
locale: locale,
|
|
3400
|
+
weekStartsOn: weekStartsOn
|
|
3399
3401
|
})));
|
|
3400
3402
|
})));
|
|
3401
3403
|
});
|
|
@@ -3405,6 +3407,7 @@ Datepicker.propTypes = {
|
|
|
3405
3407
|
onChange: PropTypes.any,
|
|
3406
3408
|
formatDate: PropTypes.func,
|
|
3407
3409
|
locale: PropTypes.any,
|
|
3410
|
+
weekStartsOn: PropTypes.number,
|
|
3408
3411
|
minValue: PropTypes.any,
|
|
3409
3412
|
maxValue: PropTypes.any,
|
|
3410
3413
|
isCompact: PropTypes.bool,
|
|
@@ -3863,6 +3866,7 @@ var Month = forwardRef(function (_ref, ref) {
|
|
|
3863
3866
|
state = _useDatepickerRangeCo.state,
|
|
3864
3867
|
dispatch = _useDatepickerRangeCo.dispatch,
|
|
3865
3868
|
locale = _useDatepickerRangeCo.locale,
|
|
3869
|
+
weekStartsOn = _useDatepickerRangeCo.weekStartsOn,
|
|
3866
3870
|
isCompact = _useDatepickerRangeCo.isCompact,
|
|
3867
3871
|
minValue = _useDatepickerRangeCo.minValue,
|
|
3868
3872
|
maxValue = _useDatepickerRangeCo.maxValue,
|
|
@@ -3888,14 +3892,14 @@ var Month = forwardRef(function (_ref, ref) {
|
|
|
3888
3892
|
});
|
|
3889
3893
|
return formatter.format(date);
|
|
3890
3894
|
}, [locale]);
|
|
3891
|
-
var
|
|
3895
|
+
var preferredWeekStartsOn = weekStartsOn || getStartOfWeek(locale);
|
|
3892
3896
|
var monthStartDate = startOfMonth(displayDate);
|
|
3893
3897
|
var monthEndDate = endOfMonth(monthStartDate);
|
|
3894
3898
|
var startDate = startOfWeek(monthStartDate, {
|
|
3895
|
-
weekStartsOn:
|
|
3899
|
+
weekStartsOn: preferredWeekStartsOn
|
|
3896
3900
|
});
|
|
3897
3901
|
var endDate = endOfWeek(monthEndDate, {
|
|
3898
|
-
weekStartsOn:
|
|
3902
|
+
weekStartsOn: preferredWeekStartsOn
|
|
3899
3903
|
});
|
|
3900
3904
|
var dayLabels = eachDayOfInterval({
|
|
3901
3905
|
start: startDate,
|
|
@@ -4089,7 +4093,7 @@ var Calendar = forwardRef(function (props, ref) {
|
|
|
4089
4093
|
return React__default.createElement(StyledRangeCalendar, _extends$2({
|
|
4090
4094
|
ref: ref,
|
|
4091
4095
|
"data-garden-id": "datepickers.range",
|
|
4092
|
-
"data-garden-version": '8.
|
|
4096
|
+
"data-garden-version": '8.56.0'
|
|
4093
4097
|
}, props), React__default.createElement(Month, {
|
|
4094
4098
|
displayDate: state.previewDate,
|
|
4095
4099
|
isNextHidden: true
|
|
@@ -4103,6 +4107,7 @@ Calendar.displayName = 'DatepickerRange.Calendar';
|
|
|
4103
4107
|
var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
4104
4108
|
var startValue = props.startValue,
|
|
4105
4109
|
locale = props.locale,
|
|
4110
|
+
weekStartsOn = props.weekStartsOn,
|
|
4106
4111
|
formatDate = props.formatDate,
|
|
4107
4112
|
endValue = props.endValue,
|
|
4108
4113
|
onChange = props.onChange,
|
|
@@ -4152,6 +4157,7 @@ var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
|
4152
4157
|
dispatch: dispatch,
|
|
4153
4158
|
isCompact: isCompact,
|
|
4154
4159
|
locale: locale,
|
|
4160
|
+
weekStartsOn: weekStartsOn,
|
|
4155
4161
|
minValue: minValue,
|
|
4156
4162
|
maxValue: maxValue,
|
|
4157
4163
|
startValue: startValue,
|
|
@@ -4161,13 +4167,14 @@ var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
|
4161
4167
|
endInputRef: endInputRef,
|
|
4162
4168
|
customParseDate: customParseDate
|
|
4163
4169
|
};
|
|
4164
|
-
}, [state, dispatch, isCompact, locale, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
|
|
4170
|
+
}, [state, dispatch, isCompact, locale, weekStartsOn, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
|
|
4165
4171
|
return React__default.createElement(DatepickerRangeContext.Provider, {
|
|
4166
4172
|
value: value
|
|
4167
4173
|
}, children);
|
|
4168
4174
|
};
|
|
4169
4175
|
DatepickerRangeComponent.propTypes = {
|
|
4170
4176
|
locale: PropTypes.string,
|
|
4177
|
+
weekStartsOn: PropTypes.number,
|
|
4171
4178
|
startValue: PropTypes.instanceOf(Date),
|
|
4172
4179
|
endValue: PropTypes.instanceOf(Date),
|
|
4173
4180
|
minValue: PropTypes.instanceOf(Date),
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React, { HTMLAttributes } from 'react';
|
|
8
|
+
import { DateFnsIndex } from '../../../utils/calendar-utils';
|
|
8
9
|
interface ICalendarProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
10
|
value?: Date;
|
|
10
11
|
minValue?: Date;
|
|
11
12
|
maxValue?: Date;
|
|
12
13
|
isCompact?: boolean;
|
|
13
14
|
locale?: string;
|
|
15
|
+
weekStartsOn?: DateFnsIndex;
|
|
14
16
|
}
|
|
15
17
|
export declare const Calendar: React.ForwardRefExoticComponent<ICalendarProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
18
|
export {};
|
|
@@ -14,6 +14,7 @@ export declare const DatepickerRange: {
|
|
|
14
14
|
(props: PropsWithChildren<IDatepickerRangeProps>): JSX.Element;
|
|
15
15
|
propTypes: {
|
|
16
16
|
locale: PropTypes.Requireable<string>;
|
|
17
|
+
weekStartsOn: PropTypes.Requireable<number>;
|
|
17
18
|
startValue: PropTypes.Requireable<Date>;
|
|
18
19
|
endValue: PropTypes.Requireable<Date>;
|
|
19
20
|
minValue: PropTypes.Requireable<Date>;
|
|
@@ -63,7 +63,7 @@ export declare const datepickerRangeReducer: ({ startValue, endValue, locale, fo
|
|
|
63
63
|
endValue?: Date | undefined;
|
|
64
64
|
locale?: string | undefined;
|
|
65
65
|
formatDate?: any;
|
|
66
|
-
customParseDate?: ((inputValue?: string
|
|
66
|
+
customParseDate?: ((inputValue?: string) => Date) | undefined;
|
|
67
67
|
}) => (state: IDatepickerRangeState, action: DatepickerRangeAction) => IDatepickerRangeState;
|
|
68
68
|
/**
|
|
69
69
|
* Retrieve initial state for the Datepicker reducer
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
import { DateFnsIndex } from 'packages/datepickers/src/utils/calendar-utils';
|
|
7
8
|
import { MutableRefObject } from 'react';
|
|
8
9
|
import { IDatepickerRangeState, DatepickerRangeAction } from './datepicker-range-reducer';
|
|
9
10
|
export interface IDatepickerRangeContext {
|
|
10
11
|
state: IDatepickerRangeState;
|
|
11
12
|
dispatch: React.Dispatch<DatepickerRangeAction>;
|
|
12
13
|
locale?: string;
|
|
14
|
+
weekStartsOn?: DateFnsIndex;
|
|
13
15
|
isCompact?: boolean;
|
|
14
16
|
minValue?: Date;
|
|
15
17
|
maxValue?: Date;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLAttributes } from 'react';
|
|
8
8
|
import { Modifiers } from 'popper.js';
|
|
9
|
+
import { DateFnsIndex } from '../utils/calendar-utils';
|
|
9
10
|
export declare const PLACEMENT: readonly ["auto", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "end", "end-top", "end-bottom", "start", "start-top", "start-bottom"];
|
|
10
11
|
export declare const POPPER_PLACEMENT: readonly ["auto", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"];
|
|
11
12
|
export declare type GardenPlacement = typeof PLACEMENT[number];
|
|
@@ -33,6 +34,10 @@ export interface IDatepickerProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
33
34
|
* Accepts all valid `Intl` [locales](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
|
|
34
35
|
*/
|
|
35
36
|
locale?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Overrides the locale default start day of week
|
|
39
|
+
*/
|
|
40
|
+
weekStartsOn?: DateFnsIndex;
|
|
36
41
|
/**
|
|
37
42
|
* Disables dates before this value on the calendar
|
|
38
43
|
*/
|
|
@@ -77,7 +82,7 @@ export interface IDatepickerProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
77
82
|
*/
|
|
78
83
|
zIndex?: number;
|
|
79
84
|
}
|
|
80
|
-
export interface IDatepickerRangeProps extends Pick<IDatepickerProps, 'locale' | 'minValue' | 'maxValue' | 'formatDate' | 'isCompact'> {
|
|
85
|
+
export interface IDatepickerRangeProps extends Pick<IDatepickerProps, 'locale' | 'weekStartsOn' | 'minValue' | 'maxValue' | 'formatDate' | 'isCompact'> {
|
|
81
86
|
/**
|
|
82
87
|
* Sets the start date
|
|
83
88
|
*/
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
* 6 - Saturday
|
|
12
12
|
*/
|
|
13
13
|
/** This type matches definition required by date-fns utilities */
|
|
14
|
-
declare type DateFnsIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
14
|
+
export declare type DateFnsIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Return start day of week based on locale
|
|
17
17
|
*/
|
|
18
18
|
export declare function getStartOfWeek(locale?: string): DateFnsIndex;
|
|
19
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-datepickers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.56.0",
|
|
4
4
|
"description": "Components relating to datepickers in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@zendeskgarden/react-theming": "^8.
|
|
36
|
+
"@zendeskgarden/react-theming": "^8.56.0",
|
|
37
37
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "c0e1cb7669a366ff510cc9613e2b426d48019732"
|
|
50
50
|
}
|