@instructure/ui-select 8.17.0 → 8.17.1-snapshot.17

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.
@@ -3,7 +3,7 @@ const _excluded = ["id", "renderLabel", "children"],
3
3
  _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions"],
4
4
  _excluded3 = ["ref"];
5
5
 
6
- var _dec, _dec2, _class, _class2, _temp, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
6
+ var _dec, _dec2, _dec3, _class, _class2, _temp, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
7
7
 
8
8
  /*
9
9
  * The MIT License (MIT)
@@ -33,8 +33,7 @@ var _dec, _dec2, _class, _class2, _temp, _Options$Separator, _Options$Separator2
33
33
  import React, { Children, Component } from 'react';
34
34
  import { createChainedFunction } from '@instructure/ui-utils';
35
35
  import { testable } from '@instructure/ui-testable';
36
- import { uid } from '@instructure/uid';
37
- import { matchComponentTypes, omitProps, getInteraction } from '@instructure/ui-react-utils';
36
+ import { matchComponentTypes, omitProps, getInteraction, withDeterministicId } from '@instructure/ui-react-utils';
38
37
  import { getBoundingClientRect, isActiveElement } from '@instructure/ui-dom-utils';
39
38
  import { View } from '@instructure/ui-view';
40
39
  import { Selectable } from '@instructure/ui-selectable';
@@ -56,14 +55,14 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
56
55
  ---
57
56
  @tsProps
58
57
  **/
59
- let Select = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Select extends Component {
58
+ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class Select extends Component {
60
59
  constructor() {
61
60
  super(...arguments);
62
61
  this.state = {
63
62
  hasInputRef: false
64
63
  };
65
64
  this.ref = null;
66
- this._defaultId = uid('Select');
65
+ this._defaultId = this.props.deterministicId();
67
66
  this._inputContainer = null;
68
67
  this._listView = null;
69
68
  this._optionIds = [];
@@ -582,6 +581,6 @@ let Select = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
582
581
  placement: 'bottom stretch',
583
582
  constrain: 'window',
584
583
  shouldNotWrap: false
585
- }, _class2.Option = Option, _class2.Group = Group, _temp)) || _class) || _class);
584
+ }, _class2.Option = Option, _class2.Group = Group, _temp)) || _class) || _class) || _class);
586
585
  export default Select;
587
586
  export { Select };
@@ -17,14 +17,14 @@ var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFun
17
17
 
18
18
  var _testable = require("@instructure/ui-testable/lib/testable.js");
19
19
 
20
- var _uid = require("@instructure/uid");
21
-
22
20
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
23
21
 
24
22
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
25
23
 
26
24
  var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
27
25
 
26
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
27
+
28
28
  var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
29
29
 
30
30
  var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
@@ -59,7 +59,7 @@ const _excluded = ["id", "renderLabel", "children"],
59
59
  _excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions"],
60
60
  _excluded3 = ["ref"];
61
61
 
62
- var _dec, _dec2, _class, _class2, _temp, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
62
+ var _dec, _dec2, _dec3, _class, _class2, _temp, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
63
63
 
64
64
  /**
65
65
  ---
@@ -68,14 +68,14 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
68
68
  ---
69
69
  @tsProps
70
70
  **/
71
- let Select = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Select extends _react.Component {
71
+ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class Select extends _react.Component {
72
72
  constructor() {
73
73
  super(...arguments);
74
74
  this.state = {
75
75
  hasInputRef: false
76
76
  };
77
77
  this.ref = null;
78
- this._defaultId = (0, _uid.uid)('Select');
78
+ this._defaultId = this.props.deterministicId();
79
79
  this._inputContainer = null;
80
80
  this._listView = null;
81
81
  this._optionIds = [];
@@ -590,7 +590,7 @@ let Select = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
590
590
  placement: 'bottom stretch',
591
591
  constrain: 'window',
592
592
  shouldNotWrap: false
593
- }, _class2.Option = _Option.Option, _class2.Group = _Group.Group, _temp)) || _class) || _class);
593
+ }, _class2.Option = _Option.Option, _class2.Group = _Group.Group, _temp)) || _class) || _class) || _class);
594
594
  exports.Select = Select;
595
595
  var _default = Select;
