@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
29 lines (28 loc) • 1.08 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let __provider_tsx = require("./provider.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
// packages/global-styles-ui/src/with-global-styles-provider.tsx
/**
* Higher-order component that wraps a component with GlobalStylesProvider.
* This allows components to access GlobalStylesContext without exposing
* the provider directly in the public API.
*
* @param Component - The component to wrap
* @return A wrapped component that accepts value, baseValue, and onChange props
*/
function withGlobalStylesProvider(Component) {
return function WrappedComponent({ value, baseValue, onChange, ...props }) {
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__provider_tsx.GlobalStylesProvider, {
value,
baseValue,
onChange,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...props })
});
};
}
exports.withGlobalStylesProvider = withGlobalStylesProvider;
//# sourceMappingURL=with-global-styles-provider.cjs.map