@chakra-ui/media-query
Advanced tools
Comparing version 1.0.5 to 1.0.6
# Change Log | ||
## 1.0.6 | ||
### Patch Changes | ||
- Updated dependencies | ||
[[`87cc23e14`](https://github.com/chakra-ui/chakra-ui/commit/87cc23e14814e02cbbfc9737c2356cef682ddd5d)]: | ||
- @chakra-ui/utils@1.3.0 | ||
## 1.0.5 | ||
@@ -4,0 +12,0 @@ |
@@ -9,12 +9,9 @@ "use strict"; | ||
function createMediaQueries(breakpoints) { | ||
return Object.entries(breakpoints).filter(function (_ref) { | ||
var key = _ref[0]; | ||
return (0, _utils.isCustomBreakpoint)(key); | ||
}) // sort css units in ascending order to ensure media queries are generated | ||
return Object.entries(breakpoints) // sort css units in ascending order to ensure media queries are generated | ||
// in the correct order and reference to each other correctly aswell | ||
.sort(function (a, b) { | ||
return Number.parseInt(a[1], 10) > Number.parseInt(b[1], 10) ? 1 : -1; | ||
}).map(function (_ref2, index, arr) { | ||
var breakpoint = _ref2[0], | ||
minWidth = _ref2[1]; | ||
}).map(function (_ref, index, arr) { | ||
var breakpoint = _ref[0], | ||
minWidth = _ref[1]; | ||
// given a following breakpoint | ||
@@ -21,0 +18,0 @@ var next = arr[index + 1]; // this breakpoint must end prior the threshold of the next |
@@ -29,3 +29,3 @@ "use strict"; | ||
var breakpoints = Object.keys(theme.breakpoints).filter(_utils.isCustomBreakpoint); | ||
var breakpoints = Object.keys(theme.breakpoints); | ||
var obj = (0, _utils.isArray)(values) ? (0, _utils.fromEntries)(Object.entries((0, _utils.arrayToObjectNotation)(values, breakpoints)).map(function (_ref) { | ||
@@ -32,0 +32,0 @@ var key = _ref[0], |
@@ -1,10 +0,7 @@ | ||
import { isNumber, isCustomBreakpoint } from "@chakra-ui/utils"; | ||
import { isNumber } from "@chakra-ui/utils"; | ||
export default function createMediaQueries(breakpoints) { | ||
return Object.entries(breakpoints).filter((_ref) => { | ||
var [key] = _ref; | ||
return isCustomBreakpoint(key); | ||
}) // sort css units in ascending order to ensure media queries are generated | ||
return Object.entries(breakpoints) // sort css units in ascending order to ensure media queries are generated | ||
// in the correct order and reference to each other correctly aswell | ||
.sort((a, b) => Number.parseInt(a[1], 10) > Number.parseInt(b[1], 10) ? 1 : -1).map((_ref2, index, arr) => { | ||
var [breakpoint, minWidth] = _ref2; | ||
.sort((a, b) => Number.parseInt(a[1], 10) > Number.parseInt(b[1], 10) ? 1 : -1).map((_ref, index, arr) => { | ||
var [breakpoint, minWidth] = _ref; | ||
// given a following breakpoint | ||
@@ -11,0 +8,0 @@ var next = arr[index + 1]; // this breakpoint must end prior the threshold of the next |
import { useTheme } from "@chakra-ui/system"; | ||
import { arrayToObjectNotation, fromEntries, isArray, isCustomBreakpoint } from "@chakra-ui/utils"; | ||
import { arrayToObjectNotation, fromEntries, isArray } from "@chakra-ui/utils"; | ||
import { getClosestValue } from "./media-query.utils"; | ||
@@ -21,3 +21,3 @@ import { useBreakpoint } from "./use-breakpoint"; | ||
var breakpoints = Object.keys(theme.breakpoints).filter(isCustomBreakpoint); | ||
var breakpoints = Object.keys(theme.breakpoints); | ||
var obj = isArray(values) ? fromEntries(Object.entries(arrayToObjectNotation(values, breakpoints)).map((_ref) => { | ||
@@ -24,0 +24,0 @@ var [key, value] = _ref; |
@@ -1,2 +0,3 @@ | ||
export default function createMediaQueries(breakpoints: string[]): MediaQuery[]; | ||
import { Dict } from "@chakra-ui/utils"; | ||
export default function createMediaQueries(breakpoints: Dict): MediaQuery[]; | ||
interface MediaQuery { | ||
@@ -3,0 +4,0 @@ breakpoint: string; |
{ | ||
"name": "@chakra-ui/media-query", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A React hook for changing properties or visibility of a component based on css media query", | ||
@@ -55,7 +55,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@chakra-ui/utils": "1.2.0" | ||
"@chakra-ui/utils": "1.3.0" | ||
}, | ||
"devDependencies": { | ||
"@chakra-ui/system": "1.3.0", | ||
"@chakra-ui/test-utils": "1.0.15", | ||
"@chakra-ui/system": "1.4.0", | ||
"@chakra-ui/test-utils": "1.0.18", | ||
"@chakra-ui/theme": "*", | ||
@@ -62,0 +62,0 @@ "jest-matchmedia-mock": "^1.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81354
750
+ Added@chakra-ui/utils@1.3.0(transitive)
- Removed@chakra-ui/utils@1.2.0(transitive)
Updated@chakra-ui/utils@1.3.0