@instructure/ui-responsive 7.19.0 → 7.20.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.20.2](https://github.com/instructure/instructure-ui/compare/v7.20.1...v7.20.2) (2022-07-29)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-responsive
9
+
10
+ ## [7.20.1](https://github.com/instructure/instructure-ui/compare/v7.20.0...v7.20.1) (2022-07-22)
11
+
12
+ **Note:** Version bump only for package @instructure/ui-responsive
13
+
14
+ # [7.20.0](https://github.com/instructure/instructure-ui/compare/v7.19.0...v7.20.0) (2022-06-22)
15
+
16
+ ### Features
17
+
18
+ - **ui-responsive:** add `display` prop to Responsive ([36ea2e4](https://github.com/instructure/instructure-ui/commit/36ea2e4))
19
+
6
20
  # [7.19.0](https://github.com/instructure/instructure-ui/compare/v7.18.0...v7.19.0) (2022-06-03)
7
21
 
8
22
  **Note:** Version bump only for package @instructure/ui-responsive
@@ -170,6 +170,7 @@ var Responsive = /*#__PURE__*/function (_Component) {
170
170
  var _this$props2 = this.props,
171
171
  props = _this$props2.props,
172
172
  render = _this$props2.render,
173
+ display = _this$props2.display,
173
174
  children = _this$props2.children;
174
175
  var renderFunc; // Responsive needs to render once to measure the dom and obtain matches.
175
176
  // Calling the render prop on this initial render can cause visual side
@@ -181,7 +182,11 @@ var Responsive = /*#__PURE__*/function (_Component) {
181
182
  renderFunc = children || render;
182
183
  }
183
184
 
184
- return /*#__PURE__*/React.createElement("div", null, renderFunc && renderFunc(this.mergeProps(matches, props), matches));
185
+ return /*#__PURE__*/React.createElement("div", {
186
+ style: {
187
+ display: display
188
+ }
189
+ }, renderFunc && renderFunc(this.mergeProps(matches, props), matches));
185
190
  }
186
191
  }]);
187
192
 
@@ -220,13 +225,21 @@ Responsive.propTypes = {
220
225
  * Function that takes the same form and arguments as the render prop. Either this or a `render`
221
226
  * prop function must be supplied.
222
227
  */
223
- children: PropTypes.func
228
+ children: PropTypes.func,
229
+
230
+ /**
231
+ * The Responsive component is rendered as a `<div>`,
232
+ * so it has `display="block"` by default.
233
+ * You can override the display value with this prop.
234
+ */
235
+ display: PropTypes.oneOf(['inline', 'block', 'inline-block', 'flex', 'inline-flex'])
224
236
  };
225
237
  Responsive.defaultProps = {
226
238
  children: null,
227
239
  render: void 0,
228
240
  match: 'element',
229
- props: null
241
+ props: null,
242
+ display: void 0
230
243
  };
231
244
  export default Responsive;
232
245
  export { Responsive };
@@ -186,6 +186,7 @@ var Responsive = /*#__PURE__*/function (_Component) {
186
186
  var _this$props2 = this.props,
187
187
  props = _this$props2.props,
188
188
  render = _this$props2.render,
189
+ display = _this$props2.display,
189
190
  children = _this$props2.children;
190
191
  var renderFunc; // Responsive needs to render once to measure the dom and obtain matches.
191
192
  // Calling the render prop on this initial render can cause visual side
@@ -197,7 +198,11 @@ var Responsive = /*#__PURE__*/function (_Component) {
197
198
  renderFunc = children || render;
198
199
  }
199
200
 
200
- return /*#__PURE__*/_react.default.createElement("div", null, renderFunc && renderFunc(this.mergeProps(matches, props), matches));
201
+ return /*#__PURE__*/_react.default.createElement("div", {
202
+ style: {
203
+ display: display
204
+ }
205
+ }, renderFunc && renderFunc(this.mergeProps(matches, props), matches));
201
206
  }
202
207
  }]);
203
208
  Responsive.displayName = "Responsive";
@@ -236,13 +241,21 @@ Responsive.propTypes = {
236
241
  * Function that takes the same form and arguments as the render prop. Either this or a `render`
237
242
  * prop function must be supplied.
238
243
  */
239
- children: _propTypes.default.func
244
+ children: _propTypes.default.func,
245
+
246
+ /**
247
+ * The Responsive component is rendered as a `<div>`,
248
+ * so it has `display="block"` by default.
249
+ * You can override the display value with this prop.
250
+ */
251
+ display: _propTypes.default.oneOf(['inline', 'block', 'inline-block', 'flex', 'inline-flex'])
240
252
  };
