@radix-ui/react-use-escape-keydown 1.1.6 → 1.1.7-rc.1791897977948
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 +1 -1
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
42
42
|
const onEscapeKeyDown = (0, import_react_use_callback_ref.useCallbackRef)(onEscapeKeyDownProp);
|
|
43
43
|
React.useEffect(() => {
|
|
44
44
|
const handleKeyDown = /* @__PURE__ */ __name((event) => {
|
|
45
|
-
if (event.key === "Escape") {
|
|
45
|
+
if (event.key === "Escape" && !event.isComposing && event.keyCode !== 229) {
|
|
46
46
|
onEscapeKeyDown(event);
|
|
47
47
|
}
|
|
48
48
|
}, "handleKeyDown");
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/use-escape-keydown.tsx"],
|
|
4
|
-
"sourcesContent": ["export { useEscapeKeydown } from './use-escape-keydown';\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 *\n * @deprecated Attach listeners directly via useEffect for more granular control\n * over how callbacks are stabilized, when to detach listeners, etc.\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;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,oCAA+B;AAQ/B,SAAS,iBACP,qBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,sBAAkB,8CAAe,mBAAmB;AAE1D,EAAM,gBAAU,MAAM;AACpB,UAAM,gBAAgB,wBAAC,UAAyB;
|
|
4
|
+
"sourcesContent": ["export { useEscapeKeydown } from './use-escape-keydown';\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 *\n * @deprecated Attach listeners directly via useEffect for more granular control\n * over how callbacks are stabilized, when to detach listeners, etc.\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 // An Escape during an IME composition belongs to the input method (see DismissableLayer).\n if (event.key === 'Escape' && !event.isComposing && event.keyCode !== 229) {\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;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,oCAA+B;AAQ/B,SAAS,iBACP,qBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,sBAAkB,8CAAe,mBAAmB;AAE1D,EAAM,gBAAU,MAAM;AACpB,UAAM,gBAAgB,wBAAC,UAAyB;AAE9C,UAAI,MAAM,QAAQ,YAAY,CAAC,MAAM,eAAe,MAAM,YAAY,KAAK;AACzE,wBAAgB,KAAK;AAAA,MACvB;AAAA,IACF,GALsB;AAMtB,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;AAhBS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
8
8
|
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
9
9
|
React.useEffect(() => {
|
|
10
10
|
const handleKeyDown = /* @__PURE__ */ __name((event) => {
|
|
11
|
-
if (event.key === "Escape") {
|
|
11
|
+
if (event.key === "Escape" && !event.isComposing && event.keyCode !== 229) {
|
|
12
12
|
onEscapeKeyDown(event);
|
|
13
13
|
}
|
|
14
14
|
}, "handleKeyDown");
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/use-escape-keydown.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 *\n * @deprecated Attach listeners directly via useEffect for more granular control\n * over how callbacks are stabilized, when to detach listeners, etc.\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;AAQ/B,SAAS,iBACP,qBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,kBAAkB,eAAe,mBAAmB;AAE1D,EAAM,gBAAU,MAAM;AACpB,UAAM,gBAAgB,wBAAC,UAAyB;
|
|
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 *\n * @deprecated Attach listeners directly via useEffect for more granular control\n * over how callbacks are stabilized, when to detach listeners, etc.\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 // An Escape during an IME composition belongs to the input method (see DismissableLayer).\n if (event.key === 'Escape' && !event.isComposing && event.keyCode !== 229) {\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;AAQ/B,SAAS,iBACP,qBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,kBAAkB,eAAe,mBAAmB;AAE1D,EAAM,gBAAU,MAAM;AACpB,UAAM,gBAAgB,wBAAC,UAAyB;AAE9C,UAAI,MAAM,QAAQ,YAAY,CAAC,MAAM,eAAe,MAAM,YAAY,KAAK;AACzE,wBAAgB,KAAK;AAAA,MACvB;AAAA,IACF,GALsB;AAMtB,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;AAhBS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|