@abumble/design-system 0.0.17 → 0.0.19
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/LICENSE
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
MIT License Copyright (c) 2025
|
|
1
|
+
MIT License Copyright (c) 2025 Abilaesh Kandiah
|
|
2
2
|
|
|
3
|
-
Permission is hereby granted,
|
|
4
|
-
to any person obtaining a copy of this software and associated
|
|
5
|
-
files (the "Software"), to deal in the Software without
|
|
6
|
-
without limitation the rights to use, copy, modify, merge,
|
|
7
|
-
sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
Software is furnished to do so, subject to the
|
|
3
|
+
Permission is hereby granted,
|
|
4
|
+
free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
+
documentation files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use, copy, modify, merge,
|
|
7
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
9
10
|
|
|
10
|
-
The above
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
The above copyright notice and this permission notice
|
|
12
|
+
(including the next paragraph) shall be included in all copies or substantial
|
|
13
|
+
portions of the Software.
|
|
13
14
|
|
|
14
|
-
THE SOFTWARE
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
18
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
19
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -18,5 +18,5 @@ interface MessageBannerProps extends BannerProps {
|
|
|
18
18
|
message: string | React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
declare function MessageBanner({ message, ...props }: MessageBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export { Banner,
|
|
21
|
+
export { Banner, bannerType, MessageBanner, type TBannerType };
|
|
22
22
|
//# sourceMappingURL=Banner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/Banner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/Banner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAMrD,QAAA,MAAM,UAAU;;;;;CAKN,CAAC;AAEX,KAAK,WAAW,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAUhE,UAAU,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACxD,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;CAC7C;AAED,iBAAS,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAqCtG;AAED,UAAU,kBAAmB,SAAQ,WAAW;IAC/C,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;CAClC;AAED,iBAAS,aAAa,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAQ/D;AA4BD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
|
@@ -1,76 +1,71 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const n = {
|
|
1
|
+
import { jsx as n, jsxs as r, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../shared/utils.js";
|
|
3
|
+
import { CircleX as N, TriangleAlert as g, Lightbulb as x, Info as b, X as v } from "lucide-react";
|
|
4
|
+
import { B } from "../shared/Button.js";
|
|
5
|
+
import { S as s } from "../shared/Skeleton.js";
|
|
6
|
+
const a = {
|
|
8
7
|
Info: "info",
|
|
9
8
|
Note: "note",
|
|
10
9
|
Warning: "warning",
|
|
11
10
|
Alert: "alert"
|
|
12
|
-
},
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
}, m = {
|
|
18
|
-
[n.Info]: "blue",
|
|
19
|
-
[n.Note]: "green",
|
|
20
|
-
[n.Warning]: "yellow",
|
|
21
|
-
[n.Alert]: "red"
|
|
11
|
+
}, o = {
|
|
12
|
+
[a.Info]: b,
|
|
13
|
+
[a.Note]: x,
|
|
14
|
+
[a.Warning]: g,
|
|
15
|
+
[a.Alert]: N
|
|
22
16
|
};
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
17
|
+
function w({ type: e, title: t, loading: i, hideIcon: c, onClose: l, children: m, className: d, ...h }) {
|
|
18
|
+
const f = o[e] ?? o[a.Note];
|
|
19
|
+
return /* @__PURE__ */ n(
|
|
26
20
|
"div",
|
|
27
21
|
{
|
|
28
|
-
|
|
22
|
+
"data-banner-type": e,
|
|
23
|
+
className: p(d),
|
|
29
24
|
role: "alert",
|
|
30
|
-
...
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
!
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
t && /* @__PURE__ */
|
|
36
|
-
|
|
25
|
+
...h,
|
|
26
|
+
children: /* @__PURE__ */ r("div", { className: "flex items-start", children: [
|
|
27
|
+
i ? /* @__PURE__ */ n(C, {}) : /* @__PURE__ */ r(u, { children: [
|
|
28
|
+
!c && /* @__PURE__ */ n("div", { className: "flex-shrink-0 mr-3", children: /* @__PURE__ */ n(f, {}) }),
|
|
29
|
+
/* @__PURE__ */ r("section", { children: [
|
|
30
|
+
t && /* @__PURE__ */ n("p", { className: "font-bold", children: t }),
|
|
31
|
+
m
|
|
37
32
|
] })
|
|
38
33
|
] }),
|
|
39
|
-
|
|
34
|
+
l && /* @__PURE__ */ n(I, { onClick: l })
|
|
40
35
|
] })
|
|
41
36
|
}
|
|
42
37
|
);
|
|
43
38
|
}
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */
|
|
39
|
+
function S({ message: e, ...t }) {
|
|
40
|
+
return /* @__PURE__ */ n(w, { ...t, children: /* @__PURE__ */ n("p", { className: "text-sm", children: e }) });
|
|
46
41
|
}
|
|
47
|
-
function
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
42
|
+
function C() {
|
|
43
|
+
return /* @__PURE__ */ r("div", { className: "flex items-center space-x-4", children: [
|
|
44
|
+
/* @__PURE__ */ n(s, { className: "h-12 w-12 rounded-full" }),
|
|
45
|
+
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
46
|
+
/* @__PURE__ */ n(s, { className: "h-4 w-[250px]" }),
|
|
47
|
+
/* @__PURE__ */ n(s, { className: "h-4 w-[200px]" })
|
|
53
48
|
] })
|
|
54
49
|
] });
|
|
55
50
|
}
|
|
56
|
-
function
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
|
|
51
|
+
function I(e) {
|
|
52
|
+
return /* @__PURE__ */ r(
|
|
53
|
+
B,
|
|
59
54
|
{
|
|
60
55
|
variant: "ghost",
|
|
61
56
|
size: "icon",
|
|
62
57
|
className: "h-8 w-8 rounded-full ml-auto mb-auto relative -top-1 -right-1",
|
|
63
|
-
...
|
|
58
|
+
...e,
|
|
64
59
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ n(v, {}),
|
|
61
|
+
/* @__PURE__ */ n("span", { className: "sr-only", children: "Close banner" })
|
|
67
62
|
]
|
|
68
63
|
}
|
|
69
64
|
);
|
|
70
65
|
}
|
|
71
66
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
w as Banner,
|
|
68
|
+
S as MessageBanner,
|
|
69
|
+
a as bannerType
|
|
75
70
|
};
|
|
76
71
|
//# sourceMappingURL=Banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sources":["../../src/components/Banner/Banner.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Banner.js","sources":["../../src/components/Banner/Banner.tsx"],"sourcesContent":["import type { onClickCallback } from \"@/types/types\";\nimport { cn } from \"@/utils\";\nimport { CircleX, Info, Lightbulb, TriangleAlert, X } from \"lucide-react\";\nimport { Button } from \"../Button\";\nimport { Skeleton } from \"../Skeleton\";\n\nconst bannerType = {\n\tInfo: 'info',\n\tNote: 'note',\n\tWarning: 'warning',\n\tAlert: 'alert'\n} as const;\n\ntype TBannerType = (typeof bannerType)[keyof typeof bannerType];\n\nconst icons: Record<TBannerType, React.ComponentType> = {\n\t[bannerType.Info]: Info,\n\t[bannerType.Note]: Lightbulb,\n\t[bannerType.Warning]: TriangleAlert,\n\t[bannerType.Alert]: CircleX\n};\n\n\ninterface BannerProps extends React.ComponentProps<\"div\"> {\n\ttype: TBannerType;\n\ttitle?: string;\n\tloading?: boolean;\n\thideIcon?: boolean;\n\tonClose?: onClickCallback<HTMLButtonElement>;\n}\n\nfunction Banner({ type, title, loading, hideIcon, onClose, children, className, ...props }: BannerProps) {\n\tconst Icon = icons[type] ?? icons[bannerType.Note];\n\n\treturn (\n\t\t<div\n\t\t\tdata-banner-type={type}\n\t\t\tclassName={cn(className)}\n\t\t\trole=\"alert\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<div className={`flex items-start`}>\n\t\t\t\t{loading ?\n\t\t\t\t\t<BannerLoadingContent />\n\t\t\t\t\t:\n\t\t\t\t\t<>\n\t\t\t\t\t\t{!hideIcon &&\n\t\t\t\t\t\t\t<div className={`flex-shrink-0 mr-3`}>\n\t\t\t\t\t\t\t\t<Icon />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t{title && (\n\t\t\t\t\t\t\t\t<p className={`font-bold`}>\n\t\t\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</section>\n\t\t\t\t\t</>\n\t\t\t\t}\n\n\t\t\t\t{onClose &&\n\t\t\t\t\t<CloseButton onClick={onClose} />\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\ninterface MessageBannerProps extends BannerProps {\n\tmessage: string | React.ReactNode;\n}\n\nfunction MessageBanner({ message, ...props }: MessageBannerProps) {\n\treturn (\n\t\t<Banner {...props}>\n\t\t\t<p className=\"text-sm\">\n\t\t\t\t{message}\n\t\t\t</p>\n\t\t</Banner>\n\t)\n}\n\nfunction BannerLoadingContent() {\n\treturn (\n\t\t<div className=\"flex items-center space-x-4\">\n\t\t\t<Skeleton className=\"h-12 w-12 rounded-full\" />\n\t\t\t<div className=\"space-y-2\">\n\t\t\t\t<Skeleton className=\"h-4 w-[250px]\" />\n\t\t\t\t<Skeleton className=\"h-4 w-[200px]\" />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nfunction CloseButton(props: React.ComponentProps<\"button\">) {\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"ghost\"\n\t\t\tsize=\"icon\"\n\t\t\tclassName=\"h-8 w-8 rounded-full ml-auto mb-auto relative -top-1 -right-1\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<X />\n\t\t\t<span className=\"sr-only\">Close banner</span>\n\t\t</Button>\n\t);\n}\n\nexport { Banner, bannerType, MessageBanner, type TBannerType };\n\n"],"names":["bannerType","icons","Info","Lightbulb","TriangleAlert","CircleX","Banner","type","title","loading","hideIcon","onClose","children","className","props","Icon","jsx","cn","jsxs","BannerLoadingContent","Fragment","CloseButton","MessageBanner","message","Skeleton","Button","X"],"mappings":";;;;;AAMA,MAAMA,IAAa;AAAA,EAClB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACR,GAIMC,IAAkD;AAAA,EACvD,CAACD,EAAW,IAAI,GAAGE;AAAA,EACnB,CAACF,EAAW,IAAI,GAAGG;AAAA,EACnB,CAACH,EAAW,OAAO,GAAGI;AAAA,EACtB,CAACJ,EAAW,KAAK,GAAGK;AACrB;AAWA,SAASC,EAAO,EAAE,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,UAAAC,GAAU,SAAAC,GAAS,UAAAC,GAAU,WAAAC,GAAW,GAAGC,KAAsB;AACxG,QAAMC,IAAOd,EAAMM,CAAI,KAAKN,EAAMD,EAAW,IAAI;AAEjD,SACC,gBAAAgB;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,oBAAkBT;AAAA,MAClB,WAAWU,EAAGJ,CAAS;AAAA,MACvB,MAAK;AAAA,MACJ,GAAGC;AAAA,MAEJ,UAAA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A,QACH,gBAAAV,EAAC,QAAA,EAAK,WAAU,WAAU,UAAA,eAAA,CAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGzC;"}
|
package/package.json
CHANGED
package/src/styles.css
CHANGED
|
@@ -193,6 +193,19 @@ code {
|
|
|
193
193
|
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
|
194
194
|
--sidebar-border: oklch(0.92 0.004 286.32);
|
|
195
195
|
--sidebar-ring: oklch(0.871 0.006 286.286);
|
|
196
|
+
/* Banner type semantic tokens (light) */
|
|
197
|
+
--banner-warning: oklch(0.95 0.06 85);
|
|
198
|
+
--banner-warning-foreground: oklch(0.45 0.12 75);
|
|
199
|
+
--banner-warning-border: oklch(0.75 0.15 85);
|
|
200
|
+
--banner-info: oklch(0.94 0.04 250);
|
|
201
|
+
--banner-info-foreground: oklch(0.35 0.12 265);
|
|
202
|
+
--banner-info-border: oklch(0.65 0.18 250);
|
|
203
|
+
--banner-alert: oklch(0.97 0.02 25);
|
|
204
|
+
--banner-alert-foreground: oklch(0.45 0.18 25);
|
|
205
|
+
--banner-alert-border: oklch(0.65 0.2 25);
|
|
206
|
+
--banner-note: oklch(0.967 0.001 286.375);
|
|
207
|
+
--banner-note-foreground: oklch(0.45 0.02 286);
|
|
208
|
+
--banner-note-border: oklch(0.85 0.01 286);
|
|
196
209
|
}
|
|
197
210
|
|
|
198
211
|
.dark {
|
|
@@ -228,6 +241,47 @@ code {
|
|
|
228
241
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
229
242
|
--sidebar-border: oklch(0.274 0.006 286.033);
|
|
230
243
|
--sidebar-ring: oklch(0.442 0.017 285.786);
|
|
244
|
+
/* Banner type semantic tokens (dark) */
|
|
245
|
+
--banner-warning: oklch(0.28 0.08 75);
|
|
246
|
+
--banner-warning-foreground: oklch(0.88 0.1 85);
|
|
247
|
+
--banner-warning-border: oklch(0.5 0.12 75);
|
|
248
|
+
--banner-info: oklch(0.22 0.06 265);
|
|
249
|
+
--banner-info-foreground: oklch(0.85 0.08 250);
|
|
250
|
+
--banner-info-border: oklch(0.45 0.15 265);
|
|
251
|
+
--banner-alert: oklch(0.28 0.08 25);
|
|
252
|
+
--banner-alert-foreground: oklch(0.88 0.1 25);
|
|
253
|
+
--banner-alert-border: oklch(0.5 0.15 25);
|
|
254
|
+
--banner-note: oklch(0.274 0.006 286.033);
|
|
255
|
+
--banner-note-foreground: oklch(0.705 0.015 286.067);
|
|
256
|
+
--banner-note-border: oklch(0.4 0.02 286);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* Banner: style by type so colors work when package is imported in other projects */
|
|
260
|
+
[data-banner-type] {
|
|
261
|
+
padding: 0.75rem;
|
|
262
|
+
border-left-width: 4px;
|
|
263
|
+
border-left-style: solid;
|
|
264
|
+
border-radius: var(--radius);
|
|
265
|
+
}
|
|
266
|
+
[data-banner-type="warning"] {
|
|
267
|
+
background: var(--banner-warning);
|
|
268
|
+
color: var(--banner-warning-foreground);
|
|
269
|
+
border-color: var(--banner-warning-border);
|
|
270
|
+
}
|
|
271
|
+
[data-banner-type="info"] {
|
|
272
|
+
background: var(--banner-info);
|
|
273
|
+
color: var(--banner-info-foreground);
|
|
274
|
+
border-color: var(--banner-info-border);
|
|
275
|
+
}
|
|
276
|
+
[data-banner-type="alert"] {
|
|
277
|
+
background: var(--banner-alert);
|
|
278
|
+
color: var(--banner-alert-foreground);
|
|
279
|
+
border-color: var(--banner-alert-border);
|
|
280
|
+
}
|
|
281
|
+
[data-banner-type="note"] {
|
|
282
|
+
background: var(--banner-note);
|
|
283
|
+
color: var(--banner-note-foreground);
|
|
284
|
+
border-color: var(--banner-note-border);
|
|
231
285
|
}
|
|
232
286
|
|
|
233
287
|
@theme inline {
|