UNPKG

@wordpress/components

Version:
34 lines (33 loc) • 883 B
import { COMPONENT_NAMESPACE, CONNECTED_NAMESPACE } from "./constants.mjs"; // packages/components/src/context/utils.ts /** * Creates a dedicated context namespace HTML attribute for components. * ns is short for "namespace" * * @example * ```jsx * <div {...ns('Container')} /> * ``` * * @param componentName The name for the component. * @return A props object with the namespaced HTML attribute. */ function getNamespace(componentName) { return { [COMPONENT_NAMESPACE]: componentName }; } /** * Creates a dedicated connected context namespace HTML attribute for components. * ns is short for "namespace" * * @example * ```jsx * <div {...cns()} /> * ``` * * @return A props object with the namespaced HTML attribute. */ function getConnectedNamespace() { return { [CONNECTED_NAMESPACE]: true }; } export { getConnectedNamespace, getNamespace }; //# sourceMappingURL=utils.mjs.map