react-tiling-workspace 0.0.0-stage → 0.1.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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -2
  3. package/dist/components/LayoutPickerDialog-C-Sb3uOl.cjs +517 -0
  4. package/dist/components/LayoutPickerDialog-C-Sb3uOl.cjs.map +1 -0
  5. package/dist/components/LayoutPickerDialog-STglqYFI.mjs +500 -0
  6. package/dist/components/LayoutPickerDialog-STglqYFI.mjs.map +1 -0
  7. package/dist/components/icons-0kjsH_LJ.cjs +144 -0
  8. package/dist/components/icons-0kjsH_LJ.cjs.map +1 -0
  9. package/dist/components/icons-BgtEPXL8.mjs +97 -0
  10. package/dist/components/icons-BgtEPXL8.mjs.map +1 -0
  11. package/dist/components/layout-picker.cjs +5 -0
  12. package/dist/components/layout-picker.d.cts +22 -0
  13. package/dist/components/layout-picker.d.mts +22 -0
  14. package/dist/components/layout-picker.mjs +2 -0
  15. package/dist/components/mobile.cjs +575 -0
  16. package/dist/components/mobile.cjs.map +1 -0
  17. package/dist/components/mobile.d.cts +42 -0
  18. package/dist/components/mobile.d.mts +42 -0
  19. package/dist/components/mobile.mjs +574 -0
  20. package/dist/components/mobile.mjs.map +1 -0
  21. package/dist/components/topbar.cjs +94 -0
  22. package/dist/components/topbar.cjs.map +1 -0
  23. package/dist/components/topbar.d.cts +38 -0
  24. package/dist/components/topbar.d.mts +38 -0
  25. package/dist/components/topbar.mjs +93 -0
  26. package/dist/components/topbar.mjs.map +1 -0
  27. package/dist/components/types-DkwWFcD5.d.mts +32 -0
  28. package/dist/components/types-qsXC_48o.d.cts +32 -0
  29. package/dist/index.cjs +3336 -0
  30. package/dist/index.cjs.map +1 -0
  31. package/dist/index.d.cts +243 -0
  32. package/dist/index.d.mts +243 -0
  33. package/dist/index.mjs +3320 -0
  34. package/dist/index.mjs.map +1 -0
  35. package/dist/server/server.cjs +104 -0
  36. package/dist/server/server.cjs.map +1 -0
  37. package/dist/server/server.d.cts +71 -0
  38. package/dist/server/server.d.mts +71 -0
  39. package/dist/server/server.mjs +95 -0
  40. package/dist/server/server.mjs.map +1 -0
  41. package/dist/server/shortcuts.cjs +32 -0
  42. package/dist/server/shortcuts.cjs.map +1 -0
  43. package/dist/server/shortcuts.d.cts +6 -0
  44. package/dist/server/shortcuts.d.mts +6 -0
  45. package/dist/server/shortcuts.mjs +31 -0
  46. package/dist/server/shortcuts.mjs.map +1 -0
  47. package/dist/theme.css +119 -0
  48. package/package.json +113 -4
