@instructure/ui-select 11.7.3-snapshot-7 → 11.7.3-snapshot-26

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.
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = exports.Select = void 0;
9
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
9
  var _react = require("react");
11
10
  var utils = _interopRequireWildcard(require("@instructure/ui-utils"));
12
11
  var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
@@ -22,7 +21,7 @@ var _v11_2 = require("@instructure/ui-popover/v11_6");
22
21
  var _v11_3 = require("@instructure/ui-text-input/v11_6");
23
22
  var _v11_4 = require("@instructure/ui-options/v11_6");
24
23
  var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/generated/IconArrowOpenDownLine.js");
25
- var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/generated/IconArrowOpenUpLine.js");
24
+ var _IconArrowOpenUpLine = require("@instructure/ui-icons/lib/generated/IconArrowOpenUpLine.js");
26
25
  var _emotion = require("@instructure/emotion");
27
26
  var _styles = _interopRequireDefault(require("./styles"));
28
27
  var _theme = _interopRequireDefault(require("./theme"));
@@ -30,10 +29,7 @@ var _Group = require("./Group");
30
29
  var _Option = require("./Option");
31
30
  var _props = require("./props");
32
31
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
33
- const _excluded = ["id", "renderLabel", "children"],
34
- _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions", "layout"],
35
- _excluded3 = ["ref"];
36
- var _dec, _dec2, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
32
+ var _dec, _dec2, _class;
37
33
  /*
38
34
  * The MIT License (MIT)
39
35
  *
@@ -62,8 +58,10 @@ var _dec, _dec2, _class, _Select, _Options$Separator, _Options$Separator2, _Icon
62
58
  // because the Select component is re-rendered on every prop change of the <Select.Option>
63
59
  // and with a large amount of options, this can cause a lot of unnecessary re-renders.
64
60
  const MemoedOption = /*#__PURE__*/(0, _react.memo)(function Opt(props) {
65
- const optionsItemProps = props.optionsItemProps,
66
- children = props.children;
61
+ const {
62
+ optionsItemProps,
63
+ children
64
+ } = props;
67
65
  return (
68
66
  // The main <Options> that renders this is always an "ul"
69
67
  (0, _jsxRuntime.jsx)(_v11_4.Options.Item, {
@@ -88,58 +86,50 @@ category: components
88
86
  tags: autocomplete, typeahead, combobox, dropdown, search, form
89
87
  ---
90
88
  **/
91
- let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Select = class Select extends _react.Component {
92
- constructor(...args) {
93
- super(...args);
94
- this.SCROLL_TOLERANCE = 0.5;
95
- this.state = {
96
- hasInputRef: false
97
- };
98
- this.ref = null;
99
- this._input = null;
100
- this._defaultId = this.props.deterministicId();
101
- this._inputContainer = null;
102
- this._listView = null;
103
- // temporarily stores actionable options
104
- this._optionIds = [];
105
- // best guess for first calculation of list height
106
- this._optionHeight = 36;
107
- this.handleInputRef = node => {
108
- var _this$props$inputRef, _this$props;
109
- // ensures list is positioned with respect to input if list is open on mount
110
- if (!this.state.hasInputRef) {
111
- this.setState({
112
- hasInputRef: true
113
- });
114
- }
115
- this._input = node;
116
- (_this$props$inputRef = (_this$props = this.props).inputRef) === null || _this$props$inputRef === void 0 ? void 0 : _this$props$inputRef.call(_this$props, node);
117
- };
118
- this.handleListRef = node => {
119
- var _this$props$listRef, _this$props2;
120
- (_this$props$listRef = (_this$props2 = this.props).listRef) === null || _this$props$listRef === void 0 ? void 0 : _this$props$listRef.call(_this$props2, node);
121
-
122
- // store option height to calculate list maxHeight
123
- if (node && node.querySelector('[role="option"]')) {
124
- this._optionHeight = node.querySelector('[role="option"]').offsetHeight;
125
- }
126
- };
127
- this.handleInputContainerRef = node => {
128
- this._inputContainer = node;
129
- };
130
- }
89
+ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class Select extends _react.Component {
90
+ static displayName = "Select";
91
+ static componentId = 'Select';
92
+ SCROLL_TOLERANCE = 0.5;
93
+ static allowedProps = _props.allowedProps;
94
+ static defaultProps = {
95
+ inputValue: '',
96
+ isShowingOptions: false,
97
+ size: 'medium',
98
+ // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
99
+ interaction: undefined,
100
+ isRequired: false,
101
+ isInline: false,
102
+ visibleOptionsCount: 8,
103
+ placement: 'bottom stretch',
104
+ constrain: 'window',
105
+ shouldNotWrap: false,
106
+ scrollToHighlightedOption: true,
107
+ isOptionContentAppliedToInput: false
108
+ };
109
+ static Option = _Option.Option;
110
+ static Group = _Group.Group;
131
111
  componentDidMount() {
132
- var _this$props$makeStyle, _this$props3;
133
- (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
112
+ this.props.makeStyles?.();
134
113
  }
135
114
  componentDidUpdate() {
136
- var _this$props$makeStyle2, _this$props4;
137
- (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
115
+ this.props.makeStyles?.();
138
116
  if (this.props.scrollToHighlightedOption) {
139
117
  // scroll option into view if needed
140
118
  requestAnimationFrame(() => this.scrollToOption(this.highlightedOptionId));
141
119
  }
142
120
  }
121
+ state = {
122
+ hasInputRef: false
123
+ };
124
+ ref = null;
125
+ _input = null;
126
+ _defaultId = this.props.deterministicId();
127
+ _inputContainer = null;
128
+ _listView = null;
129
+ // temporarily stores actionable options
130
+ _optionIds = [];
131
+ // best guess for first calculation of list height
132
+ _optionHeight = 36;
143
133
  focus() {
144
134
  this._input && this._input.focus();
145
135
  }
@@ -159,7 +149,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
159
149
  return this.props.id || this._defaultId;
160
150
  }
161
151
  get width() {
162
- return this._inputContainer ? this._inputContainer.offsetWidth : void 0;
152
+ return this._inputContainer ? this._inputContainer.offsetWidth : undefined;
163
153
  }
164
154
  get interaction() {
165
155
  return (0, _getInteraction.getInteraction)({
@@ -208,10 +198,31 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
208
198
  return selectedOptionId[0];
209
199
  }
210
200
  if (selectedOptionId.length === 0) {
211
- return void 0;
201
+ return undefined;
212
202
  }
213
203
  return selectedOptionId;
214
204
  }
205
+ handleInputRef = node => {
206
+ // ensures list is positioned with respect to input if list is open on mount
207
+ if (!this.state.hasInputRef) {
208
+ this.setState({
209
+ hasInputRef: true
210
+ });
211
+ }
212
+ this._input = node;
213
+ this.props.inputRef?.(node);
214
+ };
215
+ handleListRef = node => {
216
+ this.props.listRef?.(node);
217
+
218
+ // store option height to calculate list maxHeight
219
+ if (node && node.querySelector('[role="option"]')) {
220
+ this._optionHeight = node.querySelector('[role="option"]').offsetHeight;
221
+ }
222
+ };
223
+ handleInputContainerRef = node => {
224
+ this._inputContainer = node;
225
+ };
215
226
  scrollToOption(id) {
216
227
  if (!this._listView || !id) return;
217
228
  const option = this._listView.querySelector(`[id="${CSS.escape(id)}"]`);
@@ -228,22 +239,25 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
228
239
  }
229
240
  }
230
241
  highlightOption(event, id) {
231
- const onRequestHighlightOption = this.props.onRequestHighlightOption;
242
+ const {
243
+ onRequestHighlightOption
244
+ } = this.props;
232
245
  if (id) {
233
- onRequestHighlightOption === null || onRequestHighlightOption === void 0 ? void 0 : onRequestHighlightOption(event, {
246
+ onRequestHighlightOption?.(event, {
234
247
  id
235
248
  });
236
249
  }
237
250
  }
238
251
  getEventHandlers() {
239
- const _this$props5 = this.props,
240
- isShowingOptions = _this$props5.isShowingOptions,
241
- onRequestShowOptions = _this$props5.onRequestShowOptions,
242
- onRequestHideOptions = _this$props5.onRequestHideOptions,
243
- onRequestSelectOption = _this$props5.onRequestSelectOption;
252
+ const {
253
+ isShowingOptions,
254
+ onRequestShowOptions,
255
+ onRequestHideOptions,
256
+ onRequestSelectOption
257
+ } = this.props;
244
258
  return this.interaction === 'enabled' ? {
245
259
  onRequestShowOptions: event => {
246
- onRequestShowOptions === null || onRequestShowOptions === void 0 ? void 0 : onRequestShowOptions(event);
260
+ onRequestShowOptions?.(event);
247
261
  const selectedOptionId = this.selectedOptionId;
248
262
  if (selectedOptionId && !Array.isArray(selectedOptionId)) {
249
263
  // highlight selected option on show
@@ -251,7 +265,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
251
265
  }
252
266
  },
253
267
  onRequestHideOptions: event => {
254
- onRequestHideOptions === null || onRequestHideOptions === void 0 ? void 0 : onRequestHideOptions(event);
268
+ onRequestHideOptions?.(event);
255
269
  },
256
270
  onRequestHighlightOption: (event, {
257
271
  id,
@@ -260,7 +274,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
260
274
  if (!isShowingOptions) return;
261
275
  const highlightedOptionId = this.highlightedOptionId;
262
276
  // if id exists, use that
263
- let highlightId = this._optionIds.indexOf(id) > -1 ? id : void 0;
277
+ let highlightId = this._optionIds.indexOf(id) > -1 ? id : undefined;
264
278
  if (!highlightId) {
265
279
  if (!highlightedOptionId) {
266
280
  // nothing highlighted yet, highlight first option
@@ -268,7 +282,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
268
282
  } else {
269
283
  // find next id based on direction
270
284
  const index = this._optionIds.indexOf(highlightedOptionId);
271
- highlightId = index > -1 ? this._optionIds[index + direction] : void 0;
285
+ highlightId = index > -1 ? this._optionIds[index + direction] : undefined;
272
286
  }
273
287
  }
274
288
  if (highlightId) {
@@ -287,7 +301,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
287
301
  }) => {
288
302
  if (id && this._optionIds.indexOf(id) !== -1) {
289
303
  // only select if id exists as a valid option
290
- onRequestSelectOption === null || onRequestSelectOption === void 0 ? void 0 : onRequestSelectOption(event, {
304
+ onRequestSelectOption?.(event, {
291
305
  id
292
306
  });
293
307
  }
@@ -295,19 +309,21 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
295
309
  } : {};
296
310
  }
297
311
  renderOption(option, data) {
298
- const getOptionProps = data.getOptionProps,
299
- getDisabledOptionProps = data.getDisabledOptionProps;
300
- const _option$props = option.props,
301
- id = _option$props.id,
302
- isDisabled = _option$props.isDisabled,
303
- isHighlighted = _option$props.isHighlighted,
304
- isSelected = _option$props.isSelected,
305
- renderBeforeLabel = _option$props.renderBeforeLabel,
306
- renderAfterLabel = _option$props.renderAfterLabel,
307
- children = _option$props.children;
312
+ const {
313
+ getOptionProps,
314
+ getDisabledOptionProps
315
+ } = data;
316
+ const {
317
+ id,
318
+ isDisabled,
319
+ isHighlighted,
320
+ isSelected,
321
+ renderBeforeLabel,
322
+ renderAfterLabel,
323
+ children
324
+ } = option.props;
308
325
  const getRenderOptionLabel = renderOptionLabel => {
309
- var _renderOptionLabel$pr;
310
- return typeof renderOptionLabel === 'function' && !(renderOptionLabel !== null && renderOptionLabel !== void 0 && (_renderOptionLabel$pr = renderOptionLabel.prototype) !== null && _renderOptionLabel$pr !== void 0 && _renderOptionLabel$pr.isReactComponent) ? renderOptionLabel.bind(null, {
326
+ return typeof renderOptionLabel === 'function' && !renderOptionLabel?.prototype?.isReactComponent ? renderOptionLabel.bind(null, {
311
327
  id,
312
328
  isDisabled,
313
329
  isSelected,
@@ -354,20 +370,23 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
354
370
  });
355
371
  }
356
372
  renderGroup(group, data) {
357
- const getOptionProps = data.getOptionProps,
358
- getDisabledOptionProps = data.getDisabledOptionProps,
359
- isFirstChild = data.isFirstChild,
360
- isLastChild = data.isLastChild,
361
- afterGroup = data.afterGroup;
362
- const _group$props = group.props,
363
- id = _group$props.id,
364
- renderLabel = _group$props.renderLabel,
365
- children = _group$props.children,
366
- rest = (0, _objectWithoutProperties2.default)(_group$props, _excluded);
373
+ const {
374
+ getOptionProps,
375
+ getDisabledOptionProps,
376
+ isFirstChild,
377
+ isLastChild,
378
+ afterGroup
379
+ } = data;
380
+ const {
381
+ id,
382
+ renderLabel,
383
+ children,
384
+ ...rest
385
+ } = group.props;
367
386
  const groupChildren = [];
368
387
  // add a separator above
369
388
  if (!isFirstChild && !afterGroup) {
370
- groupChildren.push(_Options$Separator || (_Options$Separator = (0, _jsxRuntime.jsx)(_v11_4.Options.Separator, {})));
389
+ groupChildren.push((0, _jsxRuntime.jsx)(_v11_4.Options.Separator, {}));
371
390
  }
372
391
  // create a sublist as a group
373
392
  // a wrapping listitem will be created by Options
@@ -386,20 +405,23 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
386
405
  }));
387
406
  // add a separator below
388
407
  if (!isLastChild) {
389
- groupChildren.push(_Options$Separator2 || (_Options$Separator2 = (0, _jsxRuntime.jsx)(_v11_4.Options.Separator, {})));
408
+ groupChildren.push((0, _jsxRuntime.jsx)(_v11_4.Options.Separator, {}));
390
409
  }
391
410
  return groupChildren;
392
411
  }
393
412
  renderList(data) {
394
- const getListProps = data.getListProps,
395
- getOptionProps = data.getOptionProps,
396
- getDisabledOptionProps = data.getDisabledOptionProps;
397
- const _this$props6 = this.props,
398
- isShowingOptions = _this$props6.isShowingOptions,
399
- optionsMaxWidth = _this$props6.optionsMaxWidth,
400
- optionsMaxHeight = _this$props6.optionsMaxHeight,
401
- visibleOptionsCount = _this$props6.visibleOptionsCount,
402
- children = _this$props6.children;
413
+ const {
414
+ getListProps,
415
+ getOptionProps,
416
+ getDisabledOptionProps
417
+ } = data;
418
+ const {
419
+ isShowingOptions,
420
+ optionsMaxWidth,
421
+ optionsMaxHeight,
422
+ visibleOptionsCount,
423
+ children
424
+ } = this.props;
403
425
  let lastWasGroup = false;
404
426
  const viewProps = isShowingOptions ? {
405
427
  display: 'block',
@@ -450,16 +472,17 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
450
472
  });
451
473
  }
452
474
  renderIcon() {
453
- const _this$props7 = this.props,
454
- styles = _this$props7.styles,
455
- isShowingOptions = _this$props7.isShowingOptions;
475
+ const {
476
+ styles,
477
+ isShowingOptions
478
+ } = this.props;
456
479
  return (0, _jsxRuntime.jsx)("span", {
457
- css: styles === null || styles === void 0 ? void 0 : styles.icon,
458
- children: isShowingOptions ? _IconArrowOpenUpLine || (_IconArrowOpenUpLine = (0, _jsxRuntime.jsx)(_IconArrowOpenUpLine2.IconArrowOpenUpLine, {
480
+ css: styles?.icon,
481
+ children: isShowingOptions ? (0, _jsxRuntime.jsx)(_IconArrowOpenUpLine.IconArrowOpenUpLine, {
459
482
  inline: false
460
- })) : _IconArrowOpenDownLin || (_IconArrowOpenDownLin = (0, _jsxRuntime.jsx)(_IconArrowOpenDownLine.IconArrowOpenDownLine, {
483
+ }) : (0, _jsxRuntime.jsx)(_IconArrowOpenDownLine.IconArrowOpenDownLine, {
461
484
  inline: false
462
- }))
485
+ })
463
486
  });
464
487
  }
465
488
  renderContentBeforeOrAfterInput(position) {
@@ -505,50 +528,58 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
505
528
  return defaultReturn;
506
529
  }
507
530
  handleRenderBeforeInput() {
508
- const _this$props8 = this.props,
509
- renderBeforeInput = _this$props8.renderBeforeInput,
510
- inputValue = _this$props8.inputValue,
511
- isOptionContentAppliedToInput = _this$props8.isOptionContentAppliedToInput;
531
+ const {
532
+ renderBeforeInput,
533
+ inputValue,
534
+ isOptionContentAppliedToInput
535
+ } = this.props;
512
536
  return this.handleInputContentRender(renderBeforeInput, inputValue, isOptionContentAppliedToInput, 'before', null // default for before
513
537
  );
514
538
  }
515
539
  handleRenderAfterInput() {
516
- const _this$props9 = this.props,
517
- renderAfterInput = _this$props9.renderAfterInput,
518
- inputValue = _this$props9.inputValue,
519
- isOptionContentAppliedToInput = _this$props9.isOptionContentAppliedToInput;
540
+ const {
541
+ renderAfterInput,
542
+ inputValue,
543
+ isOptionContentAppliedToInput
544
+ } = this.props;
520
545
  return this.handleInputContentRender(renderAfterInput, inputValue, isOptionContentAppliedToInput, 'after', this.renderIcon() // default for after
521
546
  );
522
547
  }
523
548
  renderInput(data) {
524
- const getInputProps = data.getInputProps,
525
- getTriggerProps = data.getTriggerProps;
526
- const _this$props0 = this.props,
527
- renderLabel = _this$props0.renderLabel,
528
- inputValue = _this$props0.inputValue,
529
- placeholder = _this$props0.placeholder,
530
- isRequired = _this$props0.isRequired,
531
- shouldNotWrap = _this$props0.shouldNotWrap,
532
- size = _this$props0.size,
533
- isInline = _this$props0.isInline,
534
- width = _this$props0.width,
535
- htmlSize = _this$props0.htmlSize,
536
- messages = _this$props0.messages,
537
- renderBeforeInput = _this$props0.renderBeforeInput,
538
- renderAfterInput = _this$props0.renderAfterInput,
539
- onFocus = _this$props0.onFocus,
540
- onBlur = _this$props0.onBlur,
541
- onInputChange = _this$props0.onInputChange,
542
- onRequestHideOptions = _this$props0.onRequestHideOptions,
543
- layout = _this$props0.layout,
544
- rest = (0, _objectWithoutProperties2.default)(_this$props0, _excluded2);
545
- const interaction = this.interaction;
549
+ const {
550
+ getInputProps,
551
+ getTriggerProps
552
+ } = data;
553
+ const {
554
+ renderLabel,
555
+ inputValue,
556
+ placeholder,
557
+ isRequired,
558
+ shouldNotWrap,
559
+ size,
560
+ isInline,
561
+ width,
562
+ htmlSize,
563
+ messages,
564
+ renderBeforeInput,
565
+ renderAfterInput,
566
+ onFocus,
567
+ onBlur,
568
+ onInputChange,
569
+ onRequestHideOptions,
570
+ layout,
571
+ ...rest
572
+ } = this.props;
573
+ const {
574
+ interaction
575
+ } = this;
546
576
  const passthroughProps = (0, _omitProps.omitProps)(rest, Select.allowedProps);
547
- const _getTriggerProps = getTriggerProps({
548
- ...passthroughProps
549
- }),
550
- ref = _getTriggerProps.ref,
551
- triggerProps = (0, _objectWithoutProperties2.default)(_getTriggerProps, _excluded3);
577
+ const {
578
+ ref,
579
+ ...triggerProps
580
+ } = getTriggerProps({
581
+ ...passthroughProps
582
+ });
552
583
  const isEditable = typeof onInputChange !== 'undefined';
553
584
 
554
585
  // props to ensure screen readers treat uneditable selects as accessible
@@ -563,7 +594,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
563
594
  // that its 'read-only' and that this is a 'textfield', see INSTUI-4500
564
595
  role: utils.isSafari() || utils.isAndroidOrIOS() || interaction === 'disabled' && utils.isChromium() ? 'button' : 'combobox',
565
596
  title: inputValue,
566
- 'aria-autocomplete': void 0,
597
+ 'aria-autocomplete': undefined,
567
598
  'aria-readonly': true
568
599
  } : interaction === 'disabled' && utils.isChromium() ? {
569
600
  role: 'button'
@@ -594,14 +625,14 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
594
625
  // On iOS VoiceOver, if there is a custom element instead of the changing up and down arrow button
595
626
  // the listbox closes on a swipe, so a DOM change is enforced by the key change
596
627
  // that seems to inform VoiceOver to behave the correct way
597
- renderAfterInput: utils.isAndroidOrIOS() && renderAfterInput !== void 0 ? (0, _jsxRuntime.jsx)("span", {
628
+ renderAfterInput: utils.isAndroidOrIOS() && renderAfterInput !== undefined ? (0, _jsxRuntime.jsx)("span", {
598
629
  children: this.handleRenderAfterInput()
599
630
  }, this.props.isShowingOptions ? 'open' : 'closed') : this.handleRenderAfterInput(),
600
631
  // If `inputValue` is provided, we need to pass a default onChange handler,
601
632
  // because TextInput `value` is a controlled prop,
602
633
  // and onChange is not required for Select
603
634
  // (before it was handled by TextInput's defaultProp)
604
- onChange: typeof onInputChange === 'function' ? onInputChange : inputValue ? () => {} : void 0,
635
+ onChange: typeof onInputChange === 'function' ? onInputChange : inputValue ? () => {} : undefined,
605
636
  onFocus,
606
637
  onBlur: utils.createChainedFunction(onBlur, onRequestHideOptions),
607
638
  ...overrideProps
@@ -614,13 +645,14 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
614
645
  });
615
646
  }
616
647
  render() {
617
- const _this$props1 = this.props,
618
- constrain = _this$props1.constrain,
619
- placement = _this$props1.placement,
620
- mountNode = _this$props1.mountNode,
621
- assistiveText = _this$props1.assistiveText,
622
- isShowingOptions = _this$props1.isShowingOptions,
623
- styles = _this$props1.styles;
648
+ const {
649
+ constrain,
650
+ placement,
651
+ mountNode,
652
+ assistiveText,
653
+ isShowingOptions,
654
+ styles
655
+ } = this.props;
624
656
  // clear temporary option store
625
657
  this._optionIds = [];
626
658
  const highlightedOptionId = this.highlightedOptionId;
@@ -640,7 +672,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
640
672
  getDescriptionProps
641
673
  }) => (0, _jsxRuntime.jsxs)("span", {
642
674
  ...getRootProps({
643
- css: styles === null || styles === void 0 ? void 0 : styles.select
675
+ css: styles?.select
644
676
  }),
645
677
  ref: el => {
646
678
  this.ref = el;
@@ -651,7 +683,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
651
683
  getTriggerProps
652
684
  }), (0, _jsxRuntime.jsx)("span", {
653
685
  ...getDescriptionProps(),
654
- css: styles === null || styles === void 0 ? void 0 : styles.assistiveText,
686
+ css: styles?.assistiveText,
655
687
  children: assistiveText
656
688
  }), (0, _jsxRuntime.jsx)(_v11_2.Popover, {
657
689
  constrain: constrain,
@@ -660,12 +692,12 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
660
692
  // in order to be able to navigate through the list items with a swipe.
661
693
  // The swipe would result in closing the listbox if mounted elsewhere.
662
694
  ,
663
- mountNode: mountNode !== void 0 ? mountNode : utils.isAndroidOrIOS() ? this.ref : void 0,
695
+ mountNode: mountNode !== undefined ? mountNode : utils.isAndroidOrIOS() ? this.ref : undefined,
664
696
  positionTarget: this._inputContainer,
665
697
  isShowingContent: isShowingOptions,
666
698
  shouldReturnFocus: false,
667
699
  withArrow: false,
668
- borderWidth: styles === null || styles === void 0 ? void 0 : styles.popoverBorderWidth,
700
+ borderWidth: styles?.popoverBorderWidth,
669
701
  children: this.renderList({
670
702
  getListProps,
671
703
  getOptionProps,
@@ -675,19 +707,5 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
675
707
  })
676
708
  });
677
709
  }
678
- }, _Select.displayName = "Select", _Select.componentId = 'Select', _Select.allowedProps = _props.allowedProps, _Select.defaultProps = {
679
- inputValue: '',
680
- isShowingOptions: false,
681
- size: 'medium',
682
- // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
683
- interaction: void 0,
684
- isRequired: false,
685
- isInline: false,
686
- visibleOptionsCount: 8,
687
- placement: 'bottom stretch',
688
- constrain: 'window',
689
- shouldNotWrap: false,
690
- scrollToHighlightedOption: true,
691
- isOptionContentAppliedToInput: false
692
- }, _Select.Option = _Option.Option, _Select.Group = _Group.Group, _Select)) || _class) || _class);
710
+ }) || _class) || _class);
693
711
  var _default = exports.default = Select;
@@ -36,7 +36,9 @@ exports.default = void 0;
36
36
  * @return {Object} The final style object, which will be used in the component
37
37
  */
38
38
  const generateStyle = (componentTheme, props) => {
39
- const size = props.size;
39
+ const {
40
+ size
41
+ } = props;
40
42
  const iconSizeVariants = {
41
43
  small: {
42
44
  fontSize: componentTheme.smallIconSize
@@ -34,18 +34,19 @@ exports.default = void 0;
34
34
  * @return {Object} The final theme object with the overrides and component variables
35
35
  */
36
36
  const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2;
38
- const colors = theme.colors,
39
- typography = theme.typography;
37
+ const {
38
+ colors,
39
+ typography
40
+ } = theme;
40
41
  const componentVariables = {
41
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
42
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
43
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
44
- smallIconSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeXSmall,
45
- mediumIconSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
46
- largeIconSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
47
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
48
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
42
+ fontSize: typography?.fontSizeMedium,
43
+ fontFamily: typography?.fontFamily,
44
+ fontWeight: typography?.fontWeightNormal,
45
+ smallIconSize: typography?.fontSizeXSmall,
46
+ mediumIconSize: typography?.fontSizeSmall,
47
+ largeIconSize: typography?.fontSizeMedium,
48
+ color: colors?.contrasts?.grey125125,
49
+ background: colors?.contrasts?.white1010,
49
50
  popoverBorderWidth: 'small'
50
51
  };
51
52
  return {
@@ -38,6 +38,11 @@ id: Select.Group
38
38
  @module Group
39
39
  **/
40
40
  class Group extends _react.Component {
41
+ static displayName = "Group";
42
+ static componentId = 'Select.Group';
43
+ static allowedProps = _props.allowedProps;
44
+ static defaultProps = {};
45
+
41
46
  /* istanbul ignore next */
42
47
  render() {
43
48
  // this component is only used for prop validation. Select.Group children
@@ -46,8 +51,4 @@ class Group extends _react.Component {
46
51
  }
47
52
  }
48
53
  exports.Group = Group;
49
- Group.displayName = "Group";
50
- Group.componentId = 'Select.Group';
51
- Group.allowedProps = _props.allowedProps;
52
- Group.defaultProps = {};
53
54
  var _default = exports.default = Group;
@@ -38,6 +38,15 @@ id: Select.Option
38
38
  @module Option
39
39
  **/
40
40
  class Option extends _react.Component {
41
+ static displayName = "Option";
42
+ static componentId = 'Select.Option';
43
+ static allowedProps = _props.allowedProps;
44
+ static defaultProps = {
45
+ isHighlighted: false,
46
+ isSelected: false,
47
+ isDisabled: false
48
+ };
49
+
41
50
  /* istanbul ignore next */
42
51
  render() {
43
52
  // this component is only used for prop validation. Select.Option children
@@ -46,12 +55,4 @@ class Option extends _react.Component {
46
55
  }
47
56
  }
48
57
  exports.Option = Option;
49
- Option.displayName = "Option";
50
- Option.componentId = 'Select.Option';
51
- Option.allowedProps = _props.allowedProps;
52
- Option.defaultProps = {
53
- isHighlighted: false,
54
- isSelected: false,
55
- isDisabled: false
56
- };
57
58
  var _default = exports.default = Option;