@stenajs-webui/calendar 17.6.0 → 17.7.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/CHANGELOG.md +12 -0
- package/dist/components/calendar/Calendar.d.ts +3 -3
- package/dist/components/calendar/CalendarMonth.d.ts +16 -16
- package/dist/components/calendar/CalendarMonthWithMonthTextHeader.d.ts +6 -6
- package/dist/components/calendar/CalendarTheme.d.ts +57 -57
- package/dist/components/calendar/CalendarWeek.d.ts +18 -18
- package/dist/components/calendar/DisabledDayWrapper.d.ts +7 -7
- package/dist/components/calendar/renderers/CalendarDay.d.ts +3 -3
- package/dist/components/calendar/renderers/WeekDayCell.d.ts +10 -10
- package/dist/components/calendar/renderers/WeekNumberCell.d.ts +13 -13
- package/dist/components/calendar-types/date-range-calendar/DateRangeCalendar.d.ts +11 -11
- package/dist/components/calendar-types/date-range-calendar/hooks/UseDateRangeCalendarState.d.ts +10 -10
- package/dist/components/calendar-types/date-range-calendar/hooks/UseDateRangeSelection.d.ts +3 -3
- package/dist/components/calendar-types/date-range-exclusion-calendar/DateRangeExclusionCalendar.d.ts +7 -7
- package/dist/components/calendar-types/date-range-exclusion-calendar/UseDateRangeExclusionSelection.d.ts +3 -3
- package/dist/components/calendar-types/multi-date-calendar/MultiDateCalendar.d.ts +8 -8
- package/dist/components/calendar-types/multi-date-calendar/UseMultiDateSelection.d.ts +3 -3
- package/dist/components/calendar-types/single-date-calendar/SingleDateCalendar.d.ts +7 -7
- package/dist/components/calendar-types/single-date-calendar/UseSingleDateSelection.d.ts +3 -3
- package/dist/components/calendar-types/single-week-calendar/SingleWeekCalendar.d.ts +8 -8
- package/dist/components/calendar-types/single-week-calendar/UseSingleWeekSelection.d.ts +3 -3
- package/dist/components/input-types/date-input/DateInput.d.ts +52 -52
- package/dist/components/input-types/date-input/UseDateInput.d.ts +6 -6
- package/dist/components/input-types/date-range-dual-text-input/DateRangeDualTextInput.d.ts +15 -15
- package/dist/components/input-types/date-range-dual-text-input/hooks/UseDateRangeEffects.d.ts +2 -2
- package/dist/components/input-types/date-range-dual-text-input/hooks/UseDateRangeHandlers.d.ts +11 -11
- package/dist/components/input-types/date-range-dual-text-input/hooks/UseInputStates.d.ts +17 -17
- package/dist/components/input-types/date-range-dual-text-input/hooks/UseUserInputHandlers.d.ts +13 -13
- package/dist/components/input-types/date-range-input/DateRangeInput.d.ts +51 -51
- package/dist/components/input-types/date-range-input/hooks/UseDateRangeInput.d.ts +16 -16
- package/dist/components/input-types/date-text-input/DateTextInput.d.ts +28 -28
- package/dist/components/input-types/date-time-input/DateTimeInput.d.ts +12 -12
- package/dist/components/input-types/date-time-input/hooks/UseDateRangeEffects.d.ts +2 -2
- package/dist/components/input-types/date-time-input/hooks/UseDateRangeHandlers.d.ts +11 -11
- package/dist/components/input-types/date-time-input/hooks/UseInputStates.d.ts +22 -22
- package/dist/components/input-types/date-time-input/hooks/UseUserInputHandlers.d.ts +12 -12
- package/dist/components/input-types/time-text-input/TimeTextInput.d.ts +15 -15
- package/dist/config/DefaultMaxDate.d.ts +1 -1
- package/dist/config/DefaultPopoverPlacement.d.ts +2 -2
- package/dist/features/calendar-with-month-year-pickers/CalendarPanelType.d.ts +1 -1
- package/dist/features/calendar-with-month-year-pickers/CalendarWithMonthYearPickers.d.ts +13 -13
- package/dist/features/date-range/hooks/UseDateRangeOnClickDayHandler.d.ts +4 -4
- package/dist/features/dual-text-input/DualTextInput.d.ts +44 -44
- package/dist/features/internal-panel-state/UseCalendarPopoverUpdater.d.ts +4 -4
- package/dist/features/internal-panel-state/UseInternalPanelState.d.ts +9 -9
- package/dist/features/month-picker/MonthPicker.d.ts +6 -6
- package/dist/features/month-picker/MonthPickerCell.d.ts +8 -8
- package/dist/features/month-switcher/CalendarWithMonthSwitcher.d.ts +15 -15
- package/dist/features/month-switcher/MonthSwitcherBelow.d.ts +12 -12
- package/dist/features/month-switcher/hooks/UseSelectedMonthStepperLogic.d.ts +6 -6
- package/dist/features/preset-picker/CalendarPreset.d.ts +14 -14
- package/dist/features/preset-picker/PresetFactory.d.ts +2 -2
- package/dist/features/preset-picker/PresetPicker.d.ts +6 -6
- package/dist/features/time-picker/TimePicker.d.ts +5 -5
- package/dist/features/time-picker/TimePickerCell.d.ts +10 -10
- package/dist/features/time-picker/TimePickerColumn.d.ts +10 -10
- package/dist/features/today-state/UseHighlightToday.d.ts +2 -2
- package/dist/features/year-picker/YearPicker.d.ts +6 -6
- package/dist/features/year-picker/YearPickerCell.d.ts +7 -7
- package/dist/index.d.ts +32 -32
- package/dist/index.es.js +2866 -2058
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -2148
- package/dist/index.js.map +1 -1
- package/dist/types/CalendarTypes.d.ts +133 -133
- package/dist/types/DateRange.d.ts +16 -16
- package/dist/types/InternalPanelAndFocusStateProps.d.ts +3 -3
- package/dist/util/calendar/CalendarDataFactory.d.ts +64 -64
- package/dist/util/calendar/StateHelper.d.ts +3 -3
- package/dist/util/calendar/StateModifier.d.ts +11 -11
- package/dist/util/date/DateFormats.d.ts +11 -11
- package/dist/util/date/DateListTools.d.ts +3 -3
- package/dist/util/date/DateMinMaxValidator.d.ts +1 -1
- package/dist/util/date-range/DateRangeTransformer.d.ts +3 -3
- package/dist/util/date-range/DateRangeValidator.d.ts +4 -4
- package/dist/util/time/OverlappingTimesValidator.d.ts +11 -11
- package/dist/util/time/TimeStringFormatValidator.d.ts +8 -8
- package/dist/util/time/TimeTransformer.d.ts +8 -8
- package/package.json +10 -11
- package/dist/components/calendar-types/date-range-calendar/DateRangeCalendar.stories.d.ts +0 -20
- package/dist/components/calendar-types/date-range-exclusion-calendar/DateRangeExclusionCalendar.stories.d.ts +0 -17
- package/dist/components/calendar-types/multi-date-calendar/MultiDateCalendar.stories.d.ts +0 -15
- package/dist/components/calendar-types/multi-date-calendar/__tests__/UseMultiDateSelection.test.d.ts +0 -1
- package/dist/components/calendar-types/single-date-calendar/SingleDateCalendar.stories.d.ts +0 -17
- package/dist/components/calendar-types/single-week-calendar/SingleWeekCalendar.stories.d.ts +0 -8
- package/dist/components/input-types/date-input/DateInput.stories.d.ts +0 -19
- package/dist/components/input-types/date-range-dual-text-input/DateRangeDualTextInput.stories.d.ts +0 -18
- package/dist/components/input-types/date-range-input/DateRangeInput.stories.d.ts +0 -17
- package/dist/components/input-types/date-text-input/DateTextInput.stories.d.ts +0 -19
- package/dist/components/input-types/date-time-input/DateTimeInput.stories.d.ts +0 -14
- package/dist/components/input-types/time-text-input/TimeTextInput.stories.d.ts +0 -15
- package/dist/features/month-picker/MonthPicker.stories.d.ts +0 -7
- package/dist/features/preset-picker/PresetPicker.stories.d.ts +0 -7
- package/dist/features/time-picker/TimePicker.stories.d.ts +0 -7
- package/dist/features/year-picker/YearPicker.stories.d.ts +0 -12
- package/dist/util/calendar/__tests__/CalendarDataFactory.test.d.ts +0 -1
- package/dist/util/calendar/__tests__/StateHelper.test.d.ts +0 -1
- package/dist/util/calendar/__tests__/StateModifier.test.d.ts +0 -1
- package/dist/util/date/__tests__/DateListTools.test.d.ts +0 -1
- package/dist/util/date/__tests__/DateMinMaxValidator.test.d.ts +0 -1
- package/dist/util/date-range/__tests__/DateRangeValidator.test.d.ts +0 -1
- package/dist/util/time/__tests__/OverlappingTimesValidator.test.d.ts +0 -1
- package/dist/util/time/__tests__/TimeStringFormatValidator.test.d.ts +0 -1
- package/dist/util/time/__tests__/TimeTransformer.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,2149 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var elements = require('@stenajs-webui/elements');
|
|
7
|
-
var core = require('@stenajs-webui/core');
|
|
8
|
-
var dateFns = require('date-fns');
|
|
9
|
-
var lodash = require('lodash');
|
|
10
|
-
var styled = require('@emotion/styled');
|
|
11
|
-
var faAngleDoubleLeft = require('@fortawesome/free-solid-svg-icons/faAngleDoubleLeft');
|
|
12
|
-
var faAngleDoubleRight = require('@fortawesome/free-solid-svg-icons/faAngleDoubleRight');
|
|
13
|
-
var faCaretLeft = require('@fortawesome/free-solid-svg-icons/faCaretLeft');
|
|
14
|
-
var faCaretRight = require('@fortawesome/free-solid-svg-icons/faCaretRight');
|
|
15
|
-
var forms = require('@stenajs-webui/forms');
|
|
16
|
-
var tooltip = require('@stenajs-webui/tooltip');
|
|
17
|
-
var theme = require('@stenajs-webui/theme');
|
|
18
|
-
var faLongArrowAltRight = require('@fortawesome/free-solid-svg-icons/faLongArrowAltRight');
|
|
19
|
-
|
|
20
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
-
|
|
22
|
-
function _interopNamespace(e) {
|
|
23
|
-
if (e && e.__esModule) return e;
|
|
24
|
-
var n = Object.create(null);
|
|
25
|
-
if (e) {
|
|
26
|
-
Object.keys(e).forEach(function (k) {
|
|
27
|
-
if (k !== 'default') {
|
|
28
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
29
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () { return e[k]; }
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
n["default"] = e;
|
|
37
|
-
return Object.freeze(n);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
41
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
42
|
-
|
|
43
|
-
/*! *****************************************************************************
|
|
44
|
-
Copyright (c) Microsoft Corporation.
|
|
45
|
-
|
|
46
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
47
|
-
purpose with or without fee is hereby granted.
|
|
48
|
-
|
|
49
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
50
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
51
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
52
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
53
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
54
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
55
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
56
|
-
***************************************************************************** */
|
|
57
|
-
|
|
58
|
-
var __assign = function() {
|
|
59
|
-
__assign = Object.assign || function __assign(t) {
|
|
60
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
61
|
-
s = arguments[i];
|
|
62
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
63
|
-
}
|
|
64
|
-
return t;
|
|
65
|
-
};
|
|
66
|
-
return __assign.apply(this, arguments);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function __rest(s, e) {
|
|
70
|
-
var t = {};
|
|
71
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
72
|
-
t[p] = s[p];
|
|
73
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
74
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
75
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
76
|
-
t[p[i]] = s[p[i]];
|
|
77
|
-
}
|
|
78
|
-
return t;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function __spreadArray(to, from, pack) {
|
|
82
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
83
|
-
if (ar || !(i in from)) {
|
|
84
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
85
|
-
ar[i] = from[i];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
var DateFormats = {
|
|
92
|
-
yearAndMonth: "yyyy-MM",
|
|
93
|
-
fullDate: "yyyy-MM-dd",
|
|
94
|
-
fullMonthName: "LLLL",
|
|
95
|
-
fullDateAndTime: "yyyy-MM-dd HH:mm",
|
|
96
|
-
fullDateAndTimeSystem: "yyyy-MM-ddTHH:MM",
|
|
97
|
-
weekDayName: "EEEE",
|
|
98
|
-
weekDayNameShort: "EEE",
|
|
99
|
-
dateAndMonth: "d MMM",
|
|
100
|
-
monthAndDate: "MMM do", // Jan 2nd
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
var buildDayStateForDateRange = function (statePerMonth, start, end) {
|
|
104
|
-
if (statePerMonth === void 0) { statePerMonth = {}; }
|
|
105
|
-
if (start && end && dateFns.isAfter(end, start)) {
|
|
106
|
-
return dateFns.eachDayOfInterval({ start: start, end: end }).reduce(function (result, date) {
|
|
107
|
-
var isFirstInRange = dateFns.isSameDay(date, start);
|
|
108
|
-
var isLastInRange = dateFns.isSameDay(date, end);
|
|
109
|
-
var highlights = isFirstInRange
|
|
110
|
-
? ["selected", "selectedStart", "range"]
|
|
111
|
-
: isLastInRange
|
|
112
|
-
? ["selected", "selectedEnd", "range"]
|
|
113
|
-
: ["range"];
|
|
114
|
-
return addDayStateHighlights(result, date, highlights);
|
|
115
|
-
}, statePerMonth);
|
|
116
|
-
}
|
|
117
|
-
var state = statePerMonth;
|
|
118
|
-
if (start) {
|
|
119
|
-
state = addDayStateHighlights(state, start, ["selected", "singleSelected"]);
|
|
120
|
-
}
|
|
121
|
-
if (end) {
|
|
122
|
-
state = addDayStateHighlights(state, end, ["selected", "singleSelected"]);
|
|
123
|
-
}
|
|
124
|
-
return state;
|
|
125
|
-
};
|
|
126
|
-
var buildDayStateForSingleMonth = function (statePerMonth, start, end, dateInFocus) {
|
|
127
|
-
if (statePerMonth === void 0) { statePerMonth = {}; }
|
|
128
|
-
return buildDayStateForRange(statePerMonth, start, end, dateFns.startOfMonth(dateInFocus), dateFns.endOfMonth(dateInFocus));
|
|
129
|
-
};
|
|
130
|
-
var buildDayStateForRange = function (statePerMonth, start, end, startLimit, endLimit) {
|
|
131
|
-
if (statePerMonth === void 0) { statePerMonth = {}; }
|
|
132
|
-
if (start && end) {
|
|
133
|
-
return buildDayStateForDateRange(statePerMonth, dateFns.max([start, dateFns.subDays(startLimit, 1)]), dateFns.min([end, dateFns.addDays(endLimit, 1)]));
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
return buildDayStateForDateRange(statePerMonth, start, end);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
var setDayStateValue = function (state, date, values) {
|
|
140
|
-
var _a, _b, _c;
|
|
141
|
-
var monthString = dateFns.format(date, DateFormats.yearAndMonth);
|
|
142
|
-
var weekNumber = dateFns.getISOWeek(date);
|
|
143
|
-
var dayInMonth = dateFns.getDate(date);
|
|
144
|
-
return __assign(__assign({}, state), (_a = {}, _a[monthString] = __assign(__assign({}, (state && state[monthString])), (_b = {}, _b[weekNumber] = __assign(__assign({}, (state && state[monthString] && state[monthString][weekNumber])), (_c = {}, _c[dayInMonth] = __assign(__assign({}, (state &&
|
|
145
|
-
state[monthString] &&
|
|
146
|
-
state[monthString][weekNumber] &&
|
|
147
|
-
state[monthString][weekNumber][dayInMonth])), values), _c)), _b)), _a));
|
|
148
|
-
};
|
|
149
|
-
var setDayStateValueFunction = function (state, date, setter) {
|
|
150
|
-
var _a, _b, _c;
|
|
151
|
-
var monthString = dateFns.format(date, DateFormats.yearAndMonth);
|
|
152
|
-
var weekNumber = dateFns.getISOWeek(date);
|
|
153
|
-
var dayInMonth = dateFns.getDate(date);
|
|
154
|
-
return __assign(__assign({}, state), (_a = {}, _a[monthString] = __assign(__assign({}, (state && state[monthString])), (_b = {}, _b[weekNumber] = __assign(__assign({}, (state && state[monthString] && state[monthString][weekNumber])), (_c = {}, _c[dayInMonth] = __assign(__assign({}, (state &&
|
|
155
|
-
state[monthString] &&
|
|
156
|
-
state[monthString][weekNumber] &&
|
|
157
|
-
state[monthString][weekNumber][dayInMonth])), setter(state &&
|
|
158
|
-
state[monthString] &&
|
|
159
|
-
state[monthString][weekNumber] &&
|
|
160
|
-
state[monthString][weekNumber][dayInMonth])), _c)), _b)), _a));
|
|
161
|
-
};
|
|
162
|
-
var addDayStateHighlights = function (calendarState, date, highlights) {
|
|
163
|
-
var _a, _b, _c;
|
|
164
|
-
var month = date.getMonth() + 1;
|
|
165
|
-
var monthString = "".concat(date.getFullYear(), "-").concat(month < 10 ? "0" : "").concat(month);
|
|
166
|
-
var weekNumber = dateFns.getISOWeek(date);
|
|
167
|
-
var dayInMonth = dateFns.getDate(date);
|
|
168
|
-
var dayState = calendarState &&
|
|
169
|
-
calendarState[monthString] &&
|
|
170
|
-
calendarState[monthString][weekNumber] &&
|
|
171
|
-
calendarState[monthString][weekNumber][dayInMonth];
|
|
172
|
-
return __assign(__assign({}, calendarState), (_a = {}, _a[monthString] = __assign(__assign({}, (calendarState && calendarState[monthString])), (_b = {}, _b[weekNumber] = __assign(__assign({}, (calendarState &&
|
|
173
|
-
calendarState[monthString] &&
|
|
174
|
-
calendarState[monthString][weekNumber])), (_c = {}, _c[dayInMonth] = addDayStateHighlightsOnSingleDay(dayState, highlights), _c)), _b)), _a));
|
|
175
|
-
};
|
|
176
|
-
var addDayStateHighlightsOnSingleDay = function (dayState, highlights) {
|
|
177
|
-
var _a;
|
|
178
|
-
return __assign(__assign({}, dayState), { highlights: __spreadArray(__spreadArray([], ((_a = dayState === null || dayState === void 0 ? void 0 : dayState.highlights) !== null && _a !== void 0 ? _a : []), true), highlights, true) });
|
|
179
|
-
};
|
|
180
|
-
var addWeekStateHighlights = function (calendarState, week, highlights) {
|
|
181
|
-
var _a, _b;
|
|
182
|
-
var date = week.days[0].date;
|
|
183
|
-
var month = date.getMonth() + 1;
|
|
184
|
-
var monthString = "".concat(date.getFullYear(), "-").concat(month < 10 ? "0" : "").concat(month);
|
|
185
|
-
var weekNumber = week.weekNumber;
|
|
186
|
-
var state = calendarState;
|
|
187
|
-
week.days.forEach(function (day) {
|
|
188
|
-
state = addDayStateHighlights(state, day.date, highlights);
|
|
189
|
-
});
|
|
190
|
-
var weekState = state && state[monthString] ? state[monthString][weekNumber] : undefined;
|
|
191
|
-
var newHighlights = weekState && weekState.highlights
|
|
192
|
-
? __spreadArray(__spreadArray([], weekState.highlights, true), highlights, true) : highlights;
|
|
193
|
-
var newWeekState = __assign(__assign({}, weekState), { highlights: newHighlights });
|
|
194
|
-
return __assign(__assign({}, state), (_a = {}, _a[monthString] = __assign(__assign({}, (calendarState && calendarState[monthString])), (_b = {}, _b[weekNumber] = newWeekState, _b)), _a));
|
|
195
|
-
};
|
|
196
|
-
var addWeekRangeHighlights = function (calendarState, week) {
|
|
197
|
-
var _a;
|
|
198
|
-
if (!week.days.length) {
|
|
199
|
-
return __assign({}, calendarState);
|
|
200
|
-
}
|
|
201
|
-
var startDate = week.days[0].date;
|
|
202
|
-
var endDate = (_a = lodash.last(week.days)) === null || _a === void 0 ? void 0 : _a.date;
|
|
203
|
-
return __assign({}, buildDayStateForDateRange(calendarState, startDate, endDate));
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
var useHighlightToday = function (enabled, statePerMonth) {
|
|
207
|
-
return React.useMemo(function () {
|
|
208
|
-
return enabled
|
|
209
|
-
? addDayStateHighlights(statePerMonth, new Date(), ["today"])
|
|
210
|
-
: statePerMonth;
|
|
211
|
-
}, [enabled, statePerMonth]);
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
exports.Month = void 0;
|
|
215
|
-
(function (Month) {
|
|
216
|
-
Month[Month["JANUARY"] = 0] = "JANUARY";
|
|
217
|
-
Month[Month["FEBRUARY"] = 1] = "FEBRUARY";
|
|
218
|
-
Month[Month["MARCH"] = 2] = "MARCH";
|
|
219
|
-
Month[Month["APRIL"] = 3] = "APRIL";
|
|
220
|
-
Month[Month["MAY"] = 4] = "MAY";
|
|
221
|
-
Month[Month["JUNE"] = 5] = "JUNE";
|
|
222
|
-
Month[Month["JULY"] = 6] = "JULY";
|
|
223
|
-
Month[Month["AUGUST"] = 7] = "AUGUST";
|
|
224
|
-
Month[Month["SEPTEMBER"] = 8] = "SEPTEMBER";
|
|
225
|
-
Month[Month["OCTOBER"] = 9] = "OCTOBER";
|
|
226
|
-
Month[Month["NOVEMBER"] = 10] = "NOVEMBER";
|
|
227
|
-
Month[Month["DECEMBER"] = 11] = "DECEMBER";
|
|
228
|
-
})(exports.Month || (exports.Month = {}));
|
|
229
|
-
exports.WeekDay = void 0;
|
|
230
|
-
(function (WeekDay) {
|
|
231
|
-
WeekDay[WeekDay["SUNDAY"] = 0] = "SUNDAY";
|
|
232
|
-
WeekDay[WeekDay["MONDAY"] = 1] = "MONDAY";
|
|
233
|
-
WeekDay[WeekDay["TUESDAY"] = 2] = "TUESDAY";
|
|
234
|
-
WeekDay[WeekDay["WEDNESDAY"] = 3] = "WEDNESDAY";
|
|
235
|
-
WeekDay[WeekDay["THURSDAY"] = 4] = "THURSDAY";
|
|
236
|
-
WeekDay[WeekDay["FRIDAY"] = 5] = "FRIDAY";
|
|
237
|
-
WeekDay[WeekDay["SATURDAY"] = 6] = "SATURDAY";
|
|
238
|
-
})(exports.WeekDay || (exports.WeekDay = {}));
|
|
239
|
-
var getMonthsInYear = function (year, startMonth, numMonths) {
|
|
240
|
-
var months = [];
|
|
241
|
-
for (var i = 0; i < numMonths; i++) {
|
|
242
|
-
months.push(getMonthInYear(year, startMonth + i));
|
|
243
|
-
}
|
|
244
|
-
return months;
|
|
245
|
-
};
|
|
246
|
-
var getMonthInYear = function (year, month) {
|
|
247
|
-
var yearToUse = year + Math.floor(month / 12);
|
|
248
|
-
var monthToUse = month % 12;
|
|
249
|
-
var firstDayOfMonth = new Date(yearToUse, monthToUse, 1);
|
|
250
|
-
return {
|
|
251
|
-
monthString: dateFns.format(firstDayOfMonth, DateFormats.yearAndMonth),
|
|
252
|
-
name: dateFns.format(firstDayOfMonth, DateFormats.fullMonthName),
|
|
253
|
-
year: yearToUse,
|
|
254
|
-
monthInYear: monthToUse,
|
|
255
|
-
weeks: getWeeksForMonth(yearToUse, monthToUse),
|
|
256
|
-
};
|
|
257
|
-
};
|
|
258
|
-
var getWeeksForMonth = function (year, month, forceSixWeeks) {
|
|
259
|
-
if (forceSixWeeks === void 0) { forceSixWeeks = true; }
|
|
260
|
-
var firstDayOfMonth = new Date(year, month, 1);
|
|
261
|
-
var firstDayOfFirstWeek = dateFns.startOfISOWeek(firstDayOfMonth);
|
|
262
|
-
var weeks = [];
|
|
263
|
-
for (var i = 0; i < 6; i++) {
|
|
264
|
-
var week = getWeekForDate(dateFns.addWeeks(firstDayOfFirstWeek, i));
|
|
265
|
-
if (i > 0 && week.startMonth !== month && !forceSixWeeks) {
|
|
266
|
-
return weeks;
|
|
267
|
-
}
|
|
268
|
-
weeks.push(week);
|
|
269
|
-
}
|
|
270
|
-
return weeks;
|
|
271
|
-
};
|
|
272
|
-
var getWeekForDate = function (firstDayOfWeek) {
|
|
273
|
-
var isLastWeekOfMonth = dateFns.getMonth(dateFns.addDays(firstDayOfWeek, 7)) !== dateFns.getMonth(firstDayOfWeek);
|
|
274
|
-
return {
|
|
275
|
-
weekNumber: dateFns.getISOWeek(firstDayOfWeek),
|
|
276
|
-
startMonth: dateFns.getMonth(firstDayOfWeek),
|
|
277
|
-
startYear: dateFns.getYear(firstDayOfWeek),
|
|
278
|
-
endMonth: dateFns.getMonth(dateFns.addDays(firstDayOfWeek, 6)),
|
|
279
|
-
endYear: dateFns.getYear(dateFns.addDays(firstDayOfWeek, 6)),
|
|
280
|
-
days: getDaysForWeekForDate(firstDayOfWeek),
|
|
281
|
-
isLastWeekOfMonth: isLastWeekOfMonth,
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
var createDay = function (date) {
|
|
285
|
-
var dayOfWeek = dateFns.getISODay(date);
|
|
286
|
-
return {
|
|
287
|
-
date: date,
|
|
288
|
-
name: dateFns.format(date, "EEE"),
|
|
289
|
-
dateString: dateFns.format(dateFns.addHours(date, 12), DateFormats.fullDate),
|
|
290
|
-
weekNumber: dateFns.getISOWeek(date),
|
|
291
|
-
year: dateFns.getYear(date),
|
|
292
|
-
month: dateFns.getMonth(date),
|
|
293
|
-
dayOfMonth: dateFns.getDate(date),
|
|
294
|
-
dayOfWeek: dayOfWeek,
|
|
295
|
-
isFirstDayOfWeek: dayOfWeek === 1,
|
|
296
|
-
isLastDayOfWeek: dayOfWeek === 7,
|
|
297
|
-
isFirstDayOfMonth: dateFns.isSameDay(dateFns.startOfMonth(date), date),
|
|
298
|
-
isLastDayOfMonth: dateFns.isSameDay(dateFns.endOfMonth(date), date),
|
|
299
|
-
};
|
|
300
|
-
};
|
|
301
|
-
var getDaysForWeekForDate = function (firstDayOfWeek) {
|
|
302
|
-
return dateFns.eachDayOfInterval({
|
|
303
|
-
start: firstDayOfWeek,
|
|
304
|
-
end: dateFns.addDays(firstDayOfWeek, 6),
|
|
305
|
-
}).map(createDay);
|
|
306
|
-
};
|
|
307
|
-
var getStartDateOfISOWeek = function (weekNumber, year) {
|
|
308
|
-
var simple = new Date(year, 0, 1 + (weekNumber - 1) * 7);
|
|
309
|
-
var dayOfWeek = simple.getDay();
|
|
310
|
-
var isoWeekStart = simple;
|
|
311
|
-
if (dayOfWeek <= 4) {
|
|
312
|
-
isoWeekStart.setDate(simple.getDate() - simple.getDay() + 1);
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
isoWeekStart.setDate(simple.getDate() + 8 - simple.getDay());
|
|
316
|
-
}
|
|
317
|
-
return isoWeekStart;
|
|
318
|
-
};
|
|
319
|
-
var calculateOverflowingMonth = function (year, month) {
|
|
320
|
-
if (month > exports.Month.DECEMBER) {
|
|
321
|
-
return { year: year + Math.floor(month / 12), month: month % 12 };
|
|
322
|
-
}
|
|
323
|
-
if (month < exports.Month.JANUARY) {
|
|
324
|
-
return { year: year + Math.floor(month / 12), month: 12 + (month % 12) };
|
|
325
|
-
}
|
|
326
|
-
return { year: year, month: month };
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
var dayHasHighlight = function (dayState, defaultHighlights, highlight) {
|
|
330
|
-
if (defaultHighlights && defaultHighlights.indexOf(highlight) >= 0) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
if (dayState &&
|
|
334
|
-
dayState.highlights &&
|
|
335
|
-
dayState.highlights.indexOf(highlight) >= 0) {
|
|
336
|
-
return true;
|
|
337
|
-
}
|
|
338
|
-
return false;
|
|
339
|
-
};
|
|
340
|
-
var dayHighlightSelect = function (dayState, defaultHighlights, highlightsOrBoolean, returnValues, fallbackValue) {
|
|
341
|
-
if (highlightsOrBoolean.length !== returnValues.length) {
|
|
342
|
-
throw new Error("Select highlight failed, number of values do not equal number of highlights.");
|
|
343
|
-
}
|
|
344
|
-
if (highlightsOrBoolean.length === 0) {
|
|
345
|
-
return fallbackValue;
|
|
346
|
-
}
|
|
347
|
-
for (var i = 0; i < highlightsOrBoolean.length; i++) {
|
|
348
|
-
if (typeof highlightsOrBoolean[i] === "boolean" && highlightsOrBoolean[i]) {
|
|
349
|
-
return returnValues[i];
|
|
350
|
-
}
|
|
351
|
-
if (typeof highlightsOrBoolean[i] === "string" &&
|
|
352
|
-
dayHasHighlight(dayState, defaultHighlights, highlightsOrBoolean[i])) {
|
|
353
|
-
return returnValues[i];
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
return fallbackValue;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
var defaultWrapperStyleProvider = function (_a) {
|
|
360
|
-
var selectedBackground = _a.selectedBackground, todayBackground = _a.todayBackground, rangeBackground = _a.rangeBackground, _b = _a.borderColor, borderColor = _b === void 0 ? "transparent" : _b;
|
|
361
|
-
return function (defaultHighlights, dayState, day, _, month) {
|
|
362
|
-
var style = {};
|
|
363
|
-
var backgroundColor = dayHighlightSelect(dayState, defaultHighlights, ["selected", "range", "today", day.month === month.monthInYear], [selectedBackground, rangeBackground, todayBackground, "#fff"], "transparent");
|
|
364
|
-
return __assign(__assign({}, style), { backgroundColor: backgroundColor, borderTopLeftRadius: dayHighlightSelect(dayState, defaultHighlights, ["selectedStart", "singleSelected"], [
|
|
365
|
-
"var(--swui-calendar-day-border-radius)",
|
|
366
|
-
"var(--swui-calendar-day-border-radius)",
|
|
367
|
-
], borderColor), borderBottomLeftRadius: dayHighlightSelect(dayState, defaultHighlights, ["selectedStart", "singleSelected"], [
|
|
368
|
-
"var(--swui-calendar-day-border-radius)",
|
|
369
|
-
"var(--swui-calendar-day-border-radius)",
|
|
370
|
-
], borderColor), borderTopRightRadius: dayHighlightSelect(dayState, defaultHighlights, ["selectedEnd", "singleSelected"], [
|
|
371
|
-
"var(--swui-calendar-day-border-radius)",
|
|
372
|
-
"var(--swui-calendar-day-border-radius)",
|
|
373
|
-
], borderColor), borderBottomRightRadius: dayHighlightSelect(dayState, defaultHighlights, ["selectedEnd", "singleSelected"], [
|
|
374
|
-
"var(--swui-calendar-day-border-radius)",
|
|
375
|
-
"var(--swui-calendar-day-border-radius)",
|
|
376
|
-
], borderColor), boxSizing: "border-box" });
|
|
377
|
-
};
|
|
378
|
-
};
|
|
379
|
-
var defaultTextPropsProvider = function (_a) {
|
|
380
|
-
var selectedColor = _a.selectedColor, disabledColor = _a.disabledColor, inOtherMonthColor = _a.inOtherMonthColor, rangeTextColor = _a.rangeTextColor;
|
|
381
|
-
return function (defaultHighlights, dayState, day, _, month) {
|
|
382
|
-
var isOtherMonth = day.month !== month.monthInYear;
|
|
383
|
-
var color = dayHighlightSelect(dayState, defaultHighlights, [isOtherMonth, "selected", "range", "enabled", "disabled"], [
|
|
384
|
-
inOtherMonthColor,
|
|
385
|
-
selectedColor,
|
|
386
|
-
rangeTextColor,
|
|
387
|
-
undefined,
|
|
388
|
-
disabledColor,
|
|
389
|
-
]);
|
|
390
|
-
return {
|
|
391
|
-
color: color,
|
|
392
|
-
};
|
|
393
|
-
};
|
|
394
|
-
};
|
|
395
|
-
var defaultCalendarTheme = {
|
|
396
|
-
width: "var(--swui-calendar-day-width)",
|
|
397
|
-
height: "var(--swui-calendar-day-height)",
|
|
398
|
-
WeekNumber: {
|
|
399
|
-
backgroundColor: "var(--swui-calendar-week-number-bg-color)",
|
|
400
|
-
textColor: "var(--swui-calendar-week-number-text-color)",
|
|
401
|
-
clickableTextColor: "var(--swui-calendar-week-number-clickable-text-color)",
|
|
402
|
-
show: true,
|
|
403
|
-
},
|
|
404
|
-
WeekDay: {
|
|
405
|
-
textColor: "var(--swui-calendar-week-day-text-color)",
|
|
406
|
-
clickableTextColor: "var(--swui-calendar-week-day-clickable-text-color)",
|
|
407
|
-
},
|
|
408
|
-
CalendarDay: {
|
|
409
|
-
tdStyle: defaultWrapperStyleProvider({
|
|
410
|
-
selectedBackground: "var(--swui-calendar-wrapper-selected-background)",
|
|
411
|
-
rangeBackground: "var(--swui-calendar-wrapper-range-background)",
|
|
412
|
-
todayBackground: "var(--swui-calendar-wrapper-today-background)",
|
|
413
|
-
}),
|
|
414
|
-
textProps: defaultTextPropsProvider({
|
|
415
|
-
selectedColor: "var(--swui-calendar-text-selected-color)",
|
|
416
|
-
disabledColor: "var(--swui-calendar-text-disabled-color)",
|
|
417
|
-
inOtherMonthColor: "var(--swui-calendar-text-in-other-month-color)",
|
|
418
|
-
}),
|
|
419
|
-
},
|
|
420
|
-
CalendarMonth: {
|
|
421
|
-
headerTextColor: "var(--swui-calendar-week-day-text-color)",
|
|
422
|
-
},
|
|
423
|
-
};
|
|
424
|
-
var extranetCalendarTheme = __assign(__assign({}, defaultCalendarTheme), { width: "37px", height: "37px" });
|
|
425
|
-
|
|
426
|
-
var isDateInMinMaxRange = function (date, min, max) {
|
|
427
|
-
if (min && dateFns.isBefore(date, min)) {
|
|
428
|
-
return dateFns.isSameDay(date, min);
|
|
429
|
-
}
|
|
430
|
-
if (max && dateFns.isAfter(date, max)) {
|
|
431
|
-
return dateFns.isSameDay(date, max);
|
|
432
|
-
}
|
|
433
|
-
return true;
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
var DisabledDayWrapper = function DisabledDayWrapper(_a) {
|
|
437
|
-
var DayComponent = _a.dayComponent, minDate = _a.minDate, maxDate = _a.maxDate, dayState = _a.dayState, day = _a.day, props = __rest(_a, ["dayComponent", "minDate", "maxDate", "dayState", "day"]);
|
|
438
|
-
var activeDayState = React.useMemo(function () {
|
|
439
|
-
return !isDateInMinMaxRange(day.date, minDate, maxDate)
|
|
440
|
-
? addDayStateHighlightsOnSingleDay(dayState, ["disabled"])
|
|
441
|
-
: dayState;
|
|
442
|
-
}, [day.date, dayState, maxDate, minDate]);
|
|
443
|
-
return React__namespace.createElement(DayComponent, __assign({ day: day }, props, { dayState: activeDayState }));
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
var WeekNumberCell = function (_a) {
|
|
447
|
-
var onClickWeek = _a.onClickWeek, theme = _a.theme, week = _a.week, background = _a.background, backgroundColor = _a.backgroundColor, prefix = _a.prefix;
|
|
448
|
-
var content = (React__namespace.createElement(core.Box, { width: theme.width, height: theme.height, justifyContent: "center", alignItems: "center" },
|
|
449
|
-
background && React__namespace.createElement(core.Box, { position: "absolute" }, background),
|
|
450
|
-
React__namespace.createElement(core.Box, { position: "absolute" },
|
|
451
|
-
React__namespace.createElement(core.Text, { color: onClickWeek
|
|
452
|
-
? theme.WeekNumber.clickableTextColor
|
|
453
|
-
: theme.WeekNumber.textColor },
|
|
454
|
-
prefix,
|
|
455
|
-
week.weekNumber))));
|
|
456
|
-
return (React__namespace.createElement(core.Box, { background: backgroundColor || theme.WeekNumber.backgroundColor, position: "relative" }, onClickWeek ? (React__namespace.createElement(core.Clickable, { borderRadius: "var(--swui-calendar-day-border-radius)", onClick: function (ev) { return onClickWeek(week, ev); }, disableFocusHighlight: !onClickWeek }, content)) : (content)));
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
function CalendarWeek(_a) {
|
|
460
|
-
var week = _a.week, month = _a.month, dayComponent = _a.dayComponent, statePerWeekDay = _a.statePerWeekDay, userDataPerWeekDay = _a.userDataPerWeekDay, minDate = _a.minDate, maxDate = _a.maxDate, onClickWeek = _a.onClickWeek, onClickDay = _a.onClickDay, theme = _a.theme, renderWeekNumber = _a.renderWeekNumber, extraDayContent = _a.extraDayContent, defaultHighlights = _a.defaultHighlights;
|
|
461
|
-
return (React__namespace.createElement("tr", { key: week.weekNumber },
|
|
462
|
-
theme.WeekNumber.show && (React__namespace.createElement("td", null, renderWeekNumber ? (renderWeekNumber(week, theme, onClickWeek)) : (React__namespace.createElement(WeekNumberCell, { week: week, onClickWeek: onClickWeek, theme: theme })))),
|
|
463
|
-
week.days.map(function (day) { return (React__namespace.createElement(DisabledDayWrapper, { dayComponent: dayComponent, key: day.dateString, day: day, week: week, month: month, dayState: statePerWeekDay && statePerWeekDay[day.dayOfMonth], userData: userDataPerWeekDay && userDataPerWeekDay[day.dayOfMonth], onClickDay: onClickDay, theme: theme, extraDayContent: extraDayContent, defaultHighlights: defaultHighlights, minDate: minDate, maxDate: maxDate })); })));
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
var WeekDayCell = function (_a) {
|
|
467
|
-
var onClickWeekDay = _a.onClickWeekDay, day = _a.day, theme = _a.theme;
|
|
468
|
-
var content = (React__namespace.createElement(core.Box, { width: theme.width, height: theme.height, justifyContent: "center", alignItems: "center" },
|
|
469
|
-
React__namespace.createElement(core.Text, { size: "small", color: onClickWeekDay
|
|
470
|
-
? theme.WeekDay.clickableTextColor
|
|
471
|
-
: theme.WeekDay.textColor }, day.name)));
|
|
472
|
-
if (onClickWeekDay) {
|
|
473
|
-
return (React__namespace.createElement(core.Clickable, { borderRadius: "var(--swui-calendar-day-border-radius)", onClick: function (ev) { return onClickWeekDay(day.dayOfWeek, ev); }, disableFocusHighlight: !onClickWeekDay }, content));
|
|
474
|
-
}
|
|
475
|
-
return content;
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
var CalendarDay = function CalendarDay(_a) {
|
|
479
|
-
var day = _a.day, week = _a.week, month = _a.month, dayState = _a.dayState, userData = _a.userData, onClickDay = _a.onClickDay, theme = _a.theme, ExtraDayContent = _a.extraDayContent, defaultHighlights = _a.defaultHighlights;
|
|
480
|
-
var content = (React__namespace.createElement(core.Box, { width: "100%", height: "100%", justifyContent: "center", alignItems: "center" },
|
|
481
|
-
React__namespace.createElement(core.Text, __assign({}, (theme.CalendarDay.textProps &&
|
|
482
|
-
theme.CalendarDay.textProps(defaultHighlights, dayState, day, week, month, userData))), day.dayOfMonth)));
|
|
483
|
-
var WrapperTd = styled__default["default"].td(__assign({}, (theme.CalendarDay.tdStyle &&
|
|
484
|
-
theme.CalendarDay.tdStyle(defaultHighlights, dayState, day, week, month, userData))));
|
|
485
|
-
var InnerWrapperDiv = styled__default["default"].div(__assign(__assign({}, (theme.CalendarDay.innerWrapperStyle &&
|
|
486
|
-
theme.CalendarDay.innerWrapperStyle(defaultHighlights, dayState, day, week, month, userData))), { width: "100%", height: "100%" }));
|
|
487
|
-
var CellWrapperDiv = styled__default["default"].div(__assign(__assign({}, (theme.CalendarDay.cellWrapperStyle &&
|
|
488
|
-
theme.CalendarDay.cellWrapperStyle(defaultHighlights, dayState, day, week, month, userData))), { width: "100%", height: "100%", position: "relative" }));
|
|
489
|
-
return (React__namespace.createElement(WrapperTd, null,
|
|
490
|
-
React__namespace.createElement(InnerWrapperDiv, null,
|
|
491
|
-
React__namespace.createElement(CellWrapperDiv, null, day.month === month.monthInYear && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
492
|
-
ExtraDayContent && (React__namespace.createElement(ExtraDayContent, { week: week, month: month, day: day, dayState: dayState, theme: theme, userData: userData })),
|
|
493
|
-
onClickDay && isClickable(defaultHighlights, dayState) ? (React__namespace.createElement(core.Clickable, { onClick: function (ev) { return onClickDay(day, userData, ev); }, style: { width: "100%", height: "100%" }, borderRadius: "var(--swui-calendar-day-border-radius)" }, content)) : (React__namespace.createElement(React__namespace.Fragment, null, content))))))));
|
|
494
|
-
};
|
|
495
|
-
var isClickable = function (defaultHighlights, dayState) {
|
|
496
|
-
return !!dayHighlightSelect(dayState, defaultHighlights, ["enabled", "disabled"], [true, false], true);
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
function CalendarMonth(_a) {
|
|
500
|
-
var month = _a.month, _b = _a.dayComponent, dayComponent = _b === void 0 ? CalendarDay : _b, statePerWeek = _a.statePerWeek, userDataPerWeek = _a.userDataPerWeek, minDate = _a.minDate, maxDate = _a.maxDate, onClickDay = _a.onClickDay, onClickWeek = _a.onClickWeek, onClickWeekDay = _a.onClickWeekDay, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear, renderWeekNumber = _a.renderWeekNumber, renderWeekDay = _a.renderWeekDay, headerLeftContent = _a.headerLeftContent, headerRightContent = _a.headerRightContent, _c = _a.theme, theme = _c === void 0 ? defaultCalendarTheme : _c, extraDayContent = _a.extraDayContent, defaultHighlights = _a.defaultHighlights;
|
|
501
|
-
var showWeekNumber = theme.WeekNumber.show;
|
|
502
|
-
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
503
|
-
React__namespace.createElement(core.Box, { alignItems: "stretch" },
|
|
504
|
-
React__namespace.createElement(core.Row, { justifyContent: "space-between", alignItems: "center", height: "32px" },
|
|
505
|
-
React__namespace.createElement(core.Box, { alignItems: "center" }, headerLeftContent),
|
|
506
|
-
React__namespace.createElement(core.Row, { alignItems: "center" },
|
|
507
|
-
React__namespace.createElement(core.Row, { width: "104px", justifyContent: "center" }, onClickMonth ? (React__namespace.createElement(elements.FlatButton, { onClick: function () { return onClickMonth(month); }, label: month.name })) : (React__namespace.createElement(core.Text, null, month.name))),
|
|
508
|
-
React__namespace.createElement(core.Space, null),
|
|
509
|
-
React__namespace.createElement(core.Row, { width: "64px", justifyContent: "center" }, onClickYear ? (React__namespace.createElement(elements.FlatButton, { onClick: function () { return onClickYear(month.year); }, label: String(month.year) })) : (React__namespace.createElement(core.Text, null, month.year)))),
|
|
510
|
-
React__namespace.createElement(core.Box, { alignItems: "center" }, headerRightContent)),
|
|
511
|
-
React__namespace.createElement("table", null,
|
|
512
|
-
React__namespace.createElement("tbody", null,
|
|
513
|
-
React__namespace.createElement("tr", null,
|
|
514
|
-
showWeekNumber && (React__namespace.createElement("td", null,
|
|
515
|
-
React__namespace.createElement(core.Box, { width: theme.width, height: theme.height, justifyContent: "center", alignItems: "center" },
|
|
516
|
-
React__namespace.createElement(core.Text, { size: "small", color: theme.CalendarMonth.headerTextColor }, "W")))),
|
|
517
|
-
month.weeks[0].days.map(function (day) { return (React__namespace.createElement("td", { key: day.name }, renderWeekDay ? (renderWeekDay(day.name, theme, onClickWeekDay)) : (React__namespace.createElement(WeekDayCell, { day: day, onClickWeekDay: onClickWeekDay, theme: theme })))); })),
|
|
518
|
-
month.weeks.map(function (week) { return (React__namespace.createElement(CalendarWeek, { key: week.weekNumber, month: month, week: week, dayComponent: dayComponent, statePerWeekDay: statePerWeek && statePerWeek[week.weekNumber], userDataPerWeekDay: userDataPerWeek && userDataPerWeek[week.weekNumber], onClickDay: onClickDay, onClickWeek: onClickWeek, theme: theme, renderWeekNumber: renderWeekNumber, extraDayContent: extraDayContent, defaultHighlights: defaultHighlights, minDate: minDate, maxDate: maxDate })); }))))));
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function styleInject(css, ref) {
|
|
522
|
-
if ( ref === void 0 ) ref = {};
|
|
523
|
-
var insertAt = ref.insertAt;
|
|
524
|
-
|
|
525
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
526
|
-
|
|
527
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
528
|
-
var style = document.createElement('style');
|
|
529
|
-
style.type = 'text/css';
|
|
530
|
-
|
|
531
|
-
if (insertAt === 'top') {
|
|
532
|
-
if (head.firstChild) {
|
|
533
|
-
head.insertBefore(style, head.firstChild);
|
|
534
|
-
} else {
|
|
535
|
-
head.appendChild(style);
|
|
536
|
-
}
|
|
537
|
-
} else {
|
|
538
|
-
head.appendChild(style);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if (style.styleSheet) {
|
|
542
|
-
style.styleSheet.cssText = css;
|
|
543
|
-
} else {
|
|
544
|
-
style.appendChild(document.createTextNode(css));
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
var css_248z$1 = ".Calendar-module_calendar__Ztvgm {\n --swui-calendar-day-width: 40px;\n --swui-calendar-day-height: 38px;\n --swui-calendar-day-border-radius: 4px;\n\n /* Week number */\n\n --swui-calendar-week-number-bg-color: transparent;\n --swui-calendar-week-number-text-color: var(--lhds-color-ui-500);\n --swui-calendar-week-number-clickable-text-color: var(--lhds-color-ui-500);\n\n /* Week day */\n\n --swui-calendar-week-day-text-color: var(--lhds-color-ui-500);\n --swui-calendar-week-day-clickable-text-color: var(--lhds-color-ui-500);\n\n /* Wrapper */\n\n --swui-calendar-wrapper-selected-border: var(--swui-primary-action-color);\n --swui-calendar-wrapper-selected-background: var(--swui-primary-action-color);\n --swui-calendar-wrapper-range-border: var(--lhds-color-blue-100);\n --swui-calendar-wrapper-range-background: var(--lhds-color-blue-100);\n --swui-calendar-wrapper-today-border: var(--lhds-color-ui-200);\n --swui-calendar-wrapper-today-background: var(--lhds-color-ui-200);\n\n /* Text */\n\n --swui-calendar-text-selected-color: #fff;\n --swui-calendar-text-disabled-color: var(--swui-text-disabled-color);\n --swui-calendar-text-in-other-month-color: var(--swui-text-disabled-color);\n}\n\n .Calendar-module_calendar__Ztvgm table {\n border-spacing: 0 4px;\n }\n\n .Calendar-module_calendar__Ztvgm span {\n line-height: 100%;\n }\n\n .Calendar-module_calendar__Ztvgm tr td:last-child {\n border-top-right-radius: var(--swui-calendar-day-border-radius);\n border-bottom-right-radius: var(--swui-calendar-day-border-radius);\n }\n\n .Calendar-module_calendar__Ztvgm tr td:nth-child(2) {\n border-top-left-radius: var(--swui-calendar-day-border-radius);\n border-bottom-left-radius: var(--swui-calendar-day-border-radius);\n }\n\n .Calendar-module_calendar__Ztvgm td {\n padding: 0;\n width: var(--swui-calendar-day-width);\n height: var(--swui-calendar-day-height);\n }\n";
|
|
549
|
-
var styles$1 = {"calendar":"Calendar-module_calendar__Ztvgm"};
|
|
550
|
-
styleInject(css_248z$1);
|
|
551
|
-
|
|
552
|
-
function CalendarPanel(_a) {
|
|
553
|
-
var monthRows = _a.monthRows, _b = _a.dayComponent, dayComponent = _b === void 0 ? CalendarDay : _b, userDataPerMonth = _a.userDataPerMonth, statePerMonth = _a.statePerMonth, minDate = _a.minDate, maxDate = _a.maxDate, onClickDay = _a.onClickDay, onClickWeekDay = _a.onClickWeekDay, onClickWeek = _a.onClickWeek, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear, renderWeekDay = _a.renderWeekDay, renderWeekNumber = _a.renderWeekNumber, headerLeftContent = _a.headerLeftContent, headerRightContent = _a.headerRightContent, extraDayContent = _a.extraDayContent, defaultHighlights = _a.defaultHighlights, _c = _a.theme, theme = _c === void 0 ? defaultCalendarTheme : _c;
|
|
554
|
-
var minDateObj = React.useMemo(function () { return (minDate ? dateFns.parse(minDate, "yyyy-MM-dd", new Date()) : undefined); }, [minDate]);
|
|
555
|
-
var maxDateObj = React.useMemo(function () { return (maxDate ? dateFns.parse(maxDate, "yyyy-MM-dd", new Date()) : undefined); }, [maxDate]);
|
|
556
|
-
return (React__namespace.createElement("div", { className: styles$1.calendar }, monthRows.map(function (monthRow, rowIndex) { return (React__namespace.createElement(core.Spacing, { key: rowIndex },
|
|
557
|
-
React__namespace.createElement(core.Row, null, monthRow.map(function (month, index) { return (React__namespace.createElement(React__namespace.Fragment, { key: month.name },
|
|
558
|
-
index > 0 && React__namespace.createElement(core.Space, null),
|
|
559
|
-
React__namespace.createElement(CalendarMonth, { month: month, dayComponent: dayComponent, userDataPerWeek: userDataPerMonth && userDataPerMonth[month.monthString], statePerWeek: statePerMonth && statePerMonth[month.monthString], onClickDay: onClickDay, onClickWeekDay: onClickWeekDay, onClickWeek: onClickWeek, onClickMonth: onClickMonth, onClickYear: onClickYear, theme: theme, renderWeekNumber: renderWeekNumber, renderWeekDay: renderWeekDay, headerLeftContent: headerLeftContent, headerRightContent: headerRightContent, extraDayContent: extraDayContent, defaultHighlights: defaultHighlights, minDate: minDateObj, maxDate: maxDateObj }))); })))); })));
|
|
560
|
-
}
|
|
561
|
-
function Calendar(props) {
|
|
562
|
-
var initialDate = getInitialDate(props.year, props.month, props.date);
|
|
563
|
-
var _a = calculateOverflowingMonth(initialDate.year, initialDate.month), year = _a.year, month = _a.month;
|
|
564
|
-
var monthRows = getMonthRows(year, month, props.numMonths, props.monthsPerRow);
|
|
565
|
-
var statePerMonth = useHighlightToday(props.highlightToday, props.statePerMonth);
|
|
566
|
-
return (React__namespace.createElement(CalendarPanel, __assign({ year: year, month: month, monthRows: monthRows }, props, { statePerMonth: statePerMonth })));
|
|
567
|
-
}
|
|
568
|
-
var getInitialDate = function (year, month, date) {
|
|
569
|
-
if (month && year) {
|
|
570
|
-
return {
|
|
571
|
-
month: month,
|
|
572
|
-
year: year,
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
if (date) {
|
|
576
|
-
return {
|
|
577
|
-
month: dateFns.getMonth(date),
|
|
578
|
-
year: dateFns.getYear(date),
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
var now = new Date();
|
|
582
|
-
return {
|
|
583
|
-
month: dateFns.getMonth(now),
|
|
584
|
-
year: dateFns.getYear(now),
|
|
585
|
-
};
|
|
586
|
-
};
|
|
587
|
-
var getMonthRows = function (year, month, numMonths, monthsPerRow) {
|
|
588
|
-
if (numMonths == null) {
|
|
589
|
-
return [[getMonthInYear(year, month)]];
|
|
590
|
-
}
|
|
591
|
-
if (monthsPerRow == null) {
|
|
592
|
-
return [getMonthsInYear(year, month, numMonths)];
|
|
593
|
-
}
|
|
594
|
-
return lodash.chunk(getMonthsInYear(year, month, numMonths), monthsPerRow);
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
var useSelectedMonthStepperLogic = function (dateInFocus, setDateInFocus, monthsPerRow, numMonths) {
|
|
598
|
-
var nextMonth = React.useCallback(function () {
|
|
599
|
-
var _a;
|
|
600
|
-
var d = dateFns.addMonths(dateInFocus, (_a = monthsPerRow !== null && monthsPerRow !== void 0 ? monthsPerRow : numMonths) !== null && _a !== void 0 ? _a : 1);
|
|
601
|
-
setDateInFocus === null || setDateInFocus === void 0 ? void 0 : setDateInFocus(d);
|
|
602
|
-
}, [setDateInFocus, dateInFocus, monthsPerRow, numMonths]);
|
|
603
|
-
var nextYear = React.useCallback(function () {
|
|
604
|
-
var d = dateFns.addYears(dateInFocus, 1);
|
|
605
|
-
setDateInFocus === null || setDateInFocus === void 0 ? void 0 : setDateInFocus(d);
|
|
606
|
-
}, [setDateInFocus, dateInFocus]);
|
|
607
|
-
var prevMonth = React.useCallback(function () {
|
|
608
|
-
var _a;
|
|
609
|
-
var d = dateFns.subMonths(dateInFocus, (_a = monthsPerRow !== null && monthsPerRow !== void 0 ? monthsPerRow : numMonths) !== null && _a !== void 0 ? _a : 1);
|
|
610
|
-
setDateInFocus === null || setDateInFocus === void 0 ? void 0 : setDateInFocus(d);
|
|
611
|
-
}, [setDateInFocus, dateInFocus, monthsPerRow, numMonths]);
|
|
612
|
-
var prevYear = React.useCallback(function () {
|
|
613
|
-
var d = dateFns.subYears(dateInFocus, 1);
|
|
614
|
-
setDateInFocus === null || setDateInFocus === void 0 ? void 0 : setDateInFocus(d);
|
|
615
|
-
}, [setDateInFocus, dateInFocus]);
|
|
616
|
-
return {
|
|
617
|
-
nextMonth: nextMonth,
|
|
618
|
-
prevMonth: prevMonth,
|
|
619
|
-
nextYear: nextYear,
|
|
620
|
-
prevYear: prevYear,
|
|
621
|
-
};
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
var WithMonthSwitcherBelow = function (_a) {
|
|
625
|
-
var children = _a.children, prevMonth = _a.prevMonth, nextMonth = _a.nextMonth, prevYear = _a.prevYear, nextYear = _a.nextYear;
|
|
626
|
-
return (React__namespace.createElement("div", null,
|
|
627
|
-
children,
|
|
628
|
-
React__namespace.createElement(core.Indent, null,
|
|
629
|
-
React__namespace.createElement(core.Row, null,
|
|
630
|
-
React__namespace.createElement(elements.FlatButton, { onClick: prevYear, leftIcon: faAngleDoubleLeft.faAngleDoubleLeft }),
|
|
631
|
-
React__namespace.createElement(core.Space, null),
|
|
632
|
-
React__namespace.createElement(elements.FlatButton, { onClick: prevMonth, leftIcon: elements.stenaAngleLeft }),
|
|
633
|
-
React__namespace.createElement(core.Indent, { num: 2 }),
|
|
634
|
-
React__namespace.createElement(elements.FlatButton, { onClick: nextMonth, leftIcon: elements.stenaAngleRight }),
|
|
635
|
-
React__namespace.createElement(core.Space, null),
|
|
636
|
-
React__namespace.createElement(elements.FlatButton, { onClick: nextYear, leftIcon: faAngleDoubleRight.faAngleDoubleRight }))),
|
|
637
|
-
React__namespace.createElement(core.Space, null)));
|
|
638
|
-
};
|
|
639
|
-
|
|
640
|
-
var MonthPickerCell = function (_a) {
|
|
641
|
-
var value = _a.value, onValueChange = _a.onValueChange, month = _a.month;
|
|
642
|
-
var label = React.useMemo(function () {
|
|
643
|
-
var now = new Date(2000, month, 1);
|
|
644
|
-
return dateFns.format(now, "MMM");
|
|
645
|
-
}, [month]);
|
|
646
|
-
return (React__namespace.createElement(core.Row, { width: "64px", justifyContent: "center", spacing: 0.5, indent: 0.5 }, value === month ? (React__namespace.createElement(elements.PrimaryButton, { label: label, onClick: function () { return onValueChange && onValueChange(month); } })) : (React__namespace.createElement(elements.FlatButton, { label: label, onClick: function () { return onValueChange && onValueChange(month); } }))));
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
var monthMatrix = [
|
|
650
|
-
[exports.Month.JANUARY, exports.Month.FEBRUARY, exports.Month.MARCH],
|
|
651
|
-
[exports.Month.APRIL, exports.Month.MAY, exports.Month.JUNE],
|
|
652
|
-
[exports.Month.JULY, exports.Month.AUGUST, exports.Month.SEPTEMBER],
|
|
653
|
-
[exports.Month.OCTOBER, exports.Month.NOVEMBER, exports.Month.DECEMBER],
|
|
654
|
-
];
|
|
655
|
-
var MonthPicker = function (_a) {
|
|
656
|
-
var value = _a.value, onValueChange = _a.onValueChange;
|
|
657
|
-
return (React__namespace.createElement(core.Column, null, monthMatrix.map(function (monthRow) { return (React__namespace.createElement(core.Row, { key: monthRow[0] }, monthRow.map(function (month) { return (React__namespace.createElement(MonthPickerCell, { key: month, month: month, onValueChange: onValueChange, value: value })); }))); })));
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
var createStandardDateRangePresets = function (now) { return [
|
|
661
|
-
{
|
|
662
|
-
label: "Past",
|
|
663
|
-
presets: [
|
|
664
|
-
{ label: "Last 3 days", startDate: now, endDate: dateFns.subDays(now, 2) },
|
|
665
|
-
{ label: "Last 7 days", startDate: now, endDate: dateFns.subDays(now, 6) },
|
|
666
|
-
{ label: "Last 30 days", startDate: now, endDate: dateFns.subDays(now, 29) },
|
|
667
|
-
{ label: "Last 45 days", startDate: now, endDate: dateFns.subDays(now, 44) },
|
|
668
|
-
],
|
|
669
|
-
},
|
|
670
|
-
{
|
|
671
|
-
label: "Future",
|
|
672
|
-
presets: [
|
|
673
|
-
{ label: "Next 3 days", startDate: now, endDate: dateFns.addDays(now, 2) },
|
|
674
|
-
{ label: "Next 7 days", startDate: now, endDate: dateFns.addDays(now, 6) },
|
|
675
|
-
{ label: "Next 30 days", startDate: now, endDate: dateFns.addDays(now, 29) },
|
|
676
|
-
{ label: "Next 45 days", startDate: now, endDate: dateFns.addDays(now, 44) },
|
|
677
|
-
],
|
|
678
|
-
},
|
|
679
|
-
]; };
|
|
680
|
-
|
|
681
|
-
var PresetPicker = function (_a) {
|
|
682
|
-
var _b;
|
|
683
|
-
var onClickPreset = _a.onClickPreset;
|
|
684
|
-
var _c = React.useState(0), pageIndex = _c[0], setPageIndex = _c[1];
|
|
685
|
-
var pages = React.useMemo(function () { return createStandardDateRangePresets(new Date()); }, []);
|
|
686
|
-
var currentPage = (_b = pages[pageIndex]) !== null && _b !== void 0 ? _b : pages[0];
|
|
687
|
-
return (React__namespace.createElement(core.Column, null,
|
|
688
|
-
React__namespace.createElement(core.Row, { justifyContent: "space-between", alignItems: "center", width: "200px" },
|
|
689
|
-
React__namespace.createElement(elements.FlatButton, { size: "small", leftIcon: elements.stenaAngleLeft, disabled: pageIndex === 0, onClick: function () { return setPageIndex(pageIndex - 1); } }),
|
|
690
|
-
React__namespace.createElement(core.Text, null, currentPage.label),
|
|
691
|
-
React__namespace.createElement(elements.FlatButton, { size: "small", leftIcon: elements.stenaAngleRight, disabled: pageIndex === pages.length - 1, onClick: function () { return setPageIndex(pageIndex + 1); } })),
|
|
692
|
-
React__namespace.createElement(core.Space, null),
|
|
693
|
-
React__namespace.createElement(core.Column, { alignItems: "center" }, currentPage.presets.map(function (preset) { return (React__namespace.createElement(React__namespace.Fragment, { key: preset.label },
|
|
694
|
-
React__namespace.createElement(elements.PrimaryButton, { label: preset.label, onClick: function () { return onClickPreset(preset); } }),
|
|
695
|
-
React__namespace.createElement(core.Space, null))); }))));
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
var YearPickerCell = function (_a) {
|
|
699
|
-
var value = _a.value, onValueChange = _a.onValueChange, year = _a.year;
|
|
700
|
-
var label = String(year);
|
|
701
|
-
return (React__namespace.createElement(core.Row, { width: "64px", justifyContent: "center", spacing: 0.5, indent: 0.5 }, value === year ? (React__namespace.createElement(elements.PrimaryButton, { label: label, onClick: function () { return onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(year); } })) : (React__namespace.createElement(elements.FlatButton, { label: label, onClick: function () { return onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(year); } }))));
|
|
702
|
-
};
|
|
703
|
-
|
|
704
|
-
var YearPicker = function (_a) {
|
|
705
|
-
var value = _a.value, onValueChange = _a.onValueChange, initialLastYear = _a.initialLastYear;
|
|
706
|
-
var _b = React.useState(function () {
|
|
707
|
-
if (value) {
|
|
708
|
-
return value + 4;
|
|
709
|
-
}
|
|
710
|
-
return initialLastYear !== null && initialLastYear !== void 0 ? initialLastYear : new Date().getFullYear() + 4;
|
|
711
|
-
}), lastYear = _b[0], setLastYear = _b[1];
|
|
712
|
-
var yearRows = React.useMemo(function () {
|
|
713
|
-
var startYear = lastYear - 11;
|
|
714
|
-
return lodash.chunk(lodash.range(startYear, lastYear + 1), 3);
|
|
715
|
-
}, [lastYear]);
|
|
716
|
-
React.useEffect(function () {
|
|
717
|
-
setLastYear(function (prev) { return calculateLastYearInFocus(value, prev); });
|
|
718
|
-
}, [value]);
|
|
719
|
-
return (React__namespace.createElement(core.Row, null,
|
|
720
|
-
React__namespace.createElement(core.Column, { justifyContent: "center" },
|
|
721
|
-
React__namespace.createElement(elements.FlatButton, { leftIcon: faCaretLeft.faCaretLeft, onClick: function () { return setLastYear(lastYear - 3); } })),
|
|
722
|
-
React__namespace.createElement(core.Column, null, yearRows.map(function (yearRow) { return (React__namespace.createElement(core.Row, { key: yearRow[0] }, yearRow.map(function (year) { return (React__namespace.createElement(YearPickerCell, { key: year, year: year, onValueChange: onValueChange, value: value })); }))); })),
|
|
723
|
-
React__namespace.createElement(core.Column, { justifyContent: "center" },
|
|
724
|
-
React__namespace.createElement(elements.FlatButton, { leftIcon: faCaretRight.faCaretRight, onClick: function () { return setLastYear(lastYear + 3); } }))));
|
|
725
|
-
};
|
|
726
|
-
var calculateLastYearInFocus = function (value, lastYear) {
|
|
727
|
-
if (value == null) {
|
|
728
|
-
return lastYear;
|
|
729
|
-
}
|
|
730
|
-
if (value > lastYear) {
|
|
731
|
-
var yearDiff = value - lastYear;
|
|
732
|
-
var remaining = yearDiff % 3;
|
|
733
|
-
var yearsToAdd = yearDiff - remaining + 3;
|
|
734
|
-
return lastYear + yearsToAdd;
|
|
735
|
-
}
|
|
736
|
-
var startYear = lastYear - 11;
|
|
737
|
-
if (value < startYear) {
|
|
738
|
-
var yearDiff = startYear - value;
|
|
739
|
-
var remaining = yearDiff % 3;
|
|
740
|
-
var yearsToSubtract = yearDiff - remaining + 3;
|
|
741
|
-
return lastYear - yearsToSubtract;
|
|
742
|
-
}
|
|
743
|
-
return lastYear;
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
var CalendarWithMonthYearPickers = function CalendarWithMonthYearPickers(_a) {
|
|
747
|
-
var dateInFocus = _a.dateInFocus, setDateInFocus = _a.setDateInFocus, currentPanel = _a.currentPanel, setCurrentPanel = _a.setCurrentPanel, props = __rest(_a, ["dateInFocus", "setDateInFocus", "currentPanel", "setCurrentPanel"]);
|
|
748
|
-
var onChangeSelectedMonth = React.useCallback(function (selectedMonth) {
|
|
749
|
-
var newDate = dateInFocus ? new Date(dateInFocus) : new Date();
|
|
750
|
-
newDate.setMonth(selectedMonth);
|
|
751
|
-
if (setDateInFocus) {
|
|
752
|
-
setDateInFocus(newDate);
|
|
753
|
-
}
|
|
754
|
-
setCurrentPanel("calendar");
|
|
755
|
-
}, [dateInFocus, setDateInFocus, setCurrentPanel]);
|
|
756
|
-
var onChangeSelectedYear = React.useCallback(function (selectedYear) {
|
|
757
|
-
var newDate = dateInFocus ? new Date(dateInFocus) : new Date();
|
|
758
|
-
newDate.setFullYear(selectedYear);
|
|
759
|
-
if (setDateInFocus) {
|
|
760
|
-
setDateInFocus(newDate);
|
|
761
|
-
}
|
|
762
|
-
setCurrentPanel("calendar");
|
|
763
|
-
}, [dateInFocus, setDateInFocus, setCurrentPanel]);
|
|
764
|
-
var onClickYear = React.useCallback(function () {
|
|
765
|
-
setCurrentPanel("year");
|
|
766
|
-
}, [setCurrentPanel]);
|
|
767
|
-
var onClickMonth = React.useCallback(function () {
|
|
768
|
-
setCurrentPanel("month");
|
|
769
|
-
}, [setCurrentPanel]);
|
|
770
|
-
switch (currentPanel) {
|
|
771
|
-
case "calendar":
|
|
772
|
-
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
773
|
-
React__namespace.createElement(Calendar, __assign({}, props, { date: dateInFocus, onClickYear: onClickYear, onClickMonth: onClickMonth }))));
|
|
774
|
-
case "month":
|
|
775
|
-
return (React__namespace.createElement(MonthPicker, { value: dateInFocus.getMonth(), onValueChange: onChangeSelectedMonth }));
|
|
776
|
-
case "year":
|
|
777
|
-
return (React__namespace.createElement(YearPicker, { value: dateInFocus.getFullYear(), onValueChange: onChangeSelectedYear }));
|
|
778
|
-
case "presets":
|
|
779
|
-
return React__namespace.createElement(PresetPicker, { onClickPreset: function () { } });
|
|
780
|
-
default:
|
|
781
|
-
return (React__namespace.createElement(core.Box, null,
|
|
782
|
-
React__namespace.createElement(elements.PrimaryButton, { label: "Show calendar", onClick: function () { return setCurrentPanel("calendar"); } })));
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
|
|
786
|
-
var noop = function () { };
|
|
787
|
-
function CalendarWithMonthSwitcher(_a) {
|
|
788
|
-
var monthSwitcherPlacement = _a.monthSwitcherPlacement, _b = _a.theme, theme = _b === void 0 ? defaultCalendarTheme : _b, dateInFocus = _a.dateInFocus, setDateInFocus = _a.setDateInFocus, currentPanel = _a.currentPanel, setCurrentPanel = _a.setCurrentPanel, _c = _a.onSelectPreset, onSelectPreset = _c === void 0 ? noop : _c, _d = _a.hideYearPagination, hideYearPagination = _d === void 0 ? false : _d, calendarProps = __rest(_a, ["monthSwitcherPlacement", "theme", "dateInFocus", "setDateInFocus", "currentPanel", "setCurrentPanel", "onSelectPreset", "hideYearPagination"]);
|
|
789
|
-
var _e = useSelectedMonthStepperLogic(dateInFocus, setDateInFocus, calendarProps.monthsPerRow, calendarProps.numMonths), nextMonth = _e.nextMonth, prevMonth = _e.prevMonth, nextYear = _e.nextYear, prevYear = _e.prevYear;
|
|
790
|
-
var placement = fallbackIfNoPlacement(monthSwitcherPlacement, calendarProps.numMonths);
|
|
791
|
-
switch (placement) {
|
|
792
|
-
case "below": {
|
|
793
|
-
return (React__namespace.createElement(WithMonthSwitcherBelow, { theme: theme, nextMonth: nextMonth, prevMonth: prevMonth, nextYear: nextYear, prevYear: prevYear },
|
|
794
|
-
React__namespace.createElement(Calendar, __assign({}, calendarProps, { theme: theme, date: dateInFocus }))));
|
|
795
|
-
}
|
|
796
|
-
case "header": {
|
|
797
|
-
return (React__namespace.createElement(core.Column, null,
|
|
798
|
-
React__namespace.createElement(CalendarWithMonthYearPickers, __assign({}, calendarProps, { theme: theme, dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, onSelectPreset: onSelectPreset, headerLeftContent: React__namespace.createElement(core.Row, { alignItems: "center" },
|
|
799
|
-
!hideYearPagination && (React__namespace.createElement(elements.FlatButton, { size: "small", onClick: prevYear, leftIcon: faAngleDoubleLeft.faAngleDoubleLeft })),
|
|
800
|
-
React__namespace.createElement(core.Space, null),
|
|
801
|
-
React__namespace.createElement(elements.FlatButton, { size: "small", onClick: prevMonth, leftIcon: elements.stenaAngleLeft })), headerRightContent: React__namespace.createElement(core.Row, { alignItems: "center" },
|
|
802
|
-
React__namespace.createElement(elements.FlatButton, { size: "small", onClick: nextMonth, leftIcon: elements.stenaAngleRight }),
|
|
803
|
-
React__namespace.createElement(core.Space, null),
|
|
804
|
-
!hideYearPagination && (React__namespace.createElement(elements.FlatButton, { size: "small", onClick: nextYear, leftIcon: faAngleDoubleRight.faAngleDoubleRight }))) }))));
|
|
805
|
-
}
|
|
806
|
-
default: {
|
|
807
|
-
return (React__namespace.createElement(Calendar, __assign({}, calendarProps, { theme: theme, date: dateInFocus })));
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
var fallbackIfNoPlacement = function (monthSwitcherPlacement, numMonths) {
|
|
812
|
-
return monthSwitcherPlacement || (numMonths || 1) > 1 ? "below" : "header";
|
|
813
|
-
};
|
|
814
|
-
|
|
815
|
-
var dateRangeToStrings = function (dateRange) { return ({
|
|
816
|
-
startDate: dateRange.startDate
|
|
817
|
-
? dateFns.format(dateRange.startDate, "yyyy-MM-dd")
|
|
818
|
-
: undefined,
|
|
819
|
-
endDate: dateRange.endDate
|
|
820
|
-
? dateFns.format(dateRange.endDate, "yyyy-MM-dd")
|
|
821
|
-
: undefined,
|
|
822
|
-
}); };
|
|
823
|
-
var stringsToDateRange = function (_a) {
|
|
824
|
-
var startDate = _a.startDate, endDate = _a.endDate;
|
|
825
|
-
var now = new Date();
|
|
826
|
-
return {
|
|
827
|
-
startDate: startDate ? dateFns.parse(startDate, "yyyy-MM-dd", now) : undefined,
|
|
828
|
-
endDate: endDate ? dateFns.parse(endDate, "yyyy-MM-dd", now) : undefined,
|
|
829
|
-
};
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
var isDateRangeInvalid = function (_a) {
|
|
833
|
-
var startDate = _a.startDate, endDate = _a.endDate;
|
|
834
|
-
return Boolean(startDate &&
|
|
835
|
-
endDate &&
|
|
836
|
-
!dateFns.isSameDay(startDate, endDate) &&
|
|
837
|
-
dateFns.isAfter(startDate, endDate));
|
|
838
|
-
};
|
|
839
|
-
var toggleDatesIfEndIsEarlierThanStart = function (dateRange) {
|
|
840
|
-
if (isDateRangeInvalid(dateRange)) {
|
|
841
|
-
return {
|
|
842
|
-
startDate: dateRange.endDate,
|
|
843
|
-
endDate: dateRange.startDate,
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
return dateRange;
|
|
847
|
-
};
|
|
848
|
-
var toggleDateStringsIfEndIsEarlierThanStart = function (dateRange) {
|
|
849
|
-
if (dateRange.startDate && dateRange.endDate) {
|
|
850
|
-
return dateRangeToStrings(toggleDatesIfEndIsEarlierThanStart(stringsToDateRange(dateRange)));
|
|
851
|
-
}
|
|
852
|
-
return dateRange;
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
var useDateRangeOnClickDayHandler = function (value, onValueChange, focusedInput, setFocusedInput) {
|
|
856
|
-
return React.useCallback(function (day) {
|
|
857
|
-
var dateRange = {
|
|
858
|
-
startDate: focusedInput === "startDate" ? day.date : value === null || value === void 0 ? void 0 : value.startDate,
|
|
859
|
-
endDate: focusedInput === "endDate" ? day.date : value === null || value === void 0 ? void 0 : value.endDate,
|
|
860
|
-
};
|
|
861
|
-
if (!isDateRangeInvalid(dateRange)) {
|
|
862
|
-
setFocusedInput(focusedInput === "startDate" ? "endDate" : "startDate");
|
|
863
|
-
}
|
|
864
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(toggleDatesIfEndIsEarlierThanStart(dateRange));
|
|
865
|
-
}, [
|
|
866
|
-
focusedInput,
|
|
867
|
-
onValueChange,
|
|
868
|
-
setFocusedInput,
|
|
869
|
-
value === null || value === void 0 ? void 0 : value.endDate,
|
|
870
|
-
value === null || value === void 0 ? void 0 : value.startDate,
|
|
871
|
-
]);
|
|
872
|
-
};
|
|
873
|
-
|
|
874
|
-
var useInternalPanelState = function (onChangePanel) {
|
|
875
|
-
var _a = React.useState("calendar"), currentPanel = _a[0], _setCurrentPanel = _a[1];
|
|
876
|
-
var setCurrentPanel = React.useCallback(function (currentPanel) {
|
|
877
|
-
_setCurrentPanel(currentPanel);
|
|
878
|
-
onChangePanel === null || onChangePanel === void 0 ? void 0 : onChangePanel(currentPanel);
|
|
879
|
-
}, [onChangePanel]);
|
|
880
|
-
return {
|
|
881
|
-
currentPanel: currentPanel,
|
|
882
|
-
setCurrentPanel: setCurrentPanel,
|
|
883
|
-
};
|
|
884
|
-
};
|
|
885
|
-
|
|
886
|
-
var useDateRangeSelection = function (_a) {
|
|
887
|
-
var focusedInput = _a.focusedInput, value = _a.value, onValueChange = _a.onValueChange, setFocusedInput = _a.setFocusedInput, statePerMonth = _a.statePerMonth, onChangePanel = _a.onChangePanel;
|
|
888
|
-
var _b = useInternalPanelState(onChangePanel), currentPanel = _b.currentPanel, setCurrentPanel = _b.setCurrentPanel;
|
|
889
|
-
var _c = React.useState(function () { return new Date(); }), dateInFocus = _c[0], setDateInFocus = _c[1];
|
|
890
|
-
var onClickDay = useDateRangeOnClickDayHandler(value, onValueChange, focusedInput, setFocusedInput);
|
|
891
|
-
var statePerMonthWithSelection = React.useMemo(function () {
|
|
892
|
-
return buildDayStateForDateRange(statePerMonth, value === null || value === void 0 ? void 0 : value.startDate, value === null || value === void 0 ? void 0 : value.endDate);
|
|
893
|
-
}, [statePerMonth, value === null || value === void 0 ? void 0 : value.endDate, value === null || value === void 0 ? void 0 : value.startDate]);
|
|
894
|
-
return {
|
|
895
|
-
onClickDay: onClickDay,
|
|
896
|
-
statePerMonth: statePerMonthWithSelection,
|
|
897
|
-
currentPanel: currentPanel,
|
|
898
|
-
setCurrentPanel: setCurrentPanel,
|
|
899
|
-
setDateInFocus: setDateInFocus,
|
|
900
|
-
dateInFocus: dateInFocus,
|
|
901
|
-
};
|
|
902
|
-
};
|
|
903
|
-
|
|
904
|
-
function DateRangeCalendar(props) {
|
|
905
|
-
var dateRangeSelectionProps = useDateRangeSelection(props);
|
|
906
|
-
return (React__namespace.createElement(CalendarWithMonthSwitcher, __assign({}, props, dateRangeSelectionProps)));
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
var useDateRangeCalendarState = function () {
|
|
910
|
-
var _a = React.useState(), startDate = _a[0], setStartDate = _a[1];
|
|
911
|
-
var _b = React.useState(), endDate = _b[0], setEndDate = _b[1];
|
|
912
|
-
var _c = React.useState("startDate"), focusedInput = _c[0], setFocusedInput = _c[1];
|
|
913
|
-
return {
|
|
914
|
-
startDate: startDate,
|
|
915
|
-
setStartDate: setStartDate,
|
|
916
|
-
endDate: endDate,
|
|
917
|
-
setEndDate: setEndDate,
|
|
918
|
-
focusedInput: focusedInput,
|
|
919
|
-
setFocusedInput: setFocusedInput,
|
|
920
|
-
};
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
var useSingleDateSelection = function (_a) {
|
|
924
|
-
var onChange = _a.onChange, value = _a.value, statePerMonth = _a.statePerMonth, onChangePanel = _a.onChangePanel;
|
|
925
|
-
var _b = useInternalPanelState(onChangePanel), currentPanel = _b.currentPanel, setCurrentPanel = _b.setCurrentPanel;
|
|
926
|
-
var _c = React.useState(function () { return value !== null && value !== void 0 ? value : new Date(); }), dateInFocus = _c[0], setDateInFocus = _c[1];
|
|
927
|
-
var onClickDay = React.useCallback(function (day) {
|
|
928
|
-
if (onChange) {
|
|
929
|
-
onChange(day.date);
|
|
930
|
-
}
|
|
931
|
-
}, [onChange]);
|
|
932
|
-
var statePerMonthWithSelectedDate = React.useMemo(function () {
|
|
933
|
-
return value
|
|
934
|
-
? addDayStateHighlights(statePerMonth, value, [
|
|
935
|
-
"selected",
|
|
936
|
-
"singleSelected",
|
|
937
|
-
])
|
|
938
|
-
: statePerMonth;
|
|
939
|
-
}, [statePerMonth, value]);
|
|
940
|
-
return {
|
|
941
|
-
onClickDay: onClickDay,
|
|
942
|
-
statePerMonth: statePerMonthWithSelectedDate,
|
|
943
|
-
date: value,
|
|
944
|
-
currentPanel: currentPanel,
|
|
945
|
-
setCurrentPanel: setCurrentPanel,
|
|
946
|
-
dateInFocus: dateInFocus,
|
|
947
|
-
setDateInFocus: setDateInFocus,
|
|
948
|
-
};
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
function SingleDateCalendar(props) {
|
|
952
|
-
var singleDateSelectionProps = useSingleDateSelection(props);
|
|
953
|
-
return (React__namespace.createElement(CalendarWithMonthSwitcher, __assign({}, props, singleDateSelectionProps)));
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
var useMultiDateSelection = function (_a) {
|
|
957
|
-
var onChange = _a.onChange, value = _a.value, statePerMonth = _a.statePerMonth, onChangePanel = _a.onChangePanel;
|
|
958
|
-
var _b = useInternalPanelState(onChangePanel), currentPanel = _b.currentPanel, setCurrentPanel = _b.setCurrentPanel;
|
|
959
|
-
var _c = React.useState(function () { return new Date(); }), dateInFocus = _c[0], setDateInFocus = _c[1];
|
|
960
|
-
var onClickDay = React.useCallback(function (day) {
|
|
961
|
-
if (!onChange) {
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
var isSelected = value && value.find(function (d) { return dateFns.isSameDay(d, day.date); });
|
|
965
|
-
if (value && isSelected) {
|
|
966
|
-
onChange(value.filter(function (v) { return !dateFns.isSameDay(v, day.date); }));
|
|
967
|
-
}
|
|
968
|
-
else {
|
|
969
|
-
onChange(__spreadArray(__spreadArray([], (value || []), true), [day.date], false));
|
|
970
|
-
}
|
|
971
|
-
}, [onChange, value]);
|
|
972
|
-
var statePerMonthWithSelectedDate = React.useMemo(function () {
|
|
973
|
-
if (!value) {
|
|
974
|
-
return statePerMonth;
|
|
975
|
-
}
|
|
976
|
-
return value.reduce(function (stateSum, date) { return addDayStateHighlights(stateSum, date, ["selected"]); }, statePerMonth);
|
|
977
|
-
}, [statePerMonth, value]);
|
|
978
|
-
return {
|
|
979
|
-
onClickDay: onClickDay,
|
|
980
|
-
statePerMonth: statePerMonthWithSelectedDate,
|
|
981
|
-
currentPanel: currentPanel,
|
|
982
|
-
setCurrentPanel: setCurrentPanel,
|
|
983
|
-
dateInFocus: dateInFocus,
|
|
984
|
-
setDateInFocus: setDateInFocus,
|
|
985
|
-
};
|
|
986
|
-
};
|
|
987
|
-
|
|
988
|
-
function MultiDateCalendar(props) {
|
|
989
|
-
var selectionProps = useMultiDateSelection(props);
|
|
990
|
-
return React__namespace.createElement(CalendarWithMonthSwitcher, __assign({}, props, selectionProps));
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
var useSingleWeekSelection = function (_a) {
|
|
994
|
-
var onChange = _a.onChange, value = _a.value, statePerMonth = _a.statePerMonth, onChangePanel = _a.onChangePanel;
|
|
995
|
-
var _b = React.useState(function () {
|
|
996
|
-
var week = getWeekDataFromWeekString(value);
|
|
997
|
-
if (!week) {
|
|
998
|
-
return new Date();
|
|
999
|
-
}
|
|
1000
|
-
return week.days[0].date;
|
|
1001
|
-
}), dateInFocus = _b[0], setDateInFocus = _b[1];
|
|
1002
|
-
var _c = useInternalPanelState(onChangePanel), currentPanel = _c.currentPanel, setCurrentPanel = _c.setCurrentPanel;
|
|
1003
|
-
var onClickDay = React.useCallback(function (day) {
|
|
1004
|
-
if (onChange) {
|
|
1005
|
-
onChange(getWeekStringFromWeekData(getWeekForDate(day.date)));
|
|
1006
|
-
}
|
|
1007
|
-
}, [onChange]);
|
|
1008
|
-
var onClickWeek = React.useCallback(function (week) {
|
|
1009
|
-
if (onChange) {
|
|
1010
|
-
onChange(getWeekStringFromWeekData(week));
|
|
1011
|
-
}
|
|
1012
|
-
}, [onChange]);
|
|
1013
|
-
var statePerMonthWithSelection = React.useMemo(function () {
|
|
1014
|
-
var weekData = getWeekDataFromWeekString(value);
|
|
1015
|
-
return weekData
|
|
1016
|
-
? addWeekRangeHighlights(statePerMonth, weekData)
|
|
1017
|
-
: statePerMonth;
|
|
1018
|
-
}, [value, statePerMonth]);
|
|
1019
|
-
var date = React.useMemo(function () {
|
|
1020
|
-
var week = getWeekDataFromWeekString(value);
|
|
1021
|
-
if (!week) {
|
|
1022
|
-
return new Date();
|
|
1023
|
-
}
|
|
1024
|
-
return week.days[0].date;
|
|
1025
|
-
}, [value]);
|
|
1026
|
-
return {
|
|
1027
|
-
statePerMonth: statePerMonthWithSelection,
|
|
1028
|
-
date: date,
|
|
1029
|
-
dateInFocus: dateInFocus,
|
|
1030
|
-
setDateInFocus: setDateInFocus,
|
|
1031
|
-
onClickDay: onClickDay,
|
|
1032
|
-
onClickWeek: onClickWeek,
|
|
1033
|
-
currentPanel: currentPanel,
|
|
1034
|
-
setCurrentPanel: setCurrentPanel,
|
|
1035
|
-
};
|
|
1036
|
-
};
|
|
1037
|
-
var getWeekStringFromWeekData = function (week) {
|
|
1038
|
-
if (!week) {
|
|
1039
|
-
return undefined;
|
|
1040
|
-
}
|
|
1041
|
-
return "".concat(week.endYear, "-").concat(week.weekNumber);
|
|
1042
|
-
};
|
|
1043
|
-
var getWeekDataFromWeekString = function (week) {
|
|
1044
|
-
if (!week) {
|
|
1045
|
-
return undefined;
|
|
1046
|
-
}
|
|
1047
|
-
var parts = week.split("-");
|
|
1048
|
-
var weekNumber = parseInt(parts[1], 10);
|
|
1049
|
-
var year = parseInt(parts[0], 10);
|
|
1050
|
-
return getWeekForDate(getStartDateOfISOWeek(weekNumber, year));
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
|
-
function SingleWeekCalendar(props) {
|
|
1054
|
-
var singleWeekSelectionProps = useSingleWeekSelection(props);
|
|
1055
|
-
return (React__namespace.createElement(CalendarWithMonthSwitcher, __assign({}, props, singleWeekSelectionProps)));
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
var removeDateIfExist = function (list, date) {
|
|
1059
|
-
return list.filter(function (item) { return !dateFns.isSameDay(item, date); });
|
|
1060
|
-
};
|
|
1061
|
-
var listContainsDate = function (list, date) {
|
|
1062
|
-
return !!list.find(function (item) { return dateFns.isSameDay(item, date); });
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1065
|
-
var useDateRangeExclusionSelection = function (_a) {
|
|
1066
|
-
var value = _a.value, onValueChange = _a.onValueChange, statePerMonth = _a.statePerMonth, onChangePanel = _a.onChangePanel;
|
|
1067
|
-
var _b = React.useState(), dateRange = _b[0], setDateRange = _b[1];
|
|
1068
|
-
var _c = React.useState("startDate"), focusedInput = _c[0], setFocusedInput = _c[1];
|
|
1069
|
-
var _d = useInternalPanelState(onChangePanel), currentPanel = _d.currentPanel, setCurrentPanel = _d.setCurrentPanel;
|
|
1070
|
-
var _e = React.useState(function () { var _a; return (_a = (focusedInput && (value === null || value === void 0 ? void 0 : value[focusedInput]))) !== null && _a !== void 0 ? _a : new Date(); }), dateInFocus = _e[0], setDateInFocus = _e[1];
|
|
1071
|
-
var onChangeHandler = React.useCallback(function (value) {
|
|
1072
|
-
setDateRange(value);
|
|
1073
|
-
var startDate = value.startDate, endDate = value.endDate;
|
|
1074
|
-
if (onValueChange) {
|
|
1075
|
-
if (startDate && endDate) {
|
|
1076
|
-
var dates = dateFns.eachDayOfInterval({ start: startDate, end: endDate });
|
|
1077
|
-
onValueChange(dates);
|
|
1078
|
-
}
|
|
1079
|
-
else if (startDate) {
|
|
1080
|
-
onValueChange([startDate]);
|
|
1081
|
-
}
|
|
1082
|
-
else if (endDate) {
|
|
1083
|
-
onValueChange([endDate]);
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
}, [onValueChange]);
|
|
1087
|
-
var onClickDayRange = useDateRangeOnClickDayHandler(dateRange, onChangeHandler, focusedInput, setFocusedInput);
|
|
1088
|
-
var onClickDay = React.useCallback(function (day, userData, ev) {
|
|
1089
|
-
if (onValueChange) {
|
|
1090
|
-
if (ev.ctrlKey || ev.metaKey) {
|
|
1091
|
-
if (!value) {
|
|
1092
|
-
onValueChange([day.date]);
|
|
1093
|
-
}
|
|
1094
|
-
else if (listContainsDate(value, day.date)) {
|
|
1095
|
-
onValueChange(removeDateIfExist(value, day.date));
|
|
1096
|
-
}
|
|
1097
|
-
else {
|
|
1098
|
-
onValueChange(__spreadArray(__spreadArray([], value, true), [day.date], false));
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
else {
|
|
1102
|
-
onClickDayRange(day, userData, ev);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
}, [onValueChange, onClickDayRange, value]);
|
|
1106
|
-
var statePerMonthWithSelectedDate = React.useMemo(function () {
|
|
1107
|
-
return addHighlighting(statePerMonth, value);
|
|
1108
|
-
}, [statePerMonth, value]);
|
|
1109
|
-
return {
|
|
1110
|
-
onClickDay: onClickDay,
|
|
1111
|
-
statePerMonth: statePerMonthWithSelectedDate,
|
|
1112
|
-
currentPanel: currentPanel,
|
|
1113
|
-
setCurrentPanel: setCurrentPanel,
|
|
1114
|
-
dateInFocus: dateInFocus,
|
|
1115
|
-
setDateInFocus: setDateInFocus,
|
|
1116
|
-
};
|
|
1117
|
-
};
|
|
1118
|
-
var addHighlighting = function (statePerMonth, dateList) {
|
|
1119
|
-
if (!dateList) {
|
|
1120
|
-
return statePerMonth;
|
|
1121
|
-
}
|
|
1122
|
-
return dateList.reduce(function (statePerMonth, date) {
|
|
1123
|
-
return addDayStateHighlights(statePerMonth, date, ["selected"]);
|
|
1124
|
-
}, statePerMonth);
|
|
1125
|
-
};
|
|
1126
|
-
|
|
1127
|
-
function DateRangeExclusionCalendar(props) {
|
|
1128
|
-
var selectionProps = useDateRangeExclusionSelection(props);
|
|
1129
|
-
return React__namespace.createElement(CalendarWithMonthSwitcher, __assign({}, props, selectionProps));
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
var defaultPopoverPlacement = "bottom";
|
|
1133
|
-
|
|
1134
|
-
var useCalendarPopoverUpdater = function () {
|
|
1135
|
-
var _a = tooltip.useTippyInstance(), tippyRef = _a[0], tippyInstanceRef = _a[1];
|
|
1136
|
-
var onChangePanel = React.useCallback(function () {
|
|
1137
|
-
var _a, _b;
|
|
1138
|
-
(_b = (_a = tippyInstanceRef.current) === null || _a === void 0 ? void 0 : _a.popperInstance) === null || _b === void 0 ? void 0 : _b.update();
|
|
1139
|
-
}, [tippyInstanceRef]);
|
|
1140
|
-
return {
|
|
1141
|
-
onChangePanel: onChangePanel,
|
|
1142
|
-
tippyRef: tippyRef,
|
|
1143
|
-
};
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1146
|
-
var useDateInput = function (onChange, onClose, openOnMount) {
|
|
1147
|
-
var _a = React.useState(openOnMount || false), showingCalendar = _a[0], setShowingCalendar = _a[1];
|
|
1148
|
-
var showCalendar = React.useCallback(function () {
|
|
1149
|
-
setShowingCalendar(true);
|
|
1150
|
-
return true;
|
|
1151
|
-
}, [setShowingCalendar]);
|
|
1152
|
-
var hideCalendar = React.useCallback(function () {
|
|
1153
|
-
setShowingCalendar(false);
|
|
1154
|
-
if (onClose) {
|
|
1155
|
-
onClose();
|
|
1156
|
-
}
|
|
1157
|
-
}, [setShowingCalendar, onClose]);
|
|
1158
|
-
var onSelectDate = React.useCallback(function (date) {
|
|
1159
|
-
if (onChange) {
|
|
1160
|
-
onChange(date);
|
|
1161
|
-
}
|
|
1162
|
-
setTimeout(hideCalendar, 150);
|
|
1163
|
-
}, [onChange, hideCalendar]);
|
|
1164
|
-
return {
|
|
1165
|
-
showCalendar: showCalendar,
|
|
1166
|
-
hideCalendar: hideCalendar,
|
|
1167
|
-
showingCalendar: showingCalendar,
|
|
1168
|
-
onSelectDate: onSelectDate,
|
|
1169
|
-
};
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
var defaultMaxDate = "2999-12-31";
|
|
1173
|
-
|
|
1174
|
-
var DateInput = function (_a) {
|
|
1175
|
-
var _b = _a.displayFormat, displayFormat = _b === void 0 ? DateFormats.fullDate : _b, _c = _a.placeholder, placeholder = _c === void 0 ? "Enter date" : _c, value = _a.value, _d = _a.zIndex, zIndex = _d === void 0 ? 100 : _d, _e = _a.calendarTheme, calendarTheme = _e === void 0 ? defaultCalendarTheme : _e, calendarProps = _a.calendarProps, openOnMount = _a.openOnMount, onClose = _a.onClose, onChange = _a.onChange, portalTarget = _a.portalTarget, variant = _a.variant, width = _a.width, minDate = _a.minDate, _f = _a.maxDate, maxDate = _f === void 0 ? defaultMaxDate : _f, disabled = _a.disabled;
|
|
1176
|
-
var _g = useDateInput(onChange, onClose, openOnMount), hideCalendar = _g.hideCalendar, showingCalendar = _g.showingCalendar, onSelectDate = _g.onSelectDate, showCalendar = _g.showCalendar;
|
|
1177
|
-
var _h = useCalendarPopoverUpdater(), tippyRef = _h.tippyRef, onChangePanel = _h.onChangePanel;
|
|
1178
|
-
return (React__namespace.createElement(core.Box, { width: width },
|
|
1179
|
-
React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, visible: showingCalendar, onClickOutside: hideCalendar, placement: defaultPopoverPlacement, zIndex: zIndex, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", tippyRef: tippyRef, disabled: disabled, content: React__namespace.createElement(SingleDateCalendar, __assign({}, calendarProps, { onChange: onSelectDate, value: value, theme: calendarTheme, onChangePanel: onChangePanel, minDate: minDate, maxDate: maxDate })) },
|
|
1180
|
-
React__namespace.createElement(forms.TextInput, { type: "date", contentRight: React__namespace.createElement(core.Row, { alignItems: "center" },
|
|
1181
|
-
React__namespace.createElement(elements.FlatButton, { size: "small", disabled: disabled, leftIcon: elements.stenaCalendar, onClick: showCalendar })), onFocus: showCalendar, onClickRight: showCalendar, value: value ? dateFns.format(value, displayFormat) : "", placeholder: placeholder, size: 9, disabled: disabled, autoFocus: openOnMount, variant: variant, min: minDate, max: maxDate }))));
|
|
1182
|
-
};
|
|
1183
|
-
|
|
1184
|
-
var useDateRangeInput = function (value, onValueChange) {
|
|
1185
|
-
var startDateInputRef = React.useRef(null);
|
|
1186
|
-
var endDateInputRef = React.useRef(null);
|
|
1187
|
-
var _a = React.useState(false), showingCalendar = _a[0], setShowingCalendar = _a[1];
|
|
1188
|
-
var _b = React.useState(undefined), focusedInput = _b[0], setFocusedInput = _b[1];
|
|
1189
|
-
var showCalendarStartDate = React.useCallback(function () {
|
|
1190
|
-
setFocusedInput("startDate");
|
|
1191
|
-
setShowingCalendar(true);
|
|
1192
|
-
return true;
|
|
1193
|
-
}, [setFocusedInput, setShowingCalendar]);
|
|
1194
|
-
var showCalendarEndDate = React.useCallback(function () {
|
|
1195
|
-
setFocusedInput("endDate");
|
|
1196
|
-
setShowingCalendar(true);
|
|
1197
|
-
return true;
|
|
1198
|
-
}, [setFocusedInput, setShowingCalendar]);
|
|
1199
|
-
var hideCalendar = React.useCallback(function () {
|
|
1200
|
-
setShowingCalendar(false);
|
|
1201
|
-
}, [setShowingCalendar]);
|
|
1202
|
-
var onClickDay = React.useCallback(function (day) {
|
|
1203
|
-
if (focusedInput === "startDate") {
|
|
1204
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
1205
|
-
startDate: day.date,
|
|
1206
|
-
endDate: value === null || value === void 0 ? void 0 : value.endDate,
|
|
1207
|
-
});
|
|
1208
|
-
if (!(value === null || value === void 0 ? void 0 : value.endDate)) {
|
|
1209
|
-
setFocusedInput("endDate");
|
|
1210
|
-
endDateInputRef.current && endDateInputRef.current.focus();
|
|
1211
|
-
}
|
|
1212
|
-
else {
|
|
1213
|
-
setTimeout(hideCalendar, 150);
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
else if (focusedInput === "endDate") {
|
|
1217
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
1218
|
-
startDate: value === null || value === void 0 ? void 0 : value.startDate,
|
|
1219
|
-
endDate: day.date,
|
|
1220
|
-
});
|
|
1221
|
-
if (!(value === null || value === void 0 ? void 0 : value.startDate)) {
|
|
1222
|
-
setFocusedInput("startDate");
|
|
1223
|
-
startDateInputRef.current && startDateInputRef.current.focus();
|
|
1224
|
-
}
|
|
1225
|
-
else {
|
|
1226
|
-
setTimeout(hideCalendar, 150);
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
}, [focusedInput, onValueChange, setFocusedInput, hideCalendar, value]);
|
|
1230
|
-
var startDateIsAfterEnd = React.useMemo(function () {
|
|
1231
|
-
return (value === null || value === void 0 ? void 0 : value.startDate) &&
|
|
1232
|
-
(value === null || value === void 0 ? void 0 : value.endDate) &&
|
|
1233
|
-
dateFns.isAfter(value.startDate, value.endDate);
|
|
1234
|
-
}, [value === null || value === void 0 ? void 0 : value.startDate, value === null || value === void 0 ? void 0 : value.endDate]);
|
|
1235
|
-
return {
|
|
1236
|
-
showingCalendar: showingCalendar,
|
|
1237
|
-
hideCalendar: hideCalendar,
|
|
1238
|
-
showCalendarEndDate: showCalendarEndDate,
|
|
1239
|
-
showCalendarStartDate: showCalendarStartDate,
|
|
1240
|
-
focusedInput: focusedInput,
|
|
1241
|
-
setFocusedInput: setFocusedInput,
|
|
1242
|
-
startDateInputRef: startDateInputRef,
|
|
1243
|
-
endDateInputRef: endDateInputRef,
|
|
1244
|
-
onClickDay: onClickDay,
|
|
1245
|
-
startDateIsAfterEnd: startDateIsAfterEnd,
|
|
1246
|
-
};
|
|
1247
|
-
};
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* @deprecated Please use DateRangeDualTextInput instead.
|
|
1251
|
-
*/
|
|
1252
|
-
var DateRangeInput = function (_a) {
|
|
1253
|
-
var _b = _a.displayFormat, displayFormat = _b === void 0 ? DateFormats.fullDate : _b, _c = _a.placeholderStartDate, placeholderStartDate = _c === void 0 ? "Start date" : _c, _d = _a.placeholderEndDate, placeholderEndDate = _d === void 0 ? "End date" : _d, portalTarget = _a.portalTarget, value = _a.value, onValueChange = _a.onValueChange, _e = _a.zIndex, zIndex = _e === void 0 ? 100 : _e, width = _a.width, _f = _a.calendarTheme, calendarTheme = _f === void 0 ? defaultCalendarTheme : _f, calendarProps = _a.calendarProps, minDate = _a.minDate, _g = _a.maxDate, maxDate = _g === void 0 ? defaultMaxDate : _g, disabled = _a.disabled;
|
|
1254
|
-
var _h = React.useState(function () { var _a; return (_a = (focusedInput && (value === null || value === void 0 ? void 0 : value[focusedInput]))) !== null && _a !== void 0 ? _a : new Date(); }), dateInFocus = _h[0], setDateInFocus = _h[1];
|
|
1255
|
-
var _j = React.useState("calendar"), currentPanel = _j[0], setCurrentPanel = _j[1];
|
|
1256
|
-
var _k = useDateRangeInput(value, onValueChange), hideCalendar = _k.hideCalendar, showCalendarEndDate = _k.showCalendarEndDate, showCalendarStartDate = _k.showCalendarStartDate, showingCalendar = _k.showingCalendar, focusedInput = _k.focusedInput, startDateInputRef = _k.startDateInputRef, endDateInputRef = _k.endDateInputRef, onClickDay = _k.onClickDay, startDateIsAfterEnd = _k.startDateIsAfterEnd;
|
|
1257
|
-
var statePerMonth = React.useMemo(function () {
|
|
1258
|
-
return buildDayStateForDateRange(undefined, value === null || value === void 0 ? void 0 : value.startDate, value === null || value === void 0 ? void 0 : value.endDate);
|
|
1259
|
-
}, [value]);
|
|
1260
|
-
return (React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, disabled: disabled, visible: showingCalendar, zIndex: zIndex, placement: defaultPopoverPlacement, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", onClickOutside: hideCalendar, content: React__namespace.createElement(CalendarWithMonthSwitcher, __assign({}, calendarProps, { dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, statePerMonth: statePerMonth, theme: calendarTheme, onClickDay: onClickDay, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, minDate: minDate, maxDate: maxDate })) },
|
|
1261
|
-
React__namespace.createElement(core.Row, { alignItems: "center" },
|
|
1262
|
-
React__namespace.createElement(forms.TextInput, { iconLeft: elements.stenaCalendar, onFocus: showCalendarStartDate, value: (value === null || value === void 0 ? void 0 : value.startDate) ? dateFns.format(value.startDate, displayFormat) : "", placeholder: placeholderStartDate, width: width, disabled: disabled, inputRef: startDateInputRef, size: 9, variant: startDateIsAfterEnd ? "error" : undefined }),
|
|
1263
|
-
React__namespace.createElement(core.Space, null),
|
|
1264
|
-
React__namespace.createElement(elements.Icon, { icon: faLongArrowAltRight.faLongArrowAltRight, color: theme.cssColor("--lhds-color-ui-500"), size: 14 }),
|
|
1265
|
-
React__namespace.createElement(core.Space, null),
|
|
1266
|
-
React__namespace.createElement(forms.TextInput, { iconLeft: elements.stenaCalendar, onFocus: showCalendarEndDate, value: (value === null || value === void 0 ? void 0 : value.endDate) ? dateFns.format(value.endDate, displayFormat) : "", placeholder: placeholderEndDate, width: width, disabled: disabled, inputRef: endDateInputRef, size: 9, variant: startDateIsAfterEnd ? "error" : undefined }))));
|
|
1267
|
-
};
|
|
1268
|
-
|
|
1269
|
-
var DateTextInput = function (_a) {
|
|
1270
|
-
var calendarProps = _a.calendarProps, _b = _a.closeOnCalendarSelectDate, closeOnCalendarSelectDate = _b === void 0 ? true : _b, _c = _a.dateFormat, dateFormat = _c === void 0 ? DateFormats.fullDate : _c; _a.disableCalender; var onValueChange = _a.onValueChange, _e = _a.placeholder, placeholder = _e === void 0 ? "yyyy-mm-dd" : _e, portalTarget = _a.portalTarget, value = _a.value, _f = _a.width, width = _f === void 0 ? "130px" : _f, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.calendarTheme, calendarTheme = _h === void 0 ? defaultCalendarTheme : _h, _j = _a.hideCalenderIcon, hideCalenderIcon = _j === void 0 ? false : _j, minDate = _a.minDate, _k = _a.maxDate, maxDate = _k === void 0 ? defaultMaxDate : _k, variant = _a.variant, props = __rest(_a, ["calendarProps", "closeOnCalendarSelectDate", "dateFormat", "disableCalender", "onValueChange", "placeholder", "portalTarget", "value", "width", "zIndex", "calendarTheme", "hideCalenderIcon", "minDate", "maxDate", "variant"]);
|
|
1271
|
-
var _l = React.useState(false), open = _l[0], setOpen = _l[1];
|
|
1272
|
-
var _m = useCalendarPopoverUpdater(), tippyRef = _m.tippyRef, onChangePanel = _m.onChangePanel;
|
|
1273
|
-
var toggleCalendar = React.useCallback(function () {
|
|
1274
|
-
setOpen(!open);
|
|
1275
|
-
}, [setOpen, open]);
|
|
1276
|
-
var hideCalendar = React.useCallback(function () {
|
|
1277
|
-
setOpen(false);
|
|
1278
|
-
}, [setOpen]);
|
|
1279
|
-
var onValueChangeHandler = React.useCallback(function (value) {
|
|
1280
|
-
if (onValueChange) {
|
|
1281
|
-
onValueChange(value);
|
|
1282
|
-
}
|
|
1283
|
-
}, [onValueChange]);
|
|
1284
|
-
var onCalendarSelectDate = React.useCallback(function (date) {
|
|
1285
|
-
if (date) {
|
|
1286
|
-
onValueChangeHandler(dateFns.format(date, dateFormat));
|
|
1287
|
-
if (closeOnCalendarSelectDate) {
|
|
1288
|
-
setTimeout(function () { return setOpen(!open); }, 200);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
}, [onValueChangeHandler, dateFormat, closeOnCalendarSelectDate, setOpen, open]);
|
|
1292
|
-
var inValidInput = !!value && !/^[-/\\.0-9]+$/.test(value);
|
|
1293
|
-
var dateIsValid = !!value && dateFns.isValid(dateFns.parse(value, dateFormat, new Date()));
|
|
1294
|
-
var userInputCorrectLength = !!value && value.length >= dateFormat.length;
|
|
1295
|
-
var invalid = (userInputCorrectLength && !dateIsValid) || inValidInput;
|
|
1296
|
-
return (React__namespace.createElement(core.Box, { width: width },
|
|
1297
|
-
React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, visible: open, zIndex: zIndex, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", placement: defaultPopoverPlacement, onClickOutside: hideCalendar, tippyRef: tippyRef, content: React__namespace.createElement(SingleDateCalendar, __assign({}, calendarProps, { onChange: onCalendarSelectDate, onChangePanel: onChangePanel, value: value && dateIsValid
|
|
1298
|
-
? dateFns.parse(value, dateFormat, new Date())
|
|
1299
|
-
: undefined, minDate: minDate, maxDate: maxDate, theme: calendarTheme })) },
|
|
1300
|
-
React__namespace.createElement(forms.TextInput, __assign({}, props, { variant: invalid ? "error" : variant, disableContentPaddingRight: true, contentRight: !hideCalenderIcon ? (React__namespace.createElement(core.Row, { alignItems: "center", indent: 0.5 },
|
|
1301
|
-
React__namespace.createElement(elements.FlatButton, { size: "small", disabled: props.disabled, leftIcon: elements.stenaCalendar, onClick: toggleCalendar }))) : undefined, onValueChange: onValueChangeHandler, placeholder: placeholder, value: value || "", min: minDate, max: maxDate, size: 10 })))));
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
|
-
var formatHours = function (hours) {
|
|
1305
|
-
if (hours === "") {
|
|
1306
|
-
return "00";
|
|
1307
|
-
}
|
|
1308
|
-
var h = parseInt(hours, 10);
|
|
1309
|
-
if (isNaN(h)) {
|
|
1310
|
-
throw new Error("Hours is not a number");
|
|
1311
|
-
}
|
|
1312
|
-
if (h < 0 || h > 23) {
|
|
1313
|
-
throw new Error("Hours is an invalid number");
|
|
1314
|
-
}
|
|
1315
|
-
switch (hours.length) {
|
|
1316
|
-
case 1:
|
|
1317
|
-
return "0".concat(h);
|
|
1318
|
-
case 2:
|
|
1319
|
-
return hours;
|
|
1320
|
-
default:
|
|
1321
|
-
throw new Error("Invalid hour string");
|
|
1322
|
-
}
|
|
1323
|
-
};
|
|
1324
|
-
var formatMinutes = function (minutes) {
|
|
1325
|
-
if (minutes === "") {
|
|
1326
|
-
return "00";
|
|
1327
|
-
}
|
|
1328
|
-
var m = parseInt(minutes, 10);
|
|
1329
|
-
if (isNaN(m)) {
|
|
1330
|
-
throw new Error("Minutes is not a number");
|
|
1331
|
-
}
|
|
1332
|
-
if (m < 0 || m > 59) {
|
|
1333
|
-
throw new Error("Minutes is an invalid number");
|
|
1334
|
-
}
|
|
1335
|
-
switch (minutes.length) {
|
|
1336
|
-
case 1:
|
|
1337
|
-
return "0".concat(m);
|
|
1338
|
-
case 2:
|
|
1339
|
-
return minutes;
|
|
1340
|
-
default:
|
|
1341
|
-
throw new Error("Invalid minute string");
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
var formatTimeString = function (time) {
|
|
1345
|
-
if (!validUserInput(time)) {
|
|
1346
|
-
return { time: time, success: false };
|
|
1347
|
-
}
|
|
1348
|
-
var arr = time && time.split(/-|:|,|;|[/]|[.]| /); // consider all these chars as user input separator
|
|
1349
|
-
if (arr && arr.length === 2) {
|
|
1350
|
-
try {
|
|
1351
|
-
var hours = formatHours(arr[0]);
|
|
1352
|
-
var minutes = formatMinutes(arr[1]);
|
|
1353
|
-
return { time: "".concat(hours, ":").concat(minutes), success: true };
|
|
1354
|
-
}
|
|
1355
|
-
catch (_a) {
|
|
1356
|
-
return { time: time, success: false };
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
else if (arr && arr.length === 1) {
|
|
1360
|
-
var hours = 0;
|
|
1361
|
-
var minutes = 0;
|
|
1362
|
-
switch (time.length) {
|
|
1363
|
-
case 1:
|
|
1364
|
-
return { time: "0".concat(time, ":00"), success: true };
|
|
1365
|
-
case 2:
|
|
1366
|
-
var timeNumber = parseInt(arr[0], 10);
|
|
1367
|
-
if (timeNumber >= 0 && timeNumber < 24) {
|
|
1368
|
-
return { time: "".concat(time, ":00"), success: true };
|
|
1369
|
-
}
|
|
1370
|
-
else if (timeNumber >= 24 && timeNumber < 59) {
|
|
1371
|
-
return { time: "00:".concat(time), success: true };
|
|
1372
|
-
}
|
|
1373
|
-
return { time: time, success: false };
|
|
1374
|
-
case 3:
|
|
1375
|
-
minutes = parseInt(time.substr(1, 2), 10);
|
|
1376
|
-
if (minutes >= 0 && minutes <= 59) {
|
|
1377
|
-
return {
|
|
1378
|
-
time: "0".concat(time.substr(0, 1), ":").concat(time.substr(1, 2)),
|
|
1379
|
-
success: true,
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
return { time: time, success: false };
|
|
1383
|
-
case 4:
|
|
1384
|
-
hours = parseInt(time.substr(0, 2), 10);
|
|
1385
|
-
minutes = parseInt(time.substr(2, 2), 10);
|
|
1386
|
-
if (hours < 0 || hours > 23) {
|
|
1387
|
-
return { time: time, success: false };
|
|
1388
|
-
}
|
|
1389
|
-
if (minutes < 0 || minutes > 59) {
|
|
1390
|
-
return { time: time, success: false };
|
|
1391
|
-
}
|
|
1392
|
-
return {
|
|
1393
|
-
time: "".concat(time.substr(0, 2), ":").concat(time.substr(2, 2)),
|
|
1394
|
-
success: true,
|
|
1395
|
-
};
|
|
1396
|
-
default:
|
|
1397
|
-
return { time: time, success: false };
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
return { time: time, success: false };
|
|
1401
|
-
};
|
|
1402
|
-
var validUserInput = function (input) {
|
|
1403
|
-
if (input) {
|
|
1404
|
-
return /^[-:.,/; 0-9]+$/.test(input);
|
|
1405
|
-
}
|
|
1406
|
-
return true;
|
|
1407
|
-
};
|
|
1408
|
-
|
|
1409
|
-
/**
|
|
1410
|
-
* @deprecated
|
|
1411
|
-
*/
|
|
1412
|
-
var TimeTextInput = function (_a) {
|
|
1413
|
-
var onValueChange = _a.onValueChange, _b = _a.showPlaceholder, showPlaceholder = _b === void 0 ? true : _b, _c = _a.useIcon, useIcon = _c === void 0 ? true : _c, value = _a.value, _d = _a.width, width = _d === void 0 ? "85px" : _d, variant = _a.variant, props = __rest(_a, ["onValueChange", "showPlaceholder", "useIcon", "value", "width", "variant"]);
|
|
1414
|
-
var _e = React.useState(function () { return validUserInput(value); }), valid = _e[0], setValid = _e[1];
|
|
1415
|
-
var timeFormat = "hh:mm";
|
|
1416
|
-
var onBlur = React.useCallback(function () {
|
|
1417
|
-
if (value) {
|
|
1418
|
-
var formattedResult = formatTimeString(value);
|
|
1419
|
-
setValid(formattedResult.success);
|
|
1420
|
-
if (formattedResult.success) {
|
|
1421
|
-
if (onValueChange) {
|
|
1422
|
-
onValueChange(formattedResult.time);
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
}, [value, onValueChange, setValid]);
|
|
1427
|
-
var onChangeHandler = React.useCallback(function (ev) {
|
|
1428
|
-
var time = ev.target.value;
|
|
1429
|
-
var validInput = validUserInput(time);
|
|
1430
|
-
setValid(validInput && time.length <= timeFormat.length);
|
|
1431
|
-
if (onValueChange) {
|
|
1432
|
-
onValueChange(time);
|
|
1433
|
-
}
|
|
1434
|
-
}, [onValueChange, setValid]);
|
|
1435
|
-
return (React__namespace.createElement(forms.TextInput, __assign({}, props, { type: "time", variant: !valid ? "error" : variant, iconLeft: useIcon ? elements.stenaClock : undefined, value: value, placeholder: showPlaceholder ? timeFormat : undefined, onChange: onChangeHandler, onBlur: onBlur, width: width })));
|
|
1436
|
-
};
|
|
1437
|
-
|
|
1438
|
-
var DualTextInput = function (_a) {
|
|
1439
|
-
var autoFocusLeft = _a.autoFocusLeft, autoFocusRight = _a.autoFocusRight, onEsc = _a.onEsc, onEnter = _a.onEnter, onValueChangeLeft = _a.onValueChangeLeft, onValueChangeRight = _a.onValueChangeRight, separatorIcon = _a.separatorIcon, placeholderLeft = _a.placeholderLeft, placeholderRight = _a.placeholderRight, typeLeft = _a.typeLeft, typeRight = _a.typeRight, onChangeLeft = _a.onChangeLeft, onChangeRight = _a.onChangeRight, valueLeft = _a.valueLeft, valueRight = _a.valueRight, minLeft = _a.minLeft, maxLeft = _a.maxLeft, minRight = _a.minRight, maxRight = _a.maxRight, onClickLeft = _a.onClickLeft, onClickRight = _a.onClickRight, onClickCalendar = _a.onClickCalendar, onClickArrowDown = _a.onClickArrowDown, onBlurLeft = _a.onBlurLeft, onBlurRight = _a.onBlurRight, onFocusLeft = _a.onFocusLeft, onFocusRight = _a.onFocusRight, inputRefLeft = _a.inputRefLeft, inputRefRight = _a.inputRefRight, variant = _a.variant, variantLeft = _a.variantLeft, variantRight = _a.variantRight, onBlur = _a.onBlur, showPresets = _a.showPresets, widthLeft = _a.widthLeft, widthRight = _a.widthRight, disabled = _a.disabled;
|
|
1440
|
-
var focusCounter = React.useRef(0);
|
|
1441
|
-
var tryTriggerOnBlur = React.useMemo(function () {
|
|
1442
|
-
return lodash.debounce(function (focusCounter) {
|
|
1443
|
-
if (focusCounter === 0) {
|
|
1444
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
1445
|
-
}
|
|
1446
|
-
}, 10);
|
|
1447
|
-
}, [onBlur]);
|
|
1448
|
-
var focusLeftHandler = React.useCallback(function (ev) {
|
|
1449
|
-
focusCounter.current++;
|
|
1450
|
-
tryTriggerOnBlur(focusCounter.current);
|
|
1451
|
-
if (onFocusLeft) {
|
|
1452
|
-
onFocusLeft(ev);
|
|
1453
|
-
}
|
|
1454
|
-
}, [onFocusLeft, focusCounter, tryTriggerOnBlur]);
|
|
1455
|
-
var focusRightHandler = React.useCallback(function (ev) {
|
|
1456
|
-
focusCounter.current++;
|
|
1457
|
-
tryTriggerOnBlur(focusCounter.current);
|
|
1458
|
-
if (onFocusRight) {
|
|
1459
|
-
onFocusRight(ev);
|
|
1460
|
-
}
|
|
1461
|
-
}, [onFocusRight, focusCounter, tryTriggerOnBlur]);
|
|
1462
|
-
var blurLeftHandler = React.useCallback(function (ev) {
|
|
1463
|
-
focusCounter.current--;
|
|
1464
|
-
tryTriggerOnBlur(focusCounter.current);
|
|
1465
|
-
if (onBlurLeft) {
|
|
1466
|
-
onBlurLeft(ev);
|
|
1467
|
-
}
|
|
1468
|
-
}, [onBlurLeft, focusCounter, tryTriggerOnBlur]);
|
|
1469
|
-
var blurRightHandler = React.useCallback(function (ev) {
|
|
1470
|
-
focusCounter.current--;
|
|
1471
|
-
tryTriggerOnBlur(focusCounter.current);
|
|
1472
|
-
if (onBlurRight) {
|
|
1473
|
-
onBlurRight(ev);
|
|
1474
|
-
}
|
|
1475
|
-
}, [onBlurRight, focusCounter, tryTriggerOnBlur]);
|
|
1476
|
-
return (React__namespace.createElement(core.Box, null,
|
|
1477
|
-
React__namespace.createElement(forms.TextInputBox, { disableContentPaddingRight: true, disabled: disabled, variant: variant, contentRight: React__namespace.createElement(core.Row, { alignItems: "center" },
|
|
1478
|
-
React__namespace.createElement(core.Indent, { num: 0.5 },
|
|
1479
|
-
React__namespace.createElement(elements.FlatButton, { leftIcon: elements.stenaCalendar, onClick: onClickCalendar, disabled: disabled, size: "small" })),
|
|
1480
|
-
showPresets ? (React__namespace.createElement(React__namespace.Fragment, null,
|
|
1481
|
-
React__namespace.createElement(core.Row, { height: "22px" },
|
|
1482
|
-
React__namespace.createElement(core.SeparatorLine, { vertical: true })),
|
|
1483
|
-
React__namespace.createElement(core.Indent, { num: 0.5 },
|
|
1484
|
-
React__namespace.createElement(elements.FlatButton, { leftIcon: elements.stenaAngleDown, onClick: onClickArrowDown, disabled: disabled, size: "small" })))) : null) },
|
|
1485
|
-
React__namespace.createElement(core.Box, { width: widthLeft },
|
|
1486
|
-
React__namespace.createElement(forms.TextInput, { onEsc: onEsc, onEnter: onEnter, onClick: onClickLeft, disabled: disabled, hideBorder: true, placeholder: placeholderLeft, value: valueLeft, onValueChange: onValueChangeLeft, onChange: onChangeLeft, onBlur: blurLeftHandler, onFocus: focusLeftHandler, inputRef: inputRefLeft, variant: variantLeft, type: typeLeft, autoFocus: autoFocusLeft, min: minLeft, max: maxLeft })),
|
|
1487
|
-
React__namespace.createElement(core.Row, { indent: 0.5, alignItems: "center", justifyContent: "center" },
|
|
1488
|
-
React__namespace.createElement(elements.Icon, { icon: separatorIcon, size: 12, color: theme.cssColor("--lhds-color-ui-500") })),
|
|
1489
|
-
React__namespace.createElement(core.Box, { width: widthRight },
|
|
1490
|
-
React__namespace.createElement(forms.TextInput, { onEsc: onEsc, onEnter: onEnter, onClick: onClickRight, disabled: disabled, hideBorder: true, placeholder: placeholderRight, value: valueRight, onValueChange: onValueChangeRight, onChange: onChangeRight, onBlur: blurRightHandler, onFocus: focusRightHandler, inputRef: inputRefRight, variant: variantRight, type: typeRight, autoFocus: autoFocusRight, min: minRight, max: maxRight })))));
|
|
1491
|
-
};
|
|
1492
|
-
|
|
1493
|
-
var transformTimeStringToNumber = function (time) {
|
|
1494
|
-
if (time == null) {
|
|
1495
|
-
throw new Error("Time is not set.");
|
|
1496
|
-
}
|
|
1497
|
-
if (time === "") {
|
|
1498
|
-
throw new Error("Time is empty.");
|
|
1499
|
-
}
|
|
1500
|
-
var parts = time.split(":");
|
|
1501
|
-
if (parts.length !== 2) {
|
|
1502
|
-
throw new Error("Invalid time.");
|
|
1503
|
-
}
|
|
1504
|
-
if (parts[1].length !== 2) {
|
|
1505
|
-
throw new Error("Invalid time.");
|
|
1506
|
-
}
|
|
1507
|
-
if (parts[0].length < 1 || parts[0].length > 2) {
|
|
1508
|
-
throw new Error("Invalid time.");
|
|
1509
|
-
}
|
|
1510
|
-
var hours = parseInt(parts[0], 10);
|
|
1511
|
-
var minutes = parseInt(parts[1], 10);
|
|
1512
|
-
if (isNaN(hours)) {
|
|
1513
|
-
throw new Error("Invalid time.");
|
|
1514
|
-
}
|
|
1515
|
-
if (isNaN(minutes)) {
|
|
1516
|
-
throw new Error("Invalid time.");
|
|
1517
|
-
}
|
|
1518
|
-
if (hours < 0 || hours > 23) {
|
|
1519
|
-
throw new Error("Invalid time.");
|
|
1520
|
-
}
|
|
1521
|
-
if (minutes < 0 || minutes > 59) {
|
|
1522
|
-
throw new Error("Invalid time.");
|
|
1523
|
-
}
|
|
1524
|
-
return hours * 100 + minutes;
|
|
1525
|
-
};
|
|
1526
|
-
var isValidTimeString = function (time) {
|
|
1527
|
-
try {
|
|
1528
|
-
transformTimeStringToNumber(time);
|
|
1529
|
-
return true;
|
|
1530
|
-
}
|
|
1531
|
-
catch (e) {
|
|
1532
|
-
return false;
|
|
1533
|
-
}
|
|
1534
|
-
};
|
|
1535
|
-
var getHoursAndMinutesFromTimeString = function (value) {
|
|
1536
|
-
if (value && isValidTimeString(value)) {
|
|
1537
|
-
var p = value.split(":");
|
|
1538
|
-
return {
|
|
1539
|
-
hour: core.parseIntElseUndefined(p[0]),
|
|
1540
|
-
minute: core.parseIntElseUndefined(p[1]),
|
|
1541
|
-
};
|
|
1542
|
-
}
|
|
1543
|
-
return {
|
|
1544
|
-
hour: undefined,
|
|
1545
|
-
minute: undefined,
|
|
1546
|
-
};
|
|
1547
|
-
};
|
|
1548
|
-
var transformTimeInDateToTimeString = function (date) {
|
|
1549
|
-
return "".concat(formatHours(String(date.getHours())), ":").concat(formatMinutes(String(date.getMinutes())));
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
|
-
var css_248z = ".TimePicker-module_timePicker__1ElGu {\n overflow: hidden;\n width: 180px;\n}\n\n.TimePicker-module_timePickerColumn__2vfuE {\n overflow-y: hidden;\n flex: 1;\n}\n\n.TimePicker-module_timePickerColumn__2vfuE:hover {\n overflow-y: scroll;\n }\n";
|
|
1553
|
-
var styles = {"timePicker":"TimePicker-module_timePicker__1ElGu","timePickerColumn":"TimePicker-module_timePickerColumn__2vfuE"};
|
|
1554
|
-
styleInject(css_248z);
|
|
1555
|
-
|
|
1556
|
-
var TimePickerCell = function (_a) {
|
|
1557
|
-
var onClick = _a.onClick, item = _a.item, selected = _a.selected, columnRef = _a.columnRef, canScrollRef = _a.canScrollRef;
|
|
1558
|
-
var ref = React.useRef(null);
|
|
1559
|
-
React.useEffect(function scrollToSelectedItem() {
|
|
1560
|
-
if (selected &&
|
|
1561
|
-
columnRef.current &&
|
|
1562
|
-
ref.current &&
|
|
1563
|
-
canScrollRef.current) {
|
|
1564
|
-
var targetScroll = ref.current.scrollHeight * Math.max(item - 2, 0);
|
|
1565
|
-
columnRef.current.scrollTo(0, targetScroll);
|
|
1566
|
-
canScrollRef.current = false;
|
|
1567
|
-
}
|
|
1568
|
-
}, [columnRef, item, selected, canScrollRef]);
|
|
1569
|
-
return (React__namespace.createElement(core.Row, { width: "64px", justifyContent: "center", spacing: 0.5, indent: 0.5, ref: ref }, selected ? (React__namespace.createElement(elements.PrimaryButton, { label: String(item), onClick: function () { return onClick && onClick(item); } })) : (React__namespace.createElement(elements.FlatButton, { label: String(item), onClick: function () { return onClick && onClick(item); } }))));
|
|
1570
|
-
};
|
|
1571
|
-
|
|
1572
|
-
var TimePickerColumn = function (_a) {
|
|
1573
|
-
var onClick = _a.onClick, items = _a.items, selectedItem = _a.selectedItem, canScrollRef = _a.canScrollRef;
|
|
1574
|
-
var columnRef = React.useRef(null);
|
|
1575
|
-
return (React__namespace.createElement(core.Column, { className: styles.timePickerColumn, ref: columnRef }, items.map(function (item) { return (React__namespace.createElement(TimePickerCell, { key: item, item: item, onClick: onClick, selected: item === selectedItem, columnRef: columnRef, canScrollRef: canScrollRef })); })));
|
|
1576
|
-
};
|
|
1577
|
-
|
|
1578
|
-
var hours = lodash.range(0, 24);
|
|
1579
|
-
var minutes = lodash.range(0, 60);
|
|
1580
|
-
var TimePicker = function (_a) {
|
|
1581
|
-
var value = _a.value, onValueChange = _a.onValueChange;
|
|
1582
|
-
var canScrollRef = React.useRef(true);
|
|
1583
|
-
var _b = React.useState(undefined), hour = _b[0], setHour = _b[1];
|
|
1584
|
-
var _c = React.useState(undefined), minute = _c[0], setMinute = _c[1];
|
|
1585
|
-
React.useEffect(function () {
|
|
1586
|
-
if (value) {
|
|
1587
|
-
var _a = getHoursAndMinutesFromTimeString(value), minute_1 = _a.minute, hour_1 = _a.hour;
|
|
1588
|
-
setHour(hour_1);
|
|
1589
|
-
setMinute(minute_1);
|
|
1590
|
-
}
|
|
1591
|
-
}, [value]);
|
|
1592
|
-
var onClickHour = React.useCallback(function (h) {
|
|
1593
|
-
setHour(h);
|
|
1594
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("".concat(formatHours(String(h !== null && h !== void 0 ? h : 0)), ":").concat(formatMinutes(String(minute !== null && minute !== void 0 ? minute : 0))));
|
|
1595
|
-
}, [minute, onValueChange]);
|
|
1596
|
-
var onClickMinutes = React.useCallback(function (m) {
|
|
1597
|
-
setMinute(m);
|
|
1598
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("".concat(formatHours(String(hour !== null && hour !== void 0 ? hour : 0)), ":").concat(formatMinutes(String(m !== null && m !== void 0 ? m : 0))));
|
|
1599
|
-
}, [hour, onValueChange]);
|
|
1600
|
-
return (React__namespace.createElement(core.Row, { className: styles.timePicker },
|
|
1601
|
-
React__namespace.createElement(TimePickerColumn, { items: hours, onClick: onClickHour, selectedItem: hour, canScrollRef: canScrollRef }),
|
|
1602
|
-
React__namespace.createElement(core.Indent, null),
|
|
1603
|
-
React__namespace.createElement(TimePickerColumn, { items: minutes, onClick: onClickMinutes, selectedItem: minute, canScrollRef: canScrollRef })));
|
|
1604
|
-
};
|
|
1605
|
-
|
|
1606
|
-
var useDateRangeEffects$1 = function (date, setDateInFocus, dateInputRef) {
|
|
1607
|
-
React.useEffect(function moveFocusedDateWhenDateChanges() {
|
|
1608
|
-
if (date) {
|
|
1609
|
-
setDateInFocus(date);
|
|
1610
|
-
}
|
|
1611
|
-
}, [date, setDateInFocus]);
|
|
1612
|
-
React.useEffect(function updateDateFieldWhenValueChanges() {
|
|
1613
|
-
if (dateInputRef.current) {
|
|
1614
|
-
if (date) {
|
|
1615
|
-
dateInputRef.current.valueAsDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
1616
|
-
}
|
|
1617
|
-
else {
|
|
1618
|
-
dateInputRef.current.valueAsDate = null;
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
}, [date, dateInputRef]);
|
|
1622
|
-
};
|
|
1623
|
-
|
|
1624
|
-
var useDateRangeHandlers$1 = function (date, onValueChange, _a, dateInputRef) {
|
|
1625
|
-
var setDateInFocus = _a.setDateInFocus, showCalendarInternal = _a.showCalendarInternal, hideCalendarInternal = _a.hideCalendarInternal, setFirstFocusedInput = _a.setFirstFocusedInput, setCurrentPanel = _a.setCurrentPanel, localTime = _a.localTime, setLocalTime = _a.setLocalTime, localDate = _a.localDate, setLocalDate = _a.setLocalDate;
|
|
1626
|
-
var onChangeDate = React.useCallback(function (incomingDate) {
|
|
1627
|
-
if (!incomingDate) {
|
|
1628
|
-
return;
|
|
1629
|
-
}
|
|
1630
|
-
var newDate = new Date(incomingDate);
|
|
1631
|
-
if (date) {
|
|
1632
|
-
// Full date is available
|
|
1633
|
-
newDate.setHours(date.getHours());
|
|
1634
|
-
newDate.setMinutes(date.getMinutes());
|
|
1635
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newDate);
|
|
1636
|
-
setLocalDate(undefined);
|
|
1637
|
-
}
|
|
1638
|
-
else if (localTime) {
|
|
1639
|
-
// Only time has been selected
|
|
1640
|
-
var _a = getHoursAndMinutesFromTimeString(localTime), minute = _a.minute, hour = _a.hour;
|
|
1641
|
-
newDate.setHours(hour !== null && hour !== void 0 ? hour : 0);
|
|
1642
|
-
newDate.setMinutes(minute !== null && minute !== void 0 ? minute : 0);
|
|
1643
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newDate);
|
|
1644
|
-
setLocalDate(undefined);
|
|
1645
|
-
}
|
|
1646
|
-
else {
|
|
1647
|
-
// Nothing has been selected
|
|
1648
|
-
setLocalDate(newDate);
|
|
1649
|
-
}
|
|
1650
|
-
setDateInFocus(newDate);
|
|
1651
|
-
if (dateInputRef.current) {
|
|
1652
|
-
dateInputRef.current.valueAsDate = newDate;
|
|
1653
|
-
}
|
|
1654
|
-
}, [date, dateInputRef, localTime, onValueChange, setDateInFocus, setLocalDate]);
|
|
1655
|
-
var onChangeTime = React.useCallback(function (time) {
|
|
1656
|
-
if (!time) {
|
|
1657
|
-
return;
|
|
1658
|
-
}
|
|
1659
|
-
if (date) {
|
|
1660
|
-
// Full date is available
|
|
1661
|
-
var newTime = getHoursAndMinutesFromTimeString(time);
|
|
1662
|
-
var newDate = new Date(date);
|
|
1663
|
-
newDate.setHours(newTime.hour || 0);
|
|
1664
|
-
newDate.setMinutes(newTime.minute || 0);
|
|
1665
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newDate);
|
|
1666
|
-
setLocalTime(undefined);
|
|
1667
|
-
}
|
|
1668
|
-
else if (localDate) {
|
|
1669
|
-
// Only date has already been selected
|
|
1670
|
-
var newTime = getHoursAndMinutesFromTimeString(time);
|
|
1671
|
-
var newDate = new Date(localDate);
|
|
1672
|
-
newDate.setHours(newTime.hour || 0);
|
|
1673
|
-
newDate.setMinutes(newTime.minute || 0);
|
|
1674
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newDate);
|
|
1675
|
-
setLocalTime(undefined);
|
|
1676
|
-
}
|
|
1677
|
-
else {
|
|
1678
|
-
// Nothing has been selected
|
|
1679
|
-
setLocalTime(time);
|
|
1680
|
-
}
|
|
1681
|
-
}, [onValueChange, date, localDate, setLocalTime]);
|
|
1682
|
-
var inputLeftChangeHandler = React.useCallback(function (ev) {
|
|
1683
|
-
if (ev.target.value[0] !== "0") {
|
|
1684
|
-
onChangeDate(ev.target.valueAsDate);
|
|
1685
|
-
}
|
|
1686
|
-
}, [onChangeDate]);
|
|
1687
|
-
var inputRightChangeHandler = React.useCallback(function (ev) { return onChangeTime(ev.target.value); }, [onChangeTime]);
|
|
1688
|
-
var showCalendar = React.useCallback(function () {
|
|
1689
|
-
if (date) {
|
|
1690
|
-
setDateInFocus(date);
|
|
1691
|
-
}
|
|
1692
|
-
else {
|
|
1693
|
-
setDateInFocus(new Date());
|
|
1694
|
-
}
|
|
1695
|
-
setCurrentPanel("calendar");
|
|
1696
|
-
showCalendarInternal();
|
|
1697
|
-
}, [date, setCurrentPanel, showCalendarInternal, setDateInFocus]);
|
|
1698
|
-
var hideCalendar = React.useCallback(function () {
|
|
1699
|
-
setFirstFocusedInput(undefined);
|
|
1700
|
-
hideCalendarInternal();
|
|
1701
|
-
}, [setFirstFocusedInput, hideCalendarInternal]);
|
|
1702
|
-
return {
|
|
1703
|
-
inputLeftChangeHandler: inputLeftChangeHandler,
|
|
1704
|
-
inputRightChangeHandler: inputRightChangeHandler,
|
|
1705
|
-
hideCalendar: hideCalendar,
|
|
1706
|
-
showCalendar: showCalendar,
|
|
1707
|
-
onChangeTime: onChangeTime,
|
|
1708
|
-
onChangeDate: onChangeDate,
|
|
1709
|
-
};
|
|
1710
|
-
};
|
|
1711
|
-
|
|
1712
|
-
var useInputStates$1 = function (date) {
|
|
1713
|
-
var _a = React.useState(undefined), localDate = _a[0], setLocalDate = _a[1];
|
|
1714
|
-
var _b = React.useState(undefined), localTime = _b[0], setLocalTime = _b[1];
|
|
1715
|
-
var _c = core.useBoolean(false), isCalendarVisible = _c[0], showCalendarInternal = _c[1], hideCalendarInternal = _c[2];
|
|
1716
|
-
var _d = core.useBoolean(false), isTimePickerVisible = _d[0], showTimePicker = _d[1], hideTimePicker = _d[2];
|
|
1717
|
-
var _e = React.useState(undefined), firstFocusedInput = _e[0], setFirstFocusedInput = _e[1];
|
|
1718
|
-
var _f = React.useState(function () { return date !== null && date !== void 0 ? date : new Date(); }), dateInFocus = _f[0], setDateInFocus = _f[1];
|
|
1719
|
-
var _g = React.useState("calendar"), currentPanel = _g[0], setCurrentPanel = _g[1];
|
|
1720
|
-
return {
|
|
1721
|
-
isCalendarVisible: isCalendarVisible,
|
|
1722
|
-
showCalendarInternal: showCalendarInternal,
|
|
1723
|
-
hideCalendarInternal: hideCalendarInternal,
|
|
1724
|
-
firstFocusedInput: firstFocusedInput,
|
|
1725
|
-
setFirstFocusedInput: setFirstFocusedInput,
|
|
1726
|
-
dateInFocus: dateInFocus,
|
|
1727
|
-
setDateInFocus: setDateInFocus,
|
|
1728
|
-
currentPanel: currentPanel,
|
|
1729
|
-
setCurrentPanel: setCurrentPanel,
|
|
1730
|
-
isTimePickerVisible: isTimePickerVisible,
|
|
1731
|
-
showTimePicker: showTimePicker,
|
|
1732
|
-
hideTimePicker: hideTimePicker,
|
|
1733
|
-
localDate: localDate,
|
|
1734
|
-
setLocalDate: setLocalDate,
|
|
1735
|
-
localTime: localTime,
|
|
1736
|
-
setLocalTime: setLocalTime,
|
|
1737
|
-
};
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
|
-
var useUserInputHandlers$1 = function (onChangeDate, dateInputRef, showCalendar, hideCalendar, _a) {
|
|
1741
|
-
var isCalendarVisible = _a.isCalendarVisible, setCurrentPanel = _a.setCurrentPanel, showTimePicker = _a.showTimePicker, hideTimePicker = _a.hideTimePicker;
|
|
1742
|
-
var onFocusLeft = React.useCallback(function () {
|
|
1743
|
-
if (!isCalendarVisible) {
|
|
1744
|
-
showCalendar();
|
|
1745
|
-
}
|
|
1746
|
-
setCurrentPanel("calendar");
|
|
1747
|
-
hideTimePicker();
|
|
1748
|
-
}, [hideTimePicker, isCalendarVisible, setCurrentPanel, showCalendar]);
|
|
1749
|
-
var onFocusRight = React.useCallback(function () {
|
|
1750
|
-
hideCalendar();
|
|
1751
|
-
showTimePicker();
|
|
1752
|
-
}, [hideCalendar, showTimePicker]);
|
|
1753
|
-
var onClickDay = React.useCallback(function (day) {
|
|
1754
|
-
onChangeDate(day.date);
|
|
1755
|
-
hideCalendar();
|
|
1756
|
-
showTimePicker();
|
|
1757
|
-
}, [onChangeDate, hideCalendar, showTimePicker]);
|
|
1758
|
-
var onClickArrowButton = React.useCallback(function () {
|
|
1759
|
-
setCurrentPanel("presets");
|
|
1760
|
-
showCalendar();
|
|
1761
|
-
}, [setCurrentPanel, showCalendar]);
|
|
1762
|
-
var onClickCalendarButton = React.useCallback(function () {
|
|
1763
|
-
var _a;
|
|
1764
|
-
if (isCalendarVisible) {
|
|
1765
|
-
hideCalendar();
|
|
1766
|
-
}
|
|
1767
|
-
else {
|
|
1768
|
-
(_a = dateInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1769
|
-
setCurrentPanel("calendar");
|
|
1770
|
-
showCalendar();
|
|
1771
|
-
}
|
|
1772
|
-
}, [
|
|
1773
|
-
isCalendarVisible,
|
|
1774
|
-
hideCalendar,
|
|
1775
|
-
dateInputRef,
|
|
1776
|
-
setCurrentPanel,
|
|
1777
|
-
showCalendar,
|
|
1778
|
-
]);
|
|
1779
|
-
var onKeyDownHandler = React.useCallback(function (ev) {
|
|
1780
|
-
if (ev.key === "Escape") {
|
|
1781
|
-
hideCalendar();
|
|
1782
|
-
}
|
|
1783
|
-
}, [hideCalendar]);
|
|
1784
|
-
return {
|
|
1785
|
-
onFocusLeft: onFocusLeft,
|
|
1786
|
-
onFocusRight: onFocusRight,
|
|
1787
|
-
onClickDay: onClickDay,
|
|
1788
|
-
onClickArrowButton: onClickArrowButton,
|
|
1789
|
-
onClickCalendarButton: onClickCalendarButton,
|
|
1790
|
-
onKeyDownHandler: onKeyDownHandler,
|
|
1791
|
-
};
|
|
1792
|
-
};
|
|
1793
|
-
|
|
1794
|
-
var DateTimeInput = function (_a) {
|
|
1795
|
-
var value = _a.value, onValueChange = _a.onValueChange, onEnter = _a.onEnter, onEsc = _a.onEsc, onBlur = _a.onBlur, autoFocus = _a.autoFocus, minDate = _a.minDate, _b = _a.widthLeft, widthLeft = _b === void 0 ? 128 : _b, _c = _a.widthRight, widthRight = _c === void 0 ? 80 : _c, _d = _a.maxDate, maxDate = _d === void 0 ? defaultMaxDate : _d, variant = _a.variant, disabled = _a.disabled;
|
|
1796
|
-
var dateInputRef = React.useRef(null);
|
|
1797
|
-
var timeInputRef = React.useRef(null);
|
|
1798
|
-
var states = useInputStates$1(value);
|
|
1799
|
-
var setCurrentPanel = states.setCurrentPanel, currentPanel = states.currentPanel, isCalendarVisible = states.isCalendarVisible, dateInFocus = states.dateInFocus, setDateInFocus = states.setDateInFocus, isTimePickerVisible = states.isTimePickerVisible, hideTimePicker = states.hideTimePicker, localTime = states.localTime, localDate = states.localDate;
|
|
1800
|
-
var _e = useDateRangeHandlers$1(value, onValueChange, states, dateInputRef), showCalendar = _e.showCalendar, hideCalendar = _e.hideCalendar, inputLeftChangeHandler = _e.inputLeftChangeHandler, inputRightChangeHandler = _e.inputRightChangeHandler, onChangeTime = _e.onChangeTime, onChangeDate = _e.onChangeDate;
|
|
1801
|
-
var _f = useUserInputHandlers$1(onChangeDate, dateInputRef, showCalendar, hideCalendar, states), onKeyDownHandler = _f.onKeyDownHandler, onFocusRight = _f.onFocusRight, onFocusLeft = _f.onFocusLeft, onClickDay = _f.onClickDay, onClickCalendarButton = _f.onClickCalendarButton, onClickArrowButton = _f.onClickArrowButton;
|
|
1802
|
-
useDateRangeEffects$1(value, setDateInFocus, dateInputRef);
|
|
1803
|
-
var statePerMonth = React.useMemo(function () {
|
|
1804
|
-
var dateToHighlight = value || localDate;
|
|
1805
|
-
if (!dateToHighlight) {
|
|
1806
|
-
return {};
|
|
1807
|
-
}
|
|
1808
|
-
return addDayStateHighlights(undefined, dateToHighlight, [
|
|
1809
|
-
"singleSelected",
|
|
1810
|
-
"selected",
|
|
1811
|
-
]);
|
|
1812
|
-
}, [localDate, value]);
|
|
1813
|
-
var hideAll = React.useCallback(function () {
|
|
1814
|
-
hideCalendar();
|
|
1815
|
-
hideTimePicker();
|
|
1816
|
-
}, [hideCalendar, hideTimePicker]);
|
|
1817
|
-
var timeValue = React.useMemo(function () { return (value ? transformTimeInDateToTimeString(value) : localTime); }, [value, localTime]);
|
|
1818
|
-
var delayedIsCalendarVisible = core.useDelayedFalse(isCalendarVisible, 300);
|
|
1819
|
-
var delayedIsTimePickerVisible = core.useDelayedFalse(isTimePickerVisible, 300);
|
|
1820
|
-
return (React__namespace.createElement(core.Box, { onKeyDown: onKeyDownHandler },
|
|
1821
|
-
React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, disabled: disabled, placement: defaultPopoverPlacement, visible: isCalendarVisible || isTimePickerVisible, onClickOutside: hideAll, content: (delayedIsCalendarVisible || delayedIsTimePickerVisible) && (React__namespace.createElement(core.Column, null, delayedIsCalendarVisible ? (React__namespace.createElement(CalendarWithMonthSwitcher, { statePerMonth: statePerMonth, onClickDay: onClickDay, dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, minDate: minDate, maxDate: maxDate })) : delayedIsTimePickerVisible ? (React__namespace.createElement(core.Column, null,
|
|
1822
|
-
React__namespace.createElement(core.Column, { overflow: "hidden", height: "250px" },
|
|
1823
|
-
React__namespace.createElement(TimePicker, { value: timeValue !== null && timeValue !== void 0 ? timeValue : "", onValueChange: onChangeTime })),
|
|
1824
|
-
React__namespace.createElement(core.Space, null),
|
|
1825
|
-
React__namespace.createElement(core.Row, { justifyContent: "flex-end" },
|
|
1826
|
-
React__namespace.createElement(elements.PrimaryButton, { label: "Done", onClick: hideTimePicker })))) : null)) },
|
|
1827
|
-
React__namespace.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: elements.stenaClock, typeLeft: "date", typeRight: "time", placeholderLeft: "yyyy-mm-dd", placeholderRight: "hh:mm", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: dateInputRef, inputRefRight: timeInputRef, valueRight: timeValue !== null && timeValue !== void 0 ? timeValue : "", widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate, variant: variant }))));
|
|
1828
|
-
};
|
|
1829
|
-
|
|
1830
|
-
var useDateRangeEffects = function (startDate, endDate, setDateInFocus, startDateInputRef, endDateInputRef) {
|
|
1831
|
-
React.useEffect(function moveFocusedDateWhenStartDateChanges() {
|
|
1832
|
-
if (startDate) {
|
|
1833
|
-
setDateInFocus(startDate);
|
|
1834
|
-
}
|
|
1835
|
-
}, [startDate, setDateInFocus]);
|
|
1836
|
-
React.useEffect(function moveFocusedDateWhenEndDateChanges() {
|
|
1837
|
-
if (endDate) {
|
|
1838
|
-
setDateInFocus(endDate);
|
|
1839
|
-
}
|
|
1840
|
-
}, [endDate, setDateInFocus]);
|
|
1841
|
-
React.useEffect(function updateStartDateFieldWhenValueChanges() {
|
|
1842
|
-
if (startDateInputRef.current) {
|
|
1843
|
-
if (startDate) {
|
|
1844
|
-
startDateInputRef.current.valueAsDate = new Date(Date.UTC(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()));
|
|
1845
|
-
}
|
|
1846
|
-
else {
|
|
1847
|
-
startDateInputRef.current.valueAsDate = null;
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
}, [startDate, startDateInputRef]);
|
|
1851
|
-
React.useEffect(function updateEndDateFieldWhenValueChanges() {
|
|
1852
|
-
if (endDateInputRef.current) {
|
|
1853
|
-
if (endDate) {
|
|
1854
|
-
endDateInputRef.current.valueAsDate = new Date(Date.UTC(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()));
|
|
1855
|
-
}
|
|
1856
|
-
else {
|
|
1857
|
-
endDateInputRef.current.valueAsDate = null;
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
}, [endDate, endDateInputRef]);
|
|
1861
|
-
};
|
|
1862
|
-
|
|
1863
|
-
var useDateRangeHandlers = function (startDate, endDate, onValueChange, _a) {
|
|
1864
|
-
var setDateInFocus = _a.setDateInFocus, showCalendarInternal = _a.showCalendarInternal, hideCalendarInternal = _a.hideCalendarInternal, setFirstFocusedInput = _a.setFirstFocusedInput, setCurrentPanel = _a.setCurrentPanel;
|
|
1865
|
-
var inputLeftChangeHandler = React.useCallback(function (ev) {
|
|
1866
|
-
var _a;
|
|
1867
|
-
if (ev.target.value[0] !== "0") {
|
|
1868
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
1869
|
-
startDate: (_a = ev.target.valueAsDate) !== null && _a !== void 0 ? _a : undefined,
|
|
1870
|
-
endDate: endDate,
|
|
1871
|
-
});
|
|
1872
|
-
}
|
|
1873
|
-
}, [onValueChange, endDate]);
|
|
1874
|
-
var inputRightChangeHandler = React.useCallback(function (ev) {
|
|
1875
|
-
var _a;
|
|
1876
|
-
if (ev.target.value[0] !== "0") {
|
|
1877
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
1878
|
-
startDate: startDate,
|
|
1879
|
-
endDate: (_a = ev.target.valueAsDate) !== null && _a !== void 0 ? _a : undefined,
|
|
1880
|
-
});
|
|
1881
|
-
}
|
|
1882
|
-
}, [onValueChange, startDate]);
|
|
1883
|
-
var showCalendar = React.useCallback(function () {
|
|
1884
|
-
if (startDate) {
|
|
1885
|
-
setDateInFocus(startDate);
|
|
1886
|
-
}
|
|
1887
|
-
else if (endDate) {
|
|
1888
|
-
setDateInFocus(endDate);
|
|
1889
|
-
}
|
|
1890
|
-
else {
|
|
1891
|
-
setDateInFocus(new Date());
|
|
1892
|
-
}
|
|
1893
|
-
setCurrentPanel("calendar");
|
|
1894
|
-
showCalendarInternal();
|
|
1895
|
-
}, [
|
|
1896
|
-
startDate,
|
|
1897
|
-
endDate,
|
|
1898
|
-
setCurrentPanel,
|
|
1899
|
-
showCalendarInternal,
|
|
1900
|
-
setDateInFocus,
|
|
1901
|
-
]);
|
|
1902
|
-
var hideCalendar = React.useCallback(function () {
|
|
1903
|
-
setFirstFocusedInput(undefined);
|
|
1904
|
-
hideCalendarInternal();
|
|
1905
|
-
}, [setFirstFocusedInput, hideCalendarInternal]);
|
|
1906
|
-
return {
|
|
1907
|
-
inputLeftChangeHandler: inputLeftChangeHandler,
|
|
1908
|
-
inputRightChangeHandler: inputRightChangeHandler,
|
|
1909
|
-
hideCalendar: hideCalendar,
|
|
1910
|
-
setDateInFocus: setDateInFocus,
|
|
1911
|
-
setCurrentPanel: setCurrentPanel,
|
|
1912
|
-
showCalendar: showCalendar,
|
|
1913
|
-
};
|
|
1914
|
-
};
|
|
1915
|
-
|
|
1916
|
-
var useInputStates = function (startDate, endDate) {
|
|
1917
|
-
var _a = core.useBoolean(false), isCalendarVisible = _a[0], showCalendarInternal = _a[1], hideCalendarInternal = _a[2];
|
|
1918
|
-
var _b = React.useState(undefined), firstFocusedInput = _b[0], setFirstFocusedInput = _b[1];
|
|
1919
|
-
var _c = React.useState("startDate"), focusedInput = _c[0], setFocusedInput = _c[1];
|
|
1920
|
-
var _d = React.useState(function () {
|
|
1921
|
-
var fromValue = focusedInput === "startDate"
|
|
1922
|
-
? startDate
|
|
1923
|
-
: focusedInput === "endDate"
|
|
1924
|
-
? endDate
|
|
1925
|
-
: undefined;
|
|
1926
|
-
return fromValue !== null && fromValue !== void 0 ? fromValue : new Date();
|
|
1927
|
-
}), dateInFocus = _d[0], setDateInFocus = _d[1];
|
|
1928
|
-
var _e = React.useState("calendar"), currentPanel = _e[0], setCurrentPanel = _e[1];
|
|
1929
|
-
return {
|
|
1930
|
-
isCalendarVisible: isCalendarVisible,
|
|
1931
|
-
showCalendarInternal: showCalendarInternal,
|
|
1932
|
-
hideCalendarInternal: hideCalendarInternal,
|
|
1933
|
-
firstFocusedInput: firstFocusedInput,
|
|
1934
|
-
setFirstFocusedInput: setFirstFocusedInput,
|
|
1935
|
-
focusedInput: focusedInput,
|
|
1936
|
-
setFocusedInput: setFocusedInput,
|
|
1937
|
-
dateInFocus: dateInFocus,
|
|
1938
|
-
setDateInFocus: setDateInFocus,
|
|
1939
|
-
currentPanel: currentPanel,
|
|
1940
|
-
setCurrentPanel: setCurrentPanel,
|
|
1941
|
-
};
|
|
1942
|
-
};
|
|
1943
|
-
|
|
1944
|
-
var useUserInputHandlers = function (startDate, endDate, onValueChange, startDateInputRef, endDateInputRef, showCalendar, hideCalendar, _a) {
|
|
1945
|
-
var firstFocusedInput = _a.firstFocusedInput, setFirstFocusedInput = _a.setFirstFocusedInput, isCalendarVisible = _a.isCalendarVisible, setFocusedInput = _a.setFocusedInput, focusedInput = _a.focusedInput, setCurrentPanel = _a.setCurrentPanel;
|
|
1946
|
-
var onFocusLeft = React.useCallback(function () {
|
|
1947
|
-
if (firstFocusedInput == null) {
|
|
1948
|
-
setFirstFocusedInput("startDate");
|
|
1949
|
-
}
|
|
1950
|
-
setFocusedInput("startDate");
|
|
1951
|
-
if (!isCalendarVisible) {
|
|
1952
|
-
showCalendar();
|
|
1953
|
-
}
|
|
1954
|
-
}, [
|
|
1955
|
-
isCalendarVisible,
|
|
1956
|
-
setFocusedInput,
|
|
1957
|
-
showCalendar,
|
|
1958
|
-
setFirstFocusedInput,
|
|
1959
|
-
firstFocusedInput,
|
|
1960
|
-
]);
|
|
1961
|
-
var onFocusRight = React.useCallback(function () {
|
|
1962
|
-
if (firstFocusedInput == null) {
|
|
1963
|
-
setFirstFocusedInput("endDate");
|
|
1964
|
-
}
|
|
1965
|
-
setFocusedInput("endDate");
|
|
1966
|
-
if (!isCalendarVisible) {
|
|
1967
|
-
showCalendar();
|
|
1968
|
-
}
|
|
1969
|
-
}, [
|
|
1970
|
-
isCalendarVisible,
|
|
1971
|
-
setFocusedInput,
|
|
1972
|
-
showCalendar,
|
|
1973
|
-
setFirstFocusedInput,
|
|
1974
|
-
firstFocusedInput,
|
|
1975
|
-
]);
|
|
1976
|
-
var onClickDay = React.useCallback(function (day) {
|
|
1977
|
-
var _a, _b, _c, _d;
|
|
1978
|
-
if (focusedInput === "startDate") {
|
|
1979
|
-
if (endDate != null && dateFns.isAfter(day.date, endDate)) {
|
|
1980
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
1981
|
-
startDate: day.date,
|
|
1982
|
-
endDate: undefined,
|
|
1983
|
-
});
|
|
1984
|
-
setFocusedInput("endDate");
|
|
1985
|
-
(_a = endDateInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1986
|
-
}
|
|
1987
|
-
else {
|
|
1988
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
1989
|
-
startDate: day.date,
|
|
1990
|
-
endDate: endDate,
|
|
1991
|
-
});
|
|
1992
|
-
if (firstFocusedInput === "startDate") {
|
|
1993
|
-
setFocusedInput("endDate");
|
|
1994
|
-
(_b = endDateInputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1995
|
-
}
|
|
1996
|
-
else {
|
|
1997
|
-
setTimeout(hideCalendar, 50);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
else if (focusedInput === "endDate") {
|
|
2002
|
-
if (!startDate) {
|
|
2003
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
2004
|
-
startDate: startDate,
|
|
2005
|
-
endDate: day.date,
|
|
2006
|
-
});
|
|
2007
|
-
setFocusedInput("startDate");
|
|
2008
|
-
(_c = startDateInputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
2009
|
-
}
|
|
2010
|
-
else if (dateFns.isAfter(startDate, day.date)) {
|
|
2011
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
2012
|
-
startDate: day.date,
|
|
2013
|
-
endDate: undefined,
|
|
2014
|
-
});
|
|
2015
|
-
setFocusedInput("endDate");
|
|
2016
|
-
(_d = endDateInputRef.current) === null || _d === void 0 ? void 0 : _d.focus();
|
|
2017
|
-
}
|
|
2018
|
-
else {
|
|
2019
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange({
|
|
2020
|
-
startDate: startDate,
|
|
2021
|
-
endDate: day.date,
|
|
2022
|
-
});
|
|
2023
|
-
setTimeout(hideCalendar, 50);
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
}, [
|
|
2027
|
-
focusedInput,
|
|
2028
|
-
onValueChange,
|
|
2029
|
-
endDate,
|
|
2030
|
-
firstFocusedInput,
|
|
2031
|
-
setFocusedInput,
|
|
2032
|
-
endDateInputRef,
|
|
2033
|
-
hideCalendar,
|
|
2034
|
-
startDate,
|
|
2035
|
-
startDateInputRef,
|
|
2036
|
-
]);
|
|
2037
|
-
var onClickArrowButton = React.useCallback(function () {
|
|
2038
|
-
setCurrentPanel("presets");
|
|
2039
|
-
showCalendar();
|
|
2040
|
-
}, [setCurrentPanel, showCalendar]);
|
|
2041
|
-
var onClickCalendarButton = React.useCallback(function () {
|
|
2042
|
-
var _a;
|
|
2043
|
-
if (isCalendarVisible) {
|
|
2044
|
-
hideCalendar();
|
|
2045
|
-
}
|
|
2046
|
-
else {
|
|
2047
|
-
setFocusedInput("startDate");
|
|
2048
|
-
setFirstFocusedInput("startDate");
|
|
2049
|
-
(_a = startDateInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2050
|
-
setCurrentPanel("calendar");
|
|
2051
|
-
showCalendar();
|
|
2052
|
-
}
|
|
2053
|
-
}, [
|
|
2054
|
-
isCalendarVisible,
|
|
2055
|
-
hideCalendar,
|
|
2056
|
-
setFocusedInput,
|
|
2057
|
-
setFirstFocusedInput,
|
|
2058
|
-
startDateInputRef,
|
|
2059
|
-
setCurrentPanel,
|
|
2060
|
-
showCalendar,
|
|
2061
|
-
]);
|
|
2062
|
-
var onKeyDownHandler = React.useCallback(function (ev) {
|
|
2063
|
-
if (ev.key === "Escape") {
|
|
2064
|
-
hideCalendar();
|
|
2065
|
-
}
|
|
2066
|
-
}, [hideCalendar]);
|
|
2067
|
-
return {
|
|
2068
|
-
onFocusLeft: onFocusLeft,
|
|
2069
|
-
onFocusRight: onFocusRight,
|
|
2070
|
-
onClickDay: onClickDay,
|
|
2071
|
-
onClickArrowButton: onClickArrowButton,
|
|
2072
|
-
onClickCalendarButton: onClickCalendarButton,
|
|
2073
|
-
onKeyDownHandler: onKeyDownHandler,
|
|
2074
|
-
};
|
|
2075
|
-
};
|
|
2076
|
-
|
|
2077
|
-
var DateRangeDualTextInput = function (_a) {
|
|
2078
|
-
var value = _a.value, onValueChange = _a.onValueChange, autoFocus = _a.autoFocus, onBlur = _a.onBlur, onEnter = _a.onEnter, onEsc = _a.onEsc, minDate = _a.minDate, _b = _a.maxDate, maxDate = _b === void 0 ? defaultMaxDate : _b, calendarProps = _a.calendarProps, _c = _a.widthLeft, widthLeft = _c === void 0 ? 128 : _c, _d = _a.widthRight, widthRight = _d === void 0 ? 128 : _d, variant = _a.variant, disabled = _a.disabled;
|
|
2079
|
-
var _e = value || {}, startDate = _e.startDate, endDate = _e.endDate;
|
|
2080
|
-
var startDateInputRef = React.useRef(null);
|
|
2081
|
-
var endDateInputRef = React.useRef(null);
|
|
2082
|
-
var states = useInputStates(startDate, endDate);
|
|
2083
|
-
var dateInFocus = states.dateInFocus, setDateInFocus = states.setDateInFocus, isCalendarVisible = states.isCalendarVisible, currentPanel = states.currentPanel, setCurrentPanel = states.setCurrentPanel;
|
|
2084
|
-
var _f = useDateRangeHandlers(startDate, endDate, onValueChange, states), showCalendar = _f.showCalendar, hideCalendar = _f.hideCalendar, inputLeftChangeHandler = _f.inputLeftChangeHandler, inputRightChangeHandler = _f.inputRightChangeHandler;
|
|
2085
|
-
var _g = useUserInputHandlers(startDate, endDate, onValueChange, startDateInputRef, endDateInputRef, showCalendar, hideCalendar, states), onKeyDownHandler = _g.onKeyDownHandler, onFocusRight = _g.onFocusRight, onFocusLeft = _g.onFocusLeft, onClickDay = _g.onClickDay, onClickCalendarButton = _g.onClickCalendarButton, onClickArrowButton = _g.onClickArrowButton;
|
|
2086
|
-
useDateRangeEffects(startDate, endDate, setDateInFocus, startDateInputRef, endDateInputRef);
|
|
2087
|
-
var startDateIsAfterEnd = React.useMemo(function () { return startDate && endDate && dateFns.isAfter(startDate, endDate); }, [startDate, endDate]);
|
|
2088
|
-
var statePerMonth = React.useMemo(function () {
|
|
2089
|
-
return buildDayStateForSingleMonth(calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.statePerMonth, startDate, endDate, dateInFocus);
|
|
2090
|
-
}, [calendarProps === null || calendarProps === void 0 ? void 0 : calendarProps.statePerMonth, startDate, endDate, dateInFocus]);
|
|
2091
|
-
var delayedIsCalendarVisible = core.useDelayedFalse(isCalendarVisible, 300);
|
|
2092
|
-
return (React__namespace.createElement(core.Box, { onKeyDown: onKeyDownHandler },
|
|
2093
|
-
React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, disabled: disabled, placement: defaultPopoverPlacement, onClickOutside: hideCalendar, visible: isCalendarVisible, content: delayedIsCalendarVisible && (React__namespace.createElement(CalendarWithMonthSwitcher, __assign({ onClickDay: onClickDay, dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, minDate: minDate, maxDate: maxDate }, calendarProps, { statePerMonth: statePerMonth }))) },
|
|
2094
|
-
React__namespace.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: elements.stenaArrowRight, typeLeft: "date", typeRight: "date", placeholderLeft: "Start date", placeholderRight: "End date", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: startDateInputRef, inputRefRight: endDateInputRef, variant: startDateIsAfterEnd ? "error" : variant, widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate, minRight: minDate, maxRight: maxDate }))));
|
|
2095
|
-
};
|
|
2096
|
-
|
|
2097
|
-
exports.Calendar = Calendar;
|
|
2098
|
-
exports.CalendarDay = CalendarDay;
|
|
2099
|
-
exports.DateInput = DateInput;
|
|
2100
|
-
exports.DateRangeCalendar = DateRangeCalendar;
|
|
2101
|
-
exports.DateRangeDualTextInput = DateRangeDualTextInput;
|
|
2102
|
-
exports.DateRangeExclusionCalendar = DateRangeExclusionCalendar;
|
|
2103
|
-
exports.DateRangeInput = DateRangeInput;
|
|
2104
|
-
exports.DateTextInput = DateTextInput;
|
|
2105
|
-
exports.DateTimeInput = DateTimeInput;
|
|
2106
|
-
exports.MonthPicker = MonthPicker;
|
|
2107
|
-
exports.MultiDateCalendar = MultiDateCalendar;
|
|
2108
|
-
exports.PresetPicker = PresetPicker;
|
|
2109
|
-
exports.SingleDateCalendar = SingleDateCalendar;
|
|
2110
|
-
exports.SingleWeekCalendar = SingleWeekCalendar;
|
|
2111
|
-
exports.TimeTextInput = TimeTextInput;
|
|
2112
|
-
exports.WeekDayCell = WeekDayCell;
|
|
2113
|
-
exports.WeekNumberCell = WeekNumberCell;
|
|
2114
|
-
exports.YearPicker = YearPicker;
|
|
2115
|
-
exports.addDayStateHighlights = addDayStateHighlights;
|
|
2116
|
-
exports.addDayStateHighlightsOnSingleDay = addDayStateHighlightsOnSingleDay;
|
|
2117
|
-
exports.addWeekRangeHighlights = addWeekRangeHighlights;
|
|
2118
|
-
exports.addWeekStateHighlights = addWeekStateHighlights;
|
|
2119
|
-
exports.buildDayStateForDateRange = buildDayStateForDateRange;
|
|
2120
|
-
exports.buildDayStateForRange = buildDayStateForRange;
|
|
2121
|
-
exports.buildDayStateForSingleMonth = buildDayStateForSingleMonth;
|
|
2122
|
-
exports.calculateOverflowingMonth = calculateOverflowingMonth;
|
|
2123
|
-
exports.createDay = createDay;
|
|
2124
|
-
exports.dateRangeToStrings = dateRangeToStrings;
|
|
2125
|
-
exports.dayHasHighlight = dayHasHighlight;
|
|
2126
|
-
exports.dayHighlightSelect = dayHighlightSelect;
|
|
2127
|
-
exports.defaultCalendarTheme = defaultCalendarTheme;
|
|
2128
|
-
exports.defaultTextPropsProvider = defaultTextPropsProvider;
|
|
2129
|
-
exports.defaultWrapperStyleProvider = defaultWrapperStyleProvider;
|
|
2130
|
-
exports.extranetCalendarTheme = extranetCalendarTheme;
|
|
2131
|
-
exports.getDaysForWeekForDate = getDaysForWeekForDate;
|
|
2132
|
-
exports.getMonthInYear = getMonthInYear;
|
|
2133
|
-
exports.getMonthsInYear = getMonthsInYear;
|
|
2134
|
-
exports.getStartDateOfISOWeek = getStartDateOfISOWeek;
|
|
2135
|
-
exports.getWeekForDate = getWeekForDate;
|
|
2136
|
-
exports.getWeeksForMonth = getWeeksForMonth;
|
|
2137
|
-
exports.isDateRangeInvalid = isDateRangeInvalid;
|
|
2138
|
-
exports.setDayStateValue = setDayStateValue;
|
|
2139
|
-
exports.setDayStateValueFunction = setDayStateValueFunction;
|
|
2140
|
-
exports.stringsToDateRange = stringsToDateRange;
|
|
2141
|
-
exports.toggleDateStringsIfEndIsEarlierThanStart = toggleDateStringsIfEndIsEarlierThanStart;
|
|
2142
|
-
exports.toggleDatesIfEndIsEarlierThanStart = toggleDatesIfEndIsEarlierThanStart;
|
|
2143
|
-
exports.useDateRangeCalendarState = useDateRangeCalendarState;
|
|
2144
|
-
exports.useDateRangeExclusionSelection = useDateRangeExclusionSelection;
|
|
2145
|
-
exports.useDateRangeSelection = useDateRangeSelection;
|
|
2146
|
-
exports.useMultiDateSelection = useMultiDateSelection;
|
|
2147
|
-
exports.useSingleDateSelection = useSingleDateSelection;
|
|
2148
|
-
exports.useSingleWeekSelection = useSingleWeekSelection;
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("._calendar_1w0de_1{--swui-calendar-day-width: 40px;--swui-calendar-day-height: 38px;--swui-calendar-day-border-radius: 4px;--swui-calendar-week-number-bg-color: transparent;--swui-calendar-week-number-text-color: var(--lhds-color-ui-500);--swui-calendar-week-number-clickable-text-color: var(--lhds-color-ui-500);--swui-calendar-week-day-text-color: var(--lhds-color-ui-500);--swui-calendar-week-day-clickable-text-color: var(--lhds-color-ui-500);--swui-calendar-wrapper-selected-border: var(--swui-primary-action-color);--swui-calendar-wrapper-selected-background: var(--swui-primary-action-color);--swui-calendar-wrapper-range-border: var(--lhds-color-blue-100);--swui-calendar-wrapper-range-background: var(--lhds-color-blue-100);--swui-calendar-wrapper-today-border: var(--lhds-color-ui-200);--swui-calendar-wrapper-today-background: var(--lhds-color-ui-200);--swui-calendar-text-selected-color: #fff;--swui-calendar-text-disabled-color: var(--swui-text-disabled-color);--swui-calendar-text-in-other-month-color: var(--swui-text-disabled-color)}._calendar_1w0de_1 table{border-spacing:0 4px}._calendar_1w0de_1 span{line-height:100%}._calendar_1w0de_1 tr td:last-child{border-top-right-radius:var(--swui-calendar-day-border-radius);border-bottom-right-radius:var(--swui-calendar-day-border-radius)}._calendar_1w0de_1 tr td:nth-child(2){border-top-left-radius:var(--swui-calendar-day-border-radius);border-bottom-left-radius:var(--swui-calendar-day-border-radius)}._calendar_1w0de_1 td{padding:0;width:var(--swui-calendar-day-width);height:var(--swui-calendar-day-height)}._timePicker_1w05d_1{overflow:hidden;width:180px}._timePickerColumn_1w05d_6{overflow-y:hidden;flex:1}._timePickerColumn_1w05d_6:hover{overflow-y:scroll}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var j=require("@stenajs-webui/elements"),D=require("@stenajs-webui/core"),f=require("date-fns"),J=require("lodash"),o=require("react"),c=require("react/jsx-runtime"),rt=require("@emotion/styled"),pe=require("@fortawesome/free-solid-svg-icons/faAngleDoubleLeft"),Ce=require("@fortawesome/free-solid-svg-icons/faAngleDoubleRight"),st=require("@fortawesome/free-solid-svg-icons/faCaretLeft"),ct=require("@fortawesome/free-solid-svg-icons/faCaretRight"),$=require("@stenajs-webui/forms"),Q=require("@stenajs-webui/tooltip"),Me=require("@stenajs-webui/theme"),it=require("@fortawesome/free-solid-svg-icons/faLongArrowAltRight");function ot(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}function at(e){if(e&&e.__esModule)return e;var t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var Re=at(o),fe=ot(rt);const F={yearAndMonth:"yyyy-MM",fullDate:"yyyy-MM-dd",fullMonthName:"LLLL",fullDateAndTime:"yyyy-MM-dd HH:mm",fullDateAndTimeSystem:"yyyy-MM-ddTHH:MM",weekDayName:"EEEE",weekDayNameShort:"EEE",dateAndMonth:"d MMM",monthAndDate:"MMM do"},G=(e={},t,n)=>{if(t&&n&&f.isAfter(n,t))return f.eachDayOfInterval({start:t,end:n}).reduce((s,i)=>{const l=f.isSameDay(i,t),a=f.isSameDay(i,n);return O(s,i,l?["selected","selectedStart","range"]:a?["selected","selectedEnd","range"]:["range"])},e);let r=e;return t&&(r=O(r,t,["selected","singleSelected"])),n&&(r=O(r,n,["selected","singleSelected"])),r},Ee=(e={},t,n,r)=>Te(e,t,n,f.startOfMonth(r),f.endOfMonth(r)),Te=(e={},t,n,r,s)=>t&&n?G(e,f.max([t,f.subDays(r,1)]),f.min([n,f.addDays(s,1)])):G(e,t,n),lt=(e,t,n)=>{const r=f.format(t,F.yearAndMonth),s=f.getISOWeek(t),i=f.getDate(t);return{...e,[r]:{...e&&e[r],[s]:{...e&&e[r]&&e[r][s],[i]:{...e&&e[r]&&e[r][s]&&e[r][s][i],...n}}}}},dt=(e,t,n)=>{const r=f.format(t,F.yearAndMonth),s=f.getISOWeek(t),i=f.getDate(t);return{...e,[r]:{...e&&e[r],[s]:{...e&&e[r]&&e[r][s],[i]:{...e&&e[r]&&e[r][s]&&e[r][s][i],...n(e&&e[r]&&e[r][s]&&e[r][s][i])}}}}},O=(e,t,n)=>{const r=t.getMonth()+1,s=`${t.getFullYear()}-${r<10?"0":""}${r}`,i=f.getISOWeek(t),l=f.getDate(t),a=e&&e[s]&&e[s][i]&&e[s][i][l];return{...e,[s]:{...e&&e[s],[i]:{...e&&e[s]&&e[s][i],[l]:he(a,n)}}}},he=(e,t)=>{var n;return{...e,highlights:[...(n=e==null?void 0:e.highlights)!=null?n:[],...t]}},ut=(e,t,n)=>{const r=t.days[0].date,s=r.getMonth()+1,i=`${r.getFullYear()}-${s<10?"0":""}${s}`,l=t.weekNumber;let a=e;t.days.forEach(y=>{a=O(a,y.date,n)});const d=a&&a[i]?a[i][l]:void 0,u=d&&d.highlights?[...d.highlights,...n]:n,x={...d,highlights:u};return{...a,[i]:{...e&&e[i],[l]:x}}},Ae=(e,t)=>{var s;if(!t.days.length)return{...e};const n=t.days[0].date,r=(s=J.last(t.days))==null?void 0:s.date;return{...G(e,n,r)}},ft=(e,t)=>o.useMemo(()=>e?O(t,new Date,["today"]):t,[e,t]);var B=(e=>(e[e.JANUARY=0]="JANUARY",e[e.FEBRUARY=1]="FEBRUARY",e[e.MARCH=2]="MARCH",e[e.APRIL=3]="APRIL",e[e.MAY=4]="MAY",e[e.JUNE=5]="JUNE",e[e.JULY=6]="JULY",e[e.AUGUST=7]="AUGUST",e[e.SEPTEMBER=8]="SEPTEMBER",e[e.OCTOBER=9]="OCTOBER",e[e.NOVEMBER=10]="NOVEMBER",e[e.DECEMBER=11]="DECEMBER",e))(B||{}),Ie=(e=>(e[e.SUNDAY=0]="SUNDAY",e[e.MONDAY=1]="MONDAY",e[e.TUESDAY=2]="TUESDAY",e[e.WEDNESDAY=3]="WEDNESDAY",e[e.THURSDAY=4]="THURSDAY",e[e.FRIDAY=5]="FRIDAY",e[e.SATURDAY=6]="SATURDAY",e))(Ie||{});const xe=(e,t,n)=>{const r=[];for(let s=0;s<n;s++)r.push(ye(e,t+s));return r},ye=(e,t)=>{const n=e+Math.floor(t/12),r=t%12,s=new Date(n,r,1);return{monthString:f.format(s,F.yearAndMonth),name:f.format(s,F.fullMonthName),year:n,monthInYear:r,weeks:Be(n,r)}},Be=(e,t,n=!0)=>{const r=new Date(e,t,1),s=f.startOfISOWeek(r),i=[];for(let l=0;l<6;l++){const a=ue(f.addWeeks(s,l));if(l>0&&a.startMonth!==t&&!n)return i;i.push(a)}return i},ue=e=>{const t=f.getMonth(f.addDays(e,7))!==f.getMonth(e);return{weekNumber:f.getISOWeek(e),startMonth:f.getMonth(e),startYear:f.getYear(e),endMonth:f.getMonth(f.addDays(e,6)),endYear:f.getYear(f.addDays(e,6)),days:He(e),isLastWeekOfMonth:t}},Ne=e=>{const t=f.getISODay(e);return{date:e,name:f.format(e,"EEE"),dateString:f.format(f.addHours(e,12),F.fullDate),weekNumber:f.getISOWeek(e),year:f.getYear(e),month:f.getMonth(e),dayOfMonth:f.getDate(e),dayOfWeek:t,isFirstDayOfWeek:t===1,isLastDayOfWeek:t===7,isFirstDayOfMonth:f.isSameDay(f.startOfMonth(e),e),isLastDayOfMonth:f.isSameDay(f.endOfMonth(e),e)}},He=e=>f.eachDayOfInterval({start:e,end:f.addDays(e,6)}).map(Ne),Le=(e,t)=>{const n=new Date(t,0,1+(e-1)*7),r=n.getDay(),s=n;return r<=4?s.setDate(n.getDate()-n.getDay()+1):s.setDate(n.getDate()+8-n.getDay()),s},Ye=(e,t)=>t>11?{year:e+Math.floor(t/12),month:t%12}:t<0?{year:e+Math.floor(t/12),month:12+t%12}:{year:e,month:t},Oe=(e,t,n)=>!!(t&&t.indexOf(n)>=0||e&&e.highlights&&e.highlights.indexOf(n)>=0),U=(e,t,n,r,s)=>{if(n.length!==r.length)throw new Error("Select highlight failed, number of values do not equal number of highlights.");if(n.length===0)return s;for(let i=0;i<n.length;i++)if(typeof n[i]=="boolean"&&n[i]||typeof n[i]=="string"&&Oe(e,t,n[i]))return r[i];return s},We=({selectedBackground:e,todayBackground:t,rangeBackground:n,borderColor:r="transparent"})=>(s,i,l,a,d)=>{let u={};const x=U(i,s,["selected","range","today",l.month===d.monthInYear],[e,n,t,"#fff"],"transparent");return{...u,backgroundColor:x,borderTopLeftRadius:U(i,s,["selectedStart","singleSelected"],["var(--swui-calendar-day-border-radius)","var(--swui-calendar-day-border-radius)"],r),borderBottomLeftRadius:U(i,s,["selectedStart","singleSelected"],["var(--swui-calendar-day-border-radius)","var(--swui-calendar-day-border-radius)"],r),borderTopRightRadius:U(i,s,["selectedEnd","singleSelected"],["var(--swui-calendar-day-border-radius)","var(--swui-calendar-day-border-radius)"],r),borderBottomRightRadius:U(i,s,["selectedEnd","singleSelected"],["var(--swui-calendar-day-border-radius)","var(--swui-calendar-day-border-radius)"],r),boxSizing:"border-box"}},Pe=({selectedColor:e,disabledColor:t,inOtherMonthColor:n,rangeTextColor:r})=>(s,i,l,a,d)=>{const u=l.month!==d.monthInYear;return{color:U(i,s,[u,"selected","range","enabled","disabled"],[n,e,r,void 0,t])}},z={width:"var(--swui-calendar-day-width)",height:"var(--swui-calendar-day-height)",WeekNumber:{backgroundColor:"var(--swui-calendar-week-number-bg-color)",textColor:"var(--swui-calendar-week-number-text-color)",clickableTextColor:"var(--swui-calendar-week-number-clickable-text-color)",show:!0},WeekDay:{textColor:"var(--swui-calendar-week-day-text-color)",clickableTextColor:"var(--swui-calendar-week-day-clickable-text-color)"},CalendarDay:{tdStyle:We({selectedBackground:"var(--swui-calendar-wrapper-selected-background)",rangeBackground:"var(--swui-calendar-wrapper-range-background)",todayBackground:"var(--swui-calendar-wrapper-today-background)"}),textProps:Pe({selectedColor:"var(--swui-calendar-text-selected-color)",disabledColor:"var(--swui-calendar-text-disabled-color)",inOtherMonthColor:"var(--swui-calendar-text-in-other-month-color)"})},CalendarMonth:{headerTextColor:"var(--swui-calendar-week-day-text-color)"}},Dt={...z,width:"37px",height:"37px"},xt=(e,t,n)=>t&&f.isBefore(e,t)?f.isSameDay(e,t):n&&f.isAfter(e,n)?f.isSameDay(e,n):!0,gt=function({dayComponent:t,minDate:n,maxDate:r,dayState:s,day:i,...l}){const a=o.useMemo(()=>xt(i.date,n,r)?s:he(s,["disabled"]),[i.date,s,r,n]);return c.jsx(t,{day:i,...l,dayState:a})},Ue=({onClickWeek:e,theme:t,week:n,background:r,backgroundColor:s,prefix:i})=>{const l=c.jsxs(D.Box,{width:t.width,height:t.height,justifyContent:"center",alignItems:"center",children:[r&&c.jsx(D.Box,{position:"absolute",children:r}),c.jsx(D.Box,{position:"absolute",children:c.jsxs(D.Text,{color:e?t.WeekNumber.clickableTextColor:t.WeekNumber.textColor,children:[i,n.weekNumber]})})]});return c.jsx(D.Box,{background:s||t.WeekNumber.backgroundColor,position:"relative",children:e?c.jsx(D.Clickable,{borderRadius:"var(--swui-calendar-day-border-radius)",onClick:a=>e(n,a),disableFocusHighlight:!e,children:l}):l})};function ht({week:e,month:t,dayComponent:n,statePerWeekDay:r,userDataPerWeekDay:s,minDate:i,maxDate:l,onClickWeek:a,onClickDay:d,theme:u,renderWeekNumber:x,extraDayContent:y,defaultHighlights:g}){return c.jsxs("tr",{children:[u.WeekNumber.show&&c.jsx("td",{children:x?x(e,u,a):c.jsx(Ue,{week:e,onClickWeek:a,theme:u})}),e.days.map(h=>c.jsx(gt,{dayComponent:n,day:h,week:e,month:t,dayState:r&&r[h.dayOfMonth],userData:s&&s[h.dayOfMonth],onClickDay:d,theme:u,extraDayContent:y,defaultHighlights:g,minDate:i,maxDate:l},h.dateString))]},e.weekNumber)}const $e=({onClickWeekDay:e,day:t,theme:n})=>{const r=c.jsx(D.Box,{width:n.width,height:n.height,justifyContent:"center",alignItems:"center",children:c.jsx(D.Text,{size:"small",color:e?n.WeekDay.clickableTextColor:n.WeekDay.textColor,children:t.name})});return e?c.jsx(D.Clickable,{borderRadius:"var(--swui-calendar-day-border-radius)",onClick:s=>e(t.dayOfWeek,s),disableFocusHighlight:!e,children:r}):r},be=function({day:t,week:n,month:r,dayState:s,userData:i,onClickDay:l,theme:a,extraDayContent:d,defaultHighlights:u}){const x=c.jsx(D.Box,{width:"100%",height:"100%",justifyContent:"center",alignItems:"center",children:c.jsx(D.Text,{...a.CalendarDay.textProps&&a.CalendarDay.textProps(u,s,t,n,r,i),children:t.dayOfMonth})}),y=fe.default.td({...a.CalendarDay.tdStyle&&a.CalendarDay.tdStyle(u,s,t,n,r,i)}),g=fe.default.div({...a.CalendarDay.innerWrapperStyle&&a.CalendarDay.innerWrapperStyle(u,s,t,n,r,i),width:"100%",height:"100%"}),h=fe.default.div({...a.CalendarDay.cellWrapperStyle&&a.CalendarDay.cellWrapperStyle(u,s,t,n,r,i),width:"100%",height:"100%",position:"relative"});return c.jsx(y,{children:c.jsx(g,{children:c.jsx(h,{children:t.month===r.monthInYear&&c.jsxs(c.Fragment,{children:[d&&c.jsx(d,{week:n,month:r,day:t,dayState:s,theme:a,userData:i}),l&&yt(u,s)?c.jsx(D.Clickable,{onClick:m=>l(t,i,m),style:{width:"100%",height:"100%"},borderRadius:"var(--swui-calendar-day-border-radius)",children:x}):c.jsx(c.Fragment,{children:x})]})})})})},yt=(e,t)=>!!U(t,e,["enabled","disabled"],[!0,!1],!0);function bt({month:e,dayComponent:t=be,statePerWeek:n,userDataPerWeek:r,minDate:s,maxDate:i,onClickDay:l,onClickWeek:a,onClickWeekDay:d,onClickMonth:u,onClickYear:x,renderWeekNumber:y,renderWeekDay:g,headerLeftContent:h,headerRightContent:m,theme:p=z,extraDayContent:w,defaultHighlights:S}){const k=p.WeekNumber.show;return c.jsx(c.Fragment,{children:c.jsxs(D.Box,{alignItems:"stretch",children:[c.jsxs(D.Row,{justifyContent:"space-between",alignItems:"center",height:"32px",children:[c.jsx(D.Box,{alignItems:"center",children:h}),c.jsxs(D.Row,{alignItems:"center",children:[c.jsx(D.Row,{width:"104px",justifyContent:"center",children:u?c.jsx(j.FlatButton,{onClick:()=>u(e),label:e.name}):c.jsx(D.Text,{children:e.name})}),c.jsx(D.Space,{}),c.jsx(D.Row,{width:"64px",justifyContent:"center",children:x?c.jsx(j.FlatButton,{onClick:()=>x(e.year),label:String(e.year)}):c.jsx(D.Text,{children:e.year})})]}),c.jsx(D.Box,{alignItems:"center",children:m})]}),c.jsx("table",{children:c.jsxs("tbody",{children:[c.jsxs("tr",{children:[k&&c.jsx("td",{children:c.jsx(D.Box,{width:p.width,height:p.height,justifyContent:"center",alignItems:"center",children:c.jsx(D.Text,{size:"small",color:p.CalendarMonth.headerTextColor,children:"W"})})}),e.weeks[0].days.map(b=>c.jsx("td",{children:g?g(b.name,p,d):c.jsx($e,{day:b,onClickWeekDay:d,theme:p})},b.name))]}),e.weeks.map(b=>c.jsx(ht,{month:e,week:b,dayComponent:t,statePerWeekDay:n&&n[b.weekNumber],userDataPerWeekDay:r&&r[b.weekNumber],onClickDay:l,onClickWeek:a,theme:p,renderWeekNumber:y,extraDayContent:w,defaultHighlights:S,minDate:s,maxDate:i},b.weekNumber))]})})]})})}const mt="_calendar_1w0de_1";var jt={calendar:mt};function kt({monthRows:e,dayComponent:t=be,userDataPerMonth:n,statePerMonth:r,minDate:s,maxDate:i,onClickDay:l,onClickWeekDay:a,onClickWeek:d,onClickMonth:u,onClickYear:x,renderWeekDay:y,renderWeekNumber:g,headerLeftContent:h,headerRightContent:m,extraDayContent:p,defaultHighlights:w,theme:S=z}){const k=o.useMemo(()=>s?f.parse(s,"yyyy-MM-dd",new Date):void 0,[s]),b=o.useMemo(()=>i?f.parse(i,"yyyy-MM-dd",new Date):void 0,[i]);return c.jsx("div",{className:jt.calendar,children:e.map((C,M)=>c.jsx(D.Spacing,{children:c.jsx(D.Row,{children:C.map((R,E)=>c.jsxs(Re.Fragment,{children:[E>0&&c.jsx(D.Space,{}),c.jsx(bt,{month:R,dayComponent:t,userDataPerWeek:n&&n[R.monthString],statePerWeek:r&&r[R.monthString],onClickDay:l,onClickWeekDay:a,onClickWeek:d,onClickMonth:u,onClickYear:x,theme:S,renderWeekNumber:g,renderWeekDay:y,headerLeftContent:h,headerRightContent:m,extraDayContent:p,defaultHighlights:w,minDate:k,maxDate:b})]},R.name))})},M))})}function ae(e){const t=wt(e.year,e.month,e.date),{year:n,month:r}=Ye(t.year,t.month),s=St(n,r,e.numMonths,e.monthsPerRow),i=ft(e.highlightToday,e.statePerMonth);return c.jsx(kt,{year:n,month:r,monthRows:s,...e,statePerMonth:i})}const wt=(e,t,n)=>{if(t&&e)return{month:t,year:e};if(n)return{month:f.getMonth(n),year:f.getYear(n)};const r=new Date;return{month:f.getMonth(r),year:f.getYear(r)}},St=(e,t,n,r)=>n==null?[[ye(e,t)]]:r==null?[xe(e,t,n)]:J.chunk(xe(e,t,n),r),pt=(e,t,n,r)=>{const s=o.useCallback(()=>{var u;const d=f.addMonths(e,(u=n!=null?n:r)!=null?u:1);t==null||t(d)},[t,e,n,r]),i=o.useCallback(()=>{const d=f.addYears(e,1);t==null||t(d)},[t,e]),l=o.useCallback(()=>{var u;const d=f.subMonths(e,(u=n!=null?n:r)!=null?u:1);t==null||t(d)},[t,e,n,r]),a=o.useCallback(()=>{const d=f.subYears(e,1);t==null||t(d)},[t,e]);return{nextMonth:s,prevMonth:l,nextYear:i,prevYear:a}},Ct=({children:e,prevMonth:t,nextMonth:n,prevYear:r,nextYear:s})=>c.jsxs("div",{children:[e,c.jsx(D.Indent,{children:c.jsxs(D.Row,{children:[c.jsx(j.FlatButton,{onClick:r,leftIcon:pe.faAngleDoubleLeft}),c.jsx(D.Space,{}),c.jsx(j.FlatButton,{onClick:t,leftIcon:j.stenaAngleLeft}),c.jsx(D.Indent,{num:2}),c.jsx(j.FlatButton,{onClick:n,leftIcon:j.stenaAngleRight}),c.jsx(D.Space,{}),c.jsx(j.FlatButton,{onClick:s,leftIcon:Ce.faAngleDoubleRight})]})}),c.jsx(D.Space,{})]}),Mt=({value:e,onValueChange:t,month:n})=>{const r=o.useMemo(()=>{const s=new Date(2e3,n,1);return f.format(s,"MMM")},[n]);return c.jsx(D.Row,{width:"64px",justifyContent:"center",spacing:.5,indent:.5,children:e===n?c.jsx(j.PrimaryButton,{label:r,onClick:()=>t&&t(n)}):c.jsx(j.FlatButton,{label:r,onClick:()=>t&&t(n)})})},Rt=[[B.JANUARY,B.FEBRUARY,B.MARCH],[B.APRIL,B.MAY,B.JUNE],[B.JULY,B.AUGUST,B.SEPTEMBER],[B.OCTOBER,B.NOVEMBER,B.DECEMBER]],Fe=({value:e,onValueChange:t})=>c.jsx(D.Column,{children:Rt.map(n=>c.jsx(D.Row,{children:n.map(r=>c.jsx(Mt,{month:r,onValueChange:t,value:e},r))},n[0]))}),Et=e=>[{label:"Past",presets:[{label:"Last 3 days",startDate:e,endDate:f.subDays(e,2)},{label:"Last 7 days",startDate:e,endDate:f.subDays(e,6)},{label:"Last 30 days",startDate:e,endDate:f.subDays(e,29)},{label:"Last 45 days",startDate:e,endDate:f.subDays(e,44)}]},{label:"Future",presets:[{label:"Next 3 days",startDate:e,endDate:f.addDays(e,2)},{label:"Next 7 days",startDate:e,endDate:f.addDays(e,6)},{label:"Next 30 days",startDate:e,endDate:f.addDays(e,29)},{label:"Next 45 days",startDate:e,endDate:f.addDays(e,44)}]}],ze=({onClickPreset:e})=>{var i;const[t,n]=o.useState(0),r=o.useMemo(()=>Et(new Date),[]),s=(i=r[t])!=null?i:r[0];return c.jsxs(D.Column,{children:[c.jsxs(D.Row,{justifyContent:"space-between",alignItems:"center",width:"200px",children:[c.jsx(j.FlatButton,{size:"small",leftIcon:j.stenaAngleLeft,disabled:t===0,onClick:()=>n(t-1)}),c.jsx(D.Text,{children:s.label}),c.jsx(j.FlatButton,{size:"small",leftIcon:j.stenaAngleRight,disabled:t===r.length-1,onClick:()=>n(t+1)})]}),c.jsx(D.Space,{}),c.jsx(D.Column,{alignItems:"center",children:s.presets.map(l=>c.jsxs(Re.Fragment,{children:[c.jsx(j.PrimaryButton,{label:l.label,onClick:()=>e(l)}),c.jsx(D.Space,{})]},l.label))})]})},Tt=({value:e,onValueChange:t,year:n})=>{const r=String(n);return c.jsx(D.Row,{width:"64px",justifyContent:"center",spacing:.5,indent:.5,children:e===n?c.jsx(j.PrimaryButton,{label:r,onClick:()=>t==null?void 0:t(n)}):c.jsx(j.FlatButton,{label:r,onClick:()=>t==null?void 0:t(n)})})},_e=({value:e,onValueChange:t,initialLastYear:n})=>{const[r,s]=o.useState(()=>e?e+4:n!=null?n:new Date().getFullYear()+4),i=o.useMemo(()=>{const l=r-11;return J.chunk(J.range(l,r+1),3)},[r]);return o.useEffect(()=>{s(l=>At(e,l))},[e]),c.jsxs(D.Row,{children:[c.jsx(D.Column,{justifyContent:"center",children:c.jsx(j.FlatButton,{leftIcon:st.faCaretLeft,onClick:()=>s(r-3)})}),c.jsx(D.Column,{children:i.map(l=>c.jsx(D.Row,{children:l.map(a=>c.jsx(Tt,{year:a,onValueChange:t,value:e},a))},l[0]))}),c.jsx(D.Column,{justifyContent:"center",children:c.jsx(j.FlatButton,{leftIcon:ct.faCaretRight,onClick:()=>s(r+3)})})]})},At=(e,t)=>{if(e==null)return t;if(e>t){const r=e-t,s=r%3,i=r-s+3;return t+i}const n=t-11;if(e<n){const r=n-e,s=r%3,i=r-s+3;return t-i}return t},It=function({dateInFocus:t,setDateInFocus:n,currentPanel:r,setCurrentPanel:s,...i}){const l=o.useCallback(x=>{const y=t?new Date(t):new Date;y.setMonth(x),n&&n(y),s("calendar")},[t,n,s]),a=o.useCallback(x=>{const y=t?new Date(t):new Date;y.setFullYear(x),n&&n(y),s("calendar")},[t,n,s]),d=o.useCallback(()=>{s("year")},[s]),u=o.useCallback(()=>{s("month")},[s]);switch(r){case"calendar":return c.jsx(c.Fragment,{children:c.jsx(ae,{...i,date:t,onClickYear:d,onClickMonth:u})});case"month":return c.jsx(Fe,{value:t.getMonth(),onValueChange:l});case"year":return c.jsx(_e,{value:t.getFullYear(),onValueChange:a});case"presets":return c.jsx(ze,{onClickPreset:()=>{}});default:return c.jsx(D.Box,{children:c.jsx(j.PrimaryButton,{label:"Show calendar",onClick:()=>s("calendar")})})}},Bt=()=>{};function _({monthSwitcherPlacement:e,theme:t=z,dateInFocus:n,setDateInFocus:r,currentPanel:s,setCurrentPanel:i,onSelectPreset:l=Bt,hideYearPagination:a=!1,...d}){const{nextMonth:u,prevMonth:x,nextYear:y,prevYear:g}=pt(n,r,d.monthsPerRow,d.numMonths);switch(Nt(e,d.numMonths)){case"below":return c.jsx(Ct,{theme:t,nextMonth:u,prevMonth:x,nextYear:y,prevYear:g,children:c.jsx(ae,{...d,theme:t,date:n})});case"header":return c.jsx(D.Column,{children:c.jsx(It,{...d,theme:t,dateInFocus:n,setDateInFocus:r,currentPanel:s,setCurrentPanel:i,onSelectPreset:l,headerLeftContent:c.jsxs(D.Row,{alignItems:"center",children:[!a&&c.jsx(j.FlatButton,{size:"small",onClick:g,leftIcon:pe.faAngleDoubleLeft}),c.jsx(D.Space,{}),c.jsx(j.FlatButton,{size:"small",onClick:x,leftIcon:j.stenaAngleLeft})]}),headerRightContent:c.jsxs(D.Row,{alignItems:"center",children:[c.jsx(j.FlatButton,{size:"small",onClick:u,leftIcon:j.stenaAngleRight}),c.jsx(D.Space,{}),!a&&c.jsx(j.FlatButton,{size:"small",onClick:y,leftIcon:Ce.faAngleDoubleRight})]})})});default:return c.jsx(ae,{...d,theme:t,date:n})}}const Nt=(e,t)=>e||(t||1)>1?"below":"header",qe=e=>({startDate:e.startDate?f.format(e.startDate,"yyyy-MM-dd"):void 0,endDate:e.endDate?f.format(e.endDate,"yyyy-MM-dd"):void 0}),Je=({startDate:e,endDate:t})=>{const n=new Date;return{startDate:e?f.parse(e,"yyyy-MM-dd",n):void 0,endDate:t?f.parse(t,"yyyy-MM-dd",n):void 0}},me=({startDate:e,endDate:t})=>Boolean(e&&t&&!f.isSameDay(e,t)&&f.isAfter(e,t)),je=e=>me(e)?{startDate:e.endDate,endDate:e.startDate}:e,Ht=e=>e.startDate&&e.endDate?qe(je(Je(e))):e,Ke=(e,t,n,r)=>o.useCallback(s=>{const i={startDate:n==="startDate"?s.date:e==null?void 0:e.startDate,endDate:n==="endDate"?s.date:e==null?void 0:e.endDate};me(i)||r(n==="startDate"?"endDate":"startDate"),t==null||t(je(i))},[n,t,r,e==null?void 0:e.endDate,e==null?void 0:e.startDate]),te=e=>{const[t,n]=o.useState("calendar"),r=o.useCallback(s=>{n(s),e==null||e(s)},[e]);return{currentPanel:t,setCurrentPanel:r}},ve=({focusedInput:e,value:t,onValueChange:n,setFocusedInput:r,statePerMonth:s,onChangePanel:i})=>{const{currentPanel:l,setCurrentPanel:a}=te(i),[d,u]=o.useState(()=>new Date),x=Ke(t,n,e,r),y=o.useMemo(()=>G(s,t==null?void 0:t.startDate,t==null?void 0:t.endDate),[s,t==null?void 0:t.endDate,t==null?void 0:t.startDate]);return{onClickDay:x,statePerMonth:y,currentPanel:l,setCurrentPanel:a,setDateInFocus:u,dateInFocus:d}};function Lt(e){const t=ve(e);return c.jsx(_,{...e,...t})}const Yt=()=>{const[e,t]=o.useState(),[n,r]=o.useState(),[s,i]=o.useState("startDate");return{startDate:e,setStartDate:t,endDate:n,setEndDate:r,focusedInput:s,setFocusedInput:i}},Ge=({onChange:e,value:t,statePerMonth:n,onChangePanel:r})=>{const{currentPanel:s,setCurrentPanel:i}=te(r),[l,a]=o.useState(()=>t!=null?t:new Date),d=o.useCallback(x=>{e&&e(x.date)},[e]),u=o.useMemo(()=>t?O(n,t,["selected","singleSelected"]):n,[n,t]);return{onClickDay:d,statePerMonth:u,date:t,currentPanel:s,setCurrentPanel:i,dateInFocus:l,setDateInFocus:a}};function ke(e){const t=Ge(e);return c.jsx(_,{...e,...t})}const Qe=({onChange:e,value:t,statePerMonth:n,onChangePanel:r})=>{const{currentPanel:s,setCurrentPanel:i}=te(r),[l,a]=o.useState(()=>new Date),d=o.useCallback(x=>{if(!e)return;const y=t&&t.find(g=>f.isSameDay(g,x.date));e(t&&y?t.filter(g=>!f.isSameDay(g,x.date)):[...t||[],x.date])},[e,t]),u=o.useMemo(()=>t?t.reduce((x,y)=>O(x,y,["selected"]),n):n,[n,t]);return{onClickDay:d,statePerMonth:u,currentPanel:s,setCurrentPanel:i,dateInFocus:l,setDateInFocus:a}};function Ot(e){const t=Qe(e);return c.jsx(_,{...e,...t})}const Xe=({onChange:e,value:t,statePerMonth:n,onChangePanel:r})=>{const[s,i]=o.useState(()=>{const g=De(t);return g?g.days[0].date:new Date}),{currentPanel:l,setCurrentPanel:a}=te(r),d=o.useCallback(g=>{e&&e(we(ue(g.date)))},[e]),u=o.useCallback(g=>{e&&e(we(g))},[e]),x=o.useMemo(()=>{const g=De(t);return g?Ae(n,g):n},[t,n]),y=o.useMemo(()=>{const g=De(t);return g?g.days[0].date:new Date},[t]);return{statePerMonth:x,date:y,dateInFocus:s,setDateInFocus:i,onClickDay:d,onClickWeek:u,currentPanel:l,setCurrentPanel:a}},we=e=>{if(!!e)return`${e.endYear}-${e.weekNumber}`},De=e=>{if(!e)return;const t=e.split("-"),n=parseInt(t[1],10),r=parseInt(t[0],10);return ue(Le(n,r))};function Wt(e){const t=Xe(e);return c.jsx(_,{...e,...t})}const Pt=(e,t)=>e.filter(n=>!f.isSameDay(n,t)),Ut=(e,t)=>!!e.find(n=>f.isSameDay(n,t)),Ze=({value:e,onValueChange:t,statePerMonth:n,onChangePanel:r})=>{const[s,i]=o.useState(),[l,a]=o.useState("startDate"),{currentPanel:d,setCurrentPanel:u}=te(r),[x,y]=o.useState(()=>{var w;return(w=l&&(e==null?void 0:e[l]))!=null?w:new Date}),g=o.useCallback(w=>{i(w);const{startDate:S,endDate:k}=w;if(t)if(S&&k){const b=f.eachDayOfInterval({start:S,end:k});t(b)}else S?t([S]):k&&t([k])},[t]),h=Ke(s,g,l,a),m=o.useCallback((w,S,k)=>{t&&(k.ctrlKey||k.metaKey?e?Ut(e,w.date)?t(Pt(e,w.date)):t([...e,w.date]):t([w.date]):h(w,S,k))},[t,h,e]),p=o.useMemo(()=>$t(n,e),[n,e]);return{onClickDay:m,statePerMonth:p,currentPanel:d,setCurrentPanel:u,dateInFocus:x,setDateInFocus:y}},$t=(e,t)=>t?t.reduce((n,r)=>O(n,r,["selected"]),e):e;function Ft(e){const t=Ze(e);return c.jsx(_,{...e,...t})}const ne="bottom",Ve=()=>{const[e,t]=Q.useTippyInstance();return{onChangePanel:o.useCallback(()=>{var r,s;(s=(r=t.current)==null?void 0:r.popperInstance)==null||s.update()},[t]),tippyRef:e}},zt=(e,t,n)=>{const[r,s]=o.useState(n||!1),i=o.useCallback(()=>(s(!0),!0),[s]),l=o.useCallback(()=>{s(!1),t&&t()},[s,t]),a=o.useCallback(d=>{e&&e(d),setTimeout(l,150)},[e,l]);return{showCalendar:i,hideCalendar:l,showingCalendar:r,onSelectDate:a}},re="2999-12-31",_t=({displayFormat:e=F.fullDate,placeholder:t="Enter date",value:n,zIndex:r=100,calendarTheme:s=z,calendarProps:i,openOnMount:l,onClose:a,onChange:d,portalTarget:u,variant:x,width:y,minDate:g,maxDate:h=re,disabled:m})=>{const{hideCalendar:p,showingCalendar:w,onSelectDate:S,showCalendar:k}=zt(d,a,l),{tippyRef:b,onChangePanel:C}=Ve();return c.jsx(D.Box,{width:y,children:c.jsx(Q.Popover,{arrow:!1,lazy:!0,visible:w,onClickOutside:p,placement:ne,zIndex:r,appendTo:u!=null?u:"parent",tippyRef:b,disabled:m,content:c.jsx(ke,{...i,onChange:S,value:n,theme:s,onChangePanel:C,minDate:g,maxDate:h}),children:c.jsx($.TextInput,{type:"date",contentRight:c.jsx(D.Row,{alignItems:"center",children:c.jsx(j.FlatButton,{size:"small",disabled:m,leftIcon:j.stenaCalendar,onClick:k})}),onFocus:k,onClickRight:k,value:n?f.format(n,e):"",placeholder:t,size:9,disabled:m,autoFocus:l,variant:x,min:g,max:h})})})},qt=(e,t)=>{const n=o.useRef(null),r=o.useRef(null),[s,i]=o.useState(!1),[l,a]=o.useState(void 0),d=o.useCallback(()=>(a("startDate"),i(!0),!0),[a,i]),u=o.useCallback(()=>(a("endDate"),i(!0),!0),[a,i]),x=o.useCallback(()=>{i(!1)},[i]),y=o.useCallback(h=>{l==="startDate"?(t==null||t({startDate:h.date,endDate:e==null?void 0:e.endDate}),e!=null&&e.endDate?setTimeout(x,150):(a("endDate"),r.current&&r.current.focus())):l==="endDate"&&(t==null||t({startDate:e==null?void 0:e.startDate,endDate:h.date}),e!=null&&e.startDate?setTimeout(x,150):(a("startDate"),n.current&&n.current.focus()))},[l,t,a,x,e]),g=o.useMemo(()=>(e==null?void 0:e.startDate)&&(e==null?void 0:e.endDate)&&f.isAfter(e.startDate,e.endDate),[e==null?void 0:e.startDate,e==null?void 0:e.endDate]);return{showingCalendar:s,hideCalendar:x,showCalendarEndDate:u,showCalendarStartDate:d,focusedInput:l,setFocusedInput:a,startDateInputRef:n,endDateInputRef:r,onClickDay:y,startDateIsAfterEnd:g}},Jt=({displayFormat:e=F.fullDate,placeholderStartDate:t="Start date",placeholderEndDate:n="End date",portalTarget:r,value:s,onValueChange:i,zIndex:l=100,width:a,calendarTheme:d=z,calendarProps:u,minDate:x,maxDate:y=re,disabled:g})=>{const[h,m]=o.useState(()=>{var Y;return(Y=M&&(s==null?void 0:s[M]))!=null?Y:new Date}),[p,w]=o.useState("calendar"),{hideCalendar:S,showCalendarEndDate:k,showCalendarStartDate:b,showingCalendar:C,focusedInput:M,startDateInputRef:R,endDateInputRef:E,onClickDay:N,startDateIsAfterEnd:T}=qt(s,i),L=o.useMemo(()=>G(void 0,s==null?void 0:s.startDate,s==null?void 0:s.endDate),[s]);return c.jsx(Q.Popover,{arrow:!1,lazy:!0,disabled:g,visible:C,zIndex:l,placement:ne,appendTo:r!=null?r:"parent",onClickOutside:S,content:c.jsx(_,{...u,dateInFocus:h,setDateInFocus:m,statePerMonth:L,theme:d,onClickDay:N,currentPanel:p,setCurrentPanel:w,minDate:x,maxDate:y}),children:c.jsxs(D.Row,{alignItems:"center",children:[c.jsx($.TextInput,{iconLeft:j.stenaCalendar,onFocus:b,value:s!=null&&s.startDate?f.format(s.startDate,e):"",placeholder:t,width:a,disabled:g,inputRef:R,size:9,variant:T?"error":void 0}),c.jsx(D.Space,{}),c.jsx(j.Icon,{icon:it.faLongArrowAltRight,color:Me.cssColor("--lhds-color-ui-500"),size:14}),c.jsx(D.Space,{}),c.jsx($.TextInput,{iconLeft:j.stenaCalendar,onFocus:k,value:s!=null&&s.endDate?f.format(s.endDate,e):"",placeholder:n,width:a,disabled:g,inputRef:E,size:9,variant:T?"error":void 0})]})})},Kt=({calendarProps:e,closeOnCalendarSelectDate:t=!0,dateFormat:n=F.fullDate,disableCalender:r=!1,onValueChange:s,placeholder:i="yyyy-mm-dd",portalTarget:l,value:a,width:d="130px",zIndex:u=100,calendarTheme:x=z,hideCalenderIcon:y=!1,minDate:g,maxDate:h=re,variant:m,...p})=>{const[w,S]=o.useState(!1),{tippyRef:k,onChangePanel:b}=Ve(),C=o.useCallback(()=>{S(!w)},[S,w]),M=o.useCallback(()=>{S(!1)},[S]),R=o.useCallback(H=>{s&&s(H)},[s]),E=o.useCallback(H=>{H&&(R(f.format(H,n)),t&&setTimeout(()=>S(!w),200))},[R,n,t,S,w]),N=!!a&&!/^[-/\\.0-9]+$/.test(a),T=!!a&&f.isValid(f.parse(a,n,new Date)),Y=!!a&&a.length>=n.length&&!T||N;return c.jsx(D.Box,{width:d,children:c.jsx(Q.Popover,{arrow:!1,lazy:!0,visible:w,zIndex:u,appendTo:l!=null?l:"parent",placement:ne,onClickOutside:M,tippyRef:k,content:c.jsx(ke,{...e,onChange:E,onChangePanel:b,value:a&&T?f.parse(a,n,new Date):void 0,minDate:g,maxDate:h,theme:x}),children:c.jsx($.TextInput,{...p,variant:Y?"error":m,disableContentPaddingRight:!0,contentRight:y?void 0:c.jsx(D.Row,{alignItems:"center",indent:.5,children:c.jsx(j.FlatButton,{size:"small",disabled:p.disabled,leftIcon:j.stenaCalendar,onClick:C})}),onValueChange:R,placeholder:i,value:a||"",min:g,max:h,size:10})})})},le=e=>{if(e==="")return"00";const t=parseInt(e,10);if(isNaN(t))throw new Error("Hours is not a number");if(t<0||t>23)throw new Error("Hours is an invalid number");switch(e.length){case 1:return`0${t}`;case 2:return e;default:throw new Error("Invalid hour string")}},de=e=>{if(e==="")return"00";const t=parseInt(e,10);if(isNaN(t))throw new Error("Minutes is not a number");if(t<0||t>59)throw new Error("Minutes is an invalid number");switch(e.length){case 1:return`0${t}`;case 2:return e;default:throw new Error("Invalid minute string")}},vt=e=>{if(!ge(e))return{time:e,success:!1};const t=e&&e.split(/-|:|,|;|[/]|[.]| /);if(t&&t.length===2)try{const n=le(t[0]),r=de(t[1]);return{time:`${n}:${r}`,success:!0}}catch{return{time:e,success:!1}}else if(t&&t.length===1){let n=0,r=0;switch(e.length){case 1:return{time:`0${e}:00`,success:!0};case 2:const s=parseInt(t[0],10);return s>=0&&s<24?{time:`${e}:00`,success:!0}:s>=24&&s<59?{time:`00:${e}`,success:!0}:{time:e,success:!1};case 3:return r=parseInt(e.substr(1,2),10),r>=0&&r<=59?{time:`0${e.substr(0,1)}:${e.substr(1,2)}`,success:!0}:{time:e,success:!1};case 4:return n=parseInt(e.substr(0,2),10),r=parseInt(e.substr(2,2),10),n<0||n>23?{time:e,success:!1}:r<0||r>59?{time:e,success:!1}:{time:`${e.substr(0,2)}:${e.substr(2,2)}`,success:!0};default:return{time:e,success:!1}}}return{time:e,success:!1}},ge=e=>e?/^[-:.,/; 0-9]+$/.test(e):!0,Gt=({onValueChange:e,showPlaceholder:t=!0,useIcon:n=!0,value:r,width:s="85px",variant:i,...l})=>{const[a,d]=o.useState(()=>ge(r)),u="hh:mm",x=o.useCallback(()=>{if(r){const g=vt(r);d(g.success),g.success&&e&&e(g.time)}},[r,e,d]),y=o.useCallback(g=>{const h=g.target.value,m=ge(h);d(m&&h.length<=u.length),e&&e(h)},[e,d]);return c.jsx($.TextInput,{...l,type:"time",variant:a?i:"error",iconLeft:n?j.stenaClock:void 0,value:r,placeholder:t?u:void 0,onChange:y,onBlur:x,width:s})},et=({autoFocusLeft:e,autoFocusRight:t,onEsc:n,onEnter:r,onValueChangeLeft:s,onValueChangeRight:i,separatorIcon:l,placeholderLeft:a,placeholderRight:d,typeLeft:u,typeRight:x,onChangeLeft:y,onChangeRight:g,valueLeft:h,valueRight:m,minLeft:p,maxLeft:w,minRight:S,maxRight:k,onClickLeft:b,onClickRight:C,onClickCalendar:M,onClickArrowDown:R,onBlurLeft:E,onBlurRight:N,onFocusLeft:T,onFocusRight:L,inputRefLeft:Y,inputRefRight:H,variant:K,variantLeft:X,variantRight:v,onBlur:W,showPresets:Z,widthLeft:V,widthRight:ee,disabled:q})=>{const I=o.useRef(0),A=o.useMemo(()=>J.debounce(P=>{P===0&&(W==null||W())},10),[W]),se=o.useCallback(P=>{I.current++,A(I.current),T&&T(P)},[T,I,A]),ce=o.useCallback(P=>{I.current++,A(I.current),L&&L(P)},[L,I,A]),ie=o.useCallback(P=>{I.current--,A(I.current),E&&E(P)},[E,I,A]),nt=o.useCallback(P=>{I.current--,A(I.current),N&&N(P)},[N,I,A]);return c.jsx(D.Box,{children:c.jsxs($.TextInputBox,{disableContentPaddingRight:!0,disabled:q,variant:K,contentRight:c.jsxs(D.Row,{alignItems:"center",children:[c.jsx(D.Indent,{num:.5,children:c.jsx(j.FlatButton,{leftIcon:j.stenaCalendar,onClick:M,disabled:q,size:"small"})}),Z?c.jsxs(c.Fragment,{children:[c.jsx(D.Row,{height:"22px",children:c.jsx(D.SeparatorLine,{vertical:!0})}),c.jsx(D.Indent,{num:.5,children:c.jsx(j.FlatButton,{leftIcon:j.stenaAngleDown,onClick:R,disabled:q,size:"small"})})]}):null]}),children:[c.jsx(D.Box,{width:V,children:c.jsx($.TextInput,{onEsc:n,onEnter:r,onClick:b,disabled:q,hideBorder:!0,placeholder:a,value:h,onValueChange:s,onChange:y,onBlur:ie,onFocus:se,inputRef:Y,variant:X,type:u,autoFocus:e,min:p,max:w})}),c.jsx(D.Row,{indent:.5,alignItems:"center",justifyContent:"center",children:c.jsx(j.Icon,{icon:l,size:12,color:Me.cssColor("--lhds-color-ui-500")})}),c.jsx(D.Box,{width:ee,children:c.jsx($.TextInput,{onEsc:n,onEnter:r,onClick:C,disabled:q,hideBorder:!0,placeholder:d,value:m,onValueChange:i,onChange:g,onBlur:nt,onFocus:ce,inputRef:H,variant:v,type:x,autoFocus:t,min:S,max:k})})]})})},Qt=e=>{if(e==null)throw new Error("Time is not set.");if(e==="")throw new Error("Time is empty.");const t=e.split(":");if(t.length!==2)throw new Error("Invalid time.");if(t[1].length!==2)throw new Error("Invalid time.");if(t[0].length<1||t[0].length>2)throw new Error("Invalid time.");const n=parseInt(t[0],10),r=parseInt(t[1],10);if(isNaN(n))throw new Error("Invalid time.");if(isNaN(r))throw new Error("Invalid time.");if(n<0||n>23)throw new Error("Invalid time.");if(r<0||r>59)throw new Error("Invalid time.");return n*100+r},Xt=e=>{try{return Qt(e),!0}catch{return!1}},oe=e=>{if(e&&Xt(e)){const t=e.split(":");return{hour:D.parseIntElseUndefined(t[0]),minute:D.parseIntElseUndefined(t[1])}}return{hour:void 0,minute:void 0}},Zt=e=>`${le(String(e.getHours()))}:${de(String(e.getMinutes()))}`,Vt="_timePicker_1w05d_1",en="_timePickerColumn_1w05d_6";var tt={timePicker:Vt,timePickerColumn:en};const tn=({onClick:e,item:t,selected:n,columnRef:r,canScrollRef:s})=>{const i=o.useRef(null);return o.useEffect(function(){if(n&&r.current&&i.current&&s.current){const a=i.current.scrollHeight*Math.max(t-2,0);r.current.scrollTo(0,a),s.current=!1}},[r,t,n,s]),c.jsx(D.Row,{width:"64px",justifyContent:"center",spacing:.5,indent:.5,ref:i,children:n?c.jsx(j.PrimaryButton,{label:String(t),onClick:()=>e&&e(t)}):c.jsx(j.FlatButton,{label:String(t),onClick:()=>e&&e(t)})})},Se=({onClick:e,items:t,selectedItem:n,canScrollRef:r})=>{const s=o.useRef(null);return c.jsx(D.Column,{className:tt.timePickerColumn,ref:s,children:t.map(i=>c.jsx(tn,{item:i,onClick:e,selected:i===n,columnRef:s,canScrollRef:r},i))})},nn=J.range(0,24),rn=J.range(0,60),sn=({value:e,onValueChange:t})=>{const n=o.useRef(!0),[r,s]=o.useState(void 0),[i,l]=o.useState(void 0);o.useEffect(()=>{if(e){const{minute:u,hour:x}=oe(e);s(x),l(u)}},[e]);const a=o.useCallback(u=>{s(u),t==null||t(`${le(String(u!=null?u:0))}:${de(String(i!=null?i:0))}`)},[i,t]),d=o.useCallback(u=>{l(u),t==null||t(`${le(String(r!=null?r:0))}:${de(String(u!=null?u:0))}`)},[r,t]);return c.jsxs(D.Row,{className:tt.timePicker,children:[c.jsx(Se,{items:nn,onClick:a,selectedItem:r,canScrollRef:n}),c.jsx(D.Indent,{}),c.jsx(Se,{items:rn,onClick:d,selectedItem:i,canScrollRef:n})]})},cn=(e,t,n)=>{o.useEffect(function(){e&&t(e)},[e,t]),o.useEffect(function(){n.current&&(e?n.current.valueAsDate=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())):n.current.valueAsDate=null)},[e,n])},on=(e,t,{setDateInFocus:n,showCalendarInternal:r,hideCalendarInternal:s,setFirstFocusedInput:i,setCurrentPanel:l,localTime:a,setLocalTime:d,localDate:u,setLocalDate:x},y)=>{const g=o.useCallback(k=>{if(!k)return;const b=new Date(k);if(e)b.setHours(e.getHours()),b.setMinutes(e.getMinutes()),t==null||t(b),x(void 0);else if(a){const{minute:C,hour:M}=oe(a);b.setHours(M!=null?M:0),b.setMinutes(C!=null?C:0),t==null||t(b),x(void 0)}else x(b);n(b),y.current&&(y.current.valueAsDate=b)},[e,y,a,t,n,x]),h=o.useCallback(k=>{if(!!k)if(e){const b=oe(k),C=new Date(e);C.setHours(b.hour||0),C.setMinutes(b.minute||0),t==null||t(C),d(void 0)}else if(u){const b=oe(k),C=new Date(u);C.setHours(b.hour||0),C.setMinutes(b.minute||0),t==null||t(C),d(void 0)}else d(k)},[t,e,u,d]),m=o.useCallback(k=>{k.target.value[0]!=="0"&&g(k.target.valueAsDate)},[g]),p=o.useCallback(k=>h(k.target.value),[h]),w=o.useCallback(()=>{n(e||new Date),l("calendar"),r()},[e,l,r,n]),S=o.useCallback(()=>{i(void 0),s()},[i,s]);return{inputLeftChangeHandler:m,inputRightChangeHandler:p,hideCalendar:S,showCalendar:w,onChangeTime:h,onChangeDate:g}},an=e=>{const[t,n]=o.useState(void 0),[r,s]=o.useState(void 0),[i,l,a]=D.useBoolean(!1),[d,u,x]=D.useBoolean(!1),[y,g]=o.useState(void 0),[h,m]=o.useState(()=>e!=null?e:new Date),[p,w]=o.useState("calendar");return{isCalendarVisible:i,showCalendarInternal:l,hideCalendarInternal:a,firstFocusedInput:y,setFirstFocusedInput:g,dateInFocus:h,setDateInFocus:m,currentPanel:p,setCurrentPanel:w,isTimePickerVisible:d,showTimePicker:u,hideTimePicker:x,localDate:t,setLocalDate:n,localTime:r,setLocalTime:s}},ln=(e,t,n,r,{isCalendarVisible:s,setCurrentPanel:i,showTimePicker:l,hideTimePicker:a})=>{const d=o.useCallback(()=>{s||n(),i("calendar"),a()},[a,s,i,n]),u=o.useCallback(()=>{r(),l()},[r,l]),x=o.useCallback(m=>{e(m.date),r(),l()},[e,r,l]),y=o.useCallback(()=>{i("presets"),n()},[i,n]),g=o.useCallback(()=>{var m;s?r():((m=t.current)==null||m.focus(),i("calendar"),n())},[s,r,t,i,n]),h=o.useCallback(m=>{m.key==="Escape"&&r()},[r]);return{onFocusLeft:d,onFocusRight:u,onClickDay:x,onClickArrowButton:y,onClickCalendarButton:g,onKeyDownHandler:h}},dn=({value:e,onValueChange:t,onEnter:n,onEsc:r,onBlur:s,autoFocus:i,minDate:l,widthLeft:a=128,widthRight:d=80,maxDate:u=re,variant:x,disabled:y})=>{const g=o.useRef(null),h=o.useRef(null),m=an(e),{setCurrentPanel:p,currentPanel:w,isCalendarVisible:S,dateInFocus:k,setDateInFocus:b,isTimePickerVisible:C,hideTimePicker:M,localTime:R,localDate:E}=m,{showCalendar:N,hideCalendar:T,inputLeftChangeHandler:L,inputRightChangeHandler:Y,onChangeTime:H,onChangeDate:K}=on(e,t,m,g),{onKeyDownHandler:X,onFocusRight:v,onFocusLeft:W,onClickDay:Z,onClickCalendarButton:V,onClickArrowButton:ee}=ln(K,g,N,T,m);cn(e,b,g);const q=o.useMemo(()=>{const ie=e||E;return ie?O(void 0,ie,["singleSelected","selected"]):{}},[E,e]),I=o.useCallback(()=>{T(),M()},[T,M]),A=o.useMemo(()=>e?Zt(e):R,[e,R]),se=D.useDelayedFalse(S,300),ce=D.useDelayedFalse(C,300);return c.jsx(D.Box,{onKeyDown:X,children:c.jsx(Q.Popover,{arrow:!1,lazy:!0,disabled:y,placement:ne,visible:S||C,onClickOutside:I,content:(se||ce)&&c.jsx(D.Column,{children:se?c.jsx(_,{statePerMonth:q,onClickDay:Z,dateInFocus:k,setDateInFocus:b,currentPanel:w,setCurrentPanel:p,minDate:l,maxDate:u}):ce?c.jsxs(D.Column,{children:[c.jsx(D.Column,{overflow:"hidden",height:"250px",children:c.jsx(sn,{value:A!=null?A:"",onValueChange:H})}),c.jsx(D.Space,{}),c.jsx(D.Row,{justifyContent:"flex-end",children:c.jsx(j.PrimaryButton,{label:"Done",onClick:M})})]}):null}),children:c.jsx(et,{autoFocusLeft:i,onEsc:r,onEnter:n,onBlur:s,disabled:y,separatorIcon:j.stenaClock,typeLeft:"date",typeRight:"time",placeholderLeft:"yyyy-mm-dd",placeholderRight:"hh:mm",onChangeLeft:L,onChangeRight:Y,onClickArrowDown:ee,onClickCalendar:V,onFocusLeft:W,onFocusRight:v,onClickLeft:W,onClickRight:v,inputRefLeft:g,inputRefRight:h,valueRight:A!=null?A:"",widthLeft:a,widthRight:d,minLeft:l,maxLeft:u,variant:x})})})},un=(e,t,n,r,s)=>{o.useEffect(function(){e&&n(e)},[e,n]),o.useEffect(function(){t&&n(t)},[t,n]),o.useEffect(function(){r.current&&(e?r.current.valueAsDate=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())):r.current.valueAsDate=null)},[e,r]),o.useEffect(function(){s.current&&(t?s.current.valueAsDate=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())):s.current.valueAsDate=null)},[t,s])},fn=(e,t,n,{setDateInFocus:r,showCalendarInternal:s,hideCalendarInternal:i,setFirstFocusedInput:l,setCurrentPanel:a})=>{const d=o.useCallback(g=>{var h;g.target.value[0]!=="0"&&(n==null||n({startDate:(h=g.target.valueAsDate)!=null?h:void 0,endDate:t}))},[n,t]),u=o.useCallback(g=>{var h;g.target.value[0]!=="0"&&(n==null||n({startDate:e,endDate:(h=g.target.valueAsDate)!=null?h:void 0}))},[n,e]),x=o.useCallback(()=>{r(e||t||new Date),a("calendar"),s()},[e,t,a,s,r]),y=o.useCallback(()=>{l(void 0),i()},[l,i]);return{inputLeftChangeHandler:d,inputRightChangeHandler:u,hideCalendar:y,setDateInFocus:r,setCurrentPanel:a,showCalendar:x}},Dn=(e,t)=>{const[n,r,s]=D.useBoolean(!1),[i,l]=o.useState(void 0),[a,d]=o.useState("startDate"),[u,x]=o.useState(()=>{const h=a==="startDate"?e:a==="endDate"?t:void 0;return h!=null?h:new Date}),[y,g]=o.useState("calendar");return{isCalendarVisible:n,showCalendarInternal:r,hideCalendarInternal:s,firstFocusedInput:i,setFirstFocusedInput:l,focusedInput:a,setFocusedInput:d,dateInFocus:u,setDateInFocus:x,currentPanel:y,setCurrentPanel:g}},xn=(e,t,n,r,s,i,l,{firstFocusedInput:a,setFirstFocusedInput:d,isCalendarVisible:u,setFocusedInput:x,focusedInput:y,setCurrentPanel:g})=>{const h=o.useCallback(()=>{a==null&&d("startDate"),x("startDate"),u||i()},[u,x,i,d,a]),m=o.useCallback(()=>{a==null&&d("endDate"),x("endDate"),u||i()},[u,x,i,d,a]),p=o.useCallback(b=>{var C,M,R,E;y==="startDate"?t!=null&&f.isAfter(b.date,t)?(n==null||n({startDate:b.date,endDate:void 0}),x("endDate"),(C=s.current)==null||C.focus()):(n==null||n({startDate:b.date,endDate:t}),a==="startDate"?(x("endDate"),(M=s.current)==null||M.focus()):setTimeout(l,50)):y==="endDate"&&(e?f.isAfter(e,b.date)?(n==null||n({startDate:b.date,endDate:void 0}),x("endDate"),(E=s.current)==null||E.focus()):(n==null||n({startDate:e,endDate:b.date}),setTimeout(l,50)):(n==null||n({startDate:e,endDate:b.date}),x("startDate"),(R=r.current)==null||R.focus()))},[y,n,t,a,x,s,l,e,r]),w=o.useCallback(()=>{g("presets"),i()},[g,i]),S=o.useCallback(()=>{var b;u?l():(x("startDate"),d("startDate"),(b=r.current)==null||b.focus(),g("calendar"),i())},[u,l,x,d,r,g,i]),k=o.useCallback(b=>{b.key==="Escape"&&l()},[l]);return{onFocusLeft:h,onFocusRight:m,onClickDay:p,onClickArrowButton:w,onClickCalendarButton:S,onKeyDownHandler:k}},gn=({value:e,onValueChange:t,autoFocus:n,onBlur:r,onEnter:s,onEsc:i,minDate:l,maxDate:a=re,calendarProps:d,widthLeft:u=128,widthRight:x=128,variant:y,disabled:g})=>{const{startDate:h,endDate:m}=e||{},p=o.useRef(null),w=o.useRef(null),S=Dn(h,m),{dateInFocus:k,setDateInFocus:b,isCalendarVisible:C,currentPanel:M,setCurrentPanel:R}=S,{showCalendar:E,hideCalendar:N,inputLeftChangeHandler:T,inputRightChangeHandler:L}=fn(h,m,t,S),{onKeyDownHandler:Y,onFocusRight:H,onFocusLeft:K,onClickDay:X,onClickCalendarButton:v,onClickArrowButton:W}=xn(h,m,t,p,w,E,N,S);un(h,m,b,p,w);const Z=o.useMemo(()=>h&&m&&f.isAfter(h,m),[h,m]),V=o.useMemo(()=>Ee(d==null?void 0:d.statePerMonth,h,m,k),[d==null?void 0:d.statePerMonth,h,m,k]),ee=D.useDelayedFalse(C,300);return c.jsx(D.Box,{onKeyDown:Y,children:c.jsx(Q.Popover,{arrow:!1,lazy:!0,disabled:g,placement:ne,onClickOutside:N,visible:C,content:ee&&c.jsx(_,{onClickDay:X,dateInFocus:k,setDateInFocus:b,currentPanel:M,setCurrentPanel:R,minDate:l,maxDate:a,...d,statePerMonth:V}),children:c.jsx(et,{autoFocusLeft:n,onEsc:i,onEnter:s,onBlur:r,disabled:g,separatorIcon:j.stenaArrowRight,typeLeft:"date",typeRight:"date",placeholderLeft:"Start date",placeholderRight:"End date",onChangeLeft:T,onChangeRight:L,onClickArrowDown:W,onClickCalendar:v,onFocusLeft:K,onFocusRight:H,onClickLeft:K,onClickRight:H,inputRefLeft:p,inputRefRight:w,variant:Z?"error":y,widthLeft:u,widthRight:x,minLeft:l,maxLeft:a,minRight:l,maxRight:a})})})};exports.Calendar=ae;exports.CalendarDay=be;exports.DateInput=_t;exports.DateRangeCalendar=Lt;exports.DateRangeDualTextInput=gn;exports.DateRangeExclusionCalendar=Ft;exports.DateRangeInput=Jt;exports.DateTextInput=Kt;exports.DateTimeInput=dn;exports.Month=B;exports.MonthPicker=Fe;exports.MultiDateCalendar=Ot;exports.PresetPicker=ze;exports.SingleDateCalendar=ke;exports.SingleWeekCalendar=Wt;exports.TimeTextInput=Gt;exports.WeekDay=Ie;exports.WeekDayCell=$e;exports.WeekNumberCell=Ue;exports.YearPicker=_e;exports.addDayStateHighlights=O;exports.addDayStateHighlightsOnSingleDay=he;exports.addWeekRangeHighlights=Ae;exports.addWeekStateHighlights=ut;exports.buildDayStateForDateRange=G;exports.buildDayStateForRange=Te;exports.buildDayStateForSingleMonth=Ee;exports.calculateOverflowingMonth=Ye;exports.createDay=Ne;exports.dateRangeToStrings=qe;exports.dayHasHighlight=Oe;exports.dayHighlightSelect=U;exports.defaultCalendarTheme=z;exports.defaultTextPropsProvider=Pe;exports.defaultWrapperStyleProvider=We;exports.extranetCalendarTheme=Dt;exports.getDaysForWeekForDate=He;exports.getMonthInYear=ye;exports.getMonthsInYear=xe;exports.getStartDateOfISOWeek=Le;exports.getWeekForDate=ue;exports.getWeeksForMonth=Be;exports.isDateRangeInvalid=me;exports.setDayStateValue=lt;exports.setDayStateValueFunction=dt;exports.stringsToDateRange=Je;exports.toggleDateStringsIfEndIsEarlierThanStart=Ht;exports.toggleDatesIfEndIsEarlierThanStart=je;exports.useDateRangeCalendarState=Yt;exports.useDateRangeExclusionSelection=Ze;exports.useDateRangeSelection=ve;exports.useMultiDateSelection=Qe;exports.useSingleDateSelection=Ge;exports.useSingleWeekSelection=Xe;
|
|
2149
2
|
//# sourceMappingURL=index.js.map
|