@instructure/ui-date-time-input 11.7.3 → 11.7.4-pr-snapshot-1781695314229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE.md +1 -0
- package/{lib/DateTimeInput/v2/props.js → babel.config.cjs} +12 -7
- package/es/DateTimeInput/v1/index.js +2 -2
- package/es/DateTimeInput/v2/index.js +2 -2
- package/es/exports/a.js +2 -1
- package/es/exports/b.js +2 -1
- package/package.json +16 -21
- package/src/DateTimeInput/v1/index.tsx +2 -1
- package/src/DateTimeInput/v2/index.tsx +2 -1
- package/src/exports/a.ts +1 -1
- package/src/exports/b.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DateTimeInput/v1/index.d.ts +1 -0
- package/types/DateTimeInput/v1/index.d.ts.map +1 -1
- package/types/DateTimeInput/v2/index.d.ts +1 -0
- package/types/DateTimeInput/v2/index.d.ts.map +1 -1
- package/types/exports/a.d.ts +1 -1
- package/types/exports/a.d.ts.map +1 -1
- package/types/exports/b.d.ts +1 -1
- package/types/exports/b.d.ts.map +1 -1
- package/lib/DateTimeInput/v1/index.js +0 -551
- package/lib/DateTimeInput/v1/props.js +0 -31
- package/lib/DateTimeInput/v2/index.js +0 -349
- package/lib/exports/a.js +0 -12
- package/lib/exports/b.js +0 -12
- package/lib/package.json +0 -1
|
@@ -8,6 +8,7 @@ category: components
|
|
|
8
8
|
---
|
|
9
9
|
**/
|
|
10
10
|
declare class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
11
|
+
static displayName: string;
|
|
11
12
|
private static readonly DEFAULT_MESSAGE_FORMAT;
|
|
12
13
|
static allowedProps: readonly (keyof DateTimeInputProps)[];
|
|
13
14
|
static defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DateTimeInput/v1/index.tsx"],"names":[],"mappings":"AAwBA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,MAAM,EAAE,KAAK,MAAM,aAK5C;IAED,UAAU,GAAI,GAAG,cAAc,UAS9B;IAED,kBAAkB,GAAI,QAAQ,cAAc,UAE3C;IAED,mBAAmB,GAAI,QAAQ,cAAc,UAc5C;IAED,mBAAmB,GAAI,QAAQ,cAAc,UAc5C;IAED,qBAAqB,GAAI,QAAQ,cAAc,UAI9C;IAED,qBAAqB,GAAI,QAAQ,cAAc,UAI9C;IAED,UAAU;IAqDV,IAAI,eAAe,uDAoClB;IAED,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAyB/C,MAAM;CAuGP;AAED,eAAe,aAAa,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -8,6 +8,7 @@ category: components
|
|
|
8
8
|
---
|
|
9
9
|
**/
|
|
10
10
|
declare class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
|
|
11
|
+
static displayName: string;
|
|
11
12
|
private static readonly DEFAULT_MESSAGE_FORMAT;
|
|
12
13
|
static allowedProps: readonly (keyof DateTimeInputProps)[];
|
|
13
14
|
static defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DateTimeInput/v2/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAoB,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAMlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAIrE;;;;GAIG;AACH,cAAM,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAE3E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAS;IACvD,MAAM,CAAC,YAAY,wCAAe;IAClC,MAAM,CAA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ED,mBAAmB,GAAI,UAAU,kBAAkB,EAAE,GAAG,cAAc,UAwBrE;IAED,iBAAiB,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,aAK5C;IAED,UAAU,GAAI,GAAG,cAAc,UAS9B;IAED,MAAM;CA2FP;AAED,eAAe,aAAa,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
package/types/exports/a.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DateTimeInput } from '../DateTimeInput/v1';
|
|
1
|
+
export { DateTimeInput } from '../DateTimeInput/v1/index.js';
|
|
2
2
|
//# sourceMappingURL=a.d.ts.map
|
package/types/exports/a.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../../src/exports/a.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA"}
|
package/types/exports/b.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DateTimeInput } from '../DateTimeInput/v2';
|
|
1
|
+
export { DateTimeInput } from '../DateTimeInput/v2/index.js';
|
|
2
2
|
//# sourceMappingURL=b.d.ts.map
|
package/types/exports/b.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.DateTimeInput = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
9
|
-
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
10
|
-
var _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
|
11
|
-
var _v11_ = require("@instructure/ui-form-field/v11_6");
|
|
12
|
-
var _v11_2 = require("@instructure/ui-date-input/v11_6");
|
|
13
|
-
var _v11_3 = require("@instructure/ui-time-select/v11_6");
|
|
14
|
-
var _v11_4 = require("@instructure/ui-calendar/v11_6");
|
|
15
|
-
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
16
|
-
var _v11_5 = require("@instructure/ui-buttons/v11_6");
|
|
17
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
|
|
18
|
-
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenStartSolid.js");
|
|
19
|
-
var _props = require("./props");
|
|
20
|
-
var _console = require("@instructure/console");
|
|
21
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
22
|
-
/*
|
|
23
|
-
* The MIT License (MIT)
|
|
24
|
-
*
|
|
25
|
-
* Copyright (c) 2018 - present Instructure, Inc.
|
|
26
|
-
*
|
|
27
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
29
|
-
* in the Software without restriction, including without limitation the rights
|
|
30
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
32
|
-
* furnished to do so, subject to the following conditions:
|
|
33
|
-
*
|
|
34
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
35
|
-
* copies or substantial portions of the Software.
|
|
36
|
-
*
|
|
37
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
-
* SOFTWARE.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
---
|
|
48
|
-
category: components
|
|
49
|
-
---
|
|
50
|
-
**/class DateTimeInput extends _react.Component {
|
|
51
|
-
static displayName = "DateTimeInput";
|
|
52
|
-
// extra verbose localized date and time
|
|
53
|
-
static DEFAULT_MESSAGE_FORMAT = 'LLLL';
|
|
54
|
-
static allowedProps = _props.allowedProps;
|
|
55
|
-
static defaultProps = {
|
|
56
|
-
layout: 'inline',
|
|
57
|
-
colSpacing: 'medium',
|
|
58
|
-
rowSpacing: 'small',
|
|
59
|
-
timeStep: 30,
|
|
60
|
-
showMessages: true,
|
|
61
|
-
messageFormat: DateTimeInput.DEFAULT_MESSAGE_FORMAT,
|
|
62
|
-
isRequired: false,
|
|
63
|
-
dateFormat: 'LL',
|
|
64
|
-
// Localized date with full month, e.g. "August 6, 2014"
|
|
65
|
-
allowNonStepInput: false
|
|
66
|
-
};
|
|
67
|
-
static contextType = _ApplyLocaleContext.ApplyLocaleContext;
|
|
68
|
-
ref = null; // This is used by Tooltip for positioning
|
|
69
|
-
|
|
70
|
-
handleRef = el => {
|
|
71
|
-
this.ref = el;
|
|
72
|
-
};
|
|
73
|
-
constructor(props) {
|
|
74
|
-
super(props);
|
|
75
|
-
// State needs to be calculated because render could be called before
|
|
76
|
-
// componentDidMount()
|
|
77
|
-
this.state = this.recalculateState(props.value || props.defaultValue);
|
|
78
|
-
}
|
|
79
|
-
componentDidMount() {
|
|
80
|
-
// we'll need to recalculate the state because the context value is
|
|
81
|
-
// set at this point (and it might change locale & timezone)
|
|
82
|
-
const initState = this.recalculateState(this.props.value || this.props.defaultValue);
|
|
83
|
-
this.setState(initState);
|
|
84
|
-
this.props.reset?.(this.reset);
|
|
85
|
-
}
|
|
86
|
-
componentDidUpdate(prevProps) {
|
|
87
|
-
const valueChanged = prevProps.value !== this.props.value || prevProps.defaultValue !== this.props.defaultValue;
|
|
88
|
-
const isUpdated = valueChanged || prevProps.locale !== this.props.locale || prevProps.timezone !== this.props.timezone || prevProps.dateFormat !== this.props.dateFormat || prevProps.messageFormat !== this.props.messageFormat || prevProps.invalidDateTimeMessage !== this.props.invalidDateTimeMessage;
|
|
89
|
-
if (isUpdated) {
|
|
90
|
-
this.setState(_prevState => {
|
|
91
|
-
return {
|
|
92
|
-
...this.recalculateState(this.props.value || this.props.defaultValue)
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
recalculateState(dateStr, doNotChangeDate = false, doNotChangeTime = false) {
|
|
98
|
-
let errorMsg;
|
|
99
|
-
if (dateStr) {
|
|
100
|
-
const parsed = _DateTime.DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
101
|
-
if (parsed.isValid()) {
|
|
102
|
-
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
103
|
-
// There is a selected time, adjust the parsed date to its value
|
|
104
|
-
const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
105
|
-
parsed.hour(timeParsed.hour()).minute(timeParsed.minute());
|
|
106
|
-
}
|
|
107
|
-
if (doNotChangeDate && this.state.iso) {
|
|
108
|
-
parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
|
|
109
|
-
}
|
|
110
|
-
if (this.props.initialTimeForNewDate && !this.state?.timeSelectValue) {
|
|
111
|
-
const hour = Number(this.props.initialTimeForNewDate.slice(0, 2));
|
|
112
|
-
const minute = Number(this.props.initialTimeForNewDate.slice(3, 5));
|
|
113
|
-
if (isNaN(hour) || isNaN(minute)) {
|
|
114
|
-
(0, _console.error)(false, `[DateTimeInput] initialTimeForNewDate prop is not in the correct format. Please use HH:MM format.`);
|
|
115
|
-
} else if (hour < 0 || hour > 23 || minute > 59 || minute < 0) {
|
|
116
|
-
(0, _console.error)(false, `[DateTimeInput] 0 <= hour < 24 and 0 <= minute < 60 for initialTimeForNewDate prop.`);
|
|
117
|
-
} else {
|
|
118
|
-
parsed.hour(hour).minute(minute);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const newTimeSelectValue = parsed.toISOString();
|
|
122
|
-
if (this.isDisabledDate(parsed)) {
|
|
123
|
-
let text = typeof this.props.disabledDateTimeMessage === 'function' ? this.props.disabledDateTimeMessage(parsed.toISOString(true)) : this.props.disabledDateTimeMessage;
|
|
124
|
-
if (!text) {
|
|
125
|
-
text = typeof this.props.invalidDateTimeMessage === 'function' ? this.props.invalidDateTimeMessage(parsed.toISOString(true)) : this.props.invalidDateTimeMessage;
|
|
126
|
-
}
|
|
127
|
-
errorMsg = text ? {
|
|
128
|
-
text,
|
|
129
|
-
type: 'error'
|
|
130
|
-
} : undefined;
|
|
131
|
-
return {
|
|
132
|
-
iso: parsed.clone(),
|
|
133
|
-
calendarSelectedDate: parsed.clone(),
|
|
134
|
-
dateInputTextChanged: false,
|
|
135
|
-
dateInputText: parsed.format(this.dateFormat),
|
|
136
|
-
message: errorMsg,
|
|
137
|
-
timeSelectValue: newTimeSelectValue,
|
|
138
|
-
renderedDate: parsed.clone()
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
iso: parsed.clone(),
|
|
143
|
-
calendarSelectedDate: parsed.clone(),
|
|
144
|
-
dateInputTextChanged: false,
|
|
145
|
-
dateInputText: parsed.format(this.dateFormat),
|
|
146
|
-
message: {
|
|
147
|
-
type: 'success',
|
|
148
|
-
text: parsed.format(this.props.messageFormat)
|
|
149
|
-
},
|
|
150
|
-
timeSelectValue: newTimeSelectValue,
|
|
151
|
-
renderedDate: parsed.clone()
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// if there is no date string clear TimeSelect value
|
|
156
|
-
const clearTimeSelect = dateStr ? {} : {
|
|
157
|
-
timeSelectValue: '',
|
|
158
|
-
message: undefined
|
|
159
|
-
};
|
|
160
|
-
return {
|
|
161
|
-
iso: undefined,
|
|
162
|
-
calendarSelectedDate: undefined,
|
|
163
|
-
dateInputText: dateStr ? dateStr : '',
|
|
164
|
-
renderedDate: _DateTime.DateTime.now(this.locale(), this.timezone()),
|
|
165
|
-
dateInputTextChanged: false,
|
|
166
|
-
...clearTimeSelect
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
reset = () => this.setState(this.recalculateState());
|
|
170
|
-
locale() {
|
|
171
|
-
if (this.props.locale) {
|
|
172
|
-
return this.props.locale;
|
|
173
|
-
} else if (this.context && this.context.locale) {
|
|
174
|
-
return this.context.locale;
|
|
175
|
-
}
|
|
176
|
-
return _Locale.Locale.browserLocale();
|
|
177
|
-
}
|
|
178
|
-
timezone() {
|
|
179
|
-
if (this.props.timezone) {
|
|
180
|
-
return this.props.timezone;
|
|
181
|
-
} else if (this.context && this.context.timezone) {
|
|
182
|
-
return this.context.timezone;
|
|
183
|
-
}
|
|
184
|
-
return _DateTime.DateTime.browserTimeZone();
|
|
185
|
-
}
|
|
186
|
-
get dateFormat() {
|
|
187
|
-
return this.props.dateFormat;
|
|
188
|
-
}
|
|
189
|
-
isDisabledDate(date) {
|
|
190
|
-
const disabledDates = this.props.disabledDates;
|
|
191
|
-
if (!disabledDates) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
if (Array.isArray(disabledDates)) {
|
|
195
|
-
for (const aDisabledDate of disabledDates) {
|
|
196
|
-
if (date.isSame(aDisabledDate, 'day')) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
return disabledDates(date.toISOString());
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Called when the user enters text into dateInput
|
|
206
|
-
handleDateTextChange = (_event, date) => {
|
|
207
|
-
const dateParsed = this.tryParseDate(date.value);
|
|
208
|
-
this.setState({
|
|
209
|
-
dateInputText: date.value,
|
|
210
|
-
dateInputTextChanged: true,
|
|
211
|
-
calendarSelectedDate: dateParsed ? dateParsed : undefined,
|
|
212
|
-
renderedDate: dateParsed ? dateParsed.clone() : _DateTime.DateTime.now(this.locale(), this.timezone())
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
tryParseDate(val) {
|
|
216
|
-
const parsed = _DateTime.DateTime.parse(val, this.locale(), this.timezone());
|
|
217
|
-
return parsed.isValid() ? parsed : null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// date is returned es a ISO string, like 2021-09-14T22:00:00.000Z
|
|
221
|
-
handleDayClick = (event, {
|
|
222
|
-
date
|
|
223
|
-
}) => {
|
|
224
|
-
const dateParsed = _DateTime.DateTime.parse(date, this.locale(), this.timezone());
|
|
225
|
-
this.updateStateBasedOnDateInput(dateParsed, event);
|
|
226
|
-
};
|
|
227
|
-
handleHideCalendar = event => {
|
|
228
|
-
// prevent event pooling https://reactjs.org/docs/legacy-event-pooling.html
|
|
229
|
-
// Remove if React 16 is no longer supported
|
|
230
|
-
event.persist();
|
|
231
|
-
// timeout is needed here because handleDayClick could be called in the same
|
|
232
|
-
// frame, and it updates calendarSelectedDate which is read in here.
|
|
233
|
-
setTimeout(() => {
|
|
234
|
-
if (event.key === 'Enter') {
|
|
235
|
-
// user pressed enter, use the selected value in the calendar
|
|
236
|
-
this.updateStateBasedOnDateInput(this.state.calendarSelectedDate, event);
|
|
237
|
-
} else {
|
|
238
|
-
// user clicked outside/tabbed away/pressed esc, try to use the value in dateInputText
|
|
239
|
-
const dateParsed = this.tryParseDate(this.state.dateInputText);
|
|
240
|
-
this.updateStateBasedOnDateInput(dateParsed, event);
|
|
241
|
-
}
|
|
242
|
-
this.setState({
|
|
243
|
-
isShowingCalendar: false,
|
|
244
|
-
dateInputTextChanged: false
|
|
245
|
-
});
|
|
246
|
-
}, 0);
|
|
247
|
-
};
|
|
248
|
-
updateStateBasedOnDateInput(dateParsed, event) {
|
|
249
|
-
let newState;
|
|
250
|
-
if (dateParsed && this.state.timeSelectValue && (!this.state.dateInputText || this.state.dateInputText == '')) {
|
|
251
|
-
// There is already a selected time, but no date. Adjust the time too
|
|
252
|
-
const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
253
|
-
const dateParsedAdjusted = dateParsed.set({
|
|
254
|
-
hour: timeParsed.hour(),
|
|
255
|
-
minute: timeParsed.minute()
|
|
256
|
-
});
|
|
257
|
-
newState = this.recalculateState(dateParsedAdjusted.toISOString(), false, false);
|
|
258
|
-
} else if (!dateParsed) {
|
|
259
|
-
// if the text in the dateInput is not readable display error
|
|
260
|
-
newState = this.recalculateState(this.state.dateInputText, false, true);
|
|
261
|
-
} else {
|
|
262
|
-
newState = this.recalculateState(dateParsed?.toISOString(), false, true);
|
|
263
|
-
}
|
|
264
|
-
this.changeStateIfNeeded(newState, event);
|
|
265
|
-
}
|
|
266
|
-
updateStateBasedOnTimeSelect = (event, option) => {
|
|
267
|
-
// this.state.iso is undefined if date is invalid or not set.
|
|
268
|
-
// in this case recalculate with the dateInput's text which will result in
|
|
269
|
-
// an empty valid date (if isRequired is false) or an invalid date.
|
|
270
|
-
const newValue = this.state.iso ? option.value : this.state.dateInputText;
|
|
271
|
-
const newState = this.recalculateState(newValue, true, false);
|
|
272
|
-
this.changeStateIfNeeded(newState, event);
|
|
273
|
-
this.setState({
|
|
274
|
-
timeSelectValue: option.value
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
changeStateIfNeeded = (newState, e) => {
|
|
278
|
-
const dateStr = newState.dateInputText;
|
|
279
|
-
if (this.props.isRequired && !newState.iso || dateStr && dateStr.length > 0 && !newState.iso) {
|
|
280
|
-
const text = typeof this.props.invalidDateTimeMessage === 'function' ? this.props.invalidDateTimeMessage(dateStr ? dateStr : '') : this.props.invalidDateTimeMessage;
|
|
281
|
-
// eslint-disable-next-line no-param-reassign
|
|
282
|
-
newState.message = {
|
|
283
|
-
text: text,
|
|
284
|
-
type: 'error'
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
if (this.areDifferentDates(this.state.iso, newState.iso)) {
|
|
288
|
-
if (typeof this.props.onChange === 'function') {
|
|
289
|
-
const newDate = newState.iso?.toISOString();
|
|
290
|
-
// Timeout is needed here because users might change value in the
|
|
291
|
-
// onChange event lister, which might not execute properly
|
|
292
|
-
setTimeout(() => {
|
|
293
|
-
this.props.onChange?.(e, newDate);
|
|
294
|
-
}, 0);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
this.setState(newState);
|
|
298
|
-
};
|
|
299
|
-
areDifferentDates = (d1, d2) => {
|
|
300
|
-
if (!d1 && !d2) {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
return !d1 || !d2 || !d1.isSame(d2);
|
|
304
|
-
};
|
|
305
|
-
handleBlur = e => {
|
|
306
|
-
// when TABbing from the DateInput to TimeInput or visa-versa, the blur
|
|
307
|
-
// happens on the target before the relatedTarget gets focus.
|
|
308
|
-
// The timeout gives it a moment for that to happen
|
|
309
|
-
if (typeof this.props.onBlur === 'function') {
|
|
310
|
-
setTimeout(() => {
|
|
311
|
-
this.props.onBlur?.(e);
|
|
312
|
-
}, 0);
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
handleShowCalendar = _event => {
|
|
316
|
-
this.setState({
|
|
317
|
-
isShowingCalendar: true
|
|
318
|
-
});
|
|
319
|
-
};
|
|
320
|
-
handleSelectNextDay = _event => {
|
|
321
|
-
let toAlter;
|
|
322
|
-
if (this.state.calendarSelectedDate) {
|
|
323
|
-
toAlter = this.state.calendarSelectedDate.clone();
|
|
324
|
-
} else if (this.state.iso) {
|
|
325
|
-
toAlter = this.state.iso.clone();
|
|
326
|
-
} else {
|
|
327
|
-
toAlter = _DateTime.DateTime.now(this.locale(), this.timezone());
|
|
328
|
-
}
|
|
329
|
-
toAlter.add({
|
|
330
|
-
days: 1
|
|
331
|
-
});
|
|
332
|
-
this.setState({
|
|
333
|
-
calendarSelectedDate: toAlter,
|
|
334
|
-
renderedDate: toAlter.clone()
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
handleSelectPrevDay = _event => {
|
|
338
|
-
let toAlter;
|
|
339
|
-
if (this.state.calendarSelectedDate) {
|
|
340
|
-
toAlter = this.state.calendarSelectedDate.clone();
|
|
341
|
-
} else if (this.state.iso) {
|
|
342
|
-
toAlter = this.state.iso.clone();
|
|
343
|
-
} else {
|
|
344
|
-
toAlter = _DateTime.DateTime.now(this.locale(), this.timezone());
|
|
345
|
-
}
|
|
346
|
-
toAlter.subtract({
|
|
347
|
-
days: 1
|
|
348
|
-
});
|
|
349
|
-
this.setState({
|
|
350
|
-
calendarSelectedDate: toAlter,
|
|
351
|
-
renderedDate: toAlter.clone()
|
|
352
|
-
});
|
|
353
|
-
};
|
|
354
|
-
handleRenderNextMonth = _event => {
|
|
355
|
-
this.setState({
|
|
356
|
-
renderedDate: this.state.renderedDate.clone().add({
|
|
357
|
-
months: 1
|
|
358
|
-
})
|
|
359
|
-
});
|
|
360
|
-
};
|
|
361
|
-
handleRenderPrevMonth = _event => {
|
|
362
|
-
this.setState({
|
|
363
|
-
renderedDate: this.state.renderedDate.clone().subtract({
|
|
364
|
-
months: 1
|
|
365
|
-
})
|
|
366
|
-
});
|
|
367
|
-
};
|
|
368
|
-
renderDays() {
|
|
369
|
-
const {
|
|
370
|
-
selectedLabel
|
|
371
|
-
} = this.props;
|
|
372
|
-
const renderedDate = this.state.renderedDate;
|
|
373
|
-
// Sets it to the first local day of the week counting back from the start of the month.
|
|
374
|
-
// Note that first day depends on the locale, e.g. it's Sunday in the US and
|
|
375
|
-
// Monday in most of the EU.
|
|
376
|
-
const currDate = _DateTime.DateTime.getFirstDayOfWeek(renderedDate.startOf('month'));
|
|
377
|
-
const arr = [];
|
|
378
|
-
for (let i = 0; i < _v11_4.Calendar.DAY_COUNT; i++) {
|
|
379
|
-
// This workaround is needed because moment's `.add({days: 1})` function has a bug that happens when the date added lands perfectly onto the DST cutoff,
|
|
380
|
-
// in these cases adding 1 day results in 23 hours added instead,
|
|
381
|
-
// so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
|
|
382
|
-
// in "Sat Sep 07 2024 23:00:00 GMT-0400" instead of "Sun Sep 08 2024 00:00:00 GMT-0400".
|
|
383
|
-
// which would cause duplicate dates in the calendar.
|
|
384
|
-
// More info on the bug: https://github.com/moment/moment/issues/4743
|
|
385
|
-
// Please note that this causes one hour of time difference in the affected timezones/dates and to
|
|
386
|
-
// fully solve this bug we need to change to something like luxon which handles this properly
|
|
387
|
-
if (currDate.clone().format('HH') === '23') {
|
|
388
|
-
arr.push(currDate.clone().add({
|
|
389
|
-
hours: 1
|
|
390
|
-
}));
|
|
391
|
-
} else {
|
|
392
|
-
arr.push(currDate.clone());
|
|
393
|
-
}
|
|
394
|
-
currDate.add({
|
|
395
|
-
days: 1
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
return arr.map(date => {
|
|
399
|
-
const dateStr = date.toISOString();
|
|
400
|
-
return (0, _jsxRuntime.jsx)(_v11_2.DateInput.Day, {
|
|
401
|
-
date: dateStr,
|
|
402
|
-
isSelected: this.state.calendarSelectedDate ? date.isSame(this.state.calendarSelectedDate, 'day') : false,
|
|
403
|
-
isToday: date.isSame(_DateTime.DateTime.now(this.locale(), this.timezone()), 'day'),
|
|
404
|
-
isOutsideMonth: !date.isSame(renderedDate, 'month'),
|
|
405
|
-
label: date.format('D MMMM YYYY') // used by screen readers
|
|
406
|
-
,
|
|
407
|
-
selectedLabel: selectedLabel,
|
|
408
|
-
onClick: this.handleDayClick,
|
|
409
|
-
interaction: this.isDisabledDate(date) ? 'disabled' : 'enabled',
|
|
410
|
-
children: date.format('DD')
|
|
411
|
-
}, dateStr);
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// The default weekdays rendered in the calendar
|
|
416
|
-
get defaultWeekdays() {
|
|
417
|
-
if (!this.state.isShowingCalendar) {
|
|
418
|
-
// this is an expensive function, only execute if the calendar is open
|
|
419
|
-
return [];
|
|
420
|
-
}
|
|
421
|
-
const shortDayNames = _DateTime.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'short');
|
|
422
|
-
const longDayNames = _DateTime.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'long');
|
|
423
|
-
return [(0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
424
|
-
alt: longDayNames[0],
|
|
425
|
-
children: shortDayNames[0]
|
|
426
|
-
}, 1), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
427
|
-
alt: longDayNames[1],
|
|
428
|
-
children: shortDayNames[1]
|
|
429
|
-
}, 2), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
430
|
-
alt: longDayNames[2],
|
|
431
|
-
children: shortDayNames[2]
|
|
432
|
-
}, 3), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
433
|
-
alt: longDayNames[3],
|
|
434
|
-
children: shortDayNames[3]
|
|
435
|
-
}, 4), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
436
|
-
alt: longDayNames[4],
|
|
437
|
-
children: shortDayNames[4]
|
|
438
|
-
}, 5), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
439
|
-
alt: longDayNames[5],
|
|
440
|
-
children: shortDayNames[5]
|
|
441
|
-
}, 6), (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
442
|
-
alt: longDayNames[6],
|
|
443
|
-
children: shortDayNames[6]
|
|
444
|
-
}, 7)];
|
|
445
|
-
}
|
|
446
|
-
renderNextPrevMonthButton(type) {
|
|
447
|
-
if (!this.state.isShowingCalendar) {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
return (0, _jsxRuntime.jsx)(_v11_5.IconButton, {
|
|
451
|
-
size: "small",
|
|
452
|
-
withBackground: false,
|
|
453
|
-
withBorder: false,
|
|
454
|
-
renderIcon: type === 'prev' ? (0, _jsxRuntime.jsx)(_IconArrowOpenStartSolid.IconArrowOpenStartSolid, {
|
|
455
|
-
color: "primary"
|
|
456
|
-
}) : (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {
|
|
457
|
-
color: "primary"
|
|
458
|
-
}),
|
|
459
|
-
screenReaderLabel: type === 'prev' ? this.props.prevMonthLabel : this.props.nextMonthLabel
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
render() {
|
|
463
|
-
const {
|
|
464
|
-
description,
|
|
465
|
-
datePlaceholder,
|
|
466
|
-
timePlaceholder,
|
|
467
|
-
dateRenderLabel,
|
|
468
|
-
dateInputRef,
|
|
469
|
-
timeRenderLabel,
|
|
470
|
-
timeFormat,
|
|
471
|
-
timeStep,
|
|
472
|
-
timeInputRef,
|
|
473
|
-
locale,
|
|
474
|
-
timezone,
|
|
475
|
-
showMessages,
|
|
476
|
-
messages,
|
|
477
|
-
layout,
|
|
478
|
-
rowSpacing,
|
|
479
|
-
colSpacing,
|
|
480
|
-
isRequired,
|
|
481
|
-
interaction,
|
|
482
|
-
renderWeekdayLabels,
|
|
483
|
-
allowNonStepInput
|
|
484
|
-
} = this.props;
|
|
485
|
-
const allMessages = [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])];
|
|
486
|
-
const hasError = allMessages.find(m => m.type === 'newError' || m.type === 'error');
|
|
487
|
-
// if the component is in error state, create an empty error message to pass down to the subcomponents (DateInput and TimeInput) so they get a red outline and red required asterisk
|
|
488
|
-
const subComponentMessages = hasError ? [{
|
|
489
|
-
type: 'error',
|
|
490
|
-
text: ''
|
|
491
|
-
}] : [];
|
|
492
|
-
return (0, _jsxRuntime.jsxs)(_v11_.FormFieldGroup, {
|
|
493
|
-
description: description,
|
|
494
|
-
layout: layout,
|
|
495
|
-
rowSpacing: rowSpacing,
|
|
496
|
-
colSpacing: colSpacing,
|
|
497
|
-
vAlign: "top",
|
|
498
|
-
elementRef: this.handleRef,
|
|
499
|
-
isGroup: false,
|
|
500
|
-
messages: [...(showMessages && this.state.message ? [this.state.message] : []), ...(messages || [])],
|
|
501
|
-
"data-cid": "DateTimeInput",
|
|
502
|
-
children: [(0, _jsxRuntime.jsx)(_v11_2.DateInput, {
|
|
503
|
-
display: "block",
|
|
504
|
-
value: this.state.dateInputText,
|
|
505
|
-
onChange: this.handleDateTextChange,
|
|
506
|
-
onBlur: this.handleBlur,
|
|
507
|
-
inputRef: dateInputRef,
|
|
508
|
-
placeholder: datePlaceholder,
|
|
509
|
-
renderLabel: dateRenderLabel,
|
|
510
|
-
renderWeekdayLabels: renderWeekdayLabels ? renderWeekdayLabels : this.defaultWeekdays,
|
|
511
|
-
onRequestShowCalendar: this.handleShowCalendar,
|
|
512
|
-
onRequestHideCalendar: this.handleHideCalendar,
|
|
513
|
-
isShowingCalendar: this.state.isShowingCalendar,
|
|
514
|
-
renderNextMonthButton: this.renderNextPrevMonthButton('next'),
|
|
515
|
-
renderPrevMonthButton: this.renderNextPrevMonthButton('prev'),
|
|
516
|
-
onRequestSelectNextDay: this.handleSelectNextDay,
|
|
517
|
-
onRequestSelectPrevDay: this.handleSelectPrevDay,
|
|
518
|
-
onRequestRenderNextMonth: this.handleRenderNextMonth,
|
|
519
|
-
onRequestRenderPrevMonth: this.handleRenderPrevMonth,
|
|
520
|
-
isRequired: isRequired,
|
|
521
|
-
messages: subComponentMessages,
|
|
522
|
-
interaction: interaction,
|
|
523
|
-
renderNavigationLabel: (0, _jsxRuntime.jsxs)("span", {
|
|
524
|
-
children: [(0, _jsxRuntime.jsx)("div", {
|
|
525
|
-
children: this.state.renderedDate.format('MMMM')
|
|
526
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
|
527
|
-
children: this.state.renderedDate.format('y')
|
|
528
|
-
})]
|
|
529
|
-
}),
|
|
530
|
-
children: this.renderDays()
|
|
531
|
-
}), (0, _jsxRuntime.jsx)(_v11_3.TimeSelect, {
|
|
532
|
-
value: this.state.timeSelectValue,
|
|
533
|
-
onChange: this.updateStateBasedOnTimeSelect,
|
|
534
|
-
placeholder: timePlaceholder,
|
|
535
|
-
onBlur: this.handleBlur,
|
|
536
|
-
renderLabel: timeRenderLabel,
|
|
537
|
-
locale: locale,
|
|
538
|
-
format: timeFormat,
|
|
539
|
-
step: timeStep,
|
|
540
|
-
timezone: timezone,
|
|
541
|
-
inputRef: timeInputRef,
|
|
542
|
-
interaction: interaction,
|
|
543
|
-
allowNonStepInput: allowNonStepInput,
|
|
544
|
-
isRequired: isRequired,
|
|
545
|
-
messages: subComponentMessages
|
|
546
|
-
})]
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
exports.DateTimeInput = DateTimeInput;
|
|
551
|
-
var _default = exports.default = DateTimeInput;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const allowedProps = exports.allowedProps = ['description', 'dateRenderLabel', 'prevMonthLabel', 'nextMonthLabel', 'datePlaceholder', 'timePlaceholder', 'dateFormat', 'interaction', 'timeRenderLabel', 'timeStep', 'timeFormat', 'locale', 'timezone', 'invalidDateTimeMessage', 'showMessages', 'messages', 'messageFormat', 'layout', 'rowSpacing', 'colSpacing', 'value', 'defaultValue', 'renderWeekdayLabels', 'isRequired', 'onChange', 'dateInputRef', 'timeInputRef', 'onBlur', 'disabledDates', 'disabledDateTimeMessage', 'allowNonStepInput', 'reset', 'selectedLabel'];
|