@instructure/ui-date-time-input 8.17.1-snapshot.21 → 8.17.1-snapshot.30

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.
@@ -122,9 +122,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
122
122
  this.setState(newState);
123
123
 
124
124
  if (this.props.onChange) {
125
- var _newState$iso;
126
-
127
- this.props.onChange(e, (_newState$iso = newState.iso) === null || _newState$iso === void 0 ? void 0 : _newState$iso.toISOString());
125
+ this.props.onChange(e, newState.iso?.toISOString());
128
126
  }
129
127
  }
130
128
  };
@@ -135,9 +133,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
135
133
  // The timeout gives it a moment for that to happen
136
134
  if (typeof this.props.onBlur === 'function') {
137
135
  window.setTimeout(() => {
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);
136
+ this.props.onBlur?.(e);
141
137
  }, 0);
142
138
  }
143
139
  };
@@ -241,8 +237,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
241
237
  const parsed = DateTime.parse(dateStr, this.locale(), this.timezone());
242
238
 
243
239
  if (parsed.isValid()) {
244
- var _this$state, _this$_timeInput;
245
-
246
240
  if (doNotChangeTime && this.state.timeSelectValue) {
247
241
  // There is a selected time, adjust the parsed date to its value
248
242
  const timeParsed = DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
@@ -253,7 +247,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
253
247
  parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
254
248
  }
255
249
 
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();
250
+ const newTimeSelectValue = this.state?.timeSelectValue ? this.state.timeSelectValue : this._timeInput?.getBaseDate().minute(parsed.minute()).hour(parsed.hour()).toISOString();
257
251
  return {
258
252
  iso: parsed.clone(),
259
253
  calendarSelectedDate: parsed.clone(),
@@ -333,7 +327,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
333
327
  // if the text in the dateInput is not readable display error
334
328
  newState = this.recalculateState(this.state.dateInputText, false, true);
335
329
  } else {
336
- newState = this.recalculateState(dateParsed === null || dateParsed === void 0 ? void 0 : dateParsed.toISOString(), false, true);
330
+ newState = this.recalculateState(dateParsed?.toISOString(), false, true);
337
331
  }
338
332
 
339
333
  this.changeStateIfNeeded(newState, event);
@@ -426,22 +420,22 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_temp = _class2 = class D
426
420
  }
427
421
 
428
422
  render() {
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;
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;
445
439
  return /*#__PURE__*/React.createElement(FormFieldGroup, {
446
440
  description: description,
447
441
  colSpacing: "medium",
@@ -127,9 +127,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
127
127
  this.setState(newState);
128
128
 
129
129
  if (this.props.onChange) {
130
- var _newState$iso;
131
-
132
- this.props.onChange(e, (_newState$iso = newState.iso) === null || _newState$iso === void 0 ? void 0 : _newState$iso.toISOString());
130
+ this.props.onChange(e, newState.iso?.toISOString());
133
131
  }
134
132
  }
135
133
  };
@@ -140,9 +138,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
140
138
  // The timeout gives it a moment for that to happen
141
139
  if (typeof this.props.onBlur === 'function') {
142
140
  window.setTimeout(() => {
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);
141
+ this.props.onBlur?.(e);
146
142
  }, 0);
147
143
  }
148
144
  };
@@ -246,8 +242,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
246
242
  const parsed = _DateTime.DateTime.parse(dateStr, this.locale(), this.timezone());
247
243
 
248
244
  if (parsed.isValid()) {
249
- var _this$state, _this$_timeInput;
250
-
251
245
  if (doNotChangeTime && this.state.timeSelectValue) {
252
246
  // There is a selected time, adjust the parsed date to its value
253
247
  const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
@@ -259,7 +253,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
259
253
  parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
260
254
  }
261
255
 
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();
256
+ const newTimeSelectValue = this.state?.timeSelectValue ? this.state.timeSelectValue : this._timeInput?.getBaseDate().minute(parsed.minute()).hour(parsed.hour()).toISOString();
263
257
  return {
264
258
  iso: parsed.clone(),
265
259
  calendarSelectedDate: parsed.clone(),
@@ -341,7 +335,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
341
335
  // if the text in the dateInput is not readable display error
342
336
  newState = this.recalculateState(this.state.dateInputText, false, true);
343
337
  } else {
344
- newState = this.recalculateState(dateParsed === null || dateParsed === void 0 ? void 0 : dateParsed.toISOString(), false, true);
338
+ newState = this.recalculateState(dateParsed?.toISOString(), false, true);
345
339
  }
346
340
 
347
341
  this.changeStateIfNeeded(newState, event);
@@ -437,22 +431,22 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
437
431
  }
