@@ -16,6 +16,7 @@ import { AnimatePresence } from 'motion/react';
1616 * @param title - Title to display in the header
1717 * @param type - How the side sheet should be position, default is standard
1818 * @param headerElements - Optional spot to put elements in the header, for example more action buttons
19+ * @param width - Optional width override (number is treated as px)
1920 * @param children - Content in the side sheet
2021 */
2122export const SideSheet : FC < SideSheetProps > = ( {
@@ -24,6 +25,7 @@ export const SideSheet: FC<SideSheetProps> = ({
2425 title,
2526 type = 'standard' ,
2627 headerElements,
28+ width,
2729 children,
2830 ...rest
2931} ) => {
@@ -32,6 +34,7 @@ export const SideSheet: FC<SideSheetProps> = ({
3234 < ScrimWrapper
3335 data-testid = "side-sheet-scrim"
3436 onClick = { open ? onClose : undefined }
37+ $zIndex = { 'zIndex' in rest ? rest . zIndex : undefined }
3538 initial = { {
3639 display : 'none' ,
3740 background : 'rgba(111,111,111,0)' ,
@@ -47,6 +50,8 @@ export const SideSheet: FC<SideSheetProps> = ({
4750 title = { title }
4851 type = "modal"
4952 headerElements = { headerElements }
53+ width = { width }
54+ zIndex = { 'zIndex' in rest ? rest . zIndex : undefined }
5055 withScrim
5156 >
5257 { children }
@@ -55,13 +60,30 @@ export const SideSheet: FC<SideSheetProps> = ({
5560 ) ;
5661 }
5762
63+ if ( type === 'modal' || type === 'floating' ) {
64+ return (
65+ < SideSheetContent
66+ open = { open }
67+ onClose = { onClose }
68+ title = { title }
69+ type = { type }
70+ headerElements = { headerElements }
71+ width = { width }
72+ zIndex = { 'zIndex' in rest ? rest . zIndex : undefined }
73+ >
74+ { children }
75+ </ SideSheetContent >
76+ ) ;
77+ }
78+
5879 return (
5980 < SideSheetContent
6081 open = { open }
6182 onClose = { onClose }
6283 title = { title }
6384 type = { type }
6485 headerElements = { headerElements }
86+ width = { width }
6587 >
6688 { children }
6789 </ SideSheetContent >
@@ -74,6 +96,7 @@ function SideSheetContent({
7496 title,
7597 type = 'standard' ,
7698 headerElements,
99+ width,
77100 children,
78101 ...rest
79102} : SideSheetProps ) {
@@ -83,6 +106,7 @@ function SideSheetContent({
83106 < Wrapper
84107 $type = { type }
85108 $withShadow = { ! ( 'withScrim' in rest && rest . withScrim ) }
109+ $zIndex = { 'zIndex' in rest ? rest . zIndex : undefined }
86110 initial = { {
87111 x : type !== 'standard' ? '110%' : undefined ,
88112 width : type === 'standard' ? 0 : undefined ,
@@ -99,7 +123,7 @@ function SideSheetContent({
99123 bounce : 0.25 ,
100124 } }
101125 >
102- < Sheet $type = { type } >
126+ < Sheet $type = { type } $width = { width } >
103127 < Header >
104128 < Typography variant = "h2" > { title } </ Typography >
105129 { headerElements && < section > { headerElements } </ section > }
0 commit comments