@instructure/ui-select 8.15.0 → 8.15.1-snapshot.5

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.
@@ -389,13 +389,14 @@ let Select = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
389
389
  const _this$props6 = this.props,
390
390
  isShowingOptions = _this$props6.isShowingOptions,
391
391
  optionsMaxWidth = _this$props6.optionsMaxWidth,
392
+ optionsMaxHeight = _this$props6.optionsMaxHeight,
392
393
  visibleOptionsCount = _this$props6.visibleOptionsCount,
393
394
  children = _this$props6.children;
394
395
  let lastWasGroup = false;
395
396
  const viewProps = isShowingOptions ? {
396
397
  display: 'block',
397
398
  overflowY: 'auto',
398
- maxHeight: this._optionHeight * visibleOptionsCount,
399
+ maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount,
399
400
  maxWidth: optionsMaxWidth || this.width,
400
401
  background: 'primary',
401
402
  elementRef: node => this._listView = node
@@ -39,8 +39,9 @@ const propTypes = {
39
39
  isInline: PropTypes.bool,
40
40
  width: PropTypes.string,
41
41
  htmlSize: PropTypes.number,
42
- optionsMaxWidth: PropTypes.string,
43
42
  visibleOptionsCount: PropTypes.number,
43
+ optionsMaxHeight: PropTypes.string,
44
+ optionsMaxWidth: PropTypes.string,
44
45
  messages: PropTypes.arrayOf(FormPropTypes.message),
45
46
  placement: PositionPropTypes.placement,
46
47
  constrain: PositionPropTypes.constrain,
@@ -60,5 +61,5 @@ const propTypes = {
60
61
  children: ChildrenPropTypes.oneOf([Group, Option]),
61
62
  shouldNotWrap: PropTypes.bool
62
63
  };
63
- const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'optionsMaxWidth', 'visibleOptionsCount', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap'];
64
+ const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap'];
64
65
  export { propTypes, allowedProps };
@@ -399,13 +399,14 @@ let Select = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
399
399
  const _this$props6 = this.props,
400
400
  isShowingOptions = _this$props6.isShowingOptions,
401
401
  optionsMaxWidth = _this$props6.optionsMaxWidth,
402
+ optionsMaxHeight = _this$props6.optionsMaxHeight,
402
403
  visibleOptionsCount = _this$props6.visibleOptionsCount,
403
404
  children = _this$props6.children;
404
405
  let lastWasGroup = false;
405
406
  const viewProps = isShowingOptions ? {
406
407
  display: 'block',
407
408
  overflowY: 'auto',
408
- maxHeight: this._optionHeight * visibleOptionsCount,
409
+ maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount,
409
410
  maxWidth: optionsMaxWidth || this.width,
410
411
  background: 'primary',
411
412
  elementRef: node => this._listView = node
@@ -54,8 +54,9 @@ const propTypes = {
54
54
  isInline: _propTypes.default.bool,
55
55
  width: _propTypes.default.string,
56
56
  htmlSize: _propTypes.default.number,
57
- optionsMaxWidth: _propTypes.default.string,
58
57
  visibleOptionsCount: _propTypes.default.number,
58
+ optionsMaxHeight: _propTypes.default.string,
59
+ optionsMaxWidth: _propTypes.default.string,
59
60
  messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
60
61
  placement: _PositionPropTypes.PositionPropTypes.placement,
61
62
  constrain: _PositionPropTypes.PositionPropTypes.constrain,
@@ -76,5 +77,5 @@ const propTypes = {
76
77
  shouldNotWrap: _propTypes.default.bool
77
78
  };
78
79
  exports.propTypes = propTypes;
79
- const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'optionsMaxWidth', 'visibleOptionsCount', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap'];
80
+ const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap'];
80
81
  exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-select",
3
- "version": "8.15.0",
3
+ "version": "8.15.1-snapshot.5+c205f80a3",
4
4
  "description": "A component for select and autocomplete behavior.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -24,30 +24,30 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.15.0",
28
- "@instructure/ui-color-utils": "8.15.0",
29
- "@instructure/ui-test-locator": "8.15.0",
30
- "@instructure/ui-test-utils": "8.15.0",
31
- "@instructure/ui-themes": "8.15.0"
27
+ "@instructure/ui-babel-preset": "8.15.1-snapshot.5+c205f80a3",
28
+ "@instructure/ui-color-utils": "8.15.1-snapshot.5+c205f80a3",
29
+ "@instructure/ui-test-locator": "8.15.1-snapshot.5+c205f80a3",
30
+ "@instructure/ui-test-utils": "8.15.1-snapshot.5+c205f80a3",
31
+ "@instructure/ui-themes": "8.15.1-snapshot.5+c205f80a3"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.13.10",
35
- "@instructure/emotion": "8.15.0",
36
- "@instructure/shared-types": "8.15.0",
37
- "@instructure/ui-dom-utils": "8.15.0",
38
- "@instructure/ui-form-field": "8.15.0",
39
- "@instructure/ui-icons": "8.15.0",
40
- "@instructure/ui-options": "8.15.0",
41
- "@instructure/ui-popover": "8.15.0",
42
- "@instructure/ui-position": "8.15.0",
43
- "@instructure/ui-prop-types": "8.15.0",
44
- "@instructure/ui-react-utils": "8.15.0",
45
- "@instructure/ui-selectable": "8.15.0",
46
- "@instructure/ui-testable": "8.15.0",
47
- "@instructure/ui-text-input": "8.15.0",
48
- "@instructure/ui-utils": "8.15.0",
49
- "@instructure/ui-view": "8.15.0",
50
- "@instructure/uid": "8.15.0",
35
+ "@instructure/emotion": "8.15.1-snapshot.5+c205f80a3",
36
+ "@instructure/shared-types": "8.15.1-snapshot.5+c205f80a3",
37
+ "@instructure/ui-dom-utils": "8.15.1-snapshot.5+c205f80a3",
38
+ "@instructure/ui-form-field": "8.15.1-snapshot.5+c205f80a3",
39
+ "@instructure/ui-icons": "8.15.1-snapshot.5+c205f80a3",
40
+ "@instructure/ui-options": "8.15.1-snapshot.5+c205f80a3",
41
+ "@instructure/ui-popover": "8.15.1-snapshot.5+c205f80a3",
42
+ "@instructure/ui-position": "8.15.1-snapshot.5+c205f80a3",
43
+ "@instructure/ui-prop-types": "8.15.1-snapshot.5+c205f80a3",
44
+ "@instructure/ui-react-utils": "8.15.1-snapshot.5+c205f80a3",
45
+ "@instructure/ui-selectable": "8.15.1-snapshot.5+c205f80a3",
46
+ "@instructure/ui-testable": "8.15.1-snapshot.5+c205f80a3",
47
+ "@instructure/ui-text-input": "8.15.1-snapshot.5+c205f80a3",
48
+ "@instructure/ui-utils": "8.15.1-snapshot.5+c205f80a3",
49
+ "@instructure/ui-view": "8.15.1-snapshot.5+c205f80a3",
50
+ "@instructure/uid": "8.15.1-snapshot.5+c205f80a3",
51
51
  "prop-types": "^15"
52
52
  },
53
53
  "peerDependencies": {
@@ -56,5 +56,6 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "sideEffects": false
59
+ "sideEffects": false,
60
+ "gitHead": "c205f80a35a46812abacb6cdfaadbc0de76beea4"
60
61
  }
@@ -459,8 +459,13 @@ class Select extends Component<SelectProps> {
459
459
  >
460
460
  ) {
461
461
  const { getListProps, getOptionProps, getDisabledOptionProps } = data
462
- const { isShowingOptions, optionsMaxWidth, visibleOptionsCount, children } =
463
- this.props
462
+ const {
463
+ isShowingOptions,
464
+ optionsMaxWidth,
465
+ optionsMaxHeight,
466
+ visibleOptionsCount,
467
+ children
468
+ } = this.props
464
469
 
465
470
  let lastWasGroup = false
466
471
 
@@ -468,7 +473,8 @@ class Select extends Component<SelectProps> {
468
473
  ? {
469
474
  display: 'block',
470
475
  overflowY: 'auto',
471
- maxHeight: this._optionHeight * visibleOptionsCount!,
476
+ maxHeight:
477
+ optionsMaxHeight || this._optionHeight * visibleOptionsCount!,
472
478
  maxWidth: optionsMaxWidth || this.width,
473
479
  background: 'primary',
474
480
  elementRef: (node: Element | null) => (this._listView = node)
@@ -72,15 +72,21 @@ type SelectOwnProps = {
72
72
  isInline?: boolean
73
73
 
74
74
  /**
75
- * The max width the options list can be before option text wraps. If not
76
- * set, the list will only display as wide as the text input.
75
+ * The number of options that should be visible before having to scroll. Works best when the options are the same height.
77
76
  */
78
- optionsMaxWidth?: string
77
+ visibleOptionsCount?: number
79
78
 
80
79
  /**
81
- * The number of options that should be visible before having to scroll.
80
+ * The max height the options list can be before having to scroll. If
81
+ * set, it will __override__ the `visibleOptionsCount` prop.
82
82
  */
83
- visibleOptionsCount?: number
83
+ optionsMaxHeight?: string
84
+
85
+ /**
86
+ * The max width the options list can be before option text wraps. If not
87
+ * set, the list will only display as wide as the text input.
88
+ */
89
+ optionsMaxWidth?: string
84
90
 
85
91
  // Passed directly to TextInput as `value`
86
92
  /**
@@ -270,8 +276,9 @@ const propTypes: PropValidators<PropKeys> = {
270
276
  isInline: PropTypes.bool,
271
277
  width: PropTypes.string,
272
278
  htmlSize: PropTypes.number,
273
- optionsMaxWidth: PropTypes.string,
274
279
  visibleOptionsCount: PropTypes.number,
280
+ optionsMaxHeight: PropTypes.string,
281
+ optionsMaxWidth: PropTypes.string,
275
282
  messages: PropTypes.arrayOf(FormPropTypes.message),
276
283
  placement: PositionPropTypes.placement,
277
284
  constrain: PositionPropTypes.constrain,
@@ -305,8 +312,9 @@ const allowedProps: AllowedPropKeys = [
305
312
  'isInline',
306
313
  'width',
307
314
  'htmlSize',
308
- 'optionsMaxWidth',
309
315
  'visibleOptionsCount',
316
+ 'optionsMaxHeight',
317
+ 'optionsMaxWidth',
310
318
  'messages',
311
319
  'placement',
312
320
  'constrain',