@zendeskgarden/react-datepickers 8.46.0 → 8.48.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 +170 -137
- package/dist/index.esm.js +95 -60
- package/dist/typings/elements/Datepicker/Datepicker.d.ts +6 -3
- package/dist/typings/elements/Datepicker/components/Calendar.d.ts +4 -4
- package/dist/typings/elements/Datepicker/components/MonthSelector.d.ts +2 -2
- package/dist/typings/elements/DatepickerRange/DatepickerRange.d.ts +8 -4
- package/dist/typings/elements/DatepickerRange/components/Calendar.d.ts +5 -3
- package/dist/typings/elements/DatepickerRange/components/End.d.ts +1 -2
- package/dist/typings/elements/DatepickerRange/components/Month.d.ts +5 -4
- package/dist/typings/elements/DatepickerRange/components/Start.d.ts +1 -2
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -27,14 +27,12 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
28
28
|
Object.defineProperty(n, k, d.get ? d : {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
return e[k];
|
|
32
|
-
}
|
|
30
|
+
get: function () { return e[k]; }
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
});
|
|
36
34
|
}
|
|
37
|
-
n[
|
|
35
|
+
n["default"] = e;
|
|
38
36
|
return Object.freeze(n);
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -48,14 +46,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
48
46
|
|
|
49
47
|
if (Object.getOwnPropertySymbols) {
|
|
50
48
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
keys.push.apply(keys, symbols);
|
|
49
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
50
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
51
|
+
})), keys.push.apply(keys, symbols);
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
return keys;
|
|
@@ -63,19 +56,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
63
56
|
|
|
64
57
|
function _objectSpread2(target) {
|
|
65
58
|
for (var i = 1; i < arguments.length; i++) {
|
|
66
|
-
var source = arguments[i]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
73
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
74
|
-
} else {
|
|
75
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
76
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
77
|
-
});
|
|
78
|
-
}
|
|
59
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
60
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
61
|
+
_defineProperty(target, key, source[key]);
|
|
62
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
63
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
64
|
+
});
|
|
79
65
|
}
|
|
80
66
|
|
|
81
67
|
return target;
|
|
@@ -114,6 +100,42 @@ function _extends$2() {
|
|
|
114
100
|
return _extends$2.apply(this, arguments);
|
|
115
101
|
}
|
|
116
102
|
|
|
103
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
104
|
+
if (source == null) return {};
|
|
105
|
+
var target = {};
|
|
106
|
+
var sourceKeys = Object.keys(source);
|
|
107
|
+
var key, i;
|
|
108
|
+
|
|
109
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
110
|
+
key = sourceKeys[i];
|
|
111
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
112
|
+
target[key] = source[key];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return target;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function _objectWithoutProperties(source, excluded) {
|
|
119
|
+
if (source == null) return {};
|
|
120
|
+
|
|
121
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
122
|
+
|
|
123
|
+
var key, i;
|
|
124
|
+
|
|
125
|
+
if (Object.getOwnPropertySymbols) {
|
|
126
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
127
|
+
|
|
128
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
129
|
+
key = sourceSymbolKeys[i];
|
|
130
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
131
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
132
|
+
target[key] = source[key];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return target;
|
|
137
|
+
}
|
|
138
|
+
|
|
117
139
|
function _slicedToArray(arr, i) {
|
|
118
140
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
119
141
|
}
|
|
@@ -392,9 +414,9 @@ function getDate(dirtyDate) {
|
|
|
392
414
|
}
|
|
393
415
|
|
|
394
416
|
var COMPONENT_ID$b = 'datepickers.menu';
|
|
395
|
-
var StyledMenu = styled__default[
|
|
417
|
+
var StyledMenu = styled__default["default"].div.attrs({
|
|
396
418
|
'data-garden-id': COMPONENT_ID$b,
|
|
397
|
-
'data-garden-version': '8.
|
|
419
|
+
'data-garden-version': '8.48.0'
|
|
398
420
|
}).withConfig({
|
|
399
421
|
displayName: "StyledMenu",
|
|
400
422
|
componentId: "sc-1npbkk0-0"
|
|
@@ -406,7 +428,7 @@ StyledMenu.defaultProps = {
|
|
|
406
428
|
};
|
|
407
429
|
|
|
408
430
|
var COMPONENT_ID$a = 'datepickers.menu_wrapper';
|
|
409
|
-
var StyledMenuWrapper = styled__default[
|
|
431
|
+
var StyledMenuWrapper = styled__default["default"].div.attrs(function (props) {
|
|
410
432
|
return {
|
|
411
433
|
className: props.isAnimated && 'is-animated'
|
|
412
434
|
};
|
|
@@ -438,7 +460,7 @@ var retrievePadding = function retrievePadding(_ref) {
|
|
|
438
460
|
}
|
|
439
461
|
return "margin: ".concat(value, "px;");
|
|
440
462
|
};
|
|
441
|
-
var StyledDatepicker = styled__default[
|
|
463
|
+
var StyledDatepicker = styled__default["default"].div.attrs({
|
|
442
464
|
'data-garden-id': COMPONENT_ID$9
|
|
443
465
|
}).withConfig({
|
|
444
466
|
displayName: "StyledDatepicker",
|
|
@@ -457,7 +479,7 @@ StyledDatepicker.defaultProps = {
|
|
|
457
479
|
};
|
|
458
480
|
|
|
459
481
|
var COMPONENT_ID$8 = 'datepickers.range_calendar';
|
|
460
|
-
var StyledRangeCalendar = styled__default[
|
|
482
|
+
var StyledRangeCalendar = styled__default["default"].div.attrs({
|
|
461
483
|
'data-garden-id': COMPONENT_ID$8
|
|
462
484
|
}).withConfig({
|
|
463
485
|
displayName: "StyledRangeCalendar",
|
|
@@ -472,7 +494,7 @@ StyledRangeCalendar.defaultProps = {
|
|
|
472
494
|
};
|
|
473
495
|
|
|
474
496
|
var COMPONENT_ID$7 = 'datepickers.header';
|
|
475
|
-
var StyledHeader = styled__default[
|
|
497
|
+
var StyledHeader = styled__default["default"].div.attrs({
|
|
476
498
|
'data-garden-id': COMPONENT_ID$7
|
|
477
499
|
}).withConfig({
|
|
478
500
|
displayName: "StyledHeader",
|
|
@@ -500,7 +522,7 @@ var retrieveColor$1 = function retrieveColor(_ref2) {
|
|
|
500
522
|
return styled.css([":hover{background-color:", ";color:", ";}:active{background-color:", ";color:", ";}color:", ";"], reactTheming.getColor('primaryHue', 600, theme, 0.08), theme.colors.foreground, reactTheming.getColor('primaryHue', 600, theme, 0.2), theme.colors.foreground, reactTheming.getColor('neutralHue', 600, theme));
|
|
501
523
|
};
|
|
502
524
|
var COMPONENT_ID$6 = 'datepickers.header_paddle';
|
|
503
|
-
var StyledHeaderPaddle = styled__default[
|
|
525
|
+
var StyledHeaderPaddle = styled__default["default"].div.attrs({
|
|
504
526
|
'data-garden-id': COMPONENT_ID$6
|
|
505
527
|
}).withConfig({
|
|
506
528
|
displayName: "StyledHeaderPaddle",
|
|
@@ -522,7 +544,7 @@ StyledHeaderPaddle.defaultProps = {
|
|
|
522
544
|
};
|
|
523
545
|
|
|
524
546
|
var COMPONENT_ID$5 = 'datepickers.header_label';
|
|
525
|
-
var StyledHeaderLabel = styled__default[
|
|
547
|
+
var StyledHeaderLabel = styled__default["default"].div.attrs({
|
|
526
548
|
'data-garden-id': COMPONENT_ID$5
|
|
527
549
|
}).withConfig({
|
|
528
550
|
displayName: "StyledHeaderLabel",
|
|
@@ -539,7 +561,7 @@ StyledHeaderLabel.defaultProps = {
|
|
|
539
561
|
};
|
|
540
562
|
|
|
541
563
|
var COMPONENT_ID$4 = 'datepickers.calendar';
|
|
542
|
-
var StyledCalendar = styled__default[
|
|
564
|
+
var StyledCalendar = styled__default["default"].div.attrs({
|
|
543
565
|
'data-garden-id': COMPONENT_ID$4
|
|
544
566
|
}).withConfig({
|
|
545
567
|
displayName: "StyledCalendar",
|
|
@@ -565,7 +587,7 @@ var retrieveSize = function retrieveSize(_ref) {
|
|
|
565
587
|
}
|
|
566
588
|
return styled.css(["width:", ";height:", ";"], size, size);
|
|
567
589
|
};
|
|
568
|
-
var StyledCalendarItem = styled__default[
|
|
590
|
+
var StyledCalendarItem = styled__default["default"].div.attrs({
|
|
569
591
|
'data-garden-id': COMPONENT_ID$3
|
|
570
592
|
}).withConfig({
|
|
571
593
|
displayName: "StyledCalendarItem",
|
|
@@ -578,7 +600,7 @@ StyledCalendarItem.defaultProps = {
|
|
|
578
600
|
};
|
|
579
601
|
|
|
580
602
|
var COMPONENT_ID$2 = 'datepickers.day_label';
|
|
581
|
-
var StyledDayLabel = styled__default[
|
|
603
|
+
var StyledDayLabel = styled__default["default"].div.attrs({
|
|
582
604
|
'data-garden-id': COMPONENT_ID$2
|
|
583
605
|
}).withConfig({
|
|
584
606
|
displayName: "StyledDayLabel",
|
|
@@ -623,7 +645,7 @@ var retrieveColor = function retrieveColor(_ref2) {
|
|
|
623
645
|
}
|
|
624
646
|
return styled.css([""]);
|
|
625
647
|
};
|
|
626
|
-
var StyledHighlight = styled__default[
|
|
648
|
+
var StyledHighlight = styled__default["default"].div.attrs({
|
|
627
649
|
'data-garden-id': COMPONENT_ID$1
|
|
628
650
|
}).withConfig({
|
|
629
651
|
displayName: "StyledHighlight",
|
|
@@ -656,7 +678,7 @@ var retrieveStyledDayColors = function retrieveStyledDayColors(_ref) {
|
|
|
656
678
|
return styled.css(["background-color:", ";color:", ";", ""], backgroundColor, color, !isSelected && !isDisabled && "\n :hover {\n background-color: ".concat(reactTheming.getColor('primaryHue', 600, theme, 0.08), ";\n color: ").concat(reactTheming.getColor('primaryHue', 800, theme), ";\n }\n\n :active {\n background-color: ").concat(reactTheming.getColor('primaryHue', 600, theme, 0.2), ";\n color: ").concat(reactTheming.getColor('primaryHue', 800, theme), ";\n }\n "));
|
|
657
679
|
};
|
|
658
680
|
var COMPONENT_ID = 'datepickers.day';
|
|
659
|
-
var StyledDay = styled__default[
|
|
681
|
+
var StyledDay = styled__default["default"].div.attrs(function (props) {
|
|
660
682
|
return {
|
|
661
683
|
'data-garden-id': COMPONENT_ID,
|
|
662
684
|
'aria-disabled': props.isDisabled ? 'true' : 'false'
|
|
@@ -763,41 +785,41 @@ function getStartOfWeek(locale) {
|
|
|
763
785
|
return 0;
|
|
764
786
|
}
|
|
765
787
|
|
|
766
|
-
|
|
788
|
+
var _path$1;
|
|
767
789
|
|
|
768
|
-
|
|
769
|
-
fill: "currentColor",
|
|
770
|
-
d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
|
|
771
|
-
});
|
|
790
|
+
function _extends$1() { _extends$1 = Object.assign || 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); }
|
|
772
791
|
|
|
773
|
-
function SvgChevronLeftStroke(props) {
|
|
792
|
+
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
774
793
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
775
794
|
xmlns: "http://www.w3.org/2000/svg",
|
|
776
795
|
width: 16,
|
|
777
796
|
height: 16,
|
|
778
|
-
viewBox: "0 0 16 16",
|
|
779
797
|
focusable: "false",
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
798
|
+
viewBox: "0 0 16 16",
|
|
799
|
+
"aria-hidden": "true"
|
|
800
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
801
|
+
fill: "currentColor",
|
|
802
|
+
d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
|
|
803
|
+
})));
|
|
804
|
+
};
|
|
783
805
|
|
|
784
|
-
|
|
806
|
+
var _path;
|
|
785
807
|
|
|
786
|
-
var
|
|
787
|
-
fill: "currentColor",
|
|
788
|
-
d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
|
|
789
|
-
});
|
|
808
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
790
809
|
|
|
791
|
-
function SvgChevronRightStroke(props) {
|
|
810
|
+
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
792
811
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
793
812
|
xmlns: "http://www.w3.org/2000/svg",
|
|
794
813
|
width: 16,
|
|
795
814
|
height: 16,
|
|
796
|
-
viewBox: "0 0 16 16",
|
|
797
815
|
focusable: "false",
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
816
|
+
viewBox: "0 0 16 16",
|
|
817
|
+
"aria-hidden": "true"
|
|
818
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
819
|
+
fill: "currentColor",
|
|
820
|
+
d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
|
|
821
|
+
})));
|
|
822
|
+
};
|
|
801
823
|
|
|
802
824
|
var MonthSelector = function MonthSelector(_ref) {
|
|
803
825
|
var locale = _ref.locale,
|
|
@@ -812,28 +834,28 @@ var MonthSelector = function MonthSelector(_ref) {
|
|
|
812
834
|
});
|
|
813
835
|
return formatter.format(date);
|
|
814
836
|
}, [locale]);
|
|
815
|
-
return React__default[
|
|
837
|
+
return React__default["default"].createElement(StyledHeader, {
|
|
816
838
|
isCompact: isCompact
|
|
817
|
-
}, React__default[
|
|
839
|
+
}, React__default["default"].createElement(StyledHeaderPaddle, {
|
|
818
840
|
isCompact: isCompact,
|
|
819
841
|
onClick: function onClick() {
|
|
820
842
|
dispatch({
|
|
821
843
|
type: 'PREVIEW_PREVIOUS_MONTH'
|
|
822
844
|
});
|
|
823
845
|
}
|
|
824
|
-
}, React__default[
|
|
846
|
+
}, React__default["default"].createElement(SvgChevronLeftStroke, null)), React__default["default"].createElement(StyledHeaderLabel, {
|
|
825
847
|
isCompact: isCompact
|
|
826
|
-
}, headerLabelFormatter(state.previewDate)), React__default[
|
|
848
|
+
}, headerLabelFormatter(state.previewDate)), React__default["default"].createElement(StyledHeaderPaddle, {
|
|
827
849
|
isCompact: isCompact,
|
|
828
850
|
onClick: function onClick() {
|
|
829
851
|
dispatch({
|
|
830
852
|
type: 'PREVIEW_NEXT_MONTH'
|
|
831
853
|
});
|
|
832
854
|
}
|
|
833
|
-
}, React__default[
|
|
855
|
+
}, React__default["default"].createElement(SvgChevronRightStroke, null)));
|
|
834
856
|
};
|
|
835
857
|
|
|
836
|
-
var Calendar$1 = function
|
|
858
|
+
var Calendar$1 = React.forwardRef(function (_ref, ref) {
|
|
837
859
|
var value = _ref.value,
|
|
838
860
|
minValue = _ref.minValue,
|
|
839
861
|
maxValue = _ref.maxValue,
|
|
@@ -862,10 +884,10 @@ var Calendar$1 = function Calendar(_ref) {
|
|
|
862
884
|
end: addDays(startDate, 6)
|
|
863
885
|
}).map(function (date) {
|
|
864
886
|
var formattedDayLabel = dayLabelFormatter(date);
|
|
865
|
-
return React__default[
|
|
887
|
+
return React__default["default"].createElement(StyledCalendarItem, {
|
|
866
888
|
key: "day-label-".concat(formattedDayLabel),
|
|
867
889
|
isCompact: isCompact
|
|
868
|
-
}, React__default[
|
|
890
|
+
}, React__default["default"].createElement(StyledDayLabel, {
|
|
869
891
|
isCompact: isCompact
|
|
870
892
|
}, formattedDayLabel));
|
|
871
893
|
});
|
|
@@ -884,10 +906,10 @@ var Calendar$1 = function Calendar(_ref) {
|
|
|
884
906
|
if (maxValue !== undefined) {
|
|
885
907
|
isDisabled = isDisabled || isAfter(date, maxValue) && !isSameDay(date, maxValue);
|
|
886
908
|
}
|
|
887
|
-
return React__default[
|
|
909
|
+
return React__default["default"].createElement(StyledCalendarItem, {
|
|
888
910
|
key: "day-".concat(itemsIndex),
|
|
889
911
|
isCompact: isCompact
|
|
890
|
-
}, React__default[
|
|
912
|
+
}, React__default["default"].createElement(StyledDay, {
|
|
891
913
|
isToday: isCurrentDate,
|
|
892
914
|
isPreviousMonth: isPreviousMonth,
|
|
893
915
|
isSelected: isSelected,
|
|
@@ -903,18 +925,20 @@ var Calendar$1 = function Calendar(_ref) {
|
|
|
903
925
|
}
|
|
904
926
|
}, formattedDayLabel));
|
|
905
927
|
});
|
|
906
|
-
return React__default[
|
|
928
|
+
return React__default["default"].createElement(StyledDatepicker, {
|
|
929
|
+
ref: ref,
|
|
907
930
|
isCompact: isCompact,
|
|
908
931
|
onMouseDown: function onMouseDown(e) {
|
|
909
932
|
e.preventDefault();
|
|
910
933
|
}
|
|
911
|
-
}, React__default[
|
|
934
|
+
}, React__default["default"].createElement(MonthSelector, {
|
|
912
935
|
locale: locale,
|
|
913
936
|
isCompact: isCompact
|
|
914
|
-
}), React__default[
|
|
937
|
+
}), React__default["default"].createElement(StyledCalendar, {
|
|
915
938
|
isCompact: isCompact
|
|
916
939
|
}, dayLabels, items));
|
|
917
|
-
};
|
|
940
|
+
});
|
|
941
|
+
Calendar$1.displayName = 'Calendar';
|
|
918
942
|
|
|
919
943
|
function addMonths(dirtyDate, dirtyAmount) {
|
|
920
944
|
requiredArgs(2, arguments);
|
|
@@ -3256,7 +3280,8 @@ function retrieveInitialState$1(initialProps) {
|
|
|
3256
3280
|
};
|
|
3257
3281
|
}
|
|
3258
3282
|
|
|
3259
|
-
var
|
|
3283
|
+
var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "customParseDate"];
|
|
3284
|
+
var Datepicker = React.forwardRef(function (props, calendarRef) {
|
|
3260
3285
|
var children = props.children,
|
|
3261
3286
|
placement = props.placement,
|
|
3262
3287
|
popperModifiers = props.popperModifiers,
|
|
@@ -3271,7 +3296,8 @@ var Datepicker = function Datepicker(props) {
|
|
|
3271
3296
|
minValue = props.minValue,
|
|
3272
3297
|
maxValue = props.maxValue,
|
|
3273
3298
|
locale = props.locale,
|
|
3274
|
-
customParseDate = props.customParseDate
|
|
3299
|
+
customParseDate = props.customParseDate,
|
|
3300
|
+
menuProps = _objectWithoutProperties(props, _excluded);
|
|
3275
3301
|
var theme = React.useContext(styled.ThemeContext);
|
|
3276
3302
|
var memoizedReducer = React.useCallback(datepickerReducer({
|
|
3277
3303
|
value: value,
|
|
@@ -3329,13 +3355,13 @@ var Datepicker = function Datepicker(props) {
|
|
|
3329
3355
|
dispatch: dispatch
|
|
3330
3356
|
};
|
|
3331
3357
|
}, [state, dispatch]);
|
|
3332
|
-
return React__default[
|
|
3358
|
+
return React__default["default"].createElement(DatepickerContext.Provider, {
|
|
3333
3359
|
value: contextValue
|
|
3334
|
-
}, React__default[
|
|
3360
|
+
}, React__default["default"].createElement(reactPopper.Manager, null, React__default["default"].createElement(reactPopper.Reference, null, function (_ref) {
|
|
3335
3361
|
var _React$cloneElement;
|
|
3336
3362
|
var ref = _ref.ref;
|
|
3337
|
-
var childElement = React__default[
|
|
3338
|
-
return React__default[
|
|
3363
|
+
var childElement = React__default["default"].Children.only(children);
|
|
3364
|
+
return React__default["default"].cloneElement(childElement, (_React$cloneElement = {}, _defineProperty(_React$cloneElement, refKey, function (refValue) {
|
|
3339
3365
|
ref(refValue);
|
|
3340
3366
|
inputRef.current = refValue;
|
|
3341
3367
|
}), _defineProperty(_React$cloneElement, "onMouseDown", containerUtilities.composeEventHandlers(childElement.props.onMouseDown, function () {
|
|
@@ -3376,7 +3402,7 @@ var Datepicker = function Datepicker(props) {
|
|
|
3376
3402
|
break;
|
|
3377
3403
|
}
|
|
3378
3404
|
})), _defineProperty(_React$cloneElement, "autoComplete", 'off'), _defineProperty(_React$cloneElement, "value", state.inputValue), _React$cloneElement));
|
|
3379
|
-
}), React__default[
|
|
3405
|
+
}), React__default["default"].createElement(reactPopper.Popper, {
|
|
3380
3406
|
placement: popperPlacement,
|
|
3381
3407
|
modifiers: popperModifiers
|
|
3382
3408
|
,
|
|
@@ -3387,14 +3413,15 @@ var Datepicker = function Datepicker(props) {
|
|
|
3387
3413
|
scheduleUpdate = _ref2.scheduleUpdate,
|
|
3388
3414
|
currentPlacement = _ref2.placement;
|
|
3389
3415
|
scheduleUpdateRef.current = scheduleUpdate;
|
|
3390
|
-
return React__default[
|
|
3416
|
+
return React__default["default"].createElement(StyledMenuWrapper, {
|
|
3391
3417
|
ref: ref,
|
|
3392
3418
|
style: style,
|
|
3393
3419
|
isHidden: !state.isOpen,
|
|
3394
3420
|
isAnimated: isAnimated && (state.isOpen || isVisible),
|
|
3395
3421
|
placement: currentPlacement,
|
|
3396
3422
|
zIndex: zIndex
|
|
3397
|
-
}, React__default[
|
|
3423
|
+
}, (state.isOpen || isVisible) && React__default["default"].createElement(StyledMenu, menuProps, React__default["default"].createElement(Calendar$1, {
|
|
3424
|
+
ref: calendarRef,
|
|
3398
3425
|
isCompact: isCompact,
|
|
3399
3426
|
value: value,
|
|
3400
3427
|
minValue: minValue,
|
|
@@ -3402,22 +3429,23 @@ var Datepicker = function Datepicker(props) {
|
|
|
3402
3429
|
locale: locale
|
|
3403
3430
|
})));
|
|
3404
3431
|
})));
|
|
3405
|
-
};
|
|
3432
|
+
});
|
|
3433
|
+
Datepicker.displayName = 'Datepicker';
|
|
3406
3434
|
Datepicker.propTypes = {
|
|
3407
|
-
value: PropTypes__default[
|
|
3408
|
-
onChange: PropTypes__default[
|
|
3409
|
-
formatDate: PropTypes__default[
|
|
3410
|
-
locale: PropTypes__default[
|
|
3411
|
-
minValue: PropTypes__default[
|
|
3412
|
-
maxValue: PropTypes__default[
|
|
3413
|
-
isCompact: PropTypes__default[
|
|
3414
|
-
customParseDate: PropTypes__default[
|
|
3415
|
-
refKey: PropTypes__default[
|
|
3416
|
-
placement: PropTypes__default[
|
|
3417
|
-
popperModifiers: PropTypes__default[
|
|
3418
|
-
isAnimated: PropTypes__default[
|
|
3419
|
-
eventsEnabled: PropTypes__default[
|
|
3420
|
-
zIndex: PropTypes__default[
|
|
3435
|
+
value: PropTypes__default["default"].any,
|
|
3436
|
+
onChange: PropTypes__default["default"].any,
|
|
3437
|
+
formatDate: PropTypes__default["default"].func,
|
|
3438
|
+
locale: PropTypes__default["default"].any,
|
|
3439
|
+
minValue: PropTypes__default["default"].any,
|
|
3440
|
+
maxValue: PropTypes__default["default"].any,
|
|
3441
|
+
isCompact: PropTypes__default["default"].bool,
|
|
3442
|
+
customParseDate: PropTypes__default["default"].any,
|
|
3443
|
+
refKey: PropTypes__default["default"].string,
|
|
3444
|
+
placement: PropTypes__default["default"].oneOf(['auto', 'top', 'top-start', 'top-end', 'end', 'end-top', 'end-bottom', 'bottom', 'bottom-start', 'bottom-end', 'start', 'start-top', 'start-bottom']),
|
|
3445
|
+
popperModifiers: PropTypes__default["default"].any,
|
|
3446
|
+
isAnimated: PropTypes__default["default"].bool,
|
|
3447
|
+
eventsEnabled: PropTypes__default["default"].bool,
|
|
3448
|
+
zIndex: PropTypes__default["default"].number
|
|
3421
3449
|
};
|
|
3422
3450
|
Datepicker.defaultProps = {
|
|
3423
3451
|
placement: 'bottom-start',
|
|
@@ -3770,8 +3798,8 @@ var Start = function Start(props) {
|
|
|
3770
3798
|
});
|
|
3771
3799
|
props.children.props.onBlur && props.children.props.onBlur(e);
|
|
3772
3800
|
}, [dispatch, props.children]);
|
|
3773
|
-
var childElement = React__default[
|
|
3774
|
-
return React__default[
|
|
3801
|
+
var childElement = React__default["default"].Children.only(props.children);
|
|
3802
|
+
return React__default["default"].cloneElement(childElement, {
|
|
3775
3803
|
value: state.startInputValue,
|
|
3776
3804
|
ref: startInputRef,
|
|
3777
3805
|
onChange: containerUtilities.composeEventHandlers(childElement.props.onChange, onChangeCallback),
|
|
@@ -3814,8 +3842,8 @@ var End = function End(props) {
|
|
|
3814
3842
|
});
|
|
3815
3843
|
props.children.props.onBlur && props.children.props.onBlur(e);
|
|
3816
3844
|
}, [dispatch, props.children]);
|
|
3817
|
-
var childElement = React__default[
|
|
3818
|
-
return React__default[
|
|
3845
|
+
var childElement = React__default["default"].Children.only(props.children);
|
|
3846
|
+
return React__default["default"].cloneElement(childElement, {
|
|
3819
3847
|
value: state.endInputValue,
|
|
3820
3848
|
ref: endInputRef,
|
|
3821
3849
|
onChange: containerUtilities.composeEventHandlers(childElement.props.onChange, onChangeCallback),
|
|
@@ -3831,7 +3859,7 @@ function subDays(dirtyDate, dirtyAmount) {
|
|
|
3831
3859
|
return addDays(dirtyDate, -amount);
|
|
3832
3860
|
}
|
|
3833
3861
|
|
|
3834
|
-
var Month = function
|
|
3862
|
+
var Month = React.forwardRef(function (_ref, ref) {
|
|
3835
3863
|
var locale = _ref.locale,
|
|
3836
3864
|
displayDate = _ref.displayDate,
|
|
3837
3865
|
isCompact = _ref.isCompact,
|
|
@@ -3876,10 +3904,10 @@ var Month = function Month(_ref) {
|
|
|
3876
3904
|
end: addDays(startDate, 6)
|
|
3877
3905
|
}).map(function (date) {
|
|
3878
3906
|
var formattedDayLabel = dayLabelFormatter(date);
|
|
3879
|
-
return React__default[
|
|
3907
|
+
return React__default["default"].createElement(StyledCalendarItem, {
|
|
3880
3908
|
key: "day-label-".concat(formattedDayLabel),
|
|
3881
3909
|
isCompact: isCompact
|
|
3882
|
-
}, React__default[
|
|
3910
|
+
}, React__default["default"].createElement(StyledDayLabel, {
|
|
3883
3911
|
isCompact: isCompact
|
|
3884
3912
|
}, formattedDayLabel));
|
|
3885
3913
|
});
|
|
@@ -3891,10 +3919,10 @@ var Month = function Month(_ref) {
|
|
|
3891
3919
|
var isCurrentDate = isToday(date);
|
|
3892
3920
|
var isPreviousMonth = !isSameMonth(date, displayDate);
|
|
3893
3921
|
if (isPreviousMonth) {
|
|
3894
|
-
return React__default[
|
|
3922
|
+
return React__default["default"].createElement(StyledCalendarItem, {
|
|
3895
3923
|
key: "day-".concat(itemsIndex),
|
|
3896
3924
|
isCompact: isCompact
|
|
3897
|
-
}, React__default[
|
|
3925
|
+
}, React__default["default"].createElement(StyledDay, {
|
|
3898
3926
|
isCompact: isCompact,
|
|
3899
3927
|
isPreviousMonth: true,
|
|
3900
3928
|
isDisabled: true
|
|
@@ -3939,14 +3967,14 @@ var Month = function Month(_ref) {
|
|
|
3939
3967
|
isInvalidDateRange = isInvalidDateRange || compareAsc(endValue, maxValue) === 1;
|
|
3940
3968
|
}
|
|
3941
3969
|
}
|
|
3942
|
-
return React__default[
|
|
3970
|
+
return React__default["default"].createElement(StyledCalendarItem, {
|
|
3943
3971
|
key: "day-".concat(itemsIndex),
|
|
3944
3972
|
isCompact: isCompact
|
|
3945
|
-
}, React__default[
|
|
3973
|
+
}, React__default["default"].createElement(StyledHighlight, {
|
|
3946
3974
|
isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
|
|
3947
3975
|
isStart: !isInvalidDateRange && isHighlightStart,
|
|
3948
3976
|
isEnd: !isInvalidDateRange && isHighlightEnd
|
|
3949
|
-
}), React__default[
|
|
3977
|
+
}), React__default["default"].createElement(StyledDay, {
|
|
3950
3978
|
isToday: isCurrentDate,
|
|
3951
3979
|
isPreviousMonth: isPreviousMonth,
|
|
3952
3980
|
isSelected: !isInvalidDateRange && isSelected,
|
|
@@ -3970,14 +3998,15 @@ var Month = function Month(_ref) {
|
|
|
3970
3998
|
}
|
|
3971
3999
|
}, formattedDayLabel));
|
|
3972
4000
|
});
|
|
3973
|
-
return React__default[
|
|
4001
|
+
return React__default["default"].createElement(StyledDatepicker, {
|
|
4002
|
+
ref: ref,
|
|
3974
4003
|
isCompact: isCompact,
|
|
3975
4004
|
onMouseDown: function onMouseDown(e) {
|
|
3976
4005
|
e.preventDefault();
|
|
3977
4006
|
}
|
|
3978
|
-
}, React__default[
|
|
4007
|
+
}, React__default["default"].createElement(StyledHeader, {
|
|
3979
4008
|
isCompact: isCompact
|
|
3980
|
-
}, React__default[
|
|
4009
|
+
}, React__default["default"].createElement(StyledHeaderPaddle, {
|
|
3981
4010
|
isCompact: isCompact,
|
|
3982
4011
|
onClick: function onClick() {
|
|
3983
4012
|
dispatch({
|
|
@@ -3985,9 +4014,9 @@ var Month = function Month(_ref) {
|
|
|
3985
4014
|
});
|
|
3986
4015
|
},
|
|
3987
4016
|
isHidden: isPreviousHidden
|
|
3988
|
-
}, React__default[
|
|
4017
|
+
}, React__default["default"].createElement(SvgChevronLeftStroke, null)), React__default["default"].createElement(StyledHeaderLabel, {
|
|
3989
4018
|
isCompact: isCompact
|
|
3990
|
-
}, headerLabelFormatter(displayDate)), React__default[
|
|
4019
|
+
}, headerLabelFormatter(displayDate)), React__default["default"].createElement(StyledHeaderPaddle, {
|
|
3991
4020
|
isCompact: isCompact,
|
|
3992
4021
|
isHidden: isNextHidden,
|
|
3993
4022
|
onClick: function onClick() {
|
|
@@ -3995,7 +4024,7 @@ var Month = function Month(_ref) {
|
|
|
3995
4024
|
type: 'PREVIEW_NEXT_MONTH'
|
|
3996
4025
|
});
|
|
3997
4026
|
}
|
|
3998
|
-
}, React__default[
|
|
4027
|
+
}, React__default["default"].createElement(SvgChevronRightStroke, null))), React__default["default"].createElement(StyledCalendar, {
|
|
3999
4028
|
isCompact: isCompact,
|
|
4000
4029
|
onMouseLeave: function onMouseLeave() {
|
|
4001
4030
|
dispatch({
|
|
@@ -4004,9 +4033,10 @@ var Month = function Month(_ref) {
|
|
|
4004
4033
|
});
|
|
4005
4034
|
}
|
|
4006
4035
|
}, dayLabels, items));
|
|
4007
|
-
};
|
|
4036
|
+
});
|
|
4037
|
+
Month.displayName = 'Month';
|
|
4008
4038
|
|
|
4009
|
-
var Calendar = function
|
|
4039
|
+
var Calendar = React.forwardRef(function (props, ref) {
|
|
4010
4040
|
var _useDatepickerRangeCo = useDatepickerContext(),
|
|
4011
4041
|
state = _useDatepickerRangeCo.state,
|
|
4012
4042
|
dispatch = _useDatepickerRangeCo.dispatch,
|
|
@@ -4017,10 +4047,11 @@ var Calendar = function Calendar(props) {
|
|
|
4017
4047
|
startValue = _useDatepickerRangeCo.startValue,
|
|
4018
4048
|
endValue = _useDatepickerRangeCo.endValue,
|
|
4019
4049
|
onChange = _useDatepickerRangeCo.onChange;
|
|
4020
|
-
return React__default[
|
|
4050
|
+
return React__default["default"].createElement(StyledRangeCalendar, _extends$2({
|
|
4051
|
+
ref: ref,
|
|
4021
4052
|
"data-garden-id": "datepickers.range",
|
|
4022
|
-
"data-garden-version": '8.
|
|
4023
|
-
}, props), React__default[
|
|
4053
|
+
"data-garden-version": '8.48.0'
|
|
4054
|
+
}, props), React__default["default"].createElement(Month, {
|
|
4024
4055
|
locale: locale,
|
|
4025
4056
|
displayDate: state.previewDate,
|
|
4026
4057
|
isCompact: isCompact,
|
|
@@ -4032,7 +4063,7 @@ var Calendar = function Calendar(props) {
|
|
|
4032
4063
|
endValue: endValue,
|
|
4033
4064
|
onChange: onChange,
|
|
4034
4065
|
hoverDate: state.hoverDate
|
|
4035
|
-
}), React__default[
|
|
4066
|
+
}), React__default["default"].createElement(Month, {
|
|
4036
4067
|
locale: locale,
|
|
4037
4068
|
displayDate: addMonths(state.previewDate, 1),
|
|
4038
4069
|
isCompact: isCompact,
|
|
@@ -4045,9 +4076,10 @@ var Calendar = function Calendar(props) {
|
|
|
4045
4076
|
onChange: onChange,
|
|
4046
4077
|
hoverDate: state.hoverDate
|
|
4047
4078
|
}));
|
|
4048
|
-
};
|
|
4079
|
+
});
|
|
4080
|
+
Calendar.displayName = 'Calendar';
|
|
4049
4081
|
|
|
4050
|
-
var
|
|
4082
|
+
var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
4051
4083
|
var startValue = props.startValue,
|
|
4052
4084
|
locale = props.locale,
|
|
4053
4085
|
formatDate = props.formatDate,
|
|
@@ -4109,28 +4141,29 @@ var DatepickerRange = function DatepickerRange(props) {
|
|
|
4109
4141
|
endInputRef: endInputRef
|
|
4110
4142
|
};
|
|
4111
4143
|
}, [state, dispatch, isCompact, locale, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef]);
|
|
4112
|
-
return React__default[
|
|
4144
|
+
return React__default["default"].createElement(DatepickerRangeContext.Provider, {
|
|
4113
4145
|
value: value
|
|
4114
4146
|
}, children);
|
|
4115
4147
|
};
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
formatDate: PropTypes__default['default'].func,
|
|
4127
|
-
customParseDate: PropTypes__default['default'].func,
|
|
4128
|
-
isCompact: PropTypes__default['default'].bool
|
|
4148
|
+
DatepickerRangeComponent.propTypes = {
|
|
4149
|
+
locale: PropTypes__default["default"].string,
|
|
4150
|
+
startValue: PropTypes__default["default"].instanceOf(Date),
|
|
4151
|
+
endValue: PropTypes__default["default"].instanceOf(Date),
|
|
4152
|
+
minValue: PropTypes__default["default"].instanceOf(Date),
|
|
4153
|
+
maxValue: PropTypes__default["default"].instanceOf(Date),
|
|
4154
|
+
onChange: PropTypes__default["default"].func,
|
|
4155
|
+
formatDate: PropTypes__default["default"].func,
|
|
4156
|
+
customParseDate: PropTypes__default["default"].func,
|
|
4157
|
+
isCompact: PropTypes__default["default"].bool
|
|
4129
4158
|
};
|
|
4130
|
-
|
|
4159
|
+
DatepickerRangeComponent.defaultProps = {
|
|
4131
4160
|
locale: 'en-US',
|
|
4132
4161
|
isCompact: false
|
|
4133
4162
|
};
|
|
4163
|
+
var DatepickerRange = DatepickerRangeComponent;
|
|
4164
|
+
DatepickerRange.Calendar = Calendar;
|
|
4165
|
+
DatepickerRange.End = End;
|
|
4166
|
+
DatepickerRange.Start = Start;
|
|
4134
4167
|
|
|
4135
4168
|
exports.Datepicker = Datepicker;
|
|
4136
4169
|
exports.DatepickerRange = DatepickerRange;
|
package/dist/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import React__default, { createContext, useContext, useCallback, useReducer, useRef, useEffect, useState, useMemo } from 'react';
|
|
9
|
+
import React__default, { createContext, useContext, useCallback, forwardRef, useReducer, useRef, useEffect, useState, useMemo } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import styled, { css, ThemeContext } from 'styled-components';
|
|
12
12
|
import { Manager, Reference, Popper } from 'react-popper';
|
|
@@ -18,14 +18,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
18
18
|
|
|
19
19
|
if (Object.getOwnPropertySymbols) {
|
|
20
20
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
keys.push.apply(keys, symbols);
|
|
21
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
22
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
23
|
+
})), keys.push.apply(keys, symbols);
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
return keys;
|
|
@@ -33,19 +28,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
33
28
|
|
|
34
29
|
function _objectSpread2(target) {
|
|
35
30
|
for (var i = 1; i < arguments.length; i++) {
|
|
36
|
-
var source = arguments[i]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
43
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
44
|
-
} else {
|
|
45
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
46
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
47
|
-
});
|
|
48
|
-
}
|
|
31
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
32
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
33
|
+
_defineProperty(target, key, source[key]);
|
|
34
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
35
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
36
|
+
});
|
|
49
37
|
}
|
|
50
38
|
|
|
51
39
|
return target;
|
|
@@ -84,6 +72,42 @@ function _extends$2() {
|
|
|
84
72
|
return _extends$2.apply(this, arguments);
|
|
85
73
|
}
|
|
86
74
|
|
|
75
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
76
|
+
if (source == null) return {};
|
|
77
|
+
var target = {};
|
|
78
|
+
var sourceKeys = Object.keys(source);
|
|
79
|
+
var key, i;
|
|
80
|
+
|
|
81
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
82
|
+
key = sourceKeys[i];
|
|
83
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
84
|
+
target[key] = source[key];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function _objectWithoutProperties(source, excluded) {
|
|
91
|
+
if (source == null) return {};
|
|
92
|
+
|
|
93
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
94
|
+
|
|
95
|
+
var key, i;
|
|
96
|
+
|
|
97
|
+
if (Object.getOwnPropertySymbols) {
|
|
98
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
99
|
+
|
|
100
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
101
|
+
key = sourceSymbolKeys[i];
|
|
102
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
103
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
104
|
+
target[key] = source[key];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return target;
|
|
109
|
+
}
|
|
110
|
+
|
|
87
111
|
function _slicedToArray(arr, i) {
|
|
88
112
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
89
113
|
}
|
|
@@ -364,7 +388,7 @@ function getDate(dirtyDate) {
|
|
|
364
388
|
var COMPONENT_ID$b = 'datepickers.menu';
|
|
365
389
|
var StyledMenu = styled.div.attrs({
|
|
366
390
|
'data-garden-id': COMPONENT_ID$b,
|
|
367
|
-
'data-garden-version': '8.
|
|
391
|
+
'data-garden-version': '8.48.0'
|
|
368
392
|
}).withConfig({
|
|
369
393
|
displayName: "StyledMenu",
|
|
370
394
|
componentId: "sc-1npbkk0-0"
|
|
@@ -733,41 +757,41 @@ function getStartOfWeek(locale) {
|
|
|
733
757
|
return 0;
|
|
734
758
|
}
|
|
735
759
|
|
|
736
|
-
|
|
760
|
+
var _path$1;
|
|
737
761
|
|
|
738
|
-
|
|
739
|
-
fill: "currentColor",
|
|
740
|
-
d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
|
|
741
|
-
});
|
|
762
|
+
function _extends$1() { _extends$1 = Object.assign || 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); }
|
|
742
763
|
|
|
743
|
-
function SvgChevronLeftStroke(props) {
|
|
764
|
+
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
744
765
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
745
766
|
xmlns: "http://www.w3.org/2000/svg",
|
|
746
767
|
width: 16,
|
|
747
768
|
height: 16,
|
|
748
|
-
viewBox: "0 0 16 16",
|
|
749
769
|
focusable: "false",
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
770
|
+
viewBox: "0 0 16 16",
|
|
771
|
+
"aria-hidden": "true"
|
|
772
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
773
|
+
fill: "currentColor",
|
|
774
|
+
d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
|
|
775
|
+
})));
|
|
776
|
+
};
|
|
753
777
|
|
|
754
|
-
|
|
778
|
+
var _path;
|
|
755
779
|
|
|
756
|
-
var
|
|
757
|
-
fill: "currentColor",
|
|
758
|
-
d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
|
|
759
|
-
});
|
|
780
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
760
781
|
|
|
761
|
-
function SvgChevronRightStroke(props) {
|
|
782
|
+
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
762
783
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
763
784
|
xmlns: "http://www.w3.org/2000/svg",
|
|
764
785
|
width: 16,
|
|
765
786
|
height: 16,
|
|
766
|
-
viewBox: "0 0 16 16",
|
|
767
787
|
focusable: "false",
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
788
|
+
viewBox: "0 0 16 16",
|
|
789
|
+
"aria-hidden": "true"
|
|
790
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
791
|
+
fill: "currentColor",
|
|
792
|
+
d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
|
|
793
|
+
})));
|
|
794
|
+
};
|
|
771
795
|
|
|
772
796
|
var MonthSelector = function MonthSelector(_ref) {
|
|
773
797
|
var locale = _ref.locale,
|
|
@@ -803,7 +827,7 @@ var MonthSelector = function MonthSelector(_ref) {
|
|
|
803
827
|
}, React__default.createElement(SvgChevronRightStroke, null)));
|
|
804
828
|
};
|
|
805
829
|
|
|
806
|
-
var Calendar$1 = function
|
|
830
|
+
var Calendar$1 = forwardRef(function (_ref, ref) {
|
|
807
831
|
var value = _ref.value,
|
|
808
832
|
minValue = _ref.minValue,
|
|
809
833
|
maxValue = _ref.maxValue,
|
|
@@ -874,6 +898,7 @@ var Calendar$1 = function Calendar(_ref) {
|
|
|
874
898
|
}, formattedDayLabel));
|
|
875
899
|
});
|
|
876
900
|
return React__default.createElement(StyledDatepicker, {
|
|
901
|
+
ref: ref,
|
|
877
902
|
isCompact: isCompact,
|
|
878
903
|
onMouseDown: function onMouseDown(e) {
|
|
879
904
|
e.preventDefault();
|
|
@@ -884,7 +909,8 @@ var Calendar$1 = function Calendar(_ref) {
|
|
|
884
909
|
}), React__default.createElement(StyledCalendar, {
|
|
885
910
|
isCompact: isCompact
|
|
886
911
|
}, dayLabels, items));
|
|
887
|
-
};
|
|
912
|
+
});
|
|
913
|
+
Calendar$1.displayName = 'Calendar';
|
|
888
914
|
|
|
889
915
|
function addMonths(dirtyDate, dirtyAmount) {
|
|
890
916
|
requiredArgs(2, arguments);
|
|
@@ -3226,7 +3252,8 @@ function retrieveInitialState$1(initialProps) {
|
|
|
3226
3252
|
};
|
|
3227
3253
|
}
|
|
3228
3254
|
|
|
3229
|
-
var
|
|
3255
|
+
var _excluded = ["children", "placement", "popperModifiers", "eventsEnabled", "zIndex", "isAnimated", "refKey", "value", "isCompact", "onChange", "formatDate", "minValue", "maxValue", "locale", "customParseDate"];
|
|
3256
|
+
var Datepicker = forwardRef(function (props, calendarRef) {
|
|
3230
3257
|
var children = props.children,
|
|
3231
3258
|
placement = props.placement,
|
|
3232
3259
|
popperModifiers = props.popperModifiers,
|
|
@@ -3241,7 +3268,8 @@ var Datepicker = function Datepicker(props) {
|
|
|
3241
3268
|
minValue = props.minValue,
|
|
3242
3269
|
maxValue = props.maxValue,
|
|
3243
3270
|
locale = props.locale,
|
|
3244
|
-
customParseDate = props.customParseDate
|
|
3271
|
+
customParseDate = props.customParseDate,
|
|
3272
|
+
menuProps = _objectWithoutProperties(props, _excluded);
|
|
3245
3273
|
var theme = useContext(ThemeContext);
|
|
3246
3274
|
var memoizedReducer = useCallback(datepickerReducer({
|
|
3247
3275
|
value: value,
|
|
@@ -3364,7 +3392,8 @@ var Datepicker = function Datepicker(props) {
|
|
|
3364
3392
|
isAnimated: isAnimated && (state.isOpen || isVisible),
|
|
3365
3393
|
placement: currentPlacement,
|
|
3366
3394
|
zIndex: zIndex
|
|
3367
|
-
}, React__default.createElement(StyledMenu,
|
|
3395
|
+
}, (state.isOpen || isVisible) && React__default.createElement(StyledMenu, menuProps, React__default.createElement(Calendar$1, {
|
|
3396
|
+
ref: calendarRef,
|
|
3368
3397
|
isCompact: isCompact,
|
|
3369
3398
|
value: value,
|
|
3370
3399
|
minValue: minValue,
|
|
@@ -3372,7 +3401,8 @@ var Datepicker = function Datepicker(props) {
|
|
|
3372
3401
|
locale: locale
|
|
3373
3402
|
})));
|
|
3374
3403
|
})));
|
|
3375
|
-
};
|
|
3404
|
+
});
|
|
3405
|
+
Datepicker.displayName = 'Datepicker';
|
|
3376
3406
|
Datepicker.propTypes = {
|
|
3377
3407
|
value: PropTypes.any,
|
|
3378
3408
|
onChange: PropTypes.any,
|
|
@@ -3801,7 +3831,7 @@ function subDays(dirtyDate, dirtyAmount) {
|
|
|
3801
3831
|
return addDays(dirtyDate, -amount);
|
|
3802
3832
|
}
|
|
3803
3833
|
|
|
3804
|
-
var Month = function
|
|
3834
|
+
var Month = forwardRef(function (_ref, ref) {
|
|
3805
3835
|
var locale = _ref.locale,
|
|
3806
3836
|
displayDate = _ref.displayDate,
|
|
3807
3837
|
isCompact = _ref.isCompact,
|
|
@@ -3941,6 +3971,7 @@ var Month = function Month(_ref) {
|
|
|
3941
3971
|
}, formattedDayLabel));
|
|
3942
3972
|
});
|
|
3943
3973
|
return React__default.createElement(StyledDatepicker, {
|
|
3974
|
+
ref: ref,
|
|
3944
3975
|
isCompact: isCompact,
|
|
3945
3976
|
onMouseDown: function onMouseDown(e) {
|
|
3946
3977
|
e.preventDefault();
|
|
@@ -3974,9 +4005,10 @@ var Month = function Month(_ref) {
|
|
|
3974
4005
|
});
|
|
3975
4006
|
}
|
|
3976
4007
|
}, dayLabels, items));
|
|
3977
|
-
};
|
|
4008
|
+
});
|
|
4009
|
+
Month.displayName = 'Month';
|
|
3978
4010
|
|
|
3979
|
-
var Calendar = function
|
|
4011
|
+
var Calendar = forwardRef(function (props, ref) {
|
|
3980
4012
|
var _useDatepickerRangeCo = useDatepickerContext(),
|
|
3981
4013
|
state = _useDatepickerRangeCo.state,
|
|
3982
4014
|
dispatch = _useDatepickerRangeCo.dispatch,
|
|
@@ -3988,8 +4020,9 @@ var Calendar = function Calendar(props) {
|
|
|
3988
4020
|
endValue = _useDatepickerRangeCo.endValue,
|
|
3989
4021
|
onChange = _useDatepickerRangeCo.onChange;
|
|
3990
4022
|
return React__default.createElement(StyledRangeCalendar, _extends$2({
|
|
4023
|
+
ref: ref,
|
|
3991
4024
|
"data-garden-id": "datepickers.range",
|
|
3992
|
-
"data-garden-version": '8.
|
|
4025
|
+
"data-garden-version": '8.48.0'
|
|
3993
4026
|
}, props), React__default.createElement(Month, {
|
|
3994
4027
|
locale: locale,
|
|
3995
4028
|
displayDate: state.previewDate,
|
|
@@ -4015,9 +4048,10 @@ var Calendar = function Calendar(props) {
|
|
|
4015
4048
|
onChange: onChange,
|
|
4016
4049
|
hoverDate: state.hoverDate
|
|
4017
4050
|
}));
|
|
4018
|
-
};
|
|
4051
|
+
});
|
|
4052
|
+
Calendar.displayName = 'Calendar';
|
|
4019
4053
|
|
|
4020
|
-
var
|
|
4054
|
+
var DatepickerRangeComponent = function DatepickerRangeComponent(props) {
|
|
4021
4055
|
var startValue = props.startValue,
|
|
4022
4056
|
locale = props.locale,
|
|
4023
4057
|
formatDate = props.formatDate,
|
|
@@ -4083,10 +4117,7 @@ var DatepickerRange = function DatepickerRange(props) {
|
|
|
4083
4117
|
value: value
|
|
4084
4118
|
}, children);
|
|
4085
4119
|
};
|
|
4086
|
-
|
|
4087
|
-
DatepickerRange.End = End;
|
|
4088
|
-
DatepickerRange.Calendar = Calendar;
|
|
4089
|
-
DatepickerRange.propTypes = {
|
|
4120
|
+
DatepickerRangeComponent.propTypes = {
|
|
4090
4121
|
locale: PropTypes.string,
|
|
4091
4122
|
startValue: PropTypes.instanceOf(Date),
|
|
4092
4123
|
endValue: PropTypes.instanceOf(Date),
|
|
@@ -4097,9 +4128,13 @@ DatepickerRange.propTypes = {
|
|
|
4097
4128
|
customParseDate: PropTypes.func,
|
|
4098
4129
|
isCompact: PropTypes.bool
|
|
4099
4130
|
};
|
|
4100
|
-
|
|
4131
|
+
DatepickerRangeComponent.defaultProps = {
|
|
4101
4132
|
locale: 'en-US',
|
|
4102
4133
|
isCompact: false
|
|
4103
4134
|
};
|
|
4135
|
+
var DatepickerRange = DatepickerRangeComponent;
|
|
4136
|
+
DatepickerRange.Calendar = Calendar;
|
|
4137
|
+
DatepickerRange.End = End;
|
|
4138
|
+
DatepickerRange.Start = Start;
|
|
4104
4139
|
|
|
4105
4140
|
export { Datepicker, DatepickerRange };
|
|
@@ -4,10 +4,13 @@
|
|
|
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 React from 'react';
|
|
7
|
+
import React, { HTMLAttributes } from 'react';
|
|
8
8
|
import { Modifiers } from 'popper.js';
|
|
9
9
|
import { GARDEN_PLACEMENT } from './utils/garden-placements';
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
12
|
+
*/
|
|
13
|
+
export interface IDatepickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
11
14
|
/**
|
|
12
15
|
* Sets the selected date
|
|
13
16
|
*/
|
|
@@ -74,4 +77,4 @@ export interface IDatepickerProps {
|
|
|
74
77
|
*/
|
|
75
78
|
zIndex?: number;
|
|
76
79
|
}
|
|
77
|
-
export declare const Datepicker: React.
|
|
80
|
+
export declare const Datepicker: React.ForwardRefExoticComponent<IDatepickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -4,13 +4,13 @@
|
|
|
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 React from 'react';
|
|
8
|
-
interface ICalendarProps {
|
|
7
|
+
import React, { HTMLAttributes } from 'react';
|
|
8
|
+
interface ICalendarProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
9
|
value?: Date;
|
|
10
10
|
minValue?: Date;
|
|
11
11
|
maxValue?: Date;
|
|
12
12
|
isCompact?: boolean;
|
|
13
13
|
locale?: string;
|
|
14
14
|
}
|
|
15
|
-
declare const Calendar: React.
|
|
16
|
-
export
|
|
15
|
+
export declare const Calendar: React.ForwardRefExoticComponent<ICalendarProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export {};
|
|
@@ -9,5 +9,5 @@ interface IMonthSelectorProps {
|
|
|
9
9
|
locale?: string;
|
|
10
10
|
isCompact: boolean;
|
|
11
11
|
}
|
|
12
|
-
declare const MonthSelector: React.FunctionComponent<IMonthSelectorProps>;
|
|
13
|
-
export
|
|
12
|
+
export declare const MonthSelector: React.FunctionComponent<IMonthSelectorProps>;
|
|
13
|
+
export {};
|
|
@@ -4,8 +4,11 @@
|
|
|
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
|
|
7
|
+
import { PropsWithChildren } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import { Start } from './components/Start';
|
|
10
|
+
import { End } from './components/End';
|
|
11
|
+
import { Calendar } from './components/Calendar';
|
|
9
12
|
export interface IDatepickerRangeProps {
|
|
10
13
|
/**
|
|
11
14
|
* Applies locale-based formatting.
|
|
@@ -60,9 +63,6 @@ export interface IDatepickerRangeProps {
|
|
|
60
63
|
}
|
|
61
64
|
export declare const DatepickerRange: {
|
|
62
65
|
(props: PropsWithChildren<IDatepickerRangeProps>): JSX.Element;
|
|
63
|
-
Start: (props: React.PropsWithChildren<React.HTMLAttributes<HTMLInputElement>>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
64
|
-
End: (props: React.PropsWithChildren<React.HTMLAttributes<HTMLInputElement>>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
65
|
-
Calendar: React.FunctionComponent<React.HTMLAttributes<HTMLDivElement>>;
|
|
66
66
|
propTypes: {
|
|
67
67
|
locale: PropTypes.Requireable<string>;
|
|
68
68
|
startValue: PropTypes.Requireable<Date>;
|
|
@@ -78,4 +78,8 @@ export declare const DatepickerRange: {
|
|
|
78
78
|
locale: string;
|
|
79
79
|
isCompact: boolean;
|
|
80
80
|
};
|
|
81
|
+
} & {
|
|
82
|
+
Calendar: typeof Calendar;
|
|
83
|
+
End: typeof End;
|
|
84
|
+
Start: typeof Start;
|
|
81
85
|
};
|
|
@@ -4,6 +4,8 @@
|
|
|
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 React
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* @extends HTMLAttributes<HTMLDivElement>
|
|
10
|
+
*/
|
|
11
|
+
export declare const Calendar: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -5,5 +5,4 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React, { PropsWithChildren, HTMLAttributes } from 'react';
|
|
8
|
-
declare const End: (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>) => React.ReactElement<any, string |
|
|
9
|
-
export default End;
|
|
8
|
+
export declare const End: (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -4,9 +4,9 @@
|
|
|
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 React from 'react';
|
|
7
|
+
import React, { HTMLAttributes } from 'react';
|
|
8
8
|
import { DatepickerRangeAction } from '../utils/datepicker-range-reducer';
|
|
9
|
-
|
|
9
|
+
interface IMonthProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
10
10
|
locale?: string;
|
|
11
11
|
displayDate: Date;
|
|
12
12
|
isCompact?: boolean;
|
|
@@ -22,5 +22,6 @@ declare const Month: React.FunctionComponent<{
|
|
|
22
22
|
endValue?: Date;
|
|
23
23
|
}) => void;
|
|
24
24
|
hoverDate?: Date;
|
|
25
|
-
}
|
|
26
|
-
export
|
|
25
|
+
}
|
|
26
|
+
export declare const Month: React.ForwardRefExoticComponent<IMonthProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export {};
|
|
@@ -5,5 +5,4 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React, { PropsWithChildren, HTMLAttributes } from 'react';
|
|
8
|
-
declare const Start: (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>) => React.ReactElement<any, string |
|
|
9
|
-
export default Start;
|
|
8
|
+
export declare const Start: (props: PropsWithChildren<HTMLAttributes<HTMLInputElement>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-datepickers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.48.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>",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/container-utilities": "^0.
|
|
24
|
+
"@zendeskgarden/container-utilities": "^0.7.0",
|
|
25
25
|
"date-fns": "^2.0.0-beta.2",
|
|
26
26
|
"prop-types": "^15.5.7",
|
|
27
27
|
"react-popper": "^1.3.4"
|
|
@@ -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.48.0",
|
|
37
37
|
"@zendeskgarden/svg-icons": "6.30.2"
|
|
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": "75f36aee62043004650c3eb2e1583b98a87d71f8"
|
|
50
50
|
}
|