Skip to content

Commit 1fd9f5a

Browse files
authored
fix(ToolbarV2 subcomponents): add missing props (#5366)
1 parent 6bd3ba5 commit 1fd9f5a

File tree

4 files changed

+88
-13
lines changed

4 files changed

+88
-13
lines changed

packages/main/src/webComponents/ToolbarButton/index.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import '@ui5/webcomponents/dist/ToolbarButton.js';
44
import type { CSSProperties } from 'react';
5-
import { ButtonDesign } from '../../enums/index.js';
5+
import { ButtonDesign, ToolbarItemOverflowBehavior } from '../../enums/index.js';
66
import type { Ui5CustomEvent, CommonProps, Ui5DomRef } from '../../interfaces/index.js';
77
import { withWebComponent } from '../../internal/withWebComponent.js';
88

@@ -51,6 +51,21 @@ interface ToolbarButtonAttributes {
5151
* **Note:** A tooltip attribute should be provided for icon-only buttons, in order to represent their exact meaning/function.
5252
*/
5353
tooltip?: string;
54+
/**
55+
* Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
56+
* the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
57+
* Available options are:
58+
*
59+
* *`NeverOverflow`
60+
* *`AlwaysOverflow`
61+
* *`Default`
62+
*/
63+
overflowPriority?: ToolbarItemOverflowBehavior | keyof typeof ToolbarItemOverflowBehavior;
64+
/**
65+
* Defines if the toolbar overflow popup should close upon interaction with the item.
66+
* It will close by default.
67+
*/
68+
preventOverflowClosing?: boolean;
5469
/**
5570
* Defines the width of the button.
5671
*
@@ -97,8 +112,8 @@ export interface ToolbarButtonPropTypes extends ToolbarButtonAttributes, Omit<Co
97112
*/
98113
const ToolbarButton = withWebComponent<ToolbarButtonPropTypes, ToolbarButtonDomRef>(
99114
'ui5-toolbar-button',
100-
['accessibleName', 'accessibleNameRef', 'design', 'icon', 'text', 'tooltip', 'width'],
101-
['disabled', 'iconEnd'],
115+
['accessibleName', 'accessibleNameRef', 'design', 'icon', 'overflowPriority', 'text', 'tooltip', 'width'],
116+
['disabled', 'iconEnd', 'preventOverflowClosing'],
102117
[],
103118
['click'],
104119
() => import('@ui5/webcomponents/dist/ToolbarButton.js')
@@ -107,7 +122,8 @@ const ToolbarButton = withWebComponent<ToolbarButtonPropTypes, ToolbarButtonDomR
107122
ToolbarButton.displayName = 'ToolbarButton';
108123

109124
ToolbarButton.defaultProps = {
110-
design: ButtonDesign.Default
125+
design: ButtonDesign.Default,
126+
overflowPriority: ToolbarItemOverflowBehavior.Default
111127
};
112128

113129
export { ToolbarButton };

packages/main/src/webComponents/ToolbarSelect/index.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import '@ui5/webcomponents/dist/ToolbarSelect.js';
44
import type { ToolbarSelectChangeEventDetail } from '@ui5/webcomponents/dist/ToolbarSelect.js';
55
import type { CSSProperties, ReactNode } from 'react';
6-
import { ValueState } from '../../enums/index.js';
6+
import { ToolbarItemOverflowBehavior, ValueState } from '../../enums/index.js';
77
import type { Ui5CustomEvent, CommonProps, Ui5DomRef } from '../../interfaces/index.js';
88
import { withWebComponent } from '../../internal/withWebComponent.js';
99

@@ -22,6 +22,21 @@ interface ToolbarSelectAttributes {
2222
* **Note:** A disabled component is noninteractive.
2323
*/
2424
disabled?: boolean;
25+
/**
26+
* Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
27+
* the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
28+
* Available options are:
29+
*
30+
* *`NeverOverflow`
31+
* *`AlwaysOverflow`
32+
* *`Default`
33+
*/
34+
overflowPriority?: ToolbarItemOverflowBehavior | keyof typeof ToolbarItemOverflowBehavior;
35+
/**
36+
* Defines if the toolbar overflow popup should close upon interaction with the item.
37+
* It will close by default.
38+
*/
39+
preventOverflowClosing?: boolean;
2540
/**
2641
* Defines the value state of the component.
2742
*/
@@ -70,8 +85,8 @@ export interface ToolbarSelectPropTypes extends ToolbarSelectAttributes, Omit<Co
7085
*/
7186
const ToolbarSelect = withWebComponent<ToolbarSelectPropTypes, ToolbarSelectDomRef>(
7287
'ui5-toolbar-select',
73-
['accessibleName', 'accessibleNameRef', 'valueState', 'width'],
74-
['disabled'],
88+
['accessibleName', 'accessibleNameRef', 'overflowPriority', 'valueState', 'width'],
89+
['disabled', 'preventOverflowClosing'],
7590
[],
7691
['change', 'close', 'open'],
7792
() => import('@ui5/webcomponents/dist/ToolbarSelect.js')
@@ -80,7 +95,8 @@ const ToolbarSelect = withWebComponent<ToolbarSelectPropTypes, ToolbarSelectDomR
8095
ToolbarSelect.displayName = 'ToolbarSelect';
8196

8297
ToolbarSelect.defaultProps = {
83-
valueState: ValueState.None
98+
valueState: ValueState.None,
99+
overflowPriority: ToolbarItemOverflowBehavior.Default
84100
};
85101

86102
export { ToolbarSelect };

packages/main/src/webComponents/ToolbarSeparatorV2/index.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
'use client';
22

33
import '@ui5/webcomponents/dist/ToolbarSeparator.js';
4+
import { ToolbarItemOverflowBehavior } from '../../enums/index.js';
45
import type { CommonProps, Ui5DomRef } from '../../interfaces/index.js';
56
import { withWebComponent } from '../../internal/withWebComponent.js';
7+
import { ToolbarSelect } from '../ToolbarSelect/index.js';
68

7-
interface ToolbarSeparatorV2Attributes {}
9+
interface ToolbarSeparatorV2Attributes {
10+
/**
11+
* Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
12+
* the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
13+
* Available options are:
14+
*
15+
* *`NeverOverflow`
16+
* *`AlwaysOverflow`
17+
* *`Default`
18+
*/
19+
overflowPriority?: ToolbarItemOverflowBehavior | keyof typeof ToolbarItemOverflowBehavior;
20+
/**
21+
* Defines if the toolbar overflow popup should close upon interaction with the item.
22+
* It will close by default.
23+
*/
24+
preventOverflowClosing?: boolean;
25+
}
826

927
export interface ToolbarSeparatorV2DomRef extends ToolbarSeparatorV2Attributes, Ui5DomRef {}
1028

@@ -21,13 +39,17 @@ export interface ToolbarSeparatorV2PropTypes extends ToolbarSeparatorV2Attribute
2139
*/
2240
const ToolbarSeparatorV2 = withWebComponent<ToolbarSeparatorV2PropTypes, ToolbarSeparatorV2DomRef>(
2341
'ui5-toolbar-separator',
24-
[],
25-
[],
42+
['overflowPriority'],
43+
['preventOverflowClosing'],
2644
[],
2745
[],
2846
() => import('@ui5/webcomponents/dist/ToolbarSeparator.js')
2947
);
3048

3149
ToolbarSeparatorV2.displayName = 'ToolbarSeparatorV2';
3250

51+
ToolbarSelect.defaultProps = {
52+
overflowPriority: ToolbarItemOverflowBehavior.Default
53+
};
54+
3355
export { ToolbarSeparatorV2 };

packages/main/src/webComponents/ToolbarSpacerV2/index.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,27 @@
22

33
import '@ui5/webcomponents/dist/ToolbarSpacer.js';
44
import type { CSSProperties } from 'react';
5+
import { ToolbarItemOverflowBehavior } from '../../enums/index.js';
56
import type { CommonProps, Ui5DomRef } from '../../interfaces/index.js';
67
import { withWebComponent } from '../../internal/withWebComponent.js';
8+
import { ToolbarSelect } from '../ToolbarSelect/index.js';
79

810
interface ToolbarSpacerV2Attributes {
11+
/**
12+
* Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
13+
* the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
14+
* Available options are:
15+
*
16+
* *`NeverOverflow`
17+
* *`AlwaysOverflow`
18+
* *`Default`
19+
*/
20+
overflowPriority?: ToolbarItemOverflowBehavior | keyof typeof ToolbarItemOverflowBehavior;
21+
/**
22+
* Defines if the toolbar overflow popup should close upon interaction with the item.
23+
* It will close by default.
24+
*/
25+
preventOverflowClosing?: boolean;
926
/**
1027
* Defines the width of the spacer.
1128
*
@@ -29,13 +46,17 @@ export interface ToolbarSpacerV2PropTypes extends ToolbarSpacerV2Attributes, Com
2946
*/
3047
const ToolbarSpacerV2 = withWebComponent<ToolbarSpacerV2PropTypes, ToolbarSpacerV2DomRef>(
3148
'ui5-toolbar-spacer',
32-
['width'],
33-
[],
49+
['overflowPriority', 'width'],
50+
['preventOverflowClosing'],
3451
[],
3552
[],
3653
() => import('@ui5/webcomponents/dist/ToolbarSpacer.js')
3754
);
3855

3956
ToolbarSpacerV2.displayName = 'ToolbarSpacerV2';
4057

58+
ToolbarSelect.defaultProps = {
59+
overflowPriority: ToolbarItemOverflowBehavior.Default
60+
};
61+
4162
export { ToolbarSpacerV2 };

0 commit comments

Comments
 (0)