2
2
3
3
import { useStylesheet } from '@ui5/webcomponents-react-base' ;
4
4
import { clsx } from 'clsx' ;
5
- import type { ElementType , ReactNode } from 'react' ;
5
+ import type { CSSProperties , ElementType , ReactNode } from 'react' ;
6
6
import { forwardRef } from 'react' ;
7
7
import { FlexBoxAlignItems , FlexBoxDirection , FlexBoxJustifyContent , FlexBoxWrap } from '../../enums/index.js' ;
8
8
import type { CommonProps } from '../../types/index.js' ;
9
9
import { classNames , styleData } from './FlexBox.module.css.js' ;
10
10
11
11
export interface FlexBoxPropTypes extends CommonProps {
12
12
/**
13
- * Controls the alignment of items on the Cross Axis.<br />
14
- * <b>Note:</b> Corresponds to `align-items`.
13
+ * Controls the alignment of items on the Cross Axis.
14
+ *
15
+ * __Note:__ Corresponds to `align-items`.
15
16
*/
16
17
alignItems ?: FlexBoxAlignItems | keyof typeof FlexBoxAlignItems ;
17
18
/**
18
- * Controls how the items are placed in the `FlexBox`.<br />
19
- * <b>Note:</b> Corresponds to `flex-direction`.
19
+ * Controls how the items are placed in the `FlexBox`.
20
+ *
21
+ * __Note:__ Corresponds to `flex-direction`.
20
22
*/
21
23
direction ?: FlexBoxDirection | keyof typeof FlexBoxDirection ;
22
24
/**
@@ -30,15 +32,23 @@ export interface FlexBoxPropTypes extends CommonProps {
30
32
*/
31
33
fitContainer ?: boolean ;
32
34
/**
33
- * Defines how the browser distributes space between and around items along the main-axis.<br />
34
- * <b>Note:</b> Corresponds to `justify-content`.
35
+ * Defines how the browser distributes space between and around items along the main-axis.
36
+ *
37
+ * __Note:__ Corresponds to `justify-content`.
35
38
*/
36
39
justifyContent ?: FlexBoxJustifyContent | keyof typeof FlexBoxJustifyContent ;
37
40
/**
38
- * Determines whether the `FlexBox` should wrap, when there is not enough space to display all items in one line.<br />
39
- * <b>Note:</b> Corresponds to `flex-wrap`.
41
+ * Determines whether the `FlexBox` should wrap, when there is not enough space to display all items in one line.
42
+ *
43
+ * __Note:__ Corresponds to `flex-wrap`.
40
44
*/
41
45
wrap ?: FlexBoxWrap | keyof typeof FlexBoxWrap ;
46
+ /**
47
+ * Define the gap (gutters) between flex items and flex lines.
48
+ *
49
+ * __Note:__ Corresponds to the `gap` CSS Property.
50
+ */
51
+ gap ?: CSSProperties [ 'gap' ] ;
42
52
/**
43
53
* Content of the `FlexBox`.
44
54
*/
@@ -64,7 +74,9 @@ const FlexBox = forwardRef<HTMLDivElement, FlexBoxPropTypes>((props, ref) => {
64
74
wrap = FlexBoxWrap . NoWrap ,
65
75
className,
66
76
fitContainer,
77
+ gap,
67
78
as = 'div' ,
79
+ style,
68
80
...rest
69
81
} = props ;
70
82
@@ -82,7 +94,7 @@ const FlexBox = forwardRef<HTMLDivElement, FlexBoxPropTypes>((props, ref) => {
82
94
83
95
const CustomTag = as as ElementType ;
84
96
return (
85
- < CustomTag ref = { ref } className = { flexBoxClasses } { ...rest } >
97
+ < CustomTag ref = { ref } className = { flexBoxClasses } style = { { gap , ... style } } { ...rest } >
86
98
{ children }
87
99
</ CustomTag >
88
100
) ;
0 commit comments