@tamagui/use-escape-keydown 2.7.7 → 3.0.0-beta.637.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.
@@ -1,3 +1,4 @@
1
+
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -5,54 +6,41 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
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
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
30
26
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
28
  var index_exports = {};
35
- __export(index_exports, {
36
- useEscapeKeydown: () => useEscapeKeydown
37
- });
29
+ __export(index_exports, { useEscapeKeydown: () => useEscapeKeydown });
38
30
  module.exports = __toCommonJS(index_exports);
39
31
  var import_use_callback_ref = require("@tamagui/use-callback-ref");
40
32
  var import_react = __toESM(require("react"), 1);
41
33
  function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
42
- const onEscapeKeyDown = (0, import_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
43
- import_react.default.useEffect(() => {
44
- const handleKeyDown = event => {
45
- if (event.key === "Escape") {
46
- onEscapeKeyDown(event);
47
- }
48
- };
49
- ownerDocument.addEventListener("keydown",
50
- // @ts-expect-error
51
- handleKeyDown);
52
- return () => {
53
- ownerDocument.removeEventListener("keydown",
54
- // @ts-expect-error
55
- handleKeyDown);
56
- };
57
- }, [onEscapeKeyDown, ownerDocument]);
58
- }
34
+ const onEscapeKeyDown = (0, import_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
35
+ import_react.default.useEffect(() => {
36
+ const handleKeyDown = (event) => {
37
+ if (event.key === "Escape") {
38
+ onEscapeKeyDown(event);
39
+ }
40
+ };
41
+ ownerDocument.addEventListener("keydown", handleKeyDown);
42
+ return () => {
43
+ ownerDocument.removeEventListener("keydown", handleKeyDown);
44
+ };
45
+ }, [onEscapeKeyDown, ownerDocument]);
46
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var index_exports = {};
31
+ __export(index_exports, { useEscapeKeydown: () => useEscapeKeydown });
32
+ module.exports = __toCommonJS(index_exports);
33
+ var import_use_callback_ref = require("@tamagui/use-callback-ref");
34
+ var import_react = __toESM(require("react"), 1);
35
+ function useEscapeKeydown(onEscapeKeyDownProp) {
36
+ var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (function() {
37
+ var _globalThis;
38
+ return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;
39
+ })();
40
+ var onEscapeKeyDown = (0, import_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
41
+ import_react.default.useEffect(function() {
42
+ var handleKeyDown = function(event) {
43
+ if (event.key === "Escape") {
44
+ onEscapeKeyDown(event);
45
+ }
46
+ };
47
+ ownerDocument.addEventListener("keydown", handleKeyDown);
48
+ return function() {
49
+ ownerDocument.removeEventListener("keydown", handleKeyDown);
50
+ };
51
+ }, [onEscapeKeyDown, ownerDocument]);
52
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,59 +8,47 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var index_exports = {};
37
- __export(index_exports, {
38
- useEscapeKeydown: () => useEscapeKeydown
39
- });
31
+ __export(index_exports, { useEscapeKeydown: () => useEscapeKeydown });
40
32
  module.exports = __toCommonJS(index_exports);
41
33
  var import_use_callback_ref = require("@tamagui/use-callback-ref");
42
34
  var import_react = __toESM(require("react"), 1);
43
35
  function useEscapeKeydown(onEscapeKeyDownProp) {
44
- var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function () {
45
- var _globalThis;
46
- return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;
47
- }();
48
- var onEscapeKeyDown = (0, import_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
49
- import_react.default.useEffect(function () {
50
- var handleKeyDown = function (event) {
51
- if (event.key === "Escape") {
52
- onEscapeKeyDown(event);
53
- }
54
- };
55
- ownerDocument.addEventListener("keydown",
56
- // @ts-expect-error
57
- handleKeyDown);
58
- return function () {
59
- ownerDocument.removeEventListener("keydown",
60
- // @ts-expect-error
61
- handleKeyDown);
62
- };
63
- }, [onEscapeKeyDown, ownerDocument]);
36
+ var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (function() {
37
+ var _globalThis;
38
+ return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;
39
+ })();
40
+ var onEscapeKeyDown = (0, import_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
41
+ import_react.default.useEffect(function() {
42
+ var handleKeyDown = function(event) {
43
+ if (event.key === "Escape") {
44
+ onEscapeKeyDown(event);
45
+ }
46
+ };
47
+ ownerDocument.addEventListener("keydown", handleKeyDown);
48
+ return function() {
49
+ ownerDocument.removeEventListener("keydown", handleKeyDown);
50
+ };
51
+ }, [onEscapeKeyDown, ownerDocument]);
64
52
  }
53
+
65
54
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","useEscapeKeydown","module","exports","import_use_callback_ref","require","import_react","__toESM","onEscapeKeyDownProp","ownerDocument","arguments","length","_globalThis","globalThis","document","onEscapeKeyDown","useCallbackRef","default","useEffect","handleKeyDown","event","key","addEventListener","removeEventListener"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAA+BK,aAAA;AAC/B,IAAAK,uBAAkB,GAAAC,OAAA;AAKX,IAAAC,YAAS,GAAAC,OACd,CAAAF,OAAA,aACA;AAEA,SAAMJ,iBAAAO,mBAAkB;EAExB,IAAAC,aAAA,GAAAC,SAAM,CAAAC,MAAU,GAAM,KAAAD,SAAA,iBAAAA,SAAA;IACpB,IAAAE,WAAM;IACJ,OAAI,CAAAA,WAAM,GAAQC,UAAU,cAAAD,WAAA,uBAAAA,WAAA,CAAAE,QAAA;EAC1B;EAAqB,IACvBC,eAAA,OAAAX,uBAAA,CAAAY,cAAA,EAAAR,mBAAA;EAAAF,YACF,CAAAW,OAAA,CAAAC,SAAA;IAEA,IAAAC,aAAc,YAAAA,CAAAC,KAAA;MACZ,IAAAA,KAAA,CAAAC,GAAA;QAAAN,eAAA,CAAAK,KAAA;MAEA;IACF;IAEAX,aAAa,CAAAa,gBAAA,CACX;IAAc;IACZH,aAAA;IAEA,OACF;MACFV,aAAA,CAAAc,mBAAA,CACE;MACN","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.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 index_exports = {};\n__export(index_exports, {\n useEscapeKeydown: () => useEscapeKeydown\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_use_callback_ref = require(\"@tamagui/use-callback-ref\");\nvar import_react = __toESM(require(\"react\"), 1);\nfunction useEscapeKeydown(onEscapeKeyDownProp) {\n var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (function() {\n var _globalThis;\n return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;\n })();\n var onEscapeKeyDown = (0, import_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);\n import_react.default.useEffect(function() {\n var handleKeyDown = function(event) {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n return function() {\n ownerDocument.removeEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n };\n }, [\n onEscapeKeyDown,\n ownerDocument\n ]);\n}\n//# sourceMappingURL=index.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,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,wBAAwB,iBAC1B,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,0BAA0B,QAAQ,2BAA2B;AACjE,IAAI,eAAe,QAAQ,QAAQ,OAAO,GAAG,CAAC;AAC9C,SAAS,iBAAiB,qBAAqB;CAC7C,IAAI,gBAAgB,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,MAAM,WAAW;EAC/F,IAAI;EACJ,QAAQ,cAAc,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY;CAC9F,GAAG;CACH,IAAI,mBAAmB,GAAG,wBAAwB,gBAAgB,mBAAmB;CACrF,aAAa,QAAQ,UAAU,WAAW;EACxC,IAAI,gBAAgB,SAAS,OAAO;GAClC,IAAI,MAAM,QAAQ,UAAU;IAC1B,gBAAgB,KAAK;GACvB;EACF;EACA,cAAc,iBACZ,WAEA,aACF;EACA,OAAO,WAAW;GAChB,cAAc,oBACZ,WAEA,aACF;EACF;CACF,GAAG,CACD,iBACA,aACF,CAAC;AACH"}
package/dist/esm/index.js CHANGED
@@ -1,22 +1,20 @@
1
1
  import { useCallbackRef } from "@tamagui/use-callback-ref";
2
2
  import React from "react";
3
+
3
4
  function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
4
- const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
5
- React.useEffect(() => {
6
- const handleKeyDown = event => {
7
- if (event.key === "Escape") {
8
- onEscapeKeyDown(event);
9
- }
10
- };
11
- ownerDocument.addEventListener("keydown",
12
- // @ts-expect-error
13
- handleKeyDown);
14
- return () => {
15
- ownerDocument.removeEventListener("keydown",
16
- // @ts-expect-error
17
- handleKeyDown);
18
- };
19
- }, [onEscapeKeyDown, ownerDocument]);
5
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
6
+ React.useEffect(() => {
7
+ const handleKeyDown = (event) => {
8
+ if (event.key === "Escape") {
9
+ onEscapeKeyDown(event);
10
+ }
11
+ };
12
+ ownerDocument.addEventListener("keydown", handleKeyDown);
13
+ return () => {
14
+ ownerDocument.removeEventListener("keydown", handleKeyDown);
15
+ };
16
+ }, [onEscapeKeyDown, ownerDocument]);
20
17
  }
18
+
21
19
  export { useEscapeKeydown };
22
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallbackRef","React","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","removeEventListener"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,cAAA,QAAsB;AAC/B,OAAOC,KAAA,MAAW;AAKX,SAASC,iBACdC,mBAAA,EACAC,aAAA,GAA0BC,UAAA,EAAYC,QAAA,EAChC;EACN,MAAMC,eAAA,GAAkBP,cAAA,CAAeG,mBAAmB;EAE1DF,KAAA,CAAMO,SAAA,CAAU,MAAM;IACpB,MAAMC,aAAA,GAAiBC,KAAA,IAA+B;MACpD,IAAIA,KAAA,CAAMC,GAAA,KAAQ,UAAU;QAC1BJ,eAAA,CAAgBG,KAAK;MACvB;IACF;IAEAN,aAAA,CAAcQ,gBAAA,CACZ;IAAA;IAEAH,aACF;IAEA,OAAO,MAAM;MACXL,aAAA,CAAcS,mBAAA,CACZ;MAAA;MAEAJ,aACF;IACF;EACF,GAAG,CAACF,eAAA,EAAiBH,aAAa,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { useCallbackRef } from \"@tamagui/use-callback-ref\";\nimport React from \"react\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n return () => {\n ownerDocument.removeEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n };\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAEA,SAAS,iBAAiB,qBAAqB,gBAAgB,YAAY,UAAU;CACnF,MAAM,kBAAkB,eAAe,mBAAmB;CAC1D,MAAM,gBAAgB;EACpB,MAAM,iBAAiB,UAAU;GAC/B,IAAI,MAAM,QAAQ,UAAU;IAC1B,gBAAgB,KAAK;GACvB;EACF;EACA,cAAc,iBACZ,WAEA,aACF;EACA,aAAa;GACX,cAAc,oBACZ,WAEA,aACF;EACF;CACF,GAAG,CAAC,iBAAiB,aAAa,CAAC;AACrC"}
@@ -1,22 +1,20 @@
1
1
  import { useCallbackRef } from "@tamagui/use-callback-ref";
2
2
  import React from "react";
3
+
3
4
  function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
4
- const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
5
- React.useEffect(() => {
6
- const handleKeyDown = event => {
7
- if (event.key === "Escape") {
8
- onEscapeKeyDown(event);
9
- }
10
- };
11
- ownerDocument.addEventListener("keydown",
12
- // @ts-expect-error
13
- handleKeyDown);
14
- return () => {
15
- ownerDocument.removeEventListener("keydown",
16
- // @ts-expect-error
17
- handleKeyDown);
18
- };
19
- }, [onEscapeKeyDown, ownerDocument]);
5
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
6
+ React.useEffect(() => {
7
+ const handleKeyDown = (event) => {
8
+ if (event.key === "Escape") {
9
+ onEscapeKeyDown(event);
10
+ }
11
+ };
12
+ ownerDocument.addEventListener("keydown", handleKeyDown);
13
+ return () => {
14
+ ownerDocument.removeEventListener("keydown", handleKeyDown);
15
+ };
16
+ }, [onEscapeKeyDown, ownerDocument]);
20
17
  }
18
+
21
19
  export { useEscapeKeydown };
22
20
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallbackRef","React","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","removeEventListener"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,cAAA,QAAsB;AAC/B,OAAOC,KAAA,MAAW;AAKX,SAASC,iBACdC,mBAAA,EACAC,aAAA,GAA0BC,UAAA,EAAYC,QAAA,EAChC;EACN,MAAMC,eAAA,GAAkBP,cAAA,CAAeG,mBAAmB;EAE1DF,KAAA,CAAMO,SAAA,CAAU,MAAM;IACpB,MAAMC,aAAA,GAAiBC,KAAA,IAA+B;MACpD,IAAIA,KAAA,CAAMC,GAAA,KAAQ,UAAU;QAC1BJ,eAAA,CAAgBG,KAAK;MACvB;IACF;IAEAN,aAAA,CAAcQ,gBAAA,CACZ;IAAA;IAEAH,aACF;IAEA,OAAO,MAAM;MACXL,aAAA,CAAcS,mBAAA,CACZ;MAAA;MAEAJ,aACF;IACF;EACF,GAAG,CAACF,eAAA,EAAiBH,aAAa,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { useCallbackRef } from \"@tamagui/use-callback-ref\";\nimport React from \"react\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n return () => {\n ownerDocument.removeEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n };\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAEA,SAAS,iBAAiB,qBAAqB,gBAAgB,YAAY,UAAU;CACnF,MAAM,kBAAkB,eAAe,mBAAmB;CAC1D,MAAM,gBAAgB;EACpB,MAAM,iBAAiB,UAAU;GAC/B,IAAI,MAAM,QAAQ,UAAU;IAC1B,gBAAgB,KAAK;GACvB;EACF;EACA,cAAc,iBACZ,WAEA,aACF;EACA,aAAa;GACX,cAAc,oBACZ,WAEA,aACF;EACF;CACF,GAAG,CAAC,iBAAiB,aAAa,CAAC;AACrC"}
@@ -1,26 +1,24 @@
1
1
  import { useCallbackRef } from "@tamagui/use-callback-ref";
