@elliemae/ds-date-time-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/DSDateTimePicker.js +185 -0
- package/dist/cjs/DSDateTimePicker.js.map +7 -0
- package/dist/cjs/components/DateTimePickerImpl.js +284 -0
- package/dist/cjs/components/DateTimePickerImpl.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/lang/english.js +39 -0
- package/dist/cjs/lang/english.js.map +7 -0
- package/dist/cjs/tests/utils.js +54 -0
- package/dist/cjs/tests/utils.js.map +7 -0
- package/dist/cjs/utils.js +45 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/DSDateTimePicker.js +158 -0
- package/dist/esm/DSDateTimePicker.js.map +7 -0
- package/dist/esm/components/DateTimePickerImpl.js +257 -0
- package/dist/esm/components/DateTimePickerImpl.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/lang/english.js +10 -0
- package/dist/esm/lang/english.js.map +7 -0
- package/dist/esm/tests/utils.js +27 -0
- package/dist/esm/tests/utils.js.map +7 -0
- package/dist/esm/utils.js +16 -0
- package/dist/esm/utils.js.map +7 -0
- package/package.json +41 -32
- package/cjs/DSDateTimePicker.js +0 -193
- package/cjs/components/DateTimePickerImpl.js +0 -285
- package/cjs/index.js +0 -10
- package/cjs/lang/english.js +0 -9
- package/cjs/utils.js +0 -22
- package/esm/DSDateTimePicker.js +0 -182
- package/esm/components/DateTimePickerImpl.js +0 -276
- package/esm/index.js +0 -1
- package/esm/lang/english.js +0 -7
- package/esm/utils.js +0 -14
- package/types/DSDateTimePicker.d.ts +0 -238
- package/types/components/DateTimePickerImpl.d.ts +0 -75
- package/types/index.d.ts +0 -1
- package/types/lang/english.d.ts +0 -6
- package/types/tests/DateTimePicker-events.test.d.ts +0 -1
- package/types/tests/DateTimePickerSelectedDate.test.d.ts +0 -1
- package/types/tests/utils.d.ts +0 -1
- package/types/utils.d.ts +0 -2
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
27
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(module2))
|
|
29
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
30
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (module2, isNodeMode) => {
|
|
35
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
36
|
+
};
|
|
37
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
+
return (module2, temp) => {
|
|
39
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
+
};
|
|
41
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
42
|
+
var DSDateTimePicker_exports = {};
|
|
43
|
+
__export(DSDateTimePicker_exports, {
|
|
44
|
+
DSDateTimePicker: () => DSDateTimePicker,
|
|
45
|
+
DateTimePickerWithSchema: () => DateTimePickerWithSchema,
|
|
46
|
+
default: () => DSDateTimePicker_default
|
|
47
|
+
});
|
|
48
|
+
var React = __toESM(require("react"));
|
|
49
|
+
var import_react = __toESM(require("react"));
|
|
50
|
+
var import_react_desc = require("react-desc");
|
|
51
|
+
var import_moment = __toESM(require("moment"));
|
|
52
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
53
|
+
var import_ds_date_picker = require("@elliemae/ds-date-picker");
|
|
54
|
+
var import_DateTimePickerImpl = require("./components/DateTimePickerImpl");
|
|
55
|
+
var import_english = __toESM(require("./lang/english"));
|
|
56
|
+
const {
|
|
57
|
+
placeholder: placeholderDefault,
|
|
58
|
+
className: classNameDefault,
|
|
59
|
+
id: idDefault
|
|
60
|
+
} = import_english.default;
|
|
61
|
+
const DSDateTimePicker = ({
|
|
62
|
+
containerProps = {},
|
|
63
|
+
className = classNameDefault,
|
|
64
|
+
id = idDefault,
|
|
65
|
+
placeholder = placeholderDefault,
|
|
66
|
+
date,
|
|
67
|
+
clearable = false,
|
|
68
|
+
onBlur = () => null,
|
|
69
|
+
datePickerProps = {
|
|
70
|
+
disabled: false,
|
|
71
|
+
numberOfMonths: 1,
|
|
72
|
+
readOnly: false,
|
|
73
|
+
enableOutsideDays: false,
|
|
74
|
+
transitionDuration: 0,
|
|
75
|
+
firstDayOfWeek: 0,
|
|
76
|
+
keepOpenOnDateSelect: true,
|
|
77
|
+
hideKeyboardShortcutsPanel: true,
|
|
78
|
+
onPrevMonthClick: () => null,
|
|
79
|
+
onNextMonthClick: () => null,
|
|
80
|
+
onClose: () => null,
|
|
81
|
+
onchange: () => null,
|
|
82
|
+
onDateChange: () => null,
|
|
83
|
+
phrases: import_ds_date_picker.SingleDatePickerPhrases,
|
|
84
|
+
displayFormatDay: "D",
|
|
85
|
+
isDayBlocked: () => false,
|
|
86
|
+
isOutsideRange: () => false,
|
|
87
|
+
isDayHighlighted: () => false,
|
|
88
|
+
zIndex: 11
|
|
89
|
+
},
|
|
90
|
+
timePickerProps = {
|
|
91
|
+
format: "hh:mm A",
|
|
92
|
+
onChange: () => null,
|
|
93
|
+
disabledTimes: void 0,
|
|
94
|
+
minutesInterval: 1
|
|
95
|
+
},
|
|
96
|
+
dateInputProps = {
|
|
97
|
+
onDateInputDateChange: () => null
|
|
98
|
+
}
|
|
99
|
+
}) => {
|
|
100
|
+
const { cssClassName } = (0, import_ds_classnames.convertPropToCssClassName)("datetimepicker", className, {
|
|
101
|
+
id
|
|
102
|
+
});
|
|
103
|
+
return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues({
|
|
104
|
+
className: cssClassName
|
|
105
|
+
}, containerProps), /* @__PURE__ */ import_react.default.createElement(import_DateTimePickerImpl.DSDateTimePickerImpl, {
|
|
106
|
+
clearable,
|
|
107
|
+
date,
|
|
108
|
+
datePickerProps,
|
|
109
|
+
onBlur,
|
|
110
|
+
placeholder,
|
|
111
|
+
timePickerProps,
|
|
112
|
+
dateInputProps
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
const dateTimePickerProps = {
|
|
116
|
+
containerProps: import_react_desc.PropTypes.object.description("Set of Properties attached to the main container"),
|
|
117
|
+
className: import_react_desc.PropTypes.string.description("html class attribute"),
|
|
118
|
+
id: import_react_desc.PropTypes.string.description("components id"),
|
|
119
|
+
onBlur: import_react_desc.PropTypes.func.description("on blur callback"),
|
|
120
|
+
date: import_react_desc.PropTypes.instanceOf(Date, import_moment.default).description("Initial date, by default current date"),
|
|
121
|
+
clearable: import_react_desc.PropTypes.bool.description("Flag to trigger onDateChange on error"),
|
|
122
|
+
datePickerProps: import_react_desc.PropTypes.shape({
|
|
123
|
+
disabled: import_react_desc.PropTypes.bool,
|
|
124
|
+
numberOfMonths: import_react_desc.PropTypes.number,
|
|
125
|
+
readOnly: import_react_desc.PropTypes.bool,
|
|
126
|
+
enableOutsideDays: import_react_desc.PropTypes.bool,
|
|
127
|
+
transitionDuration: import_react_desc.PropTypes.number,
|
|
128
|
+
firstDayOfWeek: import_react_desc.PropTypes.number,
|
|
129
|
+
keepOpenOnDateSelect: import_react_desc.PropTypes.bool,
|
|
130
|
+
hideKeyboardShortcutsPanel: import_react_desc.PropTypes.bool,
|
|
131
|
+
onPrevMonthClick: import_react_desc.PropTypes.func,
|
|
132
|
+
onNextMonthClick: import_react_desc.PropTypes.func,
|
|
133
|
+
onClose: import_react_desc.PropTypes.func,
|
|
134
|
+
onDateChange: import_react_desc.PropTypes.func,
|
|
135
|
+
phrases: import_react_desc.PropTypes.shape({
|
|
136
|
+
calendarLabel: import_react_desc.PropTypes.string,
|
|
137
|
+
closeDatePicker: import_react_desc.PropTypes.string,
|
|
138
|
+
clearDates: import_react_desc.PropTypes.string,
|
|
139
|
+
focusStartDate: import_react_desc.PropTypes.string,
|
|
140
|
+
jumpToPrevMonth: import_react_desc.PropTypes.string,
|
|
141
|
+
jumpToNextMonth: import_react_desc.PropTypes.string,
|
|
142
|
+
keyboardShortcuts: import_react_desc.PropTypes.string,
|
|
143
|
+
showKeyboardShortcutsPanel: import_react_desc.PropTypes.string,
|
|
144
|
+
hideKeyboardShortcutsPanel: import_react_desc.PropTypes.string,
|
|
145
|
+
openThisPanel: import_react_desc.PropTypes.string,
|
|
146
|
+
enterKey: import_react_desc.PropTypes.string,
|
|
147
|
+
leftArrowRightArrow: import_react_desc.PropTypes.string,
|
|
148
|
+
upArrowDownArrow: import_react_desc.PropTypes.string,
|
|
149
|
+
pageUpPageDown: import_react_desc.PropTypes.string,
|
|
150
|
+
homeEnd: import_react_desc.PropTypes.string,
|
|
151
|
+
escape: import_react_desc.PropTypes.string,
|
|
152
|
+
questionMark: import_react_desc.PropTypes.string,
|
|
153
|
+
selectFocusedDate: import_react_desc.PropTypes.string,
|
|
154
|
+
moveFocusByOneDay: import_react_desc.PropTypes.string,
|
|
155
|
+
moveFocusByOneWeek: import_react_desc.PropTypes.string,
|
|
156
|
+
moveFocusByOneMonth: import_react_desc.PropTypes.string,
|
|
157
|
+
moveFocustoStartAndEndOfWeek: import_react_desc.PropTypes.string,
|
|
158
|
+
returnFocusToInput: import_react_desc.PropTypes.string,
|
|
159
|
+
keyboardNavigationInstructions: import_react_desc.PropTypes.string,
|
|
160
|
+
chooseAvailableStartDate: import_react_desc.PropTypes.func,
|
|
161
|
+
chooseAvailableEndDate: import_react_desc.PropTypes.func,
|
|
162
|
+
dateIsUnavailable: import_react_desc.PropTypes.func,
|
|
163
|
+
dateIsSelected: import_react_desc.PropTypes.func,
|
|
164
|
+
zIndex: import_react_desc.PropTypes.number
|
|
165
|
+
}),
|
|
166
|
+
displayFormatDay: import_react_desc.PropTypes.string,
|
|
167
|
+
isDayBlocked: import_react_desc.PropTypes.func,
|
|
168
|
+
isOutsideRange: import_react_desc.PropTypes.func,
|
|
169
|
+
isDayHighlighted: import_react_desc.PropTypes.func
|
|
170
|
+
}).description("DatePicker properties"),
|
|
171
|
+
placeholder: import_react_desc.PropTypes.string.description("Input placeholder"),
|
|
172
|
+
timePickerProps: import_react_desc.PropTypes.shape({
|
|
173
|
+
format: import_react_desc.PropTypes.string,
|
|
174
|
+
onChange: import_react_desc.PropTypes.func
|
|
175
|
+
}).description("TimePicker properties"),
|
|
176
|
+
dateInputProps: import_react_desc.PropTypes.shape({
|
|
177
|
+
onDateInputDateChange: import_react_desc.PropTypes.func
|
|
178
|
+
}).description("DateInputProperties")
|
|
179
|
+
};
|
|
180
|
+
DSDateTimePicker.propTypes = dateTimePickerProps;
|
|
181
|
+
const DateTimePickerWithSchema = (0, import_react_desc.describe)(DSDateTimePicker);
|
|
182
|
+
DateTimePickerWithSchema.propTypes = dateTimePickerProps;
|
|
183
|
+
var DSDateTimePicker_default = DSDateTimePicker;
|
|
184
|
+
module.exports = __toCommonJS(DSDateTimePicker_exports);
|
|
185
|
+
//# sourceMappingURL=DSDateTimePicker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSDateTimePicker.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport moment from 'moment';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { SingleDatePickerPhrases } from '@elliemae/ds-date-picker';\nimport { DSDateTimePickerImpl } from './components/DateTimePickerImpl';\nimport english from './lang/english';\n\nconst {\n placeholder: placeholderDefault,\n className: classNameDefault,\n id: idDefault,\n} = english;\n\nconst DSDateTimePicker = ({\n containerProps = {},\n className = classNameDefault,\n id = idDefault,\n placeholder = placeholderDefault,\n date,\n clearable = false,\n onBlur = () => null,\n datePickerProps = {\n disabled: false,\n numberOfMonths: 1,\n readOnly: false,\n enableOutsideDays: false,\n transitionDuration: 0,\n firstDayOfWeek: 0,\n keepOpenOnDateSelect: true,\n hideKeyboardShortcutsPanel: true,\n onPrevMonthClick: () => null,\n onNextMonthClick: () => null,\n onClose: () => null,\n onchange: () => null,\n onDateChange: () => null,\n phrases: SingleDatePickerPhrases,\n displayFormatDay: 'D',\n isDayBlocked: () => false,\n isOutsideRange: () => false,\n isDayHighlighted: () => false,\n zIndex: 11,\n },\n timePickerProps = {\n format: 'hh:mm A',\n onChange: () => null,\n disabledTimes: undefined,\n minutesInterval: 1,\n },\n dateInputProps = {\n onDateInputDateChange: () => null,\n },\n}) => {\n const { cssClassName } = convertPropToCssClassName(\n 'datetimepicker',\n className,\n {\n id,\n },\n );\n return (\n <div className={cssClassName} {...containerProps}>\n <DSDateTimePickerImpl\n clearable={clearable}\n date={date}\n datePickerProps={datePickerProps}\n onBlur={onBlur}\n placeholder={placeholder}\n timePickerProps={timePickerProps}\n dateInputProps={dateInputProps}\n />\n </div>\n );\n};\n\nconst dateTimePickerProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n className: PropTypes.string.description('html class attribute'),\n id: PropTypes.string.description('components id'),\n /**\n * on blur callback\n */\n onBlur: PropTypes.func.description('on blur callback'),\n /**\n * Initial date, by default current date\n */\n date: PropTypes.instanceOf(Date, moment).description(\n 'Initial date, by default current date',\n ),\n /**\n * Flag to trigger onDateChange on error\n */\n clearable: PropTypes.bool.description(\n 'Flag to trigger onDateChange on error',\n ),\n /**\n * DatePicker properties\n */\n datePickerProps: PropTypes.shape({\n disabled: PropTypes.bool,\n numberOfMonths: PropTypes.number,\n readOnly: PropTypes.bool,\n enableOutsideDays: PropTypes.bool,\n transitionDuration: PropTypes.number,\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 onDateChange: PropTypes.func,\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 * ZIndex for the picker popup\n */\n zIndex: PropTypes.number,\n }),\n displayFormatDay: PropTypes.string,\n isDayBlocked: PropTypes.func,\n isOutsideRange: PropTypes.func,\n isDayHighlighted: PropTypes.func,\n }).description('DatePicker properties'),\n /**\n * Input placeholder\n */\n placeholder: PropTypes.string.description('Input placeholder'),\n /**\n * TimePicker properties\n */\n timePickerProps: PropTypes.shape({\n format: PropTypes.string,\n onChange: PropTypes.func,\n }).description('TimePicker properties'),\n dateInputProps: PropTypes.shape({\n onDateInputDateChange: PropTypes.func,\n }).description('DateInputProperties'),\n};\n\nDSDateTimePicker.propTypes = dateTimePickerProps;\nconst DateTimePickerWithSchema = describe(DSDateTimePicker);\nDateTimePickerWithSchema.propTypes = dateTimePickerProps;\n\nexport { DateTimePickerWithSchema, DSDateTimePicker };\nexport default DSDateTimePicker;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,wBAAoC;AACpC,oBAAmB;A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,0BAA0B,4BAAU;AAAA,MACpC,wBAAwB,4BAAU;AAAA,MAClC,mBAAmB,4BAAU;AAAA,MAC7B,gBAAgB,4BAAU;AAAA,MAI1B,QAAQ,4BAAU;AAAA;AAAA,IAEpB,kBAAkB,4BAAU;AAAA,IAC5B,cAAc,4BAAU;AAAA,IACxB,gBAAgB,4BAAU;AAAA,IAC1B,kBAAkB,4BAAU;AAAA,KAC3B,YAAY;AAAA,EAIf,aAAa,4BAAU,OAAO,YAAY;AAAA,EAI1C,iBAAiB,4BAAU,MAAM;AAAA,IAC/B,QAAQ,4BAAU;AAAA,IAClB,UAAU,4BAAU;AAAA,KACnB,YAAY;AAAA,EACf,gBAAgB,4BAAU,MAAM;AAAA,IAC9B,uBAAuB,4BAAU;AAAA,KAChC,YAAY;AAAA;AAGjB,iBAAiB,YAAY;AAC7B,MAAM,2BAA2B,gCAAS;AAC1C,yBAAyB,YAAY;AAGrC,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
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 DateTimePickerImpl_exports = {};
|
|
58
|
+
__export(DateTimePickerImpl_exports, {
|
|
59
|
+
DSDateTimePickerImpl: () => DSDateTimePickerImpl,
|
|
60
|
+
default: () => DateTimePickerImpl_default
|
|
61
|
+
});
|
|
62
|
+
var React = __toESM(require("react"));
|
|
63
|
+
var import_react = __toESM(require("react"));
|
|
64
|
+
var import_moment = __toESM(require("moment"));
|
|
65
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
66
|
+
var import_ds_date_picker = require("@elliemae/ds-date-picker");
|
|
67
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
68
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
69
|
+
var import_ds_time_picker = require("@elliemae/ds-time-picker");
|
|
70
|
+
var import_utils = require("../utils");
|
|
71
|
+
const blockName = "date-time-picker";
|
|
72
|
+
const DateTimePickerWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "wrapper");
|
|
73
|
+
const TimePicker = (0, import_ds_classnames.aggregatedClasses)(import_ds_time_picker.DSTimePickerMenu)(blockName, "time-picker");
|
|
74
|
+
const TimePickerWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "time-picker-wrapper");
|
|
75
|
+
const formatDate = "MMDDYYYY";
|
|
76
|
+
const DSDateTimePickerImpl = ({
|
|
77
|
+
onBlur = () => null,
|
|
78
|
+
placeholder,
|
|
79
|
+
date,
|
|
80
|
+
clearable,
|
|
81
|
+
datePickerProps: {
|
|
82
|
+
disabled = false,
|
|
83
|
+
numberOfMonths = 1,
|
|
84
|
+
readOnly = false,
|
|
85
|
+
enableOutsideDays = false,
|
|
86
|
+
transitionDuration = 0,
|
|
87
|
+
firstDayOfWeek = 0,
|
|
88
|
+
keepOpenOnDateSelect = true,
|
|
89
|
+
hideKeyboardShortcutsPanel = true,
|
|
90
|
+
onPrevMonthClick = () => null,
|
|
91
|
+
onNextMonthClick = () => null,
|
|
92
|
+
onClose = () => null,
|
|
93
|
+
onChange: onDatePickerChange = () => null,
|
|
94
|
+
onDateChange = () => null,
|
|
95
|
+
onError: onErrorDate = () => null,
|
|
96
|
+
phrases = import_ds_date_picker.SingleDatePickerPhrases,
|
|
97
|
+
displayFormatDay = "D",
|
|
98
|
+
isDayBlocked = () => false,
|
|
99
|
+
isOutsideRange = () => false,
|
|
100
|
+
isDayHighlighted = () => false,
|
|
101
|
+
zIndex = 11
|
|
102
|
+
},
|
|
103
|
+
timePickerProps: {
|
|
104
|
+
format = "hh:mm A",
|
|
105
|
+
onChange: onChangeTimePicker = () => null,
|
|
106
|
+
disabledTimes = void 0,
|
|
107
|
+
onError: onErrorTime = () => null,
|
|
108
|
+
minutesInterval = 1
|
|
109
|
+
},
|
|
110
|
+
dateInputProps: { onDateInputDateChange = () => null }
|
|
111
|
+
}) => {
|
|
112
|
+
const [selectedDate, setSelectedDate] = (0, import_react.useState)(void 0);
|
|
113
|
+
const [incompleteInput, setIncompleteInput] = (0, import_react.useState)(void 0);
|
|
114
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
115
|
+
const disabledTimeRange = disabledTimes && {
|
|
116
|
+
from: (0, import_ds_time_picker.convertTimeString)(disabledTimes.from),
|
|
117
|
+
to: (0, import_ds_time_picker.convertTimeString)(disabledTimes.to)
|
|
118
|
+
};
|
|
119
|
+
const dateTimePickerWrapperRef = (0, import_react.useRef)();
|
|
120
|
+
const fullFormat = `${formatDate} ${format}`;
|
|
121
|
+
(0, import_react.useEffect)(() => {
|
|
122
|
+
if (date) {
|
|
123
|
+
setSelectedDate((0, import_moment.default)(date));
|
|
124
|
+
} else if (date === null)
|
|
125
|
+
setSelectedDate(void 0);
|
|
126
|
+
}, [date]);
|
|
127
|
+
const visiblePanels = (0, import_react.useMemo)(() => (0, import_ds_utilities.getVisibleTimeByFormat)(format), []);
|
|
128
|
+
const currentYear = (0, import_moment.default)().year();
|
|
129
|
+
const handleDatePickerChange = (dateSelected) => {
|
|
130
|
+
const splittedDate = (0, import_utils.updateDateAndTime)(dateSelected, selectedDate);
|
|
131
|
+
if (!readOnly) {
|
|
132
|
+
setSelectedDate(splittedDate);
|
|
133
|
+
onDateChange(splittedDate);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const onTimeChange = (pickerTime) => {
|
|
137
|
+
const splittedDate = (0, import_utils.updateDateAndTime)(selectedDate, pickerTime);
|
|
138
|
+
onChangeTimePicker(splittedDate);
|
|
139
|
+
setSelectedDate(splittedDate);
|
|
140
|
+
};
|
|
141
|
+
const handleInputChange = (inputValue, type) => {
|
|
142
|
+
onDatePickerChange(inputValue);
|
|
143
|
+
let timeBlocked = false;
|
|
144
|
+
const inputMoment = (0, import_moment.default)(inputValue, fullFormat);
|
|
145
|
+
setIncompleteInput(inputValue);
|
|
146
|
+
if (type === "date") {
|
|
147
|
+
const splittedDate = (0, import_utils.updateDateAndTime)(inputMoment, selectedDate);
|
|
148
|
+
if (inputValue.length < 8) {
|
|
149
|
+
onErrorDate({ message: "date incomplete", inputValue });
|
|
150
|
+
if (clearable)
|
|
151
|
+
onDateChange("error");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (inputValue.length === 8 && inputMoment.isValid()) {
|
|
155
|
+
setSelectedDate(splittedDate);
|
|
156
|
+
onChangeTimePicker(splittedDate);
|
|
157
|
+
}
|
|
158
|
+
onDateChange(splittedDate);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (disabledTimeRange) {
|
|
162
|
+
const hour = inputValue.hour();
|
|
163
|
+
const min = inputValue.minutes();
|
|
164
|
+
const { from, to } = disabledTimeRange;
|
|
165
|
+
if (hour > from.hour && hour < to.hour || hour === to.hour && min < to.min) {
|
|
166
|
+
timeBlocked = true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (timeBlocked)
|
|
170
|
+
onErrorTime({ message: "time blocked", inputValue });
|
|
171
|
+
const dateBlocked = isDayBlocked(inputMoment);
|
|
172
|
+
if (dateBlocked)
|
|
173
|
+
onErrorDate({ message: "date blocked", inputValue });
|
|
174
|
+
if (!timeBlocked && !dateBlocked) {
|
|
175
|
+
onDateChange(inputValue);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const handleOutsideClick = (event) => {
|
|
179
|
+
if (!dateTimePickerWrapperRef.current.contains(event.target)) {
|
|
180
|
+
setIsOpen(false);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const handleClickEscape = () => setIsOpen(false);
|
|
184
|
+
const handleOpen = () => setIsOpen(true);
|
|
185
|
+
const handleContainerBlur = (event) => {
|
|
186
|
+
if (!isOpen && !event.currentTarget.contains(event.relatedTarget)) {
|
|
187
|
+
onBlur(event, selectedDate?.isValid() ? selectedDate : {
|
|
188
|
+
error: true,
|
|
189
|
+
message: "incomplete input",
|
|
190
|
+
input: incompleteInput
|
|
191
|
+
});
|
|
192
|
+
if (clearable && !selectedDate && !!incompleteInput) {
|
|
193
|
+
const inputMoment = (0, import_moment.default)(incompleteInput, fullFormat);
|
|
194
|
+
const splittedDate = (0, import_utils.updateDateAndTime)(inputMoment, selectedDate);
|
|
195
|
+
setSelectedDate(splittedDate);
|
|
196
|
+
onDateChange(splittedDate);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
(0, import_react.useEffect)(() => {
|
|
201
|
+
if (!isOpen)
|
|
202
|
+
onBlur({}, selectedDate?.isValid() ? selectedDate : {
|
|
203
|
+
error: true,
|
|
204
|
+
message: "incomplete input",
|
|
205
|
+
input: incompleteInput
|
|
206
|
+
});
|
|
207
|
+
}, [isOpen]);
|
|
208
|
+
const hasSelectedDate = !!selectedDate;
|
|
209
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSInputGroup, {
|
|
210
|
+
containerProps: {
|
|
211
|
+
onBlur: handleContainerBlur
|
|
212
|
+
},
|
|
213
|
+
rightAddon: /* @__PURE__ */ import_react.default.createElement(import_ds_date_picker.DatePickerDropdown, {
|
|
214
|
+
disabled,
|
|
215
|
+
isOpen,
|
|
216
|
+
zIndex,
|
|
217
|
+
menu: /* @__PURE__ */ import_react.default.createElement(DateTimePickerWrapper, {
|
|
218
|
+
ref: dateTimePickerWrapperRef,
|
|
219
|
+
"data-testid": "date-time-picker"
|
|
220
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
221
|
+
className: hasSelectedDate ? "has-selected-date" : "without-selected-date",
|
|
222
|
+
"data-testid": "date-time-picker-portal-wrapper"
|
|
223
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_date_picker.DSDatePickerController, {
|
|
224
|
+
date: selectedDate,
|
|
225
|
+
displayFormatDay,
|
|
226
|
+
enableOutsideDays,
|
|
227
|
+
firstDayOfWeek,
|
|
228
|
+
hideKeyboardShortcutsPanel,
|
|
229
|
+
isDayBlocked,
|
|
230
|
+
isDayHighlighted,
|
|
231
|
+
isOutsideRange,
|
|
232
|
+
keepOpenOnDateSelect,
|
|
233
|
+
numberOfMonths,
|
|
234
|
+
onClickEscape: handleClickEscape,
|
|
235
|
+
onClose,
|
|
236
|
+
onDateChange: handleDatePickerChange,
|
|
237
|
+
onNextMonthClick,
|
|
238
|
+
onOutsideClick: (event) => handleOutsideClick(event),
|
|
239
|
+
onPrevMonthClick,
|
|
240
|
+
phrases,
|
|
241
|
+
transitionDuration
|
|
242
|
+
})), /* @__PURE__ */ import_react.default.createElement(TimePickerWrapper, null, /* @__PURE__ */ import_react.default.createElement(TimePicker, __spreadValues({
|
|
243
|
+
disabled,
|
|
244
|
+
disabledTimes: disabledTimeRange,
|
|
245
|
+
format,
|
|
246
|
+
hasHeader: true,
|
|
247
|
+
hasHeaderDisplay: true,
|
|
248
|
+
onTimeChange,
|
|
249
|
+
showSeconds: false,
|
|
250
|
+
minutesInterval,
|
|
251
|
+
time: selectedDate
|
|
252
|
+
}, visiblePanels)))),
|
|
253
|
+
onClick: handleOpen,
|
|
254
|
+
readOnly
|
|
255
|
+
})
|
|
256
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSInput, {
|
|
257
|
+
customInputType: (_a) => {
|
|
258
|
+
var _b = _a, { onChange: handleChange } = _b, restInputProps = __objRest(_b, ["onChange"]);
|
|
259
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
260
|
+
style: { display: "flex" }
|
|
261
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DateInputsV2Impl, __spreadProps(__spreadValues({
|
|
262
|
+
disabled,
|
|
263
|
+
onChange: (input) => handleChange(input, "date")
|
|
264
|
+
}, restInputProps), {
|
|
265
|
+
onDateChange: onDateInputDateChange,
|
|
266
|
+
yearMaxRange: currentYear + 100,
|
|
267
|
+
yearMinRange: currentYear - 100,
|
|
268
|
+
time: restInputProps.value && restInputProps.value.hour && restInputProps.value.isValid() ? restInputProps.value.format(formatDate) : restInputProps.value
|
|
269
|
+
}))), /* @__PURE__ */ import_react.default.createElement(import_ds_form.TimeInputImpl, __spreadValues({
|
|
270
|
+
disabled,
|
|
271
|
+
format,
|
|
272
|
+
onChange: (time) => handleChange(time, "time")
|
|
273
|
+
}, restInputProps)));
|
|
274
|
+
},
|
|
275
|
+
isShowElipsisActive: false,
|
|
276
|
+
disabled,
|
|
277
|
+
onChange: handleInputChange,
|
|
278
|
+
placeholder,
|
|
279
|
+
value: selectedDate
|
|
280
|
+
}));
|
|
281
|
+
};
|
|
282
|
+
var DateTimePickerImpl_default = DSDateTimePickerImpl;
|
|
283
|
+
module.exports = __toCommonJS(DateTimePickerImpl_exports);
|
|
284
|
+
//# sourceMappingURL=DateTimePickerImpl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DateTimePickerImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable no-empty-pattern */\n/* eslint-disable import/no-unresolved */\n/* eslint-disable max-lines */\n/* eslint-disable react/prop-types */\nimport React, { useState, useEffect, useMemo, useRef } from 'react';\nimport moment from 'moment';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSDatePickerController, DatePickerDropdown, SingleDatePickerPhrases } from '@elliemae/ds-date-picker';\nimport { DSInput, DSInputGroup, DateInputsV2Impl, TimeInputImpl } from '@elliemae/ds-form';\nimport { getVisibleTimeByFormat } from '@elliemae/ds-utilities';\nimport { DSTimePickerMenu, convertTimeString } from '@elliemae/ds-time-picker';\nimport { updateDateAndTime } from '../utils';\n\nconst blockName = 'date-time-picker';\n\nconst DateTimePickerWrapper = aggregatedClasses('div')(blockName, 'wrapper');\nconst TimePicker = aggregatedClasses(DSTimePickerMenu)(blockName, 'time-picker');\nconst TimePickerWrapper = aggregatedClasses('div')(blockName, 'time-picker-wrapper');\n// const DateInput = aggregatedClasses(DateInputsV2Impl)(blockName, 'date-input');\nconst formatDate = 'MMDDYYYY';\n\nconst DSDateTimePickerImpl = ({\n onBlur = () => null,\n placeholder,\n date,\n clearable,\n datePickerProps: {\n disabled = false,\n numberOfMonths = 1,\n readOnly = false,\n enableOutsideDays = false,\n transitionDuration = 0,\n firstDayOfWeek = 0,\n keepOpenOnDateSelect = true,\n hideKeyboardShortcutsPanel = true,\n onPrevMonthClick = () => null,\n onNextMonthClick = () => null,\n onClose = () => null,\n onChange: onDatePickerChange = () => null,\n onDateChange = () => null,\n onError: onErrorDate = () => null,\n phrases = SingleDatePickerPhrases,\n displayFormatDay = 'D',\n isDayBlocked = () => false,\n isOutsideRange = () => false,\n isDayHighlighted = () => false,\n zIndex = 11,\n },\n timePickerProps: {\n format = 'hh:mm A',\n onChange: onChangeTimePicker = () => null,\n disabledTimes = undefined,\n onError: onErrorTime = () => null,\n minutesInterval = 1,\n },\n dateInputProps: { onDateInputDateChange = () => null },\n}) => {\n const [selectedDate, setSelectedDate] = useState(undefined);\n const [incompleteInput, setIncompleteInput] = useState(undefined);\n const [isOpen, setIsOpen] = useState(false);\n\n const disabledTimeRange = disabledTimes && {\n from: convertTimeString(disabledTimes.from),\n to: convertTimeString(disabledTimes.to),\n };\n\n const dateTimePickerWrapperRef = useRef();\n const fullFormat = `${formatDate} ${format}`;\n\n useEffect(() => {\n if (date) {\n setSelectedDate(moment(date));\n } else if (date === null) setSelectedDate(undefined);\n }, [date]);\n\n const visiblePanels = useMemo(() => getVisibleTimeByFormat(format), []);\n\n const currentYear = moment().year();\n\n const handleDatePickerChange = (dateSelected) => {\n const splittedDate = updateDateAndTime(dateSelected, selectedDate);\n if (!readOnly) {\n setSelectedDate(splittedDate);\n onDateChange(splittedDate);\n }\n };\n\n const onTimeChange = (pickerTime) => {\n const splittedDate = updateDateAndTime(selectedDate, pickerTime);\n onChangeTimePicker(splittedDate);\n setSelectedDate(splittedDate);\n };\n\n const handleInputChange = (inputValue, type) => {\n onDatePickerChange(inputValue);\n let timeBlocked = false;\n const inputMoment = moment(inputValue, fullFormat);\n setIncompleteInput(inputValue);\n if (type === 'date') {\n const splittedDate = updateDateAndTime(inputMoment, selectedDate);\n if (inputValue.length < 8) {\n onErrorDate({ message: 'date incomplete', inputValue });\n if (clearable) onDateChange('error');\n return;\n }\n if (inputValue.length === 8 && inputMoment.isValid()) {\n setSelectedDate(splittedDate);\n onChangeTimePicker(splittedDate);\n }\n onDateChange(splittedDate);\n return;\n }\n\n if (disabledTimeRange) {\n const hour = inputValue.hour();\n const min = inputValue.minutes();\n const { from, to } = disabledTimeRange;\n\n if ((hour > from.hour && hour < to.hour) || (hour === to.hour && min < to.min)) {\n timeBlocked = true;\n }\n }\n if (timeBlocked) onErrorTime({ message: 'time blocked', inputValue });\n const dateBlocked = isDayBlocked(inputMoment);\n if (dateBlocked) onErrorDate({ message: 'date blocked', inputValue });\n if (!timeBlocked && !dateBlocked) {\n onDateChange(inputValue);\n }\n };\n\n const handleOutsideClick = (event) => {\n if (!dateTimePickerWrapperRef.current.contains(event.target)) {\n setIsOpen(false);\n }\n };\n\n const handleClickEscape = () => setIsOpen(false);\n const handleOpen = () => setIsOpen(true);\n\n const handleContainerBlur = (event) => {\n if (!isOpen && !event.currentTarget.contains(event.relatedTarget)) {\n onBlur(\n event,\n selectedDate?.isValid()\n ? selectedDate\n : {\n error: true,\n message: 'incomplete input',\n input: incompleteInput,\n },\n );\n if (clearable && !selectedDate && !!incompleteInput) {\n const inputMoment = moment(incompleteInput, fullFormat);\n const splittedDate = updateDateAndTime(inputMoment, selectedDate);\n\n setSelectedDate(splittedDate);\n onDateChange(splittedDate);\n }\n }\n };\n\n useEffect(() => {\n if (!isOpen)\n onBlur(\n {},\n selectedDate?.isValid()\n ? selectedDate\n : {\n error: true,\n message: 'incomplete input',\n input: incompleteInput,\n },\n );\n }, [isOpen]);\n\n const hasSelectedDate = !!selectedDate;\n return (\n <DSInputGroup\n containerProps={{\n onBlur: handleContainerBlur,\n }}\n rightAddon={\n <DatePickerDropdown\n disabled={disabled}\n isOpen={isOpen}\n zIndex={zIndex}\n menu={\n <DateTimePickerWrapper ref={dateTimePickerWrapperRef} data-testid=\"date-time-picker\">\n <div\n className={hasSelectedDate ? 'has-selected-date' : 'without-selected-date'}\n data-testid=\"date-time-picker-portal-wrapper\"\n >\n <DSDatePickerController\n date={selectedDate}\n displayFormatDay={displayFormatDay}\n enableOutsideDays={enableOutsideDays}\n firstDayOfWeek={firstDayOfWeek}\n hideKeyboardShortcutsPanel={hideKeyboardShortcutsPanel}\n isDayBlocked={isDayBlocked}\n isDayHighlighted={isDayHighlighted}\n isOutsideRange={isOutsideRange}\n keepOpenOnDateSelect={keepOpenOnDateSelect}\n numberOfMonths={numberOfMonths}\n onClickEscape={handleClickEscape}\n onClose={onClose}\n onDateChange={handleDatePickerChange}\n onNextMonthClick={onNextMonthClick}\n onOutsideClick={(event) => handleOutsideClick(event)}\n onPrevMonthClick={onPrevMonthClick}\n phrases={phrases}\n transitionDuration={transitionDuration}\n />\n </div>\n <TimePickerWrapper>\n <TimePicker\n disabled={disabled}\n disabledTimes={disabledTimeRange}\n format={format}\n hasHeader\n hasHeaderDisplay\n onTimeChange={onTimeChange}\n showSeconds={false}\n minutesInterval={minutesInterval}\n time={selectedDate}\n {...visiblePanels}\n />\n </TimePickerWrapper>\n </DateTimePickerWrapper>\n }\n onClick={handleOpen}\n readOnly={readOnly}\n />\n }\n >\n <DSInput\n customInputType={({ onChange: handleChange, ...restInputProps }) => (\n <>\n <div style={{ display: 'flex' }}>\n <DateInputsV2Impl\n disabled={disabled}\n onChange={(input) => handleChange(input, 'date')}\n {...restInputProps}\n onDateChange={onDateInputDateChange}\n yearMaxRange={currentYear + 100}\n yearMinRange={currentYear - 100}\n time={\n restInputProps.value && restInputProps.value.hour && restInputProps.value.isValid()\n ? restInputProps.value.format(formatDate)\n : restInputProps.value\n }\n />\n </div>\n <TimeInputImpl\n disabled={disabled}\n format={format}\n onChange={(time) => handleChange(time, 'time')}\n {...restInputProps}\n />\n </>\n )}\n isShowElipsisActive={false}\n disabled={disabled}\n onChange={handleInputChange}\n placeholder={placeholder}\n value={selectedDate}\n />\n </DSInputGroup>\n );\n};\n\nexport { DSDateTimePickerImpl };\nexport default DSDateTimePickerImpl;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADOvB,mBAA4D;AAC5D,oB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AAAA,QAC9C;AAAA,QACA;AAAA,QACA;AAAA,WAGJ,mDAAC,mBAAD,MACE,mDAAC,YAAD;AAAA,QACE;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA,WAAS;AAAA,QACT,kBAAgB;AAAA,QAChB;AAAA,QACA,aAAa;AAAA,QACb;AAAA,QACA,MAAM;AAAA,SACF;AAAA,MAKZ,SAAS;AAAA,MACT;AAAA;AAAA,KAIJ,mDAAC,wBAAD;AAAA,IACE,iBAAiB,CAAC,OAA+C;AAA/C,mBAAE,YAAU,iBAAZ,IAA6B,2BAA7B,IAA6B,CAA3B;AAClB,qGACE,mDAAC,OAAD;AAAA,QAAK,OAAO,EAAE,SAAS;AAAA,SACrB,mDAAC,iCAAD;AAAA,QACE;AAAA,QACA,UAAU,CAAC,UAAU,aAAa,OAAO;AAAA,SACrC,iBAHN;AAAA,QAIE,cAAc;AAAA,QACd,cAAc,cAAc;AAAA,QAC5B,cAAc,cAAc;AAAA,QAC5B,MACE,eAAe,SAAS,eAAe,MAAM,QAAQ,eAAe,MAAM,YACtE,eAAe,MAAM,OAAO,cAC5B,eAAe;AAAA,YAIzB,mDAAC,8BAAD;AAAA,QACE;AAAA,QACA;AAAA,QACA,UAAU,CAAC,SAAS,aAAa,MAAM;AAAA,SACnC;AAAA;AAAA,IAIV,qBAAqB;AAAA,IACrB;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,OAAO;AAAA;AAAA;AAOf,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
DSDateTimePicker: () => import_DSDateTimePicker.DSDateTimePicker,
|
|
31
|
+
DateTimePickerWithSchema: () => import_DSDateTimePicker.DateTimePickerWithSchema,
|
|
32
|
+
default: () => import_DSDateTimePicker.default
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_DSDateTimePicker = __toESM(require("./DSDateTimePicker"));
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
//# 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, DSDateTimePicker, DateTimePickerWithSchema } from './DSDateTimePicker';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAoE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 english_exports = {};
|
|
29
|
+
__export(english_exports, {
|
|
30
|
+
default: () => english_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var english_default = {
|
|
34
|
+
placeholder: "Select date and time",
|
|
35
|
+
className: "",
|
|
36
|
+
id: ""
|
|
37
|
+
};
|
|
38
|
+
module.exports = __toCommonJS(english_exports);
|
|
39
|
+
//# sourceMappingURL=english.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lang/english.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export default {\n placeholder: 'Select date and time',\n className: '',\n id: '',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,IAAO,kBAAQ;AAAA,EACb,aAAa;AAAA,EACb,WAAW;AAAA,EACX,IAAI;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|