@floegence/floe-webapp-core 0.46.3 → 0.46.5
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/Dialog.d.ts +1 -1
- package/dist/components/ui/Dialog.js +93 -92
- package/dist/components/ui/DialogPlacementContext.d.ts +16 -0
- package/dist/components/ui/DialogPlacementContext.js +26 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/full.js +427 -425
- package/dist/ui.js +103 -101
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export interface DialogProps {
|
|
|
8
8
|
children: JSX.Element;
|
|
9
9
|
footer?: JSX.Element;
|
|
10
10
|
class?: string;
|
|
11
|
-
/** Optional stacking layer for global dialogs.
|
|
11
|
+
/** Optional stacking layer for global dialogs. Overrides the placement provider default. */
|
|
12
12
|
globalZIndex?: number;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -1,77 +1,78 @@
|
|
|
1
|
-
import { createComponent as r, use as E, setAttribute as f, style as
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { X as
|
|
6
|
-
import { useResolvedFloeConfig as
|
|
7
|
-
import { useOverlayMask as
|
|
8
|
-
import { resolveSurfacePortalHost as
|
|
9
|
-
import { LOCAL_INTERACTION_SURFACE_ATTR as
|
|
10
|
-
import { createFloatingPresence as
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { createComponent as r, use as E, setAttribute as f, style as Y, Portal as X, spread as k, mergeProps as P, memo as S, insert as a, effect as N, template as u } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as J, createSignal as I, createMemo as H, createEffect as Q, onCleanup as ee, Show as b, untrack as te } from "solid-js";
|
|
3
|
+
import { cn as A } from "../../utils/cn.js";
|
|
4
|
+
import { Button as B } from "./Button.js";
|
|
5
|
+
import { X as ne } from "../icons/index.js";
|
|
6
|
+
import { useResolvedFloeConfig as re } from "../../context/FloeConfigContext.js";
|
|
7
|
+
import { useOverlayMask as oe } from "../../hooks/useOverlayMask.js";
|
|
8
|
+
import { resolveSurfacePortalHost as ie, DIALOG_SURFACE_BOUNDARY_ATTR as O, isSurfacePortalMode as j, projectSurfacePortalRect as le, resolveSurfacePortalBoundaryRect as ae, resolveSurfacePortalMount as de } from "./dialogSurfaceScope.js";
|
|
9
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as ce } from "./localInteractionSurface.js";
|
|
10
|
+
import { createFloatingPresence as ue } from "./floatingPresence.js";
|
|
11
|
+
import { useDialogPlacement as se } from "./DialogPlacementContext.js";
|
|
12
|
+
var fe = /* @__PURE__ */ u("<span aria-hidden=true>"), ge = /* @__PURE__ */ u('<h2 class="text-sm font-semibold">'), me = /* @__PURE__ */ u('<p class="mt-0.5 text-xs text-muted-foreground">'), he = /* @__PURE__ */ u('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), be = /* @__PURE__ */ u('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), ve = /* @__PURE__ */ u('<div><div></div><div class="pointer-events-none relative z-[1] flex h-full w-full items-center justify-center"><div><div class="flex-1 overflow-auto overscroll-contain p-3">'), we = /* @__PURE__ */ u("<div>");
|
|
13
|
+
const ye = {
|
|
13
14
|
display: "none"
|
|
14
15
|
};
|
|
15
|
-
function
|
|
16
|
+
function xe(e) {
|
|
16
17
|
if (typeof queueMicrotask == "function") {
|
|
17
18
|
queueMicrotask(e);
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
Promise.resolve().then(e);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function q(e) {
|
|
23
24
|
return `${e.left}|${e.top}|${e.right}|${e.bottom}|${e.width}|${e.height}`;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function pe(e) {
|
|
26
27
|
return typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(e) : window.setTimeout(() => e(Date.now()), 16);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function $e(e) {
|
|
29
30
|
if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
|
|
30
31
|
window.cancelAnimationFrame(e);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
window.clearTimeout(e);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
const [
|
|
39
|
-
open: M,
|
|
36
|
+
function _e(e) {
|
|
37
|
+
const g = se(), d = J(), F = () => `dialog-${d}-title`, D = () => `dialog-${d}-description`;
|
|
38
|
+
let v;
|
|
39
|
+
const [w, G] = I(null), [M, z] = I(0), [L, Z] = I(0), s = ue({
|
|
40
|
+
open: () => e.open && !!w() && M() > 0,
|
|
40
41
|
exitDurationMs: 120
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
}), y = () => s.mounted() && !!w() && M() > 0, U = (t) => {
|
|
43
|
+
G(t), xe(() => {
|
|
44
|
+
te(w) === t && z((i) => i + 1);
|
|
44
45
|
});
|
|
45
|
-
},
|
|
46
|
-
owner:
|
|
46
|
+
}, x = H(() => y() ? ie({
|
|
47
|
+
owner: w()
|
|
47
48
|
}) : {
|
|
48
49
|
host: null,
|
|
49
50
|
boundaryHost: null,
|
|
50
51
|
mountHost: null,
|
|
51
52
|
mode: "global"
|
|
52
|
-
}),
|
|
53
|
-
return
|
|
54
|
-
const t =
|
|
55
|
-
if (!
|
|
53
|
+
}), p = () => `dialog-boundary-${d}`, n = () => g.mode() === "auto" && j(x()), V = () => n() ? de(x()) : void 0, T = () => e.globalZIndex ?? g.globalZIndex(), R = (t) => le(ae(t), t), K = () => R(x()), $ = H(() => (L(), K())), W = (t) => typeof Element < "u" && t instanceof Element ? !!t.closest(`[${O}="${p()}"]`) : typeof Node < "u" && t instanceof Node ? !!t.parentElement?.closest(`[${O}="${p()}"]`) : !1;
|
|
54
|
+
return Q(() => {
|
|
55
|
+
const t = x();
|
|
56
|
+
if (!y() || !n() || typeof window > "u")
|
|
56
57
|
return;
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
58
|
+
let i = !1, m = null, o = q(R(t));
|
|
59
|
+
const _ = () => {
|
|
60
|
+
if (i || !j(t))
|
|
60
61
|
return;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const l = q(R(t));
|
|
63
|
+
l !== o && (o = l, Z((C) => C + 1));
|
|
64
|
+
}, h = () => {
|
|
65
|
+
i || (m = pe(() => {
|
|
66
|
+
_(), h();
|
|
66
67
|
}));
|
|
67
68
|
};
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
h(), ee(() => {
|
|
70
|
+
i = !0, m !== null && $e(m);
|
|
70
71
|
});
|
|
71
|
-
}),
|
|
72
|
-
open:
|
|
73
|
-
root: () =>
|
|
74
|
-
containsTarget: n() ? (t)
|
|
72
|
+
}), oe({
|
|
73
|
+
open: y,
|
|
74
|
+
root: () => v,
|
|
75
|
+
containsTarget: (t) => n() ? W(t) : typeof Node < "u" && t instanceof Node ? !!v?.contains(t) : !1,
|
|
75
76
|
onClose: () => e.onOpenChange(!1),
|
|
76
77
|
lockBodyScroll: () => !n(),
|
|
77
78
|
trapFocus: !0,
|
|
@@ -82,20 +83,20 @@ function $e(e) {
|
|
|
82
83
|
blockTouchMove: () => n() ? "none" : "outside",
|
|
83
84
|
restoreFocus: !0
|
|
84
85
|
}), [(() => {
|
|
85
|
-
var t =
|
|
86
|
-
return E(U, t), f(t, "data-floe-dialog-owner-anchor",
|
|
87
|
-
})(), r(
|
|
86
|
+
var t = fe();
|
|
87
|
+
return E(U, t), f(t, "data-floe-dialog-owner-anchor", d), Y(t, ye), t;
|
|
88
|
+
})(), r(b, {
|
|
88
89
|
get when() {
|
|
89
|
-
return
|
|
90
|
+
return y();
|
|
90
91
|
},
|
|
91
92
|
get children() {
|
|
92
|
-
return r(
|
|
93
|
+
return r(X, {
|
|
93
94
|
get mount() {
|
|
94
95
|
return V();
|
|
95
96
|
},
|
|
96
97
|
get children() {
|
|
97
|
-
var t =
|
|
98
|
-
f(t, "data-floe-dialog-overlay-root",
|
|
98
|
+
var t = ve(), i = t.firstChild, m = i.nextSibling, o = m.firstChild, _ = o.firstChild;
|
|
99
|
+
f(t, "data-floe-dialog-overlay-root", d), k(t, P({
|
|
99
100
|
get "data-floe-dialog-mode"() {
|
|
100
101
|
return n() ? "surface" : "global";
|
|
101
102
|
},
|
|
@@ -106,38 +107,38 @@ function $e(e) {
|
|
|
106
107
|
return s.exiting() ? "true" : void 0;
|
|
107
108
|
}
|
|
108
109
|
}, () => ({
|
|
109
|
-
[
|
|
110
|
+
[ce]: n() ? "true" : void 0
|
|
110
111
|
}), {
|
|
111
112
|
get class() {
|
|
112
|
-
return
|
|
113
|
+
return A(n() ? "absolute z-20 box-border p-3" : A("fixed inset-0 box-border p-4", T() === void 0 && "z-50"), s.exiting() && "pointer-events-none");
|
|
113
114
|
},
|
|
114
115
|
get style() {
|
|
115
|
-
return
|
|
116
|
-
left: `${
|
|
117
|
-
top: `${
|
|
118
|
-
width: `${
|
|
119
|
-
height: `${
|
|
116
|
+
return S(() => !!n())() ? {
|
|
117
|
+
left: `${$().left}px`,
|
|
118
|
+
top: `${$().top}px`,
|
|
119
|
+
width: `${$().width}px`,
|
|
120
|
+
height: `${$().height}px`
|
|
120
121
|
} : {
|
|
121
|
-
"z-index":
|
|
122
|
+
"z-index": T()
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
|
-
}), !1, !0), f(
|
|
125
|
-
[
|
|
125
|
+
}), !1, !0), f(i, "data-floe-dialog-backdrop", d), k(i, P(() => ({
|
|
126
|
+
[O]: p()
|
|
126
127
|
}), {
|
|
127
128
|
get "data-floating-presence"() {
|
|
128
129
|
return s.state();
|
|
129
130
|
},
|
|
130
131
|
get class() {
|
|
131
|
-
return
|
|
132
|
+
return A("absolute inset-0 cursor-pointer floe-floating-presence floe-floating-backdrop", n() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
|
|
132
133
|
},
|
|
133
134
|
onClick: () => e.onOpenChange(!1)
|
|
134
135
|
}), !1, !1);
|
|
135
|
-
var
|
|
136
|
-
return typeof
|
|
137
|
-
[
|
|
136
|
+
var h = v;
|
|
137
|
+
return typeof h == "function" ? E(h, o) : v = o, f(o, "data-floe-dialog-panel", d), k(o, P(() => ({
|
|
138
|
+
[O]: p()
|
|
138
139
|
}), {
|
|
139
140
|
get class() {
|
|
140
|
-
return
|
|
141
|
+
return A(n() ? "flex max-h-[calc(100%-1rem)] w-[min(32rem,calc(100%-1rem))] max-w-[calc(100%-1rem)] flex-col" : "w-full max-w-md max-h-[85vh]", "bg-card text-card-foreground rounded-md shadow-lg", "border border-border", "floe-floating-presence floe-floating-dialog-panel", "pointer-events-auto flex flex-col", e.class);
|
|
141
142
|
},
|
|
142
143
|
get "data-floating-presence"() {
|
|
143
144
|
return s.state();
|
|
@@ -147,54 +148,54 @@ function $e(e) {
|
|
|
147
148
|
return n() ? void 0 : "true";
|
|
148
149
|
},
|
|
149
150
|
get "aria-labelledby"() {
|
|
150
|
-
return
|
|
151
|
+
return S(() => !!e.title)() ? F() : void 0;
|
|
151
152
|
},
|
|
152
153
|
get "aria-describedby"() {
|
|
153
|
-
return
|
|
154
|
+
return S(() => !!e.description)() ? D() : void 0;
|
|
154
155
|
},
|
|
155
156
|
tabIndex: -1
|
|
156
|
-
}), !1, !0),
|
|
157
|
+
}), !1, !0), a(o, r(b, {
|
|
157
158
|
get when() {
|
|
158
159
|
return e.title || e.description;
|
|
159
160
|
},
|
|
160
161
|
get children() {
|
|
161
|
-
var
|
|
162
|
-
return
|
|
162
|
+
var l = he(), C = l.firstChild;
|
|
163
|
+
return a(C, r(b, {
|
|
163
164
|
get when() {
|
|
164
165
|
return e.title;
|
|
165
166
|
},
|
|
166
167
|
get children() {
|
|
167
|
-
var c =
|
|
168
|
-
return
|
|
168
|
+
var c = ge();
|
|
169
|
+
return a(c, () => e.title), N(() => f(c, "id", F())), c;
|
|
169
170
|
}
|
|
170
|
-
}), null),
|
|
171
|
+
}), null), a(C, r(b, {
|
|
171
172
|
get when() {
|
|
172
173
|
return e.description;
|
|
173
174
|
},
|
|
174
175
|
get children() {
|
|
175
|
-
var c =
|
|
176
|
-
return
|
|
176
|
+
var c = me();
|
|
177
|
+
return a(c, () => e.description), N(() => f(c, "id", D())), c;
|
|
177
178
|
}
|
|
178
|
-
}), null),
|
|
179
|
+
}), null), a(l, r(B, {
|
|
179
180
|
variant: "ghost-destructive",
|
|
180
181
|
size: "icon",
|
|
181
182
|
class: "-my-2 -mr-2 h-[46px] w-[46px] shrink-0 sm:my-0 sm:-mr-1 sm:h-6 sm:w-6",
|
|
182
183
|
onClick: () => e.onOpenChange(!1),
|
|
183
184
|
"aria-label": "Close",
|
|
184
185
|
get children() {
|
|
185
|
-
return r(
|
|
186
|
+
return r(ne, {
|
|
186
187
|
class: "w-3.5 h-3.5"
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
|
-
}), null),
|
|
190
|
+
}), null), l;
|
|
190
191
|
}
|
|
191
|
-
}),
|
|
192
|
+
}), _), a(_, () => e.children), a(o, r(b, {
|
|
192
193
|
get when() {
|
|
193
194
|
return e.footer;
|
|
194
195
|
},
|
|
195
196
|
get children() {
|
|
196
|
-
var
|
|
197
|
-
return
|
|
197
|
+
var l = be();
|
|
198
|
+
return a(l, () => e.footer), l;
|
|
198
199
|
}
|
|
199
200
|
}), null), t;
|
|
200
201
|
}
|
|
@@ -202,9 +203,9 @@ function $e(e) {
|
|
|
202
203
|
}
|
|
203
204
|
})];
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
-
const
|
|
207
|
-
return r(
|
|
206
|
+
function Te(e) {
|
|
207
|
+
const g = re();
|
|
208
|
+
return r(_e, {
|
|
208
209
|
get open() {
|
|
209
210
|
return e.open;
|
|
210
211
|
},
|
|
@@ -221,16 +222,16 @@ function Ie(e) {
|
|
|
221
222
|
return e.globalZIndex;
|
|
222
223
|
},
|
|
223
224
|
get footer() {
|
|
224
|
-
return [r(
|
|
225
|
+
return [r(B, {
|
|
225
226
|
variant: "ghost",
|
|
226
227
|
onClick: () => e.onOpenChange(!1),
|
|
227
228
|
get disabled() {
|
|
228
229
|
return e.loading;
|
|
229
230
|
},
|
|
230
231
|
get children() {
|
|
231
|
-
return e.cancelText ??
|
|
232
|
+
return e.cancelText ?? g.config.strings.confirmDialog.cancel;
|
|
232
233
|
}
|
|
233
|
-
}), r(
|
|
234
|
+
}), r(B, {
|
|
234
235
|
get variant() {
|
|
235
236
|
return e.variant === "destructive" ? "destructive" : "primary";
|
|
236
237
|
},
|
|
@@ -241,16 +242,16 @@ function Ie(e) {
|
|
|
241
242
|
return e.loading;
|
|
242
243
|
},
|
|
243
244
|
get children() {
|
|
244
|
-
return e.confirmText ??
|
|
245
|
+
return e.confirmText ?? g.config.strings.confirmDialog.confirm;
|
|
245
246
|
}
|
|
246
247
|
})];
|
|
247
248
|
},
|
|
248
249
|
get children() {
|
|
249
|
-
return e.children ??
|
|
250
|
+
return e.children ?? we();
|
|
250
251
|
}
|
|
251
252
|
});
|
|
252
253
|
}
|
|
253
254
|
export {
|
|
254
|
-
|
|
255
|
-
|
|
255
|
+
Te as ConfirmDialog,
|
|
256
|
+
_e as Dialog
|
|
256
257
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
2
|
+
export type DialogPlacementMode = 'auto' | 'global';
|
|
3
|
+
export interface DialogPlacementProviderProps {
|
|
4
|
+
/** Resolve dialogs from their nearest surface host, or force document-level modal placement. */
|
|
5
|
+
mode: DialogPlacementMode;
|
|
6
|
+
/** Default stacking layer for global dialogs in this placement scope. */
|
|
7
|
+
globalZIndex?: number;
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
interface DialogPlacementContextValue {
|
|
11
|
+
mode: Accessor<DialogPlacementMode>;
|
|
12
|
+
globalZIndex: Accessor<number | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare function DialogPlacementProvider(props: DialogPlacementProviderProps): JSX.Element;
|
|
15
|
+
export declare function useDialogPlacement(): DialogPlacementContextValue;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent as n } from "solid-js/web";
|
|
2
|
+
import { useContext as r, createContext as l } from "solid-js";
|
|
3
|
+
const a = {
|
|
4
|
+
mode: () => "auto",
|
|
5
|
+
globalZIndex: () => {
|
|
6
|
+
}
|
|
7
|
+
}, o = l(a);
|
|
8
|
+
function d(e) {
|
|
9
|
+
const t = {
|
|
10
|
+
mode: () => e.mode,
|
|
11
|
+
globalZIndex: () => e.globalZIndex
|
|
12
|
+
};
|
|
13
|
+
return n(o.Provider, {
|
|
14
|
+
value: t,
|
|
15
|
+
get children() {
|
|
16
|
+
return e.children;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function m() {
|
|
21
|
+
return r(o);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
d as DialogPlacementProvider,
|
|
25
|
+
m as useDialogPlacement
|
|
26
|
+
};
|
|
@@ -2,6 +2,7 @@ export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from '.
|
|
|
2
2
|
export { Tag, type TagProps, type TagVariant, type TagSize } from './Tag';
|
|
3
3
|
export { Input, Textarea, NumberInput, AffixInput, type InputProps, type InputSize, type TextareaProps, type NumberInputProps, type AffixInputProps, type AffixOption, } from './Input';
|
|
4
4
|
export { Dialog, ConfirmDialog, type DialogProps, type ConfirmDialogProps } from './Dialog';
|
|
5
|
+
export { DialogPlacementProvider, type DialogPlacementMode, type DialogPlacementProviderProps, } from './DialogPlacementContext';
|
|
5
6
|
export { FloatingWindow, type FloatingWindowProps } from './FloatingWindow';
|
|
6
7
|
export { createFloatingPresence, type FloatingPresence, type FloatingPresenceOptions, type FloatingPresenceState, } from './floatingPresence';
|
|
7
8
|
export { MENU_ITEM_SELECTOR, focusMenuItem, getMenuItems, handleMenuKeyboardNavigation, moveMenuFocus, type MenuDismissReason, type MenuFocusMode, type MenuItemNavigationOptions, type MenuKeyboardNavigationOptions, } from './menuUtils';
|