@instructure/ui-options 8.20.1-snapshot.22 → 8.20.1-snapshot.36

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.
@@ -114,6 +114,18 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
114
114
  });
115
115
  }
116
116
 
117
+ get ariaLabelledby() {
118
+ if (this.props.renderLabel) {
119
+ return this._labelId;
120
+ }
121
+
122
+ if (this.props['aria-labelledby']) {
123
+ return this.props['aria-labelledby'];
124
+ }
125
+
126
+ return void 0;
127
+ }
128
+
117
129
  render() {
118
130
  const passthroughProps = View.omitViewProps(omitProps(this.props, Options.allowedProps), Options);
119
131
  const _this$props4 = this.props,
@@ -135,7 +147,7 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
135
147
  margin: "none",
136
148
  padding: "none",
137
149
  background: "primary",
138
- "aria-labelledby": renderLabel ? this._labelId : this.props['aria-labelledby'] ? this.props['aria-labelledby'] : void 0
150
+ "aria-labelledby": this.ariaLabelledby
139
151
  }), this.renderChildren()));
140
152
  }
141
153
 
@@ -109,6 +109,18 @@ let Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emo
109
109
  });
110
110
  }
111
111
 
112
+ get ariaLabelledby() {
113
+ if (this.props.renderLabel) {
114
+ return this._labelId;
115
+ }
116
+
117
+ if (this.props['aria-labelledby']) {
118
+ return this.props['aria-labelledby'];
119
+ }
120
+
121
+ return void 0;
122
+ }
123
+
112
124
  render() {
113
125
  const passthroughProps = _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Options.allowedProps), Options);
114
126
 
@@ -131,7 +143,7 @@ let Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emo
131
143
  margin: "none",
132
144
  padding: "none",
133
145
  background: "primary",
134
- "aria-labelledby": renderLabel ? this._labelId : this.props['aria-labelledby'] ? this.props['aria-labelledby'] : void 0
146
+ "aria-labelledby": this.ariaLabelledby
135
147
  }), this.renderChildren()));
136
148
  }
137
149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-options",
3
- "version": "8.20.1-snapshot.22+a60e3a0da",
3
+ "version": "8.20.1-snapshot.36+09110e7be",
4
4
  "description": "A view-only component for composing interactive lists and menus.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,21 +23,21 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.20.1-snapshot.22+a60e3a0da",
27
- "@instructure/ui-color-utils": "8.20.1-snapshot.22+a60e3a0da",
28
- "@instructure/ui-test-locator": "8.20.1-snapshot.22+a60e3a0da",
29
- "@instructure/ui-test-utils": "8.20.1-snapshot.22+a60e3a0da",
30
- "@instructure/ui-themes": "8.20.1-snapshot.22+a60e3a0da"
26
+ "@instructure/ui-babel-preset": "8.20.1-snapshot.36+09110e7be",
27
+ "@instructure/ui-color-utils": "8.20.1-snapshot.36+09110e7be",
28
+ "@instructure/ui-test-locator": "8.20.1-snapshot.36+09110e7be",
29
+ "@instructure/ui-test-utils": "8.20.1-snapshot.36+09110e7be",
30
+ "@instructure/ui-themes": "8.20.1-snapshot.36+09110e7be"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/emotion": "8.20.1-snapshot.22+a60e3a0da",
35
- "@instructure/shared-types": "8.20.1-snapshot.22+a60e3a0da",
36
- "@instructure/ui-icons": "8.20.1-snapshot.22+a60e3a0da",
37
- "@instructure/ui-prop-types": "8.20.1-snapshot.22+a60e3a0da",
38
- "@instructure/ui-react-utils": "8.20.1-snapshot.22+a60e3a0da",
39
- "@instructure/ui-testable": "8.20.1-snapshot.22+a60e3a0da",
40
- "@instructure/ui-view": "8.20.1-snapshot.22+a60e3a0da",
34
+ "@instructure/emotion": "8.20.1-snapshot.36+09110e7be",
35
+ "@instructure/shared-types": "8.20.1-snapshot.36+09110e7be",
36
+ "@instructure/ui-icons": "8.20.1-snapshot.36+09110e7be",
37
+ "@instructure/ui-prop-types": "8.20.1-snapshot.36+09110e7be",
38
+ "@instructure/ui-react-utils": "8.20.1-snapshot.36+09110e7be",
39
+ "@instructure/ui-testable": "8.20.1-snapshot.36+09110e7be",
40
+ "@instructure/ui-view": "8.20.1-snapshot.36+09110e7be",
41
41
  "prop-types": "^15"
42
42
  },
43
43
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "sideEffects": false,
50
- "gitHead": "a60e3a0daf7729db909fd87efbbd58dd4ac0834c"
50
+ "gitHead": "09110e7bec04cb68273f80dbd601915366f7af50"
51
51
  }
@@ -140,6 +140,18 @@ class Options extends Component<OptionsProps> {
140
140
  })
141
141
  }
142
142
 
143
+ get ariaLabelledby() {
144
+ if (this.props.renderLabel) {
145
+ return this._labelId
146
+ }
147
+
148
+ if (this.props['aria-labelledby']) {
149
+ return this.props['aria-labelledby']
150
+ }
151
+
152
+ return undefined
153
+ }
154
+
143
155
  render() {
144
156
  const passthroughProps = View.omitViewProps(
145
157
  omitProps(this.props, Options.allowedProps),
@@ -161,13 +173,7 @@ class Options extends Component<OptionsProps> {
161
173
  margin="none"
162
174
  padding="none"
163
175
  background="primary"
164
- aria-labelledby={
165
- renderLabel
166
- ? this._labelId
167
- : this.props['aria-labelledby']
168
- ? this.props['aria-labelledby']
169
- : undefined
170
- }
176
+ aria-labelledby={this.ariaLabelledby}
171
177
  >
172
178
  {this.renderChildren()}
173
179
  </View>
@@ -52,6 +52,7 @@ type OptionsOwnProps = {
52
52
  * Content to render as a label. Mostly for when the component is nested
53
53
  */
54
54
  renderLabel?: React.ReactNode | (() => React.ReactNode)
55
+
55
56
  //TODO children has to be typed better
56
57
  //e.g.: ChildrenPropTypes.oneOf(['Options', 'Item', 'Separator']))
57
58
  children?: React.ReactNode
@@ -63,7 +64,8 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
63
64
 
64
65
  type OptionsProps = OptionsOwnProps &
65
66
  WithStyleProps<OptionsTheme, OptionsStyle> &
66
- OtherHTMLAttributes<OptionsOwnProps> & WithDeterministicIdProps
67
+ OtherHTMLAttributes<OptionsOwnProps> &
68
+ WithDeterministicIdProps
67
69
 
68
70
  type OptionsStyle = ComponentStyle<'options' | 'list' | 'label'>
69
71