@propellerads/badge 3.0.1 → 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.
@@ -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 || function (target) {
14
- for (var i = 1; i < arguments.length; i++) {
15
- var source = arguments[i];
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
- return target;
25
- };
26
-
27
- return _extends.apply(this, arguments);
18
+ return n;
19
+ }, _extends.apply(null, arguments);
28
20
  }
29
-
30
- function _taggedTemplateLiteralLoose(strings, raw) {
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
- function _templateObject7() {
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
- var StyledBadgeContainer = /*#__PURE__*/styled__default.div( /*#__PURE__*/_templateObject(), style.spacing, style.white, style.borderRadius / 2, function (props) {
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__*/_templateObject7(), style.spacing);
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
- label = _ref$label === void 0 ? '' : _ref$label,
136
- _ref$type = _ref.type,
137
- type = _ref$type === void 0 ? exports.BADGE_TYPE.INFO : _ref$type,
138
- _ref$customStyle = _ref.customStyle,
139
- customStyle = _ref$customStyle === void 0 ? {} : _ref$customStyle,
140
- _ref$icon = _ref.icon,
141
- icon = _ref$icon === void 0 ? undefined : _ref$icon;
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?: React.ReactChildren | string | React.ComponentElement<any, any>;\n type?: BADGE_TYPE;\n customStyle?: CustomStyle;\n icon?: React.ComponentElement<any, any>;\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, CustomStyle};\n"],"names":["BADGE_TYPE","getCustomStyle","props","StyledBadgeContainer","styled","div","style","type","INFO","css","WARNING","DANGER","SUCCESS","Boolean","Object","values","customStyle","length","StyledBadgeIcon","span","Badge","label","icon","undefined","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,WAAYA;AACVA,EAAAA,kBAAA,SAAA;AACAA,EAAAA,qBAAA,YAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,qBAAA,YAAA;AACD,CALD,EAAYA,kBAAU,KAAVA,kBAAU,KAAA,CAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD;AAAA,sBAA6BA,KAA7B;AAAA,CAAvB;;AAOA,IAAMC,oBAAoB,gBAAGC,eAAM,CAACC,GAAV,kCAGXC,aAHW,EAKfA,WALe,EAMPA,kBAAA,GAAqB,CANd,EAYtB,UAACJ,KAAD;AAAA,SACAA,KAAK,CAACK,IAAN,KAAeP,kBAAU,CAACQ,IAA1B,IACAC,UADA,qBAEsBH,iBAFtB,CADA;AAAA,CAZsB,EAkBtB,UAACJ,KAAD;AAAA,SACAA,KAAK,CAACK,IAAN,KAAeP,kBAAU,CAACU,OAA1B,IACAD,UADA,qBAEsBH,kBAFtB,CADA;AAAA,CAlBsB,EAwBpB,UAACJ,KAAD;AAAA,SACFA,KAAK,CAACK,IAAN,KAAeP,kBAAU,CAACW,MAA1B,IACAF,UADA,qBAEsBH,gBAFtB,CADE;AAAA,CAxBoB,EA8BpB,UAACJ,KAAD;AAAA,SACFA,KAAK,CAACK,IAAN,KAAeP,kBAAU,CAACY,OAA1B,IACAH,UADA,qBAEsBH,kBAFtB,CADE;AAAA,CA9BoB,EAqCpB,UAACJ,KAAD;AAAA,SACFW,OAAO,CAACC,MAAM,CAACC,MAAP,CAAcb,KAAK,CAACc,WAApB,EAAiCC,MAAlC,CAAP,IACAR,UADA,qBAEIR,cAAc,CAACC,KAAK,CAACc,WAAP,CAFlB,CADE;AAAA,CArCoB,CAA1B;AA4CA,IAAME,eAAe,gBAAGd,eAAM,CAACe,IAAV,mCACHb,aADG,CAArB;;ACnDA,IAAMc,KAAK,GAAG,SAARA,KAAQ;AAAA,wBAAEC,KAAF;AAAA,MAAEA,KAAF,2BAAU,EAAV;AAAA,uBAAcd,IAAd;AAAA,MAAcA,IAAd,0BAAqBP,kBAAU,CAACQ,IAAhC;AAAA,8BAAsCQ,WAAtC;AAAA,MAAsCA,WAAtC,iCAAoD,EAApD;AAAA,uBAAwDM,IAAxD;AAAA,MAAwDA,IAAxD,0BAA+DC,SAA/D;AAAA,SACZC,mBAAA,CAACrB,oBAAD;AAAsBI,IAAAA,IAAI,EAAEA;AAAMS,IAAAA,WAAW,EAAEA;GAA/C,EACGM,IAAI,IAAIE,mBAAA,CAACN,eAAD,MAAA,EAAkBI,IAAlB,CADX,EAEGD,KAFH,CADY;AAAA,CAAd;;;;"}
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,e=n(require("react")),t=require("styled-components"),o=n(t),u=require("@propellerads/stylevariables");function i(){return(i=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}return n}).apply(this,arguments)}function c(n,r){return r||(r=n.slice(0)),n.raw=r,n}function s(){var n=c(["\n margin-right: ","px;\n display: flex;\n align-items: center;\n"]);return s=function(){return n},n}function a(){var n=c(["\n ",",\n "]);return a=function(){return n},n}function l(){var n=c(["\n background-color: ",";\n "]);return l=function(){return n},n}function p(){var n=c(["\n background-color: ",";\n "]);return p=function(){return n},n}function f(){var n=c(["\n background-color: ",";\n "]);return f=function(){return n},n}function d(){var n=c(["\n background-color: ",";\n "]);return d=function(){return n},n}function v(){var n=c(["\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"]);return v=function(){return n},n}(r=exports.BADGE_TYPE||(exports.BADGE_TYPE={})).INFO="info",r.WARNING="warning",r.DANGER="danger",r.SUCCESS="success";var y=o.div(v(),u.spacing,u.white,u.borderRadius/2,(function(n){return n.type===exports.BADGE_TYPE.INFO&&t.css(d(),u.actionColor)}),(function(n){return n.type===exports.BADGE_TYPE.WARNING&&t.css(f(),u.warningColor)}),(function(n){return n.type===exports.BADGE_TYPE.DANGER&&t.css(p(),u.errorColor)}),(function(n){return n.type===exports.BADGE_TYPE.SUCCESS&&t.css(l(),u.successColor)}),(function(n){return Boolean(Object.values(n.customStyle).length)&&t.css(a(),function(n){return i({},n)}(n.customStyle))})),E=o.span(s(),u.spacing);exports.default=function(n){var r=n.label,t=void 0===r?"":r,o=n.type,u=void 0===o?exports.BADGE_TYPE.INFO:o,i=n.customStyle,c=n.icon,s=void 0===c?void 0:c;return e.createElement(y,{type:u,customStyle:void 0===i?{}:i},s&&e.createElement(E,null,s),t)};
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?: React.ReactChildren | string | React.ComponentElement<any, any>;\n type?: BADGE_TYPE;\n customStyle?: CustomStyle;\n icon?: React.ComponentElement<any, any>;\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, CustomStyle};\n"],"names":["BADGE_TYPE","StyledBadgeContainer","styled","div","style","props","type","INFO","css","WARNING","DANGER","SUCCESS","Boolean","Object","values","customStyle","length","getCustomStyle","StyledBadgeIcon","span","label","icon","undefined","React"],"mappings":"8IAEYA,+wCAAAA,EAAAA,qBAAAA,oCAEVA,oBACAA,kBACAA,oBCDF,IAOMC,EAAuBC,EAAOC,QAGrBC,UAEJA,QACQA,eAAqB,GAMpC,SAACC,UACDA,EAAMC,OAASN,mBAAWO,MAC1BC,UACsBJ,kBAGtB,SAACC,UACDA,EAAMC,OAASN,mBAAWS,SAC1BD,UACsBJ,mBAGpB,SAACC,UACHA,EAAMC,OAASN,mBAAWU,QAC1BF,UACsBJ,iBAGpB,SAACC,UACHA,EAAMC,OAASN,mBAAWW,SAC1BH,UACsBJ,mBAIpB,SAACC,UACHO,QAAQC,OAAOC,OAAOT,EAAMU,aAAaC,SACzCR,UA9CmB,SAACH,eAA4BA,GA+C5CY,CAAeZ,EAAMU,iBAIvBG,EAAkBhB,EAAOiB,SACbf,2BCpDJ,oBAAEgB,MAAAA,aAAQ,SAAId,KAAAA,aAAON,mBAAWO,WAAMQ,gBAAkBM,KAAAA,kBAAOC,WAC3EC,gBAACtB,GAAqBK,KAAMA,EAAMS,uBAD8B,MAE7DM,GAAQE,gBAACL,OAAiBG,GAC1BD"}
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 || function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
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
- return target;
18
- };
19
-
20
- return _extends.apply(this, arguments);
11
+ return n;
12
+ }, _extends.apply(null, arguments);
21
13
  }
