@instructure/ui-date-time-input 8.24.0 → 8.24.1-snapshot.19

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.
@@ -50,7 +50,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
50
50
  // componentDidMount()
51
51
 
52
52
  this.context = void 0;
53
- this._timeInput = void 0;
54
53
  this.ref = null;
55
54
 
56
55
  this.handleRef = el => {
@@ -142,10 +141,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
142
141
  }
143
142
  };
144
143
 
145
- this.timeInputComponentRef = node => {
146
- this._timeInput = node;
147
- };
148
-
149
144
  this.handleShowCalendar = _event => {
150
145
  this.setState({
151
146
  isShowingCalendar: true
@@ -241,8 +236,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
241
236
  const parsed = DateTime.parse(dateStr, this.locale(), this.timezone());
242
237
 
243
238
  if (parsed.isValid()) {
244
- var _this$state, _this$_timeInput;
245
-
246
239
  if (doNotChangeTime && this.state.timeSelectValue) {
247
240
  // There is a selected time, adjust the parsed date to its value
248
241
  const timeParsed = DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
@@ -253,7 +246,7 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
253
246
  parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
254
247
  }
255
248
 
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();
249
+ const newTimeSelectValue = parsed.toISOString();
257
250
 
258
251
  if (this.isDisabledDate(parsed)) {
259
252
  let text = typeof this.props.disabledDateTimeMessage === 'function' ? this.props.disabledDateTimeMessage(parsed.toISOString(true)) : this.props.disabledDateTimeMessage;
@@ -523,7 +516,6 @@ let DateTimeInput = (_dec = testable(), _dec(_class = (_class2 = class DateTimeI
523
516
  value: this.state.timeSelectValue,
524
517
  onChange: this.handleTimeChange,
525
518
  onBlur: this.handleBlur,
526
- ref: this.timeInputComponentRef,
527
519
  renderLabel: timeRenderLabel,
528
520
  locale: locale,
529
521
  format: timeFormat,
@@ -53,7 +53,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
53
53
  // componentDidMount()
54
54
 
55
55
  this.context = void 0;
56
- this._timeInput = void 0;
57
56
  this.ref = null;
58
57
 
59
58
  this.handleRef = el => {
@@ -147,10 +146,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
147
146
  }
148
147
  };
149
148
 
150
- this.timeInputComponentRef = node => {
151
- this._timeInput = node;
152
- };
153
-
154
149
  this.handleShowCalendar = _event => {
155
150
  this.setState({
156
151
  isShowingCalendar: true
@@ -246,8 +241,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
246
241
  const parsed = _DateTime.DateTime.parse(dateStr, this.locale(), this.timezone());
247
242
 
248
243
  if (parsed.isValid()) {
249
- var _this$state, _this$_timeInput;
250
-
251
244
  if (doNotChangeTime && this.state.timeSelectValue) {
252
245
  // There is a selected time, adjust the parsed date to its value
253
246
  const timeParsed = _DateTime.DateTime.parse(this.state.timeSelectValue, this.locale(), this.timezone());
@@ -259,7 +252,7 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
259
252
  parsed.date(this.state.iso.date()).month(this.state.iso.month()).year(this.state.iso.year());
260
253
  }
261
254
 
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();
255
+ const newTimeSelectValue = parsed.toISOString();
263
256
 
264
257
  if (this.isDisabledDate(parsed)) {
265
258
  let text = typeof this.props.disabledDateTimeMessage === 'function' ? this.props.disabledDateTimeMessage(parsed.toISOString(true)) : this.props.disabledDateTimeMessage;
@@ -534,7 +527,6 @@ let DateTimeInput = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 =
534
527
  value: this.state.timeSelectValue,
535
528
  onChange: this.handleTimeChange,
536
529
  onBlur: this.handleBlur,
537
- ref: this.timeInputComponentRef,
538
530
  renderLabel: timeRenderLabel,
539
531
  locale: locale,
540
532
  format: timeFormat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-date-time-input",
3
- "version": "8.24.0",
3
+ "version": "8.24.1-snapshot.19+102c13da9",
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.24.0",
27
- "@instructure/ui-test-locator": "8.24.0",
28
- "@instructure/ui-test-utils": "8.24.0"
26
+ "@instructure/ui-babel-preset": "8.24.1-snapshot.19+102c13da9",
27
+ "@instructure/ui-test-locator": "8.24.1-snapshot.19+102c13da9",
28
+ "@instructure/ui-test-utils": "8.24.1-snapshot.19+102c13da9"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.13.10",
32
- "@instructure/debounce": "8.24.0",
33
- "@instructure/emotion": "8.24.0",
34
- "@instructure/ui-a11y-content": "8.24.0",
35
- "@instructure/ui-buttons": "8.24.0",
36
- "@instructure/ui-calendar": "8.24.0",
37
- "@instructure/ui-date-input": "8.24.0",
38
- "@instructure/ui-form-field": "8.24.0",
39
- "@instructure/ui-i18n": "8.24.0",
40
- "@instructure/ui-icons": "8.24.0",
41
- "@instructure/ui-prop-types": "8.24.0",
42
- "@instructure/ui-react-utils": "8.24.0",
43
- "@instructure/ui-testable": "8.24.0",
44
- "@instructure/ui-time-select": "8.24.0",
45
- "@instructure/ui-utils": "8.24.0",
32
+ "@instructure/debounce": "8.24.1-snapshot.19+102c13da9",
33
+ "@instructure/emotion": "8.24.1-snapshot.19+102c13da9",
34
+ "@instructure/ui-a11y-content": "8.24.1-snapshot.19+102c13da9",
35
+ "@instructure/ui-buttons": "8.24.1-snapshot.19+102c13da9",
36
+ "@instructure/ui-calendar": "8.24.1-snapshot.19+102c13da9",
37
+ "@instructure/ui-date-input": "8.24.1-snapshot.19+102c13da9",
38
+ "@instructure/ui-form-field": "8.24.1-snapshot.19+102c13da9",
39
+ "@instructure/ui-i18n": "8.24.1-snapshot.19+102c13da9",
40
+ "@instructure/ui-icons": "8.24.1-snapshot.19+102c13da9",
41
+ "@instructure/ui-prop-types": "8.24.1-snapshot.19+102c13da9",
42
+ "@instructure/ui-react-utils": "8.24.1-snapshot.19+102c13da9",
43
+ "@instructure/ui-testable": "8.24.1-snapshot.19+102c13da9",
44
+ "@instructure/ui-time-select": "8.24.1-snapshot.19+102c13da9",
45
+ "@instructure/ui-utils": "8.24.1-snapshot.19+102c13da9",
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": "102c13da991ad65ffde83ca7e0f23cbb760b8c68"
55
56
  }
@@ -68,7 +68,6 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
68
68
 
69
69
  static contextType = ApplyLocaleContext
70
70
 
71
- private _timeInput?: TimeSelect
72
71
  ref: Element | null = null // This is used by Tooltip for positioning
73
72
 
74
73
  handleRef = (el: Element | null) => {
@@ -136,13 +135,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
136
135
  .month(this.state.iso.month())
137
136
  .year(this.state.iso.year())
138
137
  }
139
- const newTimeSelectValue = this.state?.timeSelectValue
140
- ? this.state.timeSelectValue
141
- : this._timeInput
142
- ?.getBaseDate()
143
- .minute(parsed.minute())
144
- .hour(parsed.hour())
145
- .toISOString()
138
+ const newTimeSelectValue = parsed.toISOString()
146
139
  if (this.isDisabledDate(parsed)) {
147
140
  let text =
148
141
  typeof this.props.disabledDateTimeMessage === 'function'
@@ -359,10 +352,6 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
359
352
  }
360
353
  }
361
354
 
362
- timeInputComponentRef = (node: TimeSelect) => {
363
- this._timeInput = node
364
- }
365
-
366
355
  handleShowCalendar = (_event: SyntheticEvent) => {
367
356
  this.setState({ isShowingCalendar: true })
368
357
  }
@@ -589,7 +578,6 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
589
578
  value={this.state.timeSelectValue}
590
579
  onChange={this.handleTimeChange}
591
580
  onBlur={this.handleBlur}
592
- ref={this.timeInputComponentRef}
593
581
  renderLabel={timeRenderLabel}
594
582
  locale={locale}
595
583
  format={timeFormat}