@tamagui/sheet 3.0.0-beta.922.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/cjs/Sheet.cjs +48 -16
  2. package/dist/cjs/Sheet.native.cjs +46 -17
  3. package/dist/cjs/Sheet.native.js +46 -17
  4. package/dist/cjs/Sheet.native.js.map +1 -1
  5. package/dist/cjs/SheetDragSurface.cjs +50 -0
  6. package/dist/{jsx/GestureDetectorWrapper.native.js → cjs/SheetDragSurface.native.cjs} +24 -12
  7. package/dist/cjs/{GestureDetectorWrapper.native.js → SheetDragSurface.native.js} +25 -11
  8. package/dist/cjs/SheetDragSurface.native.js.map +1 -0
  9. package/dist/cjs/SheetImplementationCustom.cjs +41 -58
  10. package/dist/cjs/SheetImplementationCustom.native.cjs +43 -59
  11. package/dist/cjs/SheetImplementationCustom.native.js +43 -59
  12. package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
  13. package/dist/cjs/SheetScrollView.cjs +15 -3
  14. package/dist/cjs/SheetScrollView.native.cjs +17 -4
  15. package/dist/cjs/SheetScrollView.native.js +17 -4
  16. package/dist/cjs/SheetScrollView.native.js.map +1 -1
  17. package/dist/cjs/nativeSheet.cjs +3 -59
  18. package/dist/cjs/nativeSheet.native.cjs +70 -58
  19. package/dist/cjs/nativeSheet.native.js +70 -58
  20. package/dist/cjs/nativeSheet.native.js.map +1 -1
  21. package/dist/cjs/stableViewportHeight.cjs +27 -0
  22. package/dist/cjs/stableViewportHeight.native.cjs +29 -0
  23. package/dist/cjs/stableViewportHeight.native.js +31 -0
  24. package/dist/cjs/stableViewportHeight.native.js.map +1 -0
  25. package/dist/cjs/useSheetOffscreenSize.cjs +3 -1
  26. package/dist/cjs/useSheetOffscreenSize.native.cjs +3 -2
  27. package/dist/cjs/useSheetOffscreenSize.native.js +3 -2
  28. package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
  29. package/dist/cjs/useSheetOpenState.cjs +13 -6
  30. package/dist/cjs/useSheetOpenState.native.cjs +15 -5
  31. package/dist/cjs/useSheetOpenState.native.js +15 -5
  32. package/dist/cjs/useSheetOpenState.native.js.map +1 -1
  33. package/dist/cjs/useSheetProviderProps.cjs +5 -94
  34. package/dist/cjs/useSheetProviderProps.native.cjs +5 -103
  35. package/dist/cjs/useSheetProviderProps.native.js +5 -103
  36. package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
  37. package/dist/cjs/useSheetState.cjs +120 -0
  38. package/dist/cjs/useSheetState.native.cjs +131 -0
  39. package/dist/cjs/useSheetState.native.js +133 -0
  40. package/dist/cjs/useSheetState.native.js.map +1 -0
  41. package/dist/esm/Sheet.mjs +48 -15
  42. package/dist/esm/Sheet.mjs.map +1 -1
  43. package/dist/esm/Sheet.native.js +46 -17
  44. package/dist/esm/Sheet.native.js.map +1 -1
  45. package/dist/esm/SheetDragSurface.mjs +25 -0
  46. package/dist/esm/SheetDragSurface.mjs.map +1 -0
  47. package/dist/esm/SheetDragSurface.native.js +34 -0
  48. package/dist/esm/SheetDragSurface.native.js.map +1 -0
  49. package/dist/esm/SheetImplementationCustom.mjs +39 -56
  50. package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
  51. package/dist/esm/SheetImplementationCustom.native.js +41 -57
  52. package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
  53. package/dist/esm/SheetScrollView.mjs +16 -4
  54. package/dist/esm/SheetScrollView.mjs.map +1 -1
  55. package/dist/esm/SheetScrollView.native.js +18 -5
  56. package/dist/esm/SheetScrollView.native.js.map +1 -1
  57. package/dist/esm/nativeSheet.mjs +3 -60
  58. package/dist/esm/nativeSheet.mjs.map +1 -1
  59. package/dist/esm/nativeSheet.native.js +70 -58
  60. package/dist/esm/nativeSheet.native.js.map +1 -1
  61. package/dist/esm/stableViewportHeight.mjs +8 -0
  62. package/dist/esm/stableViewportHeight.mjs.map +1 -0
  63. package/dist/esm/stableViewportHeight.native.js +8 -0
  64. package/dist/esm/stableViewportHeight.native.js.map +1 -0
  65. package/dist/esm/useKeyboardControllerSheet.native.js +0 -5
  66. package/dist/esm/useSheetOffscreenSize.mjs +3 -1
  67. package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
  68. package/dist/esm/useSheetOffscreenSize.native.js +3 -2
  69. package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
  70. package/dist/esm/useSheetOpenState.mjs +14 -7
  71. package/dist/esm/useSheetOpenState.mjs.map +1 -1
  72. package/dist/esm/useSheetOpenState.native.js +16 -6
  73. package/dist/esm/useSheetOpenState.native.js.map +1 -1
  74. package/dist/esm/useSheetProviderProps.mjs +5 -88
  75. package/dist/esm/useSheetProviderProps.mjs.map +1 -1
  76. package/dist/esm/useSheetProviderProps.native.js +5 -97
  77. package/dist/esm/useSheetProviderProps.native.js.map +1 -1
  78. package/dist/esm/useSheetState.mjs +95 -0
  79. package/dist/esm/useSheetState.mjs.map +1 -0
  80. package/dist/esm/useSheetState.native.js +104 -0
  81. package/dist/esm/useSheetState.native.js.map +1 -0
  82. package/dist/jsx/Sheet.mjs +48 -15
  83. package/dist/jsx/Sheet.mjs.map +1 -1
  84. package/dist/jsx/Sheet.native.cjs +46 -17
  85. package/dist/jsx/Sheet.native.js +46 -17
  86. package/dist/jsx/Sheet.native.js.map +1 -1
  87. package/dist/jsx/SheetDragSurface.mjs +25 -0
  88. package/dist/jsx/SheetDragSurface.mjs.map +1 -0
  89. package/dist/{cjs/GestureDetectorWrapper.native.cjs → jsx/SheetDragSurface.native.cjs} +24 -10
  90. package/dist/jsx/{GestureDetectorWrapper.native.cjs → SheetDragSurface.native.js} +26 -10
  91. package/dist/jsx/SheetDragSurface.native.js.map +1 -0
  92. package/dist/jsx/SheetImplementationCustom.mjs +39 -56
  93. package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
  94. package/dist/jsx/SheetImplementationCustom.native.cjs +43 -59
  95. package/dist/jsx/SheetImplementationCustom.native.js +43 -59
  96. package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
  97. package/dist/jsx/SheetScrollView.mjs +16 -4
  98. package/dist/jsx/SheetScrollView.mjs.map +1 -1
  99. package/dist/jsx/SheetScrollView.native.cjs +17 -4
  100. package/dist/jsx/SheetScrollView.native.js +17 -4
  101. package/dist/jsx/SheetScrollView.native.js.map +1 -1
  102. package/dist/jsx/nativeSheet.mjs +3 -60
  103. package/dist/jsx/nativeSheet.mjs.map +1 -1
  104. package/dist/jsx/nativeSheet.native.cjs +70 -58
  105. package/dist/jsx/nativeSheet.native.js +70 -58
  106. package/dist/jsx/nativeSheet.native.js.map +1 -1
  107. package/dist/jsx/stableViewportHeight.mjs +8 -0
  108. package/dist/jsx/stableViewportHeight.mjs.map +1 -0
  109. package/dist/jsx/stableViewportHeight.native.cjs +29 -0
  110. package/dist/jsx/stableViewportHeight.native.js +31 -0
  111. package/dist/jsx/stableViewportHeight.native.js.map +1 -0
  112. package/dist/jsx/useSheetOffscreenSize.mjs +3 -1
  113. package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
  114. package/dist/jsx/useSheetOffscreenSize.native.cjs +3 -2
  115. package/dist/jsx/useSheetOffscreenSize.native.js +3 -2
  116. package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
  117. package/dist/jsx/useSheetOpenState.mjs +14 -7
  118. package/dist/jsx/useSheetOpenState.mjs.map +1 -1
  119. package/dist/jsx/useSheetOpenState.native.cjs +15 -5
  120. package/dist/jsx/useSheetOpenState.native.js +15 -5
  121. package/dist/jsx/useSheetOpenState.native.js.map +1 -1
  122. package/dist/jsx/useSheetProviderProps.mjs +5 -88
  123. package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
  124. package/dist/jsx/useSheetProviderProps.native.cjs +5 -103
  125. package/dist/jsx/useSheetProviderProps.native.js +5 -103
  126. package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
  127. package/dist/jsx/useSheetState.mjs +95 -0
  128. package/dist/jsx/useSheetState.mjs.map +1 -0
  129. package/dist/jsx/useSheetState.native.cjs +131 -0
  130. package/dist/jsx/useSheetState.native.js +133 -0
  131. package/dist/jsx/useSheetState.native.js.map +1 -0
  132. package/package.json +27 -22
  133. package/src/Sheet.tsx +45 -18
  134. package/src/SheetDragSurface.native.tsx +42 -0
  135. package/src/SheetDragSurface.tsx +40 -0
  136. package/src/SheetImplementationCustom.tsx +67 -92
  137. package/src/SheetScrollView.tsx +26 -4
  138. package/src/nativeSheet.native.tsx +110 -0
  139. package/src/nativeSheet.ts +16 -0
  140. package/src/stableViewportHeight.native.ts +9 -0
  141. package/src/stableViewportHeight.ts +15 -0
  142. package/src/types.tsx +44 -1
  143. package/src/useSheetOffscreenSize.tsx +3 -7
  144. package/src/useSheetOpenState.tsx +18 -8
  145. package/src/useSheetProviderProps.tsx +18 -149
  146. package/src/useSheetScrollViewGestures.native.ts +4 -1
  147. package/src/useSheetState.tsx +139 -0
  148. package/types/Sheet.d.ts +71 -167
  149. package/types/Sheet.d.ts.map +1 -1
  150. package/types/SheetDragSurface.d.ts +11 -0
  151. package/types/SheetDragSurface.d.ts.map +1 -0
  152. package/types/SheetDragSurface.native.d.ts +11 -0
  153. package/types/SheetDragSurface.native.d.ts.map +1 -0
  154. package/types/SheetImplementationCustom.d.ts +1 -2
  155. package/types/SheetImplementationCustom.d.ts.map +1 -1
  156. package/types/SheetScrollView.d.ts +3 -3
  157. package/types/SheetScrollView.d.ts.map +1 -1
  158. package/types/nativeSheet.d.ts +8 -9
  159. package/types/nativeSheet.d.ts.map +1 -1
  160. package/types/nativeSheet.native.d.ts +4 -0
  161. package/types/nativeSheet.native.d.ts.map +1 -0
  162. package/types/stableViewportHeight.d.ts +12 -0
  163. package/types/stableViewportHeight.d.ts.map +1 -0
  164. package/types/stableViewportHeight.native.d.ts +6 -0
  165. package/types/stableViewportHeight.native.d.ts.map +1 -0
  166. package/types/types.d.ts +34 -1
  167. package/types/types.d.ts.map +1 -1
  168. package/types/useSheetOffscreenSize.d.ts +1 -1
  169. package/types/useSheetOffscreenSize.d.ts.map +1 -1
  170. package/types/useSheetOpenState.d.ts +3 -1
  171. package/types/useSheetOpenState.d.ts.map +1 -1
  172. package/types/useSheetProviderProps.d.ts +15 -13
  173. package/types/useSheetProviderProps.d.ts.map +1 -1
  174. package/types/useSheetScrollViewGestures.native.d.ts +1 -1
  175. package/types/useSheetScrollViewGestures.native.d.ts.map +1 -1
  176. package/types/useSheetState.d.ts +26 -0
  177. package/types/useSheetState.d.ts.map +1 -0
  178. package/dist/cjs/GestureDetectorWrapper.cjs +0 -44
  179. package/dist/cjs/GestureDetectorWrapper.native.js.map +0 -1
  180. package/dist/esm/GestureDetectorWrapper.mjs +0 -25
  181. package/dist/esm/GestureDetectorWrapper.mjs.map +0 -1
  182. package/dist/esm/GestureDetectorWrapper.native.js +0 -26
  183. package/dist/esm/GestureDetectorWrapper.native.js.map +0 -1
  184. package/dist/jsx/GestureDetectorWrapper.mjs +0 -25
  185. package/dist/jsx/GestureDetectorWrapper.mjs.map +0 -1
  186. package/dist/jsx/GestureDetectorWrapper.native.js.map +0 -1
  187. package/src/GestureDetectorWrapper.tsx +0 -38
  188. package/src/nativeSheet.tsx +0 -86
  189. package/types/GestureDetectorWrapper.d.ts +0 -14
  190. package/types/GestureDetectorWrapper.d.ts.map +0 -1
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all) __defProp(target, name, {
@@ -19,31 +21,43 @@ var __copyProps = (to, from, except, desc) => {
19
21
  }
20
22
  return to;
21
23
  };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
22
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
- var GestureDetectorWrapper_exports = {};
24
- __export(GestureDetectorWrapper_exports, { GestureDetectorWrapper: () => GestureDetectorWrapper });
25
- module.exports = __toCommonJS(GestureDetectorWrapper_exports);
29
+ var SheetDragSurface_native_exports = {};
30
+ __export(SheetDragSurface_native_exports, { SheetDragSurface: () => SheetDragSurface });
31
+ module.exports = __toCommonJS(SheetDragSurface_native_exports);
26
32
  var import_jsx_runtime = require("react/jsx-runtime");
33
+ var React = __toESM(require("react"), 1);
27
34
  var import_react_native = require("react-native");
28
35
  var import_gestureState = require("./gestureState.native.js");
29
- function GestureDetectorWrapper(param) {
30
- var { gesture, children, style } = param;
36
+ function SheetDragSurface(param) {
37
+ var { gestureHandlerEnabled, panGesture, panConfig, children } = param;
31
38
  var { GestureDetector } = (0, import_gestureState.getGestureHandlerState)();
32
- var enabled = (0, import_gestureState.isGestureHandlerEnabled)();
33
- if (enabled && GestureDetector && gesture) {
39
+ var panHandlers = React.useMemo(function() {
40
+ return panConfig ? import_react_native.PanResponder.create(panConfig).panHandlers : void 0;
41
+ }, [panConfig]);
42
+ if (gestureHandlerEnabled && panGesture && GestureDetector) {
34
43
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GestureDetector, {
35
- gesture,
44
+ gesture: panGesture,
36
45
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
37
- style,
46
+ style: { flex: 1 },
38
47
  collapsable: false,
39
48
  children
40
49
  })
41
50
  });
42
51
  }
43
52
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
44
- style,
53
+ ...panHandlers,
54
+ style: {
55
+ flex: 1,
56
+ width: "100%",
57
+ height: "100%"
58
+ },
45
59
  children
46
60
  });
