@tamagui/sheet 1.111.13 → 1.112.0-1727286694781
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.
- package/dist/cjs/Sheet.cjs +122 -0
- package/dist/cjs/Sheet.cjs.map +6 -0
- package/dist/cjs/SheetContext.cjs +32 -0
- package/dist/cjs/SheetContext.cjs.map +6 -0
- package/dist/cjs/SheetController.cjs +57 -0
- package/dist/cjs/SheetController.cjs.map +6 -0
- package/dist/cjs/SheetImplementationCustom.cjs +365 -0
- package/dist/cjs/SheetImplementationCustom.cjs.map +6 -0
- package/dist/cjs/SheetScrollView.cjs +92 -0
- package/dist/cjs/SheetScrollView.cjs.map +6 -0
- package/dist/cjs/constants.cjs +36 -0
- package/dist/cjs/constants.cjs.map +6 -0
- package/dist/cjs/contexts.cjs +42 -0
- package/dist/cjs/contexts.cjs.map +6 -0
- package/dist/cjs/createSheet.cjs +166 -0
- package/dist/cjs/createSheet.cjs.map +6 -0
- package/dist/cjs/helpers.cjs +33 -0
- package/dist/cjs/helpers.cjs.map +6 -0
- package/dist/cjs/index.cjs +28 -0
- package/dist/cjs/index.cjs.map +6 -0
- package/dist/cjs/nativeSheet.cjs +75 -0
- package/dist/cjs/nativeSheet.cjs.map +6 -0
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/types.cjs.map +6 -0
- package/dist/cjs/useSheet.cjs +27 -0
- package/dist/cjs/useSheet.cjs.map +6 -0
- package/dist/cjs/useSheetController.cjs +50 -0
- package/dist/cjs/useSheetController.cjs.map +6 -0
- package/dist/cjs/useSheetOffscreenSize.cjs +51 -0
- package/dist/cjs/useSheetOffscreenSize.cjs.map +6 -0
- package/dist/cjs/useSheetOpenState.cjs +49 -0
- package/dist/cjs/useSheetOpenState.cjs.map +6 -0
- package/dist/cjs/useSheetProviderProps.cjs +121 -0
- package/dist/cjs/useSheetProviderProps.cjs.map +6 -0
- package/package.json +16 -16
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var SheetScrollView_exports = {};
|
|
33
|
+
__export(SheetScrollView_exports, {
|
|
34
|
+
SheetScrollView: () => SheetScrollView
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(SheetScrollView_exports);
|
|
37
|
+
var import_react = __toESM(require("react")),
|
|
38
|
+
import_compose_refs = require("@tamagui/compose-refs"),
|
|
39
|
+
import_scroll_view = require("@tamagui/scroll-view"),
|
|
40
|
+
import_SheetContext = require("./SheetContext.cjs"),
|
|
41
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
const SHEET_SCROLL_VIEW_NAME = "SheetScrollView",
|
|
43
|
+
SheetScrollView = import_react.default.forwardRef(({
|
|
44
|
+
__scopeSheet,
|
|
45
|
+
children,
|
|
46
|
+
onScroll,
|
|
47
|
+
...props
|
|
48
|
+
}, ref) => {
|
|
49
|
+
const context = (0, import_SheetContext.useSheetContext)(SHEET_SCROLL_VIEW_NAME, __scopeSheet),
|
|
50
|
+
{
|
|
51
|
+
scrollBridge
|
|
52
|
+
} = context,
|
|
53
|
+
scrollRef = import_react.default.useRef(null),
|
|
54
|
+
state = import_react.default.useRef({
|
|
55
|
+
lastPageY: 0,
|
|
56
|
+
dragAt: 0,
|
|
57
|
+
dys: [],
|
|
58
|
+
// store a few recent dys to get velocity on release
|
|
59
|
+
isScrolling: !1,
|
|
60
|
+
isDragging: !1
|
|
61
|
+
}),
|
|
62
|
+
release = () => {
|
|
63
|
+
if (!state.current.isDragging) return;
|
|
64
|
+
state.current.isDragging = !1, scrollBridge.scrollStartY = -1, state.current.isScrolling = !1;
|
|
65
|
+
let vy = 0;
|
|
66
|
+
if (state.current.dys.length) {
|
|
67
|
+
const recentDys = state.current.dys.slice(-10);
|
|
68
|
+
vy = (recentDys.length ? recentDys.reduce((a, b) => a + b, 0) : 0) / recentDys.length * 0.04;
|
|
69
|
+
}
|
|
70
|
+
state.current.dys = [], scrollBridge.release({
|
|
71
|
+
dragAt: state.current.dragAt,
|
|
72
|
+
vy
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_scroll_view.ScrollView, {
|
|
76
|
+
ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),
|
|
77
|
+
flex: 1,
|
|
78
|
+
scrollEventThrottle: 8,
|
|
79
|
+
onScroll: e => {
|
|
80
|
+
const {
|
|
81
|
+
y
|
|
82
|
+
} = e.nativeEvent.contentOffset;
|
|
83
|
+
scrollBridge.y = y, y > 0 && (scrollBridge.scrollStartY = -1), onScroll?.(e);
|
|
84
|
+
},
|
|
85
|
+
onStartShouldSetResponder: () => (scrollBridge.scrollStartY = -1, state.current.isDragging = !0, !0),
|
|
86
|
+
onMoveShouldSetResponder: () => !1,
|
|
87
|
+
onResponderRelease: release,
|
|
88
|
+
className: "_ovs-contain",
|
|
89
|
+
...props,
|
|
90
|
+
children: import_react.default.useMemo(() => children, [children])
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/SheetScrollView.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,sBAA4B,kCAG5B,qBAA2B,iCAI3B,sBAAgC,2BAmE1B;AA1DN,MAAM,yBAAyB,mBAElB,kBAAkB,aAAAA,QAAM;AAAA,EAInC,CACE,EAAE,cAAc,UAAU,UAAU,GAAG,MAAM,GAC7C,QACG;AACH,UAAM,cAAU,qCAAgB,wBAAwB,YAAY,GAC9D,EAAE,aAAa,IAAI,SAEnB,YAAY,aAAAA,QAAM,OAA4B,IAAI,GAclD,QAAQ,aAAAA,QAAM,OAAO;AAAA,MACzB,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,KAAK,CAAC;AAAA;AAAA,MACN,aAAa;AAAA,MACb,YAAY;AAAA,IACd,CAAC,GAEK,UAAU,MAAM;AACpB,UAAI,CAAC,MAAM,QAAQ;AACjB;AAEF,YAAM,QAAQ,aAAa,IAC3B,aAAa,eAAe,IAC5B,MAAM,QAAQ,cAAc;AAE5B,UAAI,KAAK;AACT,UAAI,MAAM,QAAQ,IAAI,QAAQ;AAC5B,cAAM,YAAY,MAAM,QAAQ,IAAI,MAAM,GAAG;AAG7C,cAFa,UAAU,SAAS,UAAU,OAAO,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,IAAI,KAClD,UAAU,SAClB;AAAA,MACf;AACA,YAAM,QAAQ,MAAM,CAAC,GACrB,aAAa,QAAQ;AAAA,QACnB,QAAQ,MAAM,QAAQ;AAAA,QACtB;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SAAK,iCAAY,WAAkB,GAAG;AAAA,QACtC,MAAM;AAAA,QACN,qBAAqB;AAAA,QAErB,UAAU,CAAC,MAAM;AACf,gBAAM,EAAE,EAAE,IAAI,EAAE,YAAY;AAC5B,uBAAa,IAAI,GACb,IAAI,MACN,aAAa,eAAe,KAI9B,WAAW,CAAC;AAAA,QASd;AAAA,QACA,2BAA2B,OACzB,aAAa,eAAe,IAC5B,MAAM,QAAQ,aAAa,IACpB;AAAA,QAGT,0BAA0B,MAAM;AAAA,QAmChC,oBAAoB;AAAA,QACpB,WAAU;AAAA,QACT,GAAG;AAAA,QAEH,uBAAAA,QAAM,QAAQ,MAAM,UAAU,CAAC,QAAQ,CAAC;AAAA;AAAA,IAC3C;AAAA,EAEJ;AACF;",
|
|
5
|
+
"names": ["React"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var constants_exports = {};
|
|
22
|
+
__export(constants_exports, {
|
|
23
|
+
SHEET_HANDLE_NAME: () => SHEET_HANDLE_NAME,
|
|
24
|
+
SHEET_HIDDEN_STYLESHEET: () => SHEET_HIDDEN_STYLESHEET,
|
|
25
|
+
SHEET_NAME: () => SHEET_NAME,
|
|
26
|
+
SHEET_OVERLAY_NAME: () => SHEET_OVERLAY_NAME,
|
|
27
|
+
constants: () => constants
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(constants_exports);
|
|
30
|
+
var import_core = require("@tamagui/core");
|
|
31
|
+
const constants = {},
|
|
32
|
+
SHEET_NAME = "Sheet",
|
|
33
|
+
SHEET_HANDLE_NAME = "SheetHandle",
|
|
34
|
+
SHEET_OVERLAY_NAME = "SheetOverlay",
|
|
35
|
+
SHEET_HIDDEN_STYLESHEET = import_core.isClient ? document.createElement("style") : null;
|
|
36
|
+
SHEET_HIDDEN_STYLESHEET && typeof document.head < "u" && document.head.appendChild(SHEET_HIDDEN_STYLESHEET);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/constants.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AAElB,MAAM,YAAY,CAAC,GAEb,aAAa,SACb,oBAAoB,eACpB,qBAAqB,gBAErB,0BAA0B,uBAAW,SAAS,cAAc,OAAO,IAAI;AAChF,2BACE,OAAO,SAAS,OAAS,OAC3B,SAAS,KAAK,YAAY,uBAAuB;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var contexts_exports = {};
|
|
33
|
+
__export(contexts_exports, {
|
|
34
|
+
ParentSheetContext: () => ParentSheetContext,
|
|
35
|
+
SheetInsideSheetContext: () => SheetInsideSheetContext
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(contexts_exports);
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
const ParentSheetContext = import_react.default.createContext({
|
|
40
|
+
zIndex: 1e5
|
|
41
|
+
}),
|
|
42
|
+
SheetInsideSheetContext = import_react.default.createContext(null);
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var createSheet_exports = {};
|
|
22
|
+
__export(createSheet_exports, {
|
|
23
|
+
createSheet: () => createSheet
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(createSheet_exports);
|
|
26
|
+
var import_compose_refs = require("@tamagui/compose-refs"),
|
|
27
|
+
import_constants = require("@tamagui/constants"),
|
|
28
|
+
import_core = require("@tamagui/core"),
|
|
29
|
+
import_helpers = require("@tamagui/helpers"),
|
|
30
|
+
import_remove_scroll = require("@tamagui/remove-scroll"),
|
|
31
|
+
import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr"),
|
|
32
|
+
import_react = require("react"),
|
|
33
|
+
import_react_native = require("react-native-web"),
|
|
34
|
+
import_constants2 = require("./constants.cjs"),
|
|
35
|
+
import_nativeSheet = require("./nativeSheet.cjs"),
|
|
36
|
+
import_SheetContext = require("./SheetContext.cjs"),
|
|
37
|
+
import_SheetImplementationCustom = require("./SheetImplementationCustom.cjs"),
|
|
38
|
+
import_SheetScrollView = require("./SheetScrollView.cjs"),
|
|
39
|
+
import_useSheetController = require("./useSheetController.cjs"),
|
|
40
|
+
import_useSheetOffscreenSize = require("./useSheetOffscreenSize.cjs"),
|
|
41
|
+
import_jsx_runtime =
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
require("react/jsx-runtime");
|
|
44
|
+
function createSheet({
|
|
45
|
+
Handle,
|
|
46
|
+
Frame,
|
|
47
|
+
Overlay
|
|
48
|
+
}) {
|
|
49
|
+
const SheetHandle = Handle.styleable(({
|
|
50
|
+
__scopeSheet,
|
|
51
|
+
...props
|
|
52
|
+
}, forwardedRef) => {
|
|
53
|
+
const context = (0, import_SheetContext.useSheetContext)(import_constants2.SHEET_HANDLE_NAME, __scopeSheet),
|
|
54
|
+
composedRef = (0, import_compose_refs.useComposedRefs)(context.handleRef, forwardedRef);
|
|
55
|
+
return context.onlyShowFrame ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(Handle, {
|
|
56
|
+
ref: composedRef,
|
|
57
|
+
onPress: () => {
|
|
58
|
+
const max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0),
|
|
59
|
+
nextPos = (context.position + 1) % max;
|
|
60
|
+
context.setPosition(nextPos);
|
|
61
|
+
},
|
|
62
|
+
open: context.open,
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}),
|
|
66
|
+
SheetOverlay = Overlay.extractable((0, import_react.memo)(propsIn => {
|
|
67
|
+
const {
|
|
68
|
+
__scopeSheet,
|
|
69
|
+
...props
|
|
70
|
+
} = propsIn,
|
|
71
|
+
context = (0, import_SheetContext.useSheetContext)(import_constants2.SHEET_OVERLAY_NAME, __scopeSheet),
|
|
72
|
+
element = (0, import_react.useMemo)(() =>
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
/* @__PURE__ */
|
|
75
|
+
(0, import_jsx_runtime.jsx)(Overlay, {
|
|
76
|
+
...props,
|
|
77
|
+
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, context.dismissOnOverlayPress ? () => {
|
|
78
|
+
context.setOpen(!1);
|
|
79
|
+
} : void 0)
|
|
80
|
+
}), [props.onPress, context.dismissOnOverlayPress]);
|
|
81
|
+
return (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
82
|
+
context.onOverlayComponent?.(element);
|
|
83
|
+
}, [element]), context.onlyShowFrame, null;
|
|
84
|
+
})),
|
|
85
|
+
SheetFrame = Frame.extractable((0, import_react.forwardRef)(({
|
|
86
|
+
__scopeSheet,
|
|
87
|
+
adjustPaddingForOffscreenContent,
|
|
88
|
+
disableHideBottomOverflow,
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}, forwardedRef) => {
|
|
92
|
+
const context = (0, import_SheetContext.useSheetContext)(import_constants2.SHEET_NAME, __scopeSheet),
|
|
93
|
+
{
|
|
94
|
+
hasFit,
|
|
95
|
+
removeScrollEnabled,
|
|
96
|
+
frameSize,
|
|
97
|
+
contentRef,
|
|
98
|
+
open
|
|
99
|
+
} = context,
|
|
100
|
+
composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef),
|
|
101
|
+
offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context),
|
|
102
|
+
sheetContents = (0, import_react.useMemo)(() =>
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
/* @__PURE__ */
|
|
105
|
+
(0, import_jsx_runtime.jsxs)(Frame, {
|
|
106
|
+
ref: composedContentRef,
|
|
107
|
+
flex: hasFit ? 0 : 1,
|
|
108
|
+
height: hasFit ? void 0 : frameSize,
|
|
109
|
+
pointerEvents: open ? "auto" : "none",
|
|
110
|
+
...props,
|
|
111
|
+
children: [children, adjustPaddingForOffscreenContent && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Stack, {
|
|
112
|
+
"data-sheet-offscreen-pad": !0,
|
|
113
|
+
height: offscreenSize,
|
|
114
|
+
width: "100%"
|
|
115
|
+
})]
|
|
116
|
+
}), [open, props, frameSize, offscreenSize, adjustPaddingForOffscreenContent, hasFit]);
|
|
117
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
118
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_remove_scroll.RemoveScroll, {
|
|
119
|
+
forwardProps: !0,
|
|
120
|
+
enabled: removeScrollEnabled,
|
|
121
|
+
allowPinchZoom: !0,
|
|
122
|
+
shards: [contentRef],
|
|
123
|
+
removeScrollBar: !1,
|
|
124
|
+
children: sheetContents
|
|
125
|
+
}), !disableHideBottomOverflow &&
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
/* @__PURE__ */
|
|
128
|
+
(0, import_jsx_runtime.jsx)(Frame, {
|
|
129
|
+
...props,
|
|
130
|
+
componentName: "SheetCover",
|
|
131
|
+
children: null,
|
|
132
|
+
position: "absolute",
|
|
133
|
+
bottom: "-100%",
|
|
134
|
+
zIndex: -1,
|
|
135
|
+
height: context.frameSize,
|
|
136
|
+
left: 0,
|
|
137
|
+
right: 0,
|
|
138
|
+
borderWidth: 0,
|
|
139
|
+
borderRadius: 0,
|
|
140
|
+
shadowOpacity: 0
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
143
|
+
})),
|
|
144
|
+
Sheet = (0, import_react.forwardRef)(function (props, ref) {
|
|
145
|
+
const hydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(),
|
|
146
|
+
{
|
|
147
|
+
isShowingNonSheet
|
|
148
|
+
} = (0, import_useSheetController.useSheetController)();
|
|
149
|
+
let SheetImplementation = import_SheetImplementationCustom.SheetImplementationCustom;
|
|
150
|
+
return props.native && import_react_native.Platform.OS, isShowingNonSheet || !hydrated ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(SheetImplementation, {
|
|
151
|
+
ref,
|
|
152
|
+
...props
|
|
153
|
+
});
|
|
154
|
+
}),
|
|
155
|
+
components = {
|
|
156
|
+
Frame: SheetFrame,
|
|
157
|
+
Overlay: SheetOverlay,
|
|
158
|
+
Handle: SheetHandle,
|
|
159
|
+
ScrollView: import_SheetScrollView.SheetScrollView
|
|
160
|
+
},
|
|
161
|
+
Controlled = (0, import_helpers.withStaticProperties)(Sheet, components);
|
|
162
|
+
return (0, import_helpers.withStaticProperties)(Sheet, {
|
|
163
|
+
...components,
|
|
164
|
+
Controlled
|
|
165
|
+
});
|
|
166
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createSheet.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,mBAA0C,+BAQ1C,cAAsB,0BACtB,iBAA2D,6BAC3D,uBAA6B,mCAC7B,4BAAgC,wCAEhC,eAA0C,kBAE1C,sBAAyB,yBAEzBA,oBAAkE,wBAClE,qBAA+B,0BAC/B,sBAAgC,2BAChC,mCAA0C,wCAC1C,yBAAgC,8BAEhC,4BAAmC,iCACnC,+BAAsC,oCA6B9B;AAAA;AAAA;AAAA;AAnBD,SAAS,YAId,EAAE,QAAQ,OAAO,QAAQ,GAAwC;AACjE,QAAM,cAAc,OAAO;AAAA,IACzB,CACE,EAAE,cAAc,GAAG,MAAM,GACzB,iBACG;AACH,YAAM,cAAU,qCAAgB,qCAAmB,YAAY,GACzD,kBAAc,qCAAgC,QAAQ,WAAW,YAAY;AAEnF,aAAI,QAAQ,gBACH,OAKP;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,SAAS,MAAM;AAEb,kBAAM,MACJ,QAAQ,WAAW,UAAU,QAAQ,wBAAwB,KAAK,IAC9D,WAAW,QAAQ,WAAW,KAAK;AACzC,oBAAQ,YAAY,OAAO;AAAA,UAC7B;AAAA,UACA,MAAM,QAAQ;AAAA,UACb,GAAG;AAAA;AAAA,MACN;AAAA,IAEJ;AAAA,EACF,GAMM,eAAe,QAAQ;AAAA,QAC3B,mBAAK,CAAC,YAAwD;AAC5D,YAAM,EAAE,cAAc,GAAG,MAAM,IAAI,SAC7B,cAAU,qCAAgB,sCAAoB,YAAY,GAK1D,cAAU,sBAAQ;AAAA;AAAA,QAGpB;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACJ,aAAS;AAAA,cACP,MAAM;AAAA,cACN,QAAQ,wBACJ,MAAM;AACJ,wBAAQ,QAAQ,EAAK;AAAA,cACvB,IACA;AAAA,YACN;AAAA;AAAA,QACF;AAAA,SAED,CAAC,MAAM,SAAS,QAAQ,qBAAqB,CAAC;AAMjD,iBAJA,4CAA0B,MAAM;AAC9B,gBAAQ,qBAAqB,OAAO;AAAA,MACtC,GAAG,CAAC,OAAO,CAAC,GAER,QAAQ,eACH;AAAA,IAIX,CAAC;AAAA,EACH,GAsBM,aAAa,MAAM;AAAA,QACvB;AAAA,MACE,CACE;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL,GAGA,iBACG;AACH,cAAM,cAAU,qCAAgB,8BAAY,YAAY,GAClD,EAAE,QAAQ,qBAAqB,WAAW,YAAY,KAAK,IAAI,SAC/D,yBAAqB,qCAAgB,cAAc,UAAU,GAC7D,oBAAgB,oDAAsB,OAAO,GAE7C,oBAAgB,sBAAQ;AAAA;AAAA,UAG1B;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL,MAAM,SAAS,IAAI;AAAA,cACnB,QAAQ,SAAS,SAAY;AAAA,cAC7B,eAAe,OAAO,SAAS;AAAA,cAC9B,GAAG;AAAA,cAEH;AAAA;AAAA,gBAEA,oCACC,4CAAC,qBAAM,4BAAwB,IAAC,QAAQ,eAAe,OAAM,QAAO;AAAA;AAAA;AAAA,UAExE;AAAA,WAED;AAAA,UACD;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAED,eACE,4EACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,cAAY;AAAA,cACZ,SAAS;AAAA,cACT,gBAAc;AAAA,cACd,QAAQ,CAAC,UAAU;AAAA,cAEnB,iBAAiB;AAAA,cAEhB;AAAA;AAAA,UACH;AAAA,UAGC,CAAC;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,eAAc;AAAA,cAEd,UAAU;AAAA,cACV,UAAS;AAAA,cACT,QAAO;AAAA,cACP,QAAQ;AAAA,cACR,QAAQ,QAAQ;AAAA,cAChB,MAAM;AAAA,cACN,OAAO;AAAA,cACP,aAAa;AAAA,cACb,cAAc;AAAA,cACd,eAAe;AAAA;AAAA,UACjB;AAAA,WAEJ;AAAA,MAEJ;AAAA,IACF;AAAA,EACF,GAEM,YAAQ,yBAA6B,SAAe,OAAO,KAAK;AACpE,UAAM,eAAW,2CAAgB,GAC3B,EAAE,kBAAkB,QAAI,8CAAmB;AAEjD,QAAI,sBAAsB;AAc1B,WAZI,MAAM,UAAU,6BAAS,IAYzB,qBAAqB,CAAC,WACjB,OAGF,4CAAC,uBAAoB,KAAW,GAAG,OAAO;AAAA,EACnD,CAAC,GAEK,aAAa;AAAA,IACjB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,EACd,GAEM,iBAAa,qCAAqB,OAAO,UAAU;AAKzD,aAAO,qCAAqB,OAAO;AAAA,IACjC,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
|
|
5
|
+
"names": ["import_constants"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var helpers_exports = {};
|
|
22
|
+
__export(helpers_exports, {
|
|
23
|
+
resisted: () => resisted
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
26
|
+
function resisted(y, minY, maxOverflow = 25) {
|
|
27
|
+
if (y < minY) {
|
|
28
|
+
const past = minY - y,
|
|
29
|
+
extra = -(1.1 - 0.15 ** (Math.min(maxOverflow, past) / maxOverflow)) * maxOverflow;
|
|
30
|
+
return minY + extra;
|
|
31
|
+
}
|
|
32
|
+
return y;
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/helpers.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,SAAS,GAAW,MAAc,cAAc,IAAI;AAClE,MAAI,IAAI,MAAM;AACZ,UAAM,OAAO,OAAO,GAGd,QAAQ,EADK,MAAM,SADT,KAAK,IAAI,aAAa,IAAI,IAAI,gBAElB;AAC5B,WAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACT;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
|
+
get: () => from[key],
|
|
8
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
|
+
});
|
|
10
|
+
return to;
|
|
11
|
+
},
|
|
12
|
+
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
13
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
14
|
+
value: !0
|
|
15
|
+
}), mod);
|
|
16
|
+
var src_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(src_exports);
|
|
18
|
+
__reExport(src_exports, require("./Sheet.cjs"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./useSheet.cjs"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./createSheet.cjs"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./SheetController.cjs"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./useSheetController.cjs"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./useSheetOpenState.cjs"), module.exports);
|
|
24
|
+
__reExport(src_exports, require("./useSheetOffscreenSize.cjs"), module.exports);
|
|
25
|
+
__reExport(src_exports, require("./SheetScrollView.cjs"), module.exports);
|
|
26
|
+
__reExport(src_exports, require("./nativeSheet.cjs"), module.exports);
|
|
27
|
+
__reExport(src_exports, require("./types.cjs"), module.exports);
|
|
28
|
+
__reExport(src_exports, require("./contexts.cjs"), module.exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,oBAAd;AACA,wBAAc,uBADd;AAEA,wBAAc,0BAFd;AAGA,wBAAc,8BAHd;AAIA,wBAAc,iCAJd;AAKA,wBAAc,gCALd;AAMA,wBAAc,oCANd;AAOA,wBAAc,8BAPd;AAQA,wBAAc,0BARd;AASA,wBAAc,oBATd;AAUA,wBAAc,uBAVd;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var nativeSheet_exports = {};
|
|
22
|
+
__export(nativeSheet_exports, {
|
|
23
|
+
getNativeSheet: () => getNativeSheet,
|
|
24
|
+
setupNativeSheet: () => setupNativeSheet
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(nativeSheet_exports);
|
|
27
|
+
var import_stacks = require("@tamagui/stacks"),
|
|
28
|
+
import_react = require("react"),
|
|
29
|
+
import_react_native = require("react-native-web"),
|
|
30
|
+
import_SheetContext = require("./SheetContext.cjs"),
|
|
31
|
+
import_useSheetOpenState = require("./useSheetOpenState.cjs"),
|
|
32
|
+
import_useSheetProviderProps = require("./useSheetProviderProps.cjs"),
|
|
33
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
const nativeSheets = {
|
|
35
|
+
ios: null
|
|
36
|
+
};
|
|
37
|
+
function getNativeSheet(platform) {
|
|
38
|
+
return nativeSheets[platform];
|
|
39
|
+
}
|
|
40
|
+
function setupNativeSheet(platform, Implementation) {
|
|
41
|
+
platform === "ios" && (nativeSheets[platform] = props => {
|
|
42
|
+
const state = (0, import_useSheetOpenState.useSheetOpenState)(props),
|
|
43
|
+
providerProps = (0, import_useSheetProviderProps.useSheetProviderProps)(props, state),
|
|
44
|
+
{
|
|
45
|
+
open,
|
|
46
|
+
setOpen
|
|
47
|
+
} = state,
|
|
48
|
+
ref = (0, import_react.useRef)();
|
|
49
|
+
return (0, import_react.useEffect)(() => {
|
|
50
|
+
ref.current?.setVisibility(open);
|
|
51
|
+
}, [open]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
52
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_SheetContext.SheetProvider, {
|
|
53
|
+
...providerProps,
|
|
54
|
+
onlyShowFrame: !0,
|
|
55
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(Implementation, {
|
|
56
|
+
ref,
|
|
57
|
+
onModalDismiss: () => setOpen(!1),
|
|
58
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
59
|
+
style: {
|
|
60
|
+
flex: 1
|
|
61
|
+
},
|
|
62
|
+
children: props.children
|
|
63
|
+
})
|
|
64
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.YStack, {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
opacity: 0,
|
|
67
|
+
pointerEvents: "none",
|
|
68
|
+
width: 0,
|
|
69
|
+
height: 0,
|
|
70
|
+
children: props.children
|
|
71
|
+
})]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/nativeSheet.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB,4BAEvB,eAAkC,kBAClC,sBAAqB,yBAErB,sBAA8B,2BAE9B,2BAAkC,gCAClC,+BAAsC,oCAsC9B;AAhCR,MAAM,eAAmF;AAAA,EACvF,KAAK;AACP;AAEO,SAAS,eAAe,UAAgC;AAC7D,SAAO,aAAa,QAAQ;AAC9B;AAEO,SAAS,iBAAiB,UAAgC,gBAAqB;AACpF,EAAI,aAAa,UACf,aAAa,QAAQ,IAAI,CAAC,UAAsB;AAC9C,UAAM,YAAQ,4CAAkB,KAAK,GAC/B,oBAAgB,oDAAsB,OAAO,KAAK,GAIlD,EAAE,MAAM,QAAQ,IAAI,OACpB,UAAM,qBAET;AAEH,uCAAU,MAAM;AACd,UAAI,SAAS,cAAc,IAAI;AAAA,IACjC,GAAG,CAAC,IAAI,CAAC,GASP,2EACE,uDAAC,qCAAe,GAAG,eAAe,eAAa,IAC7C;AAAA,kDAAC,kBAAe,KAAU,gBAAgB,MAAM,QAAQ,EAAK,GAC3D,sDAAC,4BAAK,OAAO,EAAE,MAAM,EAAE,GAAI,gBAAM,UAAS,GAC5C;AAAA,MAIA;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,SAAS;AAAA,UACT,eAAc;AAAA,UACd,OAAO;AAAA,UACP,QAAQ;AAAA,UAEP,gBAAM;AAAA;AAAA,MACT;AAAA,OACF,GACF;AAAA,EAEJ;AAEJ;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
|
+
get: () => from[key],
|
|
8
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
|
+
});
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
13
|
+
value: !0
|
|
14
|
+
}), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var useSheet_exports = {};
|
|
22
|
+
__export(useSheet_exports, {
|
|
23
|
+
useSheet: () => useSheet
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useSheet_exports);
|
|
26
|
+
var import_SheetContext = require("./SheetContext.cjs");
|
|
27
|
+
const useSheet = () => (0, import_SheetContext.useSheetContext)("", void 0);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var useSheetController_exports = {};
|
|
33
|
+
__export(useSheetController_exports, {
|
|
34
|
+
SheetControllerContext: () => SheetControllerContext,
|
|
35
|
+
useSheetController: () => useSheetController
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(useSheetController_exports);
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
const useSheetController = () => {
|
|
40
|
+
const controller = import_react.default.useContext(SheetControllerContext),
|
|
41
|
+
isHidden = controller?.hidden,
|
|
42
|
+
isShowingNonSheet = isHidden && controller?.open;
|
|
43
|
+
return {
|
|
44
|
+
controller,
|
|
45
|
+
isHidden,
|
|
46
|
+
isShowingNonSheet,
|
|
47
|
+
disableDrag: controller?.disableDrag
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
SheetControllerContext = import_react.default.createContext(null);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useSheetController.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAEX,MAAM,qBAAqB,MAAM;AACtC,QAAM,aAAa,aAAAA,QAAM,WAAW,sBAAsB,GACpD,WAAW,YAAY,QACvB,oBAAoB,YAAY,YAAY;AAClD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,YAAY;AAAA,EAC3B;AACF,GAEa,yBACX,aAAAA,QAAM,cAAkD,IAAI;",
|
|
5
|
+
"names": ["React"]
|
|
6
|
+
}
|