@sapudex/web-components 2.22.0 → 2.23.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.
Files changed (170) hide show
  1. package/cypress/specs/CountrySelector.cy.tsx +158 -144
  2. package/cypress/specs/EventRibbon.cy.tsx +3 -1
  3. package/cypress/specs/SelectBox.cy.tsx +173 -206
  4. package/cypress/specs/Tag.cy.tsx +1 -1
  5. package/cypress/specs/TextField.cy.tsx +15 -0
  6. package/cypress/specs/Textarea.cy.tsx +15 -33
  7. package/dist/CountrySelector.d.ts +25 -142
  8. package/dist/CountrySelector.js +91 -268
  9. package/dist/CountrySelector.js.map +1 -1
  10. package/dist/FilterMenu.d.ts +14 -2
  11. package/dist/FilterMenu.js +11 -1
  12. package/dist/FilterMenu.js.map +1 -1
  13. package/dist/List.js +2 -3
  14. package/dist/List.js.map +1 -1
  15. package/dist/ListGroupHeaderBase.d.ts +1 -0
  16. package/dist/ListGroupHeaderBase.js +3 -0
  17. package/dist/ListGroupHeaderBase.js.map +1 -1
  18. package/dist/ListItemBase.d.ts +12 -0
  19. package/dist/ListItemBase.js +17 -2
  20. package/dist/ListItemBase.js.map +1 -1
  21. package/dist/MediaPlayer.js +2 -0
  22. package/dist/MediaPlayer.js.map +1 -1
  23. package/dist/MediaPlayerTemplate.js +4 -4
  24. package/dist/MediaPlayerTemplate.js.map +1 -1
  25. package/dist/SearchableListBase.d.ts +23 -16
  26. package/dist/SearchableListBase.js +48 -72
  27. package/dist/SearchableListBase.js.map +1 -1
  28. package/dist/SelectBase.d.ts +193 -0
  29. package/dist/SelectBase.js +428 -0
  30. package/dist/SelectBase.js.map +1 -0
  31. package/dist/SelectBox.d.ts +30 -152
  32. package/dist/SelectBox.js +139 -348
  33. package/dist/SelectBox.js.map +1 -1
  34. package/dist/TagGroup.d.ts +23 -5
  35. package/dist/TagGroup.js +37 -16
  36. package/dist/TagGroup.js.map +1 -1
  37. package/dist/TagTemplate.js +4 -2
  38. package/dist/TagTemplate.js.map +1 -1
  39. package/dist/TextArea.d.ts +1 -1
  40. package/dist/TextArea.js +5 -5
  41. package/dist/TextArea.js.map +1 -1
  42. package/dist/TextAreaTemplate.d.ts +2 -0
  43. package/dist/TextAreaTemplate.js +13 -0
  44. package/dist/TextAreaTemplate.js.map +1 -0
  45. package/dist/TextField.d.ts +29 -4
  46. package/dist/TextField.js +32 -16
  47. package/dist/TextField.js.map +1 -1
  48. package/dist/TextFieldTemplate.d.ts +2 -0
  49. package/dist/TextFieldTemplate.js +14 -0
  50. package/dist/TextFieldTemplate.js.map +1 -0
  51. package/dist/assets/{InputSuggestions-By00xQan.js → InputSuggestions-C8m6N2-d.js} +1 -1
  52. package/dist/assets/{ListItemStandardExpandableTextTemplate-BGtoxRbA.js → ListItemStandardExpandableTextTemplate-BwD5bYhw.js} +1 -1
  53. package/dist/assets/{bundle.esm-9yDdQqR5.js → bundle.esm-hGsUwmUy.js} +218 -217
  54. package/dist/css/themes/CountrySelector.css +1 -1
  55. package/dist/css/themes/EventRibbon.css +1 -1
  56. package/dist/css/themes/ListItem.css +1 -1
  57. package/dist/css/themes/MastheadItem.css +1 -1
  58. package/dist/css/themes/MastheadMobileMenu.css +1 -1
  59. package/dist/css/themes/RatingIndicator.css +1 -1
  60. package/dist/css/themes/Search.css +1 -1
  61. package/dist/css/themes/SelectBase.css +1 -0
  62. package/dist/css/themes/SelectBox.css +1 -1
  63. package/dist/css/themes/Slider.css +1 -1
  64. package/dist/css/themes/TagGroup.css +1 -1
  65. package/dist/css/themes/TextField.css +1 -1
  66. package/dist/custom-elements-internal.json +1088 -1284
  67. package/dist/custom-elements.json +284 -934
  68. package/dist/generated/templates/CountrySelectorTemplate.lit.js +3 -3
  69. package/dist/generated/templates/CountrySelectorTemplate.lit.js.map +1 -1
  70. package/dist/generated/templates/ListItemTemplate.lit.js +1 -1
  71. package/dist/generated/templates/ListItemTemplate.lit.js.map +1 -1
  72. package/dist/generated/templates/SelectBoxTemplate.lit.js +10 -9
  73. package/dist/generated/templates/SelectBoxTemplate.lit.js.map +1 -1
  74. package/dist/generated/themes/CountrySelector.css.d.ts +1 -1
  75. package/dist/generated/themes/CountrySelector.css.js +1 -1
  76. package/dist/generated/themes/CountrySelector.css.js.map +1 -1
  77. package/dist/generated/themes/EventRibbon.css.d.ts +1 -1
  78. package/dist/generated/themes/EventRibbon.css.js +1 -1
  79. package/dist/generated/themes/EventRibbon.css.js.map +1 -1
  80. package/dist/generated/themes/ListItem.css.d.ts +1 -1
  81. package/dist/generated/themes/ListItem.css.js +1 -1
  82. package/dist/generated/themes/ListItem.css.js.map +1 -1
  83. package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
  84. package/dist/generated/themes/MastheadItem.css.js +1 -1
  85. package/dist/generated/themes/MastheadItem.css.js.map +1 -1
  86. package/dist/generated/themes/MastheadMobileMenu.css.d.ts +1 -1
  87. package/dist/generated/themes/MastheadMobileMenu.css.js +1 -1
  88. package/dist/generated/themes/MastheadMobileMenu.css.js.map +1 -1
  89. package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
  90. package/dist/generated/themes/RatingIndicator.css.js +1 -1
  91. package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
  92. package/dist/generated/themes/Search.css.d.ts +1 -1
  93. package/dist/generated/themes/Search.css.js +1 -1
  94. package/dist/generated/themes/Search.css.js.map +1 -1
  95. package/dist/generated/themes/SelectBase.css.d.ts +2 -0
  96. package/dist/generated/themes/SelectBase.css.js +8 -0
  97. package/dist/generated/themes/SelectBase.css.js.map +1 -0
  98. package/dist/generated/themes/SelectBox.css.d.ts +1 -1
  99. package/dist/generated/themes/SelectBox.css.js +1 -1
  100. package/dist/generated/themes/SelectBox.css.js.map +1 -1
  101. package/dist/generated/themes/Slider.css.d.ts +1 -1
  102. package/dist/generated/themes/Slider.css.js +1 -1
  103. package/dist/generated/themes/Slider.css.js.map +1 -1
  104. package/dist/generated/themes/TagGroup.css.d.ts +1 -1
  105. package/dist/generated/themes/TagGroup.css.js +1 -1
  106. package/dist/generated/themes/TagGroup.css.js.map +1 -1
  107. package/dist/generated/themes/TextField.css.d.ts +1 -1
  108. package/dist/generated/themes/TextField.css.js +1 -1
  109. package/dist/generated/themes/TextField.css.js.map +1 -1
  110. package/dist/types/common.d.ts +1 -1
  111. package/dist/types/common.js +1 -1
  112. package/dist/types/common.js.map +1 -1
  113. package/dist/vscode.html-custom-data.json +23 -234
  114. package/dist/web-types.json +256 -811
  115. package/package.json +1 -1
  116. package/src/CountrySelector.hbs +6 -61
  117. package/src/CountrySelector.ts +93 -375
  118. package/src/FilterMenu.ts +13 -3
  119. package/src/List.ts +2 -3
  120. package/src/ListGroupHeaderBase.ts +4 -0
  121. package/src/ListItem.hbs +0 -1
  122. package/src/ListItemBase.ts +17 -3
  123. package/src/MediaPlayer.ts +2 -0
  124. package/src/MediaPlayerTemplate.tsx +0 -1
  125. package/src/SearchableListBase.ts +68 -83
  126. package/src/SelectBase.ts +580 -0
  127. package/src/SelectBox.hbs +118 -107
  128. package/src/SelectBox.ts +155 -445
  129. package/src/TagGroup.ts +53 -19
  130. package/src/TagTemplate.tsx +4 -2
  131. package/src/TextArea.ts +5 -5
  132. package/src/TextAreaTemplate.tsx +67 -0
  133. package/src/TextField.ts +57 -24
  134. package/src/TextFieldTemplate.tsx +90 -0
  135. package/src/generated/templates/CountrySelectorTemplate.lit.ts +2 -2
  136. package/src/generated/templates/ListItemTemplate.lit.ts +1 -1
  137. package/src/generated/templates/SelectBoxTemplate.lit.ts +10 -9
  138. package/src/generated/themes/CountrySelector.css.ts +1 -1
  139. package/src/generated/themes/EventRibbon.css.ts +1 -1
  140. package/src/generated/themes/ListItem.css.ts +1 -1
  141. package/src/generated/themes/MastheadItem.css.ts +1 -1
  142. package/src/generated/themes/MastheadMobileMenu.css.ts +1 -1
  143. package/src/generated/themes/RatingIndicator.css.ts +1 -1
  144. package/src/generated/themes/Search.css.ts +1 -1
  145. package/src/generated/themes/SelectBase.css.ts +9 -0
  146. package/src/generated/themes/SelectBox.css.ts +1 -1
  147. package/src/generated/themes/Slider.css.ts +1 -1
  148. package/src/generated/themes/TagGroup.css.ts +1 -1
  149. package/src/generated/themes/TextField.css.ts +1 -1
  150. package/src/themes/CountrySelector.css +42 -115
  151. package/src/themes/EventRibbon.css +21 -13
  152. package/src/themes/ListItem.css +6 -0
  153. package/src/themes/MastheadItem.css +0 -2
  154. package/src/themes/MastheadMobileMenu.css +2 -0
  155. package/src/themes/Search.css +0 -1
  156. package/src/themes/SelectBase.css +239 -0
  157. package/src/themes/SelectBox.css +13 -195
  158. package/src/themes/TagGroup.css +0 -1
  159. package/src/themes/TextField.css +7 -7
  160. package/src/types/common.ts +1 -1
  161. package/dist/generated/templates/TextAreaTemplate.lit.d.ts +0 -3
  162. package/dist/generated/templates/TextAreaTemplate.lit.js +0 -13
  163. package/dist/generated/templates/TextAreaTemplate.lit.js.map +0 -1
  164. package/dist/generated/templates/TextFieldTemplate.lit.d.ts +0 -3
  165. package/dist/generated/templates/TextFieldTemplate.lit.js +0 -14
  166. package/dist/generated/templates/TextFieldTemplate.lit.js.map +0 -1
  167. package/src/TextArea.hbs +0 -54
  168. package/src/TextField.hbs +0 -78
  169. package/src/generated/templates/TextAreaTemplate.lit.ts +0 -17
  170. package/src/generated/templates/TextFieldTemplate.lit.ts +0 -18
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@sapudex/web-components",
4
- "version": "2.22.0",
4
+ "version": "2.23.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
@@ -1,61 +1,6 @@
1
- <div class="{{countrySelectorClasses}}">
2
- {{> trigger}}
3
- <udex-dropdown
4
- id="dropdown"
5
- opener="udex-{{this._id}}-country-selector__opener"
6
- horizontal-align="Start"
7
- height="{{height}}"
8
- @ui5-item-press="{{handleItemPress}}"
9
- @ui5-before-open="{{_dropdownBeforeOpen}}"
10
- @ui5-open="{{_dropdownOpen}}"
11
- @ui5-before-close="{{_dropdownBeforeClose}}"
12
- @ui5-close="{{_dropdownClose}}"
13
- @ui5-submit-search-value="{{handleSubmitSearch}}"
14
- @ui5-handle-value-search="{{handleValueSearch}}"
15
- @ui5-handle-value-reset="{{handleResetSearch}}"
16
- @ui5-search-keydown="{{handleKeyDownSearch}}"
17
- @keydown="{{handleKeyDownDropdown}}">
18
- {{searchableList}}
19
- </udex-dropdown>
20
- </div>
21
-
22
- {{#*inline "trigger"}}
23
- <div
24
- id="udex-{{this._id}}-country-selector__opener"
25
- class="{{countrySelectorTriggerClasses}}"
26
- ?disabled="{{isOpenerDisabled}}"
27
- @click="{{handleTriggerClick}}"
28
- slot="trigger">
29
- {{#if showFlagImages}}
30
- <img
31
- class="udex-country-selector__image"
32
- aria-label="{{flagAriaLabel}}"
33
- style="background-position-x: {{selectedCountryFlagX}}; background-position-y: {{selectedCountryFlagY}}">
34
- {{/if}}
35
- <udex-text-field
36
- label="{{effectiveAriaLabel}}"
37
- id="udexTextField"
38
- class="udex-country-selector__text"
39
- value="{{selectedCountryName}}"
40
- value-state="{{valueState}}"
41
- supporting-text="{{supportingText}}"
42
- direction="left"
43
- aria-label="{{effectiveAriaLabel}}"
44
- accessible-name="{{supportingText}}"
45
- accessible-name-ref="{{accessibleNameRef}}"
46
- aria-controls="{{ariaControls}}"
47
- aria-haspopup="true"
48
- aria-expanded="{{_open}}"
49
- ?required="{{required}}"
50
- ?disabled="{{disabled}}"
51
- ?readonly="{{readonly}}"
52
- ?displayonly="{{displayonly}}"
53
- @ui5-click-icon="{{handleTriggerClick}}"
54
- @mousedown="{{handleInputMouseDown}}"
55
- icon="{{triggerIcon}}"
56
- accessible-icon-name="{{effectiveAriaLabel}}"
57
- maxlength="0"
58
- _is-combobox-role>
59
- </udex-text-field>
60
- </div>
61
- {{/inline}}
1
+ {{#unless hideFlagImages}}
2
+ <img
3
+ class="udex-text-field__image"
4
+ aria-label="{{flagAriaLabel}}"
5
+ style="background-position-x: {{selectedCountryFlagX}}; background-position-y: {{selectedCountryFlagY}}">
6
+ {{/unless}}
@@ -1,33 +1,26 @@
1
1
  import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
2
2
  import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
3
3
  import property from "@ui5/webcomponents-base/dist/decorators/property.js";
4
- import executeTemplate from "@ui5/webcomponents-base/dist/renderer/executeTemplate.js";
5
- import { isEscape, isTabPrevious, isTabNext } from "@ui5/webcomponents-base/dist/Keys.js";
6
- import type Popover from "@ui5/webcomponents/dist/Popover.js";
7
- import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
8
- import Button from "@ui5/webcomponents/dist/Button.js";
9
- import type { ResizeObserverCallback } from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
10
- import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
4
+ import UI5Button from "@ui5/webcomponents/dist/Button.js";
11
5
  import "@ui5/webcomponents-icons/dist/navigation-down-arrow.js";
12
6
  import "@ui5/webcomponents-icons/dist/navigation-up-arrow.js";
13
7
  import type { Country } from "./data/CountryListISO3166.js";
14
8
  import { CountryListDB } from "./data/CountryListISO3166.js";
15
- import { COUNTRY_SELECT } from "./generated/i18n/i18n-defaults.js";
16
- import Search from "./Search.js";
9
+ import UDExSearch from "./Search.js";
17
10
  import UDExDropdown from "./Dropdown.js";
18
11
  import UDExList from "./List.js";
19
- import UDExSearchableListBase from "./SearchableListBase.js";
12
+ import UDExSelectBase from "./SelectBase.js";
20
13
  import UDExListItem from "./ListItem.js";
21
14
  import UDExTextField from "./TextField.js";
22
- import UDExValueState from "./types/common.js";
23
- import StatusMessage from "./StatusMessage.js";
24
- import type { UDExSearchKeydownEventDetail } from "./Search.js";
25
- import type { UDExSearchableListBaseEvents } from "./SearchableListBase.js";
26
- import CountrySelectorTemplate from "./generated/templates/CountrySelectorTemplate.lit.js";
27
- import SearchableListBaseTemplate from "./generated/templates/SearchableListBaseTemplate.lit.js";
15
+ import UDExStatusMessage from "./StatusMessage.js";
16
+ import SelectBoxTemplate from "./generated/templates/SelectBoxTemplate.lit.js";
28
17
 
29
18
  // Styles
30
19
  import CountrySelectorCss from "./generated/themes/CountrySelector.css.js";
20
+ import TextFieldCss from "./generated/themes/TextField.css.js";
21
+ import SelectBaseCss from "./generated/themes/SelectBase.css.js";
22
+ import SearchableListCss from "./generated/themes/SearchableList.css.js";
23
+ import getEffectiveScrollbarStyle from "./utils/getEffectiveScrollbarStyle.js";
31
24
 
32
25
  type UDExCountrySelectorChangeSearchEventDetail = {
33
26
  value: string,
@@ -54,157 +47,26 @@ type UDExCountrySelectorChangeSearchEventDetail = {
54
47
  @customElement({
55
48
  tag: "udex-country-selector",
56
49
  renderer: litRender,
57
- styles: CountrySelectorCss,
58
- template: CountrySelectorTemplate,
50
+ styles: [
51
+ TextFieldCss,
52
+ SelectBaseCss,
53
+ CountrySelectorCss,
54
+ SearchableListCss,
55
+ getEffectiveScrollbarStyle(),
56
+ ],
57
+ template: SelectBoxTemplate,
59
58
  dependencies: [
60
- Search,
61
- Button,
59
+ UI5Button,
62
60
  UDExList,
61
+ UDExSearch,
63
62
  UDExListItem,
64
63
  UDExDropdown,
65
64
  UDExTextField,
66
- StatusMessage,
65
+ UDExStatusMessage,
67
66
  ],
68
67
  })
69
68
 
70
- /**
71
- * Fired before the dropdown pane is opened.
72
- *
73
- * @public
74
- */
75
- @event("before-open", { bubbles: true })
76
-
77
- /**
78
- * Fired after the dropdown pane is opened.
79
- *
80
- * @public
81
- */
82
- @event("open", { bubbles: true })
83
-
84
- /**
85
- * Fired before the dropdown pane is closed.
86
- *
87
- * @public
88
- */
89
- @event("before-close", { bubbles: true })
90
-
91
- /**
92
- * Fired after the dropdown pane is closed.
93
- *
94
- * @public
95
- */
96
- @event("close", { bubbles: true })
97
-
98
- /**
99
- * Fired event when the user submitted the value in the search.
100
- *
101
- * @public
102
- * @param {string} value The current value of the search field
103
- */
104
- @event("change-search", { bubbles: true })
105
-
106
- /**
107
- * Fired event when the user clicks on the reset button in the search.
108
- *
109
- * @public
110
- */
111
- @event("reset-search", { bubbles: true })
112
-
113
- /**
114
- * Fired event when the user clicks on the submitted icon in the search.
115
- *
116
- * @public
117
- */
118
- @event("submit-search", { bubbles: true })
119
-
120
- class UDExCountrySelector extends UDExSearchableListBase {
121
- eventDetails!: {
122
- "open": void,
123
- "close": void,
124
- "before-close": void,
125
- "before-open": void,
126
- "change-search": UDExCountrySelectorChangeSearchEventDetail,
127
- } & Omit<UDExSearchableListBaseEvents, "change-search">;
128
-
129
- /**
130
- * Defines label text for the input field.
131
- *
132
- * @default undefined
133
- * @public
134
- */
135
- @property({ type: String })
136
- label?: string;
137
-
138
- /**
139
- * Defines the accessible ARIA name of the component.
140
- *
141
- * @default undefined
142
- * @public
143
- */
144
- @property()
145
- accessibleName?: string;
146
-
147
- /**
148
- * Receives id (or many ids) of the elements that label the component.
149
- * @default ""
150
- * @public
151
- */
152
- @property()
153
- accessibleNameRef: string = "";
154
-
155
- /**
156
- * Defines whether the component is required.
157
- *
158
- * @default false
159
- * @public
160
- */
161
- @property({ type: Boolean })
162
- required!: boolean;
163
-
164
- /**
165
- * Allows control over the height.
166
- *
167
- * @public
168
- */
169
- @property({ type: String })
170
- height?: string;
171
-
172
- /**
173
- * Defines whether the component is in disabled state.
174
- * <br><br>
175
- * <b>Note:</b> A disabled component is completely noninteractive.
176
- *
177
- * @default false
178
- * @public
179
- */
180
- @property({ type: Boolean })
181
- disabled!: boolean;
182
-
183
- /**
184
- * Defines whether the component is read-only.
185
- * <br><br>
186
- * <b>Note:</b> A read-only component is not editable,
187
- * but still provides visual feedback upon user interaction.
188
- *
189
- * @default false
190
- * @public
191
- */
192
- @property({ type: Boolean })
193
- readonly!: boolean;
194
-
195
- /**
196
- * Defines whether the component is display-only.
197
- * <br><br>
198
- * <b>Note:</b> A display-only component is not editable,
199
- * but still provides visual feedback upon user interaction, input border is not visible.
200
- *
201
- * @default false
202
- * @public
203
- */
204
-
205
- @property({ type: Boolean })
206
- displayonly!: boolean;
207
-
69
+ class UDExCountrySelector extends UDExSelectBase {
208
70
  /**
209
71
  * Allows to define the initially preselected country.
210
72
  *
@@ -224,194 +86,113 @@ class UDExCountrySelector extends UDExSearchableListBase {
224
86
  blockedCountryCodes?: string;
225
87
 
226
88
  /**
227
- * Defines the placeholder of the search.
228
- *
229
- * @default ""
230
- * @public
231
- */
232
- @property({ type: String })
233
- searchPlaceholder!: string;
234
-
235
- /**
236
- * Defines the value state of the component.
89
+ * Allows to hide the flag images in the country selector.
237
90
  *
238
- * @default "Standard"
239
- * @public
240
- */
241
- @property()
242
- valueState: `${UDExValueState}` = UDExValueState.Standard;
243
-
244
- /**
245
- * Defines supporting text under the country selector.
246
- *
247
- * @default undefined
91
+ * @default false
248
92
  * @public
249
93
  */
250
- @property({ type: String })
251
- supportingText?: string;
94
+ @property({ type: Boolean })
95
+ hideFlagImages?: boolean;
252
96
 
253
97
  /**
98
+ * Indicates whether the country selector is enabled.
254
99
  *
255
- * @public
100
+ * @default true
101
+ * @private
256
102
  */
257
103
  @property({ type: Boolean })
258
- hideFlagImages?: boolean;
104
+ _countrySelector: boolean = true;
259
105
 
260
- @property({ type: Boolean })
261
- _open?: boolean = false;
106
+ _countryList: Country[] = CountryListDB;
107
+ _selectedCountry!: Country | undefined;
262
108
 
263
- countryList: Country[] = CountryListDB;
264
- selectedCountry!: Country | undefined;
265
- _trigger!: UDExTextField;
266
-
267
- _dropdown!: UDExDropdown;
268
- _search!: Search;
269
- _handleResizeBound: ResizeObserverCallback;
270
-
271
- constructor() {
272
- super();
273
- this._shouldFilterItems = false;
274
- this._handleResizeBound = this._handleResize.bind(this);
275
- this._filteredItems = [];
276
- }
277
-
278
- onEnterDOM(): void {
279
- ResizeHandler.register(this, this._handleResizeBound);
280
- }
281
-
282
- onExitDOM(): void {
283
- ResizeHandler.deregister(this, this._handleResizeBound);
109
+ onAfterRendering(): void {
110
+ super.onAfterRendering();
111
+ this.handleOutsideClick();
284
112
  }
285
113
 
286
114
  onBeforeRendering(): void {
287
- if (this.blockedCountryCodes?.length) {
288
- const blockedCountryCodesArray = this.blockedCountryCodes.split(",").map(code => code.trim().toUpperCase());
289
- this.countryList = this.countryList.filter(country => !blockedCountryCodesArray?.includes(country.iso.toUpperCase()));
290
- }
291
-
292
- if (!this.selectedCountry) {
293
- this.selectedCountry = this.countryList.find(country => country.iso.toUpperCase() === this.preselectedCountry?.toUpperCase());
294
- }
295
-
115
+ super.onBeforeRendering();
116
+ this.filterBlockedCountries();
117
+ this.setPreselectedCountry();
296
118
  this.prepareCountrySelectorItems();
297
-
298
- if (!this._shouldFilterItems) {
299
- this._filteredItems = this.getProcessedItems();
300
- }
301
- }
302
-
303
- onAfterRendering() {
304
- this._dropdown = this.getDropdown();
305
- this._search = this.getSearch();
306
- this._trigger = this.getTrigger();
307
119
  }
308
120
 
309
- getTrigger(): UDExTextField {
310
- return this.shadowRoot!.querySelector<UDExTextField>("[udex-text-field]")!;
121
+ handleItemPress(e: CustomEvent): void {
122
+ this.handleItemSelection(e);
123
+ this.selectCountryByElement(e.target as HTMLElement);
311
124
  }
312
125
 
313
- _dropdownClose() {
314
- this.fireDecoratorEvent("close");
315
- this._trigger.iconActive = false;
126
+ handleInputFocusIn(): void {
127
+ this.inputFocusIn();
316
128
  }
317
129
 
318
- _dropdownOpen() {
319
- this.fireDecoratorEvent("open");
320
- this._trigger.iconActive = true;
321
- }
322
-
323
- _dropdownBeforeOpen() {
324
- this._open = true;
325
- this.onResetSearch();
326
- this.fireDecoratorEvent("before-open");
327
- }
328
-
329
- _dropdownBeforeClose() {
330
- this._open = false;
331
- this.fireDecoratorEvent("before-close");
332
- }
130
+ handleInputFocusOut(e: FocusEvent): void {
131
+ const relatedTarget = e.relatedTarget as HTMLElement;
132
+ const isInsideComponent = relatedTarget?.closest(`.${this._rootClass}`);
333
133
 
334
- get searchableList() {
335
- this.defaultAccessibleRole = "listbox";
336
- return executeTemplate(UDExCountrySelector.searchableListBaseTemplate, this);
337
- }
338
-
339
- static get searchableListBaseTemplate() {
340
- return SearchableListBaseTemplate;
341
- }
134
+ if (!isInsideComponent) {
135
+ this.closeDropdown();
136
+ this.resetSearchState();
137
+ this.updateImagePosition();
138
+ }
342
139
 
343
- _handleResize() {
344
- this._dropdown.style.setProperty("--udex-dropdown-pane-width", `${this._trigger.offsetWidth}px`);
140
+ this._focused = false;
345
141
  }
346
142
 
347
- handleCloseSearch() {
348
- this.getTextField()?.shadowRoot!.querySelector<Button>("[udex-control-button]")?.focus();
143
+ handleKeyDownSearch(e: KeyboardEvent): void {
144
+ this.onKeyDownSearch(e);
349
145
  }
350
146
 
351
- handleItemPress(e: CustomEvent) {
352
- this.onItemPress(e);
353
- const target = e.target as HTMLElement;
354
- const item: any = this.getItemFromList(target?.getAttribute("data-token-id") as string);
355
- this.selectedCountry = this.countryList.find(country => country.iso === item._id);
356
- this.dropDownClose();
147
+ handleDropdownBeforeOpen(): void {
148
+ this.dropdownBeforeOpen();
357
149
  }
358
150
 
359
- handleKeyPress(keyEvent: KeyboardEvent) {
360
- const key = keyEvent.key;
361
- this._dropdown.open = true;
362
- this._search.focus();
363
- this._search.value = key;
364
- this.fireChangeSearch();
151
+ handleDropdownClose(): void {
152
+ this._open = false;
153
+ this.fireEventDropdownClose();
365
154
  }
366
155
 
367
- handleInputMouseDown(e: CustomEvent): void {
368
- e.preventDefault();
156
+ handleOutsideClick(): void {
157
+ document.addEventListener("click", (e: Event) => {
158
+ if (e.target !== this) {
159
+ this._open = this._popover.open;
160
+ }
161
+ });
369
162
  }
370
163
 
371
- handleTriggerClick() {
372
- if (!this.isOpenerDisabled) {
373
- this._dropdown.opener = this.getTextField()._inputHolder;
374
- this._dropdown.open = !this._dropdown.open;
164
+ updateImagePosition(): void {
165
+ const imagePlaceholder = this.shadowRoot!.querySelector<HTMLElement>(".udex-text-field__input > .udex-text-field__image");
166
+ if (imagePlaceholder) {
167
+ imagePlaceholder.style.backgroundPosition = this.selectedCountryFlagX || "";
375
168
  }
376
169
  }
377
170
 
378
- handleValueSearch(e: CustomEvent): void {
379
- this.onSearch(e);
380
- this.fireChangeSearch();
381
- }
382
-
383
- handleSubmitSearch(): void {
384
- this.onSubmitSearch();
385
- }
386
-
387
- handleKeyDownSearch(keyEvent: CustomEvent<UDExSearchKeydownEventDetail>) {
388
- const { detail: { e } } = keyEvent;
389
-
390
- if (isTabPrevious(e) || isEscape(e)) {
391
- e.preventDefault();
392
- this.dropDownClose();
393
- this.handleCloseSearch();
171
+ filterBlockedCountries(): void {
172
+ if (this.blockedCountryCodes?.length) {
173
+ const blockedCountryCodesArray = this.blockedCountryCodes.split(",").map(code => code.trim().toUpperCase());
174
+ this._countryList = this._countryList.filter(country => !blockedCountryCodesArray.includes(country.iso.toUpperCase()));
394
175
  }
395
176
  }
396
177
 
397
- handleKeyDownDropdown(e: KeyboardEvent) {
398
- if ((isTabNext(e) && (e.target !== this._search || this.isListEmpty))) {
399
- this.dropDownClose();
178
+ setPreselectedCountry(): void {
179
+ if (!this._selectedCountry && this.preselectedCountry) {
180
+ const preselectedISO = this.preselectedCountry.toUpperCase();
181
+ this._selectedCountry = this._countryList.find(({ iso }) => iso.toUpperCase() === preselectedISO);
400
182
  }
401
183
  }
402
184
 
403
- dropDownClose(): void {
404
- this._dropdown.open = false;
405
- }
406
-
407
- handleResetSearch() {
408
- this.onResetSearch();
185
+ selectCountryByElement(el: HTMLElement): void {
186
+ const tokenId = el?.getAttribute("data-token-id") || "";
187
+ const itemObj = this.getItemFromList(tokenId);
188
+ this._selectedCountry = this._countryList.find(country => country.iso === itemObj?._id);
189
+ this._selectedOption = this.selectedCountryName || "";
409
190
  }
410
191
 
411
192
  prepareCountrySelectorItems(): void {
412
193
  this.items.length = 0;
413
- this.countryList.forEach(country => {
414
- const selected = country.iso.toUpperCase() === this.selectedCountry?.iso.toUpperCase();
194
+ this._countryList.forEach(country => {
195
+ const selected = country.iso.toUpperCase() === this._selectedCountry?.iso.toUpperCase();
415
196
  this.items.push({
416
197
  label: this.getCountryLabel(country.countryName, country.localName),
417
198
  innerHTML: this.getItemTemplate(country),
@@ -421,95 +202,32 @@ class UDExCountrySelector extends UDExSearchableListBase {
421
202
  });
422
203
  }
423
204
 
424
- fireChangeSearch(): void {
425
- this.fireDecoratorEvent("change-search", { value: this._search.value });
426
- }
427
-
428
- getItemTemplate(country: Country) {
429
- return this.hideFlagImages ? undefined : `<span class="udex-country-selector-item__image" style="background-position:${country.flagX}">`;
205
+ getItemTemplate(country: Country) :string | undefined {
206
+ return this.hideFlagImages ? undefined : `<span class="udex-text-field__image" style="background-position:${country.flagX}">`;
430
207
  }
431
208
 
432
209
  getCountryLabel(countryName?: string, localName?: string): string | null {
433
210
  return localName ? `${countryName} (${localName})` : countryName || null;
434
211
  }
435
212
 
436
- get ariaControls(): string | null | undefined {
437
- const list = this.shadowRoot!.querySelector<UDExList>("[udex-list]");
438
- return list?.getAttribute("id");
439
- }
440
-
441
- get selectedCountryFlagX(): string | undefined {
442
- return this.selectedCountry?.flagX;
443
- }
444
-
445
- get selectedCountryFlagY(): string | undefined {
446
- return this.selectedCountry?.flagY;
447
- }
448
-
449
213
  get selectedCountryName(): string | null {
450
- return this.selectedCountry ? this.getCountryLabel(this.selectedCountry.countryName, this.selectedCountry.localName) : "";
214
+ return this._selectedCountry ? this.getCountryLabel(this._selectedCountry.countryName, this._selectedCountry.localName) : "";
451
215
  }
452
216
 
453
217
  get flagAriaLabel(): string {
454
- return this.getCountryLabel(this.selectedCountry?.countryName, this.selectedCountry?.localName) || "None";
455
- }
456
-
457
- get triggerIcon(): string | undefined {
458
- if (!this.displayonly) {
459
- return this._open ? "navigation-up-arrow" : "navigation-down-arrow";
460
- }
461
- }
462
-
463
- get countrySelectorClasses(): string {
464
- const baseClass = "udex-country-selector__dropdown";
465
- return this.hideFlagImages ? `${baseClass} ${baseClass}--hide-flag` : baseClass;
466
- }
467
-
468
- get countrySelectorTriggerClasses(): string {
469
- const baseClass = "udex-country-selector__trigger";
470
- const classes = [baseClass];
471
-
472
- if (this.disabled) {
473
- classes.push(`${baseClass}--disabled`);
474
- }
475
-
476
- if (this.readonly) {
477
- classes.push(`${baseClass}--readonly`);
478
- }
479
-
480
- if (this.displayonly) {
481
- classes.push(`${baseClass}--displayonly`);
482
- }
483
-
484
- return classes.join(" ");
485
- }
486
-
487
- get showFlagImages(): boolean {
488
- return !this.hideFlagImages;
218
+ return this.getCountryLabel(this._selectedCountry?.countryName, this._selectedCountry?.localName) || "None";
489
219
  }
490
220
 
491
- get isOpenerDisabled(): boolean {
492
- return this.readonly || this.displayonly || this.disabled;
493
- }
494
-
495
- getSearch(): Search {
496
- return this.shadowRoot!.querySelector<Search>("[udex-search]")!;
497
- }
498
-
499
- getDropdownPopover(): Popover {
500
- return this._dropdown.shadowRoot!.querySelector<Popover>("[ui5-popover]")!;
501
- }
502
-
503
- getDropdown(): UDExDropdown {
504
- return this.shadowRoot!.querySelector<UDExDropdown>("[udex-dropdown]")!;
221
+ get selectedCountryFlagX(): string | undefined {
222
+ return this._selectedCountry?.flagX;
505
223
  }
506
224
 
507
- getTextField(): UDExTextField {
508
- return this.shadowRoot!.querySelector<UDExTextField>("[udex-text-field]")!;
225
+ get selectedCountryFlagY(): string | undefined {
226
+ return this._selectedCountry?.flagY;
509
227
  }
510
228
 
511
- get effectiveAriaLabel(): string {
512
- return this.label || this.accessibleName || UDExCountrySelector.i18nBundle.getText(COUNTRY_SELECT);
229
+ get showImageFlags(): boolean {
230
+ return true;
513
231
  }
514
232
  }
515
233
 
package/src/FilterMenu.ts CHANGED
@@ -305,14 +305,24 @@ class UDExFilterMenu extends UDExSearchableListBase {
305
305
  @property({ type: String })
306
306
  triggerAccessibleRole: string = "combobox";
307
307
 
308
+ /**
309
+ * Determines whether the filter should be applied.
310
+ * @default false
311
+ * @private
312
+ */
308
313
  @property({ type: Boolean })
309
314
  _shouldApplyFilter: boolean = false;
310
315
 
316
+ /**
317
+ * Determines whether the component should be re-rendered.
318
+ * @default false
319
+ * @private
320
+ */
311
321
  @property({ type: Boolean, noAttribute: true })
312
322
  _requestRender = false;
313
323
 
314
324
  _trigger!: UDExButton;
315
- _search!: UDExSearch;
325
+ _search!: UDExSearch | HTMLInputElement;
316
326
  _popover!: Popover;
317
327
  _breakpointSizeXS = 640;
318
328
  _initialState: Array<initialItemState> = [];
@@ -349,8 +359,8 @@ class UDExFilterMenu extends UDExSearchableListBase {
349
359
  this.onHeaderPress(e);
350
360
  }
351
361
 
352
- handleValueSearch(e:CustomEvent): void {
353
- this.onSearch(e);
362
+ handleValueSearch(e:CustomEvent<{ value: string }>): void {
363
+ this.onSearch(e.detail.value);
354
364
  }
355
365
 
356
366
  handleSubmitSearch(): void {