@wordpress/compose 7.39.1-next.v.202602111440.0 → 7.40.0

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -9
  3. package/build/hooks/use-constrained-tabbing/index.cjs.map +1 -1
  4. package/build/hooks/use-copy-on-click/index.cjs +1 -1
  5. package/build/hooks/use-copy-on-click/index.cjs.map +2 -2
  6. package/build/hooks/use-copy-to-clipboard/index.cjs.map +1 -1
  7. package/build/hooks/use-dialog/index.cjs +1 -1
  8. package/build/hooks/use-dialog/index.cjs.map +2 -2
  9. package/build/hooks/use-disabled/index.cjs.map +1 -1
  10. package/build/hooks/use-dragging/index.cjs.map +1 -1
  11. package/build/hooks/use-drop-zone/index.cjs.map +1 -1
  12. package/build/hooks/use-fixed-window-list/index.cjs.map +1 -1
  13. package/build/hooks/use-focus-on-mount/index.cjs +1 -1
  14. package/build/hooks/use-focus-on-mount/index.cjs.map +2 -2
  15. package/build/hooks/use-focus-outside/index.cjs +1 -1
  16. package/build/hooks/use-focus-outside/index.cjs.map +2 -2
  17. package/build/hooks/use-focus-return/index.cjs.map +1 -1
  18. package/build/hooks/use-keyboard-shortcut/index.cjs.map +1 -1
  19. package/build/hooks/use-merge-refs/index.cjs +2 -2
  20. package/build/hooks/use-merge-refs/index.cjs.map +3 -3
  21. package/build/hooks/use-previous/index.cjs +1 -1
  22. package/build/hooks/use-previous/index.cjs.map +2 -2
  23. package/build/hooks/use-ref-effect/index.cjs +1 -1
  24. package/build/hooks/use-ref-effect/index.cjs.map +2 -2
  25. package/build/hooks/use-resize-observer/use-resize-observer.cjs +3 -3
  26. package/build/hooks/use-resize-observer/use-resize-observer.cjs.map +2 -2
  27. package/build-module/hooks/use-constrained-tabbing/index.mjs.map +1 -1
  28. package/build-module/hooks/use-copy-on-click/index.mjs +1 -1
  29. package/build-module/hooks/use-copy-on-click/index.mjs.map +2 -2
  30. package/build-module/hooks/use-copy-to-clipboard/index.mjs.map +1 -1
  31. package/build-module/hooks/use-dialog/index.mjs +1 -1
  32. package/build-module/hooks/use-dialog/index.mjs.map +2 -2
  33. package/build-module/hooks/use-disabled/index.mjs.map +1 -1
  34. package/build-module/hooks/use-dragging/index.mjs.map +1 -1
  35. package/build-module/hooks/use-drop-zone/index.mjs.map +1 -1
  36. package/build-module/hooks/use-fixed-window-list/index.mjs.map +1 -1
  37. package/build-module/hooks/use-focus-on-mount/index.mjs +1 -1
  38. package/build-module/hooks/use-focus-on-mount/index.mjs.map +2 -2
  39. package/build-module/hooks/use-focus-outside/index.mjs +1 -1
  40. package/build-module/hooks/use-focus-outside/index.mjs.map +2 -2
  41. package/build-module/hooks/use-focus-return/index.mjs.map +1 -1
  42. package/build-module/hooks/use-keyboard-shortcut/index.mjs.map +1 -1
  43. package/build-module/hooks/use-merge-refs/index.mjs +2 -2
  44. package/build-module/hooks/use-merge-refs/index.mjs.map +3 -3
  45. package/build-module/hooks/use-previous/index.mjs +1 -1
  46. package/build-module/hooks/use-previous/index.mjs.map +2 -2
  47. package/build-module/hooks/use-ref-effect/index.mjs +1 -1
  48. package/build-module/hooks/use-ref-effect/index.mjs.map +2 -2
  49. package/build-module/hooks/use-resize-observer/use-resize-observer.mjs +3 -3
  50. package/build-module/hooks/use-resize-observer/use-resize-observer.mjs.map +2 -2
  51. package/build-types/hooks/use-constrained-tabbing/index.d.ts +2 -2
  52. package/build-types/hooks/use-constrained-tabbing/index.d.ts.map +1 -1
  53. package/build-types/hooks/use-copy-on-click/index.d.ts +5 -5
  54. package/build-types/hooks/use-copy-on-click/index.d.ts.map +1 -1
  55. package/build-types/hooks/use-copy-to-clipboard/index.d.ts +2 -2
  56. package/build-types/hooks/use-copy-to-clipboard/index.d.ts.map +1 -1
  57. package/build-types/hooks/use-disabled/index.d.ts +1 -1
  58. package/build-types/hooks/use-dragging/index.d.ts +6 -6
  59. package/build-types/hooks/use-dragging/index.d.ts.map +1 -1
  60. package/build-types/hooks/use-drop-zone/index.d.ts +2 -2
  61. package/build-types/hooks/use-drop-zone/index.d.ts.map +1 -1
  62. package/build-types/hooks/use-fixed-window-list/index.d.ts +5 -5
  63. package/build-types/hooks/use-fixed-window-list/index.d.ts.map +1 -1
  64. package/build-types/hooks/use-focus-on-mount/index.d.ts +2 -2
  65. package/build-types/hooks/use-focus-on-mount/index.d.ts.map +1 -1
  66. package/build-types/hooks/use-focus-return/index.d.ts +2 -2
  67. package/build-types/hooks/use-focus-return/index.d.ts.map +1 -1
  68. package/build-types/hooks/use-keyboard-shortcut/index.d.ts +10 -9
  69. package/build-types/hooks/use-keyboard-shortcut/index.d.ts.map +1 -1
  70. package/build-types/hooks/use-merge-refs/index.d.ts +4 -6
  71. package/build-types/hooks/use-merge-refs/index.d.ts.map +1 -1
  72. package/package.json +9 -9
  73. package/src/hooks/use-constrained-tabbing/index.js +1 -1
  74. package/src/hooks/use-copy-on-click/index.js +6 -6
  75. package/src/hooks/use-copy-to-clipboard/index.js +2 -2
  76. package/src/hooks/use-dialog/index.ts +1 -1
  77. package/src/hooks/use-disabled/index.ts +1 -1
  78. package/src/hooks/use-dragging/index.js +5 -5
  79. package/src/hooks/use-drop-zone/index.js +1 -1
  80. package/src/hooks/use-fixed-window-list/index.js +4 -4
  81. package/src/hooks/use-focus-on-mount/index.js +3 -3
  82. package/src/hooks/use-focus-outside/index.native.js +3 -3
  83. package/src/hooks/use-focus-outside/index.ts +1 -1
  84. package/src/hooks/use-focus-return/index.js +3 -3
  85. package/src/hooks/use-keyboard-shortcut/index.js +7 -7
  86. package/src/hooks/use-merge-refs/{index.js → index.ts} +11 -22
  87. package/src/hooks/use-previous/index.ts +1 -1
  88. package/src/hooks/use-ref-effect/index.ts +1 -1
  89. package/src/hooks/use-resize-observer/use-resize-observer.ts +3 -3
