@instructure/ui-date-time-input 8.33.2-snapshot-0 → 8.33.2
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 +1 -5
- package/es/DateTimeInput/DateTimeInputLocator.js +5 -4
- package/es/DateTimeInput/index.js +35 -91
- package/es/DateTimeInput/locator.js +1 -0
- package/es/DateTimeInput/props.js +1 -0
- package/es/index.js +1 -0
- package/lib/DateTimeInput/DateTimeInputLocator.js +2 -5
- package/lib/DateTimeInput/index.js +33 -114
- package/lib/DateTimeInput/locator.js +0 -2
- package/lib/DateTimeInput/props.js +1 -6
- package/lib/index.js +0 -1
- package/package.json +18 -18
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.DateTimeInput = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
13
|
-
|
|
14
10
|
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
15
|
-
|
|
16
11
|
var _ApplyLocaleContext = require("@instructure/ui-i18n/lib/ApplyLocale/ApplyLocaleContext.js");
|
|
17
|
-
|
|
18
12
|
var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
|
|
19
|
-
|
|
20
13
|
var _DateInput = require("@instructure/ui-date-input/lib/DateInput");
|
|
21
|
-
|
|
22
14
|
var _TimeSelect = require("@instructure/ui-time-select/lib/TimeSelect");
|
|
23
|
-
|
|
24
15
|
var _Calendar = require("@instructure/ui-calendar/lib/Calendar");
|
|
25
|
-
|
|
26
16
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
27
|
-
|
|
28
17
|
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
29
|
-
|
|
30
18
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
31
|
-
|
|
32
19
|
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
33
|
-
|
|
34
20
|
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
|
|
35
|
-
|
|
36
21
|
var _props = require("./props");
|
|
37
|
-
|
|
38
22
|
var _dec, _class, _class2, _IconArrowOpenStartSo, _IconArrowOpenEndSoli;
|
|
39
|
-
|
|
40
23
|
/**
|
|
41
24
|
---
|
|
42
25
|
category: components
|
|
@@ -45,17 +28,17 @@ category: components
|
|
|
45
28
|
**/
|
|
46
29
|
let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = class DateTimeInput extends _react.Component {
|
|
47
30
|
// extra verbose localized date and time
|
|
31
|
+
|
|
48
32
|
// This is used by Tooltip for positioning
|
|
33
|
+
|
|
49
34
|
constructor(props) {
|
|
50
|
-
super(props);
|
|
35
|
+
super(props);
|
|
36
|
+
// State needs to be calculated because render could be called before
|
|
51
37
|
// componentDidMount()
|
|
52
|
-
|
|
53
38
|
this.ref = null;
|
|
54
|
-
|
|
55
39
|
this.handleRef = el => {
|
|
56
40
|
this.ref = el;
|
|
57
41
|
};
|
|
58
|
-
|
|
59
42
|
this.handleDateTextChange = (_event, date) => {
|
|
60
43
|
const dateParsed = this.tryParseDate(date.value);
|
|
61
44
|
this.setState({
|
|
@@ -65,21 +48,17 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
65
48
|
renderedDate: dateParsed ? dateParsed.clone() : _DateTime.DateTime.now(this.locale(), this.timezone())
|
|
66
49
|
});
|
|
67
50
|
};
|
|
68
|
-
|
|
69
51
|
this.handleDayClick = (event, _ref) => {
|
|
70
52
|
let date = _ref.date;
|
|
71
|
-
|
|
72
53
|
const dateParsed = _DateTime.DateTime.parse(date, this.locale(), this.timezone());
|
|
73
|
-
|
|
74
54
|
this.updateStateBasedOnDateInput(dateParsed, event);
|
|
75
55
|
};
|
|
76
|
-
|
|
77
56
|
this.handleHideCalendar = event => {
|
|
78
57
|
// prevent event pooling https://reactjs.org/docs/legacy-event-pooling.html
|
|
79
58
|
// Remove if React 16 is no longer supported
|
|
80
|
-
event.persist();
|
|
59
|
+
event.persist();
|
|
60
|
+
// timeout is needed here because handleDayClick could be called in the same
|
|
81
61
|
// frame, and it updates calendarSelectedDate which is read in here.
|
|
82
|
-
|
|
83
62
|
window.setTimeout(() => {
|
|
84
63
|
// update state based on the DateInput's text value
|
|
85
64
|
if (this.state.dateInputTextChanged || event.key === 'Enter') {
|
|
@@ -92,51 +71,41 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
92
71
|
calendarSelectedDate: this.state.iso ? this.state.iso.clone() : void 0
|
|
93
72
|
});
|
|
94
73
|
}
|
|
95
|
-
|
|
96
74
|
this.setState({
|
|
97
75
|
isShowingCalendar: false,
|
|
98
76
|
dateInputTextChanged: false
|
|
99
77
|
});
|
|
100
78
|
}, 0);
|
|
101
79
|
};
|
|
102
|
-
|
|
103
80
|
this.handleTimeChange = (event, option) => {
|
|
104
81
|
let newValue;
|
|
105
|
-
|
|
106
82
|
if (this.state.iso) {
|
|
107
83
|
newValue = option.value;
|
|
108
84
|
} else {
|
|
109
85
|
// if no date is set just return the input text, it will error
|
|
110
86
|
newValue = option.inputText;
|
|
111
87
|
}
|
|
112
|
-
|
|
113
88
|
const newState = this.recalculateState(newValue, true, false);
|
|
114
89
|
this.changeStateIfNeeded(newState, event);
|
|
115
90
|
this.setState({
|
|
116
91
|
timeSelectValue: option.value
|
|
117
92
|
});
|
|
118
93
|
};
|
|
119
|
-
|
|
120
94
|
this.changeStateIfNeeded = (newState, e) => {
|
|
121
95
|
this.setState({
|
|
122
96
|
message: newState.message
|
|
123
97
|
});
|
|
124
|
-
|
|
125
98
|
if (!newState.iso && !this.state.iso) {
|
|
126
99
|
return;
|
|
127
100
|
}
|
|
128
|
-
|
|
129
101
|
if (!this.state.iso || !newState.iso || !this.state.iso.isSame(newState.iso)) {
|
|
130
102
|
this.setState(newState);
|
|
131
|
-
|
|
132
103
|
if (this.props.onChange) {
|
|
133
104
|
var _newState$iso;
|
|
134
|
-
|
|
135
105
|
this.props.onChange(e, (_newState$iso = newState.iso) === null || _newState$iso === void 0 ? void 0 : _newState$iso.toISOString());
|
|
136
106
|
}
|
|
137
107
|
}
|
|
138
108
|
};
|
|
139
|
-
|
|
140
109
|
this.handleBlur = e => {
|
|
141
110
|
// when TABbing from the DateInput to TimeInput or visa-versa, the blur
|
|
142
111
|
// happens on the target before the relatedTarget gets focus.
|
|
@@ -144,21 +113,17 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
144
113
|
if (typeof this.props.onBlur === 'function') {
|
|
145
114
|
window.setTimeout(() => {
|
|
146
115
|
var _this$props$onBlur, _this$props;
|
|
147
|
-
|
|
148
116
|
(_this$props$onBlur = (_this$props = this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, e);
|
|
149
117
|
}, 0);
|
|
150
118
|
}
|
|
151
119
|
};
|
|
152
|
-
|
|
153
120
|
this.handleShowCalendar = _event => {
|
|
154
121
|
this.setState({
|
|
155
122
|
isShowingCalendar: true
|
|
156
123
|
});
|
|
157
124
|
};
|
|
158
|
-
|
|
159
125
|
this.handleSelectNextDay = _event => {
|
|
160
126
|
let toAlter;
|
|
161
|
-
|
|
162
127
|
if (this.state.calendarSelectedDate) {
|
|
163
128
|
toAlter = this.state.calendarSelectedDate.clone();
|
|
164
129
|
} else if (this.state.iso) {
|
|
@@ -166,7 +131,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
166
131
|
} else {
|
|
167
132
|
toAlter = _DateTime.DateTime.now(this.locale(), this.timezone());
|
|
168
133
|
}
|
|
169
|
-
|
|
170
134
|
toAlter.add({
|
|
171
135
|
days: 1
|
|
172
136
|
});
|
|
@@ -176,10 +140,8 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
176
140
|
dateInputText: toAlter.format(this.dateFormat)
|
|
177
141
|
});
|
|
178
142
|
};
|
|
179
|
-
|
|
180
143
|
this.handleSelectPrevDay = _event => {
|
|
181
144
|
let toAlter;
|
|
182
|
-
|
|
183
145
|
if (this.state.calendarSelectedDate) {
|
|
184
146
|
toAlter = this.state.calendarSelectedDate.clone();
|
|
185
147
|
} else if (this.state.iso) {
|
|
@@ -187,7 +149,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
187
149
|
} else {
|
|
188
150
|
toAlter = _DateTime.DateTime.now(this.locale(), this.timezone());
|
|
189
151
|
}
|
|
190
|
-
|
|
191
152
|
toAlter.subtract({
|
|
192
153
|
days: 1
|
|
193
154
|
});
|
|
@@ -197,7 +158,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
197
158
|
dateInputText: toAlter.format(this.dateFormat)
|
|
198
159
|
});
|
|
199
160
|
};
|
|
200
|
-
|
|
201
161
|
this.handleRenderNextMonth = _event => {
|
|
202
162
|
this.setState({
|
|
203
163
|
renderedDate: this.state.renderedDate.clone().add({
|
|
@@ -205,7 +165,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
205
165
|
})
|
|
206
166
|
});
|
|
207
167
|
};
|
|
208
|
-
|
|
209
168
|
this.handleRenderPrevMonth = _event => {
|
|
210
169
|
this.setState({
|
|
211
170
|
renderedDate: this.state.renderedDate.clone().subtract({
|
|
@@ -213,58 +172,46 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
213
172
|
})
|
|
214
173
|
});
|
|
215
174
|
};
|
|
216
|
-
|
|
217
175
|
this.state = this.recalculateState(props.value || props.defaultValue);
|
|
218
176
|
}
|
|
219
|
-
|
|
220
177
|
componentDidMount() {
|
|
221
178
|
// we'll need to recalculate the state because the context value is
|
|
222
179
|
// set at this point (and it might change locale & timezone)
|
|
223
180
|
const initState = this.recalculateState(this.props.value || this.props.defaultValue);
|
|
224
181
|
this.setState(initState);
|
|
225
182
|
}
|
|
226
|
-
|
|
227
183
|
componentDidUpdate(prevProps) {
|
|
228
184
|
const valueChanged = prevProps.value !== this.props.value || prevProps.defaultValue !== this.props.defaultValue;
|
|
229
185
|
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;
|
|
230
|
-
|
|
231
186
|
if (isUpdated) {
|
|
232
187
|
this.setState(_prevState => {
|
|
233
|
-
return {
|
|
188
|
+
return {
|
|
189
|
+
...this.recalculateState(this.props.value || this.props.defaultValue)
|
|
234
190
|
};
|
|
235
191
|
});
|
|
236
192
|
}
|
|
237
193
|
}
|
|
238
|
-
|
|
239
194
|
recalculateState(dateStr) {
|
|
240
195
|
let doNotChangeDate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
241
196
|
let doNotChangeTime = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
242
197
|
let errorMsg;
|
|
243
|
-
|
|
244
198
|
if (dateStr) {
|
|
245
199
|
const parsed = _DateTime.DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
246
|
-
|
|
247
200
|
if (parsed.isValid()) {
|
|
248
201
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
249
202
|
// There is a selected time, adjust the parsed date to its value
|
|
250
203
|
const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
251
|
-
|
|
252
204
|
parsed.hour(timeParsed.hour()).minute(timeParsed.minute());
|
|
253
205
|
}
|
|
254
|
-
|
|
255
206
|
if (doNotChangeDate && this.state.iso) {
|
|
256
207
|
parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
|
|
257
208
|
}
|
|
258
|
-
|
|
259
209
|
const newTimeSelectValue = parsed.toISOString();
|
|
260
|
-
|
|
261
210
|
if (this.isDisabledDate(parsed)) {
|
|
262
211
|
let text = typeof this.props.disabledDateTimeMessage === 'function' ? this.props.disabledDateTimeMessage(parsed.toISOString(true)) : this.props.disabledDateTimeMessage;
|
|
263
|
-
|
|
264
212
|
if (!text) {
|
|
265
213
|
text = typeof this.props.invalidDateTimeMessage === 'function' ? this.props.invalidDateTimeMessage(parsed.toISOString(true)) : this.props.invalidDateTimeMessage;
|
|
266
214
|
}
|
|
267
|
-
|
|
268
215
|
errorMsg = text ? {
|
|
269
216
|
text,
|
|
270
217
|
type: 'error'
|
|
@@ -279,7 +226,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
279
226
|
renderedDate: parsed.clone()
|
|
280
227
|
};
|
|
281
228
|
}
|
|
282
|
-
|
|
283
229
|
return {
|
|
284
230
|
iso: parsed.clone(),
|
|
285
231
|
calendarSelectedDate: parsed.clone(),
|
|
@@ -293,7 +239,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
293
239
|
renderedDate: parsed.clone()
|
|
294
240
|
};
|
|
295
241
|
}
|
|
296
|
-
|
|
297
242
|
if (dateStr.length > 0 || this.props.isRequired) {
|
|
298
243
|
const text = typeof this.props.invalidDateTimeMessage === 'function' ? this.props.invalidDateTimeMessage(dateStr) : this.props.invalidDateTimeMessage;
|
|
299
244
|
errorMsg = text ? {
|
|
@@ -302,7 +247,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
302
247
|
} : void 0;
|
|
303
248
|
}
|
|
304
249
|
}
|
|
305
|
-
|
|
306
250
|
return {
|
|
307
251
|
iso: void 0,
|
|
308
252
|
calendarSelectedDate: void 0,
|
|
@@ -312,66 +256,55 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
312
256
|
dateInputTextChanged: false
|
|
313
257
|
};
|
|
314
258
|
}
|
|
315
|
-
|
|
316
259
|
locale() {
|
|
317
260
|
if (this.props.locale) {
|
|
318
261
|
return this.props.locale;
|
|
319
262
|
} else if (this.context && this.context.locale) {
|
|
320
263
|
return this.context.locale;
|
|
321
264
|
}
|
|
322
|
-
|
|
323
265
|
return _Locale.Locale.browserLocale();
|
|
324
266
|
}
|
|
325
|
-
|
|
326
267
|
timezone() {
|
|
327
268
|
if (this.props.timezone) {
|
|
328
269
|
return this.props.timezone;
|
|
329
270
|
} else if (this.context && this.context.timezone) {
|
|
330
271
|
return this.context.timezone;
|
|
331
272
|
}
|
|
332
|
-
|
|
333
273
|
return _DateTime.DateTime.browserTimeZone();
|
|
334
274
|
}
|
|
335
|
-
|
|
336
275
|
get dateFormat() {
|
|
337
276
|
return this.props.dateFormat;
|
|
338
277
|
}
|
|
339
|
-
|
|
340
278
|
isDisabledDate(date) {
|
|
341
279
|
const disabledDates = this.props.disabledDates;
|
|
342
|
-
|
|
343
280
|
if (!disabledDates) {
|
|
344
281
|
return false;
|
|
345
282
|
}
|
|
346
|
-
|
|
347
283
|
if (Array.isArray(disabledDates)) {
|
|
348
284
|
for (const aDisabledDate of disabledDates) {
|
|
349
285
|
if (date.isSame(aDisabledDate, 'day')) {
|
|
350
286
|
return true;
|
|
351
287
|
}
|
|
352
288
|
}
|
|
353
|
-
|
|
354
289
|
return false;
|
|
355
290
|
}
|
|
356
|
-
|
|
357
291
|
return disabledDates(date.toISOString());
|
|
358
|
-
}
|
|
292
|
+
}
|
|
359
293
|
|
|
294
|
+
// Called when the user enters text into dateInput
|
|
360
295
|
|
|
361
296
|
tryParseDate(val) {
|
|
362
297
|
const parsed = _DateTime.DateTime.parse(val, this.locale(), this.timezone());
|
|
363
|
-
|
|
364
298
|
return parsed.isValid() ? parsed : null;
|
|
365
|
-
}
|
|
299
|
+
}
|
|
366
300
|
|
|
301
|
+
// date is returned es a ISO string, like 2021-09-14T22:00:00.000Z
|
|
367
302
|
|
|
368
303
|
updateStateBasedOnDateInput(dateParsed, event) {
|
|
369
304
|
let newState;
|
|
370
|
-
|
|
371
305
|
if (dateParsed && this.state.timeSelectValue && (!this.state.dateInputText || this.state.dateInputText == '')) {
|
|
372
306
|
// There is already a selected time, but no date. Adjust the time too
|
|
373
307
|
const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
374
|
-
|
|
375
308
|
const dateParsedAdjusted = dateParsed.set({
|
|
376
309
|
hour: timeParsed.hour(),
|
|
377
310
|
minute: timeParsed.minute()
|
|
@@ -383,31 +316,25 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
383
316
|
} else {
|
|
384
317
|
newState = this.recalculateState(dateParsed === null || dateParsed === void 0 ? void 0 : dateParsed.toISOString(), false, true);
|
|
385
318
|
}
|
|
386
|
-
|
|
387
319
|
this.changeStateIfNeeded(newState, event);
|
|
388
320
|
}
|
|
389
|
-
|
|
390
321
|
renderDays() {
|
|
391
322
|
if (!this.state.isShowingCalendar) {
|
|
392
323
|
// this is an expensive function, only execute if the calendar is open
|
|
393
324
|
return;
|
|
394
325
|
}
|
|
395
|
-
|
|
396
|
-
|
|
326
|
+
const renderedDate = this.state.renderedDate;
|
|
327
|
+
// Sets it to the first local day of the week counting back from the start of the month.
|
|
397
328
|
// Note that first day depends on the locale, e.g. it's Sunday in the US and
|
|
398
329
|
// Monday in most of the EU.
|
|
399
|
-
|
|
400
330
|
const currDate = _DateTime.DateTime.getFirstDayOfWeek(renderedDate.startOf('month'));
|
|
401
|
-
|
|
402
331
|
const arr = [];
|
|
403
|
-
|
|
404
332
|
for (let i = 0; i < _Calendar.Calendar.DAY_COUNT; i++) {
|
|
405
333
|
arr.push(currDate.clone());
|
|
406
334
|
currDate.add({
|
|
407
335
|
days: 1
|
|
408
336
|
});
|
|
409
337
|
}
|
|
410
|
-
|
|
411
338
|
return arr.map(date => {
|
|
412
339
|
const dateStr = date.toISOString();
|
|
413
340
|
return /*#__PURE__*/_react.default.createElement(_DateInput.DateInput.Day, {
|
|
@@ -422,19 +349,16 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
422
349
|
interaction: this.isDisabledDate(date) ? 'disabled' : 'enabled'
|
|
423
350
|
}, date.format('DD'));
|
|
424
351
|
});
|
|
425
|
-
}
|
|
426
|
-
|
|
352
|
+
}
|
|
427
353
|
|
|
354
|
+
// The default weekdays rendered in the calendar
|
|
428
355
|
get defaultWeekdays() {
|
|
429
356
|
if (!this.state.isShowingCalendar) {
|
|
430
357
|
// this is an expensive function, only execute if the calendar is open
|
|
431
358
|
return [];
|
|
432
359
|
}
|
|
433
|
-
|
|
434
360
|
const shortDayNames = _DateTime.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'short');
|
|
435
|
-
|
|
436
361
|
const longDayNames = _DateTime.DateTime.getLocalDayNamesOfTheWeek(this.locale(), 'long');
|
|
437
|
-
|
|
438
362
|
return [/*#__PURE__*/_react.default.createElement(_AccessibleContent.AccessibleContent, {
|
|
439
363
|
key: 1,
|
|
440
364
|
alt: longDayNames[0]
|
|
@@ -458,12 +382,10 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
458
382
|
alt: longDayNames[6]
|
|
459
383
|
}, shortDayNames[6])];
|
|
460
384
|
}
|
|
461
|
-
|
|
462
385
|
renderNextPrevMonthButton(type) {
|
|
463
386
|
if (!this.state.isShowingCalendar) {
|
|
464
387
|
return;
|
|
465
388
|
}
|
|
466
|
-
|
|
467
389
|
return /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
468
390
|
size: "small",
|
|
469
391
|
withBackground: false,
|
|
@@ -476,26 +398,25 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
476
398
|
screenReaderLabel: type === 'prev' ? this.props.prevMonthLabel : this.props.nextMonthLabel
|
|
477
399
|
});
|
|
478
400
|
}
|
|
479
|
-
|
|
480
401
|
render() {
|
|
481
402
|
const _this$props2 = this.props,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
403
|
+
description = _this$props2.description,
|
|
404
|
+
datePlaceholder = _this$props2.datePlaceholder,
|
|
405
|
+
dateRenderLabel = _this$props2.dateRenderLabel,
|
|
406
|
+
dateInputRef = _this$props2.dateInputRef,
|
|
407
|
+
timeRenderLabel = _this$props2.timeRenderLabel,
|
|
408
|
+
timeFormat = _this$props2.timeFormat,
|
|
409
|
+
timeStep = _this$props2.timeStep,
|
|
410
|
+
timeInputRef = _this$props2.timeInputRef,
|
|
411
|
+
locale = _this$props2.locale,
|
|
412
|
+
timezone = _this$props2.timezone,
|
|
413
|
+
messages = _this$props2.messages,
|
|
414
|
+
layout = _this$props2.layout,
|
|
415
|
+
rowSpacing = _this$props2.rowSpacing,
|
|
416
|
+
colSpacing = _this$props2.colSpacing,
|
|
417
|
+
isRequired = _this$props2.isRequired,
|
|
418
|
+
interaction = _this$props2.interaction,
|
|
419
|
+
renderWeekdayLabels = _this$props2.renderWeekdayLabels;
|
|
499
420
|
return /*#__PURE__*/_react.default.createElement(_FormFieldGroup.FormFieldGroup, {
|
|
500
421
|
description: description,
|
|
501
422
|
layout: layout,
|
|
@@ -538,7 +459,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
538
459
|
interaction: interaction
|
|
539
460
|
}));
|
|
540
461
|
}
|
|
541
|
-
|
|
542
462
|
}, _class2.displayName = "DateTimeInput", _class2.DEFAULT_MESSAGE_FORMAT = 'LLLL', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
543
463
|
layout: 'inline',
|
|
544
464
|
colSpacing: 'medium',
|
|
@@ -547,7 +467,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
|
|
|
547
467
|
messageFormat: _class2.DEFAULT_MESSAGE_FORMAT,
|
|
548
468
|
isRequired: false,
|
|
549
469
|
dateFormat: 'LL' // Localized date with full month, e.g. "August 6, 2014"
|
|
550
|
-
|
|
551
470
|
}, _class2.contextType = _ApplyLocaleContext.ApplyLocaleContext, _class2)) || _class);
|
|
552
471
|
exports.DateTimeInput = DateTimeInput;
|
|
553
472
|
var _default = DateTimeInput;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
|
11
|
-
|
|
12
9
|
var _I18nPropTypes = require("@instructure/ui-i18n/lib/I18nPropTypes.js");
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
17
|
-
|
|
18
12
|
/*
|
|
19
13
|
* The MIT License (MIT)
|
|
20
14
|
*
|
|
@@ -38,6 +32,7 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
38
32
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
33
|
* SOFTWARE.
|
|
40
34
|
*/
|
|
35
|
+
|
|
41
36
|
const propTypes = {
|
|
42
37
|
description: _propTypes.default.node.isRequired,
|
|
43
38
|
dateRenderLabel: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]).isRequired,
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "8.33.2
|
|
3
|
+
"version": "8.33.2",
|
|
4
4
|
"description": "A UI component that allows to select date and time.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.33.2
|
|
27
|
-
"@instructure/ui-test-locator": "8.33.2
|
|
28
|
-
"@instructure/ui-test-utils": "8.33.2
|
|
26
|
+
"@instructure/ui-babel-preset": "8.33.2",
|
|
27
|
+
"@instructure/ui-test-locator": "8.33.2",
|
|
28
|
+
"@instructure/ui-test-utils": "8.33.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.13.10",
|
|
32
|
-
"@instructure/debounce": "8.33.2
|
|
33
|
-
"@instructure/emotion": "8.33.2
|
|
34
|
-
"@instructure/ui-a11y-content": "8.33.2
|
|
35
|
-
"@instructure/ui-buttons": "8.33.2
|
|
36
|
-
"@instructure/ui-calendar": "8.33.2
|
|
37
|
-
"@instructure/ui-date-input": "8.33.2
|
|
38
|
-
"@instructure/ui-form-field": "8.33.2
|
|
39
|
-
"@instructure/ui-i18n": "8.33.2
|
|
40
|
-
"@instructure/ui-icons": "8.33.2
|
|
41
|
-
"@instructure/ui-prop-types": "8.33.2
|
|
42
|
-
"@instructure/ui-react-utils": "8.33.2
|
|
43
|
-
"@instructure/ui-testable": "8.33.2
|
|
44
|
-
"@instructure/ui-time-select": "8.33.2
|
|
45
|
-
"@instructure/ui-utils": "8.33.2
|
|
32
|
+
"@instructure/debounce": "8.33.2",
|
|
33
|
+
"@instructure/emotion": "8.33.2",
|
|
34
|
+
"@instructure/ui-a11y-content": "8.33.2",
|
|
35
|
+
"@instructure/ui-buttons": "8.33.2",
|
|
36
|
+
"@instructure/ui-calendar": "8.33.2",
|
|
37
|
+
"@instructure/ui-date-input": "8.33.2",
|
|
38
|
+
"@instructure/ui-form-field": "8.33.2",
|
|
39
|
+
"@instructure/ui-i18n": "8.33.2",
|
|
40
|
+
"@instructure/ui-icons": "8.33.2",
|
|
41
|
+
"@instructure/ui-prop-types": "8.33.2",
|
|
42
|
+
"@instructure/ui-react-utils": "8.33.2",
|
|
43
|
+
"@instructure/ui-testable": "8.33.2",
|
|
44
|
+
"@instructure/ui-time-select": "8.33.2",
|
|
45
|
+
"@instructure/ui-utils": "8.33.2",
|
|
46
46
|
"prop-types": "^15"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|