22
-
23
- function _taggedTemplateLiteralLoose(strings, raw) {
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
- function _templateObject7() {
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
- var StyledBadgeContainer = /*#__PURE__*/styled.div( /*#__PURE__*/_templateObject(), spacing, white, borderRadius / 2, function (props) {
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__*/_templateObject7(), spacing);
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
- label = _ref$label === void 0 ? '' : _ref$label,
131
- _ref$type = _ref.type,
132
- type = _ref$type === void 0 ? BADGE_TYPE.INFO : _ref$type,
133
- _ref$customStyle = _ref.customStyle,
134
- customStyle = _ref$customStyle === void 0 ? {} : _ref$customStyle,
135
- _ref$icon = _ref.icon,
136
- icon = _ref$icon === void 0 ? undefined : _ref$icon;
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
@@ -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?: React.ReactChildren | string | React.ComponentElement<any, any>;\n type?: BADGE_TYPE;\n customStyle?: CustomStyle;\n icon?: React.ComponentElement<any, any>;\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, CustomStyle};\n"],"names":["BADGE_TYPE","getCustomStyle","props","StyledBadgeContainer","styled","div","style","type","INFO","css","WARNING","DANGER","SUCCESS","Boolean","Object","values","customStyle","length","StyledBadgeIcon","span","Badge","label","icon","undefined","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEYA;;AAAZ,WAAYA;AACVA,EAAAA,kBAAA,SAAA;AACAA,EAAAA,qBAAA,YAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,qBAAA,YAAA;AACD,CALD,EAAYA,UAAU,KAAVA,UAAU,KAAA,CAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD;AAAA,sBAA6BA,KAA7B;AAAA,CAAvB;;AAOA,IAAMC,oBAAoB,gBAAGC,MAAM,CAACC,GAAV,kCAGXC,OAHW,EAKfA,KALe,EAMPA,YAAA,GAAqB,CANd,EAYtB,UAACJ,KAAD;AAAA,SACAA,KAAK,CAACK,IAAN,KAAeP,UAAU,CAACQ,IAA1B,IACAC,GADA,qBAEsBH,WAFtB,CADA;AAAA,CAZsB,EAkBtB,UAACJ,KAAD;AAAA,SACAA,KAAK,CAACK,IAAN,KAAeP,UAAU,CAACU,OAA1B,IACAD,GADA,qBAEsBH,YAFtB,CADA;AAAA,CAlBsB,EAwBpB,UAACJ,KAAD;AAAA,SACFA,KAAK,CAACK,IAAN,KAAeP,UAAU,CAACW,MAA1B,IACAF,GADA,qBAEsBH,UAFtB,CADE;AAAA,CAxBoB,EA8BpB,UAACJ,KAAD;AAAA,SACFA,KAAK,CAACK,IAAN,KAAeP,UAAU,CAACY,OAA1B,IACAH,GADA,qBAEsBH,YAFtB,CADE;AAAA,CA9BoB,EAqCpB,UAACJ,KAAD;AAAA,SACFW,OAAO,CAACC,MAAM,CAACC,MAAP,CAAcb,KAAK,CAACc,WAApB,EAAiCC,MAAlC,CAAP,IACAR,GADA,qBAEIR,cAAc,CAACC,KAAK,CAACc,WAAP,CAFlB,CADE;AAAA,CArCoB,CAA1B;AA4CA,IAAME,eAAe,gBAAGd,MAAM,CAACe,IAAV,mCACHb,OADG,CAArB;;ACnDA,IAAMc,KAAK,GAAG,SAARA,KAAQ;AAAA,wBAAEC,KAAF;AAAA,MAAEA,KAAF,2BAAU,EAAV;AAAA,uBAAcd,IAAd;AAAA,MAAcA,IAAd,0BAAqBP,UAAU,CAACQ,IAAhC;AAAA,8BAAsCQ,WAAtC;AAAA,MAAsCA,WAAtC,iCAAoD,EAApD;AAAA,uBAAwDM,IAAxD;AAAA,MAAwDA,IAAxD,0BAA+DC,SAA/D;AAAA,SACZC,mBAAA,CAACrB,oBAAD;AAAsBI,IAAAA,IAAI,EAAEA;AAAMS,IAAAA,WAAW,EAAEA;GAA/C,EACGM,IAAI,IAAIE,mBAAA,CAACN,eAAD,MAAA,EAAkBI,IAAlB,CADX,EAEGD,KAFH,CADY;AAAA,CAAd;;;;;"}
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, CustomStyle };
5
+ export { BADGE_TYPE };
6
+ export type { CustomStyle };
package/dist/style.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- declare const StyledBadgeContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
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?: React.ReactChildren | string | React.ComponentElement<any, any>;
13
+ label?: ReactNode;
14
14
  type?: BADGE_TYPE;
15
15
  customStyle?: CustomStyle;
16
- icon?: React.ComponentElement<any, any>;
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.1",
3
+ "version": "3.0.2",
4
4
  "repository": "https://github.com/propellerads/ui-components",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -15,7 +15,6 @@
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
  },
