@astryxdesign/core 0.4.3 → 0.4.4-canary.0e8af82

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 (254) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +79 -45
  3. package/dist/Banner/Banner.d.ts +3 -0
  4. package/dist/Banner/Banner.d.ts.map +1 -1
  5. package/dist/Banner/Banner.js +13 -3
  6. package/dist/BottomSheet/BottomSheet.d.ts +75 -0
  7. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -0
  8. package/dist/BottomSheet/BottomSheet.js +396 -0
  9. package/dist/BottomSheet/BottomSheetPanel.d.ts +63 -0
  10. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -0
  11. package/dist/BottomSheet/BottomSheetPanel.js +441 -0
  12. package/dist/BottomSheet/BottomSheetSwitcher.d.ts +61 -0
  13. package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -0
  14. package/dist/BottomSheet/BottomSheetSwitcher.js +410 -0
  15. package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts +21 -0
  16. package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -0
  17. package/dist/BottomSheet/BottomSheetSwitcherContext.js +13 -0
  18. package/dist/BottomSheet/index.d.ts +11 -0
  19. package/dist/BottomSheet/index.d.ts.map +1 -0
  20. package/dist/BottomSheet/index.js +12 -0
  21. package/dist/BottomSheet/snapOffsets.d.ts +109 -0
  22. package/dist/BottomSheet/snapOffsets.d.ts.map +1 -0
  23. package/dist/BottomSheet/snapOffsets.js +206 -0
  24. package/dist/BottomSheet/useMobileKeyboard.d.ts +35 -0
  25. package/dist/BottomSheet/useMobileKeyboard.d.ts.map +1 -0
  26. package/dist/BottomSheet/useMobileKeyboard.js +373 -0
  27. package/dist/BottomSheet/useSheetGestures.d.ts +185 -0
  28. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -0
  29. package/dist/BottomSheet/useSheetGestures.js +1038 -0
  30. package/dist/Calendar/Calendar.d.ts +17 -0
  31. package/dist/Calendar/Calendar.d.ts.map +1 -1
  32. package/dist/Calendar/Calendar.js +25 -1
  33. package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
  34. package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
  35. package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
  36. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  37. package/dist/Chat/ChatComposerInput.js +3 -4
  38. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  39. package/dist/CheckboxInput/CheckboxInput.js +9 -0
  40. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  41. package/dist/ComplexSelector/ComplexSelector.js +18 -7
  42. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  43. package/dist/ContextMenu/ContextMenu.js +4 -2
  44. package/dist/DateInput/DateInput.d.ts.map +1 -1
  45. package/dist/DateInput/DateInput.js +15 -2
  46. package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
  47. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  48. package/dist/DateRangeInput/DateRangeInput.js +38 -3
  49. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  50. package/dist/DateTimeInput/DateTimeInput.js +38 -3
  51. package/dist/Dialog/Dialog.d.ts.map +1 -1
  52. package/dist/Dialog/Dialog.js +2 -1
  53. package/dist/Field/FieldLabel.d.ts +2 -1
  54. package/dist/Field/FieldLabel.d.ts.map +1 -1
  55. package/dist/Field/FieldLabel.js +21 -3
  56. package/dist/Field/InputClearButton.d.ts +2 -1
  57. package/dist/Field/InputClearButton.d.ts.map +1 -1
  58. package/dist/Field/InputClearButton.js +6 -1
  59. package/dist/FormLayout/FormLayout.d.ts +24 -2
  60. package/dist/FormLayout/FormLayout.d.ts.map +1 -1
  61. package/dist/FormLayout/FormLayout.js +7 -2
  62. package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
  63. package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
  64. package/dist/FormLayout/FormLayoutContext.js +19 -4
  65. package/dist/FormLayout/index.d.ts +1 -1
  66. package/dist/FormLayout/index.d.ts.map +1 -1
  67. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  68. package/dist/Lightbox/Lightbox.js +9 -3
  69. package/dist/MobileNav/MobileNav.d.ts +12 -0
  70. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  71. package/dist/MobileNav/MobileNav.js +102 -30
  72. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  73. package/dist/MultiSelector/MultiSelector.js +27 -8
  74. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  75. package/dist/NumberInput/NumberInput.js +15 -2
  76. package/dist/PowerSearch/PowerSearchEditPopover.js +1 -1
  77. package/dist/RadioList/RadioList.d.ts.map +1 -1
  78. package/dist/RadioList/RadioList.js +12 -1
  79. package/dist/Selector/Selector.d.ts.map +1 -1
  80. package/dist/Selector/Selector.js +20 -4
  81. package/dist/StatusDot/StatusDot.d.ts +43 -3
  82. package/dist/StatusDot/StatusDot.d.ts.map +1 -1
  83. package/dist/StatusDot/StatusDot.js +42 -5
  84. package/dist/Switch/Switch.d.ts.map +1 -1
  85. package/dist/Switch/Switch.js +14 -1
  86. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  87. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
  88. package/dist/TextArea/TextArea.d.ts.map +1 -1
  89. package/dist/TextArea/TextArea.js +6 -1
  90. package/dist/TextInput/TextInput.d.ts.map +1 -1
  91. package/dist/TextInput/TextInput.js +6 -1
  92. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  93. package/dist/TimeInput/TimeInput.js +14 -2
  94. package/dist/Tokenizer/Tokenizer.js +11 -5
  95. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  96. package/dist/Tooltip/useTooltip.js +4 -1
  97. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  98. package/dist/Typeahead/BaseTypeahead.js +5 -3
  99. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  100. package/dist/Typeahead/Typeahead.js +10 -1
  101. package/dist/astryx.css +21 -0
  102. package/dist/hooks/index.d.ts +8 -1
  103. package/dist/hooks/index.d.ts.map +1 -1
  104. package/dist/hooks/index.js +8 -1
  105. package/dist/hooks/useFocusTrap.d.ts +0 -11
  106. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  107. package/dist/hooks/useFocusTrap.js +1 -11
  108. package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
  109. package/dist/hooks/useInputStatusIcon.js +1 -0
  110. package/dist/hooks/useResolvedRequired.d.ts +19 -0
  111. package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
  112. package/dist/hooks/useResolvedRequired.js +40 -0
  113. package/dist/index.d.ts +1 -0
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +1 -0
  116. package/dist/theme/defineTheme.d.ts +22 -4
  117. package/dist/theme/defineTheme.d.ts.map +1 -1
  118. package/dist/theme/expandColorScale.d.ts +17 -2
  119. package/dist/theme/expandColorScale.d.ts.map +1 -1
  120. package/dist/theme/expandColorScale.js +63 -33
  121. package/dist/utils/ime.d.ts +5 -0
  122. package/dist/utils/ime.d.ts.map +1 -0
  123. package/dist/utils/ime.js +63 -0
  124. package/dist/utils/index.d.ts +1 -0
  125. package/dist/utils/index.d.ts.map +1 -1
  126. package/dist/utils/index.js +2 -1
  127. package/dist/utils/plainDate.d.ts +6 -0
  128. package/dist/utils/plainDate.d.ts.map +1 -1
  129. package/dist/utils/plainDate.js +12 -0
  130. package/locales/af-ZA.json +958 -0
  131. package/locales/ar-SA.json +998 -0
  132. package/locales/ca-ES.json +974 -0
  133. package/locales/cs-CZ.json +990 -0
  134. package/locales/da-DK.json +966 -0
  135. package/locales/de-DE.json +966 -0
  136. package/locales/el-GR.json +990 -0
  137. package/locales/en.json +52 -0
  138. package/locales/es-ES.json +978 -0
  139. package/locales/fi-FI.json +990 -0
  140. package/locales/fr-FR.json +928 -0
  141. package/locales/he-IL.json +990 -0
  142. package/locales/hu-HU.json +990 -0
  143. package/locales/it-IT.json +978 -0
  144. package/locales/ja-JP.json +998 -0
  145. package/locales/ko-KR.json +990 -0
  146. package/locales/nl-NL.json +954 -0
  147. package/locales/no-NO.json +978 -0
  148. package/locales/pl-PL.json +982 -0
  149. package/locales/pseudo.json +39 -0
  150. package/locales/pt-BR.json +982 -0
  151. package/locales/pt-PT.json +982 -0
  152. package/locales/ro-RO.json +982 -0
  153. package/locales/ru-RU.json +990 -0
  154. package/locales/sr-SP.json +990 -0
  155. package/locales/sv-SE.json +986 -0
  156. package/locales/tr-TR.json +990 -0
  157. package/locales/uk-UA.json +990 -0
  158. package/locales/vi-VN.json +986 -0
  159. package/locales/zh-CN.json +998 -0
  160. package/locales/zh-TW.json +998 -0
  161. package/package.json +9 -8
  162. package/src/Banner/Banner.doc.mjs +3 -3
  163. package/src/Banner/Banner.test.tsx +40 -0
  164. package/src/Banner/Banner.tsx +27 -2
  165. package/src/BottomSheet/BottomSheet.doc.mjs +299 -0
  166. package/src/BottomSheet/BottomSheet.test.tsx +2265 -0
  167. package/src/BottomSheet/BottomSheet.tsx +559 -0
  168. package/src/BottomSheet/BottomSheetPanel.test.tsx +240 -0
  169. package/src/BottomSheet/BottomSheetPanel.tsx +601 -0
  170. package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +219 -0
  171. package/src/BottomSheet/BottomSheetSwitcher.test.tsx +850 -0
  172. package/src/BottomSheet/BottomSheetSwitcher.tsx +628 -0
  173. package/src/BottomSheet/BottomSheetSwitcherContext.ts +51 -0
  174. package/src/BottomSheet/index.ts +19 -0
  175. package/src/BottomSheet/snapOffsets.test.ts +254 -0
  176. package/src/BottomSheet/snapOffsets.ts +245 -0
  177. package/src/BottomSheet/useMobileKeyboard.ts +499 -0
  178. package/src/BottomSheet/useSheetGestures.test.ts +1112 -0
  179. package/src/BottomSheet/useSheetGestures.ts +1503 -0
  180. package/src/Calendar/Calendar.doc.mjs +16 -0
  181. package/src/Calendar/Calendar.test.tsx +96 -0
  182. package/src/Calendar/Calendar.tsx +55 -0
  183. package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
  184. package/src/Chat/ChatComposerInput.tsx +3 -4
  185. package/src/CheckboxInput/CheckboxInput.tsx +6 -0
  186. package/src/ComplexSelector/ComplexSelector.tsx +15 -6
  187. package/src/ContextMenu/ContextMenu.tsx +4 -2
  188. package/src/DateInput/DateInput.test.tsx +21 -0
  189. package/src/DateInput/DateInput.tsx +12 -2
  190. package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
  191. package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
  192. package/src/DateRangeInput/DateRangeInput.tsx +72 -1
  193. package/src/DateTimeInput/DateTimeInput.doc.mjs +4 -0
  194. package/src/DateTimeInput/DateTimeInput.test.tsx +137 -0
  195. package/src/DateTimeInput/DateTimeInput.tsx +43 -4
  196. package/src/Dialog/Dialog.tsx +2 -1
  197. package/src/Field/Field.doc.mjs +1 -0
  198. package/src/Field/FieldLabel.tsx +20 -4
  199. package/src/Field/InputClearButton.test.tsx +25 -0
  200. package/src/Field/InputClearButton.tsx +4 -1
  201. package/src/FileInput/FileInput.test.tsx +53 -9
  202. package/src/FormLayout/FormLayout.doc.mjs +13 -0
  203. package/src/FormLayout/FormLayout.test.tsx +181 -4
  204. package/src/FormLayout/FormLayout.tsx +33 -2
  205. package/src/FormLayout/FormLayoutContext.ts +22 -7
  206. package/src/FormLayout/index.ts +1 -1
  207. package/src/Lightbox/Lightbox.test.tsx +49 -28
  208. package/src/Lightbox/Lightbox.tsx +7 -3
  209. package/src/MobileNav/MobileNav.tsx +128 -37
  210. package/src/MobileNav/MobileNavCloseEdgeCases.test.tsx +426 -0
  211. package/src/MobileNav/MobileNavCloseTiming.test.ts +58 -0
  212. package/src/MobileNav/MobileNavCloseVisibility.test.tsx +172 -0
  213. package/src/MultiSelector/MultiSelector.test.tsx +195 -51
  214. package/src/MultiSelector/MultiSelector.tsx +25 -9
  215. package/src/NumberInput/NumberInput.test.tsx +18 -0
  216. package/src/NumberInput/NumberInput.tsx +12 -2
  217. package/src/PowerSearch/PowerSearchEditPopover.tsx +1 -1
  218. package/src/RadioList/RadioList.tsx +9 -1
  219. package/src/Selector/Selector.test.tsx +85 -26
  220. package/src/Selector/Selector.tsx +16 -5
  221. package/src/StatusDot/StatusDot.doc.mjs +13 -0
  222. package/src/StatusDot/StatusDot.test.tsx +115 -8
  223. package/src/StatusDot/StatusDot.tsx +74 -9
  224. package/src/Switch/Switch.test.tsx +16 -0
  225. package/src/Switch/Switch.tsx +13 -0
  226. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +20 -2
  227. package/src/TextArea/TextArea.tsx +3 -1
  228. package/src/TextInput/TextInput.tsx +3 -1
  229. package/src/TimeInput/TimeInput.test.tsx +23 -0
  230. package/src/TimeInput/TimeInput.tsx +11 -1
  231. package/src/Tokenizer/Tokenizer.test.tsx +50 -32
  232. package/src/Tokenizer/Tokenizer.tsx +5 -5
  233. package/src/Tooltip/useTooltip.tsx +4 -1
  234. package/src/Typeahead/BaseTypeahead.tsx +10 -3
  235. package/src/Typeahead/Typeahead.test.tsx +116 -7
  236. package/src/Typeahead/Typeahead.tsx +10 -1
  237. package/src/__tests__/stubMatchMedia.test.ts +79 -0
  238. package/src/__tests__/stubMatchMedia.ts +95 -0
  239. package/src/hooks/index.ts +9 -5
  240. package/src/hooks/useFocusTrap.ts +1 -14
  241. package/src/hooks/useInputStatusIcon.test.tsx +19 -0
  242. package/src/hooks/useInputStatusIcon.tsx +7 -0
  243. package/src/hooks/useResolvedRequired.ts +42 -0
  244. package/src/index.ts +1 -0
  245. package/src/theme/defineTheme.ts +22 -4
  246. package/src/theme/expandColorScale.test.ts +138 -0
  247. package/src/theme/expandColorScale.ts +89 -44
  248. package/src/utils/ime.test.ts +32 -0
  249. package/src/utils/ime.ts +69 -0
  250. package/src/utils/index.ts +2 -0
  251. package/src/utils/plainDate.test.ts +50 -0
  252. package/src/utils/plainDate.ts +12 -0
  253. package/dist/astryx.umd.js +0 -147
  254. package/dist/astryx.umd.js.map +0 -7
