@infineon/infineon-design-system-stencil 37.5.1--canary.1723.34ea69810f554741126370a7b5230b9aef9d65e5.0 → 37.6.0--canary.1954.6c07dfe4ac965c782ba6feeb2957e37be53515a7.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.
- package/dist/cjs/ifx-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/ifx-basic-table.cjs.entry.js +1 -1
- package/dist/cjs/ifx-faq.cjs.entry.js +1 -1
- package/dist/cjs/ifx-filter-accordion.cjs.entry.js +2 -2
- package/dist/cjs/ifx-filter-bar.cjs.entry.js +1 -1
- package/dist/cjs/ifx-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/ifx-filter-type-group.cjs.entry.js +1 -1
- package/dist/cjs/ifx-list-entry.cjs.entry.js +1 -1
- package/dist/cjs/ifx-multiselect_2.cjs.entry.js +4 -4
- package/dist/cjs/ifx-search-field.cjs.entry.js +348 -13
- package/dist/cjs/ifx-search-field.cjs.entry.js.map +1 -1
- package/dist/cjs/ifx-segment.cjs.entry.js +1 -1
- package/dist/cjs/ifx-segmented-control.cjs.entry.js +2 -2
- package/dist/cjs/ifx-select.cjs.entry.js +2 -2
- package/dist/cjs/ifx-slider.cjs.entry.js +2 -2
- package/dist/cjs/ifx-spinner_2.cjs.entry.js +6 -6
- package/dist/cjs/ifx-status.cjs.entry.js +1 -1
- package/dist/cjs/ifx-step.cjs.entry.js +4 -4
- package/dist/cjs/ifx-stepper.cjs.entry.js +2 -2
- package/dist/cjs/ifx-switch.cjs.entry.js +1 -1
- package/dist/cjs/ifx-tab.cjs.entry.js +1 -1
- package/dist/cjs/ifx-table.cjs.entry.js +2 -2
- package/dist/cjs/ifx-tabs.cjs.entry.js +2 -2
- package/dist/cjs/ifx-tag.cjs.entry.js +1 -1
- package/dist/cjs/ifx-templates-ui.cjs.entry.js +1 -1
- package/dist/cjs/ifx-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ifx-tooltip.cjs.entry.js +4 -4
- package/dist/cjs/ifx-tree-view-item.cjs.entry.js +2 -2
- package/dist/cjs/ifx-tree-view.cjs.entry.js +1 -1
- package/dist/cjs/infineon-design-system-stencil.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/search-field/search-field.css +114 -0
- package/dist/collection/components/search-field/search-field.js +723 -18
- package/dist/collection/components/search-field/search-field.js.map +1 -1
- package/dist/collection/components/search-field/search-field.stories.js +378 -2
- package/dist/collection/components/search-field/search-field.stories.js.map +1 -1
- package/dist/collection/components/segmented-control/segment/segment.js +1 -1
- package/dist/collection/components/segmented-control/segmented-control.js +2 -2
- package/dist/collection/components/select/multi-select/multiselect-option.js +4 -4
- package/dist/collection/components/select/single-select/select.js +2 -2
- package/dist/collection/components/slider/slider.js +2 -2
- package/dist/collection/components/spinner/spinner.js +2 -2
- package/dist/collection/components/status/status.js +1 -1
- package/dist/collection/components/stepper/step/step.js +4 -4
- package/dist/collection/components/stepper/stepper.js +2 -2
- package/dist/collection/components/switch/switch.js +1 -1
- package/dist/collection/components/table-advanced-version/filter-bar/filter-bar.js +1 -1
- package/dist/collection/components/table-advanced-version/filter-type-group/filter-accordion/filter-accordion.js +2 -2
- package/dist/collection/components/table-advanced-version/filter-type-group/filter-search/filter-search.js +1 -1
- package/dist/collection/components/table-advanced-version/filter-type-group/filter-type-group.js +1 -1
- package/dist/collection/components/table-advanced-version/list/list-entry/list-entry.js +1 -1
- package/dist/collection/components/table-advanced-version/table.js +2 -2
- package/dist/collection/components/table-basic-version/table.js +1 -1
- package/dist/collection/components/tabs/tab.js +1 -1
- package/dist/collection/components/tabs/tabs.js +2 -2
- package/dist/collection/components/tag/tag.js +1 -1
- package/dist/collection/components/templates/template/template.js +1 -1
- package/dist/collection/components/templates/templates-ui/templates-ui.js +1 -1
- package/dist/collection/components/text-field/text-field.js +4 -4
- package/dist/collection/components/textarea/textarea.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js +4 -4
- package/dist/collection/components/tree-view/tree-view-item.js +2 -2
- package/dist/collection/components/tree-view/tree-view.js +1 -1
- package/dist/collection/stories/setup-and-installation/faq/faq.js +1 -1
- package/dist/components/ifx-basic-table.js +1 -1
- package/dist/components/ifx-faq.js +1 -1
- package/dist/components/ifx-filter-accordion.js +2 -2
- package/dist/components/ifx-filter-bar.js +1 -1
- package/dist/components/ifx-filter-search.js +2 -2
- package/dist/components/ifx-filter-type-group.js +1 -1
- package/dist/components/ifx-icons-preview.js +1 -1
- package/dist/components/ifx-list-entry.js +1 -1
- package/dist/components/ifx-multiselect-option.js +1 -1
- package/dist/components/ifx-multiselect.js +1 -1
- package/dist/components/ifx-pagination.js +1 -1
- package/dist/components/ifx-search-bar.js +1 -1
- package/dist/components/ifx-search-field.js +1 -1
- package/dist/components/ifx-segment.js +1 -1
- package/dist/components/ifx-segmented-control.js +2 -2
- package/dist/components/ifx-select.js +1 -1
- package/dist/components/ifx-set-filter.js +5 -5
- package/dist/components/ifx-slider.js +2 -2
- package/dist/components/ifx-spinner.js +1 -1
- package/dist/components/ifx-status.js +1 -1
- package/dist/components/ifx-step.js +4 -4
- package/dist/components/ifx-stepper.js +2 -2
- package/dist/components/ifx-switch.js +1 -1
- package/dist/components/ifx-tab.js +1 -1
- package/dist/components/ifx-table.js +4 -4
- package/dist/components/ifx-tabs.js +2 -2
- package/dist/components/ifx-tag.js +1 -1
- package/dist/components/ifx-template.js +1 -1
- package/dist/components/ifx-templates-ui.js +4 -4
- package/dist/components/ifx-text-field.js +1 -1
- package/dist/components/ifx-textarea.js +1 -1
- package/dist/components/ifx-tooltip.js +4 -4
- package/dist/components/ifx-tree-view-item.js +2 -2
- package/dist/components/ifx-tree-view.js +1 -1
- package/dist/components/p-15597da9.js +470 -0
- package/dist/components/p-15597da9.js.map +1 -0
- package/dist/components/{p-4f7fbf98.js → p-1bd23a52.js} +3 -3
- package/dist/components/{p-4f7fbf98.js.map → p-1bd23a52.js.map} +1 -1
- package/dist/components/{p-60294bc5.js → p-6b139880.js} +3 -3
- package/dist/components/{p-60294bc5.js.map → p-6b139880.js.map} +1 -1
- package/dist/components/{p-a96d43ef.js → p-81265366.js} +4 -4
- package/dist/components/{p-a96d43ef.js.map → p-81265366.js.map} +1 -1
- package/dist/components/{p-46f5d4b5.js → p-9378105f.js} +2 -2
- package/dist/components/{p-46f5d4b5.js.map → p-9378105f.js.map} +1 -1
- package/dist/components/{p-c2ab000f.js → p-b57d6694.js} +2 -2
- package/dist/components/{p-c2ab000f.js.map → p-b57d6694.js.map} +1 -1
- package/dist/components/{p-4366492e.js → p-f4531a17.js} +5 -5
- package/dist/components/{p-4366492e.js.map → p-f4531a17.js.map} +1 -1
- package/dist/components/{p-b56aae98.js → p-fa8735da.js} +5 -5
- package/dist/components/{p-b56aae98.js.map → p-fa8735da.js.map} +1 -1
- package/dist/esm/ifx-alert_2.entry.js +1 -1
- package/dist/esm/ifx-basic-table.entry.js +1 -1
- package/dist/esm/ifx-faq.entry.js +1 -1
- package/dist/esm/ifx-filter-accordion.entry.js +2 -2
- package/dist/esm/ifx-filter-bar.entry.js +1 -1
- package/dist/esm/ifx-filter-search.entry.js +1 -1
- package/dist/esm/ifx-filter-type-group.entry.js +1 -1
- package/dist/esm/ifx-list-entry.entry.js +1 -1
- package/dist/esm/ifx-multiselect_2.entry.js +4 -4
- package/dist/esm/ifx-search-field.entry.js +348 -13
- package/dist/esm/ifx-search-field.entry.js.map +1 -1
- package/dist/esm/ifx-segment.entry.js +1 -1
- package/dist/esm/ifx-segmented-control.entry.js +2 -2
- package/dist/esm/ifx-select.entry.js +2 -2
- package/dist/esm/ifx-slider.entry.js +2 -2
- package/dist/esm/ifx-spinner_2.entry.js +6 -6
- package/dist/esm/ifx-status.entry.js +1 -1
- package/dist/esm/ifx-step.entry.js +4 -4
- package/dist/esm/ifx-stepper.entry.js +2 -2
- package/dist/esm/ifx-switch.entry.js +1 -1
- package/dist/esm/ifx-tab.entry.js +1 -1
- package/dist/esm/ifx-table.entry.js +2 -2
- package/dist/esm/ifx-tabs.entry.js +2 -2
- package/dist/esm/ifx-tag.entry.js +1 -1
- package/dist/esm/ifx-templates-ui.entry.js +1 -1
- package/dist/esm/ifx-textarea.entry.js +1 -1
- package/dist/esm/ifx-tooltip.entry.js +4 -4
- package/dist/esm/ifx-tree-view-item.entry.js +2 -2
- package/dist/esm/ifx-tree-view.entry.js +1 -1
- package/dist/esm/infineon-design-system-stencil.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/infineon-design-system-stencil/infineon-design-system-stencil.esm.js +1 -1
- package/dist/infineon-design-system-stencil/infineon-design-system-stencil.esm.js.map +1 -1
- package/dist/infineon-design-system-stencil/{p-577289c5.entry.js → p-030215bd.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-67c9a9c0.entry.js → p-03690ea5.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-7adee2dd.entry.js → p-0cbdafca.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-012129b3.entry.js → p-24d7ff6e.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-0c1c831c.entry.js → p-253ea47f.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-09a8d63d.entry.js → p-273a91b3.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-3d037fa4.entry.js → p-33b46161.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-4097932f.entry.js → p-377996c5.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-a2a44fbe.entry.js → p-37be5d65.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-18a81f5f.entry.js → p-3bce1f22.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-e9241ef3.entry.js → p-461450ac.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-0d8a16ab.entry.js → p-5afef060.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-7311a88d.entry.js → p-65a5cdd0.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-6c2698a3.entry.js → p-6ec8258a.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-fb954440.entry.js → p-6f43f8cb.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-cf7cf03b.entry.js → p-7078cbee.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/p-7705c159.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-28bd7e9d.entry.js → p-7958bc33.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-54e6a8d8.entry.js → p-7b2c1280.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-2facce0d.entry.js → p-bcf3f499.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-b4caad8b.entry.js → p-c303185e.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-04d8ea38.entry.js → p-caef0e47.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-36dcebde.entry.js → p-d3d6a562.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-c5de05c9.entry.js → p-e6632fdc.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-c7e86c7c.entry.js → p-ed30fb98.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-966548e9.entry.js → p-efe3e6d2.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-9675a12a.entry.js → p-effa0498.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/p-fe185620.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-fe185620.entry.js.map +1 -0
- package/dist/types/components/search-field/search-field.d.ts +53 -3
- package/dist/types/components/search-field/search-field.stories.d.ts +191 -0
- package/dist/types/components.d.ts +42 -2
- package/package.json +1 -1
- package/dist/components/p-bf74ceb8.js +0 -116
- package/dist/components/p-bf74ceb8.js.map +0 -1
- package/dist/infineon-design-system-stencil/p-4e633224.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-4e633224.entry.js.map +0 -1
- package/dist/infineon-design-system-stencil/p-e571c002.entry.js +0 -2
- /package/dist/infineon-design-system-stencil/{p-577289c5.entry.js.map → p-030215bd.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-67c9a9c0.entry.js.map → p-03690ea5.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-7adee2dd.entry.js.map → p-0cbdafca.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-012129b3.entry.js.map → p-24d7ff6e.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-0c1c831c.entry.js.map → p-253ea47f.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-09a8d63d.entry.js.map → p-273a91b3.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-3d037fa4.entry.js.map → p-33b46161.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-4097932f.entry.js.map → p-377996c5.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-a2a44fbe.entry.js.map → p-37be5d65.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-18a81f5f.entry.js.map → p-3bce1f22.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-e9241ef3.entry.js.map → p-461450ac.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-0d8a16ab.entry.js.map → p-5afef060.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-7311a88d.entry.js.map → p-65a5cdd0.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-6c2698a3.entry.js.map → p-6ec8258a.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-fb954440.entry.js.map → p-6f43f8cb.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-cf7cf03b.entry.js.map → p-7078cbee.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-e571c002.entry.js.map → p-7705c159.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-28bd7e9d.entry.js.map → p-7958bc33.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-54e6a8d8.entry.js.map → p-7b2c1280.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-2facce0d.entry.js.map → p-bcf3f499.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-b4caad8b.entry.js.map → p-c303185e.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-04d8ea38.entry.js.map → p-caef0e47.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-36dcebde.entry.js.map → p-d3d6a562.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-c5de05c9.entry.js.map → p-e6632fdc.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-c7e86c7c.entry.js.map → p-ed30fb98.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-966548e9.entry.js.map → p-efe3e6d2.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-9675a12a.entry.js.map → p-effa0498.entry.js.map} +0 -0
@@ -6,42 +6,355 @@ import classNames from "classnames";
|
|
6
6
|
export class SearchField {
|
7
7
|
constructor() {
|
8
8
|
this.value = '';
|
9
|
-
this.
|
9
|
+
this.suggestions = [];
|
10
|
+
this.showSuggestions = false;
|
11
|
+
this.maxSuggestions = 10;
|
12
|
+
this.maxHistoryItems = 5;
|
13
|
+
this.enableHistory = true;
|
14
|
+
this.historyKey = 'ifx-search-history';
|
15
|
+
this.historyHeaderText = 'Recent Searches';
|
16
|
+
// ARIA Labels and Accessibility Props
|
17
|
+
this.ariaLabel = "Search Field";
|
18
|
+
this.deleteIconAriaLabel = 'Clear search';
|
19
|
+
this.historyDeleteAriaLabel = 'Remove from history';
|
20
|
+
this.dropdownAriaLabel = 'Search suggestions and history';
|
21
|
+
this.suggestionAriaLabel = 'Search suggestion';
|
22
|
+
this.historyItemAriaLabel = 'Search history item';
|
23
|
+
this.showDropdown = false;
|
24
|
+
this.filteredSuggestions = [];
|
25
|
+
this.selectedSuggestionIndex = -1;
|
26
|
+
this.searchHistory = [];
|
10
27
|
this.showDeleteIcon = false;
|
11
28
|
this.showDeleteIconInternalState = false;
|
12
29
|
this.disabled = false;
|
13
30
|
this.size = 'l';
|
14
31
|
this.isFocused = false;
|
15
32
|
this.placeholder = "Search...";
|
16
|
-
this.autocomplete = "
|
33
|
+
this.autocomplete = "off";
|
17
34
|
this.maxlength = null;
|
35
|
+
this.focusEmitted = false;
|
18
36
|
this.handleInput = () => {
|
19
37
|
const query = this.inputElement.value;
|
20
|
-
this.value = query;
|
38
|
+
this.value = query;
|
21
39
|
this.ifxInput.emit(this.value);
|
40
|
+
if (this.showSuggestions) {
|
41
|
+
this.showDropdown = true;
|
42
|
+
this.selectedSuggestionIndex = -1;
|
43
|
+
this.requestSuggestions(query);
|
44
|
+
}
|
22
45
|
};
|
23
46
|
this.handleDelete = () => {
|
24
47
|
this.inputElement.value = '';
|
25
48
|
this.value = "";
|
26
49
|
this.ifxInput.emit(this.value);
|
50
|
+
this.hideDropdown();
|
51
|
+
};
|
52
|
+
this.handleSearch = () => {
|
53
|
+
if (this.value.trim() && this.enableHistory) {
|
54
|
+
// Only add to history if there are actual results
|
55
|
+
if (this.filteredSuggestions.length > 0) {
|
56
|
+
this.addToHistory(this.value);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
this.hideDropdown();
|
60
|
+
};
|
61
|
+
// Handle click on history delete button
|
62
|
+
this.handleHistoryDelete = (event, term) => {
|
63
|
+
event.stopPropagation(); // Prevent selection of the entry
|
64
|
+
this.removeFromHistory(term);
|
27
65
|
};
|
28
66
|
}
|
29
67
|
handleOutsideClick(event) {
|
30
68
|
const path = event.composedPath();
|
31
|
-
if (!path.includes(this.inputElement)) {
|
32
|
-
this.
|
69
|
+
if (!path.includes(this.inputElement) && !path.includes(this.dropdownElement)) {
|
70
|
+
this.hideDropdown();
|
71
|
+
}
|
72
|
+
}
|
73
|
+
handleKeyDown(event) {
|
74
|
+
if (!this.showDropdown)
|
75
|
+
return;
|
76
|
+
switch (event.key) {
|
77
|
+
case 'ArrowDown':
|
78
|
+
event.preventDefault();
|
79
|
+
this.navigateSuggestions(1);
|
80
|
+
break;
|
81
|
+
case 'ArrowUp':
|
82
|
+
event.preventDefault();
|
83
|
+
this.navigateSuggestions(-1);
|
84
|
+
break;
|
85
|
+
case 'Enter':
|
86
|
+
event.preventDefault();
|
87
|
+
if (this.selectedSuggestionIndex >= 0) {
|
88
|
+
this.selectSuggestion(this.filteredSuggestions[this.selectedSuggestionIndex]);
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
this.handleSearch();
|
92
|
+
}
|
93
|
+
break;
|
94
|
+
case 'Escape':
|
95
|
+
this.hideDropdown();
|
96
|
+
break;
|
33
97
|
}
|
34
98
|
}
|
35
99
|
valueWatcher(newValue) {
|
36
|
-
if (newValue !== this.inputElement.value) {
|
100
|
+
if (this.inputElement && newValue !== this.inputElement.value) {
|
37
101
|
this.inputElement.value = newValue;
|
38
102
|
}
|
103
|
+
this.updateSuggestions();
|
104
|
+
}
|
105
|
+
suggestionsWatcher() {
|
106
|
+
this.updateSuggestions();
|
39
107
|
}
|
40
108
|
focusInput() {
|
41
|
-
|
42
|
-
this.
|
109
|
+
// Don't call focus() if the input is already focused to prevent unnecessary operations
|
110
|
+
if (document.activeElement !== this.inputElement) {
|
111
|
+
this.inputElement.focus();
|
112
|
+
}
|
113
|
+
// Only emit focus event if it hasn't been emitted already
|
114
|
+
if (!this.focusEmitted) {
|
115
|
+
this.focusEmitted = true;
|
116
|
+
this.isFocused = true;
|
117
|
+
this.ifxFocus.emit();
|
118
|
+
}
|
119
|
+
if (this.showSuggestions) {
|
120
|
+
// On focus without input: Show only history
|
121
|
+
if (this.value.length === 0) {
|
122
|
+
this.showHistoryDropdown();
|
123
|
+
// Only show dropdown if history is actually present
|
124
|
+
this.showDropdown = this.enableHistory && this.searchHistory.length > 0;
|
125
|
+
}
|
126
|
+
else {
|
127
|
+
// With existing input: Normal suggestion logic
|
128
|
+
this.updateSuggestions();
|
129
|
+
this.showDropdown = this.filteredSuggestions.length > 0;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
blurInput() {
|
134
|
+
setTimeout(() => {
|
135
|
+
this.isFocused = false;
|
136
|
+
this.focusEmitted = false; // Reset focus flag when blur occurs
|
137
|
+
this.ifxBlur.emit();
|
138
|
+
}, 150);
|
139
|
+
}
|
140
|
+
// Public method to update history from external sources
|
141
|
+
loadSearchHistory() {
|
142
|
+
if (this.enableHistory && typeof localStorage !== 'undefined') {
|
143
|
+
const stored = localStorage.getItem(this.historyKey);
|
144
|
+
this.searchHistory = stored ? JSON.parse(stored) : [];
|
145
|
+
// Update suggestions when history is loaded
|
146
|
+
this.updateSuggestions();
|
147
|
+
// If no input and no history left, close dropdown
|
148
|
+
if (this.value.length === 0 && this.searchHistory.length === 0) {
|
149
|
+
this.showDropdown = false;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
// Public method to completely clear history
|
154
|
+
clearSearchHistory() {
|
155
|
+
if (this.enableHistory && typeof localStorage !== 'undefined') {
|
156
|
+
// Clear from localStorage
|
157
|
+
localStorage.removeItem(this.historyKey);
|
158
|
+
// Clear internal history
|
159
|
+
this.searchHistory = [];
|
160
|
+
// Reset all dropdown-relevant states
|
161
|
+
this.filteredSuggestions = [];
|
162
|
+
this.selectedSuggestionIndex = -1;
|
163
|
+
this.showDropdown = false;
|
164
|
+
// Update suggestions after reset
|
165
|
+
this.updateSuggestions();
|
166
|
+
}
|
167
|
+
}
|
168
|
+
// Suggestion Management Methods
|
169
|
+
addToHistory(term) {
|
170
|
+
if (!this.enableHistory || !term.trim())
|
171
|
+
return;
|
172
|
+
const history = [...this.searchHistory];
|
173
|
+
const existingIndex = history.indexOf(term);
|
174
|
+
if (existingIndex > -1) {
|
175
|
+
history.splice(existingIndex, 1);
|
176
|
+
}
|
177
|
+
history.unshift(term);
|
178
|
+
// Limit history to maxHistoryItems (default 5)
|
179
|
+
this.searchHistory = history.slice(0, this.maxHistoryItems);
|
180
|
+
if (typeof localStorage !== 'undefined') {
|
181
|
+
localStorage.setItem(this.historyKey, JSON.stringify(this.searchHistory));
|
182
|
+
}
|
183
|
+
}
|
184
|
+
// Remove individual history entry
|
185
|
+
removeFromHistory(term) {
|
186
|
+
if (!this.enableHistory)
|
187
|
+
return;
|
188
|
+
const history = [...this.searchHistory];
|
189
|
+
const index = history.indexOf(term);
|
190
|
+
if (index > -1) {
|
191
|
+
history.splice(index, 1);
|
192
|
+
this.searchHistory = history;
|
193
|
+
// Update localStorage
|
194
|
+
if (typeof localStorage !== 'undefined') {
|
195
|
+
localStorage.setItem(this.historyKey, JSON.stringify(this.searchHistory));
|
196
|
+
}
|
197
|
+
// Update suggestions after removal
|
198
|
+
this.updateSuggestions();
|
199
|
+
// Close dropdown if no history remains
|
200
|
+
if (this.searchHistory.length === 0 && this.value.length === 0) {
|
201
|
+
this.showDropdown = false;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
requestSuggestions(query) {
|
206
|
+
this.ifxSuggestionRequested.emit(query);
|
207
|
+
this.updateSuggestions();
|
208
|
+
}
|
209
|
+
updateSuggestions() {
|
210
|
+
const query = this.value.toLowerCase();
|
211
|
+
let suggestions = [];
|
212
|
+
if (query.length > 0) {
|
213
|
+
// For text input: Mix external suggestions and relevant history
|
214
|
+
// 1. Filter external suggestions
|
215
|
+
if (this.suggestions && this.suggestions.length > 0) {
|
216
|
+
const filteredExternal = this.suggestions.filter(s => s.text.toLowerCase().includes(query));
|
217
|
+
suggestions = [...suggestions, ...filteredExternal];
|
218
|
+
}
|
219
|
+
// 2. Filter relevant history entries
|
220
|
+
if (this.enableHistory && this.searchHistory.length > 0) {
|
221
|
+
const filteredHistory = this.searchHistory
|
222
|
+
.filter(term => term.toLowerCase().includes(query))
|
223
|
+
.map((term, index) => ({
|
224
|
+
id: `history-${index}`,
|
225
|
+
text: term,
|
226
|
+
type: 'history'
|
227
|
+
}));
|
228
|
+
suggestions = [...suggestions, ...filteredHistory];
|
229
|
+
}
|
230
|
+
// 3. Sort by relevance (exact matches first, then prefix matches)
|
231
|
+
suggestions.sort((a, b) => {
|
232
|
+
const aText = a.text.toLowerCase();
|
233
|
+
const bText = b.text.toLowerCase();
|
234
|
+
// Exact match has highest priority
|
235
|
+
if (aText === query && bText !== query)
|
236
|
+
return -1;
|
237
|
+
if (bText === query && aText !== query)
|
238
|
+
return 1;
|
239
|
+
// Prefix match has second highest priority
|
240
|
+
const aStartsWith = aText.startsWith(query);
|
241
|
+
const bStartsWith = bText.startsWith(query);
|
242
|
+
if (aStartsWith && !bStartsWith)
|
243
|
+
return -1;
|
244
|
+
if (bStartsWith && !aStartsWith)
|
245
|
+
return 1;
|
246
|
+
// With equal relevance: external suggestions before history
|
247
|
+
if (a.type === 'suggestion' && b.type === 'history')
|
248
|
+
return -1;
|
249
|
+
if (a.type === 'history' && b.type === 'suggestion')
|
250
|
+
return 1;
|
251
|
+
// Alphabetical sorting as last criterion
|
252
|
+
return aText.localeCompare(bText);
|
253
|
+
});
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
// For empty query: Show only history (no external suggestions)
|
257
|
+
if (this.enableHistory && this.searchHistory.length > 0) {
|
258
|
+
const historySuggestions = this.searchHistory.map((term, index) => ({
|
259
|
+
id: `history-${index}`,
|
260
|
+
text: term,
|
261
|
+
type: 'history'
|
262
|
+
}));
|
263
|
+
suggestions = historySuggestions;
|
264
|
+
}
|
265
|
+
// For empty query DO NOT show external suggestions
|
266
|
+
}
|
267
|
+
// Remove duplicates based on text and scope combination (history takes precedence over external)
|
268
|
+
const uniqueSuggestions = suggestions.reduce((unique, current) => {
|
269
|
+
const existingIndex = unique.findIndex(item => item.text.toLowerCase() === current.text.toLowerCase() &&
|
270
|
+
item.scope === current.scope);
|
271
|
+
if (existingIndex === -1) {
|
272
|
+
unique.push(current);
|
273
|
+
}
|
274
|
+
else {
|
275
|
+
// If already exists, prefer history over external suggestions
|
276
|
+
if (current.type === 'history' && unique[existingIndex].type !== 'history') {
|
277
|
+
unique[existingIndex] = current;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
return unique;
|
281
|
+
}, []);
|
282
|
+
this.filteredSuggestions = uniqueSuggestions.slice(0, this.maxSuggestions);
|
283
|
+
this.selectedSuggestionIndex = -1;
|
284
|
+
}
|
285
|
+
navigateSuggestions(direction) {
|
286
|
+
const maxIndex = this.filteredSuggestions.length - 1;
|
287
|
+
if (direction > 0) {
|
288
|
+
this.selectedSuggestionIndex = this.selectedSuggestionIndex < maxIndex
|
289
|
+
? this.selectedSuggestionIndex + 1
|
290
|
+
: 0;
|
291
|
+
}
|
292
|
+
else {
|
293
|
+
this.selectedSuggestionIndex = this.selectedSuggestionIndex > 0
|
294
|
+
? this.selectedSuggestionIndex - 1
|
295
|
+
: maxIndex;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
selectSuggestion(suggestion) {
|
299
|
+
this.value = suggestion.text;
|
300
|
+
this.inputElement.value = suggestion.text;
|
301
|
+
this.ifxSuggestionSelected.emit(suggestion);
|
302
|
+
this.ifxInput.emit(this.value);
|
303
|
+
if (this.enableHistory) {
|
304
|
+
// Always add selected suggestions to history since they are valid results
|
305
|
+
this.addToHistory(suggestion.text);
|
306
|
+
}
|
307
|
+
this.hideDropdown();
|
308
|
+
}
|
309
|
+
hideDropdown() {
|
310
|
+
this.showDropdown = false;
|
311
|
+
this.selectedSuggestionIndex = -1;
|
312
|
+
this.isFocused = false;
|
313
|
+
}
|
314
|
+
// Show only history in dropdown (e.g. on focus without input)
|
315
|
+
showHistoryDropdown() {
|
316
|
+
if (this.enableHistory && this.searchHistory.length > 0) {
|
317
|
+
// Show only history entries
|
318
|
+
const historySuggestions = this.searchHistory.map((term, index) => ({
|
319
|
+
id: `history-${index}`,
|
320
|
+
text: term,
|
321
|
+
type: 'history'
|
322
|
+
}));
|
323
|
+
this.filteredSuggestions = historySuggestions.slice(0, this.maxSuggestions);
|
324
|
+
this.selectedSuggestionIndex = -1;
|
325
|
+
}
|
326
|
+
else {
|
327
|
+
this.filteredSuggestions = [];
|
328
|
+
}
|
43
329
|
}
|
44
|
-
|
330
|
+
// Check if only history entries are displayed (without text input)
|
331
|
+
isShowingOnlyHistory() {
|
332
|
+
return this.value.length === 0 &&
|
333
|
+
this.filteredSuggestions.length > 0 &&
|
334
|
+
this.filteredSuggestions.every(s => s.type === 'history');
|
335
|
+
}
|
336
|
+
// Render text with highlighted matches
|
337
|
+
renderHighlightedText(text, query) {
|
338
|
+
if (!query || query.length === 0) {
|
339
|
+
return text;
|
340
|
+
}
|
341
|
+
const lowerText = text.toLowerCase();
|
342
|
+
const lowerQuery = query.toLowerCase();
|
343
|
+
const index = lowerText.indexOf(lowerQuery);
|
344
|
+
if (index === -1) {
|
345
|
+
return text;
|
346
|
+
}
|
347
|
+
const before = text.substring(0, index);
|
348
|
+
const match = text.substring(index, index + query.length);
|
349
|
+
const after = text.substring(index + query.length);
|
350
|
+
return [
|
351
|
+
before,
|
352
|
+
h("strong", null, match),
|
353
|
+
after
|
354
|
+
];
|
355
|
+
}
|
356
|
+
async componentWillLoad() {
|
357
|
+
this.loadSearchHistory();
|
45
358
|
if (!isNestedInIfxComponent(this.el)) {
|
46
359
|
const framework = detectFramework();
|
47
360
|
trackComponent('ifx-search-field', await framework);
|
@@ -55,7 +368,17 @@ export class SearchField {
|
|
55
368
|
this.showDeleteIconInternalState = false;
|
56
369
|
}
|
57
370
|
render() {
|
58
|
-
return (h("div", { key: '
|
371
|
+
return (h("div", { key: '637f2c7144beb35f9915a64fac8df66d65ec5118', "aria-disabled": this.disabled, "aria-value": this.value, class: 'search-field' }, h("div", { key: 'b5c4d373d93a9225ca08db7340e2732f585c5e80', class: this.getWrapperClassNames(), tabindex: 1, onClick: () => this.focusInput() }, h("ifx-icon", { key: '6cc46a75102036d4706d8873e4d0481d0bce263f', icon: "search-16", class: "search-icon" }), h("input", { key: 'd770d8a5dc8cf75c8a0f3f3f9d557ccf88bf525d', ref: (el) => (this.inputElement = el), type: "text", autocomplete: this.autocomplete, onInput: () => this.handleInput(), onFocus: () => this.focusInput(), onBlur: () => this.blurInput(), placeholder: this.placeholder, disabled: this.disabled, maxlength: this.maxlength, value: this.value, role: "combobox", "aria-expanded": this.showDropdown, "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedBy, "aria-owns": this.showDropdown ? 'suggestions-dropdown' : undefined, "aria-activedescendant": this.selectedSuggestionIndex >= 0 ? `suggestion-${this.selectedSuggestionIndex}` : undefined }), this.showDeleteIcon && this.showDeleteIconInternalState ? (h("ifx-icon", { icon: "cRemove16", class: "delete-icon", onClick: this.handleDelete, role: "button", tabindex: "0", "aria-label": this.deleteIconAriaLabel, onKeyDown: (event) => {
|
372
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
373
|
+
event.preventDefault();
|
374
|
+
this.handleDelete();
|
375
|
+
}
|
376
|
+
} })) : null), this.showDropdown && this.filteredSuggestions.length > 0 && (h("div", { key: 'be15e8157313ad37d0b991ea74b46ba8a7c88880', ref: (el) => (this.dropdownElement = el), id: "suggestions-dropdown", class: "suggestions-dropdown", role: "listbox", "aria-label": this.dropdownAriaLabel }, this.isShowingOnlyHistory() && (h("div", { key: 'd3a1e06a246436ffbc239c502bd76c9250317411', class: "suggestions-header" }, this.historyHeaderText)), this.filteredSuggestions.map((suggestion, index) => (h("div", { key: suggestion.id, id: `suggestion-${index}`, class: this.getSuggestionClassNames(index), role: "option", "aria-selected": index === this.selectedSuggestionIndex, "aria-label": `${suggestion.type === 'history' ? this.historyItemAriaLabel : this.suggestionAriaLabel}: ${suggestion.text}${suggestion.scope ? `, ${suggestion.scope}` : ''}${suggestion.resultCount ? `, ${suggestion.resultCount} results` : ''}`, onClick: () => this.selectSuggestion(suggestion), onMouseEnter: () => this.selectedSuggestionIndex = index }, h("div", { class: "suggestion-content" }, suggestion.type === 'history' && (h("ifx-icon", { icon: "history-16", class: "suggestion-icon suggestion-icon--history" })), suggestion.type === 'suggestion' && (h("ifx-icon", { icon: "search-16", class: "suggestion-icon suggestion-icon--suggestion" })), h("span", { class: "suggestion-text" }, h("span", { class: "suggestion-main-text" }, this.renderHighlightedText(suggestion.text, this.value)), suggestion.scope && (h("span", { class: "suggestion-scope" }, "\u2013 ", suggestion.scope))), suggestion.resultCount !== undefined && suggestion.scope && (h("span", { class: "suggestion-count" }, suggestion.resultCount)), suggestion.type === 'history' && (h("ifx-icon", { icon: "cross16", class: "suggestion-delete-icon", role: "button", tabindex: "0", "aria-label": `${this.historyDeleteAriaLabel}: ${suggestion.text}`, onClick: (event) => this.handleHistoryDelete(event, suggestion.text), onKeyDown: (event) => {
|
377
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
378
|
+
event.preventDefault();
|
379
|
+
this.handleHistoryDelete(event, suggestion.text);
|
380
|
+
}
|
381
|
+
} }))))))))));
|
59
382
|
}
|
60
383
|
getSizeClass() {
|
61
384
|
return `${this.size}` === "s"
|
@@ -63,7 +386,14 @@ export class SearchField {
|
|
63
386
|
: "";
|
64
387
|
}
|
65
388
|
getWrapperClassNames() {
|
66
|
-
return classNames(`search-field__wrapper`, `search-field__wrapper ${this.getSizeClass()}`, `${this.isFocused ? 'focused' : ""}`);
|
389
|
+
return classNames(`search-field__wrapper`, `search-field__wrapper ${this.getSizeClass()}`, `${this.isFocused ? 'focused' : ""}`, `${this.showDropdown ? 'dropdown-open' : ""}`);
|
390
|
+
}
|
391
|
+
getSuggestionClassNames(index) {
|
392
|
+
var _a;
|
393
|
+
return classNames('suggestion-item', {
|
394
|
+
'suggestion-item--selected': index === this.selectedSuggestionIndex,
|
395
|
+
'suggestion-item--history': ((_a = this.filteredSuggestions[index]) === null || _a === void 0 ? void 0 : _a.type) === 'history'
|
396
|
+
});
|
67
397
|
}
|
68
398
|
static get is() { return "ifx-search-field"; }
|
69
399
|
static get encapsulation() { return "shadow"; }
|
@@ -99,6 +429,308 @@ export class SearchField {
|
|
99
429
|
"reflect": false,
|
100
430
|
"defaultValue": "''"
|
101
431
|
},
|
432
|
+
"suggestions": {
|
433
|
+
"type": "unknown",
|
434
|
+
"mutable": false,
|
435
|
+
"complexType": {
|
436
|
+
"original": "SuggestionItem[]",
|
437
|
+
"resolved": "SuggestionItem[]",
|
438
|
+
"references": {
|
439
|
+
"SuggestionItem": {
|
440
|
+
"location": "local",
|
441
|
+
"path": "/home/runner/work/infineon-design-system-stencil/infineon-design-system-stencil/packages/components/src/components/search-field/search-field.tsx",
|
442
|
+
"id": "src/components/search-field/search-field.tsx::SuggestionItem"
|
443
|
+
}
|
444
|
+
}
|
445
|
+
},
|
446
|
+
"required": false,
|
447
|
+
"optional": false,
|
448
|
+
"docs": {
|
449
|
+
"tags": [],
|
450
|
+
"text": ""
|
451
|
+
},
|
452
|
+
"getter": false,
|
453
|
+
"setter": false,
|
454
|
+
"defaultValue": "[]"
|
455
|
+
},
|
456
|
+
"showSuggestions": {
|
457
|
+
"type": "boolean",
|
458
|
+
"mutable": false,
|
459
|
+
"complexType": {
|
460
|
+
"original": "boolean",
|
461
|
+
"resolved": "boolean",
|
462
|
+
"references": {}
|
463
|
+
},
|
464
|
+
"required": false,
|
465
|
+
"optional": false,
|
466
|
+
"docs": {
|
467
|
+
"tags": [],
|
468
|
+
"text": ""
|
469
|
+
},
|
470
|
+
"getter": false,
|
471
|
+
"setter": false,
|
472
|
+
"attribute": "show-suggestions",
|
473
|
+
"reflect": false,
|
474
|
+
"defaultValue": "false"
|
475
|
+
},
|
476
|
+
"maxSuggestions": {
|
477
|
+
"type": "number",
|
478
|
+
"mutable": false,
|
479
|
+
"complexType": {
|
480
|
+
"original": "number",
|
481
|
+
"resolved": "number",
|
482
|
+
"references": {}
|
483
|
+
},
|
484
|
+
"required": false,
|
485
|
+
"optional": false,
|
486
|
+
"docs": {
|
487
|
+
"tags": [],
|
488
|
+
"text": ""
|
489
|
+
},
|
490
|
+
"getter": false,
|
491
|
+
"setter": false,
|
492
|
+
"attribute": "max-suggestions",
|
493
|
+
"reflect": false,
|
494
|
+
"defaultValue": "10"
|
495
|
+
},
|
496
|
+
"maxHistoryItems": {
|
497
|
+
"type": "number",
|
498
|
+
"mutable": false,
|
499
|
+
"complexType": {
|
500
|
+
"original": "number",
|
501
|
+
"resolved": "number",
|
502
|
+
"references": {}
|
503
|
+
},
|
504
|
+
"required": false,
|
505
|
+
"optional": false,
|
506
|
+
"docs": {
|
507
|
+
"tags": [],
|
508
|
+
"text": ""
|
509
|
+
},
|
510
|
+
"getter": false,
|
511
|
+
"setter": false,
|
512
|
+
"attribute": "max-history-items",
|
513
|
+
"reflect": false,
|
514
|
+
"defaultValue": "5"
|
515
|
+
},
|
516
|
+
"enableHistory": {
|
517
|
+
"type": "boolean",
|
518
|
+
"mutable": false,
|
519
|
+
"complexType": {
|
520
|
+
"original": "boolean",
|
521
|
+
"resolved": "boolean",
|
522
|
+
"references": {}
|
523
|
+
},
|
524
|
+
"required": false,
|
525
|
+
"optional": false,
|
526
|
+
"docs": {
|
527
|
+
"tags": [],
|
528
|
+
"text": ""
|
529
|
+
},
|
530
|
+
"getter": false,
|
531
|
+
"setter": false,
|
532
|
+
"attribute": "enable-history",
|
533
|
+
"reflect": false,
|
534
|
+
"defaultValue": "true"
|
535
|
+
},
|
536
|
+
"historyKey": {
|
537
|
+
"type": "string",
|
538
|
+
"mutable": false,
|
539
|
+
"complexType": {
|
540
|
+
"original": "string",
|
541
|
+
"resolved": "string",
|
542
|
+
"references": {}
|
543
|
+
},
|
544
|
+
"required": false,
|
545
|
+
"optional": false,
|
546
|
+
"docs": {
|
547
|
+
"tags": [],
|
548
|
+
"text": ""
|
549
|
+
},
|
550
|
+
"getter": false,
|
551
|
+
"setter": false,
|
552
|
+
"attribute": "history-key",
|
553
|
+
"reflect": false,
|
554
|
+
"defaultValue": "'ifx-search-history'"
|
555
|
+
},
|
556
|
+
"historyHeaderText": {
|
557
|
+
"type": "string",
|
558
|
+
"mutable": false,
|
559
|
+
"complexType": {
|
560
|
+
"original": "string",
|
561
|
+
"resolved": "string",
|
562
|
+
"references": {}
|
563
|
+
},
|
564
|
+
"required": false,
|
565
|
+
"optional": false,
|
566
|
+
"docs": {
|
567
|
+
"tags": [],
|
568
|
+
"text": ""
|
569
|
+
},
|
570
|
+
"getter": false,
|
571
|
+
"setter": false,
|
572
|
+
"attribute": "history-header-text",
|
573
|
+
"reflect": false,
|
574
|
+
"defaultValue": "'Recent Searches'"
|
575
|
+
},
|
576
|
+
"ariaLabel": {
|
577
|
+
"type": "string",
|
578
|
+
"mutable": false,
|
579
|
+
"complexType": {
|
580
|
+
"original": "string | null",
|
581
|
+
"resolved": "string",
|
582
|
+
"references": {}
|
583
|
+
},
|
584
|
+
"required": false,
|
585
|
+
"optional": false,
|
586
|
+
"docs": {
|
587
|
+
"tags": [],
|
588
|
+
"text": ""
|
589
|
+
},
|
590
|
+
"getter": false,
|
591
|
+
"setter": false,
|
592
|
+
"attribute": "aria-label",
|
593
|
+
"reflect": false,
|
594
|
+
"defaultValue": "\"Search Field\""
|
595
|
+
},
|
596
|
+
"ariaLabelledBy": {
|
597
|
+
"type": "string",
|
598
|
+
"mutable": false,
|
599
|
+
"complexType": {
|
600
|
+
"original": "string | null",
|
601
|
+
"resolved": "string",
|
602
|
+
"references": {}
|
603
|
+
},
|
604
|
+
"required": false,
|
605
|
+
"optional": true,
|
606
|
+
"docs": {
|
607
|
+
"tags": [],
|
608
|
+
"text": ""
|
609
|
+
},
|
610
|
+
"getter": false,
|
611
|
+
"setter": false,
|
612
|
+
"attribute": "aria-labelled-by",
|
613
|
+
"reflect": false
|
614
|
+
},
|
615
|
+
"ariaDescribedBy": {
|
616
|
+
"type": "string",
|
617
|
+
"mutable": false,
|
618
|
+
"complexType": {
|
619
|
+
"original": "string | null",
|
620
|
+
"resolved": "string",
|
621
|
+
"references": {}
|
622
|
+
},
|
623
|
+
"required": false,
|
624
|
+
"optional": true,
|
625
|
+
"docs": {
|
626
|
+
"tags": [],
|
627
|
+
"text": ""
|
628
|
+
},
|
629
|
+
"getter": false,
|
630
|
+
"setter": false,
|
631
|
+
"attribute": "aria-described-by",
|
632
|
+
"reflect": false
|
633
|
+
},
|
634
|
+
"deleteIconAriaLabel": {
|
635
|
+
"type": "string",
|
636
|
+
"mutable": false,
|
637
|
+
"complexType": {
|
638
|
+
"original": "string",
|
639
|
+
"resolved": "string",
|
640
|
+
"references": {}
|
641
|
+
},
|
642
|
+
"required": false,
|
643
|
+
"optional": false,
|
644
|
+
"docs": {
|
645
|
+
"tags": [],
|
646
|
+
"text": ""
|
647
|
+
},
|
648
|
+
"getter": false,
|
649
|
+
"setter": false,
|
650
|
+
"attribute": "delete-icon-aria-label",
|
651
|
+
"reflect": false,
|
652
|
+
"defaultValue": "'Clear search'"
|
653
|
+
},
|
654
|
+
"historyDeleteAriaLabel": {
|
655
|
+
"type": "string",
|
656
|
+
"mutable": false,
|
657
|
+
"complexType": {
|
658
|
+
"original": "string",
|
659
|
+
"resolved": "string",
|
660
|
+
"references": {}
|
661
|
+
},
|
662
|
+
"required": false,
|
663
|
+
"optional": false,
|
664
|
+
"docs": {
|
665
|
+
"tags": [],
|
666
|
+
"text": ""
|
667
|
+
},
|
668
|
+
"getter": false,
|
669
|
+
"setter": false,
|
670
|
+
"attribute": "history-delete-aria-label",
|
671
|
+
"reflect": false,
|
672
|
+
"defaultValue": "'Remove from history'"
|
673
|
+
},
|
674
|
+
"dropdownAriaLabel": {
|
675
|
+
"type": "string",
|
676
|
+
"mutable": false,
|
677
|
+
"complexType": {
|
678
|
+
"original": "string",
|
679
|
+
"resolved": "string",
|
680
|
+
"references": {}
|
681
|
+
},
|
682
|
+
"required": false,
|
683
|
+
"optional": false,
|
684
|
+
"docs": {
|
685
|
+
"tags": [],
|
686
|
+
"text": ""
|
687
|
+
},
|
688
|
+
"getter": false,
|
689
|
+
"setter": false,
|
690
|
+
"attribute": "dropdown-aria-label",
|
691
|
+
"reflect": false,
|
692
|
+
"defaultValue": "'Search suggestions and history'"
|
693
|
+
},
|
694
|
+
"suggestionAriaLabel": {
|
695
|
+
"type": "string",
|
696
|
+
"mutable": false,
|
697
|
+
"complexType": {
|
698
|
+
"original": "string",
|
699
|
+
"resolved": "string",
|
700
|
+
"references": {}
|
701
|
+
},
|
702
|
+
"required": false,
|
703
|
+
"optional": false,
|
704
|
+
"docs": {
|
705
|
+
"tags": [],
|
706
|
+
"text": ""
|
707
|
+
},
|
708
|
+
"getter": false,
|
709
|
+
"setter": false,
|
710
|
+
"attribute": "suggestion-aria-label",
|
711
|
+
"reflect": false,
|
712
|
+
"defaultValue": "'Search suggestion'"
|
713
|
+
},
|
714
|
+
"historyItemAriaLabel": {
|
715
|
+
"type": "string",
|
716
|
+
"mutable": false,
|
717
|
+
"complexType": {
|
718
|
+
"original": "string",
|
719
|
+
"resolved": "string",
|
720
|
+
"references": {}
|
721
|
+
},
|
722
|
+
"required": false,
|
723
|
+
"optional": false,
|
724
|
+
"docs": {
|
725
|
+
"tags": [],
|
726
|
+
"text": ""
|
727
|
+
},
|
728
|
+
"getter": false,
|
729
|
+
"setter": false,
|
730
|
+
"attribute": "history-item-aria-label",
|
731
|
+
"reflect": false,
|
732
|
+
"defaultValue": "'Search history item'"
|
733
|
+
},
|
102
734
|
"showDeleteIcon": {
|
103
735
|
"type": "boolean",
|
104
736
|
"mutable": false,
|
@@ -197,7 +829,7 @@ export class SearchField {
|
|
197
829
|
"setter": false,
|
198
830
|
"attribute": "autocomplete",
|
199
831
|
"reflect": false,
|
200
|
-
"defaultValue": "\"
|
832
|
+
"defaultValue": "\"off\""
|
201
833
|
},
|
202
834
|
"maxlength": {
|
203
835
|
"type": "number",
|
@@ -223,7 +855,10 @@ export class SearchField {
|
|
223
855
|
}
|
224
856
|
static get states() {
|
225
857
|
return {
|
226
|
-
"
|
858
|
+
"showDropdown": {},
|
859
|
+
"filteredSuggestions": {},
|
860
|
+
"selectedSuggestionIndex": {},
|
861
|
+
"searchHistory": {},
|
227
862
|
"showDeleteIconInternalState": {},
|
228
863
|
"isFocused": {}
|
229
864
|
};
|
@@ -240,15 +875,76 @@ export class SearchField {
|
|
240
875
|
"text": ""
|
241
876
|
},
|
242
877
|
"complexType": {
|
243
|
-
"original": "
|
244
|
-
"resolved": "
|
878
|
+
"original": "string",
|
879
|
+
"resolved": "string",
|
880
|
+
"references": {}
|
881
|
+
}
|
882
|
+
}, {
|
883
|
+
"method": "ifxSuggestionRequested",
|
884
|
+
"name": "ifxSuggestionRequested",
|
885
|
+
"bubbles": true,
|
886
|
+
"cancelable": true,
|
887
|
+
"composed": true,
|
888
|
+
"docs": {
|
889
|
+
"tags": [],
|
890
|
+
"text": ""
|
891
|
+
},
|
892
|
+
"complexType": {
|
893
|
+
"original": "string",
|
894
|
+
"resolved": "string",
|
895
|
+
"references": {}
|
896
|
+
}
|
897
|
+
}, {
|
898
|
+
"method": "ifxSuggestionSelected",
|
899
|
+
"name": "ifxSuggestionSelected",
|
900
|
+
"bubbles": true,
|
901
|
+
"cancelable": true,
|
902
|
+
"composed": true,
|
903
|
+
"docs": {
|
904
|
+
"tags": [],
|
905
|
+
"text": ""
|
906
|
+
},
|
907
|
+
"complexType": {
|
908
|
+
"original": "SuggestionItem",
|
909
|
+
"resolved": "SuggestionItem",
|
245
910
|
"references": {
|
246
|
-
"
|
247
|
-
"location": "
|
248
|
-
"
|
911
|
+
"SuggestionItem": {
|
912
|
+
"location": "local",
|
913
|
+
"path": "/home/runner/work/infineon-design-system-stencil/infineon-design-system-stencil/packages/components/src/components/search-field/search-field.tsx",
|
914
|
+
"id": "src/components/search-field/search-field.tsx::SuggestionItem"
|
249
915
|
}
|
250
916
|
}
|
251
917
|
}
|
918
|
+
}, {
|
919
|
+
"method": "ifxFocus",
|
920
|
+
"name": "ifxFocus",
|
921
|
+
"bubbles": true,
|
922
|
+
"cancelable": true,
|
923
|
+
"composed": true,
|
924
|
+
"docs": {
|
925
|
+
"tags": [],
|
926
|
+
"text": ""
|
927
|
+
},
|
928
|
+
"complexType": {
|
929
|
+
"original": "void",
|
930
|
+
"resolved": "void",
|
931
|
+
"references": {}
|
932
|
+
}
|
933
|
+
}, {
|
934
|
+
"method": "ifxBlur",
|
935
|
+
"name": "ifxBlur",
|
936
|
+
"bubbles": true,
|
937
|
+
"cancelable": true,
|
938
|
+
"composed": true,
|
939
|
+
"docs": {
|
940
|
+
"tags": [],
|
941
|
+
"text": ""
|
942
|
+
},
|
943
|
+
"complexType": {
|
944
|
+
"original": "void",
|
945
|
+
"resolved": "void",
|
946
|
+
"references": {}
|
947
|
+
}
|
252
948
|
}];
|
253
949
|
}
|
254
950
|
static get elementRef() { return "el"; }
|
@@ -256,6 +952,9 @@ export class SearchField {
|
|
256
952
|
return [{
|
257
953
|
"propName": "value",
|
258
954
|
"methodName": "valueWatcher"
|
955
|
+
}, {
|
956
|
+
"propName": "suggestions",
|
957
|
+
"methodName": "suggestionsWatcher"
|
259
958
|
}];
|
260
959
|
}
|
261
960
|
static get listeners() {
|
@@ -265,6 +964,12 @@ export class SearchField {
|
|
265
964
|
"target": "document",
|
266
965
|
"capture": false,
|
267
966
|
"passive": true
|
967
|
+
}, {
|
968
|
+
"name": "keydown",
|
969
|
+
"method": "handleKeyDown",
|
970
|
+
"target": undefined,
|
971
|
+
"capture": false,
|
972
|
+
"passive": false
|
268
973
|
}];
|
269
974
|
}
|
270
975
|
}
|