@shoper/phoenix_design_system 1.11.10-0 → 1.11.10-2
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/file_picker/file_picker.js +0 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/search.js +135 -46
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/search_constants.js +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +12 -5
- 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 +10 -10
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +9 -3
- 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 -3
- 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 +15 -3
- 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 +9 -3
- 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/form/select/select.js +1 -1
- package/build/cjs/packages/phoenix/src/index.js +6 -6
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +0 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +11 -2
- package/build/esm/packages/phoenix/src/components/form/search/search.js +136 -47
- package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_constants.d.ts +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_constants.js +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_types.d.ts +10 -0
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +12 -5
- 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 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +10 -10
- 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 -3
- 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 -3
- 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 +3 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +15 -3
- 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 +9 -3
- 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/form/select/select.js +1 -1
- package/build/esm/packages/phoenix/src/index.js +2 -2
- package/package.json +1 -1
|
@@ -97,7 +97,6 @@ exports.HFilePicker = class HFilePicker extends phoenix_light_lit_element.Phoeni
|
|
|
97
97
|
control-id="${this.controlId}"
|
|
98
98
|
label-text="${this.labelText}"
|
|
99
99
|
label-icon-name="${ifDefined_js.ifDefined(this.labelIconName)}"
|
|
100
|
-
focus-priority
|
|
101
100
|
/>`
|
|
102
101
|
: lit.nothing}
|
|
103
102
|
${((_b = this._file) === null || _b === void 0 ? void 0 : _b.name)
|
|
@@ -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,oBAAoB,0CAA8C;AAClE;AACA,iBAAiB,wDAA4D;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+CAAmD;AAC3E;AACA;AACA;AACA;AACA,oBAAoB,0CAA8C;AAClE;AACA,iBAAiB,wDAA4D;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
6
|
var lit = require('lit');
|
|
7
7
|
var decorators = require('lit/decorators');
|
|
8
|
+
var utilities = require('@dreamcommerce/utilities');
|
|
8
9
|
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
10
|
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
11
|
var icon_constants = require('../../icon/icon_constants.js');
|
|
11
12
|
var observer = require('../../../core/classes/observer/observer.js');
|
|
12
13
|
var context_consumer_controller = require('../../../core/context/context_consumer_controller.js');
|
|
13
14
|
var behavior_subject = require('../../../core/classes/behavior_subject/behavior_subject.js');
|
|
15
|
+
var ref_js = require('lit-html/directives/ref.js');
|
|
14
16
|
var context_provider_controller = require('../../../core/context/context_provider_controller.js');
|
|
15
17
|
var global_constants = require('../../../global_constants.js');
|
|
16
18
|
var when = require('../../../../../../external/lit/external/lit-html/directives/when.js');
|
|
@@ -20,6 +22,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
20
22
|
constructor() {
|
|
21
23
|
super(...arguments);
|
|
22
24
|
this.view = search_constants.DEFAULT_VIEW;
|
|
25
|
+
this._searchResultsRef = ref_js.createRef();
|
|
26
|
+
this._searchHistoryRef = ref_js.createRef();
|
|
23
27
|
this._shouldShowHistory = false;
|
|
24
28
|
this._shouldShowResults = false;
|
|
25
29
|
this._shouldShowMessage = false;
|
|
@@ -29,25 +33,30 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
29
33
|
this._historyContext = new behavior_subject.BehaviorSubject({
|
|
30
34
|
showLoadMore: false
|
|
31
35
|
});
|
|
32
|
-
this._activeItemId = -1;
|
|
36
|
+
this._activeItemId = '-1';
|
|
33
37
|
this._translations = {};
|
|
34
38
|
this._bindKeys = (ev) => {
|
|
35
39
|
var _a;
|
|
36
|
-
const searchItemsCount = this._getSearchItemsCount();
|
|
37
40
|
switch (ev.key) {
|
|
38
41
|
case 'ArrowDown':
|
|
39
42
|
ev.preventDefault();
|
|
40
|
-
this.
|
|
41
|
-
this._scroll(search_constants.SCROLL_DIRECTIONS.down);
|
|
43
|
+
this._handleForwardListFocus();
|
|
42
44
|
break;
|
|
43
45
|
case 'ArrowUp':
|
|
44
46
|
ev.preventDefault();
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
+
this._handleBackwardListFocus();
|
|
48
|
+
break;
|
|
49
|
+
case 'ArrowLeft':
|
|
50
|
+
ev.preventDefault();
|
|
51
|
+
this._handleBackwardGridFocus();
|
|
52
|
+
break;
|
|
53
|
+
case 'ArrowRight':
|
|
54
|
+
ev.preventDefault();
|
|
55
|
+
this._handleForwardGridFocus();
|
|
47
56
|
break;
|
|
48
57
|
case 'Enter':
|
|
49
58
|
ev.preventDefault();
|
|
50
|
-
if (this._activeItemId === -1)
|
|
59
|
+
if (this._activeItemId === '-1' || !this._shouldShowResults)
|
|
51
60
|
return;
|
|
52
61
|
this._handleChooseSearchItem();
|
|
53
62
|
break;
|
|
@@ -67,17 +76,77 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
67
76
|
break;
|
|
68
77
|
}
|
|
69
78
|
};
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this._searchResults.producers.length;
|
|
77
|
-
if (this._searchResults.products.length && this._searchResults.suggestions.length) {
|
|
78
|
-
searchItemsCount += 1;
|
|
79
|
+
this._preventScrollingOnSearchContentBrowsing = (ev) => {
|
|
80
|
+
var _a;
|
|
81
|
+
const hasArrowBeenPressed = ev.key === "ArrowUp" || ev.key === "ArrowDown";
|
|
82
|
+
const hasSearchContainerParent = !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.search__container'));
|
|
83
|
+
if (hasArrowBeenPressed && hasSearchContainerParent) {
|
|
84
|
+
ev.preventDefault();
|
|
79
85
|
}
|
|
80
|
-
|
|
86
|
+
};
|
|
87
|
+
this._handleForwardListFocus = () => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
90
|
+
if (!$searchItemsContainer)
|
|
91
|
+
return;
|
|
92
|
+
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');
|
|
93
|
+
const $listSearchItems = utilities.UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
94
|
+
const searchItemId = $el.getAttribute('data-search-item-id');
|
|
95
|
+
const isListSearchItem = !!searchItemId && !searchItemId.includes('grid');
|
|
96
|
+
const isGridSearchItem = !!searchItemId && searchItemId.includes('grid');
|
|
97
|
+
return isActiveElementAGridSearchItem ? isGridSearchItem : isListSearchItem;
|
|
98
|
+
});
|
|
99
|
+
this._handleForwardFocus($listSearchItems);
|
|
100
|
+
};
|
|
101
|
+
this._handleForwardGridFocus = () => {
|
|
102
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
103
|
+
if (!$searchItemsContainer)
|
|
104
|
+
return;
|
|
105
|
+
const $gridSearchItems = utilities.UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
106
|
+
return !!$el.getAttribute('data-search-item-id');
|
|
107
|
+
});
|
|
108
|
+
this._handleForwardFocus($gridSearchItems);
|
|
109
|
+
};
|
|
110
|
+
this._handleForwardFocus = ($searchItems) => {
|
|
111
|
+
var _a;
|
|
112
|
+
const $activeElement = document.activeElement;
|
|
113
|
+
const indexOfCurrentElement = $searchItems.indexOf($activeElement);
|
|
114
|
+
const indexOfNextElement = indexOfCurrentElement === $searchItems.length - 1 ? 0 : indexOfCurrentElement + 1;
|
|
115
|
+
const $nextSearchItemElement = $searchItems[indexOfNextElement];
|
|
116
|
+
$nextSearchItemElement.focus();
|
|
117
|
+
this._activeItemId = (_a = $nextSearchItemElement.getAttribute('data-search-item-id')) !== null && _a !== void 0 ? _a : '-1';
|
|
118
|
+
};
|
|
119
|
+
this._handleBackwardListFocus = () => {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
122
|
+
if (!$searchItemsContainer)
|
|
123
|
+
return;
|
|
124
|
+
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');
|
|
125
|
+
const $listSearchItems = utilities.UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
126
|
+
const searchItemId = $el.getAttribute('data-search-item-id');
|
|
127
|
+
const isListSearchItem = !!searchItemId && !searchItemId.includes('grid');
|
|
128
|
+
const isGridSearchItem = !!searchItemId && searchItemId.includes('grid');
|
|
129
|
+
return isActiveElementAGridSearchItem ? isGridSearchItem : isListSearchItem;
|
|
130
|
+
});
|
|
131
|
+
this._handleBackwardFocus($listSearchItems);
|
|
132
|
+
};
|
|
133
|
+
this._handleBackwardGridFocus = () => {
|
|
134
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
135
|
+
if (!$searchItemsContainer)
|
|
136
|
+
return;
|
|
137
|
+
const $gridSearchItems = utilities.UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
138
|
+
return !!$el.getAttribute('data-search-item-id');
|
|
139
|
+
});
|
|
140
|
+
this._handleBackwardFocus($gridSearchItems);
|
|
141
|
+
};
|
|
142
|
+
this._handleBackwardFocus = ($searchItems) => {
|
|
143
|
+
var _a;
|
|
144
|
+
const $activeElement = document.activeElement;
|
|
145
|
+
const indexOfCurrentElement = $searchItems.indexOf($activeElement);
|
|
146
|
+
const indexOfPreviousElement = indexOfCurrentElement === 0 ? $searchItems.length - 1 : indexOfCurrentElement - 1;
|
|
147
|
+
const $previousSearchItemElement = $searchItems[indexOfPreviousElement];
|
|
148
|
+
$previousSearchItemElement.focus();
|
|
149
|
+
this._activeItemId = (_a = $previousSearchItemElement.getAttribute('data-search-item-id')) !== null && _a !== void 0 ? _a : '-1';
|
|
81
150
|
};
|
|
82
151
|
this._hideSuggesterOnClickOutside = (ev) => {
|
|
83
152
|
const outsideClick = typeof ev.composedPath === 'function' && !ev.composedPath().includes(this);
|
|
@@ -99,10 +168,21 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
99
168
|
try {
|
|
100
169
|
this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
|
|
101
170
|
this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
|
|
171
|
+
const ariaTranslations = {
|
|
172
|
+
historyGuideAriaLabel: this.settings.historyGuideAriaLabel,
|
|
173
|
+
suggesterGuideAriaLabel: this.settings.suggesterGuideAriaLabel,
|
|
174
|
+
historyItemAriaLabel: this.settings.historyItemAriaLabel,
|
|
175
|
+
suggesterItemAriaLabel: this.settings.suggesterItemAriaLabel,
|
|
176
|
+
suggesterProductItemAriaLabel: this.settings.suggesterProductItemAriaLabel,
|
|
177
|
+
suggesterProducerItemAriaLabel: this.settings.suggesterProducerItemAriaLabel
|
|
178
|
+
};
|
|
102
179
|
this._searchContextObserver = new observer.Observer((searchData) => {
|
|
103
180
|
this._searchResults = searchData.results;
|
|
104
181
|
this._searchHistory = searchData.history;
|
|
105
|
-
this._translations =
|
|
182
|
+
this._translations = {
|
|
183
|
+
...searchData.translations,
|
|
184
|
+
...ariaTranslations
|
|
185
|
+
};
|
|
106
186
|
this._searchPhrase = searchData.searchPhrase;
|
|
107
187
|
this._historyContext.notify({ showLoadMore: this._searchHistory.length > search_constants.SEARCH_CONFIGURATION.historyContentLimit });
|
|
108
188
|
this._historyLimitedContent = this._searchHistory.slice(0, search_constants.SEARCH_CONFIGURATION.historyContentLimit);
|
|
@@ -153,6 +233,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
153
233
|
const shouldShowMessage = ev.detail.searchPhrase !== '';
|
|
154
234
|
this._updateSearchView(ev.detail.searchPhrase, shouldShowMessage, false);
|
|
155
235
|
document.addEventListener('keyup', this._bindKeys);
|
|
236
|
+
document.addEventListener('keydown', this._preventScrollingOnSearchContentBrowsing);
|
|
156
237
|
});
|
|
157
238
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, (ev) => {
|
|
158
239
|
const shouldShowMessage = ev.detail.searchPhrase !== '';
|
|
@@ -163,7 +244,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
163
244
|
this._updateSearchView('', false);
|
|
164
245
|
});
|
|
165
246
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, () => {
|
|
166
|
-
if (this._activeItemId !== -1)
|
|
247
|
+
if (this._activeItemId !== '-1')
|
|
167
248
|
return;
|
|
168
249
|
if (this._inputField.value === '') {
|
|
169
250
|
this._updateSearchView(this._inputField.value, true);
|
|
@@ -190,7 +271,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
190
271
|
}
|
|
191
272
|
_updateSearchView(searchPhrase, shouldShowMessage, shouldUpdateSearchPhrase = true) {
|
|
192
273
|
this._shouldShowMessage = shouldShowMessage;
|
|
193
|
-
this._activeItemId = -1;
|
|
274
|
+
this._activeItemId = '-1';
|
|
194
275
|
this._displaySuggester(searchPhrase);
|
|
195
276
|
if (!shouldUpdateSearchPhrase)
|
|
196
277
|
return;
|
|
@@ -208,36 +289,42 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
208
289
|
}
|
|
209
290
|
}
|
|
210
291
|
_displayHistorySuggestions() {
|
|
211
|
-
this.
|
|
212
|
-
|
|
292
|
+
this._handleToggleHistoryAndResults({
|
|
293
|
+
shouldShowHistory: true,
|
|
294
|
+
shouldShowResults: false
|
|
295
|
+
});
|
|
213
296
|
}
|
|
214
297
|
_hideHistorySuggestionsAndResults() {
|
|
215
|
-
this.
|
|
216
|
-
|
|
298
|
+
this._handleToggleHistoryAndResults({
|
|
299
|
+
shouldShowHistory: false,
|
|
300
|
+
shouldShowResults: false
|
|
301
|
+
});
|
|
217
302
|
}
|
|
218
303
|
_displayResults() {
|
|
219
|
-
this.
|
|
220
|
-
|
|
304
|
+
this._handleToggleHistoryAndResults({
|
|
305
|
+
shouldShowHistory: false,
|
|
306
|
+
shouldShowResults: true
|
|
307
|
+
});
|
|
221
308
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
top = maxScrollTop;
|
|
236
|
-
}
|
|
237
|
-
if (this._activeItemId === 0) {
|
|
238
|
-
top = 0;
|
|
309
|
+
_handleToggleHistoryAndResults({ shouldShowHistory, shouldShowResults }) {
|
|
310
|
+
this._shouldShowHistory = shouldShowHistory;
|
|
311
|
+
this._shouldShowResults = shouldShowResults;
|
|
312
|
+
this._toggleSearchInputAria(shouldShowHistory, shouldShowResults);
|
|
313
|
+
}
|
|
314
|
+
_toggleSearchInputAria(shouldShowHistory, shouldShowResults) {
|
|
315
|
+
var _a;
|
|
316
|
+
const $input = (_a = this._searchInput) === null || _a === void 0 ? void 0 : _a.input;
|
|
317
|
+
if (!$input)
|
|
318
|
+
return;
|
|
319
|
+
if (!shouldShowHistory && !shouldShowResults) {
|
|
320
|
+
$input.removeAttribute('aria-label');
|
|
321
|
+
return;
|
|
239
322
|
}
|
|
240
|
-
|
|
323
|
+
$input.setAttribute('aria-expanded', 'true');
|
|
324
|
+
if (shouldShowHistory)
|
|
325
|
+
$input.setAttribute('aria-label', this.settings.historyGuideAriaLabel);
|
|
326
|
+
if (shouldShowResults)
|
|
327
|
+
$input.setAttribute('aria-label', this.settings.suggesterGuideAriaLabel);
|
|
241
328
|
}
|
|
242
329
|
_handleChooseSearchItem() {
|
|
243
330
|
const activeSearchItem = this.querySelector(`[data-search-item-id="${this._activeItemId}"]`);
|
|
@@ -248,7 +335,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
248
335
|
}
|
|
249
336
|
_resetSearchView() {
|
|
250
337
|
this._shouldShowMessage = false;
|
|
251
|
-
this._activeItemId = -1;
|
|
338
|
+
this._activeItemId = '-1';
|
|
252
339
|
const searchBar = this.querySelector(`.${search_constants.SEARCH_CLASS_NAMES.searchBar}`);
|
|
253
340
|
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(search_constants.SEARCH_CLASS_NAMES.outline);
|
|
254
341
|
this._hideHistorySuggestionsAndResults();
|
|
@@ -296,12 +383,14 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
296
383
|
module-instance-id="${this.moduleInstanceId}"
|
|
297
384
|
></h-search-message>`)}
|
|
298
385
|
${when.when(this._shouldShowHistory, () => lit.html `<h-search-history
|
|
386
|
+
${ref_js.ref(this._searchHistoryRef)}
|
|
299
387
|
.history="${this._historyLimitedContent}"
|
|
300
388
|
.translations="${this._translations}"
|
|
301
389
|
active-item-id="${this._activeItemId}"
|
|
302
390
|
module-instance-id="${this.moduleInstanceId}"
|
|
303
391
|
></h-search-history>`)}
|
|
304
392
|
${when.when(this._shouldShowResults, () => lit.html `<h-search-results
|
|
393
|
+
${ref_js.ref(this._searchResultsRef)}
|
|
305
394
|
.results="${this._searchResults}"
|
|
306
395
|
search-phrase="${this._searchPhrase}"
|
|
307
396
|
.settings="${this.settings}"
|
|
@@ -365,7 +454,7 @@ tslib_es6.__decorate([
|
|
|
365
454
|
], exports.HSearch.prototype, "_historyContext", void 0);
|
|
366
455
|
tslib_es6.__decorate([
|
|
367
456
|
decorators.state(),
|
|
368
|
-
tslib_es6.__metadata("design:type",
|
|
457
|
+
tslib_es6.__metadata("design:type", String)
|
|
369
458
|
], exports.HSearch.prototype, "_activeItemId", void 0);
|
|
370
459
|
tslib_es6.__decorate([
|
|
371
460
|
decorators.state(),
|
|
@@ -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,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;"}
|
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -27,7 +27,7 @@ const SEARCH_CUSTOM_EVENT_NAMES = {
|
|
|
27
27
|
clear: 'clearSearchPhrase',
|
|
28
28
|
submit: 'submitSearchPhrase',
|
|
29
29
|
close: 'close',
|
|
30
|
-
search: '
|
|
30
|
+
search: 'performSearch',
|
|
31
31
|
updateSearchPhrase: 'updateSearchPhrase',
|
|
32
32
|
focusin: 'searchFocusIn',
|
|
33
33
|
keyup: 'searchKeyUp'
|
|
@@ -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
|
}
|
|
@@ -46,7 +48,7 @@ exports.HSearchHistory = class HSearchHistory extends phoenix_light_lit_element.
|
|
|
46
48
|
|
|
47
49
|
<ul>
|
|
48
50
|
${repeat.repeat(this.history, (historyElement, index) => lit.html ` <li
|
|
49
|
-
class="${search_constants.SEARCH_CLASS_NAMES.item} ${index === this.activeItemId ? search_constants.SEARCH_CLASS_NAMES.itemActive : ''}"
|
|
51
|
+
class="${search_constants.SEARCH_CLASS_NAMES.item} ${String(index) === this.activeItemId ? search_constants.SEARCH_CLASS_NAMES.itemActive : ''}"
|
|
50
52
|
>
|
|
51
53
|
<h-search-history-select
|
|
52
54
|
item-label="${historyElement.label}"
|
|
@@ -54,13 +56,14 @@ exports.HSearchHistory = class HSearchHistory extends phoenix_light_lit_element.
|
|
|
54
56
|
data-suggested-value="${historyElement.label}"
|
|
55
57
|
data-search-item-id="${index}"
|
|
56
58
|
module-instance-id="${this.moduleInstanceId}"
|
|
59
|
+
aria-label=${this.translations.historyAriaLabel ? `${this.translations.historyAriaLabel} ${historyElement.label}` : undefined}
|
|
57
60
|
>
|
|
58
61
|
<h-icon icon-name="icon-clock"></h-icon>
|
|
59
62
|
|
|
60
63
|
<span class="${search_constants.SEARCH_CLASS_NAMES.historyItemValue}">${historyElement.label}</span>
|
|
61
64
|
</h-search-history-select>
|
|
62
65
|
|
|
63
|
-
<h-search-history-remove item-id="${historyElement.id}">
|
|
66
|
+
<h-search-history-remove data-search-item-id="${index}-grid" item-id="${historyElement.id}">
|
|
64
67
|
<h-icon
|
|
65
68
|
icon-name="icon-x"
|
|
66
69
|
clickable=${true}
|
|
@@ -71,7 +74,11 @@ exports.HSearchHistory = class HSearchHistory extends phoenix_light_lit_element.
|
|
|
71
74
|
</li>`)}
|
|
72
75
|
</ul>
|
|
73
76
|
|
|
74
|
-
<h-search-history-load-more
|
|
77
|
+
<h-search-history-load-more
|
|
78
|
+
class="${search_constants.SEARCH_CLASS_NAMES.historyLoadMore}"
|
|
79
|
+
data-search-item-id="${this._loadMoreButtonId}"
|
|
80
|
+
${ref_js.ref(this.buttonRef)}
|
|
81
|
+
>
|
|
75
82
|
${this.translations.loadMore}
|
|
76
83
|
</h-search-history-load-more>`);
|
|
77
84
|
}
|
|
@@ -81,8 +88,8 @@ tslib_es6.__decorate([
|
|
|
81
88
|
tslib_es6.__metadata("design:type", Array)
|
|
82
89
|
], exports.HSearchHistory.prototype, "history", void 0);
|
|
83
90
|
tslib_es6.__decorate([
|
|
84
|
-
decorators.property({ type:
|
|
85
|
-
tslib_es6.__metadata("design:type",
|
|
91
|
+
decorators.property({ type: String, attribute: 'active-item-id' }),
|
|
92
|
+
tslib_es6.__metadata("design:type", String)
|
|
86
93
|
], exports.HSearchHistory.prototype, "activeItemId", void 0);
|
|
87
94
|
tslib_es6.__decorate([
|
|
88
95
|
decorators.property({ 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;"}
|
|
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;"}
|
package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js
CHANGED
|
@@ -15,8 +15,8 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
15
15
|
}
|
|
16
16
|
connectedCallback() {
|
|
17
17
|
super.connectedCallback();
|
|
18
|
-
this.
|
|
19
|
-
if (!this.
|
|
18
|
+
this.input = this.querySelector('input[type="search"]');
|
|
19
|
+
if (!this.input) {
|
|
20
20
|
throw new Error('Search input not found');
|
|
21
21
|
}
|
|
22
22
|
this._setupInitialValue();
|
|
@@ -28,7 +28,7 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
28
28
|
if (!searchPhraseRegArray)
|
|
29
29
|
return;
|
|
30
30
|
const searchQuery = searchPhraseRegArray[1].replace(/\+/g, ' ');
|
|
31
|
-
this.
|
|
31
|
+
this.input.value = decodeURIComponent(this._deserializeInputPhrase(searchQuery));
|
|
32
32
|
}
|
|
33
33
|
_deserializeInputPhrase(value) {
|
|
34
34
|
if (value.indexOf('%2f') !== -1) {
|
|
@@ -46,14 +46,14 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
46
46
|
return value;
|
|
47
47
|
}
|
|
48
48
|
_setupListeners() {
|
|
49
|
-
this.
|
|
49
|
+
this.input.addEventListener('focusin', (ev) => {
|
|
50
50
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.focusin, {
|
|
51
51
|
detail: {
|
|
52
52
|
searchPhrase: ev.target.value
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
|
-
this.
|
|
56
|
+
this.input.addEventListener('keyup', (ev) => {
|
|
57
57
|
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
|
|
58
58
|
return;
|
|
59
59
|
if (ev.key !== 'Enter') {
|
|
@@ -74,8 +74,8 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
this.
|
|
78
|
-
if (this.
|
|
77
|
+
this.input.addEventListener('search', (ev) => {
|
|
78
|
+
if (this.input.value !== '') {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.search, {
|
|
@@ -88,13 +88,13 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
88
88
|
if (!ev.detail || ev.detail.moduleInstanceId !== this.moduleInstanceId)
|
|
89
89
|
return;
|
|
90
90
|
this._isSearchPhraseCleared = true;
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
91
|
+
this.input.value = '';
|
|
92
|
+
this.input.focus();
|
|
93
93
|
});
|
|
94
94
|
document.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.updateSearchPhrase, (ev) => {
|
|
95
95
|
if (!ev.detail || ev.detail.moduleInstanceId !== this.moduleInstanceId)
|
|
96
96
|
return;
|
|
97
|
-
this.
|
|
97
|
+
this.input.value = ev.detail.searchPhrase;
|
|
98
98
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
99
99
|
detail: {
|
|
100
100
|
searchPhrase: ev.detail.searchPhrase
|
|
@@ -31,11 +31,13 @@ exports.HSearchProducerContent = class HSearchProducerContent extends phoenix_li
|
|
|
31
31
|
${repeat.repeat(this.producers, (producer, index) => {
|
|
32
32
|
var _a, _b;
|
|
33
33
|
return lit.html `<li
|
|
34
|
-
class="${search_constants.SEARCH_CLASS_NAMES.item} ${search_constants.SEARCH_CLASS_NAMES.itemHoverable} ${this.initialItemIds.producers + index ===
|
|
34
|
+
class="${search_constants.SEARCH_CLASS_NAMES.item} ${search_constants.SEARCH_CLASS_NAMES.itemHoverable} ${String(this.initialItemIds.producers + index) ===
|
|
35
35
|
this.activeItemId
|
|
36
36
|
? search_constants.SEARCH_CLASS_NAMES.itemActive
|
|
37
37
|
: ''}"
|
|
38
38
|
data-search-item-id="${this.initialItemIds.producers + index}"
|
|
39
|
+
aria-label=${this.producerAriaLabel ? `${this.producerAriaLabel} ${producer.name}` : undefined}
|
|
40
|
+
tabindex="0"
|
|
39
41
|
>
|
|
40
42
|
<a
|
|
41
43
|
href="${producer.url}"
|
|
@@ -56,8 +58,8 @@ tslib_es6.__decorate([
|
|
|
56
58
|
tslib_es6.__metadata("design:type", Array)
|
|
57
59
|
], exports.HSearchProducerContent.prototype, "producers", void 0);
|
|
58
60
|
tslib_es6.__decorate([
|
|
59
|
-
decorators.property({ type:
|
|
60
|
-
tslib_es6.__metadata("design:type",
|
|
61
|
+
decorators.property({ type: String, attribute: 'active-item-id' }),
|
|
62
|
+
tslib_es6.__metadata("design:type", String)
|
|
61
63
|
], exports.HSearchProducerContent.prototype, "activeItemId", void 0);
|
|
62
64
|
tslib_es6.__decorate([
|
|
63
65
|
decorators.property({ type: Object, reflect: true }),
|
|
@@ -71,6 +73,10 @@ tslib_es6.__decorate([
|
|
|
71
73
|
decorators.property({ type: String, attribute: 'search-phrase' }),
|
|
72
74
|
tslib_es6.__metadata("design:type", String)
|
|
73
75
|
], exports.HSearchProducerContent.prototype, "searchPhrase", void 0);
|
|
76
|
+
tslib_es6.__decorate([
|
|
77
|
+
decorators.property({ type: String }),
|
|
78
|
+
tslib_es6.__metadata("design:type", String)
|
|
79
|
+
], exports.HSearchProducerContent.prototype, "producerAriaLabel", void 0);
|
|
74
80
|
exports.HSearchProducerContent = tslib_es6.__decorate([
|
|
75
81
|
phoenix_custom_element.phoenixCustomElement(search_constants.SEARCH_COMPONENT_NAMES.searchProducerContent)
|
|
76
82
|
], exports.HSearchProducerContent);
|
|
@@ -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,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;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;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;"}
|
|
@@ -44,11 +44,13 @@ exports.HSearchProductContent = class HSearchProductContent extends phoenix_ligh
|
|
|
44
44
|
${repeat.repeat(this.products, (product, index) => {
|
|
45
45
|
var _a, _b;
|
|
46
46
|
return lit.html ` <li
|
|
47
|
-
class="${search_constants.SEARCH_CLASS_NAMES.item} ${search_constants.SEARCH_CLASS_NAMES.itemHoverable} ${this.initialItemIds.products + index ===
|
|
47
|
+
class="${search_constants.SEARCH_CLASS_NAMES.item} ${search_constants.SEARCH_CLASS_NAMES.itemHoverable} ${String(this.initialItemIds.products + index) ===
|
|
48
48
|
this.activeItemId
|
|
49
49
|
? search_constants.SEARCH_CLASS_NAMES.itemActive
|
|
50
50
|
: ''}"
|
|
51
51
|
data-search-item-id="${this.initialItemIds.products + index}"
|
|
52
|
+
aria-label=${this.productAriaLabel ? `${this.productAriaLabel} ${product.name}` : undefined}
|
|
53
|
+
tabindex="0"
|
|
52
54
|
>
|
|
53
55
|
<a
|
|
54
56
|
href="${product.url}"
|
|
@@ -97,8 +99,8 @@ tslib_es6.__decorate([
|
|
|
97
99
|
tslib_es6.__metadata("design:type", Object)
|
|
98
100
|
], exports.HSearchProductContent.prototype, "settings", void 0);
|
|
99
101
|
tslib_es6.__decorate([
|
|
100
|
-
decorators.property({ type:
|
|
101
|
-
tslib_es6.__metadata("design:type",
|
|
102
|
+
decorators.property({ type: String, attribute: 'active-item-id' }),
|
|
103
|
+
tslib_es6.__metadata("design:type", String)
|
|
102
104
|
], exports.HSearchProductContent.prototype, "activeItemId", void 0);
|
|
103
105
|
tslib_es6.__decorate([
|
|
104
106
|
decorators.property({ type: Object, reflect: true }),
|
|
@@ -108,6 +110,10 @@ tslib_es6.__decorate([
|
|
|
108
110
|
decorators.property({ type: Object }),
|
|
109
111
|
tslib_es6.__metadata("design:type", Object)
|
|
110
112
|
], exports.HSearchProductContent.prototype, "translations", void 0);
|
|
113
|
+
tslib_es6.__decorate([
|
|
114
|
+
decorators.property({ type: String }),
|
|
115
|
+
tslib_es6.__metadata("design:type", String)
|
|
116
|
+
], exports.HSearchProductContent.prototype, "productAriaLabel", void 0);
|
|
111
117
|
exports.HSearchProductContent = tslib_es6.__decorate([
|
|
112
118
|
phoenix_custom_element.phoenixCustomElement(search_constants.SEARCH_COMPONENT_NAMES.searchProductContent)
|
|
113
119
|
], exports.HSearchProductContent);
|
|
@@ -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,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;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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -7,6 +7,7 @@ var lit = require('lit');
|
|
|
7
7
|
var decorators = require('lit/decorators');
|
|
8
8
|
var phoenix_light_lit_element = require('../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
9
|
var phoenix_custom_element = require('../../../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var v4 = require('../../../../../../../../external/uuid/dist/esm-browser/v4.js');
|
|
10
11
|
var when = require('../../../../../../../../external/lit/external/lit-html/directives/when.js');
|
|
11
12
|
var search_constants = require('../../search_constants.js');
|
|
12
13
|
var isEqual = require('../../../../../../../../external/lodash/isEqual.js');
|
|
@@ -14,6 +15,8 @@ var isEqual = require('../../../../../../../../external/lodash/isEqual.js');
|
|
|
14
15
|
exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
15
16
|
constructor() {
|
|
16
17
|
super(...arguments);
|
|
18
|
+
this._loadMoreButtonId = v4['default']();
|
|
19
|
+
this._goToProductsForButtonId = v4['default']();
|
|
17
20
|
this.searchPhrase = '';
|
|
18
21
|
this.translations = {};
|
|
19
22
|
this._productPage = 1;
|
|
@@ -72,6 +75,7 @@ exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.
|
|
|
72
75
|
locale="${this.locale}"
|
|
73
76
|
view="${this.view}"
|
|
74
77
|
module-instance-id="${this.moduleInstanceId}"
|
|
78
|
+
.suggestionAriaLabel=${this.settings.suggesterItemAriaLabel}
|
|
75
79
|
>
|
|
76
80
|
</h-search-suggestion-content>`)}
|
|
77
81
|
${when.when((_c = this.results.products) === null || _c === void 0 ? void 0 : _c.length, () => lit.html `
|
|
@@ -82,16 +86,23 @@ exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.
|
|
|
82
86
|
active-item-id="${this.activeItemId}"
|
|
83
87
|
.initialItemIds="${this._getInitialItemsIds()}"
|
|
84
88
|
.translations="${this.translations}"
|
|
89
|
+
.productAriaLabel=${this.settings.suggesterProductItemAriaLabel}
|
|
85
90
|
></h-search-product-content>
|
|
86
91
|
|
|
87
92
|
${when.when(this.settings.isLoadingMoreSearchResultsEnabled, () => when.when(this._areMoreProductsAvailable(), () => lit.html `<button
|
|
88
93
|
class="${search_constants.SEARCH_CLASS_NAMES.productButton}"
|
|
89
94
|
@click="${this.handleLoadMoreProducts}"
|
|
90
95
|
type="button"
|
|
96
|
+
data-search-item-id="${this._loadMoreButtonId}"
|
|
91
97
|
>
|
|
92
98
|
${this.translations.loadMore}
|
|
93
99
|
</button>`), () => lit.html `
|
|
94
|
-
<button
|
|
100
|
+
<button
|
|
101
|
+
class="${search_constants.SEARCH_CLASS_NAMES.productButton}"
|
|
102
|
+
@click="${this.handleGoToProductsFor}"
|
|
103
|
+
type="button"
|
|
104
|
+
data-search-item-id="${this._goToProductsForButtonId}"
|
|
105
|
+
>
|
|
95
106
|
${this.translations.goToProductsFor}: <strong>${this._getSearchPhrase()}</strong>
|
|
96
107
|
</button>
|
|
97
108
|
`)}
|
|
@@ -104,6 +115,7 @@ exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.
|
|
|
104
115
|
.initialItemIds="${this._getInitialItemsIds()}"
|
|
105
116
|
.translations="${this.translations}"
|
|
106
117
|
search-phrase="${this.searchPhrase}"
|
|
118
|
+
.producerAriaLabel=${this.settings.suggesterProducerItemAriaLabel}
|
|
107
119
|
></h-search-producer-content>`)}
|
|
108
120
|
`;
|
|
109
121
|
});
|
|
@@ -130,8 +142,8 @@ tslib_es6.__decorate([
|
|
|
130
142
|
tslib_es6.__metadata("design:type", String)
|
|
131
143
|
], exports.HSearchResults.prototype, "locale", void 0);
|
|
132
144
|
tslib_es6.__decorate([
|
|
133
|
-
decorators.property({ type:
|
|
134
|
-
tslib_es6.__metadata("design:type",
|
|
145
|
+
decorators.property({ type: String, attribute: 'active-item-id' }),
|
|
146
|
+
tslib_es6.__metadata("design:type", String)
|
|
135
147
|
], exports.HSearchResults.prototype, "activeItemId", void 0);
|
|
136
148
|
tslib_es6.__decorate([
|
|
137
149
|
decorators.property({ type: Object }),
|