@micromag/element-badge 0.3.354
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/styles.css +1 -0
- package/es/index.js +54 -0
- package/lib/index.js +65 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.micromag-element-badge-container{border:2px solid #adadad;border-radius:100px;color:#adadad;display:inline-block;line-height:1;padding:4px 10px}
|
package/es/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import PropTypes$1 from 'prop-types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { PropTypes } from '@micromag/core';
|
|
7
|
+
import { getStyleFromBox } from '@micromag/core/utils';
|
|
8
|
+
import Text from '@micromag/element-text';
|
|
9
|
+
|
|
10
|
+
var styles = {"container":"micromag-element-badge-container"};
|
|
11
|
+
|
|
12
|
+
var propTypes = {
|
|
13
|
+
label: PropTypes.textElement,
|
|
14
|
+
boxStyle: PropTypes.boxStyle,
|
|
15
|
+
className: PropTypes$1.string,
|
|
16
|
+
labelClassName: PropTypes$1.string
|
|
17
|
+
};
|
|
18
|
+
var defaultProps = {
|
|
19
|
+
label: null,
|
|
20
|
+
boxStyle: null,
|
|
21
|
+
className: null,
|
|
22
|
+
labelClassName: null
|
|
23
|
+
};
|
|
24
|
+
function Badge(_ref) {
|
|
25
|
+
var label = _ref.label,
|
|
26
|
+
boxStyle = _ref.boxStyle,
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
labelClassName = _ref.labelClassName;
|
|
29
|
+
var _ref2 = label || {},
|
|
30
|
+
_ref2$textStyle = _ref2.textStyle,
|
|
31
|
+
textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
|
|
32
|
+
var _ref3 = textStyle || {},
|
|
33
|
+
_ref3$lineHeight = _ref3.lineHeight,
|
|
34
|
+
lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
|
|
35
|
+
var boxStyles = null;
|
|
36
|
+
if (boxStyle !== null) {
|
|
37
|
+
boxStyles = _objectSpread(_objectSpread({}, boxStyles), getStyleFromBox(boxStyle));
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
41
|
+
style: boxStyles
|
|
42
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
className: classNames([styles.label, _defineProperty({}, labelClassName, labelClassName !== null)])
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, label, {
|
|
45
|
+
textStyle: _objectSpread(_objectSpread({}, textStyle), {}, {
|
|
46
|
+
lineHeight: lineHeight || 1
|
|
47
|
+
}),
|
|
48
|
+
inline: true
|
|
49
|
+
}))));
|
|
50
|
+
}
|
|
51
|
+
Badge.propTypes = propTypes;
|
|
52
|
+
Badge.defaultProps = defaultProps;
|
|
53
|
+
|
|
54
|
+
export { Badge as default };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
5
|
+
var classNames = require('classnames');
|
|
6
|
+
var PropTypes = require('prop-types');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var core = require('@micromag/core');
|
|
9
|
+
var utils = require('@micromag/core/utils');
|
|
10
|
+
var Text = require('@micromag/element-text');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
|
+
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
16
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
17
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
|
+
var Text__default = /*#__PURE__*/_interopDefaultLegacy(Text);
|
|
20
|
+
|
|
21
|
+
var styles = {"container":"micromag-element-badge-container"};
|
|
22
|
+
|
|
23
|
+
var propTypes = {
|
|
24
|
+
label: core.PropTypes.textElement,
|
|
25
|
+
boxStyle: core.PropTypes.boxStyle,
|
|
26
|
+
className: PropTypes__default["default"].string,
|
|
27
|
+
labelClassName: PropTypes__default["default"].string
|
|
28
|
+
};
|
|
29
|
+
var defaultProps = {
|
|
30
|
+
label: null,
|
|
31
|
+
boxStyle: null,
|
|
32
|
+
className: null,
|
|
33
|
+
labelClassName: null
|
|
34
|
+
};
|
|
35
|
+
function Badge(_ref) {
|
|
36
|
+
var label = _ref.label,
|
|
37
|
+
boxStyle = _ref.boxStyle,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
labelClassName = _ref.labelClassName;
|
|
40
|
+
var _ref2 = label || {},
|
|
41
|
+
_ref2$textStyle = _ref2.textStyle,
|
|
42
|
+
textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
|
|
43
|
+
var _ref3 = textStyle || {},
|
|
44
|
+
_ref3$lineHeight = _ref3.lineHeight,
|
|
45
|
+
lineHeight = _ref3$lineHeight === void 0 ? null : _ref3$lineHeight;
|
|
46
|
+
var boxStyles = null;
|
|
47
|
+
if (boxStyle !== null) {
|
|
48
|
+
boxStyles = _objectSpread__default["default"](_objectSpread__default["default"]({}, boxStyles), utils.getStyleFromBox(boxStyle));
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
51
|
+
className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)]),
|
|
52
|
+
style: boxStyles
|
|
53
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
54
|
+
className: classNames__default["default"]([styles.label, _defineProperty__default["default"]({}, labelClassName, labelClassName !== null)])
|
|
55
|
+
}, /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({}, label, {
|
|
56
|
+
textStyle: _objectSpread__default["default"](_objectSpread__default["default"]({}, textStyle), {}, {
|
|
57
|
+
lineHeight: lineHeight || 1
|
|
58
|
+
}),
|
|
59
|
+
inline: true
|
|
60
|
+
}))));
|
|
61
|
+
}
|
|
62
|
+
Badge.propTypes = propTypes;
|
|
63
|
+
Badge.defaultProps = defaultProps;
|
|
64
|
+
|
|
65
|
+
module.exports = Badge;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@micromag/element-badge",
|
|
3
|
+
"version": "0.3.354",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"javascript"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/urbania-media/micromag-js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/urbania-media/micromag-js.git"
|
|
12
|
+
},
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "Folklore",
|
|
15
|
+
"email": "info@folklore.email"
|
|
16
|
+
},
|
|
17
|
+
"contributors": [
|
|
18
|
+
{
|
|
19
|
+
"name": "David Mongeau-Petitpas",
|
|
20
|
+
"email": "dmp@folklore.email"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Nicolas Roy-Bourdages",
|
|
24
|
+
"email": "nrb@folklore.email"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"license": "ISC",
|
|
28
|
+
"main": "lib/index.js",
|
|
29
|
+
"module": "es/index.js",
|
|
30
|
+
"files": [
|
|
31
|
+
"lib",
|
|
32
|
+
"es",
|
|
33
|
+
"assets"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"prepare": "../../scripts/prepare-package.sh"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
40
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
44
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@babel/runtime": "^7.13.10",
|
|
48
|
+
"@micromag/core": "^0.3.354",
|
|
49
|
+
"@micromag/element-text": "^0.3.354",
|
|
50
|
+
"classnames": "^2.2.6",
|
|
51
|
+
"lodash": "^4.17.21",
|
|
52
|
+
"prop-types": "^15.7.2",
|
|
53
|
+
"react-intl": "^5.12.1",
|
|
54
|
+
"uuid": "^9.0.0"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "ccf852d0a7df8f222365088e7de3843492e720e7"
|
|
60
|
+
}
|