@zendeskgarden/react-datepickers 8.62.1 → 8.63.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 +85 -94
- package/dist/index.esm.js +4 -10
- package/dist/typings/elements/Datepicker/utils/datepicker-reducer.d.ts +1 -1
- package/dist/typings/elements/DatepickerRange/utils/datepicker-range-reducer.d.ts +1 -1
- package/dist/typings/types/index.d.ts +2 -2
- package/dist/typings/utils/calendar-utils.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var PropTypes = require('prop-types');
|
|
14
12
|
var styled = require('styled-components');
|
|
@@ -16,7 +14,7 @@ var reactPopper = require('react-popper');
|
|
|
16
14
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
17
15
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
18
16
|
|
|
19
|
-
function
|
|
17
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
18
|
|
|
21
19
|
function _interopNamespace(e) {
|
|
22
20
|
if (e && e.__esModule) return e;
|
|
@@ -32,14 +30,13 @@ function _interopNamespace(e) {
|
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
|
-
n
|
|
33
|
+
n.default = e;
|
|
36
34
|
return Object.freeze(n);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
38
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
39
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
43
40
|
|
|
44
41
|
const SHARED_PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'];
|
|
45
42
|
const PLACEMENT = [...SHARED_PLACEMENT, 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
@@ -263,9 +260,9 @@ function getDate(dirtyDate) {
|
|
|
263
260
|
}
|
|
264
261
|
|
|
265
262
|
const COMPONENT_ID$b = 'datepickers.menu';
|
|
266
|
-
const StyledMenu = styled__default
|
|
263
|
+
const StyledMenu = styled__default.default.div.attrs({
|
|
267
264
|
'data-garden-id': COMPONENT_ID$b,
|
|
268
|
-
'data-garden-version': '8.
|
|
265
|
+
'data-garden-version': '8.63.0'
|
|
269
266
|
}).withConfig({
|
|
270
267
|
displayName: "StyledMenu",
|
|
271
268
|
componentId: "sc-1npbkk0-0"
|
|
@@ -275,7 +272,7 @@ StyledMenu.defaultProps = {
|
|
|
275
272
|
};
|
|
276
273
|
|
|
277
274
|
const COMPONENT_ID$a = 'datepickers.menu_wrapper';
|
|
278
|
-
const StyledMenuWrapper = styled__default
|
|
275
|
+
const StyledMenuWrapper = styled__default.default.div.attrs(props => ({
|
|
279
276
|
className: props.isAnimated && 'is-animated'
|
|
280
277
|
})).withConfig({
|
|
281
278
|
displayName: "StyledMenuWrapper",
|
|
@@ -303,7 +300,7 @@ const retrievePadding = _ref => {
|
|
|
303
300
|
}
|
|
304
301
|
return `margin: ${value}px;`;
|
|
305
302
|
};
|
|
306
|
-
const StyledDatepicker = styled__default
|
|
303
|
+
const StyledDatepicker = styled__default.default.div.attrs({
|
|
307
304
|
'data-garden-id': COMPONENT_ID$9
|
|
308
305
|
}).withConfig({
|
|
309
306
|
displayName: "StyledDatepicker",
|
|
@@ -314,7 +311,7 @@ StyledDatepicker.defaultProps = {
|
|
|
314
311
|
};
|
|
315
312
|
|
|
316
313
|
const COMPONENT_ID$8 = 'datepickers.range_calendar';
|
|
317
|
-
const StyledRangeCalendar = styled__default
|
|
314
|
+
const StyledRangeCalendar = styled__default.default.div.attrs({
|
|
318
315
|
'data-garden-id': COMPONENT_ID$8
|
|
319
316
|
}).withConfig({
|
|
320
317
|
displayName: "StyledRangeCalendar",
|
|
@@ -325,7 +322,7 @@ StyledRangeCalendar.defaultProps = {
|
|
|
325
322
|
};
|
|
326
323
|
|
|
327
324
|
const COMPONENT_ID$7 = 'datepickers.header';
|
|
328
|
-
const StyledHeader = styled__default
|
|
325
|
+
const StyledHeader = styled__default.default.div.attrs({
|
|
329
326
|
'data-garden-id': COMPONENT_ID$7
|
|
330
327
|
}).withConfig({
|
|
331
328
|
displayName: "StyledHeader",
|
|
@@ -353,7 +350,7 @@ const retrieveColor$1 = _ref2 => {
|
|
|
353
350
|
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));
|
|
354
351
|
};
|
|
355
352
|
const COMPONENT_ID$6 = 'datepickers.header_paddle';
|
|
356
|
-
const StyledHeaderPaddle = styled__default
|
|
353
|
+
const StyledHeaderPaddle = styled__default.default.div.attrs({
|
|
357
354
|
'data-garden-id': COMPONENT_ID$6
|
|
358
355
|
}).withConfig({
|
|
359
356
|
displayName: "StyledHeaderPaddle",
|
|
@@ -364,7 +361,7 @@ StyledHeaderPaddle.defaultProps = {
|
|
|
364
361
|
};
|
|
365
362
|
|
|
366
363
|
const COMPONENT_ID$5 = 'datepickers.header_label';
|
|
367
|
-
const StyledHeaderLabel = styled__default
|
|
364
|
+
const StyledHeaderLabel = styled__default.default.div.attrs({
|
|
368
365
|
'data-garden-id': COMPONENT_ID$5
|
|
369
366
|
}).withConfig({
|
|
370
367
|
displayName: "StyledHeaderLabel",
|
|
@@ -375,7 +372,7 @@ StyledHeaderLabel.defaultProps = {
|
|
|
375
372
|
};
|
|
376
373
|
|
|
377
374
|
const COMPONENT_ID$4 = 'datepickers.calendar';
|
|
378
|
-
const StyledCalendar = styled__default
|
|
375
|
+
const StyledCalendar = styled__default.default.div.attrs({
|
|
379
376
|
'data-garden-id': COMPONENT_ID$4
|
|
380
377
|
}).withConfig({
|
|
381
378
|
displayName: "StyledCalendar",
|
|
@@ -399,7 +396,7 @@ const retrieveSize = _ref => {
|
|
|
399
396
|
}
|
|
400
397
|
return styled.css(["width:", ";height:", ";"], size, size);
|
|
401
398
|
};
|
|
402
|
-
const StyledCalendarItem = styled__default
|
|
399
|
+
const StyledCalendarItem = styled__default.default.div.attrs({
|
|
403
400
|
'data-garden-id': COMPONENT_ID$3
|
|
404
401
|
}).withConfig({
|
|
405
402
|
displayName: "StyledCalendarItem",
|
|
@@ -410,7 +407,7 @@ StyledCalendarItem.defaultProps = {
|
|
|
410
407
|
};
|
|
411
408
|
|
|
412
409
|
const COMPONENT_ID$2 = 'datepickers.day_label';
|
|
413
|
-
const StyledDayLabel = styled__default
|
|
410
|
+
const StyledDayLabel = styled__default.default.div.attrs({
|
|
414
411
|
'data-garden-id': COMPONENT_ID$2
|
|
415
412
|
}).withConfig({
|
|
416
413
|
displayName: "StyledDayLabel",
|
|
@@ -453,7 +450,7 @@ const retrieveColor = _ref2 => {
|
|
|
453
450
|
}
|
|
454
451
|
return styled.css([""]);
|
|
455
452
|
};
|
|
456
|
-
const StyledHighlight = styled__default
|
|
453
|
+
const StyledHighlight = styled__default.default.div.attrs({
|
|
457
454
|
'data-garden-id': COMPONENT_ID$1
|
|
458
455
|
}).withConfig({
|
|
459
456
|
displayName: "StyledHighlight",
|
|
@@ -496,7 +493,7 @@ const retrieveStyledDayColors = _ref => {
|
|
|
496
493
|
`);
|
|
497
494
|
};
|
|
498
495
|
const COMPONENT_ID = 'datepickers.day';
|
|
499
|
-
const StyledDay = styled__default
|
|
496
|
+
const StyledDay = styled__default.default.div.attrs(props => ({
|
|
500
497
|
'data-garden-id': COMPONENT_ID,
|
|
501
498
|
'aria-disabled': props.isDisabled ? 'true' : 'false'
|
|
502
499
|
})).withConfig({
|
|
@@ -594,9 +591,7 @@ function getStartOfWeek(locale) {
|
|
|
594
591
|
}
|
|
595
592
|
|
|
596
593
|
var _path$1;
|
|
597
|
-
|
|
598
594
|
function _extends$2() { _extends$2 = 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$2.apply(this, arguments); }
|
|
599
|
-
|
|
600
595
|
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
601
596
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
602
597
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -604,8 +599,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
604
599
|
height: 16,
|
|
605
600
|
focusable: "false",
|
|
606
601
|
viewBox: "0 0 16 16",
|
|
607
|
-
"aria-hidden": "true"
|
|
608
|
-
role: "img"
|
|
602
|
+
"aria-hidden": "true"
|
|
609
603
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
610
604
|
fill: "currentColor",
|
|
611
605
|
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"
|
|
@@ -613,9 +607,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
613
607
|
};
|
|
614
608
|
|
|
615
609
|
var _path;
|
|
616
|
-
|
|
617
610
|
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); }
|
|
618
|
-
|
|
619
611
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
620
612
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
621
613
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -623,8 +615,7 @@ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
|
623
615
|
height: 16,
|
|
624
616
|
focusable: "false",
|
|
625
617
|
viewBox: "0 0 16 16",
|
|
626
|
-
"aria-hidden": "true"
|
|
627
|
-
role: "img"
|
|
618
|
+
"aria-hidden": "true"
|
|
628
619
|
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
629
620
|
fill: "currentColor",
|
|
630
621
|
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"
|
|
@@ -647,25 +638,25 @@ const MonthSelector = _ref => {
|
|
|
647
638
|
});
|
|
648
639
|
return formatter.format(date);
|
|
649
640
|
}, [locale]);
|
|
650
|
-
return
|
|
641
|
+
return React__namespace.default.createElement(StyledHeader, {
|
|
651
642
|
isCompact: isCompact
|
|
652
|
-
},
|
|
643
|
+
}, React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
653
644
|
isCompact: isCompact,
|
|
654
645
|
onClick: () => {
|
|
655
646
|
dispatch({
|
|
656
647
|
type: 'PREVIEW_PREVIOUS_MONTH'
|
|
657
648
|
});
|
|
658
649
|
}
|
|
659
|
-
},
|
|
650
|
+
}, React__namespace.default.createElement(SvgChevronLeftStroke, null)), React__namespace.default.createElement(StyledHeaderLabel, {
|
|
660
651
|
isCompact: isCompact
|
|
661
|
-
}, headerLabelFormatter(state.previewDate)),
|
|
652
|
+
}, headerLabelFormatter(state.previewDate)), React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
662
653
|
isCompact: isCompact,
|
|
663
654
|
onClick: () => {
|
|
664
655
|
dispatch({
|
|
665
656
|
type: 'PREVIEW_NEXT_MONTH'
|
|
666
657
|
});
|
|
667
658
|
}
|
|
668
|
-
},
|
|
659
|
+
}, React__namespace.default.createElement(SvgChevronRightStroke, null)));
|
|
669
660
|
};
|
|
670
661
|
|
|
671
662
|
const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
@@ -701,10 +692,10 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
701
692
|
end: addDays(startDate, 6)
|
|
702
693
|
}).map(date => {
|
|
703
694
|
const formattedDayLabel = dayLabelFormatter(date);
|
|
704
|
-
return
|
|
695
|
+
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
705
696
|
key: `day-label-${formattedDayLabel}`,
|
|
706
697
|
isCompact: isCompact
|
|
707
|
-
},
|
|
698
|
+
}, React__namespace.default.createElement(StyledDayLabel, {
|
|
708
699
|
isCompact: isCompact
|
|
709
700
|
}, formattedDayLabel));
|
|
710
701
|
});
|
|
@@ -723,10 +714,10 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
723
714
|
if (maxValue !== undefined) {
|
|
724
715
|
isDisabled = isDisabled || isAfter(date, maxValue) && !isSameDay(date, maxValue);
|
|
725
716
|
}
|
|
726
|
-
return
|
|
717
|
+
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
727
718
|
key: `day-${itemsIndex}`,
|
|
728
719
|
isCompact: isCompact
|
|
729
|
-
},
|
|
720
|
+
}, React__namespace.default.createElement(StyledDay, {
|
|
730
721
|
isToday: isCurrentDate,
|
|
731
722
|
isPreviousMonth: isPreviousMonth,
|
|
732
723
|
isSelected: isSelected,
|
|
@@ -742,16 +733,16 @@ const Calendar$1 = React.forwardRef((_ref, ref) => {
|
|
|
742
733
|
}
|
|
743
734
|
}, formattedDayLabel));
|
|
744
735
|
});
|
|
745
|
-
return
|
|
736
|
+
return React__namespace.default.createElement(StyledDatepicker, {
|
|
746
737
|
ref: ref,
|
|
747
738
|
isCompact: isCompact,
|
|
748
739
|
onMouseDown: e => {
|
|
749
740
|
e.preventDefault();
|
|
750
741
|
}
|
|
751
|
-
},
|
|
742
|
+
}, React__namespace.default.createElement(MonthSelector, {
|
|
752
743
|
locale: locale,
|
|
753
744
|
isCompact: isCompact
|
|
754
|
-
}),
|
|
745
|
+
}), React__namespace.default.createElement(StyledCalendar, {
|
|
755
746
|
isCompact: isCompact
|
|
756
747
|
}, dayLabels, items));
|
|
757
748
|
});
|
|
@@ -3176,14 +3167,14 @@ const Datepicker = React.forwardRef((props, calendarRef) => {
|
|
|
3176
3167
|
state,
|
|
3177
3168
|
dispatch
|
|
3178
3169
|
}), [state, dispatch]);
|
|
3179
|
-
return
|
|
3170
|
+
return React__namespace.default.createElement(DatepickerContext.Provider, {
|
|
3180
3171
|
value: contextValue
|
|
3181
|
-
},
|
|
3172
|
+
}, React__namespace.default.createElement(reactPopper.Manager, null, React__namespace.default.createElement(reactPopper.Reference, null, _ref => {
|
|
3182
3173
|
let {
|
|
3183
3174
|
ref
|
|
3184
3175
|
} = _ref;
|
|
3185
|
-
const childElement =
|
|
3186
|
-
return
|
|
3176
|
+
const childElement = React__namespace.default.Children.only(children);
|
|
3177
|
+
return React__namespace.default.cloneElement(childElement, {
|
|
3187
3178
|
[refKey]: refValue => {
|
|
3188
3179
|
ref(refValue);
|
|
3189
3180
|
inputRef.current = refValue;
|
|
@@ -3234,7 +3225,7 @@ const Datepicker = React.forwardRef((props, calendarRef) => {
|
|
|
3234
3225
|
autoComplete: 'off',
|
|
3235
3226
|
value: state.inputValue
|
|
3236
3227
|
});
|
|
3237
|
-
}),
|
|
3228
|
+
}), React__namespace.default.createElement(reactPopper.Popper, {
|
|
3238
3229
|
placement: popperPlacement,
|
|
3239
3230
|
modifiers: popperModifiers
|
|
3240
3231
|
,
|
|
@@ -3247,14 +3238,14 @@ const Datepicker = React.forwardRef((props, calendarRef) => {
|
|
|
3247
3238
|
placement: currentPlacement
|
|
3248
3239
|
} = _ref2;
|
|
3249
3240
|
scheduleUpdateRef.current = scheduleUpdate;
|
|
3250
|
-
return
|
|
3241
|
+
return React__namespace.default.createElement(StyledMenuWrapper, {
|
|
3251
3242
|
ref: ref,
|
|
3252
3243
|
style: style,
|
|
3253
3244
|
isHidden: !state.isOpen,
|
|
3254
3245
|
isAnimated: isAnimated && (state.isOpen || isVisible),
|
|
3255
3246
|
placement: currentPlacement,
|
|
3256
3247
|
zIndex: zIndex
|
|
3257
|
-
}, (state.isOpen || isVisible) &&
|
|
3248
|
+
}, (state.isOpen || isVisible) && React__namespace.default.createElement(StyledMenu, menuProps, React__namespace.default.createElement(Calendar$1, {
|
|
3258
3249
|
ref: calendarRef,
|
|
3259
3250
|
isCompact: isCompact,
|
|
3260
3251
|
value: value,
|
|
@@ -3267,21 +3258,21 @@ const Datepicker = React.forwardRef((props, calendarRef) => {
|
|
|
3267
3258
|
});
|
|
3268
3259
|
Datepicker.displayName = 'Datepicker';
|
|
3269
3260
|
Datepicker.propTypes = {
|
|
3270
|
-
value: PropTypes__default
|
|
3271
|
-
onChange: PropTypes__default
|
|
3272
|
-
formatDate: PropTypes__default
|
|
3273
|
-
locale: PropTypes__default
|
|
3274
|
-
weekStartsOn: PropTypes__default
|
|
3275
|
-
minValue: PropTypes__default
|
|
3276
|
-
maxValue: PropTypes__default
|
|
3277
|
-
isCompact: PropTypes__default
|
|
3278
|
-
customParseDate: PropTypes__default
|
|
3279
|
-
refKey: PropTypes__default
|
|
3280
|
-
placement: PropTypes__default
|
|
3281
|
-
popperModifiers: PropTypes__default
|
|
3282
|
-
isAnimated: PropTypes__default
|
|
3283
|
-
eventsEnabled: PropTypes__default
|
|
3284
|
-
zIndex: PropTypes__default
|
|
3261
|
+
value: PropTypes__default.default.any,
|
|
3262
|
+
onChange: PropTypes__default.default.any,
|
|
3263
|
+
formatDate: PropTypes__default.default.func,
|
|
3264
|
+
locale: PropTypes__default.default.any,
|
|
3265
|
+
weekStartsOn: PropTypes__default.default.number,
|
|
3266
|
+
minValue: PropTypes__default.default.any,
|
|
3267
|
+
maxValue: PropTypes__default.default.any,
|
|
3268
|
+
isCompact: PropTypes__default.default.bool,
|
|
3269
|
+
customParseDate: PropTypes__default.default.any,
|
|
3270
|
+
refKey: PropTypes__default.default.string,
|
|
3271
|
+
placement: PropTypes__default.default.oneOf(PLACEMENT),
|
|
3272
|
+
popperModifiers: PropTypes__default.default.any,
|
|
3273
|
+
isAnimated: PropTypes__default.default.bool,
|
|
3274
|
+
eventsEnabled: PropTypes__default.default.bool,
|
|
3275
|
+
zIndex: PropTypes__default.default.number
|
|
3285
3276
|
};
|
|
3286
3277
|
Datepicker.defaultProps = {
|
|
3287
3278
|
placement: 'bottom-start',
|
|
@@ -3665,8 +3656,8 @@ const Start = props => {
|
|
|
3665
3656
|
handleBlur();
|
|
3666
3657
|
props.children.props.onBlur && props.children.props.onBlur(e);
|
|
3667
3658
|
}, [handleBlur, props.children]);
|
|
3668
|
-
const childElement =
|
|
3669
|
-
return
|
|
3659
|
+
const childElement = React__namespace.default.Children.only(props.children);
|
|
3660
|
+
return React__namespace.default.cloneElement(childElement, {
|
|
3670
3661
|
value: state.startInputValue || '',
|
|
3671
3662
|
ref: startInputRef,
|
|
3672
3663
|
onChange: containerUtilities.composeEventHandlers(childElement.props.onChange, onChangeCallback),
|
|
@@ -3730,8 +3721,8 @@ const End = props => {
|
|
|
3730
3721
|
handleBlur();
|
|
3731
3722
|
props.children.props.onBlur && props.children.props.onBlur(e);
|
|
3732
3723
|
}, [handleBlur, props.children]);
|
|
3733
|
-
const childElement =
|
|
3734
|
-
return
|
|
3724
|
+
const childElement = React__namespace.default.Children.only(props.children);
|
|
3725
|
+
return React__namespace.default.cloneElement(childElement, {
|
|
3735
3726
|
value: state.endInputValue || '',
|
|
3736
3727
|
ref: endInputRef,
|
|
3737
3728
|
onChange: containerUtilities.composeEventHandlers(childElement.props.onChange, onChangeCallback),
|
|
@@ -3814,10 +3805,10 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
3814
3805
|
end: addDays(startDate, 6)
|
|
3815
3806
|
}).map(date => {
|
|
3816
3807
|
const formattedDayLabel = dayLabelFormatter(date);
|
|
3817
|
-
return
|
|
3808
|
+
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
3818
3809
|
key: `day-label-${formattedDayLabel}`,
|
|
3819
3810
|
isCompact: isCompact
|
|
3820
|
-
},
|
|
3811
|
+
}, React__namespace.default.createElement(StyledDayLabel, {
|
|
3821
3812
|
isCompact: isCompact
|
|
3822
3813
|
}, formattedDayLabel));
|
|
3823
3814
|
});
|
|
@@ -3829,10 +3820,10 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
3829
3820
|
const isCurrentDate = isToday(date);
|
|
3830
3821
|
const isPreviousMonth = !isSameMonth(date, displayDate);
|
|
3831
3822
|
if (isPreviousMonth) {
|
|
3832
|
-
return
|
|
3823
|
+
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
3833
3824
|
key: `day-${itemsIndex}`,
|
|
3834
3825
|
isCompact: isCompact
|
|
3835
|
-
},
|
|
3826
|
+
}, React__namespace.default.createElement(StyledDay, {
|
|
3836
3827
|
isCompact: isCompact,
|
|
3837
3828
|
isPreviousMonth: true,
|
|
3838
3829
|
isDisabled: true
|
|
@@ -3877,14 +3868,14 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
3877
3868
|
isInvalidDateRange = isInvalidDateRange || compareAsc(endValue, maxValue) === 1;
|
|
3878
3869
|
}
|
|
3879
3870
|
}
|
|
3880
|
-
return
|
|
3871
|
+
return React__namespace.default.createElement(StyledCalendarItem, {
|
|
3881
3872
|
key: `day-${itemsIndex}`,
|
|
3882
3873
|
isCompact: isCompact
|
|
3883
|
-
},
|
|
3874
|
+
}, React__namespace.default.createElement(StyledHighlight, {
|
|
3884
3875
|
isHighlighted: !isInvalidDateRange && isHighlighted && !isDisabled,
|
|
3885
3876
|
isStart: !isInvalidDateRange && isHighlightStart,
|
|
3886
3877
|
isEnd: !isInvalidDateRange && isHighlightEnd
|
|
3887
|
-
}),
|
|
3878
|
+
}), React__namespace.default.createElement(StyledDay, {
|
|
3888
3879
|
isToday: isCurrentDate,
|
|
3889
3880
|
isPreviousMonth: isPreviousMonth,
|
|
3890
3881
|
isSelected: !isInvalidDateRange && isSelected,
|
|
@@ -3957,15 +3948,15 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
3957
3948
|
}
|
|
3958
3949
|
}, formattedDayLabel));
|
|
3959
3950
|
});
|
|
3960
|
-
return
|
|
3951
|
+
return React__namespace.default.createElement(StyledDatepicker, {
|
|
3961
3952
|
ref: ref,
|
|
3962
3953
|
isCompact: isCompact,
|
|
3963
3954
|
onMouseDown: e => {
|
|
3964
3955
|
e.preventDefault();
|
|
3965
3956
|
}
|
|
3966
|
-
},
|
|
3957
|
+
}, React__namespace.default.createElement(StyledHeader, {
|
|
3967
3958
|
isCompact: isCompact
|
|
3968
|
-
},
|
|
3959
|
+
}, React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
3969
3960
|
isCompact: isCompact,
|
|
3970
3961
|
onClick: () => {
|
|
3971
3962
|
dispatch({
|
|
@@ -3973,9 +3964,9 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
3973
3964
|
});
|
|
3974
3965
|
},
|
|
3975
3966
|
isHidden: isPreviousHidden
|
|
3976
|
-
},
|
|
3967
|
+
}, React__namespace.default.createElement(SvgChevronLeftStroke, null)), React__namespace.default.createElement(StyledHeaderLabel, {
|
|
3977
3968
|
isCompact: isCompact
|
|
3978
|
-
}, headerLabelFormatter(displayDate)),
|
|
3969
|
+
}, headerLabelFormatter(displayDate)), React__namespace.default.createElement(StyledHeaderPaddle, {
|
|
3979
3970
|
isCompact: isCompact,
|
|
3980
3971
|
isHidden: isNextHidden,
|
|
3981
3972
|
onClick: () => {
|
|
@@ -3983,7 +3974,7 @@ const Month = React.forwardRef((_ref, ref) => {
|
|
|
3983
3974
|
type: 'PREVIEW_NEXT_MONTH'
|
|
3984
3975
|
});
|
|
3985
3976
|
}
|
|
3986
|
-
},
|
|
3977
|
+
}, React__namespace.default.createElement(SvgChevronRightStroke, null))), React__namespace.default.createElement(StyledCalendar, {
|
|
3987
3978
|
isCompact: isCompact,
|
|
3988
3979
|
onMouseLeave: () => {
|
|
3989
3980
|
dispatch({
|
|
@@ -3999,14 +3990,14 @@ const Calendar = React.forwardRef((props, ref) => {
|
|
|
3999
3990
|
const {
|
|
4000
3991
|
state
|
|
4001
3992
|
} = useDatepickerContext();
|
|
4002
|
-
return
|
|
3993
|
+
return React__namespace.default.createElement(StyledRangeCalendar, _extends({
|
|
4003
3994
|
ref: ref,
|
|
4004
3995
|
"data-garden-id": "datepickers.range",
|
|
4005
|
-
"data-garden-version": '8.
|
|
4006
|
-
}, props),
|
|
3996
|
+
"data-garden-version": '8.63.0'
|
|
3997
|
+
}, props), React__namespace.default.createElement(Month, {
|
|
4007
3998
|
displayDate: state.previewDate,
|
|
4008
3999
|
isNextHidden: true
|
|
4009
|
-
}),
|
|
4000
|
+
}), React__namespace.default.createElement(Month, {
|
|
4010
4001
|
displayDate: addMonths(state.previewDate, 1),
|
|
4011
4002
|
isPreviousHidden: true
|
|
4012
4003
|
}));
|
|
@@ -4074,21 +4065,21 @@ const DatepickerRangeComponent = props => {
|
|
|
4074
4065
|
endInputRef,
|
|
4075
4066
|
customParseDate
|
|
4076
4067
|
}), [state, dispatch, isCompact, locale, weekStartsOn, minValue, maxValue, startValue, endValue, onChange, startInputRef, endInputRef, customParseDate]);
|
|
4077
|
-
return
|
|
4068
|
+
return React__namespace.default.createElement(DatepickerRangeContext.Provider, {
|
|
4078
4069
|
value: value
|
|
4079
4070
|
}, children);
|
|
4080
4071
|
};
|
|
4081
4072
|
DatepickerRangeComponent.propTypes = {
|
|
4082
|
-
locale: PropTypes__default
|
|
4083
|
-
weekStartsOn: PropTypes__default
|
|
4084
|
-
startValue: PropTypes__default
|
|
4085
|
-
endValue: PropTypes__default
|
|
4086
|
-
minValue: PropTypes__default
|
|
4087
|
-
maxValue: PropTypes__default
|
|
4088
|
-
onChange: PropTypes__default
|
|
4089
|
-
formatDate: PropTypes__default
|
|
4090
|
-
customParseDate: PropTypes__default
|
|
4091
|
-
isCompact: PropTypes__default
|
|
4073
|
+
locale: PropTypes__default.default.string,
|
|
4074
|
+
weekStartsOn: PropTypes__default.default.number,
|
|
4075
|
+
startValue: PropTypes__default.default.instanceOf(Date),
|
|
4076
|
+
endValue: PropTypes__default.default.instanceOf(Date),
|
|
4077
|
+
minValue: PropTypes__default.default.instanceOf(Date),
|
|
4078
|
+
maxValue: PropTypes__default.default.instanceOf(Date),
|
|
4079
|
+
onChange: PropTypes__default.default.func,
|
|
4080
|
+
formatDate: PropTypes__default.default.func,
|
|
4081
|
+
customParseDate: PropTypes__default.default.func,
|
|
4082
|
+
isCompact: PropTypes__default.default.bool
|
|
4092
4083
|
};
|
|
4093
4084
|
DatepickerRangeComponent.defaultProps = {
|
|
4094
4085
|
locale: 'en-US',
|
package/dist/index.esm.js
CHANGED
|
@@ -237,7 +237,7 @@ function getDate(dirtyDate) {
|
|
|
237
237
|
const COMPONENT_ID$b = 'datepickers.menu';
|
|
238
238
|
const StyledMenu = styled.div.attrs({
|
|
239
239
|
'data-garden-id': COMPONENT_ID$b,
|
|
240
|
-
'data-garden-version': '8.
|
|
240
|
+
'data-garden-version': '8.63.0'
|
|
241
241
|
}).withConfig({
|
|
242
242
|
displayName: "StyledMenu",
|
|
243
243
|
componentId: "sc-1npbkk0-0"
|
|
@@ -566,9 +566,7 @@ function getStartOfWeek(locale) {
|
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
var _path$1;
|
|
569
|
-
|
|
570
569
|
function _extends$2() { _extends$2 = 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$2.apply(this, arguments); }
|
|
571
|
-
|
|
572
570
|
var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
573
571
|
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
574
572
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -576,8 +574,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
576
574
|
height: 16,
|
|
577
575
|
focusable: "false",
|
|
578
576
|
viewBox: "0 0 16 16",
|
|
579
|
-
"aria-hidden": "true"
|
|
580
|
-
role: "img"
|
|
577
|
+
"aria-hidden": "true"
|
|
581
578
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
582
579
|
fill: "currentColor",
|
|
583
580
|
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"
|
|
@@ -585,9 +582,7 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
585
582
|
};
|
|
586
583
|
|
|
587
584
|
var _path;
|
|
588
|
-
|
|
589
585
|
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); }
|
|
590
|
-
|
|
591
586
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
592
587
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
593
588
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -595,8 +590,7 @@ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
|
595
590
|
height: 16,
|
|
596
591
|
focusable: "false",
|
|
597
592
|
viewBox: "0 0 16 16",
|
|
598
|
-
"aria-hidden": "true"
|
|
599
|
-
role: "img"
|
|
593
|
+
"aria-hidden": "true"
|
|
600
594
|
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
601
595
|
fill: "currentColor",
|
|
602
596
|
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"
|
|
@@ -3974,7 +3968,7 @@ const Calendar = forwardRef((props, ref) => {
|
|
|
3974
3968
|
return React__default.createElement(StyledRangeCalendar, _extends({
|
|
3975
3969
|
ref: ref,
|
|
3976
3970
|
"data-garden-id": "datepickers.range",
|
|
3977
|
-
"data-garden-version": '8.
|
|
3971
|
+
"data-garden-version": '8.63.0'
|
|
3978
3972
|
}, props), React__default.createElement(Month, {
|
|
3979
3973
|
displayDate: state.previewDate,
|
|
3980
3974
|
isNextHidden: true
|
|
@@ -27,7 +27,7 @@ export declare function formatValue({ value, locale, formatDate }: {
|
|
|
27
27
|
export declare function parseInputValue({ inputValue }: {
|
|
28
28
|
inputValue?: string;
|
|
29
29
|
}): Date;
|
|
30
|
-
export
|
|
30
|
+
export type DatepickerRangeAction = {
|
|
31
31
|
type: 'HOVER_DATE';
|
|
32
32
|
value?: Date;
|
|
33
33
|
} | {
|
|
@@ -9,8 +9,8 @@ import { Modifiers } from 'popper.js';
|
|
|
9
9
|
import { DateFnsIndex } from '../utils/calendar-utils';
|
|
10
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"];
|
|
11
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"];
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export type GardenPlacement = (typeof PLACEMENT)[number];
|
|
13
|
+
export type PopperPlacement = (typeof POPPER_PLACEMENT)[number];
|
|
14
14
|
export interface IDatepickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
15
15
|
/**
|
|
16
16
|
* Sets the selected date
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* 6 - Saturday
|
|
12
12
|
*/
|
|
13
13
|
/** This type matches definition required by date-fns utilities */
|
|
14
|
-
export
|
|
14
|
+
export type DateFnsIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Return start day of week based on locale
|
|
17
17
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-datepickers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.63.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": "^1.0.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.63.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": "4b8715305a769881b143c7195c5b31e687422926"
|
|
50
50
|
}
|