@instructure/ui-time-select 8.8.1-snapshot.8 → 8.9.0

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 CHANGED
@@ -3,6 +3,10 @@
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
+ # [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-time-select
9
+
6
10
  # [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
7
11
 
8
12
  ### Features
@@ -27,8 +27,7 @@ var _dec, _class, _class2, _temp;
27
27
  * SOFTWARE.
28
28
  */
29
29
  import React, { Component } from 'react';
30
- import PropTypes from 'prop-types';
31
- import { I18nPropTypes, ApplyLocaleContext, Locale } from '@instructure/ui-i18n';
30
+ import { ApplyLocaleContext, Locale } from '@instructure/ui-i18n';
32
31
  import dayjs from 'dayjs';
33
32
  import utc from 'dayjs/plugin/utc';
34
33
  import timezone from 'dayjs/plugin/timezone';
@@ -37,19 +36,17 @@ import './locales';
37
36
  dayjs.extend(utc);
38
37
  dayjs.extend(timezone);
39
38
  dayjs.extend(localizedFormat);
40
- import { controllable } from '@instructure/ui-prop-types';
41
39
  import { getInteraction, passthroughProps, callRenderProp } from '@instructure/ui-react-utils';
42
- import { FormPropTypes } from '@instructure/ui-form-field';
43
- import { PositionPropTypes } from '@instructure/ui-position';
44
40
  import { testable } from '@instructure/ui-testable';
45
41
  import { Select } from '@instructure/ui-select';
46
42
  import { uid } from '@instructure/uid';
47
-
43
+ import { allowedProps, propTypes } from './props';
48
44
  /**
49
45
  ---
50
46
  category: components
51
47
  ---
52
48
  **/
49
+
53
50
  let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class TimeSelect extends Component {
54
51
  constructor(props) {
55
52
  super(props);
@@ -460,205 +457,13 @@ let TimeSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Time
460
457
  }, passthroughProps(rest)), isShowingOptions && this.renderOptions());
461
458
  }
462
459
 
