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