@wordpress/components
Version:
UI components for WordPress.
40 lines (39 loc) • 1.06 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let __constants_ts = require("./constants.cjs");
// 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 { [__constants_ts.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 { [__constants_ts.CONNECTED_NAMESPACE]: true };
}
exports.getConnectedNamespace = getConnectedNamespace;
exports.getNamespace = getNamespace;
//# sourceMappingURL=utils.cjs.map