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