47
61
  }
48
62
 
49
- //# sourceMappingURL=GestureDetectorWrapper.native.js.map
63
+ //# sourceMappingURL=SheetDragSurface.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SheetDragSurface.native.js","names":[],"sources":["cjs/SheetDragSurface.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SheetDragSurface_native_exports = {};\n__export(SheetDragSurface_native_exports, {\n SheetDragSurface: () => SheetDragSurface\n});\nmodule.exports = __toCommonJS(SheetDragSurface_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_gestureState = require(\"./gestureState\");\nfunction SheetDragSurface(param) {\n var { gestureHandlerEnabled, panGesture, panConfig, children } = param;\n var { GestureDetector } = (0, import_gestureState.getGestureHandlerState)();\n var panHandlers = React.useMemo(function() {\n return panConfig ? import_react_native.PanResponder.create(panConfig).panHandlers : void 0;\n }, [\n panConfig\n ]);\n if (gestureHandlerEnabled && panGesture && GestureDetector) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GestureDetector, {\n gesture: panGesture,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {\n style: {\n flex: 1\n },\n collapsable: false,\n children\n })\n });\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {\n ...panHandlers,\n style: {\n flex: 1,\n width: \"100%\",\n height: \"100%\"\n },\n children\n });\n}\n//# sourceMappingURL=SheetDragSurface.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,kCAAkC,CAAC;AACvC,SAAS,iCAAiC,EACxC,wBAAwB,iBAC1B,CAAC;AACD,OAAO,UAAU,aAAa,+BAA+B;AAC7D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,QAAQ,QAAQ,QAAQ,OAAO,GAAG,CAAC;AACvC,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,sBAAsB,QAAQ,0BAAgB;AAClD,SAAS,iBAAiB,OAAO;CAC/B,IAAI,EAAE,uBAAuB,YAAY,WAAW,aAAa;CACjE,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,uBAAsB,CAAE;CAC1E,IAAI,cAAc,MAAM,QAAQ,WAAW;EACzC,OAAO,YAAY,oBAAoB,aAAa,OAAO,SAAS,CAAC,CAAC,cAAc,KAAK;CAC3F,GAAG,CACD,SACF,CAAC;CACD,IAAI,yBAAyB,cAAc,iBAAiB;EAC1D,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,iBAAiB;GAClE,SAAS;GACT,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB,MAAM;IAC9E,OAAO,EACL,MAAM,EACR;IACA,aAAa;IACb;GACF,CAAC;EACH,CAAC;CACH;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB,MAAM;EAC3E,GAAG;EACH,OAAO;GACL,MAAM;GACN,OAAO;GACP,QAAQ;EACV;EACA;CACF,CAAC;AACH"}
@@ -32,16 +32,17 @@ __export(SheetImplementationCustom_exports, {
32
32
  module.exports = __toCommonJS(SheetImplementationCustom_exports);
33
33
  require("@tamagui/adapt");
34
34
  var import_animate_presence = require("@tamagui/animate-presence");
35
+ var import_transitionResolver = require("@tamagui/animation-helpers/transitionResolver");
35
36
  var import_compose_refs = require("@tamagui/compose-refs");
36
37
  var import_constants = require("@tamagui/constants");
37
38
  var import_core = require("@tamagui/core");
38
39
  var import_portal = require("@tamagui/portal");
39
40
  var import_react = __toESM(require("react"), 1);
40
- var import_react_native = require("react-native-web");
41
41
  var import_contexts = require("./contexts.cjs");
42
42
  var import_constants2 = require("./constants.cjs");
43
- var import_GestureDetectorWrapper = require("./GestureDetectorWrapper.cjs");
44
43
  var import_gestureState = require("./gestureState.cjs");
44
+ var import_SheetDragSurface = require("./SheetDragSurface.cjs");
45
+ var import_stableViewportHeight = require("./stableViewportHeight.cjs");
45
46
  var import_GestureSheetContext = require("./GestureSheetContext.cjs");
46
47
  var import_helpers = require("./helpers.cjs");
47
48
  var import_keyboardAvoidance = require("./keyboardAvoidance.cjs");
@@ -64,11 +65,6 @@ const rnghRootStyleClosed = {
64
65
  };
65
66
  let sheetHiddenStyleSheet = null;
66
67
  const sheetEscapeLayers = [];
67
- const relativeDimensionTo = import_constants.isWeb ? "window" : "screen";
68
- function getStableViewportHeight() {
69
- if (import_constants.isWeb && typeof window !== "undefined") return (0, import_webViewport.getStableLayoutViewportHeight)();
70
- return import_react_native.Dimensions.get(relativeDimensionTo).height;
71
- }
72
68
  const SheetImplementationCustom = (0, import_core.createRefComponent)(function SheetImplementationCustom2(props, forwardedRef) {
73
69
  const parentSheet = import_react.default.useContext(import_contexts.ParentSheetContext);
74
70
  const safeAreaTopInset = (0, import_useSafeAreaInsets.useSafeAreaInsets)()?.top ?? 0;
@@ -84,16 +80,18 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
84
80
  const animationDriver = (0, import_core.useAnimationDriver)();
85
81
  const transitionConfig = (() => {
86
82
  if (transitionConfigProp) return transitionConfigProp;
87
- const [animationProp, animationPropConfig] = !transition ? [] : Array.isArray(transition) ? transition : [transition];
88
- const namedConfig = animationProp && animationDriver.animations?.[animationProp];
89
- if (namedConfig) {
90
- if (typeof namedConfig === "string") return animationPropConfig ?? null;
91
- return {
92
- ...namedConfig,
93
- ...animationPropConfig
94
- };
95
- }
96
- return null;
83
+ const timing = (transition ? (0, import_transitionResolver.getTransitionResolver)()?.resolve(transition, { animations: animationDriver.animations }) : null)?.all?.timing;
84
+ if (!timing) return null;
85
+ if (timing.kind === "timing") return {
86
+ type: "timing",
87
+ duration: timing.durationMs
88
+ };
89
+ return {
90
+ type: "spring",
91
+ stiffness: timing.stiffness,
92
+ damping: timing.damping,
93
+ mass: timing.mass
94
+ };
97
95
  })();
98
96
  const [isShowingInnerSheet, setIsShowingInnerSheet] = import_react.default.useState(false);
99
97
  const shouldHideParentSheet = !import_constants.isWeb && modal && isShowingInnerSheet && (0, import_portal.needsPortalRepropagation)();
@@ -117,7 +115,7 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
117
115
  isKeyboardVisible,
118
116
  frameSize
119
117
  ]);
120
- const effScreenSize = isWebKbSheet ? getStableViewportHeight() : screenSize;
118
+ const effScreenSize = isWebKbSheet ? (0, import_stableViewportHeight.getStableViewportHeight)() : screenSize;
121
119
  const effectiveFrameSize = open ? frameSize : stableFrameSize.current || frameSize;
122
120
  const positions = import_react.default.useMemo(() => snapPoints.map((point) => getYPositions(snapPointsMode, point, effScreenSize, effectiveFrameSize)), [
123
121
  effScreenSize,
@@ -307,15 +305,11 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
307
305
  (0, import_constants.useIsomorphicLayoutEffect)(() => {
308
306
  if (hasntMeasured && screenSize && frameSize) {
309
307
  at.current = screenSize;
310
- animatedNumber.setValue(screenSize, {
311
- type: "timing",
312
- duration: 0
313
- }, () => {
314
- syncAnimatedPosition(screenSize);
315
- setTimeout(() => {
316
- setDisableAnimation(false);
317
- }, 10);
318
- });
308
+ animatedNumber.setValue(screenSize, { type: "direct" });
309
+ syncAnimatedPosition(screenSize);
310
+ setTimeout(() => {
311
+ setDisableAnimation(false);
312
+ }, 10);
319
313
  return;
320
314
  }
321
315
  if (disableAnimation) return;
@@ -349,10 +343,10 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
349
343
  const disableDrag = props.disableDrag ?? controller?.disableDrag;
350
344
  (0, import_core.useThemeName)();
351
345
  const [blockPan, setBlockPan] = import_react.default.useState(false);
352
- const panResponder = import_react.default.useMemo(() => {
353
- if (disableDrag) return;
354
- if (!frameSize) return;
355
- if (isShowingInnerSheet) return;
346
+ const panConfig = import_react.default.useMemo(() => {
347
+ if (disableDrag) return null;
348
+ if (!frameSize) return null;
349
+ if (isShowingInnerSheet) return null;
356
350
  const minY = activePositions[0];
357
351
  scrollBridge.paneMinY = minY;
358
352
  let startY = at.current;
@@ -438,7 +432,7 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
438
432
  setPosition(positionIndex);
439
433
  animateTo(positionIndex);
440
434
  };
441
- return import_react_native.PanResponder.create({
435
+ return {
442
436
  onMoveShouldSetPanResponder: onMoveShouldSet,
443
437
  onPanResponderTerminationRequest: () => false,
444
438
  onPanResponderGrant: grant,
@@ -452,7 +446,7 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
452
446
  onPanResponderEnd: finish,
453
447
  onPanResponderTerminate: finish,
454
448
  onPanResponderRelease: finish
455
- });
449
+ };
456
450
  }, [
457
451
  disableDrag,
458
452
  isShowingInnerSheet,
@@ -533,13 +527,13 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
533
527
  if (!open && stableFrameSize.current !== 0) return;
534
528
  const layoutHeight = e.nativeEvent?.layout.height;
535
529
  if (ignoreLayoutForKeyboard() && frameSize > 0) return;
536
- const next = modal ? Math.min(layoutHeight, getStableViewportHeight()) : layoutHeight;
530
+ const next = modal ? Math.min(layoutHeight, (0, import_stableViewportHeight.getStableViewportHeight)()) : layoutHeight;
537
531
  if (!next) return;
538
532
  setFrameSize(Math.round(next));
539
533
  });
540
534
  const handleMaxContentViewLayout = import_react.default.useCallback((e) => {
541
535
  if (ignoreLayoutForKeyboard() && screenSize > 0) return;
542
- const next = Math.min(e.nativeEvent?.layout.height, getStableViewportHeight());
536
+ const next = Math.min(e.nativeEvent?.layout.height, (0, import_stableViewportHeight.getStableViewportHeight)());
543
537
  if (!next) return;
544
538
  setMaxContentSize(Math.round(next));
545
539
  }, [ignoreLayoutForKeyboard, screenSize]);
@@ -597,16 +591,11 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
597
591
  children: shouldHideParentSheet || !open ? null : overlayChildren
598
592
  })
599
593
  }),
600
- snapPointsMode !== "percent" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
601
- style: {
602
- opacity: 0,
603
- position: "absolute",
604
- top: 0,
605
- left: 0,
606
- right: 0,
607
- bottom: 0,
608
- pointerEvents: "none"
609
- },
594
+ snapPointsMode !== "percent" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
595
+ opacity: 0,
596
+ position: "absolute",
597
+ inset: 0,
598
+ pointerEvents: "none",
610
599
  onLayout: handleMaxContentViewLayout
611
600
  }),
612
601
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedView, {
@@ -623,17 +612,10 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
623
612
  ...applyHidden && { display: "none" },
624
613
  ...(shouldHideParentSheet || !open) && { pointerEvents: "none" }
625
614
  }, animatedStyle],
