Skip to content

Commit 4f49349

Browse files
committed
chore: clear noise
1 parent 154370d commit 4f49349

File tree

4 files changed

+44
-27
lines changed

4 files changed

+44
-27
lines changed

packages/main/src/Option.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ListItemType from "./types/ListItemType.js";
99
import { IButton } from "./Button.js";
1010
import type { ListItemAccessibilityAttributes as OptionAccessibilityAttributes } from "./ListItem.js";
1111
import HighlightTypes from "./types/HighlightTypes.js";
12+
import { IOption } from "./Select.js";
1213

1314
/**
1415
* @class
@@ -32,7 +33,7 @@ import HighlightTypes from "./types/HighlightTypes.js";
3233
* @deprecated
3334
*/
3435
@event("detail-click")
35-
class Option extends StandardListItem {
36+
class Option extends StandardListItem implements IOption {
3637
/**
3738
* Defines the text of the component.
3839
*

packages/main/src/OptionCustom.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { IButton } from "./Button.js";
88
import ListItemType from "./types/ListItemType.js";
99
import type { ListItemAccessibilityAttributes as CustomOptionAccessibilityAttributes } from "./ListItem.js";
1010
import HighlightTypes from "./types/HighlightTypes.js";
11+
import { IOption } from "./Select.js";
1112

1213
/**
1314
* @class
@@ -34,7 +35,7 @@ import HighlightTypes from "./types/HighlightTypes.js";
3435
* @deprecated
3536
*/
3637
@event("detail-click")
37-
class OptionCustom extends CustomListItem {
38+
class OptionCustom extends CustomListItem implements IOption {
3839
/**
3940
* Defines the text, displayed inside the `ui5-select` input filed
4041
* when the option gets selected.
@@ -106,6 +107,15 @@ class OptionCustom extends CustomListItem {
106107
@slot()
107108
declare deleteButton: Array<IButton>;
108109

110+
/**
111+
* Defines the text of the component.
112+
*
113+
* **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
114+
* @public
115+
*/
116+
@slot({ type: Node, "default": true, invalidateOnChildChange: true })
117+
content!: Array<Node>;
118+
109119
get effectiveDisplayText() {
110120
return this.displayText || this.textContent || "";
111121
}

packages/main/src/Select.ts

+28-22
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,22 @@ import {
1919
import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js";
2020
import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js";
2121
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
22-
import "@ui5/webcomponents-icons/dist/alert.js";
23-
import "@ui5/webcomponents-icons/dist/decline.js";
24-
import "@ui5/webcomponents-icons/dist/error.js";
25-
import "@ui5/webcomponents-icons/dist/information.js";
2622
import "@ui5/webcomponents-icons/dist/slim-arrow-down.js";
23+
import "@ui5/webcomponents-icons/dist/error.js";
24+
import "@ui5/webcomponents-icons/dist/alert.js";
2725
import "@ui5/webcomponents-icons/dist/sys-enter-2.js";
26+
import "@ui5/webcomponents-icons/dist/information.js";
27+
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
2828
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
2929
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
30+
import "@ui5/webcomponents-icons/dist/decline.js";
3031
import type { Timeout } from "@ui5/webcomponents-base/dist/types.js";
3132
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
3233
import InvisibleMessageMode from "@ui5/webcomponents-base/dist/types/InvisibleMessageMode.js";
3334
import { getScopedVarName } from "@ui5/webcomponents-base/dist/CustomElementsScope.js";
34-
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
3535
import type { IFormInputElement } from "@ui5/webcomponents-base/dist/features/InputElementsFormSupport.js";
36-
import Button from "./Button.js";
37-
import CustomListItem from "./CustomListItem.js";
38-
import Icon from "./Icon.js";
39-
import Label from "./Label.js";
40-
import type { ListItemClickEventDetail } from "./List.js";
4136
import List from "./List.js";
42-
import Popover from "./Popover.js";
43-
import ResponsivePopover from "./ResponsivePopover.js";
37+
import type { ListItemClickEventDetail } from "./List.js";
4438
import {
4539
VALUE_STATE_SUCCESS,
4640
VALUE_STATE_INFORMATION,
@@ -55,16 +49,21 @@ import {
5549
SELECT_ROLE_DESCRIPTION,
5650
FORM_SELECTABLE_REQUIRED,
5751
} from "./generated/i18n/i18n-defaults.js";
52+
import Label from "./Label.js";
53+
import ResponsivePopover from "./ResponsivePopover.js";
54+
import Popover from "./Popover.js";
55+
import Icon from "./Icon.js";
56+
import Button from "./Button.js";
57+
import ListItemBase from "./ListItemBase.js";
5858

5959
// Templates
6060
import SelectTemplate from "./generated/templates/SelectTemplate.lit.js";
61-
import ResponsivePopoverCommonCss from "./generated/themes/ResponsivePopoverCommon.css.js";
62-
import ValueStateMessageCss from "./generated/themes/ValueStateMessage.css.js";
63-
import SelectPopoverCss from "./generated/themes/SelectPopover.css.js";
6461

6562
// Styles
6663
import selectCss from "./generated/themes/Select.css.js";
67-
import ListItemBase from "./ListItemBase.js";
64+
import ResponsivePopoverCommonCss from "./generated/themes/ResponsivePopoverCommon.css.js";
65+
import ValueStateMessageCss from "./generated/themes/ValueStateMessage.css.js";
66+
import SelectPopoverCss from "./generated/themes/SelectPopover.css.js";
6867

6968
type SelectChangeEventDetail = {
7069
selectedOption: IOption,
@@ -73,10 +72,17 @@ type SelectLiveChangeEventDetail = {
7372
selectedOption: IOption,
7473
}
7574

75+
/**
76+
* Interface for components that may be slotted inside `ui5-select` as options
77+
* @public
78+
*/
7679
type IOption = ListItemBase & {
77-
icon?: string,
78-
value?: string,
79-
effectiveDisplayText: string
80+
tooltip: string,
81+
icon?: string | null,
82+
value: string,
83+
additionalText?: string,
84+
focused?: boolean,
85+
effectiveDisplayText: string,
8086
}
8187

8288
/**
@@ -137,7 +143,6 @@ type IOption = ListItemBase & {
137143
ResponsivePopover,
138144
Popover,
139145
List,
140-
CustomListItem,
141146
Icon,
142147
Button,
143148
],
@@ -340,7 +345,7 @@ class Select extends UI5Element implements IFormInputElement {
340345
const selectedOption = this.selectedOption;
341346

342347
if (selectedOption) {
343-
return selectedOption.hasAttribute("value") ? selectedOption.value as string : selectedOption.textContent;
348+
return selectedOption.hasAttribute("value") ? selectedOption.value : selectedOption.textContent;
344349
}
345350

346351
return "";
@@ -923,6 +928,7 @@ Select.define();
923928

924929
export default Select;
925930
export type {
926-
IOption, SelectChangeEventDetail,
931+
IOption,
932+
SelectChangeEventDetail,
927933
SelectLiveChangeEventDetail,
928934
};

packages/main/src/themes/SelectPopover.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
padding: 0;
44
}
55

6-
.ui5-select-popover [ui5-li],
7-
.ui5-select-popover [ui5-li-custom] {
6+
.ui5-select-popover [ui5-option],
7+
.ui5-select-popover [ui5-option-custom] {
88
height: var(--_ui5_list_item_dropdown_base_height);
99
}
1010

11-
.ui5-select-popover [ui5-li]::part(icon) {
11+
.ui5-select-popover [ui5-option]::part(icon) {
1212
color: var(--sapList_TextColor);
1313
}

0 commit comments

Comments
 (0)