@astryxdesign/core 0.7.6-canary.2c32c71 → 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 (187) hide show
  1. package/dist/Badge/Badge.d.ts.map +1 -1
  2. package/dist/Badge/Badge.js +2 -1
  3. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheet.js +6 -2
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheetPanel.js +36 -9
  7. package/dist/BottomSheet/useSheetGestures.d.ts +36 -6
  8. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  9. package/dist/BottomSheet/useSheetGestures.js +67 -10
  10. package/dist/Breadcrumbs/BreadcrumbItem.js +4 -2
  11. package/dist/Chat/ChatComposer.d.ts.map +1 -1
  12. package/dist/Chat/ChatComposer.js +10 -5
  13. package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
  14. package/dist/Chat/ChatPastedTextToken.js +15 -4
  15. package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
  16. package/dist/CheckboxList/CheckboxList.js +5 -2
  17. package/dist/CheckboxList/CheckboxListContext.d.ts +8 -0
  18. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  19. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  20. package/dist/CheckboxList/CheckboxListItem.js +5 -2
  21. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  22. package/dist/CommandPalette/CommandPaletteInput.js +8 -5
  23. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  24. package/dist/DateInput/MonthScroller.js +17 -18
  25. package/dist/Dialog/Dialog.d.ts.map +1 -1
  26. package/dist/Dialog/Dialog.js +10 -15
  27. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  28. package/dist/DropdownMenu/DropdownMenu.js +19 -8
  29. package/dist/DropdownMenu/DropdownMenuGroup.d.ts.map +1 -1
  30. package/dist/DropdownMenu/DropdownMenuGroup.js +2 -1
  31. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  32. package/dist/DropdownMenu/DropdownMenuSubMenu.js +1 -1
  33. package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -1
  34. package/dist/DropdownMenu/MenuBottomSheetActionList.js +9 -3
  35. package/dist/Field/FieldLabel.d.ts.map +1 -1
  36. package/dist/Field/FieldLabel.js +19 -2
  37. package/dist/Field/PanelSearchInput.d.ts.map +1 -1
  38. package/dist/Field/PanelSearchInput.js +10 -5
  39. package/dist/FileInput/FileInput.d.ts.map +1 -1
  40. package/dist/FileInput/FileInput.js +60 -24
  41. package/dist/Item/ItemSwipeLayer.d.ts.map +1 -1
  42. package/dist/Item/ItemSwipeLayer.js +8 -2
  43. package/dist/Layer/useTouchTrigger.d.ts +35 -3
  44. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  45. package/dist/Layer/useTouchTrigger.js +80 -11
  46. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  47. package/dist/MultiSelector/MultiSelector.js +15 -14
  48. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  49. package/dist/NumberInput/NumberInput.js +11 -15
  50. package/dist/RadioList/RadioList.d.ts.map +1 -1
  51. package/dist/RadioList/RadioList.js +7 -2
  52. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  53. package/dist/RadioList/RadioListItem.js +8 -2
  54. package/dist/RadioList/RadioListReasonContext.d.ts +2 -0
  55. package/dist/RadioList/RadioListReasonContext.d.ts.map +1 -0
  56. package/dist/RadioList/RadioListReasonContext.js +22 -0
  57. package/dist/Resizable/useResizable.d.ts.map +1 -1
  58. package/dist/Resizable/useResizable.js +53 -10
  59. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  60. package/dist/SegmentedControl/SegmentedControl.js +22 -5
  61. package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
  62. package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  63. package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
  64. package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
  65. package/dist/SegmentedControl/SegmentedControlItem.js +16 -3
  66. package/dist/Selector/Selector.d.ts.map +1 -1
  67. package/dist/Selector/Selector.js +4 -1
  68. package/dist/Selector/useSelectorPresentation.d.ts +7 -1
  69. package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
  70. package/dist/Selector/useSelectorPresentation.js +2 -1
  71. package/dist/Slider/Slider.d.ts.map +1 -1
  72. package/dist/Slider/Slider.js +100 -17
  73. package/dist/Toast/useToast.d.ts.map +1 -1
  74. package/dist/Toast/useToast.js +8 -2
  75. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  76. package/dist/ToggleButton/ToggleButton.js +8 -2
  77. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  78. package/dist/Tokenizer/Tokenizer.js +57 -49
  79. package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
  80. package/dist/Tokenizer/TokenizerBottomSheet.js +8 -14
  81. package/dist/Typeahead/BaseTypeahead.d.ts +4 -1
  82. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  83. package/dist/Typeahead/BaseTypeahead.js +262 -43
  84. package/dist/Typeahead/index.d.ts +1 -1
  85. package/dist/Typeahead/index.d.ts.map +1 -1
  86. package/dist/Typeahead/types.d.ts +26 -3
  87. package/dist/Typeahead/types.d.ts.map +1 -1
  88. package/dist/gestures/haptics.d.ts.map +1 -1
  89. package/dist/gestures/haptics.js +1 -5
  90. package/dist/hooks/useClickableContainer.d.ts +24 -4
  91. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  92. package/dist/hooks/useClickableContainer.js +41 -14
  93. package/dist/hooks/useFocusReturnVisibility.d.ts +8 -1
  94. package/dist/hooks/useFocusReturnVisibility.d.ts.map +1 -1
  95. package/dist/hooks/useFocusReturnVisibility.js +14 -8
  96. package/dist/hooks/useListFocus.d.ts +19 -0
  97. package/dist/hooks/useListFocus.d.ts.map +1 -1
  98. package/dist/hooks/useListFocus.js +26 -1
  99. package/dist/hooks/useMenuPress.js +3 -3
  100. package/dist/privateAttributes/segmentDisabled.stylex.d.ts +5 -0
  101. package/dist/privateAttributes/segmentDisabled.stylex.d.ts.map +1 -0
  102. package/dist/privateAttributes/segmentDisabled.stylex.js +28 -0
  103. package/dist/theme/Theme.d.ts +10 -0
  104. package/dist/theme/Theme.d.ts.map +1 -1
  105. package/dist/theme/Theme.js +8 -4
  106. package/dist/utils/focusReturn.d.ts +5 -3
  107. package/dist/utils/focusReturn.d.ts.map +1 -1
  108. package/dist/utils/focusReturn.js +6 -4
  109. package/dist/utils/interactionModality.d.ts +78 -7
  110. package/dist/utils/interactionModality.d.ts.map +1 -1
  111. package/dist/utils/interactionModality.js +125 -42
  112. package/dist/utils/pressDisabled.d.ts +21 -0
  113. package/dist/utils/pressDisabled.d.ts.map +1 -0
  114. package/dist/utils/pressDisabled.js +32 -0
  115. package/package.json +5 -4
  116. package/src/Badge/Badge.tsx +2 -1
  117. package/src/BottomSheet/BottomSheet.tsx +4 -2
  118. package/src/BottomSheet/BottomSheetPanel.tsx +39 -8
  119. package/src/BottomSheet/useSheetGestures.ts +92 -15
  120. package/src/Breadcrumbs/BreadcrumbItem.tsx +2 -1
  121. package/src/Chat/ChatComposer.tsx +7 -10
  122. package/src/Chat/ChatPastedTextToken.tsx +14 -4
  123. package/src/CheckboxList/CheckboxList.tsx +7 -1
  124. package/src/CheckboxList/CheckboxListContext.tsx +8 -0
  125. package/src/CheckboxList/CheckboxListItem.tsx +8 -2
  126. package/src/CommandPalette/CommandPaletteInput.tsx +5 -8
  127. package/src/DateInput/MonthScroller.tsx +15 -17
  128. package/src/Dialog/Dialog.tsx +9 -25
  129. package/src/DropdownMenu/DropdownMenu.tsx +24 -9
  130. package/src/DropdownMenu/DropdownMenuGroup.tsx +2 -1
  131. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +3 -1
  132. package/src/DropdownMenu/MenuBottomSheetActionList.tsx +6 -3
  133. package/src/Field/Field.doc.mjs +2 -1
  134. package/src/Field/FieldLabel.doc.mjs +4 -2
  135. package/src/Field/FieldLabel.spec.md +72 -55
  136. package/src/Field/FieldLabel.tsx +18 -2
  137. package/src/Field/PanelSearchInput.tsx +7 -8
  138. package/src/FileInput/FileInput.tsx +68 -24
  139. package/src/HoverCard/HoverCard.doc.mjs +3 -3
  140. package/src/HoverCard/HoverCard.spec.md +98 -39
  141. package/src/HoverCard/useHoverCard.doc.mjs +1 -1
  142. package/src/InfoTip/InfoTip.spec.md +193 -0
  143. package/src/Item/ItemSwipeLayer.tsx +8 -1
  144. package/src/Layer/useTouchTrigger.ts +107 -18
  145. package/src/Layout/LayoutPanel.spec.md +60 -38
  146. package/src/MultiSelector/MultiSelector.tsx +36 -29
  147. package/src/NumberInput/NumberInput.tsx +11 -18
  148. package/src/RadioList/RadioList.tsx +13 -2
  149. package/src/RadioList/RadioListItem.tsx +9 -1
  150. package/src/RadioList/RadioListReasonContext.ts +25 -0
  151. package/src/Resizable/Resizable.spec.md +41 -33
  152. package/src/Resizable/useResizable.ts +50 -7
  153. package/src/SegmentedControl/SegmentedControl.spec.md +36 -39
  154. package/src/SegmentedControl/SegmentedControl.tsx +43 -8
  155. package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
  156. package/src/SegmentedControl/SegmentedControlItem.spec.md +1 -1
  157. package/src/SegmentedControl/SegmentedControlItem.tsx +12 -1
  158. package/src/Selector/Selector.tsx +4 -0
  159. package/src/Selector/useSelectorPresentation.ts +8 -1
  160. package/src/SideNav/SideNav.spec.md +8 -8
  161. package/src/Slider/Slider.spec.md +18 -16
  162. package/src/Slider/Slider.tsx +116 -19
  163. package/src/StatusDot/StatusDot.spec.md +77 -54
  164. package/src/Toast/useToast.tsx +8 -3
  165. package/src/ToggleButton/ToggleButton.tsx +9 -3
  166. package/src/Tokenizer/Tokenizer.doc.mjs +12 -8
  167. package/src/Tokenizer/Tokenizer.tsx +69 -51
  168. package/src/Tokenizer/TokenizerBottomSheet.tsx +8 -14
  169. package/src/Tooltip/Tooltip.doc.mjs +3 -3
  170. package/src/Tooltip/Tooltip.spec.md +139 -41
  171. package/src/Tooltip/useTooltip.doc.mjs +1 -1
  172. package/src/Typeahead/BaseTypeahead.doc.mjs +7 -4
  173. package/src/Typeahead/BaseTypeahead.tsx +314 -40
  174. package/src/Typeahead/Typeahead.doc.mjs +21 -4
  175. package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
  176. package/src/Typeahead/index.ts +1 -1
  177. package/src/Typeahead/types.ts +27 -3
  178. package/src/gestures/haptics.ts +1 -8
  179. package/src/hooks/useClickableContainer.ts +48 -17
  180. package/src/hooks/useFocusReturnVisibility.ts +15 -12
  181. package/src/hooks/useListFocus.ts +38 -1
  182. package/src/hooks/useMenuPress.ts +3 -3
  183. package/src/privateAttributes/segmentDisabled.stylex.ts +28 -0
  184. package/src/theme/Theme.tsx +8 -4
  185. package/src/utils/focusReturn.ts +6 -4
  186. package/src/utils/interactionModality.ts +165 -44
  187. package/src/utils/pressDisabled.ts +32 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/Badge/Badge.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAW5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAwJ7C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAmB,EACnB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,UAAU,+BA6CZ;yBAtDe,KAAK"}
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/Badge/Badge.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAY5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAwJ7C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAmB,EACnB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,UAAU,+BA6CZ;yBAtDe,KAAK"}
@@ -19,6 +19,7 @@ import "../theme/tokens.stylex.js";
19
19
  import { colorVars, spacingVars, radiusVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
20
20
  import { mergeProps } from "../utils/index.js";
21
21
  import { themeProps } from "../utils/themeProps.js";
22
+ import { isRenderable } from "../utils/isRenderable.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  /**
24
25
  * Base badge styles
@@ -187,7 +188,7 @@ export function Badge({
187
188
  // a client component, so it is tracked in #5585.
188
189
  const labelTitle = typeof label === 'number' ? String(label) : typeof label === 'string' && label.length > 0 ? label : undefined;
189
190
  // Whether the label renders anything, which is when the badge grows with it.
190
- const hasLabel = label !== '' && label != null && typeof label !== 'boolean';
191
+ const hasLabel = isRenderable(label);
191
192
  return /*#__PURE__*/_jsxs("span", {
192
193
  ref: ref,
193
194
  ...mergeProps(themeProps('badge', {
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAsDhD,YAAY,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAsJhF,UAAU,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,qDAAqD;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC,sCAAsC;IACtC,KAAK,EAAE,MAAM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C;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AAo0BxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
@@ -82,6 +82,7 @@ import "../theme/tokens.stylex.js";
82
82
  import { colorVars, durationVars, easeVars, spacingVars } from "../theme/tokens.stylex.js";
83
83
  import { useDevWarning } from "../hooks/useDevWarning.js";
84
84
  import { useScrollLock } from "../hooks/useScrollLock.js";
85
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
85
86
  import { mergeProps } from "../utils/mergeProps.js";
86
87
  import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
87
88
  import { ModalAnnounceProvider } from "../hooks/ModalAnnounceProvider.js";
@@ -523,7 +524,10 @@ function StandaloneBottomSheet({
523
524
  }
524
525
  triggerRef.current = null;
525
526
  }, [finalFocusRef, hasScrim, isOpen]);
526
- useInteractionModalityTracking();
527
+ const {
528
+ ref: modalityRef
529
+ } = useInteractionModalityTracking();
530
+ const dialogComposedRef = useMergedRefs(dialogRef, modalityRef);
527
531
  useScrollLock(shouldPresent && hasScrim);
528
532
  useDevWarning('BottomSheet', 'requires a non-empty `label` for an accessible name; the open sheet ' + 'has no built-in heading to derive one from.', isOpen && !label);
529
533
 
@@ -586,7 +590,7 @@ function StandaloneBottomSheet({
586
590
  // transforms the dialog: panel, grabber and all shrink and lift as
587
591
  // one. The backdrop is not a descendant and stays put.
588
592
  ...stackPositionerStyles(stackView), hasScrim && styles.scrim, hasScrim && isExiting && styles.scrimClosing, !hasScrim && styles.dialogNonModal),
589
- ref: dialogRef
593
+ ref: dialogComposedRef
590
594
  // A non-modal sheet is hosted in the top layer as a manual popover
591
595
  // (no light dismiss, no backdrop), so sheets order by presentation
592
596
  // without a page-level z-index. Below the Popover API floor the
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetPanel.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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,CAC9B,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,IAAI,EAAE,WAAW,GAChB,WAAW,EAAE,CAaf;AA4BD,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,MAAM,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gFAAgF;IAChF,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;;;;;;;OAUG;I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vB,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) {
@@ -356,7 +356,9 @@ function BreadcrumbMenuTrigger({
356
356
  // The menu's rows move focus with the last input
357
357
  // (`architecture:interaction-modality` INV1); this menu has no press model
358
358
  // to activate the tracking they read, so it activates it itself.
359
- useInteractionModalityTracking();
359
+ const {
360
+ ref: modalityRef
361
+ } = useInteractionModalityTracking();
360
362
  const popover = usePopover({
361
363
  hasLightDismiss: true,
362
364
  hasCloseButton: false,
@@ -447,7 +449,7 @@ function BreadcrumbMenuTrigger({
447
449
  const hasOverflow = useMenuOverflow(listRef, menuContent, popover.isOpen);
448
450
  return /*#__PURE__*/_jsxs(_Fragment, {
449
451
  children: [/*#__PURE__*/_jsxs("button", {
450
- ref: useMergedRefs(ref, buttonRef, popover.triggerRef),
452
+ ref: useMergedRefs(ref, buttonRef, modalityRef, popover.triggerRef),
451
453
  type: "button",
452
454
  onClick: handleClick,
453
455
  onKeyDown: handleKeyDown,
@@ -1 +1 @@
1
- {"version":3,"file":"ChatComposer.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatComposer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,c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rB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sBAAsB;IACtB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAI3B,6GAA6G;IAC7G,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yHAAyH;IACzH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,yGAAyG;IACzG,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gHAAgH;IAChH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,gHAAgH;IAChH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,gDAAgD;IAChD,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,oDAAoD;IACpD,cAAc,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CACnC;AAoOD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAoOpD;yBApOe,YAAY"}
@@ -34,8 +34,9 @@ import { ChatSendButton } from "./ChatSendButton.js";
34
34
  import { themeProps } from "../utils/themeProps.js";
35
35
  import { useTranslator } from "../i18n/index.js";
36
36
  import { useAnnounceRenderedText } from "../hooks/useAnnounceRenderedText.js";
37
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
37
38
  import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
38
- import { getInteractionModality, useInteractionModalityTracking } from "../utils/interactionModality.js";
39
+ import { useInteractionModalityTracking } from "../utils/interactionModality.js";
39
40
 
40
41
  // =============================================================================
41
42
  // Types
@@ -142,7 +143,6 @@ export function ChatComposer(props) {
142
143
  const placeholder = placeholderFromProps ?? t('@astryx.chat.composer.placeholder');
143
144
  const [internalValue, setInternalValue] = useState('');
144
145
  const [hasKeyboardEditorFocus, setHasKeyboardEditorFocus] = useState(false);
145
- useInteractionModalityTracking();
146
146
  const isControlled = controlledValue !== undefined;
147
147
  const currentValue = isControlled ? controlledValue : internalValue;
148
148
  const updateValue = useCallback(newValue => {
@@ -161,6 +161,11 @@ export function ChatComposer(props) {
161
161
  }, [isDisabled, onSubmit, updateValue]);
162
162
  const canSend = currentValue.trim().length > 0 && !isDisabled;
163
163
  const bodyRef = useRef(null);
164
+ const {
165
+ ref: modalityRef,
166
+ readModality
167
+ } = useInteractionModalityTracking();
168
+ const bodyComposedRef = useMergedRefs(bodyRef, modalityRef);
164
169
 
165
170
  // Input slot registers its focus (and future) control here so the shell can
166
171
  // drive it without knowing its DOM shape. Stable ref — safe in the memoized
@@ -185,8 +190,8 @@ export function ChatComposer(props) {
185
190
  editable?.focus();
186
191
  }, []);
187
192
  const handleBodyFocusCapture = useCallback(event => {
188
- setHasKeyboardEditorFocus(isComposerEditor(event.target) && getInteractionModality() === 'keyboard');
189
- }, []);
193
+ setHasKeyboardEditorFocus(isComposerEditor(event.target) && readModality() === 'keyboard');
194
+ }, [readModality]);
190
195
  const handleBodyBlurCapture = useCallback(event => {
191
196
  if (!event.currentTarget.contains(event.relatedTarget)) {
192
197
  setHasKeyboardEditorFocus(false);
@@ -268,7 +273,7 @@ export function ChatComposer(props) {
268
273
  }[!!isDisabled << 0], className, style),
269
274
  ...rest,
270
275
  children: [statusPosition === 'top' && statusEl, drawer, /*#__PURE__*/_jsxs("div", {
271
- ref: bodyRef,
276
+ ref: bodyComposedRef,
272
277
  onClick: handleBodyClick,
273
278
  onPointerDownCapture: () => setHasKeyboardEditorFocus(false),
274
279
  onFocusCapture: handleBodyFocusCapture,
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPastedTextToken.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatPastedTextToken.tsx"],"names":[],"mappings":"AAiCA,MAAM,WAAW,wBAAwB;IACvC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAkDD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,QAAQ,GACT,EAAE,wBAAwB,+BA8B1B;yBAjCe,mBAAmB"}
1
+ {"version":3,"file":"ChatPastedTextToken.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatPastedTextToken.tsx"],"names":[],"mappings":"AAoCA,MAAM,WAAW,wBAAwB;IACvC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAkDD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,QAAQ,GACT,EAAE,wBAAwB,+BAqC1B;yBAxCe,mBAAmB"}
@@ -4,12 +4,14 @@
4
4
 
5
5
  /**
6
6
  * @file ChatPastedTextToken.tsx
7
- * @input Uses React, StyleX, Badge, HoverCard, Button, provider-bound translator
7
+ * @input Uses React, StyleX, Badge, HoverCard, Button, provider-bound translator,
8
+ * the shared tap stop (`useTapStop`)
8
9
  * @output Exports ChatPastedTextToken component
9
10
  * @position Inline token for pasted text with hover card preview + expand
10
11
  *
11
- * Hover: card with truncated text preview and "Expand" button.
12
- * Expand replaces the token with the full text in the contentEditable.
12
+ * Hover, or a tap by finger or pen: card with truncated text preview and
13
+ * "Expand" button. Expand replaces the token with the full text in the
14
+ * contentEditable.
13
15
  *
14
16
  * SYNC: When modified, update:
15
17
  * - /packages/core/src/Chat/index.ts (exports)
@@ -21,6 +23,7 @@ import { Badge } from "../Badge/index.js";
21
23
  import { Button } from "../Button/index.js";
22
24
  import { HoverCard } from "../HoverCard/index.js";
23
25
  import { useTranslator } from "../i18n/index.js";
26
+ import { useTapStop } from "../Layer/useTouchTrigger.js";
24
27
 
25
28
  // =============================================================================
26
29
  // Types
@@ -49,6 +52,13 @@ export function ChatPastedTextToken({
49
52
  }) {
50
53
  const t = useTranslator();
51
54
  const label = formatLabel(text, t);
55
+ // A tap on the token, by finger or pen, asks for its preview, so it stops
56
+ // there: cancelling the mouse press the browser makes of it keeps the
57
+ // composer around the token from taking focus and the caret, which on a
58
+ // touch device raises the keyboard over the preview. The tap's click still
59
+ // reaches the card's trigger. A mouse press still places the caret, and
60
+ // hover opens the preview.
61
+ const tapStop = useTapStop('mousedown');
52
62
  const cardContent = /*#__PURE__*/_jsxs("div", {
53
63
  ...{
54
64
  className: "x78zum5 xdt5ytf x1txdalj x17fpy1y"
@@ -82,7 +92,8 @@ export function ChatPastedTextToken({
82
92
  hasHoverIndication: false,
83
93
  children: /*#__PURE__*/_jsx(Badge, {
84
94
  label: label,
85
- variant: "neutral"
95
+ variant: "neutral",
96
+ ...tapStop
86
97
  })
87
98
  });
88
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAarD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,mBAAmB,CAAC,cAAc,CAAC,EACnC,UAAU,CACX;IACC,mDAAmD;IACnD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,OAAoB,EACpB,WAAmB,EACnB,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,QAAQ,EACR,GAAG,EACH,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EAAE,kBAAkB,EACrC,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,iBAAiB,+BA2InB;yBApKe,YAAY"}
1
+ {"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;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BG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,OAAoB,EACpB,WAAmB,EACnB,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,QAAQ,EACR,GAAG,EACH,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EAAE,kBAAkB,EACrC,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,iBAAiB,+BAiJnB;yBA1Ke,YAAY"}
@@ -96,7 +96,9 @@ export function CheckboxList({
96
96
  // Disabled-reason tooltip. Applies to the whole-group disabled state. Disabled
97
97
  // controls swallow pointer events, so the tooltip listeners attach to the
98
98
  // group container and the checkboxes stay perceivable via aria-disabled
99
- // instead of the disabled attribute. Toggling is blocked in the item.
99
+ // instead of the disabled attribute. Toggling is blocked in the item. The
100
+ // reason describes the group and each checkbox (see
101
+ // CheckboxListContextValue.disabledMessageID).
100
102
  const showsDisabledMessage = isDisabled && !!disabledMessage;
101
103
  const disabledMessageTooltip = useTooltip({
102
104
  placement: 'above',
@@ -122,9 +124,10 @@ export function CheckboxList({
122
124
  onChange: isCollectionMode ? handleChange : undefined,
123
125
  isDisabled,
124
126
  hasDisabledMessage: showsDisabledMessage,
127
+ disabledMessageID: showsDisabledMessage ? disabledMessageTooltip.describedBy : undefined,
125
128
  isReadOnly,
126
129
  loadingValues
127
- }), [isCollectionMode, optimisticValue, handleChange, isDisabled, showsDisabledMessage, isReadOnly, loadingValues]);
130
+ }), [isCollectionMode, optimisticValue, handleChange, isDisabled, showsDisabledMessage, disabledMessageTooltip.describedBy, isReadOnly, loadingValues]);
128
131
  return /*#__PURE__*/_jsxs(Field, {
129
132
  label: label,
130
133
  isLabelHidden: isLabelHidden,
@@ -15,6 +15,14 @@ export interface CheckboxListContextValue {
15
15
  * and AT-discoverable; toggling is still blocked.
16
16
  */
17
17
  hasDisabledMessage?: boolean;
18
+ /**
19
+ * The id of the group's reason tooltip while `hasDisabledMessage` is true.
20
+ * The reason describes the group (CheckboxList FR1) and every checkbox adds
21
+ * it to its own `aria-describedby` (FR9): a screen reader announces a
22
+ * checkbox's description when the checkbox takes focus, which it does not
23
+ * reliably do for a description on the group.
24
+ */
25
+ disabledMessageID?: string;
18
26
  isReadOnly: boolean;
19
27
  /**
20
28
  * Values of the items whose `changeAction` is pending. Each matching item
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxListContext.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxListContext.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,mBAAmB,0DACiC,CAAC"}
1
+ {"version":3,"file":"CheckboxListContext.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxListContext.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,mBAAmB,0DACiC,CAAC"}