Comparing version 0.0.3 to 0.0.4
@@ -0,22 +1,31 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = exports.withTextProp = exports.withCenterProp = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import React from 'react'; | ||
var ZWSP = "\u200B"; // use zero-width space to mock [strut](https://www.w3.org/TR/CSS22/visudet.html#strut), ​ | ||
var withCenterProp = function withCenterProp(strutStyle) { | ||
if (strutStyle === void 0) { | ||
strutStyle = { | ||
display: 'inline-flex', | ||
alignItems: 'center' | ||
}; | ||
} | ||
var withCenterProp = function withCenterProp() { | ||
var strutStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { | ||
display: 'inline-flex', | ||
alignItems: 'center' | ||
}; | ||
return function (Component) { | ||
return function (_ref) { | ||
var center = _ref.center, | ||
props = _objectWithoutPropertiesLoose(_ref, ["center"]); | ||
props = _objectWithoutProperties(_ref, ["center"]); | ||
return center ? React.createElement("span", { | ||
return center ? _react.default.createElement("span", { | ||
style: strutStyle | ||
}, ZWSP, React.createElement(Component, props)) : React.createElement(Component, props); | ||
}, ZWSP, _react.default.createElement(Component, props)) : _react.default.createElement(Component, props); | ||
}; | ||
@@ -26,13 +35,12 @@ }; | ||
var withTextProp = function withTextProp(size) { | ||
if (size === void 0) { | ||
size = '1.2em'; | ||
} | ||
exports.withCenterProp = withCenterProp; | ||
var withTextProp = function withTextProp() { | ||
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '1.2em'; | ||
return function (Component) { | ||
return function (_ref2) { | ||
var text = _ref2.text, | ||
props = _objectWithoutPropertiesLoose(_ref2, ["text"]); | ||
props = _objectWithoutProperties(_ref2, ["text"]); | ||
return React.createElement(Component, Object.assign({}, props, text && { | ||
return _react.default.createElement(Component, Object.assign({}, props, text && { | ||
size: size | ||
@@ -44,7 +52,9 @@ })); | ||
exports.withTextProp = withTextProp; | ||
var BaseIcon = function BaseIcon(_ref3) { | ||
var size = _ref3.size, | ||
props = _objectWithoutPropertiesLoose(_ref3, ["size"]); | ||
props = _objectWithoutProperties(_ref3, ["size"]); | ||
return React.createElement("svg", Object.assign({}, props, size && { | ||
return _react.default.createElement("svg", Object.assign({}, props, size && { | ||
width: size, | ||
@@ -58,3 +68,5 @@ height: size | ||
}; | ||
export { withCenterProp, withTextProp }; | ||
export default withTextProp()(withCenterProp()(BaseIcon)); | ||
var _default = withTextProp()(withCenterProp()(BaseIcon)); | ||
exports.default = _default; |
{ | ||
"name": "base-icon", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "React base icon", | ||
@@ -5,0 +5,0 @@ "repository": "ambar/reiconify", |
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
3931
53