@multiplatform.one/components 7.49.1 → 7.49.2

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 (51) hide show
  1. package/dist/cjs/SheetModal/index.cjs +2 -74
  2. package/dist/cjs/SheetModal/useSheetFrameFocus.cjs +101 -0
  3. package/dist/cjs/SheetModal/useSheetFrameFocus.native.js +109 -0
  4. package/dist/cjs/SheetModal/useSheetFrameFocus.native.js.map +1 -0
  5. package/dist/cjs/shared/restoreRetries.cjs +96 -0
  6. package/dist/cjs/shared/restoreRetries.native.js +101 -0
  7. package/dist/cjs/shared/restoreRetries.native.js.map +1 -0
  8. package/dist/cjs/shared/useReturnFocusOnClose.cjs +5 -3
  9. package/dist/cjs/shared/useReturnFocusOnClose.native.js +5 -5
  10. package/dist/cjs/shared/useReturnFocusOnClose.native.js.map +1 -1
  11. package/dist/esm/SheetModal/index.mjs +2 -74
  12. package/dist/esm/SheetModal/index.mjs.map +1 -1
  13. package/dist/esm/SheetModal/useSheetFrameFocus.mjs +76 -0
  14. package/dist/esm/SheetModal/useSheetFrameFocus.mjs.map +1 -0
  15. package/dist/esm/SheetModal/useSheetFrameFocus.native.js +81 -0
  16. package/dist/esm/SheetModal/useSheetFrameFocus.native.js.map +1 -0
  17. package/dist/esm/shared/restoreRetries.mjs +71 -0
  18. package/dist/esm/shared/restoreRetries.mjs.map +1 -0
  19. package/dist/esm/shared/restoreRetries.native.js +73 -0
  20. package/dist/esm/shared/restoreRetries.native.js.map +1 -0
  21. package/dist/esm/shared/useReturnFocusOnClose.mjs +5 -3
  22. package/dist/esm/shared/useReturnFocusOnClose.mjs.map +1 -1
  23. package/dist/esm/shared/useReturnFocusOnClose.native.js +5 -5
  24. package/dist/esm/shared/useReturnFocusOnClose.native.js.map +1 -1
  25. package/dist/jsx/SheetModal/index.mjs +2 -74
  26. package/dist/jsx/SheetModal/index.mjs.map +1 -1
  27. package/dist/jsx/SheetModal/useSheetFrameFocus.mjs +76 -0
  28. package/dist/jsx/SheetModal/useSheetFrameFocus.mjs.map +1 -0
  29. package/dist/jsx/SheetModal/useSheetFrameFocus.native.js +109 -0
  30. package/dist/jsx/SheetModal/useSheetFrameFocus.native.js.map +1 -0
  31. package/dist/jsx/shared/restoreRetries.mjs +71 -0
  32. package/dist/jsx/shared/restoreRetries.mjs.map +1 -0
  33. package/dist/jsx/shared/restoreRetries.native.js +101 -0
  34. package/dist/jsx/shared/restoreRetries.native.js.map +1 -0
  35. package/dist/jsx/shared/useReturnFocusOnClose.mjs +5 -3
  36. package/dist/jsx/shared/useReturnFocusOnClose.mjs.map +1 -1
  37. package/dist/jsx/shared/useReturnFocusOnClose.native.js +5 -5
  38. package/dist/jsx/shared/useReturnFocusOnClose.native.js.map +1 -1
  39. package/package.json +9 -9
  40. package/src/SheetModal/index.tsx +3 -84
  41. package/src/SheetModal/useSheetFrameFocus.spec.tsx +72 -0
  42. package/src/SheetModal/useSheetFrameFocus.ts +88 -0
  43. package/src/shared/restoreRetries.ts +87 -0
  44. package/src/shared/useReturnFocusOnClose.spec.tsx +51 -2
  45. package/src/shared/useReturnFocusOnClose.ts +8 -6
  46. package/types/SheetModal/index.d.ts.map +1 -1
  47. package/types/SheetModal/useSheetFrameFocus.d.ts +7 -0
  48. package/types/SheetModal/useSheetFrameFocus.d.ts.map +1 -0
  49. package/types/shared/restoreRetries.d.ts +14 -0
  50. package/types/shared/restoreRetries.d.ts.map +1 -0
  51. package/types/shared/useReturnFocusOnClose.d.ts.map +1 -1
