@floegence/floe-webapp-core 0.80.1 → 0.81.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/components/ui/Button.js +4 -4
- package/dist/components/ui/FeedbackIndicator.d.ts +20 -0
- package/dist/components/ui/FeedbackIndicator.js +206 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/full.js +439 -437
- package/dist/primitives.css +3 -0
- package/dist/styles.css +1 -1
- package/dist/ui.js +98 -96
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spread as u, mergeProps as g, insert as n, createComponent as t, memo as m, Dynamic as
|
|
1
|
+
import { spread as u, mergeProps as g, insert as n, createComponent as t, memo as m, Dynamic as h, effect as b, className as f, template as d } from "solid-js/web";
|
|
2
2
|
import { splitProps as p, Show as i } from "solid-js";
|
|
3
3
|
import { cn as s } from "../../utils/cn.js";
|
|
4
4
|
import { Loader2 as v } from "../icons/index.js";
|
|
@@ -33,7 +33,7 @@ function P(a) {
|
|
|
33
33
|
return e.variant === "ghost" || e.variant === "ghost-destructive" ? void 0 : "raised";
|
|
34
34
|
},
|
|
35
35
|
get class() {
|
|
36
|
-
return s("inline-flex items-center justify-center gap-1.5 font-medium cursor-pointer", "transition-[color,background-color,border-color] duration-120", "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed", w[e.variant ?? "default"], z[e.size ?? "md"], e.class);
|
|
36
|
+
return s("inline-flex min-w-max items-center justify-center gap-1.5 whitespace-nowrap font-medium cursor-pointer", "transition-[color,background-color,border-color] duration-120", "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed", w[e.variant ?? "default"], z[e.size ?? "md"], e.class);
|
|
37
37
|
},
|
|
38
38
|
get disabled() {
|
|
39
39
|
return e.disabled || e.loading;
|
|
@@ -52,7 +52,7 @@ function P(a) {
|
|
|
52
52
|
return e.loading;
|
|
53
53
|
},
|
|
54
54
|
get fallback() {
|
|
55
|
-
return m(() => !!e.icon)() && t(
|
|
55
|
+
return m(() => !!e.icon)() && t(h, {
|
|
56
56
|
get component() {
|
|
57
57
|
return e.icon;
|
|
58
58
|
},
|
|
@@ -64,7 +64,7 @@ function P(a) {
|
|
|
64
64
|
class: "h-full w-full animate-spin"
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
})),
|
|
67
|
+
})), b(() => f(o, s("inline-flex shrink-0 items-center justify-center", l()))), o;
|
|
68
68
|
}
|
|
69
69
|
}), null), n(r, () => e.children, null), r;
|
|
70
70
|
})();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
export interface FeedbackIndicatorEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
severity: 'info' | 'warning' | 'error';
|
|
5
|
+
summary: string;
|
|
6
|
+
detail?: JSX.Element;
|
|
7
|
+
actions?: JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export interface FeedbackIndicatorProps {
|
|
10
|
+
/** Current feedback, owned by the caller. Closing details never clears these entries. */
|
|
11
|
+
entries: readonly FeedbackIndicatorEntry[];
|
|
12
|
+
label: string;
|
|
13
|
+
closeLabel: string;
|
|
14
|
+
/** Stable destination when feedback resolves while its trigger or details owns focus. */
|
|
15
|
+
restoreFocus: () => HTMLElement | undefined;
|
|
16
|
+
size?: 'sm' | 'md';
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Compact feedback in an existing action row; no empty vertical status lane. */
|
|
20
|
+
export declare function FeedbackIndicator(props: FeedbackIndicatorProps): JSX.Element;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { insert as a, createComponent as c, effect as z, setAttribute as g, spread as X, mergeProps as D, memo as G, className as J, setStyleProperty as _, template as w, use as Q, delegateEvents as Y } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as Z, createSignal as E, createMemo as ee, createEffect as I, untrack as te, Show as k, For as re, onCleanup as ne } from "solid-js";
|
|
3
|
+
import { AlertTriangle as oe, Info as ie, X as se } from "../icons/index.js";
|
|
4
|
+
import { useOverlayMask as ae } from "../../hooks/useOverlayMask.js";
|
|
5
|
+
import { cn as le } from "../../utils/cn.js";
|
|
6
|
+
import { SurfaceFloatingLayer as ce } from "./SurfaceFloatingLayer.js";
|
|
7
|
+
import { calculateMenuPosition as de } from "./menuUtils.js";
|
|
8
|
+
import { WORKBENCH_TEXT_SELECTION_SURFACE_ATTR as ue, CANVAS_WHEEL_INTERACTIVE_ATTR as fe } from "./localInteractionSurface.js";
|
|
9
|
+
import { resolveSurfacePortalHost as me, resolveSurfacePortalBoundaryRect as ve, resolveSurfacePortalScale as be } from "./dialogSurfaceScope.js";
|
|
10
|
+
var he = /* @__PURE__ */ w('<div class="flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2"><span class="min-w-0 truncate text-xs font-medium"></span><button type=button class="flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md hover:bg-accent">'), ge = /* @__PURE__ */ w("<div data-floe-status-details>"), we = /* @__PURE__ */ w('<span data-floe-status-indicator><button type=button class="inline-flex h-full w-full cursor-pointer items-center justify-center rounded-md hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"aria-haspopup=dialog></button><span class=sr-only role=alert aria-atomic=true></span><span class=sr-only role=status aria-atomic=true>'), ye = /* @__PURE__ */ w("<div>"), xe = /* @__PURE__ */ w('<div class="flex flex-wrap items-center gap-2">'), Ee = /* @__PURE__ */ w('<section class="space-y-2 border-b border-border pb-3 mb-3 last:border-0 last:pb-0 last:mb-0"><p class=font-medium>');
|
|
11
|
+
function Ae(n) {
|
|
12
|
+
const T = Z(), [f, F] = E(!1), [p, N] = E(), [H, q] = E({
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0
|
|
15
|
+
}), [A, K] = E({
|
|
16
|
+
width: 360,
|
|
17
|
+
height: 384
|
|
18
|
+
}), [U, P] = E(!1);
|
|
19
|
+
let m, v = !1;
|
|
20
|
+
const d = () => n.entries.length > 0, L = ee(() => n.entries.some((t) => t.severity === "error") ? "error" : n.entries.some((t) => t.severity === "warning") ? "warning" : "info"), R = (t) => n.entries.filter((r) => r.severity === "error" === t).map((r) => r.summary).join(". "), V = () => (d() ? m : n.restoreFocus())?.focus({
|
|
21
|
+
preventScroll: !0
|
|
22
|
+
}), S = (t) => {
|
|
23
|
+
F(!1), v = !1, t && V();
|
|
24
|
+
}, y = (t) => t instanceof Node && !!(m?.contains(t) || p()?.contains(t));
|
|
25
|
+
return ae({
|
|
26
|
+
open: f,
|
|
27
|
+
root: p,
|
|
28
|
+
containsTarget: y,
|
|
29
|
+
onClose: () => S(!0),
|
|
30
|
+
lockBodyScroll: !1,
|
|
31
|
+
trapFocus: !1,
|
|
32
|
+
autoFocus: !1,
|
|
33
|
+
restoreFocus: !1,
|
|
34
|
+
closeOnEscape: "inside",
|
|
35
|
+
escapeKeyPhase: "bubble",
|
|
36
|
+
blockHotkeys: !1
|
|
37
|
+
}), I(() => {
|
|
38
|
+
if (d()) {
|
|
39
|
+
f() && queueMicrotask(() => te(() => {
|
|
40
|
+
f() && v && document.activeElement === document.body && p()?.focus({
|
|
41
|
+
preventScroll: !0
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const t = v || typeof document < "u" && y(document.activeElement);
|
|
47
|
+
F(!1), v = !1, t && n.restoreFocus()?.focus({
|
|
48
|
+
preventScroll: !0
|
|
49
|
+
});
|
|
50
|
+
}), I(() => {
|
|
51
|
+
const t = p();
|
|
52
|
+
if (!f() || !t || !m) return;
|
|
53
|
+
const r = m;
|
|
54
|
+
let b = 0, $ = !0;
|
|
55
|
+
const C = () => {
|
|
56
|
+
if (b = 0, !r.isConnected) {
|
|
57
|
+
S(!1);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const s = me({
|
|
61
|
+
owner: r
|
|
62
|
+
}), u = ve(s), x = be(s);
|
|
63
|
+
K({
|
|
64
|
+
width: Math.max(0, Math.min(360, u.right - u.left - 16)) / x.x,
|
|
65
|
+
height: Math.max(0, Math.min(384, u.bottom - u.top - 16)) / x.y
|
|
66
|
+
}), q(de(r.getBoundingClientRect(), t.getBoundingClientRect(), "end", u)), P(!0), $ && ($ = !1, t.focus({
|
|
67
|
+
preventScroll: !0
|
|
68
|
+
}));
|
|
69
|
+
}, e = () => {
|
|
70
|
+
cancelAnimationFrame(b), b = requestAnimationFrame(C);
|
|
71
|
+
}, o = new ResizeObserver(e);
|
|
72
|
+
o.observe(r), o.observe(t);
|
|
73
|
+
const i = new MutationObserver(e);
|
|
74
|
+
for (let s = r.parentElement; s; s = s.parentElement) i.observe(s, {
|
|
75
|
+
attributes: !0,
|
|
76
|
+
attributeFilter: ["style", "class"]
|
|
77
|
+
});
|
|
78
|
+
const h = (s) => {
|
|
79
|
+
v = y(s.target);
|
|
80
|
+
};
|
|
81
|
+
document.addEventListener("focusin", h);
|
|
82
|
+
const l = (s) => {
|
|
83
|
+
y(s.target) || S(!1);
|
|
84
|
+
};
|
|
85
|
+
window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), document.addEventListener("pointerdown", l, !0), e(), ne(() => {
|
|
86
|
+
cancelAnimationFrame(b), document.removeEventListener("focusin", h), o.disconnect(), i.disconnect(), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0), document.removeEventListener("pointerdown", l, !0);
|
|
87
|
+
});
|
|
88
|
+
}), (() => {
|
|
89
|
+
var t = we(), r = t.firstChild, b = r.nextSibling, $ = b.nextSibling;
|
|
90
|
+
r.$$click = () => {
|
|
91
|
+
d() && (P(!1), F((e) => !e));
|
|
92
|
+
}, r.addEventListener("blur", (e) => {
|
|
93
|
+
e.relatedTarget && (v = y(e.relatedTarget));
|
|
94
|
+
}), r.addEventListener("focus", () => {
|
|
95
|
+
v = !0;
|
|
96
|
+
});
|
|
97
|
+
var C = m;
|
|
98
|
+
return typeof C == "function" ? Q(C, r) : m = r, a(r, c(k, {
|
|
99
|
+
get when() {
|
|
100
|
+
return L() !== "info";
|
|
101
|
+
},
|
|
102
|
+
get fallback() {
|
|
103
|
+
return c(ie, {
|
|
104
|
+
class: "h-4 w-4",
|
|
105
|
+
"aria-hidden": "true"
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
return c(oe, {
|
|
110
|
+
class: "h-4 w-4",
|
|
111
|
+
"aria-hidden": "true"
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
})), a(b, () => R(!0)), a($, () => R(!1)), a(t, c(k, {
|
|
115
|
+
get when() {
|
|
116
|
+
return G(() => !!f())() && d();
|
|
117
|
+
},
|
|
118
|
+
get children() {
|
|
119
|
+
return c(ce, {
|
|
120
|
+
owner: m,
|
|
121
|
+
get position() {
|
|
122
|
+
return H();
|
|
123
|
+
},
|
|
124
|
+
layerRef: N,
|
|
125
|
+
id: T,
|
|
126
|
+
role: "dialog",
|
|
127
|
+
get "aria-label"() {
|
|
128
|
+
return n.label;
|
|
129
|
+
},
|
|
130
|
+
tabindex: -1,
|
|
131
|
+
"data-floe-surface": "floating",
|
|
132
|
+
class: "flex flex-col overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg",
|
|
133
|
+
get style() {
|
|
134
|
+
return {
|
|
135
|
+
width: `${A().width}px`,
|
|
136
|
+
"max-height": `${A().height}px`,
|
|
137
|
+
visibility: U() ? "visible" : "hidden"
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
get children() {
|
|
141
|
+
return [(() => {
|
|
142
|
+
var e = he(), o = e.firstChild, i = o.nextSibling;
|
|
143
|
+
return a(o, () => n.label), i.$$click = () => S(!0), a(i, c(se, {
|
|
144
|
+
class: "h-4 w-4"
|
|
145
|
+
})), z(() => g(i, "aria-label", n.closeLabel)), e;
|
|
146
|
+
})(), (() => {
|
|
147
|
+
var e = ge();
|
|
148
|
+
return X(e, D({
|
|
149
|
+
[fe]: "true",
|
|
150
|
+
[ue]: "true"
|
|
151
|
+
}, {
|
|
152
|
+
class: "min-h-0 overflow-auto overscroll-contain p-3 text-xs",
|
|
153
|
+
style: {
|
|
154
|
+
"overflow-wrap": "anywhere"
|
|
155
|
+
}
|
|
156
|
+
}), !1, !0), a(e, c(re, {
|
|
157
|
+
get each() {
|
|
158
|
+
return n.entries;
|
|
159
|
+
},
|
|
160
|
+
children: (o) => (() => {
|
|
161
|
+
var i = Ee(), h = i.firstChild;
|
|
162
|
+
return a(h, () => o.summary), a(i, c(k, {
|
|
163
|
+
get when() {
|
|
164
|
+
return o.detail;
|
|
165
|
+
},
|
|
166
|
+
get children() {
|
|
167
|
+
var l = ye();
|
|
168
|
+
return a(l, () => o.detail), l;
|
|
169
|
+
}
|
|
170
|
+
}), null), a(i, c(k, {
|
|
171
|
+
get when() {
|
|
172
|
+
return o.actions;
|
|
173
|
+
},
|
|
174
|
+
get children() {
|
|
175
|
+
var l = xe();
|
|
176
|
+
return a(l, () => o.actions), l;
|
|
177
|
+
}
|
|
178
|
+
}), null), i;
|
|
179
|
+
})()
|
|
180
|
+
})), e;
|
|
181
|
+
})()];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}), null), z((e) => {
|
|
186
|
+
var o = le("inline-flex shrink-0 items-center justify-center align-middle", n.class), i = n.size === "md" ? "2rem" : "1.75rem", h = n.size === "md" ? "2rem" : "1.75rem", l = d() ? "visible" : "hidden", s = L() === "error" ? "var(--error)" : L() === "warning" ? "var(--warning)" : "var(--muted-foreground)", u = d() ? 0 : -1, x = !d() || void 0, M = `${n.label}${d() ? `: ${n.entries.map((W) => W.summary).join("; ")}` : ""}`, B = n.label, O = f(), j = f() ? T : void 0;
|
|
187
|
+
return o !== e.e && J(t, e.e = o), i !== e.t && _(t, "width", e.t = i), h !== e.a && _(t, "height", e.a = h), l !== e.o && _(r, "visibility", e.o = l), s !== e.i && _(r, "color", e.i = s), u !== e.n && g(r, "tabindex", e.n = u), x !== e.s && g(r, "aria-hidden", e.s = x), M !== e.h && g(r, "aria-label", e.h = M), B !== e.r && g(r, "title", e.r = B), O !== e.d && g(r, "aria-expanded", e.d = O), j !== e.l && g(r, "aria-controls", e.l = j), e;
|
|
188
|
+
}, {
|
|
189
|
+
e: void 0,
|
|
190
|
+
t: void 0,
|
|
191
|
+
a: void 0,
|
|
192
|
+
o: void 0,
|
|
193
|
+
i: void 0,
|
|
194
|
+
n: void 0,
|
|
195
|
+
s: void 0,
|
|
196
|
+
h: void 0,
|
|
197
|
+
r: void 0,
|
|
198
|
+
d: void 0,
|
|
199
|
+
l: void 0
|
|
200
|
+
}), t;
|
|
201
|
+
})();
|
|
202
|
+
}
|
|
203
|
+
Y(["click"]);
|
|
204
|
+
export {
|
|
205
|
+
Ae as FeedbackIndicator
|
|
206
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { FeedbackIndicator, type FeedbackIndicatorProps, type FeedbackIndicatorEntry } from './FeedbackIndicator';
|
|
1
2
|
export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from './Button';
|
|
2
3
|
export { StableText, type StableTextProps } from './StableText';
|
|
3
4
|
export { StatusRegion, type StatusRegionProps } from './StatusRegion';
|