UNPKG

600 BJavaScriptView Raw
1import { globalStateClasses } from '@mui/utils/generateUtilityClass';
2const GLOBAL_CLASS_PREFIX = 'base';
3function buildStateClass(state) {
4 return `${GLOBAL_CLASS_PREFIX}--${state}`;
5}
6function buildSlotClass(componentName, slot) {
7 return `${GLOBAL_CLASS_PREFIX}-${componentName}-${slot}`;
8}
9export function generateUtilityClass(componentName, slot) {
10 const globalStateClass = globalStateClasses[slot];
11 return globalStateClass ? buildStateClass(globalStateClass) : buildSlotClass(componentName, slot);
12}
13export function isGlobalState(slot) {
14 return globalStateClasses[slot] !== undefined;
15}
\No newline at end of file