@@ -9,11 +9,12 @@
9
9
  * on device). Dismissal: overlay tap / snap-to-bottom / Escape (LC-21).
10
10
  */
11
11
 
12
- import { transitionProps, useResolvedKnobs, wasKeyboardFocus } from "@multiplatform.one/theme";
12
+ import { transitionProps, useResolvedKnobs } from "@multiplatform.one/theme";
13
13
  import { OverlayStackProvider, useOverlayZIndex } from "@multiplatform.one/forms";
14
- import { useEffect, useId, useRef, type ReactNode, type RefObject } from "react";
14
+ import { useEffect, useId, useRef, type ReactNode } from "react";
15
15
  import { isWeb, Sheet, View } from "tamagui";
16
16
  import { DialogRegionContext, SheetFrame } from "../surfaces";
17
+ import { useSheetFrameFocus } from "./useSheetFrameFocus";
17
18
 
18
19
  export interface SheetModalProps {
19
20
  open: boolean;
@@ -34,9 +35,6 @@ export interface SheetModalProps {
34
35
  fill?: boolean;
35
36
  }
36
37
 
37
- const FOCUSABLE =
38
- 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
39
-
40
38
  const IN_DIALOG_REGION = { inDialogRegion: true } as const;
41
39
 
42
40
  /*
@@ -55,85 +53,6 @@ const frameRingReset = {
55
53
  focusVisibleStyle: { outlineWidth: 0, outlineStyle: "none" as const },
56
54
  };
57
55
 
58
- function useSheetFrameFocus(open: boolean, frameRef: RefObject<HTMLElement | null>) {
59
- const prevRef = useRef<HTMLElement | null>(null);
60
- const wasOpenRef = useRef(false);
61
- if (isWeb && typeof document !== "undefined") {
62
- if (open && !wasOpenRef.current) {
63
- prevRef.current = document.activeElement as HTMLElement | null;
64
- }
65
- wasOpenRef.current = open;
66
- }
67
-
68
- useEffect(() => {
69
- if (!isWeb || typeof document === "undefined" || !open) return;
70
- const frame = frameRef.current;
71
- const restore = () => {
72
- if (typeof document === "undefined") return;
73
- const target = prevRef.current;
74
- if (!target || !target.isConnected) return;
75
- const ae = document.activeElement;
76
- const dropped =
77
- !ae ||
78
- ae === document.body ||
79
- ae === document.documentElement ||
80
- !!frameRef.current?.contains(ae);
81
- if (dropped) {
82
- target.focus({
83
- preventScroll: true,
84
- focusVisible: wasKeyboardFocus(),
85
- } as FocusOptions);
86
- }
87
- };
88
- if (!frame || typeof frame.addEventListener !== "function") {
89
- return () => {
90
- requestAnimationFrame(() => requestAnimationFrame(restore));
91
- setTimeout(restore, 320);
92
- };
93
- }
94
-
95
- const focusIn = () => {
96
- if (typeof document === "undefined") return;
97
- if (frame.contains(document.activeElement)) return;
98
- const first = frame.querySelector<HTMLElement>(FOCUSABLE);
99
- (first ?? frame).focus({ preventScroll: true, focusVisible: false } as FocusOptions);
100
- };
101
- let innerRaf = 0;
102
- const raf = requestAnimationFrame(() => {
103
- innerRaf = requestAnimationFrame(focusIn);
104
- });
105
-
106
- const onKeyDown = (e: KeyboardEvent) => {
107
- if (e.key !== "Tab") return;
108
- const focusables = Array.from(frame.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(
109
- (el) => el.offsetWidth > 0 || el.offsetHeight > 0,
110
- );
111
- if (!focusables.length) {
112
- e.preventDefault();
113
- return;
114
- }
115
- const first = focusables[0];
116
- const last = focusables[focusables.length - 1];
117
- const current = document.activeElement;
118
- if (e.shiftKey && (current === first || current === frame)) {
119
- e.preventDefault();
120
- last.focus();
121
- } else if (!e.shiftKey && current === last) {
122
- e.preventDefault();
123
- first.focus();
124
- }
125
- };
126
- frame.addEventListener("keydown", onKeyDown);
127
- return () => {
128
- cancelAnimationFrame(raf);
129
- cancelAnimationFrame(innerRaf);
130
- frame.removeEventListener("keydown", onKeyDown);
131
- requestAnimationFrame(() => requestAnimationFrame(restore));
132
- setTimeout(restore, 320);
133
- };
134
- }, [open, frameRef]);
135
- }
136
-
137
56
  function useSheetEscapeDismiss(open: boolean, onDismiss: () => void) {
138
57
  const onDismissRef = useRef(onDismiss);
139
58
  onDismissRef.current = onDismiss;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * FZ-7904: SheetModal's close retries (two frames and a timer) used to drop
3
+ * their ids, so a reopen stacked them and an unmount left them running after
4
+ * the test window was gone.
5
+ */
6
+ import { holdAnimationFrames } from "@multiplatform.one/test-utils/frames";
7
+ import { act, cleanup, renderHook } from "@testing-library/react";
8
+ import { afterEach, describe, expect, it, vi } from "vitest";
9
+ import { useSheetFrameFocus } from "./useSheetFrameFocus";
10
+
11
+ afterEach(() => {
12
+ cleanup();
13
+ vi.unstubAllGlobals();
14
+ vi.useRealTimers();
15
+ document.body.replaceChildren();
16
+ });
17
+
18
+ describe("useSheetFrameFocus", () => {
19
+ function setup() {
20
+ vi.useFakeTimers();
21
+ const frames = holdAnimationFrames();
22
+ const trigger = document.createElement("button");
23
+ const frame = document.createElement("div");
24
+ const item = document.createElement("button");
25
+ frame.append(item);
26
+ document.body.append(trigger, frame);
27
+ trigger.focus();
28
+ const frameRef = { current: frame as HTMLElement | null };
29
+ const hook = renderHook(({ open }) => useSheetFrameFocus(open, frameRef), {
30
+ initialProps: { open: true },
31
+ });
32
+ return { ...hook, frames, trigger, item };
33
+ }
34
+
35
+ it("moves focus in on open and returns it on close", async () => {
36
+ const h = setup();
37
+ h.frames.flush();
38
+ h.frames.flush();
39
+ expect(document.activeElement).toBe(h.item);
40
+ h.rerender({ open: false });
41
+ await act(() => vi.advanceTimersByTimeAsync(400));
42
+ expect(document.activeElement).toBe(h.trigger);
43
+ });
44
+
45
+ it("cancels a close's retries when the sheet reopens", () => {
46
+ const h = setup();
47
+ const frames = h.frames.pending;
48
+ const timers = vi.getTimerCount();
49
+ h.rerender({ open: false });
50
+ h.rerender({ open: true });
51
+ expect(h.frames.pending).toBe(frames);
52
+ expect(vi.getTimerCount()).toBe(timers);
53
+ });
54
+
55
+ it("leaves no frame or timer behind once it unmounts, and still restores", async () => {
56
+ const h = setup();
57
+ h.trigger.blur();
58
+ h.rerender({ open: false });
59
+ h.unmount();
60
+ expect(h.frames.pending).toBe(0);
61
+ expect(vi.getTimerCount()).toBe(0);
62
+ await Promise.resolve();
63
+ expect(document.activeElement).toBe(h.trigger);
64
+ });
65
+
66
+ it("does not throw when its frame outlives the requestAnimationFrame global", () => {
67
+ const h = setup();
68
+ h.rerender({ open: false });
69
+ vi.stubGlobal("requestAnimationFrame", undefined);
70
+ expect(() => h.frames.flush()).not.toThrow();
71
+ });
72
+ });
@@ -0,0 +1,88 @@
1
+ /**
2
+ * SheetModal's web focus: move focus into the frame on open, trap Tab while
3
+ * open, return dropped focus on close (Radix Dialog anatomy, see ./index.tsx).
4
+ */
5
+
6
+ import { wasKeyboardFocus } from "@multiplatform.one/theme";
7
+ import { useEffect, useRef, type RefObject } from "react";
8
+ import { isWeb } from "tamagui";
9
+ import { useRestoreRetries } from "../shared/restoreRetries";
10
+
11
+ const FOCUSABLE =
12
+ 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
13
+
14
+ export function useSheetFrameFocus(open: boolean, frameRef: RefObject<HTMLElement | null>) {
15
+ const prevRef = useRef<HTMLElement | null>(null);
16
+ const wasOpenRef = useRef(false);
17
+ if (isWeb && typeof document !== "undefined") {
18
+ if (open && !wasOpenRef.current) {
19
+ prevRef.current = document.activeElement as HTMLElement | null;
20
+ }
21
+ wasOpenRef.current = open;
22
+ }
23
+ const retries = useRestoreRetries();
24
+
25
+ useEffect(() => {
26
+ if (!isWeb || typeof document === "undefined" || !open) return;
27
+ retries.cancel();
28
+ const frame = frameRef.current;
29
+ const restore = () => {
30
+ if (typeof document === "undefined") return;
31
+ const target = prevRef.current;
32
+ if (!target || !target.isConnected) return;
33
+ const ae = document.activeElement;
34
+ const dropped =
35
+ !ae ||
36
+ ae === document.body ||
37
+ ae === document.documentElement ||
38
+ !!frameRef.current?.contains(ae);
39
+ if (dropped) {
40
+ target.focus({
41
+ preventScroll: true,
42
+ focusVisible: wasKeyboardFocus(),
43
+ } as FocusOptions);
44
+ }
45
+ };
46
+ const restoreLater = () => retries.schedule(restore, 320);
47
+ if (!frame || typeof frame.addEventListener !== "function") return restoreLater;
48
+
49
+ const focusIn = () => {
50
+ if (typeof document === "undefined") return;
51
+ if (frame.contains(document.activeElement)) return;
52
+ const first = frame.querySelector<HTMLElement>(FOCUSABLE);
53
+ (first ?? frame).focus({ preventScroll: true, focusVisible: false } as FocusOptions);
54
+ };
55
+ let innerRaf = 0;
56
+ const raf = requestAnimationFrame(() => {
57
+ innerRaf = requestAnimationFrame(focusIn);
58
+ });
59
+
60
+ const onKeyDown = (e: KeyboardEvent) => {
61
+ if (e.key !== "Tab") return;
62
+ const focusables = Array.from(frame.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(
63
+ (el) => el.offsetWidth > 0 || el.offsetHeight > 0,
64
+ );
65
+ if (!focusables.length) {
66
+ e.preventDefault();
67
+ return;
68
+ }
69
+ const first = focusables[0];
70
+ const last = focusables[focusables.length - 1];
71
+ const current = document.activeElement;
72
+ if (e.shiftKey && (current === first || current === frame)) {
73
+ e.preventDefault();
74
+ last.focus();
75
+ } else if (!e.shiftKey && current === last) {
76
+ e.preventDefault();
77
+ first.focus();
78
+ }
79
+ };
80
+ frame.addEventListener("keydown", onKeyDown);
81
+ return () => {
82
+ cancelAnimationFrame(raf);
83
+ cancelAnimationFrame(innerRaf);
84
+ frame.removeEventListener("keydown", onKeyDown);
85
+ restoreLater();
86
+ };
87
+ }, [open, frameRef, retries]);
88
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The retries an overlay runs to return focus after it closes: after two
3
+ * frames, then after the exit window (FZ-7904). The handles are kept, so a
4
+ * new schedule or a reopen cancels the old retries instead of stacking them,
5
+ * and an unmount leaves no frame or timer behind: the restore it would have
6
+ * run happens once, in a microtask, unless the component mounted again
7
+ * (StrictMode's simulated unmount). Mirror of the forms-package helper.
8
+ */
9
+
10
+ import { useEffect, useRef } from "react";
11
+
12
+ export interface RestoreRetries {
13
+ schedule: (restore: () => void, delayMs: number) => void;
14
+ cancel: () => void;
15
+ }
16
+
17
+ const hasFrames = () => typeof requestAnimationFrame === "function";
18
+
19
+ export function useRestoreRetries(): RestoreRetries {
20
+ const mountedRef = useRef(false);
21
+ const retriesRef = useRef<(RestoreRetries & { unmount: () => void }) | null>(null);
22
+ if (!retriesRef.current) {
23
+ let outer = 0;
24
+ let inner = 0;
25
+ let timer: ReturnType<typeof setTimeout> | undefined;
26
+ let pending: (() => void) | null = null;
27
+ const restoreOnceUnmounted = (restore: () => void) => {
28
+ queueMicrotask(() => {
29
+ if (!mountedRef.current) restore();
30
+ });
31
+ };
32
+ const cancel = () => {
33
+ if (typeof cancelAnimationFrame === "function") {
34
+ if (outer) cancelAnimationFrame(outer);
35
+ if (inner) cancelAnimationFrame(inner);
36
+ }
37
+ if (timer !== undefined) clearTimeout(timer);
38
+ outer = 0;
39
+ inner = 0;
40
+ timer = undefined;
41
+ pending = null;
42
+ };
43
+ retriesRef.current = {
44
+ cancel,
45
+ schedule(restore, delayMs) {
46
+ cancel();
47
+ if (!mountedRef.current) {
48
+ restoreOnceUnmounted(restore);
49
+ return;
50
+ }
51
+ pending = restore;
52
+ if (hasFrames()) {
53
+ outer = requestAnimationFrame(() => {
54
+ outer = 0;
55
+ // The outer frame can outlive the document (a test window torn
56
+ // down between the two frames), and with it the global.
57
+ if (!hasFrames()) return;
58
+ inner = requestAnimationFrame(() => {
59
+ inner = 0;
60
+ if (timer === undefined) pending = null;
61
+ restore();
62
+ });
63
+ });
64
+ }
65
+ timer = setTimeout(() => {
66
+ timer = undefined;
67
+ if (!outer && !inner) pending = null;
68
+ restore();
69
+ }, delayMs);
70
+ },
71
+ unmount() {
72
+ const restore = pending;
73
+ cancel();
74
+ if (restore) restoreOnceUnmounted(restore);
75
+ },
76
+ };
77
+ }
78
+ const retries = retriesRef.current;
79
+ useEffect(() => {
80
+ mountedRef.current = true;
81
+ return () => {
82
+ mountedRef.current = false;
83
+ retries.unmount();
84
+ };
85
+ }, [retries]);
86
+ return retries;
87
+ }
@@ -1,5 +1,7 @@
1
1
  import { act, cleanup, renderHook } from "@testing-library/react";
2
+ import { StrictMode } from "react";
2
3
  import { afterEach, describe, expect, it, vi } from "vitest";
4
+ import { holdAnimationFrames } from "@multiplatform.one/test-utils/frames";
3
5
  import { useReturnFocusOnClose } from "./useReturnFocusOnClose";
4
6
 
5
7
  afterEach(() => {
@@ -10,15 +12,16 @@ afterEach(() => {
10
12
  });
11
13
 
12
14
  describe("useReturnFocusOnClose", () => {
13
- function setup() {
15
+ function setup({ holdFrames = false } = {}) {
14
16
  vi.useFakeTimers();
17
+ const frames = holdFrames ? holdAnimationFrames() : null;
15
18
  const trigger = document.createElement("button");
16
19
  document.body.append(trigger);
17
20
  trigger.focus();
18
21
  const hook = renderHook(({ open }) => useReturnFocusOnClose(open), {
19
22
  initialProps: { open: true },
20
23
  });
21
- return { ...hook, trigger };
24
+ return { ...hook, frames, trigger };
22
25
  }
23
26
 
24
27
  it("restores dropped focus after the close animation", async () => {
@@ -36,4 +39,50 @@ describe("useReturnFocusOnClose", () => {
36
39
  vi.stubGlobal("document", undefined);
37
40
  expect(() => vi.advanceTimersByTime(400)).not.toThrow();
38
41
  });
42
+
43
+ // FZ-7904: the close retries used to drop their frame and timer ids. These
44
+ // unmount before the outer afterEach drops the held frames.
45
+ describe("frame handles", () => {
46
+ afterEach(() => {
47
+ cleanup();
48
+ });
49
+
50
+ it("a StrictMode remount on open does not restore", async () => {
51
+ vi.useFakeTimers();
52
+ const trigger = document.createElement("button");
53
+ document.body.append(trigger);
54
+ trigger.focus();
55
+ renderHook(() => useReturnFocusOnClose(true), { wrapper: StrictMode });
56
+ trigger.blur();
57
+ await Promise.resolve();
58
+ await act(() => vi.advanceTimersByTimeAsync(400));
59
+ expect(document.activeElement).toBe(document.body);
60
+ });
61
+
62
+ it("cancels a close's retries when the overlay reopens", () => {
63
+ const h = setup({ holdFrames: true });
64
+ h.rerender({ open: false });
65
+ h.rerender({ open: true });
66
+ expect(h.frames!.pending).toBe(0);
67
+ expect(vi.getTimerCount()).toBe(0);
68
+ });
69
+
70
+ it("leaves no frame or timer behind once it unmounts, and still restores", async () => {
71
+ const h = setup({ holdFrames: true });
72
+ h.trigger.blur();
73
+ h.rerender({ open: false });
74
+ h.unmount();
75
+ expect(h.frames!.pending).toBe(0);
76
+ expect(vi.getTimerCount()).toBe(0);
77
+ await Promise.resolve();
78
+ expect(document.activeElement).toBe(h.trigger);
79
+ });
80
+
81
+ it("does not throw when its frame outlives the requestAnimationFrame global", () => {
82
+ const h = setup({ holdFrames: true });
83
+ h.rerender({ open: false });
84
+ vi.stubGlobal("requestAnimationFrame", undefined);
85
+ expect(() => h.frames!.flush()).not.toThrow();
86
+ });
87
+ });
39
88
  });
@@ -18,6 +18,7 @@
18
18
  import { useEffect, useRef } from "react";
19
19
  import { isWeb } from "tamagui";
20
20
  import { wasKeyboardFocus } from "@multiplatform.one/theme";
21
+ import { useRestoreRetries } from "./restoreRetries";
21
22
 
22
23
  const canUseDom = () => isWeb && typeof document !== "undefined";
23
24
 
@@ -35,13 +36,15 @@ export function useReturnFocusOnClose(open: boolean) {
35
36
  }
36
37
  wasOpenRef.current = open;
37
38
  }
39
+ const retries = useRestoreRetries();
38
40
  useEffect(() => {
39
41
  if (!canUseDom() || !open) return;
42
+ retries.cancel();
40
43
  return () => {
41
44
  const restore = () => {
42
- // Nothing cancels this after unmount, so the document can be gone by
43
- // now (a test environment torn down inside the retry window), and
44
- // `isConnected` stays true on the detached node.
45
+ // The microtask after an unmount can run once the document is gone
46
+ // (a test environment torn down), and `isConnected` stays true on
47
+ // the detached node.
45
48
  if (!canUseDom()) return;
46
49
  const target = prevRef.current;
47
50
  if (!target || !target.isConnected) return;
@@ -54,8 +57,7 @@ export function useReturnFocusOnClose(open: boolean) {
54
57
  };
55
58
  // Exit animations unmount the overlay a few frames later; retry after
56
59
  // the typical exit window. Both calls are idempotent.
57
- requestAnimationFrame(() => requestAnimationFrame(restore));
58
- setTimeout(restore, 320);
60
+ retries.schedule(restore, 320);
59
61
  };
60
- }, [open]);
62
+ }, [open, retries]);
61
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SheetModal/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAA4B,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAIjF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,uEAAuE;IACvE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAoHD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,SAAc,EACd,UAAU,EACV,IAAY,GACb,EAAE,eAAe,2CAkFjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SheetModal/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,uEAAuE;IACvE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAkCD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,SAAc,EACd,UAAU,EACV,IAAY,GACb,EAAE,eAAe,2CAkFjB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * SheetModal's web focus: move focus into the frame on open, trap Tab while
3
+ * open, return dropped focus on close (Radix Dialog anatomy, see ./index.tsx).
4
+ */
5
+ import { type RefObject } from "react";
6
+ export declare function useSheetFrameFocus(open: boolean, frameRef: RefObject<HTMLElement | null>): void;
7
+ //# sourceMappingURL=useSheetFrameFocus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSheetFrameFocus.d.ts","sourceRoot":"","sources":["../../src/SheetModal/useSheetFrameFocus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO1D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QA0ExF"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The retries an overlay runs to return focus after it closes: after two
3
+ * frames, then after the exit window (FZ-7904). The handles are kept, so a
4
+ * new schedule or a reopen cancels the old retries instead of stacking them,
5
+ * and an unmount leaves no frame or timer behind: the restore it would have
6
+ * run happens once, in a microtask, unless the component mounted again
7
+ * (StrictMode's simulated unmount). Mirror of the forms-package helper.
8
+ */
9
+ export interface RestoreRetries {
10
+ schedule: (restore: () => void, delayMs: number) => void;
11
+ cancel: () => void;
12
+ }
13
+ export declare function useRestoreRetries(): RestoreRetries;
14
+ //# sourceMappingURL=restoreRetries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restoreRetries.d.ts","sourceRoot":"","sources":["../../src/shared/restoreRetries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAID,wBAAgB,iBAAiB,IAAI,cAAc,CAoElD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useReturnFocusOnClose.d.ts","sourceRoot":"","sources":["../../src/shared/useReturnFocusOnClose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,QAgClD"}
1
+ {"version":3,"file":"useReturnFocusOnClose.d.ts","sourceRoot":"","sources":["../../src/shared/useReturnFocusOnClose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAcH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,QAiClD"}