@wordpress/compose 5.6.0 → 5.7.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 (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +35 -9
  3. package/build/hooks/use-disabled/index.js +77 -7
  4. package/build/hooks/use-disabled/index.js.map +1 -1
  5. package/build/hooks/use-focus-on-mount/index.js +6 -1
  6. package/build/hooks/use-focus-on-mount/index.js.map +1 -1
  7. package/build/hooks/use-ref-effect/index.js.map +1 -1
  8. package/build/hooks/use-resize-observer/index.js +224 -13
  9. package/build/hooks/use-resize-observer/index.js.map +1 -1
  10. package/build/hooks/use-resize-observer/index.native.js +0 -2
  11. package/build/hooks/use-resize-observer/index.native.js.map +1 -1
  12. package/build/index.js +6 -6
  13. package/build/index.js.map +1 -1
  14. package/build/index.native.js +8 -0
  15. package/build/index.native.js.map +1 -1
  16. package/build-module/hooks/use-disabled/index.js +78 -7
  17. package/build-module/hooks/use-disabled/index.js.map +1 -1
  18. package/build-module/hooks/use-focus-on-mount/index.js +6 -1
  19. package/build-module/hooks/use-focus-on-mount/index.js.map +1 -1
  20. package/build-module/hooks/use-ref-effect/index.js.map +1 -1
  21. package/build-module/hooks/use-resize-observer/index.js +226 -9
  22. package/build-module/hooks/use-resize-observer/index.js.map +1 -1
  23. package/build-module/hooks/use-resize-observer/index.native.js +0 -2
  24. package/build-module/hooks/use-resize-observer/index.native.js.map +1 -1
  25. package/build-module/index.js +1 -1
  26. package/build-module/index.js.map +1 -1
  27. package/build-module/index.native.js +1 -0
  28. package/build-module/index.native.js.map +1 -1
  29. package/build-types/higher-order/if-condition/index.d.ts +0 -1
  30. package/build-types/higher-order/if-condition/index.d.ts.map +1 -1
  31. package/build-types/higher-order/with-instance-id/index.d.ts +0 -1
  32. package/build-types/higher-order/with-instance-id/index.d.ts.map +1 -1
  33. package/build-types/hooks/use-disabled/index.d.ts +6 -2
  34. package/build-types/hooks/use-disabled/index.d.ts.map +1 -1
  35. package/build-types/hooks/use-focus-on-mount/index.d.ts.map +1 -1
  36. package/build-types/hooks/use-ref-effect/index.d.ts +1 -1
  37. package/build-types/hooks/use-ref-effect/index.d.ts.map +1 -1
  38. package/build-types/hooks/use-resize-observer/index.d.ts +32 -2
  39. package/build-types/hooks/use-resize-observer/index.d.ts.map +1 -1
  40. package/build-types/index.d.ts +1 -1
  41. package/package.json +8 -9
  42. package/src/hooks/use-disabled/index.js +140 -50
  43. package/src/hooks/use-focus-on-mount/index.js +6 -1
  44. package/src/hooks/use-ref-effect/index.ts +2 -2
  45. package/src/hooks/use-resize-observer/index.native.js +0 -2
  46. package/src/hooks/use-resize-observer/index.tsx +362 -0
  47. package/src/index.js +1 -1
  48. package/src/index.native.js +1 -0
  49. package/tsconfig.json +2 -4
  50. package/tsconfig.tsbuildinfo +1 -1
  51. package/src/hooks/use-resize-observer/index.js +0 -31
@@ -14,7 +14,7 @@ export { default as useConstrainedTabbing } from './hooks/use-constrained-tabbin
14
14
  export { default as useCopyOnClick } from './hooks/use-copy-on-click';
15
15
  export { default as useCopyToClipboard } from './hooks/use-copy-to-clipboard';
16
16
  export { default as __experimentalUseDialog } from './hooks/use-dialog';
17
- export { default as __experimentalUseDisabled } from './hooks/use-disabled';
17
+ export { default as useDisabled } from './hooks/use-disabled';
18
18
  export { default as __experimentalUseDragging } from './hooks/use-dragging';
19
19
  export { default as useFocusOnMount } from './hooks/use-focus-on-mount';
20
20
  export { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/index.js"],"names":["default","createHigherOrderComponent","compose","ifCondition","pure","withGlobalEvents","withInstanceId","withSafeTimeout","withState","useConstrainedTabbing","useCopyOnClick","useCopyToClipboard","__experimentalUseDialog","__experimentalUseDisabled","__experimentalUseDragging","useFocusOnMount","__experimentalUseFocusOutside","useFocusReturn","useInstanceId","useIsomorphicLayoutEffect","useKeyboardShortcut","useMediaQuery","usePrevious","useReducedMotion","useViewportMatch","useResizeObserver","useAsyncList","useWarnOnChange","useDebounce","useThrottle","useMergeRefs","useRefEffect","__experimentalUseDropZone","useFocusableIframe","__experimentalUseFixedWindowList"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,0BAApB,QAAsD,uCAAtD,C,CAEA;;AACA,SAASD,OAAO,IAAIE,OAApB,QAAmC,wBAAnC,C,CAEA;;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,6BAAvC;AACA,SAASH,OAAO,IAAII,IAApB,QAAgC,qBAAhC;AACA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,mCAA5C;AACA,SAASL,OAAO,IAAIM,cAApB,QAA0C,iCAA1C;AACA,SAASN,OAAO,IAAIO,eAApB,QAA2C,kCAA3C;AACA,SAASP,OAAO,IAAIQ,SAApB,QAAqC,2BAArC,C,CAEA;;AACA,SAASR,OAAO,IAAIS,qBAApB,QAAiD,iCAAjD;AACA,SAAST,OAAO,IAAIU,cAApB,QAA0C,2BAA1C;AACA,SAASV,OAAO,IAAIW,kBAApB,QAA8C,+BAA9C;AACA,SAASX,OAAO,IAAIY,uBAApB,QAAmD,oBAAnD;AACA,SAASZ,OAAO,IAAIa,yBAApB,QAAqD,sBAArD;AACA,SAASb,OAAO,IAAIc,yBAApB,QAAqD,sBAArD;AACA,SAASd,OAAO,IAAIe,eAApB,QAA2C,4BAA3C;AACA,SAASf,OAAO,IAAIgB,6BAApB,QAAyD,2BAAzD;AACA,SAAShB,OAAO,IAAIiB,cAApB,QAA0C,0BAA1C;AACA,SAASjB,OAAO,IAAIkB,aAApB,QAAyC,yBAAzC;AACA,SAASlB,OAAO,IAAImB,yBAApB,QAAqD,sCAArD;AACA,SAASnB,OAAO,IAAIoB,mBAApB,QAA+C,+BAA/C;AACA,SAASpB,OAAO,IAAIqB,aAApB,QAAyC,yBAAzC;AACA,SAASrB,OAAO,IAAIsB,WAApB,QAAuC,sBAAvC;AACA,SAAStB,OAAO,IAAIuB,gBAApB,QAA4C,4BAA5C;AACA,SAASvB,OAAO,IAAIwB,gBAApB,QAA4C,4BAA5C;AACA,SAASxB,OAAO,IAAIyB,iBAApB,QAA6C,6BAA7C;AACA,SAASzB,OAAO,IAAI0B,YAApB,QAAwC,wBAAxC;AACA,SAAS1B,OAAO,IAAI2B,eAApB,QAA2C,4BAA3C;AACA,SAAS3B,OAAO,IAAI4B,WAApB,QAAuC,sBAAvC;AACA,SAAS5B,OAAO,IAAI6B,WAApB,QAAuC,sBAAvC;AACA,SAAS7B,OAAO,IAAI8B,YAApB,QAAwC,wBAAxC;AACA,SAAS9B,OAAO,IAAI+B,YAApB,QAAwC,wBAAxC;AACA,SAAS/B,OAAO,IAAIgC,yBAApB,QAAqD,uBAArD;AACA,SAAShC,OAAO,IAAIiC,kBAApB,QAA8C,8BAA9C;AACA,SAASjC,OAAO,IAAIkC,gCAApB,QAA4D,+BAA5D","sourcesContent":["// Utils.\nexport { default as createHigherOrderComponent } from './utils/create-higher-order-component';\n\n// Compose helper (aliased flowRight from Lodash)\nexport { default as compose } from './higher-order/compose';\n\n// Higher-order components.\nexport { default as ifCondition } from './higher-order/if-condition';\nexport { default as pure } from './higher-order/pure';\nexport { default as withGlobalEvents } from './higher-order/with-global-events';\nexport { default as withInstanceId } from './higher-order/with-instance-id';\nexport { default as withSafeTimeout } from './higher-order/with-safe-timeout';\nexport { default as withState } from './higher-order/with-state';\n\n// Hooks.\nexport { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';\nexport { default as useCopyOnClick } from './hooks/use-copy-on-click';\nexport { default as useCopyToClipboard } from './hooks/use-copy-to-clipboard';\nexport { default as __experimentalUseDialog } from './hooks/use-dialog';\nexport { default as __experimentalUseDisabled } from './hooks/use-disabled';\nexport { default as __experimentalUseDragging } from './hooks/use-dragging';\nexport { default as useFocusOnMount } from './hooks/use-focus-on-mount';\nexport { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';\nexport { default as useFocusReturn } from './hooks/use-focus-return';\nexport { default as useInstanceId } from './hooks/use-instance-id';\nexport { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';\nexport { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';\nexport { default as useMediaQuery } from './hooks/use-media-query';\nexport { default as usePrevious } from './hooks/use-previous';\nexport { default as useReducedMotion } from './hooks/use-reduced-motion';\nexport { default as useViewportMatch } from './hooks/use-viewport-match';\nexport { default as useResizeObserver } from './hooks/use-resize-observer';\nexport { default as useAsyncList } from './hooks/use-async-list';\nexport { default as useWarnOnChange } from './hooks/use-warn-on-change';\nexport { default as useDebounce } from './hooks/use-debounce';\nexport { default as useThrottle } from './hooks/use-throttle';\nexport { default as useMergeRefs } from './hooks/use-merge-refs';\nexport { default as useRefEffect } from './hooks/use-ref-effect';\nexport { default as __experimentalUseDropZone } from './hooks/use-drop-zone';\nexport { default as useFocusableIframe } from './hooks/use-focusable-iframe';\nexport { default as __experimentalUseFixedWindowList } from './hooks/use-fixed-window-list';\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/index.js"],"names":["default","createHigherOrderComponent","compose","ifCondition","pure","withGlobalEvents","withInstanceId","withSafeTimeout","withState","useConstrainedTabbing","useCopyOnClick","useCopyToClipboard","__experimentalUseDialog","useDisabled","__experimentalUseDragging","useFocusOnMount","__experimentalUseFocusOutside","useFocusReturn","useInstanceId","useIsomorphicLayoutEffect","useKeyboardShortcut","useMediaQuery","usePrevious","useReducedMotion","useViewportMatch","useResizeObserver","useAsyncList","useWarnOnChange","useDebounce","useThrottle","useMergeRefs","useRefEffect","__experimentalUseDropZone","useFocusableIframe","__experimentalUseFixedWindowList"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,0BAApB,QAAsD,uCAAtD,C,CAEA;;AACA,SAASD,OAAO,IAAIE,OAApB,QAAmC,wBAAnC,C,CAEA;;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,6BAAvC;AACA,SAASH,OAAO,IAAII,IAApB,QAAgC,qBAAhC;AACA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,mCAA5C;AACA,SAASL,OAAO,IAAIM,cAApB,QAA0C,iCAA1C;AACA,SAASN,OAAO,IAAIO,eAApB,QAA2C,kCAA3C;AACA,SAASP,OAAO,IAAIQ,SAApB,QAAqC,2BAArC,C,CAEA;;AACA,SAASR,OAAO,IAAIS,qBAApB,QAAiD,iCAAjD;AACA,SAAST,OAAO,IAAIU,cAApB,QAA0C,2BAA1C;AACA,SAASV,OAAO,IAAIW,kBAApB,QAA8C,+BAA9C;AACA,SAASX,OAAO,IAAIY,uBAApB,QAAmD,oBAAnD;AACA,SAASZ,OAAO,IAAIa,WAApB,QAAuC,sBAAvC;AACA,SAASb,OAAO,IAAIc,yBAApB,QAAqD,sBAArD;AACA,SAASd,OAAO,IAAIe,eAApB,QAA2C,4BAA3C;AACA,SAASf,OAAO,IAAIgB,6BAApB,QAAyD,2BAAzD;AACA,SAAShB,OAAO,IAAIiB,cAApB,QAA0C,0BAA1C;AACA,SAASjB,OAAO,IAAIkB,aAApB,QAAyC,yBAAzC;AACA,SAASlB,OAAO,IAAImB,yBAApB,QAAqD,sCAArD;AACA,SAASnB,OAAO,IAAIoB,mBAApB,QAA+C,+BAA/C;AACA,SAASpB,OAAO,IAAIqB,aAApB,QAAyC,yBAAzC;AACA,SAASrB,OAAO,IAAIsB,WAApB,QAAuC,sBAAvC;AACA,SAAStB,OAAO,IAAIuB,gBAApB,QAA4C,4BAA5C;AACA,SAASvB,OAAO,IAAIwB,gBAApB,QAA4C,4BAA5C;AACA,SAASxB,OAAO,IAAIyB,iBAApB,QAA6C,6BAA7C;AACA,SAASzB,OAAO,IAAI0B,YAApB,QAAwC,wBAAxC;AACA,SAAS1B,OAAO,IAAI2B,eAApB,QAA2C,4BAA3C;AACA,SAAS3B,OAAO,IAAI4B,WAApB,QAAuC,sBAAvC;AACA,SAAS5B,OAAO,IAAI6B,WAApB,QAAuC,sBAAvC;AACA,SAAS7B,OAAO,IAAI8B,YAApB,QAAwC,wBAAxC;AACA,SAAS9B,OAAO,IAAI+B,YAApB,QAAwC,wBAAxC;AACA,SAAS/B,OAAO,IAAIgC,yBAApB,QAAqD,uBAArD;AACA,SAAShC,OAAO,IAAIiC,kBAApB,QAA8C,8BAA9C;AACA,SAASjC,OAAO,IAAIkC,gCAApB,QAA4D,+BAA5D","sourcesContent":["// Utils.\nexport { default as createHigherOrderComponent } from './utils/create-higher-order-component';\n\n// Compose helper (aliased flowRight from Lodash)\nexport { default as compose } from './higher-order/compose';\n\n// Higher-order components.\nexport { default as ifCondition } from './higher-order/if-condition';\nexport { default as pure } from './higher-order/pure';\nexport { default as withGlobalEvents } from './higher-order/with-global-events';\nexport { default as withInstanceId } from './higher-order/with-instance-id';\nexport { default as withSafeTimeout } from './higher-order/with-safe-timeout';\nexport { default as withState } from './higher-order/with-state';\n\n// Hooks.\nexport { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';\nexport { default as useCopyOnClick } from './hooks/use-copy-on-click';\nexport { default as useCopyToClipboard } from './hooks/use-copy-to-clipboard';\nexport { default as __experimentalUseDialog } from './hooks/use-dialog';\nexport { default as useDisabled } from './hooks/use-disabled';\nexport { default as __experimentalUseDragging } from './hooks/use-dragging';\nexport { default as useFocusOnMount } from './hooks/use-focus-on-mount';\nexport { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';\nexport { default as useFocusReturn } from './hooks/use-focus-return';\nexport { default as useInstanceId } from './hooks/use-instance-id';\nexport { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';\nexport { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';\nexport { default as useMediaQuery } from './hooks/use-media-query';\nexport { default as usePrevious } from './hooks/use-previous';\nexport { default as useReducedMotion } from './hooks/use-reduced-motion';\nexport { default as useViewportMatch } from './hooks/use-viewport-match';\nexport { default as useResizeObserver } from './hooks/use-resize-observer';\nexport { default as useAsyncList } from './hooks/use-async-list';\nexport { default as useWarnOnChange } from './hooks/use-warn-on-change';\nexport { default as useDebounce } from './hooks/use-debounce';\nexport { default as useThrottle } from './hooks/use-throttle';\nexport { default as useMergeRefs } from './hooks/use-merge-refs';\nexport { default as useRefEffect } from './hooks/use-ref-effect';\nexport { default as __experimentalUseDropZone } from './hooks/use-drop-zone';\nexport { default as useFocusableIframe } from './hooks/use-focusable-iframe';\nexport { default as __experimentalUseFixedWindowList } from './hooks/use-fixed-window-list';\n"]}
@@ -26,5 +26,6 @@ export { default as usePreferredColorScheme } from './hooks/use-preferred-color-
26
26
  export { default as usePreferredColorSchemeStyle } from './hooks/use-preferred-color-scheme-style';
27
27
  export { default as useResizeObserver } from './hooks/use-resize-observer';
28
28
  export { default as useDebounce } from './hooks/use-debounce';
29
+ export { default as useThrottle } from './hooks/use-throttle';
29
30
  export { default as useMergeRefs } from './hooks/use-merge-refs';
30
31
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/index.native.js"],"names":["default","createHigherOrderComponent","compose","ifCondition","pure","withGlobalEvents","withInstanceId","withSafeTimeout","withState","withPreferredColorScheme","useConstrainedTabbing","__experimentalUseDragging","__experimentalUseFocusOutside","useInstanceId","useIsomorphicLayoutEffect","useKeyboardShortcut","useMediaQuery","usePrevious","useReducedMotion","useViewportMatch","useAsyncList","usePreferredColorScheme","usePreferredColorSchemeStyle","useResizeObserver","useDebounce","useMergeRefs"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,0BAApB,QAAsD,uCAAtD,C,CAEA;;AACA,SAASD,OAAO,IAAIE,OAApB,QAAmC,wBAAnC,C,CAEA;;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,6BAAvC;AACA,SAASH,OAAO,IAAII,IAApB,QAAgC,qBAAhC;AACA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,mCAA5C;AACA,SAASL,OAAO,IAAIM,cAApB,QAA0C,iCAA1C;AACA,SAASN,OAAO,IAAIO,eAApB,QAA2C,kCAA3C;AACA,SAASP,OAAO,IAAIQ,SAApB,QAAqC,2BAArC;AACA,SAASR,OAAO,IAAIS,wBAApB,QAAoD,4CAApD,C,CAEA;;AACA,SAAST,OAAO,IAAIU,qBAApB,QAAiD,iCAAjD;AACA,SAASV,OAAO,IAAIW,yBAApB,QAAqD,sBAArD;AACA,SAASX,OAAO,IAAIY,6BAApB,QAAyD,2BAAzD;AACA,SAASZ,OAAO,IAAIa,aAApB,QAAyC,yBAAzC;AACA,SAASb,OAAO,IAAIc,yBAApB,QAAqD,sCAArD;AACA,SAASd,OAAO,IAAIe,mBAApB,QAA+C,+BAA/C;AACA,SAASf,OAAO,IAAIgB,aAApB,QAAyC,yBAAzC;AACA,SAAShB,OAAO,IAAIiB,WAApB,QAAuC,sBAAvC;AACA,SAASjB,OAAO,IAAIkB,gBAApB,QAA4C,4BAA5C;AACA,SAASlB,OAAO,IAAImB,gBAApB,QAA4C,4BAA5C;AACA,SAASnB,OAAO,IAAIoB,YAApB,QAAwC,wBAAxC;AACA,SAASpB,OAAO,IAAIqB,uBAApB,QAAmD,oCAAnD;AACA,SAASrB,OAAO,IAAIsB,4BAApB,QAAwD,0CAAxD;AACA,SAAStB,OAAO,IAAIuB,iBAApB,QAA6C,6BAA7C;AACA,SAASvB,OAAO,IAAIwB,WAApB,QAAuC,sBAAvC;AACA,SAASxB,OAAO,IAAIyB,YAApB,QAAwC,wBAAxC","sourcesContent":["// Utils.\nexport { default as createHigherOrderComponent } from './utils/create-higher-order-component';\n\n// Compose helper (aliased flowRight from Lodash)\nexport { default as compose } from './higher-order/compose';\n\n// Higher-order components.\nexport { default as ifCondition } from './higher-order/if-condition';\nexport { default as pure } from './higher-order/pure';\nexport { default as withGlobalEvents } from './higher-order/with-global-events';\nexport { default as withInstanceId } from './higher-order/with-instance-id';\nexport { default as withSafeTimeout } from './higher-order/with-safe-timeout';\nexport { default as withState } from './higher-order/with-state';\nexport { default as withPreferredColorScheme } from './higher-order/with-preferred-color-scheme';\n\n// Hooks.\nexport { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';\nexport { default as __experimentalUseDragging } from './hooks/use-dragging';\nexport { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';\nexport { default as useInstanceId } from './hooks/use-instance-id';\nexport { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';\nexport { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';\nexport { default as useMediaQuery } from './hooks/use-media-query';\nexport { default as usePrevious } from './hooks/use-previous';\nexport { default as useReducedMotion } from './hooks/use-reduced-motion';\nexport { default as useViewportMatch } from './hooks/use-viewport-match';\nexport { default as useAsyncList } from './hooks/use-async-list';\nexport { default as usePreferredColorScheme } from './hooks/use-preferred-color-scheme';\nexport { default as usePreferredColorSchemeStyle } from './hooks/use-preferred-color-scheme-style';\nexport { default as useResizeObserver } from './hooks/use-resize-observer';\nexport { default as useDebounce } from './hooks/use-debounce';\nexport { default as useMergeRefs } from './hooks/use-merge-refs';\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/index.native.js"],"names":["default","createHigherOrderComponent","compose","ifCondition","pure","withGlobalEvents","withInstanceId","withSafeTimeout","withState","withPreferredColorScheme","useConstrainedTabbing","__experimentalUseDragging","__experimentalUseFocusOutside","useInstanceId","useIsomorphicLayoutEffect","useKeyboardShortcut","useMediaQuery","usePrevious","useReducedMotion","useViewportMatch","useAsyncList","usePreferredColorScheme","usePreferredColorSchemeStyle","useResizeObserver","useDebounce","useThrottle","useMergeRefs"],"mappings":"AAAA;AACA,SAASA,OAAO,IAAIC,0BAApB,QAAsD,uCAAtD,C,CAEA;;AACA,SAASD,OAAO,IAAIE,OAApB,QAAmC,wBAAnC,C,CAEA;;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,6BAAvC;AACA,SAASH,OAAO,IAAII,IAApB,QAAgC,qBAAhC;AACA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,mCAA5C;AACA,SAASL,OAAO,IAAIM,cAApB,QAA0C,iCAA1C;AACA,SAASN,OAAO,IAAIO,eAApB,QAA2C,kCAA3C;AACA,SAASP,OAAO,IAAIQ,SAApB,QAAqC,2BAArC;AACA,SAASR,OAAO,IAAIS,wBAApB,QAAoD,4CAApD,C,CAEA;;AACA,SAAST,OAAO,IAAIU,qBAApB,QAAiD,iCAAjD;AACA,SAASV,OAAO,IAAIW,yBAApB,QAAqD,sBAArD;AACA,SAASX,OAAO,IAAIY,6BAApB,QAAyD,2BAAzD;AACA,SAASZ,OAAO,IAAIa,aAApB,QAAyC,yBAAzC;AACA,SAASb,OAAO,IAAIc,yBAApB,QAAqD,sCAArD;AACA,SAASd,OAAO,IAAIe,mBAApB,QAA+C,+BAA/C;AACA,SAASf,OAAO,IAAIgB,aAApB,QAAyC,yBAAzC;AACA,SAAShB,OAAO,IAAIiB,WAApB,QAAuC,sBAAvC;AACA,SAASjB,OAAO,IAAIkB,gBAApB,QAA4C,4BAA5C;AACA,SAASlB,OAAO,IAAImB,gBAApB,QAA4C,4BAA5C;AACA,SAASnB,OAAO,IAAIoB,YAApB,QAAwC,wBAAxC;AACA,SAASpB,OAAO,IAAIqB,uBAApB,QAAmD,oCAAnD;AACA,SAASrB,OAAO,IAAIsB,4BAApB,QAAwD,0CAAxD;AACA,SAAStB,OAAO,IAAIuB,iBAApB,QAA6C,6BAA7C;AACA,SAASvB,OAAO,IAAIwB,WAApB,QAAuC,sBAAvC;AACA,SAASxB,OAAO,IAAIyB,WAApB,QAAuC,sBAAvC;AACA,SAASzB,OAAO,IAAI0B,YAApB,QAAwC,wBAAxC","sourcesContent":["// Utils.\nexport { default as createHigherOrderComponent } from './utils/create-higher-order-component';\n\n// Compose helper (aliased flowRight from Lodash)\nexport { default as compose } from './higher-order/compose';\n\n// Higher-order components.\nexport { default as ifCondition } from './higher-order/if-condition';\nexport { default as pure } from './higher-order/pure';\nexport { default as withGlobalEvents } from './higher-order/with-global-events';\nexport { default as withInstanceId } from './higher-order/with-instance-id';\nexport { default as withSafeTimeout } from './higher-order/with-safe-timeout';\nexport { default as withState } from './higher-order/with-state';\nexport { default as withPreferredColorScheme } from './higher-order/with-preferred-color-scheme';\n\n// Hooks.\nexport { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';\nexport { default as __experimentalUseDragging } from './hooks/use-dragging';\nexport { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';\nexport { default as useInstanceId } from './hooks/use-instance-id';\nexport { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';\nexport { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';\nexport { default as useMediaQuery } from './hooks/use-media-query';\nexport { default as usePrevious } from './hooks/use-previous';\nexport { default as useReducedMotion } from './hooks/use-reduced-motion';\nexport { default as useViewportMatch } from './hooks/use-viewport-match';\nexport { default as useAsyncList } from './hooks/use-async-list';\nexport { default as usePreferredColorScheme } from './hooks/use-preferred-color-scheme';\nexport { default as usePreferredColorSchemeStyle } from './hooks/use-preferred-color-scheme-style';\nexport { default as useResizeObserver } from './hooks/use-resize-observer';\nexport { default as useDebounce } from './hooks/use-debounce';\nexport { default as useThrottle } from './hooks/use-throttle';\nexport { default as useMergeRefs } from './hooks/use-merge-refs';\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Higher-order component creator, creating a new component which renders if
4
3
  * the given condition is satisfied or with the given optional prop name.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higher-order/if-condition/index.tsx"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,WAAW,qEACgB,OAAO,2HAWtC,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higher-order/if-condition/index.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,WAAW,qEACgB,OAAO,2HAWtC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * A Higher Order Component used to be provide a unique instance ID by
4
3
  * component.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higher-order/with-instance-id/index.tsx"],"names":[],"mappings":";AAMA;;;GAGG;AACH,QAAA,MAAM,cAAc;gBACP,MAAM,GAAG,MAAM;qHAOP,CAAC;AAEtB,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higher-order/with-instance-id/index.tsx"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,cAAc;gBACP,MAAM,GAAG,MAAM;qHAOP,CAAC;AAEtB,eAAe,cAAc,CAAC"}
@@ -3,11 +3,13 @@
3
3
  * (input fields, links, buttons, etc.) need to be disabled. This hook adds the
4
4
  * behavior to disable nested DOM elements to the returned ref.
5
5
  *
6
+ * @param {Object} config Configuration object.
7
+ * @param {boolean=} config.isDisabled Whether the element should be disabled.
6
8
  * @return {import('react').RefCallback<HTMLElement>} Element Ref.
7
9
  *
8
10
  * @example
9
11
  * ```js
10
- * import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';
12
+ * import { useDisabled } from '@wordpress/compose';
11
13
  * const DisabledExample = () => {
12
14
  * const disabledRef = useDisabled();
13
15
  * return (
@@ -19,5 +21,7 @@
19
21
  * };
20
22
  * ```
21
23
  */
22
- export default function useDisabled(): import('react').RefCallback<HTMLElement>;
24
+ export default function useDisabled({ isDisabled: isDisabledProp, }?: {
25
+ isDisabled?: boolean | undefined;
26
+ }): import('react').RefCallback<HTMLElement>;
23
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-disabled/index.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uCAhBY,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAyEnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-disabled/index.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAjB4B,UAAU,GAA3B,OAAO;IACN,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAiKnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-on-mount/index.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uDAlBW,OAAO,GAAG,cAAc,GACvB,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CA4CnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-on-mount/index.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uDAlBW,OAAO,GAAG,cAAc,GACvB,OAAO,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAiDnD"}
@@ -21,5 +21,5 @@ import type { DependencyList, RefCallback } from 'react';
21
21
  *
22
22
  * @return Ref callback.
23
23
  */
24
- export default function useRefEffect<TElement = Node>(callback: (node: TElement) => (() => void) | undefined, dependencies: DependencyList): RefCallback<TElement | null>;
24
+ export default function useRefEffect<TElement = Node>(callback: (node: TElement) => (() => void) | void, dependencies: DependencyList): RefCallback<TElement | null>;
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-ref-effect/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAOzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,QAAQ,GAAG,IAAI,EACpD,QAAQ,EAAE,CAAE,IAAI,EAAE,QAAQ,KAAM,CAAE,MAAM,IAAI,CAAE,GAAG,SAAS,EAC1D,YAAY,EAAE,cAAc,GAC1B,WAAW,CAAE,QAAQ,GAAG,IAAI,CAAE,CAShC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-ref-effect/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAOzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,QAAQ,GAAG,IAAI,EACpD,QAAQ,EAAE,CAAE,IAAI,EAAE,QAAQ,KAAM,CAAE,MAAM,IAAI,CAAE,GAAG,IAAI,EACrD,YAAY,EAAE,cAAc,GAC1B,WAAW,CAAE,QAAQ,GAAG,IAAI,CAAE,CAShC"}
@@ -1,3 +1,33 @@
1
- export default useResizeAware;
2
- import useResizeAware from "react-resize-aware";
1
+ import type { WPElement } from '@wordpress/element';
2
+ declare global {
3
+ interface ResizeObserverEntry {
4
+ readonly devicePixelContentBoxSize: ReadonlyArray<ResizeObserverSize>;
5
+ }
6
+ }
7
+ /**
8
+ * Hook which allows to listen the resize event of any target element when it changes sizes.
9
+ * _Note: `useResizeObserver` will report `null` until after first render.
10
+ *
11
+ * @example
12
+ *
13
+ * ```js
14
+ * const App = () => {
15
+ * const [ resizeListener, sizes ] = useResizeObserver();
16
+ *
17
+ * return (
18
+ * <div>
19
+ * { resizeListener }
20
+ * Your content here
21
+ * </div>
22
+ * );
23
+ * };
24
+ * ```
25
+ */
26
+ export default function useResizeAware(): [
27
+ WPElement,
28
+ {
29
+ width: number | null;
30
+ height: number | null;
31
+ }
32
+ ];
3
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-resize-observer/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-resize-observer/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA6FpD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,mBAAmB;QAC5B,QAAQ,CAAC,yBAAyB,EAAE,aAAa,CAAE,kBAAkB,CAAE,CAAC;KACxE;CACD;AA4MD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI;IACzC,SAAS;IACT;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAC/C,CAuBA"}
@@ -10,7 +10,7 @@ export { default as useConstrainedTabbing } from "./hooks/use-constrained-tabbin
10
10
  export { default as useCopyOnClick } from "./hooks/use-copy-on-click";
11
11
  export { default as useCopyToClipboard } from "./hooks/use-copy-to-clipboard";
12
12
  export { default as __experimentalUseDialog } from "./hooks/use-dialog";
13
- export { default as __experimentalUseDisabled } from "./hooks/use-disabled";
13
+ export { default as useDisabled } from "./hooks/use-disabled";
14
14
  export { default as __experimentalUseDragging } from "./hooks/use-dragging";
15
15
  export { default as useFocusOnMount } from "./hooks/use-focus-on-mount";
16
16
  export { default as __experimentalUseFocusOutside } from "./hooks/use-focus-outside";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/compose",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "WordPress higher-order components (HOCs).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -32,16 +32,15 @@
32
32
  "@babel/runtime": "^7.16.0",
33
33
  "@types/lodash": "^4.14.172",
34
34
  "@types/mousetrap": "^1.6.8",
35
- "@wordpress/deprecated": "^3.8.0",
36
- "@wordpress/dom": "^3.8.0",
37
- "@wordpress/element": "^4.6.0",
38
- "@wordpress/is-shallow-equal": "^4.8.0",
39
- "@wordpress/keycodes": "^3.8.0",
40
- "@wordpress/priority-queue": "^2.8.0",
35
+ "@wordpress/deprecated": "^3.9.0",
36
+ "@wordpress/dom": "^3.9.0",
37
+ "@wordpress/element": "^4.7.0",
38
+ "@wordpress/is-shallow-equal": "^4.9.0",
39
+ "@wordpress/keycodes": "^3.9.0",
40
+ "@wordpress/priority-queue": "^2.9.0",
41
41
  "clipboard": "^2.0.8",
42
42
  "lodash": "^4.17.21",
43
43
  "mousetrap": "^1.6.5",
44
- "react-resize-aware": "^3.1.0",
45
44
  "use-memo-one": "^1.1.1"
46
45
  },
47
46
  "peerDependencies": {
@@ -50,5 +49,5 @@
50
49
  "publishConfig": {
51
50
  "access": "public"
52
51
  },
53
- "gitHead": "4631d515033397fcfeda77e5755960253caef9bf"
52
+ "gitHead": "198fa129cf1af8dc615918987ea6795cd40ab7df"
54
53
  }
@@ -37,11 +37,13 @@ const DISABLED_ELIGIBLE_NODE_NAMES = [
37
37
  * (input fields, links, buttons, etc.) need to be disabled. This hook adds the
38
38
  * behavior to disable nested DOM elements to the returned ref.
39
39
  *
40
+ * @param {Object} config Configuration object.
41
+ * @param {boolean=} config.isDisabled Whether the element should be disabled.
40
42
  * @return {import('react').RefCallback<HTMLElement>} Element Ref.
41
43
  *
42
44
  * @example
43
45
  * ```js
44
- * import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose';
46
+ * import { useDisabled } from '@wordpress/compose';
45
47
  * const DisabledExample = () => {
46
48
  * const disabledRef = useDisabled();
47
49
  * return (
@@ -53,61 +55,149 @@ const DISABLED_ELIGIBLE_NODE_NAMES = [
53
55
  * };
54
56
  * ```
55
57
  */
56
- export default function useDisabled() {
57
- return useRefEffect( ( node ) => {
58
- const disable = () => {
59
- node.style.setProperty( 'user-select', 'none' );
60
- node.style.setProperty( '-webkit-user-select', 'none' );
61
- focus.focusable.find( node ).forEach( ( focusable ) => {
62
- if (
63
- includes( DISABLED_ELIGIBLE_NODE_NAMES, focusable.nodeName )
64
- ) {
65
- focusable.setAttribute( 'disabled', '' );
66
- }
58
+ export default function useDisabled( {
59
+ isDisabled: isDisabledProp = false,
60
+ } = {} ) {
61
+ return useRefEffect(
62
+ ( node ) => {
63
+ if ( isDisabledProp ) {
64
+ return;
65
+ }
67
66
 
68
- if ( focusable.nodeName === 'A' ) {
69
- focusable.setAttribute( 'tabindex', '-1' );
70
- }
67
+ /** A variable keeping track of the previous updates in order to restore them. */
68
+ /** @type {Function[]} */
69
+ const updates = [];
71
70
 
72
- const tabIndex = focusable.getAttribute( 'tabindex' );
73
- if ( tabIndex !== null && tabIndex !== '-1' ) {
74
- focusable.removeAttribute( 'tabindex' );
71
+ const disable = () => {
72
+ if ( node.style.getPropertyValue( 'user-select' ) !== 'none' ) {
73
+ const previousValue = node.style.getPropertyValue(
74
+ 'user-select'
75
+ );
76
+ node.style.setProperty( 'user-select', 'none' );
77
+ node.style.setProperty( '-webkit-user-select', 'none' );
78
+ updates.push( () => {
79
+ if ( ! node.isConnected ) {
80
+ return;
81
+ }
82
+ node.style.setProperty( 'user-select', previousValue );
83
+ node.style.setProperty(
84
+ '-webkit-user-select',
85
+ previousValue
86
+ );
87
+ } );
75
88
  }
76
89
 
77
- if ( focusable.hasAttribute( 'contenteditable' ) ) {
78
- focusable.setAttribute( 'contenteditable', 'false' );
79
- }
90
+ focus.focusable.find( node ).forEach( ( focusable ) => {
91
+ if (
92
+ includes(
93
+ DISABLED_ELIGIBLE_NODE_NAMES,
94
+ focusable.nodeName
95
+ ) &&
96
+ // @ts-ignore
97
+ ! focusable.disabled
98
+ ) {
99
+ focusable.setAttribute( 'disabled', '' );
100
+ updates.push( () => {
101
+ if ( ! focusable.isConnected ) {
102
+ return;
103
+ }
104
+ // @ts-ignore
105
+ focusable.disabled = false;
106
+ } );
107
+ }
80
108
 
81
- if (
82
- node.ownerDocument.defaultView?.HTMLElement &&
83
- focusable instanceof
84
- node.ownerDocument.defaultView.HTMLElement
85
- ) {
86
- focusable.style.setProperty( 'pointer-events', 'none' );
87
- }
88
- } );
89
- };
109
+ if (
110
+ focusable.nodeName === 'A' &&
111
+ focusable.getAttribute( 'tabindex' ) !== '-1'
112
+ ) {
113
+ const previousValue = focusable.getAttribute(
114
+ 'tabindex'
115
+ );
116
+ focusable.setAttribute( 'tabindex', '-1' );
117
+ updates.push( () => {
118
+ if ( ! focusable.isConnected ) {
119
+ return;
120
+ }
121
+ if ( ! previousValue ) {
122
+ focusable.removeAttribute( 'tabindex' );
123
+ } else {
124
+ focusable.setAttribute(
125
+ 'tabindex',
126
+ previousValue
127
+ );
128
+ }
129
+ } );
130
+ }
90
131
 
91
- // Debounce re-disable since disabling process itself will incur
92
- // additional mutations which should be ignored.
93
- const debouncedDisable = debounce( disable, undefined, {
94
- leading: true,
95
- } );
96
- disable();
132
+ const tabIndex = focusable.getAttribute( 'tabindex' );
133
+ if ( tabIndex !== null && tabIndex !== '-1' ) {
134
+ focusable.removeAttribute( 'tabindex' );
135
+ updates.push( () => {
136
+ if ( ! focusable.isConnected ) {
137
+ return;
138
+ }
139
+ focusable.setAttribute( 'tabindex', tabIndex );
140
+ } );
141
+ }
97
142
 
98
- /** @type {MutationObserver | undefined} */
99
- const observer = new window.MutationObserver( debouncedDisable );
100
- observer.observe( node, {
101
- childList: true,
102
- attributes: true,
103
- subtree: true,
104
- } );
143
+ if (
144
+ focusable.hasAttribute( 'contenteditable' ) &&
145
+ focusable.getAttribute( 'contenteditable' ) !== 'false'
146
+ ) {
147
+ focusable.setAttribute( 'contenteditable', 'false' );
148
+ updates.push( () => {
149
+ if ( ! focusable.isConnected ) {
150
+ return;
151
+ }
152
+ focusable.setAttribute( 'contenteditable', 'true' );
153
+ } );
154
+ }
105
155
 
106
- return () => {
107
- if ( observer ) {
108
- observer.disconnect();
109
- }
110
- debouncedDisable.cancel();
111
- };
112
- }, [] );
156
+ if (
157
+ node.ownerDocument.defaultView?.HTMLElement &&
158
+ focusable instanceof
159
+ node.ownerDocument.defaultView.HTMLElement
160
+ ) {
161
+ const previousValue = focusable.style.getPropertyValue(
162
+ 'pointer-events'
163
+ );
164
+ focusable.style.setProperty( 'pointer-events', 'none' );
165
+ updates.push( () => {
166
+ if ( ! focusable.isConnected ) {
167
+ return;
168
+ }
169
+ focusable.style.setProperty(
170
+ 'pointer-events',
171
+ previousValue
172
+ );
173
+ } );
174
+ }
175
+ } );
176
+ };
177
+
178
+ // Debounce re-disable since disabling process itself will incur
179
+ // additional mutations which should be ignored.
180
+ const debouncedDisable = debounce( disable, undefined, {
181
+ leading: true,
182
+ } );
183
+ disable();
184
+
185
+ /** @type {MutationObserver | undefined} */
186
+ const observer = new window.MutationObserver( debouncedDisable );
187
+ observer.observe( node, {
188
+ childList: true,
189
+ attributes: true,
190
+ subtree: true,
191
+ } );
192
+
193
+ return () => {
194
+ if ( observer ) {
195
+ observer.disconnect();
196
+ }
197
+ debouncedDisable.cancel();
198
+ updates.forEach( ( update ) => update() );
199
+ };
200
+ },
201
+ [ isDisabledProp ]
202
+ );
113
203
  }
@@ -50,6 +50,11 @@ export default function useFocusOnMount( focusOnMount = 'firstElement' ) {
50
50
  }
51
51
  }
52
52
 
53
- target.focus();
53
+ target.focus( {
54
+ // When focusing newly mounted dialogs,
55
+ // the position of the popover is often not right on the first render
56
+ // This prevents the layout shifts when focusing the dialogs.
57
+ preventScroll: true,
58
+ } );
54
59
  }, [] );
55
60
  }
@@ -28,10 +28,10 @@ import { useCallback, useRef } from '@wordpress/element';
28
28
  * @return Ref callback.
29
29
  */
30
30
  export default function useRefEffect< TElement = Node >(
31
- callback: ( node: TElement ) => ( () => void ) | undefined,
31
+ callback: ( node: TElement ) => ( () => void ) | void,
32
32
  dependencies: DependencyList
33
33
  ): RefCallback< TElement | null > {
34
- const cleanup = useRef< ( () => void ) | undefined >();
34
+ const cleanup = useRef< ( () => void ) | void >();
35
35
  return useCallback( ( node: TElement | null ) => {
36
36
  if ( node ) {
37
37
  cleanup.current = callback( node );
@@ -10,8 +10,6 @@ import { useState, useCallback } from '@wordpress/element';
10
10
  /**
11
11
  * Hook which allows to listen the resize event of any target element when it changes sizes.
12
12
  *
13
- * @return {[JSX.Element, { width: number, height: number } | null]} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height`
14
- *
15
13
  * @example
16
14
  *
17
15
  * ```js