438
432
 
439
433
  render() {
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;
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;
456
450
  return /*#__PURE__*/_react.default.createElement(_FormFieldGroup.FormFieldGroup, {
457
451
  description: description,
458
452
  colSpacing: "medium",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-date-time-input",
3
- "version": "8.17.1-snapshot.21+79d490548",
3
+ "version": "8.17.1-snapshot.30+cb1322c25",
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.17.1-snapshot.21+79d490548",
27
- "@instructure/ui-test-locator": "8.17.1-snapshot.21+79d490548",
28
- "@instructure/ui-test-utils": "8.17.1-snapshot.21+79d490548"
26
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.30+cb1322c25",
27
+ "@instructure/ui-test-locator": "8.17.1-snapshot.30+cb1322c25",
28
+ "@instructure/ui-test-utils": "8.17.1-snapshot.30+cb1322c25"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.13.10",
32
- "@instructure/debounce": "8.17.1-snapshot.21+79d490548",
33
- "@instructure/emotion": "8.17.1-snapshot.21+79d490548",
34
- "@instructure/ui-a11y-content": "8.17.1-snapshot.21+79d490548",
35
- "@instructure/ui-buttons": "8.17.1-snapshot.21+79d490548",
36
- "@instructure/ui-calendar": "8.17.1-snapshot.21+79d490548",
37
- "@instructure/ui-date-input": "8.17.1-snapshot.21+79d490548",
38
- "@instructure/ui-form-field": "8.17.1-snapshot.21+79d490548",
39
- "@instructure/ui-i18n": "8.17.1-snapshot.21+79d490548",
40
- "@instructure/ui-icons": "8.17.1-snapshot.21+79d490548",
41
- "@instructure/ui-prop-types": "8.17.1-snapshot.21+79d490548",
42
- "@instructure/ui-react-utils": "8.17.1-snapshot.21+79d490548",
43
- "@instructure/ui-testable": "8.17.1-snapshot.21+79d490548",
44
- "@instructure/ui-time-select": "8.17.1-snapshot.21+79d490548",
45
- "@instructure/ui-utils": "8.17.1-snapshot.21+79d490548",
32
+ "@instructure/debounce": "8.17.1-snapshot.30+cb1322c25",
33
+ "@instructure/emotion": "8.17.1-snapshot.30+cb1322c25",
34
+ "@instructure/ui-a11y-content": "8.17.1-snapshot.30+cb1322c25",
35
+ "@instructure/ui-buttons": "8.17.1-snapshot.30+cb1322c25",
36
+ "@instructure/ui-calendar": "8.17.1-snapshot.30+cb1322c25",
37
+ "@instructure/ui-date-input": "8.17.1-snapshot.30+cb1322c25",
38
+ "@instructure/ui-form-field": "8.17.1-snapshot.30+cb1322c25",
39
+ "@instructure/ui-i18n": "8.17.1-snapshot.30+cb1322c25",
40
+ "@instructure/ui-icons": "8.17.1-snapshot.30+cb1322c25",
41
+ "@instructure/ui-prop-types": "8.17.1-snapshot.30+cb1322c25",
42
+ "@instructure/ui-react-utils": "8.17.1-snapshot.30+cb1322c25",
43
+ "@instructure/ui-testable": "8.17.1-snapshot.30+cb1322c25",
44
+ "@instructure/ui-time-select": "8.17.1-snapshot.30+cb1322c25",
45
+ "@instructure/ui-utils": "8.17.1-snapshot.30+cb1322c25",
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": "79d490548a0736feb2a7232bf5918857317b178b"
55
+ "gitHead": "cb1322c25257139750149d7a817f1fb32571c1ed"
56
56
  }