@instructure/ui-time-select 11.7.8 → 11.7.9-snapshot-1
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 +8 -0
- package/lib/TimeSelect/v1/index.js +18 -23
- package/lib/TimeSelect/v2/index.js +18 -23
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-time-select
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-time-select
|
|
@@ -6,13 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.TimeSelect = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
12
|
-
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
13
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
14
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
15
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
9
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
16
11
|
var _v11_ = require("@instructure/ui-select/v11_6");
|
|
17
12
|
var utils = _interopRequireWildcard(require("@instructure/ui-utils"));
|
|
18
13
|
var _props = require("./props.js");
|
|
@@ -48,7 +43,7 @@ category: components
|
|
|
48
43
|
|
|
49
44
|
A component used to select a time value.
|
|
50
45
|
**/
|
|
51
|
-
let TimeSelect = exports.TimeSelect = (_dec = (0,
|
|
46
|
+
let TimeSelect = exports.TimeSelect = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec(_class = class TimeSelect extends _react.Component {
|
|
52
47
|
static displayName = 'TimeSelect';
|
|
53
48
|
static componentId = 'TimeSelect';
|
|
54
49
|
static allowedProps = _props.allowedProps;
|
|
@@ -66,7 +61,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
66
61
|
allowNonStepInput: false,
|
|
67
62
|
allowClearingSelection: false
|
|
68
63
|
};
|
|
69
|
-
static contextType =
|
|
64
|
+
static contextType = _uiI18n.ApplyLocaleContext;
|
|
70
65
|
ref = null;
|
|
71
66
|
_emptyOptionId = this.props.deterministicId('Select-EmptyOption');
|
|
72
67
|
constructor(props) {
|
|
@@ -91,7 +86,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
91
86
|
return typeof this.props.value !== 'undefined';
|
|
92
87
|
}
|
|
93
88
|
get interaction() {
|
|
94
|
-
return (0,
|
|
89
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
95
90
|
props: this.props
|
|
96
91
|
});
|
|
97
92
|
}
|
|
@@ -107,7 +102,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
107
102
|
} else if (this.context && this.context.locale) {
|
|
108
103
|
return this.context.locale;
|
|
109
104
|
}
|
|
110
|
-
return
|
|
105
|
+
return _uiI18n.Locale.browserLocale();
|
|
111
106
|
}
|
|
112
107
|
timezone() {
|
|
113
108
|
if (this.props.timezone) {
|
|
@@ -115,7 +110,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
115
110
|
} else if (this.context && this.context.timezone) {
|
|
116
111
|
return this.context.timezone;
|
|
117
112
|
}
|
|
118
|
-
return
|
|
113
|
+
return _uiI18n.DateTime.browserTimeZone();
|
|
119
114
|
}
|
|
120
115
|
componentDidUpdate(prevProps) {
|
|
121
116
|
if (this.props.step !== prevProps.step || this.props.format !== prevProps.format || this.props.locale !== prevProps.locale || this.props.timezone !== prevProps.timezone || this.props.allowNonStepInput !== prevProps.allowNonStepInput) {
|
|
@@ -127,7 +122,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
127
122
|
if (this.props.value !== prevProps.value) {
|
|
128
123
|
let newValue;
|
|
129
124
|
if (this.props.value) {
|
|
130
|
-
newValue =
|
|
125
|
+
newValue = _uiI18n.DateTime.parse(this.props.value, this.locale(), this.timezone());
|
|
131
126
|
}
|
|
132
127
|
// value changed
|
|
133
128
|
const initState = this.getInitialState();
|
|
@@ -137,14 +132,14 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
137
132
|
if (!this.isControlled) {
|
|
138
133
|
// preserve current value when changing from controlled to uncontrolled
|
|
139
134
|
if (prevProps.value) {
|
|
140
|
-
option = this.getOption('id', this.getFormattedId(
|
|
135
|
+
option = this.getOption('id', this.getFormattedId(_uiI18n.DateTime.parse(prevProps.value, this.locale(), this.timezone())));
|
|
141
136
|
}
|
|
142
137
|
} else if (newValue) {
|
|
143
138
|
option = this.getOption('id', this.getFormattedId(newValue), initState.options);
|
|
144
139
|
}
|
|
145
140
|
const outsideVal = this.props.value ? this.props.value : '';
|
|
146
141
|
// value does not match an existing option
|
|
147
|
-
const date =
|
|
142
|
+
const date = _uiI18n.DateTime.parse(outsideVal, this.locale(), this.timezone());
|
|
148
143
|
let label = '';
|
|
149
144
|
if (date.isValid()) {
|
|
150
145
|
label = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
@@ -183,7 +178,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
183
178
|
} = this.props;
|
|
184
179
|
const initialValue = value || defaultValue;
|
|
185
180
|
if (typeof initialValue === 'string') {
|
|
186
|
-
const date =
|
|
181
|
+
const date = _uiI18n.DateTime.parse(initialValue, this.locale(), this.timezone());
|
|
187
182
|
// get option based on value or defaultValue, if provided
|
|
188
183
|
const option = this.getOption('value', date, options);
|
|
189
184
|
if (option) {
|
|
@@ -210,9 +205,9 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
210
205
|
let baseDate;
|
|
211
206
|
const baseValue = this.props.value || this.props.defaultValue;
|
|
212
207
|
if (baseValue) {
|
|
213
|
-
baseDate =
|
|
208
|
+
baseDate = _uiI18n.DateTime.parse(baseValue, this.locale(), this.timezone());
|
|
214
209
|
} else {
|
|
215
|
-
baseDate =
|
|
210
|
+
baseDate = _uiI18n.DateTime.now(this.locale(), this.timezone());
|
|
216
211
|
}
|
|
217
212
|
return baseDate.set({
|
|
218
213
|
second: 0,
|
|
@@ -341,7 +336,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
341
336
|
} = this.state;
|
|
342
337
|
let defaultValue = '';
|
|
343
338
|
if (this.props.defaultValue) {
|
|
344
|
-
const date =
|
|
339
|
+
const date = _uiI18n.DateTime.parse(this.props.defaultValue, this.locale(), this.timezone());
|
|
345
340
|
defaultValue = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
346
341
|
}
|
|
347
342
|
const selectedOption = this.getOption('id', selectedOptionId);
|
|
@@ -355,7 +350,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
355
350
|
newInputValue = selectedOption.label;
|
|
356
351
|
} else if (this.props.value) {
|
|
357
352
|
// If controlled and input is cleared and blurred after the first render, it should revert to value
|
|
358
|
-
const date =
|
|
353
|
+
const date = _uiI18n.DateTime.parse(this.props.value, this.locale(), this.timezone());
|
|
359
354
|
newInputValue = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
360
355
|
}
|
|
361
356
|
this.setState(() => ({
|
|
@@ -462,11 +457,11 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
462
457
|
id: this._emptyOptionId,
|
|
463
458
|
isHighlighted: false,
|
|
464
459
|
isSelected: false,
|
|
465
|
-
children: (0,
|
|
460
|
+
children: (0, _uiReactUtils.callRenderProp)(this.props.renderEmptyOption)
|
|
466
461
|
});
|
|
467
462
|
}
|
|
468
463
|
parseInputText = inputValue => {
|
|
469
|
-
const input =
|
|
464
|
+
const input = _uiI18n.DateTime.parse(inputValue, this.locale(), this.timezone(), [this.props.format], true);
|
|
470
465
|
const baseDate = this.getBaseDate();
|
|
471
466
|
input.year(baseDate.year());
|
|
472
467
|
input.month(baseDate.month());
|
|
@@ -535,7 +530,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
535
530
|
onRequestSelectOption: this.handleSelectOption,
|
|
536
531
|
onInputChange: this.handleInputChange,
|
|
537
532
|
onKeyDown: this.onKeyDown,
|
|
538
|
-
...(0,
|
|
533
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
539
534
|
"data-cid": "TimeSelect",
|
|
540
535
|
children: isShowingOptions && this.renderOptions()
|
|
541
536
|
});
|
|
@@ -6,13 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.TimeSelect = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
12
|
-
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
13
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
14
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
15
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
9
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
16
11
|
var _latest = require("@instructure/ui-select/latest");
|
|
17
12
|
var utils = _interopRequireWildcard(require("@instructure/ui-utils"));
|
|
18
13
|
var _props = require("./props.js");
|
|
@@ -48,7 +43,7 @@ category: components
|
|
|
48
43
|
|
|
49
44
|
A component used to select a time value.
|
|
50
45
|
**/
|
|
51
|
-
let TimeSelect = exports.TimeSelect = (_dec = (0,
|
|
46
|
+
let TimeSelect = exports.TimeSelect = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec(_class = class TimeSelect extends _react.Component {
|
|
52
47
|
static displayName = 'TimeSelect';
|
|
53
48
|
static componentId = 'TimeSelect';
|
|
54
49
|
static allowedProps = _props.allowedProps;
|
|
@@ -66,7 +61,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
66
61
|
allowNonStepInput: false,
|
|
67
62
|
allowClearingSelection: false
|
|
68
63
|
};
|
|
69
|
-
static contextType =
|
|
64
|
+
static contextType = _uiI18n.ApplyLocaleContext;
|
|
70
65
|
ref = null;
|
|
71
66
|
_emptyOptionId = this.props.deterministicId('Select-EmptyOption');
|
|
72
67
|
constructor(props) {
|
|
@@ -88,7 +83,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
88
83
|
return typeof this.props.value !== 'undefined';
|
|
89
84
|
}
|
|
90
85
|
get interaction() {
|
|
91
|
-
return (0,
|
|
86
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
92
87
|
props: this.props
|
|
93
88
|
});
|
|
94
89
|
}
|
|
@@ -104,7 +99,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
104
99
|
} else if (this.context && this.context.locale) {
|
|
105
100
|
return this.context.locale;
|
|
106
101
|
}
|
|
107
|
-
return
|
|
102
|
+
return _uiI18n.Locale.browserLocale();
|
|
108
103
|
}
|
|
109
104
|
timezone() {
|
|
110
105
|
if (this.props.timezone) {
|
|
@@ -112,7 +107,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
112
107
|
} else if (this.context && this.context.timezone) {
|
|
113
108
|
return this.context.timezone;
|
|
114
109
|
}
|
|
115
|
-
return
|
|
110
|
+
return _uiI18n.DateTime.browserTimeZone();
|
|
116
111
|
}
|
|
117
112
|
componentDidUpdate(prevProps) {
|
|
118
113
|
if (this.props.step !== prevProps.step || this.props.format !== prevProps.format || this.props.locale !== prevProps.locale || this.props.timezone !== prevProps.timezone || this.props.allowNonStepInput !== prevProps.allowNonStepInput) {
|
|
@@ -124,7 +119,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
124
119
|
if (this.props.value !== prevProps.value) {
|
|
125
120
|
let newValue;
|
|
126
121
|
if (this.props.value) {
|
|
127
|
-
newValue =
|
|
122
|
+
newValue = _uiI18n.DateTime.parse(this.props.value, this.locale(), this.timezone());
|
|
128
123
|
}
|
|
129
124
|
// value changed
|
|
130
125
|
const initState = this.getInitialState();
|
|
@@ -134,14 +129,14 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
134
129
|
if (!this.isControlled) {
|
|
135
130
|
// preserve current value when changing from controlled to uncontrolled
|
|
136
131
|
if (prevProps.value) {
|
|
137
|
-
option = this.getOption('id', this.getFormattedId(
|
|
132
|
+
option = this.getOption('id', this.getFormattedId(_uiI18n.DateTime.parse(prevProps.value, this.locale(), this.timezone())));
|
|
138
133
|
}
|
|
139
134
|
} else if (newValue) {
|
|
140
135
|
option = this.getOption('id', this.getFormattedId(newValue), initState.options);
|
|
141
136
|
}
|
|
142
137
|
const outsideVal = this.props.value ? this.props.value : '';
|
|
143
138
|
// value does not match an existing option
|
|
144
|
-
const date =
|
|
139
|
+
const date = _uiI18n.DateTime.parse(outsideVal, this.locale(), this.timezone());
|
|
145
140
|
let label = '';
|
|
146
141
|
if (date.isValid()) {
|
|
147
142
|
label = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
@@ -180,7 +175,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
180
175
|
} = this.props;
|
|
181
176
|
const initialValue = value || defaultValue;
|
|
182
177
|
if (typeof initialValue === 'string') {
|
|
183
|
-
const date =
|
|
178
|
+
const date = _uiI18n.DateTime.parse(initialValue, this.locale(), this.timezone());
|
|
184
179
|
// get option based on value or defaultValue, if provided
|
|
185
180
|
const option = this.getOption('value', date, options);
|
|
186
181
|
if (option) {
|
|
@@ -207,9 +202,9 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
207
202
|
let baseDate;
|
|
208
203
|
const baseValue = this.props.value || this.props.defaultValue;
|
|
209
204
|
if (baseValue) {
|
|
210
|
-
baseDate =
|
|
205
|
+
baseDate = _uiI18n.DateTime.parse(baseValue, this.locale(), this.timezone());
|
|
211
206
|
} else {
|
|
212
|
-
baseDate =
|
|
207
|
+
baseDate = _uiI18n.DateTime.now(this.locale(), this.timezone());
|
|
213
208
|
}
|
|
214
209
|
return baseDate.set({
|
|
215
210
|
second: 0,
|
|
@@ -338,7 +333,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
338
333
|
} = this.state;
|
|
339
334
|
let defaultValue = '';
|
|
340
335
|
if (this.props.defaultValue) {
|
|
341
|
-
const date =
|
|
336
|
+
const date = _uiI18n.DateTime.parse(this.props.defaultValue, this.locale(), this.timezone());
|
|
342
337
|
defaultValue = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
343
338
|
}
|
|
344
339
|
const selectedOption = this.getOption('id', selectedOptionId);
|
|
@@ -352,7 +347,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
352
347
|
newInputValue = selectedOption.label;
|
|
353
348
|
} else if (this.props.value) {
|
|
354
349
|
// If controlled and input is cleared and blurred after the first render, it should revert to value
|
|
355
|
-
const date =
|
|
350
|
+
const date = _uiI18n.DateTime.parse(this.props.value, this.locale(), this.timezone());
|
|
356
351
|
newInputValue = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
357
352
|
}
|
|
358
353
|
this.setState(() => ({
|
|
@@ -459,11 +454,11 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
459
454
|
id: this._emptyOptionId,
|
|
460
455
|
isHighlighted: false,
|
|
461
456
|
isSelected: false,
|
|
462
|
-
children: (0,
|
|
457
|
+
children: (0, _uiReactUtils.callRenderProp)(this.props.renderEmptyOption)
|
|
463
458
|
});
|
|
464
459
|
}
|
|
465
460
|
parseInputText = inputValue => {
|
|
466
|
-
const input =
|
|
461
|
+
const input = _uiI18n.DateTime.parse(inputValue, this.locale(), this.timezone(), [this.props.format], true);
|
|
467
462
|
const baseDate = this.getBaseDate();
|
|
468
463
|
input.year(baseDate.year());
|
|
469
464
|
input.month(baseDate.month());
|
|
@@ -532,7 +527,7 @@ let TimeSelect = exports.TimeSelect = (_dec = (0, _withDeterministicId.withDeter
|
|
|
532
527
|
onRequestSelectOption: this.handleSelectOption,
|
|
533
528
|
onInputChange: this.handleInputChange,
|
|
534
529
|
onKeyDown: this.onKeyDown,
|
|
535
|
-
...(0,
|
|
530
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
536
531
|
"data-cid": "TimeSelect",
|
|
537
532
|
children: isShowingOptions && this.renderOptions()
|
|
538
533
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-time-select",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
4
4
|
"description": "A component for selecting time values.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/
|
|
19
|
-
"@instructure/ui-
|
|
20
|
-
"@instructure/ui-
|
|
21
|
-
"@instructure/ui-react-utils": "11.7.
|
|
22
|
-
"@instructure/
|
|
23
|
-
"@instructure/ui-select": "11.7.
|
|
24
|
-
"@instructure/ui-utils": "11.7.
|
|
18
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/ui-form-field": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/ui-i18n": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-position": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-select": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"moment-timezone": "^0.6.2",
|
|
28
28
|
"vitest": "^5.0.0",
|
|
29
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
29
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=18 <=19"
|