@mt-gloss/ui 0.0.14 → 0.0.15

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.
@@ -0,0 +1,179 @@
1
+ import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
+ import { f as p, b as B, al as g, h as f } from "./UIContext-C3E-k7HI.js";
3
+ import b, { useEffect as h } from "react";
4
+ const N = function(l) {
5
+ const { as: e, htmlFor: s, className: t, ...n } = l;
6
+ return /* @__PURE__ */ o(
7
+ p,
8
+ {
9
+ as: e || "label",
10
+ htmlFor: s,
11
+ className: t ? `gloss-base-label ${t}` : "gloss-base-label",
12
+ ...n
13
+ }
14
+ );
15
+ };
16
+ N.displayName = "BaseLabel";
17
+ const _ = function(l) {
18
+ const { as: e, className: s, ...t } = l;
19
+ return /* @__PURE__ */ o(
20
+ p,
21
+ {
22
+ as: e || "span",
23
+ "data-role": "value",
24
+ className: s ? `gloss-base-value ${s}` : "gloss-base-value",
25
+ ...t
26
+ }
27
+ );
28
+ };
29
+ _.displayName = "BaseValue";
30
+ function v({
31
+ definition: a,
32
+ open: l,
33
+ onDismiss: e,
34
+ className: s,
35
+ style: t,
36
+ children: n
37
+ }) {
38
+ const c = a?.position ?? "top-right", r = a?.duration ?? 0;
39
+ h(() => {
40
+ if (!l || r <= 0 || !e) return;
41
+ const y = setTimeout(() => {
42
+ e();
43
+ }, r);
44
+ return () => clearTimeout(y);
45
+ }, [l, r, e]);
46
+ const i = {
47
+ portal: !0,
48
+ dismissOnClickOutside: !1,
49
+ dismissOnEscape: !0,
50
+ bg: a?.bg,
51
+ shadow: a?.shadow,
52
+ radius: a?.radius,
53
+ padding: a?.padding,
54
+ zIndex: a?.zIndex
55
+ }, u = ["gloss-base-toast", `gloss-base-toast--${c}`];
56
+ return s && u.push(s), /* @__PURE__ */ o(
57
+ B,
58
+ {
59
+ definition: i,
60
+ open: l,
61
+ onDismiss: e,
62
+ children: /* @__PURE__ */ o(
63
+ "div",
64
+ {
65
+ className: u.join(" "),
66
+ style: t,
67
+ role: "status",
68
+ "aria-live": "polite",
69
+ children: n
70
+ }
71
+ )
72
+ }
73
+ );
74
+ }
75
+ v.displayName = "BaseToast";
76
+ const A = {
77
+ bg: "--_bg",
78
+ borderColor: "--_border-color",
79
+ color: "--_color",
80
+ padding: "--_padding",
81
+ radius: "--_radius",
82
+ iconColor: "--_icon-color"
83
+ };
84
+ function C(a) {
85
+ const { definition: l, className: e, style: s, role: t, children: n, ...c } = a, { style: r, dataAttrs: i } = g(l, A);
86
+ return /* @__PURE__ */ o(
87
+ "div",
88
+ {
89
+ role: t || "alert",
90
+ className: e ? `gloss-base-alert ${e}` : "gloss-base-alert",
91
+ style: { ...r, ...s },
92
+ ...i,
93
+ ...c,
94
+ children: n
95
+ }
96
+ );
97
+ }
98
+ C.displayName = "BaseAlert";
99
+ const S = {
100
+ gap: "--_gap",
101
+ color: "--_color",
102
+ fontSize: "--_font-size"
103
+ };
104
+ function $(a) {
105
+ const { definition: l, separator: e = "/", className: s, style: t, children: n } = a, { style: c } = g(
106
+ l,
107
+ S
108
+ ), r = b.Children.toArray(n);
109
+ return /* @__PURE__ */ o(
110
+ "nav",
111
+ {
112
+ "aria-label": "Breadcrumb",
113
+ className: s ? `gloss-base-breadcrumbs-nav ${s}` : "gloss-base-breadcrumbs-nav",
114
+ style: { ...c, ...t },
115
+ children: /* @__PURE__ */ o("ol", { className: "gloss-base-breadcrumbs", children: r.map((i, d) => {
116
+ const u = d === r.length - 1;
117
+ return /* @__PURE__ */ m(b.Fragment, { children: [
118
+ /* @__PURE__ */ o(
119
+ "li",
120
+ {
121
+ className: "gloss-base-breadcrumbs__item",
122
+ ...u ? { "aria-current": "page" } : {},
123
+ children: i
124
+ }
125
+ ),
126
+ !u && /* @__PURE__ */ o("li", { className: "gloss-base-breadcrumbs__separator", "aria-hidden": "true", children: e })
127
+ ] }, d);
128
+ }) })
129
+ }
130
+ );
131
+ }
132
+ $.displayName = "BaseBreadcrumbs";
133
+ function T(a) {
134
+ const {
135
+ as: l,
136
+ definition: e,
137
+ loading: s = !1,
138
+ disabled: t = !1,
139
+ className: n,
140
+ style: c,
141
+ children: r,
142
+ ...i
143
+ } = a, d = [
144
+ "gloss-base-async-button",
145
+ n
146
+ ].filter(Boolean).join(" ");
147
+ return /* @__PURE__ */ m(
148
+ f,
149
+ {
150
+ as: l,
151
+ definition: e,
152
+ disabled: t || s,
153
+ loading: s,
154
+ className: d,
155
+ style: c,
156
+ ...i,
157
+ children: [
158
+ /* @__PURE__ */ o(
159
+ "span",
160
+ {
161
+ className: "gloss-base-async-button__content",
162
+ ...s ? { "data-hidden": "" } : {},
163
+ children: r
164
+ }
165
+ ),
166
+ s && /* @__PURE__ */ o("span", { className: "gloss-base-async-button__spinner" })
167
+ ]
168
+ }
169
+ );
170
+ }
171
+ T.displayName = "BaseAsyncButton";
172
+ export {
173
+ N as B,
174
+ _ as a,
175
+ v as b,
176
+ C as c,
177
+ $ as d,
178
+ T as e
179
+ };