@@ -0,0 +1,185 @@
1
+ /**
2
+ * @file useSheetGestures.ts
3
+ * @input Uses React (useCallback, useEffect, useMemo, useRef, useState) and
4
+ * the core useMediaQuery hook
5
+ * @output Exports useSheetGestures hook and its option/result types
6
+ * @position Internal to BottomSheet; not exported from the core entry point
7
+ *
8
+ * Drag + snap machinery for the bottom sheet. Tracks a pointer drag down the
9
+ * block axis, translates the sliding surface live, and on release either
10
+ * settles to the nearest snap detent (a slow drag) or dismisses (a fast flick
11
+ * down). A fast flick up expands to the tallest detent. This is the core
12
+ * behavior split the sheet needs: DRAG places, SWIPE closes.
13
+ *
14
+ * A settled detent is split across two properties: `settledLayoutOffset` is
15
+ * the part the scrolling area gives up as layout height, and the remainder is
16
+ * a transform. Gestures and snaps only ever move the transform, so they stay
17
+ * on the compositor; layout height changes at rest, in one transition-free
18
+ * render whose visible geometry is identical. A peek detent — a stop that is
19
+ * only a sliver of the sheet — keeps the full height and slides below the
20
+ * viewport instead of reflowing to that sliver.
21
+ *
22
+ * Those are pixels, and the stops behind them are relative to the viewport, so
23
+ * a sheet at rest re-resolves its detent on `resize` / `orientationchange`,
24
+ * and whenever the host swaps the snap points, and re-anchors to the new
25
+ * geometry without animating. The detent it returns to is tracked by index:
26
+ * the pixels stop meaning the same thing when the viewport changes, the stop
27
+ * the user chose does not.
28
+ *
29
+ * On touch, the scrolling body hands the gesture to the sheet at a scroll
30
+ * edge. Two shapes, because the browser only offers one of them a choice: a
31
+ * finger that lands on an edge and pulls away from it promotes by cancelling
32
+ * the first, still-cancelable touchmove; a finger that scrolls INTO the end of
33
+ * the content mid-gesture cannot, since the browser has committed the gesture
34
+ * to scrolling and every remaining event is non-cancelable. The second shape
35
+ * needs no cancelling — the scroller is clamped at its end, so there is
36
+ * nothing left to scroll — and instead anchors at the point where the content
37
+ * ran out and drives the sheet from the travel beyond it.
38
+ *
39
+ * Kept private to BottomSheet: a dismiss edge + detents on a bottom-anchored
40
+ * surface are inherently sheet concepts. It is not a general primitive and is
41
+ * intentionally not exported.
42
+ *
43
+ * SSR-safe: no window/document access at module scope; all measurement
44
+ * happens inside handlers. Respects prefers-reduced-motion by skipping the
45
+ * settle transition.
46
+ *
47
+ * SYNC: When modified, update these files to stay in sync:
48
+ * - /packages/core/src/BottomSheet/useSheetGestures.test.ts
49
+ */
50
+ import { type CSSProperties, type MouseEvent as ReactMouseEvent, type PointerEvent as ReactPointerEvent, type RefObject, type UIEvent as ReactUIEvent } from 'react';
51
+ export interface UseSheetGesturesOptions {
52
+ /** Whether the owning sheet is open. Drag state resets when it closes. */
53
+ isOpen: boolean;
54
+ /**
55
+ * Whether a downward swipe may dismiss the sheet. When false, a gesture
56
+ * past the dismiss threshold settles at the shortest detent instead.
57
+ * @default true
58
+ */
59
+ canDismiss?: boolean;
60
+ /**
61
+ * Portion of the measured sheet border box reserved below the viewport.
62
+ * Excluded from detent heights so a 50vh snap has 50vh of visible sheet.
63
+ * @default 0
64
+ */
65
+ offscreenBlockEndInset?: number;
66
+ /** Called on a swipe-to-close (fast downward flick, or drag past the floor). */
67
+ onDismiss: () => void;
68
+ /**
69
+ * Resolver for candidate visible detent heights in px below the fully open
70
+ * visible height. Called at the start of each drag, and again whenever the
71
+ * viewport changes while the sheet rests, so the detents track the window
72
+ * (rotation, a resized desktop window, collapsing browser chrome). The fully
73
+ * open height is always the tallest detent. Omit for a single-height sheet
74
+ * (a drag then only dismisses or springs back).
75
+ *
76
+ * Keep the identity stable: a new function is read as new stops, and
77
+ * re-anchors a resting sheet to them.
78
+ */
79
+ snapHeights?: () => number[];
80
+ /** Notified when the settled visible detent height (px) changes. */
81
+ onSnap?: (heightPx: number) => void;
82
+ /**
83
+ * Called with the scrim opacity the sheet should show (1 = fully visible,
84
+ * 0 = hidden) as the drag moves and on settle. Full while the sheet is at
85
+ * or above its mid detent, fading to 0 as it collapses onto the shortest
86
+ * "peek" detent — thinning to a faint glance state without fully clearing — and
87
+ * on the dismiss overshoot. Lets the owner mirror it onto the scrim.
88
+ */
89
+ onScrimOpacity?: (opacity: number) => void;
90
+ }
91
+ export interface SheetContentProps {
92
+ style: CSSProperties;
93
+ }
94
+ export interface SheetHandleProps {
95
+ style: CSSProperties;
96
+ onContextMenu: (event: ReactMouseEvent) => void;
97
+ onLostPointerCapture: (event: ReactPointerEvent) => void;
98
+ onPointerDown: (event: ReactPointerEvent) => void;
99
+ onPointerMove: (event: ReactPointerEvent) => void;
100
+ onPointerUp: (event: ReactPointerEvent) => void;
101
+ onPointerCancel: (event: ReactPointerEvent) => void;
102
+ }
103
+ export interface SheetBodyProps {
104
+ ref: (node: HTMLElement | null) => void;
105
+ onContextMenu: (event: ReactMouseEvent) => void;
106
+ onLostPointerCapture: (event: ReactPointerEvent) => void;
107
+ onPointerDown: (event: ReactPointerEvent) => void;
108
+ onPointerMove: (event: ReactPointerEvent) => void;
109
+ onPointerUp: (event: ReactPointerEvent) => void;
110
+ onPointerCancel: (event: ReactPointerEvent) => void;
111
+ onScroll: (event: ReactUIEvent<HTMLElement>) => void;
112
+ }
113
+ export interface UseSheetGesturesResult {
114
+ /**
115
+ * Callback ref for the sheet surface. The hook observes it (ResizeObserver)
116
+ * to keep the fully-open height current, so detents stay correct across
117
+ * rotation / viewport changes without re-measuring mid-drag.
118
+ */
119
+ sheetRef: (node: HTMLElement | null) => void;
120
+ /** Spread on the sliding surface: live translate + touch-action guard. */
121
+ contentProps: SheetContentProps;
122
+ /** Spread on the grab-handle element: pointer drag handlers. */
123
+ handleProps: SheetHandleProps;
124
+ /**
125
+ * Spread on the scrollable body. An overscroll-at-top pull-down starts a
126
+ * sheet drag (a larger, more forgiving target when the content isn't itself
127
+ * scrolling); normal scrolling passes through untouched.
128
+ */
129
+ bodyProps: SheetBodyProps;
130
+ /**
131
+ * The body element `bodyProps.ref` is attached to. The hook tracks the node
132
+ * anyway (it owns the non-passive touch listeners on it), so a host that
133
+ * also needs the element reads it here rather than wrapping `bodyProps.ref`
134
+ * in a second callback ref.
135
+ */
136
+ bodyElementRef: RefObject<HTMLElement | null>;
137
+ /** Current live drag translate in px (0 = fully expanded, larger = collapsed). */
138
+ dragOffset: number;
139
+ /** Translate of the resting detent in px (0 = tallest detent). */
140
+ settledOffset: number;
141
+ /** Whether a drag is currently in progress. */
142
+ isDragging: boolean;
143
+ /** Measured height of the fully expanded sheet. */
144
+ sheetHeight: number;
145
+ /** End padding that preserves the scroll position across height changes. */
146
+ scrollPreservationInset: number;
147
+ /** Layout offset retained until the transform-only snap finishes. */
148
+ settlingLayoutOffset: number | null;
149
+ /**
150
+ * Reconciles the final layout once the transform-only snap finishes. The
151
+ * panel decides WHEN a snap is over (it owns the element and its computed
152
+ * transition), so completion cannot be driven from a `transitionend`
153
+ * listener alone: with transitions disabled — inline `transition: none`, a
154
+ * `0s` duration token, a test harness turning animation off — no event ever
155
+ * arrives and the scroll area would keep its full height forever.
156
+ */
157
+ completeScrollAreaSettle: () => void;
158
+ /**
159
+ * How much of `settledOffset` is expressed as layout height rather than as a
160
+ * transform. Equals `settledOffset` at the resizing detents; 0 at fully open
161
+ * and at the peek, which keep the sheet's full height (see peekOffsetFor).
162
+ */
163
+ settledLayoutOffset: number;
164
+ }
165
+ /**
166
+ * Drag + snap machinery for the bottom sheet. Returns props to spread on the
167
+ * grab handle and the sliding surface, plus live drag state. A slow drag
168
+ * settles to the nearest detent; a fast downward flick dismisses; a fast
169
+ * upward flick expands to the tallest detent.
170
+ *
171
+ * @example
172
+ * ```
173
+ * const {contentProps, handleProps} = useSheetGestures({
174
+ * isOpen,
175
+ * onDismiss: () => onOpenChange(false),
176
+ * snapHeights: () => [240, 0.5 * (window.visualViewport?.height ?? 0)],
177
+ * });
178
+ * <div {...contentProps}>
179
+ * <div {...handleProps} />
180
+ * {children}
181
+ * </div>
182
+ * ```
183
+ */
184
+ export declare function useSheetGestures({ isOpen, canDismiss, offscreenBlockEndInset, onDismiss, snapHeights, onSnap, onScrimOpacity, }: UseSheetGesturesOptions): UseSheetGesturesResult;
185
+ //# sourceMappingURL=useSheetGestures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSheetGestures.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/useSheetGestures.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,SAAS,EACd,KAAK,OAAO,IAAI,YAAY,EAC7B,MAAM,OAAO,CAAC;AAgIf,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,MAAM,EAAE,OAAO,CAAC;IAChB;;;;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;IACH,WAAW,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,aAAa,CAAC;IACrB,aAAa,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,oBAAoB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,CAAC,KAAK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