@floegence/floe-webapp-core 0.62.0 → 0.64.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.
@@ -4,7 +4,8 @@ export interface DialogProps {
4
4
  onOpenChange: (open: boolean) => void;
5
5
  /** Dialog title - can be a string or JSX element for custom headers */
6
6
  title?: string | JSX.Element;
7
- description?: string;
7
+ /** Plain-text guidance rendered at the start of the body, never in the header. */
8
+ bodyDescription?: string;
8
9
  /** Localized accessible name for the close button. */
9
10
  closeLabel?: string;
10
11
  /** Whether clicking the backdrop requests dismissal. Defaults to true. */
@@ -17,7 +18,7 @@ export interface DialogProps {
17
18
  class?: string;
18
19
  /** Bottom drawers retain the same modal and surface-placement contract. */
19
20
  presentation?: 'dialog' | 'bottom-drawer';
20
- /** Undefined uses the default header; null leaves only accessible title/description. */
21
+ /** Undefined uses the default header; null leaves only the accessible title. */
21
22
  header?: JSX.Element;
22
23
  contentClass?: string;
23
24
  /** Includes the exit animation, so hosts can retain background input isolation. */
@@ -36,9 +37,9 @@ export interface ConfirmDialogProps {
36
37
  open: boolean;
37
38
  onOpenChange: (open: boolean) => void;
38
39
  title: string;
39
- /** Description displayed under title (header area). Use children for content area. */
40
- description?: string;
41
- /** Custom content in the dialog body. If not provided, an empty placeholder is used. */
40
+ /** Plain-text guidance rendered in the body; use children for rich content. */
41
+ bodyDescription?: string;
42
+ /** Optional custom content after the body description. */
42
43
  children?: JSX.Element;
43
44
  confirmText?: string;
44
45
  cancelText?: string;
@@ -1,19 +1,19 @@
1
- import { createComponent as r, use as L, setAttribute as s, style as ee, Portal as te, spread as B, mergeProps as F, memo as C, insert as i, effect as A, className as N, template as c } from "solid-js/web";
2
- import { createUniqueId as ne, createSignal as I, createEffect as G, onCleanup as j, createMemo as q, Show as f, untrack as re } from "solid-js";
3
- import { cn as w } from "../../utils/cn.js";
4
- import { Button as E } from "./Button.js";
1
+ import { createComponent as r, use as L, setAttribute as s, style as ee, Portal as te, spread as T, mergeProps as B, memo as _, insert as l, effect as D, className as N, template as g } from "solid-js/web";
2
+ import { createUniqueId as ne, createSignal as F, createEffect as G, onCleanup as j, createMemo as q, Show as f, untrack as re } from "solid-js";
3
+ import { cn as y } from "../../utils/cn.js";
4
+ import { Button as I } from "./Button.js";
5
5
  import { X as oe } from "../icons/index.js";
6
- import { useResolvedFloeConfig as ie } from "../../context/FloeConfigContext.js";
6
+ import { useResolvedFloeConfig as ae } from "../../context/FloeConfigContext.js";
7
7
  import { useOverlayMask as le } from "../../hooks/useOverlayMask.js";
8
- import { resolveSurfacePortalHost as ae, DIALOG_SURFACE_BOUNDARY_ATTR as O, SURFACE_PORTAL_LAYER_ATTR as de, DIALOG_SURFACE_HOST_ATTR as ce, isSurfacePortalMode as K, projectSurfacePortalRect as ue, resolveSurfacePortalBoundaryRect as se, resolveSurfacePortalMount as fe } from "./dialogSurfaceScope.js";
8
+ import { resolveSurfacePortalHost as ie, DIALOG_SURFACE_BOUNDARY_ATTR as A, SURFACE_PORTAL_LAYER_ATTR as de, DIALOG_SURFACE_HOST_ATTR as ce, isSurfacePortalMode as K, projectSurfacePortalRect as ue, resolveSurfacePortalBoundaryRect as se, resolveSurfacePortalMount as fe } from "./dialogSurfaceScope.js";
9
9
  import { LOCAL_INTERACTION_SURFACE_ATTR as ge } from "./localInteractionSurface.js";
10
10
  import { createFloatingPresence as me } from "./floatingPresence.js";
11
11
  import { useDialogPlacement as he } from "./DialogPlacementContext.js";
12
- var be = /* @__PURE__ */ c("<span aria-hidden=true>"), we = /* @__PURE__ */ c('<h2 class="text-sm font-semibold">'), ve = /* @__PURE__ */ c('<p class="mt-0.5 text-xs text-muted-foreground">'), ye = /* @__PURE__ */ c('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), xe = /* @__PURE__ */ c('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), $e = /* @__PURE__ */ c("<div><div></div><div><div data-floe-surface=floating><div>"), _e = /* @__PURE__ */ c("<h2 class=sr-only>"), Ce = /* @__PURE__ */ c("<p class=sr-only>"), Ae = /* @__PURE__ */ c("<div>");
13
- const Oe = {
12
+ var be = /* @__PURE__ */ g("<span aria-hidden=true>"), we = /* @__PURE__ */ g('<h2 class="text-sm font-semibold">'), ye = /* @__PURE__ */ g('<div data-floe-dialog-header class="flex items-start justify-between p-3 border-b border-border"><div>'), ve = /* @__PURE__ */ g('<p class="mb-3 shrink-0 text-sm text-muted-foreground last:mb-0">'), xe = /* @__PURE__ */ g('<div data-floe-dialog-footer class="flex items-center justify-end gap-2 p-3 border-t border-border">'), $e = /* @__PURE__ */ g("<div><div></div><div><div data-floe-surface=floating><div data-floe-dialog-body>"), Ce = /* @__PURE__ */ g("<h2 class=sr-only>");
13
+ const _e = {
14
14
  display: "none"
15
15
  };
16
- function Re(e) {
16
+ function Ae(e) {
17
17
  if (typeof queueMicrotask == "function") {
18
18
  queueMicrotask(e);
19
19
  return;
@@ -23,59 +23,59 @@ function Re(e) {
23
23
  function U(e) {
24
24
  return `${e.left}|${e.top}|${e.right}|${e.bottom}|${e.width}|${e.height}`;
25
25
  }
26
- function ke(e) {
26
+ function Oe(e) {
27
27
  return typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(e) : window.setTimeout(() => e(Date.now()), 16);
28
28
  }
29
- function Pe(e) {
29
+ function ke(e) {
30
30
  if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
31
31
  window.cancelAnimationFrame(e);
32
32
  return;
33
33
  }
34
34
  window.clearTimeout(e);
35
35
  }
36
- function pe(e) {
37
- const v = he(), g = ne(), p = () => `dialog-${g}-title`, S = () => `dialog-${g}-description`;
38
- let T;
39
- const [R, z] = I(null), [M, Z] = I(0), [V, W] = I(0), m = () => e.presentation === "bottom-drawer", u = me({
40
- open: () => e.open && !!R() && M() > 0,
36
+ function Re(e) {
37
+ const v = he(), c = ne(), P = () => `dialog-${c}-title`, E = () => `dialog-${c}-description`;
38
+ let p;
39
+ const [O, z] = F(null), [M, Z] = F(0), [V, W] = F(0), u = () => e.presentation === "bottom-drawer", d = me({
40
+ open: () => e.open && !!O() && M() > 0,
41
41
  get exitDurationMs() {
42
- return m() ? 180 : 160;
42
+ return u() ? 180 : 160;
43
43
  }
44
- }), y = () => u.mounted() && !!R() && M() > 0;
45
- G(() => e.onPresenceChange?.(y())), j(() => e.onPresenceChange?.(!1));
44
+ }), x = () => d.mounted() && !!O() && M() > 0;
45
+ G(() => e.onPresenceChange?.(x())), j(() => e.onPresenceChange?.(!1));
46
46
  const Y = (n) => {
47
- z(n), Re(() => {
48
- re(R) === n && Z((d) => d + 1);
47
+ z(n), Ae(() => {
48
+ re(O) === n && Z((i) => i + 1);
49
49
  });
50
- }, k = q(() => y() ? ae({
51
- owner: R()
50
+ }, k = q(() => x() ? ie({
51
+ owner: O()
52
52
  }) : {
53
53
  host: null,
54
54
  boundaryHost: null,
55
55
  mountHost: null,
56
56
  mode: "global"
57
- }), x = () => `dialog-boundary-${g}`, o = () => v.mode() === "auto" && K(k()), X = () => o() ? fe(k()) : void 0, H = () => e.globalZIndex ?? v.globalZIndex(), D = (n) => ue(se(n), n), J = () => D(k()), P = q(() => (V(), J())), Q = (n) => typeof Element < "u" && n instanceof Element ? !!n.closest(`[${O}="${x()}"]`) : typeof Node < "u" && n instanceof Node ? !!n.parentElement?.closest(`[${O}="${x()}"]`) : !1;
57
+ }), $ = () => `dialog-boundary-${c}`, o = () => v.mode() === "auto" && K(k()), X = () => o() ? fe(k()) : void 0, H = () => e.globalZIndex ?? v.globalZIndex(), S = (n) => ue(se(n), n), J = () => S(k()), R = q(() => (V(), J())), Q = (n) => typeof Element < "u" && n instanceof Element ? !!n.closest(`[${A}="${$()}"]`) : typeof Node < "u" && n instanceof Node ? !!n.parentElement?.closest(`[${A}="${$()}"]`) : !1;
58
58
  return G(() => {
59
59
  const n = k();
60
- if (!y() || !o() || typeof window > "u")
60
+ if (!x() || !o() || typeof window > "u")
61
61
  return;
62
- let d = !1, b = null, l = U(D(n));
63
- const $ = () => {
64
- if (d || !K(n))
62
+ let i = !1, m = null, a = U(S(n));
63
+ const h = () => {
64
+ if (i || !K(n))
65
65
  return;
66
- const t = U(D(n));
67
- t !== l && (l = t, W((h) => h + 1));
68
- }, _ = () => {
69
- d || (b = ke(() => {
70
- $(), _();
66
+ const t = U(S(n));
67
+ t !== a && (a = t, W((b) => b + 1));
68
+ }, C = () => {
69
+ i || (m = Oe(() => {
70
+ h(), C();
71
71
  }));
72
72
  };
73
- _(), j(() => {
74
- d = !0, b !== null && Pe(b);
73
+ C(), j(() => {
74
+ i = !0, m !== null && ke(m);
75
75
  });
76
76
  }), le({
77
- open: y,
78
- root: () => T,
77
+ open: x,
78
+ root: () => p,
79
79
  containsTarget: Q,
80
80
  onClose: () => e.onOpenChange(!1),
81
81
  lockBodyScroll: () => !o(),
@@ -89,10 +89,10 @@ function pe(e) {
89
89
  restoreFocus: !0
90
90
  }), [(() => {
91
91
  var n = be();
92
- return L(Y, n), s(n, "data-floe-dialog-owner-anchor", g), ee(n, Oe), n;
92
+ return L(Y, n), s(n, "data-floe-dialog-owner-anchor", c), ee(n, _e), n;
93
93
  })(), r(f, {
94
94
  get when() {
95
- return y();
95
+ return x();
96
96
  },
97
97
  get children() {
98
98
  return r(te, {
@@ -100,8 +100,8 @@ function pe(e) {
100
100
  return X();
101
101
  },
102
102
  get children() {
103
- var n = $e(), d = n.firstChild, b = d.nextSibling, l = b.firstChild, $ = l.firstChild;
104
- s(n, "data-floe-dialog-overlay-root", g), B(n, F({
103
+ var n = $e(), i = n.firstChild, m = i.nextSibling, a = m.firstChild, h = a.firstChild;
104
+ s(n, "data-floe-dialog-overlay-root", c), T(n, B({
105
105
  get "data-floe-dialog-mode"() {
106
106
  return o() ? "surface" : "global";
107
107
  },
@@ -109,70 +109,70 @@ function pe(e) {
109
109
  return e.presentation ?? "dialog";
110
110
  },
111
111
  get "data-floating-presence"() {
112
- return u.state();
112
+ return d.state();
113
113
  },
114
114
  get "aria-hidden"() {
115
- return u.exiting() ? "true" : void 0;
115
+ return d.exiting() ? "true" : void 0;
116
116
  }
117
117
  }, {
118
118
  [ge]: "true"
119
119
  }, () => ({
120
120
  [de]: "true",
121
- [O]: x()
121
+ [A]: $()
122
122
  }), {
123
123
  get class() {
124
- return w(o() ? "absolute z-20 box-border p-3" : w("fixed inset-0 box-border p-4", H() === void 0 && "z-50"), m() && "floe-bottom-drawer-overlay", u.exiting() && !m() && "pointer-events-none");
124
+ return y(o() ? "absolute z-20 box-border p-3" : y("fixed inset-0 box-border p-4", H() === void 0 && "z-50"), u() && "floe-bottom-drawer-overlay", d.exiting() && !u() && "pointer-events-none");
125
125
  },
126
126
  get style() {
127
- return C(() => !!o())() ? {
128
- left: `${P().left}px`,
129
- top: `${P().top}px`,
130
- width: `${P().width}px`,
131
- height: `${P().height}px`
127
+ return _(() => !!o())() ? {
128
+ left: `${R().left}px`,
129
+ top: `${R().top}px`,
130
+ width: `${R().width}px`,
131
+ height: `${R().height}px`
132
132
  } : {
133
133
  "z-index": H()
134
134
  };
135
135
  }
136
- }), !1, !0), s(d, "data-floe-dialog-backdrop", g), B(d, F(() => ({
137
- [O]: x()
136
+ }), !1, !0), s(i, "data-floe-dialog-backdrop", c), T(i, B(() => ({
137
+ [A]: $()
138
138
  }), {
139
139
  get "data-floating-presence"() {
140
- return u.state();
140
+ return d.state();
141
141
  },
142
142
  get class() {
143
- return w("absolute inset-0 floe-floating-presence floe-floating-backdrop", e.closeOnBackdropClick === !1 ? "cursor-default" : "cursor-pointer", m() ? "floe-bottom-drawer-backdrop" : o() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
143
+ return y("absolute inset-0 floe-floating-presence floe-floating-backdrop", e.closeOnBackdropClick === !1 ? "cursor-default" : "cursor-pointer", u() ? "floe-bottom-drawer-backdrop" : o() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
144
144
  },
145
145
  onClick: () => {
146
- !u.exiting() && e.closeOnBackdropClick !== !1 && e.onOpenChange(!1);
146
+ !d.exiting() && e.closeOnBackdropClick !== !1 && e.onOpenChange(!1);
147
147
  }
148
148
  }), !1, !1);
149
- var _ = T;
150
- return typeof _ == "function" ? L(_, l) : T = l, s(l, "data-floe-dialog-panel", g), B(l, F(() => ({
151
- [O]: x(),
149
+ var C = p;
150
+ return typeof C == "function" ? L(C, a) : p = a, s(a, "data-floe-dialog-panel", c), T(a, B(() => ({
151
+ [A]: $(),
152
152
  [ce]: "true"
153
153
  }), {
154
154
  get class() {
155
- return w(o() ? "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", m() ? "floe-bottom-drawer-panel" : "floe-floating-dialog-panel", "pointer-events-auto flex flex-col", e.class);
155
+ return y(o() ? "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", u() ? "floe-bottom-drawer-panel" : "floe-floating-dialog-panel", "pointer-events-auto flex flex-col", e.class);
156
156
  },
157
157
  get "data-floating-presence"() {
158
- return u.state();
158
+ return d.state();
159
159
  },
160
160
  get inert() {
161
- return C(() => !!m())() && u.exiting();
161
+ return _(() => !!u())() && d.exiting();
162
162
  },
163
163
  role: "dialog",
164
164
  get "aria-modal"() {
165
165
  return o() ? void 0 : "true";
166
166
  },
167
167
  get "aria-labelledby"() {
168
- return C(() => !!e.title)() ? p() : void 0;
168
+ return _(() => !!e.title)() ? P() : void 0;
169
169
  },
170
170
  get "aria-describedby"() {
171
- return C(() => !!e.description)() ? S() : void 0;
171
+ return _(() => !!e.bodyDescription)() ? E() : void 0;
172
172
  },
173
173
  onKeyDown: (t) => e.onKeyDown?.(t),
174
174
  tabIndex: -1
175
- }), !1, !0), i(l, r(f, {
175
+ }), !1, !0), l(a, r(f, {
176
176
  get when() {
177
177
  return e.header === void 0;
178
178
  },
@@ -181,44 +181,28 @@ function pe(e) {
181
181
  get when() {
182
182
  return e.title;
183
183
  },
184
- get children() {
185
- var t = _e();
186
- return i(t, () => e.title), A(() => s(t, "id", p())), t;
187
- }
188
- }), r(f, {
189
- get when() {
190
- return e.description;
191
- },
192
184
  get children() {
193
185
  var t = Ce();
194
- return i(t, () => e.description), A(() => s(t, "id", S())), t;
186
+ return l(t, () => e.title), D(() => s(t, "id", P())), t;
195
187
  }
196
- }), C(() => e.header)];
188
+ }), _(() => e.header)];
197
189
  },
198
190
  get children() {
199
191
  return r(f, {
200
192
  get when() {
201
- return e.title || e.description;
193
+ return e.title;
202
194
  },
203
195
  get children() {
204
- var t = ye(), h = t.firstChild;
205
- return i(h, r(f, {
196
+ var t = ye(), b = t.firstChild;
197
+ return l(b, r(f, {
206
198
  get when() {
207
199
  return e.title;
208
200
  },
209
201
  get children() {
210
- var a = we();
211
- return i(a, () => e.title), A(() => s(a, "id", p())), a;
202
+ var w = we();
203
+ return l(w, () => e.title), D(() => s(w, "id", P())), w;
212
204
  }
213
- }), null), i(h, r(f, {
214
- get when() {
215
- return e.description;
216
- },
217
- get children() {
218
- var a = ve();
219
- return i(a, () => e.description), A(() => s(a, "id", S())), a;
220
- }
221
- }), null), i(t, r(E, {
205
+ })), l(t, r(I, {
222
206
  variant: "ghost-destructive",
223
207
  size: "icon",
224
208
  class: "-my-2 -mr-2 h-[46px] w-[46px] shrink-0 sm:my-0 sm:-mr-1 sm:h-6 sm:w-6",
@@ -235,17 +219,25 @@ function pe(e) {
235
219
  }
236
220
  });
237
221
  }
238
- }), $), i($, () => e.children), i(l, r(f, {
222
+ }), h), l(h, r(f, {
223
+ get when() {
224
+ return e.bodyDescription;
225
+ },
226
+ get children() {
227
+ var t = ve();
228
+ return l(t, () => e.bodyDescription), D(() => s(t, "id", E())), t;
229
+ }
230
+ }), null), l(h, () => e.children, null), l(a, r(f, {
239
231
  get when() {
240
232
  return e.footer;
241
233
  },
242
234
  get children() {
243
235
  var t = xe();
244
- return i(t, () => e.footer), t;
236
+ return l(t, () => e.footer), t;
245
237
  }
246
- }), null), A((t) => {
247
- var h = w("pointer-events-none relative z-[1] flex h-full w-full justify-center", m() ? "items-end" : "items-center"), a = w("min-h-0 flex-1 overflow-auto overscroll-contain p-3", e.contentClass);
248
- return h !== t.e && N(b, t.e = h), a !== t.t && N($, t.t = a), t;
238
+ }), null), D((t) => {
239
+ var b = y("pointer-events-none relative z-[1] flex h-full w-full justify-center", u() ? "items-end" : "items-center"), w = y("min-h-0 flex-1 overflow-auto overscroll-contain p-3", e.contentClass);
240
+ return b !== t.e && N(m, t.e = b), w !== t.t && N(h, t.t = w), t;
249
241
  }, {
250
242
  e: void 0,
251
243
  t: void 0
@@ -255,9 +247,9 @@ function pe(e) {
255
247
  }
256
248
  })];
257
249
  }
258
- function je(e) {
259
- const v = ie();
260
- return r(pe, {
250
+ function Ne(e) {
251
+ const v = ae();
252
+ return r(Re, {
261
253
  get open() {
262
254
  return e.open;
263
255
  },
@@ -267,14 +259,14 @@ function je(e) {
267
259
  get title() {
268
260
  return e.title;
269
261
  },
270
- get description() {
271
- return e.description;
262
+ get bodyDescription() {
263
+ return e.bodyDescription;
272
264
  },
273
265
  get globalZIndex() {
274
266
  return e.globalZIndex;
275
267
  },
276
268
  get footer() {
277
- return [r(E, {
269
+ return [r(I, {
278
270
  variant: "ghost",
279
271
  onClick: () => e.onOpenChange(!1),
280
272
  get disabled() {
@@ -283,7 +275,7 @@ function je(e) {
283
275
  get children() {
284
276
  return e.cancelText ?? v.config.strings.confirmDialog.cancel;
285
277
  }
286
- }), r(E, {
278
+ }), r(I, {
287
279
  get variant() {
288
280
  return e.variant === "destructive" ? "destructive" : "primary";
289
281
  },
@@ -299,11 +291,11 @@ function je(e) {
299
291
  })];
300
292
  },
301
293
  get children() {
302
- return e.children ?? Ae();
294
+ return e.children;
303
295
  }
304
296
  });
305
297
  }
306
298
  export {
307
- je as ConfirmDialog,
308
- pe as Dialog
299
+ Ne as ConfirmDialog,
300
+ Re as Dialog
309
301
  };