596
596
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-select",
3
- "version": "8.17.0",
3
+ "version": "8.17.1-snapshot.17+8e38d5a2e",
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.17.0",
27
- "@instructure/ui-color-utils": "8.17.0",
28
- "@instructure/ui-test-locator": "8.17.0",
29
- "@instructure/ui-test-utils": "8.17.0",
30
- "@instructure/ui-themes": "8.17.0"
26
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.17+8e38d5a2e",
27
+ "@instructure/ui-color-utils": "8.17.1-snapshot.17+8e38d5a2e",
28
+ "@instructure/ui-test-locator": "8.17.1-snapshot.17+8e38d5a2e",
29
+ "@instructure/ui-test-utils": "8.17.1-snapshot.17+8e38d5a2e",
30
+ "@instructure/ui-themes": "8.17.1-snapshot.17+8e38d5a2e"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/emotion": "8.17.0",
35
- "@instructure/shared-types": "8.17.0",
36
- "@instructure/ui-dom-utils": "8.17.0",
37
- "@instructure/ui-form-field": "8.17.0",
38
- "@instructure/ui-icons": "8.17.0",
39
- "@instructure/ui-options": "8.17.0",
40
- "@instructure/ui-popover": "8.17.0",
41
- "@instructure/ui-position": "8.17.0",
42
- "@instructure/ui-prop-types": "8.17.0",
43
- "@instructure/ui-react-utils": "8.17.0",
44
- "@instructure/ui-selectable": "8.17.0",
45
- "@instructure/ui-testable": "8.17.0",
46
- "@instructure/ui-text-input": "8.17.0",
47
- "@instructure/ui-utils": "8.17.0",
48
- "@instructure/ui-view": "8.17.0",
49
- "@instructure/uid": "8.17.0",
34
+ "@instructure/emotion": "8.17.1-snapshot.17+8e38d5a2e",
35
+ "@instructure/shared-types": "8.17.1-snapshot.17+8e38d5a2e",
36
+ "@instructure/ui-dom-utils": "8.17.1-snapshot.17+8e38d5a2e",
37
+ "@instructure/ui-form-field": "8.17.1-snapshot.17+8e38d5a2e",
38
+ "@instructure/ui-icons": "8.17.1-snapshot.17+8e38d5a2e",
39
+ "@instructure/ui-options": "8.17.1-snapshot.17+8e38d5a2e",
40
+ "@instructure/ui-popover": "8.17.1-snapshot.17+8e38d5a2e",
41
+ "@instructure/ui-position": "8.17.1-snapshot.17+8e38d5a2e",
42
+ "@instructure/ui-prop-types": "8.17.1-snapshot.17+8e38d5a2e",
43
+ "@instructure/ui-react-utils": "8.17.1-snapshot.17+8e38d5a2e",
44
+ "@instructure/ui-selectable": "8.17.1-snapshot.17+8e38d5a2e",
45
+ "@instructure/ui-testable": "8.17.1-snapshot.17+8e38d5a2e",
46
+ "@instructure/ui-text-input": "8.17.1-snapshot.17+8e38d5a2e",
47
+ "@instructure/ui-utils": "8.17.1-snapshot.17+8e38d5a2e",
48
+ "@instructure/ui-view": "8.17.1-snapshot.17+8e38d5a2e",
49
+ "@instructure/uid": "8.17.1-snapshot.17+8e38d5a2e",
50
50
  "prop-types": "^15"
51
51
  },
52
52
  "peerDependencies": {
@@ -55,5 +55,6 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "sideEffects": false
58
+ "sideEffects": false,
59
+ "gitHead": "8e38d5a2e11e842eafa2fa270e47a261c6ebb626"
59
60
  }
@@ -27,11 +27,11 @@ import React, { Children, Component } from 'react'
27
27
 
28
28
  import { createChainedFunction } from '@instructure/ui-utils'
29
29
  import { testable } from '@instructure/ui-testable'
30
- import { uid } from '@instructure/uid'
31
30
  import {
32
31
  matchComponentTypes,
33
32
  omitProps,
34
- getInteraction
33
+ getInteraction,
34
+ withDeterministicId
35
35
  } from '@instructure/ui-react-utils'
36
36
  import {
37
37
  getBoundingClientRect,
@@ -85,6 +85,7 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
85
85
  ---
86
86
  @tsProps
87
87
  **/
88
+ @withDeterministicId()
88
89
  @withStyle(generateStyle, generateComponentTheme)
89
90
  @testable()
90
91
  class Select extends Component<SelectProps> {
@@ -124,10 +125,8 @@ class Select extends Component<SelectProps> {
124
125
  state = {
125
126
  hasInputRef: false
126
127
  }
127
-
128
128
  ref: HTMLInputElement | null = null
129
-
130
- private _defaultId = uid('Select')
129
+ private _defaultId = this.props.deterministicId!()
131
130
  private _inputContainer: HTMLSpanElement | null = null
132
131
  private _listView: Element | null = null
133
132
  // temporarily stores actionable options
@@ -238,9 +237,9 @@ class Select extends Component<SelectProps> {
238
237
 
239
238
  // store option height to calculate list maxHeight
240
239
  if (node && node.querySelector('[role="option"]')) {
241
- this._optionHeight = (
242
- node.querySelector('[role="option"]') as HTMLElement
243
- ).offsetHeight
240
+ this._optionHeight = (node.querySelector(
241
+ '[role="option"]'
242
+ ) as HTMLElement).offsetHeight
244
243
  }
245
244
  }
246
245
 
@@ -44,6 +44,7 @@ import type {
44
44
  PositionConstraint,
45
45
  PositionMountNode
46
46
  } from '@instructure/ui-position'
47
+ import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
47
48
 
48
49
  type SelectOwnProps = {
49
50
  /**
@@ -260,7 +261,7 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
260
261
 
261
262
  type SelectProps = SelectOwnProps &
262
263
  WithStyleProps<SelectTheme, SelectStyle> &
263
- OtherHTMLAttributes<SelectOwnProps, InputHTMLAttributes<SelectOwnProps>>
264
+ OtherHTMLAttributes<SelectOwnProps, InputHTMLAttributes<SelectOwnProps>> & WithDeterministicIdProps
264
265
 
265
266
  type SelectStyle = ComponentStyle<'select' | 'icon' | 'assistiveText'>
266
267
 
@@ -21,12 +21,13 @@
21
21
  { "path": "../ui-popover/tsconfig.build.json" },
22
22
  { "path": "../ui-position/tsconfig.build.json" },
23
23
  { "path": "../ui-prop-types/tsconfig.build.json" },
24
- { "path": "../ui-react-utils/tsconfig.build.json" },
25
24
  { "path": "../ui-selectable/tsconfig.build.json" },
26
25
  { "path": "../ui-testable/tsconfig.build.json" },
27
26
  { "path": "../ui-text-input/tsconfig.build.json" },
28
27
  { "path": "../ui-utils/tsconfig.build.json" },
29
28
  { "path": "../ui-view/tsconfig.build.json" },
29
+ { "path": "../ui-utils/tsconfig.build.json" },
30
+ { "path": "../ui-react-utils/tsconfig.build.json" },
30
31
  { "path": "../uid/tsconfig.build.json" }
31
32
  ]
32
33
  }