/**
 * The function generates a list of CSS class names separated with a space for component identified by componentName based on provided props.
 * It accepts an optional className prop that will be included in the result if provided. All generated class names are prefixed with "pega-".
 * The function also accepts key-value pairs of props used to generate additional CSS classes.
 * @param componentName name of the component to be used as a root CSS class
 * @param classNameProp optional className prop which value will be copied to the result string
 * @param props optional props object used to generate additional CSS classes
 * @param props.key the key of the prop to be included in the CSS class
 * @param props.value the value of the prop to be appended to the CSS class
 * @returns a string of class names separated by a space
 */
const createClassName = (componentName, classNameProp, props) => {
    const baseClassName = `pega-${componentName}`;
    return Object.entries(props ?? {})
        .reduce((classNames, [propName, propValue]) => {
        if (typeof propValue === 'string') {
            classNames.push(`${baseClassName}-${propName}-${propValue}`);
        }
        else if (propValue === true) {
            classNames.push(`${baseClassName}-${propName}`);
        }
        return classNames;
    }, classNameProp ? [classNameProp, baseClassName] : [baseClassName])
        .join(' ');
};
export default createClassName;
//# sourceMappingURL=createClassName.js.map