463
- }, _class2.displayName = "TimeSelect", _class2.componentId = 'TimeSelect', _class2.propTypes = {
464
- /**
465
- * The form field label.
466
- */
467
- renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
468
-
469
- /**
470
- * Whether to default to the first option when `defaultValue` hasn't been specified.
471
- */
472
- defaultToFirstOption: PropTypes.bool,
473
-
474
- /**
475
- * An ISO 8601 formatted date string representing the current selected value. If defined,
476
- * the component will act controlled and will not manage its own state.
477
- */
478
- value: controllable(I18nPropTypes.iso8601, 'onChange'),
479
-
480
- /**
481
- * An ISO 8601 formatted date string to use if `value` isn't provided.
482
- */
483
- defaultValue: I18nPropTypes.iso8601,
484
-
485
- /**
486
- * The id of the text input. One is generated if not supplied.
487
- */
488
- id: PropTypes.string,
489
-
490
- /**
491
- * The format to use when displaying the possible and currently selected options.
492
- *
493
- * See [moment.js formats](https://momentjs.com/docs/#/displaying/format/) for the list of available formats.
494
- */
495
- format: PropTypes.string,
496
-
497
- /**
498
- * The number of minutes to increment by when generating the allowable options.
499
- */
500
- step: PropTypes.oneOf([5, 10, 15, 20, 30, 60]),
501
-
502
- /**
503
- * Specifies if interaction with the input is enabled, disabled, or readonly.
504
- * When "disabled", the input changes visibly to indicate that it cannot
505
- * receive user interactions. When "readonly" the input still cannot receive
506
- * user interactions but it keeps the same styles as if it were enabled.
507
- */
508
- interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
509
-
510
- /**
511
- * Html placeholder text to display when the input has no value. This should
512
- * be hint text, not a label replacement.
513
- */
514
- placeholder: PropTypes.string,
515
-
516
- /**
517
- * Whether or not the text input is required.
518
- */
519
- isRequired: PropTypes.bool,
520
-
521
- /**
522
- * Whether the input is rendered inline with other elements or if it
523
- * is rendered as a block level element.
524
- */
525
- isInline: PropTypes.bool,
526
-
527
- /**
528
- * The width of the text input.
529
- */
530
- width: PropTypes.string,
531
-
532
- /**
533
- * The max width the options list can be before option text wraps. If not
534
- * set, the list will only display as wide as the text input.
535
- */
536
- optionsMaxWidth: PropTypes.string,
537
-
538
- /**
539
- * The number of options that should be visible before having to scroll.
540
- */
541
- visibleOptionsCount: PropTypes.number,
542
-
543
- /**
544
- * Displays messages and validation for the input. It should be an object
545
- * with the following shape:
546
- * `{
547
- * text: PropTypes.string,
548
- * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
549
- * }`
550
- */
551
- messages: PropTypes.arrayOf(FormPropTypes.message),
552
-
553
- /**
554
- * The placement of the options list.
555
- */
556
- placement: PositionPropTypes.placement,
557
-
558
- /**
559
- * The parent in which to constrain the placement.
560
- */
561
- constrain: PositionPropTypes.constrain,
562
-
563
- /**
564
- * Callback fired when a new option is selected.
565
- * @param {Object} event - the event object
566
- * @param {Object} data - additional data
567
- * @param data.value - the value of selected option
568
- */
569
- onChange: PropTypes.func,
570
-
571
- /**
572
- * Callback fired when text input receives focus.
573
- */
574
- onFocus: PropTypes.func,
575
-
576
- /**
577
- * Callback fired when text input loses focus.
578
- */
579
- onBlur: PropTypes.func,
580
-
581
- /**
582
- * Callback fired when the options list is shown.
583
- */
584
- onShowOptions: PropTypes.func,
585
-
586
- /**
587
- * Callback fired when the options list is hidden.
588
- */
589
- onHideOptions: PropTypes.func,
590
-
591
- /**
592
- * A ref to the html `input` element.
593
- */
594
- inputRef: PropTypes.func,
595
-
596
- /**
597
- * A ref to the html `ul` element.
598
- */
599
- listRef: PropTypes.func,
600
-
601
- /**
602
- * Content to display in the list when no options are available.
603
- */
604
- renderEmptyOption: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
605
-
606
- /**
607
- * Content to display before the text input. This will commonly be an icon.
608
- */
609
- renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
610
-
611
- /**
612
- * Content to display after the text input. This content will replace the
613
- * default arrow icons.
614
- */
615
- renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
616
-
617
- /* eslint-disable react/require-default-props */
618
-
619
- /**
620
- * A standard language identifier.
621
- *
622
- * See [moment.js i18n](https://momentjs.com/docs/#/i18n/) for more details.
623
- *
624
- * This property can also be set via a context property and if both are set then the component property takes
625
- * precedence over the context property.
626
- *
627
- * The web browser's locale will be used if no value is set via a component property or a context
628
- * property.
629
- */
630
- locale: PropTypes.string,
631
-
632
- /**
633
- * A timezone identifier in the format: Area/Location
634
- *
635
- * See [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the list
636
- * of possible options.
637
- *
638
- * This property can also be set via a context property and if both are set then the component property takes
639
- * precedence over the context property.
640
- *
641
- * The web browser's timezone will be used if no value is set via a component property or a context
642
- * property.
643
- */
644
- timezone: PropTypes.string
645
- /* eslint-enable react/require-default-props */
646
-
647
- }, _class2.defaultProps = {
648
- value: void 0,
649
- defaultValue: void 0,
460
+ }, _class2.displayName = "TimeSelect", _class2.componentId = 'TimeSelect', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
650
461
  defaultToFirstOption: false,
651
- id: void 0,
652
462
  format: 'LT',
653
463
  step: 30,
654
- interaction: void 0,
655
- placeholder: void 0,
656
464
  isRequired: false,
657
465
  isInline: false,
658
- width: void 0,
659
- optionsMaxWidth: void 0,
660
466
  visibleOptionsCount: 8,
661
- messages: void 0,
662
467
  placement: 'bottom stretch',
663
468
  constrain: 'window',
664
469
  onChange: (event, data) => {},
