@sproutsocial/seeds-react-badge 1.0.0 → 1.0.1
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +9 -0
- package/dist/esm/index.js +32 -54
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +35 -57
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,14 +8,14 @@ CLI Target: es2022
|
|
|
8
8
|
CLI Cleaning output folder
|
|
9
9
|
CJS Build start
|
|
10
10
|
ESM Build start
|
|
11
|
-
CJS dist/index.js 24.
|
|
12
|
-
CJS dist/index.js.map 6.
|
|
13
|
-
CJS ⚡️ Build success in
|
|
14
|
-
ESM dist/esm/index.js 22.
|
|
15
|
-
ESM dist/esm/index.js.map 6.
|
|
16
|
-
ESM ⚡️ Build success in
|
|
11
|
+
CJS dist/index.js 24.39 KB
|
|
12
|
+
CJS dist/index.js.map 6.60 KB
|
|
13
|
+
CJS ⚡️ Build success in 299ms
|
|
14
|
+
ESM dist/esm/index.js 22.41 KB
|
|
15
|
+
ESM dist/esm/index.js.map 6.51 KB
|
|
16
|
+
ESM ⚡️ Build success in 306ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
18
|
+
DTS ⚡️ Build success in 39587ms
|
|
19
19
|
DTS dist/index.d.ts 2.22 KB
|
|
20
20
|
DTS dist/index.d.mts 2.22 KB
|
|
21
|
-
Done in
|
|
21
|
+
Done in 46.86s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-badge
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9fd8bac: Update dependencies to use semantic package version instead of wildcards
|
|
8
|
+
- Updated dependencies [9fd8bac]
|
|
9
|
+
- @sproutsocial/seeds-react-icon@1.1.2
|
|
10
|
+
- @sproutsocial/seeds-react-box@1.1.2
|
|
11
|
+
|
|
3
12
|
## 1.0.0
|
|
4
13
|
|
|
5
14
|
### Major Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -16,33 +16,26 @@ var te = Object.getPrototypeOf;
|
|
|
16
16
|
var oe = Object.prototype.hasOwnProperty;
|
|
17
17
|
var ae = (a3, r) => () => (r || a3((r = { exports: {} }).exports, r), r.exports);
|
|
18
18
|
var se = (a3, r, e, o) => {
|
|
19
|
-
if (r && typeof r == "object" || typeof r == "function")
|
|
20
|
-
for (let t of ee(r))
|
|
21
|
-
!oe.call(a3, t) && t !== e && _(a3, t, { get: () => r[t], enumerable: !(o = re(r, t)) || o.enumerable });
|
|
19
|
+
if (r && typeof r == "object" || typeof r == "function") for (let t of ee(r)) !oe.call(a3, t) && t !== e && _(a3, t, { get: () => r[t], enumerable: !(o = re(r, t)) || o.enumerable });
|
|
22
20
|
return a3;
|
|
23
21
|
};
|
|
24
22
|
var ie = (a3, r, e) => (e = a3 != null ? _r(te(a3)) : {}, se(!a3 || !a3.__esModule ? _(e, "default", { value: a3, enumerable: true }) : e, a3));
|
|
25
23
|
var tr = ae(($e, er) => {
|
|
26
24
|
var rr = Object.getOwnPropertySymbols, pe = Object.prototype.hasOwnProperty, ne = Object.prototype.propertyIsEnumerable;
|
|
27
25
|
function de(a3) {
|
|
28
|
-
if (a3 == null)
|
|
29
|
-
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
26
|
+
if (a3 == null) throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
30
27
|
return Object(a3);
|
|
31
28
|
}
|
|
32
29
|
function le() {
|
|
33
30
|
try {
|
|
34
|
-
if (!Object.assign)
|
|
35
|
-
return false;
|
|
31
|
+
if (!Object.assign) return false;
|
|
36
32
|
var a3 = new String("abc");
|
|
37
|
-
if (a3[5] = "de", Object.getOwnPropertyNames(a3)[0] === "5")
|
|
38
|
-
|
|
39
|
-
for (var r = {}, e = 0; e < 10; e++)
|
|
40
|
-
r["_" + String.fromCharCode(e)] = e;
|
|
33
|
+
if (a3[5] = "de", Object.getOwnPropertyNames(a3)[0] === "5") return false;
|
|
34
|
+
for (var r = {}, e = 0; e < 10; e++) r["_" + String.fromCharCode(e)] = e;
|
|
41
35
|
var o = Object.getOwnPropertyNames(r).map(function(s) {
|
|
42
36
|
return r[s];
|
|
43
37
|
});
|
|
44
|
-
if (o.join("") !== "0123456789")
|
|
45
|
-
return false;
|
|
38
|
+
if (o.join("") !== "0123456789") return false;
|
|
46
39
|
var t = {};
|
|
47
40
|
return "abcdefghijklmnopqrst".split("").forEach(function(s) {
|
|
48
41
|
t[s] = s;
|
|
@@ -54,12 +47,10 @@ var tr = ae(($e, er) => {
|
|
|
54
47
|
er.exports = le() ? Object.assign : function(a3, r) {
|
|
55
48
|
for (var e, o = de(a3), t, s = 1; s < arguments.length; s++) {
|
|
56
49
|
e = Object(arguments[s]);
|
|
57
|
-
for (var i in e)
|
|
58
|
-
pe.call(e, i) && (o[i] = e[i]);
|
|
50
|
+
for (var i in e) pe.call(e, i) && (o[i] = e[i]);
|
|
59
51
|
if (rr) {
|
|
60
52
|
t = rr(e);
|
|
61
|
-
for (var p = 0; p < t.length; p++)
|
|
62
|
-
ne.call(e, t[p]) && (o[t[p]] = e[t[p]]);
|
|
53
|
+
for (var p = 0; p < t.length; p++) ne.call(e, t[p]) && (o[t[p]] = e[t[p]]);
|
|
63
54
|
}
|
|
64
55
|
}
|
|
65
56
|
return o;
|
|
@@ -92,26 +83,24 @@ var ge = function(r, e) {
|
|
|
92
83
|
return P(e, r, r);
|
|
93
84
|
};
|
|
94
85
|
var P = function(r, e, o, t, s) {
|
|
95
|
-
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++)
|
|
96
|
-
r = r ? r[e[t]] : s;
|
|
86
|
+
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++) r = r ? r[e[t]] : s;
|
|
97
87
|
return r === s ? o : r;
|
|
98
88
|
};
|
|
99
89
|
var j = function a(r) {
|
|
100
90
|
var e = {}, o = function(i) {
|
|
101
91
|
var p = {}, c = false, d = i.theme && i.theme.disableStyledSystemCache;
|
|
102
|
-
for (var g in i)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
e.media = !d && e.media || [null].concat(e.breakpoints.map(ar)), p = or(p, fe(e.media, m, x, u, i));
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
u !== null && (p = or(p, ue(e.breakpoints, m, x, u, i)), c = true);
|
|
92
|
+
for (var g in i) if (r[g]) {
|
|
93
|
+
var m = r[g], u = i[g], x = P(i.theme, m.scale, m.defaults);
|
|
94
|
+
if (typeof u == "object") {
|
|
95
|
+
if (e.breakpoints = !d && e.breakpoints || P(i.theme, "breakpoints", me.breakpoints), Array.isArray(u)) {
|
|
96
|
+
e.media = !d && e.media || [null].concat(e.breakpoints.map(ar)), p = or(p, fe(e.media, m, x, u, i));
|
|
111
97
|
continue;
|
|
112
98
|
}
|
|
113
|
-
(
|
|
99
|
+
u !== null && (p = or(p, ue(e.breakpoints, m, x, u, i)), c = true);
|
|
100
|
+
continue;
|
|
114
101
|
}
|
|
102
|
+
(0, R.default)(p, m(u, x, i));
|
|
103
|
+
}
|
|
115
104
|
return c && (p = ce(p)), p;
|
|
116
105
|
};
|
|
117
106
|
o.config = r, o.propNames = Object.keys(r), o.cache = e;
|
|
@@ -127,8 +116,7 @@ var fe = function(r, e, o, t, s) {
|
|
|
127
116
|
var i = {};
|
|
128
117
|
return t.slice(0, r.length).forEach(function(p, c) {
|
|
129
118
|
var d = r[c], g = e(p, o, s);
|
|
130
|
-
if (!d)
|
|
131
|
-
(0, R.default)(i, g);
|
|
119
|
+
if (!d) (0, R.default)(i, g);
|
|
132
120
|
else {
|
|
133
121
|
var m;
|
|
134
122
|
(0, R.default)(i, (m = {}, m[d] = (0, R.default)({}, i[d], g), m));
|
|
@@ -139,8 +127,7 @@ var ue = function(r, e, o, t, s) {
|
|
|
139
127
|
var i = {};
|
|
140
128
|
for (var p in t) {
|
|
141
129
|
var c = r[p], d = t[p], g = e(d, o, s);
|
|
142
|
-
if (!c)
|
|
143
|
-
(0, R.default)(i, g);
|
|
130
|
+
if (!c) (0, R.default)(i, g);
|
|
144
131
|
else {
|
|
145
132
|
var m, u = ar(c);
|
|
146
133
|
(0, R.default)(i, (m = {}, m[u] = (0, R.default)({}, i[u], g), m));
|
|
@@ -153,10 +140,9 @@ var X = function(r) {
|
|
|
153
140
|
e = e || [o];
|
|
154
141
|
var c = function(g, m, u) {
|
|
155
142
|
var x = {}, B = i(g, m, u);
|
|
156
|
-
if (B !== null)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}), x;
|
|
143
|
+
if (B !== null) return e.forEach(function(z) {
|
|
144
|
+
x[z] = B;
|
|
145
|
+
}), x;
|
|
160
146
|
};
|
|
161
147
|
return c.scale = t, c.defaults = p, c;
|
|
162
148
|
};
|
|
@@ -179,8 +165,7 @@ var l = function(r) {
|
|
|
179
165
|
return o;
|
|
180
166
|
};
|
|
181
167
|
var y = function() {
|
|
182
|
-
for (var r = {}, e = arguments.length, o = new Array(e), t = 0; t < e; t++)
|
|
183
|
-
o[t] = arguments[t];
|
|
168
|
+
for (var r = {}, e = arguments.length, o = new Array(e), t = 0; t < e; t++) o[t] = arguments[t];
|
|
184
169
|
o.forEach(function(i) {
|
|
185
170
|
!i || !i.config || (0, R.default)(r, i.config);
|
|
186
171
|
});
|
|
@@ -246,8 +231,7 @@ var ir = function(r) {
|
|
|
246
231
|
return typeof r == "number" && !isNaN(r);
|
|
247
232
|
};
|
|
248
233
|
var O = function(r, e) {
|
|
249
|
-
if (!ir(r))
|
|
250
|
-
return P(e, r, r);
|
|
234
|
+
if (!ir(r)) return P(e, r, r);
|
|
251
235
|
var o = r < 0, t = Math.abs(r), s = P(e, t, t);
|
|
252
236
|
return ir(s) ? s * (o ? -1 : 1) : o ? "-" + s : s;
|
|
253
237
|
};
|
|
@@ -277,15 +261,13 @@ function F() {
|
|
|
277
261
|
return F = Object.assign || function(a3) {
|
|
278
262
|
for (var r = 1; r < arguments.length; r++) {
|
|
279
263
|
var e = arguments[r];
|
|
280
|
-
for (var o in e)
|
|
281
|
-
Object.prototype.hasOwnProperty.call(e, o) && (a3[o] = e[o]);
|
|
264
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (a3[o] = e[o]);
|
|
282
265
|
}
|
|
283
266
|
return a3;
|
|
284
267
|
}, F.apply(this, arguments);
|
|
285
268
|
}
|
|
286
269
|
var w = function(r, e, o, t, s) {
|
|
287
|
-
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++)
|
|
288
|
-
r = r ? r[e[t]] : s;
|
|
270
|
+
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++) r = r ? r[e[t]] : s;
|
|
289
271
|
return r === s ? o : r;
|
|
290
272
|
};
|
|
291
273
|
var Te = [40, 52, 64].map(function(a3) {
|
|
@@ -296,8 +278,7 @@ var Ce = { bg: "backgroundColor", m: "margin", mt: "marginTop", mr: "marginRight
|
|
|
296
278
|
var dr = { marginX: ["marginLeft", "marginRight"], marginY: ["marginTop", "marginBottom"], paddingX: ["paddingLeft", "paddingRight"], paddingY: ["paddingTop", "paddingBottom"], size: ["width", "height"] };
|
|
297
279
|
var Be = { color: "colors", backgroundColor: "colors", borderColor: "colors", margin: "space", marginTop: "space", marginRight: "space", marginBottom: "space", marginLeft: "space", marginX: "space", marginY: "space", padding: "space", paddingTop: "space", paddingRight: "space", paddingBottom: "space", paddingLeft: "space", paddingX: "space", paddingY: "space", top: "space", right: "space", bottom: "space", left: "space", gridGap: "space", gridColumnGap: "space", gridRowGap: "space", gap: "space", columnGap: "space", rowGap: "space", fontFamily: "fonts", fontSize: "fontSizes", fontWeight: "fontWeights", lineHeight: "lineHeights", letterSpacing: "letterSpacings", border: "borders", borderTop: "borders", borderRight: "borders", borderBottom: "borders", borderLeft: "borders", borderWidth: "borderWidths", borderStyle: "borderStyles", borderRadius: "radii", borderTopRightRadius: "radii", borderTopLeftRadius: "radii", borderBottomRightRadius: "radii", borderBottomLeftRadius: "radii", borderTopWidth: "borderWidths", borderTopColor: "colors", borderTopStyle: "borderStyles", borderBottomWidth: "borderWidths", borderBottomColor: "colors", borderBottomStyle: "borderStyles", borderLeftWidth: "borderWidths", borderLeftColor: "colors", borderLeftStyle: "borderStyles", borderRightWidth: "borderWidths", borderRightColor: "colors", borderRightStyle: "borderStyles", outlineColor: "colors", boxShadow: "shadows", textShadow: "shadows", zIndex: "zIndices", width: "sizes", minWidth: "sizes", maxWidth: "sizes", height: "sizes", minHeight: "sizes", maxHeight: "sizes", flexBasis: "sizes", size: "sizes", fill: "colors", stroke: "colors" };
|
|
298
280
|
var We = function(r, e) {
|
|
299
|
-
if (typeof e != "number" || e >= 0)
|
|
300
|
-
return w(r, e, e);
|
|
281
|
+
if (typeof e != "number" || e >= 0) return w(r, e, e);
|
|
301
282
|
var o = Math.abs(e), t = w(r, o, o);
|
|
302
283
|
return typeof t == "string" ? "-" + t : t * -1;
|
|
303
284
|
};
|
|
@@ -346,11 +327,8 @@ var ze = function a2(r) {
|
|
|
346
327
|
continue;
|
|
347
328
|
}
|
|
348
329
|
var m = w(Ce, p, p), u = w(Be, m), x = w(o, u, w(o, m, {})), B = w(Le, m, w), z = B(x, d, d);
|
|
349
|
-
if (dr[m])
|
|
350
|
-
|
|
351
|
-
t[Z[Q]] = z;
|
|
352
|
-
else
|
|
353
|
-
t[m] = z;
|
|
330
|
+
if (dr[m]) for (var Z = dr[m], Q = 0; Q < Z.length; Q++) t[Z[Q]] = z;
|
|
331
|
+
else t[m] = z;
|
|
354
332
|
}
|
|
355
333
|
return t;
|
|
356
334
|
};
|
|
@@ -558,11 +536,11 @@ var Badge = ({
|
|
|
558
536
|
var Badge_default = Badge;
|
|
559
537
|
|
|
560
538
|
// src/index.ts
|
|
561
|
-
var
|
|
539
|
+
var index_default = Badge_default;
|
|
562
540
|
export {
|
|
563
541
|
Badge_default as Badge,
|
|
564
542
|
badgeColors,
|
|
565
|
-
|
|
543
|
+
index_default as default,
|
|
566
544
|
legacyBadgeColors
|
|
567
545
|
};
|
|
568
546
|
/*! Bundled license information:
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Badge.tsx","../../src/styles.ts","../../src/constants.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\";\nimport type { TypeBadgeProps } from \"./BadgeTypes\";\n\nconst Badge = ({\n children,\n text,\n iconName,\n type,\n tip,\n size = \"small\",\n badgeColor = \"blue\",\n color,\n ...rest\n}: TypeBadgeProps) => {\n if (children && text) {\n throw new Error(\n \"can't use both `children` and `text` props. Text is deprecated, consider using children.\"\n );\n }\n\n return (\n <Container\n // size previously included default, which currently maps to small. Once consumers have updated this can be simplified.\n size={size === \"default\" ? \"large\" : size}\n badgeColor={badgeColor}\n data-tip={tip}\n data-qa-badge={text || \"\"}\n data-qa-badge-type={type}\n data-qa-badge-tip={tip || \"\"}\n type={type}\n // TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n color={color}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"center\">\n {iconName ? (\n <Icon\n mr={200}\n name={iconName}\n size={size === \"small\" ? \"mini\" : \"small\"}\n aria-hidden\n />\n ) : null}\n {children || text}\n </Box>\n </Container>\n );\n};\n\nexport default Badge;\n","import styled from \"styled-components\";\n\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { legacyBadgeColors } from \"./constants\";\n// @ts-ignore: no types exist for this thang\nimport { themeGet } from \"@styled-system/theme-get\";\n\ntype TypeTypeKey = keyof typeof legacyBadgeColors;\n\nconst Container = styled.span<{\n type?: TypeTypeKey;\n badgeColor: string;\n size: string;\n}>`\n font-family: ${(p) => p.theme.fontFamily};\n ${(p) =>\n p.size === \"small\" ? p.theme.typography[100] : p.theme.typography[200]};\n border-radius: 9999px;\n line-height: 16px;\n display: inline-block;\n color: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].color)\n : p.theme.colors.text.body};\n background: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].background)\n : p.theme.colors.container.background.decorative[p.badgeColor]};\n padding: ${(p) =>\n p.size === \"small\"\n ? `${p.theme.space[0]} ${p.theme.space[200]}`\n : `${p.theme.space[300]}`};\n ${COMMON};\n`;\n\nexport default Container;\n","const defaultPurple = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.purple\",\n};\n\nconst suggestion = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst passive = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.neutral\",\n};\n\nconst primary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst secondary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.yellow\",\n};\n\nconst common = {\n color: \"colors.text.inverse\",\n background: \"colors.aqua.600\",\n};\n\nconst approval = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.orange\",\n};\n\n//Deprecated former \"types\"\n\n/**\n * @deprecated Use badgeColor instead\n */\n\nexport const legacyBadgeColors = {\n primary,\n secondary,\n passive,\n common,\n approval,\n default: defaultPurple,\n suggestion,\n};\n\nexport const badgeColors = {\n green: \"green\",\n blue: \"blue\",\n purple: \"purple\",\n yellow: \"yellow\",\n orange: \"orange\",\n red: \"red\",\n neutral: \"neutral\",\n magenta: \"magenta\",\n pink: \"pink\",\n aqua: \"aqua\",\n teal: \"teal\",\n} as const;\n","import Badge from \"./Badge\";\n\nexport default Badge;\nexport { Badge };\nexport * from \"./BadgeTypes\";\nexport * from \"./constants\";\n"],"mappings":";AAAA,OAAuB;AACvB,OAAO,SAAS;AAChB,OAAO,UAAU;;;ACFjB,OAAO,YAAY
|
|
1
|
+
{"version":3,"sources":["../../src/Badge.tsx","../../src/styles.ts","../../src/constants.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\";\nimport type { TypeBadgeProps } from \"./BadgeTypes\";\n\nconst Badge = ({\n children,\n text,\n iconName,\n type,\n tip,\n size = \"small\",\n badgeColor = \"blue\",\n color,\n ...rest\n}: TypeBadgeProps) => {\n if (children && text) {\n throw new Error(\n \"can't use both `children` and `text` props. Text is deprecated, consider using children.\"\n );\n }\n\n return (\n <Container\n // size previously included default, which currently maps to small. Once consumers have updated this can be simplified.\n size={size === \"default\" ? \"large\" : size}\n badgeColor={badgeColor}\n data-tip={tip}\n data-qa-badge={text || \"\"}\n data-qa-badge-type={type}\n data-qa-badge-tip={tip || \"\"}\n type={type}\n // TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n color={color}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"center\">\n {iconName ? (\n <Icon\n mr={200}\n name={iconName}\n size={size === \"small\" ? \"mini\" : \"small\"}\n aria-hidden\n />\n ) : null}\n {children || text}\n </Box>\n </Container>\n );\n};\n\nexport default Badge;\n","import styled from \"styled-components\";\n\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { legacyBadgeColors } from \"./constants\";\n// @ts-ignore: no types exist for this thang\nimport { themeGet } from \"@styled-system/theme-get\";\n\ntype TypeTypeKey = keyof typeof legacyBadgeColors;\n\nconst Container = styled.span<{\n type?: TypeTypeKey;\n badgeColor: string;\n size: string;\n}>`\n font-family: ${(p) => p.theme.fontFamily};\n ${(p) =>\n p.size === \"small\" ? p.theme.typography[100] : p.theme.typography[200]};\n border-radius: 9999px;\n line-height: 16px;\n display: inline-block;\n color: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].color)\n : p.theme.colors.text.body};\n background: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].background)\n : p.theme.colors.container.background.decorative[p.badgeColor]};\n padding: ${(p) =>\n p.size === \"small\"\n ? `${p.theme.space[0]} ${p.theme.space[200]}`\n : `${p.theme.space[300]}`};\n ${COMMON};\n`;\n\nexport default Container;\n","const defaultPurple = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.purple\",\n};\n\nconst suggestion = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst passive = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.neutral\",\n};\n\nconst primary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst secondary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.yellow\",\n};\n\nconst common = {\n color: \"colors.text.inverse\",\n background: \"colors.aqua.600\",\n};\n\nconst approval = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.orange\",\n};\n\n//Deprecated former \"types\"\n\n/**\n * @deprecated Use badgeColor instead\n */\n\nexport const legacyBadgeColors = {\n primary,\n secondary,\n passive,\n common,\n approval,\n default: defaultPurple,\n suggestion,\n};\n\nexport const badgeColors = {\n green: \"green\",\n blue: \"blue\",\n purple: \"purple\",\n yellow: \"yellow\",\n orange: \"orange\",\n red: \"red\",\n neutral: \"neutral\",\n magenta: \"magenta\",\n pink: \"pink\",\n aqua: \"aqua\",\n teal: \"teal\",\n} as const;\n","import Badge from \"./Badge\";\n\nexport default Badge;\nexport { Badge };\nexport * from \"./BadgeTypes\";\nexport * from \"./constants\";\n"],"mappings":";AAAA,OAAuB;AACvB,OAAO,SAAS;AAChB,OAAO,UAAU;;;ACFjB,OAAO,YAAY;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,SAAS;AAAA,YAClC,eAAW;AAAA;AAAA,QACb,IACE;AAAA,QACH,YAAY;AAAA,SACf;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;;;AGpDf,IAAO,gBAAQ;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -28,14 +28,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
Badge: () => Badge_default,
|
|
34
34
|
badgeColors: () => badgeColors,
|
|
35
|
-
default: () =>
|
|
35
|
+
default: () => index_default,
|
|
36
36
|
legacyBadgeColors: () => legacyBadgeColors
|
|
37
37
|
});
|
|
38
|
-
module.exports = __toCommonJS(
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/Badge.tsx
|
|
41
41
|
var React = require("react");
|
|
@@ -55,33 +55,26 @@ var te = Object.getPrototypeOf;
|
|
|
55
55
|
var oe = Object.prototype.hasOwnProperty;
|
|
56
56
|
var ae = (a3, r) => () => (r || a3((r = { exports: {} }).exports, r), r.exports);
|
|
57
57
|
var se = (a3, r, e, o) => {
|
|
58
|
-
if (r && typeof r == "object" || typeof r == "function")
|
|
59
|
-
for (let t of ee(r))
|
|
60
|
-
!oe.call(a3, t) && t !== e && _(a3, t, { get: () => r[t], enumerable: !(o = re(r, t)) || o.enumerable });
|
|
58
|
+
if (r && typeof r == "object" || typeof r == "function") for (let t of ee(r)) !oe.call(a3, t) && t !== e && _(a3, t, { get: () => r[t], enumerable: !(o = re(r, t)) || o.enumerable });
|
|
61
59
|
return a3;
|
|
62
60
|
};
|
|
63
61
|
var ie = (a3, r, e) => (e = a3 != null ? _r(te(a3)) : {}, se(!a3 || !a3.__esModule ? _(e, "default", { value: a3, enumerable: true }) : e, a3));
|
|
64
62
|
var tr = ae(($e, er) => {
|
|
65
63
|
var rr = Object.getOwnPropertySymbols, pe = Object.prototype.hasOwnProperty, ne = Object.prototype.propertyIsEnumerable;
|
|
66
64
|
function de(a3) {
|
|
67
|
-
if (a3 == null)
|
|
68
|
-
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
65
|
+
if (a3 == null) throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
69
66
|
return Object(a3);
|
|
70
67
|
}
|
|
71
68
|
function le() {
|
|
72
69
|
try {
|
|
73
|
-
if (!Object.assign)
|
|
74
|
-
return false;
|
|
70
|
+
if (!Object.assign) return false;
|
|
75
71
|
var a3 = new String("abc");
|
|
76
|
-
if (a3[5] = "de", Object.getOwnPropertyNames(a3)[0] === "5")
|
|
77
|
-
|
|
78
|
-
for (var r = {}, e = 0; e < 10; e++)
|
|
79
|
-
r["_" + String.fromCharCode(e)] = e;
|
|
72
|
+
if (a3[5] = "de", Object.getOwnPropertyNames(a3)[0] === "5") return false;
|
|
73
|
+
for (var r = {}, e = 0; e < 10; e++) r["_" + String.fromCharCode(e)] = e;
|
|
80
74
|
var o = Object.getOwnPropertyNames(r).map(function(s) {
|
|
81
75
|
return r[s];
|
|
82
76
|
});
|
|
83
|
-
if (o.join("") !== "0123456789")
|
|
84
|
-
return false;
|
|
77
|
+
if (o.join("") !== "0123456789") return false;
|
|
85
78
|
var t = {};
|
|
86
79
|
return "abcdefghijklmnopqrst".split("").forEach(function(s) {
|
|
87
80
|
t[s] = s;
|
|
@@ -93,12 +86,10 @@ var tr = ae(($e, er) => {
|
|
|
93
86
|
er.exports = le() ? Object.assign : function(a3, r) {
|
|
94
87
|
for (var e, o = de(a3), t, s = 1; s < arguments.length; s++) {
|
|
95
88
|
e = Object(arguments[s]);
|
|
96
|
-
for (var i in e)
|
|
97
|
-
pe.call(e, i) && (o[i] = e[i]);
|
|
89
|
+
for (var i in e) pe.call(e, i) && (o[i] = e[i]);
|
|
98
90
|
if (rr) {
|
|
99
91
|
t = rr(e);
|
|
100
|
-
for (var p = 0; p < t.length; p++)
|
|
101
|
-
ne.call(e, t[p]) && (o[t[p]] = e[t[p]]);
|
|
92
|
+
for (var p = 0; p < t.length; p++) ne.call(e, t[p]) && (o[t[p]] = e[t[p]]);
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
95
|
return o;
|
|
@@ -131,26 +122,24 @@ var ge = function(r, e) {
|
|
|
131
122
|
return P(e, r, r);
|
|
132
123
|
};
|
|
133
124
|
var P = function(r, e, o, t, s) {
|
|
134
|
-
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++)
|
|
135
|
-
r = r ? r[e[t]] : s;
|
|
125
|
+
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++) r = r ? r[e[t]] : s;
|
|
136
126
|
return r === s ? o : r;
|
|
137
127
|
};
|
|
138
128
|
var j = function a(r) {
|
|
139
129
|
var e = {}, o = function(i) {
|
|
140
130
|
var p = {}, c = false, d = i.theme && i.theme.disableStyledSystemCache;
|
|
141
|
-
for (var g in i)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
e.media = !d && e.media || [null].concat(e.breakpoints.map(ar)), p = or(p, fe(e.media, m, x, u, i));
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
u !== null && (p = or(p, ue(e.breakpoints, m, x, u, i)), c = true);
|
|
131
|
+
for (var g in i) if (r[g]) {
|
|
132
|
+
var m = r[g], u = i[g], x = P(i.theme, m.scale, m.defaults);
|
|
133
|
+
if (typeof u == "object") {
|
|
134
|
+
if (e.breakpoints = !d && e.breakpoints || P(i.theme, "breakpoints", me.breakpoints), Array.isArray(u)) {
|
|
135
|
+
e.media = !d && e.media || [null].concat(e.breakpoints.map(ar)), p = or(p, fe(e.media, m, x, u, i));
|
|
150
136
|
continue;
|
|
151
137
|
}
|
|
152
|
-
(
|
|
138
|
+
u !== null && (p = or(p, ue(e.breakpoints, m, x, u, i)), c = true);
|
|
139
|
+
continue;
|
|
153
140
|
}
|
|
141
|
+
(0, R.default)(p, m(u, x, i));
|
|
142
|
+
}
|
|
154
143
|
return c && (p = ce(p)), p;
|
|
155
144
|
};
|
|
156
145
|
o.config = r, o.propNames = Object.keys(r), o.cache = e;
|
|
@@ -166,8 +155,7 @@ var fe = function(r, e, o, t, s) {
|
|
|
166
155
|
var i = {};
|
|
167
156
|
return t.slice(0, r.length).forEach(function(p, c) {
|
|
168
157
|
var d = r[c], g = e(p, o, s);
|
|
169
|
-
if (!d)
|
|
170
|
-
(0, R.default)(i, g);
|
|
158
|
+
if (!d) (0, R.default)(i, g);
|
|
171
159
|
else {
|
|
172
160
|
var m;
|
|
173
161
|
(0, R.default)(i, (m = {}, m[d] = (0, R.default)({}, i[d], g), m));
|
|
@@ -178,8 +166,7 @@ var ue = function(r, e, o, t, s) {
|
|
|
178
166
|
var i = {};
|
|
179
167
|
for (var p in t) {
|
|
180
168
|
var c = r[p], d = t[p], g = e(d, o, s);
|
|
181
|
-
if (!c)
|
|
182
|
-
(0, R.default)(i, g);
|
|
169
|
+
if (!c) (0, R.default)(i, g);
|
|
183
170
|
else {
|
|
184
171
|
var m, u = ar(c);
|
|
185
172
|
(0, R.default)(i, (m = {}, m[u] = (0, R.default)({}, i[u], g), m));
|
|
@@ -192,10 +179,9 @@ var X = function(r) {
|
|
|
192
179
|
e = e || [o];
|
|
193
180
|
var c = function(g, m, u) {
|
|
194
181
|
var x = {}, B = i(g, m, u);
|
|
195
|
-
if (B !== null)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}), x;
|
|
182
|
+
if (B !== null) return e.forEach(function(z) {
|
|
183
|
+
x[z] = B;
|
|
184
|
+
}), x;
|
|
199
185
|
};
|
|
200
186
|
return c.scale = t, c.defaults = p, c;
|
|
201
187
|
};
|
|
@@ -218,8 +204,7 @@ var l = function(r) {
|
|
|
218
204
|
return o;
|
|
219
205
|
};
|
|
220
206
|
var y = function() {
|
|
221
|
-
for (var r = {}, e = arguments.length, o = new Array(e), t = 0; t < e; t++)
|
|
222
|
-
o[t] = arguments[t];
|
|
207
|
+
for (var r = {}, e = arguments.length, o = new Array(e), t = 0; t < e; t++) o[t] = arguments[t];
|
|
223
208
|
o.forEach(function(i) {
|
|
224
209
|
!i || !i.config || (0, R.default)(r, i.config);
|
|
225
210
|
});
|
|
@@ -285,8 +270,7 @@ var ir = function(r) {
|
|
|
285
270
|
return typeof r == "number" && !isNaN(r);
|
|
286
271
|
};
|
|
287
272
|
var O = function(r, e) {
|
|
288
|
-
if (!ir(r))
|
|
289
|
-
return P(e, r, r);
|
|
273
|
+
if (!ir(r)) return P(e, r, r);
|
|
290
274
|
var o = r < 0, t = Math.abs(r), s = P(e, t, t);
|
|
291
275
|
return ir(s) ? s * (o ? -1 : 1) : o ? "-" + s : s;
|
|
292
276
|
};
|
|
@@ -316,15 +300,13 @@ function F() {
|
|
|
316
300
|
return F = Object.assign || function(a3) {
|
|
317
301
|
for (var r = 1; r < arguments.length; r++) {
|
|
318
302
|
var e = arguments[r];
|
|
319
|
-
for (var o in e)
|
|
320
|
-
Object.prototype.hasOwnProperty.call(e, o) && (a3[o] = e[o]);
|
|
303
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (a3[o] = e[o]);
|
|
321
304
|
}
|
|
322
305
|
return a3;
|
|
323
306
|
}, F.apply(this, arguments);
|
|
324
307
|
}
|
|
325
308
|
var w = function(r, e, o, t, s) {
|
|
326
|
-
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++)
|
|
327
|
-
r = r ? r[e[t]] : s;
|
|
309
|
+
for (e = e && e.split ? e.split(".") : [e], t = 0; t < e.length; t++) r = r ? r[e[t]] : s;
|
|
328
310
|
return r === s ? o : r;
|
|
329
311
|
};
|
|
330
312
|
var Te = [40, 52, 64].map(function(a3) {
|
|
@@ -335,8 +317,7 @@ var Ce = { bg: "backgroundColor", m: "margin", mt: "marginTop", mr: "marginRight
|
|
|
335
317
|
var dr = { marginX: ["marginLeft", "marginRight"], marginY: ["marginTop", "marginBottom"], paddingX: ["paddingLeft", "paddingRight"], paddingY: ["paddingTop", "paddingBottom"], size: ["width", "height"] };
|
|
336
318
|
var Be = { color: "colors", backgroundColor: "colors", borderColor: "colors", margin: "space", marginTop: "space", marginRight: "space", marginBottom: "space", marginLeft: "space", marginX: "space", marginY: "space", padding: "space", paddingTop: "space", paddingRight: "space", paddingBottom: "space", paddingLeft: "space", paddingX: "space", paddingY: "space", top: "space", right: "space", bottom: "space", left: "space", gridGap: "space", gridColumnGap: "space", gridRowGap: "space", gap: "space", columnGap: "space", rowGap: "space", fontFamily: "fonts", fontSize: "fontSizes", fontWeight: "fontWeights", lineHeight: "lineHeights", letterSpacing: "letterSpacings", border: "borders", borderTop: "borders", borderRight: "borders", borderBottom: "borders", borderLeft: "borders", borderWidth: "borderWidths", borderStyle: "borderStyles", borderRadius: "radii", borderTopRightRadius: "radii", borderTopLeftRadius: "radii", borderBottomRightRadius: "radii", borderBottomLeftRadius: "radii", borderTopWidth: "borderWidths", borderTopColor: "colors", borderTopStyle: "borderStyles", borderBottomWidth: "borderWidths", borderBottomColor: "colors", borderBottomStyle: "borderStyles", borderLeftWidth: "borderWidths", borderLeftColor: "colors", borderLeftStyle: "borderStyles", borderRightWidth: "borderWidths", borderRightColor: "colors", borderRightStyle: "borderStyles", outlineColor: "colors", boxShadow: "shadows", textShadow: "shadows", zIndex: "zIndices", width: "sizes", minWidth: "sizes", maxWidth: "sizes", height: "sizes", minHeight: "sizes", maxHeight: "sizes", flexBasis: "sizes", size: "sizes", fill: "colors", stroke: "colors" };
|
|
337
319
|
var We = function(r, e) {
|
|
338
|
-
if (typeof e != "number" || e >= 0)
|
|
339
|
-
return w(r, e, e);
|
|
320
|
+
if (typeof e != "number" || e >= 0) return w(r, e, e);
|
|
340
321
|
var o = Math.abs(e), t = w(r, o, o);
|
|
341
322
|
return typeof t == "string" ? "-" + t : t * -1;
|
|
342
323
|
};
|
|
@@ -385,11 +366,8 @@ var ze = function a2(r) {
|
|
|
385
366
|
continue;
|
|
386
367
|
}
|
|
387
368
|
var m = w(Ce, p, p), u = w(Be, m), x = w(o, u, w(o, m, {})), B = w(Le, m, w), z = B(x, d, d);
|
|
388
|
-
if (dr[m])
|
|
389
|
-
|
|
390
|
-
t[Z[Q]] = z;
|
|
391
|
-
else
|
|
392
|
-
t[m] = z;
|
|
369
|
+
if (dr[m]) for (var Z = dr[m], Q = 0; Q < Z.length; Q++) t[Z[Q]] = z;
|
|
370
|
+
else t[m] = z;
|
|
393
371
|
}
|
|
394
372
|
return t;
|
|
395
373
|
};
|
|
@@ -597,7 +575,7 @@ var Badge = ({
|
|
|
597
575
|
var Badge_default = Badge;
|
|
598
576
|
|
|
599
577
|
// src/index.ts
|
|
600
|
-
var
|
|
578
|
+
var index_default = Badge_default;
|
|
601
579
|
// Annotate the CommonJS export names for ESM import in node:
|
|
602
580
|
0 && (module.exports = {
|
|
603
581
|
Badge,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Badge.tsx","../src/styles.ts","../src/constants.ts"],"sourcesContent":["import Badge from \"./Badge\";\n\nexport default Badge;\nexport { Badge };\nexport * from \"./BadgeTypes\";\nexport * from \"./constants\";\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\";\nimport type { TypeBadgeProps } from \"./BadgeTypes\";\n\nconst Badge = ({\n children,\n text,\n iconName,\n type,\n tip,\n size = \"small\",\n badgeColor = \"blue\",\n color,\n ...rest\n}: TypeBadgeProps) => {\n if (children && text) {\n throw new Error(\n \"can't use both `children` and `text` props. Text is deprecated, consider using children.\"\n );\n }\n\n return (\n <Container\n // size previously included default, which currently maps to small. Once consumers have updated this can be simplified.\n size={size === \"default\" ? \"large\" : size}\n badgeColor={badgeColor}\n data-tip={tip}\n data-qa-badge={text || \"\"}\n data-qa-badge-type={type}\n data-qa-badge-tip={tip || \"\"}\n type={type}\n // TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n color={color}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"center\">\n {iconName ? (\n <Icon\n mr={200}\n name={iconName}\n size={size === \"small\" ? \"mini\" : \"small\"}\n aria-hidden\n />\n ) : null}\n {children || text}\n </Box>\n </Container>\n );\n};\n\nexport default Badge;\n","import styled from \"styled-components\";\n\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { legacyBadgeColors } from \"./constants\";\n// @ts-ignore: no types exist for this thang\nimport { themeGet } from \"@styled-system/theme-get\";\n\ntype TypeTypeKey = keyof typeof legacyBadgeColors;\n\nconst Container = styled.span<{\n type?: TypeTypeKey;\n badgeColor: string;\n size: string;\n}>`\n font-family: ${(p) => p.theme.fontFamily};\n ${(p) =>\n p.size === \"small\" ? p.theme.typography[100] : p.theme.typography[200]};\n border-radius: 9999px;\n line-height: 16px;\n display: inline-block;\n color: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].color)\n : p.theme.colors.text.body};\n background: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].background)\n : p.theme.colors.container.background.decorative[p.badgeColor]};\n padding: ${(p) =>\n p.size === \"small\"\n ? `${p.theme.space[0]} ${p.theme.space[200]}`\n : `${p.theme.space[300]}`};\n ${COMMON};\n`;\n\nexport default Container;\n","const defaultPurple = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.purple\",\n};\n\nconst suggestion = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst passive = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.neutral\",\n};\n\nconst primary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst secondary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.yellow\",\n};\n\nconst common = {\n color: \"colors.text.inverse\",\n background: \"colors.aqua.600\",\n};\n\nconst approval = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.orange\",\n};\n\n//Deprecated former \"types\"\n\n/**\n * @deprecated Use badgeColor instead\n */\n\nexport const legacyBadgeColors = {\n primary,\n secondary,\n passive,\n common,\n approval,\n default: defaultPurple,\n suggestion,\n};\n\nexport const badgeColors = {\n green: \"green\",\n blue: \"blue\",\n purple: \"purple\",\n yellow: \"yellow\",\n orange: \"orange\",\n red: \"red\",\n neutral: \"neutral\",\n magenta: \"magenta\",\n pink: \"pink\",\n aqua: \"aqua\",\n teal: \"teal\",\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAAgB;AAChB,8BAAiB;;;ACFjB,+BAAmB
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Badge.tsx","../src/styles.ts","../src/constants.ts"],"sourcesContent":["import Badge from \"./Badge\";\n\nexport default Badge;\nexport { Badge };\nexport * from \"./BadgeTypes\";\nexport * from \"./constants\";\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\";\nimport type { TypeBadgeProps } from \"./BadgeTypes\";\n\nconst Badge = ({\n children,\n text,\n iconName,\n type,\n tip,\n size = \"small\",\n badgeColor = \"blue\",\n color,\n ...rest\n}: TypeBadgeProps) => {\n if (children && text) {\n throw new Error(\n \"can't use both `children` and `text` props. Text is deprecated, consider using children.\"\n );\n }\n\n return (\n <Container\n // size previously included default, which currently maps to small. Once consumers have updated this can be simplified.\n size={size === \"default\" ? \"large\" : size}\n badgeColor={badgeColor}\n data-tip={tip}\n data-qa-badge={text || \"\"}\n data-qa-badge-type={type}\n data-qa-badge-tip={tip || \"\"}\n type={type}\n // TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n color={color}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"center\">\n {iconName ? (\n <Icon\n mr={200}\n name={iconName}\n size={size === \"small\" ? \"mini\" : \"small\"}\n aria-hidden\n />\n ) : null}\n {children || text}\n </Box>\n </Container>\n );\n};\n\nexport default Badge;\n","import styled from \"styled-components\";\n\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { legacyBadgeColors } from \"./constants\";\n// @ts-ignore: no types exist for this thang\nimport { themeGet } from \"@styled-system/theme-get\";\n\ntype TypeTypeKey = keyof typeof legacyBadgeColors;\n\nconst Container = styled.span<{\n type?: TypeTypeKey;\n badgeColor: string;\n size: string;\n}>`\n font-family: ${(p) => p.theme.fontFamily};\n ${(p) =>\n p.size === \"small\" ? p.theme.typography[100] : p.theme.typography[200]};\n border-radius: 9999px;\n line-height: 16px;\n display: inline-block;\n color: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].color)\n : p.theme.colors.text.body};\n background: ${(p) =>\n p.type\n ? themeGet(legacyBadgeColors[p.type].background)\n : p.theme.colors.container.background.decorative[p.badgeColor]};\n padding: ${(p) =>\n p.size === \"small\"\n ? `${p.theme.space[0]} ${p.theme.space[200]}`\n : `${p.theme.space[300]}`};\n ${COMMON};\n`;\n\nexport default Container;\n","const defaultPurple = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.purple\",\n};\n\nconst suggestion = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst passive = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.neutral\",\n};\n\nconst primary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.blue\",\n};\n\nconst secondary = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.yellow\",\n};\n\nconst common = {\n color: \"colors.text.inverse\",\n background: \"colors.aqua.600\",\n};\n\nconst approval = {\n color: \"colors.text.body\",\n background: \"colors.container.background.decorative.orange\",\n};\n\n//Deprecated former \"types\"\n\n/**\n * @deprecated Use badgeColor instead\n */\n\nexport const legacyBadgeColors = {\n primary,\n secondary,\n passive,\n common,\n approval,\n default: defaultPurple,\n suggestion,\n};\n\nexport const badgeColors = {\n green: \"green\",\n blue: \"blue\",\n purple: \"purple\",\n yellow: \"yellow\",\n orange: \"orange\",\n red: \"red\",\n neutral: \"neutral\",\n magenta: \"magenta\",\n pink: \"pink\",\n aqua: \"aqua\",\n teal: \"teal\",\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAAgB;AAChB,8BAAiB;;;ACFjB,+BAAmB;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAnB,IAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,EACP,YAAY;AACd;AAEA,IAAM,aAAa;AAAA,EACjB,OAAO;AAAA,EACP,YAAY;AACd;AAEA,IAAM,UAAU;AAAA,EACd,OAAO;AAAA,EACP,YAAY;AACd;AAEA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,QAAQ,CAAC;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACL,MAAsB;AACpB,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,MAAM,SAAS,YAAY,UAAU;AAAA,MACrC;AAAA,MACA,YAAU;AAAA,MACV,iBAAe,QAAQ;AAAA,MACvB,sBAAoB;AAAA,MACpB,qBAAmB,OAAO;AAAA,MAC1B;AAAA,MAIA;AAAA,MACC,GAAG;AAAA,MAEJ,uDAAC,uBAAAC,SAAA,EAAI,SAAQ,QAAO,YAAW,UAAS,gBAAe,UACpD;AAAA,mBACC;AAAA,UAAC,wBAAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,MAAM;AAAA,YACN,MAAM,SAAS,UAAU,SAAS;AAAA,YAClC,eAAW;AAAA;AAAA,QACb,IACE;AAAA,QACH,YAAY;AAAA,SACf;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;;;ADpDf,IAAO,gBAAQ;","names":["styled","Box","Icon"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-badge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Seeds React Badge",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"test:watch": "jest --watch --coverage=false"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@sproutsocial/seeds-react-box": "
|
|
22
|
-
"@sproutsocial/seeds-react-icon": "
|
|
21
|
+
"@sproutsocial/seeds-react-box": "^1.1.1",
|
|
22
|
+
"@sproutsocial/seeds-react-icon": "^1.1.1",
|
|
23
23
|
"@styled-system/theme-get": "^5.1.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|