@gympass/yoga-helpers
Advanced tools
Comparing version 1.1.0 to 1.1.1
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -20,10 +18,2 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -35,8 +25,7 @@ var hide_exports = {}; | ||
module.exports = __toCommonJS(hide_exports); | ||
var import_yoga_tokens = __toESM(require("@gympass/yoga-tokens")); | ||
var import_yoga_tokens = require("@gympass/yoga-tokens"); | ||
var import_styled_components = require("styled-components"); | ||
var import_media = require("./media"); | ||
const { breakpoints } = import_yoga_tokens.default; | ||
const availableBreakpoints = Object.entries( | ||
breakpoints | ||
import_yoga_tokens.breakpoints | ||
); | ||
@@ -43,0 +32,0 @@ const hide = (isNot = false) => availableBreakpoints.reduce((acc, [key, breakpoint], index) => { |
@@ -36,7 +36,6 @@ "use strict"; | ||
module.exports = __toCommonJS(media_exports); | ||
var import_yoga_tokens = __toESM(require("@gympass/yoga-tokens")); | ||
var import_yoga_tokens = require("@gympass/yoga-tokens"); | ||
var import_styled_components = require("styled-components"); | ||
var import_hide = __toESM(require("./hide")); | ||
const { breakpoints, BREAKPOINTS_KEYS } = import_yoga_tokens.default; | ||
const availableBreakpoints = BREAKPOINTS_KEYS; | ||
const availableBreakpoints = import_yoga_tokens.BREAKPOINTS_KEYS; | ||
const media = { not: {} }; | ||
@@ -51,6 +50,6 @@ const not = (isNot) => isNot ? "not all and " : ""; | ||
[max]: { width: maxBreakpoint } | ||
} = breakpoints; | ||
} = import_yoga_tokens.breakpoints; | ||
return `(min-width: ${minBreakpoint}px) and (max-width: ${maxBreakpoint}px)`; | ||
} | ||
return `(${range}-width: ${breakpoints[width].width}px)`; | ||
return `(${range}-width: ${import_yoga_tokens.breakpoints[width].width}px)`; | ||
} catch (e) { | ||
@@ -57,0 +56,0 @@ const msg = `Make sure you've entered the right breakpoints. |
@@ -24,5 +24,4 @@ "use strict"; | ||
)); | ||
var import_yoga_tokens = __toESM(require("@gympass/yoga-tokens")); | ||
var import_yoga_tokens = require("@gympass/yoga-tokens"); | ||
var import_media = __toESM(require("./media")); | ||
const { breakpoints, BREAKPOINTS_KEYS } = import_yoga_tokens.default; | ||
const formatCss = (style) => Array.isArray(style) ? style.join().replace(/,|\s*/g, "") : style.replace(/,|\s*/g, ""); | ||
@@ -34,7 +33,7 @@ const expectedStyle = (...args) => { | ||
}; | ||
const expectedHideStyle = (breakpoint) => formatCss(`@media (min-width: ${breakpoints[breakpoint].width}px) { | ||
const expectedHideStyle = (breakpoint) => formatCss(`@media (min-width: ${import_yoga_tokens.breakpoints[breakpoint].width}px) { | ||
display: none !important; | ||
}`); | ||
describe("media", () => { | ||
it.each(BREAKPOINTS_KEYS)(".%s", (breakpoint) => { | ||
it.each(import_yoga_tokens.BREAKPOINTS_KEYS)(".%s", (breakpoint) => { | ||
const style = import_media.default[breakpoint]` | ||
@@ -45,3 +44,3 @@ padding: 10px; | ||
}); | ||
it.each(BREAKPOINTS_KEYS)(".not.%s", (breakpoint) => { | ||
it.each(import_yoga_tokens.BREAKPOINTS_KEYS)(".not.%s", (breakpoint) => { | ||
const notStyle = import_media.default.not[breakpoint]` | ||
@@ -53,3 +52,3 @@ padding: 10px; | ||
describe("max", () => { | ||
it.each(BREAKPOINTS_KEYS)(".max('%s')", (breakpoint) => { | ||
it.each(import_yoga_tokens.BREAKPOINTS_KEYS)(".max('%s')", (breakpoint) => { | ||
const style = import_media.default.max(breakpoint)` | ||
@@ -60,3 +59,3 @@ padding: 10px; | ||
}); | ||
it.each(Object.keys(breakpoints))(".not.max('%s')", (breakpoint) => { | ||
it.each(Object.keys(import_yoga_tokens.breakpoints))(".not.max('%s')", (breakpoint) => { | ||
const style = import_media.default.not.max(breakpoint)` | ||
@@ -97,24 +96,24 @@ padding: 10px; | ||
const hideMatchers = (isNot) => ({ | ||
xxs: `@media ${(0, import_media.not)(isNot)} (max-width: ${breakpoints.xs.width}px) { | ||
xxs: `@media ${(0, import_media.not)(isNot)} (max-width: ${import_yoga_tokens.breakpoints.xs.width}px) { | ||
display: none !important; | ||
}`, | ||
xs: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.xs.width}px) and (max-width: ${breakpoints.sm.width - 1}px) { | ||
xs: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.xs.width}px) and (max-width: ${import_yoga_tokens.breakpoints.sm.width - 1}px) { | ||
display: none !important; | ||
}`, | ||
sm: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.sm.width}px) and (max-width: ${breakpoints.md.width - 1}px) { | ||
sm: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.sm.width}px) and (max-width: ${import_yoga_tokens.breakpoints.md.width - 1}px) { | ||
display: none !important; | ||
}`, | ||
md: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.md.width}px) and (max-width: ${breakpoints.lg.width - 1}px) { | ||
md: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.md.width}px) and (max-width: ${import_yoga_tokens.breakpoints.lg.width - 1}px) { | ||
display: none !important; | ||
}`, | ||
lg: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.lg.width}px) and (max-width: ${breakpoints.xl.width - 1}px) { | ||
lg: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.lg.width}px) and (max-width: ${import_yoga_tokens.breakpoints.xl.width - 1}px) { | ||
display: none !important; | ||
}`, | ||
xl: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.xl.width}px) and (max-width: ${breakpoints.xxl.width - 1}px) { | ||
xl: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.xl.width}px) and (max-width: ${import_yoga_tokens.breakpoints.xxl.width - 1}px) { | ||
display: none !important; | ||
}`, | ||
xxl: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.xxl.width}px) and (max-width: ${breakpoints.xxxl.width - 1}px) { | ||
xxl: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.xxl.width}px) and (max-width: ${import_yoga_tokens.breakpoints.xxxl.width - 1}px) { | ||
display: none !important; | ||
}`, | ||
xxxl: `@media ${(0, import_media.not)(isNot)} (min-width: ${breakpoints.xxxl.width}px) { | ||
xxxl: `@media ${(0, import_media.not)(isNot)} (min-width: ${import_yoga_tokens.breakpoints.xxxl.width}px) { | ||
display: none !important; | ||
@@ -132,3 +131,3 @@ }` | ||
); | ||
it.each(Object.keys(breakpoints))("%s-start", (breakpoint) => { | ||
it.each(Object.keys(import_yoga_tokens.breakpoints))("%s-start", (breakpoint) => { | ||
const style = import_media.default.hide[`${breakpoint}-start`]; | ||
@@ -135,0 +134,0 @@ if (style) { |
@@ -1,3 +0,2 @@ | ||
import tokens from "@gympass/yoga-tokens"; | ||
const { breakpoints } = tokens; | ||
import { breakpoints } from "@gympass/yoga-tokens"; | ||
import { css } from "styled-components"; | ||
@@ -4,0 +3,0 @@ import { not } from "./media"; |
@@ -1,5 +0,4 @@ | ||
import tokens from "@gympass/yoga-tokens"; | ||
import { breakpoints, BREAKPOINTS_KEYS } from "@gympass/yoga-tokens"; | ||
import { css } from "styled-components"; | ||
import hide from "./hide"; | ||
const { breakpoints, BREAKPOINTS_KEYS } = tokens; | ||
const availableBreakpoints = BREAKPOINTS_KEYS; | ||
@@ -6,0 +5,0 @@ const media = { not: {} }; |
@@ -1,4 +0,3 @@ | ||
import tokens from "@gympass/yoga-tokens"; | ||
import { breakpoints, BREAKPOINTS_KEYS } from "@gympass/yoga-tokens"; | ||
import media, { matcher, not } from "./media"; | ||
const { breakpoints, BREAKPOINTS_KEYS } = tokens; | ||
const formatCss = (style) => Array.isArray(style) ? style.join().replace(/,|\s*/g, "") : style.replace(/,|\s*/g, ""); | ||
@@ -5,0 +4,0 @@ const expectedStyle = (...args) => { |
{ | ||
"name": "@gympass/yoga-helpers", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Gympass helpers", | ||
@@ -27,5 +27,5 @@ "keywords": [ | ||
}, | ||
"gitHead": "c7386e9739774f4bc622d20a463ac7ceba02a0d9", | ||
"gitHead": "191181de12d23696b74539faff7b3a65e182e713", | ||
"module": "./esm", | ||
"private": false | ||
} |
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
24692
604