UNPKG

@wordpress/components

Version:
47 lines (46 loc) • 1.34 kB
import deprecated from "@wordpress/deprecated"; import { contextConnect } from "../context/index.mjs"; import { View } from "../view/index.mjs"; import { useSurface } from "./hook.mjs"; import { jsx } from "react/jsx-runtime"; // packages/components/src/surface/component.tsx function UnconnectedSurface(props, forwardedRef) { deprecated("wp.components.__experimentalSurface", { since: "7.2", version: "7.4" }); const surfaceProps = useSurface(props); return /* @__PURE__ */ jsx(View, { ...surfaceProps, ref: forwardedRef }); } /** * `Surface` is a core component that renders a primary background color. * * This component is deprecated. Write your own CSS instead, * preferably using the [design tokens](https://wordpress.github.io/gutenberg/?path=/docs/design-system-tokens-introduction--docs) * available in `@wordpress/theme`. * * @deprecated * * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode). * * ```jsx * import { * __experimentalSurface as Surface, * __experimentalText as Text, * } from '@wordpress/components'; * * function Example() { * return ( * <Surface> * <Text>Code is Poetry</Text> * </Surface> * ); * } * ``` */ const Surface = contextConnect(UnconnectedSurface, "Surface"); export { Surface, Surface as default }; //# sourceMappingURL=component.mjs.map