2
2
  import React from "react";
3
+
3
4
  function useEscapeKeydown(onEscapeKeyDownProp) {
4
- var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function () {
5
- var _globalThis;
6
- return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;
7
- }();
8
- var onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
9
- React.useEffect(function () {
10
- var handleKeyDown = function (event) {
11
- if (event.key === "Escape") {
12
- onEscapeKeyDown(event);
13
- }
14
- };
15
- ownerDocument.addEventListener("keydown",
16
- // @ts-expect-error
17
- handleKeyDown);
18
- return function () {
19
- ownerDocument.removeEventListener("keydown",
20
- // @ts-expect-error
21
- handleKeyDown);
22
- };
23
- }, [onEscapeKeyDown, ownerDocument]);
5
+ var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (function() {
6
+ var _globalThis;
7
+ return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;
8
+ })();
9
+ var onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
10
+ React.useEffect(function() {
11
+ var handleKeyDown = function(event) {
12
+ if (event.key === "Escape") {
13
+ onEscapeKeyDown(event);
14
+ }
15
+ };
16
+ ownerDocument.addEventListener("keydown", handleKeyDown);
17
+ return function() {
18
+ ownerDocument.removeEventListener("keydown", handleKeyDown);
19
+ };
20
+ }, [onEscapeKeyDown, ownerDocument]);
24
21
  }
