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