@floegence/floe-webapp-core 0.101.13 → 0.101.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.
|
@@ -12,8 +12,8 @@ import { resolveFloatingWindowViewport as we, normalizeFloatingWindowRect as me,
|
|
|
12
12
|
import { observeViewport as yt } from "../../viewport.js";
|
|
13
13
|
import { createFloatingPresence as bt } from "./floatingPresence.js";
|
|
14
14
|
import { LOCAL_INTERACTION_SURFACE_ATTR as Be } from "./localInteractionSurface.js";
|
|
15
|
-
import { resolveFloatingBoundary as
|
|
16
|
-
import { SURFACE_PORTAL_LAYER_ATTR as
|
|
15
|
+
import { resolveFloatingBoundary as pt } from "./surfaceFloatingBoundary.js";
|
|
16
|
+
import { SURFACE_PORTAL_LAYER_ATTR as zt, resolveSurfacePortalHost as _t } from "./dialogSurfaceScope.js";
|
|
17
17
|
var $t = /* @__PURE__ */ a("<span hidden>"), St = /* @__PURE__ */ a("<h2 class=sr-only>"), Pt = /* @__PURE__ */ a('<div data-floe-floating-window-title-content=true class="flex h-full min-w-0 flex-1 items-center">'), It = /* @__PURE__ */ a('<div data-floe-floating-window-header-actions=true class="flex shrink-0 items-center gap-1"><span aria-hidden=true class="mx-2 h-4 w-px shrink-0 bg-border">'), Rt = /* @__PURE__ */ a('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-[var(--floe-line)]">'), Ct = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), At = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), Et = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), Mt = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), Ft = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), kt = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), Ot = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), Tt = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), Lt = /* @__PURE__ */ a('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex h-full flex-1 min-w-0 items-center px-3"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="min-h-0 flex-1 overflow-auto overscroll-contain p-3">'), Bt = /* @__PURE__ */ a('<span data-floe-floating-window-title-icon=true aria-hidden=true class="flex size-4 shrink-0 items-center justify-center">'), Dt = /* @__PURE__ */ a('<h2 class="flex min-w-0 items-center gap-2 text-xs leading-none font-medium select-none"><span class="min-w-0 truncate">');
|
|
18
18
|
function nn(i) {
|
|
19
19
|
const ve = () => i.resizable ?? !0, K = () => i.maximizable ?? !0, xe = () => i.draggable ?? !0, q = () => i.minSize ?? {
|
|
@@ -31,7 +31,7 @@ function nn(i) {
|
|
|
31
31
|
height: 0
|
|
32
32
|
}, {
|
|
33
33
|
equals: (e, t) => e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height
|
|
34
|
-
}), [te, qe] = b(!0), v = () => !!(i.compactBelow && R().width < i.compactBelow),
|
|
34
|
+
}), [te, qe] = b(!0), v = () => !!(i.compactBelow && R().width < i.compactBelow), p = () => i.viewportInsets, T = () => O()?.fixedScale ?? 1, ne = (e) => ({
|
|
35
35
|
x: (e.x + (O()?.fixedOffset.left ?? 0)) / T(),
|
|
36
36
|
y: (e.y + (O()?.fixedOffset.top ?? 0)) / T()
|
|
37
37
|
}), He = () => i.zIndex ?? 100, Xe = st(), Ye = ct(), Ne = ut(), E = Ye?.isMobile ?? ft(() => Ne.config.layout.mobileQuery), X = 16, ie = () => `floating-window-${Xe}-title`, [Ve, je] = b(i.defaultPosition ?? {
|
|
@@ -44,7 +44,7 @@ function nn(i) {
|
|
|
44
44
|
open: () => i.open,
|
|
45
45
|
element: () => ae
|
|
46
46
|
});
|
|
47
|
-
let
|
|
47
|
+
let z = {
|
|
48
48
|
x: 0,
|
|
49
49
|
y: 0
|
|
50
50
|
}, F = {
|
|
@@ -52,30 +52,30 @@ function nn(i) {
|
|
|
52
52
|
y: 0,
|
|
53
53
|
width: 0,
|
|
54
54
|
height: 0
|
|
55
|
-
}, le = 32,
|
|
55
|
+
}, le = 32, pe = {
|
|
56
56
|
x: 0,
|
|
57
57
|
y: 0
|
|
58
|
-
},
|
|
58
|
+
}, ze = {
|
|
59
59
|
x: 0,
|
|
60
60
|
y: 0,
|
|
61
61
|
width: 0,
|
|
62
62
|
height: 0
|
|
63
|
-
}, _e = "se",
|
|
63
|
+
}, _e = "se", s, ae, se, h = null, N, f = null, C = {
|
|
64
64
|
x: 0,
|
|
65
65
|
y: 0
|
|
66
|
-
}, k = null, V = null, _, de = !1,
|
|
66
|
+
}, k = null, V = null, _, de = !1, d = {
|
|
67
67
|
x: i.defaultPosition?.x ?? 0,
|
|
68
68
|
y: i.defaultPosition?.y ?? 0,
|
|
69
69
|
width: i.defaultSize?.width ?? 400,
|
|
70
70
|
height: i.defaultSize?.height ?? 300
|
|
71
71
|
}, x = {
|
|
72
|
-
...
|
|
72
|
+
...d
|
|
73
73
|
}, A;
|
|
74
74
|
const $e = (e) => {
|
|
75
75
|
x = {
|
|
76
76
|
...e
|
|
77
77
|
};
|
|
78
|
-
const t = we(R(),
|
|
78
|
+
const t = we(R(), p());
|
|
79
79
|
A = {
|
|
80
80
|
x: t.width > e.width ? (e.x - t.x) / (t.width - e.width) : A?.x ?? 0.5,
|
|
81
81
|
y: t.height > e.height ? (e.y - t.y) / (t.height - e.height) : A?.y ?? 0.5
|
|
@@ -105,9 +105,9 @@ function nn(i) {
|
|
|
105
105
|
lockDocumentStyles: f !== "drag"
|
|
106
106
|
});
|
|
107
107
|
}, j = (e) => {
|
|
108
|
-
if ((e.x !==
|
|
108
|
+
if ((e.x !== d.x || e.y !== d.y || e.width !== d.width || e.height !== d.height) && (_?.cancel(), _ = void 0), d = e, !s) return;
|
|
109
109
|
const t = ne(e);
|
|
110
|
-
|
|
110
|
+
s.style.transform = `translate3d(${t.x}px, ${t.y}px, 0)`, s.style.width = `${e.width / T()}px`, s.style.height = `${e.height / T()}px`;
|
|
111
111
|
}, Se = () => {
|
|
112
112
|
const e = Ve(), t = Ue();
|
|
113
113
|
return {
|
|
@@ -117,7 +117,7 @@ function nn(i) {
|
|
|
117
117
|
height: t.height
|
|
118
118
|
};
|
|
119
119
|
}, ue = (e) => {
|
|
120
|
-
(e.x !==
|
|
120
|
+
(e.x !== d.x || e.y !== d.y || e.width !== d.width || e.height !== d.height) && (_?.cancel(), _ = void 0), d = e, je((t) => t.x === e.x && t.y === e.y ? t : {
|
|
121
121
|
x: e.x,
|
|
122
122
|
y: e.y
|
|
123
123
|
}), Ge((t) => t.width === e.width && t.height === e.height ? t : {
|
|
@@ -126,20 +126,23 @@ function nn(i) {
|
|
|
126
126
|
});
|
|
127
127
|
}, Je = () => {
|
|
128
128
|
try {
|
|
129
|
-
|
|
129
|
+
s?.focus({
|
|
130
130
|
preventScroll: !0
|
|
131
131
|
});
|
|
132
132
|
} catch {
|
|
133
133
|
}
|
|
134
134
|
}, Ke = (e) => {
|
|
135
|
-
const t
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
for (const t of e.composedPath()) {
|
|
136
|
+
if (t === s) break;
|
|
137
|
+
if (t instanceof Element && t.matches('button, input, select, textarea, a, [role="button"], [role="menu"], [role="menuitem"], [contenteditable="true"], [tabindex]:not([tabindex="-1"])')) return !1;
|
|
138
|
+
}
|
|
139
|
+
return !0;
|
|
140
|
+
}, fe = (e) => !!s && e instanceof Node && s.contains(e), et = (e) => {
|
|
138
141
|
const o = (e instanceof Element ? e : null)?.closest('[role="menu"], [role="dialog"]')?.closest('[data-floe-surface-floating-layer="true"], [data-floe-dropdown]');
|
|
139
|
-
return !!(o &&
|
|
142
|
+
return !!(o && s?.contains(o));
|
|
140
143
|
}, tt = () => {
|
|
141
|
-
if (!
|
|
142
|
-
const e =
|
|
144
|
+
if (!s) return null;
|
|
145
|
+
const e = s.getBoundingClientRect();
|
|
143
146
|
return {
|
|
144
147
|
x: e.left,
|
|
145
148
|
y: e.top,
|
|
@@ -149,35 +152,35 @@ function nn(i) {
|
|
|
149
152
|
}, Pe = () => {
|
|
150
153
|
if (i.open && !(h === null || f === null) && !(typeof window > "u")) {
|
|
151
154
|
if (f === "drag" && u()) {
|
|
152
|
-
if (Math.hypot(C.x -
|
|
155
|
+
if (Math.hypot(C.x - z.x, C.y - z.y) < 4) return;
|
|
153
156
|
const e = me({
|
|
154
157
|
rect: x,
|
|
155
158
|
minSize: q(),
|
|
156
159
|
maxSize: H(),
|
|
157
160
|
viewport: R(),
|
|
158
|
-
viewportInsets:
|
|
161
|
+
viewportInsets: p(),
|
|
159
162
|
mobile: i.boundary === void 0 && E(),
|
|
160
163
|
mobilePadding: X
|
|
161
|
-
}), t = Math.max(0, Math.min(1, (
|
|
164
|
+
}), t = Math.max(0, Math.min(1, (z.x - F.x) / Math.max(1, F.width))), r = Math.max(0, Math.min(le, z.y - F.y));
|
|
162
165
|
F = {
|
|
163
166
|
...e,
|
|
164
|
-
x:
|
|
165
|
-
y:
|
|
167
|
+
x: z.x - e.width * t,
|
|
168
|
+
y: z.y - r
|
|
166
169
|
}, oe(!1);
|
|
167
170
|
}
|
|
168
171
|
j(xt({
|
|
169
172
|
mode: f,
|
|
170
173
|
pointer: C,
|
|
171
|
-
dragStartPos:
|
|
174
|
+
dragStartPos: z,
|
|
172
175
|
dragStartRect: F,
|
|
173
176
|
dragTitlebarHeight: le,
|
|
174
|
-
resizeStartPos:
|
|
175
|
-
resizeStartRect:
|
|
177
|
+
resizeStartPos: pe,
|
|
178
|
+
resizeStartRect: ze,
|
|
176
179
|
resizeHandle: _e,
|
|
177
180
|
minSize: q(),
|
|
178
181
|
maxSize: H(),
|
|
179
182
|
viewport: R(),
|
|
180
|
-
viewportInsets:
|
|
183
|
+
viewportInsets: p(),
|
|
181
184
|
mobile: i.boundary === void 0 && E(),
|
|
182
185
|
mobilePadding: X
|
|
183
186
|
}));
|
|
@@ -186,7 +189,7 @@ function nn(i) {
|
|
|
186
189
|
if (typeof window > "u") return;
|
|
187
190
|
const t = R();
|
|
188
191
|
if (u() || v()) {
|
|
189
|
-
ue(we(t,
|
|
192
|
+
ue(we(t, p()));
|
|
190
193
|
return;
|
|
191
194
|
}
|
|
192
195
|
let r = me({
|
|
@@ -194,13 +197,13 @@ function nn(i) {
|
|
|
194
197
|
minSize: q(),
|
|
195
198
|
maxSize: H(),
|
|
196
199
|
viewport: t,
|
|
197
|
-
viewportInsets:
|
|
200
|
+
viewportInsets: p(),
|
|
198
201
|
mobile: i.boundary === void 0 && E(),
|
|
199
202
|
mobilePadding: X,
|
|
200
203
|
center: e?.center ?? !1
|
|
201
204
|
});
|
|
202
205
|
if (i.boundary !== void 0 && A && !e?.center) {
|
|
203
|
-
const o = we(t,
|
|
206
|
+
const o = we(t, p());
|
|
204
207
|
r = {
|
|
205
208
|
...r,
|
|
206
209
|
x: o.x + A.x * Math.max(0, o.width - r.width),
|
|
@@ -216,12 +219,12 @@ function nn(i) {
|
|
|
216
219
|
}
|
|
217
220
|
}, Ie = (e) => {
|
|
218
221
|
k !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(k), k = null), e && Pe();
|
|
219
|
-
const t = f === "drag", r = e && !(t && u()) ? tt() ??
|
|
222
|
+
const t = f === "drag", r = e && !(t && u()) ? tt() ?? d : null, o = r ? me({
|
|
220
223
|
rect: r,
|
|
221
224
|
minSize: q(),
|
|
222
225
|
maxSize: H(),
|
|
223
226
|
viewport: R(),
|
|
224
|
-
viewportInsets:
|
|
227
|
+
viewportInsets: p(),
|
|
225
228
|
mobile: i.boundary === void 0 && E(),
|
|
226
229
|
mobilePadding: X
|
|
227
230
|
}) : null;
|
|
@@ -235,9 +238,9 @@ function nn(i) {
|
|
|
235
238
|
$e(o), f === "drag" && Object.assign(x, P);
|
|
236
239
|
}
|
|
237
240
|
h = null, f = null, ye(!1), be(!1);
|
|
238
|
-
}), ce(!1, ""), N = void 0, o && (j(o), t && r &&
|
|
241
|
+
}), ce(!1, ""), N = void 0, o && (j(o), t && r && s?.animate && (r.x !== o.x || r.y !== o.y) && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)) {
|
|
239
242
|
const P = ne(r), U = ne(o);
|
|
240
|
-
_ =
|
|
243
|
+
_ = s.animate([{
|
|
241
244
|
transform: `translate3d(${P.x}px, ${P.y}px, 0)`
|
|
242
245
|
}, {
|
|
243
246
|
transform: `translate3d(${U.x}px, ${U.y}px, 0)`
|
|
@@ -260,7 +263,7 @@ function nn(i) {
|
|
|
260
263
|
mode: "global"
|
|
261
264
|
} : _t({
|
|
262
265
|
owner: ee
|
|
263
|
-
}), o =
|
|
266
|
+
}), o = pt(r, i.boundary, t?.safeArea);
|
|
264
267
|
ge(() => {
|
|
265
268
|
qe(!!(o && o.width > 16 && o.height > 16)), We(o ? {
|
|
266
269
|
x: o.left,
|
|
@@ -303,7 +306,7 @@ function nn(i) {
|
|
|
303
306
|
}
|
|
304
307
|
requestAnimationFrame(t);
|
|
305
308
|
}), I(() => {
|
|
306
|
-
|
|
309
|
+
p(), R(), v(), !(!i.open || !de || h !== null) && W(() => B({
|
|
307
310
|
center: !1
|
|
308
311
|
}));
|
|
309
312
|
}), I(() => {
|
|
@@ -341,24 +344,24 @@ function nn(i) {
|
|
|
341
344
|
}), I(() => {
|
|
342
345
|
if (!i.open) return;
|
|
343
346
|
const e = Se();
|
|
344
|
-
T(), O()?.fixedOffset, j(h === null ? e :
|
|
347
|
+
T(), O()?.fixedOffset, j(h === null ? e : d);
|
|
345
348
|
});
|
|
346
349
|
const nt = (e) => {
|
|
347
|
-
!xe() || v() || h !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [role="tab"], [data-floe-interactive], [contenteditable="true"]') || (e.preventDefault(), _?.cancel(), _ = void 0, le = e.currentTarget instanceof HTMLElement && e.currentTarget.getBoundingClientRect().height || 32, h = e.pointerId, f = "drag", ye(!0),
|
|
350
|
+
!xe() || v() || h !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [role="tab"], [data-floe-interactive], [contenteditable="true"]') || (e.preventDefault(), _?.cancel(), _ = void 0, le = e.currentTarget instanceof HTMLElement && e.currentTarget.getBoundingClientRect().height || 32, h = e.pointerId, f = "drag", ye(!0), z = {
|
|
348
351
|
x: e.clientX,
|
|
349
352
|
y: e.clientY
|
|
350
353
|
}, F = {
|
|
351
|
-
...
|
|
354
|
+
...d
|
|
352
355
|
}, C = {
|
|
353
356
|
x: e.clientX,
|
|
354
357
|
y: e.clientY
|
|
355
358
|
}, ce(!0, "grabbing"), Ce(e));
|
|
356
359
|
}, $ = (e) => (t) => {
|
|
357
|
-
!ve() || u() || v() || h !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), h = t.pointerId, f = "resize", be(!0), _e = e,
|
|
360
|
+
!ve() || u() || v() || h !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), h = t.pointerId, f = "resize", be(!0), _e = e, pe = {
|
|
358
361
|
x: t.clientX,
|
|
359
362
|
y: t.clientY
|
|
360
|
-
},
|
|
361
|
-
...
|
|
363
|
+
}, ze = {
|
|
364
|
+
...d
|
|
362
365
|
}, C = {
|
|
363
366
|
x: t.clientX,
|
|
364
367
|
y: t.clientY
|
|
@@ -380,7 +383,7 @@ function nn(i) {
|
|
|
380
383
|
N = vt({
|
|
381
384
|
pointerEvent: e,
|
|
382
385
|
// Keep click/double-click targeting on the titlebar while retaining capture.
|
|
383
|
-
captureEl: f === "drag" ? se :
|
|
386
|
+
captureEl: f === "drag" ? se : s,
|
|
384
387
|
onMove: it,
|
|
385
388
|
onEnd: ({
|
|
386
389
|
commit: t,
|
|
@@ -398,7 +401,7 @@ function nn(i) {
|
|
|
398
401
|
}, ot = (e) => {
|
|
399
402
|
e.target?.closest('button, input, select, textarea, a, [role="button"], [role="tab"], [data-floe-interactive], [contenteditable="true"]') || Ae();
|
|
400
403
|
}, rt = (e) => {
|
|
401
|
-
Ke(e
|
|
404
|
+
Ke(e) && Je();
|
|
402
405
|
}, S = (e) => J("absolute z-10", {
|
|
403
406
|
n: "cursor-ns-resize top-0 left-2 right-2 h-1",
|
|
404
407
|
s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
|
|
@@ -421,7 +424,7 @@ function nn(i) {
|
|
|
421
424
|
get children() {
|
|
422
425
|
var e = Lt(), t = e.firstChild, r = t.firstChild, o = r.firstChild, P = o.nextSibling, U = r.nextSibling;
|
|
423
426
|
Q((n) => {
|
|
424
|
-
|
|
427
|
+
s = n, W(() => j(Se()));
|
|
425
428
|
}, e), ke(e, Oe({
|
|
426
429
|
get "data-floating-presence"() {
|
|
427
430
|
return M.state();
|
|
@@ -457,7 +460,7 @@ function nn(i) {
|
|
|
457
460
|
}), !1, !0);
|
|
458
461
|
var Ee = ae;
|
|
459
462
|
typeof Ee == "function" ? Q(Ee, t) : ae = t, ke(t, Oe({
|
|
460
|
-
[
|
|
463
|
+
[zt]: "true"
|
|
461
464
|
}, {
|
|
462
465
|
"data-floe-floating-window-surface": "true",
|
|
463
466
|
"data-floe-surface": "floating",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { cn as
|
|
4
|
-
var ne = /* @__PURE__ */
|
|
1
|
+
import { use as P, spread as Q, mergeProps as U, insert as y, createComponent as W, effect as j, setAttribute as S, setStyleProperty as c, className as D, template as F, memo as X, delegateEvents as Y } from "solid-js/web";
|
|
2
|
+
import { splitProps as Z, createSignal as V, createEffect as ee, onMount as te, onCleanup as q, For as B, untrack as oe } from "solid-js";
|
|
3
|
+
import { cn as E } from "../../utils/cn.js";
|
|
4
|
+
var re = /* @__PURE__ */ F('<span class="inline-flex items-center gap-1.5"><span class=floe-segmented-control__label>'), ne = /* @__PURE__ */ F("<div role=group data-floe-surface=inset data-floe-surface-part=rail><span aria-hidden=true><span class=floe-segmented-control__ink>"), ie = /* @__PURE__ */ F("<span class=floe-segmented-control__ink-label>"), ae = /* @__PURE__ */ F("<button type=button role=radio data-floe-surface-part=segment data-floe-interactive=item>");
|
|
5
5
|
const le = {
|
|
6
6
|
sm: {
|
|
7
7
|
container: "p-0.5 gap-0.5",
|
|
@@ -19,70 +19,80 @@ const le = {
|
|
|
19
19
|
icon: "w-4 h-4"
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
function fe(
|
|
23
|
-
const [l,
|
|
24
|
-
let
|
|
25
|
-
const [
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
|
|
22
|
+
function fe(G) {
|
|
23
|
+
const [l, I] = Z(G, ["value", "onChange", "options", "size", "disabled", "class"]);
|
|
24
|
+
let m, g, h;
|
|
25
|
+
const [_, J] = V({}), w = /* @__PURE__ */ new Map(), [d, M] = V();
|
|
26
|
+
let b, x, $, z;
|
|
27
|
+
const O = () => {
|
|
28
|
+
const n = w.get(l.value);
|
|
29
|
+
if (!m || !n) {
|
|
30
|
+
x?.cancel(), $?.cancel(), M(void 0), z = void 0;
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
33
|
+
if (!n.offsetWidth || !m.getClientRects().length) return;
|
|
34
|
+
const o = {
|
|
35
|
+
x: n.offsetLeft,
|
|
36
|
+
y: n.offsetTop,
|
|
37
|
+
width: n.offsetWidth,
|
|
38
|
+
height: n.offsetHeight
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
x:
|
|
42
|
-
y:
|
|
43
|
-
width:
|
|
44
|
-
height:
|
|
40
|
+
J(Object.fromEntries([...w].map(([i, t]) => [i, {
|
|
41
|
+
x: t.offsetLeft,
|
|
42
|
+
y: t.offsetTop,
|
|
43
|
+
width: t.offsetWidth,
|
|
44
|
+
height: t.offsetHeight
|
|
45
45
|
}])));
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
transform:
|
|
50
|
-
width:
|
|
51
|
-
} : void 0, e =
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
transform: `translate(${
|
|
56
|
-
width: `${
|
|
46
|
+
const s = oe(d);
|
|
47
|
+
if (s && Object.keys(o).every((i) => o[i] === s[i]) && z === l.value) return;
|
|
48
|
+
const u = s && z !== l.value && g && !window.matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active)").matches, p = u ? getComputedStyle(g) : void 0, k = p ? {
|
|
49
|
+
transform: p.transform,
|
|
50
|
+
width: p.width
|
|
51
|
+
} : void 0, e = u && h ? getComputedStyle(h).transform : void 0;
|
|
52
|
+
if (x?.cancel(), $?.cancel(), M(o), z = l.value, k && g) {
|
|
53
|
+
const i = getComputedStyle(m), t = i.getPropertyValue("--floe-duration-slow").trim(), a = parseFloat(t) * (t.endsWith("ms") ? 1 : 1e3);
|
|
54
|
+
x = g.animate([k, {
|
|
55
|
+
transform: `translate(${o.x}px, ${o.y}px)`,
|
|
56
|
+
width: `${o.width}px`
|
|
57
57
|
}], {
|
|
58
58
|
// Position changes need visible travel: the fast entrance curve
|
|
59
59
|
// covers almost 90% of this short rail in its first 60ms.
|
|
60
|
-
duration: Number.isFinite(
|
|
61
|
-
easing:
|
|
62
|
-
}),
|
|
60
|
+
duration: Number.isFinite(a) ? a : 280,
|
|
61
|
+
easing: i.getPropertyValue("--floe-ease-in-out").trim() || "ease-in-out"
|
|
62
|
+
}), x.id = "floe-segmented-selection", h && e && ($ = h.animate([{
|
|
63
63
|
transform: e
|
|
64
64
|
}, {
|
|
65
|
-
transform: `translate(${-
|
|
66
|
-
}],
|
|
65
|
+
transform: `translate(${-o.x}px, ${-o.y}px)`
|
|
66
|
+
}], x.effect.getTiming()), $.id = "floe-segmented-ink");
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
l.value, l.options, l.size,
|
|
71
|
-
}),
|
|
69
|
+
ee(() => {
|
|
70
|
+
l.value, l.options, l.size, O();
|
|
71
|
+
}), te(() => {
|
|
72
72
|
if (typeof ResizeObserver < "u") {
|
|
73
|
-
|
|
74
|
-
for (const
|
|
73
|
+
b = new ResizeObserver(O), b.observe(m);
|
|
74
|
+
for (const n of w.values()) b.observe(n);
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
}),
|
|
78
|
-
|
|
76
|
+
O();
|
|
77
|
+
}), q(() => {
|
|
78
|
+
b?.disconnect(), x?.cancel(), $?.cancel();
|
|
79
79
|
});
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const R = () => l.size ?? "md", T = () => le[R()], A = (n) => (() => {
|
|
81
|
+
var o = re(), s = o.firstChild;
|
|
82
|
+
return y(o, (() => {
|
|
83
|
+
var u = X(() => !!n.icon);
|
|
84
|
+
return () => u() && W(n.icon, {
|
|
85
|
+
get class() {
|
|
86
|
+
return T().icon;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
})(), s), y(s, () => n.label), o;
|
|
90
|
+
})(), K = (n, o) => {
|
|
91
|
+
l.disabled || o || n !== l.value && l.onChange(n);
|
|
82
92
|
};
|
|
83
93
|
return (() => {
|
|
84
|
-
var
|
|
85
|
-
typeof
|
|
94
|
+
var n = ne(), o = n.firstChild, s = o.firstChild, u = m;
|
|
95
|
+
typeof u == "function" ? P(u, n) : m = n, Q(n, U({
|
|
86
96
|
get "data-floe-segmented-pill"() {
|
|
87
97
|
return d() ? "true" : void 0;
|
|
88
98
|
},
|
|
@@ -90,58 +100,44 @@ function fe(J) {
|
|
|
90
100
|
return d() ? "ready" : void 0;
|
|
91
101
|
},
|
|
92
102
|
get class() {
|
|
93
|
-
return
|
|
103
|
+
return E("floe-segmented-control relative inline-flex items-center border", "rounded-group", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", T().container, l.disabled && "opacity-50 pointer-events-none", l.class);
|
|
94
104
|
}
|
|
95
|
-
},
|
|
96
|
-
var
|
|
97
|
-
typeof
|
|
98
|
-
var
|
|
99
|
-
return typeof
|
|
105
|
+
}, I), !1, !0);
|
|
106
|
+
var p = g;
|
|
107
|
+
typeof p == "function" ? P(p, o) : g = o;
|
|
108
|
+
var k = h;
|
|
109
|
+
return typeof k == "function" ? P(k, s) : h = s, y(s, W(B, {
|
|
100
110
|
get each() {
|
|
101
111
|
return l.options;
|
|
102
112
|
},
|
|
103
113
|
children: (e) => (() => {
|
|
104
|
-
var
|
|
105
|
-
return
|
|
106
|
-
var
|
|
107
|
-
return ()
|
|
108
|
-
get class() {
|
|
109
|
-
return O().icon;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
})(), n), p(n, () => e.label), M((i) => {
|
|
113
|
-
var v = e.value, t = `${P()[e.value]?.x ?? 0}px`, k = `${P()[e.value]?.y ?? 0}px`, _ = `${P()[e.value]?.width ?? 0}px`, S = `${P()[e.value]?.height ?? 0}px`;
|
|
114
|
-
return v !== i.e && z(o, "data-segmented-label", i.e = v), t !== i.t && c(o, "left", i.t = t), k !== i.a && c(o, "top", i.a = k), _ !== i.o && c(o, "width", i.o = _), S !== i.i && c(o, "height", i.i = S), i;
|
|
114
|
+
var i = ie();
|
|
115
|
+
return y(i, () => A(e)), j((t) => {
|
|
116
|
+
var a = e.value, r = `${_()[e.value]?.x ?? 0}px`, f = `${_()[e.value]?.y ?? 0}px`, v = `${_()[e.value]?.width ?? 0}px`, C = `${_()[e.value]?.height ?? 0}px`;
|
|
117
|
+
return a !== t.e && S(i, "data-segmented-label", t.e = a), r !== t.t && c(i, "left", t.t = r), f !== t.a && c(i, "top", t.a = f), v !== t.o && c(i, "width", t.o = v), C !== t.i && c(i, "height", t.i = C), t;
|
|
115
118
|
}, {
|
|
116
119
|
e: void 0,
|
|
117
120
|
t: void 0,
|
|
118
121
|
a: void 0,
|
|
119
122
|
o: void 0,
|
|
120
123
|
i: void 0
|
|
121
|
-
}),
|
|
124
|
+
}), i;
|
|
122
125
|
})()
|
|
123
|
-
})),
|
|
126
|
+
})), y(n, W(B, {
|
|
124
127
|
get each() {
|
|
125
128
|
return l.options;
|
|
126
129
|
},
|
|
127
130
|
children: (e) => {
|
|
128
|
-
const
|
|
131
|
+
const i = () => l.value === e.value, t = () => l.disabled || e.disabled;
|
|
129
132
|
return (() => {
|
|
130
|
-
var
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
var a = ae();
|
|
134
|
+
return a.$$click = () => K(e.value, e.disabled), P((r) => {
|
|
135
|
+
w.set(e.value, r), b?.observe(r), q(() => {
|
|
136
|
+
b?.unobserve(r), w.delete(e.value);
|
|
134
137
|
});
|
|
135
|
-
},
|
|
136
|
-
var t =
|
|
137
|
-
return ()
|
|
138
|
-
get class() {
|
|
139
|
-
return O().icon;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
})(), v), p(v, () => e.label), M((t) => {
|
|
143
|
-
var k = e.label, _ = e.label, S = o() ? "raised" : "flat", L = o(), N = s(), D = R("floe-segmented-control__item relative font-medium cursor-pointer border", "transition-[background-color,border-color,color,box-shadow] duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--floe-plane)]", O().button, o() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", s() && "cursor-not-allowed opacity-50");
|
|
144
|
-
return k !== t.e && z(n, "aria-label", t.e = k), _ !== t.t && z(n, "title", t.t = _), S !== t.a && z(n, "data-floe-surface", t.a = S), L !== t.o && z(n, "aria-checked", t.o = L), N !== t.i && (n.disabled = t.i = N), D !== t.n && q(n, t.n = D), t;
|
|
138
|
+
}, a), y(a, () => A(e)), j((r) => {
|
|
139
|
+
var f = e.label, v = e.label, C = i() ? "raised" : "flat", H = i(), L = t(), N = E("floe-segmented-control__item relative inline-flex items-center justify-center font-medium cursor-pointer border", "transition-[background-color,border-color,color,box-shadow] duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--floe-plane)]", T().button, i() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", t() && "cursor-not-allowed opacity-50");
|
|
140
|
+
return f !== r.e && S(a, "aria-label", r.e = f), v !== r.t && S(a, "title", r.t = v), C !== r.a && S(a, "data-floe-surface", r.a = C), H !== r.o && S(a, "aria-checked", r.o = H), L !== r.i && (a.disabled = r.i = L), N !== r.n && D(a, r.n = N), r;
|
|
145
141
|
}, {
|
|
146
142
|
e: void 0,
|
|
147
143
|
t: void 0,
|
|
@@ -149,12 +145,12 @@ function fe(J) {
|
|
|
149
145
|
o: void 0,
|
|
150
146
|
i: void 0,
|
|
151
147
|
n: void 0
|
|
152
|
-
}),
|
|
148
|
+
}), a;
|
|
153
149
|
})();
|
|
154
150
|
}
|
|
155
|
-
}), null),
|
|
156
|
-
var
|
|
157
|
-
return
|
|
151
|
+
}), null), j((e) => {
|
|
152
|
+
var i = E("floe-segmented-control__pill", R() === "lg" ? "rounded-md" : "rounded-sm"), t = d() ? "visible" : "hidden", a = `translate(${d()?.x ?? 0}px, ${d()?.y ?? 0}px)`, r = `${d()?.width ?? 0}px`, f = `${d()?.height ?? 0}px`, v = `translate(${-(d()?.x ?? 0)}px, ${-(d()?.y ?? 0)}px)`;
|
|
153
|
+
return i !== e.e && D(o, e.e = i), t !== e.t && c(o, "visibility", e.t = t), a !== e.a && c(o, "transform", e.a = a), r !== e.o && c(o, "width", e.o = r), f !== e.i && c(o, "height", e.i = f), v !== e.n && c(s, "transform", e.n = v), e;
|
|
158
154
|
}, {
|
|
159
155
|
e: void 0,
|
|
160
156
|
t: void 0,
|
|
@@ -162,10 +158,10 @@ function fe(J) {
|
|
|
162
158
|
o: void 0,
|
|
163
159
|
i: void 0,
|
|
164
160
|
n: void 0
|
|
165
|
-
}),
|
|
161
|
+
}), n;
|
|
166
162
|
})();
|
|
167
163
|
}
|
|
168
|
-
|
|
164
|
+
Y(["click"]);
|
|
169
165
|
export {
|
|
170
166
|
fe as SegmentedControl
|
|
171
167
|
};
|