@radix-ui/react-use-escape-keydown 1.0.4-rc.6 → 1.1.0-rc.2

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/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Listens for when the escape key is down
3
3
  */
4
- export function useEscapeKeydown(onEscapeKeyDownProp?: (event: KeyboardEvent) => void, ownerDocument?: Document): void;
4
+ declare function useEscapeKeydown(onEscapeKeyDownProp?: (event: KeyboardEvent) => void, ownerDocument?: Document): void;
5
5
 
6
- //# sourceMappingURL=index.d.ts.map
6
+ export { useEscapeKeydown };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Listens for when the escape key is down
3
3
  */
4
- export function useEscapeKeydown(onEscapeKeyDownProp?: (event: KeyboardEvent) => void, ownerDocument?: Document): void;
4
+ declare function useEscapeKeydown(onEscapeKeyDownProp?: (event: KeyboardEvent) => void, ownerDocument?: Document): void;
5
5
 
6
- //# sourceMappingURL=index.d.ts.map
6
+ export { useEscapeKeydown };
package/dist/index.js CHANGED
@@ -1,35 +1,48 @@
1
- var $b0gz3$react = require("react");
2
- var $b0gz3$radixuireactusecallbackref = require("@radix-ui/react-use-callback-ref");
3
-
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
7
-
8
- $parcel$export(module.exports, "useEscapeKeydown", () => $24c84e9f83c4454f$export$3a72a57244d6e765);
9
-
10
-
11
- /**
12
- * Listens for when the escape key is down
13
- */ function $24c84e9f83c4454f$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
14
- const onEscapeKeyDown = $b0gz3$radixuireactusecallbackref.useCallbackRef(onEscapeKeyDownProp);
15
- $b0gz3$react.useEffect(()=>{
16
- const handleKeyDown = (event)=>{
17
- if (event.key === 'Escape') onEscapeKeyDown(event);
18
- };
19
- ownerDocument.addEventListener('keydown', handleKeyDown, {
20
- capture: true
21
- });
22
- return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown, {
23
- capture: true
24
- })
25
- ;
26
- }, [
27
- onEscapeKeyDown,
28
- ownerDocument
29
- ]);
30
- }
31
-
32
-
33
-
34
-
1
+ "use strict";
2
+ (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
+ }) : x)(function(x) {
12
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
+ throw Error('Dynamic require of "' + x + '" is not supported');
14
+ });
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+
32
+ // packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
33
+ var React = __toESM(__require("react"));
34
+ var import_react_use_callback_ref = __require("@radix-ui/react-use-callback-ref");
35
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
36
+ const onEscapeKeyDown = (0, import_react_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
37
+ React.useEffect(() => {
38
+ const handleKeyDown = (event) => {
39
+ if (event.key === "Escape") {
40
+ onEscapeKeyDown(event);
41
+ }
42
+ };
43
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
44
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
45
+ }, [onEscapeKeyDown, ownerDocument]);
46
+ }
47
+ })();
35
48
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"mappings":";;;;;;;;ACAA;;AAGA;;GAEA,CACA,SAASA,yCAAT,CACEG,mBADF,EAEEC,aAAuB,GAAGC,UAAH,KAAA,IAAA,IAAGA,UAAH,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAGA,UAAU,CAAEC,QAFxC,EAGE;IACA,MAAMC,eAAe,GAAGL,gDAAc,CAACC,mBAAD,CAAtC,AAAA;IAEAF,sBAAA,CAAgB,IAAM;QACpB,MAAMQ,aAAa,GAAIC,CAAAA,KAAD,GAA0B;YAC9C,IAAIA,KAAK,CAACC,GAAN,KAAc,QAAlB,EACEJ,eAAe,CAACG,KAAD,CAAf,CAAAH;SAFJ,AAIC;QACDH,aAAa,CAACQ,gBAAd,CAA+B,SAA/B,EAA0CH,aAA1C,EAAyD;YAAEI,OAAO,EAAE,IAATA;SAA3D,CAAyD,CAAA;QACzD,OAAO,IAAMT,aAAa,CAACU,mBAAd,CAAkC,SAAlC,EAA6CL,aAA7C,EAA4D;gBAAEI,OAAO,EAAE,IAATA;aAA9D,CAAb;QAAA,CAAyE;KAP3E,EAQG;QAACN,eAAD;QAAkBH,aAAlB;KARH,CAQC,CAAA;CACF;;ADrBD","sources":["packages/react/use-escape-keydown/src/index.ts","packages/react/use-escape-keydown/src/useEscapeKeydown.tsx"],"sourcesContent":["export { useEscapeKeydown } from './useEscapeKeydown';\n","import * as React from 'react';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\n/**\n * Listens for when the escape key is down\n */\nfunction useEscapeKeydown(\n onEscapeKeyDownProp?: (event: KeyboardEvent) => void,\n ownerDocument: Document = globalThis?.document\n) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\n\nexport { useEscapeKeydown };\n"],"names":["useEscapeKeydown","React","useCallbackRef","onEscapeKeyDownProp","ownerDocument","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","capture","removeEventListener"],"version":3,"file":"index.js.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/useEscapeKeydown.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\n/**\n * Listens for when the escape key is down\n */\nfunction useEscapeKeydown(\n onEscapeKeyDownProp?: (event: KeyboardEvent) => void,\n ownerDocument: Document = globalThis?.document\n) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\n\nexport { useEscapeKeydown };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,sCAA+B;AAK/B,WAAS,iBACP,qBACA,gBAA0B,YAAY,UACtC;AACA,UAAM,sBAAkB,8CAAe,mBAAmB;AAE1D,IAAM,gBAAU,MAAM;AACpB,YAAM,gBAAgB,CAAC,UAAyB;AAC9C,YAAI,MAAM,QAAQ,UAAU;AAC1B,0BAAgB,KAAK;AAAA,QACvB;AAAA,MACF;AACA,oBAAc,iBAAiB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AAC1E,aAAO,MAAM,cAAc,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AAAA,IAC5F,GAAG,CAAC,iBAAiB,aAAa,CAAC;AAAA,EACrC;",
6
+ "names": []
7
+ }
package/dist/index.mjs CHANGED
@@ -1,31 +1,19 @@
1
- import {useEffect as $hPSQ5$useEffect} from "react";
2
- import {useCallbackRef as $hPSQ5$useCallbackRef} from "@radix-ui/react-use-callback-ref";
3
-
4
-
5
-
6
- /**
7
- * Listens for when the escape key is down
8
- */ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
9
- const onEscapeKeyDown = $hPSQ5$useCallbackRef(onEscapeKeyDownProp);
10
- $hPSQ5$useEffect(()=>{
11
- const handleKeyDown = (event)=>{
12
- if (event.key === 'Escape') onEscapeKeyDown(event);
13
- };
14
- ownerDocument.addEventListener('keydown', handleKeyDown, {
15
- capture: true
16
- });
17
- return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown, {
18
- capture: true
19
- })
20
- ;
21
- }, [
22
- onEscapeKeyDown,
23
- ownerDocument
24
- ]);
1
+ // packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
2
+ import * as React from "react";
3
+ import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
4
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
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, { capture: true });
13
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
14
+ }, [onEscapeKeyDown, ownerDocument]);
25
15
  }
