@semcore/spin
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [1.1.0] - 2018-11-23 | ||
### Added | ||
- Добавлен autocomplete для IDE | ||
## [1.0.1] - 2018-10-24 | ||
@@ -7,0 +14,0 @@ |
211
lib/index.js
@@ -7,5 +7,10 @@ 'use strict'; | ||
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); | ||
var _classCallCheck = _interopDefault(require('@babel/runtime/helpers/classCallCheck')); | ||
var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass')); | ||
var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn')); | ||
var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf')); | ||
var _inherits = _interopDefault(require('@babel/runtime/helpers/inherits')); | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
var cn = _interopDefault(require('classnames')); | ||
@@ -15,141 +20,39 @@ var isNode = _interopDefault(require('@semcore/utils/lib/isNode')); | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a 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); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
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 _extends() { | ||
_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; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (typeof call === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
var data = { | ||
"block": { | ||
"block": "_spin_2aefj_12", | ||
"block": "_spin_qhytk_12", | ||
"theme": { | ||
"dark": "_spin--theme_dark_qhytk_18", | ||
"invert": "_spin--theme_invert_qhytk_21" | ||
}, | ||
"centered": { | ||
"block": "_spin--centered_2aefj_103" | ||
"block": "_spin--centered_qhytk_104" | ||
}, | ||
"direction": { | ||
"row": "_spin--direction_row_2aefj_107", | ||
"column": "_spin--direction_column_2aefj_127" | ||
"row": "_spin--direction_row_qhytk_108", | ||
"column": "_spin--direction_column_qhytk_128" | ||
} | ||
}, | ||
"icon": { | ||
"block": "_spin__icon_2aefj_18", | ||
"theme": { | ||
"dark": "_spin__icon--theme_dark_2aefj_32", | ||
"invert": "_spin__icon--theme_invert_2aefj_36" | ||
}, | ||
"block": "_spin__icon_qhytk_25", | ||
"size": { | ||
"xxs": "_spin__icon--size_xxs_2aefj_40", | ||
"xs": "_spin__icon--size_xs_2aefj_49", | ||
"s": "_spin__icon--size_s_2aefj_58", | ||
"m": "_spin__icon--size_m_2aefj_67", | ||
"l": "_spin__icon--size_l_2aefj_76", | ||
"xl": "_spin__icon--size_xl_2aefj_85", | ||
"xxl": "_spin__icon--size_xxl_2aefj_94" | ||
"xxs": "_spin__icon--size_xxs_qhytk_41", | ||
"xs": "_spin__icon--size_xs_qhytk_50", | ||
"s": "_spin__icon--size_s_qhytk_59", | ||
"m": "_spin__icon--size_m_qhytk_68", | ||
"l": "_spin__icon--size_l_qhytk_77", | ||
"xl": "_spin__icon--size_xl_qhytk_86", | ||
"xxl": "_spin__icon--size_xxl_qhytk_95" | ||
} | ||
}, | ||
"text": { | ||
"block": "_spin__text_2aefj_26", | ||
"block": "_spin__text_qhytk_35", | ||
"size": { | ||
"xxs": "_spin__text--size_xxs_2aefj_45", | ||
"xs": "_spin__text--size_xs_2aefj_54", | ||
"s": "_spin__text--size_s_2aefj_63", | ||
"m": "_spin__text--size_m_2aefj_72", | ||
"l": "_spin__text--size_l_2aefj_81", | ||
"xl": "_spin__text--size_xl_2aefj_90", | ||
"xxl": "_spin__text--size_xxl_2aefj_99" | ||
"xxs": "_spin__text--size_xxs_qhytk_46", | ||
"xs": "_spin__text--size_xs_qhytk_55", | ||
"s": "_spin__text--size_s_qhytk_64", | ||
"m": "_spin__text--size_m_qhytk_73", | ||
"l": "_spin__text--size_l_qhytk_82", | ||
"xl": "_spin__text--size_xl_qhytk_91", | ||
"xxl": "_spin__text--size_xxl_qhytk_100" | ||
} | ||
@@ -164,3 +67,3 @@ } | ||
style.classList.add('_css-style'); | ||
style.innerHTML = "@-webkit-keyframes _spin-rotate_2aefj_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes _spin-rotate_2aefj_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}._spin_2aefj_12{display:inline-flex;align-items:center;justify-content:center}._spin__icon_2aefj_18{flex-shrink:0;box-sizing:border-box;border-radius:50%;border-style:solid;-webkit-animation:_spin-rotate_2aefj_1 .75s linear infinite;animation:_spin-rotate_2aefj_1 .75s linear infinite}._spin__text_2aefj_26{color:#757575;font-size:14px;margin:0}._spin__icon--theme_dark_2aefj_32{border-color:rgba(0,0,0,.3) rgba(0,0,0,.3) transparent transparent}._spin__icon--theme_invert_2aefj_36{border-color:#fff #fff transparent transparent}._spin__icon--size_xxs_2aefj_40{width:10px;height:10px;border-width:1px}._spin__text--size_xxs_2aefj_45{font-size:10px}._spin__icon--size_xs_2aefj_49{width:16px;height:16px;border-width:2px}._spin__text--size_xs_2aefj_54{font-size:12px}._spin__icon--size_s_2aefj_58{width:20px;height:20px;border-width:3px}._spin__text--size_s_2aefj_63{font-size:14px}._spin__icon--size_m_2aefj_67{width:24px;height:24px;border-width:4px}._spin__text--size_m_2aefj_72{font-size:16px}._spin__icon--size_l_2aefj_76{width:32px;height:32px;border-width:6px}._spin__text--size_l_2aefj_81{font-size:16px}._spin__icon--size_xl_2aefj_85{width:48px;height:48px;border-width:8px}._spin__text--size_xl_2aefj_90{font-size:16px}._spin__icon--size_xxl_2aefj_94{width:72px;height:72px;border-width:10px}._spin__text--size_xxl_2aefj_99{font-size:16px}._spin--centered_2aefj_103{width:100%}._spin--direction_row_2aefj_107{flex-flow:row nowrap}._spin--direction_row_2aefj_107>._spin__text--size_xs_2aefj_54,._spin--direction_row_2aefj_107>._spin__text--size_xxs_2aefj_45{margin-left:4px}._spin--direction_row_2aefj_107>._spin__text--size_l_2aefj_81,._spin--direction_row_2aefj_107>._spin__text--size_m_2aefj_72,._spin--direction_row_2aefj_107>._spin__text--size_s_2aefj_63{margin-left:8px}._spin--direction_row_2aefj_107>._spin__text--size_xl_2aefj_90,._spin--direction_row_2aefj_107>._spin__text--size_xxl_2aefj_99{margin-left:16px}._spin--direction_column_2aefj_127{flex-flow:column nowrap}._spin--direction_column_2aefj_127>._spin__text--size_s_2aefj_63,._spin--direction_column_2aefj_127>._spin__text--size_xs_2aefj_54,._spin--direction_column_2aefj_127>._spin__text--size_xxs_2aefj_45{margin-top:4px}._spin--direction_column_2aefj_127>._spin__text--size_l_2aefj_81,._spin--direction_column_2aefj_127>._spin__text--size_m_2aefj_72,._spin--direction_column_2aefj_127>._spin__text--size_xl_2aefj_90,._spin--direction_column_2aefj_127>._spin__text--size_xxl_2aefj_99{margin-top:8px}"; | ||
style.innerHTML = "@-webkit-keyframes _spin-rotate_qhytk_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes _spin-rotate_qhytk_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}._spin_qhytk_12{display:inline-flex;align-items:center;justify-content:center}._spin--theme_dark_qhytk_18{color:rgba(0,0,0,.3)}._spin--theme_invert_qhytk_21{color:#fff}._spin__icon_qhytk_25{flex-shrink:0;box-sizing:border-box;border-radius:50%;border-style:solid;-webkit-animation:_spin-rotate_qhytk_1 .75s linear infinite;animation:_spin-rotate_qhytk_1 .75s linear infinite;border-bottom-color:transparent;border-left-color:transparent}._spin__text_qhytk_35{color:#757575;font-size:14px;margin:0}._spin__icon--size_xxs_qhytk_41{width:10px;height:10px;border-width:1px}._spin__text--size_xxs_qhytk_46{font-size:10px}._spin__icon--size_xs_qhytk_50{width:16px;height:16px;border-width:2px}._spin__text--size_xs_qhytk_55{font-size:12px}._spin__icon--size_s_qhytk_59{width:20px;height:20px;border-width:3px}._spin__text--size_s_qhytk_64{font-size:14px}._spin__icon--size_m_qhytk_68{width:24px;height:24px;border-width:4px}._spin__text--size_m_qhytk_73{font-size:16px}._spin__icon--size_l_qhytk_77{width:32px;height:32px;border-width:6px}._spin__text--size_l_qhytk_82{font-size:16px}._spin__icon--size_xl_qhytk_86{width:48px;height:48px;border-width:8px}._spin__text--size_xl_qhytk_91{font-size:16px}._spin__icon--size_xxl_qhytk_95{width:72px;height:72px;border-width:10px}._spin__text--size_xxl_qhytk_100{font-size:16px}._spin--centered_qhytk_104{width:100%}._spin--direction_row_qhytk_108{flex-flow:row nowrap}._spin--direction_row_qhytk_108>._spin__text--size_xs_qhytk_55,._spin--direction_row_qhytk_108>._spin__text--size_xxs_qhytk_46{margin-left:4px}._spin--direction_row_qhytk_108>._spin__text--size_l_qhytk_82,._spin--direction_row_qhytk_108>._spin__text--size_m_qhytk_73,._spin--direction_row_qhytk_108>._spin__text--size_s_qhytk_64{margin-left:8px}._spin--direction_row_qhytk_108>._spin__text--size_xl_qhytk_91,._spin--direction_row_qhytk_108>._spin__text--size_xxl_qhytk_100{margin-left:16px}._spin--direction_column_qhytk_128{flex-flow:column nowrap}._spin--direction_column_qhytk_128>._spin__text--size_s_qhytk_64,._spin--direction_column_qhytk_128>._spin__text--size_xs_qhytk_55,._spin--direction_column_qhytk_128>._spin__text--size_xxs_qhytk_46{margin-top:4px}._spin--direction_column_qhytk_128>._spin__text--size_l_qhytk_82,._spin--direction_column_qhytk_128>._spin__text--size_m_qhytk_73,._spin--direction_column_qhytk_128>._spin__text--size_xl_qhytk_91,._spin--direction_column_qhytk_128>._spin__text--size_xxl_qhytk_100{margin-top:8px}"; | ||
head.appendChild(style); | ||
@@ -174,2 +77,7 @@ } | ||
block['theme'] = function () { | ||
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'block'; | ||
return data['block']['theme'][value]; | ||
}; | ||
block['centered'] = function () { | ||
@@ -189,7 +97,2 @@ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'block'; | ||
icon['theme'] = function () { | ||
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'block'; | ||
return data['icon']['theme'][value]; | ||
}; | ||
icon['size'] = function () { | ||
@@ -208,10 +111,2 @@ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'block'; | ||
}; | ||
var SIZES = ['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl']; | ||
var THEMES = ['dark', 'invert']; | ||
var DIRECTIONS = ['column', 'row']; | ||
/** | ||
* ```js | ||
* import Spin from "@semcore/spin" | ||
* ``` | ||
* */ | ||
@@ -240,7 +135,7 @@ var Spin = | ||
var styles = { | ||
container: cn(block(), block.direction(direction), _defineProperty({}, block.centered(), centered), className), | ||
icon: cn(icon(), icon.size(size), icon.theme(theme)), | ||
container: cn(block(), block.direction(direction), block.theme(theme), _defineProperty({}, block.centered(), centered), className), | ||
icon: cn(icon(), icon.size(size)), | ||
text: cn(text(), text.size(size)) | ||
}; | ||
return React__default.createElement("div", _extends({}, propsForElement(this.props), { | ||
return React__default.createElement("div", Object.assign({}, propsForElement(this.props), { | ||
className: styles.container | ||
@@ -258,7 +153,5 @@ }), React__default.createElement("div", { | ||
_defineProperty(Spin, "UIname", 'Spin'); | ||
_defineProperty(Spin, "displayName", 'Spin'); | ||
_defineProperty(Spin, "defaultProps", { | ||
Spin.UIname = 'Spin'; | ||
Spin.displayName = 'Spin'; | ||
Spin.defaultProps = { | ||
size: 'm', | ||
@@ -268,21 +161,5 @@ theme: 'dark', | ||
centered: false | ||
}); | ||
}; | ||
_defineProperty(Spin, "propTypes", { | ||
/** Текст спиннера */ | ||
tip: PropTypes.node, | ||
/** Размер спиннера */ | ||
size: PropTypes.oneOf(SIZES), | ||
/** Тема спиннера */ | ||
theme: PropTypes.oneOf(THEMES), | ||
/** Направление расположения иконки и текста спиннера */ | ||
direction: PropTypes.oneOf(DIRECTIONS), | ||
/** Должен ли спиннер растянуться на всю ширину родителя */ | ||
centered: PropTypes.bool | ||
}); | ||
exports.default = Spin; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@semcore/spin", | ||
"description": "SEMRush Spin Component", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "lib/index.js", | ||
"module": "lib/index.es.js", | ||
"typings": "lib/index.d.ts", | ||
"author": "Roman Lysov <r.lysov@semrush.com>", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "rollup --config=node:rollup-config-react", | ||
"build": "rollup --config=node:rollup-config-ts", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"@semcore/utils": "^1.1.0", | ||
"classnames": "^2.2.5", | ||
"prop-types": "^15.6.1" | ||
"@babel/runtime": "^7.1.5", | ||
"@semcore/utils": "^1.3.0", | ||
"@types/react": "^16.7.6", | ||
"classnames": "^2.2.5" | ||
}, | ||
@@ -17,0 +20,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
30502
13
510
5
3
+ Added@babel/runtime@^7.1.5
+ Added@types/react@^16.7.6
+ Added@babel/runtime@7.25.6(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Added@types/react@16.14.61(transitive)
+ Added@types/scheduler@0.16.8(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
- Removedprop-types@^15.6.1
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)
Updated@semcore/utils@^1.3.0