@instructure/ui-select 8.15.1-snapshot.3 → 8.16.1-snapshot.2

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,12 @@
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.16.0](https://github.com/instructure/instructure-ui/compare/v8.15.0...v8.16.0) (2022-02-03)
7
+
8
+ ### Features
9
+
10
+ - **ui-select:** add `optionsMaxHeight` prop to Select ([cf361bf](https://github.com/instructure/instructure-ui/commit/cf361bf41dcef00548cd7a9053f44bec32c58f6a))
11
+
6
12
  # [8.15.0](https://github.com/instructure/instructure-ui/compare/v8.14.0...v8.15.0) (2022-01-26)
7
13
 
8
14
  **Note:** Version bump only for package @instructure/ui-select
@@ -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,9 +1,8 @@
1
1
  {
2
2
  "name": "@instructure/ui-select",
3
- "version": "8.15.1-snapshot.3+7badd52b7",
3
+ "version": "8.16.1-snapshot.2+25359e770",
4
4
  "description": "A component for select and autocomplete behavior.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
- "type": "commonjs",
7
6
  "module": "./es/index.js",
8
7
  "main": "./lib/index.js",
9
8
  "types": "./types/index.d.ts",
@@ -24,30 +23,30 @@
24
23
  },
25
24
  "license": "MIT",
26
25
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.15.1-snapshot.3+7badd52b7",
28
- "@instructure/ui-color-utils": "8.15.1-snapshot.3+7badd52b7",
29
- "@instructure/ui-test-locator": "8.15.1-snapshot.3+7badd52b7",
30
- "@instructure/ui-test-utils": "8.15.1-snapshot.3+7badd52b7",
31
- "@instructure/ui-themes": "8.15.1-snapshot.3+7badd52b7"
26
+ "@instructure/ui-babel-preset": "8.16.1-snapshot.2+25359e770",
27
+ "@instructure/ui-color-utils": "8.16.1-snapshot.2+25359e770",
28
+ "@instructure/ui-test-locator": "8.16.1-snapshot.2+25359e770",
29
+ "@instructure/ui-test-utils": "8.16.1-snapshot.2+25359e770",
30
+ "@instructure/ui-themes": "8.16.1-snapshot.2+25359e770"
32
31
  },
33
32
  "dependencies": {
34
33
  "@babel/runtime": "^7.13.10",
35
- "@instructure/emotion": "8.15.1-snapshot.3+7badd52b7",
36
- "@instructure/shared-types": "8.15.1-snapshot.3+7badd52b7",
37
- "@instructure/ui-dom-utils": "8.15.1-snapshot.3+7badd52b7",
38
- "@instructure/ui-form-field": "8.15.1-snapshot.3+7badd52b7",
39
- "@instructure/ui-icons": "8.15.1-snapshot.3+7badd52b7",
40
- "@instructure/ui-options": "8.15.1-snapshot.3+7badd52b7",
41
- "@instructure/ui-popover": "8.15.1-snapshot.3+7badd52b7",
42
- "@instructure/ui-position": "8.15.1-snapshot.3+7badd52b7",
43
- "@instructure/ui-prop-types": "8.15.1-snapshot.3+7badd52b7",
44
- "@instructure/ui-react-utils": "8.15.1-snapshot.3+7badd52b7",
45
- "@instructure/ui-selectable": "8.15.1-snapshot.3+7badd52b7",
46
- "@instructure/ui-testable": "8.15.1-snapshot.3+7badd52b7",
47
- "@instructure/ui-text-input": "8.15.1-snapshot.3+7badd52b7",
48
- "@instructure/ui-utils": "8.15.1-snapshot.3+7badd52b7",
49
- "@instructure/ui-view": "8.15.1-snapshot.3+7badd52b7",
50
- "@instructure/uid": "8.15.1-snapshot.3+7badd52b7",
34
+ "@instructure/emotion": "8.16.1-snapshot.2+25359e770",
35
+ "@instructure/shared-types": "8.16.1-snapshot.2+25359e770",
36
+ "@instructure/ui-dom-utils": "8.16.1-snapshot.2+25359e770",
37
+ "@instructure/ui-form-field": "8.16.1-snapshot.2+25359e770",
38
+ "@instructure/ui-icons": "8.16.1-snapshot.2+25359e770",
39
+ "@instructure/ui-options": "8.16.1-snapshot.2+25359e770",
40
+ "@instructure/ui-popover": "8.16.1-snapshot.2+25359e770",
41
+ "@instructure/ui-position": "8.16.1-snapshot.2+25359e770",
42
+ "@instructure/ui-prop-types": "8.16.1-snapshot.2+25359e770",
43
+ "@instructure/ui-react-utils": "8.16.1-snapshot.2+25359e770",
44
+ "@instructure/ui-selectable": "8.16.1-snapshot.2+25359e770",
45
+ "@instructure/ui-testable": "8.16.1-snapshot.2+25359e770",
46
+ "@instructure/ui-text-input": "8.16.1-snapshot.2+25359e770",
47
+ "@instructure/ui-utils": "8.16.1-snapshot.2+25359e770",
48
+ "@instructure/ui-view": "8.16.1-snapshot.2+25359e770",
49
+ "@instructure/uid": "8.16.1-snapshot.2+25359e770",
51
50
  "prop-types": "^15"
52
51
  },
53
52
  "peerDependencies": {
@@ -57,5 +56,5 @@
57
56
  "access": "public"
58
57
  },
59
58
  "sideEffects": false,
60
- "gitHead": "7badd52b7e444a81741ef17ff6dadf5866438a3b"
59
+ "gitHead": "25359e77043270cf26e92b14f396b498f1540c62"
61
60
  }
@@ -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',