@instructure/ui-responsive 8.12.1-snapshot.7 → 8.13.0
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/es/Responsive/index.js +4 -3
- package/es/addElementQueryMatchListener.js +3 -1
- package/es/addMediaQueryMatchListener.js +2 -1
- package/es/parseQuery.js +10 -5
- package/lib/Responsive/index.js +5 -4
- package/lib/Responsive/props.js +1 -1
- package/lib/ResponsivePropTypes.js +1 -1
- package/lib/addElementQueryMatchListener.js +4 -2
- package/lib/addMediaQueryMatchListener.js +3 -2
- package/lib/index.js +8 -8
- package/lib/jsonToMediaQuery.js +1 -1
- package/lib/parseQuery.js +13 -6
- package/package.json +12 -13
- package/LICENSE.md +0 -27
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.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-responsive
|
|
9
|
+
|
|
6
10
|
# [8.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-responsive
|
package/es/Responsive/index.js
CHANGED
|
@@ -36,8 +36,8 @@ category: components
|
|
|
36
36
|
**/
|
|
37
37
|
|
|
38
38
|
class Responsive extends Component {
|
|
39
|
-
constructor(
|
|
40
|
-
super(...
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
41
|
this.ref = /*#__PURE__*/createRef();
|
|
42
42
|
this._matchListener = null;
|
|
43
43
|
this.state = {
|
|
@@ -92,7 +92,8 @@ class Responsive extends Component {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
addMatchListener(query, updateMatches
|
|
95
|
+
addMatchListener(query, updateMatches) {
|
|
96
|
+
let match = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.props.match;
|
|
96
97
|
const matchListener = match === 'element' ? addElementQueryMatchListener : addMediaQueryMatchListener;
|
|
97
98
|
return matchListener(query, () => findDOMNode(this), updateMatches);
|
|
98
99
|
}
|
|
@@ -137,7 +137,9 @@ const addElementQueryMatchListener = (query, el, cb) => {
|
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
function updateElementMatches(query, el
|
|
140
|
+
function updateElementMatches(query, el) {
|
|
141
|
+
let matches = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
142
|
+
let size = arguments.length > 3 ? arguments[3] : void 0;
|
|
141
143
|
const node = findDOMNode(el);
|
|
142
144
|
|
|
143
145
|
const _ref = size || getBoundingClientRect(node),
|
|
@@ -76,7 +76,8 @@ import { jsonToMediaQuery } from './jsonToMediaQuery';
|
|
|
76
76
|
* @returns {function} remove() function to call to remove the listener
|
|
77
77
|
*/
|
|
78
78
|
|
|
79
|
-
const addMediaQueryMatchListener = (query, el, cb
|
|
79
|
+
const addMediaQueryMatchListener = function (query, el, cb) {
|
|
80
|
+
let matchMedia = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : defaultMatchMedia;
|
|
80
81
|
const node = typeof el === 'function' ? el() : el;
|
|
81
82
|
|
|
82
83
|
const updateMediaMatches = mediaQueryLists => {
|
package/es/parseQuery.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* The MIT License (MIT)
|
|
3
5
|
*
|
|
@@ -55,12 +57,15 @@ function parseQuery(query, el) {
|
|
|
55
57
|
maxHeight: maxHeight && px(maxHeight, el) || Infinity
|
|
56
58
|
};
|
|
57
59
|
});
|
|
58
|
-
return function ({
|
|
59
|
-
width,
|
|
60
|
-
|
|
61
|
-
}) {
|
|
60
|
+
return function (_ref) {
|
|
61
|
+
let width = _ref.width,
|
|
62
|
+
height = _ref.height;
|
|
62
63
|
const selectorMap = {};
|
|
63
|
-
Object.entries(rules).forEach(
|
|
64
|
+
Object.entries(rules).forEach(_ref2 => {
|
|
65
|
+
let _ref3 = _slicedToArray(_ref2, 2),
|
|
66
|
+
selectorName = _ref3[0],
|
|
67
|
+
query = _ref3[1];
|
|
68
|
+
|
|
64
69
|
const minWidth = query.minWidth,
|
|
65
70
|
maxWidth = query.maxWidth,
|
|
66
71
|
minHeight = query.minHeight,
|
package/lib/Responsive/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.default = exports.Responsive = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -52,8 +52,8 @@ category: components
|
|
|
52
52
|
@tsProps
|
|
53
53
|
**/
|
|
54
54
|
class Responsive extends _react.Component {
|
|
55
|
-
constructor(
|
|
56
|
-
super(...
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
57
|
this.ref = /*#__PURE__*/(0, _react.createRef)();
|
|
58
58
|
this._matchListener = null;
|
|
59
59
|
this.state = {
|
|
@@ -108,7 +108,8 @@ class Responsive extends _react.Component {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
addMatchListener(query, updateMatches
|
|
111
|
+
addMatchListener(query, updateMatches) {
|
|
112
|
+
let match = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.props.match;
|
|
112
113
|
const matchListener = match === 'element' ? _addElementQueryMatchListener.addElementQueryMatchListener : _addMediaQueryMatchListener.addMediaQueryMatchListener;
|
|
113
114
|
return matchListener(query, () => (0, _findDOMNode.findDOMNode)(this), updateMatches);
|
|
114
115
|
}
|
package/lib/Responsive/props.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = exports.addElementQueryMatchListener = void 0;
|
|
6
7
|
exports.updateElementMatches = updateElementMatches;
|
|
7
|
-
exports.addElementQueryMatchListener = exports.default = void 0;
|
|
8
8
|
|
|
9
9
|
var _parseQuery = require("./parseQuery");
|
|
10
10
|
|
|
@@ -152,7 +152,9 @@ const addElementQueryMatchListener = (query, el, cb) => {
|
|
|
152
152
|
|
|
153
153
|
exports.addElementQueryMatchListener = addElementQueryMatchListener;
|
|
154
154
|
|
|
155
|
-
function updateElementMatches(query, el
|
|
155
|
+
function updateElementMatches(query, el) {
|
|
156
|
+
let matches = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
157
|
+
let size = arguments.length > 3 ? arguments[3] : void 0;
|
|
156
158
|
const node = (0, _findDOMNode.findDOMNode)(el);
|
|
157
159
|
|
|
158
160
|
const _ref = size || (0, _getBoundingClientRect.getBoundingClientRect)(node),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.addMediaQueryMatchListener = void 0;
|
|
7
7
|
|
|
8
8
|
var _matchMedia = require("@instructure/ui-dom-utils/lib/matchMedia.js");
|
|
9
9
|
|
|
@@ -85,7 +85,8 @@ var _jsonToMediaQuery = require("./jsonToMediaQuery");
|
|
|
85
85
|
* @param {object} matchMedia - called with an array of the names of the currently matching queries whenever a matching query changes
|
|
86
86
|
* @returns {function} remove() function to call to remove the listener
|
|
87
87
|
*/
|
|
88
|
-
const addMediaQueryMatchListener = (query, el, cb
|
|
88
|
+
const addMediaQueryMatchListener = function (query, el, cb) {
|
|
89
|
+
let matchMedia = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : _matchMedia.matchMedia;
|
|
89
90
|
const node = typeof el === 'function' ? el() : el;
|
|
90
91
|
|
|
91
92
|
const updateMediaMatches = mediaQueryLists => {
|
package/lib/index.js
CHANGED
|
@@ -9,22 +9,22 @@ Object.defineProperty(exports, "Responsive", {
|
|
|
9
9
|
return _Responsive.Responsive;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "ResponsivePropTypes", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _ResponsivePropTypes.ResponsivePropTypes;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "addElementQueryMatchListener", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _addElementQueryMatchListener.addElementQueryMatchListener;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "addMediaQueryMatchListener", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return
|
|
27
|
+
return _addMediaQueryMatchListener.addMediaQueryMatchListener;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "jsonToMediaQuery", {
|
|
@@ -33,10 +33,10 @@ Object.defineProperty(exports, "jsonToMediaQuery", {
|
|
|
33
33
|
return _jsonToMediaQuery.jsonToMediaQuery;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "parseQuery", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function () {
|
|
39
|
-
return
|
|
39
|
+
return _parseQuery.parseQuery;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
package/lib/jsonToMediaQuery.js
CHANGED
package/lib/parseQuery.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.parseQuery = parseQuery;
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
exports.parseQuery = parseQuery;
|
|
10
|
+
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
12
|
|
|
9
13
|
var _px = require("@instructure/ui-utils/lib/px.js");
|
|
10
14
|
|
|
@@ -64,12 +68,15 @@ function parseQuery(query, el) {
|
|
|
64
68
|
maxHeight: maxHeight && (0, _px.px)(maxHeight, el) || Infinity
|
|
65
69
|
};
|
|
66
70
|
});
|
|
67
|
-
return function ({
|
|
68
|
-
width,
|
|
69
|
-
|
|
70
|
-
}) {
|
|
71
|
+
return function (_ref) {
|
|
72
|
+
let width = _ref.width,
|
|
73
|
+
height = _ref.height;
|
|
71
74
|
const selectorMap = {};
|
|
72
|
-
Object.entries(rules).forEach(
|
|
75
|
+
Object.entries(rules).forEach(_ref2 => {
|
|
76
|
+
let _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
77
|
+
selectorName = _ref3[0],
|
|
78
|
+
query = _ref3[1];
|
|
79
|
+
|
|
73
80
|
const minWidth = query.minWidth,
|
|
74
81
|
maxWidth = query.maxWidth,
|
|
75
82
|
minHeight = query.minHeight,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-responsive",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.0",
|
|
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.
|
|
29
|
-
"@instructure/debounce": "8.
|
|
30
|
-
"@instructure/shared-types": "8.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.
|
|
32
|
-
"@instructure/ui-react-utils": "8.
|
|
33
|
-
"@instructure/ui-testable": "8.
|
|
34
|
-
"@instructure/ui-utils": "8.
|
|
28
|
+
"@instructure/console": "8.13.0",
|
|
29
|
+
"@instructure/debounce": "8.13.0",
|
|
30
|
+
"@instructure/shared-types": "8.13.0",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.13.0",
|
|
32
|
+
"@instructure/ui-react-utils": "8.13.0",
|
|
33
|
+
"@instructure/ui-testable": "8.13.0",
|
|
34
|
+
"@instructure/ui-utils": "8.13.0",
|
|
35
35
|
"prop-types": "^15"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@instructure/ui-babel-preset": "8.
|
|
39
|
-
"@instructure/ui-color-utils": "8.
|
|
40
|
-
"@instructure/ui-test-utils": "8.
|
|
38
|
+
"@instructure/ui-babel-preset": "8.13.0",
|
|
39
|
+
"@instructure/ui-color-utils": "8.13.0",
|
|
40
|
+
"@instructure/ui-test-utils": "8.13.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.8 <=17"
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"sideEffects": false
|
|
49
|
-
"gitHead": "1e7ac821932a91fe9ef761c96f747c7ea1f3925a"
|
|
48
|
+
"sideEffects": false
|
|
50
49
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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.
|