@patternfly/react-charts
Version:
This library provides a set of React chart components for use with the PatternFly reference implementation.
30 lines • 1.07 kB
JavaScript
;
// Misc util functions
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClassName = exports.canUseDOM = void 0;
/**
* Copied from exenv
*
* @private Not intended as public API and subject to change
*/
exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Returns the class name that will be applied to the outermost div rendered by the chart's container
*
* @private Not intended as public API and subject to change
*/
const getClassName = ({ className }) => {
let cleanClassName;
// Workaround for VictoryContainer class name
if (className) {
cleanClassName = className
.replace(/VictoryContainer/g, '')
.replace(/pf-v6-c-chart/g, '')
.replace(/pf-c-chart/g, '')
.replace(/\s+/g, ' ')
.trim();
}
return cleanClassName && cleanClassName.length ? `pf-v6-c-chart ${cleanClassName}` : 'pf-v6-c-chart';
};
exports.getClassName = getClassName;
//# sourceMappingURL=chart-helpers.js.map