@instructure/ui-select 10.20.2-snapshot-7 → 10.20.2-snapshot-10

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,9 +3,17 @@
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
- ## [10.20.2-snapshot-7](https://github.com/instructure/instructure-ui/compare/v10.20.1...v10.20.2-snapshot-7) (2025-06-24)
6
+ ## [10.20.2-snapshot-10](https://github.com/instructure/instructure-ui/compare/v10.20.1...v10.20.2-snapshot-10) (2025-06-24)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-select
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-select:** prevent scrolling when last item is hovered in Chrome ([51cd81a](https://github.com/instructure/instructure-ui/commit/51cd81a5360bbbc78d30e7e2489bb0c02b67a470))
12
+
13
+
14
+ ### Features
15
+
16
+ * **ui-simple-select,ui-select:** add layout prop to Select and SimpleSelect ([94f0a6f](https://github.com/instructure/instructure-ui/commit/94f0a6f99f9e813fe44e6c3111fdb4e5f3708b76))
9
17
 
10
18
 
11
19
 
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["id", "renderLabel", "children"],
3
- _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions"],
3
+ _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions", "layout"],
4
4
  _excluded3 = ["ref"];
5
5
  var _dec, _dec2, _dec3, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
6
6
  /*
@@ -79,6 +79,7 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
79
79
  let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_Select = class Select extends Component {
80
80
  constructor(...args) {
81
81
  super(...args);
82
+ this.SCROLL_TOLERANCE = 0.5;
82
83
  this.state = {
83
84
  hasInputRef: false
84
85
  };
@@ -391,7 +392,9 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
391
392
  const viewProps = isShowingOptions ? {
392
393
  display: 'block',
393
394
  overflowY: 'auto',
394
- maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount,
395
+ maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount - (
396
+ // in Chrome, we need to prevent scrolling when the bottom area of last item is hovered
397
+ utils.isChromium() ? this.SCROLL_TOLERANCE : 0),
395
398
  maxWidth: optionsMaxWidth || this.width,
396
399
  background: 'primary',
397
400
  elementRef: node => this._listView = node,
@@ -525,6 +528,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
525
528
  onBlur = _this$props0.onBlur,
526
529
  onInputChange = _this$props0.onInputChange,
527
530
  onRequestHideOptions = _this$props0.onRequestHideOptions,
531
+ layout = _this$props0.layout,
528
532
  rest = _objectWithoutProperties(_this$props0, _excluded2);
529
533
  const interaction = this.interaction;
530
534
  const passthroughProps = omitProps(rest, Select.allowedProps);
@@ -572,6 +576,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
572
576
  : interaction,
573
577
  isRequired,
574
578
  shouldNotWrap,
579
+ layout,
575
580
  display: isInline ? 'inline-block' : 'block',
576
581
  renderBeforeInput: this.handleRenderBeforeInput(),
577
582
  // On iOS VoiceOver, if there is a custom element instead of the changing up and down arrow button
@@ -72,7 +72,8 @@ const propTypes = {
72
72
  renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
73
73
  children: ChildrenPropTypes.oneOf([Group, Option]),
74
74
  shouldNotWrap: PropTypes.bool,
75
- scrollToHighlightedOption: PropTypes.bool
75
+ scrollToHighlightedOption: PropTypes.bool,
76
+ layout: PropTypes.oneOf(['stacked', 'inline'])
76
77
  };
77
- const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'isOptionContentAppliedToInput', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption'];
78
+ const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'isOptionContentAppliedToInput', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption', 'layout'];
78
79
  export { propTypes, allowedProps };
@@ -31,7 +31,7 @@ var _Option = require("./Option");
31
31
  var _props = require("./props");
32
32
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
33
33
  const _excluded = ["id", "renderLabel", "children"],
34
- _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions"],
34
+ _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions", "layout"],
35
35
  _excluded3 = ["ref"];
36
36
  var _dec, _dec2, _dec3, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
37
37
  /*
@@ -91,6 +91,7 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
91
91
  let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_Select = class Select extends _react.Component {
92
92
  constructor(...args) {
93
93
  super(...args);
94
+ this.SCROLL_TOLERANCE = 0.5;
94
95
  this.state = {
95
96
  hasInputRef: false
96
97
  };
@@ -403,7 +404,9 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
403
404
  const viewProps = isShowingOptions ? {
404
405
  display: 'block',
405
406
  overflowY: 'auto',
406
- maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount,
407
+ maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount - (
408
+ // in Chrome, we need to prevent scrolling when the bottom area of last item is hovered
409
+ utils.isChromium() ? this.SCROLL_TOLERANCE : 0),
407
410
  maxWidth: optionsMaxWidth || this.width,
408
411
  background: 'primary',
409
412
  elementRef: node => this._listView = node,
@@ -537,6 +540,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
537
540
  onBlur = _this$props0.onBlur,
538
541
  onInputChange = _this$props0.onInputChange,
539
542
  onRequestHideOptions = _this$props0.onRequestHideOptions,
543
+ layout = _this$props0.layout,
540
544
  rest = (0, _objectWithoutProperties2.default)(_this$props0, _excluded2);
541
545
  const interaction = this.interaction;
542
546
  const passthroughProps = (0, _omitProps.omitProps)(rest, Select.allowedProps);
@@ -584,6 +588,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
584
588
  : interaction,
585
589
  isRequired,
586
590
  shouldNotWrap,
591
+ layout,
587
592
  display: isInline ? 'inline-block' : 'block',
588
593
  renderBeforeInput: this.handleRenderBeforeInput(),
589
594
  // On iOS VoiceOver, if there is a custom element instead of the changing up and down arrow button
@@ -78,6 +78,7 @@ const propTypes = exports.propTypes = {
78
78
  renderAfterInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
79
79
  children: _Children.Children.oneOf([_Group.Group, _Option.Option]),
80
80
  shouldNotWrap: _propTypes.default.bool,
81
- scrollToHighlightedOption: _propTypes.default.bool
81
+ scrollToHighlightedOption: _propTypes.default.bool,
82
+ layout: _propTypes.default.oneOf(['stacked', 'inline'])
82
83
  };
83
- const allowedProps = exports.allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'isOptionContentAppliedToInput', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption'];
84
+ const allowedProps = exports.allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'isOptionContentAppliedToInput', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption', 'layout'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-select",
3
- "version": "10.20.2-snapshot-7",
3
+ "version": "10.20.2-snapshot-10",
4
4
  "description": "A component for select and autocomplete behavior.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "10.20.2-snapshot-7",
27
- "@instructure/ui-color-utils": "10.20.2-snapshot-7",
28
- "@instructure/ui-scripts": "10.20.2-snapshot-7",
29
- "@instructure/ui-test-utils": "10.20.2-snapshot-7",
30
- "@instructure/ui-themes": "10.20.2-snapshot-7",
26
+ "@instructure/ui-babel-preset": "10.20.2-snapshot-10",
27
+ "@instructure/ui-color-utils": "10.20.2-snapshot-10",
28
+ "@instructure/ui-scripts": "10.20.2-snapshot-10",
29
+ "@instructure/ui-test-utils": "10.20.2-snapshot-10",
30
+ "@instructure/ui-themes": "10.20.2-snapshot-10",
31
31
  "@testing-library/jest-dom": "^6.6.3",
32
32
  "@testing-library/react": "^16.0.1",
33
33
  "@testing-library/user-event": "^14.6.1",
@@ -35,22 +35,22 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/runtime": "^7.27.6",
38
- "@instructure/emotion": "10.20.2-snapshot-7",
39
- "@instructure/shared-types": "10.20.2-snapshot-7",
40
- "@instructure/ui-dom-utils": "10.20.2-snapshot-7",
41
- "@instructure/ui-form-field": "10.20.2-snapshot-7",
42
- "@instructure/ui-icons": "10.20.2-snapshot-7",
43
- "@instructure/ui-options": "10.20.2-snapshot-7",
44
- "@instructure/ui-popover": "10.20.2-snapshot-7",
45
- "@instructure/ui-position": "10.20.2-snapshot-7",
46
- "@instructure/ui-prop-types": "10.20.2-snapshot-7",
47
- "@instructure/ui-react-utils": "10.20.2-snapshot-7",
48
- "@instructure/ui-selectable": "10.20.2-snapshot-7",
49
- "@instructure/ui-testable": "10.20.2-snapshot-7",
50
- "@instructure/ui-text-input": "10.20.2-snapshot-7",
51
- "@instructure/ui-utils": "10.20.2-snapshot-7",
52
- "@instructure/ui-view": "10.20.2-snapshot-7",
53
- "@instructure/uid": "10.20.2-snapshot-7",
38
+ "@instructure/emotion": "10.20.2-snapshot-10",
39
+ "@instructure/shared-types": "10.20.2-snapshot-10",
40
+ "@instructure/ui-dom-utils": "10.20.2-snapshot-10",
41
+ "@instructure/ui-form-field": "10.20.2-snapshot-10",
42
+ "@instructure/ui-icons": "10.20.2-snapshot-10",
43
+ "@instructure/ui-options": "10.20.2-snapshot-10",
44
+ "@instructure/ui-popover": "10.20.2-snapshot-10",
45
+ "@instructure/ui-position": "10.20.2-snapshot-10",
46
+ "@instructure/ui-prop-types": "10.20.2-snapshot-10",
47
+ "@instructure/ui-react-utils": "10.20.2-snapshot-10",
48
+ "@instructure/ui-selectable": "10.20.2-snapshot-10",
49
+ "@instructure/ui-testable": "10.20.2-snapshot-10",
50
+ "@instructure/ui-text-input": "10.20.2-snapshot-10",
51
+ "@instructure/ui-utils": "10.20.2-snapshot-10",
52
+ "@instructure/ui-view": "10.20.2-snapshot-10",
53
+ "@instructure/uid": "10.20.2-snapshot-10",
54
54
  "prop-types": "^15.8.1"
55
55
  },
56
56
  "peerDependencies": {
@@ -133,6 +133,7 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
133
133
  @testable()
134
134
  class Select extends Component<SelectProps> {
135
135
  static readonly componentId = 'Select'
136
+ private readonly SCROLL_TOLERANCE = 0.5
136
137
 
137
138
  static allowedProps = allowedProps
138
139
  static propTypes = propTypes
@@ -527,7 +528,10 @@ class Select extends Component<SelectProps> {
527
528
  display: 'block',
528
529
  overflowY: 'auto',
529
530
  maxHeight:
530
- optionsMaxHeight || this._optionHeight * visibleOptionsCount!,
531
+ optionsMaxHeight ||
532
+ this._optionHeight * visibleOptionsCount! -
533
+ // in Chrome, we need to prevent scrolling when the bottom area of last item is hovered
534
+ (utils.isChromium() ? this.SCROLL_TOLERANCE : 0),
531
535
  maxWidth: optionsMaxWidth || this.width,
532
536
  background: 'primary',
533
537
  elementRef: (node: Element | null) => (this._listView = node),
@@ -690,6 +694,7 @@ class Select extends Component<SelectProps> {
690
694
  onBlur,
691
695
  onInputChange,
692
696
  onRequestHideOptions,
697
+ layout,
693
698
  ...rest
694
699
  } = this.props
695
700
 
@@ -745,6 +750,7 @@ class Select extends Component<SelectProps> {
745
750
  : interaction,
746
751
  isRequired,
747
752
  shouldNotWrap,
753
+ layout,
748
754
  display: isInline ? 'inline-block' : 'block',
749
755
  renderBeforeInput: this.handleRenderBeforeInput(),
750
756
  // On iOS VoiceOver, if there is a custom element instead of the changing up and down arrow button
@@ -256,6 +256,14 @@ type PropsFromTextInput = {
256
256
  * when available space is exceeded.
257
257
  */
258
258
  shouldNotWrap?: boolean
259
+
260
+ /**
261
+ * In `stacked` mode the input is below the label.
262
+ *
263
+ * In `inline` mode the input is to the right/left (depending on text direction) of the label,
264
+ * and the layout will look like `stacked` for small screens.
265
+ */
266
+ layout?: 'stacked' | 'inline'
259
267
  }
260
268
 
261
269
  // These props are directly passed to Popover
@@ -328,7 +336,8 @@ const propTypes: PropValidators<PropKeys> = {
328
336
  renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
329
337
  children: ChildrenPropTypes.oneOf([Group, Option]),
330
338
  shouldNotWrap: PropTypes.bool,
331
- scrollToHighlightedOption: PropTypes.bool
339
+ scrollToHighlightedOption: PropTypes.bool,
340
+ layout: PropTypes.oneOf(['stacked', 'inline'])
332
341
  }
333
342
 
334
343
  const allowedProps: AllowedPropKeys = [
@@ -365,7 +374,8 @@ const allowedProps: AllowedPropKeys = [
365
374
  'renderAfterInput',
366
375
  'children',
367
376
  'shouldNotWrap',
368
- 'scrollToHighlightedOption'
377
+ 'scrollToHighlightedOption',
378
+ 'layout'
369
379
  ]
370
380
 
371
381
  export type { SelectProps, SelectOwnProps, SelectStyle }