@instructure/ui-simple-select 8.22.1-snapshot.21 → 8.22.1-snapshot.24

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.
@@ -50,10 +50,11 @@ let SimpleSelect = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_clas
50
50
  this._emptyOptionId = void 0;
51
51
 
52
52
  this.getOption = (field, value) => {
53
+ const children = Children.toArray(this.props.children);
53
54
  let match;
54
55
 
55
- for (let i = 0; i < this.childrenArray.length; ++i) {
56
- const child = this.childrenArray[i];
56
+ for (let i = 0; i < children.length; ++i) {
57
+ const child = children[i];
57
58
 
58
59
  if (matchComponentTypes(child, [Option])) {
59
60
  if (child.props[field] === value) {
@@ -184,10 +185,6 @@ let SimpleSelect = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_clas
184
185
  return this.ref;
185
186
  }
186
187
 
187
- get childrenArray() {
188
- return Children.toArray(this.props.children);
189
- }
190
-
191
188
  focus() {
192
189
  this.ref && this.ref.focus();
193
190
  }
@@ -246,10 +243,11 @@ let SimpleSelect = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_clas
246
243
  }
247
244
 
248
245
  getFirstOption() {
246
+ const children = Children.toArray(this.props.children);
249
247
  let match;
250
248
 
251
- for (let i = 0; i < this.childrenArray.length; i++) {
252
- const child = this.childrenArray[i];
249
+ for (let i = 0; i < children.length; i++) {
250
+ const child = children[i];
253
251
 
254
252
  if (matchComponentTypes(child, [Option])) {
255
253
  match = child;
@@ -267,7 +265,8 @@ let SimpleSelect = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_clas
267
265
  }
268
266
 
269
267
  renderChildren() {
270
- const children = Children.map(this.childrenArray, child => {
268
+ let children = Children.toArray(this.props.children);
269
+ children = Children.map(children, child => {
271
270
  if (matchComponentTypes(child, [Option])) {
272
271
  return this.renderOption(child);
273
272
  } else if (matchComponentTypes(child, [Group])) {
@@ -53,10 +53,12 @@ let SimpleSelect = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec
53
53
  this._emptyOptionId = void 0;
54
54
 
55
55
  this.getOption = (field, value) => {
56
+ const children = _react.Children.toArray(this.props.children);
57
+
56
58
  let match;
57
59
 
58
- for (let i = 0; i < this.childrenArray.length; ++i) {
59
- const child = this.childrenArray[i];
60
+ for (let i = 0; i < children.length; ++i) {
61
+ const child = children[i];
60
62
 
61
63
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Option.Option])) {
62
64
  if (child.props[field] === value) {
@@ -187,10 +189,6 @@ let SimpleSelect = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec
187
189
  return this.ref;
188
190
  }
189
191
 
190
- get childrenArray() {
191
- return _react.Children.toArray(this.props.children);
192
- }
193
-
194
192
  focus() {
195
193
  this.ref && this.ref.focus();
196
194
  }
@@ -249,10 +247,12 @@ let SimpleSelect = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec
249
247
  }
250
248
 
251
249
  getFirstOption() {
250
+ const children = _react.Children.toArray(this.props.children);
251
+
252
252
  let match;
253
253
 
254
- for (let i = 0; i < this.childrenArray.length; i++) {
255
- const child = this.childrenArray[i];
254
+ for (let i = 0; i < children.length; i++) {
255
+ const child = children[i];
256
256
 
257
257
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Option.Option])) {
258
258
  match = child;
@@ -270,7 +270,9 @@ let SimpleSelect = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec
270
270
  }
271
271
 
272
272
  renderChildren() {
273
- const children = _react.Children.map(this.childrenArray, child => {
273
+ let children = _react.Children.toArray(this.props.children);
274
+
275
+ children = _react.Children.map(children, child => {
274
276
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Option.Option])) {
275
277
  return this.renderOption(child);
276
278
  } else if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Group.Group])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-simple-select",
3
- "version": "8.22.1-snapshot.21+7bdf07c83",
3
+ "version": "8.22.1-snapshot.24+e5a2b72a6",
4
4
  "description": "A component for standard select element behavior.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,22 +24,22 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.13.10",
27
- "@instructure/console": "8.22.1-snapshot.21+7bdf07c83",
28
- "@instructure/shared-types": "8.22.1-snapshot.21+7bdf07c83",
29
- "@instructure/ui-form-field": "8.22.1-snapshot.21+7bdf07c83",
30
- "@instructure/ui-position": "8.22.1-snapshot.21+7bdf07c83",
31
- "@instructure/ui-prop-types": "8.22.1-snapshot.21+7bdf07c83",
32
- "@instructure/ui-react-utils": "8.22.1-snapshot.21+7bdf07c83",
33
- "@instructure/ui-select": "8.22.1-snapshot.21+7bdf07c83",
34
- "@instructure/ui-testable": "8.22.1-snapshot.21+7bdf07c83",
27
+ "@instructure/console": "8.22.1-snapshot.24+e5a2b72a6",
28
+ "@instructure/shared-types": "8.22.1-snapshot.24+e5a2b72a6",
29
+ "@instructure/ui-form-field": "8.22.1-snapshot.24+e5a2b72a6",
30
+ "@instructure/ui-position": "8.22.1-snapshot.24+e5a2b72a6",
31
+ "@instructure/ui-prop-types": "8.22.1-snapshot.24+e5a2b72a6",
32
+ "@instructure/ui-react-utils": "8.22.1-snapshot.24+e5a2b72a6",
33
+ "@instructure/ui-select": "8.22.1-snapshot.24+e5a2b72a6",
34
+ "@instructure/ui-testable": "8.22.1-snapshot.24+e5a2b72a6",
35
35
  "prop-types": "^15"
36
36
  },
37
37
  "devDependencies": {
38
- "@instructure/ui-babel-preset": "8.22.1-snapshot.21+7bdf07c83",
39
- "@instructure/ui-color-utils": "8.22.1-snapshot.21+7bdf07c83",
40
- "@instructure/ui-icons": "8.22.1-snapshot.21+7bdf07c83",
41
- "@instructure/ui-test-locator": "8.22.1-snapshot.21+7bdf07c83",
42
- "@instructure/ui-test-utils": "8.22.1-snapshot.21+7bdf07c83"
38
+ "@instructure/ui-babel-preset": "8.22.1-snapshot.24+e5a2b72a6",
39
+ "@instructure/ui-color-utils": "8.22.1-snapshot.24+e5a2b72a6",
40
+ "@instructure/ui-icons": "8.22.1-snapshot.24+e5a2b72a6",
41
+ "@instructure/ui-test-locator": "8.22.1-snapshot.24+e5a2b72a6",
42
+ "@instructure/ui-test-utils": "8.22.1-snapshot.24+e5a2b72a6"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8 <=17"
@@ -48,5 +48,5 @@
48
48
  "access": "public"
49
49
  },
50
50
  "sideEffects": false,
51
- "gitHead": "7bdf07c834ffb614098415cbe0e3df6c0f6efdfb"
51
+ "gitHead": "e5a2b72a61a761440403c8c6d15fce852b59854c"
52
52
  }
@@ -111,12 +111,6 @@ class SimpleSelect extends Component<SimpleSelectProps, SimpleSelectState> {
111
111
  return this.ref
112
112
  }
113
113
 
114
- get childrenArray() {
115
- return Children.toArray(this.props.children) as Array<
116
- OptionChild | GroupChild
117
- >
118
- }
119
-
120
114
  focus() {
121
115
  this.ref && this.ref.focus()
122
116
  }
@@ -169,10 +163,14 @@ class SimpleSelect extends Component<SimpleSelectProps, SimpleSelectState> {
169
163
  }
170
164
 
171
165
  getFirstOption() {
166
+ const children = Children.toArray(this.props.children) as (
167
+ | OptionChild
168
+ | GroupChild
169
+ )[]
172
170
  let match: OptionChild | undefined
173
171
 
174
- for (let i = 0; i < this.childrenArray.length; i++) {
175
- const child = this.childrenArray[i]
172
+ for (let i = 0; i < children.length; i++) {
173
+ const child = children[i]
176
174
  if (matchComponentTypes<OptionChild>(child, [Option])) {
177
175
  match = child
178
176
  } else if (matchComponentTypes<GroupChild>(child, [Group])) {
@@ -187,10 +185,14 @@ class SimpleSelect extends Component<SimpleSelectProps, SimpleSelectState> {
187
185
  }
188
186
 
189
187
  getOption: GetOption = (field, value) => {
188
+ const children = Children.toArray(this.props.children) as (
189
+ | OptionChild
190
+ | GroupChild
191
+ )[]
190
192
  let match: OptionChild | undefined
191
193
 
192
- for (let i = 0; i < this.childrenArray.length; ++i) {
193
- const child = this.childrenArray[i]
194
+ for (let i = 0; i < children.length; ++i) {
195
+ const child = children[i]
194
196
  if (matchComponentTypes<OptionChild>(child, [Option])) {
195
197
  if (child.props[field] === value) {
196
198
  match = child
@@ -293,7 +295,11 @@ class SimpleSelect extends Component<SimpleSelectProps, SimpleSelectState> {
293
295
  }
294
296
 
295
297
  renderChildren() {
296
- const children = Children.map(this.childrenArray, (child) => {
298
+ let children = Children.toArray(this.props.children) as (
299
+ | OptionChild
300
+ | GroupChild
301
+ )[]
302
+ children = Children.map(children, (child) => {
297
303
  if (matchComponentTypes<OptionChild>(child, [Option])) {
298
304
  return this.renderOption(child)
299
305
  } else if (matchComponentTypes<GroupChild>(child, [Group])) {