@cloudflare/util-responsive
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="1.0.7"></a> | ||
## [1.0.7](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-responsive@1.0.6...@cloudflare/util-responsive@1.0.7) (2018-06-05) | ||
**Note:** Version bump only for package @cloudflare/util-responsive | ||
<a name="1.0.6"></a> | ||
@@ -8,0 +16,0 @@ ## [1.0.6](http://stash.cfops.it:7999/www/cf-ux/compare/@cloudflare/util-responsive@1.0.5...@cloudflare/util-responsive@1.0.6) (2018-05-25) |
@@ -1,1 +0,14 @@ | ||
export { default as withAutoWidth } from './withAutoWidth'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _withAutoWidth = require('./withAutoWidth'); | ||
Object.defineProperty(exports, 'withAutoWidth', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_withAutoWidth).default; | ||
} | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -0,1 +1,5 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -5,2 +9,18 @@ | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _reactDimensions = require('react-dimensions'); | ||
var _reactDimensions2 = _interopRequireDefault(_reactDimensions); | ||
var _index = require('@cloudflare/component-box/src/index.js'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -12,8 +32,3 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Dimensions from 'react-dimensions'; | ||
import { Box } from '@cloudflare/component-box'; | ||
export default (function (Comp) { | ||
exports.default = function (Comp) { | ||
var InnerComp = function (_React$PureComponent) { | ||
@@ -31,3 +46,3 @@ _inherits(InnerComp, _React$PureComponent); | ||
value: function render() { | ||
return React.createElement(Comp, _extends({}, this.props, { | ||
return _react2.default.createElement(Comp, _extends({}, this.props, { | ||
width: this.props.width || this.props.containerWidth | ||
@@ -39,7 +54,7 @@ })); | ||
return InnerComp; | ||
}(React.PureComponent); | ||
}(_react2.default.PureComponent); | ||
InnerComp.propTypes = { | ||
width: PropTypes.number, | ||
containerWidth: PropTypes.number.isRequired | ||
width: _propTypes2.default.number, | ||
containerWidth: _propTypes2.default.number.isRequired | ||
}; | ||
@@ -50,3 +65,3 @@ InnerComp.defaultProps = { | ||
var SizedComp = Dimensions()(InnerComp); // Provide containerWidth | ||
var SizedComp = (0, _reactDimensions2.default)()(InnerComp); // Provide containerWidth | ||
@@ -84,3 +99,3 @@ // | ||
return this.state.init ? React.createElement(SizedComp, this.props) : React.createElement(Box, { width: width, height: height }); | ||
return this.state.init ? _react2.default.createElement(SizedComp, this.props) : _react2.default.createElement(_index.Box, { width: width, height: height }); | ||
} | ||
@@ -90,10 +105,10 @@ }]); | ||
return WrapperInit; | ||
}(React.PureComponent); | ||
}(_react2.default.PureComponent); | ||
WrapperInit.propTypes = { | ||
width: PropTypes.number, | ||
height: PropTypes.number | ||
width: _propTypes2.default.number, | ||
height: _propTypes2.default.number | ||
}; | ||
return WrapperInit; | ||
}); | ||
}; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _interopRequireDefault(_withAutoWidth).default; | ||
@@ -14,0 +14,0 @@ } |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = require('react'); | ||
@@ -22,15 +24,34 @@ | ||
var _componentBox = require('@cloudflare/component-box'); | ||
var _index = require('@cloudflare/component-box/src/index.js'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = Comp => { | ||
class InnerComp extends _react2.default.PureComponent { | ||
render() { | ||
return _react2.default.createElement(Comp, _extends({}, this.props, { | ||
width: this.props.width || this.props.containerWidth | ||
})); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
exports.default = function (Comp) { | ||
var InnerComp = function (_React$PureComponent) { | ||
_inherits(InnerComp, _React$PureComponent); | ||
function InnerComp() { | ||
_classCallCheck(this, InnerComp); | ||
return _possibleConstructorReturn(this, (InnerComp.__proto__ || Object.getPrototypeOf(InnerComp)).apply(this, arguments)); | ||
} | ||
} | ||
_createClass(InnerComp, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement(Comp, _extends({}, this.props, { | ||
width: this.props.width || this.props.containerWidth | ||
})); | ||
} | ||
}]); | ||
return InnerComp; | ||
}(_react2.default.PureComponent); | ||
InnerComp.propTypes = { | ||
@@ -44,23 +65,42 @@ width: _propTypes2.default.number, | ||
const SizedComp = (0, _reactDimensions2.default)()(InnerComp); // Provide containerWidth | ||
var SizedComp = (0, _reactDimensions2.default)()(InnerComp); // Provide containerWidth | ||
// | ||
class WrapperInit extends _react2.default.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
this.state = { init: false }; | ||
} | ||
var WrapperInit = function (_React$PureComponent2) { | ||
_inherits(WrapperInit, _React$PureComponent2); | ||
componentDidMount() { | ||
// Attach SizedComp asynchronously on 2nd render to ensure containerWidth is computed after all Fela styles have been attached to the DOM | ||
setTimeout(() => this.setState({ init: true })); | ||
} | ||
function WrapperInit(props) { | ||
_classCallCheck(this, WrapperInit); | ||
render() { | ||
const { width, height } = this.props; | ||
return this.state.init ? _react2.default.createElement(SizedComp, this.props) : _react2.default.createElement(_componentBox.Box, { width: width, height: height }); | ||
var _this2 = _possibleConstructorReturn(this, (WrapperInit.__proto__ || Object.getPrototypeOf(WrapperInit)).call(this, props)); | ||
_this2.state = { init: false }; | ||
return _this2; | ||
} | ||
} | ||
_createClass(WrapperInit, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
var _this3 = this; | ||
// Attach SizedComp asynchronously on 2nd render to ensure containerWidth is computed after all Fela styles have been attached to the DOM | ||
setTimeout(function () { | ||
return _this3.setState({ init: true }); | ||
}); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
width = _props.width, | ||
height = _props.height; | ||
return this.state.init ? _react2.default.createElement(SizedComp, this.props) : _react2.default.createElement(_index.Box, { width: width, height: height }); | ||
} | ||
}]); | ||
return WrapperInit; | ||
}(_react2.default.PureComponent); | ||
WrapperInit.propTypes = { | ||
@@ -67,0 +107,0 @@ width: _propTypes2.default.number, |
{ | ||
"name": "@cloudflare/util-responsive", | ||
"description": "Cloudflare Responsive Design Utils", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "lib/index.js", | ||
@@ -14,4 +14,4 @@ "module": "es/index.js", | ||
"dependencies": { | ||
"@cloudflare/component-box": "^1.0.6", | ||
"@cloudflare/style-container": "^1.0.6", | ||
"@cloudflare/component-box": "^1.0.7", | ||
"@cloudflare/style-container": "^1.0.7", | ||
"prop-types": "^15.6.0", | ||
@@ -18,0 +18,0 @@ "react-dimensions": "^1.3.1" |
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
18592
225