Skip to content

Commit

Permalink
[joy-ui][Box] Added boxClasses (mui#39895)
Browse files Browse the repository at this point in the history
  • Loading branch information
sadik-malik authored Nov 17, 2023
1 parent 9a805ae commit 597b787
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/pages/joy-ui/api/box.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"name": "Box",
"imports": ["import Box from '@mui/joy/Box';", "import { Box } from '@mui/joy';"],
"styles": { "classes": [], "globalClasses": {}, "name": null },
"styles": { "classes": ["root"], "globalClasses": {}, "name": "MuiBox" },
"spread": true,
"themeDefaultProps": false,
"muiName": "JoyBox",
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs-joy/box/box.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"description": "The system prop that allows defining system overrides as well as additional CSS styles."
}
},
"classDescriptions": {}
"classDescriptions": { "root": { "description": "Class name applied to the root element." } }
}
3 changes: 2 additions & 1 deletion packages/mui-joy/src/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { unstable_ClassNameGenerator as ClassNameGenerator } from '../className'
import { Theme } from '../styles/types';
import defaultTheme from '../styles/defaultTheme';
import THEME_ID from '../styles/identifier';
import boxClasses from './boxClasses';
/**
*
* Demos:
Expand All @@ -18,7 +19,7 @@ import THEME_ID from '../styles/identifier';
const Box = createBox<Theme>({
themeId: THEME_ID,
defaultTheme,
defaultClassName: 'MuiBox-root',
defaultClassName: boxClasses.root,
generateClassName: ClassNameGenerator.generate,
});

Expand Down
12 changes: 12 additions & 0 deletions packages/mui-joy/src/Box/boxClasses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';

export interface BoxClasses {
/** Class name applied to the root element. */
root: string;
}

export type BoxClassKey = keyof BoxClasses;

const boxClasses: BoxClasses = generateUtilityClasses('MuiBox', ['root']);

export default boxClasses;
3 changes: 3 additions & 0 deletions packages/mui-joy/src/Box/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
'use client';
export { default } from './Box';
export * from './BoxProps';

export { default as boxClasses } from './boxClasses';
export * from './boxClasses';

0 comments on commit 597b787

Please sign in to comment.