26
-
27
-
28
-
29
-
30
- export {$addc16e1bbe58fd0$export$3a72a57244d6e765 as useEscapeKeydown};
16
+ export {
17
+ useEscapeKeydown
18
+ };
31
19
  //# sourceMappingURL=index.mjs.map
@@ -1 +1,7 @@
1
- {"mappings":";;;ACAA;;AAGA;;GAEA,CACA,SAASA,yCAAT,CACEG,mBADF,EAEEC,aAAuB,GAAGC,UAAH,KAAA,IAAA,IAAGA,UAAH,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAGA,UAAU,CAAEC,QAFxC,EAGE;IACA,MAAMC,eAAe,GAAGL,qBAAc,CAACC,mBAAD,CAAtC,AAAA;IAEAF,gBAAA,CAAgB,IAAM;QACpB,MAAMQ,aAAa,GAAIC,CAAAA,KAAD,GAA0B;YAC9C,IAAIA,KAAK,CAACC,GAAN,KAAc,QAAlB,EACEJ,eAAe,CAACG,KAAD,CAAf,CAAAH;SAFJ,AAIC;QACDH,aAAa,CAACQ,gBAAd,CAA+B,SAA/B,EAA0CH,aAA1C,EAAyD;YAAEI,OAAO,EAAE,IAATA;SAA3D,CAAyD,CAAA;QACzD,OAAO,IAAMT,aAAa,CAACU,mBAAd,CAAkC,SAAlC,EAA6CL,aAA7C,EAA4D;gBAAEI,OAAO,EAAE,IAATA;aAA9D,CAAb;QAAA,CAAyE;KAP3E,EAQG;QAACN,eAAD;QAAkBH,aAAlB;KARH,CAQC,CAAA;CACF;;ADrBD","sources":["packages/react/use-escape-keydown/src/index.ts","packages/react/use-escape-keydown/src/useEscapeKeydown.tsx"],"sourcesContent":["export { useEscapeKeydown } from './useEscapeKeydown';\n","import * as React from 'react';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\n/**\n * Listens for when the escape key is down\n */\nfunction useEscapeKeydown(\n onEscapeKeyDownProp?: (event: KeyboardEvent) => void,\n ownerDocument: Document = globalThis?.document\n) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\n\nexport { useEscapeKeydown };\n"],"names":["useEscapeKeydown","React","useCallbackRef","onEscapeKeyDownProp","ownerDocument","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","capture","removeEventListener"],"version":3,"file":"index.mjs.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/useEscapeKeydown.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\n/**\n * Listens for when the escape key is down\n */\nfunction useEscapeKeydown(\n onEscapeKeyDownProp?: (event: KeyboardEvent) => void,\n ownerDocument: Document = globalThis?.document\n) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener('keydown', handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\n\nexport { useEscapeKeydown };\n"],
5
+ "mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,sBAAsB;AAK/B,SAAS,iBACP,qBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,kBAAkB,eAAe,mBAAmB;AAE1D,EAAM,gBAAU,MAAM;AACpB,UAAM,gBAAgB,CAAC,UAAyB;AAC9C,UAAI,MAAM,QAAQ,UAAU;AAC1B,wBAAgB,KAAK;AAAA,MACvB;AAAA,IACF;AACA,kBAAc,iBAAiB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AAC1E,WAAO,MAAM,cAAc,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AAAA,EAC5F,GAAG,CAAC,iBAAiB,aAAa,CAAC;AACrC;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-use-escape-keydown",
3
- "version": "1.0.4-rc.6",
3
+ "version": "1.1.0-rc.2",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -28,8 +28,7 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@babel/runtime": "^7.13.10",
32
- "@radix-ui/react-use-callback-ref": "1.0.1"
31
+ "@radix-ui/react-use-callback-ref": "1.1.0-rc.2"
33
32
  },
34
33
  "peerDependencies": {
35
34
  "@types/react": "*",
@@ -1 +0,0 @@
1
- {"mappings":"AAGA;;GAEG;AACH,iCACE,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EACpD,aAAa,GAAE,QAA+B,QAa/C","sources":["packages/react/use-escape-keydown/src/packages/react/use-escape-keydown/src/useEscapeKeydown.tsx","packages/react/use-escape-keydown/src/packages/react/use-escape-keydown/src/index.ts","packages/react/use-escape-keydown/src/index.ts"],"sourcesContent":[null,null,"export { useEscapeKeydown } from './useEscapeKeydown';\n"],"names":[],"version":3,"file":"index.d.ts.map"}