22 lines
738 B
JavaScript
22 lines
738 B
JavaScript
|
import ClassNameGenerator from '../ClassNameGenerator';
|
||
|
export const globalStateClasses = {
|
||
|
active: 'active',
|
||
|
checked: 'checked',
|
||
|
completed: 'completed',
|
||
|
disabled: 'disabled',
|
||
|
error: 'error',
|
||
|
expanded: 'expanded',
|
||
|
focused: 'focused',
|
||
|
focusVisible: 'focusVisible',
|
||
|
open: 'open',
|
||
|
readOnly: 'readOnly',
|
||
|
required: 'required',
|
||
|
selected: 'selected'
|
||
|
};
|
||
|
export default function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
|
||
|
const globalStateClass = globalStateClasses[slot];
|
||
|
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
|
||
|
}
|
||
|
export function isGlobalState(slot) {
|
||
|
return globalStateClasses[slot] !== undefined;
|
||
|
}
|