@radix-ui/react-use-escape-keydown 1.0.3-rc.6 → 1.0.4-rc.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/index.js CHANGED
@@ -16,8 +16,12 @@ $parcel$export(module.exports, "useEscapeKeydown", () => $24c84e9f83c4454f$expor
16
16
  const handleKeyDown = (event)=>{
17
17
  if (event.key === 'Escape') onEscapeKeyDown(event);
18
18
  };
19
- ownerDocument.addEventListener('keydown', handleKeyDown);
20
- return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)
19
+ ownerDocument.addEventListener('keydown', handleKeyDown, {
20
+ capture: true
21
+ });
22
+ return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown, {
23
+ capture: true
24
+ })
21
25
  ;
22
26
  }, [
23
27
  onEscapeKeyDown,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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,CAAAL,CAAAA;QACA,OAAO,IAAMA,aAAa,CAACS,mBAAd,CAAkC,SAAlC,EAA6CJ,aAA7C,CAAb;QAAA,CAAA;KAPF,EAQG;QAACF,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);\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown);\n }, [onEscapeKeyDown, ownerDocument]);\n}\n\nexport { useEscapeKeydown };\n"],"names":["useEscapeKeydown","React","useCallbackRef","onEscapeKeyDownProp","ownerDocument","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","removeEventListener"],"version":3,"file":"index.js.map"}
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"}
package/dist/index.mjs CHANGED
@@ -11,8 +11,12 @@ import {useCallbackRef as $hPSQ5$useCallbackRef} from "@radix-ui/react-use-callb
11
11
  const handleKeyDown = (event)=>{
12
12
  if (event.key === 'Escape') onEscapeKeyDown(event);
13
13
  };
14
- ownerDocument.addEventListener('keydown', handleKeyDown);
15
- return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)
14
+ ownerDocument.addEventListener('keydown', handleKeyDown, {
15
+ capture: true
16
+ });
17
+ return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown, {
18
+ capture: true
19
+ })
16
20
  ;
17
21
  }, [
18
22
  onEscapeKeyDown,
@@ -1 +1 @@
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,CAAAL,CAAAA;QACA,OAAO,IAAMA,aAAa,CAACS,mBAAd,CAAkC,SAAlC,EAA6CJ,aAA7C,CAAb;QAAA,CAAA;KAPF,EAQG;QAACF,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);\n return () => ownerDocument.removeEventListener('keydown', handleKeyDown);\n }, [onEscapeKeyDown, ownerDocument]);\n}\n\nexport { useEscapeKeydown };\n"],"names":["useEscapeKeydown","React","useCallbackRef","onEscapeKeyDownProp","ownerDocument","globalThis","document","onEscapeKeyDown","useEffect","handleKeyDown","event","key","addEventListener","removeEventListener"],"version":3,"file":"index.mjs.map"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-use-escape-keydown",
3
- "version": "1.0.3-rc.6",
3
+ "version": "1.0.4-rc.1",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.13.10",
32
- "@radix-ui/react-use-callback-ref": "1.0.1-rc.6"
32
+ "@radix-ui/react-use-callback-ref": "1.0.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@types/react": "*",
@@ -48,5 +48,5 @@
48
48
  "bugs": {
49
49
  "url": "https://github.com/radix-ui/primitives/issues"
50
50
  },
51
- "stableVersion": "1.0.2"
51
+ "stableVersion": "1.0.3"
52
52
  }