@instructure/ui-time-select 8.14.1-snapshot.21 → 8.14.1-snapshot.31
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/es/TimeSelect/TimeSelectLocator.js +3 -1
- package/es/TimeSelect/index.js +20 -23
- package/es/TimeSelect/props.js +0 -155
- package/lib/TimeSelect/TimeSelectLocator.js +2 -0
- package/lib/TimeSelect/index.js +20 -23
- package/lib/TimeSelect/props.js +0 -155
- package/package.json +14 -14
- package/src/TimeSelect/index.tsx +42 -69
- package/src/TimeSelect/props.ts +87 -76
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TimeSelect/index.d.ts +49 -78
- package/types/TimeSelect/index.d.ts.map +1 -1
- package/types/TimeSelect/props.d.ts +151 -16
- package/types/TimeSelect/props.d.ts.map +1 -1
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
/* eslint-disable no-restricted-imports */
|
|
26
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
26
27
|
|
|
27
28
|
import { SelectLocator } from '@instructure/ui-select/es/Select/SelectLocator';
|
|
28
29
|
/* eslint-enable no-restricted-imports */
|
|
29
30
|
|
|
30
|
-
import { TimeSelect } from './index';
|
|
31
|
+
import { TimeSelect } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
32
|
+
|
|
31
33
|
export const TimeSelectLocator = locator(TimeSelect.selector, {
|
|
32
34
|
findInput: SelectLocator.findInput,
|
|
33
35
|
// TODO these dont work because TS doesnt find its type declarations
|
package/es/TimeSelect/index.js
CHANGED
|
@@ -38,13 +38,24 @@ import { allowedProps, propTypes } from './props';
|
|
|
38
38
|
---
|
|
39
39
|
category: components
|
|
40
40
|
---
|
|
41
|
+
@tsProps
|
|
42
|
+
|
|
43
|
+
A component used to select a time value.
|
|
41
44
|
**/
|
|
42
45
|
let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class TimeSelect extends Component {
|
|
43
46
|
constructor(props) {
|
|
47
|
+
var _this;
|
|
48
|
+
|
|
44
49
|
super(props);
|
|
50
|
+
_this = this;
|
|
45
51
|
this.ref = null;
|
|
46
52
|
this._emptyOptionId = uid('Select-EmptyOption');
|
|
47
53
|
|
|
54
|
+
this.getOption = function (field, value) {
|
|
55
|
+
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _this.state.options;
|
|
56
|
+
return options.find(option => option[field] === value);
|
|
57
|
+
};
|
|
58
|
+
|
|
48
59
|
this.handleRef = node => {
|
|
49
60
|
this.ref = node;
|
|
50
61
|
};
|
|
@@ -61,12 +72,12 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
61
72
|
this.handleInputChange = event => {
|
|
62
73
|
const value = event.target.value;
|
|
63
74
|
const newOptions = this.filterOptions(value);
|
|
64
|
-
this.setState(
|
|
75
|
+
this.setState({
|
|
65
76
|
inputValue: value,
|
|
66
77
|
filteredOptions: newOptions,
|
|
67
78
|
highlightedOptionId: newOptions.length > 0 ? newOptions[0].id : void 0,
|
|
68
79
|
isShowingOptions: true
|
|
69
|
-
})
|
|
80
|
+
});
|
|
70
81
|
|
|
71
82
|
if (!this.state.isShowingOptions) {
|
|
72
83
|
var _this$props$onShowOpt, _this$props2;
|
|
@@ -97,7 +108,7 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
97
108
|
prevValue = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
98
109
|
}
|
|
99
110
|
|
|
100
|
-
this.setState(
|
|
111
|
+
this.setState(() => ({
|
|
101
112
|
isShowingOptions: false,
|
|
102
113
|
highlightedOptionId: void 0,
|
|
103
114
|
inputValue: selectedOptionId ? option.label : prevValue,
|
|
@@ -173,7 +184,9 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
173
184
|
}
|
|
174
185
|
|
|
175
186
|
focus() {
|
|
176
|
-
|
|
187
|
+
var _this$ref;
|
|
188
|
+
|
|
189
|
+
(_this$ref = this.ref) === null || _this$ref === void 0 ? void 0 : _this$ref.focus();
|
|
177
190
|
}
|
|
178
191
|
|
|
179
192
|
get _select() {
|
|
@@ -277,7 +290,7 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
277
290
|
return {
|
|
278
291
|
label: format ? date.format(format) : date.toISOString()
|
|
279
292
|
};
|
|
280
|
-
} // otherwise return first option, if desired
|
|
293
|
+
} // otherwise, return first option, if desired
|
|
281
294
|
|
|
282
295
|
|
|
283
296
|
if (defaultToFirstOption) {
|
|
@@ -287,16 +300,10 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
287
300
|
return void 0;
|
|
288
301
|
}
|
|
289
302
|
|
|
290
|
-
getOption(field, value) {
|
|
291
|
-
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.state.options;
|
|
292
|
-
return options.find(option => option[field] === value);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
303
|
getFormattedId(date) {
|
|
296
304
|
// ISO8601 strings may contain a space. Remove any spaces before using the
|
|
297
305
|
// date as the id.
|
|
298
|
-
|
|
299
|
-
return dateStr.replace(/\s/g, '');
|
|
306
|
+
return date.toISOString().replace(/\s/g, '');
|
|
300
307
|
}
|
|
301
308
|
|
|
302
309
|
getBaseDate() {
|
|
@@ -485,7 +492,6 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
485
492
|
|
|
486
493
|
}, _class2.displayName = "TimeSelect", _class2.componentId = 'TimeSelect', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
487
494
|
defaultToFirstOption: false,
|
|
488
|
-
id: void 0,
|
|
489
495
|
format: 'LT',
|
|
490
496
|
// see https://momentjs.com/docs/#/displaying/
|
|
491
497
|
step: 30,
|
|
@@ -494,16 +500,7 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
|
|
|
494
500
|
visibleOptionsCount: 8,
|
|
495
501
|
placement: 'bottom stretch',
|
|
496
502
|
constrain: 'window',
|
|
497
|
-
|
|
498
|
-
onFocus: event => {},
|
|
499
|
-
onBlur: event => {},
|
|
500
|
-
onShowOptions: event => {},
|
|
501
|
-
onHideOptions: event => {},
|
|
502
|
-
inputRef: node => {},
|
|
503
|
-
listRef: node => {},
|
|
504
|
-
renderEmptyOption: '---',
|
|
505
|
-
renderBeforeInput: null,
|
|
506
|
-
renderAfterInput: null
|
|
503
|
+
renderEmptyOption: '---'
|
|
507
504
|
}, _class2.contextType = ApplyLocaleContext, _temp)) || _class);
|
|
508
505
|
export { TimeSelect };
|
|
509
506
|
export default TimeSelect;
|
package/es/TimeSelect/props.js
CHANGED
|
@@ -27,190 +27,35 @@ import { I18nPropTypes } from '@instructure/ui-i18n';
|
|
|
27
27
|
import { FormPropTypes } from '@instructure/ui-form-field';
|
|
28
28
|
import { PositionPropTypes } from '@instructure/ui-position';
|
|
29
29
|
const propTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* The form field label.
|
|
32
|
-
*/
|
|
33
30
|
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Whether to default to the first option when `defaultValue` hasn't been specified.
|
|
37
|
-
*/
|
|
38
31
|
defaultToFirstOption: PropTypes.bool,
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* An ISO 8601 formatted date string representing the current selected value. If defined,
|
|
42
|
-
* the component will act controlled and will not manage its own state.
|
|
43
|
-
*/
|
|
44
32
|
value: controllable(I18nPropTypes.iso8601, 'onChange'),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* An ISO 8601 formatted date string to use if `value` isn't provided.
|
|
48
|
-
*/
|
|
49
33
|
defaultValue: I18nPropTypes.iso8601,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The id of the text input. One is generated if not supplied.
|
|
53
|
-
*/
|
|
54
34
|
id: PropTypes.string,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The format to use when displaying the possible and currently selected options.
|
|
58
|
-
*
|
|
59
|
-
* See [moment](https://momentjs.com/docs/#/displaying/format/) for the list
|
|
60
|
-
* of available formats.
|
|
61
|
-
*/
|
|
62
35
|
format: PropTypes.string,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The number of minutes to increment by when generating the allowable options.
|
|
66
|
-
*/
|
|
67
36
|
step: PropTypes.oneOf([5, 10, 15, 20, 30, 60]),
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
71
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
72
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
73
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
74
|
-
*/
|
|
75
37
|
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Html placeholder text to display when the input has no value. This should
|
|
79
|
-
* be hint text, not a label replacement.
|
|
80
|
-
*/
|
|
81
38
|
placeholder: PropTypes.string,
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Whether or not the text input is required.
|
|
85
|
-
*/
|
|
86
39
|
isRequired: PropTypes.bool,
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Whether the input is rendered inline with other elements or if it
|
|
90
|
-
* is rendered as a block level element.
|
|
91
|
-
*/
|
|
92
40
|
isInline: PropTypes.bool,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The width of the text input.
|
|
96
|
-
*/
|
|
97
41
|
width: PropTypes.string,
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* The max width the options list can be before option text wraps. If not
|
|
101
|
-
* set, the list will only display as wide as the text input.
|
|
102
|
-
*/
|
|
103
42
|
optionsMaxWidth: PropTypes.string,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The number of options that should be visible before having to scroll.
|
|
107
|
-
*/
|
|
108
43
|
visibleOptionsCount: PropTypes.number,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Displays messages and validation for the input. It should be an object
|
|
112
|
-
* with the following shape:
|
|
113
|
-
* `{
|
|
114
|
-
* text: PropTypes.node,
|
|
115
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
116
|
-
* }`
|
|
117
|
-
*/
|
|
118
44
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The placement of the options list.
|
|
122
|
-
*/
|
|
123
45
|
placement: PositionPropTypes.placement,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* The parent in which to constrain the placement.
|
|
127
|
-
*/
|
|
128
46
|
constrain: PositionPropTypes.constrain,
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Callback fired when a new option is selected.
|
|
132
|
-
* @param {Object} event - the event object
|
|
133
|
-
* @param {Object} data - additional data
|
|
134
|
-
* @param data.value - the value of selected option
|
|
135
|
-
*/
|
|
136
47
|
onChange: PropTypes.func,
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Callback fired when text input receives focus.
|
|
140
|
-
*/
|
|
141
48
|
onFocus: PropTypes.func,
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Callback fired when text input loses focus.
|
|
145
|
-
*/
|
|
146
49
|
onBlur: PropTypes.func,
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Callback fired when the options list is shown.
|
|
150
|
-
*/
|
|
151
50
|
onShowOptions: PropTypes.func,
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Callback fired when the options list is hidden.
|
|
155
|
-
*/
|
|
156
51
|
onHideOptions: PropTypes.func,
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* A ref to the html `input` element.
|
|
160
|
-
*/
|
|
161
52
|
inputRef: PropTypes.func,
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* A ref to the html `ul` element.
|
|
165
|
-
*/
|
|
166
53
|
listRef: PropTypes.func,
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Content to display in the list when no options are available.
|
|
170
|
-
*/
|
|
171
54
|
renderEmptyOption: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Content to display before the text input. This will commonly be an icon.
|
|
175
|
-
*/
|
|
176
55
|
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Content to display after the text input. This content will replace the
|
|
180
|
-
* default arrow icons.
|
|
181
|
-
*/
|
|
182
56
|
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
183
|
-
|
|
184
|
-
/* eslint-disable react/require-default-props */
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* A standard language identifier.
|
|
188
|
-
*
|
|
189
|
-
* See [moment.js i18n](https://momentjs.com/docs/#/i18n/) for more details.
|
|
190
|
-
*
|
|
191
|
-
* This property can also be set via a context property and if both are set then the component property takes
|
|
192
|
-
* precedence over the context property.
|
|
193
|
-
*
|
|
194
|
-
* The web browser's locale will be used if no value is set via a component property or a context
|
|
195
|
-
* property.
|
|
196
|
-
*/
|
|
197
57
|
locale: PropTypes.string,
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* A timezone identifier in the format: Area/Location
|
|
201
|
-
*
|
|
202
|
-
* See [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the list
|
|
203
|
-
* of possible options.
|
|
204
|
-
*
|
|
205
|
-
* This property can also be set via a context property and if both are set then the component property takes
|
|
206
|
-
* precedence over the context property.
|
|
207
|
-
*
|
|
208
|
-
* The web browser's timezone will be used if no value is set via a component property or a context
|
|
209
|
-
* property.
|
|
210
|
-
*/
|
|
211
58
|
timezone: PropTypes.string
|
|
212
|
-
/* eslint-enable react/require-default-props */
|
|
213
|
-
|
|
214
59
|
};
|
|
215
60
|
const allowedProps = ['renderLabel', 'defaultToFirstOption', 'value', 'defaultValue', 'id', 'format', 'step', 'interaction', 'placeholder', 'isRequired', 'isInline', 'width', 'optionsMaxWidth', 'visibleOptionsCount', 'messages', 'placement', 'constrain', 'onChange', 'onFocus', 'onBlur', 'onShowOptions', 'onHideOptions', 'inputRef', 'listRef', 'renderEmptyOption', 'renderBeforeInput', 'renderAfterInput', 'locale', 'timezone'];
|
|
216
61
|
export { propTypes, allowedProps };
|
|
@@ -36,8 +36,10 @@ var _index = require("./index");
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
/* eslint-disable no-restricted-imports */
|
|
39
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
39
40
|
|
|
40
41
|
/* eslint-enable no-restricted-imports */
|
|
42
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
41
43
|
const TimeSelectLocator = (0, _locator.locator)(_index.TimeSelect.selector, {
|
|
42
44
|
findInput: _SelectLocator.SelectLocator.findInput,
|
|
43
45
|
// TODO these dont work because TS doesnt find its type declarations
|
package/lib/TimeSelect/index.js
CHANGED
|
@@ -41,13 +41,24 @@ var _dec, _class, _class2, _temp;
|
|
|
41
41
|
---
|
|
42
42
|
category: components
|
|
43
43
|
---
|
|
44
|
+
@tsProps
|
|
45
|
+
|
|
46
|
+
A component used to select a time value.
|
|
44
47
|
**/
|
|
45
48
|
let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _class2 = class TimeSelect extends _react.Component {
|
|
46
49
|
constructor(props) {
|
|
50
|
+
var _this;
|
|
51
|
+
|
|
47
52
|
super(props);
|
|
53
|
+
_this = this;
|
|
48
54
|
this.ref = null;
|
|
49
55
|
this._emptyOptionId = (0, _uid.uid)('Select-EmptyOption');
|
|
50
56
|
|
|
57
|
+
this.getOption = function (field, value) {
|
|
58
|
+
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _this.state.options;
|
|
59
|
+
return options.find(option => option[field] === value);
|
|
60
|
+
};
|
|
61
|
+
|
|
51
62
|
this.handleRef = node => {
|
|
52
63
|
this.ref = node;
|
|
53
64
|
};
|
|
@@ -64,12 +75,12 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
64
75
|
this.handleInputChange = event => {
|
|
65
76
|
const value = event.target.value;
|
|
66
77
|
const newOptions = this.filterOptions(value);
|
|
67
|
-
this.setState(
|
|
78
|
+
this.setState({
|
|
68
79
|
inputValue: value,
|
|
69
80
|
filteredOptions: newOptions,
|
|
70
81
|
highlightedOptionId: newOptions.length > 0 ? newOptions[0].id : void 0,
|
|
71
82
|
isShowingOptions: true
|
|
72
|
-
})
|
|
83
|
+
});
|
|
73
84
|
|
|
74
85
|
if (!this.state.isShowingOptions) {
|
|
75
86
|
var _this$props$onShowOpt, _this$props2;
|
|
@@ -101,7 +112,7 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
101
112
|
prevValue = this.props.format ? date.format(this.props.format) : date.toISOString();
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
this.setState(
|
|
115
|
+
this.setState(() => ({
|
|
105
116
|
isShowingOptions: false,
|
|
106
117
|
highlightedOptionId: void 0,
|
|
107
118
|
inputValue: selectedOptionId ? option.label : prevValue,
|
|
@@ -177,7 +188,9 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
177
188
|
}
|
|
178
189
|
|
|
179
190
|
focus() {
|
|
180
|
-
|
|
191
|
+
var _this$ref;
|
|
192
|
+
|
|
193
|
+
(_this$ref = this.ref) === null || _this$ref === void 0 ? void 0 : _this$ref.focus();
|
|
181
194
|
}
|
|
182
195
|
|
|
183
196
|
get _select() {
|
|
@@ -282,7 +295,7 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
282
295
|
return {
|
|
283
296
|
label: format ? date.format(format) : date.toISOString()
|
|
284
297
|
};
|
|
285
|
-
} // otherwise return first option, if desired
|
|
298
|
+
} // otherwise, return first option, if desired
|
|
286
299
|
|
|
287
300
|
|
|
288
301
|
if (defaultToFirstOption) {
|
|
@@ -292,16 +305,10 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
292
305
|
return void 0;
|
|
293
306
|
}
|
|
294
307
|
|
|
295
|
-
getOption(field, value) {
|
|
296
|
-
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.state.options;
|
|
297
|
-
return options.find(option => option[field] === value);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
308
|
getFormattedId(date) {
|
|
301
309
|
// ISO8601 strings may contain a space. Remove any spaces before using the
|
|
302
310
|
// date as the id.
|
|
303
|
-
|
|
304
|
-
return dateStr.replace(/\s/g, '');
|
|
311
|
+
return date.toISOString().replace(/\s/g, '');
|
|
305
312
|
}
|
|
306
313
|
|
|
307
314
|
getBaseDate() {
|
|
@@ -489,7 +496,6 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
489
496
|
|
|
490
497
|
}, _class2.displayName = "TimeSelect", _class2.componentId = 'TimeSelect', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
491
498
|
defaultToFirstOption: false,
|
|
492
|
-
id: void 0,
|
|
493
499
|
format: 'LT',
|
|
494
500
|
// see https://momentjs.com/docs/#/displaying/
|
|
495
501
|
step: 30,
|
|
@@ -498,16 +504,7 @@ let TimeSelect = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _clas
|
|
|
498
504
|
visibleOptionsCount: 8,
|
|
499
505
|
placement: 'bottom stretch',
|
|
500
506
|
constrain: 'window',
|
|
501
|
-
|
|
502
|
-
onFocus: event => {},
|
|
503
|
-
onBlur: event => {},
|
|
504
|
-
onShowOptions: event => {},
|
|
505
|
-
onHideOptions: event => {},
|
|
506
|
-
inputRef: node => {},
|
|
507
|
-
listRef: node => {},
|
|
508
|
-
renderEmptyOption: '---',
|
|
509
|
-
renderBeforeInput: null,
|
|
510
|
-
renderAfterInput: null
|
|
507
|
+
renderEmptyOption: '---'
|
|
511
508
|
}, _class2.contextType = _ApplyLocaleContext.ApplyLocaleContext, _temp)) || _class);
|
|
512
509
|
exports.TimeSelect = TimeSelect;
|
|
513
510
|
var _default = TimeSelect;
|
package/lib/TimeSelect/props.js
CHANGED
|
@@ -41,190 +41,35 @@ var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes
|
|
|
41
41
|
* SOFTWARE.
|
|
42
42
|
*/
|
|
43
43
|
const propTypes = {
|
|
44
|
-
/**
|
|
45
|
-
* The form field label.
|
|
46
|
-
*/
|
|
47
44
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Whether to default to the first option when `defaultValue` hasn't been specified.
|
|
51
|
-
*/
|
|
52
45
|
defaultToFirstOption: _propTypes.default.bool,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* An ISO 8601 formatted date string representing the current selected value. If defined,
|
|
56
|
-
* the component will act controlled and will not manage its own state.
|
|
57
|
-
*/
|
|
58
46
|
value: (0, _controllable.controllable)(_I18nPropTypes.I18nPropTypes.iso8601, 'onChange'),
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* An ISO 8601 formatted date string to use if `value` isn't provided.
|
|
62
|
-
*/
|
|
63
47
|
defaultValue: _I18nPropTypes.I18nPropTypes.iso8601,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The id of the text input. One is generated if not supplied.
|
|
67
|
-
*/
|
|
68
48
|
id: _propTypes.default.string,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The format to use when displaying the possible and currently selected options.
|
|
72
|
-
*
|
|
73
|
-
* See [moment](https://momentjs.com/docs/#/displaying/format/) for the list
|
|
74
|
-
* of available formats.
|
|
75
|
-
*/
|
|
76
49
|
format: _propTypes.default.string,
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* The number of minutes to increment by when generating the allowable options.
|
|
80
|
-
*/
|
|
81
50
|
step: _propTypes.default.oneOf([5, 10, 15, 20, 30, 60]),
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
85
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
86
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
87
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
88
|
-
*/
|
|
89
51
|
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Html placeholder text to display when the input has no value. This should
|
|
93
|
-
* be hint text, not a label replacement.
|
|
94
|
-
*/
|
|
95
52
|
placeholder: _propTypes.default.string,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Whether or not the text input is required.
|
|
99
|
-
*/
|
|
100
53
|
isRequired: _propTypes.default.bool,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Whether the input is rendered inline with other elements or if it
|
|
104
|
-
* is rendered as a block level element.
|
|
105
|
-
*/
|
|
106
54
|
isInline: _propTypes.default.bool,
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* The width of the text input.
|
|
110
|
-
*/
|
|
111
55
|
width: _propTypes.default.string,
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* The max width the options list can be before option text wraps. If not
|
|
115
|
-
* set, the list will only display as wide as the text input.
|
|
116
|
-
*/
|
|
117
56
|
optionsMaxWidth: _propTypes.default.string,
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* The number of options that should be visible before having to scroll.
|
|
121
|
-
*/
|
|
122
57
|
visibleOptionsCount: _propTypes.default.number,
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Displays messages and validation for the input. It should be an object
|
|
126
|
-
* with the following shape:
|
|
127
|
-
* `{
|
|
128
|
-
* text: PropTypes.node,
|
|
129
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
130
|
-
* }`
|
|
131
|
-
*/
|
|
132
58
|
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* The placement of the options list.
|
|
136
|
-
*/
|
|
137
59
|
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* The parent in which to constrain the placement.
|
|
141
|
-
*/
|
|
142
60
|
constrain: _PositionPropTypes.PositionPropTypes.constrain,
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Callback fired when a new option is selected.
|
|
146
|
-
* @param {Object} event - the event object
|
|
147
|
-
* @param {Object} data - additional data
|
|
148
|
-
* @param data.value - the value of selected option
|
|
149
|
-
*/
|
|
150
61
|
onChange: _propTypes.default.func,
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Callback fired when text input receives focus.
|
|
154
|
-
*/
|
|
155
62
|
onFocus: _propTypes.default.func,
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Callback fired when text input loses focus.
|
|
159
|
-
*/
|
|
160
63
|
onBlur: _propTypes.default.func,
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Callback fired when the options list is shown.
|
|
164
|
-
*/
|
|
165
64
|
onShowOptions: _propTypes.default.func,
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Callback fired when the options list is hidden.
|
|
169
|
-
*/
|
|
170
65
|
onHideOptions: _propTypes.default.func,
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* A ref to the html `input` element.
|
|
174
|
-
*/
|
|
175
66
|
inputRef: _propTypes.default.func,
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* A ref to the html `ul` element.
|
|
179
|
-
*/
|
|
180
67
|
listRef: _propTypes.default.func,
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Content to display in the list when no options are available.
|
|
184
|
-
*/
|
|
185
68
|
renderEmptyOption: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Content to display before the text input. This will commonly be an icon.
|
|
189
|
-
*/
|
|
190
69
|
renderBeforeInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Content to display after the text input. This content will replace the
|
|
194
|
-
* default arrow icons.
|
|
195
|
-
*/
|
|
196
70
|
renderAfterInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
197
|
-
|
|
198
|
-
/* eslint-disable react/require-default-props */
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* A standard language identifier.
|
|
202
|
-
*
|
|
203
|
-
* See [moment.js i18n](https://momentjs.com/docs/#/i18n/) for more details.
|
|
204
|
-
*
|
|
205
|
-
* This property can also be set via a context property and if both are set then the component property takes
|
|
206
|
-
* precedence over the context property.
|
|
207
|
-
*
|
|
208
|
-
* The web browser's locale will be used if no value is set via a component property or a context
|
|
209
|
-
* property.
|
|
210
|
-
*/
|
|
211
71
|
locale: _propTypes.default.string,
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* A timezone identifier in the format: Area/Location
|
|
215
|
-
*
|
|
216
|
-
* See [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the list
|
|
217
|
-
* of possible options.
|
|
218
|
-
*
|
|
219
|
-
* This property can also be set via a context property and if both are set then the component property takes
|
|
220
|
-
* precedence over the context property.
|
|
221
|
-
*
|
|
222
|
-
* The web browser's timezone will be used if no value is set via a component property or a context
|
|
223
|
-
* property.
|
|
224
|
-
*/
|
|
225
72
|
timezone: _propTypes.default.string
|
|
226
|
-
/* eslint-enable react/require-default-props */
|
|
227
|
-
|
|
228
73
|
};
|
|
229
74
|
exports.propTypes = propTypes;
|
|
230
75
|
const allowedProps = ['renderLabel', 'defaultToFirstOption', 'value', 'defaultValue', 'id', 'format', 'step', 'interaction', 'placeholder', 'isRequired', 'isInline', 'width', 'optionsMaxWidth', 'visibleOptionsCount', 'messages', 'placement', 'constrain', 'onChange', 'onFocus', 'onBlur', 'onShowOptions', 'onHideOptions', 'inputRef', 'listRef', 'renderEmptyOption', 'renderBeforeInput', 'renderAfterInput', 'locale', 'timezone'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-time-select",
|
|
3
|
-
"version": "8.14.1-snapshot.
|
|
3
|
+
"version": "8.14.1-snapshot.31+49a7396b9",
|
|
4
4
|
"description": "A component for selecting time values.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.14.1-snapshot.
|
|
29
|
-
"@instructure/ui-form-field": "8.14.1-snapshot.
|
|
30
|
-
"@instructure/ui-i18n": "8.14.1-snapshot.
|
|
31
|
-
"@instructure/ui-position": "8.14.1-snapshot.
|
|
32
|
-
"@instructure/ui-prop-types": "8.14.1-snapshot.
|
|
33
|
-
"@instructure/ui-react-utils": "8.14.1-snapshot.
|
|
34
|
-
"@instructure/ui-select": "8.14.1-snapshot.
|
|
35
|
-
"@instructure/ui-test-locator": "8.14.1-snapshot.
|
|
36
|
-
"@instructure/ui-testable": "8.14.1-snapshot.
|
|
37
|
-
"@instructure/uid": "8.14.1-snapshot.
|
|
28
|
+
"@instructure/console": "8.14.1-snapshot.31+49a7396b9",
|
|
29
|
+
"@instructure/ui-form-field": "8.14.1-snapshot.31+49a7396b9",
|
|
30
|
+
"@instructure/ui-i18n": "8.14.1-snapshot.31+49a7396b9",
|
|
31
|
+
"@instructure/ui-position": "8.14.1-snapshot.31+49a7396b9",
|
|
32
|
+
"@instructure/ui-prop-types": "8.14.1-snapshot.31+49a7396b9",
|
|
33
|
+
"@instructure/ui-react-utils": "8.14.1-snapshot.31+49a7396b9",
|
|
34
|
+
"@instructure/ui-select": "8.14.1-snapshot.31+49a7396b9",
|
|
35
|
+
"@instructure/ui-test-locator": "8.14.1-snapshot.31+49a7396b9",
|
|
36
|
+
"@instructure/ui-testable": "8.14.1-snapshot.31+49a7396b9",
|
|
37
|
+
"@instructure/uid": "8.14.1-snapshot.31+49a7396b9",
|
|
38
38
|
"prop-types": "^15"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@instructure/ui-babel-preset": "8.14.1-snapshot.
|
|
42
|
-
"@instructure/ui-test-utils": "8.14.1-snapshot.
|
|
41
|
+
"@instructure/ui-babel-preset": "8.14.1-snapshot.31+49a7396b9",
|
|
42
|
+
"@instructure/ui-test-utils": "8.14.1-snapshot.31+49a7396b9",
|
|
43
43
|
"moment-timezone": "^0.5.33"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false,
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "49a7396b93296ce050bbfa44efc0c31c902d5dd8"
|
|
53
53
|
}
|