@wordpress/components
Version:
UI components for WordPress.
23 lines (22 loc) • 867 B
JavaScript
import { createHigherOrderComponent, useDebounce } from "@wordpress/compose";
import { speak } from "@wordpress/a11y";
import { jsx } from "react/jsx-runtime";
// packages/components/src/higher-order/with-spoken-messages/index.tsx
/**
* A Higher Order Component used to provide speak and debounced speak functions.
*
* @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak
*
* @param {React.ComponentType} Component The component to be wrapped.
*
* @return {React.ComponentType} The wrapped component.
*/
var with_spoken_messages_default = createHigherOrderComponent((Component) => function WithSpokenMessages(props) {
return /* @__PURE__ */ jsx(Component, {
...props,
speak,
debouncedSpeak: useDebounce(speak, 500)
});
}, "withSpokenMessages");
export { with_spoken_messages_default as default };
//# sourceMappingURL=index.mjs.map