@instructure/ui-date-time-input 8.18.0 → 8.18.1-snapshot.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/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
- this.props.onChange(e, newState.iso?.toISOString());
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
- this.props.onBlur?.(e);
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?.timeSelectValue ? this.state.timeSelectValue : this._timeInput?.getBaseDate().minute(parsed.minute()).hour(parsed.hour()).toISOString();
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?.toISOString(), false, true);
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$props = this.props,
424
- description = _this$props.description,
425
- datePlaceholder = _this$props.datePlaceholder,
426
- dateRenderLabel = _this$props.dateRenderLabel,
427
- dateInputRef = _this$props.dateInputRef,
428
- timeRenderLabel = _this$props.timeRenderLabel,
429
- timeFormat = _this$props.timeFormat,
430
- timeStep = _this$props.timeStep,
431
- timeInputRef = _this$props.timeInputRef,
432
- locale = _this$props.locale,
433
- timezone = _this$props.timezone,
434
- messages = _this$props.messages,
435
- layout = _this$props.layout,
436
- isRequired = _this$props.isRequired,
437
- interaction = _this$props.interaction,
438
- renderWeekdayLabels = _this$props.renderWeekdayLabels;
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
- this.props.onChange(e, newState.iso?.toISOString());
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
- this.props.onBlur?.(e);
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?.timeSelectValue ? this.state.timeSelectValue : this._timeInput?.getBaseDate().minute(parsed.minute()).hour(parsed.hour()).toISOString();
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?.toISOString(), false, true);
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$props = this.props,
435
- description = _this$props.description,
436
- datePlaceholder = _this$props.datePlaceholder,
437
- dateRenderLabel = _this$props.dateRenderLabel,
438
- dateInputRef = _this$props.dateInputRef,
439
- timeRenderLabel = _this$props.timeRenderLabel,
440
- timeFormat = _this$props.timeFormat,
441
- timeStep = _this$props.timeStep,
442
- timeInputRef = _this$props.timeInputRef,
443
- locale = _this$props.locale,
444
- timezone = _this$props.timezone,
445
- messages = _this$props.messages,
446
- layout = _this$props.layout,
447
- isRequired = _this$props.isRequired,
448
- interaction = _this$props.interaction,
449
- renderWeekdayLabels = _this$props.renderWeekdayLabels;
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.0",
3
+ "version": "8.18.1-snapshot.2+ca4c1ff9d",
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.0",
27
- "@instructure/ui-test-locator": "8.18.0",
28
- "@instructure/ui-test-utils": "8.18.0"
26
+ "@instructure/ui-babel-preset": "8.18.1-snapshot.2+ca4c1ff9d",
27
+ "@instructure/ui-test-locator": "8.18.1-snapshot.2+ca4c1ff9d",
28
+ "@instructure/ui-test-utils": "8.18.1-snapshot.2+ca4c1ff9d"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.13.10",
32
- "@instructure/debounce": "8.18.0",
33
- "@instructure/emotion": "8.18.0",
34
- "@instructure/ui-a11y-content": "8.18.0",
35
- "@instructure/ui-buttons": "8.18.0",
36
- "@instructure/ui-calendar": "8.18.0",
37
- "@instructure/ui-date-input": "8.18.0",
38
- "@instructure/ui-form-field": "8.18.0",
39
- "@instructure/ui-i18n": "8.18.0",
40
- "@instructure/ui-icons": "8.18.0",
41
- "@instructure/ui-prop-types": "8.18.0",
42
- "@instructure/ui-react-utils": "8.18.0",
43
- "@instructure/ui-testable": "8.18.0",
44
- "@instructure/ui-time-select": "8.18.0",
45
- "@instructure/ui-utils": "8.18.0",
32
+ "@instructure/debounce": "8.18.1-snapshot.2+ca4c1ff9d",
33
+ "@instructure/emotion": "8.18.1-snapshot.2+ca4c1ff9d",
34
+ "@instructure/ui-a11y-content": "8.18.1-snapshot.2+ca4c1ff9d",
35
+ "@instructure/ui-buttons": "8.18.1-snapshot.2+ca4c1ff9d",
36
+ "@instructure/ui-calendar": "8.18.1-snapshot.2+ca4c1ff9d",
37
+ "@instructure/ui-date-input": "8.18.1-snapshot.2+ca4c1ff9d",
38
+ "@instructure/ui-form-field": "8.18.1-snapshot.2+ca4c1ff9d",
39
+ "@instructure/ui-i18n": "8.18.1-snapshot.2+ca4c1ff9d",
40
+ "@instructure/ui-icons": "8.18.1-snapshot.2+ca4c1ff9d",
41
+ "@instructure/ui-prop-types": "8.18.1-snapshot.2+ca4c1ff9d",
42
+ "@instructure/ui-react-utils": "8.18.1-snapshot.2+ca4c1ff9d",
43
+ "@instructure/ui-testable": "8.18.1-snapshot.2+ca4c1ff9d",
44
+ "@instructure/ui-time-select": "8.18.1-snapshot.2+ca4c1ff9d",
45
+ "@instructure/ui-utils": "8.18.1-snapshot.2+ca4c1ff9d",
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": "ca4c1ff9d3985151ae0758fb596de41652dbb58b"
55
56
  }