241
253
  Responsive.defaultProps = {
242
254
  children: null,
243
255
  render: void 0,
244
256
  match: 'element',
245
- props: null
257
+ props: null,
258
+ display: void 0
246
259
  };
247
260
  var _default = Responsive;
248
261
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-responsive",
3
- "version": "7.19.0",
3
+ "version": "7.20.2",
4
4
  "description": "A component that allows for rendering a component differently based on either the element or the viewport size",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -23,19 +23,19 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/runtime": "^7.9.2",
26
- "@instructure/console": "^7.19.0",
27
- "@instructure/debounce": "^7.19.0",
28
- "@instructure/ui-dom-utils": "^7.19.0",
29
- "@instructure/ui-react-utils": "^7.19.0",
30
- "@instructure/ui-testable": "^7.19.0",
31
- "@instructure/ui-themeable": "^7.19.0",
32
- "@instructure/ui-utils": "^7.19.0",
26
+ "@instructure/console": "^7.20.2",
27
+ "@instructure/debounce": "^7.20.2",
28
+ "@instructure/ui-dom-utils": "^7.20.2",
29
+ "@instructure/ui-react-utils": "^7.20.2",
30
+ "@instructure/ui-testable": "^7.20.2",
31
+ "@instructure/ui-themeable": "^7.20.2",
32
+ "@instructure/ui-utils": "^7.20.2",
33
33
  "prop-types": "^15"
34
34
  },
35
35
  "devDependencies": {
36
- "@instructure/ui-babel-preset": "^7.19.0",
37
- "@instructure/ui-color-utils": "^7.19.0",
38
- "@instructure/ui-test-utils": "^7.19.0"
36
+ "@instructure/ui-babel-preset": "^7.20.2",
37
+ "@instructure/ui-color-utils": "^7.20.2",
38
+ "@instructure/ui-test-utils": "^7.20.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^16.8"
@@ -69,14 +69,27 @@ class Responsive extends Component {
69
69
  * Function that takes the same form and arguments as the render prop. Either this or a `render`
70
70
  * prop function must be supplied.
71
71
  */
72
- children: PropTypes.func
72
+ children: PropTypes.func,
73
+ /**
74
+ * The Responsive component is rendered as a `<div>`,
75
+ * so it has `display="block"` by default.
76
+ * You can override the display value with this prop.
77
+ */
78
+ display: PropTypes.oneOf([
79
+ 'inline',
80
+ 'block',
81
+ 'inline-block',
82
+ 'flex',
83
+ 'inline-flex'
84
+ ])
73
85
  }
74
86
 
75
87
  static defaultProps = {
76
88
  children: null,
77
89
  render: undefined,
78
90
  match: 'element',
79
- props: null
91
+ props: null,
92
+ display: undefined
80
93
  }
81
94
 
82
95
  _matchListener = null
@@ -182,7 +195,7 @@ class Responsive extends Component {
182
195
 
183
196
  render() {
184
197
  const { matches, hasRendered } = this.state
185
- const { props, render, children } = this.props
198
+ const { props, render, display, children } = this.props
186
199
  let renderFunc
187
200
  // Responsive needs to render once to measure the dom and obtain matches.
188
201
  // Calling the render prop on this initial render can cause visual side
@@ -193,7 +206,7 @@ class Responsive extends Component {
193
206
  renderFunc = children || render
194
207
  }
195
208
  return (
196
- <div>
209
+ <div style={{ display }}>
197
210
  {renderFunc && renderFunc(this.mergeProps(matches, props), matches)}
198
211
  </div>
199
212
  )
package/types/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import * as React from 'react';
2
2
 
3
3
  export type ResponsiveMatch = "element" | "media";
4
4
 
5
+ export type ResponsiveDisplay = "inline" | "block" | "inline-block" | "flex" | "inline-flex";
6
+
5
7
  export interface ResponsiveProps {
6
8
  /**
7
9
  * Specifies if the `<Responsive />` component should use element or media queries
@@ -30,6 +32,12 @@ export interface ResponsiveProps {
30
32
  * prop function must be supplied.
31
33
  */
32
34
  children?: (...args: any[])=>any;
35
+ /**
36
+ * The Responsive component is rendered as a `<div>`,
37
+ * so it has `display="block"` by default.
38
+ * You can override the display value with this prop.
39
+ */
40
+ display?: ResponsiveDisplay;
33
41
  }
34
42
 
35
43
  export class Responsive extends React.Component<ResponsiveProps, any> {