@propellerads/badge 3.0.0 → 3.0.2
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/dist/badge.cjs.development.js +23 -107
- package/dist/badge.cjs.development.js.map +1 -1
- package/dist/badge.cjs.production.min.js +1 -1
- package/dist/badge.cjs.production.min.js.map +1 -1
- package/dist/badge.esm.js +23 -108
- package/dist/badge.esm.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/style.d.ts +6 -1
- package/dist/types.d.ts +3 -3
- package/package.json +8 -9
- package/src/index.tsx +2 -1
- package/src/style.tsx +3 -3
- package/src/types.ts +3 -3
|
@@ -10,30 +10,16 @@ var styled__default = _interopDefault(styled);
|
|
|
10
10
|
var style = require('@propellerads/stylevariables');
|
|
11
11
|
|
|
12
12
|
function _extends() {
|
|
13
|
-
_extends = Object.assign
|
|
14
|
-
for (var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
for (var key in source) {
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19
|
-
target[key] = source[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
13
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
14
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
15
|
+
var t = arguments[e];
|
|
16
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return _extends.apply(this, arguments);
|
|
18
|
+
return n;
|
|
19
|
+
}, _extends.apply(null, arguments);
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!raw) {
|
|
32
|
-
raw = strings.slice(0);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
strings.raw = raw;
|
|
36
|
-
return strings;
|
|
21
|
+
function _taggedTemplateLiteralLoose(e, t) {
|
|
22
|
+
return t || (t = e.slice(0)), e.raw = t, e;
|
|
37
23
|
}
|
|
38
24
|
|
|
39
25
|
(function (BADGE_TYPE) {
|
|
@@ -43,102 +29,32 @@ function _taggedTemplateLiteralLoose(strings, raw) {
|
|
|
43
29
|
BADGE_TYPE["SUCCESS"] = "success";
|
|
44
30
|
})(exports.BADGE_TYPE || (exports.BADGE_TYPE = {}));
|
|
45
31
|
|
|
46
|
-
|
|
47
|
-
var data = _taggedTemplateLiteralLoose(["\n margin-right: ", "px;\n display: flex;\n align-items: center;\n"]);
|
|
48
|
-
|
|
49
|
-
_templateObject7 = function _templateObject7() {
|
|
50
|
-
return data;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return data;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _templateObject6() {
|
|
57
|
-
var data = _taggedTemplateLiteralLoose(["\n ", ",\n "]);
|
|
58
|
-
|
|
59
|
-
_templateObject6 = function _templateObject6() {
|
|
60
|
-
return data;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _templateObject5() {
|
|
67
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
68
|
-
|
|
69
|
-
_templateObject5 = function _templateObject5() {
|
|
70
|
-
return data;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
return data;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function _templateObject4() {
|
|
77
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
78
|
-
|
|
79
|
-
_templateObject4 = function _templateObject4() {
|
|
80
|
-
return data;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return data;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function _templateObject3() {
|
|
87
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
88
|
-
|
|
89
|
-
_templateObject3 = function _templateObject3() {
|
|
90
|
-
return data;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
return data;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function _templateObject2() {
|
|
97
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
98
|
-
|
|
99
|
-
_templateObject2 = function _templateObject2() {
|
|
100
|
-
return data;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
return data;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function _templateObject() {
|
|
107
|
-
var data = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n padding: 0 ", "px;\n text-transform: uppercase;\n color: ", ";\n border-radius: ", "px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ", "\n\n ", "\n \n ", "\n \n ", "\n \n // Have priority\n ", "\n"]);
|
|
108
|
-
|
|
109
|
-
_templateObject = function _templateObject() {
|
|
110
|
-
return data;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
return data;
|
|
114
|
-
}
|
|
115
|
-
|
|
32
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
116
33
|
var getCustomStyle = function getCustomStyle(props) {
|
|
117
34
|
return _extends({}, props);
|
|
118
35
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return props.type === exports.BADGE_TYPE.INFO && styled.css(_templateObject2(), style.actionColor);
|
|
36
|
+
var StyledBadgeContainer = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n padding: 0 ", "px;\n text-transform: uppercase;\n color: ", ";\n border-radius: ", "px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n // Have priority\n ", "\n"])), style.spacing, style.white, style.borderRadius / 2, function (props) {
|
|
37
|
+
return props.type === exports.BADGE_TYPE.INFO && styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), style.actionColor);
|
|
122
38
|
}, function (props) {
|
|
123
|
-
return props.type === exports.BADGE_TYPE.WARNING && styled.css(_templateObject3(), style.warningColor);
|
|
39
|
+
return props.type === exports.BADGE_TYPE.WARNING && styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), style.warningColor);
|
|
124
40
|
}, function (props) {
|
|
125
|
-
return props.type === exports.BADGE_TYPE.DANGER && styled.css(_templateObject4(), style.errorColor);
|
|
41
|
+
return props.type === exports.BADGE_TYPE.DANGER && styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), style.errorColor);
|
|
126
42
|
}, function (props) {
|
|
127
|
-
return props.type === exports.BADGE_TYPE.SUCCESS && styled.css(_templateObject5(), style.successColor);
|
|
43
|
+
return props.type === exports.BADGE_TYPE.SUCCESS && styled.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), style.successColor);
|
|
128
44
|
}, function (props) {
|
|
129
|
-
return Boolean(Object.values(props.customStyle).length) && styled.css(_templateObject6(), getCustomStyle(props.customStyle));
|
|
45
|
+
return Boolean(Object.values(props.customStyle).length) && styled.css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n ", ",\n "])), getCustomStyle(props.customStyle));
|
|
130
46
|
});
|
|
131
|
-
var StyledBadgeIcon = /*#__PURE__*/styled__default.span( /*#__PURE__*/
|
|
47
|
+
var StyledBadgeIcon = /*#__PURE__*/styled__default.span(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-right: ", "px;\n display: flex;\n align-items: center;\n"])), style.spacing);
|
|
132
48
|
|
|
133
49
|
var Badge = function Badge(_ref) {
|
|
134
50
|
var _ref$label = _ref.label,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
51
|
+
label = _ref$label === void 0 ? '' : _ref$label,
|
|
52
|
+
_ref$type = _ref.type,
|
|
53
|
+
type = _ref$type === void 0 ? exports.BADGE_TYPE.INFO : _ref$type,
|
|
54
|
+
_ref$customStyle = _ref.customStyle,
|
|
55
|
+
customStyle = _ref$customStyle === void 0 ? {} : _ref$customStyle,
|
|
56
|
+
_ref$icon = _ref.icon,
|
|
57
|
+
icon = _ref$icon === void 0 ? undefined : _ref$icon;
|
|
142
58
|
return React.createElement(StyledBadgeContainer, {
|
|
143
59
|
type: type,
|
|
144
60
|
customStyle: customStyle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.cjs.development.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport enum BADGE_TYPE {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\nexport interface CustomStyle {\n color?: string;\n background?: string;\n}\n\nexport interface BadgeProps {\n label?:
|
|
1
|
+
{"version":3,"file":"badge.cjs.development.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum BADGE_TYPE {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\nexport interface CustomStyle {\n color?: string;\n background?: string;\n}\n\nexport interface BadgeProps {\n label?: ReactNode;\n type?: BADGE_TYPE;\n customStyle?: CustomStyle;\n icon?: ReactNode;\n}\n\nexport default class Badge extends React.Component<BadgeProps> {}\n","import styled, {css} from 'styled-components';\nimport * as style from '@propellerads/stylevariables';\n\nimport {BADGE_TYPE, CustomStyle} from './types';\n\nconst getCustomStyle = (props: CustomStyle) => ({...props});\n\ninterface StyledBadgeContainerProps {\n type: BADGE_TYPE;\n customStyle: CustomStyle;\n}\n\nconst StyledBadgeContainer = styled.div`\n display: inline-flex;\n align-items: center;\n padding: 0 ${style.spacing}px;\n text-transform: uppercase;\n color: ${style.white};\n border-radius: ${style.borderRadius / 2}px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.INFO &&\n css`\n background-color: ${style.actionColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.WARNING &&\n css`\n background-color: ${style.warningColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.DANGER &&\n css`\n background-color: ${style.errorColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.SUCCESS &&\n css`\n background-color: ${style.successColor};\n `}\n\n // Have priority\n ${(props: StyledBadgeContainerProps) =>\n Boolean(Object.values(props.customStyle).length) &&\n css`\n ${getCustomStyle(props.customStyle)},\n `}\n`;\n\nconst StyledBadgeIcon = styled.span`\n margin-right: ${style.spacing}px;\n display: flex;\n align-items: center;\n`;\n\nexport {StyledBadgeContainer, StyledBadgeIcon};\n","import React from 'react';\n\nimport {StyledBadgeContainer, StyledBadgeIcon} from './style';\nimport {BADGE_TYPE, BadgeProps, CustomStyle} from './types';\n\nconst Badge = ({label = '', type = BADGE_TYPE.INFO, customStyle = {}, icon = undefined}: BadgeProps) => (\n <StyledBadgeContainer type={type} customStyle={customStyle}>\n {icon && <StyledBadgeIcon>{icon}</StyledBadgeIcon>}\n {label}\n </StyledBadgeContainer>\n);\n\nexport default Badge;\nexport {BADGE_TYPE};\nexport type {CustomStyle};\n"],"names":["BADGE_TYPE","getCustomStyle","props","_extends","StyledBadgeContainer","styled","div","_templateObject","_taggedTemplateLiteralLoose","style","type","INFO","css","_templateObject2","WARNING","_templateObject3","DANGER","_templateObject4","SUCCESS","_templateObject5","Boolean","Object","values","customStyle","length","_templateObject6","StyledBadgeIcon","span","_templateObject7","Badge","_ref","_ref$label","label","_ref$type","_ref$customStyle","_ref$icon","icon","undefined","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,WAAYA,UAAU;EACpBA,2BAAa;EACbA,iCAAmB;EACnBA,+BAAiB;EACjBA,iCAAmB;AACrB,CAAC,EALWA,kBAAU,KAAVA,kBAAU;;;ACFtB,AAKA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAkB;EAAA,OAAAC,QAAA,KAAUD,KAAK;AAAA,CAAE;AAO3D,IAAME,oBAAoB,gBAAGC,eAAM,CAACC,GAAG,CAAAC,eAAA,KAAAA,eAAA,gBAAAC,2BAAA,kTAGxBC,aAAa,EAEjBA,WAAW,EACHA,kBAAkB,GAAG,CAAC,EAMrC,UAACP,KAAgC;EAAA,OACjCA,KAAK,CAACQ,IAAI,KAAKV,kBAAU,CAACW,IAAI,IAC9BC,UAAG,CAAAC,gBAAA,KAAAA,gBAAA,GAAAL,2BAAA,8CACmBC,iBAAiB,CACtC;AAAA,GAED,UAACP,KAAgC;EAAA,OACjCA,KAAK,CAACQ,IAAI,KAAKV,kBAAU,CAACc,OAAO,IACjCF,UAAG,CAAAG,gBAAA,KAAAA,gBAAA,GAAAP,2BAAA,8CACmBC,kBAAkB,CACvC;AAAA,GAEC,UAACP,KAAgC;EAAA,OACnCA,KAAK,CAACQ,IAAI,KAAKV,kBAAU,CAACgB,MAAM,IAChCJ,UAAG,CAAAK,gBAAA,KAAAA,gBAAA,GAAAT,2BAAA,8CACmBC,gBAAgB,CACrC;AAAA,GAEC,UAACP,KAAgC;EAAA,OACnCA,KAAK,CAACQ,IAAI,KAAKV,kBAAU,CAACkB,OAAO,IACjCN,UAAG,CAAAO,gBAAA,KAAAA,gBAAA,GAAAX,2BAAA,8CACmBC,kBAAkB,CACvC;AAAA,GAGC,UAACP,KAAgC;EAAA,OACnCkB,OAAO,CAACC,MAAM,CAACC,MAAM,CAACpB,KAAK,CAACqB,WAAW,CAAC,CAACC,MAAM,CAAC,IAChDZ,UAAG,CAAAa,gBAAA,KAAAA,gBAAA,GAAAjB,2BAAA,4BACCP,cAAc,CAACC,KAAK,CAACqB,WAAW,CAAC,CACpC;AAAA,EACJ;AAED,IAAMG,eAAe,gBAAGrB,eAAM,CAACsB,IAAI,CAAAC,gBAAA,KAAAA,gBAAA,gBAAApB,2BAAA,8EACjBC,aAAa,CAG9B;;ACvDD,IAAMoB,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA;EAAA,IAAAC,UAAA,GAAAD,IAAA,CAAKE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,EAAE,GAAAA,UAAA;IAAAE,SAAA,GAAAH,IAAA,CAAEpB,IAAI;IAAJA,IAAI,GAAAuB,SAAA,cAAGjC,kBAAU,CAACW,IAAI,GAAAsB,SAAA;IAAAC,gBAAA,GAAAJ,IAAA,CAAEP,WAAW;IAAXA,WAAW,GAAAW,gBAAA,cAAG,EAAE,GAAAA,gBAAA;IAAAC,SAAA,GAAAL,IAAA,CAAEM,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAGE,SAAS,GAAAF,SAAA;EAAA,OACpFG,oBAAClC,oBAAoB;IAACM,IAAI,EAAEA,IAAI;IAAEa,WAAW,EAAEA;KAC5Ca,IAAI,IAAIE,oBAACZ,eAAe,QAAEU,IAAI,CAAmB,EACjDJ,KAAK,CACe;AAAA,CACxB;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var r,
|
|
1
|
+
"use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t,o,i,s,c,l,a=n(require("react")),u=require("styled-components"),p=n(u),d=require("@propellerads/stylevariables");function f(){return(f=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)({}).hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n}).apply(null,arguments)}function g(n,e){return e||(e=n.slice(0)),n.raw=e,n}(e=exports.BADGE_TYPE||(exports.BADGE_TYPE={})).INFO="info",e.WARNING="warning",e.DANGER="danger",e.SUCCESS="success";var E=p.div(r||(r=g(["\n display: inline-flex;\n align-items: center;\n padding: 0 ","px;\n text-transform: uppercase;\n color: ",";\n border-radius: ","px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ","\n\n ","\n\n ","\n\n ","\n\n // Have priority\n ","\n"])),d.spacing,d.white,d.borderRadius/2,(function(n){return n.type===exports.BADGE_TYPE.INFO&&u.css(t||(t=g(["\n background-color: ",";\n "])),d.actionColor)}),(function(n){return n.type===exports.BADGE_TYPE.WARNING&&u.css(o||(o=g(["\n background-color: ",";\n "])),d.warningColor)}),(function(n){return n.type===exports.BADGE_TYPE.DANGER&&u.css(i||(i=g(["\n background-color: ",";\n "])),d.errorColor)}),(function(n){return n.type===exports.BADGE_TYPE.SUCCESS&&u.css(s||(s=g(["\n background-color: ",";\n "])),d.successColor)}),(function(n){return Boolean(Object.values(n.customStyle).length)&&u.css(c||(c=g(["\n ",",\n "])),function(n){return f({},n)}(n.customStyle))})),y=p.span(l||(l=g(["\n margin-right: ","px;\n display: flex;\n align-items: center;\n"])),d.spacing);exports.default=function(n){var e=n.label,r=void 0===e?"":e,t=n.type,o=void 0===t?exports.BADGE_TYPE.INFO:t,i=n.customStyle,s=n.icon,c=void 0===s?void 0:s;return a.createElement(E,{type:o,customStyle:void 0===i?{}:i},c&&a.createElement(y,null,c),r)};
|
|
2
2
|
//# sourceMappingURL=badge.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.cjs.production.min.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport enum BADGE_TYPE {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\nexport interface CustomStyle {\n color?: string;\n background?: string;\n}\n\nexport interface BadgeProps {\n label?:
|
|
1
|
+
{"version":3,"file":"badge.cjs.production.min.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum BADGE_TYPE {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\nexport interface CustomStyle {\n color?: string;\n background?: string;\n}\n\nexport interface BadgeProps {\n label?: ReactNode;\n type?: BADGE_TYPE;\n customStyle?: CustomStyle;\n icon?: ReactNode;\n}\n\nexport default class Badge extends React.Component<BadgeProps> {}\n","import styled, {css} from 'styled-components';\nimport * as style from '@propellerads/stylevariables';\n\nimport {BADGE_TYPE, CustomStyle} from './types';\n\nconst getCustomStyle = (props: CustomStyle) => ({...props});\n\ninterface StyledBadgeContainerProps {\n type: BADGE_TYPE;\n customStyle: CustomStyle;\n}\n\nconst StyledBadgeContainer = styled.div`\n display: inline-flex;\n align-items: center;\n padding: 0 ${style.spacing}px;\n text-transform: uppercase;\n color: ${style.white};\n border-radius: ${style.borderRadius / 2}px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.INFO &&\n css`\n background-color: ${style.actionColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.WARNING &&\n css`\n background-color: ${style.warningColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.DANGER &&\n css`\n background-color: ${style.errorColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.SUCCESS &&\n css`\n background-color: ${style.successColor};\n `}\n\n // Have priority\n ${(props: StyledBadgeContainerProps) =>\n Boolean(Object.values(props.customStyle).length) &&\n css`\n ${getCustomStyle(props.customStyle)},\n `}\n`;\n\nconst StyledBadgeIcon = styled.span`\n margin-right: ${style.spacing}px;\n display: flex;\n align-items: center;\n`;\n\nexport {StyledBadgeContainer, StyledBadgeIcon};\n","import React from 'react';\n\nimport {StyledBadgeContainer, StyledBadgeIcon} from './style';\nimport {BADGE_TYPE, BadgeProps, CustomStyle} from './types';\n\nconst Badge = ({label = '', type = BADGE_TYPE.INFO, customStyle = {}, icon = undefined}: BadgeProps) => (\n <StyledBadgeContainer type={type} customStyle={customStyle}>\n {icon && <StyledBadgeIcon>{icon}</StyledBadgeIcon>}\n {label}\n </StyledBadgeContainer>\n);\n\nexport default Badge;\nexport {BADGE_TYPE};\nexport type {CustomStyle};\n"],"names":["BADGE_TYPE","StyledBadgeContainer","styled","div","_templateObject","_taggedTemplateLiteralLoose","style","props","type","INFO","css","_templateObject2","WARNING","_templateObject3","DANGER","_templateObject4","SUCCESS","_templateObject5","Boolean","Object","values","customStyle","length","_templateObject6","_extends","getCustomStyle","StyledBadgeIcon","span","_templateObject7","_ref","_ref$label","label","_ref$type","_ref$customStyle","_ref$icon","icon","undefined","React"],"mappings":"8IAEYA,iYAAAA,EAAAA,qBAAAA,oCAEVA,oBACAA,kBACAA,oBCDF,IAOMC,EAAuBC,EAAOC,IAAGC,IAAAA,EAAAC,0SAGxBC,UAEJA,QACQA,eAAqB,GAMpC,SAACC,GAAgC,OACjCA,EAAMC,OAASR,mBAAWS,MAC1BC,MAAGC,IAAAA,EAAAN,6CACmBC,kBAGtB,SAACC,GAAgC,OACjCA,EAAMC,OAASR,mBAAWY,SAC1BF,MAAGG,IAAAA,EAAAR,6CACmBC,mBAGpB,SAACC,GAAgC,OACnCA,EAAMC,OAASR,mBAAWc,QAC1BJ,MAAGK,IAAAA,EAAAV,6CACmBC,iBAGpB,SAACC,GAAgC,OACnCA,EAAMC,OAASR,mBAAWgB,SAC1BN,MAAGO,IAAAA,EAAAZ,6CACmBC,mBAIpB,SAACC,GAAgC,OACnCW,QAAQC,OAAOC,OAAOb,EAAMc,aAAaC,SACzCZ,MAAGa,IAAAA,EAAAlB,2BA9CgB,SAACE,GAAkB,OAAAiB,KAAUjB,GA+C5CkB,CAAelB,EAAMc,iBAIvBK,EAAkBxB,EAAOyB,KAAIC,IAAAA,EAAAvB,6EACjBC,2BCpDJ,SAAHuB,GAAA,IAAAC,EAAAD,EAAKE,MAAAA,WAAKD,EAAG,GAAEA,EAAAE,EAAAH,EAAErB,KAAAA,WAAIwB,EAAGhC,mBAAWS,KAAIuB,EAAAC,EAAAJ,EAAER,YAAgBa,EAAAL,EAAEM,KAAAA,WAAID,OAAGE,EAASF,EAAA,OACpFG,gBAACpC,GAAqBO,KAAMA,EAAMa,qBAD2BY,EAAG,GAAEA,GAE/DE,GAAQE,gBAACX,OAAiBS,GAC1BJ"}
|
package/dist/badge.esm.js
CHANGED
|
@@ -3,34 +3,19 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
import { spacing, white, borderRadius, actionColor, warningColor, errorColor, successColor } from '@propellerads/stylevariables';
|
|
4
4
|
|
|
5
5
|
function _extends() {
|
|
6
|
-
_extends = Object.assign
|
|
7
|
-
for (var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
for (var key in source) {
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
-
target[key] = source[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
6
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
7
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
8
|
+
var t = arguments[e];
|
|
9
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return _extends.apply(this, arguments);
|
|
11
|
+
return n;
|
|
12
|
+
}, _extends.apply(null, arguments);
|
|
21
13
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!raw) {
|
|
25
|
-
raw = strings.slice(0);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
strings.raw = raw;
|
|
29
|
-
return strings;
|
|
14
|
+
function _taggedTemplateLiteralLoose(e, t) {
|
|
15
|
+
return t || (t = e.slice(0)), e.raw = t, e;
|
|
30
16
|
}
|
|
31
17
|
|
|
32
18
|
var BADGE_TYPE;
|
|
33
|
-
|
|
34
19
|
(function (BADGE_TYPE) {
|
|
35
20
|
BADGE_TYPE["INFO"] = "info";
|
|
36
21
|
BADGE_TYPE["WARNING"] = "warning";
|
|
@@ -38,102 +23,32 @@ var BADGE_TYPE;
|
|
|
38
23
|
BADGE_TYPE["SUCCESS"] = "success";
|
|
39
24
|
})(BADGE_TYPE || (BADGE_TYPE = {}));
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
var data = _taggedTemplateLiteralLoose(["\n margin-right: ", "px;\n display: flex;\n align-items: center;\n"]);
|
|
43
|
-
|
|
44
|
-
_templateObject7 = function _templateObject7() {
|
|
45
|
-
return data;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _templateObject6() {
|
|
52
|
-
var data = _taggedTemplateLiteralLoose(["\n ", ",\n "]);
|
|
53
|
-
|
|
54
|
-
_templateObject6 = function _templateObject6() {
|
|
55
|
-
return data;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return data;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _templateObject5() {
|
|
62
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
63
|
-
|
|
64
|
-
_templateObject5 = function _templateObject5() {
|
|
65
|
-
return data;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return data;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _templateObject4() {
|
|
72
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
73
|
-
|
|
74
|
-
_templateObject4 = function _templateObject4() {
|
|
75
|
-
return data;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
return data;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function _templateObject3() {
|
|
82
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
83
|
-
|
|
84
|
-
_templateObject3 = function _templateObject3() {
|
|
85
|
-
return data;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return data;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function _templateObject2() {
|
|
92
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "]);
|
|
93
|
-
|
|
94
|
-
_templateObject2 = function _templateObject2() {
|
|
95
|
-
return data;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
return data;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function _templateObject() {
|
|
102
|
-
var data = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n padding: 0 ", "px;\n text-transform: uppercase;\n color: ", ";\n border-radius: ", "px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ", "\n\n ", "\n \n ", "\n \n ", "\n \n // Have priority\n ", "\n"]);
|
|
103
|
-
|
|
104
|
-
_templateObject = function _templateObject() {
|
|
105
|
-
return data;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return data;
|
|
109
|
-
}
|
|
110
|
-
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
111
27
|
var getCustomStyle = function getCustomStyle(props) {
|
|
112
28
|
return _extends({}, props);
|
|
113
29
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return props.type === BADGE_TYPE.INFO && css(_templateObject2(), actionColor);
|
|
30
|
+
var StyledBadgeContainer = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n padding: 0 ", "px;\n text-transform: uppercase;\n color: ", ";\n border-radius: ", "px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n // Have priority\n ", "\n"])), spacing, white, borderRadius / 2, function (props) {
|
|
31
|
+
return props.type === BADGE_TYPE.INFO && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), actionColor);
|
|
117
32
|
}, function (props) {
|
|
118
|
-
return props.type === BADGE_TYPE.WARNING && css(_templateObject3(), warningColor);
|
|
33
|
+
return props.type === BADGE_TYPE.WARNING && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), warningColor);
|
|
119
34
|
}, function (props) {
|
|
120
|
-
return props.type === BADGE_TYPE.DANGER && css(_templateObject4(), errorColor);
|
|
35
|
+
return props.type === BADGE_TYPE.DANGER && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), errorColor);
|
|
121
36
|
}, function (props) {
|
|
122
|
-
return props.type === BADGE_TYPE.SUCCESS && css(_templateObject5(), successColor);
|
|
37
|
+
return props.type === BADGE_TYPE.SUCCESS && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), successColor);
|
|
123
38
|
}, function (props) {
|
|
124
|
-
return Boolean(Object.values(props.customStyle).length) && css(_templateObject6(), getCustomStyle(props.customStyle));
|
|
39
|
+
return Boolean(Object.values(props.customStyle).length) && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n ", ",\n "])), getCustomStyle(props.customStyle));
|
|
125
40
|
});
|
|
126
|
-
var StyledBadgeIcon = /*#__PURE__*/styled.span( /*#__PURE__*/
|
|
41
|
+
var StyledBadgeIcon = /*#__PURE__*/styled.span(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-right: ", "px;\n display: flex;\n align-items: center;\n"])), spacing);
|
|
127
42
|
|
|
128
43
|
var Badge = function Badge(_ref) {
|
|
129
44
|
var _ref$label = _ref.label,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
45
|
+
label = _ref$label === void 0 ? '' : _ref$label,
|
|
46
|
+
_ref$type = _ref.type,
|
|
47
|
+
type = _ref$type === void 0 ? BADGE_TYPE.INFO : _ref$type,
|
|
48
|
+
_ref$customStyle = _ref.customStyle,
|
|
49
|
+
customStyle = _ref$customStyle === void 0 ? {} : _ref$customStyle,
|
|
50
|
+
_ref$icon = _ref.icon,
|
|
51
|
+
icon = _ref$icon === void 0 ? undefined : _ref$icon;
|
|
137
52
|
return React.createElement(StyledBadgeContainer, {
|
|
138
53
|
type: type,
|
|
139
54
|
customStyle: customStyle
|
package/dist/badge.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.esm.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport enum BADGE_TYPE {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\nexport interface CustomStyle {\n color?: string;\n background?: string;\n}\n\nexport interface BadgeProps {\n label?:
|
|
1
|
+
{"version":3,"file":"badge.esm.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum BADGE_TYPE {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\nexport interface CustomStyle {\n color?: string;\n background?: string;\n}\n\nexport interface BadgeProps {\n label?: ReactNode;\n type?: BADGE_TYPE;\n customStyle?: CustomStyle;\n icon?: ReactNode;\n}\n\nexport default class Badge extends React.Component<BadgeProps> {}\n","import styled, {css} from 'styled-components';\nimport * as style from '@propellerads/stylevariables';\n\nimport {BADGE_TYPE, CustomStyle} from './types';\n\nconst getCustomStyle = (props: CustomStyle) => ({...props});\n\ninterface StyledBadgeContainerProps {\n type: BADGE_TYPE;\n customStyle: CustomStyle;\n}\n\nconst StyledBadgeContainer = styled.div`\n display: inline-flex;\n align-items: center;\n padding: 0 ${style.spacing}px;\n text-transform: uppercase;\n color: ${style.white};\n border-radius: ${style.borderRadius / 2}px;\n font-size: 10px;\n line-height: 1.5;\n min-height: 16px;\n\n // Color\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.INFO &&\n css`\n background-color: ${style.actionColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.WARNING &&\n css`\n background-color: ${style.warningColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.DANGER &&\n css`\n background-color: ${style.errorColor};\n `}\n\n ${(props: StyledBadgeContainerProps) =>\n props.type === BADGE_TYPE.SUCCESS &&\n css`\n background-color: ${style.successColor};\n `}\n\n // Have priority\n ${(props: StyledBadgeContainerProps) =>\n Boolean(Object.values(props.customStyle).length) &&\n css`\n ${getCustomStyle(props.customStyle)},\n `}\n`;\n\nconst StyledBadgeIcon = styled.span`\n margin-right: ${style.spacing}px;\n display: flex;\n align-items: center;\n`;\n\nexport {StyledBadgeContainer, StyledBadgeIcon};\n","import React from 'react';\n\nimport {StyledBadgeContainer, StyledBadgeIcon} from './style';\nimport {BADGE_TYPE, BadgeProps, CustomStyle} from './types';\n\nconst Badge = ({label = '', type = BADGE_TYPE.INFO, customStyle = {}, icon = undefined}: BadgeProps) => (\n <StyledBadgeContainer type={type} customStyle={customStyle}>\n {icon && <StyledBadgeIcon>{icon}</StyledBadgeIcon>}\n {label}\n </StyledBadgeContainer>\n);\n\nexport default Badge;\nexport {BADGE_TYPE};\nexport type {CustomStyle};\n"],"names":["BADGE_TYPE","getCustomStyle","props","_extends","StyledBadgeContainer","styled","div","_templateObject","_taggedTemplateLiteralLoose","style","type","INFO","css","_templateObject2","WARNING","_templateObject3","DANGER","_templateObject4","SUCCESS","_templateObject5","Boolean","Object","values","customStyle","length","_templateObject6","StyledBadgeIcon","span","_templateObject7","Badge","_ref","_ref$label","label","_ref$type","_ref$customStyle","_ref$icon","icon","undefined","React"],"mappings":";;;;;;;;;;;;;;;;;IAEYA;AAAZ,WAAYA,UAAU;EACpBA,2BAAa;EACbA,iCAAmB;EACnBA,+BAAiB;EACjBA,iCAAmB;AACrB,CAAC,EALWA,UAAU,KAAVA,UAAU;;;ACFtB,AAKA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAkB;EAAA,OAAAC,QAAA,KAAUD,KAAK;AAAA,CAAE;AAO3D,IAAME,oBAAoB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,eAAA,KAAAA,eAAA,gBAAAC,2BAAA,kTAGxBC,OAAa,EAEjBA,KAAW,EACHA,YAAkB,GAAG,CAAC,EAMrC,UAACP,KAAgC;EAAA,OACjCA,KAAK,CAACQ,IAAI,KAAKV,UAAU,CAACW,IAAI,IAC9BC,GAAG,CAAAC,gBAAA,KAAAA,gBAAA,GAAAL,2BAAA,8CACmBC,WAAiB,CACtC;AAAA,GAED,UAACP,KAAgC;EAAA,OACjCA,KAAK,CAACQ,IAAI,KAAKV,UAAU,CAACc,OAAO,IACjCF,GAAG,CAAAG,gBAAA,KAAAA,gBAAA,GAAAP,2BAAA,8CACmBC,YAAkB,CACvC;AAAA,GAEC,UAACP,KAAgC;EAAA,OACnCA,KAAK,CAACQ,IAAI,KAAKV,UAAU,CAACgB,MAAM,IAChCJ,GAAG,CAAAK,gBAAA,KAAAA,gBAAA,GAAAT,2BAAA,8CACmBC,UAAgB,CACrC;AAAA,GAEC,UAACP,KAAgC;EAAA,OACnCA,KAAK,CAACQ,IAAI,KAAKV,UAAU,CAACkB,OAAO,IACjCN,GAAG,CAAAO,gBAAA,KAAAA,gBAAA,GAAAX,2BAAA,8CACmBC,YAAkB,CACvC;AAAA,GAGC,UAACP,KAAgC;EAAA,OACnCkB,OAAO,CAACC,MAAM,CAACC,MAAM,CAACpB,KAAK,CAACqB,WAAW,CAAC,CAACC,MAAM,CAAC,IAChDZ,GAAG,CAAAa,gBAAA,KAAAA,gBAAA,GAAAjB,2BAAA,4BACCP,cAAc,CAACC,KAAK,CAACqB,WAAW,CAAC,CACpC;AAAA,EACJ;AAED,IAAMG,eAAe,gBAAGrB,MAAM,CAACsB,IAAI,CAAAC,gBAAA,KAAAA,gBAAA,gBAAApB,2BAAA,8EACjBC,OAAa,CAG9B;;ACvDD,IAAMoB,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA;EAAA,IAAAC,UAAA,GAAAD,IAAA,CAAKE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,EAAE,GAAAA,UAAA;IAAAE,SAAA,GAAAH,IAAA,CAAEpB,IAAI;IAAJA,IAAI,GAAAuB,SAAA,cAAGjC,UAAU,CAACW,IAAI,GAAAsB,SAAA;IAAAC,gBAAA,GAAAJ,IAAA,CAAEP,WAAW;IAAXA,WAAW,GAAAW,gBAAA,cAAG,EAAE,GAAAA,gBAAA;IAAAC,SAAA,GAAAL,IAAA,CAAEM,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAGE,SAAS,GAAAF,SAAA;EAAA,OACpFG,oBAAClC,oBAAoB;IAACM,IAAI,EAAEA,IAAI;IAAEa,WAAW,EAAEA;KAC5Ca,IAAI,IAAIE,oBAACZ,eAAe,QAAEU,IAAI,CAAmB,EACjDJ,KAAK,CACe;AAAA,CACxB;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { BADGE_TYPE, BadgeProps, CustomStyle } from './types';
|
|
3
3
|
declare const Badge: ({ label, type, customStyle, icon }: BadgeProps) => React.JSX.Element;
|
|
4
4
|
export default Badge;
|
|
5
|
-
export { BADGE_TYPE
|
|
5
|
+
export { BADGE_TYPE };
|
|
6
|
+
export type { CustomStyle };
|
package/dist/style.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { BADGE_TYPE, CustomStyle } from './types';
|
|
2
|
+
interface StyledBadgeContainerProps {
|
|
3
|
+
type: BADGE_TYPE;
|
|
4
|
+
customStyle: CustomStyle;
|
|
5
|
+
}
|
|
6
|
+
declare const StyledBadgeContainer: import("styled-components").StyledComponent<"div", any, StyledBadgeContainerProps, never>;
|
|
2
7
|
declare const StyledBadgeIcon: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
8
|
export { StyledBadgeContainer, StyledBadgeIcon };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
export declare enum BADGE_TYPE {
|
|
3
3
|
INFO = "info",
|
|
4
4
|
WARNING = "warning",
|
|
@@ -10,10 +10,10 @@ export interface CustomStyle {
|
|
|
10
10
|
background?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface BadgeProps {
|
|
13
|
-
label?:
|
|
13
|
+
label?: ReactNode;
|
|
14
14
|
type?: BADGE_TYPE;
|
|
15
15
|
customStyle?: CustomStyle;
|
|
16
|
-
icon?:
|
|
16
|
+
icon?: ReactNode;
|
|
17
17
|
}
|
|
18
18
|
export default class Badge extends React.Component<BadgeProps> {
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/badge",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"repository": "https://github.com/propellerads/ui-components",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,23 +15,22 @@
|
|
|
15
15
|
"node": ">=10"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"prepublishOnly": "tsdx build",
|
|
19
18
|
"start": "tsdx watch",
|
|
20
19
|
"build": "tsdx build"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"react": ">=18 <19",
|
|
24
|
-
"styled-components": "5.1.1"
|
|
25
|
-
"@types/styled-components": "5.1.34"
|
|
23
|
+
"styled-components": "5.1.1"
|
|
26
24
|
},
|
|
27
25
|
"module": "dist/badge.esm.js",
|
|
28
26
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
27
|
+
"@types/styled-components": "5.1.34",
|
|
28
|
+
"tsdx": "0.13.3",
|
|
29
|
+
"tslib": "2.0.1",
|
|
30
|
+
"typescript": "4.9.5",
|
|
31
|
+
"@types/react": "18.3.24"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@propellerads/stylevariables": "^
|
|
34
|
+
"@propellerads/stylevariables": "^2.0.1"
|
|
36
35
|
}
|
|
37
36
|
}
|
package/src/index.tsx
CHANGED
package/src/style.tsx
CHANGED
|
@@ -33,19 +33,19 @@ const StyledBadgeContainer = styled.div`
|
|
|
33
33
|
css`
|
|
34
34
|
background-color: ${style.warningColor};
|
|
35
35
|
`}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
${(props: StyledBadgeContainerProps) =>
|
|
38
38
|
props.type === BADGE_TYPE.DANGER &&
|
|
39
39
|
css`
|
|
40
40
|
background-color: ${style.errorColor};
|
|
41
41
|
`}
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
${(props: StyledBadgeContainerProps) =>
|
|
44
44
|
props.type === BADGE_TYPE.SUCCESS &&
|
|
45
45
|
css`
|
|
46
46
|
background-color: ${style.successColor};
|
|
47
47
|
`}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
// Have priority
|
|
50
50
|
${(props: StyledBadgeContainerProps) =>
|
|
51
51
|
Boolean(Object.values(props.customStyle).length) &&
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {ReactNode} from 'react';
|
|
2
2
|
|
|
3
3
|
export enum BADGE_TYPE {
|
|
4
4
|
INFO = 'info',
|
|
@@ -13,10 +13,10 @@ export interface CustomStyle {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface BadgeProps {
|
|
16
|
-
label?:
|
|
16
|
+
label?: ReactNode;
|
|
17
17
|
type?: BADGE_TYPE;
|
|
18
18
|
customStyle?: CustomStyle;
|
|
19
|
-
icon?:
|
|
19
|
+
icon?: ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default class Badge extends React.Component<BadgeProps> {}
|