@tds/core-responsive
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -30,3 +30,3 @@ import media, { breakpoints } from '../media' | ||
expect(style).toEqual({ [`@media (max-width: ${breakpoints.md}px)`]: { color: 'red' } }) | ||
expect(style).toEqual({ [`@media (max-width: ${breakpoints.md - 1}px)`]: { color: 'red' } }) | ||
}) | ||
@@ -39,3 +39,3 @@ | ||
expect(style).toEqual({ [`@media (max-width: ${breakpoints.md}px)`]: { color: 'red' } }) | ||
expect(style).toEqual({ [`@media (max-width: ${breakpoints.md - 1}px)`]: { color: 'red' } }) | ||
}) | ||
@@ -72,7 +72,6 @@ }) | ||
expect(style).toEqual({ | ||
[`@media (min-width: ${breakpoints.md}px) and (max-width: ${ | ||
breakpoints.lg | ||
}px) and (orientation: landscape)`]: { color: 'red' }, | ||
[`@media (min-width: ${breakpoints.md}px) and (max-width: ${breakpoints.lg - | ||
1}px) and (orientation: landscape)`]: { color: 'red' }, | ||
}) | ||
}) | ||
}) |
@@ -6,36 +6,31 @@ # Change Log | ||
# [1.2.0](https://github.com/telusdigital/tds/compare/@tds/core-responsive@1.1.1...@tds/core-responsive@1.2.0) (2019-03-11) | ||
## [1.2.1](https://github.com/telusdigital/tds/compare/@tds/core-responsive@1.2.0...@tds/core-responsive@1.2.1) (2019-06-04) | ||
### Bug Fixes | ||
### Features | ||
- **core-responsive:** until breakpoints ([d728b1b](https://github.com/telusdigital/tds/commit/d728b1b)) | ||
* **core-responsive:** add named export for media query function in js ([0494e91](https://github.com/telusdigital/tds/commit/0494e91)) | ||
# [1.2.0](https://github.com/telusdigital/tds/compare/@tds/core-responsive@1.1.1...@tds/core-responsive@1.2.0) (2019-03-11) | ||
### Features | ||
- **core-responsive:** add named export for media query function in js ([0494e91](https://github.com/telusdigital/tds/commit/0494e91)) | ||
## [1.1.1](https://github.com/telusdigital/tds/compare/@tds/core-responsive@1.1.0...@tds/core-responsive@1.1.1) (2019-02-06) | ||
### Bug Fixes | ||
* **deps:** update dependency sass-mq to v5 ([123550e](https://github.com/telusdigital/tds/commit/123550e)) | ||
- **deps:** update dependency sass-mq to v5 ([123550e](https://github.com/telusdigital/tds/commit/123550e)) | ||
<a name="1.1.0"></a> | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/telusdigital/tds/compare/@tds/core-responsive@1.0.0...@tds/core-responsive@1.1.0) (2018-04-02) | ||
### Bug Fixes | ||
* **core-display-heading:** remove unnecessary variable ([4a48ed4](https://github.com/telusdigital/tds/commit/4a48ed4)) | ||
* **shared-base-button:** refactor for sass based responsiveness ([a17f6ac](https://github.com/telusdigital/tds/commit/a17f6ac)) | ||
- **core-display-heading:** remove unnecessary variable ([4a48ed4](https://github.com/telusdigital/tds/commit/4a48ed4)) | ||
- **shared-base-button:** refactor for sass based responsiveness ([a17f6ac](https://github.com/telusdigital/tds/commit/a17f6ac)) | ||
### Features | ||
* **core-responsive:** move responsive scss file to root ([97924b8](https://github.com/telusdigital/tds/commit/97924b8)) | ||
- **core-responsive:** move responsive scss file to root ([97924b8](https://github.com/telusdigital/tds/commit/97924b8)) |
@@ -10,19 +10,9 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var _extends_1 = createCommonjsModule(function (module) { | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
module.exports = _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
@@ -44,21 +34,5 @@ var source = arguments[i]; | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
module.exports = _extends; | ||
}); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -79,7 +53,7 @@ if (source == null) return {}; | ||
var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose; | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var target = objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
@@ -101,3 +75,5 @@ | ||
function _inheritsLoose$1(subClass, superClass) { | ||
var objectWithoutProperties = _objectWithoutProperties; | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
@@ -108,3 +84,3 @@ subClass.prototype.constructor = subClass; | ||
function _assertThisInitialized$1(self) { | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
@@ -117,3 +93,3 @@ throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
function _defineProperty$1(obj, key, value) { | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
@@ -151,6 +127,4 @@ Object.defineProperty(obj, key, { | ||
var NODE_ENV = process.env.NODE_ENV; | ||
var invariant = function(condition, format, a, b, c, d, e, f) { | ||
if (NODE_ENV !== 'production') { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (format === undefined) { | ||
@@ -182,3 +156,3 @@ throw new Error('invariant requires an error message argument'); | ||
var invariant_1 = invariant; | ||
var browser = invariant; | ||
@@ -286,3 +260,3 @@ var camel2hyphen = function (str) { | ||
function (_React$Component) { | ||
_inheritsLoose$1(Media, _React$Component); | ||
_inheritsLoose(Media, _React$Component); | ||
@@ -298,7 +272,7 @@ function Media() { | ||
_defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", { | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
matches: _this.props.defaultMatches | ||
}); | ||
_defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "updateMatches", function () { | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateMatches", function () { | ||
var matches = _this.mediaQueryList.matches; | ||
@@ -325,3 +299,3 @@ | ||
var targetWindow = this.props.targetWindow || window; | ||
!(typeof targetWindow.matchMedia === 'function') ? process.env.NODE_ENV !== "production" ? invariant_1(false, '<Media targetWindow> does not support `matchMedia`.') : invariant_1(false) : void 0; | ||
!(typeof targetWindow.matchMedia === 'function') ? process.env.NODE_ENV !== "production" ? browser(false, '<Media targetWindow> does not support `matchMedia`.') : browser(false) : void 0; | ||
var query = this.props.query; | ||
@@ -349,3 +323,3 @@ if (typeof query !== 'string') query = json2mq_1(query); | ||
_defineProperty$1(Media, "defaultProps", { | ||
_defineProperty(Media, "defaultProps", { | ||
defaultMatches: true | ||
@@ -374,2 +348,19 @@ }); | ||
function _defineProperty$1(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
var defineProperty = _defineProperty$1; | ||
var breakpoints = { | ||
@@ -401,3 +392,3 @@ sm: 576, | ||
var min = minWidth ? "(min-width: ".concat(breakpoints[minWidth], "px)") : null; | ||
var max = maxWidth ? "(max-width: ".concat(breakpoints[maxWidth], "px)") : null; | ||
var max = maxWidth ? "(max-width: ".concat(breakpoints[maxWidth] - 1, "px)") : null; | ||
var mediaQuery = "@media ".concat([min, max, and].filter(function (a) { | ||
@@ -407,3 +398,3 @@ return a; | ||
this.query = {}; | ||
return _defineProperty({}, mediaQuery, _objectSpread({}, typeof style === 'function' ? style() : style)); | ||
return defineProperty({}, mediaQuery, _extends_1({}, typeof style === 'function' ? style() : style)); | ||
} | ||
@@ -423,3 +414,3 @@ }; | ||
children = _ref.children, | ||
rest = _objectWithoutProperties(_ref, ["minWidth", "maxWidth", "query", "children"]); | ||
rest = objectWithoutProperties(_ref, ["minWidth", "maxWidth", "query", "children"]); | ||
@@ -443,4 +434,4 @@ if (!minWidth && !maxWidth) { | ||
return React.createElement(Media, _extends({}, rest, { | ||
query: _objectSpread({}, mediaQuery, query) | ||
return React.createElement(Media, _extends_1({}, rest, { | ||
query: _extends_1({}, mediaQuery, query) | ||
}), children); | ||
@@ -480,3 +471,3 @@ }; | ||
exports.default = Responsive; | ||
exports.media = media; | ||
exports.default = Responsive; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var _extends_1 = createCommonjsModule(function (module) { | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
module.exports = _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
@@ -37,21 +27,5 @@ var source = arguments[i]; | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
module.exports = _extends; | ||
}); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -72,7 +46,7 @@ if (source == null) return {}; | ||
var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose; | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var target = objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
@@ -94,3 +68,5 @@ | ||
function _inheritsLoose$1(subClass, superClass) { | ||
var objectWithoutProperties = _objectWithoutProperties; | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
@@ -101,3 +77,3 @@ subClass.prototype.constructor = subClass; | ||
function _assertThisInitialized$1(self) { | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
@@ -110,3 +86,3 @@ throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
function _defineProperty$1(obj, key, value) { | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
@@ -144,6 +120,4 @@ Object.defineProperty(obj, key, { | ||
var NODE_ENV = process.env.NODE_ENV; | ||
var invariant = function(condition, format, a, b, c, d, e, f) { | ||
if (NODE_ENV !== 'production') { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (format === undefined) { | ||
@@ -175,3 +149,3 @@ throw new Error('invariant requires an error message argument'); | ||
var invariant_1 = invariant; | ||
var browser = invariant; | ||
@@ -279,3 +253,3 @@ var camel2hyphen = function (str) { | ||
function (_React$Component) { | ||
_inheritsLoose$1(Media, _React$Component); | ||
_inheritsLoose(Media, _React$Component); | ||
@@ -291,7 +265,7 @@ function Media() { | ||
_defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", { | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
matches: _this.props.defaultMatches | ||
}); | ||
_defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "updateMatches", function () { | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateMatches", function () { | ||
var matches = _this.mediaQueryList.matches; | ||
@@ -318,3 +292,3 @@ | ||
var targetWindow = this.props.targetWindow || window; | ||
!(typeof targetWindow.matchMedia === 'function') ? process.env.NODE_ENV !== "production" ? invariant_1(false, '<Media targetWindow> does not support `matchMedia`.') : invariant_1(false) : void 0; | ||
!(typeof targetWindow.matchMedia === 'function') ? process.env.NODE_ENV !== "production" ? browser(false, '<Media targetWindow> does not support `matchMedia`.') : browser(false) : void 0; | ||
var query = this.props.query; | ||
@@ -342,3 +316,3 @@ if (typeof query !== 'string') query = json2mq_1(query); | ||
_defineProperty$1(Media, "defaultProps", { | ||
_defineProperty(Media, "defaultProps", { | ||
defaultMatches: true | ||
@@ -367,2 +341,19 @@ }); | ||
function _defineProperty$1(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
var defineProperty = _defineProperty$1; | ||
var breakpoints = { | ||
@@ -394,3 +385,3 @@ sm: 576, | ||
var min = minWidth ? "(min-width: ".concat(breakpoints[minWidth], "px)") : null; | ||
var max = maxWidth ? "(max-width: ".concat(breakpoints[maxWidth], "px)") : null; | ||
var max = maxWidth ? "(max-width: ".concat(breakpoints[maxWidth] - 1, "px)") : null; | ||
var mediaQuery = "@media ".concat([min, max, and].filter(function (a) { | ||
@@ -400,3 +391,3 @@ return a; | ||
this.query = {}; | ||
return _defineProperty({}, mediaQuery, _objectSpread({}, typeof style === 'function' ? style() : style)); | ||
return defineProperty({}, mediaQuery, _extends_1({}, typeof style === 'function' ? style() : style)); | ||
} | ||
@@ -416,3 +407,3 @@ }; | ||
children = _ref.children, | ||
rest = _objectWithoutProperties(_ref, ["minWidth", "maxWidth", "query", "children"]); | ||
rest = objectWithoutProperties(_ref, ["minWidth", "maxWidth", "query", "children"]); | ||
@@ -436,4 +427,4 @@ if (!minWidth && !maxWidth) { | ||
return React.createElement(Media, _extends({}, rest, { | ||
query: _objectSpread({}, mediaQuery, query) | ||
return React.createElement(Media, _extends_1({}, rest, { | ||
query: _extends_1({}, mediaQuery, query) | ||
}), children); | ||
@@ -440,0 +431,0 @@ }; |
@@ -26,3 +26,3 @@ export const breakpoints = { | ||
const min = minWidth ? `(min-width: ${breakpoints[minWidth]}px)` : null | ||
const max = maxWidth ? `(max-width: ${breakpoints[maxWidth]}px)` : null | ||
const max = maxWidth ? `(max-width: ${breakpoints[maxWidth] - 1}px)` : null | ||
@@ -29,0 +29,0 @@ const mediaQuery = `@media ${[min, max, and].filter(a => a).join(' and ')}` |
{ | ||
"name": "@tds/core-responsive", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Respond to device features, most commonly the browser viewport size", | ||
@@ -34,3 +34,3 @@ "main": "index.cjs.js", | ||
}, | ||
"gitHead": "a27c02f94efe5019cee9675f16918dca83632083" | ||
"gitHead": "1ac2f2499df5787982a6c0fd4196ca80d95dacfc" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
43992
962
1