@purpurds/badge 3.5.1 → 3.7.0
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/LICENSE.txt +1 -1
- package/dist/badge.cjs.js +3 -3
- package/dist/badge.cjs.js.map +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.es.js +87 -65
- package/dist/badge.es.js.map +1 -1
- package/dist/badge.system.js +3 -3
- package/dist/badge.system.js.map +1 -1
- package/package.json +5 -5
- package/readme.mdx +3 -15
- package/src/badge.test.tsx +2 -2
- package/src/badge.tsx +8 -1
package/dist/badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOzC,eAAO,MAAM,aAAa;;;;;;;;CAQhB,CAAC;AAEX,eAAO,MAAM,aAAa,2FAA+B,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOzC,eAAO,MAAM,aAAa;;;;;;;;CAQhB,CAAC;AAEX,eAAO,MAAM,aAAa,2FAA+B,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAsB9E,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,KAAK,iGAQf,UAAU,sBAaZ,CAAC"}
|
package/dist/badge.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
1
|
+
import { jsx as d, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
function m(e) {
|
|
3
3
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
4
|
}
|
|
@@ -10,36 +10,36 @@ var g = { exports: {} };
|
|
|
10
10
|
*/
|
|
11
11
|
(function(e) {
|
|
12
12
|
(function() {
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var s = {}.hasOwnProperty;
|
|
14
|
+
function a() {
|
|
15
15
|
for (var r = "", t = 0; t < arguments.length; t++) {
|
|
16
|
-
var
|
|
17
|
-
|
|
16
|
+
var n = arguments[t];
|
|
17
|
+
n && (r = l(r, u.call(this, n)));
|
|
18
18
|
}
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function u(r) {
|
|
22
22
|
if (typeof r == "string" || typeof r == "number")
|
|
23
23
|
return this && this[r] || r;
|
|
24
24
|
if (typeof r != "object")
|
|
25
25
|
return "";
|
|
26
26
|
if (Array.isArray(r))
|
|
27
|
-
return
|
|
27
|
+
return a.apply(this, r);
|
|
28
28
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
29
29
|
return r.toString();
|
|
30
30
|
var t = "";
|
|
31
|
-
for (var
|
|
32
|
-
|
|
31
|
+
for (var n in r)
|
|
32
|
+
s.call(r, n) && r[n] && (t = l(t, this && this[n] || n));
|
|
33
33
|
return t;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function l(r, t) {
|
|
36
36
|
return t ? r ? r + " " + t : r + t : r;
|
|
37
37
|
}
|
|
38
|
-
e.exports ? (
|
|
38
|
+
e.exports ? (a.default = a, e.exports = a) : window.classNames = a;
|
|
39
39
|
})();
|
|
40
40
|
})(g);
|
|
41
|
-
var
|
|
42
|
-
const
|
|
41
|
+
var _ = g.exports;
|
|
42
|
+
const w = /* @__PURE__ */ m(_), y = {
|
|
43
43
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
44
44
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
45
45
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -47,56 +47,71 @@ const y = /* @__PURE__ */ m(h), w = {
|
|
|
47
47
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
48
48
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
49
49
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
50
|
-
},
|
|
50
|
+
}, x = {
|
|
51
51
|
name: "alert",
|
|
52
52
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="m13.038 7.067-.247 6.876h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.917c0 .649-.586 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.664 0 1.25.601 1.25 1.234Z"/><path fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.75 0a8.25 8.25 0 1 1-16.5 0 8.25 8.25 0 0 1 16.5 0Z" clip-rule="evenodd"/></svg>',
|
|
53
53
|
keywords: ["alert"],
|
|
54
54
|
category: "status"
|
|
55
|
-
},
|
|
55
|
+
}, b = {
|
|
56
56
|
name: "check-circle",
|
|
57
57
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M16.487 9.514a.872.872 0 1 0-1.42-1.014l-4.248 5.948-2.18-2.18a.872.872 0 0 0-1.233 1.234l2.908 2.908a.872.872 0 0 0 1.326-.11l4.847-6.786Z"/><path fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.75 0a8.25 8.25 0 1 1-16.5 0 8.25 8.25 0 0 1 16.5 0Z" clip-rule="evenodd"/></svg>',
|
|
58
58
|
keywords: ["check-circle"],
|
|
59
59
|
category: "status"
|
|
60
|
-
},
|
|
60
|
+
}, Z = {
|
|
61
61
|
name: "error",
|
|
62
62
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M10.354 3.05c.732-1.267 2.56-1.267 3.291 0l8.66 15c.732 1.267-.182 2.85-1.645 2.85H3.34c-1.463 0-2.377-1.583-1.646-2.85l8.66-15Zm1.595.862a.092.092 0 0 0-.036.038l-8.66 15a.092.092 0 0 0-.015.05c0 .014.005.032.015.05a.11.11 0 0 0 .036.038.09.09 0 0 0 .05.012H20.66a.088.088 0 0 0 .05-.012.106.106 0 0 0 .037-.038.105.105 0 0 0 .015-.05.092.092 0 0 0-.015-.05l-8.66-15a.092.092 0 0 0-.036-.038A.106.106 0 0 0 12 3.9a.105.105 0 0 0-.05.012Z" clip-rule="evenodd"/><path d="m12.523 14.922.412-6.25a.936.936 0 1 0-1.868 0l.421 6.25h1.035ZM12 17.52c.44 0 .826-.387.826-.815 0-.418-.387-.816-.826-.816-.428 0-.825.398-.825.816 0 .428.397.815.825.815Z"/><path fill-rule="evenodd" d="M12.691 15.096h-1.37l-.431-6.53a1 1 0 0 1 .997-1.066h.227a1 1 0 0 1 .998 1.064l-.42 6.532Zm.244-6.425a.936.936 0 1 0-1.868.002l.421 6.249h1.035l.412-6.25ZM13 16.706c0 .526-.466.99-1 .99-.522 0-1-.463-1-.99 0-.264.125-.51.304-.689.18-.178.429-.301.696-.301.536 0 1 .475 1 .99Zm-.174 0c0 .428-.387.815-.826.815-.428 0-.825-.387-.825-.815 0-.418.397-.816.825-.816.44 0 .826.398.826.816Z" clip-rule="evenodd"/></svg>',
|
|
63
63
|
keywords: ["error"],
|
|
64
64
|
category: "status"
|
|
65
|
-
}, N =
|
|
66
|
-
|
|
65
|
+
}, N = {
|
|
66
|
+
name: "info",
|
|
67
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M11 8.18c0 .537.469.979 1.007.979.524 0 .993-.442.993-.98s-.469-.979-.993-.979c-.538 0-1.007.441-1.007.98Zm.152 1.958v6.897h1.696v-6.897h-1.696Z"/><path fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.75 0a8.25 8.25 0 1 1-16.5 0 8.25 8.25 0 0 1 16.5 0Z" clip-rule="evenodd"/></svg>',
|
|
68
|
+
keywords: ["info"],
|
|
69
|
+
category: "status"
|
|
70
|
+
}, S = {
|
|
71
|
+
name: "offering",
|
|
72
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M7.118 4.6H7a1.9 1.9 0 0 0-1.9 1.9V8a1.9 1.9 0 0 0 1.5 1.858v.642a.9.9 0 1 0 1.8 0v-.6h3.2v.6a.9.9 0 0 0 1.8 0v-.6h3.7V11a.9.9 0 0 0 1.8 0V9.858A1.9 1.9 0 0 0 20.4 8V6.5a1.9 1.9 0 0 0-1.9-1.9h-.618c-.063-.708-.3-1.394-.756-1.943-.56-.674-1.384-1.057-2.376-1.057-.92 0-1.696.33-2.25.915-.554-.585-1.33-.915-2.25-.915-.992 0-1.816.383-2.376 1.057-.457.549-.693 1.235-.756 1.943Zm1.812 0h2.64c-.053-.34-.174-.607-.328-.792-.192-.232-.493-.408-.992-.408s-.8.176-.992.408c-.154.185-.275.452-.328.792Zm4.5 0h2.64c-.053-.34-.174-.607-.328-.792-.192-.232-.493-.408-.992-.408s-.8.176-.992.408c-.154.185-.275.452-.328.792Zm-.03 3.5h5.1a.1.1 0 0 0 .1-.1V6.5a.1.1 0 0 0-.1-.1h-5.1v1.7Zm-1.8-1.7H7a.1.1 0 0 0-.1.1V8a.1.1 0 0 0 .1.1h4.6V6.4Zm8.335 5.147c.743-.107 1.52.135 2.201.817.474.473.695 1.011.708 1.548.012.508-.163.927-.318 1.2-.185.326-.47.607-.634.77l-.049.047-4.414 4.414a1.9 1.9 0 0 1-1.343.557H7.914a.1.1 0 0 0-.07.03l-.5.5a1.9 1.9 0 0 1-2.687 0L2.57 19.342a1.9 1.9 0 0 1 0-2.686l4-4a1.9 1.9 0 0 1 1.343-.557H14.5v.9-.9h.041l.065.004a2.73 2.73 0 0 1 .79.185 2.665 2.665 0 0 1 1.46 1.417c.188-.162.375-.324.551-.479.46-.401.815-.722.957-.863.338-.34.882-.719 1.571-.817ZM15.088 15.1a1.06 1.06 0 0 0 .08-.145c.1-.207.113-.38.027-.553a.867.867 0 0 0-.668-.497.628.628 0 0 0-.042-.005h-6.57a.1.1 0 0 0-.071.03l-4 4a.1.1 0 0 0 0 .14l2.085 2.087a.1.1 0 0 0 .142 0l.5-.5a1.9 1.9 0 0 1 1.343-.557h8.172a.1.1 0 0 0 .07-.03l4.415-4.414c.225-.225.334-.335.39-.434a.539.539 0 0 0 .083-.266.283.283 0 0 0-.026-.11.712.712 0 0 0-.154-.21c-.319-.318-.542-.326-.674-.307-.186.026-.392.146-.554.307-.191.192-.595.553-1.043.946-.904.79-2.143 1.838-2.561 2.144l-.238.174H10.5a.9.9 0 0 1 0-1.8h4.588Z" clip-rule="evenodd"/></svg>',
|
|
73
|
+
keywords: ["offering"],
|
|
74
|
+
category: "other"
|
|
75
|
+
}, A = {
|
|
76
|
+
name: "question",
|
|
77
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13.672 12.056c-.635.547-1.242 1.07-1.164 2.062h-1.385c-.309-1.553.504-2.214 1.23-2.805.514-.419.986-.802.986-1.442 0-.593-.489-1.068-1.267-1.068-.764 0-1.345.422-1.872 1.187L9 9.067C9.712 7.92 10.807 7.3 12.086 7.3 13.906 7.3 15 8.42 15 9.78c0 1.133-.678 1.717-1.328 2.277Zm-.822 3.763c0 .54-.487 1.028-1.041 1.028-.554 0-1.042-.488-1.042-1.028 0-.528.488-1.029 1.042-1.029s1.042.501 1.042 1.029Z"/><path fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.75 0a8.25 8.25 0 1 1-16.5 0 8.25 8.25 0 0 1 16.5 0Z" clip-rule="evenodd"/></svg>',
|
|
78
|
+
keywords: ["question"],
|
|
79
|
+
category: "status"
|
|
80
|
+
}, M = w.bind(y), c = "purpur-icon", O = "md", k = (e) => e.filter((s) => Object.keys(s).length >= 1).map((s) => `${s.name}="${s.value}"`).join(" "), C = ({ content: e = "", title: s } = {}) => {
|
|
81
|
+
const a = [
|
|
67
82
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
68
83
|
{ name: "fill", value: "currentColor" },
|
|
69
84
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
70
|
-
|
|
71
|
-
],
|
|
72
|
-
return `<svg ${
|
|
73
|
-
},
|
|
85
|
+
s ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
86
|
+
], u = s ? `<title>${s}</title>` : "";
|
|
87
|
+
return `<svg ${k(a)}>${u}${e}</svg>`;
|
|
88
|
+
}, R = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), E = ({
|
|
74
89
|
["data-testid"]: e,
|
|
75
|
-
svg:
|
|
76
|
-
allyTitle:
|
|
77
|
-
className:
|
|
78
|
-
size:
|
|
90
|
+
svg: s,
|
|
91
|
+
allyTitle: a,
|
|
92
|
+
className: u = "",
|
|
93
|
+
size: l = O,
|
|
79
94
|
...r
|
|
80
95
|
}) => {
|
|
81
|
-
const t =
|
|
82
|
-
content:
|
|
83
|
-
title:
|
|
84
|
-
}),
|
|
96
|
+
const t = C({
|
|
97
|
+
content: R(s.svg),
|
|
98
|
+
title: a
|
|
99
|
+
}), n = M(u, c, `${c}--${l}`);
|
|
85
100
|
return /* @__PURE__ */ d(
|
|
86
101
|
"span",
|
|
87
102
|
{
|
|
88
|
-
"aria-label":
|
|
89
|
-
className:
|
|
103
|
+
"aria-label": a,
|
|
104
|
+
className: n,
|
|
90
105
|
"data-testid": e,
|
|
91
106
|
dangerouslySetInnerHTML: { __html: t },
|
|
92
107
|
...r
|
|
93
108
|
}
|
|
94
109
|
);
|
|
95
110
|
};
|
|
96
|
-
function
|
|
111
|
+
function I(e) {
|
|
97
112
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
98
113
|
}
|
|
99
|
-
var
|
|
114
|
+
var v = { exports: {} };
|
|
100
115
|
/*!
|
|
101
116
|
Copyright (c) 2018 Jed Watson.
|
|
102
117
|
Licensed under the MIT License (MIT), see
|
|
@@ -104,36 +119,36 @@ var f = { exports: {} };
|
|
|
104
119
|
*/
|
|
105
120
|
(function(e) {
|
|
106
121
|
(function() {
|
|
107
|
-
var
|
|
108
|
-
function
|
|
122
|
+
var s = {}.hasOwnProperty;
|
|
123
|
+
function a() {
|
|
109
124
|
for (var r = "", t = 0; t < arguments.length; t++) {
|
|
110
|
-
var
|
|
111
|
-
|
|
125
|
+
var n = arguments[t];
|
|
126
|
+
n && (r = l(r, u(n)));
|
|
112
127
|
}
|
|
113
128
|
return r;
|
|
114
129
|
}
|
|
115
|
-
function
|
|
130
|
+
function u(r) {
|
|
116
131
|
if (typeof r == "string" || typeof r == "number")
|
|
117
132
|
return r;
|
|
118
133
|
if (typeof r != "object")
|
|
119
134
|
return "";
|
|
120
135
|
if (Array.isArray(r))
|
|
121
|
-
return
|
|
136
|
+
return a.apply(null, r);
|
|
122
137
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
123
138
|
return r.toString();
|
|
124
139
|
var t = "";
|
|
125
|
-
for (var
|
|
126
|
-
|
|
140
|
+
for (var n in r)
|
|
141
|
+
s.call(r, n) && r[n] && (t = l(t, n));
|
|
127
142
|
return t;
|
|
128
143
|
}
|
|
129
|
-
function
|
|
144
|
+
function l(r, t) {
|
|
130
145
|
return t ? r ? r + " " + t : r + t : r;
|
|
131
146
|
}
|
|
132
|
-
e.exports ? (
|
|
147
|
+
e.exports ? (a.default = a, e.exports = a) : window.classNames = a;
|
|
133
148
|
})();
|
|
134
|
-
})(
|
|
135
|
-
var
|
|
136
|
-
const
|
|
149
|
+
})(v);
|
|
150
|
+
var T = v.exports;
|
|
151
|
+
const j = /* @__PURE__ */ I(T), i = {
|
|
137
152
|
"purpur-badge": "_purpur-badge_yhork_1",
|
|
138
153
|
"purpur-badge--attention": "_purpur-badge--attention_yhork_13",
|
|
139
154
|
"purpur-badge--special": "_purpur-badge--special_yhork_17",
|
|
@@ -142,7 +157,7 @@ const $ = /* @__PURE__ */ M(R), p = {
|
|
|
142
157
|
"purpur-badge--success": "_purpur-badge--success_yhork_29",
|
|
143
158
|
"purpur-badge--warning": "_purpur-badge--warning_yhork_33",
|
|
144
159
|
"purpur-badge--error": "_purpur-badge--error_yhork_37"
|
|
145
|
-
},
|
|
160
|
+
}, p = "purpur-badge", o = {
|
|
146
161
|
ATTENTION: "attention",
|
|
147
162
|
SPECIAL: "special",
|
|
148
163
|
NEUTRAL: "neutral",
|
|
@@ -150,35 +165,42 @@ const $ = /* @__PURE__ */ M(R), p = {
|
|
|
150
165
|
SUCCESS: "success",
|
|
151
166
|
WARNING: "warning",
|
|
152
167
|
ERROR: "error"
|
|
153
|
-
},
|
|
168
|
+
}, q = Object.values(o), V = (e) => {
|
|
154
169
|
switch (e) {
|
|
155
|
-
case
|
|
156
|
-
|
|
157
|
-
case l.WARNING:
|
|
158
|
-
return b;
|
|
159
|
-
case l.ERROR:
|
|
170
|
+
case o.ATTENTION:
|
|
171
|
+
case o.SPECIAL:
|
|
160
172
|
return S;
|
|
173
|
+
case o.INFORMATION:
|
|
174
|
+
return N;
|
|
175
|
+
case o.SUCCESS:
|
|
176
|
+
return b;
|
|
177
|
+
case o.WARNING:
|
|
178
|
+
return x;
|
|
179
|
+
case o.ERROR:
|
|
180
|
+
return Z;
|
|
181
|
+
case o.NEUTRAL:
|
|
182
|
+
return A;
|
|
161
183
|
default:
|
|
162
184
|
return;
|
|
163
185
|
}
|
|
164
|
-
},
|
|
186
|
+
}, B = ({
|
|
165
187
|
children: e,
|
|
166
|
-
showIcon:
|
|
167
|
-
variant:
|
|
168
|
-
["data-testid"]:
|
|
169
|
-
allyLabel:
|
|
188
|
+
showIcon: s = !0,
|
|
189
|
+
variant: a,
|
|
190
|
+
["data-testid"]: u,
|
|
191
|
+
allyLabel: l,
|
|
170
192
|
className: r = "",
|
|
171
193
|
...t
|
|
172
194
|
}) => {
|
|
173
|
-
const
|
|
174
|
-
return /* @__PURE__ */
|
|
175
|
-
|
|
195
|
+
const n = V(a), f = j([r, i[p], i[`${p}--${a}`]]);
|
|
196
|
+
return /* @__PURE__ */ h("span", { "aria-label": l, className: f, "data-testid": u, ...t, children: [
|
|
197
|
+
s && n && /* @__PURE__ */ d(E, { "data-testid": `${u}-icon`, allyTitle: l, size: "xs", svg: n }),
|
|
176
198
|
e
|
|
177
199
|
] });
|
|
178
200
|
};
|
|
179
201
|
export {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
o as BADGE_VARIANT,
|
|
203
|
+
B as Badge,
|
|
204
|
+
q as badgeVariants
|
|
183
205
|
};
|
|
184
206
|
//# sourceMappingURL=badge.es.js.map
|