22
+
25
23
  export { useEscapeKeydown };
26
24
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallbackRef","React","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","arguments","length","_globalThis","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","removeEventListener"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,cAAA,QAAsB;AAC/B,OAAOC,KAAA,MAAW;AAKX,SAASC,iBACdC,mBAAA,EACA;EAEA,IAAAC,aAAM,GAAAC,SAAkB,CAAAC,MAAA,GAAe,KAAAD,SAAA,QAAmB,SAAAA,SAAA;IAE1D,IAAME,WAAU;IACd,OAAM,CAAAA,WAAA,GAAgBC,UAAC,MAA+B,QAAAD,WAAA,uBAAAA,WAAA,CAAAE,QAAA;EACpD;EACE,IAAAC,eAAA,GAAgBV,cAAK,CAAAG,mBAAA;EAAAF,KACvB,CAAAU,SAAA;IACF,IAAAC,aAAA,YAAAA,CAAAC,KAAA;MAEA,IAAAA,KAAA,CAAAC,GAAc;QACZJ,eAAA,CAAAG,KAAA;MAAA;IAAA;IAGFT,aAAA,CAAAW,gBAAA,CAEA,SAAO;IACL;IAAcH,aACZ;IAAA,OAEA;MACFR,aAAA,CAAAY,mBAAA,CACF;MACE;MACNJ,a","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["esm/index.native.js"],"sourcesContent":["import { useCallbackRef } from \"@tamagui/use-callback-ref\";\nimport React from \"react\";\nfunction useEscapeKeydown(onEscapeKeyDownProp) {\n var ownerDocument = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (function() {\n var _globalThis;\n return (_globalThis = globalThis) === null || _globalThis === void 0 ? void 0 : _globalThis.document;\n })();\n var onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(function() {\n var handleKeyDown = function(event) {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n return function() {\n ownerDocument.removeEventListener(\n \"keydown\",\n // @ts-expect-error\n handleKeyDown\n );\n };\n }, [\n onEscapeKeyDown,\n ownerDocument\n ]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAEA,SAAS,iBAAiB,qBAAqB;CAC7C,IAAI,gBAAgB,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,MAAM,WAAW;EAC/F,IAAI;EACJ,QAAQ,cAAc,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY;CAC9F,GAAG;CACH,IAAI,kBAAkB,eAAe,mBAAmB;CACxD,MAAM,UAAU,WAAW;EACzB,IAAI,gBAAgB,SAAS,OAAO;GAClC,IAAI,MAAM,QAAQ,UAAU;IAC1B,gBAAgB,KAAK;GACvB;EACF;EACA,cAAc,iBACZ,WAEA,aACF;EACA,OAAO,WAAW;GAChB,cAAc,oBACZ,WAEA,aACF;EACF;CACF,GAAG,CACD,iBACA,aACF,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-escape-keydown",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.637.1",
4
4
  "files": [
5
5
  "src",
6
6
  "types",
@@ -33,10 +33,10 @@
33
33
  "clean:build": "tamagui-build clean:build"
34
34
  },
35
35
  "dependencies": {
36
- "@tamagui/use-callback-ref": "2.7.7"
36
+ "@tamagui/use-callback-ref": "3.0.0-beta.637.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@tamagui/build": "2.7.7",
39
+ "@tamagui/build": "3.0.0-beta.637.1",
40
40
  "react": ">=19"
41
41
  },
42
42
  "peerDependencies": {