@infineon/infineon-design-system-stencil 37.2.0--canary.1935.bcd753db2b5ee68950d2fca82ac243bd652f4fba.0 → 38.0.0--canary.1954.f29b2d8edb0fe3ea64fff93b4a103a880db2a074.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 +349 -12
- 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 +724 -17
- 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-31696649.js → p-0218abcd.js} +5 -5
- package/dist/components/{p-31696649.js.map → p-0218abcd.js.map} +1 -1
- package/dist/components/{p-6a9e1fb6.js → p-122e79fc.js} +3 -3
- package/dist/components/{p-6a9e1fb6.js.map → p-122e79fc.js.map} +1 -1
- package/dist/components/{p-da273970.js → p-43438af8.js} +4 -4
- package/dist/components/{p-da273970.js.map → p-43438af8.js.map} +1 -1
- package/dist/components/{p-bfc8b82f.js → p-5853a3c8.js} +2 -2
- package/dist/components/{p-bfc8b82f.js.map → p-5853a3c8.js.map} +1 -1
- package/dist/components/{p-cb92983f.js → p-96237222.js} +3 -3
- package/dist/components/{p-cb92983f.js.map → p-96237222.js.map} +1 -1
- package/dist/components/{p-8cbf32a7.js → p-c601034d.js} +2 -2
- package/dist/components/{p-8cbf32a7.js.map → p-c601034d.js.map} +1 -1
- package/dist/components/p-c7297dfd.js +471 -0
- package/dist/components/p-c7297dfd.js.map +1 -0
- package/dist/components/{p-c5f7a0e2.js → p-f9c7ad2e.js} +5 -5
- package/dist/components/{p-c5f7a0e2.js.map → p-f9c7ad2e.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 +349 -12
- 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-7adee2dd.entry.js → p-0cbdafca.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-2d7159a9.entry.js → p-10ef115a.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-f544fb03.entry.js → p-1e7646b7.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-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-e5091718.entry.js → p-3dd8bdf4.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-71e34467.entry.js → p-706a8ead.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/p-7705c159.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-1e0d789f.entry.js → p-8e838717.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-4eda4ef3.entry.js → p-8eab207b.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-8ecae73b.entry.js → p-9be0905e.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-90efbef9.entry.js → p-9cfe025d.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-bca4f6c8.entry.js → p-b393c1e7.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/p-b83380f8.entry.js +2 -0
- package/dist/infineon-design-system-stencil/{p-e172e81c.entry.js.map → p-b83380f8.entry.js.map} +1 -1
- 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-d4b4107a.entry.js +2 -0
- package/dist/infineon-design-system-stencil/p-d4b4107a.entry.js.map +1 -0
- package/dist/infineon-design-system-stencil/{p-c36df3ce.entry.js → p-d660ebea.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-59c3ac10.entry.js → p-d8a57524.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-84d4d6a1.entry.js → p-e196740d.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-2e931b0d.entry.js → p-e45d85fc.entry.js} +2 -2
- package/dist/infineon-design-system-stencil/{p-437973f5.entry.js → p-e61d3fc6.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-05d9aa1f.entry.js → p-f84af2e3.entry.js} +2 -2
- package/dist/types/components/search-field/search-field.d.ts +53 -2
- 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-c6e5f94d.js +0 -115
- package/dist/components/p-c6e5f94d.js.map +0 -1
- package/dist/infineon-design-system-stencil/p-c164c83b.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-c164c83b.entry.js.map +0 -1
- package/dist/infineon-design-system-stencil/p-e172e81c.entry.js +0 -2
- package/dist/infineon-design-system-stencil/p-e571c002.entry.js +0 -2
- /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-2d7159a9.entry.js.map → p-10ef115a.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-f544fb03.entry.js.map → p-1e7646b7.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-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-e5091718.entry.js.map → p-3dd8bdf4.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-71e34467.entry.js.map → p-706a8ead.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-1e0d789f.entry.js.map → p-8e838717.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-4eda4ef3.entry.js.map → p-8eab207b.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-8ecae73b.entry.js.map → p-9be0905e.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-90efbef9.entry.js.map → p-9cfe025d.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-bca4f6c8.entry.js.map → p-b393c1e7.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-c36df3ce.entry.js.map → p-d660ebea.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-59c3ac10.entry.js.map → p-d8a57524.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-84d4d6a1.entry.js.map → p-e196740d.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-2e931b0d.entry.js.map → p-e45d85fc.entry.js.map} +0 -0
- /package/dist/infineon-design-system-stencil/{p-437973f5.entry.js.map → p-e61d3fc6.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-05d9aa1f.entry.js.map → p-f84af2e3.entry.js.map} +0 -0
@@ -5,40 +5,355 @@ import classNames from "classnames";
|
|
5
5
|
export class SearchField {
|
6
6
|
constructor() {
|
7
7
|
this.value = '';
|
8
|
-
this.
|
8
|
+
this.suggestions = [];
|
9
|
+
this.showSuggestions = false;
|
10
|
+
this.maxSuggestions = 10;
|
11
|
+
this.maxHistoryItems = 5;
|
12
|
+
this.enableHistory = true;
|
13
|
+
this.historyKey = 'ifx-search-history';
|
14
|
+
this.historyHeaderText = 'Recent Searches';
|
15
|
+
// ARIA Labels and Accessibility Props
|
16
|
+
this.ariaLabel = 'Search field';
|
17
|
+
this.deleteIconAriaLabel = 'Clear search';
|
18
|
+
this.historyDeleteAriaLabel = 'Remove from history';
|
19
|
+
this.dropdownAriaLabel = 'Search suggestions and history';
|
20
|
+
this.suggestionAriaLabel = 'Search suggestion';
|
21
|
+
this.historyItemAriaLabel = 'Search history item';
|
22
|
+
this.showDropdown = false;
|
23
|
+
this.filteredSuggestions = [];
|
24
|
+
this.selectedSuggestionIndex = -1;
|
25
|
+
this.searchHistory = [];
|
9
26
|
this.showDeleteIcon = false;
|
10
27
|
this.showDeleteIconInternalState = false;
|
11
28
|
this.disabled = false;
|
12
29
|
this.size = 'l';
|
13
30
|
this.isFocused = false;
|
14
31
|
this.placeholder = "Search...";
|
15
|
-
this.autocomplete = "
|
32
|
+
this.autocomplete = "off";
|
16
33
|
this.maxlength = null;
|
34
|
+
this.focusEmitted = false;
|
17
35
|
this.handleInput = () => {
|
18
36
|
const query = this.inputElement.value;
|
19
|
-
this.value = query;
|
37
|
+
this.value = query;
|
20
38
|
this.ifxInput.emit(this.value);
|
39
|
+
if (this.showSuggestions) {
|
40
|
+
this.showDropdown = true;
|
41
|
+
this.selectedSuggestionIndex = -1;
|
42
|
+
this.requestSuggestions(query);
|
43
|
+
}
|
21
44
|
};
|
22
45
|
this.handleDelete = () => {
|
23
46
|
this.inputElement.value = '';
|
24
47
|
this.value = "";
|
25
48
|
this.ifxInput.emit(this.value);
|
49
|
+
this.hideDropdown();
|
50
|
+
};
|
51
|
+
this.handleSearch = () => {
|
52
|
+
if (this.value.trim() && this.enableHistory) {
|
53
|
+
// Only add to history if there are actual results
|
54
|
+
if (this.filteredSuggestions.length > 0) {
|
55
|
+
this.addToHistory(this.value);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
this.hideDropdown();
|
59
|
+
};
|
60
|
+
// Handle click on history delete button
|
61
|
+
this.handleHistoryDelete = (event, term) => {
|
62
|
+
event.stopPropagation(); // Prevent selection of the entry
|
63
|
+
this.removeFromHistory(term);
|
26
64
|
};
|
27
65
|
}
|
66
|
+
componentDidLoad() {
|
67
|
+
this.loadSearchHistory();
|
68
|
+
}
|
28
69
|
handleOutsideClick(event) {
|
29
70
|
const path = event.composedPath();
|
30
|
-
if (!path.includes(this.inputElement)) {
|
31
|
-
this.
|
71
|
+
if (!path.includes(this.inputElement) && !path.includes(this.dropdownElement)) {
|
72
|
+
this.hideDropdown();
|
73
|
+
}
|
74
|
+
}
|
75
|
+
handleKeyDown(event) {
|
76
|
+
if (!this.showDropdown)
|
77
|
+
return;
|
78
|
+
switch (event.key) {
|
79
|
+
case 'ArrowDown':
|
80
|
+
event.preventDefault();
|
81
|
+
this.navigateSuggestions(1);
|
82
|
+
break;
|
83
|
+
case 'ArrowUp':
|
84
|
+
event.preventDefault();
|
85
|
+
this.navigateSuggestions(-1);
|
86
|
+
break;
|
87
|
+
case 'Enter':
|
88
|
+
event.preventDefault();
|
89
|
+
if (this.selectedSuggestionIndex >= 0) {
|
90
|
+
this.selectSuggestion(this.filteredSuggestions[this.selectedSuggestionIndex]);
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
this.handleSearch();
|
94
|
+
}
|
95
|
+
break;
|
96
|
+
case 'Escape':
|
97
|
+
this.hideDropdown();
|
98
|
+
break;
|
32
99
|
}
|
33
100
|
}
|
34
101
|
valueWatcher(newValue) {
|
35
|
-
if (newValue !== this.inputElement.value) {
|
102
|
+
if (this.inputElement && newValue !== this.inputElement.value) {
|
36
103
|
this.inputElement.value = newValue;
|
37
104
|
}
|
105
|
+
this.updateSuggestions();
|
106
|
+
}
|
107
|
+
suggestionsWatcher() {
|
108
|
+
this.updateSuggestions();
|
38
109
|
}
|
39
110
|
focusInput() {
|
40
|
-
|
41
|
-
this.
|
111
|
+
// Don't call focus() if the input is already focused to prevent unnecessary operations
|
112
|
+
if (document.activeElement !== this.inputElement) {
|
113
|
+
this.inputElement.focus();
|
114
|
+
}
|
115
|
+
// Only emit focus event if it hasn't been emitted already
|
116
|
+
if (!this.focusEmitted) {
|
117
|
+
this.focusEmitted = true;
|
118
|
+
this.isFocused = true;
|
119
|
+
this.ifxFocus.emit();
|
120
|
+
}
|
121
|
+
if (this.showSuggestions) {
|
122
|
+
// On focus without input: Show only history
|
123
|
+
if (this.value.length === 0) {
|
124
|
+
this.showHistoryDropdown();
|
125
|
+
// Only show dropdown if history is actually present
|
126
|
+
this.showDropdown = this.enableHistory && this.searchHistory.length > 0;
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
// With existing input: Normal suggestion logic
|
130
|
+
this.updateSuggestions();
|
131
|
+
this.showDropdown = this.filteredSuggestions.length > 0;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
blurInput() {
|
136
|
+
setTimeout(() => {
|
137
|
+
this.isFocused = false;
|
138
|
+
this.focusEmitted = false; // Reset focus flag when blur occurs
|
139
|
+
this.ifxBlur.emit();
|
140
|
+
}, 150);
|
141
|
+
}
|
142
|
+
// Public method to update history from external sources
|
143
|
+
loadSearchHistory() {
|
144
|
+
if (this.enableHistory && typeof localStorage !== 'undefined') {
|
145
|
+
const stored = localStorage.getItem(this.historyKey);
|
146
|
+
this.searchHistory = stored ? JSON.parse(stored) : [];
|
147
|
+
// Update suggestions when history is loaded
|
148
|
+
this.updateSuggestions();
|
149
|
+
// If no input and no history left, close dropdown
|
150
|
+
if (this.value.length === 0 && this.searchHistory.length === 0) {
|
151
|
+
this.showDropdown = false;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
// Public method to completely clear history
|
156
|
+
clearSearchHistory() {
|
157
|
+
if (this.enableHistory && typeof localStorage !== 'undefined') {
|
158
|
+
// Clear from localStorage
|
159
|
+
localStorage.removeItem(this.historyKey);
|
160
|
+
// Clear internal history
|
161
|
+
this.searchHistory = [];
|
162
|
+
// Reset all dropdown-relevant states
|
163
|
+
this.filteredSuggestions = [];
|
164
|
+
this.selectedSuggestionIndex = -1;
|
165
|
+
this.showDropdown = false;
|
166
|
+
// Update suggestions after reset
|
167
|
+
this.updateSuggestions();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
// Suggestion Management Methods
|
171
|
+
addToHistory(term) {
|
172
|
+
if (!this.enableHistory || !term.trim())
|
173
|
+
return;
|
174
|
+
const history = [...this.searchHistory];
|
175
|
+
const existingIndex = history.indexOf(term);
|
176
|
+
if (existingIndex > -1) {
|
177
|
+
history.splice(existingIndex, 1);
|
178
|
+
}
|
179
|
+
history.unshift(term);
|
180
|
+
// Limit history to maxHistoryItems (default 5)
|
181
|
+
this.searchHistory = history.slice(0, this.maxHistoryItems);
|
182
|
+
if (typeof localStorage !== 'undefined') {
|
183
|
+
localStorage.setItem(this.historyKey, JSON.stringify(this.searchHistory));
|
184
|
+
}
|
185
|
+
}
|
186
|
+
// Remove individual history entry
|
187
|
+
removeFromHistory(term) {
|
188
|
+
if (!this.enableHistory)
|
189
|
+
return;
|
190
|
+
const history = [...this.searchHistory];
|
191
|
+
const index = history.indexOf(term);
|
192
|
+
if (index > -1) {
|
193
|
+
history.splice(index, 1);
|
194
|
+
this.searchHistory = history;
|
195
|
+
// Update localStorage
|
196
|
+
if (typeof localStorage !== 'undefined') {
|
197
|
+
localStorage.setItem(this.historyKey, JSON.stringify(this.searchHistory));
|
198
|
+
}
|
199
|
+
// Update suggestions after removal
|
200
|
+
this.updateSuggestions();
|
201
|
+
// Close dropdown if no history remains
|
202
|
+
if (this.searchHistory.length === 0 && this.value.length === 0) {
|
203
|
+
this.showDropdown = false;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
}
|
207
|
+
requestSuggestions(query) {
|
208
|
+
this.ifxSuggestionRequested.emit(query);
|
209
|
+
this.updateSuggestions();
|
210
|
+
}
|
211
|
+
updateSuggestions() {
|
212
|
+
const query = this.value.toLowerCase();
|
213
|
+
let suggestions = [];
|
214
|
+
if (query.length > 0) {
|
215
|
+
// For text input: Mix external suggestions and relevant history
|
216
|
+
// 1. Filter external suggestions
|
217
|
+
if (this.suggestions && this.suggestions.length > 0) {
|
218
|
+
const filteredExternal = this.suggestions.filter(s => s.text.toLowerCase().includes(query));
|
219
|
+
suggestions = [...suggestions, ...filteredExternal];
|
220
|
+
}
|
221
|
+
// 2. Filter relevant history entries
|
222
|
+
if (this.enableHistory && this.searchHistory.length > 0) {
|
223
|
+
const filteredHistory = this.searchHistory
|
224
|
+
.filter(term => term.toLowerCase().includes(query))
|
225
|
+
.map((term, index) => ({
|
226
|
+
id: `history-${index}`,
|
227
|
+
text: term,
|
228
|
+
type: 'history'
|
229
|
+
}));
|
230
|
+
suggestions = [...suggestions, ...filteredHistory];
|
231
|
+
}
|
232
|
+
// 3. Sort by relevance (exact matches first, then prefix matches)
|
233
|
+
suggestions.sort((a, b) => {
|
234
|
+
const aText = a.text.toLowerCase();
|
235
|
+
const bText = b.text.toLowerCase();
|
236
|
+
// Exact match has highest priority
|
237
|
+
if (aText === query && bText !== query)
|
238
|
+
return -1;
|
239
|
+
if (bText === query && aText !== query)
|
240
|
+
return 1;
|
241
|
+
// Prefix match has second highest priority
|
242
|
+
const aStartsWith = aText.startsWith(query);
|
243
|
+
const bStartsWith = bText.startsWith(query);
|
244
|
+
if (aStartsWith && !bStartsWith)
|
245
|
+
return -1;
|
246
|
+
if (bStartsWith && !aStartsWith)
|
247
|
+
return 1;
|
248
|
+
// With equal relevance: external suggestions before history
|
249
|
+
if (a.type === 'suggestion' && b.type === 'history')
|
250
|
+
return -1;
|
251
|
+
if (a.type === 'history' && b.type === 'suggestion')
|
252
|
+
return 1;
|
253
|
+
// Alphabetical sorting as last criterion
|
254
|
+
return aText.localeCompare(bText);
|
255
|
+
});
|
256
|
+
}
|
257
|
+
else {
|
258
|
+
// For empty query: Show only history (no external suggestions)
|
259
|
+
if (this.enableHistory && this.searchHistory.length > 0) {
|
260
|
+
const historySuggestions = this.searchHistory.map((term, index) => ({
|
261
|
+
id: `history-${index}`,
|
262
|
+
text: term,
|
263
|
+
type: 'history'
|
264
|
+
}));
|
265
|
+
suggestions = historySuggestions;
|
266
|
+
}
|
267
|
+
// For empty query DO NOT show external suggestions
|
268
|
+
}
|
269
|
+
// Remove duplicates based on text and scope combination (history takes precedence over external)
|
270
|
+
const uniqueSuggestions = suggestions.reduce((unique, current) => {
|
271
|
+
const existingIndex = unique.findIndex(item => item.text.toLowerCase() === current.text.toLowerCase() &&
|
272
|
+
item.scope === current.scope);
|
273
|
+
if (existingIndex === -1) {
|
274
|
+
unique.push(current);
|
275
|
+
}
|
276
|
+
else {
|
277
|
+
// If already exists, prefer history over external suggestions
|
278
|
+
if (current.type === 'history' && unique[existingIndex].type !== 'history') {
|
279
|
+
unique[existingIndex] = current;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
return unique;
|
283
|
+
}, []);
|
284
|
+
this.filteredSuggestions = uniqueSuggestions.slice(0, this.maxSuggestions);
|
285
|
+
this.selectedSuggestionIndex = -1;
|
286
|
+
}
|
287
|
+
navigateSuggestions(direction) {
|
288
|
+
const maxIndex = this.filteredSuggestions.length - 1;
|
289
|
+
if (direction > 0) {
|
290
|
+
this.selectedSuggestionIndex = this.selectedSuggestionIndex < maxIndex
|
291
|
+
? this.selectedSuggestionIndex + 1
|
292
|
+
: 0;
|
293
|
+
}
|
294
|
+
else {
|
295
|
+
this.selectedSuggestionIndex = this.selectedSuggestionIndex > 0
|
296
|
+
? this.selectedSuggestionIndex - 1
|
297
|
+
: maxIndex;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
selectSuggestion(suggestion) {
|
301
|
+
this.value = suggestion.text;
|
302
|
+
this.inputElement.value = suggestion.text;
|
303
|
+
this.ifxSuggestionSelected.emit(suggestion);
|
304
|
+
this.ifxInput.emit(this.value);
|
305
|
+
if (this.enableHistory) {
|
306
|
+
// Always add selected suggestions to history since they are valid results
|
307
|
+
this.addToHistory(suggestion.text);
|
308
|
+
}
|
309
|
+
this.hideDropdown();
|
310
|
+
}
|
311
|
+
hideDropdown() {
|
312
|
+
this.showDropdown = false;
|
313
|
+
this.selectedSuggestionIndex = -1;
|
314
|
+
this.isFocused = false;
|
315
|
+
}
|
316
|
+
// Show only history in dropdown (e.g. on focus without input)
|
317
|
+
showHistoryDropdown() {
|
318
|
+
if (this.enableHistory && this.searchHistory.length > 0) {
|
319
|
+
// Show only history entries
|
320
|
+
const historySuggestions = this.searchHistory.map((term, index) => ({
|
321
|
+
id: `history-${index}`,
|
322
|
+
text: term,
|
323
|
+
type: 'history'
|
324
|
+
}));
|
325
|
+
this.filteredSuggestions = historySuggestions.slice(0, this.maxSuggestions);
|
326
|
+
this.selectedSuggestionIndex = -1;
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
this.filteredSuggestions = [];
|
330
|
+
}
|
331
|
+
}
|
332
|
+
// Check if only history entries are displayed (without text input)
|
333
|
+
isShowingOnlyHistory() {
|
334
|
+
return this.value.length === 0 &&
|
335
|
+
this.filteredSuggestions.length > 0 &&
|
336
|
+
this.filteredSuggestions.every(s => s.type === 'history');
|
337
|
+
}
|
338
|
+
// Render text with highlighted matches
|
339
|
+
renderHighlightedText(text, query) {
|
340
|
+
if (!query || query.length === 0) {
|
341
|
+
return text;
|
342
|
+
}
|
343
|
+
const lowerText = text.toLowerCase();
|
344
|
+
const lowerQuery = query.toLowerCase();
|
345
|
+
const index = lowerText.indexOf(lowerQuery);
|
346
|
+
if (index === -1) {
|
347
|
+
return text;
|
348
|
+
}
|
349
|
+
const before = text.substring(0, index);
|
350
|
+
const match = text.substring(index, index + query.length);
|
351
|
+
const after = text.substring(index + query.length);
|
352
|
+
return [
|
353
|
+
before,
|
354
|
+
h("strong", null, match),
|
355
|
+
after
|
356
|
+
];
|
42
357
|
}
|
43
358
|
componentWillLoad() {
|
44
359
|
if (!isNestedInIfxComponent(this.el)) {
|
@@ -53,7 +368,17 @@ export class SearchField {
|
|
53
368
|
this.showDeleteIconInternalState = false;
|
54
369
|
}
|
55
370
|
render() {
|
56
|
-
return (h("div", { key: '
|
371
|
+
return (h("div", { key: 'b7cf249b85fdd3b8de6e145e026031b55d689758', "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedBy, "aria-disabled": this.disabled, "aria-value": this.value, class: 'search-field' }, h("div", { key: '0e19cb8ecf2bb3c82e0cc835aa66d2c144aac207', class: this.getWrapperClassNames(), tabindex: 1, onClick: () => this.focusInput() }, h("ifx-icon", { key: '2c8f71752ac2c7aa1e520b5de67a31025e66ae5d', icon: "search-16", class: "search-icon" }), h("input", { key: 'f9773fac1622f99251c7ed6c4662170bf7f94460', 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: '5c83b7c9655ae7bed7e56c366d77fa400d02a080', ref: (el) => (this.dropdownElement = el), id: "suggestions-dropdown", class: "suggestions-dropdown", role: "listbox", "aria-label": this.dropdownAriaLabel }, this.isShowingOnlyHistory() && (h("div", { key: 'a053469803379f16fff04c053035095bffb7cbdc', 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
|
+
} }))))))))));
|
57
382
|
}
|
58
383
|
getSizeClass() {
|
59
384
|
return `${this.size}` === "s"
|
@@ -61,7 +386,14 @@ export class SearchField {
|
|
61
386
|
: "";
|
62
387
|
}
|
63
388
|
getWrapperClassNames() {
|
64
|
-
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
|
+
});
|
65
397
|
}
|
66
398
|
static get is() { return "ifx-search-field"; }
|
67
399
|
static get encapsulation() { return "shadow"; }
|
@@ -97,6 +429,308 @@ export class SearchField {
|
|
97
429
|
"reflect": false,
|
98
430
|
"defaultValue": "''"
|
99
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",
|
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",
|
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",
|
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
|
+
},
|
100
734
|
"showDeleteIcon": {
|
101
735
|
"type": "boolean",
|
102
736
|
"mutable": false,
|
@@ -195,7 +829,7 @@ export class SearchField {
|
|
195
829
|
"setter": false,
|
196
830
|
"attribute": "autocomplete",
|
197
831
|
"reflect": false,
|
198
|
-
"defaultValue": "\"
|
832
|
+
"defaultValue": "\"off\""
|
199
833
|
},
|
200
834
|
"maxlength": {
|
201
835
|
"type": "number",
|
@@ -221,7 +855,10 @@ export class SearchField {
|
|
221
855
|
}
|
222
856
|
static get states() {
|
223
857
|
return {
|
224
|
-
"
|
858
|
+
"showDropdown": {},
|
859
|
+
"filteredSuggestions": {},
|
860
|
+
"selectedSuggestionIndex": {},
|
861
|
+
"searchHistory": {},
|
225
862
|
"showDeleteIconInternalState": {},
|
226
863
|
"isFocused": {}
|
227
864
|
};
|
@@ -238,15 +875,76 @@ export class SearchField {
|
|
238
875
|
"text": ""
|
239
876
|
},
|
240
877
|
"complexType": {
|
241
|
-
"original": "
|
242
|
-
"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",
|
243
910
|
"references": {
|
244
|
-
"
|
245
|
-
"location": "
|
246
|
-
"
|
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"
|
247
915
|
}
|
248
916
|
}
|
249
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
|
+
}
|
250
948
|
}];
|
251
949
|
}
|
252
950
|
static get elementRef() { return "el"; }
|
@@ -254,6 +952,9 @@ export class SearchField {
|
|
254
952
|
return [{
|
255
953
|
"propName": "value",
|
256
954
|
"methodName": "valueWatcher"
|
955
|
+
}, {
|
956
|
+
"propName": "suggestions",
|
957
|
+
"methodName": "suggestionsWatcher"
|
257
958
|
}];
|
258
959
|
}
|
259
960
|
static get listeners() {
|
@@ -263,6 +964,12 @@ export class SearchField {
|
|
263
964
|
"target": "document",
|
264
965
|
"capture": false,
|
265
966
|
"passive": true
|
967
|
+
}, {
|
968
|
+
"name": "keydown",
|
969
|
+
"method": "handleKeyDown",
|
970
|
+
"target": undefined,
|
971
|
+
"capture": false,
|
972
|
+
"passive": false
|
266
973
|
}];
|
267
974
|
}
|
268
975
|
}
|