@instructure/ui-responsive 8.10.1 → 8.10.3-snapshot.3
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 +4 -0
- package/LICENSE.md +27 -0
- package/es/Responsive/index.js +5 -2
- package/lib/Responsive/index.js +4 -1
- package/package.json +13 -12
- package/src/Responsive/index.tsx +5 -3
- package/src/ResponsivePropTypes.ts +1 -1
- package/types/Responsive/index.d.ts +2 -1
- package/types/Responsive/index.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
## [8.10.2](https://github.com/instructure/instructure-ui/compare/v8.10.1...v8.10.2) (2021-10-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-responsive
|
|
9
|
+
|
|
6
10
|
## [8.10.1](https://github.com/instructure/instructure-ui/compare/v8.10.0...v8.10.1) (2021-10-01)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-responsive
|
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.
|
package/es/Responsive/index.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
import React, { Component } from 'react';
|
|
24
|
+
import React, { Component, createRef } from 'react';
|
|
25
25
|
import { deepEqual } from '@instructure/ui-utils';
|
|
26
26
|
import { logError as error } from '@instructure/console';
|
|
27
27
|
import { addElementQueryMatchListener, updateElementMatches } from '../addElementQueryMatchListener';
|
|
@@ -38,6 +38,7 @@ category: components
|
|
|
38
38
|
class Responsive extends Component {
|
|
39
39
|
constructor(...args) {
|
|
40
40
|
super(...args);
|
|
41
|
+
this.ref = /*#__PURE__*/createRef();
|
|
41
42
|
this._matchListener = null;
|
|
42
43
|
this.state = {
|
|
43
44
|
matches: [],
|
|
@@ -141,7 +142,9 @@ class Responsive extends Component {
|
|
|
141
142
|
renderFunc = children || render;
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
return /*#__PURE__*/React.createElement("div",
|
|
145
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
ref: this.ref
|
|
147
|
+
}, renderFunc && renderFunc(this.mergeProps(matches, props), matches));
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
}
|
package/lib/Responsive/index.js
CHANGED
|
@@ -54,6 +54,7 @@ category: components
|
|
|
54
54
|
class Responsive extends _react.Component {
|
|
55
55
|
constructor(...args) {
|
|
56
56
|
super(...args);
|
|
57
|
+
this.ref = /*#__PURE__*/(0, _react.createRef)();
|
|
57
58
|
this._matchListener = null;
|
|
58
59
|
this.state = {
|
|
59
60
|
matches: [],
|
|
@@ -157,7 +158,9 @@ class Responsive extends _react.Component {
|
|
|
157
158
|
renderFunc = children || render;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
return /*#__PURE__*/_react.default.createElement("div",
|
|
161
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
162
|
+
ref: this.ref
|
|
163
|
+
}, renderFunc && renderFunc(this.mergeProps(matches, props), matches));
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-responsive",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.3-snapshot.3+2ee813492",
|
|
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",
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.10.
|
|
29
|
-
"@instructure/debounce": "8.10.
|
|
30
|
-
"@instructure/shared-types": "8.10.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.10.
|
|
32
|
-
"@instructure/ui-react-utils": "8.10.
|
|
33
|
-
"@instructure/ui-testable": "8.10.
|
|
34
|
-
"@instructure/ui-utils": "8.10.
|
|
28
|
+
"@instructure/console": "8.10.3-snapshot.3+2ee813492",
|
|
29
|
+
"@instructure/debounce": "8.10.3-snapshot.3+2ee813492",
|
|
30
|
+
"@instructure/shared-types": "8.10.3-snapshot.3+2ee813492",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.10.3-snapshot.3+2ee813492",
|
|
32
|
+
"@instructure/ui-react-utils": "8.10.3-snapshot.3+2ee813492",
|
|
33
|
+
"@instructure/ui-testable": "8.10.3-snapshot.3+2ee813492",
|
|
34
|
+
"@instructure/ui-utils": "8.10.3-snapshot.3+2ee813492",
|
|
35
35
|
"prop-types": "^15"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@instructure/ui-babel-preset": "8.10.
|
|
39
|
-
"@instructure/ui-color-utils": "8.10.
|
|
40
|
-
"@instructure/ui-test-utils": "8.10.
|
|
38
|
+
"@instructure/ui-babel-preset": "8.10.3-snapshot.3+2ee813492",
|
|
39
|
+
"@instructure/ui-color-utils": "8.10.3-snapshot.3+2ee813492",
|
|
40
|
+
"@instructure/ui-test-utils": "8.10.3-snapshot.3+2ee813492"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.8 <=17"
|
|
@@ -45,5 +45,6 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"sideEffects": false
|
|
48
|
+
"sideEffects": false,
|
|
49
|
+
"gitHead": "2ee8134925b02efbc5d39662a8b1edb2c83a420d"
|
|
49
50
|
}
|
package/src/Responsive/index.tsx
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import React, { Component } from 'react'
|
|
25
|
+
import React, { Component, createRef } from 'react'
|
|
26
26
|
|
|
27
27
|
import { deepEqual } from '@instructure/ui-utils'
|
|
28
28
|
import { logError as error } from '@instructure/console'
|
|
@@ -56,7 +56,7 @@ class Responsive extends Component<ResponsiveProps> {
|
|
|
56
56
|
match: 'element',
|
|
57
57
|
props: null
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
ref = createRef<HTMLDivElement>()
|
|
60
60
|
_matchListener: { remove(): void } | null = null
|
|
61
61
|
|
|
62
62
|
state: { matches: QueriesMatching; hasRendered: boolean } = {
|
|
@@ -116,6 +116,7 @@ class Responsive extends Component<ResponsiveProps> {
|
|
|
116
116
|
match === 'element'
|
|
117
117
|
? addElementQueryMatchListener
|
|
118
118
|
: addMediaQueryMatchListener
|
|
119
|
+
|
|
119
120
|
return matchListener(query, () => findDOMNode(this) as Node, updateMatches)
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -177,8 +178,9 @@ class Responsive extends Component<ResponsiveProps> {
|
|
|
177
178
|
// both are supplied, give preference to children.
|
|
178
179
|
renderFunc = children || render
|
|
179
180
|
}
|
|
181
|
+
|
|
180
182
|
return (
|
|
181
|
-
<div>
|
|
183
|
+
<div ref={this.ref}>
|
|
182
184
|
{renderFunc && renderFunc(this.mergeProps(matches, props), matches)}
|
|
183
185
|
</div>
|
|
184
186
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
2
|
import { BreakpointQueries, QueriesMatching, UpdateMatches } from '../QueryType';
|
|
3
3
|
import type { ResponsiveByBreakpointProps, ResponsiveProps, ResponsivePropsObject } from './props';
|
|
4
4
|
/**
|
|
@@ -27,6 +27,7 @@ declare class Responsive extends Component<ResponsiveProps> {
|
|
|
27
27
|
match: string;
|
|
28
28
|
props: null;
|
|
29
29
|
};
|
|
30
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
30
31
|
_matchListener: {
|
|
31
32
|
remove(): void;
|
|
32
33
|
} | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Responsive/index.tsx"],"names":[],"mappings":"AAwBA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Responsive/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAUnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEhF,OAAO,KAAK,EACV,2BAA2B,EAC3B,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB;;;;;GAKG;AACH,cAAM,UAAW,SAAQ,SAAS,CAAC,eAAe,CAAC;IACjD,MAAM,CAAC,YAAY;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;MAIlB;IACD,GAAG,kCAA8B;IACjC,cAAc,EAAE;QAAE,MAAM,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAO;IAEhD,KAAK,EAAE;QAAE,OAAO,EAAE,eAAe,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAGxD;IAED,iBAAiB;IA0BjB,oBAAoB;IAIpB,kBAAkB,CAAC,SAAS,EAAE,eAAe;IAa7C,gBAAgB,CACd,KAAK,EAAE,iBAAiB,EACxB,aAAa,EAAE,aAAa,EAC5B,KAAK,kCAAmB;;;IAU1B,mBAAmB;IAMnB,aAAa,EAAE,aAAa,CAM3B;IAED,UAAU,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,2BAA2B;IAgCxE,MAAM;CAmBP;AAED,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
|