@elliemae/ds-date-picker 3.0.0-next.2 → 3.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSDatePicker.js +248 -0
- package/dist/cjs/DSDatePicker.js.map +7 -0
- package/dist/cjs/components/DSDatePickerImpl.js +274 -0
- package/dist/cjs/components/DSDatePickerImpl.js.map +7 -0
- package/dist/cjs/components/DatePickerController/DatePickerController.js +335 -0
- package/dist/cjs/components/DatePickerController/DatePickerController.js.map +7 -0
- package/dist/cjs/components/DatePickerDay/DatePickerDay.js +49 -0
- package/dist/cjs/components/DatePickerDay/DatePickerDay.js.map +7 -0
- package/dist/cjs/components/DatePickerDropdown.js +102 -0
- package/dist/cjs/components/DatePickerDropdown.js.map +7 -0
- package/dist/cjs/components/DatePickerHeader/DatePickerHeader.js +74 -0
- package/dist/cjs/components/DatePickerHeader/DatePickerHeader.js.map +7 -0
- package/dist/cjs/components/DatePickerNavigation/DatePickerNavigation.js +63 -0
- package/dist/cjs/components/DatePickerNavigation/DatePickerNavigation.js.map +7 -0
- package/dist/cjs/components/DatePickerPicker/DatePickerPicker.js +112 -0
- package/dist/cjs/components/DatePickerPicker/DatePickerPicker.js.map +7 -0
- package/dist/cjs/components/DatePickerRange/DatePickerRange.js +126 -0
- package/dist/cjs/components/DatePickerRange/DatePickerRange.js.map +7 -0
- package/dist/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +138 -0
- package/dist/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +7 -0
- package/dist/cjs/components/DatePickerRenderMonth/DatePickerRenderMonth.js +61 -0
- package/dist/cjs/components/DatePickerRenderMonth/DatePickerRenderMonth.js.map +7 -0
- package/dist/cjs/components/DatePickerSingleDate/DatePickerSingleDate.js +117 -0
- package/dist/cjs/components/DatePickerSingleDate/DatePickerSingleDate.js.map +7 -0
- package/dist/cjs/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +80 -0
- package/dist/cjs/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js.map +7 -0
- package/dist/cjs/components/index.js +53 -0
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/cjs/defaultPhrases.js +246 -0
- package/dist/cjs/defaultPhrases.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/DSDatePicker.js +232 -0
- package/dist/esm/DSDatePicker.js.map +7 -0
- package/dist/esm/components/DSDatePickerImpl.js +245 -0
- package/dist/esm/components/DSDatePickerImpl.js.map +7 -0
- package/dist/esm/components/DatePickerController/DatePickerController.js +308 -0
- package/dist/esm/components/DatePickerController/DatePickerController.js.map +7 -0
- package/dist/esm/components/DatePickerDay/DatePickerDay.js +20 -0
- package/dist/esm/components/DatePickerDay/DatePickerDay.js.map +7 -0
- package/dist/esm/components/DatePickerDropdown.js +75 -0
- package/dist/esm/components/DatePickerDropdown.js.map +7 -0
- package/dist/esm/components/DatePickerHeader/DatePickerHeader.js +45 -0
- package/dist/esm/components/DatePickerHeader/DatePickerHeader.js.map +7 -0
- package/dist/esm/components/DatePickerNavigation/DatePickerNavigation.js +37 -0
- package/dist/esm/components/DatePickerNavigation/DatePickerNavigation.js.map +7 -0
- package/dist/esm/components/DatePickerPicker/DatePickerPicker.js +84 -0
- package/dist/esm/components/DatePickerPicker/DatePickerPicker.js.map +7 -0
- package/dist/esm/components/DatePickerRange/DatePickerRange.js +99 -0
- package/dist/esm/components/DatePickerRange/DatePickerRange.js.map +7 -0
- package/dist/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +109 -0
- package/dist/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +7 -0
- package/dist/esm/components/DatePickerRenderMonth/DatePickerRenderMonth.js +32 -0
- package/dist/esm/components/DatePickerRenderMonth/DatePickerRenderMonth.js.map +7 -0
- package/dist/esm/components/DatePickerSingleDate/DatePickerSingleDate.js +89 -0
- package/dist/esm/components/DatePickerSingleDate/DatePickerSingleDate.js.map +7 -0
- package/dist/esm/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +51 -0
- package/dist/esm/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js.map +7 -0
- package/dist/esm/components/index.js +24 -0
- package/dist/esm/components/index.js.map +7 -0
- package/{esm → dist/esm}/defaultPhrases.js +48 -80
- package/dist/esm/defaultPhrases.js.map +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +7 -0
- package/package.json +63 -55
- package/cjs/DSDatePicker.js +0 -233
- package/cjs/components/DSDatePickerImpl.js +0 -354
- package/cjs/components/DatePickerController/DatePickerController.js +0 -360
- package/cjs/components/DatePickerDay/DatePickerDay.js +0 -24
- package/cjs/components/DatePickerDropdown.js +0 -65
- package/cjs/components/DatePickerHeader/DatePickerHeader.js +0 -56
- package/cjs/components/DatePickerNavigation/DatePickerNavigation.js +0 -32
- package/cjs/components/DatePickerPicker/DatePickerPicker.js +0 -74
- package/cjs/components/DatePickerRange/DatePickerRange.js +0 -119
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +0 -144
- package/cjs/components/DatePickerRenderMonth/DatePickerRenderMonth.js +0 -46
- package/cjs/components/DatePickerSingleDate/DatePickerSingleDate.js +0 -85
- package/cjs/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +0 -59
- package/cjs/components/index.js +0 -27
- package/cjs/defaultPhrases.js +0 -261
- package/cjs/index.js +0 -35
- package/esm/DSDatePicker.js +0 -211
- package/esm/components/DSDatePickerImpl.js +0 -346
- package/esm/components/DatePickerController/DatePickerController.js +0 -350
- package/esm/components/DatePickerDay/DatePickerDay.js +0 -18
- package/esm/components/DatePickerDropdown.js +0 -57
- package/esm/components/DatePickerHeader/DatePickerHeader.js +0 -49
- package/esm/components/DatePickerNavigation/DatePickerNavigation.js +0 -25
- package/esm/components/DatePickerPicker/DatePickerPicker.js +0 -60
- package/esm/components/DatePickerRange/DatePickerRange.js +0 -111
- package/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js +0 -137
- package/esm/components/DatePickerRenderMonth/DatePickerRenderMonth.js +0 -38
- package/esm/components/DatePickerSingleDate/DatePickerSingleDate.js +0 -77
- package/esm/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.js +0 -53
- package/esm/components/index.js +0 -10
- package/esm/index.js +0 -13
- package/types/components/DSDatePickerImpl.d.ts +0 -20
- package/types/components/DatePickerController/DatePickerController.d.ts +0 -80
- package/types/components/DatePickerDay/DatePickerDay.d.ts +0 -13
- package/types/components/DatePickerDropdown.d.ts +0 -41
- package/types/components/DatePickerHeader/DatePickerHeader.d.ts +0 -15
- package/types/components/DatePickerNavigation/DatePickerNavigation.d.ts +0 -19
- package/types/components/DatePickerPicker/DatePickerPicker.d.ts +0 -48
- package/types/components/DatePickerRange/DatePickerRange.d.ts +0 -9
- package/types/components/DatePickerRangeHeader/DatePickerRangeHeader.d.ts +0 -23
- package/types/components/DatePickerRangeHeader/tests/DatePickerRangeHeader.test.d.ts +0 -1
- package/types/components/DatePickerRenderMonth/DatePickerRenderMonth.d.ts +0 -5
- package/types/components/DatePickerSingleDate/DatePickerSingleDate.d.ts +0 -11
- package/types/components/SingleRangeDateSwitcher/SingleRangeDateSwitcher.d.ts +0 -16
- package/types/components/index.d.ts +0 -10
- package/types/components/tests/DatePickerHeader.test.d.ts +0 -1
- package/types/components/tests/DatePickerRange.test.d.ts +0 -1
- package/types/components/tests/DatePickerRangeHeader.test.d.ts +0 -1
- package/types/components/tests/DatePickerSelectedDate.test.d.ts +0 -1
- package/types/components/tests/DatePickerSingleDate.test.d.ts +0 -1
- package/types/components/tests/SingleRangeDateSwitcher.test.d.ts +0 -1
- package/types/defaultPhrases.d.ts +0 -225
- package/types/index.d.ts +0 -3
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import React2 from "react";
|
|
19
|
+
import { debounce } from "lodash";
|
|
20
|
+
import PropTypes from "prop-types";
|
|
21
|
+
import moment from "moment";
|
|
22
|
+
import "react-dates/initialize";
|
|
23
|
+
import { DayPickerSingleDateController } from "react-dates";
|
|
24
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
25
|
+
import { ChevronLeft } from "@elliemae/ds-icons";
|
|
26
|
+
import { SingleDatePickerPhrases } from "../../defaultPhrases";
|
|
27
|
+
import { renderMonthElement } from "../DatePickerRenderMonth/DatePickerRenderMonth";
|
|
28
|
+
import { DatePickerNavigation } from "../DatePickerNavigation/DatePickerNavigation";
|
|
29
|
+
import { DatePickerDay } from "../DatePickerDay/DatePickerDay";
|
|
30
|
+
const { classNameElement, classNameBlock } = convertPropToCssClassName("datepicker-range");
|
|
31
|
+
const focusElementOnOpen = debounce((datePickerDom, firstFocusableItemDom, focusCurrentDate) => {
|
|
32
|
+
if (datePickerDom) {
|
|
33
|
+
const currentDay = Array.from(datePickerDom?.getElementsByClassName("CalendarDay__today")).filter((el) => !el.className.includes("CalendarDay__outside"))[0];
|
|
34
|
+
const [calendarDaySelected] = datePickerDom?.getElementsByClassName("CalendarDay__selected");
|
|
35
|
+
if (calendarDaySelected) {
|
|
36
|
+
calendarDaySelected?.focus?.();
|
|
37
|
+
} else if (focusCurrentDate && !calendarDaySelected)
|
|
38
|
+
currentDay.focus();
|
|
39
|
+
else {
|
|
40
|
+
const navButton = firstFocusableItemDom?.closest(".DayPickerNavigation_button>div");
|
|
41
|
+
navButton?.focus?.();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, 100);
|
|
45
|
+
class DSDatePickerController extends React2.Component {
|
|
46
|
+
constructor(props) {
|
|
47
|
+
super(props);
|
|
48
|
+
this.handleMouseUp = () => {
|
|
49
|
+
const focusedElement = document.activeElement;
|
|
50
|
+
focusedElement?.blur?.();
|
|
51
|
+
};
|
|
52
|
+
this.handleKeyDown = (event) => {
|
|
53
|
+
const [firstDay, ...restOfDays] = document.getElementsByClassName("CalendarMonthGrid_month__horizontal")[1].getElementsByClassName("CalendarDay");
|
|
54
|
+
const [lastDay] = restOfDays.slice(-1);
|
|
55
|
+
const { onClickEscape } = this.props;
|
|
56
|
+
switch (event.key) {
|
|
57
|
+
case "Home":
|
|
58
|
+
firstDay.focus();
|
|
59
|
+
break;
|
|
60
|
+
case "End":
|
|
61
|
+
lastDay.focus();
|
|
62
|
+
break;
|
|
63
|
+
case "Escape":
|
|
64
|
+
onClickEscape();
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
this.getSafeValue = () => {
|
|
71
|
+
const { value, date, defaultValue } = this.props;
|
|
72
|
+
const { selectedDate } = this.state;
|
|
73
|
+
if (value)
|
|
74
|
+
return moment(value);
|
|
75
|
+
if (date)
|
|
76
|
+
return moment(date);
|
|
77
|
+
if (defaultValue)
|
|
78
|
+
return moment(defaultValue);
|
|
79
|
+
if (selectedDate)
|
|
80
|
+
return moment(selectedDate);
|
|
81
|
+
return null;
|
|
82
|
+
};
|
|
83
|
+
this.isControlled = () => {
|
|
84
|
+
const { value, date } = this.props;
|
|
85
|
+
return Boolean(value) || Boolean(date);
|
|
86
|
+
};
|
|
87
|
+
this.handleDateChange = (date) => {
|
|
88
|
+
const { readOnly, onDateChange, onChange } = this.props;
|
|
89
|
+
if (!readOnly) {
|
|
90
|
+
if (!this.isControlled()) {
|
|
91
|
+
this.setState({ selectedDate: date });
|
|
92
|
+
}
|
|
93
|
+
onDateChange(date);
|
|
94
|
+
onChange(date);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this.handleChange = (dataInput) => {
|
|
98
|
+
const { onDateChange, onChange } = this.props;
|
|
99
|
+
const momentvalue = moment(dataInput.target.value);
|
|
100
|
+
this.setState({ selectedDate: momentvalue });
|
|
101
|
+
onDateChange(momentvalue);
|
|
102
|
+
onChange(momentvalue);
|
|
103
|
+
};
|
|
104
|
+
this.handleNavClick = (date, nav) => {
|
|
105
|
+
const [prev, next] = document.getElementsByClassName("DayPickerNavigation_button");
|
|
106
|
+
const { onPrevMonthClick, onNextMonthClick } = this.props;
|
|
107
|
+
if (nav === "prev") {
|
|
108
|
+
prev?.focus?.();
|
|
109
|
+
onPrevMonthClick(date);
|
|
110
|
+
} else {
|
|
111
|
+
next?.focus?.();
|
|
112
|
+
onNextMonthClick(date);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
this.insideBlur = (event) => {
|
|
116
|
+
const { datePicker } = this.state;
|
|
117
|
+
if (!datePicker.current.contains(event.currentTarget)) {
|
|
118
|
+
this.props.onClose();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
this.state = {
|
|
122
|
+
selectedDate: null,
|
|
123
|
+
firstFocusableItem: React2.createRef(),
|
|
124
|
+
datePicker: React2.createRef()
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
componentDidMount() {
|
|
128
|
+
const { datePicker, firstFocusableItem } = this.state;
|
|
129
|
+
datePicker.current.addEventListener("mouseup", this.handleMouseUp, false);
|
|
130
|
+
document.addEventListener("keydown", this.handleKeyDown, false);
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
focusElementOnOpen(datePicker?.current, firstFocusableItem?.current, this.props.focusCurrentDate);
|
|
133
|
+
}, 400);
|
|
134
|
+
}
|
|
135
|
+
componentWillUnmount() {
|
|
136
|
+
const { datePicker } = this.state;
|
|
137
|
+
datePicker.current.removeEventListener("mouseup", this.handleMouseUp, false);
|
|
138
|
+
document.removeEventListener("keydown", this.handleKeyDown, false);
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
const {
|
|
142
|
+
numberOfMonths,
|
|
143
|
+
enableOutsideDays,
|
|
144
|
+
transitionDuration,
|
|
145
|
+
initialVisibleMonth,
|
|
146
|
+
firstDayOfWeek,
|
|
147
|
+
keepOpenOnDateSelect,
|
|
148
|
+
hideKeyboardShortcutsPanel,
|
|
149
|
+
onClose,
|
|
150
|
+
phrases,
|
|
151
|
+
displayFormatDay,
|
|
152
|
+
isDayBlocked,
|
|
153
|
+
isOutsideRange,
|
|
154
|
+
isDayHighlighted,
|
|
155
|
+
onOutsideClick,
|
|
156
|
+
key,
|
|
157
|
+
calendarProps
|
|
158
|
+
} = this.props;
|
|
159
|
+
const { datePicker, firstFocusableItem } = this.state;
|
|
160
|
+
const safedate = this.getSafeValue();
|
|
161
|
+
const safeinitialMonth = safedate && safedate.isValid() ? () => safedate : () => initialVisibleMonth;
|
|
162
|
+
return /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement("div", __spreadValues({
|
|
163
|
+
onBlur: this.insideBlur,
|
|
164
|
+
ref: datePicker,
|
|
165
|
+
className: classNameBlock("wrapper-day-picker-single-date-controller"),
|
|
166
|
+
"data-testid": "calendar-wrapper"
|
|
167
|
+
}, calendarProps), /* @__PURE__ */ React2.createElement(DayPickerSingleDateController, {
|
|
168
|
+
key,
|
|
169
|
+
date: safedate,
|
|
170
|
+
enableOutsideDays,
|
|
171
|
+
firstDayOfWeek,
|
|
172
|
+
focused: true,
|
|
173
|
+
hideKeyboardShortcutsPanel,
|
|
174
|
+
initialVisibleMonth: safeinitialMonth,
|
|
175
|
+
isDayBlocked,
|
|
176
|
+
isDayHighlighted,
|
|
177
|
+
isOutsideRange,
|
|
178
|
+
keepOpenOnDateSelect,
|
|
179
|
+
navNext: /* @__PURE__ */ React2.createElement(DatePickerNavigation, {
|
|
180
|
+
className: classNameElement("navigation-next")
|
|
181
|
+
}),
|
|
182
|
+
navPrev: /* @__PURE__ */ React2.createElement(DatePickerNavigation, {
|
|
183
|
+
className: classNameElement("navigation-prev"),
|
|
184
|
+
icon: ChevronLeft,
|
|
185
|
+
innerRef: firstFocusableItem
|
|
186
|
+
}),
|
|
187
|
+
renderMonthElement,
|
|
188
|
+
numberOfMonths,
|
|
189
|
+
onClose,
|
|
190
|
+
onDateChange: this.handleDateChange,
|
|
191
|
+
onNextMonthClick: this.handleNavClick("next"),
|
|
192
|
+
onOutsideClick,
|
|
193
|
+
onPrevMonthClick: this.handleNavClick("prev"),
|
|
194
|
+
phrases,
|
|
195
|
+
renderDayContents: (date) => /* @__PURE__ */ React2.createElement(DatePickerDay, {
|
|
196
|
+
className: classNameElement("day-contents"),
|
|
197
|
+
date: date.format(displayFormatDay)
|
|
198
|
+
}),
|
|
199
|
+
transitionDuration,
|
|
200
|
+
onTab: (e) => {
|
|
201
|
+
if (e.target.classList.contains("CalendarDay")) {
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
onClose();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
})));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
DSDatePickerController.defaultProps = {
|
|
210
|
+
date: "",
|
|
211
|
+
value: "",
|
|
212
|
+
enableOutsideDays: false,
|
|
213
|
+
initialVisibleMonth: moment(),
|
|
214
|
+
firstDayOfWeek: 0,
|
|
215
|
+
keepOpenOnDateSelect: true,
|
|
216
|
+
hideKeyboardShortcutsPanel: true,
|
|
217
|
+
onPrevMonthClick: () => null,
|
|
218
|
+
onNextMonthClick: () => null,
|
|
219
|
+
onClose: () => null,
|
|
220
|
+
onChange: () => null,
|
|
221
|
+
onClickEscape: () => null,
|
|
222
|
+
onDateChange: () => null,
|
|
223
|
+
phrases: SingleDatePickerPhrases,
|
|
224
|
+
displayFormatDay: "D",
|
|
225
|
+
transitionDuration: 0,
|
|
226
|
+
isDayBlocked: () => false,
|
|
227
|
+
isOutsideRange: () => false,
|
|
228
|
+
isDayHighlighted: () => false,
|
|
229
|
+
numberOfMonths: 1
|
|
230
|
+
};
|
|
231
|
+
DSDatePickerController.propTypes = {
|
|
232
|
+
date: PropTypes.instanceOf(Date, moment),
|
|
233
|
+
value: PropTypes.oneOf(PropTypes.instanceOf(Date), PropTypes.instanceOf(moment)),
|
|
234
|
+
enableOutsideDays: PropTypes.bool,
|
|
235
|
+
initialVisibleMonth: PropTypes.instanceOf(Date, moment),
|
|
236
|
+
firstDayOfWeek: PropTypes.number,
|
|
237
|
+
keepOpenOnDateSelect: PropTypes.bool,
|
|
238
|
+
hideKeyboardShortcutsPanel: PropTypes.bool,
|
|
239
|
+
onPrevMonthClick: PropTypes.func,
|
|
240
|
+
onNextMonthClick: PropTypes.func,
|
|
241
|
+
onClose: PropTypes.func,
|
|
242
|
+
onClickEscape: PropTypes.func,
|
|
243
|
+
onChange: PropTypes.func,
|
|
244
|
+
onDateChange: PropTypes.func,
|
|
245
|
+
phrases: SingleDatePickerPhrases,
|
|
246
|
+
displayFormatDay: PropTypes.string,
|
|
247
|
+
transitionDuration: PropTypes.number,
|
|
248
|
+
isDayBlocked: PropTypes.func,
|
|
249
|
+
isOutsideRange: PropTypes.func,
|
|
250
|
+
isDayHighlighted: PropTypes.func,
|
|
251
|
+
numberOfMonths: PropTypes.number
|
|
252
|
+
};
|
|
253
|
+
DSDatePickerController.defaultProps = {
|
|
254
|
+
date: "",
|
|
255
|
+
value: "",
|
|
256
|
+
enableOutsideDays: false,
|
|
257
|
+
initialVisibleMonth: moment(),
|
|
258
|
+
firstDayOfWeek: 0,
|
|
259
|
+
keepOpenOnDateSelect: true,
|
|
260
|
+
hideKeyboardShortcutsPanel: true,
|
|
261
|
+
onPrevMonthClick: () => null,
|
|
262
|
+
onNextMonthClick: () => null,
|
|
263
|
+
onClose: () => null,
|
|
264
|
+
onClickEscape: () => null,
|
|
265
|
+
onChange: () => null,
|
|
266
|
+
onDateChange: () => null,
|
|
267
|
+
phrases: PropTypes.shape({
|
|
268
|
+
calendarLabel: PropTypes.string,
|
|
269
|
+
closeDatePicker: PropTypes.string,
|
|
270
|
+
clearDates: PropTypes.string,
|
|
271
|
+
focusStartDate: PropTypes.string,
|
|
272
|
+
jumpToPrevMonth: PropTypes.string,
|
|
273
|
+
jumpToNextMonth: PropTypes.string,
|
|
274
|
+
keyboardShortcuts: PropTypes.string,
|
|
275
|
+
showKeyboardShortcutsPanel: PropTypes.string,
|
|
276
|
+
hideKeyboardShortcutsPanel: PropTypes.string,
|
|
277
|
+
openThisPanel: PropTypes.string,
|
|
278
|
+
enterKey: PropTypes.string,
|
|
279
|
+
leftArrowRightArrow: PropTypes.string,
|
|
280
|
+
upArrowDownArrow: PropTypes.string,
|
|
281
|
+
pageUpPageDown: PropTypes.string,
|
|
282
|
+
homeEnd: PropTypes.string,
|
|
283
|
+
escape: PropTypes.string,
|
|
284
|
+
questionMark: PropTypes.string,
|
|
285
|
+
selectFocusedDate: PropTypes.string,
|
|
286
|
+
moveFocusByOneDay: PropTypes.string,
|
|
287
|
+
moveFocusByOneWeek: PropTypes.string,
|
|
288
|
+
moveFocusByOneMonth: PropTypes.string,
|
|
289
|
+
moveFocustoStartAndEndOfWeek: PropTypes.string,
|
|
290
|
+
returnFocusToInput: PropTypes.string,
|
|
291
|
+
keyboardNavigationInstructions: PropTypes.string,
|
|
292
|
+
chooseAvailableStartDate: PropTypes.func,
|
|
293
|
+
chooseAvailableEndDate: PropTypes.func,
|
|
294
|
+
dateIsUnavailable: PropTypes.func,
|
|
295
|
+
dateIsSelected: PropTypes.func
|
|
296
|
+
}),
|
|
297
|
+
displayFormatDay: "D",
|
|
298
|
+
transitionDuration: 0,
|
|
299
|
+
isDayBlocked: () => false,
|
|
300
|
+
isOutsideRange: () => false,
|
|
301
|
+
isDayHighlighted: () => false,
|
|
302
|
+
numberOfMonths: 1
|
|
303
|
+
};
|
|
304
|
+
export {
|
|
305
|
+
DSDatePickerController,
|
|
306
|
+
DSDatePickerController as default
|
|
307
|
+
};
|
|
308
|
+
//# sourceMappingURL=DatePickerController.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/DatePickerController/DatePickerController.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport { debounce } from 'lodash';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport 'react-dates/initialize';\nimport { DayPickerSingleDateController } from 'react-dates';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { ChevronLeft } from '@elliemae/ds-icons';\nimport { SingleDatePickerPhrases } from '../../defaultPhrases';\nimport { renderMonthElement } from '../DatePickerRenderMonth/DatePickerRenderMonth';\nimport { DatePickerNavigation } from '../DatePickerNavigation/DatePickerNavigation';\nimport { DatePickerDay } from '../DatePickerDay/DatePickerDay';\n\ninterface DSDatePickerControllerStateType {\n selectedDate: any;\n firstFocusableItem: React.RefObject<HTMLElement>;\n datePicker: React.RefObject<HTMLElement>;\n}\n\nconst { classNameElement, classNameBlock } = convertPropToCssClassName('datepicker-range');\n\nconst focusElementOnOpen = debounce((datePickerDom, firstFocusableItemDom, focusCurrentDate) => {\n if (datePickerDom) {\n const currentDay = Array.from(datePickerDom?.getElementsByClassName('CalendarDay__today')).filter(\n (el) => !el.className.includes('CalendarDay__outside'),\n )[0];\n const [calendarDaySelected] = datePickerDom?.getElementsByClassName('CalendarDay__selected');\n if (calendarDaySelected) {\n calendarDaySelected?.focus?.();\n } else if (focusCurrentDate && !calendarDaySelected) currentDay.focus();\n else {\n const navButton = firstFocusableItemDom?.closest('.DayPickerNavigation_button>div');\n navButton?.focus?.();\n }\n }\n}, 100);\n\nexport default class DSDatePickerController extends React.Component<any, DSDatePickerControllerStateType> {\n // eslint-disable-next-line react/static-property-placement\n static defaultProps = {\n date: '',\n value: '',\n enableOutsideDays: false,\n initialVisibleMonth: moment(),\n firstDayOfWeek: 0,\n keepOpenOnDateSelect: true,\n hideKeyboardShortcutsPanel: true,\n onPrevMonthClick: () => null,\n onNextMonthClick: () => null,\n onClose: () => null,\n onChange: () => null,\n onClickEscape: () => null,\n onDateChange: () => null,\n phrases: SingleDatePickerPhrases,\n // displayFormat: 'L',\n displayFormatDay: 'D',\n transitionDuration: 0,\n // verticalSpacing: 0,\n isDayBlocked: () => false,\n isOutsideRange: () => false,\n isDayHighlighted: () => false,\n numberOfMonths: 1,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedDate: null,\n firstFocusableItem: React.createRef(),\n datePicker: React.createRef(),\n };\n }\n\n componentDidMount() {\n const { datePicker, firstFocusableItem } = this.state;\n datePicker.current.addEventListener('mouseup', this.handleMouseUp, false);\n document.addEventListener('keydown', this.handleKeyDown, false);\n setTimeout(() => {\n focusElementOnOpen(datePicker?.current, firstFocusableItem?.current, this.props.focusCurrentDate);\n }, 400);\n }\n\n componentWillUnmount() {\n const { datePicker } = this.state;\n datePicker.current.removeEventListener('mouseup', this.handleMouseUp, false);\n document.removeEventListener('keydown', this.handleKeyDown, false);\n }\n\n handleMouseUp = () => {\n const focusedElement = document.activeElement;\n\n focusedElement?.blur?.();\n };\n\n handleKeyDown = (event) => {\n const [firstDay, ...restOfDays] = document\n .getElementsByClassName('CalendarMonthGrid_month__horizontal')[1]\n .getElementsByClassName('CalendarDay');\n const [lastDay] = restOfDays.slice(-1);\n const { onClickEscape } = this.props;\n\n switch (event.key) {\n case 'Home':\n firstDay.focus();\n break;\n case 'End':\n lastDay.focus();\n break;\n case 'Escape':\n onClickEscape();\n break;\n default:\n break;\n }\n };\n\n getSafeValue = () => {\n const { value, date, defaultValue } = this.props;\n const { selectedDate } = this.state;\n\n if (value) return moment(value);\n if (date) return moment(date);\n if (defaultValue) return moment(defaultValue);\n if (selectedDate) return moment(selectedDate);\n\n return null;\n };\n\n isControlled = () => {\n const { value, date } = this.props;\n return Boolean(value) || Boolean(date);\n };\n\n handleDateChange = (date) => {\n const { readOnly, onDateChange, onChange } = this.props;\n if (!readOnly) {\n if (!this.isControlled()) {\n this.setState({ selectedDate: date });\n }\n onDateChange(date);\n onChange(date);\n }\n };\n\n handleChange = (dataInput) => {\n const { onDateChange, onChange } = this.props;\n const momentvalue = moment(dataInput.target.value);\n this.setState({ selectedDate: momentvalue });\n onDateChange(momentvalue);\n onChange(momentvalue);\n };\n\n handleNavClick = (date, nav) => {\n const [prev, next] = document.getElementsByClassName('DayPickerNavigation_button');\n const { onPrevMonthClick, onNextMonthClick } = this.props;\n\n if (nav === 'prev') {\n prev?.focus?.();\n onPrevMonthClick(date);\n } else {\n next?.focus?.();\n onNextMonthClick(date);\n }\n };\n\n insideBlur = (event) => {\n const { datePicker } = this.state;\n if (!datePicker.current.contains(event.currentTarget)) {\n this.props.onClose();\n }\n };\n\n render() {\n const {\n numberOfMonths,\n enableOutsideDays,\n transitionDuration,\n initialVisibleMonth,\n firstDayOfWeek,\n keepOpenOnDateSelect,\n hideKeyboardShortcutsPanel,\n onClose,\n phrases,\n displayFormatDay,\n isDayBlocked,\n isOutsideRange,\n isDayHighlighted,\n onOutsideClick,\n key,\n calendarProps,\n } = this.props;\n const { datePicker, firstFocusableItem } = this.state;\n\n const safedate = this.getSafeValue();\n const safeinitialMonth = safedate && safedate.isValid() ? () => safedate : () => initialVisibleMonth;\n\n return (\n <div>\n <div\n onBlur={this.insideBlur}\n ref={datePicker}\n className={classNameBlock('wrapper-day-picker-single-date-controller')}\n data-testid=\"calendar-wrapper\"\n {...calendarProps}\n >\n <DayPickerSingleDateController\n key={key}\n date={safedate}\n enableOutsideDays={enableOutsideDays}\n firstDayOfWeek={firstDayOfWeek}\n focused\n hideKeyboardShortcutsPanel={hideKeyboardShortcutsPanel}\n initialVisibleMonth={safeinitialMonth}\n isDayBlocked={isDayBlocked}\n isDayHighlighted={isDayHighlighted}\n isOutsideRange={isOutsideRange}\n keepOpenOnDateSelect={keepOpenOnDateSelect}\n navNext={<DatePickerNavigation className={classNameElement('navigation-next')} />}\n navPrev={\n <DatePickerNavigation\n className={classNameElement('navigation-prev')}\n icon={ChevronLeft}\n innerRef={firstFocusableItem}\n />\n }\n renderMonthElement={renderMonthElement}\n numberOfMonths={numberOfMonths}\n onClose={onClose}\n onDateChange={this.handleDateChange}\n onNextMonthClick={this.handleNavClick('next')}\n onOutsideClick={onOutsideClick}\n onPrevMonthClick={this.handleNavClick('prev')}\n phrases={phrases}\n renderDayContents={(date) => (\n <DatePickerDay className={classNameElement('day-contents')} date={date.format(displayFormatDay)} />\n )}\n transitionDuration={transitionDuration}\n onTab={(e) => {\n if (e.target.classList.contains('CalendarDay')) {\n e.preventDefault();\n onClose();\n }\n }}\n />\n </div>\n </div>\n );\n }\n}\n\nDSDatePickerController.propTypes = {\n date: PropTypes.instanceOf(Date, moment),\n value: PropTypes.oneOf(PropTypes.instanceOf(Date), PropTypes.instanceOf(moment)),\n enableOutsideDays: PropTypes.bool,\n initialVisibleMonth: PropTypes.instanceOf(Date, moment),\n firstDayOfWeek: PropTypes.number,\n keepOpenOnDateSelect: PropTypes.bool,\n hideKeyboardShortcutsPanel: PropTypes.bool,\n onPrevMonthClick: PropTypes.func,\n onNextMonthClick: PropTypes.func,\n onClose: PropTypes.func,\n onClickEscape: PropTypes.func,\n onChange: PropTypes.func,\n onDateChange: PropTypes.func,\n phrases: SingleDatePickerPhrases,\n // displayFormat: PropTypes.string,\n displayFormatDay: PropTypes.string,\n transitionDuration: PropTypes.number,\n // verticalSpacing: PropTypes.number,\n isDayBlocked: PropTypes.func,\n isOutsideRange: PropTypes.func,\n isDayHighlighted: PropTypes.func,\n numberOfMonths: PropTypes.number,\n};\n\nDSDatePickerController.defaultProps = {\n date: '',\n value: '',\n enableOutsideDays: false,\n initialVisibleMonth: moment(),\n firstDayOfWeek: 0,\n keepOpenOnDateSelect: true,\n hideKeyboardShortcutsPanel: true,\n onPrevMonthClick: () => null,\n onNextMonthClick: () => null,\n onClose: () => null,\n onClickEscape: () => null,\n onChange: () => null,\n onDateChange: () => null,\n phrases: PropTypes.shape({\n calendarLabel: PropTypes.string,\n closeDatePicker: PropTypes.string,\n clearDates: PropTypes.string,\n focusStartDate: PropTypes.string,\n jumpToPrevMonth: PropTypes.string,\n jumpToNextMonth: PropTypes.string,\n keyboardShortcuts: PropTypes.string,\n showKeyboardShortcutsPanel: PropTypes.string,\n hideKeyboardShortcutsPanel: PropTypes.string,\n openThisPanel: PropTypes.string,\n enterKey: PropTypes.string,\n leftArrowRightArrow: PropTypes.string,\n upArrowDownArrow: PropTypes.string,\n pageUpPageDown: PropTypes.string,\n homeEnd: PropTypes.string,\n escape: PropTypes.string,\n questionMark: PropTypes.string,\n selectFocusedDate: PropTypes.string,\n moveFocusByOneDay: PropTypes.string,\n moveFocusByOneWeek: PropTypes.string,\n moveFocusByOneMonth: PropTypes.string,\n moveFocustoStartAndEndOfWeek: PropTypes.string,\n returnFocusToInput: PropTypes.string,\n keyboardNavigationInstructions: PropTypes.string,\n chooseAvailableStartDate: PropTypes.func,\n chooseAvailableEndDate: PropTypes.func,\n dateIsUnavailable: PropTypes.func,\n dateIsSelected: PropTypes.func,\n }),\n // displayFormat: 'L',\n displayFormatDay: 'D',\n transitionDuration: 0,\n // verticalSpacing: 0,\n isDayBlocked: () => false,\n isOutsideRange: () => false,\n isDayHighlighted: () => false,\n numberOfMonths: 1,\n};\n\nexport { DSDatePickerController };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACEA;AACA;AACA;AACA;AACA;AACA;A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AAM;AAAA,EACrB,UAAU,MAAM;AAAA,EAChB,cAAc,MAAM;AAAA,EACpB,SAAS,UAAU,MAAM;AAAA,IACvB,eAAe,UAAU;AAAA,IACzB,iBAAiB,UAAU;AAAA,IAC3B,YAAY,UAAU;AAAA,IACtB,gBAAgB,UAAU;AAAA,IAC1B,iBAAiB,UAAU;AAAA,IAC3B,iBAAiB,UAAU;AAAA,IAC3B,mBAAmB,UAAU;AAAA,IAC7B,4BAA4B,UAAU;AAAA,IACtC,4BAA4B,UAAU;AAAA,IACtC,eAAe,UAAU;AAAA,IACzB,UAAU,UAAU;AAAA,IACpB,qBAAqB,UAAU;AAAA,IAC/B,kBAAkB,UAAU;AAAA,IAC5B,gBAAgB,UAAU;AAAA,IAC1B,SAAS,UAAU;AAAA,IACnB,QAAQ,UAAU;AAAA,IAClB,cAAc,UAAU;AAAA,IACxB,mBAAmB,UAAU;AAAA,IAC7B,mBAAmB,UAAU;AAAA,IAC7B,oBAAoB,UAAU;AAAA,IAC9B,qBAAqB,UAAU;AAAA,IAC/B,8BAA8B,UAAU;AAAA,IACxC,oBAAoB,UAAU;AAAA,IAC9B,gCAAgC,UAAU;AAAA,IAC1C,0BAA0B,UAAU;AAAA,IACpC,wBAAwB,UAAU;AAAA,IAClC,mBAAmB,UAAU;AAAA,IAC7B,gBAAgB,UAAU;AAAA;AAAA,EAG5B,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EAEpB,cAAc,MAAM;AAAA,EACpB,gBAAgB,MAAM;AAAA,EACtB,kBAAkB,MAAM;AAAA,EACxB,gBAAgB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
const Day = ({ className = "date-picker-content-day", date = "" }) => /* @__PURE__ */ React2.createElement("div", {
|
|
5
|
+
className,
|
|
6
|
+
"data-testid": `datepicker-day-${date}`
|
|
7
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
8
|
+
className: `${className}-half`,
|
|
9
|
+
"data-testid": "datepicker-day"
|
|
10
|
+
}, date));
|
|
11
|
+
Day.propTypes = {
|
|
12
|
+
className: PropTypes.string,
|
|
13
|
+
date: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
14
|
+
};
|
|
15
|
+
var DatePickerDay_default = Day;
|
|
16
|
+
export {
|
|
17
|
+
Day as DatePickerDay,
|
|
18
|
+
DatePickerDay_default as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=DatePickerDay.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/DatePickerDay/DatePickerDay.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst Day = ({ className = 'date-picker-content-day', date = '' }) => (\n <div className={className} data-testid={`datepicker-day-${date}`}>\n <div className={`${className}-half`} data-testid=\"datepicker-day\">\n {date}\n </div>\n </div>\n);\nDay.propTypes = {\n className: PropTypes.string,\n date: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n};\n\nexport { Day as DatePickerDay };\nexport default Day;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEA,MAAM,MAAM,CAAC,EAAE,YAAY,2BAA2B,OAAO,SAC3D,qCAAC,OAAD;AAAA,EAAK;AAAA,EAAsB,eAAa,kBAAkB;AAAA,GACxD,qCAAC,OAAD;AAAA,EAAK,WAAW,GAAG;AAAA,EAAkB,eAAY;AAAA,GAC9C;AAIP,IAAI,YAAY;AAAA,EACd,WAAW,UAAU;AAAA,EACrB,MAAM,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA;AAIzD,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import React2 from "react";
|
|
22
|
+
import PropTypes from "prop-types";
|
|
23
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
24
|
+
import { DSPopper } from "@elliemae/ds-popper";
|
|
25
|
+
import { DatePickerPicker, PickerPropsTypes } from "./DatePickerPicker/DatePickerPicker";
|
|
26
|
+
const { classNameElement } = convertPropToCssClassName("datepicker-range");
|
|
27
|
+
const noop = () => null;
|
|
28
|
+
function DatePickerDropdown({
|
|
29
|
+
disabled = false,
|
|
30
|
+
readOnly,
|
|
31
|
+
onClick = noop,
|
|
32
|
+
isOpen,
|
|
33
|
+
menu,
|
|
34
|
+
zIndex = 1,
|
|
35
|
+
pickerProps,
|
|
36
|
+
pickerRef
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */ React2.createElement(DSPopper, {
|
|
39
|
+
contentComponent: menu,
|
|
40
|
+
isOpen,
|
|
41
|
+
modifiers: {
|
|
42
|
+
preventOverflow: {
|
|
43
|
+
enabled: true,
|
|
44
|
+
padding: 0,
|
|
45
|
+
boundariesElement: "window"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
showArrow: false,
|
|
49
|
+
triggerComponent: /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(DatePickerPicker, __spreadProps(__spreadValues({
|
|
50
|
+
innerRef: pickerRef
|
|
51
|
+
}, pickerProps), {
|
|
52
|
+
className: classNameElement("picker"),
|
|
53
|
+
disabled,
|
|
54
|
+
onClick,
|
|
55
|
+
readOnly
|
|
56
|
+
}))),
|
|
57
|
+
zIndex
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
DatePickerDropdown.propTypes = {
|
|
61
|
+
pickerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),
|
|
62
|
+
disabled: PropTypes.bool,
|
|
63
|
+
readOnly: PropTypes.bool,
|
|
64
|
+
onClick: PropTypes.func,
|
|
65
|
+
isOpen: PropTypes.bool,
|
|
66
|
+
menu: PropTypes.element,
|
|
67
|
+
zIndex: PropTypes.number,
|
|
68
|
+
pickerProps: PropTypes.shape(PickerPropsTypes)
|
|
69
|
+
};
|
|
70
|
+
var DatePickerDropdown_default = DatePickerDropdown;
|
|
71
|
+
export {
|
|
72
|
+
DatePickerDropdown,
|
|
73
|
+
DatePickerDropdown_default as default
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=DatePickerDropdown.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/DatePickerDropdown.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSPopper } from '@elliemae/ds-popper';\nimport { DatePickerPicker, PickerPropsTypes } from './DatePickerPicker/DatePickerPicker';\nconst { classNameElement } = convertPropToCssClassName('datepicker-range');\n\nconst noop = () => null;\nfunction DatePickerDropdown({\n disabled = false,\n readOnly,\n onClick = noop,\n isOpen,\n menu,\n zIndex = 1,\n pickerProps,\n pickerRef,\n}) {\n return (\n <DSPopper\n contentComponent={menu}\n isOpen={isOpen}\n modifiers={{\n preventOverflow: {\n enabled: true,\n padding: 0,\n boundariesElement: 'window',\n },\n }}\n showArrow={false}\n triggerComponent={\n <div>\n <DatePickerPicker\n innerRef={pickerRef}\n {...pickerProps}\n className={classNameElement('picker')}\n disabled={disabled}\n onClick={onClick}\n readOnly={readOnly}\n />\n </div>\n }\n zIndex={zIndex}\n />\n );\n}\n\nDatePickerDropdown.propTypes = {\n pickerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),\n disabled: PropTypes.bool,\n readOnly: PropTypes.bool,\n onClick: PropTypes.func,\n isOpen: PropTypes.bool,\n menu: PropTypes.element,\n zIndex: PropTypes.number,\n pickerProps: PropTypes.shape(PickerPropsTypes),\n};\n\nexport { DatePickerDropdown };\nexport default DatePickerDropdown;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA,MAAM,EAAE,qBAAqB,0BAA0B;AAEvD,MAAM,OAAO,MAAM;AACnB,4BAA4B;AAAA,EAC1B,WAAW;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,GACC;AACD,SACE,qCAAC,UAAD;AAAA,IACE,kBAAkB;AAAA,IAClB;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB;AAAA,QACf,SAAS;AAAA,QACT,SAAS;AAAA,QACT,mBAAmB;AAAA;AAAA;AAAA,IAGvB,WAAW;AAAA,IACX,kBACE,qCAAC,OAAD,MACE,qCAAC,kBAAD;AAAA,MACE,UAAU;AAAA,OACN,cAFN;AAAA,MAGE,WAAW,iBAAiB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAIN;AAAA;AAAA;AAKN,mBAAmB,YAAY;AAAA,EAC7B,WAAW,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU;AAAA,EACrF,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU;AAAA,EACpB,SAAS,UAAU;AAAA,EACnB,QAAQ,UAAU;AAAA,EAClB,MAAM,UAAU;AAAA,EAChB,QAAQ,UAAU;AAAA,EAClB,aAAa,UAAU,MAAM;AAAA;AAI/B,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useState, useEffect } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import moment from "moment";
|
|
5
|
+
import { DSDateInputV2, DSInputGroup } from "@elliemae/ds-form";
|
|
6
|
+
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
7
|
+
const DATE_FORMAT = "MMDDYYYY";
|
|
8
|
+
const blockname = "date-picker-header";
|
|
9
|
+
const Header = aggregatedClasses("div")(blockname);
|
|
10
|
+
const isFn = (variable) => typeof variable === "function";
|
|
11
|
+
const DatePickerHeader = ({ onInputChange = () => null, selectedDate, updateKeyDate }) => {
|
|
12
|
+
const [value, setValue] = useState(isFn(selectedDate?.format) ? selectedDate.format(DATE_FORMAT) : "");
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (isFn(selectedDate?.format)) {
|
|
15
|
+
setValue(selectedDate?.format(DATE_FORMAT));
|
|
16
|
+
}
|
|
17
|
+
}, [selectedDate]);
|
|
18
|
+
const handleOnChange = (newDate) => {
|
|
19
|
+
setValue(newDate);
|
|
20
|
+
};
|
|
21
|
+
const handleOnKeyDown = (e) => {
|
|
22
|
+
if (e.key === "Enter" && value.length === DATE_FORMAT.length) {
|
|
23
|
+
const momentValue = moment(value, DATE_FORMAT);
|
|
24
|
+
onInputChange(momentValue);
|
|
25
|
+
updateKeyDate(momentValue);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ React2.createElement(Header, null, /* @__PURE__ */ React2.createElement(DSInputGroup, null, /* @__PURE__ */ React2.createElement(DSDateInputV2, {
|
|
29
|
+
onChange: handleOnChange,
|
|
30
|
+
onKeyDown: handleOnKeyDown,
|
|
31
|
+
value,
|
|
32
|
+
containerProps: { "data-testid": "start-date" }
|
|
33
|
+
})));
|
|
34
|
+
};
|
|
35
|
+
DatePickerHeader.propTypes = {
|
|
36
|
+
onInputChange: PropTypes.func,
|
|
37
|
+
selectedDate: PropTypes.any,
|
|
38
|
+
updateKeyDate: PropTypes.any
|
|
39
|
+
};
|
|
40
|
+
var DatePickerHeader_default = DatePickerHeader;
|
|
41
|
+
export {
|
|
42
|
+
DatePickerHeader,
|
|
43
|
+
DatePickerHeader_default as default
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=DatePickerHeader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/DatePickerHeader/DatePickerHeader.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-console */\nimport React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { DSDateInputV2, DSInputGroup } from '@elliemae/ds-form';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst DATE_FORMAT = 'MMDDYYYY';\nconst blockname = 'date-picker-header';\nconst Header = aggregatedClasses('div')(blockname);\n\nconst isFn = (variable) => typeof variable === 'function';\n\nconst DatePickerHeader = ({ onInputChange = () => null, selectedDate, updateKeyDate }) => {\n const [value, setValue] = useState(isFn(selectedDate?.format) ? selectedDate.format(DATE_FORMAT) : '');\n\n useEffect(() => {\n if (isFn(selectedDate?.format)) {\n setValue(selectedDate?.format(DATE_FORMAT));\n }\n }, [selectedDate]);\n\n const handleOnChange = (newDate) => {\n setValue(newDate);\n };\n\n const handleOnKeyDown = (e) => {\n if (e.key === 'Enter' && value.length === DATE_FORMAT.length) {\n const momentValue = moment(value, DATE_FORMAT);\n onInputChange(momentValue);\n updateKeyDate(momentValue);\n }\n };\n\n return (\n <Header>\n <DSInputGroup>\n <DSDateInputV2\n onChange={handleOnChange}\n onKeyDown={handleOnKeyDown}\n value={value}\n containerProps={{ 'data-testid': 'start-date' }}\n />\n </DSInputGroup>\n </Header>\n );\n};\n\nDatePickerHeader.propTypes = {\n onInputChange: PropTypes.func,\n selectedDate: PropTypes.any,\n updateKeyDate: PropTypes.any,\n};\n\nexport { DatePickerHeader };\nexport default DatePickerHeader;\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAEA,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,SAAS,kBAAkB,OAAO;AAExC,MAAM,OAAO,CAAC,aAAa,OAAO,aAAa;AAE/C,MAAM,mBAAmB,CAAC,EAAE,gBAAgB,MAAM,MAAM,cAAc,oBAAoB;AACxF,QAAM,CAAC,OAAO,YAAY,SAAS,KAAK,cAAc,UAAU,aAAa,OAAO,eAAe;AAEnG,YAAU,MAAM;AACd,QAAI,KAAK,cAAc,SAAS;AAC9B,eAAS,cAAc,OAAO;AAAA;AAAA,KAE/B,CAAC;AAEJ,QAAM,iBAAiB,CAAC,YAAY;AAClC,aAAS;AAAA;AAGX,QAAM,kBAAkB,CAAC,MAAM;AAC7B,QAAI,EAAE,QAAQ,WAAW,MAAM,WAAW,YAAY,QAAQ;AAC5D,YAAM,cAAc,OAAO,OAAO;AAClC,oBAAc;AACd,oBAAc;AAAA;AAAA;AAIlB,SACE,qCAAC,QAAD,MACE,qCAAC,cAAD,MACE,qCAAC,eAAD;AAAA,IACE,UAAU;AAAA,IACV,WAAW;AAAA,IACX;AAAA,IACA,gBAAgB,EAAE,eAAe;AAAA;AAAA;AAO3C,iBAAiB,YAAY;AAAA,EAC3B,eAAe,UAAU;AAAA,EACzB,cAAc,UAAU;AAAA,EACxB,eAAe,UAAU;AAAA;AAI3B,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { ChevronRight } from "@elliemae/ds-icons";
|
|
5
|
+
import { DSIconColors, DSIconSizes } from "@elliemae/ds-icon";
|
|
6
|
+
import {
|
|
7
|
+
iconSizes,
|
|
8
|
+
iconColors
|
|
9
|
+
} from "@elliemae/ds-shared/prop-types";
|
|
10
|
+
const Navigation = ({
|
|
11
|
+
className = "date-picker-navigation",
|
|
12
|
+
icon: Icon = ChevronRight,
|
|
13
|
+
color = DSIconColors.NEUTRAL,
|
|
14
|
+
size = DSIconSizes.S,
|
|
15
|
+
innerRef
|
|
16
|
+
}) => /* @__PURE__ */ React2.createElement("div", {
|
|
17
|
+
tabIndex: 0,
|
|
18
|
+
"data-testid": "date-picker-nav"
|
|
19
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
20
|
+
className,
|
|
21
|
+
color,
|
|
22
|
+
innerRef,
|
|
23
|
+
size
|
|
24
|
+
}));
|
|
25
|
+
Navigation.propTypes = {
|
|
26
|
+
className: "date-picker-navigation",
|
|
27
|
+
icon: PropTypes.element,
|
|
28
|
+
color: PropTypes.oneOf(iconColors),
|
|
29
|
+
size: PropTypes.oneOf(iconSizes),
|
|
30
|
+
innerRef: PropTypes.any
|
|
31
|
+
};
|
|
32
|
+
var DatePickerNavigation_default = Navigation;
|
|
33
|
+
export {
|
|
34
|
+
Navigation as DatePickerNavigation,
|
|
35
|
+
DatePickerNavigation_default as default
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=DatePickerNavigation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/DatePickerNavigation/DatePickerNavigation.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { ChevronRight } from '@elliemae/ds-icons';\nimport { DSIconColors, DSIconSizes } from '@elliemae/ds-icon';\nimport {\n iconSizes,\n iconColors,\n} from '@elliemae/ds-shared/prop-types';\n\nconst Navigation = ({\n className = 'date-picker-navigation',\n icon: Icon = ChevronRight,\n color = DSIconColors.NEUTRAL,\n size = DSIconSizes.S,\n innerRef,\n}) => (\n <div tabIndex={0} data-testid=\"date-picker-nav\">\n <Icon className={className} color={color} innerRef={innerRef} size={size} />\n </div>\n);\nNavigation.propTypes = {\n className: 'date-picker-navigation',\n icon: PropTypes.element,\n color: PropTypes.oneOf(iconColors),\n size: PropTypes.oneOf(iconSizes),\n innerRef: PropTypes.any,\n};\n\nexport { Navigation as DatePickerNavigation };\nexport default Navigation;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAKA,MAAM,aAAa,CAAC;AAAA,EAClB,YAAY;AAAA,EACZ,MAAM,OAAO;AAAA,EACb,QAAQ,aAAa;AAAA,EACrB,OAAO,YAAY;AAAA,EACnB;AAAA,MAEA,qCAAC,OAAD;AAAA,EAAK,UAAU;AAAA,EAAG,eAAY;AAAA,GAC5B,qCAAC,MAAD;AAAA,EAAM;AAAA,EAAsB;AAAA,EAAc;AAAA,EAAoB;AAAA;AAGlE,WAAW,YAAY;AAAA,EACrB,WAAW;AAAA,EACX,MAAM,UAAU;AAAA,EAChB,OAAO,UAAU,MAAM;AAAA,EACvB,MAAM,UAAU,MAAM;AAAA,EACtB,UAAU,UAAU;AAAA;AAItB,IAAO,+BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var __objRest = (source, exclude) => {
|
|
5
|
+
var target = {};
|
|
6
|
+
for (var prop in source)
|
|
7
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8
|
+
target[prop] = source[prop];
|
|
9
|
+
if (source != null && __getOwnPropSymbols)
|
|
10
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
11
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
12
|
+
target[prop] = source[prop];
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
import * as React from "react";
|
|
17
|
+
import React2 from "react";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import { DSIconColors, DSIconSizes } from "@elliemae/ds-icon";
|
|
20
|
+
import { DatePicker } from "@elliemae/ds-icons";
|
|
21
|
+
import { DSButton, buttonTypes } from "@elliemae/ds-button";
|
|
22
|
+
import { iconSizes } from "@elliemae/ds-shared/prop-types";
|
|
23
|
+
const Picker = (_a) => {
|
|
24
|
+
var _b = _a, {
|
|
25
|
+
className = "date-picker-icon",
|
|
26
|
+
disabled = false,
|
|
27
|
+
icon = /* @__PURE__ */ React2.createElement(DatePicker, null),
|
|
28
|
+
size = DSIconSizes.M,
|
|
29
|
+
buttonActionType = "secondary",
|
|
30
|
+
onClick = () => null,
|
|
31
|
+
onBlur = () => null,
|
|
32
|
+
readOnly = false,
|
|
33
|
+
tabIndex = 0,
|
|
34
|
+
innerRef
|
|
35
|
+
} = _b, rest = __objRest(_b, [
|
|
36
|
+
"className",
|
|
37
|
+
"disabled",
|
|
38
|
+
"icon",
|
|
39
|
+
"size",
|
|
40
|
+
"buttonActionType",
|
|
41
|
+
"onClick",
|
|
42
|
+
"onBlur",
|
|
43
|
+
"readOnly",
|
|
44
|
+
"tabIndex",
|
|
45
|
+
"innerRef"
|
|
46
|
+
]);
|
|
47
|
+
return /* @__PURE__ */ React2.createElement(DSButton, {
|
|
48
|
+
innerRef,
|
|
49
|
+
"aria-label": rest["aria-label"] || "Date Picker Button",
|
|
50
|
+
buttonType: buttonActionType,
|
|
51
|
+
className,
|
|
52
|
+
color: !disabled ? DSIconColors.PRIMARY : DSIconColors.NEUTRAL,
|
|
53
|
+
disabled,
|
|
54
|
+
icon,
|
|
55
|
+
onBlur,
|
|
56
|
+
onClick,
|
|
57
|
+
readOnly,
|
|
58
|
+
size,
|
|
59
|
+
tabIndex,
|
|
60
|
+
"data-testid": "btn-date-picker"
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const PickerPropsTypes = {
|
|
64
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),
|
|
65
|
+
className: PropTypes.string,
|
|
66
|
+
disabled: PropTypes.bool,
|
|
67
|
+
icon: PropTypes.element,
|
|
68
|
+
size: PropTypes.oneOf(iconSizes),
|
|
69
|
+
buttonActionType: PropTypes.oneOf(buttonTypes),
|
|
70
|
+
onClick: PropTypes.func,
|
|
71
|
+
onFocus: PropTypes.func,
|
|
72
|
+
onBlur: PropTypes.func,
|
|
73
|
+
readOnly: PropTypes.bool,
|
|
74
|
+
tabIndex: PropTypes.number
|
|
75
|
+
};
|
|
76
|
+
Picker.propTypes = PickerPropsTypes;
|
|
77
|
+
var DatePickerPicker_default = Picker;
|
|
78
|
+
export {
|
|
79
|
+
Picker as DatePickerPicker,
|
|
80
|
+
Picker,
|
|
81
|
+
PickerPropsTypes,
|
|
82
|
+
DatePickerPicker_default as default
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=DatePickerPicker.js.map
|