@astryxdesign/core 0.7.6-canary.2a905bb → 0.7.6-canary.2fa4cef

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 (42) hide show
  1. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  2. package/dist/BottomSheet/BottomSheetPanel.js +36 -9
  3. package/dist/BottomSheet/useSheetGestures.d.ts +36 -6
  4. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  5. package/dist/BottomSheet/useSheetGestures.js +67 -10
  6. package/dist/FileInput/FileInput.d.ts.map +1 -1
  7. package/dist/FileInput/FileInput.js +27 -2
  8. package/dist/Layer/useTouchTrigger.d.ts +16 -2
  9. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  10. package/dist/Layer/useTouchTrigger.js +56 -7
  11. package/dist/Toast/useToast.d.ts.map +1 -1
  12. package/dist/Toast/useToast.js +8 -2
  13. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  14. package/dist/ToggleButton/ToggleButton.js +8 -2
  15. package/dist/gestures/haptics.d.ts.map +1 -1
  16. package/dist/gestures/haptics.js +1 -5
  17. package/dist/hooks/useClickableContainer.d.ts +24 -4
  18. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  19. package/dist/hooks/useClickableContainer.js +41 -14
  20. package/dist/theme/Theme.d.ts +10 -0
  21. package/dist/theme/Theme.d.ts.map +1 -1
  22. package/dist/theme/Theme.js +8 -4
  23. package/dist/utils/pressDisabled.d.ts +21 -0
  24. package/dist/utils/pressDisabled.d.ts.map +1 -0
  25. package/dist/utils/pressDisabled.js +32 -0
  26. package/package.json +4 -4
  27. package/src/BottomSheet/BottomSheetPanel.tsx +39 -8
  28. package/src/BottomSheet/useSheetGestures.ts +92 -15
  29. package/src/FileInput/FileInput.tsx +29 -1
  30. package/src/HoverCard/HoverCard.doc.mjs +3 -3
  31. package/src/HoverCard/HoverCard.spec.md +16 -14
  32. package/src/HoverCard/useHoverCard.doc.mjs +1 -1
  33. package/src/Layer/useTouchTrigger.ts +70 -10
  34. package/src/Toast/useToast.tsx +8 -3
  35. package/src/ToggleButton/ToggleButton.tsx +9 -3
  36. package/src/Tooltip/Tooltip.doc.mjs +3 -3
  37. package/src/Tooltip/Tooltip.spec.md +17 -17
  38. package/src/Tooltip/useTooltip.doc.mjs +1 -1
  39. package/src/gestures/haptics.ts +1 -8
  40. package/src/hooks/useClickableContainer.ts +48 -17
  41. package/src/theme/Theme.tsx +8 -4
  42. package/src/utils/pressDisabled.ts +32 -0
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA+B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAIvB,QAAA,MAAM,cAAc;;;;CAIV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC5D,YAAY,EAAC,oBAAoB,EAAC,CAAC;AA+CnC,eAAO,MAAM,2BAA2B,2DACkB,CAAC;AAiN3D,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAC7B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,GACjC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,eAAe,EAAE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,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5C,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACjD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC7D;AA4HD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,KAAK,EACL,eAAe,EACf,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,qBAA4B,EAC5B,kBAA0B,EAC1B,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,qBAAqB,+BAoZvB;yBAzae,gBAAgB"}
@@ -39,7 +39,7 @@ import { container } from "../Layout/container.stylex.js";
39
39
  import { containerPaddingBlockEndVarStyles, containerPaddingBlockStartVarStyles, containerPaddingInlineVarStyles, overlayPaddingReset, paddingStyles, spacingStepToToken } from "../Layout/padding.stylex.js";
40
40
  import { isValidSnapPoint, resolveSnapPoints } from "./snapOffsets.js";
41
41
  import { useMobileKeyboard } from "./useMobileKeyboard.js";
42
- import { useSheetGestures } from "./useSheetGestures.js";
42
+ import { scrollPreservationPadding, sheetLayoutHeight, useSheetGestures } from "./useSheetGestures.js";
43
43
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
44
44
  const HEIGHT_BUDGETS = {
45
45
  hug: '92dvh',
@@ -359,6 +359,9 @@ export function BottomSheetPanel({
359
359
  };
360
360
  }, [snapPointsKey]);
361
361
  useDevWarning('BottomSheet', ignoredSnapPointsMessage, ignoredSnapPointsMessage !== '');
