@semcore/utils
Advanced tools
Comparing version 2.1.0 to 2.3.0
@@ -5,2 +5,30 @@ # Changelog | ||
## [2.3.0] - 2019-05-10 | ||
### Added | ||
- Добавлена возможность серверного рендера css | ||
### Change | ||
- Обнавлена зависимость `nano-css` | ||
## [2.2.3] - 2019-05-20 | ||
### Fixed | ||
- Убрана возможность фокусировать задизейбленные элементы в `WithKeyboardFocus` | ||
## [2.2.2] - 2019-04-12 | ||
### Added | ||
- Копирование `defaultProps` при создание компонентов через `createHoc` | ||
## [2.2.1] - 2019-04-01 | ||
### Added | ||
- Функция `isRetina` для проверки ретина дисплея | ||
## [2.1.0] - 2019-02-15 | ||
@@ -7,0 +35,0 @@ |
@@ -85,2 +85,4 @@ "use strict"; | ||
_defineProperty(Component, "defaultProps", WrappedComponent.defaultProps || {}); | ||
return (0, _hoistNonReactStatics.default)(Component, WrappedComponent); | ||
@@ -87,0 +89,0 @@ }; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = exports.EnhancedWithCSS = void 0; | ||
exports.default = exports.Provider = exports.EnhancedWithCSS = exports.getStylesheet = void 0; | ||
@@ -19,6 +19,6 @@ var _react = _interopRequireWildcard(require("react")); | ||
var _prefixer = require("nano-css/addon/prefixer"); | ||
var _createHoc = _interopRequireDefault(require("../createHoc")); | ||
var _prefixer = require("nano-css/addon/prefixer"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -30,2 +30,4 @@ | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -49,4 +51,10 @@ | ||
var nano; | ||
var nano = null; | ||
var getStylesheet = function getStylesheet() { | ||
return nano ? nano.raw : ''; | ||
}; | ||
exports.getStylesheet = getStylesheet; | ||
var removeUndefinedKyes = function removeUndefinedKyes(obj) { | ||
@@ -60,2 +68,7 @@ return Object.keys(obj).reduce(function (acc, key) { | ||
var WithCssContext = _react.default.createContext({}); | ||
var Provider = WithCssContext.Provider; | ||
exports.Provider = Provider; | ||
var EnhancedWithCSS = | ||
@@ -76,3 +89,3 @@ /*#__PURE__*/ | ||
function EnhancedWithCSS(props) { | ||
function EnhancedWithCSS(props, context) { | ||
var _this; | ||
@@ -82,3 +95,3 @@ | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(EnhancedWithCSS).call(this, props)); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(EnhancedWithCSS).call(this, props, context)); | ||
@@ -90,6 +103,5 @@ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
if (!nano) { | ||
nano = (0, _nanoCss.create)({ | ||
// ? | ||
nano = (0, _nanoCss.create)(_objectSpread({ | ||
pfx: 'css' | ||
}); // if (process.env.NODE !== 'production') { | ||
}, context)); // if (process.env.NODE !== 'production') { | ||
// require('nano-css/addon/sourcemaps').addon(nano); | ||
@@ -129,2 +141,4 @@ // } | ||
_defineProperty(EnhancedWithCSS, "contextType", WithCssContext); | ||
_defineProperty(EnhancedWithCSS, "defaultProps", { | ||
@@ -131,0 +145,0 @@ css: {} |
@@ -94,6 +94,7 @@ "use strict"; | ||
children = _this$props.children, | ||
tabIndex = _this$props.tabIndex; | ||
tabIndex = _this$props.tabIndex, | ||
disabled = _this$props.disabled; | ||
var keyboardFocused = this.state.keyboardFocused; | ||
return children({ | ||
tabIndex: tabIndex, | ||
tabIndex: disabled ? -1 : tabIndex, | ||
keyboardFocused: keyboardFocused, | ||
@@ -100,0 +101,0 @@ onFocus: this.handlerFocus, |
{ | ||
"name": "@semcore/utils", | ||
"description": "SEMRush Utils Component", | ||
"version": "2.1.0", | ||
"version": "2.3.0", | ||
"main": "lib/index.js", | ||
@@ -10,3 +10,3 @@ "author": "Roman Lysov <r.lysov@semrush.com>", | ||
"build": "babel src --out-dir lib --presets=babel-preset-ui", | ||
"test": "jest" | ||
"test": "jest --no-cache" | ||
}, | ||
@@ -21,10 +21,10 @@ "peerDependencies": { | ||
"jest-preset-ui": "*", | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"request": "^2.87.0" | ||
"react": "^16.6", | ||
"react-dom": "^16.6", | ||
"request": "^2.87" | ||
}, | ||
"dependencies": { | ||
"classnames": "^2.2.6", | ||
"hoist-non-react-statics": "^2.5.5", | ||
"nano-css": "^3.5.0" | ||
"classnames": "^2.2", | ||
"hoist-non-react-statics": "^3.3", | ||
"nano-css": "^5.2" | ||
}, | ||
@@ -31,0 +31,0 @@ "jest": { |
@@ -10,2 +10,3 @@ import React, { PureComponent } from 'react'; | ||
static displayName = getDisplayName(WrappedComponent); | ||
static defaultProps = WrappedComponent.defaultProps || {}; | ||
@@ -12,0 +13,0 @@ render() { |
@@ -6,7 +6,9 @@ import React, { PureComponent } from 'react'; | ||
import { addon as addonCache } from 'nano-css/addon/cache'; | ||
import { addon as addonPrefixer } from 'nano-css/addon/prefixer'; | ||
import createHoc from '../createHoc'; | ||
import { addon as addonPrefixer } from 'nano-css/addon/prefixer'; | ||
let nano; | ||
let nano = null; | ||
const getStylesheet = () => (nano ? nano.raw : ''); | ||
const removeUndefinedKyes = function(obj) { | ||
@@ -20,3 +22,6 @@ return Object.keys(obj).reduce((acc, key) => { | ||
export class EnhancedWithCSS extends PureComponent { | ||
const WithCssContext = React.createContext({}); | ||
const { Provider } = WithCssContext; | ||
class EnhancedWithCSS extends PureComponent { | ||
static propTypes = { | ||
@@ -26,2 +31,4 @@ css: PropTypes.object, | ||
static contextType = WithCssContext; | ||
static defaultProps = { | ||
@@ -42,9 +49,9 @@ css: {}, | ||
constructor(props) { | ||
super(props); | ||
constructor(props, context) { | ||
super(props, context); | ||
if (!nano) { | ||
nano = create({ | ||
// ? | ||
pfx: 'css', | ||
...context, | ||
}); | ||
@@ -71,2 +78,3 @@ | ||
export { getStylesheet, EnhancedWithCSS, Provider }; | ||
export default createHoc(EnhancedWithCSS); |
@@ -53,6 +53,6 @@ import React, { PureComponent } from 'react'; | ||
render() { | ||
const { children, tabIndex } = this.props; | ||
const { children, tabIndex, disabled } = this.props; | ||
const { keyboardFocused } = this.state; | ||
return children({ | ||
tabIndex, | ||
tabIndex: disabled ? -1 : tabIndex, | ||
keyboardFocused, | ||
@@ -59,0 +59,0 @@ onFocus: this.handlerFocus, |
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
84101
64
1488
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Addedcss-in-js-utils@3.1.0(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedfastest-stable-stringify@2.0.2(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedinline-style-prefixer@7.0.1(transitive)
+ Addednano-css@5.6.2(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedstylis@4.3.4(transitive)
- Removedbowser@1.9.4(transitive)
- Removedcss-in-js-utils@2.0.1(transitive)
- Removedcsstype@2.6.21(transitive)
- Removedfastest-stable-stringify@1.0.1(transitive)
- Removedhoist-non-react-statics@2.5.5(transitive)
- Removedinline-style-prefixer@4.0.2(transitive)
- Removedisobject@3.0.1(transitive)
- Removednano-css@3.5.0(transitive)
- Removedsourcemap-codec@1.4.8(transitive)
- Removedstylis@3.5.0(transitive)
Updatedclassnames@^2.2
Updatedhoist-non-react-statics@^3.3
Updatednano-css@^5.2