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