@instructure/ui-options 8.14.1-snapshot.63 → 8.14.1-snapshot.66

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.
@@ -25,7 +25,7 @@ var _dec, _dec2, _class, _class2, _temp;
25
25
  */
26
26
 
27
27
  /** @jsx jsx */
28
- import { Component, Children } from 'react';
28
+ import React, { Component, Children } from 'react';
29
29
  import { omitProps, matchComponentTypes, callRenderProp, safeCloneElement } from '@instructure/ui-react-utils';
30
30
  import { testable } from '@instructure/ui-testable';
31
31
  import { uid } from '@instructure/uid';
@@ -36,13 +36,13 @@ import generateComponentTheme from './theme';
36
36
  import { Item } from './Item';
37
37
  import { Separator } from './Separator';
38
38
  import { allowedProps, propTypes } from './props';
39
+
39
40
  /**
40
41
  ---
41
42
  category: components
42
43
  ---
43
44
  @tsProps
44
45
  **/
45
-
46
46
  let Options = (_dec = withStyle(generateStyles, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Options extends Component {
47
47
  constructor() {
48
48
  super(...arguments);
@@ -89,13 +89,13 @@ let Options = (_dec = withStyle(generateStyles, generateComponentTheme), _dec2 =
89
89
  }, callRenderProp(renderLabel));
90
90
  }
91
91
 
92
- renderSubList(children) {
92
+ renderSubList(subOptions) {
93
93
  const styles = this.props.styles;
94
94
  return jsx(Item, {
95
95
  as: this.childAs,
96
96
  role: "presentation",
97
97
  css: styles === null || styles === void 0 ? void 0 : styles.label
98
- }, children);
98
+ }, subOptions);
99
99
  }
100
100
 
101
101
  renderChildren() {
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -7,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
7
9
  });
8
10
  exports.default = exports.Options = void 0;
9
11
 
10
- var _react = require("react");
12
+ var _react = _interopRequireWildcard(require("react"));
11
13
 
12
14
  var _uiReactUtils = require("@instructure/ui-react-utils");
13
15
 
@@ -83,13 +85,13 @@ let Options = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
83
85
  }, (0, _uiReactUtils.callRenderProp)(renderLabel));
84
86
  }
85
87
 
86
- renderSubList(children) {
88
+ renderSubList(subOptions) {
87
89
  const styles = this.props.styles;
88
90
  return (0, _emotion.jsx)(_Item.Item, {
89
91
  as: this.childAs,
90
92
  role: "presentation",
91
93
  css: styles === null || styles === void 0 ? void 0 : styles.label
92
- }, children);
94
+ }, subOptions);
93
95
  }
94
96
 
95
97
  renderChildren() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-options",
3
- "version": "8.14.1-snapshot.63+2acf47d5b",
3
+ "version": "8.14.1-snapshot.66+ff0decd44",
4
4
  "description": "A view-only component for composing interactive lists and menus.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -24,22 +24,22 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.14.1-snapshot.63+2acf47d5b",