362
+
363
+ // A caller's height owns the element's height: the drag never writes it.
364
+ const consumerHeight = style?.height;
362
365
  const {
363
366
  contentProps,
364
367
  handleProps,
@@ -382,7 +385,8 @@ export function BottomSheetPanel({
382
385
  offscreenBlockEndInset: OVERSCROLL_PADDING,
383
386
  onDismiss,
384
387
  snapHeights,
385
- onScrimOpacity
388
+ onScrimOpacity,
389
+ hasFixedHeight: consumerHeight != null
386
390
  });
387
391
  const {
388
392
  getViewportProps,
@@ -512,6 +516,8 @@ export function BottomSheetPanel({
512
516
  // transform — the layout height changes at rest, in one reconciling render
513
517
  // whose visible geometry is identical (see useSheetGestures).
514
518
  // - dragging above the base restores the full height below the viewport
519
+ // (the move that crosses writes that height to the element itself,
520
+ // so this render only catches up to it)
515
521
  // - a peek settles with layout 0, so it slides rather than reflowing
516
522
  const layoutOffset = isDragging ? dragOffset < settledOffset ? 0 : settledLayoutOffset : settlingLayoutOffset ?? settledLayoutOffset;
517
523
  const activeOffset = isDragging ? dragOffset : settledOffset;
@@ -522,12 +528,14 @@ export function BottomSheetPanel({
522
528
  // pinned in px instead: content reflowing mid-gesture would move the
523
529
  // surface out from under the finger, or under the snap.
524
530
  const isTraveling = isDragging || settlingLayoutOffset != null;
525
- resizedHeight = layoutOffset > 0 || isTraveling ? `${Math.max(0, sheetHeight - Math.max(0, layoutOffset))}px` : undefined;
531
+ resizedHeight = layoutOffset > 0 || isTraveling ? sheetLayoutHeight(sheetHeight, layoutOffset) : undefined;
526
532
  gestureTransform = translation !== 0 ? `translateY(${translation}px)` : undefined;
527
533
  }
528
534
  const retainedTransform = alignmentOffset > 0 ? [gestureTransform, `translateY(${alignmentOffset}px)`].filter(Boolean).join(' ') : gestureTransform;
529
535
  const sheetTransform = isInteractive ? gestureTransform : isRetained ? retainedTransform : undefined;
530
536
  const consumerTransform = style?.transform;
537
+ const hostHeight = isInteractive || isRetained || isClosing ? resizedHeight : undefined;
538
+ const bodyEndPadding = scrollPreservationPadding(scrollPreservationInset);
531
539
  // The transform is written to the element here, not rendered through the
532
540
  // style prop. A drag writes it straight to the element once per input
533
541
  // sample (useSheetGestures) and renders nothing in between, so React never
@@ -536,20 +544,39 @@ export function BottomSheetPanel({
536
544
  // the finger left it. Written after every commit instead, outside a drag,
537
545
  // the resting value lands in the same style update as the restored
538
546
  // transition, so a settle or a dismissal animates from the live position.
547
+ //
548
+ // The height and the scrolling area's end inset are rendered through props,
549
+ // but a drag that crosses its base detent writes them to the elements too.
550
+ // When the release is processed before that move's render commits, React
551
+ // compares the resting values with the ones it committed before the drag,
552
+ // finds them unchanged and writes nothing, so the sheet would stay drawn at
553
+ // the drag's height. They are written here after every commit, outside a
554
+ // drag, for the same reason as the transform. A caller's height is left to
555
+ // the style prop: the drag does not write over it, so there is nothing to
556
+ // restore.
539
557
  useLayoutEffect(() => {
540
- if (isDragging || consumerTransform != null) {
558
+ if (isDragging) {
541
559
  return;
542
560
  }
543
561
  const element = elementRef.current;
544
562
  if (element != null) {
545
- element.style.transform = sheetTransform ?? '';
563
+ if (consumerTransform == null) {
564
+ element.style.transform = sheetTransform ?? '';
565
+ }
566
+ if (consumerHeight == null) {
567
+ element.style.height = hostHeight ?? '';
568
+ }
569
+ }
570
+ const body = bodyElementRef.current;
571
+ if (body != null) {
572
+ body.style.paddingBlockEnd = bodyEndPadding ?? '';
546
573
  }
547
574
  });
548
575
  const gestureStyle = {
549
576
  transition: contentProps.style.transition,
550
577
  touchAction: contentProps.style.touchAction,
551
578
  overscrollBehavior: contentProps.style.overscrollBehavior,
552
- height: resizedHeight
579
+ height: hostHeight
553
580
  };
554
581
  return /*#__PURE__*/_jsxs("div", {
555
582
  ...props,
@@ -558,7 +585,7 @@ export function BottomSheetPanel({
558
585
  ...mergeProps(themeProps('bottom-sheet'), stylex.props(layerTextReset.reset, layerStructureReset.reset, styles.sheet, overlayPaddingReset.reset, height === 'hug' ? styles.hugHeight : styles.budget, isClosing && styles.sheetClosing, isClosing && isCrossFade && styles.sheetClosingCrossFade, isFading && styles.sheetFading, isInactive && styles.sheetInactive, xstyle), className, {
559
586
  ['--_sheet-budget']: budget,
560
587
  ...(isInteractive ? gestureStyle : isRetained || isClosing ? {
561
- height: resizedHeight
588
+ height: hostHeight
562
589
  } : {}),
563
590
  ...style
564
591
  }),
@@ -571,9 +598,9 @@ export function BottomSheetPanel({
571
598
  }), /*#__PURE__*/_jsx("div", {
572
599
  ...whilePresented(isPresented, getViewportProps({
573
600
  ...bodyProps,
574
- ...mergeProps(stylex.props(focusOutlineStyles.focusVisible, styles.body, height === 'tall' && styles.tallKeyboardBody), scrollPreservationInset > 0 ? {
601
+ ...mergeProps(stylex.props(focusOutlineStyles.focusVisible, styles.body, height === 'tall' && styles.tallKeyboardBody), bodyEndPadding != null ? {
575
602
  style: {
576
- paddingBlockEnd: `${scrollPreservationInset}px`
603
+ paddingBlockEnd: bodyEndPadding
577
604
  }
578
605
  } : {})
579
606
  })),
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @file useSheetGestures.ts
3
3
  * @input Uses React (useCallback, useEffect, useMemo, useRef, useState)
4
- * @output Exports useSheetGestures hook and its option/result types
4
+ * @output Exports useSheetGestures hook, its option/result types, and the
5
+ * height and end-inset formats a host renders for the layout split
5
6
  * @position Internal to BottomSheet; not exported from the core entry point
6
7
  *
7
8
  * Drag + snap machinery for the bottom sheet. Tracks a pointer drag down the
@@ -22,10 +23,18 @@
22
23
  * A live drag writes that transform straight to the sheet element, once per
23
24
  * input sample, and renders nothing: React state changes when the drag begins
24
25
  * and ends, and in between only when the layout split changes (a drag that
25
- * crosses above its base detent restores the full height). The live offset
26
- * is readable through `activeOffsetRef`. The host owns the element's
27
- * transform outside a drag and writes the resting value after each commit,
28
- * so a settle animates from wherever the finger left the sheet.
26
+ * crosses above its base detent restores the full height). That crossing
27
+ * changes three things that only look right together: the transform, the
28
+ * sheet's height and the scrolling area's end inset. The move writes all
29
+ * three to the elements in the same task, so the browser paints them in one
30
+ * frame, and the render it schedules catches the host up to the same values
31
+ * whenever it commits; it never decides what the next frame shows. The live
32
+ * offset is readable through `activeOffsetRef`. The host owns the element's
33
+ * transform, height and end inset outside a drag and writes their resting
34
+ * values after each commit (a host with a fixed height of its own keeps that
35
+ * height, and the drag never writes it), so a settle animates from wherever the finger
36
+ * left the sheet, and a release processed before the crossing move's render
37
+ * commits still leaves the sheet drawn at its resting detent.
29
38
  *
30
39
  * Those are pixels, and the stops behind them are relative to the viewport, so
31
40
  * a sheet at rest re-resolves its detent on `resize` / `orientationchange`,
@@ -66,6 +75,19 @@
66
75
  * - /packages/core/src/BottomSheet/useSheetGestures.test.ts
67
76
  */
68
77
  import { type CSSProperties, type MouseEvent as ReactMouseEvent, type PointerEvent as ReactPointerEvent, type RefObject, type TouchEvent as ReactTouchEvent, type UIEvent as ReactUIEvent } from 'react';
78
+ /**
79
+ * The sheet's height, in px, while it is in motion or rests with a layout
80
+ * split: the fully open height less the part the scrolling area gives up.
81
+ * The host renders it and a live drag writes it; one format keeps the two
82
+ * identical, so the render that follows a written value changes nothing.
83
+ */
84
+ export declare function sheetLayoutHeight(sheetHeight: number, layoutOffset: number): string;
85
+ /**
86
+ * The scrolling area's end padding that preserves its scroll position across
87
+ * a height change, or nothing when there is none to add. Shared by the host's
88
+ * render and a live drag's write for the same reason as sheetLayoutHeight.
89
+ */
90
+ export declare function scrollPreservationPadding(inset: number): string | undefined;
69
91
  /**
70
92
  * Whether a gesture that lands on `target` began inside another layer
71
93
  * rendered in this sheet's content — a `<dialog>` between the target and the
@@ -141,6 +163,14 @@ export interface UseSheetGesturesOptions {
141
163
  * on the dismiss overshoot. Lets the owner mirror it onto the scrim.
142
164
  */
143
165
  onScrimOpacity?: (opacity: number) => void;
166
+ /**
167
+ * Whether the host draws the sheet at a fixed height of its own (a caller's
168
+ * height) rather than the layout-split height. A drag across the base
169
+ * detent then writes only the transform and the end inset, and leaves the
170
+ * element's height to the host.
171
+ * @default false
172
+ */
173
+ hasFixedHeight?: boolean;
144
174
  }
145
175
  export interface SheetContentProps {
146
176
  style: CSSProperties;
@@ -260,5 +290,5 @@ export interface UseSheetGesturesResult {
260
290
  * </div>
261
291
  * ```
262
292
  */
263
- export declare function useSheetGestures({ isOpen, isOpenRequested, canDismiss, offscreenBlockEndInset, onDismiss, snapHeights, onSnap, onScrimOpacity, }: UseSheetGesturesOptions): UseSheetGesturesResult;
293
+ export declare function useSheetGestures({ isOpen, isOpenRequested, canDismiss, offscreenBlockEndInset, onDismiss, snapHeights, onSnap, onScrimOpacity, hasFixedHeight, }: UseSheetGesturesOptions): UseSheetGesturesResult;
264
294
  //# sourceMappingURL=useSheetGestures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSheetGestures.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/useSheetGestures.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAEH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,SAAS,EACd,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,OAAO,IAAI,YAAY,EAC7B,MAAM,OAAO,CAAC;AAwJf;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,IAAI,EAAE,WAAW,GAChB,OAAO,CAWT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,C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ACpB,4EAA4E;IAC5E,uBAAuB,EAAE,MAAM,CAAC;IAChC,qEAAqE;IACrE,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAwB,EACxB,UAAiB,EACjB,sBAA0B,EAC1B,SAAS,EACT,WAAW,EACX,MAAM,EACN,cAAc,EACd,cAAsB,GACvB,EAAE,uBAAuB,GAAG,sBAAsB,CAq1ClD"}
@@ -5,7 +5,8 @@
5
5
  /**
6
6
  * @file useSheetGestures.ts
7
7
  * @input Uses React (useCallback, useEffect, useMemo, useRef, useState)
8
- * @output Exports useSheetGestures hook and its option/result types
8
+ * @output Exports useSheetGestures hook, its option/result types, and the
9
+ * height and end-inset formats a host renders for the layout split
9
10
  * @position Internal to BottomSheet; not exported from the core entry point
10
11
  *
11
12
  * Drag + snap machinery for the bottom sheet. Tracks a pointer drag down the
@@ -26,10 +27,18 @@
26
27
  * A live drag writes that transform straight to the sheet element, once per
27
28
  * input sample, and renders nothing: React state changes when the drag begins
28
29
  * and ends, and in between only when the layout split changes (a drag that
29
- * crosses above its base detent restores the full height). The live offset
30
- * is readable through `activeOffsetRef`. The host owns the element's
31
- * transform outside a drag and writes the resting value after each commit,
32
- * so a settle animates from wherever the finger left the sheet.
30
+ * crosses above its base detent restores the full height). That crossing
31
+ * changes three things that only look right together: the transform, the
32
+ * sheet's height and the scrolling area's end inset. The move writes all
33
+ * three to the elements in the same task, so the browser paints them in one
34
+ * frame, and the render it schedules catches the host up to the same values
35
+ * whenever it commits; it never decides what the next frame shows. The live
36
+ * offset is readable through `activeOffsetRef`. The host owns the element's
37
+ * transform, height and end inset outside a drag and writes their resting
38
+ * values after each commit (a host with a fixed height of its own keeps that
39
+ * height, and the drag never writes it), so a settle animates from wherever the finger
40
+ * left the sheet, and a release processed before the crossing move's render
41
+ * commits still leaves the sheet drawn at its resting detent.
33
42
  *
34
43
  * Those are pixels, and the stops behind them are relative to the viewport, so
35
44
  * a sheet at rest re-resolves its detent on `resize` / `orientationchange`,
@@ -172,6 +181,25 @@ function magnetize(value, targets) {
172
181
  function preservationInsetForOffset(baseOffset, targetOffset, naturalEndGap) {
173
182
  return Math.max(0, baseOffset - targetOffset - naturalEndGap);
174
183
  }
184
+
185
+ /**
186
+ * The sheet's height, in px, while it is in motion or rests with a layout
187
+ * split: the fully open height less the part the scrolling area gives up.
188
+ * The host renders it and a live drag writes it; one format keeps the two
189
+ * identical, so the render that follows a written value changes nothing.
190
+ */
191
+ export function sheetLayoutHeight(sheetHeight, layoutOffset) {
192
+ return `${Math.max(0, sheetHeight - Math.max(0, layoutOffset))}px`;
193
+ }
194
+
195
+ /**
196
+ * The scrolling area's end padding that preserves its scroll position across
197
+ * a height change, or nothing when there is none to add. Shared by the host's
198
+ * render and a live drag's write for the same reason as sheetLayoutHeight.
199
+ */
200
+ export function scrollPreservationPadding(inset) {
201
+ return inset > 0 ? `${inset}px` : undefined;
202
+ }
175
203
  function renderedBlockEndPadding(element) {
176
204
  const value = Number.parseFloat(getComputedStyle(element).paddingBlockEnd);
177
205
  return Number.isFinite(value) ? value : 0;
@@ -299,7 +327,8 @@ export function useSheetGestures({
299
327
  onDismiss,
300
328
  snapHeights,
301
329
  onSnap,
302
- onScrimOpacity
330
+ onScrimOpacity,
331
+ hasFixedHeight = false
303
332
  }) {
304
333
  const [dragOffset, setDragOffset] = useState(0);
305
334
  const [settledOffset, setSettledOffset] = useState(0);
@@ -416,11 +445,13 @@ export function useSheetGestures({
416
445
  const canDismissRef = useRef(canDismiss);
417
446
  const onSnapRef = useRef(onSnap);
418
447
  const onScrimOpacityRef = useRef(onScrimOpacity);
448
+ const hasFixedHeightRef = useRef(hasFixedHeight);
419
449
  useEffect(() => {
420
450
  onDismissRef.current = onDismiss;
421
451
  canDismissRef.current = canDismiss;
422
452
  onSnapRef.current = onSnap;
423
453
  onScrimOpacityRef.current = onScrimOpacity;
454
+ hasFixedHeightRef.current = hasFixedHeight;
424
455
  });
425
456
 
426
457
  // Live drag bookkeeping (refs so pointermove doesn't churn renders).
@@ -642,6 +673,27 @@ export function useSheetGestures({
642
673
  const translation = offset - layoutOffset;
643
674
  element.style.transform = translation !== 0 ? `translateY(${translation}px)` : '';
644
675
  }, []);
676
+
677
+ // A live drag's layout split moved. The transform written beside this call
678
+ // is only correct on the new split, so the height and end inset that pair
679
+ // with it go to the elements in the same task. They are the values the host
680
+ // renders from the state this move also sets, in the same format, so its
681
+ // commit, whenever it lands, leaves them as they are. If the drag ends
682
+ // before that commit, the host's post-commit write puts the resting values
683
+ // back, since React sees no change from what it committed before the drag.
684
+ // A host with a fixed height of its own renders that height throughout and
685
+ // never restores a written one, so its height is not written.
686
+ const writeLiveLayout = useCallback((sheetHeight, layoutOffset) => {
687
+ const element = sheetElRef.current;
688
+ // Unmeasured, the host renders no height to pair with.
689
+ if (element != null && sheetHeight > 0 && !hasFixedHeightRef.current) {
690
+ element.style.height = sheetLayoutHeight(sheetHeight, layoutOffset);
691
+ }
692
+ const body = bodyNodeRef.current;
693
+ if (body != null) {
694
+ body.style.paddingBlockEnd = scrollPreservationPadding(scrollPreservationInsetRef.current) ?? '';
695
+ }
696
+ }, []);
645
697
  const cancelDrag = useCallback(target => {
646
698
  const state = dragStateRef.current;
647
699
  if (state == null) {
@@ -863,17 +915,22 @@ export function useSheetGestures({
863
915
  state.renderedOffset = next;
864
916
  state.layoutOffset = layoutOffset;
865
917
  activeOffsetRef.current = next;
918
+ updateScrollPreservationInset(preservationInsetForOffset(state.baseLayoutOffset, layoutOffset, state.naturalEndGap));
866
919
  writeLiveTransform(next, layoutOffset);
867
920
  if (hasLayoutChanged) {
868
- // The layout split moved: the host renders the new height, reading
869
- // the offset it has to pair with it from state.
921
+ // The layout split moved. The new height and end inset are written
922
+ // with the transform, in this task: a render scheduled normally can
923
+ // commit after the next paint, and the transform alone on the old
924
+ // height would put the sheet the whole split away from the finger
925
+ // for that frame. The host still renders them from state, reading
926
+ // the offset it has to pair with the height from here.
927
+ writeLiveLayout(state.height, layoutOffset);
870
928
  setDragOffset(next);
871
929
  }
872
930
  if (!state.hasTraveled && next !== state.baseOffset) {
873
931
  state.hasTraveled = true;
874
932
  setIsTraveling(true);
875
933
  }
876
- updateScrollPreservationInset(preservationInsetForOffset(state.baseLayoutOffset, layoutOffset, state.naturalEndGap));
877
934
 
878
935
  // Mirror the scrim to the live drag: full at/above the mid detent,
879
936
  // fading to hidden as it collapses onto the peek detent and through the
@@ -882,7 +939,7 @@ export function useSheetGestures({
882
939
  const shortestDetentHeight = visibleHeightForOffset(state.height, floorOffset, offscreenBlockEndInsetRef.current);
883
940
  const dismissOffset = floorOffset + shortestDetentHeight * DISMISS_OVERSHOOT_RATIO;
884
941
  onScrimOpacityRef.current?.(scrimOpacityForOffset(next, offsets, dismissOffset, peekOffset));
885
- }, [resolveDetents, updateScrollPreservationInset, writeLiveTransform]);
942
+ }, [resolveDetents, updateScrollPreservationInset, writeLiveLayout, writeLiveTransform]);
886
943
  const endDrag = useCallback(event => {
887
944
  const state = dragStateRef.current;
888
945
  if (!state || state.pointerId !== event.pointerId) {
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../src/FileInput/FileInput.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAUlB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA2P9C,MAAM,WAAW,cAAe,SAAQ,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GG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,aAAqB,EACrB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,MAAM,EAAE,UAAU,EAClB,aAA0B,EAC1B,WAAW,EACX,WAAW,EACX,IAAc,EACd,UAAkB,EAClB,YAAY,EACZ,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EAAE,MAAM,EACV,GAAG,SAAS,EACb,EAAE,cAAc,+BA0fhB;yBAzhBe,SAAS"}
1
+ {"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../src/FileInput/FileInput.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAUlB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA2P9C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,mBAAmB,EACnB,UAAU,GAAG,cAAc,GAAG,OAAO,CACtC;IACC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,E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KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,MAAM,EAAE,UAAU,EAClB,aAA0B,EAC1B,WAAW,EACX,WAAW,EACX,IAAc,EACd,UAAkB,EAClB,YAAY,EACZ,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EAAE,MAAM,EACV,GAAG,SAAS,EACb,EAAE,cAAc,+BAshBhB;yBArjBe,SAAS"}
@@ -307,6 +307,30 @@ export function FileInput({
307
307
  // The tooltip variant renders no message box; describe the input by the
308
308
  // tooltip's content instead so the status is still announced.
309
309
  statusTooltipDescribedBy, conveysRequired ? requiredID : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
310
+
311
+ // The native input keeps taking the caller's base props (the shared FR10
312
+ // contract), but it is `aria-hidden` and never focused, so a caller's
313
+ // `aria-*` props are also set on the trigger, the field's focusable control,
314
+ // where assistive tech reads them. The ones the trigger composes itself are
315
+ // not copied, and a caller's description is joined to its own, first.
316
+ const {
317
+ 'aria-describedby': callerDescribedBy,
318
+ 'aria-label': _callerLabel,
319
+ 'aria-labelledby': _callerLabelledBy,
320
+ 'aria-hidden': _callerHidden,
321
+ 'aria-disabled': _callerDisabled,
322
+ 'aria-busy': _callerBusy,
323
+ 'aria-invalid': _callerInvalid,
324
+ ...otherRest
325
+ } = rest;
326
+ const triggerAriaProps = {};
327
+ for (const [key, value] of Object.entries(otherRest)) {
328
+ // Booleans and numbers are valid ARIA values too: React serializes them.
329
+ if (key.startsWith('aria-') && value != null) {
330
+ triggerAriaProps[key] = value;
331
+ }
332
+ }
333
+ const triggerDescribedBy = [callerDescribedBy, ariaDescribedBy].filter(Boolean).join(' ') || undefined;
310
334
  const defaultPlaceholder = isMultiple ? t('@astryx.fileInput.placeholderMultiple') : t('@astryx.fileInput.placeholder');
311
335
  const displayPlaceholder = placeholder ?? defaultPlaceholder;
312
336
  const handleFiles = useCallback(fileList => {
@@ -598,8 +622,9 @@ export function FileInput({
598
622
  fileNames
599
623
  }) : label,
600
624
  "aria-busy": isBusy || undefined,
601
- "aria-describedby": ariaDescribedBy,
602
- "aria-invalid": status?.type === 'error' ? 'true' : undefined
625
+ "aria-invalid": status?.type === 'error' ? 'true' : undefined,
626
+ ...triggerAriaProps,
627
+ "aria-describedby": triggerDescribedBy
603
628
  })
604
629
  }), /*#__PURE__*/_jsx("input", {
605
630
  ...rest,
@@ -2,11 +2,13 @@
2
2
  * @file useTouchTrigger.ts
3
3
  * @input Touch trigger mode, layer open state, trigger ref, show/hide callbacks
4
4
  * @output Exports useTouchTrigger hook, isActionTrigger, LayerTouchTrigger type,
5
- * TOUCH_POINTER_TYPES and useTapStop (internal: not re-exported from index)
5
+ * tapLandsOnDisabledControl, TOUCH_POINTER_TYPES and useTapStop (internal:
6
+ * not re-exported from index)
6
7
  * @position Layer hook; shared touch behavior for useTooltip and useHoverCard
7
8
  *
8
9
  * SYNC: When modified, update:
9
10
  * - /packages/core/src/Layer/index.ts
11
+ * - /packages/core/src/hooks/useClickableContainer.ts (innermostInteractive)
10
12
  *
11
13
  * Hover is the one trigger a touch screen cannot express. A tap synthesizes
12
14
  * `mouseenter`, so an untreated hover layer either opens on every tap and
@@ -20,7 +22,10 @@
20
22
  * action — an info icon, an abbreviation, a truncated label — has nothing to
21
23
  * lose, so the tap opens the layer and the next tap outside dismisses it. That
22
24
  * is `auto`; `tap` and `none` state the choice outright, which is what an
23
- * icon-button whose only job is to reveal the layer needs.
25
+ * icon-button whose only job is to reveal the layer needs. An `aria-disabled`
26
+ * control performs no action: a tap that lands in one, or on a label for a
27
+ * disabled control, opens the layer, so its reason has a touch path. (A
28
+ * natively `disabled` control receives no click at all.)
24
29
  *
25
30
  * A touch decides nothing until it is a tap. A finger landing on the trigger
26
31
  * may be starting a scroll, a pinch or a long press, and only the browser
@@ -72,6 +77,15 @@ export declare function useTapStop(event: 'mousedown'): {
72
77
  * with no role) gets both: the layer opens and the handler runs.
73
78
  */
74
79
  export declare function isActionTrigger(element: HTMLElement): boolean;
80
+ /**
81
+ * Whether a tap landed in a disabled control: walking out from the tapped
82
+ * element on the clickable containers' own walk (`innermostInteractive`),
83
+ * with labels counted, the innermost interactive element is an
84
+ * `aria-disabled` control or a label for a disabled control. That element
85
+ * takes the tap: the layer opens with its reason, and nothing activates.
86
+ * Every other tap is left to the trigger (`isActionTrigger`).
87
+ */
88
+ export declare function tapLandsOnDisabledControl(tapped: Element): boolean;
75
89
  export interface UseTouchTriggerOptions {
76
90
  /** How the layer should behave on a touch pointer. */
77
91
  touchTrigger: LayerTouchTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"useTouchTrigger.d.ts","sourceRoot":"","sources":["../../src/Layer/useTouchTrigger.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAIL,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,aAA4B,CAAC;AAE7D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG;IAC1C,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CACpD,CAAC;AACF,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG;IAC9C,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAA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I,CAAC,CAAC;IAE1C,uDAAuD;IACvD,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB,mCAAmC;IACnC,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,iBAAiB,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAEtC;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC;IAElC;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAElD;;;;;;OAMG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;IAEpD,gFAAgF;IAChF,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CA4MvB"}
@@ -6,11 +6,13 @@
6
6
  * @file useTouchTrigger.ts
7
7
  * @input Touch trigger mode, layer open state, trigger ref, show/hide callbacks
8
8
  * @output Exports useTouchTrigger hook, isActionTrigger, LayerTouchTrigger type,
9
- * TOUCH_POINTER_TYPES and useTapStop (internal: not re-exported from index)
9
+ * tapLandsOnDisabledControl, TOUCH_POINTER_TYPES and useTapStop (internal:
10
+ * not re-exported from index)
10
11
  * @position Layer hook; shared touch behavior for useTooltip and useHoverCard
11
12
  *
12
13
  * SYNC: When modified, update:
13
14
  * - /packages/core/src/Layer/index.ts
15
+ * - /packages/core/src/hooks/useClickableContainer.ts (innermostInteractive)
14
16
  *
15
17
  * Hover is the one trigger a touch screen cannot express. A tap synthesizes
16
18
  * `mouseenter`, so an untreated hover layer either opens on every tap and
@@ -24,7 +26,10 @@
24
26
  * action — an info icon, an abbreviation, a truncated label — has nothing to
25
27
  * lose, so the tap opens the layer and the next tap outside dismisses it. That
26
28
  * is `auto`; `tap` and `none` state the choice outright, which is what an
27
- * icon-button whose only job is to reveal the layer needs.
29
+ * icon-button whose only job is to reveal the layer needs. An `aria-disabled`
30
+ * control performs no action: a tap that lands in one, or on a label for a
31
+ * disabled control, opens the layer, so its reason has a touch path. (A
32
+ * natively `disabled` control receives no click at all.)
28
33
  *
29
34
  * A touch decides nothing until it is a tap. A finger landing on the trigger
30
35
  * may be starting a scroll, a pinch or a long press, and only the browser
@@ -39,6 +44,8 @@
39
44
  */
40
45
  import { useCallback, useEffect, useRef } from 'react';
41
46
  import { currentGesture } from "./gestureCounter.js";
47
+ import { innermostInteractive, matchesInteractiveSelectors } from "../hooks/useClickableContainer.js";
48
+ import { isDisabledControl } from "../utils/pressDisabled.js";
42
49
  import { useInteractionModalityTrackingFor } from "../utils/interactionModality.js";
43
50
 
44
51
  /**
@@ -98,14 +105,25 @@ const ACTION_ROLES = new Set(['button', 'checkbox', 'combobox', 'link', 'menuite
98
105
  * with no role) gets both: the layer opens and the handler runs.
99
106
  */
100
107
  export function isActionTrigger(element) {
108
+ // A disabled control performs no action: its tap is free to open the layer
109
+ // that explains why it is disabled.
110
+ if (isDisabledControl(element)) {
111
+ return false;
112
+ }
101
113
  const role = element.getAttribute('role');
102
114
  if (role != null && role !== '') {
103
115
  return ACTION_ROLES.has(role);
104
116
  }
105
117
  switch (element.tagName) {
118
+ case 'LABEL':
119
+ {
120
+ // A label acts by operating its control, so a label for a disabled one
121
+ // performs none.
122
+ const control = element.control;
123
+ return control == null || !isDisabledControl(control);
124
+ }
106
125
  case 'BUTTON':
107
126
  case 'INPUT':
108
- case 'LABEL':
109
127
  case 'SELECT':
110
128
  case 'SUMMARY':
111
129
  case 'TEXTAREA':
@@ -118,6 +136,34 @@ export function isActionTrigger(element) {
118
136
  }
119
137
  }
120
138
 
139
+ /**
140
+ * Whether this element takes a tap itself, as a disabled control does: an
141
+ * `aria-disabled` (or `:disabled`) control, or a label for one.
142
+ */
143
+ function isDisabledTarget(element) {
144
+ if (isDisabledControl(element)) {
145
+ return true;
146
+ }
147
+ if (element.tagName === 'LABEL') {
148
+ const control = element.control;
149
+ return control != null && isDisabledControl(control);
150
+ }
151
+ return false;
152
+ }
153
+
154
+ /**
155
+ * Whether a tap landed in a disabled control: walking out from the tapped
156
+ * element on the clickable containers' own walk (`innermostInteractive`),
157
+ * with labels counted, the innermost interactive element is an
158
+ * `aria-disabled` control or a label for a disabled control. That element
159
+ * takes the tap: the layer opens with its reason, and nothing activates.
160
+ * Every other tap is left to the trigger (`isActionTrigger`).
161
+ */
162
+ export function tapLandsOnDisabledControl(tapped) {
163
+ const innermost = innermostInteractive(tapped, null, element => matchesInteractiveSelectors(element) || element.tagName === 'LABEL' || isDisabledControl(element));
164
+ return innermost != null && isDisabledTarget(innermost);
165
+ }
166
+
121
167
  /**
122
168
  * Whether typing into this element edits it. Reads the attribute as well as
123
169
  * the property: jsdom does not implement `isContentEditable`, and an editor
@@ -235,9 +281,12 @@ export function useTouchTrigger(options) {
235
281
  // What a tap on the trigger does. It runs from the tap's `click`, after the
236
282
  // render that armed it, so it reads the latest props through this ref.
237
283
  const answerTapRef = useRef(() => {});
238
- answerTapRef.current = () => {
284
+ answerTapRef.current = tapEvent => {
239
285
  const trigger = triggerRef.current;
240
- const mode = touchTrigger === 'auto' ? trigger != null && isActionTrigger(trigger) ? 'none' : 'tap' : touchTrigger;
286
+ // A tap that landed in a disabled control is that control's: its reason
287
+ // opens. Every other tap is the trigger's to decide.
288
+ const tapped = tapEvent.target instanceof Element ? tapEvent.target : null;
289
+ const mode = touchTrigger === 'auto' ? tapped != null && tapLandsOnDisabledControl(tapped) ? 'tap' : trigger != null && isActionTrigger(trigger) ? 'none' : 'tap' : touchTrigger;
241
290
  if (mode === 'none' || !isEnabled) {
242
291
  // A layer left open by an earlier tap must not survive the next one.
243
292
  disarmOutsideDismiss();
@@ -279,10 +328,10 @@ export function useTouchTrigger(options) {
279
328
  forgetPendingTapRef.current = null;
280
329
  }
281
330
  };
282
- const handleTap = () => {
331
+ const handleTap = tapEvent => {
283
332
  forget();
284
333
  if (currentGesture() === gesture) {
285
- answerTapRef.current();
334
+ answerTapRef.current(tapEvent);
286
335
  }
287
336
  };
288
337
  trigger.addEventListener('click', handleTap);
@@ -1 +1 @@
1
- {"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/Toast/useToast.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,SAAS,CAAC;AAoIjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAetC"}
1
+ {"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/Toast/useToast.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,SAAS,CAAC;AAwIjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAetC"}
@@ -7,6 +7,7 @@ import { createRoot } from 'react-dom/client';
7
7
  import { dataAttr } from "../naming.js";
8
8
  import { ToastContext } from "./ToastContext.js";
9
9
  import { ToastViewport } from "./ToastViewport.js";
10
+ import { ThemeNestingContext } from "../theme/Theme.js";
10
11
  import { warnOnce } from "../utils/devWarning.js";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  // Fallback singleton
@@ -79,8 +80,13 @@ function getFallbackContext() {
79
80
  return null;
80
81
  };
81
82
  fallbackRoot = createRoot(container);
82
- fallbackRoot.render(/*#__PURE__*/_jsx(ToastViewport, {
83
- children: /*#__PURE__*/_jsx(FallbackCapture, {})
83
+ // This root sits inside the app, so a <Theme> in toast content is nested:
84
+ // it themes its own subtree and leaves the app's <html> sync alone.
85
+ fallbackRoot.render(/*#__PURE__*/_jsx(ThemeNestingContext, {
86
+ value: true,
87
+ children: /*#__PURE__*/_jsx(ToastViewport, {
88
+ children: /*#__PURE__*/_jsx(FallbackCapture, {})
89
+ })
84
90
  }));
85
91
 
86
92
  // Proxy that queues calls until real context is captured
@@ -1 +1 @@
1
- {"version":3,"file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