1
1
import { css } from '@emotion/css' ;
2
- import React from 'react' ;
2
+ import React , { CSSProperties } from 'react' ;
3
3
4
4
import { GrafanaTheme2 , ThemeSpacingTokens } from '@grafana/data' ;
5
5
@@ -40,11 +40,12 @@ interface StackProps extends Omit<React.HTMLAttributes<HTMLElement>, 'className'
40
40
direction ?: ResponsiveProp < Direction > ;
41
41
wrap ?: ResponsiveProp < Wrap > ;
42
42
children ?: React . ReactNode ;
43
+ flexGrow ?: ResponsiveProp < CSSProperties [ 'flexGrow' ] > ;
43
44
}
44
45
45
46
export const Stack = React . forwardRef < HTMLDivElement , StackProps > (
46
- ( { gap = 1 , alignItems, justifyContent, direction, wrap, children, ...rest } , ref ) => {
47
- const styles = useStyles2 ( getStyles , gap , alignItems , justifyContent , direction , wrap ) ;
47
+ ( { gap = 1 , alignItems, justifyContent, direction, wrap, children, flexGrow , ...rest } , ref ) => {
48
+ const styles = useStyles2 ( getStyles , gap , alignItems , justifyContent , direction , wrap , flexGrow ) ;
48
49
49
50
return (
50
51
< div ref = { ref } className = { styles . flex } { ...rest } >
@@ -62,28 +63,32 @@ const getStyles = (
62
63
alignItems : StackProps [ 'alignItems' ] ,
63
64
justifyContent : StackProps [ 'justifyContent' ] ,
64
65
direction : StackProps [ 'direction' ] ,
65
- wrap : StackProps [ 'wrap' ]
66
+ wrap : StackProps [ 'wrap' ] ,
67
+ flexGrow : StackProps [ 'flexGrow' ]
66
68
) => {
67
69
return {
68
70
flex : css ( [
69
71
{
70
72
display : 'flex' ,
71
73
} ,
72
- getResponsiveStyle < Direction > ( theme , direction , ( val ) => ( {
74
+ getResponsiveStyle ( theme , direction , ( val ) => ( {
73
75
flexDirection : val ,
74
76
} ) ) ,
75
- getResponsiveStyle < Wrap > ( theme , wrap , ( val ) => ( {
77
+ getResponsiveStyle ( theme , wrap , ( val ) => ( {
76
78
flexWrap : val ,
77
79
} ) ) ,
78
- getResponsiveStyle < AlignItems > ( theme , alignItems , ( val ) => ( {
80
+ getResponsiveStyle ( theme , alignItems , ( val ) => ( {
79
81
alignItems : val ,
80
82
} ) ) ,
81
- getResponsiveStyle < JustifyContent > ( theme , justifyContent , ( val ) => ( {
83
+ getResponsiveStyle ( theme , justifyContent , ( val ) => ( {
82
84
justifyContent : val ,
83
85
} ) ) ,
84
- getResponsiveStyle < ThemeSpacingTokens > ( theme , gap , ( val ) => ( {
86
+ getResponsiveStyle ( theme , gap , ( val ) => ( {
85
87
gap : theme . spacing ( val ) ,
86
88
} ) ) ,
89
+ getResponsiveStyle ( theme , flexGrow , ( val ) => ( {
90
+ flexGrow : val ,
91
+ } ) ) ,
87
92
] ) ,
88
93
} ;
89
94
} ;
0 commit comments