@wordpress/components
Version:
UI components for WordPress.
26 lines (25 loc) • 1.08 kB
JavaScript
import { useMergeRefs } from "@wordpress/compose";
import { forwardRef, useRef } from "@wordpress/element";
import { ControlWithError } from "@wordpress/ui";
import RangeControl from "../../range-control/index.mjs";
import { jsx } from "react/jsx-runtime";
// packages/components/src/validated-form-controls/components/range-control.tsx
const UnforwardedValidatedRangeControl = ({ required, customValidity, markWhenOptional, ...restProps }, forwardedRef) => {
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(RangeControl, {
ref: mergedRefs,
...restProps
})
});
};
const ValidatedRangeControl = forwardRef(UnforwardedValidatedRangeControl);
ValidatedRangeControl.displayName = "ValidatedRangeControl";
export { ValidatedRangeControl };
//# sourceMappingURL=range-control.mjs.map