@instructure/ui-responsive 11.7.3 → 11.7.4-pr-snapshot-1781695314229

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -0
  3. package/{lib/Responsive/v1/props.js → babel.config.cjs} +12 -11
  4. package/es/Responsive/v1/index.js +5 -4
  5. package/es/exports/a.js +7 -6
  6. package/es/utils/v1/ResponsivePropTypes.js +2 -1
  7. package/es/utils/v1/addElementQueryMatchListener.js +1 -1
  8. package/es/utils/v1/addMediaQueryMatchListener.js +2 -1
  9. package/package.json +11 -16
  10. package/src/Responsive/v1/index.tsx +5 -4
  11. package/src/exports/a.ts +6 -6
  12. package/src/utils/v1/ResponsivePropTypes.ts +2 -2
  13. package/src/utils/v1/addElementQueryMatchListener.ts +2 -2
  14. package/src/utils/v1/addMediaQueryMatchListener.ts +2 -2
  15. package/src/utils/v1/jsonToMediaQuery.ts +1 -1
  16. package/src/utils/v1/parseQuery.ts +1 -1
  17. package/tsconfig.build.tsbuildinfo +1 -1
  18. package/types/Responsive/v1/index.d.ts +2 -1
  19. package/types/Responsive/v1/index.d.ts.map +1 -1
  20. package/types/exports/a.d.ts +6 -6
  21. package/types/exports/a.d.ts.map +1 -1
  22. package/types/utils/v1/ResponsivePropTypes.d.ts +1 -1
  23. package/types/utils/v1/ResponsivePropTypes.d.ts.map +1 -1
  24. package/types/utils/v1/addElementQueryMatchListener.d.ts +2 -2
  25. package/types/utils/v1/addElementQueryMatchListener.d.ts.map +1 -1
  26. package/types/utils/v1/addMediaQueryMatchListener.d.ts +1 -1
  27. package/types/utils/v1/addMediaQueryMatchListener.d.ts.map +1 -1
  28. package/types/utils/v1/jsonToMediaQuery.d.ts +1 -1
  29. package/types/utils/v1/jsonToMediaQuery.d.ts.map +1 -1
  30. package/types/utils/v1/parseQuery.d.ts +1 -1
  31. package/types/utils/v1/parseQuery.d.ts.map +1 -1
  32. package/lib/Responsive/v1/index.js +0 -167
  33. package/lib/exports/a.js +0 -47
  34. package/lib/package.json +0 -1
  35. package/lib/utils/v1/QueryType.js +0 -5
  36. package/lib/utils/v1/ResponsivePropTypes.js +0 -69
  37. package/lib/utils/v1/addElementQueryMatchListener.js +0 -166
  38. package/lib/utils/v1/addMediaQueryMatchListener.js +0 -114
  39. package/lib/utils/v1/jsonToMediaQuery.js +0 -86
  40. package/lib/utils/v1/parseQuery.js +0 -88
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- exports.parseQuery = parseQuery;
8
- var _px = require("@instructure/ui-utils/lib/px.js");
9
- /*
10
- * The MIT License (MIT)
11
- *
12
- * Copyright (c) 2015 - present Instructure, Inc.
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- * copies of the Software, and to permit persons to whom the Software is
19
- * furnished to do so, subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in all
22
- * copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- * SOFTWARE.
31
- */
32
-
33
- /**
34
- * An object consisting of query names and boolean true false if it matches
35
- */
36
-
37
- /**
38
- * ---
39
- * category: utilities/layout
40
- * ---
41
- *
42
- * Given a query and an element, return a function that takes
43
- * size as an argument and returns an object consisting of
44
- * query names and a boolean true false if it matches.
45
- * @module parseQuery
46
- * @param {Object} query - an object consisting of query names
47
- * mapped to individual queries
48
- * @param {Document | Window | Node | null} el - component or DOM node
49
- * @returns {function} takes size {width, height} as an argument
50
- * and returns an object consisting of query names and boolean
51
- * true false if it matches
52
- */
53
- function parseQuery(query, el) {
54
- const rules = {};
55
-
56
- // converting values to numerical values and adding initial values to all query keys
57
- Object.keys(query).forEach(selectorName => {
58
- const {
59
- minWidth,
60
- maxWidth,
61
- minHeight,
62
- maxHeight
63
- } = query[selectorName];
64
- rules[selectorName] = {
65
- minWidth: minWidth && (0, _px.px)(minWidth, el) || 0,
66
- maxWidth: maxWidth && (0, _px.px)(maxWidth, el) || Infinity,
67
- minHeight: minHeight && (0, _px.px)(minHeight, el) || 0,
68
- maxHeight: maxHeight && (0, _px.px)(maxHeight, el) || Infinity
69
- };
70
- });
71
- return function ({
72
- width,
73
- height
74
- }) {
75
- const selectorMap = {};
76
- Object.entries(rules).forEach(([selectorName, query]) => {
77
- const {
78
- minWidth,
79
- maxWidth,
80
- minHeight,
81
- maxHeight
82
- } = query;
83
- selectorMap[selectorName] = minWidth <= width && width <= maxWidth && minHeight <= height && height <= maxHeight;
84
- });
85
- return selectorMap;
86
- };
87
- }
88
- var _default = exports.default = parseQuery;