@shoper/phoenix_design_system 1.11.13 → 1.11.14
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/build/cjs/packages/phoenix/src/components/form/search/search.js +279 -95
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +5 -0
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +22 -9
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +15 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js +8 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +9 -4
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +9 -4
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +11 -4
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +12 -5
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +12 -12
- package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +26 -5
- package/build/esm/packages/phoenix/src/components/form/search/search.js +280 -96
- package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_types.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +5 -0
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.d.ts +2 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +22 -9
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +16 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js +8 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +9 -4
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +9 -4
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +11 -4
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +12 -5
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.js +2 -2
- package/package.json +2 -2
|
@@ -11,15 +11,19 @@ import { BehaviorSubject } from '../../../core/classes/behavior_subject/behavior
|
|
|
11
11
|
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
12
12
|
import { ContextProviderController } from '../../../core/context/context_provider_controller.js';
|
|
13
13
|
import { BREAKPOINTS } from '../../../global_constants.js';
|
|
14
|
+
import v4 from '../../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
14
15
|
import { when as n } from '../../../../../../external/lit/external/lit-html/directives/when.js';
|
|
15
|
-
import { DEFAULT_VIEW, SEARCH_CLASS_NAMES,
|
|
16
|
+
import { DEFAULT_VIEW, SEARCH_CLASS_NAMES, SEARCH_COMPONENT_NAMES, SEARCH_CONFIGURATION, SEARCH_CONTEXT_NAMES, SEARCH_CUSTOM_EVENT_NAMES } from './search_constants.js';
|
|
16
17
|
|
|
17
18
|
let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
20
21
|
this.view = DEFAULT_VIEW;
|
|
22
|
+
this._id = v4();
|
|
23
|
+
this._searchContentContainerId = v4();
|
|
21
24
|
this._searchResultsRef = createRef();
|
|
22
25
|
this._searchHistoryRef = createRef();
|
|
26
|
+
this._searchMessageRef = createRef();
|
|
23
27
|
this._shouldShowHistory = false;
|
|
24
28
|
this._shouldShowResults = false;
|
|
25
29
|
this._shouldShowMessage = false;
|
|
@@ -29,84 +33,225 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
29
33
|
this._historyContext = new BehaviorSubject({
|
|
30
34
|
showLoadMore: false
|
|
31
35
|
});
|
|
32
|
-
this._activeItemId = -1
|
|
36
|
+
this._activeItemId = `${this._id}-1`;
|
|
33
37
|
this._translations = {};
|
|
38
|
+
this._containerRole = 'grid';
|
|
34
39
|
this._bindKeys = (ev) => {
|
|
35
|
-
var _a;
|
|
36
40
|
switch (ev.key) {
|
|
37
41
|
case 'ArrowDown':
|
|
38
42
|
ev.preventDefault();
|
|
39
|
-
this.
|
|
40
|
-
this._scroll(SCROLL_DIRECTIONS.down);
|
|
43
|
+
this._handleForwardListFocus();
|
|
41
44
|
break;
|
|
42
45
|
case 'ArrowUp':
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
this._handleBackwardListFocus(ev);
|
|
47
|
+
break;
|
|
48
|
+
case 'ArrowLeft':
|
|
49
|
+
if (this._containerRole === 'grid') {
|
|
50
|
+
ev.preventDefault();
|
|
51
|
+
this._handleBackwardGridFocus();
|
|
52
|
+
}
|
|
53
|
+
if (this._containerRole === 'listbox')
|
|
54
|
+
this._handleMoveToInputField();
|
|
55
|
+
break;
|
|
56
|
+
case 'ArrowRight':
|
|
57
|
+
if (this._containerRole === 'grid') {
|
|
58
|
+
ev.preventDefault();
|
|
59
|
+
this._handleForwardGridFocus();
|
|
60
|
+
}
|
|
61
|
+
if (this._containerRole === 'listbox')
|
|
62
|
+
this._handleMoveToInputField();
|
|
46
63
|
break;
|
|
47
64
|
case 'Enter':
|
|
48
65
|
ev.preventDefault();
|
|
49
|
-
if (this._activeItemId === -1 || !this._shouldShowResults)
|
|
66
|
+
if (this._activeItemId === `${this._id}-1` || !this._shouldShowResults)
|
|
50
67
|
return;
|
|
51
68
|
this._handleChooseSearchItem();
|
|
52
69
|
break;
|
|
53
70
|
case 'Escape':
|
|
54
71
|
ev.preventDefault();
|
|
55
|
-
this.
|
|
56
|
-
|
|
72
|
+
if (this._shouldShowHistory || this._shouldShowHistory || this._shouldShowResults) {
|
|
73
|
+
this._inputField.focus();
|
|
74
|
+
this._shouldShowMessage = false;
|
|
75
|
+
this._hideHistorySuggestionsAndResults();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this._inputField.value = '';
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case 'End':
|
|
82
|
+
ev.preventDefault();
|
|
83
|
+
this._handleFocusOnInputWithCaretEnd();
|
|
84
|
+
break;
|
|
85
|
+
case 'Home':
|
|
86
|
+
ev.preventDefault();
|
|
87
|
+
this._handleFocusOnInputWithCaretStart();
|
|
88
|
+
break;
|
|
89
|
+
case 'Backspace':
|
|
90
|
+
this._handleMoveToInputField();
|
|
57
91
|
break;
|
|
58
92
|
case 'Tab':
|
|
59
|
-
const isFocusedOnSearchInput =
|
|
60
|
-
if (!isFocusedOnSearchInput)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
93
|
+
const isFocusedOnSearchInput = document.activeElement === this._inputField;
|
|
94
|
+
if (!isFocusedOnSearchInput)
|
|
95
|
+
ev.preventDefault();
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
const isAWriteableCharacter = ev.key.length === 1;
|
|
99
|
+
if (isAWriteableCharacter)
|
|
100
|
+
this._handleWriteableCharacter(ev);
|
|
66
101
|
break;
|
|
67
102
|
}
|
|
68
103
|
};
|
|
69
|
-
this.
|
|
104
|
+
this._handleSearchTabNavigation = (ev) => {
|
|
105
|
+
if (ev.key !== 'Tab')
|
|
106
|
+
return;
|
|
107
|
+
const isFocusedOnSearchInput = document.activeElement === this._inputField;
|
|
108
|
+
if (ev.shiftKey && !isFocusedOnSearchInput) {
|
|
109
|
+
this._focusOnPreviousElementBeforeSearchInput(ev);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!isFocusedOnSearchInput) {
|
|
113
|
+
const searchBar = this.querySelector(`.${SEARCH_CLASS_NAMES.searchBar}`);
|
|
114
|
+
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(SEARCH_CLASS_NAMES.outline);
|
|
115
|
+
this._resetSearchView();
|
|
116
|
+
this._removeSearchKeyboardNavigation();
|
|
117
|
+
this._focusOnNextElementAfterSearchInput(ev);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
this._focusOnPreviousElementBeforeSearchInput = async (ev) => {
|
|
121
|
+
ev.preventDefault();
|
|
122
|
+
const searchBar = this.querySelector(`.${SEARCH_CLASS_NAMES.searchBar}`);
|
|
123
|
+
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(SEARCH_CLASS_NAMES.outline);
|
|
124
|
+
this._resetSearchView();
|
|
125
|
+
this._removeSearchKeyboardNavigation();
|
|
126
|
+
UiDomUtils.getPreviousFocusableElement(this._inputField).focus();
|
|
127
|
+
};
|
|
128
|
+
this._focusOnNextElementAfterSearchInput = async (ev) => {
|
|
129
|
+
ev.preventDefault();
|
|
130
|
+
UiDomUtils.getNextFocusableElement(this._inputField).focus();
|
|
131
|
+
};
|
|
132
|
+
this._preventScrollingOnSearchContentBrowsing = (ev) => {
|
|
70
133
|
var _a;
|
|
71
|
-
const
|
|
72
|
-
const
|
|
134
|
+
const hasArrowBeenPressed = ev.key === "ArrowUp" || ev.key === "ArrowDown";
|
|
135
|
+
const hasHomeOrEndBeenPressed = ev.key === "Home" || ev.key === "End";
|
|
136
|
+
const hasSearchContainerParent = !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.search__container'));
|
|
137
|
+
if ((hasArrowBeenPressed || hasHomeOrEndBeenPressed) && hasSearchContainerParent) {
|
|
138
|
+
ev.preventDefault();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
this._handleForwardListFocus = () => {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const $searchItemsContainer = this._findSearchItemsContainer();
|
|
73
144
|
if (!$searchItemsContainer)
|
|
74
145
|
return;
|
|
75
|
-
const
|
|
146
|
+
const isActiveElementASearchItem = !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute('data-search-item-id'));
|
|
147
|
+
const isActiveElementAGridSearchItem = isActiveElementASearchItem && !!((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.getAttribute('data-search-grid-item'));
|
|
148
|
+
const $listSearchItems = this._findListSearchItems($searchItemsContainer, isActiveElementAGridSearchItem);
|
|
149
|
+
this._handleForwardFocus($listSearchItems);
|
|
150
|
+
};
|
|
151
|
+
this._handleForwardGridFocus = () => {
|
|
152
|
+
const $searchItemsContainer = this._findSearchItemsContainer();
|
|
153
|
+
if (!$searchItemsContainer)
|
|
154
|
+
return;
|
|
155
|
+
const $gridSearchItems = UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
76
156
|
return !!$el.getAttribute('data-search-item-id');
|
|
77
157
|
});
|
|
158
|
+
this._handleForwardFocus($gridSearchItems);
|
|
159
|
+
};
|
|
160
|
+
this._handleForwardFocus = ($searchItems) => {
|
|
161
|
+
var _a;
|
|
162
|
+
const $activeElement = document.activeElement;
|
|
78
163
|
const indexOfCurrentElement = $searchItems.indexOf($activeElement);
|
|
79
164
|
const indexOfNextElement = indexOfCurrentElement === $searchItems.length - 1 ? 0 : indexOfCurrentElement + 1;
|
|
80
165
|
const $nextSearchItemElement = $searchItems[indexOfNextElement];
|
|
81
166
|
$nextSearchItemElement.focus();
|
|
82
|
-
this.
|
|
167
|
+
this._setActiveItemId((_a = $nextSearchItemElement.getAttribute('data-search-item-id')) !== null && _a !== void 0 ? _a : `${this._id}-1`);
|
|
83
168
|
};
|
|
84
|
-
this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
169
|
+
this._handleMoveToInputField = () => {
|
|
170
|
+
const isFocusedOnSearchInput = document.activeElement === this._inputField;
|
|
171
|
+
if (isFocusedOnSearchInput)
|
|
172
|
+
return;
|
|
173
|
+
this._inputField.focus();
|
|
174
|
+
};
|
|
175
|
+
this._handleBackwardListFocus = (ev) => {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
const isFocusedOnSearchInput = document.activeElement === this._inputField;
|
|
178
|
+
const hasPopup = this._shouldShowHistory || this._shouldShowHistory || this._shouldShowResults;
|
|
179
|
+
if (isFocusedOnSearchInput || !hasPopup)
|
|
180
|
+
return;
|
|
181
|
+
ev.preventDefault();
|
|
182
|
+
const $searchItemsContainer = this._findSearchItemsContainer();
|
|
183
|
+
if (!$searchItemsContainer)
|
|
184
|
+
return;
|
|
185
|
+
const isActiveElementASearchItem = !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute('data-search-item-id'));
|
|
186
|
+
const isActiveElementAGridSearchItem = isActiveElementASearchItem && !!((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.getAttribute('data-search-grid-item'));
|
|
187
|
+
const $listSearchItems = this._findListSearchItems($searchItemsContainer, isActiveElementAGridSearchItem);
|
|
188
|
+
this._handleBackwardFocus($listSearchItems);
|
|
189
|
+
};
|
|
190
|
+
this._findListSearchItems = ($searchItemsContainer, shouldFindGridList) => {
|
|
191
|
+
return UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
192
|
+
const searchItemId = $el.getAttribute('data-search-item-id');
|
|
193
|
+
const isListSearchItem = !!searchItemId && !$el.getAttribute('data-search-grid-item');
|
|
194
|
+
const isGridSearchItem = !!searchItemId && $el.getAttribute('data-search-grid-item');
|
|
195
|
+
return shouldFindGridList ? isGridSearchItem : isListSearchItem;
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
this._handleBackwardGridFocus = () => {
|
|
199
|
+
const $searchItemsContainer = this._findSearchItemsContainer();
|
|
88
200
|
if (!$searchItemsContainer)
|
|
89
201
|
return;
|
|
90
|
-
const $
|
|
202
|
+
const $gridSearchItems = UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
91
203
|
return !!$el.getAttribute('data-search-item-id');
|
|
92
204
|
});
|
|
205
|
+
this._handleBackwardFocus($gridSearchItems);
|
|
206
|
+
};
|
|
207
|
+
this._findSearchItemsContainer = () => {
|
|
208
|
+
const containers = [
|
|
209
|
+
this._searchHistoryRef.value,
|
|
210
|
+
this._searchResultsRef.value,
|
|
211
|
+
this._searchMessageRef.value
|
|
212
|
+
];
|
|
213
|
+
return containers.find(container => container && !UiDomUtils.isElementEmpty(container));
|
|
214
|
+
};
|
|
215
|
+
this._handleBackwardFocus = ($searchItems) => {
|
|
216
|
+
var _a;
|
|
217
|
+
const $activeElement = document.activeElement;
|
|
93
218
|
const indexOfCurrentElement = $searchItems.indexOf($activeElement);
|
|
94
219
|
const indexOfPreviousElement = indexOfCurrentElement === 0 ? $searchItems.length - 1 : indexOfCurrentElement - 1;
|
|
95
220
|
const $previousSearchItemElement = $searchItems[indexOfPreviousElement];
|
|
96
221
|
$previousSearchItemElement.focus();
|
|
97
|
-
this.
|
|
222
|
+
this._setActiveItemId((_a = $previousSearchItemElement.getAttribute('data-search-item-id')) !== null && _a !== void 0 ? _a : `${this._id}-1`);
|
|
98
223
|
};
|
|
99
|
-
this.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
224
|
+
this._setActiveItemId = (newActiveItemId) => {
|
|
225
|
+
this._activeItemId = newActiveItemId;
|
|
226
|
+
if (document.activeElement !== this._inputField) {
|
|
227
|
+
this._inputField.setAttribute('aria-activedescendant', this._activeItemId);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
this._removeSearchKeyboardNavigation = () => {
|
|
231
|
+
document.removeEventListener('keydown', this._bindKeys);
|
|
232
|
+
document.removeEventListener('keyup', this._handleSearchTabNavigation);
|
|
233
|
+
};
|
|
234
|
+
this._handleFocusOnInputWithCaretEnd = () => {
|
|
235
|
+
const isFocusedOnSearchInput = document.activeElement === this._inputField;
|
|
236
|
+
if (isFocusedOnSearchInput)
|
|
237
|
+
return;
|
|
238
|
+
this._inputField.focus();
|
|
239
|
+
const endPosition = this._inputField.value.length;
|
|
240
|
+
this._inputField.setSelectionRange(endPosition, endPosition);
|
|
241
|
+
};
|
|
242
|
+
this._handleFocusOnInputWithCaretStart = () => {
|
|
243
|
+
this._inputField.focus();
|
|
244
|
+
this._inputField.setSelectionRange(0, 0);
|
|
245
|
+
};
|
|
246
|
+
this._handleWriteableCharacter = (ev) => {
|
|
247
|
+
const isFocusedOnSearchInput = document.activeElement === this._inputField;
|
|
248
|
+
if (isFocusedOnSearchInput)
|
|
249
|
+
return;
|
|
250
|
+
this._inputField.focus();
|
|
251
|
+
const isAPrintableCharacter = ev.key.match(/\P{C}/u);
|
|
252
|
+
if (ev.key.length !== 1 || !isAPrintableCharacter) {
|
|
253
|
+
ev.preventDefault();
|
|
108
254
|
}
|
|
109
|
-
return searchItemsCount;
|
|
110
255
|
};
|
|
111
256
|
this._hideSuggesterOnClickOutside = (ev) => {
|
|
112
257
|
const outsideClick = typeof ev.composedPath === 'function' && !ev.composedPath().includes(this);
|
|
@@ -121,6 +266,12 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
121
266
|
? this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened)
|
|
122
267
|
: this.classList.add(SEARCH_CLASS_NAMES.mobileOpened);
|
|
123
268
|
};
|
|
269
|
+
this._preventSubmitOnSearchClear = (ev) => {
|
|
270
|
+
const $searchClear = this.querySelector(SEARCH_COMPONENT_NAMES.clearButton);
|
|
271
|
+
if (ev.key === 'Enter' && ev.target === $searchClear) {
|
|
272
|
+
ev.preventDefault();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
124
275
|
}
|
|
125
276
|
async connectedCallback() {
|
|
126
277
|
super.connectedCallback();
|
|
@@ -159,7 +310,9 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
159
310
|
disconnectedCallback() {
|
|
160
311
|
super.disconnectedCallback();
|
|
161
312
|
document.removeEventListener('click', this._hideSuggesterOnClickOutside);
|
|
313
|
+
document.removeEventListener('keydown', this._preventScrollingOnSearchContentBrowsing);
|
|
162
314
|
window.removeEventListener('resize', this._switchTypeOfSearchView);
|
|
315
|
+
this._searchForm.removeEventListener('keydown', this._preventSubmitOnSearchClear);
|
|
163
316
|
}
|
|
164
317
|
_setupContext() {
|
|
165
318
|
this._historyContextProvider = new ContextProviderController(this);
|
|
@@ -168,8 +321,11 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
168
321
|
_setupInitialSearchPhrase() {
|
|
169
322
|
var _a;
|
|
170
323
|
const searchInput = this.querySelector('input[type="search"]');
|
|
324
|
+
const searchForm = this.closest('form');
|
|
171
325
|
if (searchInput)
|
|
172
326
|
this._inputField = searchInput;
|
|
327
|
+
if (searchForm)
|
|
328
|
+
this._searchForm = searchForm;
|
|
173
329
|
if (!((_a = this._inputField) === null || _a === void 0 ? void 0 : _a.value))
|
|
174
330
|
return;
|
|
175
331
|
this._searchPhrase = this._inputField.value;
|
|
@@ -188,11 +344,17 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
188
344
|
}
|
|
189
345
|
_setupListeners() {
|
|
190
346
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.focusin, (ev) => {
|
|
347
|
+
var _a, _b, _c;
|
|
348
|
+
const $target = (_a = ev.detail) === null || _a === void 0 ? void 0 : _a.relatedTarget;
|
|
349
|
+
if ($target === null || $target === void 0 ? void 0 : $target.closest(`[id="${this._searchContentContainerId}"]`))
|
|
350
|
+
return;
|
|
191
351
|
const searchBar = this.querySelector(`.${SEARCH_CLASS_NAMES.searchBar}`);
|
|
192
352
|
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.add(SEARCH_CLASS_NAMES.outline);
|
|
193
|
-
const shouldShowMessage = ev.detail.searchPhrase !== '';
|
|
194
|
-
this._updateSearchView(ev.detail.searchPhrase, shouldShowMessage, false);
|
|
195
|
-
document.addEventListener('
|
|
353
|
+
const shouldShowMessage = ((_b = ev.detail) === null || _b === void 0 ? void 0 : _b.searchPhrase) !== '';
|
|
354
|
+
this._updateSearchView(((_c = ev.detail) === null || _c === void 0 ? void 0 : _c.searchPhrase) || '', shouldShowMessage, false);
|
|
355
|
+
document.addEventListener('keydown', this._bindKeys);
|
|
356
|
+
document.addEventListener('keyup', this._handleSearchTabNavigation);
|
|
357
|
+
document.addEventListener('keydown', this._preventScrollingOnSearchContentBrowsing);
|
|
196
358
|
});
|
|
197
359
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.keyup, (ev) => {
|
|
198
360
|
const shouldShowMessage = ev.detail.searchPhrase !== '';
|
|
@@ -203,7 +365,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
203
365
|
this._updateSearchView('', false);
|
|
204
366
|
});
|
|
205
367
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.submit, () => {
|
|
206
|
-
if (this._activeItemId !== -1)
|
|
368
|
+
if (this._activeItemId !== `${this._id}-1`)
|
|
207
369
|
return;
|
|
208
370
|
if (this._inputField.value === '') {
|
|
209
371
|
this._updateSearchView(this._inputField.value, true);
|
|
@@ -227,10 +389,12 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
227
389
|
});
|
|
228
390
|
document.addEventListener('click', this._hideSuggesterOnClickOutside);
|
|
229
391
|
window.addEventListener('resize', this._switchTypeOfSearchView);
|
|
392
|
+
this._searchForm.addEventListener('keydown', this._preventSubmitOnSearchClear);
|
|
230
393
|
}
|
|
231
394
|
_updateSearchView(searchPhrase, shouldShowMessage, shouldUpdateSearchPhrase = true) {
|
|
232
395
|
this._shouldShowMessage = shouldShowMessage;
|
|
233
|
-
this.
|
|
396
|
+
this._setActiveItemId(`${this._id}-1`);
|
|
397
|
+
this._inputField.setAttribute('aria-activedescendant', '');
|
|
234
398
|
this._displaySuggester(searchPhrase);
|
|
235
399
|
if (!shouldUpdateSearchPhrase)
|
|
236
400
|
return;
|
|
@@ -268,57 +432,58 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
268
432
|
_handleToggleHistoryAndResults({ shouldShowHistory, shouldShowResults }) {
|
|
269
433
|
this._shouldShowHistory = shouldShowHistory;
|
|
270
434
|
this._shouldShowResults = shouldShowResults;
|
|
271
|
-
this.
|
|
435
|
+
this._toggleSearchInputAttributes(shouldShowHistory, shouldShowResults);
|
|
436
|
+
this._toggleSearchContainerAttributes(shouldShowHistory, shouldShowResults);
|
|
272
437
|
}
|
|
273
|
-
|
|
438
|
+
_toggleSearchInputAttributes(shouldShowHistory, shouldShowResults) {
|
|
274
439
|
var _a;
|
|
275
440
|
const $input = (_a = this._searchInput) === null || _a === void 0 ? void 0 : _a.input;
|
|
276
441
|
if (!$input)
|
|
277
442
|
return;
|
|
278
443
|
if (!shouldShowHistory && !shouldShowResults) {
|
|
279
444
|
$input.removeAttribute('aria-label');
|
|
445
|
+
$input.setAttribute('aria-activedescendant', '');
|
|
280
446
|
return;
|
|
281
447
|
}
|
|
282
448
|
$input.setAttribute('aria-expanded', 'true');
|
|
283
|
-
if (shouldShowHistory)
|
|
449
|
+
if (shouldShowHistory) {
|
|
284
450
|
$input.setAttribute('aria-label', this.settings.historyGuideAriaLabel);
|
|
285
|
-
|
|
286
|
-
$input.setAttribute('aria-label', this.settings.suggesterGuideAriaLabel);
|
|
287
|
-
}
|
|
288
|
-
_scroll(direction) {
|
|
289
|
-
const searchContainer = this.querySelector(`.${SEARCH_CLASS_NAMES.container}`);
|
|
290
|
-
const maxScrollTop = searchContainer.scrollHeight - searchContainer.clientHeight;
|
|
291
|
-
const activeItem = this.querySelector(`[data-search-item-id="${this._activeItemId}"]`);
|
|
292
|
-
const activeItemHeight = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.getBoundingClientRect().height) || 0;
|
|
293
|
-
let top;
|
|
294
|
-
if (direction === SCROLL_DIRECTIONS.up) {
|
|
295
|
-
top = searchContainer.scrollTop == 0 ? 0 : searchContainer.scrollTop + 30 - activeItemHeight;
|
|
451
|
+
$input.setAttribute('aria-haspopup', 'grid');
|
|
296
452
|
}
|
|
297
|
-
|
|
298
|
-
|
|
453
|
+
if (shouldShowResults) {
|
|
454
|
+
$input.setAttribute('aria-label', this.settings.suggesterGuideAriaLabel);
|
|
455
|
+
this._inputField.removeAttribute('aria-haspopup');
|
|
299
456
|
}
|
|
300
|
-
|
|
301
|
-
|
|
457
|
+
}
|
|
458
|
+
_toggleSearchContainerAttributes(shouldShowHistory, shouldShowResults) {
|
|
459
|
+
if (shouldShowHistory) {
|
|
460
|
+
this._containerRole = 'grid';
|
|
302
461
|
}
|
|
303
|
-
if (
|
|
304
|
-
|
|
462
|
+
if (shouldShowResults) {
|
|
463
|
+
this._containerRole = 'listbox';
|
|
305
464
|
}
|
|
306
|
-
searchContainer === null || searchContainer === void 0 ? void 0 : searchContainer.scrollTo({ top, behavior: 'smooth' });
|
|
307
465
|
}
|
|
308
466
|
_handleChooseSearchItem() {
|
|
309
|
-
const activeSearchItem = this.querySelector(`[data-search-item-id="${this._activeItemId}"]`);
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
467
|
+
const $activeSearchItem = this.querySelector(`[data-search-item-id="${this._activeItemId}"]`);
|
|
468
|
+
if (!$activeSearchItem)
|
|
469
|
+
return;
|
|
470
|
+
const $linkElement = $activeSearchItem.querySelector('a');
|
|
471
|
+
const $suggestedElement = $linkElement || $activeSearchItem;
|
|
472
|
+
const $elementToClick = $activeSearchItem.dataset.suggestedValue ? $suggestedElement : $linkElement;
|
|
473
|
+
if (!$elementToClick) {
|
|
474
|
+
$activeSearchItem.click();
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
$elementToClick.click();
|
|
478
|
+
}
|
|
314
479
|
}
|
|
315
480
|
_resetSearchView() {
|
|
316
481
|
this._shouldShowMessage = false;
|
|
317
|
-
this.
|
|
482
|
+
this._setActiveItemId(`${this._id}-1`);
|
|
318
483
|
const searchBar = this.querySelector(`.${SEARCH_CLASS_NAMES.searchBar}`);
|
|
319
484
|
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(SEARCH_CLASS_NAMES.outline);
|
|
320
485
|
this._hideHistorySuggestionsAndResults();
|
|
321
|
-
|
|
486
|
+
this._removeSearchKeyboardNavigation();
|
|
322
487
|
}
|
|
323
488
|
_submitSearchPhrase(searchPhrase) {
|
|
324
489
|
this._dispatchEventWithSearchPhrase(SEARCH_CUSTOM_EVENT_NAMES.searchPhraseSubmitted, searchPhrase);
|
|
@@ -353,33 +518,48 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
353
518
|
<div class="labeled-icon__signature">${this._translations.search}</div>
|
|
354
519
|
</div>
|
|
355
520
|
|
|
356
|
-
${n(this._isSuggesterLayerVisible(), () => html
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
${n(this._shouldShowHistory, () => html `<h-search-history
|
|
365
|
-
${ref(this._searchHistoryRef)}
|
|
521
|
+
${n(this._isSuggesterLayerVisible(), () => html `
|
|
522
|
+
<div
|
|
523
|
+
class="${SEARCH_CLASS_NAMES.container}"
|
|
524
|
+
id="${this._searchContentContainerId}"
|
|
525
|
+
role="${this._containerRole}"
|
|
526
|
+
>
|
|
527
|
+
${n(this._shouldShowMessage, () => html `<h-search-message
|
|
528
|
+
${ref(this._searchMessageRef)}
|
|
366
529
|
.history="${this._historyLimitedContent}"
|
|
367
|
-
.translations="${this._translations}"
|
|
368
|
-
active-item-id="${this._activeItemId}"
|
|
369
|
-
module-instance-id="${this.moduleInstanceId}"
|
|
370
|
-
></h-search-history>`)}
|
|
371
|
-
${n(this._shouldShowResults, () => html `<h-search-results
|
|
372
|
-
${ref(this._searchResultsRef)}
|
|
373
530
|
.results="${this._searchResults}"
|
|
374
|
-
search-phrase="${this._searchPhrase}"
|
|
375
|
-
.settings="${this.settings}"
|
|
376
|
-
locale="${this.locale}"
|
|
377
|
-
view="${this.view}"
|
|
378
531
|
.translations="${this._translations}"
|
|
379
|
-
|
|
532
|
+
search-phrase="${this._searchPhrase}"
|
|
380
533
|
module-instance-id="${this.moduleInstanceId}"
|
|
381
|
-
></h-search-
|
|
382
|
-
|
|
534
|
+
></h-search-message>`)}
|
|
535
|
+
${n(this._shouldShowHistory, () => html `<h-search-history
|
|
536
|
+
${ref(this._searchHistoryRef)}
|
|
537
|
+
.history="${this._historyLimitedContent}"
|
|
538
|
+
.translations="${this._translations}"
|
|
539
|
+
active-item-id="${this._activeItemId}"
|
|
540
|
+
search-id="${this._id}"
|
|
541
|
+
module-instance-id="${this.moduleInstanceId}"
|
|
542
|
+
></h-search-history>`)}
|
|
543
|
+
${n(this._shouldShowResults, () => html `<h-search-results
|
|
544
|
+
${ref(this._searchResultsRef)}
|
|
545
|
+
.results="${this._searchResults}"
|
|
546
|
+
search-phrase="${this._searchPhrase}"
|
|
547
|
+
.settings="${this.settings}"
|
|
548
|
+
locale="${this.locale}"
|
|
549
|
+
view="${this.view}"
|
|
550
|
+
.translations="${this._translations}"
|
|
551
|
+
active-item-id="${this._activeItemId}"
|
|
552
|
+
search-id="${this._id}"
|
|
553
|
+
module-instance-id="${this.moduleInstanceId}"
|
|
554
|
+
></h-search-results>`)}
|
|
555
|
+
</div>
|
|
556
|
+
`, () => html `
|
|
557
|
+
<div
|
|
558
|
+
class="${SEARCH_CLASS_NAMES.container}"
|
|
559
|
+
id="${this._searchContentContainerId}"
|
|
560
|
+
role="${this._containerRole}"
|
|
561
|
+
hidden
|
|
562
|
+
></div>`)}
|
|
383
563
|
`;
|
|
384
564
|
}
|
|
385
565
|
};
|
|
@@ -433,12 +613,16 @@ __decorate([
|
|
|
433
613
|
], HSearch.prototype, "_historyContext", void 0);
|
|
434
614
|
__decorate([
|
|
435
615
|
state(),
|
|
436
|
-
__metadata("design:type",
|
|
616
|
+
__metadata("design:type", String)
|
|
437
617
|
], HSearch.prototype, "_activeItemId", void 0);
|
|
438
618
|
__decorate([
|
|
439
619
|
state(),
|
|
440
620
|
__metadata("design:type", Object)
|
|
441
621
|
], HSearch.prototype, "_translations", void 0);
|
|
622
|
+
__decorate([
|
|
623
|
+
state(),
|
|
624
|
+
__metadata("design:type", String)
|
|
625
|
+
], HSearch.prototype, "_containerRole", void 0);
|
|
442
626
|
HSearch = __decorate([
|
|
443
627
|
phoenixCustomElement(SEARCH_COMPONENT_NAMES.search)
|
|
444
628
|
], HSearch);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,qEAA6E;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wDAA4D;AAC3E,0BAA0B,qEAA6E;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit';
|
|
1
|
+
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import { PhoenixLightLitElement } from "../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
3
|
export declare class HSearchClear extends PhoenixLightLitElement {
|
|
4
4
|
private _btnController;
|
|
@@ -11,6 +11,7 @@ export declare class HSearchClear extends PhoenixLightLitElement {
|
|
|
11
11
|
constructor();
|
|
12
12
|
connectedCallback(): void;
|
|
13
13
|
private _handleClearButtonOnPhraseEnter;
|
|
14
|
+
protected updated(_changedProperties: PropertyValues): void;
|
|
14
15
|
private _dispatchClearEvent;
|
|
15
16
|
private _searchContextSetup;
|
|
16
17
|
disconnectedCallback(): void;
|
package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js
CHANGED
|
@@ -32,6 +32,11 @@ let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
|
|
|
32
32
|
this.addEventListener('click', this._dispatchClearEvent);
|
|
33
33
|
document.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.keyup, this._handleClearButtonOnPhraseEnter);
|
|
34
34
|
}
|
|
35
|
+
updated(_changedProperties) {
|
|
36
|
+
super.updated(_changedProperties);
|
|
37
|
+
const newTabIndex = this._shouldShow ? '0' : '-1';
|
|
38
|
+
this.setAttribute('tabindex', newTabIndex);
|
|
39
|
+
}
|
|
35
40
|
async _searchContextSetup() {
|
|
36
41
|
try {
|
|
37
42
|
this._searchContextConsumer = new ContextConsumerController(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2EAAmF;AAC7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2EAAmF;AAC7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -8,9 +8,9 @@ export declare class HSearchHistory extends PhoenixLightLitElement {
|
|
|
8
8
|
private _historyContext$;
|
|
9
9
|
private _historyContextObserver;
|
|
10
10
|
buttonRef: Ref<HSearchHistoryLoadMore>;
|
|
11
|
-
private _loadMoreButtonId;
|
|
12
11
|
history: TSearchHistoryItem[];
|
|
13
|
-
activeItemId:
|
|
12
|
+
activeItemId: string;
|
|
13
|
+
searchId: string;
|
|
14
14
|
translations: Record<string, string>;
|
|
15
15
|
moduleInstanceId: string;
|
|
16
16
|
connectedCallback(): Promise<void>;
|