28
- "@instructure/ui-color-utils": "8.14.1-snapshot.63+2acf47d5b",
29
- "@instructure/ui-test-locator": "8.14.1-snapshot.63+2acf47d5b",
30
- "@instructure/ui-test-utils": "8.14.1-snapshot.63+2acf47d5b",
31
- "@instructure/ui-themes": "8.14.1-snapshot.63+2acf47d5b"
27
+ "@instructure/ui-babel-preset": "8.14.1-snapshot.66+ff0decd44",
28
+ "@instructure/ui-color-utils": "8.14.1-snapshot.66+ff0decd44",
29
+ "@instructure/ui-test-locator": "8.14.1-snapshot.66+ff0decd44",
30
+ "@instructure/ui-test-utils": "8.14.1-snapshot.66+ff0decd44",
31
+ "@instructure/ui-themes": "8.14.1-snapshot.66+ff0decd44"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.13.10",
35
- "@instructure/emotion": "8.14.1-snapshot.63+2acf47d5b",
36
- "@instructure/shared-types": "8.14.1-snapshot.63+2acf47d5b",
37
- "@instructure/ui-icons": "8.14.1-snapshot.63+2acf47d5b",
38
- "@instructure/ui-prop-types": "8.14.1-snapshot.63+2acf47d5b",
39
- "@instructure/ui-react-utils": "8.14.1-snapshot.63+2acf47d5b",
40
- "@instructure/ui-testable": "8.14.1-snapshot.63+2acf47d5b",
41
- "@instructure/ui-view": "8.14.1-snapshot.63+2acf47d5b",
42
- "@instructure/uid": "8.14.1-snapshot.63+2acf47d5b",
35
+ "@instructure/emotion": "8.14.1-snapshot.66+ff0decd44",
36
+ "@instructure/shared-types": "8.14.1-snapshot.66+ff0decd44",
37
+ "@instructure/ui-icons": "8.14.1-snapshot.66+ff0decd44",
38
+ "@instructure/ui-prop-types": "8.14.1-snapshot.66+ff0decd44",
39
+ "@instructure/ui-react-utils": "8.14.1-snapshot.66+ff0decd44",
40
+ "@instructure/ui-testable": "8.14.1-snapshot.66+ff0decd44",
41
+ "@instructure/ui-view": "8.14.1-snapshot.66+ff0decd44",
42
+ "@instructure/uid": "8.14.1-snapshot.66+ff0decd44",
43
43
  "prop-types": "^15"
44
44
  },
45
45
  "peerDependencies": {
@@ -49,5 +49,5 @@
49
49
  "access": "public"
50
50
  },
51
51
  "sideEffects": false,
52
- "gitHead": "2acf47d5bc73bd07f4f5228bdc7654a3df997d3e"
52
+ "gitHead": "ff0decd44fd390bd7f50885610373d2c9c793053"
53
53
  }
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  /** @jsx jsx */
26
- import { Component, Children, ReactElement } from 'react'
26
+ import React, { Component, Children } from 'react'
27
27
 
28
28
  import {
29
29
  omitProps,
@@ -42,10 +42,18 @@ import generateStyles from './styles'
42
42
  import generateComponentTheme from './theme'
43
43
 
44
44
  import { Item } from './Item'
45
+ import type { OptionsItemProps } from './Item/props'
45
46
  import { Separator } from './Separator'
47
+ import type { OptionsSeparatorProps } from './Separator/props'
48
+
46
49
  import type { OptionsProps } from './props'
47
50
  import { allowedProps, propTypes } from './props'
48
51
 
52
+ type ItemChild = React.ComponentElement<OptionsItemProps, Item>
53
+ type SeparatorChild = React.ComponentElement<OptionsSeparatorProps, Separator>
54
+ type OptionsChild = React.ComponentElement<OptionsProps, Options>
55
+ type OptionsChildren = (ItemChild | SeparatorChild | OptionsChild)[]
56
+
49
57
  /**
50
58
  ---
51
59
  category: components
@@ -109,11 +117,11 @@ class Options extends Component<OptionsProps> {
109
117
  )
110
118
  }
111
119
 
112
- renderSubList(children: React.ReactNode) {
120
+ renderSubList(subOptions: OptionsChild) {
113
121
  const { styles } = this.props
114
122
  return (
115
123
  <Item as={this.childAs} role="presentation" css={styles?.label}>
116
- {children}
124
+ {subOptions}
117
125
  </Item>
118
126
  )
119
127
  }
@@ -121,12 +129,12 @@ class Options extends Component<OptionsProps> {
121
129
  renderChildren() {
122
130
  const { children } = this.props
123
131
 
124
- return Children.map(children, (child) => {
125
- if (matchComponentTypes(child, ['Options'])) {
132
+ return Children.map(children as OptionsChildren, (child) => {
133
+ if (matchComponentTypes<OptionsChild>(child, ['Options'])) {
126
134
  return this.renderSubList(child)
127
135
  }
128
136
  if (matchComponentTypes(child, ['Item', 'Separator'])) {
129
- return safeCloneElement(child as ReactElement, { as: this.childAs })
137
+ return safeCloneElement(child, { as: this.childAs })
130
138
  }
131
139
  return undefined
132
140
  })