@@ -25,14 +24,13 @@
25
24
  },
26
25
  "module": "dist/badge.esm.js",
27
26
  "devDependencies": {
28
- "@types/react": ">=18 <19",
29
27
  "@types/styled-components": "5.1.34",
30
- "tsdx": "^0.13.3",
31
- "tslib": "^2.0.1",
32
- "typescript": "^4.9.5"
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": "^1.3.0"
36
- },
37
- "gitHead": "e4a84ba8a4df9120d4940351f91ceaa947919574"
34
+ "@propellerads/stylevariables": "^2.0.1"
35
+ }
38
36
  }
package/src/index.tsx CHANGED
@@ -11,4 +11,5 @@ const Badge = ({label = '', type = BADGE_TYPE.INFO, customStyle = {}, icon = und
11
11
  );
12
12
 
13
13
  export default Badge;
14
- export {BADGE_TYPE, CustomStyle};
14
+ export {BADGE_TYPE};
15
+ export type {CustomStyle};
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?: React.ReactChildren | string | React.ComponentElement<any, any>;
16
+ label?: ReactNode;
17
17
  type?: BADGE_TYPE;
18
18
  customStyle?: CustomStyle;
19
- icon?: React.ComponentElement<any, any>;
19
+ icon?: ReactNode;
20
20
  }
21
21
 
22
22
  export default class Badge extends React.Component<BadgeProps> {}
package/CHANGELOG.md DELETED
@@ -1,35 +0,0 @@
1
- ## `3.0.1`
2
-
3
- - Fixed dependencies
4
-
5
- ## `3.0.0`
6
-
7
- - upgrade to React 18
8
-
9
- ## `2.4.0`
10
-
11
- - updated peerDependencies
12
-
13
- ## `2.3.0`
14
-
15
- - update style-variables
16
- - apply new border-radius 8px
17
-
18
- ## `2.2.0`
19
-
20
- - exported interface `CustomStyle`
21
- - Badge component exported as default module
22
-
23
- ## `2.1.0`
24
-
25
- - exported enum `BADGE_TYPE`
26
-
27
- ## `2.0.0`
28
-
29
- - TS
30
- - Production build
31
- - Breaking changes - an icon component became external
32
-
33
- ## `1.1.0`
34
-
35
- - Badge styles now fully customizable