@wordpress/components
Version:
UI components for WordPress.
34 lines (33 loc) • 883 B
JavaScript
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