@tamagui/remove-scroll 2.7.7 → 3.0.0-beta.643.1
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/RemoveScroll.cjs +18 -21
- package/dist/cjs/RemoveScroll.native.cjs +33 -0
- package/dist/cjs/RemoveScroll.native.js +19 -19
- package/dist/cjs/RemoveScroll.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useDisableScroll.cjs +94 -97
- package/dist/cjs/useDisableScroll.native.cjs +115 -0
- package/dist/cjs/useDisableScroll.native.js +96 -98
- package/dist/cjs/useDisableScroll.native.js.map +1 -1
- package/dist/esm/RemoveScroll.mjs +5 -3
- package/dist/esm/RemoveScroll.mjs.map +1 -1
- package/dist/esm/RemoveScroll.native.js +4 -3
- package/dist/esm/RemoveScroll.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/useDisableScroll.mjs +81 -79
- package/dist/esm/useDisableScroll.mjs.map +1 -1
- package/dist/esm/useDisableScroll.native.js +83 -81
- package/dist/esm/useDisableScroll.native.js.map +1 -1
- package/dist/jsx/RemoveScroll.mjs +5 -3
- package/dist/jsx/RemoveScroll.mjs.map +1 -1
- package/dist/jsx/RemoveScroll.native.cjs +33 -0
- package/dist/jsx/RemoveScroll.native.js +19 -19
- package/dist/jsx/RemoveScroll.native.js.map +1 -1
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +21 -0
- package/dist/jsx/index.native.js +10 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/useDisableScroll.mjs +81 -79
- package/dist/jsx/useDisableScroll.mjs.map +1 -1
- package/dist/jsx/useDisableScroll.native.cjs +115 -0
- package/dist/jsx/useDisableScroll.native.js +96 -98
- package/dist/jsx/useDisableScroll.native.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
|
@@ -1,32 +1,29 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var RemoveScroll_exports = {};
|
|
24
|
-
__export(RemoveScroll_exports, {
|
|
25
|
-
RemoveScroll: () => RemoveScroll
|
|
26
|
-
});
|
|
23
|
+
__export(RemoveScroll_exports, { RemoveScroll: () => RemoveScroll });
|
|
27
24
|
module.exports = __toCommonJS(RemoveScroll_exports);
|
|
28
25
|
var import_useDisableScroll = require("./useDisableScroll.cjs");
|
|
29
|
-
const RemoveScroll = props => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
26
|
+
const RemoveScroll = (props) => {
|
|
27
|
+
(0, import_useDisableScroll.useDisableBodyScroll)(Boolean(props.enabled));
|
|
28
|
+
return props.children;
|
|
29
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var RemoveScroll_native_exports = {};
|
|
25
|
+
__export(RemoveScroll_native_exports, {
|
|
26
|
+
RemoveScroll: () => RemoveScroll,
|
|
27
|
+
getAllowedScrollableNode: () => getAllowedScrollableNode
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(RemoveScroll_native_exports);
|
|
30
|
+
var RemoveScroll = function(props) {
|
|
31
|
+
return props.children;
|
|
32
|
+
};
|
|
33
|
+
var getAllowedScrollableNode = function() {};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var RemoveScroll_native_exports = {};
|
|
26
25
|
__export(RemoveScroll_native_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
RemoveScroll: () => RemoveScroll,
|
|
27
|
+
getAllowedScrollableNode: () => getAllowedScrollableNode
|
|
29
28
|
});
|
|
30
29
|
module.exports = __toCommonJS(RemoveScroll_native_exports);
|
|
31
|
-
var RemoveScroll = function
|
|
32
|
-
|
|
30
|
+
var RemoveScroll = function(props) {
|
|
31
|
+
return props.children;
|
|
33
32
|
};
|
|
34
|
-
var getAllowedScrollableNode = function
|
|
33
|
+
var getAllowedScrollableNode = function() {};
|
|
34
|
+
|
|
35
35
|
//# sourceMappingURL=RemoveScroll.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"RemoveScroll.native.js","names":[],"sources":["cjs/RemoveScroll.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar RemoveScroll_native_exports = {};\n__export(RemoveScroll_native_exports, {\n RemoveScroll: () => RemoveScroll,\n getAllowedScrollableNode: () => getAllowedScrollableNode\n});\nmodule.exports = __toCommonJS(RemoveScroll_native_exports);\nvar RemoveScroll = function(props) {\n return props.children;\n};\nvar getAllowedScrollableNode = function() {\n};\n//# sourceMappingURL=RemoveScroll.native.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,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,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,8BAA8B,CAAC;AACnC,SAAS,6BAA6B;CACpC,oBAAoB;CACpB,gCAAgC;AAClC,CAAC;AACD,OAAO,UAAU,aAAa,2BAA2B;AACzD,IAAI,eAAe,SAAS,OAAO;CACjC,OAAO,MAAM;AACf;AACA,IAAI,2BAA2B,WAAW,CAC1C"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
17
|
var index_exports = {};
|
|
19
18
|
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./RemoveScroll.cjs"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./RemoveScroll.cjs"), module.exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(index_exports);
|
|
21
|
+
__reExport(index_exports, require("./RemoveScroll.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
15
16
|
};
|
|
16
17
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
19
|
var index_exports = {};
|
|
21
20
|
module.exports = __toCommonJS(index_exports);
|
|
22
21
|
__reExport(index_exports, require("./RemoveScroll.native.js"), module.exports);
|
|
22
|
+
|
|
23
23
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./RemoveScroll\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,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,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,0BAAgB,GAAG,OAAO,OAAO"}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var useDisableScroll_exports = {};
|
|
24
|
-
__export(useDisableScroll_exports, {
|
|
25
|
-
useDisableBodyScroll: () => useDisableBodyScroll
|
|
26
|
-
});
|
|
23
|
+
__export(useDisableScroll_exports, { useDisableBodyScroll: () => useDisableBodyScroll });
|
|
27
24
|
module.exports = __toCommonJS(useDisableScroll_exports);
|
|
28
25
|
var import_react = require("react");
|
|
29
26
|
const canUseDOM = () => typeof window !== "undefined" && !!window.document && !!window.document.createElement;
|
|
@@ -31,84 +28,84 @@ let refCount = 0;
|
|
|
31
28
|
let savedScrollY = 0;
|
|
32
29
|
let previousStyles = null;
|
|
33
30
|
function isIOSSafari() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
if (typeof navigator === "undefined") return false;
|
|
32
|
+
const ua = navigator.userAgent;
|
|
33
|
+
const isIOS = /iPad|iPhone|iPod/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
34
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(ua);
|
|
35
|
+
return isIOS && isSafari;
|
|
39
36
|
}
|
|
40
|
-
const useDisableBodyScroll = enabled => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
37
|
+
const useDisableBodyScroll = (enabled) => {
|
|
38
|
+
const wasEnabled = (0, import_react.useRef)(false);
|
|
39
|
+
(0, import_react.useEffect)(() => {
|
|
40
|
+
if (!canUseDOM()) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (enabled && !wasEnabled.current) {
|
|
44
|
+
wasEnabled.current = true;
|
|
45
|
+
if (++refCount === 1) {
|
|
46
|
+
const html = document.documentElement;
|
|
47
|
+
const body = document.body;
|
|
48
|
+
savedScrollY = window.scrollY;
|
|
49
|
+
previousStyles = {
|
|
50
|
+
htmlOverflow: html.style.overflow,
|
|
51
|
+
htmlScrollbarGutter: html.style.scrollbarGutter,
|
|
52
|
+
bodyPosition: body.style.position,
|
|
53
|
+
bodyTop: body.style.top,
|
|
54
|
+
bodyWidth: body.style.width,
|
|
55
|
+
bodyOverflow: body.style.overflow,
|
|
56
|
+
bodyOverscrollBehavior: body.style.overscrollBehavior
|
|
57
|
+
};
|
|
58
|
+
html.style.scrollbarGutter = "stable";
|
|
59
|
+
html.style.overflow = "hidden";
|
|
60
|
+
body.style.overscrollBehavior = "none";
|
|
61
|
+
if (isIOSSafari()) {
|
|
62
|
+
body.style.position = "fixed";
|
|
63
|
+
body.style.top = `-${savedScrollY}px`;
|
|
64
|
+
body.style.width = "100%";
|
|
65
|
+
body.style.overflow = "hidden";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} else if (!enabled && wasEnabled.current) {
|
|
69
|
+
wasEnabled.current = false;
|
|
70
|
+
if (--refCount === 0 && previousStyles) {
|
|
71
|
+
const html = document.documentElement;
|
|
72
|
+
const body = document.body;
|
|
73
|
+
html.style.overflow = previousStyles.htmlOverflow;
|
|
74
|
+
html.style.scrollbarGutter = previousStyles.htmlScrollbarGutter;
|
|
75
|
+
body.style.position = previousStyles.bodyPosition;
|
|
76
|
+
body.style.top = previousStyles.bodyTop;
|
|
77
|
+
body.style.width = previousStyles.bodyWidth;
|
|
78
|
+
body.style.overflow = previousStyles.bodyOverflow;
|
|
79
|
+
body.style.overscrollBehavior = previousStyles.bodyOverscrollBehavior;
|
|
80
|
+
if (savedScrollY > 0) {
|
|
81
|
+
window.scrollTo(0, savedScrollY);
|
|
82
|
+
}
|
|
83
|
+
previousStyles = null;
|
|
84
|
+
savedScrollY = 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, [enabled]);
|
|
88
|
+
(0, import_react.useEffect)(() => {
|
|
89
|
+
return () => {
|
|
90
|
+
if (wasEnabled.current) {
|
|
91
|
+
wasEnabled.current = false;
|
|
92
|
+
if (--refCount === 0 && previousStyles) {
|
|
93
|
+
const html = document.documentElement;
|
|
94
|
+
const body = document.body;
|
|
95
|
+
html.style.overflow = previousStyles.htmlOverflow;
|
|
96
|
+
html.style.scrollbarGutter = previousStyles.htmlScrollbarGutter;
|
|
97
|
+
body.style.position = previousStyles.bodyPosition;
|
|
98
|
+
body.style.top = previousStyles.bodyTop;
|
|
99
|
+
body.style.width = previousStyles.bodyWidth;
|
|
100
|
+
body.style.overflow = previousStyles.bodyOverflow;
|
|
101
|
+
body.style.overscrollBehavior = previousStyles.bodyOverscrollBehavior;
|
|
102
|
+
if (savedScrollY > 0) {
|
|
103
|
+
window.scrollTo(0, savedScrollY);
|
|
104
|
+
}
|
|
105
|
+
previousStyles = null;
|
|
106
|
+
savedScrollY = 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}, []);
|
|
111
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var useDisableScroll_exports = {};
|
|
25
|
+
__export(useDisableScroll_exports, { useDisableBodyScroll: () => useDisableBodyScroll });
|
|
26
|
+
module.exports = __toCommonJS(useDisableScroll_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var canUseDOM = function() {
|
|
29
|
+
return typeof window !== "undefined" && !!window.document && !!window.document.createElement;
|
|
30
|
+
};
|
|
31
|
+
var refCount = 0;
|
|
32
|
+
var savedScrollY = 0;
|
|
33
|
+
var previousStyles = null;
|
|
34
|
+
function isIOSSafari() {
|
|
35
|
+
if (typeof navigator === "undefined") return false;
|
|
36
|
+
var ua = navigator.userAgent;
|
|
37
|
+
var isIOS = /iPad|iPhone|iPod/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
38
|
+
var isSafari = /^((?!chrome|android).)*safari/i.test(ua);
|
|
39
|
+
return isIOS && isSafari;
|
|
40
|
+
}
|
|
41
|
+
var useDisableBodyScroll = function(enabled) {
|
|
42
|
+
var wasEnabled = (0, import_react.useRef)(false);
|
|
43
|
+
(0, import_react.useEffect)(function() {
|
|
44
|
+
if (!canUseDOM()) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (enabled && !wasEnabled.current) {
|
|
48
|
+
wasEnabled.current = true;
|
|
49
|
+
if (++refCount === 1) {
|
|
50
|
+
var html = document.documentElement;
|
|
51
|
+
var body = document.body;
|
|
52
|
+
savedScrollY = window.scrollY;
|
|
53
|
+
previousStyles = {
|
|
54
|
+
htmlOverflow: html.style.overflow,
|
|
55
|
+
htmlScrollbarGutter: html.style.scrollbarGutter,
|
|
56
|
+
bodyPosition: body.style.position,
|
|
57
|
+
bodyTop: body.style.top,
|
|
58
|
+
bodyWidth: body.style.width,
|
|
59
|
+
bodyOverflow: body.style.overflow,
|
|
60
|
+
bodyOverscrollBehavior: body.style.overscrollBehavior
|
|
61
|
+
};
|
|
62
|
+
html.style.scrollbarGutter = "stable";
|
|
63
|
+
html.style.overflow = "hidden";
|
|
64
|
+
body.style.overscrollBehavior = "none";
|
|
65
|
+
if (isIOSSafari()) {
|
|
66
|
+
body.style.position = "fixed";
|
|
67
|
+
body.style.top = `-${savedScrollY}px`;
|
|
68
|
+
body.style.width = "100%";
|
|
69
|
+
body.style.overflow = "hidden";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} else if (!enabled && wasEnabled.current) {
|
|
73
|
+
wasEnabled.current = false;
|
|
74
|
+
if (--refCount === 0 && previousStyles) {
|
|
75
|
+
var html1 = document.documentElement;
|
|
76
|
+
var body1 = document.body;
|
|
77
|
+
html1.style.overflow = previousStyles.htmlOverflow;
|
|
78
|
+
html1.style.scrollbarGutter = previousStyles.htmlScrollbarGutter;
|
|
79
|
+
body1.style.position = previousStyles.bodyPosition;
|
|
80
|
+
body1.style.top = previousStyles.bodyTop;
|
|
81
|
+
body1.style.width = previousStyles.bodyWidth;
|
|
82
|
+
body1.style.overflow = previousStyles.bodyOverflow;
|
|
83
|
+
body1.style.overscrollBehavior = previousStyles.bodyOverscrollBehavior;
|
|
84
|
+
if (savedScrollY > 0) {
|
|
85
|
+
window.scrollTo(0, savedScrollY);
|
|
86
|
+
}
|
|
87
|
+
previousStyles = null;
|
|
88
|
+
savedScrollY = 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, [enabled]);
|
|
92
|
+
(0, import_react.useEffect)(function() {
|
|
93
|
+
return function() {
|
|
94
|
+
if (wasEnabled.current) {
|
|
95
|
+
wasEnabled.current = false;
|
|
96
|
+
if (--refCount === 0 && previousStyles) {
|
|
97
|
+
var html = document.documentElement;
|
|
98
|
+
var body = document.body;
|
|
99
|
+
html.style.overflow = previousStyles.htmlOverflow;
|
|
100
|
+
html.style.scrollbarGutter = previousStyles.htmlScrollbarGutter;
|
|
101
|
+
body.style.position = previousStyles.bodyPosition;
|
|
102
|
+
body.style.top = previousStyles.bodyTop;
|
|
103
|
+
body.style.width = previousStyles.bodyWidth;
|
|
104
|
+
body.style.overflow = previousStyles.bodyOverflow;
|
|
105
|
+
body.style.overscrollBehavior = previousStyles.bodyOverscrollBehavior;
|
|
106
|
+
if (savedScrollY > 0) {
|
|
107
|
+
window.scrollTo(0, savedScrollY);
|
|
108
|
+
}
|
|
109
|
+
previousStyles = null;
|
|
110
|
+
savedScrollY = 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}, []);
|
|
115
|
+
};
|