626
- children: gestureHandlerEnabled && panGesture ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GestureDetectorWrapper.GestureDetectorWrapper, {
627
- gesture: panGesture,
628
- style: { flex: 1 },
629
- children: animatedChildren
630
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
631
- ...panResponder?.panHandlers,
632
- style: {
633
- flex: 1,
634
- width: "100%",
635
- height: "100%"
636
- },
615
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SheetDragSurface.SheetDragSurface, {
616
+ gestureHandlerEnabled,
617
+ panGesture,
618
+ panConfig,
637
619
  children: animatedChildren
638
620
  })
639
621
  })
@@ -645,13 +627,14 @@ const SheetImplementationCustom = (0, import_core.createRefComponent)(function S
645
627
  });
646
628
  const shouldMountChildren = unmountChildrenWhenHidden ? !isFullyClosed : true;
647
629
  if (modal) {
630
+ if (!shouldMountChildren) return null;
648
631
  const RNGHRoot = (0, import_gestureState.getGestureHandlerState)().RootView;
649
- const mountedContents = shouldMountChildren ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContainerComponent, { children: contents }) : null;
632
+ const mountedContents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContainerComponent, { children: contents });
650
633
  const modalContents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, {
651
634
  stackZIndex: zIndex,
652
635
  hidden: !isVisuallyActive,
653
636
  ...portalProps,
654
- children: mountedContents && RNGHRoot ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RNGHRoot, {
637
+ children: RNGHRoot ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RNGHRoot, {
655
638
  style: open ? rnghRootStyleOpen : rnghRootStyleClosed,
656
639
  children: mountedContents
657
640
  }) : mountedContents
@@ -35,16 +35,17 @@ module.exports = __toCommonJS(SheetImplementationCustom_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_adapt = require("@tamagui/adapt");
37
37
  var import_animate_presence = require("@tamagui/animate-presence");
38
+ var import_transitionResolver = require("@tamagui/animation-helpers/transitionResolver");
38
39
  var import_compose_refs = require("@tamagui/compose-refs");
39
40
  var import_constants = require("@tamagui/constants");
40
41
  var import_core = require("@tamagui/core");
41
42
  var import_portal = require("@tamagui/portal");
42
43
  var import_react = __toESM(require("react"), 1);
43
- var import_react_native = require("react-native");
44
44
  var import_contexts = require("./contexts.native.js");
45
45
  var import_constants2 = require("./constants.native.js");
46
- var import_GestureDetectorWrapper = require("./GestureDetectorWrapper.native.js");
47
46
  var import_gestureState = require("./gestureState.native.js");
47
+ var import_SheetDragSurface = require("./SheetDragSurface.native.js");
48
+ var import_stableViewportHeight = require("./stableViewportHeight.native.js");
48
49
  var import_GestureSheetContext = require("./GestureSheetContext.native.js");
49
50
  var import_helpers = require("./helpers.native.js");
50
51
  var import_keyboardAvoidance = require("./keyboardAvoidance.native.js");
@@ -65,11 +66,6 @@ var rnghRootStyleClosed = {
65
66
  height: 0
66
67
  };
67
68
  var sheetEscapeLayers = [];
68
- var relativeDimensionTo = import_constants.isWeb ? "window" : "screen";
69
- function getStableViewportHeight() {
70
- if (import_constants.isWeb && typeof window !== "undefined") return (0, import_webViewport.getStableLayoutViewportHeight)();
71
- return import_react_native.Dimensions.get(relativeDimensionTo).height;
72
- }
73
69
  var SheetImplementationCustom = (0, import_core.createRefComponent)(function SheetImplementationCustom2(props, forwardedRef) {
74
70
  var parentSheet = import_react.default.useContext(import_contexts.ParentSheetContext);
75
71
  var safeAreaInsets = (0, import_useSafeAreaInsets.useSafeAreaInsets)();
@@ -86,18 +82,21 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
86
82
  var ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, sheetRef, providerProps.contentRef);
87
83
  var animationDriver = (0, import_core.useAnimationDriver)();
88
84
  var transitionConfig = (function() {
89
- var _animationDriver_animations;
85
+ var _getTransitionResolver, _resolved_all;
90
86
  if (transitionConfigProp) return transitionConfigProp;
91
- var [animationProp, animationPropConfig] = !transition ? [] : Array.isArray(transition) ? transition : [transition];
92
- var namedConfig = animationProp && ((_animationDriver_animations = animationDriver.animations) === null || _animationDriver_animations === void 0 ? void 0 : _animationDriver_animations[animationProp]);
93
- if (namedConfig) {
94
- if (typeof namedConfig === "string") return animationPropConfig !== null && animationPropConfig !== void 0 ? animationPropConfig : null;
95
- return {
96
- ...namedConfig,
97
- ...animationPropConfig
98
- };
99
- }
100
- return null;
87
+ var resolved = transition ? (_getTransitionResolver = (0, import_transitionResolver.getTransitionResolver)()) === null || _getTransitionResolver === void 0 ? void 0 : _getTransitionResolver.resolve(transition, { animations: animationDriver.animations }) : null;
88
+ var timing = resolved === null || resolved === void 0 ? void 0 : (_resolved_all = resolved.all) === null || _resolved_all === void 0 ? void 0 : _resolved_all.timing;
89
+ if (!timing) return null;
90
+ if (timing.kind === "timing") return {
91
+ type: "timing",
92
+ duration: timing.durationMs
93
+ };
94
+ return {
95
+ type: "spring",
96
+ stiffness: timing.stiffness,
97
+ damping: timing.damping,
98
+ mass: timing.mass
99
+ };
101
100
  })();
102
101
  var [isShowingInnerSheet, setIsShowingInnerSheet] = import_react.default.useState(false);
103
102
  var shouldHideParentSheet = !import_constants.isWeb && modal && isShowingInnerSheet && (0, import_portal.needsPortalRepropagation)();
@@ -121,7 +120,7 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
121
120
  isKeyboardVisible,
122
121
  frameSize
123
122
  ]);
124
- var effScreenSize = isWebKbSheet ? getStableViewportHeight() : screenSize;
123
+ var effScreenSize = isWebKbSheet ? (0, import_stableViewportHeight.getStableViewportHeight)() : screenSize;
125
124
  var effectiveFrameSize = open ? frameSize : stableFrameSize.current || frameSize;
126
125
  var positions = import_react.default.useMemo(function() {
127
126
  return snapPoints.map(function(point) {
@@ -326,15 +325,11 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
326
325
  (0, import_constants.useIsomorphicLayoutEffect)(function() {
327
326
  if (hasntMeasured && screenSize && frameSize) {
328
327
  at.current = screenSize;
329
- animatedNumber.setValue(screenSize, {
330
- type: "timing",
331
- duration: 0
332
- }, function() {
333
- syncAnimatedPosition(screenSize);
334
- setTimeout(function() {
335
- setDisableAnimation(false);
336
- }, 10);
337
- });
328
+ animatedNumber.setValue(screenSize, { type: "direct" });
329
+ syncAnimatedPosition(screenSize);
330
+ setTimeout(function() {
331
+ setDisableAnimation(false);
332
+ }, 10);
338
333
  return;
339
334
  }
340
335
  if (disableAnimation) return;
@@ -371,10 +366,10 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
371
366
  var disableDrag = (_props_disableDrag = props.disableDrag) !== null && _props_disableDrag !== void 0 ? _props_disableDrag : controller === null || controller === void 0 ? void 0 : controller.disableDrag;
372
367
  (0, import_core.useThemeName)();
373
368
  var [blockPan, setBlockPan] = import_react.default.useState(false);
374
- var panResponder = import_react.default.useMemo(function() {
375
- if (disableDrag) return;
376
- if (!frameSize) return;
377
- if (isShowingInnerSheet) return;
369
+ var panConfig = import_react.default.useMemo(function() {
370
+ if (disableDrag) return null;
371
+ if (!frameSize) return null;
372
+ if (isShowingInnerSheet) return null;
378
373
  var minY = activePositions[0];
379
374
  scrollBridge.paneMinY = minY;
380
375
  var startY = at.current;
@@ -456,7 +451,7 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
456
451
  setPosition(positionIndex);
457
452
  animateTo(positionIndex);
458
453
  };
459
- return import_react_native.PanResponder.create({
454
+ return {
460
455
  onMoveShouldSetPanResponder: onMoveShouldSet,
461
456
  onPanResponderTerminationRequest: function() {
462
457
  return false;
@@ -473,7 +468,7 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
473
468
  onPanResponderEnd: finish,
474
469
  onPanResponderTerminate: finish,
475
470
  onPanResponderRelease: finish
476
- });
471
+ };
477
472
  }, [
478
473
  disableDrag,
479
474
  isShowingInnerSheet,
@@ -557,14 +552,14 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
557
552
  if (!open && stableFrameSize.current !== 0) return;
558
553
  var layoutHeight = (_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height;
559
554
  if (ignoreLayoutForKeyboard() && frameSize > 0) return;
560
- var next = modal ? Math.min(layoutHeight, getStableViewportHeight()) : layoutHeight;
555
+ var next = modal ? Math.min(layoutHeight, (0, import_stableViewportHeight.getStableViewportHeight)()) : layoutHeight;
561
556
  if (!next) return;
562
557
  setFrameSize(Math.round(next));
563
558
  });
564
559
  var handleMaxContentViewLayout = import_react.default.useCallback(function(e) {
565
560
  var _e_nativeEvent;
566
561
  if (ignoreLayoutForKeyboard() && screenSize > 0) return;
567
- var next = Math.min((_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, getStableViewportHeight());
562
+ var next = Math.min((_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, (0, import_stableViewportHeight.getStableViewportHeight)());
568
563
  if (!next) return;
569
564
  setMaxContentSize(Math.round(next));
570
565
  }, [ignoreLayoutForKeyboard, screenSize]);
@@ -627,16 +622,11 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
627
622
  children: shouldHideParentSheet || !open ? null : overlayChildren
628
623
  })
629
624
  }),
630
- snapPointsMode !== "percent" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
631
- style: {
632
- opacity: 0,
633
- position: "absolute",
634
- top: 0,
635
- left: 0,
636
- right: 0,
637
- bottom: 0,
638
- pointerEvents: "none"
639
- },
625
+ snapPointsMode !== "percent" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.View, {
626
+ opacity: 0,
627
+ position: "absolute",
628
+ inset: 0,
629
+ pointerEvents: "none",
640
630
  onLayout: handleMaxContentViewLayout
641
631
  }),
642
632
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatedView, {
@@ -653,17 +643,10 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
653
643
  ...applyHidden && { display: "none" },
654
644
  ...(shouldHideParentSheet || !open) && { pointerEvents: "none" }
655
645
  }, animatedStyle],
656
- children: gestureHandlerEnabled && panGesture ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GestureDetectorWrapper.GestureDetectorWrapper, {
657
- gesture: panGesture,
658
- style: { flex: 1 },
659
- children: animatedChildren
660
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
661
- ...panResponder === null || panResponder === void 0 ? void 0 : panResponder.panHandlers,
662
- style: {
663
- flex: 1,
664
- width: "100%",
665
- height: "100%"
666
- },
646
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SheetDragSurface.SheetDragSurface, {
647
+ gestureHandlerEnabled,
648
+ panGesture,
649
+ panConfig,
667
650
  children: animatedChildren
668
651
  })
669
652
  })
@@ -685,13 +668,14 @@ var SheetImplementationCustom = (0, import_core.createRefComponent)(function She
685
668
  }
686
669
  var shouldMountChildren = unmountChildrenWhenHidden ? !isFullyClosed : true;
687
670
  if (modal) {
671
+ if (!shouldMountChildren) return null;
688
672
  var RNGHRoot = (0, import_gestureState.getGestureHandlerState)().RootView;
689
- var mountedContents = shouldMountChildren ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContainerComponent, { children: contents }) : null;
673
+ var mountedContents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContainerComponent, { children: contents });
690
674
  var modalContents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, {
691
675
  stackZIndex: zIndex,
692
676
  hidden: !isVisuallyActive,
693
677
  ...portalProps,
694
- children: mountedContents && RNGHRoot ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RNGHRoot, {
678
+ children: RNGHRoot ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RNGHRoot, {
695
679
  style: open ? rnghRootStyleOpen : rnghRootStyleClosed,
696
680
  children: mountedContents
697
681
  }) : mountedContents