@lucasromero/matrix-ui 0.1.3 → 0.2.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/matrix-ui.es.js +171 -159
- package/dist/matrix-ui.umd.js +2 -2
- package/dist/types/buttonType.d.ts +1 -0
- package/dist/types/cardType.d.ts +6 -1
- package/dist/types/dropdownMenuType.d.ts +1 -0
- package/dist/types/imageType.d.ts +2 -2
- package/dist/types/linkType.d.ts +1 -0
- package/dist/types/navbarType.d.ts +3 -0
- package/package.json +3 -3
package/dist/matrix-ui.es.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.primary{color:#111827;cursor:pointer;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.primary:hover:not(:disabled){background:#5fafd6}.primary:active:not(:disabled){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.secondary:hover:not(:disabled){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.ghost:hover:not(:disabled){background:#ffffff0d}.ghost:active:not(:disabled){background:#ffffff14}.error{color:#111827;cursor:pointer;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.error:hover:not(:disabled){filter:brightness(.95)}.error:active:not(:disabled){filter:brightness(.9)}.success{color:#111827;cursor:pointer;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.success:hover:not(:disabled){filter:brightness(.95)}.success:active:not(:disabled){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled){color:#f8fafc}.transparent:disabled{color:#64748b;cursor:not-allowed}._cardContainer_16ci6_1{border-radius:8px;flex-direction:column;justify-content:center;align-items:center;width:100%;max-width:min(400px,90%);height:auto;margin:0 auto;display:flex}._topContentContainer_16ci6_13{flex-direction:column;margin-top:1rem;margin-bottom:1rem;display:flex}._cardTitle_16ci6_20{margin:0 1rem .2rem}._miniCard_16ci6_27 ._cardTitle_16ci6_20{flex:1;margin:0}._ctaContainer_16ci6_32{box-sizing:border-box;flex-direction:column;justify-content:space-between;gap:1rem;width:100%;padding:.75rem;display:flex}._miniCard_16ci6_27 ._ctaContainer_16ci6_32{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem}._imgContainer_16ci6_49{box-sizing:border-box;border-radius:8px;justify-content:center;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem;display:flex}._img_16ci6_49{max-width:100%}._miniCard_16ci6_27 ._topContentContainer_16ci6_13{flex-direction:row;justify-content:flex-start;align-items:center;gap:1rem;margin-top:1rem;margin-bottom:1rem}._cardRating_16ci6_72{justify-content:center;margin-top:.1rem;display:flex}._headingSm_1wdfi_1{color:#f8fafc;font-size:1.25rem;font-weight:600}._headingMd_1wdfi_7{color:#f8fafc;font-size:1.5rem;font-weight:600}._headingLg_1wdfi_13{color:#f8fafc;font-size:1.875rem;font-weight:700}._headingXl_1wdfi_19{color:#f8fafc;font-size:2rem;font-weight:700}._bodySm_1wdfi_25{color:#cbd5e1;font-size:.875rem;font-weight:400}._bodyMd_1wdfi_31{color:#cbd5e1;font-size:1rem;font-weight:400}._bodyLg_1wdfi_37{color:#cbd5e1;font-size:1.125rem;font-weight:400}._caption_1wdfi_43{color:#cbd5e1;font-size:.75rem;font-weight:500}.
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { Fragment as
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.primary{color:#111827;cursor:pointer;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.primary:hover:not(:disabled){background:#5fafd6}.primary:active:not(:disabled){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.secondary:hover:not(:disabled){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.ghost:hover:not(:disabled){background:#ffffff0d}.ghost:active:not(:disabled){background:#ffffff14}.error{color:#111827;cursor:pointer;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.error:hover:not(:disabled){filter:brightness(.95)}.error:active:not(:disabled){filter:brightness(.9)}.success{color:#111827;cursor:pointer;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.success:hover:not(:disabled){filter:brightness(.95)}.success:active:not(:disabled){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled){color:#f8fafc}.transparent:disabled{color:#64748b;cursor:not-allowed}._cardContainer_16ci6_1{border-radius:8px;flex-direction:column;justify-content:center;align-items:center;width:100%;max-width:min(400px,90%);height:auto;margin:0 auto;display:flex}._topContentContainer_16ci6_13{flex-direction:column;margin-top:1rem;margin-bottom:1rem;display:flex}._cardTitle_16ci6_20{margin:0 1rem .2rem}._miniCard_16ci6_27 ._cardTitle_16ci6_20{flex:1;margin:0}._ctaContainer_16ci6_32{box-sizing:border-box;flex-direction:column;justify-content:space-between;gap:1rem;width:100%;padding:.75rem;display:flex}._miniCard_16ci6_27 ._ctaContainer_16ci6_32{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem}._imgContainer_16ci6_49{box-sizing:border-box;border-radius:8px;justify-content:center;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem;display:flex}._img_16ci6_49{max-width:100%}._miniCard_16ci6_27 ._topContentContainer_16ci6_13{flex-direction:row;justify-content:flex-start;align-items:center;gap:1rem;margin-top:1rem;margin-bottom:1rem}._cardRating_16ci6_72{justify-content:center;margin-top:.1rem;display:flex}._headingSm_1wdfi_1{color:#f8fafc;font-size:1.25rem;font-weight:600}._headingMd_1wdfi_7{color:#f8fafc;font-size:1.5rem;font-weight:600}._headingLg_1wdfi_13{color:#f8fafc;font-size:1.875rem;font-weight:700}._headingXl_1wdfi_19{color:#f8fafc;font-size:2rem;font-weight:700}._bodySm_1wdfi_25{color:#cbd5e1;font-size:.875rem;font-weight:400}._bodyMd_1wdfi_31{color:#cbd5e1;font-size:1rem;font-weight:400}._bodyLg_1wdfi_37{color:#cbd5e1;font-size:1.125rem;font-weight:400}._caption_1wdfi_43{color:#cbd5e1;font-size:.75rem;font-weight:500}._img_14ux7_1{max-width:100%;display:block}._circle_14ux7_6{border-radius:50%}._ratingContainer_1xmf5_1{flex-direction:row;display:flex}._text_1xmf5_6{margin:0;padding-right:.2rem}._star_1xmf5_11{color:gold;fill:gold;width:1rem;height:1rem;margin-top:.17rem}.primary{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.primary:hover:not(:disabled),.primary:hover:not([aria-disabled=true]){background:#5fafd6}.primary:active:not(:disabled),.primary:active:not([aria-disabled=true]){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;text-align:center;vertical-align:middle;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.secondary:hover:not(:disabled),.secondary:hover:not([aria-disabled=true]){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled),.secondary:active:not([aria-disabled=true]){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;text-align:center;vertical-align:middle;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.ghost:hover:not(:disabled),.ghost:hover:not([aria-disabled=true]){background:#ffffff0d}.ghost:active:not(:disabled),.ghost:active:not([aria-disabled=true]){background:#ffffff14}.error{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.error:hover:not(:disabled),.error:hover:not([aria-disabled=true]){filter:brightness(.95)}.error:active:not(:disabled),.error:active:not([aria-disabled=true]){filter:brightness(.9)}.success{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.success:hover:not(:disabled),.success:hover:not([aria-disabled=true]){filter:brightness(.95)}.success:active:not(:disabled),.success:active:not([aria-disabled=true]){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;text-align:center;vertical-align:middle;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled),.transparent:hover:not([aria-disabled=true]){color:#f8fafc}.transparent.active{color:#f8fafc;background:#ffffff14}.transparent:focus-visible{outline:none;box-shadow:0 0 0 3px #87ceeb59}.transparent:disabled,.transparent[aria-disabled=true]{color:#64748b;cursor:not-allowed}.link{justify-content:center;align-items:center;display:flex}._navElementsContainer_ndrvq_1{z-index:1000;background-color:#0b0f17;border-bottom:2px solid #1f2937;width:100%;height:3.5rem;position:sticky;top:0}._internalElementsContainer_ndrvq_11{flex-direction:row;align-items:center;width:100%;height:3.5rem;display:flex}._hamburgerIcon_ndrvq_19{margin-left:auto;padding-right:2rem}._leftElementsContainer_ndrvq_24{flex-direction:row;align-items:center;gap:2rem;width:50%;padding-left:1.5rem;line-height:.625rem;display:flex}._leftElement_ndrvq_24{padding-left:2rem}._rightElementsContainer_ndrvq_38{flex-direction:row;justify-content:end;gap:2rem;width:50%;padding-right:2rem;line-height:.625rem;display:flex}._wrapper_1cng4_1{min-width:10rem;display:inline-block;position:relative}._dropdownButton_1cng4_7{padding:0}._dropdownButtonContainer_1cng4_11{justify-content:right;align-items:end;display:flex}._listItemContainer_1cng4_17{z-index:1000;border-radius:5px;flex-direction:column;justify-content:left;align-items:start;min-width:10rem;margin-top:.5rem;padding:0;display:flex;position:absolute;top:100%;left:0}._listItem_1cng4_17{padding-top:.5rem;padding-bottom:.5rem;list-style:none}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
+
import e, { createContext as t, createElement as n, forwardRef as r, useContext as i, useEffect as a, useState as o } from "react";
|
|
3
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
4
|
//#region node_modules/clsx/dist/clsx.mjs
|
|
5
|
-
function
|
|
5
|
+
function u(e) {
|
|
6
6
|
var t, n, r = "";
|
|
7
7
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
8
8
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
9
9
|
var i = e.length;
|
|
10
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
10
|
+
for (t = 0; t < i; t++) e[t] && (n = u(e[t])) && (r && (r += " "), r += n);
|
|
11
11
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
12
12
|
return r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
14
|
+
function d() {
|
|
15
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = u(e)) && (r && (r += " "), r += t);
|
|
16
16
|
return r;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/constants.ts
|
|
20
|
-
var
|
|
20
|
+
var f = {
|
|
21
21
|
primary: "primary",
|
|
22
22
|
secondary: "secondary",
|
|
23
23
|
ghost: "ghost",
|
|
24
24
|
transparent: "transparent",
|
|
25
25
|
success: "success",
|
|
26
26
|
error: "error"
|
|
27
|
-
},
|
|
27
|
+
}, p = {
|
|
28
28
|
primary: "primary",
|
|
29
29
|
secondary: "secondary",
|
|
30
30
|
ghost: "ghost",
|
|
31
31
|
transparent: "transparent",
|
|
32
32
|
success: "success",
|
|
33
33
|
error: "error"
|
|
34
|
-
},
|
|
35
|
-
id:
|
|
36
|
-
"aria-label":
|
|
37
|
-
"aria-pressed":
|
|
38
|
-
onClick:
|
|
39
|
-
className:
|
|
34
|
+
}, m = ({ id: e, variant: t = "primary", text: n, onClick: r, className: i, ariaLabel: a = "Button", ariaPressed: o = !1 }) => /* @__PURE__ */ c("button", {
|
|
35
|
+
id: e,
|
|
36
|
+
"aria-label": a,
|
|
37
|
+
"aria-pressed": o,
|
|
38
|
+
onClick: r,
|
|
39
|
+
className: d(t && p[t], i),
|
|
40
40
|
role: "button",
|
|
41
|
-
children:
|
|
41
|
+
children: n
|
|
42
42
|
}), h = {
|
|
43
43
|
cardContainer: "_cardContainer_16ci6_1",
|
|
44
44
|
topContentContainer: "_topContentContainer_16ci6_13",
|
|
@@ -68,28 +68,30 @@ var d = {
|
|
|
68
68
|
caption: "_caption_1wdfi_43"
|
|
69
69
|
}, v = ({ copy: e, variant: t, className: n }) => {
|
|
70
70
|
let r = g[t];
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
className:
|
|
71
|
+
return /* @__PURE__ */ c(r, {
|
|
72
|
+
className: d(n, _[t]),
|
|
73
73
|
children: e
|
|
74
74
|
});
|
|
75
75
|
}, y = {
|
|
76
|
-
img: "
|
|
77
|
-
circle: "
|
|
78
|
-
}, b = ({
|
|
79
|
-
let
|
|
80
|
-
return /* @__PURE__ */
|
|
81
|
-
id:
|
|
82
|
-
"aria-label":
|
|
83
|
-
"data-circle":
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
img: "_img_14ux7_1",
|
|
77
|
+
circle: "_circle_14ux7_6"
|
|
78
|
+
}, b = (e) => `${e?.toLowerCase().replace(/\s+/g, "-")}-id`, x = ({ width: e, height: t, src: n, alt: r, className: i, isCircle: a = !1, ariaLabel: o, style: s }) => {
|
|
79
|
+
let l = d(y.img, a && y.circle, i);
|
|
80
|
+
return /* @__PURE__ */ c("img", {
|
|
81
|
+
id: b(o),
|
|
82
|
+
"aria-label": o ?? "Image",
|
|
83
|
+
"data-circle": a,
|
|
84
|
+
className: l,
|
|
85
|
+
src: n,
|
|
86
|
+
alt: r,
|
|
87
|
+
width: e,
|
|
88
|
+
height: t,
|
|
89
|
+
style: s
|
|
88
90
|
});
|
|
89
|
-
},
|
|
90
|
-
let t =
|
|
91
|
+
}, S = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), C = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), w = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), T = (e) => {
|
|
92
|
+
let t = w(e);
|
|
91
93
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
92
|
-
},
|
|
94
|
+
}, E = {
|
|
93
95
|
xmlns: "http://www.w3.org/2000/svg",
|
|
94
96
|
width: 24,
|
|
95
97
|
height: 24,
|
|
@@ -99,31 +101,31 @@ var d = {
|
|
|
99
101
|
strokeWidth: 2,
|
|
100
102
|
strokeLinecap: "round",
|
|
101
103
|
strokeLinejoin: "round"
|
|
102
|
-
},
|
|
104
|
+
}, D = (e) => {
|
|
103
105
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
104
106
|
return !1;
|
|
105
|
-
},
|
|
106
|
-
let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } =
|
|
107
|
-
return
|
|
107
|
+
}, O = t({}), k = () => i(O), A = r(({ color: e, size: t, strokeWidth: r, absoluteStrokeWidth: i, className: a = "", children: o, iconNode: s, ...c }, l) => {
|
|
108
|
+
let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = k() ?? {}, h = i ?? f ? Number(r ?? d) * 24 / Number(t ?? u) : r ?? d;
|
|
109
|
+
return n("svg", {
|
|
108
110
|
ref: l,
|
|
109
|
-
...
|
|
110
|
-
width:
|
|
111
|
-
height:
|
|
111
|
+
...E,
|
|
112
|
+
width: t ?? u ?? E.width,
|
|
113
|
+
height: t ?? u ?? E.height,
|
|
112
114
|
stroke: e ?? p,
|
|
113
115
|
strokeWidth: h,
|
|
114
|
-
className:
|
|
115
|
-
...!o && !
|
|
116
|
+
className: S("lucide", m, a),
|
|
117
|
+
...!o && !D(c) && { "aria-hidden": "true" },
|
|
116
118
|
...c
|
|
117
|
-
}, [...s.map(([e,
|
|
118
|
-
}),
|
|
119
|
-
let i =
|
|
119
|
+
}, [...s.map(([e, t]) => n(e, t)), ...Array.isArray(o) ? o : [o]]);
|
|
120
|
+
}), j = (e, t) => {
|
|
121
|
+
let i = r(({ className: r, ...i }, a) => n(A, {
|
|
120
122
|
ref: a,
|
|
121
|
-
iconNode:
|
|
122
|
-
className:
|
|
123
|
+
iconNode: t,
|
|
124
|
+
className: S(`lucide-${C(T(e))}`, `lucide-${e}`, r),
|
|
123
125
|
...i
|
|
124
126
|
}));
|
|
125
|
-
return i.displayName =
|
|
126
|
-
},
|
|
127
|
+
return i.displayName = T(e), i;
|
|
128
|
+
}, M = j("menu", [
|
|
127
129
|
["path", {
|
|
128
130
|
d: "M4 5h16",
|
|
129
131
|
key: "1tepv9"
|
|
@@ -136,114 +138,120 @@ var d = {
|
|
|
136
138
|
d: "M4 19h16",
|
|
137
139
|
key: "1djgab"
|
|
138
140
|
}]
|
|
139
|
-
]),
|
|
141
|
+
]), N = j("star", [["path", {
|
|
140
142
|
d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
|
|
141
143
|
key: "r04s7s"
|
|
142
|
-
}]]),
|
|
144
|
+
}]]), P = {
|
|
143
145
|
ratingContainer: "_ratingContainer_1xmf5_1",
|
|
144
146
|
text: "_text_1xmf5_6",
|
|
145
147
|
star: "_star_1xmf5_11"
|
|
146
|
-
},
|
|
147
|
-
{ star: /* @__PURE__ */
|
|
148
|
-
{ star: /* @__PURE__ */
|
|
149
|
-
{ star: /* @__PURE__ */
|
|
150
|
-
{ star: /* @__PURE__ */
|
|
151
|
-
{ star: /* @__PURE__ */
|
|
152
|
-
],
|
|
153
|
-
id:
|
|
154
|
-
className:
|
|
148
|
+
}, F = [
|
|
149
|
+
{ star: /* @__PURE__ */ c(N, { className: P.star }) },
|
|
150
|
+
{ star: /* @__PURE__ */ c(N, { className: P.star }) },
|
|
151
|
+
{ star: /* @__PURE__ */ c(N, { className: P.star }) },
|
|
152
|
+
{ star: /* @__PURE__ */ c(N, { className: P.star }) },
|
|
153
|
+
{ star: /* @__PURE__ */ c(N, { className: P.star }) }
|
|
154
|
+
], I = ({ rating: t }) => F.filter((e, n) => t && n < t).map((t, n) => e.cloneElement(t.star, { key: n })), L = ({ variant: e, text: t, to: n, className: r, ariaLabel: i, id: a }) => /* @__PURE__ */ c("a", {
|
|
155
|
+
id: a,
|
|
156
|
+
className: d("link", e && f[e], r),
|
|
155
157
|
href: n,
|
|
156
158
|
target: "_blank",
|
|
157
159
|
rel: "noopener noreferrer",
|
|
158
160
|
"aria-label": i ?? "Link",
|
|
159
161
|
role: "link",
|
|
160
162
|
children: t
|
|
161
|
-
}),
|
|
162
|
-
id:
|
|
163
|
-
"aria-label": `${
|
|
164
|
-
className: `${h.cardContainer} ${
|
|
163
|
+
}), R = ({ id: e, borderColor: t = "", backgroundColor: n, miniCard: r = !1, title: i, hasRating: a, ratingValue: o, img: s, imgAriaLabel: u, isImgCircle: d = !0, imgHeight: f, imgWidth: p, primaryCta: g, secondaryCta: _ }) => /* @__PURE__ */ l("article", {
|
|
164
|
+
id: e,
|
|
165
|
+
"aria-label": `${i} Card`,
|
|
166
|
+
className: `${h.cardContainer} ${r ? h.miniCard : ""}`,
|
|
165
167
|
style: {
|
|
166
|
-
backgroundColor:
|
|
167
|
-
border:
|
|
168
|
+
backgroundColor: n,
|
|
169
|
+
border: t ? `2px solid ${t}` : void 0
|
|
168
170
|
},
|
|
169
171
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ l("div", {
|
|
171
173
|
"aria-label": "Card Top Content Container",
|
|
172
174
|
className: h.topContentContainer,
|
|
173
|
-
children: [/* @__PURE__ */
|
|
175
|
+
children: [/* @__PURE__ */ c(v, {
|
|
174
176
|
className: h.cardTitle,
|
|
175
177
|
variant: "headingMd",
|
|
176
|
-
copy:
|
|
177
|
-
}),
|
|
178
|
+
copy: i
|
|
179
|
+
}), a && o != null && /* @__PURE__ */ c("div", {
|
|
178
180
|
"aria-label": "Card Rating Container",
|
|
179
181
|
className: h.cardRating,
|
|
180
|
-
children: /* @__PURE__ */
|
|
182
|
+
children: /* @__PURE__ */ c(I, { rating: o })
|
|
181
183
|
})]
|
|
182
184
|
}),
|
|
183
|
-
!
|
|
184
|
-
"aria-label":
|
|
185
|
+
!r && /* @__PURE__ */ c("div", {
|
|
186
|
+
"aria-label": u ? `${u} Container` : "Image Container",
|
|
185
187
|
className: h.imgContainer,
|
|
186
|
-
children: /* @__PURE__ */
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
children: /* @__PURE__ */ c(x, {
|
|
189
|
+
width: p,
|
|
190
|
+
height: f,
|
|
191
|
+
ariaLabel: u ?? "Card Image",
|
|
192
|
+
isCircle: d,
|
|
193
|
+
src: s ?? "",
|
|
194
|
+
alt: `${i} Card Image`,
|
|
195
|
+
style: { border: t ? `2px solid ${t}` : void 0 }
|
|
192
196
|
})
|
|
193
197
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ l("div", {
|
|
195
199
|
"aria-label": "Card CTA Container",
|
|
196
200
|
className: h.ctaContainer,
|
|
197
|
-
children: [
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
201
|
+
children: [g && (g?.isLink ? /* @__PURE__ */ c(L, {
|
|
202
|
+
id: g.id,
|
|
203
|
+
ariaLabel: g.ariaLinkLabel ?? "Primary Card Link",
|
|
204
|
+
to: g.to,
|
|
205
|
+
text: g.text,
|
|
206
|
+
variant: g.variant
|
|
207
|
+
}) : /* @__PURE__ */ c(m, {
|
|
208
|
+
id: g.id,
|
|
209
|
+
ariaLabel: g?.ariaButtonLabel ?? "Primary Card Button",
|
|
210
|
+
ariaPressed: g?.ariaPressed,
|
|
211
|
+
variant: g?.variant,
|
|
212
|
+
text: g?.text,
|
|
213
|
+
onClick: g?.onClick
|
|
214
|
+
})), _ && (_.isLink ? /* @__PURE__ */ c(L, {
|
|
215
|
+
id: _.id,
|
|
216
|
+
ariaLabel: _.ariaLinkLabel ?? "Secondary Card Link",
|
|
217
|
+
to: _.to,
|
|
218
|
+
text: _.text,
|
|
219
|
+
variant: _.variant
|
|
220
|
+
}) : /* @__PURE__ */ c(m, {
|
|
221
|
+
id: _.id,
|
|
222
|
+
ariaLabel: _.ariaButtonLabel ?? "Secondary Card Button",
|
|
223
|
+
ariaPressed: _.ariaPressed,
|
|
224
|
+
variant: _.variant,
|
|
225
|
+
text: _.text,
|
|
226
|
+
onClick: _.onClick
|
|
227
|
+
}))]
|
|
220
228
|
})
|
|
221
229
|
]
|
|
222
|
-
}),
|
|
230
|
+
}), z = {
|
|
223
231
|
navElementsContainer: "_navElementsContainer_ndrvq_1",
|
|
224
232
|
internalElementsContainer: "_internalElementsContainer_ndrvq_11",
|
|
225
233
|
hamburgerIcon: "_hamburgerIcon_ndrvq_19",
|
|
226
234
|
leftElementsContainer: "_leftElementsContainer_ndrvq_24",
|
|
227
235
|
leftElement: "_leftElement_ndrvq_24",
|
|
228
236
|
rightElementsContainer: "_rightElementsContainer_ndrvq_38"
|
|
229
|
-
},
|
|
237
|
+
}, B = {
|
|
230
238
|
mobile: "(max-width: 767px)",
|
|
231
239
|
tablet: "(min-width: 768px) and (max-width: 1023px)",
|
|
232
240
|
desktop: "(min-width: 1024px)",
|
|
233
241
|
belowMobile: "(max-width: 299px)"
|
|
234
|
-
},
|
|
235
|
-
let [e, t] =
|
|
236
|
-
isBelowMobileMinimum: B
|
|
237
|
-
isMobile: B
|
|
238
|
-
isTablet: B
|
|
239
|
-
isDesktop: B
|
|
242
|
+
}, V = (e) => typeof window > "u" ? !1 : window.matchMedia(e).matches, H = () => {
|
|
243
|
+
let [e, t] = o({
|
|
244
|
+
isBelowMobileMinimum: V(B.belowMobile),
|
|
245
|
+
isMobile: V(B.mobile),
|
|
246
|
+
isTablet: V(B.tablet),
|
|
247
|
+
isDesktop: V(B.desktop)
|
|
240
248
|
});
|
|
241
|
-
return
|
|
242
|
-
let e = Object.entries(
|
|
249
|
+
return a(() => {
|
|
250
|
+
let e = Object.entries(B).map(([e, n]) => {
|
|
243
251
|
let r = window.matchMedia(n), i = () => {
|
|
244
252
|
t((t) => ({
|
|
245
253
|
...t,
|
|
246
|
-
[e === "belowMobile" ? "isBelowMobileMinimum" : `is${
|
|
254
|
+
[e === "belowMobile" ? "isBelowMobileMinimum" : `is${U(e)}`]: r.matches
|
|
247
255
|
}));
|
|
248
256
|
};
|
|
249
257
|
return r.addEventListener("change", i), i(), () => r.removeEventListener("change", i);
|
|
@@ -252,90 +260,94 @@ var d = {
|
|
|
252
260
|
e.forEach((e) => e?.());
|
|
253
261
|
};
|
|
254
262
|
}, []), e;
|
|
255
|
-
},
|
|
263
|
+
}, U = (e) => e.charAt(0).toUpperCase() + e.slice(1), W = {
|
|
256
264
|
wrapper: "_wrapper_1cng4_1",
|
|
257
265
|
dropdownButton: "_dropdownButton_1cng4_7",
|
|
258
266
|
dropdownButtonContainer: "_dropdownButtonContainer_1cng4_11",
|
|
259
267
|
listItemContainer: "_listItemContainer_1cng4_17",
|
|
260
268
|
listItem: "_listItem_1cng4_17"
|
|
261
|
-
},
|
|
262
|
-
let [
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
className:
|
|
265
|
-
children: [/* @__PURE__ */
|
|
266
|
-
className:
|
|
267
|
-
children: /* @__PURE__ */
|
|
268
|
-
className:
|
|
269
|
+
}, G = ({ className: e, icon: t, options: n, listBorderColor: r, listBackgroundColor: i, isNavbarDropdown: a = !1 }) => {
|
|
270
|
+
let [s, u] = o(!1);
|
|
271
|
+
return /* @__PURE__ */ l("section", {
|
|
272
|
+
className: d(e, W.wrapper),
|
|
273
|
+
children: [/* @__PURE__ */ c("div", {
|
|
274
|
+
className: W.dropdownButtonContainer,
|
|
275
|
+
children: /* @__PURE__ */ c(m, {
|
|
276
|
+
className: W.dropdownButton,
|
|
269
277
|
text: t,
|
|
270
278
|
variant: "transparent",
|
|
271
|
-
onClick: () =>
|
|
279
|
+
onClick: () => u(!s),
|
|
272
280
|
ariaLabel: "Dropdown Menu Button"
|
|
273
281
|
})
|
|
274
|
-
}),
|
|
282
|
+
}), s && /* @__PURE__ */ c("ul", {
|
|
275
283
|
"aria-label": "Unordered Dropdown List",
|
|
276
|
-
className:
|
|
284
|
+
className: W.listItemContainer,
|
|
277
285
|
style: {
|
|
278
|
-
marginTop:
|
|
286
|
+
marginTop: a ? "1.5rem" : "none",
|
|
279
287
|
border: `2px solid ${r}`,
|
|
280
288
|
backgroundColor: i
|
|
281
289
|
},
|
|
282
|
-
children: n.map((e) => /* @__PURE__ */
|
|
290
|
+
children: n.map((e) => /* @__PURE__ */ c("li", {
|
|
283
291
|
"aria-label": "Dropdown List Item",
|
|
284
|
-
className:
|
|
285
|
-
children: /* @__PURE__ */
|
|
292
|
+
className: W.listItem,
|
|
293
|
+
children: /* @__PURE__ */ c(L, {
|
|
294
|
+
id: e.id,
|
|
286
295
|
variant: e.variant,
|
|
287
296
|
to: e.to,
|
|
288
297
|
text: e.text
|
|
289
298
|
})
|
|
290
|
-
}))
|
|
299
|
+
}, e.id))
|
|
291
300
|
})]
|
|
292
301
|
});
|
|
293
|
-
},
|
|
294
|
-
let
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
id:
|
|
297
|
-
"aria-label":
|
|
302
|
+
}, K = ({ id: e, ariaLabel: t, backgroundColor: n, borderBottomColor: r, dropdownListBackgroundColor: i, dropdownListBorderColor: a, dropdownListIcon: o = /* @__PURE__ */ c(M, {}), leftElement: u, leftElementNeighbors: d, rightElements: f }) => {
|
|
303
|
+
let p = [...d, ...f], { isMobile: m, isBelowMobileMinimum: h } = H();
|
|
304
|
+
return /* @__PURE__ */ c("nav", {
|
|
305
|
+
id: e,
|
|
306
|
+
"aria-label": t ?? "Main Navbar",
|
|
298
307
|
style: {
|
|
299
|
-
backgroundColor:
|
|
300
|
-
borderBottom: `2px solid ${
|
|
308
|
+
backgroundColor: n,
|
|
309
|
+
borderBottom: `2px solid ${r}`
|
|
301
310
|
},
|
|
302
|
-
className:
|
|
303
|
-
children: /* @__PURE__ */
|
|
311
|
+
className: z.navElementsContainer,
|
|
312
|
+
children: /* @__PURE__ */ l("article", {
|
|
304
313
|
"aria-label": "Elements Container",
|
|
305
|
-
className:
|
|
306
|
-
children: [!h && /* @__PURE__ */
|
|
307
|
-
className:
|
|
308
|
-
children:
|
|
309
|
-
}), m ? /* @__PURE__ */
|
|
310
|
-
listBackgroundColor:
|
|
311
|
-
listBorderColor:
|
|
312
|
-
className:
|
|
313
|
-
icon:
|
|
314
|
-
options:
|
|
314
|
+
className: z.internalElementsContainer,
|
|
315
|
+
children: [!h && /* @__PURE__ */ c("div", {
|
|
316
|
+
className: z.leftElement,
|
|
317
|
+
children: u
|
|
318
|
+
}), m ? /* @__PURE__ */ c(G, {
|
|
319
|
+
listBackgroundColor: i,
|
|
320
|
+
listBorderColor: a,
|
|
321
|
+
className: z.hamburgerIcon,
|
|
322
|
+
icon: o,
|
|
323
|
+
options: p.map(({ text: e, to: t, variant: n, id: r }) => ({
|
|
324
|
+
id: r,
|
|
315
325
|
text: e,
|
|
316
326
|
to: t,
|
|
317
327
|
variant: n
|
|
318
328
|
})),
|
|
319
329
|
isNavbarDropdown: !0
|
|
320
|
-
}) : /* @__PURE__ */
|
|
330
|
+
}) : /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("article", {
|
|
321
331
|
"aria-label": "Left Navbar Elements Container",
|
|
322
|
-
className:
|
|
323
|
-
children:
|
|
332
|
+
className: z.leftElementsContainer,
|
|
333
|
+
children: d?.map((e) => /* @__PURE__ */ c(L, {
|
|
334
|
+
id: e.id,
|
|
324
335
|
variant: e.variant,
|
|
325
336
|
text: e.text,
|
|
326
337
|
to: e.to
|
|
327
|
-
}, e.
|
|
328
|
-
}), /* @__PURE__ */
|
|
338
|
+
}, e.id))
|
|
339
|
+
}), /* @__PURE__ */ c("article", {
|
|
329
340
|
"aria-label": "Right Navbar Elements Container",
|
|
330
|
-
className:
|
|
331
|
-
children:
|
|
341
|
+
className: z.rightElementsContainer,
|
|
342
|
+
children: f.map((e) => /* @__PURE__ */ c(L, {
|
|
343
|
+
id: e.id,
|
|
332
344
|
variant: e.variant,
|
|
333
345
|
text: e.text,
|
|
334
346
|
to: e.to
|
|
335
|
-
}, e.
|
|
347
|
+
}, e.id))
|
|
336
348
|
})] })]
|
|
337
349
|
})
|
|
338
350
|
});
|
|
339
351
|
};
|
|
340
352
|
//#endregion
|
|
341
|
-
export { m as Button,
|
|
353
|
+
export { m as Button, R as Card, G as DropdownMenu, x as Image, L as Link, K as Navbar, I as Rating, v as Text, g as variantMap };
|
package/dist/matrix-ui.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.primary{color:#111827;cursor:pointer;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.primary:hover:not(:disabled){background:#5fafd6}.primary:active:not(:disabled){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.secondary:hover:not(:disabled){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.ghost:hover:not(:disabled){background:#ffffff0d}.ghost:active:not(:disabled){background:#ffffff14}.error{color:#111827;cursor:pointer;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.error:hover:not(:disabled){filter:brightness(.95)}.error:active:not(:disabled){filter:brightness(.9)}.success{color:#111827;cursor:pointer;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.success:hover:not(:disabled){filter:brightness(.95)}.success:active:not(:disabled){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled){color:#f8fafc}.transparent:disabled{color:#64748b;cursor:not-allowed}._cardContainer_16ci6_1{border-radius:8px;flex-direction:column;justify-content:center;align-items:center;width:100%;max-width:min(400px,90%);height:auto;margin:0 auto;display:flex}._topContentContainer_16ci6_13{flex-direction:column;margin-top:1rem;margin-bottom:1rem;display:flex}._cardTitle_16ci6_20{margin:0 1rem .2rem}._miniCard_16ci6_27 ._cardTitle_16ci6_20{flex:1;margin:0}._ctaContainer_16ci6_32{box-sizing:border-box;flex-direction:column;justify-content:space-between;gap:1rem;width:100%;padding:.75rem;display:flex}._miniCard_16ci6_27 ._ctaContainer_16ci6_32{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem}._imgContainer_16ci6_49{box-sizing:border-box;border-radius:8px;justify-content:center;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem;display:flex}._img_16ci6_49{max-width:100%}._miniCard_16ci6_27 ._topContentContainer_16ci6_13{flex-direction:row;justify-content:flex-start;align-items:center;gap:1rem;margin-top:1rem;margin-bottom:1rem}._cardRating_16ci6_72{justify-content:center;margin-top:.1rem;display:flex}._headingSm_1wdfi_1{color:#f8fafc;font-size:1.25rem;font-weight:600}._headingMd_1wdfi_7{color:#f8fafc;font-size:1.5rem;font-weight:600}._headingLg_1wdfi_13{color:#f8fafc;font-size:1.875rem;font-weight:700}._headingXl_1wdfi_19{color:#f8fafc;font-size:2rem;font-weight:700}._bodySm_1wdfi_25{color:#cbd5e1;font-size:.875rem;font-weight:400}._bodyMd_1wdfi_31{color:#cbd5e1;font-size:1rem;font-weight:400}._bodyLg_1wdfi_37{color:#cbd5e1;font-size:1.125rem;font-weight:400}._caption_1wdfi_43{color:#cbd5e1;font-size:.75rem;font-weight:500}.
|
|
2
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`matrix-ui`]={},e.React,e.react_jsx_runtime))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);function u(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}var f={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},p={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},m=
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.primary{color:#111827;cursor:pointer;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.primary:hover:not(:disabled){background:#5fafd6}.primary:active:not(:disabled){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.secondary:hover:not(:disabled){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.ghost:hover:not(:disabled){background:#ffffff0d}.ghost:active:not(:disabled){background:#ffffff14}.error{color:#111827;cursor:pointer;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.error:hover:not(:disabled){filter:brightness(.95)}.error:active:not(:disabled){filter:brightness(.9)}.success{color:#111827;cursor:pointer;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem}.success:hover:not(:disabled){filter:brightness(.95)}.success:active:not(:disabled){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled){color:#f8fafc}.transparent:disabled{color:#64748b;cursor:not-allowed}._cardContainer_16ci6_1{border-radius:8px;flex-direction:column;justify-content:center;align-items:center;width:100%;max-width:min(400px,90%);height:auto;margin:0 auto;display:flex}._topContentContainer_16ci6_13{flex-direction:column;margin-top:1rem;margin-bottom:1rem;display:flex}._cardTitle_16ci6_20{margin:0 1rem .2rem}._miniCard_16ci6_27 ._cardTitle_16ci6_20{flex:1;margin:0}._ctaContainer_16ci6_32{box-sizing:border-box;flex-direction:column;justify-content:space-between;gap:1rem;width:100%;padding:.75rem;display:flex}._miniCard_16ci6_27 ._ctaContainer_16ci6_32{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem}._imgContainer_16ci6_49{box-sizing:border-box;border-radius:8px;justify-content:center;padding-bottom:1rem;padding-left:1.5rem;padding-right:1.5rem;display:flex}._img_16ci6_49{max-width:100%}._miniCard_16ci6_27 ._topContentContainer_16ci6_13{flex-direction:row;justify-content:flex-start;align-items:center;gap:1rem;margin-top:1rem;margin-bottom:1rem}._cardRating_16ci6_72{justify-content:center;margin-top:.1rem;display:flex}._headingSm_1wdfi_1{color:#f8fafc;font-size:1.25rem;font-weight:600}._headingMd_1wdfi_7{color:#f8fafc;font-size:1.5rem;font-weight:600}._headingLg_1wdfi_13{color:#f8fafc;font-size:1.875rem;font-weight:700}._headingXl_1wdfi_19{color:#f8fafc;font-size:2rem;font-weight:700}._bodySm_1wdfi_25{color:#cbd5e1;font-size:.875rem;font-weight:400}._bodyMd_1wdfi_31{color:#cbd5e1;font-size:1rem;font-weight:400}._bodyLg_1wdfi_37{color:#cbd5e1;font-size:1.125rem;font-weight:400}._caption_1wdfi_43{color:#cbd5e1;font-size:.75rem;font-weight:500}._img_14ux7_1{max-width:100%;display:block}._circle_14ux7_6{border-radius:50%}._ratingContainer_1xmf5_1{flex-direction:row;display:flex}._text_1xmf5_6{margin:0;padding-right:.2rem}._star_1xmf5_11{color:gold;fill:gold;width:1rem;height:1rem;margin-top:.17rem}.primary{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#87ceeb;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.primary:hover:not(:disabled),.primary:hover:not([aria-disabled=true]){background:#5fafd6}.primary:active:not(:disabled),.primary:active:not([aria-disabled=true]){background:#4a9bc4}.secondary{color:#f8fafc;cursor:pointer;text-align:center;vertical-align:middle;background:#1a2230;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.secondary:hover:not(:disabled),.secondary:hover:not([aria-disabled=true]){background:#232e3d;border-color:#334155}.secondary:active:not(:disabled),.secondary:active:not([aria-disabled=true]){background:#0f172a}.ghost{color:#cbd5e1;cursor:pointer;text-align:center;vertical-align:middle;background:0 0;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.ghost:hover:not(:disabled),.ghost:hover:not([aria-disabled=true]){background:#ffffff0d}.ghost:active:not(:disabled),.ghost:active:not([aria-disabled=true]){background:#ffffff14}.error{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#e58a8a;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.error:hover:not(:disabled),.error:hover:not([aria-disabled=true]){filter:brightness(.95)}.error:active:not(:disabled),.error:active:not([aria-disabled=true]){filter:brightness(.9)}.success{color:#111827;cursor:pointer;text-align:center;vertical-align:middle;background:#9fc9ae;border:1px solid #1f2937;border-radius:.5rem;padding:.5rem 1rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none}.success:hover:not(:disabled),.success:hover:not([aria-disabled=true]){filter:brightness(.95)}.success:active:not(:disabled),.success:active:not([aria-disabled=true]){filter:brightness(.9)}.transparent{color:#cbd5e1;cursor:pointer;text-align:center;vertical-align:middle;background:0 0;border:1px solid #0000;border-radius:.5rem;padding:.5rem .75rem;font-size:13.3px;font-weight:400;line-height:1;text-decoration:none;transition:background .15s,color .15s,border-color .15s}.transparent:hover:not(:disabled),.transparent:hover:not([aria-disabled=true]){color:#f8fafc}.transparent.active{color:#f8fafc;background:#ffffff14}.transparent:focus-visible{outline:none;box-shadow:0 0 0 3px #87ceeb59}.transparent:disabled,.transparent[aria-disabled=true]{color:#64748b;cursor:not-allowed}.link{justify-content:center;align-items:center;display:flex}._navElementsContainer_ndrvq_1{z-index:1000;background-color:#0b0f17;border-bottom:2px solid #1f2937;width:100%;height:3.5rem;position:sticky;top:0}._internalElementsContainer_ndrvq_11{flex-direction:row;align-items:center;width:100%;height:3.5rem;display:flex}._hamburgerIcon_ndrvq_19{margin-left:auto;padding-right:2rem}._leftElementsContainer_ndrvq_24{flex-direction:row;align-items:center;gap:2rem;width:50%;padding-left:1.5rem;line-height:.625rem;display:flex}._leftElement_ndrvq_24{padding-left:2rem}._rightElementsContainer_ndrvq_38{flex-direction:row;justify-content:end;gap:2rem;width:50%;padding-right:2rem;line-height:.625rem;display:flex}._wrapper_1cng4_1{min-width:10rem;display:inline-block;position:relative}._dropdownButton_1cng4_7{padding:0}._dropdownButtonContainer_1cng4_11{justify-content:right;align-items:end;display:flex}._listItemContainer_1cng4_17{z-index:1000;border-radius:5px;flex-direction:column;justify-content:left;align-items:start;min-width:10rem;margin-top:.5rem;padding:0;display:flex;position:absolute;top:100%;left:0}._listItem_1cng4_17{padding-top:.5rem;padding-bottom:.5rem;list-style:none}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`matrix-ui`]={},e.React,e.react_jsx_runtime))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);function u(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}var f={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},p={primary:`primary`,secondary:`secondary`,ghost:`ghost`,transparent:`transparent`,success:`success`,error:`error`},m=({id:e,variant:t=`primary`,text:r,onClick:i,className:a,ariaLabel:o=`Button`,ariaPressed:s=!1})=>(0,n.jsx)(`button`,{id:e,"aria-label":o,"aria-pressed":s,onClick:i,className:d(t&&p[t],a),role:`button`,children:r}),h={cardContainer:`_cardContainer_16ci6_1`,topContentContainer:`_topContentContainer_16ci6_13`,cardTitle:`_cardTitle_16ci6_20`,miniCard:`_miniCard_16ci6_27`,ctaContainer:`_ctaContainer_16ci6_32`,imgContainer:`_imgContainer_16ci6_49`,img:`_img_16ci6_49`,cardRating:`_cardRating_16ci6_72`},g={headingXl:`h1`,headingLg:`h2`,headingMd:`h3`,headingSm:`h4`,bodyLg:`p`,bodyMd:`p`,bodySm:`p`,caption:`span`},_={headingSm:`_headingSm_1wdfi_1`,headingMd:`_headingMd_1wdfi_7`,headingLg:`_headingLg_1wdfi_13`,headingXl:`_headingXl_1wdfi_19`,bodySm:`_bodySm_1wdfi_25`,bodyMd:`_bodyMd_1wdfi_31`,bodyLg:`_bodyLg_1wdfi_37`,caption:`_caption_1wdfi_43`},v=({copy:e,variant:t,className:r})=>{let i=g[t];return(0,n.jsx)(i,{className:d(r,_[t]),children:e})},y={img:`_img_14ux7_1`,circle:`_circle_14ux7_6`},b=e=>`${e?.toLowerCase().replace(/\s+/g,`-`)}-id`,x=({width:e,height:t,src:r,alt:i,className:a,isCircle:o=!1,ariaLabel:s,style:c})=>{let l=d(y.img,o&&y.circle,a);return(0,n.jsx)(`img`,{id:b(s),"aria-label":s??`Image`,"data-circle":o,className:l,src:r,alt:i,width:e,height:t,style:c})},S=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),C=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),w=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),T=e=>{let t=w(e);return t.charAt(0).toUpperCase()+t.slice(1)},E={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},D=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},O=(0,t.createContext)({}),k=()=>(0,t.useContext)(O),A=(0,t.forwardRef)(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:s,...c},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=k()??{},h=i??f?Number(r??d)*24/Number(n??u):r??d;return(0,t.createElement)(`svg`,{ref:l,...E,width:n??u??E.width,height:n??u??E.height,stroke:e??p,strokeWidth:h,className:S(`lucide`,m,a),...!o&&!D(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(o)?o:[o]])}),j=(e,n)=>{let r=(0,t.forwardRef)(({className:r,...i},a)=>(0,t.createElement)(A,{ref:a,iconNode:n,className:S(`lucide-${C(T(e))}`,`lucide-${e}`,r),...i}));return r.displayName=T(e),r},M=j(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),N=j(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),P={ratingContainer:`_ratingContainer_1xmf5_1`,text:`_text_1xmf5_6`,star:`_star_1xmf5_11`},F=[{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})},{star:(0,n.jsx)(N,{className:P.star})}],I=({rating:e})=>F.filter((t,n)=>e&&n<e).map((e,n)=>t.default.cloneElement(e.star,{key:n})),L=({variant:e,text:t,to:r,className:i,ariaLabel:a,id:o})=>(0,n.jsx)(`a`,{id:o,className:d(`link`,e&&f[e],i),href:r,target:`_blank`,rel:`noopener noreferrer`,"aria-label":a??`Link`,role:`link`,children:t}),R=({id:e,borderColor:t=``,backgroundColor:r,miniCard:i=!1,title:a,hasRating:o,ratingValue:s,img:c,imgAriaLabel:l,isImgCircle:u=!0,imgHeight:d,imgWidth:f,primaryCta:p,secondaryCta:g})=>(0,n.jsxs)(`article`,{id:e,"aria-label":`${a} Card`,className:`${h.cardContainer} ${i?h.miniCard:``}`,style:{backgroundColor:r,border:t?`2px solid ${t}`:void 0},children:[(0,n.jsxs)(`div`,{"aria-label":`Card Top Content Container`,className:h.topContentContainer,children:[(0,n.jsx)(v,{className:h.cardTitle,variant:`headingMd`,copy:a}),o&&s!=null&&(0,n.jsx)(`div`,{"aria-label":`Card Rating Container`,className:h.cardRating,children:(0,n.jsx)(I,{rating:s})})]}),!i&&(0,n.jsx)(`div`,{"aria-label":l?`${l} Container`:`Image Container`,className:h.imgContainer,children:(0,n.jsx)(x,{width:f,height:d,ariaLabel:l??`Card Image`,isCircle:u,src:c??``,alt:`${a} Card Image`,style:{border:t?`2px solid ${t}`:void 0}})}),(0,n.jsxs)(`div`,{"aria-label":`Card CTA Container`,className:h.ctaContainer,children:[p&&(p?.isLink?(0,n.jsx)(L,{id:p.id,ariaLabel:p.ariaLinkLabel??`Primary Card Link`,to:p.to,text:p.text,variant:p.variant}):(0,n.jsx)(m,{id:p.id,ariaLabel:p?.ariaButtonLabel??`Primary Card Button`,ariaPressed:p?.ariaPressed,variant:p?.variant,text:p?.text,onClick:p?.onClick})),g&&(g.isLink?(0,n.jsx)(L,{id:g.id,ariaLabel:g.ariaLinkLabel??`Secondary Card Link`,to:g.to,text:g.text,variant:g.variant}):(0,n.jsx)(m,{id:g.id,ariaLabel:g.ariaButtonLabel??`Secondary Card Button`,ariaPressed:g.ariaPressed,variant:g.variant,text:g.text,onClick:g.onClick}))]})]}),z={navElementsContainer:`_navElementsContainer_ndrvq_1`,internalElementsContainer:`_internalElementsContainer_ndrvq_11`,hamburgerIcon:`_hamburgerIcon_ndrvq_19`,leftElementsContainer:`_leftElementsContainer_ndrvq_24`,leftElement:`_leftElement_ndrvq_24`,rightElementsContainer:`_rightElementsContainer_ndrvq_38`},B={mobile:`(max-width: 767px)`,tablet:`(min-width: 768px) and (max-width: 1023px)`,desktop:`(min-width: 1024px)`,belowMobile:`(max-width: 299px)`},V=e=>typeof window>`u`?!1:window.matchMedia(e).matches,H=()=>{let[e,n]=(0,t.useState)({isBelowMobileMinimum:V(B.belowMobile),isMobile:V(B.mobile),isTablet:V(B.tablet),isDesktop:V(B.desktop)});return(0,t.useEffect)(()=>{let e=Object.entries(B).map(([e,t])=>{let r=window.matchMedia(t),i=()=>{n(t=>({...t,[e===`belowMobile`?`isBelowMobileMinimum`:`is${U(e)}`]:r.matches}))};return r.addEventListener(`change`,i),i(),()=>r.removeEventListener(`change`,i)});return()=>{e.forEach(e=>e?.())}},[]),e},U=e=>e.charAt(0).toUpperCase()+e.slice(1),W={wrapper:`_wrapper_1cng4_1`,dropdownButton:`_dropdownButton_1cng4_7`,dropdownButtonContainer:`_dropdownButtonContainer_1cng4_11`,listItemContainer:`_listItemContainer_1cng4_17`,listItem:`_listItem_1cng4_17`},G=({className:e,icon:r,options:i,listBorderColor:a,listBackgroundColor:o,isNavbarDropdown:s=!1})=>{let[c,l]=(0,t.useState)(!1);return(0,n.jsxs)(`section`,{className:d(e,W.wrapper),children:[(0,n.jsx)(`div`,{className:W.dropdownButtonContainer,children:(0,n.jsx)(m,{className:W.dropdownButton,text:r,variant:`transparent`,onClick:()=>l(!c),ariaLabel:`Dropdown Menu Button`})}),c&&(0,n.jsx)(`ul`,{"aria-label":`Unordered Dropdown List`,className:W.listItemContainer,style:{marginTop:s?`1.5rem`:`none`,border:`2px solid ${a}`,backgroundColor:o},children:i.map(e=>(0,n.jsx)(`li`,{"aria-label":`Dropdown List Item`,className:W.listItem,children:(0,n.jsx)(L,{id:e.id,variant:e.variant,to:e.to,text:e.text})},e.id))})]})};e.Button=m,e.Card=R,e.DropdownMenu=G,e.Image=x,e.Link=L,e.Navbar=({id:e,ariaLabel:t,backgroundColor:r,borderBottomColor:i,dropdownListBackgroundColor:a,dropdownListBorderColor:o,dropdownListIcon:s=(0,n.jsx)(M,{}),leftElement:c,leftElementNeighbors:l,rightElements:u})=>{let d=[...l,...u],{isMobile:f,isBelowMobileMinimum:p}=H();return(0,n.jsx)(`nav`,{id:e,"aria-label":t??`Main Navbar`,style:{backgroundColor:r,borderBottom:`2px solid ${i}`},className:z.navElementsContainer,children:(0,n.jsxs)(`article`,{"aria-label":`Elements Container`,className:z.internalElementsContainer,children:[!p&&(0,n.jsx)(`div`,{className:z.leftElement,children:c}),f?(0,n.jsx)(G,{listBackgroundColor:a,listBorderColor:o,className:z.hamburgerIcon,icon:s,options:d.map(({text:e,to:t,variant:n,id:r})=>({id:r,text:e,to:t,variant:n})),isNavbarDropdown:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`article`,{"aria-label":`Left Navbar Elements Container`,className:z.leftElementsContainer,children:l?.map(e=>(0,n.jsx)(L,{id:e.id,variant:e.variant,text:e.text,to:e.to},e.id))}),(0,n.jsx)(`article`,{"aria-label":`Right Navbar Elements Container`,className:z.rightElementsContainer,children:u.map(e=>(0,n.jsx)(L,{id:e.id,variant:e.variant,text:e.text,to:e.to},e.id))})]})]})})},e.Rating=I,e.Text=v,e.variantMap=g});
|
package/dist/types/cardType.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { ButtonVariant } from './buttonType';
|
|
2
2
|
import { LinkVariant } from './linkType';
|
|
3
3
|
export interface CardProps {
|
|
4
|
+
id?: string;
|
|
4
5
|
borderColor?: string;
|
|
5
6
|
backgroundColor?: string;
|
|
6
7
|
miniCard?: boolean;
|
|
7
8
|
title: string;
|
|
8
9
|
hasRating?: boolean;
|
|
9
10
|
ratingValue?: number;
|
|
10
|
-
img
|
|
11
|
+
img?: string;
|
|
11
12
|
imgAriaLabel?: string;
|
|
12
13
|
isImgCircle?: boolean;
|
|
14
|
+
imgWidth?: number;
|
|
15
|
+
imgHeight?: number;
|
|
13
16
|
primaryCta?: {
|
|
17
|
+
id?: string;
|
|
14
18
|
ariaButtonLabel?: string;
|
|
15
19
|
ariaLinkLabel?: string;
|
|
16
20
|
ariaPressed?: boolean;
|
|
@@ -21,6 +25,7 @@ export interface CardProps {
|
|
|
21
25
|
isLink?: boolean;
|
|
22
26
|
};
|
|
23
27
|
secondaryCta?: {
|
|
28
|
+
id?: string;
|
|
24
29
|
ariaButtonLabel?: string;
|
|
25
30
|
ariaLinkLabel?: string;
|
|
26
31
|
ariaPressed?: boolean;
|
package/dist/types/linkType.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LinkVariant } from './linkType';
|
|
2
2
|
export interface NavbarProps {
|
|
3
|
+
id: string;
|
|
3
4
|
ariaLabel?: string;
|
|
4
5
|
backgroundColor?: string;
|
|
5
6
|
borderBottomColor?: string;
|
|
@@ -8,11 +9,13 @@ export interface NavbarProps {
|
|
|
8
9
|
dropdownListBorderColor?: string;
|
|
9
10
|
leftElement: React.ReactElement;
|
|
10
11
|
leftElementNeighbors: {
|
|
12
|
+
id: string;
|
|
11
13
|
text: string;
|
|
12
14
|
to: string;
|
|
13
15
|
variant: LinkVariant;
|
|
14
16
|
}[];
|
|
15
17
|
rightElements: {
|
|
18
|
+
id: string;
|
|
16
19
|
text: string;
|
|
17
20
|
to: string;
|
|
18
21
|
variant: LinkVariant;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucasromero/matrix-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/matrix-ui.es.js",
|
|
7
7
|
"module": "./dist/matrix-ui.es.js",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/matrix-ui.es.js",
|
|
27
28
|
"import": "./dist/matrix-ui.es.js",
|
|
28
29
|
"require": "./dist/matrix-ui.umd.js"
|
|
29
|
-
}
|
|
30
|
-
"./style.css": "./dist/matrix-ui.css"
|
|
30
|
+
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@radix-ui/react-slot": "^1.2.4",
|