@elliemae/ds-date-range-picker 2.3.1 → 3.0.0-alpha.3
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/DSDateRangePicker.js +226 -0
- package/dist/cjs/DSDateRangePicker.js.map +7 -0
- package/dist/cjs/components/DSDateRangePickerImpl.js +293 -0
- package/dist/cjs/components/DSDateRangePickerImpl.js.map +7 -0
- package/dist/cjs/components/DatePickerLabel/DatePickerLabel.js +39 -0
- package/dist/cjs/components/DatePickerLabel/DatePickerLabel.js.map +7 -0
- package/dist/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +112 -0
- package/dist/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +7 -0
- package/dist/cjs/components/DayPickerRangeController.js +203 -0
- package/dist/cjs/components/DayPickerRangeController.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/isMaxDiffSafe.js +46 -0
- package/dist/cjs/isMaxDiffSafe.js.map +7 -0
- package/dist/esm/DSDateRangePicker.js +202 -0
- package/dist/esm/DSDateRangePicker.js.map +7 -0
- package/dist/esm/components/DSDateRangePickerImpl.js +264 -0
- package/dist/esm/components/DSDateRangePickerImpl.js.map +7 -0
- package/dist/esm/components/DatePickerLabel/DatePickerLabel.js +10 -0
- package/dist/esm/components/DatePickerLabel/DatePickerLabel.js.map +7 -0
- package/{esm → dist/esm}/components/DatePickerRangeHeader/DatePickerRangeHeader.js +36 -45
- package/dist/esm/components/DatePickerRangeHeader/DatePickerRangeHeader.js.map +7 -0
- package/dist/esm/components/DayPickerRangeController.js +176 -0
- package/dist/esm/components/DayPickerRangeController.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/isMaxDiffSafe.js +17 -0
- package/dist/esm/isMaxDiffSafe.js.map +7 -0
- package/package.json +41 -32
- package/cjs/DSDateRangePicker.js +0 -204
- package/cjs/components/DSDateRangePickerImpl.js +0 -343
- package/cjs/components/DatePickerLabel/DatePickerLabel.js +0 -20
- package/cjs/components/DatePickerRangeHeader/DatePickerRangeHeader.js +0 -100
- package/cjs/components/DayPickerRangeController.js +0 -147
- package/cjs/index.js +0 -15
- package/cjs/isMaxDiffSafe.js +0 -20
- package/esm/DSDateRangePicker.js +0 -191
- package/esm/components/DSDateRangePickerImpl.js +0 -330
- package/esm/components/DatePickerLabel/DatePickerLabel.js +0 -14
- package/esm/components/DayPickerRangeController.js +0 -139
- package/esm/index.js +0 -3
- package/esm/isMaxDiffSafe.js +0 -15
- package/types/DSDateRangePicker.d.ts +0 -243
- package/types/components/DSDateRangePickerImpl.d.ts +0 -24
- package/types/components/DatePickerLabel/DatePickerLabel.d.ts +0 -6
- package/types/components/DatePickerRangeHeader/DatePickerRangeHeader.d.ts +0 -10
- package/types/components/DayPickerRangeController.d.ts +0 -36
- package/types/index.d.ts +0 -2
- package/types/isMaxDiffSafe.d.ts +0 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var DatePickerRangeHeader_exports = {};
|
|
29
|
+
__export(DatePickerRangeHeader_exports, {
|
|
30
|
+
default: () => DatePickerRangeHeader_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_moment = __toESM(require("moment"));
|
|
35
|
+
var import_ds_form = __toESM(require("@elliemae/ds-form"));
|
|
36
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
37
|
+
const blockname = "date-range-picker";
|
|
38
|
+
const Header = (0, import_ds_classnames.aggregatedClasses)("div")(blockname, "header");
|
|
39
|
+
const formatDate = (date) => {
|
|
40
|
+
if (date) {
|
|
41
|
+
return date.format("MMDDYYYY");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const DatePickerRangeHeader = ({
|
|
45
|
+
placeholderStart = "Start Date",
|
|
46
|
+
placeholderEnd = "End Date",
|
|
47
|
+
onStartInputChange = () => null,
|
|
48
|
+
onEndInputChange = () => null,
|
|
49
|
+
selectedStartDate,
|
|
50
|
+
selectedEndDate
|
|
51
|
+
}) => {
|
|
52
|
+
const [startValue, setStartValue] = (0, import_react.useState)(selectedStartDate ? formatDate(selectedStartDate) : "");
|
|
53
|
+
const [endValue, setEndValue] = (0, import_react.useState)(selectedEndDate ? formatDate(selectedEndDate) : "");
|
|
54
|
+
(0, import_react.useEffect)(() => {
|
|
55
|
+
const startDate = formatDate(selectedStartDate);
|
|
56
|
+
const endDate = formatDate(selectedEndDate);
|
|
57
|
+
startDate !== startValue && setStartValue(startDate);
|
|
58
|
+
endDate !== endValue && setEndValue(endDate);
|
|
59
|
+
}, [selectedStartDate, selectedEndDate]);
|
|
60
|
+
const handleOnChangeStart = (e) => {
|
|
61
|
+
const newStartValue = e.target.value;
|
|
62
|
+
setStartValue(newStartValue);
|
|
63
|
+
};
|
|
64
|
+
const handleOnChangeEnd = (e) => {
|
|
65
|
+
const newEndValue = e.target.value;
|
|
66
|
+
setEndValue(newEndValue);
|
|
67
|
+
};
|
|
68
|
+
const handleOnBlurStart = (e) => {
|
|
69
|
+
const newStartValue = e.target.value;
|
|
70
|
+
onStartInputChange((0, import_moment.default)(newStartValue));
|
|
71
|
+
};
|
|
72
|
+
const handleOnBlurEnd = (e) => {
|
|
73
|
+
const newEndValue = e.target.value;
|
|
74
|
+
onEndInputChange((0, import_moment.default)(newEndValue));
|
|
75
|
+
};
|
|
76
|
+
const handleOnKeyDownStart = (e) => {
|
|
77
|
+
if (e.key === "Enter") {
|
|
78
|
+
const newValue = e.target.value;
|
|
79
|
+
onStartInputChange((0, import_moment.default)(newValue));
|
|
80
|
+
e.target.blur();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const handleOnKeyDownEnd = (e) => {
|
|
84
|
+
if (e.key === "Enter") {
|
|
85
|
+
const newValue = e.target.value;
|
|
86
|
+
onEndInputChange((0, import_moment.default)(newValue));
|
|
87
|
+
e.target.blur();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ import_react.default.createElement(Header, null, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSInputGroup, null, /* @__PURE__ */ import_react.default.createElement(import_ds_form.default, {
|
|
91
|
+
"aria-label": placeholderStart || "Date Picker Input Mask",
|
|
92
|
+
mask: import_ds_form.MASK_TYPES.DATE,
|
|
93
|
+
onBlur: handleOnBlurStart,
|
|
94
|
+
onChange: handleOnChangeStart,
|
|
95
|
+
onKeyDown: handleOnKeyDownStart,
|
|
96
|
+
pipe: import_ds_form.MASK_PIPES.AUTO_CORRECT_DATE,
|
|
97
|
+
placeholder: placeholderStart,
|
|
98
|
+
value: startValue
|
|
99
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_ds_form.default, {
|
|
100
|
+
"aria-label": placeholderEnd || "Date Picker Input Mask",
|
|
101
|
+
mask: import_ds_form.MASK_TYPES.DATE,
|
|
102
|
+
onBlur: handleOnBlurEnd,
|
|
103
|
+
onChange: handleOnChangeEnd,
|
|
104
|
+
onKeyDown: handleOnKeyDownEnd,
|
|
105
|
+
pipe: import_ds_form.MASK_PIPES.AUTO_CORRECT_DATE,
|
|
106
|
+
placeholder: placeholderEnd,
|
|
107
|
+
value: endValue
|
|
108
|
+
})));
|
|
109
|
+
};
|
|
110
|
+
var DatePickerRangeHeader_default = DatePickerRangeHeader;
|
|
111
|
+
module.exports = __toCommonJS(DatePickerRangeHeader_exports);
|
|
112
|
+
//# sourceMappingURL=DatePickerRangeHeader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/DatePickerRangeHeader/DatePickerRangeHeader.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-unused-expressions */\n/* eslint-disable no-console */\nimport React, { useState, useEffect } from 'react';\nimport moment from 'moment';\nimport DSInputMask, { DSInputGroup, MASK_TYPES, MASK_PIPES } from '@elliemae/ds-form';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst blockname = 'date-range-picker';\nconst Header = aggregatedClasses('div')(blockname, 'header');\n\nconst formatDate = (date) => {\n if (date) {\n return date.format('MMDDYYYY');\n }\n};\n\nconst DatePickerRangeHeader = ({\n placeholderStart = 'Start Date',\n placeholderEnd = 'End Date',\n onStartInputChange = () => null,\n onEndInputChange = () => null,\n selectedStartDate,\n selectedEndDate,\n}) => {\n const [startValue, setStartValue] = useState(selectedStartDate ? formatDate(selectedStartDate) : '');\n const [endValue, setEndValue] = useState(selectedEndDate ? formatDate(selectedEndDate) : '');\n\n useEffect(() => {\n const startDate = formatDate(selectedStartDate);\n const endDate = formatDate(selectedEndDate);\n startDate !== startValue && setStartValue(startDate);\n endDate !== endValue && setEndValue(endDate);\n }, [selectedStartDate, selectedEndDate]);\n\n const handleOnChangeStart = (e) => {\n const newStartValue = e.target.value;\n setStartValue(newStartValue);\n };\n\n const handleOnChangeEnd = (e) => {\n const newEndValue = e.target.value;\n setEndValue(newEndValue);\n };\n\n const handleOnBlurStart = (e) => {\n const newStartValue = e.target.value;\n onStartInputChange(moment(newStartValue));\n };\n\n const handleOnBlurEnd = (e) => {\n const newEndValue = e.target.value;\n onEndInputChange(moment(newEndValue));\n };\n\n const handleOnKeyDownStart = (e) => {\n if (e.key === 'Enter') {\n const newValue = e.target.value;\n onStartInputChange(moment(newValue));\n e.target.blur();\n }\n };\n\n const handleOnKeyDownEnd = (e) => {\n if (e.key === 'Enter') {\n const newValue = e.target.value;\n onEndInputChange(moment(newValue));\n e.target.blur();\n }\n };\n\n return (\n <Header>\n <DSInputGroup>\n <DSInputMask\n aria-label={placeholderStart || 'Date Picker Input Mask'}\n mask={MASK_TYPES.DATE}\n onBlur={handleOnBlurStart}\n onChange={handleOnChangeStart}\n onKeyDown={handleOnKeyDownStart}\n pipe={MASK_PIPES.AUTO_CORRECT_DATE}\n placeholder={placeholderStart}\n value={startValue}\n />\n <DSInputMask\n aria-label={placeholderEnd || 'Date Picker Input Mask'}\n mask={MASK_TYPES.DATE}\n onBlur={handleOnBlurEnd}\n onChange={handleOnChangeEnd}\n onKeyDown={handleOnKeyDownEnd}\n pipe={MASK_PIPES.AUTO_CORRECT_DATE}\n placeholder={placeholderEnd}\n value={endValue}\n />\n </DSInputGroup>\n </Header>\n );\n};\n\nexport default DatePickerRangeHeader;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA2C;AAC3C,oBAAmB;AACnB,qBAAkE;AAClE,2BAAkC;AAElC,MAAM,YAAY;AAClB,MAAM,SAAS,4CAAkB,OAAO,WAAW;AAEnD,MAAM,aAAa,CAAC,SAAS;AAC3B,MAAI,MAAM;AACR,WAAO,KAAK,OAAO;AAAA;AAAA;AAIvB,MAAM,wBAAwB,CAAC;AAAA,EAC7B,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,qBAAqB,MAAM;AAAA,EAC3B,mBAAmB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,MACI;AACJ,QAAM,CAAC,YAAY,iBAAiB,2BAAS,oBAAoB,WAAW,qBAAqB;AACjG,QAAM,CAAC,UAAU,eAAe,2BAAS,kBAAkB,WAAW,mBAAmB;AAEzF,8BAAU,MAAM;AACd,UAAM,YAAY,WAAW;AAC7B,UAAM,UAAU,WAAW;AAC3B,kBAAc,cAAc,cAAc;AAC1C,gBAAY,YAAY,YAAY;AAAA,KACnC,CAAC,mBAAmB;AAEvB,QAAM,sBAAsB,CAAC,MAAM;AACjC,UAAM,gBAAgB,EAAE,OAAO;AAC/B,kBAAc;AAAA;AAGhB,QAAM,oBAAoB,CAAC,MAAM;AAC/B,UAAM,cAAc,EAAE,OAAO;AAC7B,gBAAY;AAAA;AAGd,QAAM,oBAAoB,CAAC,MAAM;AAC/B,UAAM,gBAAgB,EAAE,OAAO;AAC/B,uBAAmB,2BAAO;AAAA;AAG5B,QAAM,kBAAkB,CAAC,MAAM;AAC7B,UAAM,cAAc,EAAE,OAAO;AAC7B,qBAAiB,2BAAO;AAAA;AAG1B,QAAM,uBAAuB,CAAC,MAAM;AAClC,QAAI,EAAE,QAAQ,SAAS;AACrB,YAAM,WAAW,EAAE,OAAO;AAC1B,yBAAmB,2BAAO;AAC1B,QAAE,OAAO;AAAA;AAAA;AAIb,QAAM,qBAAqB,CAAC,MAAM;AAChC,QAAI,EAAE,QAAQ,SAAS;AACrB,YAAM,WAAW,EAAE,OAAO;AAC1B,uBAAiB,2BAAO;AACxB,QAAE,OAAO;AAAA;AAAA;AAIb,SACE,mDAAC,QAAD,MACE,mDAAC,6BAAD,MACE,mDAAC,wBAAD;AAAA,IACE,cAAY,oBAAoB;AAAA,IAChC,MAAM,0BAAW;AAAA,IACjB,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,WAAW;AAAA,IACX,MAAM,0BAAW;AAAA,IACjB,aAAa;AAAA,IACb,OAAO;AAAA,MAET,mDAAC,wBAAD;AAAA,IACE,cAAY,kBAAkB;AAAA,IAC9B,MAAM,0BAAW;AAAA,IACjB,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,WAAW;AAAA,IACX,MAAM,0BAAW;AAAA,IACjB,aAAa;AAAA,IACb,OAAO;AAAA;AAAA;AAOjB,IAAO,gCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
42
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(module2))
|
|
44
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
45
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (module2, isNodeMode) => {
|
|
50
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
51
|
+
};
|
|
52
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
53
|
+
return (module2, temp) => {
|
|
54
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
55
|
+
};
|
|
56
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
57
|
+
var DayPickerRangeController_exports = {};
|
|
58
|
+
__export(DayPickerRangeController_exports, {
|
|
59
|
+
default: () => DayPickerRangeController_default
|
|
60
|
+
});
|
|
61
|
+
var React = __toESM(require("react"));
|
|
62
|
+
var import_react = __toESM(require("react"));
|
|
63
|
+
var import_prop_types = __toESM(require("prop-types"));
|
|
64
|
+
var import_moment = __toESM(require("moment"));
|
|
65
|
+
var import_react_dates = require("react-dates");
|
|
66
|
+
var import_ds_date_picker = require("@elliemae/ds-date-picker");
|
|
67
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
68
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
69
|
+
const { classNameElement, classNameBlock } = (0, import_ds_classnames.convertPropToCssClassName)("datepicker-range");
|
|
70
|
+
const DayPickerRangeController = (_a) => {
|
|
71
|
+
var _b = _a, {
|
|
72
|
+
endDate = void 0,
|
|
73
|
+
startDate = void 0,
|
|
74
|
+
displayFormatDay = "D",
|
|
75
|
+
focusedInput = void 0,
|
|
76
|
+
enableOutsideDays = false,
|
|
77
|
+
onDatesChange = () => null,
|
|
78
|
+
onFocusChange = () => null,
|
|
79
|
+
onOutsideClick = () => null,
|
|
80
|
+
isDayBlocked = () => null,
|
|
81
|
+
isDayHighlighted = () => null,
|
|
82
|
+
isOutsideRange = () => null,
|
|
83
|
+
onNextMonthClick = () => null,
|
|
84
|
+
onPrevMonthClick = () => null
|
|
85
|
+
} = _b, otherProps = __objRest(_b, [
|
|
86
|
+
"endDate",
|
|
87
|
+
"startDate",
|
|
88
|
+
"displayFormatDay",
|
|
89
|
+
"focusedInput",
|
|
90
|
+
"enableOutsideDays",
|
|
91
|
+
"onDatesChange",
|
|
92
|
+
"onFocusChange",
|
|
93
|
+
"onOutsideClick",
|
|
94
|
+
"isDayBlocked",
|
|
95
|
+
"isDayHighlighted",
|
|
96
|
+
"isOutsideRange",
|
|
97
|
+
"onNextMonthClick",
|
|
98
|
+
"onPrevMonthClick"
|
|
99
|
+
]);
|
|
100
|
+
const datePickerRef = (0, import_react.useRef)();
|
|
101
|
+
(0, import_react.useEffect)(() => {
|
|
102
|
+
const handleMouseUp = () => {
|
|
103
|
+
const focusedElement = document.activeElement;
|
|
104
|
+
focusedElement.blur();
|
|
105
|
+
};
|
|
106
|
+
const handleKeyDown = (event) => {
|
|
107
|
+
const [firstDay, ...restOfDays] = document.getElementsByClassName("CalendarMonthGrid_month__horizontal")[1].getElementsByClassName("CalendarDay");
|
|
108
|
+
const [lastDay] = restOfDays.slice(-1);
|
|
109
|
+
const focusedElement = document.activeElement;
|
|
110
|
+
const [prev, next] = document.getElementsByClassName("DayPickerNavigation_button");
|
|
111
|
+
switch (event.key) {
|
|
112
|
+
case "Home":
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
firstDay.focus();
|
|
115
|
+
break;
|
|
116
|
+
case "End":
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
lastDay.focus();
|
|
119
|
+
break;
|
|
120
|
+
case "Enter":
|
|
121
|
+
case " ":
|
|
122
|
+
if (focusedElement === prev) {
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
prev.focus();
|
|
126
|
+
}, 240);
|
|
127
|
+
} else if (focusedElement === next) {
|
|
128
|
+
event.stopPropagation();
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
next?.focus();
|
|
131
|
+
}, 240);
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case "Tab":
|
|
135
|
+
if (firstDay === focusedElement || restOfDays.includes(focusedElement)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
prev.focus();
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
default:
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
datePickerRef.current.addEventListener("mouseup", handleMouseUp, false);
|
|
145
|
+
datePickerRef.current.addEventListener("keydown", handleKeyDown, false);
|
|
146
|
+
return () => {
|
|
147
|
+
if (datePickerRef.current) {
|
|
148
|
+
datePickerRef.current.removeEventListener("mouseup", handleMouseUp, false);
|
|
149
|
+
datePickerRef.current.removeEventListener("keydown", handleKeyDown, false);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}, []);
|
|
153
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
154
|
+
ref: datePickerRef,
|
|
155
|
+
className: classNameBlock("wrapper-day-picker-single-date-controller"),
|
|
156
|
+
"data-testid": otherProps["data-testid"] || "date-range-picker-controller"
|
|
157
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_react_dates.DayPickerRangeController, __spreadProps(__spreadValues({}, otherProps), {
|
|
158
|
+
isDayBlocked,
|
|
159
|
+
isDayHighlighted,
|
|
160
|
+
isOutsideRange,
|
|
161
|
+
enableOutsideDays,
|
|
162
|
+
endDate,
|
|
163
|
+
focused: true,
|
|
164
|
+
focusedInput,
|
|
165
|
+
hideKeyboardShortcutsPanel: true,
|
|
166
|
+
navNext: /* @__PURE__ */ import_react.default.createElement(import_ds_date_picker.DatePickerNavigation, {
|
|
167
|
+
className: classNameElement("navigation-next")
|
|
168
|
+
}),
|
|
169
|
+
navPrev: /* @__PURE__ */ import_react.default.createElement(import_ds_date_picker.DatePickerNavigation, {
|
|
170
|
+
className: classNameElement("navigation-prev"),
|
|
171
|
+
icon: import_ds_icons.ChevronLeft
|
|
172
|
+
}),
|
|
173
|
+
onDatesChange,
|
|
174
|
+
onFocusChange,
|
|
175
|
+
onOutsideClick,
|
|
176
|
+
onNextMonthClick,
|
|
177
|
+
onPrevMonthClick,
|
|
178
|
+
renderDayContents: (date) => /* @__PURE__ */ import_react.default.createElement(import_ds_date_picker.DatePickerDay, {
|
|
179
|
+
className: classNameElement("day-contents"),
|
|
180
|
+
date: date.format(displayFormatDay)
|
|
181
|
+
}),
|
|
182
|
+
renderMonthElement: import_ds_date_picker.renderMonthElement,
|
|
183
|
+
startDate
|
|
184
|
+
})));
|
|
185
|
+
};
|
|
186
|
+
DayPickerRangeController.propTypes = {
|
|
187
|
+
endDate: import_prop_types.default.instanceOf(Date, import_moment.default),
|
|
188
|
+
startDate: import_prop_types.default.instanceOf(Date, import_moment.default),
|
|
189
|
+
displayFormatDay: import_prop_types.default.string,
|
|
190
|
+
focusedInput: import_prop_types.default.bool,
|
|
191
|
+
onDatesChange: import_prop_types.default.func,
|
|
192
|
+
onFocusChange: import_prop_types.default.func,
|
|
193
|
+
onOutsideClick: import_prop_types.default.func,
|
|
194
|
+
onNextMonthClick: import_prop_types.default.func,
|
|
195
|
+
onPrevMonthClick: import_prop_types.default.func,
|
|
196
|
+
enableOutsideDays: import_prop_types.default.bool,
|
|
197
|
+
isDayBlocked: import_prop_types.default.func,
|
|
198
|
+
isDayHighlighted: import_prop_types.default.func,
|
|
199
|
+
isOutsideRange: import_prop_types.default.func
|
|
200
|
+
};
|
|
201
|
+
var DayPickerRangeController_default = DayPickerRangeController;
|
|
202
|
+
module.exports = __toCommonJS(DayPickerRangeController_exports);
|
|
203
|
+
//# sourceMappingURL=DayPickerRangeController.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DayPickerRangeController.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable import/no-unresolved */\n/* eslint-disable max-lines */\nimport React, { useRef, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { DayPickerRangeController as RDRangeController } from 'react-dates';\nimport { DatePickerDay, DatePickerNavigation, renderMonthElement } from '@elliemae/ds-date-picker';\nimport { ChevronLeft } from '@elliemae/ds-icons';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\n\nconst { classNameElement, classNameBlock } = convertPropToCssClassName('datepicker-range');\n\nconst DayPickerRangeController = ({\n endDate = undefined,\n startDate = undefined,\n displayFormatDay = 'D',\n focusedInput = undefined,\n enableOutsideDays = false,\n onDatesChange = () => null,\n onFocusChange = () => null,\n onOutsideClick = () => null,\n isDayBlocked = () => null,\n isDayHighlighted = () => null,\n isOutsideRange = () => null,\n onNextMonthClick = () => null,\n onPrevMonthClick = () => null,\n ...otherProps\n}) => {\n const datePickerRef = useRef();\n\n useEffect(() => {\n const handleMouseUp = () => {\n const focusedElement = document.activeElement;\n\n focusedElement.blur();\n };\n const handleKeyDown = (event) => {\n const [firstDay, ...restOfDays] = document\n .getElementsByClassName('CalendarMonthGrid_month__horizontal')[1]\n .getElementsByClassName('CalendarDay');\n const [lastDay] = restOfDays.slice(-1);\n const focusedElement = document.activeElement;\n const [prev, next] = document.getElementsByClassName('DayPickerNavigation_button');\n\n switch (event.key) {\n case 'Home':\n event.stopPropagation();\n firstDay.focus();\n break;\n case 'End':\n event.stopPropagation();\n lastDay.focus();\n break;\n case 'Enter':\n case ' ':\n if (focusedElement === prev) {\n event.stopPropagation();\n setTimeout(() => {\n prev.focus();\n }, 240);\n } else if (focusedElement === next) {\n event.stopPropagation();\n setTimeout(() => {\n next?.focus();\n }, 240);\n }\n break;\n case 'Tab':\n if (firstDay === focusedElement || restOfDays.includes(focusedElement)) {\n event.preventDefault();\n prev.focus();\n }\n break;\n default:\n break;\n }\n };\n\n datePickerRef.current.addEventListener('mouseup', handleMouseUp, false);\n\n datePickerRef.current.addEventListener('keydown', handleKeyDown, false);\n\n return () => {\n if (datePickerRef.current) {\n datePickerRef.current.removeEventListener('mouseup', handleMouseUp, false);\n\n datePickerRef.current.removeEventListener('keydown', handleKeyDown, false);\n }\n };\n }, []);\n\n return (\n <div\n ref={datePickerRef}\n className={classNameBlock('wrapper-day-picker-single-date-controller')}\n data-testid={otherProps['data-testid'] || 'date-range-picker-controller'}\n >\n <RDRangeController\n {...otherProps}\n isDayBlocked={isDayBlocked}\n isDayHighlighted={isDayHighlighted}\n isOutsideRange={isOutsideRange}\n enableOutsideDays={enableOutsideDays}\n endDate={endDate}\n focused\n focusedInput={focusedInput}\n hideKeyboardShortcutsPanel\n navNext={<DatePickerNavigation className={classNameElement('navigation-next')} />}\n navPrev={<DatePickerNavigation className={classNameElement('navigation-prev')} icon={ChevronLeft} />}\n onDatesChange={onDatesChange}\n onFocusChange={onFocusChange}\n onOutsideClick={onOutsideClick}\n onNextMonthClick={onNextMonthClick}\n onPrevMonthClick={onPrevMonthClick}\n renderDayContents={(date) => (\n <DatePickerDay className={classNameElement('day-contents')} date={date.format(displayFormatDay)} />\n )}\n renderMonthElement={renderMonthElement}\n startDate={startDate}\n />\n </div>\n );\n};\n\nDayPickerRangeController.propTypes = {\n endDate: PropTypes.instanceOf(Date, moment),\n startDate: PropTypes.instanceOf(Date, moment),\n displayFormatDay: PropTypes.string,\n focusedInput: PropTypes.bool,\n onDatesChange: PropTypes.func,\n onFocusChange: PropTypes.func,\n onOutsideClick: PropTypes.func,\n onNextMonthClick: PropTypes.func,\n onPrevMonthClick: PropTypes.func,\n enableOutsideDays: PropTypes.bool,\n isDayBlocked: PropTypes.func,\n isDayHighlighted: PropTypes.func,\n isOutsideRange: PropTypes.func,\n};\n\nexport default DayPickerRangeController;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
default: () => import_DSDateRangePicker.default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_DSDateRangePicker = __toESM(require("./DSDateRangePicker"));
|
|
34
|
+
__reExport(src_exports, require("./DSDateRangePicker"));
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { default } from './DSDateRangePicker';\nexport * from './DSDateRangePicker';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAwB;AACxB,wBAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var isMaxDiffSafe_exports = {};
|
|
29
|
+
__export(isMaxDiffSafe_exports, {
|
|
30
|
+
MAX_YEARS_DIFF: () => MAX_YEARS_DIFF,
|
|
31
|
+
isMaxDiffSafe: () => isMaxDiffSafe
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
const MAX_YEARS_DIFF = 150;
|
|
35
|
+
const isMaxDiffSafe = (startDate, endDate, prevStart, prevEnd) => {
|
|
36
|
+
try {
|
|
37
|
+
const diff = Math.abs(endDate.diff(startDate, "years"));
|
|
38
|
+
const diffStart = Math.abs(startDate.diff(prevStart, "years"));
|
|
39
|
+
const diffEnd = Math.abs(endDate.diff(prevEnd, "years"));
|
|
40
|
+
return diff < MAX_YEARS_DIFF && diffStart < MAX_YEARS_DIFF && diffEnd < MAX_YEARS_DIFF;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
module.exports = __toCommonJS(isMaxDiffSafe_exports);
|
|
46
|
+
//# sourceMappingURL=isMaxDiffSafe.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/isMaxDiffSafe.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-params */\nexport const MAX_YEARS_DIFF = 150;\n// https://jira.elliemae.io/browse/PUI-4145\nexport const isMaxDiffSafe = (startDate, endDate, prevStart, prevEnd) => {\n try {\n const diff = Math.abs(endDate.diff(startDate, 'years'));\n const diffStart = Math.abs(startDate.diff(prevStart, 'years'));\n const diffEnd = Math.abs(endDate.diff(prevEnd, 'years'));\n return (\n diff < MAX_YEARS_DIFF &&\n diffStart < MAX_YEARS_DIFF &&\n diffEnd < MAX_YEARS_DIFF\n );\n } catch (error) {\n return true;\n }\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADChB,MAAM,iBAAiB;AAEvB,MAAM,gBAAgB,CAAC,WAAW,SAAS,WAAW,YAAY;AACvE,MAAI;AACF,UAAM,OAAO,KAAK,IAAI,QAAQ,KAAK,WAAW;AAC9C,UAAM,YAAY,KAAK,IAAI,UAAU,KAAK,WAAW;AACrD,UAAM,UAAU,KAAK,IAAI,QAAQ,KAAK,SAAS;AAC/C,WACE,OAAO,kBACP,YAAY,kBACZ,UAAU;AAAA,WAEL,OAAP;AACA,WAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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, describe } from "react-desc";
|
|
23
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
24
|
+
import moment from "moment";
|
|
25
|
+
import "react-dates/initialize";
|
|
26
|
+
import { DateRangePickerPhrases } from "react-dates/lib/defaultPhrases";
|
|
27
|
+
import DayPickerRangeController from "./components/DayPickerRangeController";
|
|
28
|
+
import DSDateRangePickerImpl, {
|
|
29
|
+
START_DATE,
|
|
30
|
+
END_DATE
|
|
31
|
+
} from "./components/DSDateRangePickerImpl";
|
|
32
|
+
const DSDateRangePicker = ({
|
|
33
|
+
containerProps = {},
|
|
34
|
+
className = "",
|
|
35
|
+
disabled = false,
|
|
36
|
+
required = false,
|
|
37
|
+
startDateRequired = false,
|
|
38
|
+
endDateRequired = false,
|
|
39
|
+
id,
|
|
40
|
+
hasError = false,
|
|
41
|
+
validationMessage = "",
|
|
42
|
+
readOnly = false,
|
|
43
|
+
screenReaderInputMessage = "Select date",
|
|
44
|
+
initialVisibleMonth = moment(),
|
|
45
|
+
firstDayOfWeek = 0,
|
|
46
|
+
keepOpenOnDateSelect = true,
|
|
47
|
+
reopenPickerOnClearDates = false,
|
|
48
|
+
hideKeyboardShortcutsPanel = true,
|
|
49
|
+
onPrevMonthClick = () => null,
|
|
50
|
+
onNextMonthClick = () => null,
|
|
51
|
+
onClose = () => null,
|
|
52
|
+
onOutsideClick = () => null,
|
|
53
|
+
transitionDuration = 0,
|
|
54
|
+
verticalSpacing = 0,
|
|
55
|
+
minimumNights = 0,
|
|
56
|
+
isDayBlocked = () => false,
|
|
57
|
+
isOutsideRange = () => false,
|
|
58
|
+
isDayHighlighted = () => false,
|
|
59
|
+
displayFormat = "L",
|
|
60
|
+
displayFormatDay = "D",
|
|
61
|
+
phrases = DateRangePickerPhrases,
|
|
62
|
+
startDate,
|
|
63
|
+
endDate,
|
|
64
|
+
startDateId = "startDateId",
|
|
65
|
+
endDateId = "endDateId",
|
|
66
|
+
labelFrom = "From",
|
|
67
|
+
labelTo = "To",
|
|
68
|
+
enableOutsideDays = true,
|
|
69
|
+
onChangeStartInput = () => null,
|
|
70
|
+
onChangeEndInput = () => null,
|
|
71
|
+
onDatesChange = () => null
|
|
72
|
+
}) => {
|
|
73
|
+
const { cssClassName, prefixBlockName } = convertPropToCssClassName("datepicker", className, {
|
|
74
|
+
hasError,
|
|
75
|
+
readOnly,
|
|
76
|
+
disabled,
|
|
77
|
+
id
|
|
78
|
+
});
|
|
79
|
+
return /* @__PURE__ */ React2.createElement("div", __spreadProps(__spreadValues({}, containerProps), {
|
|
80
|
+
className: `${prefixBlockName}-range ${cssClassName} ${prefixBlockName}-range`
|
|
81
|
+
}), /* @__PURE__ */ React2.createElement(DSDateRangePickerImpl, {
|
|
82
|
+
appendToBody: true,
|
|
83
|
+
disabled,
|
|
84
|
+
displayFormat,
|
|
85
|
+
displayFormatDay,
|
|
86
|
+
enableOutsideDays,
|
|
87
|
+
endDate,
|
|
88
|
+
endDateId,
|
|
89
|
+
firstDayOfWeek,
|
|
90
|
+
hideKeyboardShortcutsPanel,
|
|
91
|
+
initialVisibleMonth: () => initialVisibleMonth ? moment(initialVisibleMonth) : moment(startDate),
|
|
92
|
+
isDayBlocked,
|
|
93
|
+
isDayHighlighted,
|
|
94
|
+
isOutsideRange: isOutsideRange === true || isOutsideRange === false ? () => isOutsideRange : isOutsideRange,
|
|
95
|
+
keepOpenOnDateSelect,
|
|
96
|
+
labelFrom,
|
|
97
|
+
labelTo,
|
|
98
|
+
minimumNights,
|
|
99
|
+
onDatesChange,
|
|
100
|
+
onChangeStartInput,
|
|
101
|
+
onChangeEndInput,
|
|
102
|
+
onClose,
|
|
103
|
+
onNextMonthClick,
|
|
104
|
+
onPrevMonthClick,
|
|
105
|
+
onOutsideClick,
|
|
106
|
+
phrases,
|
|
107
|
+
readOnly,
|
|
108
|
+
reopenPickerOnClearDates,
|
|
109
|
+
required,
|
|
110
|
+
startDateRequired,
|
|
111
|
+
endDateRequired,
|
|
112
|
+
screenReaderInputMessage,
|
|
113
|
+
startDate,
|
|
114
|
+
startDateId,
|
|
115
|
+
transitionDuration,
|
|
116
|
+
verticalSpacing,
|
|
117
|
+
hasError,
|
|
118
|
+
validationMessage
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
const dateRangePickerProps = {
|
|
122
|
+
containerProps: PropTypes.shape({}).description("Set of Properties attached to the main container"),
|
|
123
|
+
className: PropTypes.string.description("html class attribute"),
|
|
124
|
+
disabled: PropTypes.bool.description("disable component or not").defaultValue(false),
|
|
125
|
+
required: PropTypes.bool.description("input is required or not").defaultValue(false),
|
|
126
|
+
startDateRequired: PropTypes.bool.description("start date is required or not").defaultValue(false),
|
|
127
|
+
endDateRequired: PropTypes.bool.description("end date is required or not").defaultValue(false),
|
|
128
|
+
id: PropTypes.string.description("components id"),
|
|
129
|
+
hasError: PropTypes.bool.description("set error state").defaultValue(false),
|
|
130
|
+
validationMessage: PropTypes.string.description("validation message"),
|
|
131
|
+
readOnly: PropTypes.bool.description("component is read only or not").description(false),
|
|
132
|
+
screenReaderInputMessage: PropTypes.string.description("message to be anounced by screen reader").defaultValue("select date"),
|
|
133
|
+
initialVisibleMonth: PropTypes.instanceOf(Date, moment).description("initial visible month"),
|
|
134
|
+
firstDayOfWeek: PropTypes.number.description("first day of week").defaultValue(0),
|
|
135
|
+
keepOpenOnDateSelect: PropTypes.bool.description("keep picker open when a date is selected").defaultValue(true),
|
|
136
|
+
reopenPickerOnClearDates: PropTypes.bool.description("reopen picker when clearing dates").defaultValue(false),
|
|
137
|
+
hideKeyboardShortcutsPanel: PropTypes.bool.description("hide keyabord shortcut panel or not"),
|
|
138
|
+
onPrevMonthClick: PropTypes.func.description("function executed when clicking on prev month button"),
|
|
139
|
+
onNextMonthClick: PropTypes.func.description("function executed when clicking on next month button"),
|
|
140
|
+
onClose: PropTypes.func.description("function executed when component closes"),
|
|
141
|
+
transitionDuration: PropTypes.number.description("transition duration").defaultValue(0),
|
|
142
|
+
verticalSpacing: PropTypes.number.description("vertical spacing"),
|
|
143
|
+
isDayBlocked: PropTypes.func.description("function that returns each day and disables desired dates"),
|
|
144
|
+
isOutsideRange: PropTypes.func.description("function that returns each day and disables outisde range dates"),
|
|
145
|
+
isDayHighlighted: PropTypes.func.description("function that returns each day and higlights desired dates"),
|
|
146
|
+
minimumNights: 0,
|
|
147
|
+
displayFormat: PropTypes.string.description("display format").defaultValue("L"),
|
|
148
|
+
displayFormatDay: PropTypes.string.description("display format day").defaultValue("D"),
|
|
149
|
+
phrases: PropTypes.shape({
|
|
150
|
+
calendarLabel: PropTypes.string,
|
|
151
|
+
closeDatePicker: PropTypes.string,
|
|
152
|
+
clearDates: PropTypes.string,
|
|
153
|
+
focusStartDate: PropTypes.string,
|
|
154
|
+
jumpToPrevMonth: PropTypes.string,
|
|
155
|
+
jumpToNextMonth: PropTypes.string,
|
|
156
|
+
keyboardShortcuts: PropTypes.string,
|
|
157
|
+
showKeyboardShortcutsPanel: PropTypes.string,
|
|
158
|
+
hideKeyboardShortcutsPanel: PropTypes.string,
|
|
159
|
+
openThisPanel: PropTypes.string,
|
|
160
|
+
enterKey: PropTypes.string,
|
|
161
|
+
leftArrowRightArrow: PropTypes.string,
|
|
162
|
+
upArrowDownArrow: PropTypes.string,
|
|
163
|
+
pageUpPageDown: PropTypes.string,
|
|
164
|
+
homeEnd: PropTypes.string,
|
|
165
|
+
escape: PropTypes.string,
|
|
166
|
+
questionMark: PropTypes.string,
|
|
167
|
+
selectFocusedDate: PropTypes.string,
|
|
168
|
+
moveFocusByOneDay: PropTypes.string,
|
|
169
|
+
moveFocusByOneWeek: PropTypes.string,
|
|
170
|
+
moveFocusByOneMonth: PropTypes.string,
|
|
171
|
+
moveFocustoStartAndEndOfWeek: PropTypes.string,
|
|
172
|
+
returnFocusToInput: PropTypes.string,
|
|
173
|
+
keyboardNavigationInstructions: PropTypes.string,
|
|
174
|
+
chooseAvailableStartDate: PropTypes.func,
|
|
175
|
+
chooseAvailableEndDate: PropTypes.func,
|
|
176
|
+
dateIsUnavailable: PropTypes.func,
|
|
177
|
+
dateIsSelected: PropTypes.func
|
|
178
|
+
}).description("react-dates phrases"),
|
|
179
|
+
startDate: PropTypes.instanceOf(Date, moment).description("start date value"),
|
|
180
|
+
endDate: PropTypes.instanceOf(Date, moment).description("end date value"),
|
|
181
|
+
startDateId: PropTypes.string.description("start date id"),
|
|
182
|
+
endDateId: PropTypes.string.description("end date id"),
|
|
183
|
+
labelFrom: PropTypes.string.description("label of start date input"),
|
|
184
|
+
labelTo: PropTypes.string.description("label of end date input"),
|
|
185
|
+
enableOutsideDays: PropTypes.bool.description("enable days outside current month").defaultValue("true"),
|
|
186
|
+
onDatesChange: PropTypes.func.description("function executed when dates change"),
|
|
187
|
+
onChangeStartInput: PropTypes.func.description("function executed when start date input changes"),
|
|
188
|
+
onChangeEndInput: PropTypes.func.description("function executed when end date input changes"),
|
|
189
|
+
onOutsideClick: PropTypes.func.description("function executed when clicking outside component")
|
|
190
|
+
};
|
|
191
|
+
DSDateRangePicker.propTypes = dateRangePickerProps;
|
|
192
|
+
const DateRangePickerWithSchema = describe(DSDateRangePicker);
|
|
193
|
+
DateRangePickerWithSchema.propTypes = dateRangePickerProps;
|
|
194
|
+
var DSDateRangePicker_default = DSDateRangePicker;
|
|
195
|
+
export {
|
|
196
|
+
DateRangePickerWithSchema,
|
|
197
|
+
DayPickerRangeController,
|
|
198
|
+
END_DATE,
|
|
199
|
+
START_DATE,
|
|
200
|
+
DSDateRangePicker_default as default
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=DSDateRangePicker.js.map
|