@ui5/webcomponents 2.20.0-rc.3 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,16 @@
1
- import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
- import type ToolbarItemOverflowBehavior from "./types/ToolbarItemOverflowBehavior.js";
3
- type IEventOptions = {
4
- preventClosing: boolean;
5
- };
6
- type ToolbarItemEventDetail = {
7
- targetRef: HTMLElement;
8
- };
9
- interface IOverflowToolbarItem extends HTMLElement {
10
- overflowCloseEvents?: string[] | undefined;
11
- hasOverflow?: boolean | undefined;
1
+ import ToolbarItemBase from "./ToolbarItemBase.js";
2
+ import type { DefaultSlot } from "@ui5/webcomponents-base";
3
+ /**
4
+ * Interface for the slotted item in `ui5-toolbar-item`.
5
+ *
6
+ * It could be any HTMLElement or UI5 Web Component with option to specify custom overflow closing events and overflow behavior.
7
+ *
8
+ * @public
9
+ * @since 2.20.0
10
+ */
11
+ interface IToolbarItemContent extends HTMLElement {
12
+ overflowCloseEvents?: string[];
13
+ hasOverflow?: boolean;
12
14
  }
13
15
  /**
14
16
  * @class
@@ -29,42 +31,12 @@ interface IOverflowToolbarItem extends HTMLElement {
29
31
  * but specialized wrappers like `ui5-toolbar-button` provide
30
32
  * component-specific functionality and should be preferred when available.
31
33
  *
32
- *
33
- * @cssState overflowed - When the item is displayed in the overflow popover. Use this state to apply different styles when the item is overflowed. Available since 2.20.0.
34
34
  * @constructor
35
- * @extends UI5Element
35
+ * @extends ToolbarItemBase
36
36
  * @public
37
- * @since 1.17.0
37
+ * @since 2.20.0
38
38
  */
39
- declare class ToolbarItem extends UI5Element {
40
- eventDetails: {
41
- click: ToolbarItemEventDetail;
42
- "close-overflow": void;
43
- };
44
- /**
45
- * Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
46
- * the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
47
- * @public
48
- * @default "Default"
49
- */
50
- overflowPriority: `${ToolbarItemOverflowBehavior}`;
51
- /**
52
- * Defines if the toolbar overflow popup should close upon interaction with the item.
53
- * It will close by default.
54
- * @default false
55
- * @public
56
- */
57
- preventOverflowClosing: boolean;
58
- _isOverflowed: boolean;
59
- get isOverflowed(): boolean;
60
- /**
61
- * Defines if the toolbar item is overflowed.
62
- * @default false
63
- * @protected
64
- * @since 2.11.0
65
- */
66
- set isOverflowed(value: boolean);
67
- _isRendering: boolean;
39
+ declare class ToolbarItem extends ToolbarItemBase {
68
40
  _maxWidth: number;
69
41
  _wrapperChecked: boolean;
70
42
  fireCloseOverflowRef: () => void;
@@ -81,51 +53,20 @@ declare class ToolbarItem extends UI5Element {
81
53
  "ui5-select": string;
82
54
  };
83
55
  onBeforeRendering(): void;
84
- onAfterRendering(): void;
85
56
  onExitDOM(): void;
86
57
  /**
87
58
  * Wrapped component slot.
88
59
  * @public
89
60
  * @since 2.20.0
90
61
  */
91
- item: IOverflowToolbarItem[];
62
+ item: DefaultSlot<IToolbarItemContent>;
92
63
  checkForWrapper(): void;
93
64
  getClosingEvents(): string[];
94
65
  attachCloseOverflowHandlers(): void;
95
66
  detachCloseOverflowHandlers(): void;
96
67
  fireCloseOverflow(): void;
97
- /**
98
- * Defines if the width of the item should be ignored in calculating the whole width of the toolbar
99
- * @protected
100
- */
101
- get ignoreSpace(): boolean;
102
- /**
103
- * Returns if the item is flexible. An item that is returning true for this property will make
104
- * the toolbar expand to fill the 100% width of its container.
105
- * @protected
106
- */
107
- get hasFlexibleWidth(): boolean;
108
- /**
109
- * Returns if the item is interactive.
110
- * This value is used to determinate if the toolbar should have its accessibility role and attributes set.
111
- * At least two interactive items are needed for the toolbar to have the role="toolbar" attribute set.
112
- * @protected
113
- */
114
- get isInteractive(): boolean;
115
68
  get itemTagName(): string;
116
69
  get hasOverflow(): boolean;
117
- /**
118
- * Returns if the item is separator.
119
- * @protected
120
- */
121
- get isSeparator(): boolean;
122
- get stableDomRef(): string;
123
- get classes(): {
124
- root: {
125
- "ui5-tb-popover-item": boolean;
126
- "ui5-tb-item": boolean;
127
- };
128
- };
129
70
  }
130
- export type { IEventOptions, ToolbarItemEventDetail, IOverflowToolbarItem, };
71
+ export type { IToolbarItemContent, };
131
72
  export default ToolbarItem;
@@ -4,14 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
8
- import property from "@ui5/webcomponents-base/dist/decorators/property.js";
9
- import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
10
- import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
7
+ var ToolbarItem_1;
8
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot-strict.js";
11
9
  import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
12
10
  import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
13
11
  import ToolbarItemTemplate from "./ToolbarItemTemplate.js";
14
12
  import ToolbarItemCss from "./generated/themes/ToolbarItem.css.js";
13
+ import ToolbarItemBase from "./ToolbarItemBase.js";
15
14
  /**
16
15
  * @class
17
16
  *
@@ -31,32 +30,14 @@ import ToolbarItemCss from "./generated/themes/ToolbarItem.css.js";
31
30
  * but specialized wrappers like `ui5-toolbar-button` provide
32
31
  * component-specific functionality and should be preferred when available.
33
32
  *
34
- *
35
- * @cssState overflowed - When the item is displayed in the overflow popover. Use this state to apply different styles when the item is overflowed. Available since 2.20.0.
36
33
  * @constructor
37
- * @extends UI5Element
34
+ * @extends ToolbarItemBase
38
35
  * @public
39
- * @since 1.17.0
36
+ * @since 2.20.0
40
37
  */
41
- let ToolbarItem = class ToolbarItem extends UI5Element {
38
+ let ToolbarItem = ToolbarItem_1 = class ToolbarItem extends ToolbarItemBase {
42
39
  constructor() {
43
40
  super(...arguments);
44
- /**
45
- * Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
46
- * the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
47
- * @public
48
- * @default "Default"
49
- */
50
- this.overflowPriority = "Default";
51
- /**
52
- * Defines if the toolbar overflow popup should close upon interaction with the item.
53
- * It will close by default.
54
- * @default false
55
- * @public
56
- */
57
- this.preventOverflowClosing = false;
58
- this._isOverflowed = false;
59
- this._isRendering = true;
60
41
  this._maxWidth = 0;
61
42
  this._wrapperChecked = false;
62
43
  this.fireCloseOverflowRef = this.fireCloseOverflow.bind(this);
@@ -73,31 +54,10 @@ let ToolbarItem = class ToolbarItem extends UI5Element {
73
54
  "ui5-select": "ToolbarSelect",
74
55
  };
75
56
  }
76
- get isOverflowed() {
77
- return this._isOverflowed;
78
- }
79
- /**
80
- * Defines if the toolbar item is overflowed.
81
- * @default false
82
- * @protected
83
- * @since 2.11.0
84
- */
85
- set isOverflowed(value) {
86
- this._isOverflowed = value;
87
- if (value) {
88
- this._internals.states.add("overflowed");
89
- }
90
- else {
91
- this._internals.states.delete("overflowed");
92
- }
93
- }
94
57
  onBeforeRendering() {
95
58
  this.checkForWrapper();
96
59
  this.attachCloseOverflowHandlers();
97
60
  }
98
- onAfterRendering() {
99
- this._isRendering = false;
100
- }
101
61
  onExitDOM() {
102
62
  this.detachCloseOverflowHandlers();
103
63
  }
@@ -118,12 +78,12 @@ let ToolbarItem = class ToolbarItem extends UI5Element {
118
78
  }
119
79
  // We want to close the overflow popover, when closing event is being executed
120
80
  getClosingEvents() {
121
- const item = Array.isArray(this.item) ? this.item[0] : this.item;
81
+ const item = this.item[0];
122
82
  const closeEvents = this.closeOverflowSet[this.itemTagName] || [];
123
83
  if (!item) {
124
84
  return [...closeEvents];
125
85
  }
126
- const overflowCloseEvents = Array.isArray(item.overflowCloseEvents) ? item.overflowCloseEvents : [];
86
+ const overflowCloseEvents = item.overflowCloseEvents ? item.overflowCloseEvents : [];
127
87
  return [...closeEvents, ...overflowCloseEvents];
128
88
  }
129
89
  attachCloseOverflowHandlers() {
@@ -143,30 +103,6 @@ let ToolbarItem = class ToolbarItem extends UI5Element {
143
103
  fireCloseOverflow() {
144
104
  this.fireDecoratorEvent("close-overflow");
145
105
  }
146
- /**
147
- * Defines if the width of the item should be ignored in calculating the whole width of the toolbar
148
- * @protected
149
- */
150
- get ignoreSpace() {
151
- return false;
152
- }
153
- /**
154
- * Returns if the item is flexible. An item that is returning true for this property will make
155
- * the toolbar expand to fill the 100% width of its container.
156
- * @protected
157
- */
158
- get hasFlexibleWidth() {
159
- return false;
160
- }
161
- /**
162
- * Returns if the item is interactive.
163
- * This value is used to determinate if the toolbar should have its accessibility role and attributes set.
164
- * At least two interactive items are needed for the toolbar to have the role="toolbar" attribute set.
165
- * @protected
166
- */
167
- get isInteractive() {
168
- return true;
169
- }
170
106
  get itemTagName() {
171
107
  const ctor = this.getSlottedNodes("item")[0]?.constructor;
172
108
  return ctor?.getMetadata ? ctor.getMetadata().getPureTag() : this.getSlottedNodes("item")[0]?.tagName;
@@ -174,40 +110,13 @@ let ToolbarItem = class ToolbarItem extends UI5Element {
174
110
  get hasOverflow() {
175
111
  return this.item[0]?.hasOverflow ?? false;
176
112
  }
177
- /**
178
- * Returns if the item is separator.
179
- * @protected
180
- */
181
- get isSeparator() {
182
- return false;
183
- }
184
- get stableDomRef() {
185
- return this.getAttribute("stable-dom-ref") || `${this._id}-stable-dom-ref`;
186
- }
187
- get classes() {
188
- return {
189
- root: {
190
- "ui5-tb-popover-item": this.isOverflowed,
191
- "ui5-tb-item": true,
192
- },
193
- };
194
- }
195
113
  };
196
- __decorate([
197
- property()
198
- ], ToolbarItem.prototype, "overflowPriority", void 0);
199
- __decorate([
200
- property({ type: Boolean })
201
- ], ToolbarItem.prototype, "preventOverflowClosing", void 0);
202
- __decorate([
203
- property({ type: Boolean })
204
- ], ToolbarItem.prototype, "isOverflowed", null);
205
114
  __decorate([
206
115
  slot({
207
116
  "default": true, type: HTMLElement, invalidateOnChildChange: true,
208
117
  })
209
118
  ], ToolbarItem.prototype, "item", void 0);
210
- ToolbarItem = __decorate([
119
+ ToolbarItem = ToolbarItem_1 = __decorate([
211
120
  customElement({
212
121
  tag: "ui5-toolbar-item",
213
122
  languageAware: true,
@@ -215,16 +124,6 @@ ToolbarItem = __decorate([
215
124
  template: ToolbarItemTemplate,
216
125
  styles: ToolbarItemCss,
217
126
  })
218
- /**
219
- * Fired when the overflow popover is closed.
220
- * @public
221
- * @since 1.17.0
222
- */
223
- ,
224
- event("close-overflow", {
225
- bubbles: true,
226
- cancelable: true,
227
- })
228
127
  ], ToolbarItem);
229
128
  ToolbarItem.define();
230
129
  export default ToolbarItem;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../src/ToolbarItem.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,cAAc,MAAM,uCAAuC,CAAC;AAgBnE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAiBH,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAMC;;;;;WAKG;QAEH,qBAAgB,GAAqC,SAAS,CAAC;QAE/D;;;;;WAKG;QAEH,2BAAsB,GAAG,KAAK,CAAC;QAE/B,kBAAa,GAAY,KAAK,CAAC;QAuB/B,iBAAY,GAAG,IAAI,CAAC;QACpB,cAAS,GAAG,CAAC,CAAC;QACd,oBAAe,GAAG,KAAK,CAAC;QACxB,yBAAoB,GAAG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qBAAqB,EAAE,IAAI,CAAC,YAAY;gBACxC,aAAa,EAAE,IAAI;aACnB;SACD,CAAC;IACH,CAAC;CACD,CAAA;AAtLA;IADC,QAAQ,EAAE;qDACoD;AAS/D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DACG;AAe/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAS3B;AA2CD;IAHC,IAAI,CAAC;QACL,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,IAAI;KACjE,CAAC;yCAC4B;AAxFzB,WAAW;IAhBhB,aAAa,CAAC;QACd,GAAG,EAAE,kBAAkB;QACvB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,mBAAmB;QAC7B,MAAM,EAAE,cAAc;KACtB,CAAC;IACF;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,EAAE;QACxB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;KAChB,CAAC;GACI,WAAW,CAmMhB;AAOD,WAAW,CAAC,MAAM,EAAE,CAAC;AAErB,eAAe,WAAW,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport ToolbarItemTemplate from \"./ToolbarItemTemplate.js\";\nimport ToolbarItemCss from \"./generated/themes/ToolbarItem.css.js\";\nimport type ToolbarItemOverflowBehavior from \"./types/ToolbarItemOverflowBehavior.js\";\n\ntype IEventOptions = {\n\tpreventClosing: boolean;\n}\n\ntype ToolbarItemEventDetail = {\n\ttargetRef: HTMLElement;\n}\n\ninterface IOverflowToolbarItem extends HTMLElement {\n\toverflowCloseEvents?: string[] | undefined;\n\thasOverflow?: boolean | undefined;\n}\n\n/**\n * @class\n *\n * ### Overview\n * The `ui5-toolbar-item` is a wrapper component used to integrate UI5 Web Components into the `ui5-toolbar`.\n * It renders within the toolbar's shadow DOM and manages the lifecycle\n * and overflow behavior of its child component.\n *\n * ### Structure\n * The toolbar item wraps a single UI5 Web Component (such as CheckBox, Title, etc.) and handles:\n * - Overflow management (determining if the item should be displayed in the main toolbar or overflow popover)\n * - Automatic popover closing on interaction\n * - CSS custom state exposure for styling based on overflow state\n *\n * ### Usage\n * The `ui5-toolbar-item` is typically used implicitly when adding components to a toolbar,\n * but specialized wrappers like `ui5-toolbar-button` provide\n * component-specific functionality and should be preferred when available.\n *\n *\n * @cssState overflowed - When the item is displayed in the overflow popover. Use this state to apply different styles when the item is overflowed. Available since 2.20.0.\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.17.0\n */\n@customElement({\n\ttag: \"ui5-toolbar-item\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: ToolbarItemTemplate,\n\tstyles: ToolbarItemCss,\n})\n/**\n * Fired when the overflow popover is closed.\n * @public\n * @since 1.17.0\n */\n@event(\"close-overflow\", {\n\tbubbles: true,\n\tcancelable: true,\n})\nclass ToolbarItem extends UI5Element {\n\t// strictEvents: needed for parent class\n\teventDetails!: {\n\t\tclick: ToolbarItemEventDetail,\n\t\t\"close-overflow\": void;\n\t}\n\t/**\n\t * Property used to define the access of the item to the overflow Popover. If \"NeverOverflow\" option is set,\n\t * the item never goes in the Popover, if \"AlwaysOverflow\" - it never comes out of it.\n\t * @public\n\t * @default \"Default\"\n\t */\n\t@property()\n\toverflowPriority: `${ToolbarItemOverflowBehavior}` = \"Default\";\n\n\t/**\n\t * Defines if the toolbar overflow popup should close upon interaction with the item.\n\t * It will close by default.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tpreventOverflowClosing = false;\n\n\t_isOverflowed: boolean = false;\n\n\tget isOverflowed(): boolean {\n\t\treturn this._isOverflowed;\n\t}\n\n\t/**\n\t * Defines if the toolbar item is overflowed.\n\t * @default false\n\t * @protected\n\t * @since 2.11.0\n\t */\n\t@property({ type: Boolean })\n\tset isOverflowed(value: boolean) {\n\t\tthis._isOverflowed = value;\n\n\t\tif (value) {\n\t\t\tthis._internals.states.add(\"overflowed\");\n\t\t} else {\n\t\t\tthis._internals.states.delete(\"overflowed\");\n\t\t}\n\t}\n\n\t_isRendering = true;\n\t_maxWidth = 0;\n\t_wrapperChecked = false;\n\tfireCloseOverflowRef = this.fireCloseOverflow.bind(this);\n\n\tcloseOverflowSet = {\n\t\t\"ui5-button\": [\"click\"],\n\t\t\"ui5-select\": [\"change\"],\n\t\t\"ui5-combobox\": [\"change\"],\n\t\t\"ui5-multi-combobox\": [\"selection-change\"],\n\t\t\"ui5-date-picker\": [\"change\"],\n\t\t\"ui5-switch\": [\"change\"],\n\t}\n\n\tpredefinedWrapperSet = {\n\t\t\"ui5-button\": \"ToolbarButton\",\n\t\t\"ui5-select\": \"ToolbarSelect\",\n\t}\n\n\tonBeforeRendering(): void {\n\t\tthis.checkForWrapper();\n\t\tthis.attachCloseOverflowHandlers();\n\t}\n\n\tonAfterRendering(): void {\n\t\tthis._isRendering = false;\n\t}\n\n\tonExitDOM(): void {\n\t\tthis.detachCloseOverflowHandlers();\n\t}\n\n\t/**\n\t * Wrapped component slot.\n\t * @public\n\t * @since 2.20.0\n\t */\n\n\t@slot({\n\t\t\"default\": true, type: HTMLElement, invalidateOnChildChange: true,\n\t})\n\titem!: IOverflowToolbarItem[];\n\n\t// Method called by ui5-toolbar to inform about the existing toolbar wrapper\n\tcheckForWrapper() {\n\t\tif (this._wrapperChecked) {\n\t\t\treturn;\n\t\t}\n\t\tthis._wrapperChecked = true;\n\n\t\tconst tagName = this.itemTagName as keyof typeof this.predefinedWrapperSet;\n\t\tconst ctor = this.constructor as typeof UI5Element;\n\t\tconst wrapperName = ctor?.getMetadata ? ctor.getMetadata().getPureTag() : this.tagName;\n\t\tif (wrapperName === \"ui5-toolbar-item\"\n\t\t\t&& this.predefinedWrapperSet[tagName]) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(`This UI5 web component has its predefined toolbar wrapper called ${this.predefinedWrapperSet[tagName]}.`);\n\t\t}\n\t}\n\n\t// We want to close the overflow popover, when closing event is being executed\n\tgetClosingEvents(): string[] {\n\t\tconst item = Array.isArray(this.item) ? this.item[0] : this.item;\n\n\t\tconst closeEvents = this.closeOverflowSet[this.itemTagName as keyof typeof this.closeOverflowSet] || [];\n\t\tif (!item) {\n\t\t\treturn [...closeEvents];\n\t\t}\n\t\tconst overflowCloseEvents = Array.isArray(item.overflowCloseEvents) ? item.overflowCloseEvents : [];\n\n\t\treturn [...closeEvents, ...overflowCloseEvents];\n\t}\n\n\tattachCloseOverflowHandlers() {\n\t\tconst closingEvents = this.getClosingEvents();\n\t\tclosingEvents.forEach(clEvent => {\n\t\t\tif (!this.preventOverflowClosing) {\n\t\t\t\tthis.addEventListener(clEvent, this.fireCloseOverflowRef);\n\t\t\t}\n\t\t});\n\t}\n\n\tdetachCloseOverflowHandlers() {\n\t\tconst closingEvents = this.getClosingEvents();\n\t\tclosingEvents.forEach(clEvent => {\n\t\t\tthis.removeEventListener(clEvent, this.fireCloseOverflowRef);\n\t\t});\n\t}\n\n\tfireCloseOverflow() {\n\t\tthis.fireDecoratorEvent(\"close-overflow\");\n\t}\n\t/**\n\t* Defines if the width of the item should be ignored in calculating the whole width of the toolbar\n\t* @protected\n\t*/\n\tget ignoreSpace(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns if the item is flexible. An item that is returning true for this property will make\n\t * the toolbar expand to fill the 100% width of its container.\n\t * @protected\n\t */\n\tget hasFlexibleWidth(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns if the item is interactive.\n\t * This value is used to determinate if the toolbar should have its accessibility role and attributes set.\n\t * At least two interactive items are needed for the toolbar to have the role=\"toolbar\" attribute set.\n\t * @protected\n\t */\n\tget isInteractive(): boolean {\n\t\treturn true;\n\t}\n\n\tget itemTagName() {\n\t\tconst ctor = this.getSlottedNodes<IOverflowToolbarItem>(\"item\")[0]?.constructor as typeof UI5Element;\n\t\treturn ctor?.getMetadata ? ctor.getMetadata().getPureTag() : this.getSlottedNodes<IOverflowToolbarItem>(\"item\")[0]?.tagName;\n\t}\n\n\tget hasOverflow(): boolean {\n\t\treturn this.item[0]?.hasOverflow ?? false;\n\t}\n\n\t/**\n\t * Returns if the item is separator.\n\t * @protected\n\t */\n\tget isSeparator() {\n\t\treturn false;\n\t}\n\n\tget stableDomRef() {\n\t\treturn this.getAttribute(\"stable-dom-ref\") || `${this._id}-stable-dom-ref`;\n\t}\n\n\tget classes() {\n\t\treturn {\n\t\t\troot: {\n\t\t\t\t\"ui5-tb-popover-item\": this.isOverflowed,\n\t\t\t\t\"ui5-tb-item\": true,\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport type {\n\tIEventOptions,\n\tToolbarItemEventDetail,\n\tIOverflowToolbarItem,\n};\nToolbarItem.define();\n\nexport default ToolbarItem;\n"]}
1
+ {"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../src/ToolbarItem.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,cAAc,MAAM,uCAAuC,CAAC;AACnE,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAgBnD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,eAAe;IAAzC;;QACC,cAAS,GAAG,CAAC,CAAC;QACd,oBAAe,GAAG,KAAK,CA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,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAsB,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IAC5H,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,IAAI,KAAK,CAAC;IAC3C,CAAC;CACD,CAAA;AA5DA;IAHC,IAAI,CAAC;QACL,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,IAAI;KACjE,CAAC;yCACsC;AArCnC,WAAW;IAPhB,aAAa,CAAC;QACd,GAAG,EAAE,kBAAkB;QACvB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,mBAAmB;QAC7B,MAAM,EAAE,cAAc;KACtB,CAAC;GACI,WAAW,CAiGhB;AAKD,WAAW,CAAC,MAAM,EAAE,CAAC;AAErB,eAAe,WAAW,CAAC","sourcesContent":["import slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport ToolbarItemTemplate from \"./ToolbarItemTemplate.js\";\nimport ToolbarItemCss from \"./generated/themes/ToolbarItem.css.js\";\nimport ToolbarItemBase from \"./ToolbarItemBase.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base\";\n\n/**\n * Interface for the slotted item in `ui5-toolbar-item`.\n *\n * It could be any HTMLElement or UI5 Web Component with option to specify custom overflow closing events and overflow behavior.\n *\n * @public\n * @since 2.20.0\n */\ninterface IToolbarItemContent extends HTMLElement {\n\toverflowCloseEvents?: string[];\n\thasOverflow?: boolean;\n}\n\n/**\n * @class\n *\n * ### Overview\n * The `ui5-toolbar-item` is a wrapper component used to integrate UI5 Web Components into the `ui5-toolbar`.\n * It renders within the toolbar's shadow DOM and manages the lifecycle\n * and overflow behavior of its child component.\n *\n * ### Structure\n * The toolbar item wraps a single UI5 Web Component (such as CheckBox, Title, etc.) and handles:\n * - Overflow management (determining if the item should be displayed in the main toolbar or overflow popover)\n * - Automatic popover closing on interaction\n * - CSS custom state exposure for styling based on overflow state\n *\n * ### Usage\n * The `ui5-toolbar-item` is typically used implicitly when adding components to a toolbar,\n * but specialized wrappers like `ui5-toolbar-button` provide\n * component-specific functionality and should be preferred when available.\n *\n * @constructor\n * @extends ToolbarItemBase\n * @public\n * @since 2.20.0\n */\n@customElement({\n\ttag: \"ui5-toolbar-item\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: ToolbarItemTemplate,\n\tstyles: ToolbarItemCss,\n})\nclass ToolbarItem extends ToolbarItemBase {\n\t_maxWidth = 0;\n\t_wrapperChecked = false;\n\tfireCloseOverflowRef = this.fireCloseOverflow.bind(this);\n\n\tcloseOverflowSet = {\n\t\t\"ui5-button\": [\"click\"],\n\t\t\"ui5-select\": [\"change\"],\n\t\t\"ui5-combobox\": [\"change\"],\n\t\t\"ui5-multi-combobox\": [\"selection-change\"],\n\t\t\"ui5-date-picker\": [\"change\"],\n\t\t\"ui5-switch\": [\"change\"],\n\t}\n\n\tpredefinedWrapperSet = {\n\t\t\"ui5-button\": \"ToolbarButton\",\n\t\t\"ui5-select\": \"ToolbarSelect\",\n\t}\n\n\tonBeforeRendering(): void {\n\t\tthis.checkForWrapper();\n\t\tthis.attachCloseOverflowHandlers();\n\t}\n\n\tonExitDOM(): void {\n\t\tthis.detachCloseOverflowHandlers();\n\t}\n\n\t/**\n\t * Wrapped component slot.\n\t * @public\n\t * @since 2.20.0\n\t */\n\n\t@slot({\n\t\t\"default\": true, type: HTMLElement, invalidateOnChildChange: true,\n\t})\n\titem!: DefaultSlot<IToolbarItemContent>;\n\n\t// Method called by ui5-toolbar to inform about the existing toolbar wrapper\n\tcheckForWrapper() {\n\t\tif (this._wrapperChecked) {\n\t\t\treturn;\n\t\t}\n\t\tthis._wrapperChecked = true;\n\n\t\tconst tagName = this.itemTagName as keyof typeof this.predefinedWrapperSet;\n\t\tconst ctor = this.constructor as typeof ToolbarItem;\n\t\tconst wrapperName = ctor?.getMetadata ? ctor.getMetadata().getPureTag() : this.tagName;\n\t\tif (wrapperName === \"ui5-toolbar-item\"\n\t\t\t&& this.predefinedWrapperSet[tagName]) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(`This UI5 web component has its predefined toolbar wrapper called ${this.predefinedWrapperSet[tagName]}.`);\n\t\t}\n\t}\n\n\t// We want to close the overflow popover, when closing event is being executed\n\tgetClosingEvents(): string[] {\n\t\tconst item = this.item[0];\n\n\t\tconst closeEvents = this.closeOverflowSet[this.itemTagName as keyof typeof this.closeOverflowSet] || [];\n\t\tif (!item) {\n\t\t\treturn [...closeEvents];\n\t\t}\n\t\tconst overflowCloseEvents = item.overflowCloseEvents ? item.overflowCloseEvents : [];\n\n\t\treturn [...closeEvents, ...overflowCloseEvents];\n\t}\n\n\tattachCloseOverflowHandlers() {\n\t\tconst closingEvents = this.getClosingEvents();\n\t\tclosingEvents.forEach(clEvent => {\n\t\t\tif (!this.preventOverflowClosing) {\n\t\t\t\tthis.addEventListener(clEvent, this.fireCloseOverflowRef);\n\t\t\t}\n\t\t});\n\t}\n\n\tdetachCloseOverflowHandlers() {\n\t\tconst closingEvents = this.getClosingEvents();\n\t\tclosingEvents.forEach(clEvent => {\n\t\t\tthis.removeEventListener(clEvent, this.fireCloseOverflowRef);\n\t\t});\n\t}\n\n\tfireCloseOverflow() {\n\t\tthis.fireDecoratorEvent(\"close-overflow\");\n\t}\n\n\tget itemTagName() {\n\t\tconst ctor = this.getSlottedNodes<IToolbarItemContent>(\"item\")[0]?.constructor as typeof ToolbarItem;\n\t\treturn ctor?.getMetadata ? ctor.getMetadata().getPureTag() : this.getSlottedNodes<IToolbarItemContent>(\"item\")[0]?.tagName;\n\t}\n\n\tget hasOverflow(): boolean {\n\t\treturn this.item[0]?.hasOverflow ?? false;\n\t}\n}\n\nexport type {\n\tIToolbarItemContent,\n};\nToolbarItem.define();\n\nexport default ToolbarItem;\n"]}
@@ -0,0 +1,69 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import type ToolbarItemOverflowBehavior from "./types/ToolbarItemOverflowBehavior.js";
3
+ type ToolbarItemEventDetail = {
4
+ targetRef: HTMLElement;
5
+ };
6
+ declare class ToolbarItemBase extends UI5Element {
7
+ eventDetails: {
8
+ "close-overflow": void;
9
+ };
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
+ * @public
14
+ * @default "Default"
15
+ */
16
+ overflowPriority: `${ToolbarItemOverflowBehavior}`;
17
+ /**
18
+ * Defines if the toolbar overflow popup should close upon interaction with the item.
19
+ * It will close by default.
20
+ * @default false
21
+ * @public
22
+ */
23
+ preventOverflowClosing: boolean;
24
+ _isOverflowed: boolean;
25
+ get isOverflowed(): boolean;
26
+ /**
27
+ * Defines if the toolbar item is overflowed.
28
+ * @default false
29
+ * @protected
30
+ * @since 2.11.0
31
+ */
32
+ set isOverflowed(value: boolean);
33
+ _maxWidth: number;
34
+ _isRendering: boolean;
35
+ onAfterRendering(): void;
36
+ /**
37
+ * Defines if the width of the item should be ignored in calculating the whole width of the toolbar
38
+ * @protected
39
+ */
40
+ get ignoreSpace(): boolean;
41
+ /**
42
+ * Returns if the item is flexible. An item that is returning true for this property will make
43
+ * the toolbar expand to fill the 100% width of its container.
44
+ * @protected
45
+ */
46
+ get hasFlexibleWidth(): boolean;
47
+ /**
48
+ * Returns if the item is interactive.
49
+ * This value is used to determinate if the toolbar should have its accessibility role and attributes set.
50
+ * At least two interactive items are needed for the toolbar to have the role="toolbar" attribute set.
51
+ * @protected
52
+ */
53
+ get isInteractive(): boolean;
54
+ get hasOverflow(): boolean;
55
+ /**
56
+ * Returns if the item is separator.
57
+ * @protected
58
+ */
59
+ get isSeparator(): boolean;
60
+ get stableDomRef(): string;
61
+ get classes(): {
62
+ root: {
63
+ "ui5-tb-popover-item": boolean;
64
+ "ui5-tb-item": boolean;
65
+ };
66
+ };
67
+ }
68
+ export type { ToolbarItemEventDetail, };
69
+ export default ToolbarItemBase;
@@ -0,0 +1,142 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
8
+ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
9
+ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
10
+ let ToolbarItemBase =
11
+ /**
12
+ * @class
13
+ * Represents an abstract base class for items used in the `ui5-toolbar`.
14
+ *
15
+ *
16
+ * @cssState overflowed - When the item is displayed in the overflow popover.
17
+ * Use this state to apply different styles when the item is overflowed.
18
+ * Available since 2.20.0.
19
+ * @constructor
20
+ * @extends UI5Element
21
+ * @abstract
22
+ * @public
23
+ * @since 1.17.0
24
+ */
25
+ class ToolbarItemBase extends UI5Element {
26
+ constructor() {
27
+ super(...arguments);
28
+ /**
29
+ * Property used to define the access of the item to the overflow Popover. If "NeverOverflow" option is set,
30
+ * the item never goes in the Popover, if "AlwaysOverflow" - it never comes out of it.
31
+ * @public
32
+ * @default "Default"
33
+ */
34
+ this.overflowPriority = "Default";
35
+ /**
36
+ * Defines if the toolbar overflow popup should close upon interaction with the item.
37
+ * It will close by default.
38
+ * @default false
39
+ * @public
40
+ */
41
+ this.preventOverflowClosing = false;
42
+ this._isOverflowed = false;
43
+ this._maxWidth = 0;
44
+ this._isRendering = true;
45
+ }
46
+ get isOverflowed() {
47
+ return this._isOverflowed;
48
+ }
49
+ /**
50
+ * Defines if the toolbar item is overflowed.
51
+ * @default false
52
+ * @protected
53
+ * @since 2.11.0
54
+ */
55
+ set isOverflowed(value) {
56
+ this._isOverflowed = value;
57
+ if (value) {
58
+ this._internals.states.add("overflowed");
59
+ }
60
+ else {
61
+ this._internals.states.delete("overflowed");
62
+ }
63
+ }
64
+ onAfterRendering() {
65
+ this._isRendering = false;
66
+ }
67
+ /**
68
+ * Defines if the width of the item should be ignored in calculating the whole width of the toolbar
69
+ * @protected
70
+ */
71
+ get ignoreSpace() {
72
+ return false;
73
+ }
74
+ /**
75
+ * Returns if the item is flexible. An item that is returning true for this property will make
76
+ * the toolbar expand to fill the 100% width of its container.
77
+ * @protected
78
+ */
79
+ get hasFlexibleWidth() {
80
+ return false;
81
+ }
82
+ /**
83
+ * Returns if the item is interactive.
84
+ * This value is used to determinate if the toolbar should have its accessibility role and attributes set.
85
+ * At least two interactive items are needed for the toolbar to have the role="toolbar" attribute set.
86
+ * @protected
87
+ */
88
+ get isInteractive() {
89
+ return true;
90
+ }
91
+ get hasOverflow() {
92
+ return false;
93
+ }
94
+ /**
95
+ * Returns if the item is separator.
96
+ * @protected
97
+ */
98
+ get isSeparator() {
99
+ return false;
100
+ }
101
+ get stableDomRef() {
102
+ return this.getAttribute("stable-dom-ref") || `${this._id}-stable-dom-ref`;
103
+ }
104
+ get classes() {
105
+ return {
106
+ root: {
107
+ "ui5-tb-popover-item": this.isOverflowed,
108
+ "ui5-tb-item": true,
109
+ },
110
+ };
111
+ }
112
+ };
113
+ __decorate([
114
+ property()
115
+ ], ToolbarItemBase.prototype, "overflowPriority", void 0);
116
+ __decorate([
117
+ property({ type: Boolean })
118
+ ], ToolbarItemBase.prototype, "preventOverflowClosing", void 0);
119
+ __decorate([
120
+ property({ type: Boolean })
121
+ ], ToolbarItemBase.prototype, "isOverflowed", null);
122
+ ToolbarItemBase = __decorate([
123
+ event("close-overflow", {
124
+ bubbles: true,
125
+ })
126
+ /**
127
+ * @class
128
+ * Represents an abstract base class for items used in the `ui5-toolbar`.
129
+ *
130
+ *
131
+ * @cssState overflowed - When the item is displayed in the overflow popover.
132
+ * Use this state to apply different styles when the item is overflowed.
133
+ * Available since 2.20.0.
134
+ * @constructor
135
+ * @extends UI5Element
136
+ * @abstract
137
+ * @public
138
+ * @since 1.17.0
139
+ */
140
+ ], ToolbarItemBase);
141
+ export default ToolbarItemBase;
142
+ //# sourceMappingURL=ToolbarItemBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolbarItemBase.js","sourceRoot":"","sources":["../src/ToolbarItemBase.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAyB5E,IAAM,eAAe;AAdrB;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAKC;;;;;UAKE;QAEF,qBAAgB,GAAqC,SAAS,CAAC;QAE/D;;;;;WAKG;QAEH,2BAAsB,GAAG,KAAK,CAAC;QAE/B,kBAAa,GAAY,KAAK,CAAC;QAuB/B,cAAS,GAAG,CAAC,CAAC;QACd,iBAAY,GAAG,IAAI,CAAC;IAwDrB,CAAC;IA9EA,IAAI,YAAY;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IAEH,IAAI,YAAY,CAAC,KAAc;QAC9B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAE3B,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1C,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC7C,CAAC;IACF,CAAC;IAKD,gBAAgB;QACf,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD;;;MAGE;IACF,IAAI,WAAW;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,gBAAgB;QACnB,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,IAAI,aAAa;QAChB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,WAAW;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,IAAI,WAAW;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAI,YAAY;QACf,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,iBAAiB,CAAC;IAC5E,CAAC;IAED,IAAI,OAAO;QACV,OAAO;YACN,IAAI,EAAE;gBACL,qBAAqB,EAAE,IAAI,CAAC,YAAY;gBACxC,aAAa,EAAE,IAAI;aACnB;SACD,CAAC;IACH,CAAC;CACD,CAAA;AA3FA;IADC,QAAQ,EAAE;yDACoD;AAS/D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+DACG;AAe/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAS3B;AA5CI,eAAe;IAjBpB,KAAK,CAAC,gBAAgB,EAAE;QACxB,OAAO,EAAE,IAAI;KACb,CAAC;IACF;;;;;;;;;;;;;OAaG;GACG,eAAe,CAuGpB;AAKD,eAAe,eAAe,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\n\nimport type ToolbarItemOverflowBehavior from \"./types/ToolbarItemOverflowBehavior.js\";\n\ntype ToolbarItemEventDetail = {\n\ttargetRef: HTMLElement;\n}\n\n@event(\"close-overflow\", {\n\tbubbles: true,\n})\n/**\n * @class\n * Represents an abstract base class for items used in the `ui5-toolbar`.\n *\n *\n * @cssState overflowed - When the item is displayed in the overflow popover.\n * Use this state to apply different styles when the item is overflowed.\n * Available since 2.20.0.\n * @constructor\n * @extends UI5Element\n * @abstract\n * @public\n * @since 1.17.0\n */\nclass ToolbarItemBase extends UI5Element {\n\teventDetails!: {\n\t\t\"close-overflow\": void;\n\t}\n\n\t/**\n\t* Property used to define the access of the item to the overflow Popover. If \"NeverOverflow\" option is set,\n\t* the item never goes in the Popover, if \"AlwaysOverflow\" - it never comes out of it.\n\t* @public\n\t* @default \"Default\"\n\t*/\n\t@property()\n\toverflowPriority: `${ToolbarItemOverflowBehavior}` = \"Default\";\n\n\t/**\n\t * Defines if the toolbar overflow popup should close upon interaction with the item.\n\t * It will close by default.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tpreventOverflowClosing = false;\n\n\t_isOverflowed: boolean = false;\n\n\tget isOverflowed(): boolean {\n\t\treturn this._isOverflowed;\n\t}\n\n\t/**\n\t * Defines if the toolbar item is overflowed.\n\t * @default false\n\t * @protected\n\t * @since 2.11.0\n\t */\n\t@property({ type: Boolean })\n\tset isOverflowed(value: boolean) {\n\t\tthis._isOverflowed = value;\n\n\t\tif (value) {\n\t\t\tthis._internals.states.add(\"overflowed\");\n\t\t} else {\n\t\t\tthis._internals.states.delete(\"overflowed\");\n\t\t}\n\t}\n\n\t_maxWidth = 0;\n\t_isRendering = true;\n\n\tonAfterRendering(): void {\n\t\tthis._isRendering = false;\n\t}\n\t/**\n\t* Defines if the width of the item should be ignored in calculating the whole width of the toolbar\n\t* @protected\n\t*/\n\tget ignoreSpace(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns if the item is flexible. An item that is returning true for this property will make\n\t * the toolbar expand to fill the 100% width of its container.\n\t * @protected\n\t */\n\tget hasFlexibleWidth(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns if the item is interactive.\n\t * This value is used to determinate if the toolbar should have its accessibility role and attributes set.\n\t * At least two interactive items are needed for the toolbar to have the role=\"toolbar\" attribute set.\n\t * @protected\n\t */\n\tget isInteractive(): boolean {\n\t\treturn true;\n\t}\n\n\tget hasOverflow(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns if the item is separator.\n\t * @protected\n\t */\n\tget isSeparator() {\n\t\treturn false;\n\t}\n\n\tget stableDomRef() {\n\t\treturn this.getAttribute(\"stable-dom-ref\") || `${this._id}-stable-dom-ref`;\n\t}\n\n\tget classes() {\n\t\treturn {\n\t\t\troot: {\n\t\t\t\t\"ui5-tb-popover-item\": this.isOverflowed,\n\t\t\t\t\"ui5-tb-item\": true,\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport type {\n\tToolbarItemEventDetail,\n};\nexport default ToolbarItemBase;\n"]}
@@ -1,7 +1,7 @@
1
1
  import type ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
2
2
  import type Select from "./Select.js";
3
- import ToolbarItem from "./ToolbarItem.js";
4
- import type { ToolbarItemEventDetail } from "./ToolbarItem.js";
3
+ import ToolbarItemBase from "./ToolbarItemBase.js";
4
+ import type { ToolbarItemEventDetail } from "./ToolbarItemBase.js";
5
5
  import type ToolbarSelectOption from "./ToolbarSelectOption.js";
6
6
  import type { SelectChangeEventDetail } from "./Select.js";
7
7
  import type { DefaultSlot, Slot } from "@ui5/webcomponents-base/dist/UI5Element.js";
@@ -19,15 +19,16 @@ type ToolbarSelectChangeEventDetail = ToolbarItemEventDetail & SelectChangeEvent
19
19
  * `import "@ui5/webcomponents/dist/ToolbarSelectOption.js";` (comes with `ui5-toolbar-select`)
20
20
  * @constructor
21
21
  * @abstract
22
- * @extends ToolbarItem
22
+ * @extends ToolbarItemBase
23
23
  * @public
24
24
  * @since 1.17.0
25
25
  */
26
- declare class ToolbarSelect extends ToolbarItem {
27
- eventDetails: ToolbarItem["eventDetails"] & {
26
+ declare class ToolbarSelect extends ToolbarItemBase {
27
+ eventDetails: ToolbarItemBase["eventDetails"] & {
28
28
  change: ToolbarSelectChangeEventDetail;
29
29
  open: ToolbarItemEventDetail;
30
30
  close: ToolbarItemEventDetail;
31
+ "click": ToolbarItemEventDetail;
31
32
  };
32
33
  /**
33
34
  * Defines the width of the select.
@@ -12,7 +12,7 @@ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
12
12
  import ToolbarSelectCss from "./generated/themes/ToolbarSelect.css.js";
13
13
  // Templates
14
14
  import ToolbarSelectTemplate from "./ToolbarSelectTemplate.js";
15
- import ToolbarItem from "./ToolbarItem.js";
15
+ import ToolbarItemBase from "./ToolbarItemBase.js";
16
16
  /**
17
17
  * @class
18
18
  *
@@ -26,11 +26,11 @@ import ToolbarItem from "./ToolbarItem.js";
26
26
  * `import "@ui5/webcomponents/dist/ToolbarSelectOption.js";` (comes with `ui5-toolbar-select`)
27
27
  * @constructor
28
28
  * @abstract
29
- * @extends ToolbarItem
29
+ * @extends ToolbarItemBase
30
30
  * @public
31
31
  * @since 1.17.0
32
32
  */
33
- let ToolbarSelect = class ToolbarSelect extends ToolbarItem {
33
+ let ToolbarSelect = class ToolbarSelect extends ToolbarItemBase {
34
34
  constructor() {
35
35
  super(...arguments);
36
36
  /**