@instructure/ui-select 8.38.2-snapshot-5 → 8.38.2-snapshot-7

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,7 +3,7 @@
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.38.2-snapshot-5](https://github.com/instructure/instructure-ui/compare/v8.38.1...v8.38.2-snapshot-5) (2023-07-14)
6
+ ## [8.38.2-snapshot-7](https://github.com/instructure/instructure-ui/compare/v8.38.1...v8.38.2-snapshot-7) (2023-07-21)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-select
9
9
 
@@ -34,13 +34,8 @@ import { Select } from './index';
34
34
 
35
35
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
36
  export const SelectLocator = locator(Select.selector, {
37
- findInput: function () {
38
- return locator('input').find(...arguments);
39
- },
40
- findOptionsList: async function (element) {
41
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
42
- args[_key - 1] = arguments[_key];
43
- }
37
+ findInput: (...args) => locator('input').find(...args),
38
+ findOptionsList: async (element, ...args) => {
44
39
  const content = await PopoverLocator.findContent(element, ...args);
45
40
  return content ? OptionsLocator.find(content.getDOMNode()) : null;
46
41
  }
@@ -76,8 +76,8 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
76
76
  @tsProps
77
77
  **/
78
78
  let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Select extends Component {
79
- constructor() {
80
- super(...arguments);
79
+ constructor(...args) {
80
+ super(...args);
81
81
  this.state = {
82
82
  hasInputRef: false
83
83
  };
@@ -236,9 +236,10 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
236
236
  onRequestHideOptions: event => {
237
237
  onRequestHideOptions === null || onRequestHideOptions === void 0 ? void 0 : onRequestHideOptions(event);
238
238
  },
239
- onRequestHighlightOption: (event, _ref) => {
240
- let id = _ref.id,
241
- direction = _ref.direction;
239
+ onRequestHighlightOption: (event, {
240
+ id,
241
+ direction
242
+ }) => {
242
243
  if (!isShowingOptions) return;
243
244
  const highlightedOptionId = this.highlightedOptionId;
244
245
  // if id exists, use that
@@ -264,8 +265,9 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
264
265
  onRequestHighlightLastOption: event => {
265
266
  this.highlightOption(event, this._optionIds[this._optionIds.length - 1]);
266
267
  },
267
- onRequestSelectOption: (event, _ref2) => {
268
- let id = _ref2.id;
268
+ onRequestSelectOption: (event, {
269
+ id
270
+ }) => {
269
271
  if (id && this._optionIds.indexOf(id) !== -1) {
270
272
  // only select if id exists as a valid option
271
273
  onRequestSelectOption === null || onRequestSelectOption === void 0 ? void 0 : onRequestSelectOption(event, {
@@ -514,37 +516,36 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
514
516
  highlightedOptionId: highlightedOptionId,
515
517
  isShowingOptions: isShowingOptions,
516
518
  selectedOptionId: selectedOptionId
517
- }, this.getEventHandlers()), _ref3 => {
518
- let getRootProps = _ref3.getRootProps,
519
- getInputProps = _ref3.getInputProps,
520
- getTriggerProps = _ref3.getTriggerProps,
521
- getListProps = _ref3.getListProps,
522
- getOptionProps = _ref3.getOptionProps,
523
- getDisabledOptionProps = _ref3.getDisabledOptionProps,
524
- getDescriptionProps = _ref3.getDescriptionProps;
525
- return jsx("span", Object.assign({}, getRootProps({
526
- css: styles === null || styles === void 0 ? void 0 : styles.select
527
- }), {
528
- ref: el => this.ref = el
529
- }), this.renderInput({
530
- getInputProps,
531
- getTriggerProps
532
- }), jsx("span", Object.assign({}, getDescriptionProps(), {
533
- css: styles === null || styles === void 0 ? void 0 : styles.assistiveText
534
- }), assistiveText), jsx(Popover, {
535
- constrain: constrain,
536
- placement: placement,
537
- mountNode: mountNode,
538
- positionTarget: this._inputContainer,
539
- isShowingContent: isShowingOptions,
540
- shouldReturnFocus: false,
541
- withArrow: false
542
- }, this.renderList({
543
- getListProps,
544
- getOptionProps,
545
- getDisabledOptionProps
546
- })));
547
- });
519
+ }, this.getEventHandlers()), ({
520
+ getRootProps,
521
+ getInputProps,
522
+ getTriggerProps,
523
+ getListProps,
524
+ getOptionProps,
525
+ getDisabledOptionProps,
526
+ getDescriptionProps
527
+ }) => jsx("span", Object.assign({}, getRootProps({
528
+ css: styles === null || styles === void 0 ? void 0 : styles.select
529
+ }), {
530
+ ref: el => this.ref = el
531
+ }), this.renderInput({
532
+ getInputProps,
533
+ getTriggerProps
534
+ }), jsx("span", Object.assign({}, getDescriptionProps(), {
535
+ css: styles === null || styles === void 0 ? void 0 : styles.assistiveText
536
+ }), assistiveText), jsx(Popover, {
537
+ constrain: constrain,
538
+ placement: placement,
539
+ mountNode: mountNode,
540
+ positionTarget: this._inputContainer,
541
+ isShowingContent: isShowingOptions,
542
+ shouldReturnFocus: false,
543
+ withArrow: false
544
+ }, this.renderList({
545
+ getListProps,
546
+ getOptionProps,
547
+ getDisabledOptionProps
548
+ }))));
548
549
  }
549
550
  }, _class2.displayName = "Select", _class2.componentId = 'Select', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
550
551
  inputValue: '',
@@ -41,13 +41,8 @@ var _index = require("./index");
41
41
 
42
42
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
43
43
  const SelectLocator = (0, _locator.locator)(_index.Select.selector, {
44
- findInput: function () {
45
- return (0, _locator.locator)('input').find(...arguments);
46
- },
47
- findOptionsList: async function (element) {
48
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
49
- args[_key - 1] = arguments[_key];
50
- }
44
+ findInput: (...args) => (0, _locator.locator)('input').find(...args),
45
+ findOptionsList: async (element, ...args) => {
51
46
  const content = await _PopoverLocator.PopoverLocator.findContent(element, ...args);
52
47
  return content ? _OptionsLocator.OptionsLocator.find(content.getDOMNode()) : null;
53
48
  }
@@ -88,8 +88,8 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
88
88
  @tsProps
89
89
  **/
90
90
  let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Select extends _react.Component {
91
- constructor() {
92
- super(...arguments);
91
+ constructor(...args) {
92
+ super(...args);
93
93
  this.state = {
94
94
  hasInputRef: false
95
95
  };
@@ -248,9 +248,10 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
248
248
  onRequestHideOptions: event => {
249
249
  onRequestHideOptions === null || onRequestHideOptions === void 0 ? void 0 : onRequestHideOptions(event);
250
250
  },
251
- onRequestHighlightOption: (event, _ref) => {
252
- let id = _ref.id,
253
- direction = _ref.direction;
251
+ onRequestHighlightOption: (event, {
252
+ id,
253
+ direction
254
+ }) => {
254
255
  if (!isShowingOptions) return;
255
256
  const highlightedOptionId = this.highlightedOptionId;
256
257
  // if id exists, use that
@@ -276,8 +277,9 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
276
277
  onRequestHighlightLastOption: event => {
277
278
  this.highlightOption(event, this._optionIds[this._optionIds.length - 1]);
278
279
  },
279
- onRequestSelectOption: (event, _ref2) => {
280
- let id = _ref2.id;
280
+ onRequestSelectOption: (event, {
281
+ id
282
+ }) => {
281
283
  if (id && this._optionIds.indexOf(id) !== -1) {
282
284
  // only select if id exists as a valid option
283
285
  onRequestSelectOption === null || onRequestSelectOption === void 0 ? void 0 : onRequestSelectOption(event, {
@@ -526,37 +528,36 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
526
528
  highlightedOptionId: highlightedOptionId,
527
529
  isShowingOptions: isShowingOptions,
528
530
  selectedOptionId: selectedOptionId
529
- }, this.getEventHandlers()), _ref3 => {
530
- let getRootProps = _ref3.getRootProps,
531
- getInputProps = _ref3.getInputProps,
532
- getTriggerProps = _ref3.getTriggerProps,
533
- getListProps = _ref3.getListProps,
534
- getOptionProps = _ref3.getOptionProps,
535
- getDisabledOptionProps = _ref3.getDisabledOptionProps,
536
- getDescriptionProps = _ref3.getDescriptionProps;
537
- return (0, _emotion.jsx)("span", Object.assign({}, getRootProps({
538
- css: styles === null || styles === void 0 ? void 0 : styles.select
539
- }), {
540
- ref: el => this.ref = el
541
- }), this.renderInput({
542
- getInputProps,
543
- getTriggerProps
544
- }), (0, _emotion.jsx)("span", Object.assign({}, getDescriptionProps(), {
545
- css: styles === null || styles === void 0 ? void 0 : styles.assistiveText
546
- }), assistiveText), (0, _emotion.jsx)(_Popover.Popover, {
547
- constrain: constrain,
548
- placement: placement,
549
- mountNode: mountNode,
550
- positionTarget: this._inputContainer,
551
- isShowingContent: isShowingOptions,
552
- shouldReturnFocus: false,
553
- withArrow: false
554
- }, this.renderList({
555
- getListProps,
556
- getOptionProps,
557
- getDisabledOptionProps
558
- })));
559
- });
531
+ }, this.getEventHandlers()), ({
532
+ getRootProps,
533
+ getInputProps,
534
+ getTriggerProps,
535
+ getListProps,
536
+ getOptionProps,
537
+ getDisabledOptionProps,
538
+ getDescriptionProps
539
+ }) => (0, _emotion.jsx)("span", Object.assign({}, getRootProps({
540
+ css: styles === null || styles === void 0 ? void 0 : styles.select
541
+ }), {
542
+ ref: el => this.ref = el
543
+ }), this.renderInput({
544
+ getInputProps,
545
+ getTriggerProps
546
+ }), (0, _emotion.jsx)("span", Object.assign({}, getDescriptionProps(), {
547
+ css: styles === null || styles === void 0 ? void 0 : styles.assistiveText
548
+ }), assistiveText), (0, _emotion.jsx)(_Popover.Popover, {
549
+ constrain: constrain,
550
+ placement: placement,
551
+ mountNode: mountNode,
552
+ positionTarget: this._inputContainer,
553
+ isShowingContent: isShowingOptions,
554
+ shouldReturnFocus: false,
555
+ withArrow: false
556
+ }, this.renderList({
557
+ getListProps,
558
+ getOptionProps,
559
+ getDisabledOptionProps
560
+ }))));
560
561
  }
561
562
  }, _class2.displayName = "Select", _class2.componentId = 'Select', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
562
563
  inputValue: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-select",
3
- "version": "8.38.2-snapshot-5",
3
+ "version": "8.38.2-snapshot-7",
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,30 +23,30 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.38.2-snapshot-5",
27
- "@instructure/ui-color-utils": "8.38.2-snapshot-5",
28
- "@instructure/ui-test-locator": "8.38.2-snapshot-5",
29
- "@instructure/ui-test-utils": "8.38.2-snapshot-5",
30
- "@instructure/ui-themes": "8.38.2-snapshot-5"
26
+ "@instructure/ui-babel-preset": "8.38.2-snapshot-7",
27
+ "@instructure/ui-color-utils": "8.38.2-snapshot-7",
28
+ "@instructure/ui-test-locator": "8.38.2-snapshot-7",
29
+ "@instructure/ui-test-utils": "8.38.2-snapshot-7",
30
+ "@instructure/ui-themes": "8.38.2-snapshot-7"
31
31
  },
32
32
  "dependencies": {
33
- "@babel/runtime": "^7.22.5",
34
- "@instructure/emotion": "8.38.2-snapshot-5",
35
- "@instructure/shared-types": "8.38.2-snapshot-5",
36
- "@instructure/ui-dom-utils": "8.38.2-snapshot-5",
37
- "@instructure/ui-form-field": "8.38.2-snapshot-5",
38
- "@instructure/ui-icons": "8.38.2-snapshot-5",
39
- "@instructure/ui-options": "8.38.2-snapshot-5",
40
- "@instructure/ui-popover": "8.38.2-snapshot-5",
41
- "@instructure/ui-position": "8.38.2-snapshot-5",
42
- "@instructure/ui-prop-types": "8.38.2-snapshot-5",
43
- "@instructure/ui-react-utils": "8.38.2-snapshot-5",
44
- "@instructure/ui-selectable": "8.38.2-snapshot-5",
45
- "@instructure/ui-testable": "8.38.2-snapshot-5",
46
- "@instructure/ui-text-input": "8.38.2-snapshot-5",
47
- "@instructure/ui-utils": "8.38.2-snapshot-5",
48
- "@instructure/ui-view": "8.38.2-snapshot-5",
49
- "@instructure/uid": "8.38.2-snapshot-5",
33
+ "@babel/runtime": "^7.22.6",
34
+ "@instructure/emotion": "8.38.2-snapshot-7",
35
+ "@instructure/shared-types": "8.38.2-snapshot-7",
36
+ "@instructure/ui-dom-utils": "8.38.2-snapshot-7",
37
+ "@instructure/ui-form-field": "8.38.2-snapshot-7",
38
+ "@instructure/ui-icons": "8.38.2-snapshot-7",
39
+ "@instructure/ui-options": "8.38.2-snapshot-7",
40
+ "@instructure/ui-popover": "8.38.2-snapshot-7",
41
+ "@instructure/ui-position": "8.38.2-snapshot-7",
42
+ "@instructure/ui-prop-types": "8.38.2-snapshot-7",
43
+ "@instructure/ui-react-utils": "8.38.2-snapshot-7",
44
+ "@instructure/ui-selectable": "8.38.2-snapshot-7",
45
+ "@instructure/ui-testable": "8.38.2-snapshot-7",
46
+ "@instructure/ui-text-input": "8.38.2-snapshot-7",
47
+ "@instructure/ui-utils": "8.38.2-snapshot-7",
48
+ "@instructure/ui-view": "8.38.2-snapshot-7",
49
+ "@instructure/uid": "8.38.2-snapshot-7",
50
50
  "prop-types": "^15.8.1"
51
51
  },
52
52
  "peerDependencies": {
@@ -1208,3 +1208,5 @@ render(
1208
1208
  #### Providing assistive text for screen readers
1209
1209
 
1210
1210
  It's important to ensure screen reader users receive instruction and feedback while interacting with a `Select`, but screen reader support for the `combobox` role varies. The `assistiveText` prop should always be used to explain how a keyboard user can make a selection. Additionally, a live region should be updated with feedback as the component is interacted with, such as when options are filtered or highlighted. Using an [Alert](#Alert) with the `screenReaderOnly` prop is the easiest way to do this.
1211
+
1212
+ > Note: This component uses a native `input` field to render the selected value. When it's included in a native HTML `form`, the text value will be sent to the backend instead of anything specified in the `value` field of the `Select.Option`-s. We do not recommend to use this component this way, rather write your own code that collects information and sends it to the backend.