@@ -0,0 +1,215 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types';
25
+ import { controllable } from '@instructure/ui-prop-types';
26
+ import { I18nPropTypes } from '@instructure/ui-i18n';
27
+ import { FormPropTypes } from '@instructure/ui-form-field';
28
+ import { PositionPropTypes } from '@instructure/ui-position';
29
+ const propTypes = {
30
+ /**
31
+ * The form field label.
32
+ */
33
+ 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
+ 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
+ value: controllable(I18nPropTypes.iso8601, 'onChange'),
45
+
46
+ /**
47
+ * An ISO 8601 formatted date string to use if `value` isn't provided.
48
+ */
49
+ defaultValue: I18nPropTypes.iso8601,
50
+
51
+ /**
52
+ * The id of the text input. One is generated if not supplied.
53
+ */
54
+ id: PropTypes.string,
55
+
56
+ /**
57
+ * The format to use when displaying the possible and currently selected options.
58
+ *
59
+ * See [moment.js formats](https://momentjs.com/docs/#/displaying/format/) for the list of available formats.
60
+ */
61
+ format: PropTypes.string,
62
+
63
+ /**
64
+ * The number of minutes to increment by when generating the allowable options.
65
+ */
66
+ step: PropTypes.oneOf([5, 10, 15, 20, 30, 60]),
67
+
68
+ /**
69
+ * Specifies if interaction with the input is enabled, disabled, or readonly.
70
+ * When "disabled", the input changes visibly to indicate that it cannot
71
+ * receive user interactions. When "readonly" the input still cannot receive
72
+ * user interactions but it keeps the same styles as if it were enabled.
73
+ */
74
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
75
+
76
+ /**
77
+ * Html placeholder text to display when the input has no value. This should
78
+ * be hint text, not a label replacement.
79
+ */
80
+ placeholder: PropTypes.string,
81
+
82
+ /**
83
+ * Whether or not the text input is required.
84
+ */
85
+ isRequired: PropTypes.bool,
86
+
87
+ /**
88
+ * Whether the input is rendered inline with other elements or if it
89
+ * is rendered as a block level element.
90
+ */
91
+ isInline: PropTypes.bool,
92
+
93
+ /**
94
+ * The width of the text input.
95
+ */
96
+ width: PropTypes.string,
97
+
98
+ /**
99
+ * The max width the options list can be before option text wraps. If not
100
+ * set, the list will only display as wide as the text input.
101
+ */
102
+ optionsMaxWidth: PropTypes.string,
103
+
104
+ /**
105
+ * The number of options that should be visible before having to scroll.
106
+ */
107
+ visibleOptionsCount: PropTypes.number,
108
+
109
+ /**
110
+ * Displays messages and validation for the input. It should be an object
111
+ * with the following shape:
112
+ * `{
113
+ * text: PropTypes.string,
114
+ * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
115
+ * }`
116
+ */
117
+ messages: PropTypes.arrayOf(FormPropTypes.message),
118
+
119
+ /**
120
+ * The placement of the options list.
121
+ */
122
+ placement: PositionPropTypes.placement,
123
+
124
+ /**
125
+ * The parent in which to constrain the placement.
126
+ */
127
+ constrain: PositionPropTypes.constrain,
128
+
129
+ /**
130
+ * Callback fired when a new option is selected.
131
+ * @param {Object} event - the event object
132
+ * @param {Object} data - additional data
133
+ * @param data.value - the value of selected option
134
+ */
135
+ onChange: PropTypes.func,
136
+
137
+ /**
138
+ * Callback fired when text input receives focus.
139
+ */
140
+ onFocus: PropTypes.func,
141
+
142
+ /**
143
+ * Callback fired when text input loses focus.
144
+ */
145
+ onBlur: PropTypes.func,
146
+
147
+ /**
148
+ * Callback fired when the options list is shown.
149
+ */
150
+ onShowOptions: PropTypes.func,
151
+
152
+ /**
153
+ * Callback fired when the options list is hidden.
154
+ */
155
+ onHideOptions: PropTypes.func,
156
+
157
+ /**
158
+ * A ref to the html `input` element.
159
+ */
160
+ inputRef: PropTypes.func,
161
+
162
+ /**
163
+ * A ref to the html `ul` element.
164
+ */
165
+ listRef: PropTypes.func,
166
+
167
+ /**
168
+ * Content to display in the list when no options are available.
169
+ */
170
+ renderEmptyOption: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
171
+
172
+ /**
173
+ * Content to display before the text input. This will commonly be an icon.
174
+ */
175
+ renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
176
+
177
+ /**
178
+ * Content to display after the text input. This content will replace the
179
+ * default arrow icons.
180
+ */
181
+ renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
182
+
183
+ /* eslint-disable react/require-default-props */
184
+
185
+ /**
186
+ * A standard language identifier.
187
+ *
188
+ * See [moment.js i18n](https://momentjs.com/docs/#/i18n/) for more details.
189
+ *
190
+ * This property can also be set via a context property and if both are set then the component property takes
191
+ * precedence over the context property.
192
+ *
193
+ * The web browser's locale will be used if no value is set via a component property or a context
194
+ * property.
195
+ */
196
+ locale: PropTypes.string,
197
+
198
+ /**
199
+ * A timezone identifier in the format: Area/Location
200
+ *
201
+ * See [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the list
202
+ * of possible options.
203
+ *
204
+ * This property can also be set via a context property and if both are set then the component property takes
205
+ * precedence over the context property.
206
+ *
207
+ * The web browser's timezone will be used if no value is set via a component property or a context
208
+ * property.
209
+ */
210
+ timezone: PropTypes.string
211
+ /* eslint-enable react/require-default-props */
212
+
213
+ };
214
+ 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'];
215
+ export { propTypes, allowedProps };