@wordpress/components
Version:
UI components for WordPress.
32 lines (31 loc) • 1.4 kB
JavaScript
import { forwardRef, useRef } from "@wordpress/element";
import { useMergeRefs } from "@wordpress/compose";
import deprecated from "@wordpress/deprecated";
import { ControlWithError } from "@wordpress/ui";
import TextareaControl from "../../textarea-control/index.mjs";
import { jsx } from "react/jsx-runtime";
// packages/components/src/validated-form-controls/components/textarea-control.tsx
const UnforwardedValidatedTextareaControl = ({ required, customValidity, markWhenOptional, ...restProps }, forwardedRef) => {
deprecated("wp.components.privateApis.ValidatedTextareaControl", {
since: "7.2",
alternative: "ValidatedTextareaControl from @wordpress/ui",
hint: "This private API will be completely removed within a few Gutenberg plugin releases."
});
const validityTargetRef = useRef(null);
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
return /* @__PURE__ */ jsx(ControlWithError, {
className: "components-validated-control",
required,
markWhenOptional,
customValidity,
getValidityTarget: () => validityTargetRef.current,
children: /* @__PURE__ */ jsx(TextareaControl, {
ref: mergedRefs,
...restProps
})
});
};
const ValidatedTextareaControl = forwardRef(UnforwardedValidatedTextareaControl);
ValidatedTextareaControl.displayName = "ValidatedTextareaControl";
export { ValidatedTextareaControl };
//# sourceMappingURL=textarea-control.mjs.map