@@ -3,8 +3,8 @@ import { useRef } from "@wordpress/element";
3
3
  import useEvent from "../use-event/index.mjs";
4
4
  function useResizeObserver(callback, resizeObserverOptions = {}) {
5
5
  const callbackEvent = useEvent(callback);
6
- const observedElementRef = useRef();
7
- const resizeObserverRef = useRef();
6
+ const observedElementRef = useRef(null);
7
+ const resizeObserverRef = useRef(void 0);
8
8
  return useEvent((element) => {
9
9
  if (element === observedElementRef.current) {
10
10
  return;
@@ -14,7 +14,7 @@ function useResizeObserver(callback, resizeObserverOptions = {}) {
14
14
  if (observedElementRef.current) {
15
15
  resizeObserver.unobserve(observedElementRef.current);
16
16
  }
17
- observedElementRef.current = element;
17
+ observedElementRef.current = element ?? null;
18
18
  if (element) {
19
19
  resizeObserver.observe(element, resizeObserverOptions);
20
20
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/use-resize-observer/use-resize-observer.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport useEvent from '../use-event';\n\n// This is the current implementation of `useResizeObserver`.\n//\n// The legacy implementation is still supported for backwards compatibility.\n// This is achieved by overloading the exported function with both signatures,\n// and detecting which API is being used at runtime.\nexport function useResizeObserver< T extends HTMLElement >(\n\tcallback: ResizeObserverCallback,\n\tresizeObserverOptions: ResizeObserverOptions = {}\n): ( element?: T | null ) => void {\n\tconst callbackEvent = useEvent( callback );\n\n\tconst observedElementRef = useRef< T | null >();\n\tconst resizeObserverRef = useRef< ResizeObserver >();\n\treturn useEvent( ( element?: T | null ) => {\n\t\tif ( element === observedElementRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set up `ResizeObserver`.\n\t\tresizeObserverRef.current ??= new ResizeObserver( callbackEvent );\n\t\tconst { current: resizeObserver } = resizeObserverRef;\n\n\t\t// Unobserve previous element.\n\t\tif ( observedElementRef.current ) {\n\t\t\tresizeObserver.unobserve( observedElementRef.current );\n\t\t}\n\n\t\t// Observe new element.\n\t\tobservedElementRef.current = element;\n\t\tif ( element ) {\n\t\t\tresizeObserver.observe( element, resizeObserverOptions );\n\t\t}\n\t} );\n}\n"],
5
- "mappings": ";AAGA,SAAS,cAAc;AAIvB,OAAO,cAAc;AAOd,SAAS,kBACf,UACA,wBAA+C,CAAC,GACf;AACjC,QAAM,gBAAgB,SAAU,QAAS;AAEzC,QAAM,qBAAqB,OAAmB;AAC9C,QAAM,oBAAoB,OAAyB;AACnD,SAAO,SAAU,CAAE,YAAwB;AAC1C,QAAK,YAAY,mBAAmB,SAAU;AAC7C;AAAA,IACD;AAGA,sBAAkB,YAAY,IAAI,eAAgB,aAAc;AAChE,UAAM,EAAE,SAAS,eAAe,IAAI;AAGpC,QAAK,mBAAmB,SAAU;AACjC,qBAAe,UAAW,mBAAmB,OAAQ;AAAA,IACtD;AAGA,uBAAmB,UAAU;AAC7B,QAAK,SAAU;AACd,qBAAe,QAAS,SAAS,qBAAsB;AAAA,IACxD;AAAA,EACD,CAAE;AACH;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport useEvent from '../use-event';\n\n// This is the current implementation of `useResizeObserver`.\n//\n// The legacy implementation is still supported for backwards compatibility.\n// This is achieved by overloading the exported function with both signatures,\n// and detecting which API is being used at runtime.\nexport function useResizeObserver< T extends HTMLElement >(\n\tcallback: ResizeObserverCallback,\n\tresizeObserverOptions: ResizeObserverOptions = {}\n): ( element?: T | null ) => void {\n\tconst callbackEvent = useEvent( callback );\n\n\tconst observedElementRef = useRef< T | null >( null );\n\tconst resizeObserverRef = useRef< ResizeObserver >( undefined );\n\treturn useEvent( ( element?: T | null ) => {\n\t\tif ( element === observedElementRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set up `ResizeObserver`.\n\t\tresizeObserverRef.current ??= new ResizeObserver( callbackEvent );\n\t\tconst { current: resizeObserver } = resizeObserverRef;\n\n\t\t// Unobserve previous element.\n\t\tif ( observedElementRef.current ) {\n\t\t\tresizeObserver.unobserve( observedElementRef.current );\n\t\t}\n\n\t\t// Observe new element.\n\t\tobservedElementRef.current = element ?? null;\n\t\tif ( element ) {\n\t\t\tresizeObserver.observe( element, resizeObserverOptions );\n\t\t}\n\t} );\n}\n"],
5
+ "mappings": ";AAGA,SAAS,cAAc;AAIvB,OAAO,cAAc;AAOd,SAAS,kBACf,UACA,wBAA+C,CAAC,GACf;AACjC,QAAM,gBAAgB,SAAU,QAAS;AAEzC,QAAM,qBAAqB,OAAoB,IAAK;AACpD,QAAM,oBAAoB,OAA0B,MAAU;AAC9D,SAAO,SAAU,CAAE,YAAwB;AAC1C,QAAK,YAAY,mBAAmB,SAAU;AAC7C;AAAA,IACD;AAGA,sBAAkB,YAAY,IAAI,eAAgB,aAAc;AAChE,UAAM,EAAE,SAAS,eAAe,IAAI;AAGpC,QAAK,mBAAmB,SAAU;AACjC,qBAAe,UAAW,mBAAmB,OAAQ;AAAA,IACtD;AAGA,uBAAmB,UAAU,WAAW;AACxC,QAAK,SAAU;AACd,qBAAe,QAAS,SAAS,qBAAsB;AAAA,IACxD;AAAA,EACD,CAAE;AACH;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,7 @@ export default useConstrainedTabbing;
3
3
  * In Dialogs/modals, the tabbing must be constrained to the content of
4
4
  * the wrapper element. This hook adds the behavior to the returned ref.
5
5
  *
6
- * @return {import('react').RefCallback<Element>} Element Ref.
6
+ * @return {React.RefCallback<Element>} Element Ref.
7
7
  *
8
8
  * @example
9
9
  * ```js
@@ -20,5 +20,5 @@ export default useConstrainedTabbing;
20
20
  * }
21
21
  * ```
22
22
  */
23
- declare function useConstrainedTabbing(): import("react").RefCallback<Element>;
23
+ declare function useConstrainedTabbing(): React.RefCallback<Element>;
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-constrained-tabbing/index.js"],"names":[],"mappings":";AAUA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0CAjBY,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CA2E/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-constrained-tabbing/index.js"],"names":[],"mappings":";AAUA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0CAjBY,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CA2ErC"}
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * @deprecated
5
5
  *
6
- * @param {import('react').RefObject<string | Element | NodeListOf<Element>>} ref Reference with the element.
7
- * @param {string|Function} text The text to copy.
8
- * @param {number} [timeout] Optional timeout to reset the returned
9
- * state. 4 seconds by default.
6
+ * @param {React.RefObject<string | Element | NodeListOf<Element>>} ref Reference with the element.
7
+ * @param {string|Function} text The text to copy.
8
+ * @param {number} [timeout] Optional timeout to reset the returned
9
+ * state. 4 seconds by default.
10
10
  *
11
11
  * @return {boolean} Whether or not the text has been copied. Resets after the
12
12
  * timeout.
13
13
  */
14
- export default function useCopyOnClick(ref: import("react").RefObject<string | Element | NodeListOf<Element>>, text: string | Function, timeout?: number): boolean;
14
+ export default function useCopyOnClick(ref: React.RefObject<string | Element | NodeListOf<Element>>, text: string | Function, timeout?: number): boolean;
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-copy-on-click/index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;GAYG;AACH,4CARW,OAAO,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,QACjE,MAAM,WAAS,YACf,MAAM,GAGL,OAAO,CAqDlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-copy-on-click/index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;GAYG;AACH,4CARW,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,QACvD,MAAM,WAAS,YACf,MAAM,GAGL,OAAO,CAqDlB"}
@@ -6,7 +6,7 @@
6
6
  * already available and expensive to compute.
7
7
  * @param {Function} onSuccess Called when to text is copied.
8
8
  *
9
- * @return {import('react').Ref<TElementType>} A ref to assign to the target element.
9
+ * @return {React.Ref<TElementType>} A ref to assign to the target element.
10
10
  */
11
- export default function useCopyToClipboard<TElementType extends HTMLElement>(text: string | (() => string), onSuccess: Function): import("react").Ref<TElementType>;
11
+ export default function useCopyToClipboard<TElementType extends HTMLElement>(text: string | (() => string), onSuccess: Function): React.Ref<TElementType>;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-copy-to-clipboard/index.js"],"names":[],"mappings":"AA4BA;;;;;;;;;GASG;AACH,2CAP2B,YAAY,SAAzB,WAAY,QACf,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,wBAItB,OAAO,OAAO,EAAE,GAAG,CAAC,YAAY,CAAC,CAgC5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-copy-to-clipboard/index.js"],"names":[],"mappings":"AA4BA;;;;;;;;;GASG;AACH,2CAP2B,YAAY,SAAzB,WAAY,QACf,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,wBAItB,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAgClC"}
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @param {Object} config Configuration object.
9
9
  * @param {boolean=} config.isDisabled Whether the element should be disabled.
10
- * @return {import('react').RefCallback<HTMLElement>} Element Ref.
10
+ * @return {React.RefCallback<HTMLElement>} Element Ref.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @param {Object} props
3
- * @param {(e: import('react').MouseEvent) => void} props.onDragStart
4
- * @param {(e: MouseEvent) => void} props.onDragMove
5
- * @param {(e?: MouseEvent) => void} props.onDragEnd
2
+ * @param {Object} props
3
+ * @param {(e: React.MouseEvent) => void} props.onDragStart
4
+ * @param {(e: MouseEvent) => void} props.onDragMove
5
+ * @param {(e?: MouseEvent) => void} props.onDragEnd
6
6
  */
7
7
  export default function useDragging({ onDragStart, onDragMove, onDragEnd }: {
8
- onDragStart: (e: import("react").MouseEvent) => void;
8
+ onDragStart: (e: React.MouseEvent) => void;
9
9
  onDragMove: (e: MouseEvent) => void;
10
10
  onDragEnd: (e?: MouseEvent) => void;
11
11
  }): {
12
- startDrag: (e: import("react").MouseEvent) => void;
12
+ startDrag: (e: React.MouseEvent) => void;
13
13
  endDrag: (e?: MouseEvent) => void;
14
14
  isDragging: boolean;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-dragging/index.js"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,4EAJG;IAAuD,WAAW,EAA1D,CAAC,CAAC,EAAE,OAAO,OAAO,EAAE,UAAU,KAAK,IAAI;IACQ,UAAU,EAAzD,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;IACwB,SAAS,EAAxD,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;CAClC;mBA+Be,OAAO,OAAO,EAAE,UAAU,KAAK,IAAI;kBATlC,UAAU,KAAK,IAAI;;EAkCnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-dragging/index.js"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,4EAJG;IAA6C,WAAW,EAAhD,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI;IACQ,UAAU,EAA/C,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;IACc,SAAS,EAA9C,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;CAClC;mBA+Be,KAAK,CAAC,UAAU,KAAK,IAAI;kBATxB,UAAU,KAAK,IAAI;;EAkCnC"}
@@ -11,7 +11,7 @@
11
11
  * @param {(e: MouseEvent) => void} [props.onDragEnd] Called when dragging has ended.
12
12
  * @param {(e: DragEvent) => void} [props.onDrop] Called when dropping in the zone.
13
13
  *
14
- * @return {import('react').RefCallback<HTMLElement>} Ref callback to be passed to the drop zone element.
14
+ * @return {React.RefCallback<HTMLElement>} Ref callback to be passed to the drop zone element.
15
15
  */
16
16
  export default function useDropZone({ dropZoneElement, isDisabled, onDrop: _onDrop, onDragStart: _onDragStart, onDragEnter: _onDragEnter, onDragLeave: _onDragLeave, onDragEnd: _onDragEnd, onDragOver: _onDragOver, }: {
17
17
  dropZoneElement?: HTMLElement | null | undefined;
@@ -22,5 +22,5 @@ export default function useDropZone({ dropZoneElement, isDisabled, onDrop: _onDr
22
22
  onDragLeave?: ((e: DragEvent) => void) | undefined;
23
23
  onDragEnd?: ((e: MouseEvent) => void) | undefined;
24
24
  onDrop?: ((e: DragEvent) => void) | undefined;
25
- }): import("react").RefCallback<HTMLElement>;
25
+ }): React.RefCallback<HTMLElement>;
26
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-drop-zone/index.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,wNAXG;IAAwC,eAAe;IACf,UAAU;IACV,WAAW,QAAvC,SAAS,KAAK,IAAI;IACU,WAAW,QAAvC,SAAS,KAAK,IAAI;IACU,UAAU,QAAtC,SAAS,KAAK,IAAI;IACU,WAAW,QAAvC,SAAS,KAAK,IAAI;IACU,SAAS,QAArC,UAAU,KAAK,IAAI;IACS,MAAM,QAAlC,SAAS,KAAK,IAAI;CAE9B,GAAS,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAoMnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-drop-zone/index.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,wNAXG;IAAwC,eAAe;IACf,UAAU;IACV,WAAW,QAAvC,SAAS,KAAK,IAAI;IACU,WAAW,QAAvC,SAAS,KAAK,IAAI;IACU,UAAU,QAAtC,SAAS,KAAK,IAAI;IACU,WAAW,QAAvC,SAAS,KAAK,IAAI;IACU,SAAS,QAArC,UAAU,KAAK,IAAI;IACS,MAAM,QAAlC,SAAS,KAAK,IAAI;CAE9B,GAAS,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAoMzC"}
@@ -16,13 +16,13 @@
16
16
  */
17
17
  /**
18
18
  *
19
- * @param {import('react').RefObject<HTMLElement>} elementRef Used to find the closest scroll container that contains element.
20
- * @param { number } itemHeight Fixed item height in pixels
21
- * @param { number } totalItems Total items in list
22
- * @param { WPFixedWindowListOptions } [options] Options object
19
+ * @param {React.RefObject<HTMLElement>} elementRef Used to find the closest scroll container that contains element.
20
+ * @param { number } itemHeight Fixed item height in pixels
21
+ * @param { number } totalItems Total items in list
22
+ * @param { WPFixedWindowListOptions } [options] Options object
23
23
  * @return {[ WPFixedWindowList, setFixedListWindow:(nextWindow:WPFixedWindowList)=>void]} Array with the fixed window list and setter
24
24
  */
25
- export default function useFixedWindowList(elementRef: import("react").RefObject<HTMLElement>, itemHeight: number, totalItems: number, options?: WPFixedWindowListOptions): [WPFixedWindowList, setFixedListWindow: (nextWindow: WPFixedWindowList) => void];
25
+ export default function useFixedWindowList(elementRef: React.RefObject<HTMLElement>, itemHeight: number, totalItems: number, options?: WPFixedWindowListOptions): [WPFixedWindowList, setFixedListWindow: (nextWindow: WPFixedWindowList) => void];
26
26
  export type WPFixedWindowList = {
27
27
  /**
28
28
  * Items visible in the current viewport
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-fixed-window-list/index.js"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,uDANW,OAAO,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,cACrC,MAAM,cACN,MAAM,YACN,wBAAwB,GACxB,CAAE,iBAAiB,EAAE,kBAAkB,EAAC,CAAC,UAAU,EAAC,iBAAiB,KAAG,IAAI,CAAC,CA0JxF;;;;;kBA/Ka,MAAM;;;;WACN,MAAM;;;;SACN,MAAM;;;;gBACN,CAAC,KAAK,EAAC,MAAM,KAAG,OAAO;;;;;;;;;;;;;;;;;;oBASvB,GAAG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-fixed-window-list/index.js"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,uDANW,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,cAC3B,MAAM,cACN,MAAM,YACN,wBAAwB,GACxB,CAAE,iBAAiB,EAAE,kBAAkB,EAAC,CAAC,UAAU,EAAC,iBAAiB,KAAG,IAAI,CAAC,CA0JxF;;;;;kBA/Ka,MAAM;;;;WACN,MAAM;;;;SACN,MAAM;;;;gBACN,CAAC,KAAK,EAAC,MAAM,KAAG,OAAO;;;;;;;;;;;;;;;;;;oBASvB,GAAG"}
@@ -2,7 +2,7 @@
2
2
  * Hook used to focus the first tabbable element on mount.
3
3
  *
4
4
  * @param {boolean | 'firstElement' | 'firstInputElement'} focusOnMount Focus on mount mode.
5
- * @return {import('react').RefCallback<HTMLElement>} Ref callback.
5
+ * @return {React.RefCallback<HTMLElement>} Ref callback.
6
6
  *
7
7
  * @example
8
8
  * ```js
@@ -19,5 +19,5 @@
19
19
  * }
20
20
  * ```
21
21
  */
22
- export default function useFocusOnMount(focusOnMount?: boolean | "firstElement" | "firstInputElement"): import("react").RefCallback<HTMLElement>;
22
+ export default function useFocusOnMount(focusOnMount?: boolean | "firstElement" | "firstInputElement"): React.RefCallback<HTMLElement>;
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-on-mount/index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uDAlBW,OAAO,GAAG,cAAc,GAAG,mBAAmB,GAC7C,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CA4FnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-on-mount/index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uDAlBW,OAAO,GAAG,cAAc,GAAG,mBAAmB,GAC7C,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CA4FzC"}
@@ -4,7 +4,7 @@ export default useFocusReturn;
4
4
  * previously as is expected for roles like menus or dialogs.
5
5
  *
6
6
  * @param {() => void} [onFocusReturn] Overrides the default return behavior.
7
- * @return {import('react').RefCallback<HTMLElement>} Element Ref.
7
+ * @return {React.RefCallback<HTMLElement>} Element Ref.
8
8
  *
9
9
  * @example
10
10
  * ```js
@@ -21,5 +21,5 @@ export default useFocusReturn;
21
21
  * }
22
22
  * ```
23
23
  */
24
- declare function useFocusReturn(onFocusReturn?: () => void): import("react").RefCallback<HTMLElement>;
24
+ declare function useFocusReturn(onFocusReturn?: () => void): React.RefCallback<HTMLElement>;
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-return/index.js"],"names":[],"mappings":";AAQA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gDAlBW,MAAM,IAAI,GACT,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAsEnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-return/index.js"],"names":[],"mappings":";AAQA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gDAlBW,MAAM,IAAI,GACT,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAsEzC"}
@@ -18,26 +18,27 @@ export type WPKeyboardShortcutConfig = {
18
18
  /**
19
19
  * React reference to the DOM element used to catch the keyboard event.
20
20
  */
21
- target?: import("react").RefObject<HTMLElement> | undefined;
21
+ target?: import("react").RefObject<HTMLElement | null> | undefined;
22
22
  };
23
23
  /**
24
24
  * A block selection object.
25
25
  *
26
26
  * @typedef {Object} WPKeyboardShortcutConfig
27
27
  *
28
- * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields.
29
- * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown.
30
- * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true.
31
- * @property {import('react').RefObject<HTMLElement>} [target] React reference to the DOM element used to catch the keyboard event.
28
+ * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields.
29
+ * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown.
30
+ * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true.
31
+ * @property {React.RefObject<HTMLElement | null>} [target] React reference to the DOM element used to catch the keyboard event.
32
32
  */
33
33
  /**
34
34
  * Attach a keyboard shortcut handler.
35
35
  *
36
36
  * @see https://craig.is/killing/mice#api.bind for information about the `callback` parameter.
37
37
  *
38
- * @param {string[]|string} shortcuts Keyboard Shortcuts.
39
- * @param {(e: import('mousetrap').ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback.
40
- * @param {WPKeyboardShortcutConfig} options Shortcut options.
38
+ * @param {string[]|string} shortcuts Keyboard Shortcuts.
39
+ * @param {(e: Mousetrap.ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback.
40
+ * @param {WPKeyboardShortcutConfig} options Shortcut options.
41
41
  */
42
- declare function useKeyboardShortcut(shortcuts: string[] | string, callback: (e: import("mousetrap").ExtendedKeyboardEvent, combo: string) => void, { bindGlobal, eventName, isDisabled, target, }?: WPKeyboardShortcutConfig): void;
42
+ declare function useKeyboardShortcut(shortcuts: string[] | string, callback: (e: Mousetrap.ExtendedKeyboardEvent, combo: string) => void, { bindGlobal, eventName, isDisabled, target, }?: WPKeyboardShortcutConfig): void;
43
+ import Mousetrap from 'mousetrap';
43
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-keyboard-shortcut/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,gDAJW,MAAM,EAAE,GAAC,MAAM,YACf,CAAC,CAAC,EAAE,OAAO,WAAW,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,mDACrE,wBAAwB,QAqElC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-keyboard-shortcut/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,gDAJW,MAAM,EAAE,GAAC,MAAM,YACf,CAAC,CAAC,EAAE,SAAS,CAAC,qBAAqB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,mDAC3D,wBAAwB,QAqElC;sBAhGqB,WAAW"}
@@ -1,3 +1,4 @@
1
+ import type { Ref, RefCallback } from 'react';
1
2
  /**
2
3
  * Merges refs into one ref callback.
3
4
  *
@@ -36,11 +37,8 @@
36
37
  * return <div ref={ mergedRefs } />;
37
38
  * ```
38
39
  *
39
- * @template {import('react').Ref<any>} TRef
40
- * @param {Array<TRef>} refs The refs to be merged.
41
- *
42
- * @return {import('react').RefCallback<TypeFromRef<TRef>>} The merged ref callback.
40
+ * @param refs The refs to be merged.
41
+ * @return The merged ref callback.
43
42
  */
44
- export default function useMergeRefs<TRef extends import("react").Ref<any>>(refs: Array<TRef>): import("react").RefCallback<TypeFromRef<TRef>>;
45
- export type TypeFromRef<T> = T extends import("react").Ref<infer R> ? R : never;
43
+ export default function useMergeRefs<T>(refs: Ref<T>[]): RefCallback<T>;
46
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-merge-refs/index.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qCALwC,IAAI,SAA/B,OAAQ,OAAO,EAAE,GAAG,CAAC,GAAG,CAAE,QAC5B,KAAK,CAAC,IAAI,CAAC,GAEV,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CA6DzD;wBAxHY,CAAC,IACD,CAAC,SAAS,OAAO,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-merge-refs/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,GAAG,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAUhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,CAAC,EACtC,IAAI,EAAE,GAAG,CAAE,CAAC,CAAE,EAAE,GACd,WAAW,CAAE,CAAC,CAAE,CA0DlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/compose",
3
- "version": "7.39.1-next.v.202602111440.0+a307a2e35",
3
+ "version": "7.40.0",
4
4
  "description": "WordPress higher-order components (HOCs).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -47,13 +47,13 @@
47
47
  "sideEffects": false,
48
48
  "dependencies": {
49
49
  "@types/mousetrap": "^1.6.8",
50
- "@wordpress/deprecated": "^4.39.1-next.v.202602111440.0+a307a2e35",
51
- "@wordpress/dom": "^4.39.1-next.v.202602111440.0+a307a2e35",
52
- "@wordpress/element": "^6.39.1-next.v.202602111440.0+a307a2e35",
53
- "@wordpress/is-shallow-equal": "^5.39.1-next.v.202602111440.0+a307a2e35",
54
- "@wordpress/keycodes": "^4.39.1-next.v.202602111440.0+a307a2e35",
55
- "@wordpress/priority-queue": "^3.39.1-next.v.202602111440.0+a307a2e35",
56
- "@wordpress/undo-manager": "^1.39.1-next.v.202602111440.0+a307a2e35",
50
+ "@wordpress/deprecated": "^4.40.0",
51
+ "@wordpress/dom": "^4.40.0",
52
+ "@wordpress/element": "^6.40.0",
53
+ "@wordpress/is-shallow-equal": "^5.40.0",
54
+ "@wordpress/keycodes": "^4.40.0",
55
+ "@wordpress/priority-queue": "^3.40.0",
56
+ "@wordpress/undo-manager": "^1.40.0",
57
57
  "change-case": "^4.1.2",
58
58
  "clipboard": "^2.0.11",
59
59
  "mousetrap": "^1.6.5",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "e0a2324a9690e55f4101d61113f4bbbf240b55ed"
71
+ "gitHead": "376124aa10dbc2cc0c81c964ec00b99fcfee5382"
72
72
  }
@@ -12,7 +12,7 @@ import useRefEffect from '../use-ref-effect';
12
12
  * In Dialogs/modals, the tabbing must be constrained to the content of
13
13
  * the wrapper element. This hook adds the behavior to the returned ref.
14
14
  *
15
- * @return {import('react').RefCallback<Element>} Element Ref.
15
+ * @return {React.RefCallback<Element>} Element Ref.
16
16
  *
17
17
  * @example
18
18
  * ```js
@@ -14,10 +14,10 @@ import deprecated from '@wordpress/deprecated';
14
14
  *
15
15
  * @deprecated
16
16
  *
17
- * @param {import('react').RefObject<string | Element | NodeListOf<Element>>} ref Reference with the element.
18
- * @param {string|Function} text The text to copy.
19
- * @param {number} [timeout] Optional timeout to reset the returned
20
- * state. 4 seconds by default.
17
+ * @param {React.RefObject<string | Element | NodeListOf<Element>>} ref Reference with the element.
18
+ * @param {string|Function} text The text to copy.
19
+ * @param {number} [timeout] Optional timeout to reset the returned
20
+ * state. 4 seconds by default.
21
21
  *
22
22
  * @return {boolean} Whether or not the text has been copied. Resets after the
23
23
  * timeout.
@@ -28,8 +28,8 @@ export default function useCopyOnClick( ref, text, timeout = 4000 ) {
28
28
  alternative: 'wp.compose.useCopyToClipboard',
29
29
  } );
30
30
 
31
- /** @type {import('react').MutableRefObject<Clipboard | undefined>} */
32
- const clipboardRef = useRef();
31
+ /** @type {React.MutableRefObject<Clipboard | undefined>} */
32
+ const clipboardRef = useRef( undefined );
33
33
  const [ hasCopied, setHasCopied ] = useState( false );
34
34
 
35
35
  useEffect( () => {
@@ -16,7 +16,7 @@ import useRefEffect from '../use-ref-effect';
16
16
  /**
17
17
  * @template T
18
18
  * @param {T} value
19
- * @return {import('react').RefObject<T>} The updated ref
19
+ * @return {React.RefObject<T>} The updated ref
20
20
  */
21
21
  function useUpdatedRef( value ) {
22
22
  const ref = useRef( value );
@@ -34,7 +34,7 @@ function useUpdatedRef( value ) {
34
34
  * already available and expensive to compute.
35
35
  * @param {Function} onSuccess Called when to text is copied.
36
36
  *
37
- * @return {import('react').Ref<TElementType>} A ref to assign to the target element.
37
+ * @return {React.Ref<TElementType>} A ref to assign to the target element.
38
38
  */
39
39
  export default function useCopyToClipboard( text, onSuccess ) {
40
40
  // Store the dependencies as refs and continuously update them so they're
@@ -66,7 +66,7 @@ type useDialogReturn = [
66
66
  * @param options Dialog Options.
67
67
  */
68
68
  function useDialog( options: DialogOptions ): useDialogReturn {
69
- const currentOptions = useRef< DialogOptions | undefined >();
69
+ const currentOptions = useRef< DialogOptions >( undefined );
70
70
  const { constrainTabbing = options.focusOnMount !== false } = options;
71
71
  useEffect( () => {
72
72
  currentOptions.current = options;
@@ -13,7 +13,7 @@ import useRefEffect from '../use-ref-effect';
13
13
  *
14
14
  * @param {Object} config Configuration object.
15
15
  * @param {boolean=} config.isDisabled Whether the element should be disabled.
16
- * @return {import('react').RefCallback<HTMLElement>} Element Ref.
16
+ * @return {React.RefCallback<HTMLElement>} Element Ref.
17
17
  *
18
18
  * @example
19
19
  * ```js
@@ -11,10 +11,10 @@ import useIsomorphicLayoutEffect from '../use-isomorphic-layout-effect';
11
11
  // Event handlers that are triggered from `document` listeners accept a MouseEvent,
12
12
  // while those triggered from React listeners accept a React.MouseEvent.
13
13
  /**
14
- * @param {Object} props
15
- * @param {(e: import('react').MouseEvent) => void} props.onDragStart
16
- * @param {(e: MouseEvent) => void} props.onDragMove
17
- * @param {(e?: MouseEvent) => void} props.onDragEnd
14
+ * @param {Object} props
15
+ * @param {(e: React.MouseEvent) => void} props.onDragStart
16
+ * @param {(e: MouseEvent) => void} props.onDragMove
17
+ * @param {(e?: MouseEvent) => void} props.onDragEnd
18
18
  */
19
19
  export default function useDragging( { onDragStart, onDragMove, onDragEnd } ) {
20
20
  const [ isDragging, setIsDragging ] = useState( false );
@@ -46,7 +46,7 @@ export default function useDragging( { onDragStart, onDragMove, onDragEnd } ) {
46
46
  document.removeEventListener( 'mouseup', endDrag );
47
47
  setIsDragging( false );
48
48
  }, [] );
49
- /** @type {(e: import('react').MouseEvent) => void} */
49
+ /** @type {(e: React.MouseEvent) => void} */
50
50
  const startDrag = useCallback( ( event ) => {
51
51
  if ( eventsRef.current.onDragStart ) {
52
52
  eventsRef.current.onDragStart( event );
@@ -17,7 +17,7 @@ import useEvent from '../use-event';
17
17
  * @param {(e: MouseEvent) => void} [props.onDragEnd] Called when dragging has ended.
18
18
  * @param {(e: DragEvent) => void} [props.onDrop] Called when dropping in the zone.
19
19
  *
20
- * @return {import('react').RefCallback<HTMLElement>} Ref callback to be passed to the drop zone element.
20
+ * @return {React.RefCallback<HTMLElement>} Ref callback to be passed to the drop zone element.
21
21
  */
22
22
  export default function useDropZone( {
23
23
  dropZoneElement,
@@ -32,10 +32,10 @@ const DEFAULT_INIT_WINDOW_SIZE = 30;
32
32
 
33
33
  /**
34
34
  *
35
- * @param {import('react').RefObject<HTMLElement>} elementRef Used to find the closest scroll container that contains element.
36
- * @param { number } itemHeight Fixed item height in pixels
37
- * @param { number } totalItems Total items in list
38
- * @param { WPFixedWindowListOptions } [options] Options object
35
+ * @param {React.RefObject<HTMLElement>} elementRef Used to find the closest scroll container that contains element.
36
+ * @param { number } itemHeight Fixed item height in pixels
37
+ * @param { number } totalItems Total items in list
38
+ * @param { WPFixedWindowListOptions } [options] Options object
39
39
  * @return {[ WPFixedWindowList, setFixedListWindow:(nextWindow:WPFixedWindowList)=>void]} Array with the fixed window list and setter
40
40
  */
41
41
  export default function useFixedWindowList(
@@ -13,7 +13,7 @@ import useRefEffect from '../use-ref-effect';
13
13
  * Hook used to focus the first tabbable element on mount.
14
14
  *
15
15
  * @param {boolean | 'firstElement' | 'firstInputElement'} focusOnMount Focus on mount mode.
16
- * @return {import('react').RefCallback<HTMLElement>} Ref callback.
16
+ * @return {React.RefCallback<HTMLElement>} Ref callback.
17
17
  *
18
18
  * @example
19
19
  * ```js
@@ -48,8 +48,8 @@ export default function useFocusOnMount( focusOnMount = 'firstElement' ) {
48
48
  } );
49
49
  };
50
50
 
51
- /** @type {import('react').MutableRefObject<ReturnType<setTimeout> | undefined>} */
52
- const timerIdRef = useRef();
51
+ /** @type {React.MutableRefObject<ReturnType<setTimeout> | undefined>} */
52
+ const timerIdRef = useRef( undefined );
53
53
 
54
54
  useEffect( () => {
55
55
  focusOnMountRef.current = focusOnMount;
@@ -41,7 +41,7 @@ function isFocusNormalizedButton( eventTarget ) {
41
41
  }
42
42
 
43
43
  /**
44
- * @typedef {import('react').SyntheticEvent} SyntheticEvent
44
+ * @typedef {React.SyntheticEvent} SyntheticEvent
45
45
  */
46
46
 
47
47
  /**
@@ -55,7 +55,7 @@ function isFocusNormalizedButton( eventTarget ) {
55
55
  */
56
56
 
57
57
  /**
58
- * @typedef {import('react').MutableRefObject<FocusOutsideReactElement | undefined>} FocusOutsideRef
58
+ * @typedef {React.MutableRefObject<FocusOutsideReactElement | undefined>} FocusOutsideRef
59
59
  */
60
60
 
61
61
  /**
@@ -88,7 +88,7 @@ export default function useFocusOutside( onFocusOutside ) {
88
88
  const preventBlurCheck = useRef( false );
89
89
 
90
90
  /**
91
- * @type {import('react').MutableRefObject<number | undefined>}
91
+ * @type {React.MutableRefObject<number | undefined>}
92
92
  */
93
93
  const blurCheckTimeoutId = useRef();
94
94
 
@@ -78,7 +78,7 @@ export default function useFocusOutside(
78
78
 
79
79
  const preventBlurCheckRef = useRef( false );
80
80
 
81
- const blurCheckTimeoutIdRef = useRef< number | undefined >();
81
+ const blurCheckTimeoutIdRef = useRef< number >( undefined );
82
82
 
83
83
  /**
84
84
  * Cancel a blur check timeout.
@@ -11,7 +11,7 @@ let origin = null;
11
11
  * previously as is expected for roles like menus or dialogs.
12
12
  *
13
13
  * @param {() => void} [onFocusReturn] Overrides the default return behavior.
14
- * @return {import('react').RefCallback<HTMLElement>} Element Ref.
14
+ * @return {React.RefCallback<HTMLElement>} Element Ref.
15
15
  *
16
16
  * @example
17
17
  * ```js
@@ -29,9 +29,9 @@ let origin = null;
29
29
  * ```
30
30
  */
31
31
  function useFocusReturn( onFocusReturn ) {
32
- /** @type {import('react').MutableRefObject<null | HTMLElement>} */
32
+ /** @type {React.MutableRefObject<null | HTMLElement>} */
33
33
  const ref = useRef( null );
34
- /** @type {import('react').MutableRefObject<null | Element>} */
34
+ /** @type {React.MutableRefObject<null | Element>} */
35
35
  const focusedBeforeMount = useRef( null );
36
36
  const onFocusReturnRef = useRef( onFocusReturn );
37
37
  useEffect( () => {
@@ -15,10 +15,10 @@ import { isAppleOS } from '@wordpress/keycodes';
15
15
  *
16
16
  * @typedef {Object} WPKeyboardShortcutConfig
17
17
  *
18
- * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields.
19
- * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown.
20
- * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true.
21
- * @property {import('react').RefObject<HTMLElement>} [target] React reference to the DOM element used to catch the keyboard event.
18
+ * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields.
19
+ * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown.
20
+ * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true.
21
+ * @property {React.RefObject<HTMLElement | null>} [target] React reference to the DOM element used to catch the keyboard event.
22
22
  */
23
23
 
24
24
  /**
@@ -26,9 +26,9 @@ import { isAppleOS } from '@wordpress/keycodes';
26
26
  *
27
27
  * @see https://craig.is/killing/mice#api.bind for information about the `callback` parameter.
28
28
  *
29
- * @param {string[]|string} shortcuts Keyboard Shortcuts.
30
- * @param {(e: import('mousetrap').ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback.
31
- * @param {WPKeyboardShortcutConfig} options Shortcut options.
29
+ * @param {string[]|string} shortcuts Keyboard Shortcuts.
30
+ * @param {(e: Mousetrap.ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback.
31
+ * @param {WPKeyboardShortcutConfig} options Shortcut options.
32
32
  */
33
33
  function useKeyboardShortcut(
34
34
  shortcuts,