@instructure/ui-date-time-input 8.17.1-snapshot.81 → 8.18.1-snapshot.0
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 +4 -0
- package/es/DateTimeInput/index.js +26 -20
- package/lib/DateTimeInput/index.js +26 -20
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.18.0](https://github.com/instructure/instructure-ui/compare/v8.17.0...v8.18.0) (2022-02-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-date-time-input
|
|
9
|
+
|
|
6
10
|
# [8.17.0](https://github.com/instructure/instructure-ui/compare/v8.16.0...v8.17.0) (2022-02-07)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
|
@@ -122,7 +122,9 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
|
|
|
122
122
|
this.setState(newState);
|
|
123
123
|
|
|
124
124
|
if (this.props.onChange) {
|
|
125
|
-
|
|
125
|
+
var _newState$iso;
|
|
126
|
+
|
|
127
|
+
this.props.onChange(e, (_newState$iso = newState.iso) === null || _newState$iso === void 0 ? void 0 : _newState$iso.toISOString());
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
};
|
|
@@ -133,7 +135,9 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
|
|
|
133
135
|
// The timeout gives it a moment for that to happen
|
|
134
136
|
if (typeof this.props.onBlur === 'function') {
|
|
135
137
|
window.setTimeout(() => {
|
|
136
|
-
|
|
138
|
+
var _this$props$onBlur, _this$props;
|
|
139
|
+
|
|
140
|
+
(_this$props$onBlur = (_this$props = this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, e);
|
|
137
141
|
}, 0);
|
|
138
142
|
}
|
|
139
143
|
};
|
|
@@ -237,6 +241,8 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
|
|
|
237
241
|
const parsed = DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
238
242
|
|
|
239
243
|
if (parsed.isValid()) {
|
|
244
|
+
var _this$state, _this$_timeInput;
|
|
245
|
+
|
|
240
246
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
241
247
|
// There is a selected time, adjust the parsed date to its value
|
|
242
248
|
const timeParsed = DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
@@ -247,7 +253,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
|
|
|
247
253
|
parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
const newTimeSelectValue = this.state
|
|
256
|
+
const newTimeSelectValue = (_this$state = this.state) !== null && _this$state !== void 0 && _this$state.timeSelectValue ? this.state.timeSelectValue : (_this$_timeInput = this._timeInput) === null || _this$_timeInput === void 0 ? void 0 : _this$_timeInput.getBaseDate().minute(parsed.minute()).hour(parsed.hour()).toISOString();
|
|
251
257
|
return {
|
|
252
258
|
iso: parsed.clone(),
|
|
253
259
|
calendarSelectedDate: parsed.clone(),
|
|
@@ -327,7 +333,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
|
|
|
327
333
|
// if the text in the dateInput is not readable display error
|
|
328
334
|
newState = this.recalculateState(this.state.dateInputText, false, true);
|
|
329
335
|
} else {
|
|
330
|
-
newState = this.recalculateState(dateParsed
|
|
336
|
+
newState = this.recalculateState(dateParsed === null || dateParsed === void 0 ? void 0 : dateParsed.toISOString(), false, true);
|
|
331
337
|
}
|
|
332
338
|
|
|
333
339
|
this.changeStateIfNeeded(newState, event);
|
|
@@ -420,22 +426,22 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
|
|
|
420
426
|
}
|
|
421
427
|
|
|
422
428
|
render() {
|
|
423
|
-
const _this$
|
|
424
|
-
description = _this$
|
|
425
|
-
datePlaceholder = _this$
|
|
426
|
-
dateRenderLabel = _this$
|
|
427
|
-
dateInputRef = _this$
|
|
428
|
-
timeRenderLabel = _this$
|
|
429
|
-
timeFormat = _this$
|
|
430
|
-
timeStep = _this$
|
|
431
|
-
timeInputRef = _this$
|
|
432
|
-
locale = _this$
|
|
433
|
-
timezone = _this$
|
|
434
|
-
messages = _this$
|
|
435
|
-
layout = _this$
|
|
436
|
-
isRequired = _this$
|
|
437
|
-
interaction = _this$
|
|
438
|
-
renderWeekdayLabels = _this$
|
|
429
|
+
const _this$props2 = this.props,
|
|
430
|
+
description = _this$props2.description,
|
|
431
|
+
datePlaceholder = _this$props2.datePlaceholder,
|
|
432
|
+
dateRenderLabel = _this$props2.dateRenderLabel,
|
|
433
|
+
dateInputRef = _this$props2.dateInputRef,
|
|
434
|
+
timeRenderLabel = _this$props2.timeRenderLabel,
|
|
435
|
+
timeFormat = _this$props2.timeFormat,
|
|
436
|
+
timeStep = _this$props2.timeStep,
|
|
437
|
+
timeInputRef = _this$props2.timeInputRef,
|
|
438
|
+
locale = _this$props2.locale,
|
|
439
|
+
timezone = _this$props2.timezone,
|
|
440
|
+
messages = _this$props2.messages,
|
|
441
|
+
layout = _this$props2.layout,
|
|
442
|
+
isRequired = _this$props2.isRequired,
|
|
443
|
+
interaction = _this$props2.interaction,
|
|
444
|
+
renderWeekdayLabels = _this$props2.renderWeekdayLabels;
|
|
439
445
|
return /*#__PURE__*/React.createElement(FormFieldGroup, {
|
|
440
446
|
description: description,
|
|
441
447
|
colSpacing: "medium",
|
|
@@ -127,7 +127,9 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
127
127
|
this.setState(newState);
|
|
128
128
|
|
|
129
129
|
if (this.props.onChange) {
|
|
130
|
-
|
|
130
|
+
var _newState$iso;
|
|
131
|
+
|
|
132
|
+
this.props.onChange(e, (_newState$iso = newState.iso) === null || _newState$iso === void 0 ? void 0 : _newState$iso.toISOString());
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
};
|
|
@@ -138,7 +140,9 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
138
140
|
// The timeout gives it a moment for that to happen
|
|
139
141
|
if (typeof this.props.onBlur === 'function') {
|
|
140
142
|
window.setTimeout(() => {
|
|
141
|
-
|
|
143
|
+
var _this$props$onBlur, _this$props;
|
|
144
|
+
|
|
145
|
+
(_this$props$onBlur = (_this$props = this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, e);
|
|
142
146
|
}, 0);
|
|
143
147
|
}
|
|
144
148
|
};
|
|
@@ -242,6 +246,8 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
242
246
|
const parsed = _DateTime.DateTime.parse(dateStr, this.locale(), this.timezone());
|
|
243
247
|
|
|
244
248
|
if (parsed.isValid()) {
|
|
249
|
+
var _this$state, _this$_timeInput;
|
|
250
|
+
|
|
245
251
|
if (doNotChangeTime && this.state.timeSelectValue) {
|
|
246
252
|
// There is a selected time, adjust the parsed date to its value
|
|
247
253
|
const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
|
|
@@ -253,7 +259,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
253
259
|
parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
|
|
254
260
|
}
|
|
255
261
|
|
|
256
|
-
const newTimeSelectValue = this.state
|
|
262
|
+
const newTimeSelectValue = (_this$state = this.state) !== null && _this$state !== void 0 && _this$state.timeSelectValue ? this.state.timeSelectValue : (_this$_timeInput = this._timeInput) === null || _this$_timeInput === void 0 ? void 0 : _this$_timeInput.getBaseDate().minute(parsed.minute()).hour(parsed.hour()).toISOString();
|
|
257
263
|
return {
|
|
258
264
|
iso: parsed.clone(),
|
|
259
265
|
calendarSelectedDate: parsed.clone(),
|
|
@@ -335,7 +341,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
335
341
|
// if the text in the dateInput is not readable display error
|
|
336
342
|
newState = this.recalculateState(this.state.dateInputText, false, true);
|
|
337
343
|
} else {
|
|
338
|
-
newState = this.recalculateState(dateParsed
|
|
344
|
+
newState = this.recalculateState(dateParsed === null || dateParsed === void 0 ? void 0 : dateParsed.toISOString(), false, true);
|
|
339
345
|
}
|
|
340
346
|
|
|
341
347
|
this.changeStateIfNeeded(newState, event);
|
|
@@ -431,22 +437,22 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
431
437
|
}
|
|
432
438
|
|
|
433
439
|
render() {
|
|
434
|
-
const _this$
|
|
435
|
-
description = _this$
|
|
436
|
-
datePlaceholder = _this$
|
|
437
|
-
dateRenderLabel = _this$
|
|
438
|
-
dateInputRef = _this$
|
|
439
|
-
timeRenderLabel = _this$
|
|
440
|
-
timeFormat = _this$
|
|
441
|
-
timeStep = _this$
|
|
442
|
-
timeInputRef = _this$
|
|
443
|
-
locale = _this$
|
|
444
|
-
timezone = _this$
|
|
445
|
-
messages = _this$
|
|
446
|
-
layout = _this$
|
|
447
|
-
isRequired = _this$
|
|
448
|
-
interaction = _this$
|
|
449
|
-
renderWeekdayLabels = _this$
|
|
440
|
+
const _this$props2 = this.props,
|
|
441
|
+
description = _this$props2.description,
|
|
442
|
+
datePlaceholder = _this$props2.datePlaceholder,
|
|
443
|
+
dateRenderLabel = _this$props2.dateRenderLabel,
|
|
444
|
+
dateInputRef = _this$props2.dateInputRef,
|
|
445
|
+
timeRenderLabel = _this$props2.timeRenderLabel,
|
|
446
|
+
timeFormat = _this$props2.timeFormat,
|
|
447
|
+
timeStep = _this$props2.timeStep,
|
|
448
|
+
timeInputRef = _this$props2.timeInputRef,
|
|
449
|
+
locale = _this$props2.locale,
|
|
450
|
+
timezone = _this$props2.timezone,
|
|
451
|
+
messages = _this$props2.messages,
|
|
452
|
+
layout = _this$props2.layout,
|
|
453
|
+
isRequired = _this$props2.isRequired,
|
|
454
|
+
interaction = _this$props2.interaction,
|
|
455
|
+
renderWeekdayLabels = _this$props2.renderWeekdayLabels;
|
|
450
456
|
return /*#__PURE__*/_react.default.createElement(_FormFieldGroup.FormFieldGroup, {
|
|
451
457
|
description: description,
|
|
452
458
|
colSpacing: "medium",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-date-time-input",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.18.1-snapshot.0+435c9ae79",
|
|
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.
|
|
27
|
-
"@instructure/ui-test-locator": "8.
|
|
28
|
-
"@instructure/ui-test-utils": "8.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.18.1-snapshot.0+435c9ae79",
|
|
27
|
+
"@instructure/ui-test-locator": "8.18.1-snapshot.0+435c9ae79",
|
|
28
|
+
"@instructure/ui-test-utils": "8.18.1-snapshot.0+435c9ae79"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.13.10",
|
|
32
|
-
"@instructure/debounce": "8.
|
|
33
|
-
"@instructure/emotion": "8.
|
|
34
|
-
"@instructure/ui-a11y-content": "8.
|
|
35
|
-
"@instructure/ui-buttons": "8.
|
|
36
|
-
"@instructure/ui-calendar": "8.
|
|
37
|
-
"@instructure/ui-date-input": "8.
|
|
38
|
-
"@instructure/ui-form-field": "8.
|
|
39
|
-
"@instructure/ui-i18n": "8.
|
|
40
|
-
"@instructure/ui-icons": "8.
|
|
41
|
-
"@instructure/ui-prop-types": "8.
|
|
42
|
-
"@instructure/ui-react-utils": "8.
|
|
43
|
-
"@instructure/ui-testable": "8.
|
|
44
|
-
"@instructure/ui-time-select": "8.
|
|
45
|
-
"@instructure/ui-utils": "8.
|
|
32
|
+
"@instructure/debounce": "8.18.1-snapshot.0+435c9ae79",
|
|
33
|
+
"@instructure/emotion": "8.18.1-snapshot.0+435c9ae79",
|
|
34
|
+
"@instructure/ui-a11y-content": "8.18.1-snapshot.0+435c9ae79",
|
|
35
|
+
"@instructure/ui-buttons": "8.18.1-snapshot.0+435c9ae79",
|
|
36
|
+
"@instructure/ui-calendar": "8.18.1-snapshot.0+435c9ae79",
|
|
37
|
+
"@instructure/ui-date-input": "8.18.1-snapshot.0+435c9ae79",
|
|
38
|
+
"@instructure/ui-form-field": "8.18.1-snapshot.0+435c9ae79",
|
|
39
|
+
"@instructure/ui-i18n": "8.18.1-snapshot.0+435c9ae79",
|
|
40
|
+
"@instructure/ui-icons": "8.18.1-snapshot.0+435c9ae79",
|
|
41
|
+
"@instructure/ui-prop-types": "8.18.1-snapshot.0+435c9ae79",
|
|
42
|
+
"@instructure/ui-react-utils": "8.18.1-snapshot.0+435c9ae79",
|
|
43
|
+
"@instructure/ui-testable": "8.18.1-snapshot.0+435c9ae79",
|
|
44
|
+
"@instructure/ui-time-select": "8.18.1-snapshot.0+435c9ae79",
|
|
45
|
+
"@instructure/ui-utils": "8.18.1-snapshot.0+435c9ae79",
|
|
46
46
|
"prop-types": "^15"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "435c9ae794c15e2bd103f700f8c4e946d91c1b59"
|
|
56
56
|
}
|