@@ -0,0 +1,574 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
3
+ import { a as LoaderIcon, o as MenuIcon, r as CloseIcon } from "./icons-BgtEPXL8.mjs";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/MobileBottomBar.tsx
6
+ const NAV_HEIGHT_PX = 64;
7
+ const NAV_BORDER_PX = 1;
8
+ const MAX_SLOTS = 5;
9
+ const KNOB_RADIUS_PX = 18;
10
+ const TAB_KNOB_START_PX = 9;
11
+ const FILLET_PX = 26;
12
+ const PANEL_GAP_PX = 10;
13
+ const PANEL_PAD_X_PX = 6;
14
+ const PANEL_PAD_Y_PX = 4;
15
+ const PANEL_EDGE_PX = 10;
16
+ const PANEL_CORNER_PX = 18;
17
+ const ITEM_WIDTH_PX = 76;
18
+ const ITEM_HEIGHT_PX = 48;
19
+ const ITEM_GAP_PX = 4;
20
+ const EASE_OUT = "ease-[cubic-bezier(0.22,1,0.36,1)]";
21
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
22
+ const clamp01 = (value) => Math.min(1, Math.max(0, value));
23
+ const lerp = (a, b, t) => a + (b - a) * t;
24
+ const roundHalf = (value) => Math.round(value * 2) / 2;
25
+ const f = (value) => Math.round(value * 100) / 100;
26
+ /**
27
+ * One continuous outline: a rounded pill, two concave fillets, and a circular knob.
28
+ * `p` is the morph progress: at 0 the shape is only the knob, at 1 the pill has
29
+ * been pushed up out of it with the neck stretched between the two. It can go a
30
+ * touch past 1 (spring overshoot), which gives the liquid feel.
31
+ */
32
+ function buildMorphPath(g, rawP) {
33
+ const p = Math.max(0, rawP);
34
+ const pw = Math.min(1, p * 1.08);
35
+ const { cx, ky, kr, pillH } = g;
36
+ const k = lerp(g.knobFrom, kr, clamp01(p * 4));
37
+ const knobL = cx - k;
38
+ const knobR = cx + k;
39
+ const L = lerp(knobL, g.left, pw);
40
+ const R = lerp(knobR, g.right, pw);
41
+ const T = ky * (1 - p);
42
+ const B = ky - (ky - pillH) * p;
43
+ const h = B - T;
44
+ const rt = Math.min(g.corner, h / 2, (R - L) / 2);
45
+ const K = .5523;
46
+ const reach = FILLET_PX * pw;
47
+ const edgeThreshold = rt + 6;
48
+ const rightRoom = R - knobR;
49
+ const mergeRight = rightRoom < edgeThreshold;
50
+ let rightSideCmds;
51
+ if (mergeRight) {
52
+ const joinY = Math.max(T + rt, B - (edgeThreshold - rightRoom) * .85 * pw);
53
+ const midY = (joinY + ky) / 2;
54
+ rightSideCmds = [`L ${f(R)} ${f(joinY)}`, `C ${f(R)} ${f(midY)} ${f(knobR)} ${f(midY)} ${f(knobR)} ${f(ky)}`];
55
+ } else {
56
+ const rbR = Math.min(rt, Math.max(rightRoom - 6, 4));
57
+ const filletR = Math.min(R - rbR, knobR + reach);
58
+ const neckY = ky - (ky - B) * K;
59
+ rightSideCmds = [
60
+ `L ${f(R)} ${f(B - rbR)}`,
61
+ `Q ${f(R)} ${f(B)} ${f(R - rbR)} ${f(B)}`,
62
+ `L ${f(filletR)} ${f(B)}`,
63
+ `C ${f(filletR + (knobR - filletR) * K)} ${f(B)} ${f(knobR)} ${f(neckY)} ${f(knobR)} ${f(ky)}`
64
+ ];
65
+ }
66
+ const leftRoom = knobL - L;
67
+ const mergeLeft = leftRoom < edgeThreshold;
68
+ let leftSideCmds;
69
+ if (mergeLeft) {
70
+ const joinY = Math.max(T + rt, B - (edgeThreshold - leftRoom) * .85 * pw);
71
+ const midY = (joinY + ky) / 2;
72
+ leftSideCmds = [`C ${f(knobL)} ${f(midY)} ${f(L)} ${f(midY)} ${f(L)} ${f(joinY)}`];
73
+ } else {
74
+ const rbL = Math.min(rt, Math.max(leftRoom - 6, 4));
75
+ const filletL = Math.max(L + rbL, knobL - reach);
76
+ const neckY = ky - (ky - B) * K;
77
+ leftSideCmds = [
78
+ `C ${f(knobL)} ${f(neckY)} ${f(filletL + (knobL - filletL) * K)} ${f(B)} ${f(filletL)} ${f(B)}`,
79
+ `L ${f(L + rbL)} ${f(B)}`,
80
+ `Q ${f(L)} ${f(B)} ${f(L)} ${f(B - rbL)}`
81
+ ];
82
+ }
83
+ return [
84
+ `M ${f(L + rt)} ${f(T)}`,
85
+ `L ${f(R - rt)} ${f(T)}`,
86
+ `Q ${f(R)} ${f(T)} ${f(R)} ${f(T + rt)}`,
87
+ ...rightSideCmds,
88
+ `A ${f(k)} ${f(k)} 0 1 1 ${f(knobL)} ${f(ky)}`,
89
+ ...leftSideCmds,
90
+ `L ${f(L)} ${f(T + rt)}`,
91
+ `Q ${f(L)} ${f(T)} ${f(L + rt)} ${f(T)}`,
92
+ "Z"
93
+ ].join(" ");
94
+ }
95
+ /**
96
+ * Mobile bottom navigation.
97
+ *
98
+ * - A soft pill glides behind the active tab.
99
+ * - A submenu pops out of whichever slot opens it: the trigger becomes a circular
100
+ * knob, and the submenu is one fluid shape fused to it with smooth concave
101
+ * curves, in the same colour. The shape is morphed on a spring, so it truly
102
+ * stretches up out of the button instead of just scaling in.
103
+ * - `action` slots get a quiet filled well, `accent` is a circular accent button.
104
+ * Everything stays inside the bar.
105
+ * - Colours come from `--rtw-*` CSS variables so the host theme stays in control.
106
+ */
107
+ function MobileBottomBar({ items, activeId, onSelect, ariaLabel = "Mobile navigation", zIndexClassName = "z-30" }) {
108
+ const navRef = useRef(null);
109
+ const panelRef = useRef(null);
110
+ const pathRef = useRef(null);
111
+ const triggerRef = useRef(null);
112
+ const geometryRef = useRef(null);
113
+ const lastDrawnGeometryRef = useRef(null);
114
+ const switchTweenRef = useRef(null);
115
+ const phaseRef = useRef("closed");
116
+ const menuIdRef = useRef(null);
117
+ const pendingRef = useRef(null);
118
+ const openedByKeyboardRef = useRef(false);
119
+ const progressRef = useRef(0);
120
+ const velocityRef = useRef(0);
121
+ const targetRef = useRef(0);
122
+ const rafRef = useRef(null);
123
+ const lastFrameRef = useRef(0);
124
+ const finishCloseRef = useRef(() => {});
125
+ const closeMenuRef = useRef(() => {});
126
+ const submenuId = useId();
127
+ const [mountedMenuId, setMountedMenuId] = useState(null);
128
+ const [isOpen, setIsOpen] = useState(false);
129
+ const [navWidth, setNavWidth] = useState(375);
130
+ const [anchor, setAnchor] = useState({
131
+ x: 187,
132
+ y: 25
133
+ });
134
+ const [pill, setPill] = useState({
135
+ x: 0,
136
+ width: 0,
137
+ visible: false,
138
+ instant: true
139
+ });
140
+ const accentItem = items.find((item) => item.variant === "accent") ?? null;
141
+ const otherItems = items.filter((item) => item.variant !== "accent");
142
+ const maxOthers = accentItem ? 4 : MAX_SLOTS;
143
+ const needsOverflow = otherItems.length > maxOthers;
144
+ const visibleItems = needsOverflow ? otherItems.slice(0, maxOthers - 1) : otherItems;
145
+ const overflowItems = needsOverflow ? otherItems.slice(maxOthers - 1) : [];
146
+ const moreItem = needsOverflow ? {
147
+ id: "__overflow__",
148
+ label: "More",
149
+ icon: /* @__PURE__ */ jsx(MenuIcon, {}),
150
+ variant: "submenu",
151
+ active: overflowItems.some((item) => activeId === item.id || item.active),
152
+ subItems: overflowItems.map((item) => ({
153
+ id: item.id,
154
+ label: item.label,
155
+ icon: item.icon,
156
+ active: activeId === item.id || Boolean(item.active),
157
+ onSelect: () => {
158
+ if (item.onClick) item.onClick();
159
+ else onSelect?.(item.id);
160
+ }
161
+ }))
162
+ } : null;
163
+ const row = moreItem ? [...visibleItems, moreItem] : visibleItems;
164
+ const centerIndex = Math.ceil(row.length / 2);
165
+ const slots = accentItem ? [
166
+ ...row.slice(0, centerIndex),
167
+ accentItem,
168
+ ...row.slice(centerIndex)
169
+ ] : row;
170
+ const menuItem = slots.find((item) => item.id === mountedMenuId) ?? null;
171
+ const subItems = menuItem?.subItems ?? [];
172
+ const openMenuId = isOpen ? mountedMenuId : null;
173
+ let geometry = null;
174
+ let panel = {
175
+ left: 0,
176
+ width: 0,
177
+ top: 0,
178
+ height: 0,
179
+ svgHeight: 0
180
+ };
181
+ if (menuItem && subItems.length > 0) {
182
+ const cols = Math.min(4, subItems.length);
183
+ const rows = Math.ceil(subItems.length / cols);
184
+ const pillH = rows * ITEM_HEIGHT_PX + (rows - 1) * ITEM_GAP_PX + 8;
185
+ const layoutCols = Math.max(cols, 2);
186
+ const idealWidth = layoutCols * ITEM_WIDTH_PX + (layoutCols - 1) * ITEM_GAP_PX + 12;
187
+ const width = Math.min(idealWidth, navWidth - 20);
188
+ const left = clamp(anchor.x - width / 2, PANEL_EDGE_PX, navWidth - width - PANEL_EDGE_PX);
189
+ const ky = pillH + PANEL_GAP_PX + anchor.y;
190
+ geometry = {
191
+ cx: anchor.x,
192
+ ky,
193
+ kr: KNOB_RADIUS_PX,
194
+ knobFrom: menuItem.variant === "accent" ? KNOB_RADIUS_PX : TAB_KNOB_START_PX,
195
+ left: Math.min(left, anchor.x - KNOB_RADIUS_PX),
196
+ right: Math.max(left + width, anchor.x + KNOB_RADIUS_PX),
197
+ pillH,
198
+ corner: PANEL_CORNER_PX
199
+ };
200
+ panel = {
201
+ left,
202
+ width,
203
+ top: anchor.y - NAV_BORDER_PX - ky,
204
+ height: pillH,
205
+ svgHeight: ky + KNOB_RADIUS_PX + 2
206
+ };
207
+ }
208
+ const gridCols = Math.min(4, Math.max(1, subItems.length));
209
+ const prefersReducedMotion = useCallback(() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, []);
210
+ const draw = useCallback((progress, now = performance.now()) => {
211
+ const path = pathRef.current;
212
+ const targetG = geometryRef.current;
213
+ if (!path || !targetG) return;
214
+ let g = targetG;
215
+ const tween = switchTweenRef.current;
216
+ if (tween) {
217
+ const rawT = clamp01((now - tween.startTime) / tween.duration);
218
+ const t = 1 - Math.pow(1 - rawT, 3);
219
+ g = {
220
+ cx: lerp(tween.from.cx, targetG.cx, t),
221
+ ky: lerp(tween.from.ky, targetG.ky, t),
222
+ kr: lerp(tween.from.kr, targetG.kr, t),
223
+ knobFrom: lerp(tween.from.knobFrom, targetG.knobFrom, t),
224
+ left: lerp(tween.from.left, targetG.left, t),
225
+ right: lerp(tween.from.right, targetG.right, t),
226
+ pillH: lerp(tween.from.pillH, targetG.pillH, t),
227
+ corner: lerp(tween.from.corner, targetG.corner, t)
228
+ };
229
+ if (rawT >= 1) switchTweenRef.current = null;
230
+ }
231
+ lastDrawnGeometryRef.current = g;
232
+ path.setAttribute("d", buildMorphPath(g, progress));
233
+ }, []);
234
+ const tick = useCallback((now) => {
235
+ const dt = clamp((now - lastFrameRef.current) / 1e3, .001, .032);
236
+ lastFrameRef.current = now;
237
+ const target = targetRef.current;
238
+ const opening = target === 1;
239
+ const stiffness = opening ? 340 : 880;
240
+ const damping = opening ? 26 : 58;
241
+ let p = progressRef.current;
242
+ let v = velocityRef.current;
243
+ const h = dt / 2;
244
+ for (let i = 0; i < 2; i += 1) {
245
+ v += (stiffness * (target - p) - damping * v) * h;
246
+ p += v * h;
247
+ }
248
+ if (!opening && p < 0) {
249
+ p = 0;
250
+ v = 0;
251
+ }
252
+ progressRef.current = p;
253
+ velocityRef.current = v;
254
+ draw(p, now);
255
+ if (Math.abs(target - p) < .001 && Math.abs(v) < .02 && switchTweenRef.current === null) {
256
+ progressRef.current = target;
257
+ velocityRef.current = 0;
258
+ draw(target, now);
259
+ rafRef.current = null;
260
+ if (target === 0) finishCloseRef.current();
261
+ return;
262
+ }
263
+ rafRef.current = window.requestAnimationFrame(tick);
264
+ }, [draw]);
265
+ const animateTo = useCallback((target) => {
266
+ targetRef.current = target;
267
+ if (prefersReducedMotion()) {
268
+ if (rafRef.current !== null) window.cancelAnimationFrame(rafRef.current);
269
+ rafRef.current = null;
270
+ progressRef.current = target;
271
+ velocityRef.current = 0;
272
+ draw(target);
273
+ if (target === 0) finishCloseRef.current();
274
+ return;
275
+ }
276
+ if (rafRef.current === null) {
277
+ lastFrameRef.current = performance.now();
278
+ rafRef.current = window.requestAnimationFrame(tick);
279
+ }
280
+ }, [
281
+ draw,
282
+ prefersReducedMotion,
283
+ tick
284
+ ]);
285
+ useEffect(() => () => {
286
+ if (rafRef.current !== null) window.cancelAnimationFrame(rafRef.current);
287
+ }, []);
288
+ const measure = useCallback(() => {
289
+ const nav = navRef.current;
290
+ if (!nav) return;
291
+ const navRect = nav.getBoundingClientRect();
292
+ setNavWidth((prev) => prev === navRect.width ? prev : navRect.width);
293
+ const trigger = triggerRef.current;
294
+ if (trigger?.isConnected && nav.contains(trigger)) {
295
+ const rect = (trigger.querySelector("[data-anchor]") ?? trigger).getBoundingClientRect();
296
+ const x = roundHalf(rect.left - navRect.left + rect.width / 2);
297
+ const y = roundHalf(rect.top - navRect.top + rect.height / 2);
298
+ setAnchor((prev) => prev.x === x && prev.y === y ? prev : {
299
+ x,
300
+ y
301
+ });
302
+ }
303
+ const pillTarget = nav.querySelector("[data-pill-target=\"true\"]");
304
+ if (pillTarget) {
305
+ const rect = pillTarget.getBoundingClientRect();
306
+ const x = roundHalf(rect.left - navRect.left);
307
+ const width = roundHalf(rect.width);
308
+ setPill((prev) => {
309
+ const next = {
310
+ x,
311
+ width,
312
+ visible: true,
313
+ instant: !prev.visible
314
+ };
315
+ return prev.x === next.x && prev.width === next.width && prev.visible === next.visible && prev.instant === next.instant ? prev : next;
316
+ });
317
+ } else setPill((prev) => prev.visible ? {
318
+ ...prev,
319
+ visible: false,
320
+ instant: false
321
+ } : prev);
322
+ }, []);
323
+ useLayoutEffect(() => {
324
+ measure();
325
+ geometryRef.current = geometry;
326
+ if (geometry) draw(progressRef.current);
327
+ });
328
+ useLayoutEffect(() => {
329
+ const nav = navRef.current;
330
+ if (!nav) return;
331
+ window.addEventListener("resize", measure);
332
+ window.addEventListener("orientationchange", measure);
333
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
334
+ observer?.observe(nav);
335
+ return () => {
336
+ window.removeEventListener("resize", measure);
337
+ window.removeEventListener("orientationchange", measure);
338
+ observer?.disconnect();
339
+ };
340
+ }, [measure]);
341
+ function openMenu(id, trigger, viaKeyboard) {
342
+ const isSwitching = phaseRef.current !== "closed" && menuIdRef.current !== id;
343
+ if (isSwitching && !prefersReducedMotion() && lastDrawnGeometryRef.current) switchTweenRef.current = {
344
+ from: lastDrawnGeometryRef.current,
345
+ startTime: performance.now(),
346
+ duration: 220
347
+ };
348
+ else if (!isSwitching) switchTweenRef.current = null;
349
+ pendingRef.current = null;
350
+ openedByKeyboardRef.current = viaKeyboard;
351
+ triggerRef.current = trigger;
352
+ measure();
353
+ if (phaseRef.current === "closed") {
354
+ progressRef.current = 0;
355
+ velocityRef.current = 0;
356
+ }
357
+ phaseRef.current = "open";
358
+ menuIdRef.current = id;
359
+ setMountedMenuId(id);
360
+ setIsOpen(true);
361
+ animateTo(1);
362
+ }
363
+ function closeMenu(restoreFocus = false) {
364
+ if (phaseRef.current === "closed") return;
365
+ const trigger = triggerRef.current;
366
+ if (restoreFocus && trigger?.isConnected) trigger.focus({ preventScroll: true });
367
+ else if (panelRef.current?.contains(document.activeElement)) document.activeElement.blur();
368
+ if (phaseRef.current === "closing") return;
369
+ phaseRef.current = "closing";
370
+ setIsOpen(false);
371
+ animateTo(0);
372
+ }
373
+ function finishClose() {
374
+ phaseRef.current = "closed";
375
+ menuIdRef.current = null;
376
+ triggerRef.current = null;
377
+ setMountedMenuId(null);
378
+ const pending = pendingRef.current;
379
+ if (pending && pending.trigger.isConnected) {
380
+ pendingRef.current = null;
381
+ openMenu(pending.id, pending.trigger, pending.viaKeyboard);
382
+ }
383
+ pendingRef.current = null;
384
+ }
385
+ finishCloseRef.current = finishClose;
386
+ closeMenuRef.current = closeMenu;
387
+ useEffect(() => {
388
+ if (!mountedMenuId) return;
389
+ function onKeyDown(event) {
390
+ if (event.key === "Escape") {
391
+ event.preventDefault();
392
+ closeMenuRef.current(true);
393
+ }
394
+ }
395
+ window.addEventListener("keydown", onKeyDown);
396
+ return () => window.removeEventListener("keydown", onKeyDown);
397
+ }, [mountedMenuId]);
398
+ useEffect(() => {
399
+ if (!isOpen || !openedByKeyboardRef.current) return;
400
+ openedByKeyboardRef.current = false;
401
+ panelRef.current?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: true });
402
+ }, [isOpen, mountedMenuId]);
403
+ function handleSlotClick(item, event) {
404
+ if (item.subItems && item.subItems.length > 0) {
405
+ if (mountedMenuId === item.id && phaseRef.current === "open") closeMenu();
406
+ else openMenu(item.id, event.currentTarget, event.detail === 0);
407
+ return;
408
+ }
409
+ if (mountedMenuId) closeMenu();
410
+ if (item.onClick) item.onClick();
411
+ else onSelect?.(item.id);
412
+ }
413
+ function handleMenuKeyDown(event) {
414
+ if (event.key === "Tab") {
415
+ closeMenu();
416
+ return;
417
+ }
418
+ const entries = Array.from(event.currentTarget.querySelectorAll("[role=\"menuitem\"]"));
419
+ const current = entries.indexOf(document.activeElement);
420
+ let next = -1;
421
+ if (event.key === "ArrowRight") next = (current + 1) % entries.length;
422
+ else if (event.key === "ArrowLeft") next = (current - 1 + entries.length) % entries.length;
423
+ else if (event.key === "Home") next = 0;
424
+ else if (event.key === "End") next = entries.length - 1;
425
+ if (next >= 0) {
426
+ event.preventDefault();
427
+ entries[next]?.focus();
428
+ }
429
+ }
430
+ function renderSlot(item) {
431
+ const hasSubmenu = Boolean(item.subItems && item.subItems.length > 0);
432
+ const isAccent = item.variant === "accent";
433
+ const isAction = item.variant === "action";
434
+ const isMenuMounted = mountedMenuId === item.id;
435
+ const isMenuOpen = openMenuId === item.id;
436
+ const isTabActive = !isAction && !isAccent && (activeId === item.id || Boolean(item.active));
437
+ const isPillTarget = isTabActive && !isMenuOpen;
438
+ const wellShape = isAccent ? "-my-1 size-9" : "h-7 w-12";
439
+ const wellTone = isAccent ? "bg-[var(--rtw-accent,#6366f1)] text-[var(--rtw-accent-foreground,#ffffff)]" : isMenuOpen ? "text-[var(--rtw-accent-foreground,#ffffff)]" : isAction ? "bg-[var(--rtw-surface-subtle,#edf1f7)] text-[var(--rtw-text-strong,#0f172a)] group-hover/slot:bg-[var(--rtw-border,#dfe5ef)]" : isTabActive ? "text-[var(--rtw-accent,#6366f1)]" : "text-[var(--rtw-text-subtle,#64748b)] group-hover/slot:text-[var(--rtw-text-strong,#0f172a)]";
440
+ const labelTone = isAccent || isMenuOpen || isTabActive ? "text-[var(--rtw-accent,#6366f1)]" : isAction ? "text-[var(--rtw-text-strong,#0f172a)]" : "text-[var(--rtw-text-subtle,#64748b)] group-hover/slot:text-[var(--rtw-text-strong,#0f172a)]";
441
+ const glyphMotion = `transition-[transform,opacity] duration-[280ms] ${EASE_OUT} motion-reduce:transition-none`;
442
+ let glyph;
443
+ if (item.loading) glyph = /* @__PURE__ */ jsx(LoaderIcon, { className: "size-5 animate-spin" });
444
+ else if (isAccent) glyph = /* @__PURE__ */ jsx("span", {
445
+ "aria-hidden": "true",
446
+ style: { transform: isMenuOpen ? "rotate(135deg)" : "rotate(0deg)" },
447
+ className: `flex size-[22px] items-center justify-center transition-transform duration-[260ms] ${EASE_OUT} motion-reduce:!transition-none [&>svg]:size-[22px]`,
448
+ children: item.icon
449
+ });
450
+ else if (hasSubmenu) glyph = /* @__PURE__ */ jsxs("span", {
451
+ className: "relative flex size-5 items-center justify-center",
452
+ children: [/* @__PURE__ */ jsx("span", {
453
+ "aria-hidden": "true",
454
+ className: `absolute inset-0 flex items-center justify-center [&>svg]:size-5 ${glyphMotion} ${isMenuOpen ? "scale-50 -rotate-90 opacity-0" : "scale-100 rotate-0 opacity-100"}`,
455
+ children: item.icon
456
+ }), /* @__PURE__ */ jsx(CloseIcon, {
457
+ "aria-hidden": "true",
458
+ className: `absolute size-[19px] ${glyphMotion} ${isMenuOpen ? "scale-100 rotate-0 opacity-100" : "scale-50 rotate-90 opacity-0"}`
459
+ })]
460
+ });
461
+ else glyph = /* @__PURE__ */ jsx("span", {
462
+ "aria-hidden": "true",
463
+ className: "flex size-5 items-center justify-center [&>svg]:size-5",
464
+ children: item.icon
465
+ });
466
+ return /* @__PURE__ */ jsxs("button", {
467
+ type: "button",
468
+ "data-pill-target": isPillTarget ? "true" : void 0,
469
+ onClick: (event) => handleSlotClick(item, event),
470
+ "aria-haspopup": hasSubmenu ? "menu" : void 0,
471
+ "aria-controls": hasSubmenu && isMenuMounted ? submenuId : void 0,
472
+ "aria-expanded": hasSubmenu ? isMenuOpen : void 0,
473
+ "aria-current": isTabActive ? "page" : void 0,
474
+ className: "group/slot relative flex min-w-0 flex-1 cursor-pointer select-none flex-col items-center gap-[5px] pt-2.5 outline-none [-webkit-tap-highlight-color:transparent]",
475
+ children: [/* @__PURE__ */ jsxs("span", {
476
+ "data-anchor": "true",
477
+ className: `relative flex items-center justify-center rounded-full transition-[background-color,color] duration-200 group-focus-visible/slot:ring-2 group-focus-visible/slot:ring-[var(--rtw-accent,#6366f1)]/60 motion-reduce:transition-none ${wellShape} ${wellTone}`,
478
+ children: [/* @__PURE__ */ jsx("span", {
479
+ className: "flex items-center justify-center transition-transform duration-150 group-active/slot:scale-90 motion-reduce:transition-none",
480
+ children: glyph
481
+ }), item.badge !== void 0 && item.badge !== 0 && !isMenuOpen && /* @__PURE__ */ jsx("span", {
482
+ className: "absolute left-1/2 top-0 ml-1 min-w-4 -translate-y-0.5 rounded-full bg-[var(--rtw-accent,#6366f1)] px-1 text-center text-[9px] font-semibold leading-4 text-[var(--rtw-accent-foreground,#ffffff)]",
483
+ children: item.badge
484
+ })]
485
+ }), /* @__PURE__ */ jsx("span", {
486
+ className: `max-w-full truncate text-[10px] font-medium leading-[10px] transition-colors duration-200 motion-reduce:transition-none ${labelTone}`,
487
+ children: item.renderLabel ? item.renderLabel() : item.label
488
+ })]
489
+ }, item.id);
490
+ }
491
+ return /* @__PURE__ */ jsxs(Fragment, { children: [mountedMenuId && /* @__PURE__ */ jsx("div", {
492
+ "aria-hidden": "true",
493
+ onClick: () => closeMenu(),
494
+ className: `fixed inset-0 bg-[var(--rtw-scrim,rgba(15,23,42,0.18))] transition-opacity motion-reduce:transition-none lg:hidden ${zIndexClassName} ${isOpen ? "pointer-events-auto duration-200 opacity-100" : "pointer-events-none duration-120 opacity-0"}`
495
+ }), /* @__PURE__ */ jsxs("nav", {
496
+ ref: navRef,
497
+ "aria-label": ariaLabel,
498
+ style: { height: `calc(${NAV_HEIGHT_PX}px + env(safe-area-inset-bottom))` },
499
+ className: `fixed inset-x-0 bottom-0 flex items-stretch border-t border-[var(--rtw-border,#dfe5ef)] bg-[var(--rtw-surface,#ffffff)]/90 pb-[env(safe-area-inset-bottom)] backdrop-blur-xl lg:hidden ${zIndexClassName}`,
500
+ children: [
501
+ /* @__PURE__ */ jsx("span", {
502
+ "aria-hidden": "true",
503
+ style: {
504
+ transform: `translateX(${pill.x}px)`,
505
+ opacity: pill.visible ? 1 : 0,
506
+ top: 0,
507
+ width: pill.width
508
+ },
509
+ className: `pointer-events-none absolute left-0 z-10 h-[2.5px] rounded-b-full bg-[var(--rtw-accent,#6366f1)] motion-reduce:transition-none ${pill.instant ? "transition-opacity duration-200" : `transition-[transform,width,opacity] duration-[320ms] ${EASE_OUT}`}`
510
+ }),
511
+ geometry && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("svg", {
512
+ "aria-hidden": "true",
513
+ width: navWidth,
514
+ height: panel.svgHeight,
515
+ viewBox: `0 0 ${navWidth} ${panel.svgHeight}`,
516
+ style: { top: panel.top },
517
+ className: "pointer-events-none absolute left-0 z-[1] overflow-visible drop-shadow-[0_8px_20px_rgba(15,23,42,0.2)]",
518
+ children: /* @__PURE__ */ jsx("path", {
519
+ ref: pathRef,
520
+ fill: "var(--rtw-accent, #6366f1)"
521
+ })
522
+ }), /* @__PURE__ */ jsx("div", {
523
+ id: submenuId,
524
+ ref: panelRef,
525
+ role: "menu",
526
+ "aria-label": `${menuItem?.label ?? ""} options`,
527
+ "aria-hidden": !isOpen,
528
+ onKeyDown: handleMenuKeyDown,
529
+ style: {
530
+ top: panel.top,
531
+ left: panel.left,
532
+ width: panel.width,
533
+ height: panel.height,
534
+ padding: `${PANEL_PAD_Y_PX}px ${PANEL_PAD_X_PX}px`,
535
+ gap: ITEM_GAP_PX,
536
+ gridTemplateColumns: `repeat(${gridCols}, minmax(0, 1fr))`
537
+ },
538
+ className: `absolute z-20 grid items-center transition-[left,width,top,height] duration-[220ms] ${EASE_OUT} motion-reduce:transition-none ${isOpen ? "pointer-events-auto" : "pointer-events-none"}`,
539
+ children: subItems.map((sub, index) => /* @__PURE__ */ jsx("button", {
540
+ type: "button",
541
+ role: "menuitem",
542
+ tabIndex: isOpen ? 0 : -1,
543
+ onClick: () => {
544
+ closeMenu(true);
545
+ sub.onSelect();
546
+ },
547
+ className: `flex h-12 min-w-0 cursor-pointer items-center justify-center rounded-2xl px-1 text-[var(--rtw-accent-foreground,#ffffff)] outline-none transition-[background-color,transform] duration-150 [-webkit-tap-highlight-color:transparent] active:scale-95 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--rtw-accent-foreground,#ffffff)]/70 motion-reduce:transition-none ${sub.active ? "bg-[var(--rtw-accent-foreground,#ffffff)]/18" : "hover:bg-[var(--rtw-accent-foreground,#ffffff)]/10"}`,
548
+ children: /* @__PURE__ */ jsxs("span", {
549
+ style: {
550
+ transitionDelay: isOpen ? `${65 + index * 22}ms` : "0ms",
551
+ transitionDuration: isOpen ? "200ms" : "50ms"
552
+ },
553
+ className: `flex min-w-0 flex-col items-center gap-1 transition-[opacity,transform] ${EASE_OUT} motion-reduce:transition-none ${isOpen ? "translate-y-0 opacity-100" : "translate-y-2 opacity-0"}`,
554
+ children: [/* @__PURE__ */ jsx("span", {
555
+ "aria-hidden": "true",
556
+ className: "flex size-5 items-center justify-center [&>svg]:size-5",
557
+ children: sub.icon
558
+ }), /* @__PURE__ */ jsx("span", {
559
+ className: "max-w-full truncate text-[10px] font-medium leading-[10px]",
560
+ children: sub.label
561
+ })]
562
+ })
563
+ }, sub.id))
564
+ })] }),
565
+ /* @__PURE__ */ jsx("div", {
566
+ className: "relative z-10 flex min-w-0 flex-1 items-stretch",
567
+ children: slots.map(renderSlot)
568
+ })
569
+ ]
570
+ })] });
571
+ }
572
+ export { MobileBottomBar };
573
+
574
+ //# sourceMappingURL=mobile.mjs.map