@instructure/ui-date-time-input 8.18.0 → 8.18.1-snapshot.12
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/LICENSE.md +27 -0
- package/es/DateTimeInput/index.js +26 -20
- package/lib/DateTimeInput/index.js +26 -20
- package/package.json +20 -19
- package/tsconfig.build.tsbuildinfo +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
@@ -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.18.
|
|
3
|
+
"version": "8.18.1-snapshot.12+ca14b3dc8",
|
|
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.18.
|
|
27
|
-
"@instructure/ui-test-locator": "8.18.
|
|
28
|
-
"@instructure/ui-test-utils": "8.18.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.18.1-snapshot.12+ca14b3dc8",
|
|
27
|
+
"@instructure/ui-test-locator": "8.18.1-snapshot.12+ca14b3dc8",
|
|
28
|
+
"@instructure/ui-test-utils": "8.18.1-snapshot.12+ca14b3dc8"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.13.10",
|
|
32
|
-
"@instructure/debounce": "8.18.
|
|
33
|
-
"@instructure/emotion": "8.18.
|
|
34
|
-
"@instructure/ui-a11y-content": "8.18.
|
|
35
|
-
"@instructure/ui-buttons": "8.18.
|
|
36
|
-
"@instructure/ui-calendar": "8.18.
|
|
37
|
-
"@instructure/ui-date-input": "8.18.
|
|
38
|
-
"@instructure/ui-form-field": "8.18.
|
|
39
|
-
"@instructure/ui-i18n": "8.18.
|
|
40
|
-
"@instructure/ui-icons": "8.18.
|
|
41
|
-
"@instructure/ui-prop-types": "8.18.
|
|
42
|
-
"@instructure/ui-react-utils": "8.18.
|
|
43
|
-
"@instructure/ui-testable": "8.18.
|
|
44
|
-
"@instructure/ui-time-select": "8.18.
|
|
45
|
-
"@instructure/ui-utils": "8.18.
|
|
32
|
+
"@instructure/debounce": "8.18.1-snapshot.12+ca14b3dc8",
|
|
33
|
+
"@instructure/emotion": "8.18.1-snapshot.12+ca14b3dc8",
|
|
34
|
+
"@instructure/ui-a11y-content": "8.18.1-snapshot.12+ca14b3dc8",
|
|
35
|
+
"@instructure/ui-buttons": "8.18.1-snapshot.12+ca14b3dc8",
|
|
36
|
+
"@instructure/ui-calendar": "8.18.1-snapshot.12+ca14b3dc8",
|
|
37
|
+
"@instructure/ui-date-input": "8.18.1-snapshot.12+ca14b3dc8",
|
|
38
|
+
"@instructure/ui-form-field": "8.18.1-snapshot.12+ca14b3dc8",
|
|
39
|
+
"@instructure/ui-i18n": "8.18.1-snapshot.12+ca14b3dc8",
|
|
40
|
+
"@instructure/ui-icons": "8.18.1-snapshot.12+ca14b3dc8",
|
|
41
|
+
"@instructure/ui-prop-types": "8.18.1-snapshot.12+ca14b3dc8",
|
|
42
|
+
"@instructure/ui-react-utils": "8.18.1-snapshot.12+ca14b3dc8",
|
|
43
|
+
"@instructure/ui-testable": "8.18.1-snapshot.12+ca14b3dc8",
|
|
44
|
+
"@instructure/ui-time-select": "8.18.1-snapshot.12+ca14b3dc8",
|
|
45
|
+
"@instructure/ui-utils": "8.18.1-snapshot.12+ca14b3dc8",
|
|
46
46
|
"prop-types": "^15"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -51,5 +51,6 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"sideEffects": false
|
|
54
|
+
"sideEffects": false,
|
|
55
|
+
"gitHead": "ca14b3dc8f0315daef7b86aa05f711e6d6684c58"
|
|
55
56
|
}
|