@shoper/phoenix_design_system 1.11.10-0 → 1.11.10-1
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 +127 -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 +128 -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
|
@@ -107,11 +107,13 @@ exports.HSearchSuggestionContent = class HSearchSuggestionContent extends phoeni
|
|
|
107
107
|
<ul>
|
|
108
108
|
${repeat.repeat(this._suggestionsData, (suggestion, index) => lit.html `<li
|
|
109
109
|
@click=${() => this._handleSuggestion(suggestion.suggestionName, suggestion.type)}
|
|
110
|
-
class="${search_constants.SEARCH_CLASS_NAMES.item} ${search_constants.SEARCH_CLASS_NAMES.itemHoverable} ${index === this.activeItemId
|
|
110
|
+
class="${search_constants.SEARCH_CLASS_NAMES.item} ${search_constants.SEARCH_CLASS_NAMES.itemHoverable} ${String(index) === this.activeItemId
|
|
111
111
|
? search_constants.SEARCH_CLASS_NAMES.itemActive
|
|
112
112
|
: ''}"
|
|
113
113
|
data-suggested-value="${suggestion.suggestionName}"
|
|
114
114
|
data-search-item-id="${index}"
|
|
115
|
+
aria-label=${this.suggestionAriaLabel ? `${this.suggestionAriaLabel} ${suggestion.suggestionName}` : undefined}
|
|
116
|
+
tabindex="0"
|
|
115
117
|
>
|
|
116
118
|
${when.when(suggestion.type === search_constants.SUGGESTIONS_TYPE.suggestion, () => lit.html ` <span> ${this._getMatchedPhrase(suggestion.suggestionName)} </span>
|
|
117
119
|
<h-icon
|
|
@@ -134,8 +136,8 @@ exports.HSearchSuggestionContent = class HSearchSuggestionContent extends phoeni
|
|
|
134
136
|
}
|
|
135
137
|
};
|
|
136
138
|
tslib_es6.__decorate([
|
|
137
|
-
decorators.property({ type:
|
|
138
|
-
tslib_es6.__metadata("design:type",
|
|
139
|
+
decorators.property({ type: String, attribute: 'active-item-id' }),
|
|
140
|
+
tslib_es6.__metadata("design:type", String)
|
|
139
141
|
], exports.HSearchSuggestionContent.prototype, "activeItemId", void 0);
|
|
140
142
|
tslib_es6.__decorate([
|
|
141
143
|
decorators.property({ type: Object, reflect: true }),
|
|
@@ -157,6 +159,10 @@ tslib_es6.__decorate([
|
|
|
157
159
|
decorators.property({ type: String, attribute: 'module-instance-id' }),
|
|
158
160
|
tslib_es6.__metadata("design:type", String)
|
|
159
161
|
], exports.HSearchSuggestionContent.prototype, "moduleInstanceId", void 0);
|
|
162
|
+
tslib_es6.__decorate([
|
|
163
|
+
decorators.property({ type: String }),
|
|
164
|
+
tslib_es6.__metadata("design:type", String)
|
|
165
|
+
], exports.HSearchSuggestionContent.prototype, "suggestionAriaLabel", void 0);
|
|
160
166
|
tslib_es6.__decorate([
|
|
161
167
|
decorators.state(),
|
|
162
168
|
tslib_es6.__metadata("design:type", String)
|
|
@@ -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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -301,7 +301,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
301
301
|
offset=${this.offset}
|
|
302
302
|
content-width="full"
|
|
303
303
|
>
|
|
304
|
-
<h-dropdown-toggler name=${this.controlName}
|
|
304
|
+
<h-dropdown-toggler name=${this.controlName}> ${this.getSlot(select_constants.SELECT_SLOT_NAMES.toggler)} </h-dropdown-toggler>
|
|
305
305
|
|
|
306
306
|
<h-dropdown-content
|
|
307
307
|
class="${select_constants.SELECT_CSS_CLASSES.selectContent} ${this.error ? select_constants.SELECT_CSS_CLASSES.selectContentError : ''}"
|
|
@@ -99,10 +99,10 @@ var display_stepper = require('./components/form/input_stepper/display_stepper.j
|
|
|
99
99
|
var button_stepper = require('./components/form/input_stepper/button_stepper.js');
|
|
100
100
|
var search_constants = require('./components/form/search/search_constants.js');
|
|
101
101
|
var search_input = require('./components/form/search/subcomponents/input/search_input.js');
|
|
102
|
-
var
|
|
102
|
+
var search_results = require('./components/form/search/subcomponents/results/search_results.js');
|
|
103
103
|
var search_history_load_more = require('./components/form/search/subcomponents/history/search_history_load_more.js');
|
|
104
104
|
var search_history = require('./components/form/search/subcomponents/history/search_history.js');
|
|
105
|
-
var
|
|
105
|
+
var search = require('./components/form/search/search.js');
|
|
106
106
|
var search_submit = require('./components/form/search/subcomponents/buttons/search_submit.js');
|
|
107
107
|
var search_clear = require('./components/form/search/subcomponents/buttons/search_clear.js');
|
|
108
108
|
var search_close = require('./components/form/search/subcomponents/buttons/search_close.js');
|
|
@@ -592,10 +592,10 @@ Object.defineProperty(exports, 'HSearchInput', {
|
|
|
592
592
|
return search_input.HSearchInput;
|
|
593
593
|
}
|
|
594
594
|
});
|
|
595
|
-
Object.defineProperty(exports, '
|
|
595
|
+
Object.defineProperty(exports, 'HSearchResults', {
|
|
596
596
|
enumerable: true,
|
|
597
597
|
get: function () {
|
|
598
|
-
return
|
|
598
|
+
return search_results.HSearchResults;
|
|
599
599
|
}
|
|
600
600
|
});
|
|
601
601
|
Object.defineProperty(exports, 'HSearchHistoryLoadMore', {
|
|
@@ -610,10 +610,10 @@ Object.defineProperty(exports, 'HSearchHistory', {
|
|
|
610
610
|
return search_history.HSearchHistory;
|
|
611
611
|
}
|
|
612
612
|
});
|
|
613
|
-
Object.defineProperty(exports, '
|
|
613
|
+
Object.defineProperty(exports, 'HSearch', {
|
|
614
614
|
enumerable: true,
|
|
615
615
|
get: function () {
|
|
616
|
-
return
|
|
616
|
+
return search.HSearch;
|
|
617
617
|
}
|
|
618
618
|
});
|
|
619
619
|
Object.defineProperty(exports, 'HSearchSubmit', {
|
|
@@ -93,7 +93,6 @@ let HFilePicker = class HFilePicker extends PhoenixLightLitElement {
|
|
|
93
93
|
control-id="${this.controlId}"
|
|
94
94
|
label-text="${this.labelText}"
|
|
95
95
|
label-icon-name="${ifDefined(this.labelIconName)}"
|
|
96
|
-
focus-priority
|
|
97
96
|
/>`
|
|
98
97
|
: nothing}
|
|
99
98
|
${((_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,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA,uBAAuB,0CAA8C;AACrE;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,uBAAuB,0CAA8C;AACrE;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -12,6 +12,8 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
12
12
|
private _searchContextObserver;
|
|
13
13
|
private _searchInput;
|
|
14
14
|
private _inputField;
|
|
15
|
+
private _searchResultsRef;
|
|
16
|
+
private _searchHistoryRef;
|
|
15
17
|
private _shouldShowHistory;
|
|
16
18
|
private _shouldShowResults;
|
|
17
19
|
private _shouldShowMessage;
|
|
@@ -34,9 +36,16 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
34
36
|
private _displayHistorySuggestions;
|
|
35
37
|
private _hideHistorySuggestionsAndResults;
|
|
36
38
|
private _displayResults;
|
|
39
|
+
private _handleToggleHistoryAndResults;
|
|
40
|
+
private _toggleSearchInputAria;
|
|
37
41
|
private _bindKeys;
|
|
38
|
-
private
|
|
39
|
-
private
|
|
42
|
+
private _preventScrollingOnSearchContentBrowsing;
|
|
43
|
+
private _handleForwardListFocus;
|
|
44
|
+
private _handleForwardGridFocus;
|
|
45
|
+
private _handleForwardFocus;
|
|
46
|
+
private _handleBackwardListFocus;
|
|
47
|
+
private _handleBackwardGridFocus;
|
|
48
|
+
private _handleBackwardFocus;
|
|
40
49
|
private _handleChooseSearchItem;
|
|
41
50
|
private _resetSearchView;
|
|
42
51
|
private _submitSearchPhrase;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { property, state } from 'lit/decorators';
|
|
4
|
+
import { UiDomUtils } from '@dreamcommerce/utilities';
|
|
4
5
|
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
6
|
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
7
|
import { ICONS_SIZES } from '../../icon/icon_constants.js';
|
|
7
8
|
import { Observer } from '../../../core/classes/observer/observer.js';
|
|
8
9
|
import { ContextConsumerController } from '../../../core/context/context_consumer_controller.js';
|
|
9
10
|
import { BehaviorSubject } from '../../../core/classes/behavior_subject/behavior_subject.js';
|
|
11
|
+
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
10
12
|
import { ContextProviderController } from '../../../core/context/context_provider_controller.js';
|
|
11
13
|
import { BREAKPOINTS } from '../../../global_constants.js';
|
|
12
14
|
import { when as n } from '../../../../../../external/lit/external/lit-html/directives/when.js';
|
|
13
|
-
import { DEFAULT_VIEW, SEARCH_CLASS_NAMES,
|
|
15
|
+
import { DEFAULT_VIEW, SEARCH_CLASS_NAMES, SEARCH_CONFIGURATION, SEARCH_COMPONENT_NAMES, SEARCH_CONTEXT_NAMES, SEARCH_CUSTOM_EVENT_NAMES } from './search_constants.js';
|
|
14
16
|
|
|
15
17
|
let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
16
18
|
constructor() {
|
|
17
19
|
super(...arguments);
|
|
18
20
|
this.view = DEFAULT_VIEW;
|
|
21
|
+
this._searchResultsRef = createRef();
|
|
22
|
+
this._searchHistoryRef = createRef();
|
|
19
23
|
this._shouldShowHistory = false;
|
|
20
24
|
this._shouldShowResults = false;
|
|
21
25
|
this._shouldShowMessage = false;
|
|
@@ -25,25 +29,30 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
25
29
|
this._historyContext = new BehaviorSubject({
|
|
26
30
|
showLoadMore: false
|
|
27
31
|
});
|
|
28
|
-
this._activeItemId = -1;
|
|
32
|
+
this._activeItemId = '-1';
|
|
29
33
|
this._translations = {};
|
|
30
34
|
this._bindKeys = (ev) => {
|
|
31
35
|
var _a;
|
|
32
|
-
const searchItemsCount = this._getSearchItemsCount();
|
|
33
36
|
switch (ev.key) {
|
|
34
37
|
case 'ArrowDown':
|
|
35
38
|
ev.preventDefault();
|
|
36
|
-
this.
|
|
37
|
-
this._scroll(SCROLL_DIRECTIONS.down);
|
|
39
|
+
this._handleForwardListFocus();
|
|
38
40
|
break;
|
|
39
41
|
case 'ArrowUp':
|
|
40
42
|
ev.preventDefault();
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
+
this._handleBackwardListFocus();
|
|
44
|
+
break;
|
|
45
|
+
case 'ArrowLeft':
|
|
46
|
+
ev.preventDefault();
|
|
47
|
+
this._handleForwardGridFocus();
|
|
48
|
+
break;
|
|
49
|
+
case 'ArrowRight':
|
|
50
|
+
ev.preventDefault();
|
|
51
|
+
this._handleBackwardGridFocus();
|
|
43
52
|
break;
|
|
44
53
|
case 'Enter':
|
|
45
54
|
ev.preventDefault();
|
|
46
|
-
if (this._activeItemId === -1)
|
|
55
|
+
if (this._activeItemId === '-1' || !this._shouldShowResults)
|
|
47
56
|
return;
|
|
48
57
|
this._handleChooseSearchItem();
|
|
49
58
|
break;
|
|
@@ -63,17 +72,69 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
63
72
|
break;
|
|
64
73
|
}
|
|
65
74
|
};
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this._searchResults.producers.length;
|
|
73
|
-
if (this._searchResults.products.length && this._searchResults.suggestions.length) {
|
|
74
|
-
searchItemsCount += 1;
|
|
75
|
+
this._preventScrollingOnSearchContentBrowsing = (ev) => {
|
|
76
|
+
var _a;
|
|
77
|
+
const hasArrowBeenPressed = ev.key === "ArrowUp" || ev.key === "ArrowDown";
|
|
78
|
+
const hasSearchContainerParent = !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.search__container'));
|
|
79
|
+
if (hasArrowBeenPressed && hasSearchContainerParent) {
|
|
80
|
+
ev.preventDefault();
|
|
75
81
|
}
|
|
76
|
-
|
|
82
|
+
};
|
|
83
|
+
this._handleForwardListFocus = () => {
|
|
84
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
85
|
+
if (!$searchItemsContainer)
|
|
86
|
+
return;
|
|
87
|
+
const $listSearchItems = UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
88
|
+
const searchItemId = $el.getAttribute('data-search-item-id');
|
|
89
|
+
return !!searchItemId && !searchItemId.includes('grid');
|
|
90
|
+
});
|
|
91
|
+
this._handleForwardFocus($listSearchItems);
|
|
92
|
+
};
|
|
93
|
+
this._handleForwardGridFocus = () => {
|
|
94
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
95
|
+
if (!$searchItemsContainer)
|
|
96
|
+
return;
|
|
97
|
+
const $gridSearchItems = UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
98
|
+
return !!$el.getAttribute('data-search-item-id');
|
|
99
|
+
});
|
|
100
|
+
this._handleForwardFocus($gridSearchItems);
|
|
101
|
+
};
|
|
102
|
+
this._handleForwardFocus = ($searchItems) => {
|
|
103
|
+
var _a;
|
|
104
|
+
const $activeElement = document.activeElement;
|
|
105
|
+
const indexOfCurrentElement = $searchItems.indexOf($activeElement);
|
|
106
|
+
const indexOfNextElement = indexOfCurrentElement === $searchItems.length - 1 ? 0 : indexOfCurrentElement + 1;
|
|
107
|
+
const $nextSearchItemElement = $searchItems[indexOfNextElement];
|
|
108
|
+
$nextSearchItemElement.focus();
|
|
109
|
+
this._activeItemId = (_a = $nextSearchItemElement.getAttribute('data-search-item-id')) !== null && _a !== void 0 ? _a : '-1';
|
|
110
|
+
};
|
|
111
|
+
this._handleBackwardListFocus = () => {
|
|
112
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
113
|
+
if (!$searchItemsContainer)
|
|
114
|
+
return;
|
|
115
|
+
const $listSearchItems = UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
116
|
+
const searchItemId = $el.getAttribute('data-search-item-id');
|
|
117
|
+
return !!searchItemId && !searchItemId.includes('grid');
|
|
118
|
+
});
|
|
119
|
+
this._handleBackwardFocus($listSearchItems);
|
|
120
|
+
};
|
|
121
|
+
this._handleBackwardGridFocus = () => {
|
|
122
|
+
const $searchItemsContainer = this._searchHistoryRef.value || this._searchResultsRef.value;
|
|
123
|
+
if (!$searchItemsContainer)
|
|
124
|
+
return;
|
|
125
|
+
const $gridSearchItems = UiDomUtils.getFocusableElements($searchItemsContainer).filter(($el) => {
|
|
126
|
+
return !!$el.getAttribute('data-search-item-id');
|
|
127
|
+
});
|
|
128
|
+
this._handleBackwardFocus($gridSearchItems);
|
|
129
|
+
};
|
|
130
|
+
this._handleBackwardFocus = ($searchItems) => {
|
|
131
|
+
var _a;
|
|
132
|
+
const $activeElement = document.activeElement;
|
|
133
|
+
const indexOfCurrentElement = $searchItems.indexOf($activeElement);
|
|
134
|
+
const indexOfPreviousElement = indexOfCurrentElement === 0 ? $searchItems.length - 1 : indexOfCurrentElement - 1;
|
|
135
|
+
const $previousSearchItemElement = $searchItems[indexOfPreviousElement];
|
|
136
|
+
$previousSearchItemElement.focus();
|
|
137
|
+
this._activeItemId = (_a = $previousSearchItemElement.getAttribute('data-search-item-id')) !== null && _a !== void 0 ? _a : '-1';
|
|
77
138
|
};
|
|
78
139
|
this._hideSuggesterOnClickOutside = (ev) => {
|
|
79
140
|
const outsideClick = typeof ev.composedPath === 'function' && !ev.composedPath().includes(this);
|
|
@@ -95,10 +156,21 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
95
156
|
try {
|
|
96
157
|
this._searchContextConsumer = new ContextConsumerController(this);
|
|
97
158
|
this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
|
|
159
|
+
const ariaTranslations = {
|
|
160
|
+
historyGuideAriaLabel: this.settings.historyGuideAriaLabel,
|
|
161
|
+
suggesterGuideAriaLabel: this.settings.suggesterGuideAriaLabel,
|
|
162
|
+
historyItemAriaLabel: this.settings.historyItemAriaLabel,
|
|
163
|
+
suggesterItemAriaLabel: this.settings.suggesterItemAriaLabel,
|
|
164
|
+
suggesterProductItemAriaLabel: this.settings.suggesterProductItemAriaLabel,
|
|
165
|
+
suggesterProducerItemAriaLabel: this.settings.suggesterProducerItemAriaLabel
|
|
166
|
+
};
|
|
98
167
|
this._searchContextObserver = new Observer((searchData) => {
|
|
99
168
|
this._searchResults = searchData.results;
|
|
100
169
|
this._searchHistory = searchData.history;
|
|
101
|
-
this._translations =
|
|
170
|
+
this._translations = {
|
|
171
|
+
...searchData.translations,
|
|
172
|
+
...ariaTranslations
|
|
173
|
+
};
|
|
102
174
|
this._searchPhrase = searchData.searchPhrase;
|
|
103
175
|
this._historyContext.notify({ showLoadMore: this._searchHistory.length > SEARCH_CONFIGURATION.historyContentLimit });
|
|
104
176
|
this._historyLimitedContent = this._searchHistory.slice(0, SEARCH_CONFIGURATION.historyContentLimit);
|
|
@@ -149,6 +221,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
149
221
|
const shouldShowMessage = ev.detail.searchPhrase !== '';
|
|
150
222
|
this._updateSearchView(ev.detail.searchPhrase, shouldShowMessage, false);
|
|
151
223
|
document.addEventListener('keyup', this._bindKeys);
|
|
224
|
+
document.addEventListener('keydown', this._preventScrollingOnSearchContentBrowsing);
|
|
152
225
|
});
|
|
153
226
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.keyup, (ev) => {
|
|
154
227
|
const shouldShowMessage = ev.detail.searchPhrase !== '';
|
|
@@ -159,7 +232,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
159
232
|
this._updateSearchView('', false);
|
|
160
233
|
});
|
|
161
234
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.submit, () => {
|
|
162
|
-
if (this._activeItemId !== -1)
|
|
235
|
+
if (this._activeItemId !== '-1')
|
|
163
236
|
return;
|
|
164
237
|
if (this._inputField.value === '') {
|
|
165
238
|
this._updateSearchView(this._inputField.value, true);
|
|
@@ -186,7 +259,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
186
259
|
}
|
|
187
260
|
_updateSearchView(searchPhrase, shouldShowMessage, shouldUpdateSearchPhrase = true) {
|
|
188
261
|
this._shouldShowMessage = shouldShowMessage;
|
|
189
|
-
this._activeItemId = -1;
|
|
262
|
+
this._activeItemId = '-1';
|
|
190
263
|
this._displaySuggester(searchPhrase);
|
|
191
264
|
if (!shouldUpdateSearchPhrase)
|
|
192
265
|
return;
|
|
@@ -204,36 +277,42 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
204
277
|
}
|
|
205
278
|
}
|
|
206
279
|
_displayHistorySuggestions() {
|
|
207
|
-
this.
|
|
208
|
-
|
|
280
|
+
this._handleToggleHistoryAndResults({
|
|
281
|
+
shouldShowHistory: true,
|
|
282
|
+
shouldShowResults: false
|
|
283
|
+
});
|
|
209
284
|
}
|
|
210
285
|
_hideHistorySuggestionsAndResults() {
|
|
211
|
-
this.
|
|
212
|
-
|
|
286
|
+
this._handleToggleHistoryAndResults({
|
|
287
|
+
shouldShowHistory: false,
|
|
288
|
+
shouldShowResults: false
|
|
289
|
+
});
|
|
213
290
|
}
|
|
214
291
|
_displayResults() {
|
|
215
|
-
this.
|
|
216
|
-
|
|
292
|
+
this._handleToggleHistoryAndResults({
|
|
293
|
+
shouldShowHistory: false,
|
|
294
|
+
shouldShowResults: true
|
|
295
|
+
});
|
|
217
296
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
top = maxScrollTop;
|
|
232
|
-
}
|
|
233
|
-
if (this._activeItemId === 0) {
|
|
234
|
-
top = 0;
|
|
297
|
+
_handleToggleHistoryAndResults({ shouldShowHistory, shouldShowResults }) {
|
|
298
|
+
this._shouldShowHistory = shouldShowHistory;
|
|
299
|
+
this._shouldShowResults = shouldShowResults;
|
|
300
|
+
this._toggleSearchInputAria(shouldShowHistory, shouldShowResults);
|
|
301
|
+
}
|
|
302
|
+
_toggleSearchInputAria(shouldShowHistory, shouldShowResults) {
|
|
303
|
+
var _a;
|
|
304
|
+
const $input = (_a = this._searchInput) === null || _a === void 0 ? void 0 : _a.input;
|
|
305
|
+
if (!$input)
|
|
306
|
+
return;
|
|
307
|
+
if (!shouldShowHistory && !shouldShowResults) {
|
|
308
|
+
$input.removeAttribute('aria-label');
|
|
309
|
+
return;
|
|
235
310
|
}
|
|
236
|
-
|
|
311
|
+
$input.setAttribute('aria-expanded', 'true');
|
|
312
|
+
if (shouldShowHistory)
|
|
313
|
+
$input.setAttribute('aria-label', this.settings.historyGuideAriaLabel);
|
|
314
|
+
if (shouldShowResults)
|
|
315
|
+
$input.setAttribute('aria-label', this.settings.suggesterGuideAriaLabel);
|
|
237
316
|
}
|
|
238
317
|
_handleChooseSearchItem() {
|
|
239
318
|
const activeSearchItem = this.querySelector(`[data-search-item-id="${this._activeItemId}"]`);
|
|
@@ -244,7 +323,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
244
323
|
}
|
|
245
324
|
_resetSearchView() {
|
|
246
325
|
this._shouldShowMessage = false;
|
|
247
|
-
this._activeItemId = -1;
|
|
326
|
+
this._activeItemId = '-1';
|
|
248
327
|
const searchBar = this.querySelector(`.${SEARCH_CLASS_NAMES.searchBar}`);
|
|
249
328
|
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(SEARCH_CLASS_NAMES.outline);
|
|
250
329
|
this._hideHistorySuggestionsAndResults();
|
|
@@ -292,12 +371,14 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
292
371
|
module-instance-id="${this.moduleInstanceId}"
|
|
293
372
|
></h-search-message>`)}
|
|
294
373
|
${n(this._shouldShowHistory, () => html `<h-search-history
|
|
374
|
+
${ref(this._searchHistoryRef)}
|
|
295
375
|
.history="${this._historyLimitedContent}"
|
|
296
376
|
.translations="${this._translations}"
|
|
297
377
|
active-item-id="${this._activeItemId}"
|
|
298
378
|
module-instance-id="${this.moduleInstanceId}"
|
|
299
379
|
></h-search-history>`)}
|
|
300
380
|
${n(this._shouldShowResults, () => html `<h-search-results
|
|
381
|
+
${ref(this._searchResultsRef)}
|
|
301
382
|
.results="${this._searchResults}"
|
|
302
383
|
search-phrase="${this._searchPhrase}"
|
|
303
384
|
.settings="${this.settings}"
|
|
@@ -361,7 +442,7 @@ __decorate([
|
|
|
361
442
|
], HSearch.prototype, "_historyContext", void 0);
|
|
362
443
|
__decorate([
|
|
363
444
|
state(),
|
|
364
|
-
__metadata("design:type",
|
|
445
|
+
__metadata("design:type", String)
|
|
365
446
|
], HSearch.prototype, "_activeItemId", void 0);
|
|
366
447
|
__decorate([
|
|
367
448
|
state(),
|
|
@@ -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,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;"}
|
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -24,7 +24,7 @@ export declare const SEARCH_CUSTOM_EVENT_NAMES: {
|
|
|
24
24
|
readonly clear: "clearSearchPhrase";
|
|
25
25
|
readonly submit: "submitSearchPhrase";
|
|
26
26
|
readonly close: "close";
|
|
27
|
-
readonly search: "
|
|
27
|
+
readonly search: "performSearch";
|
|
28
28
|
readonly updateSearchPhrase: "updateSearchPhrase";
|
|
29
29
|
readonly focusin: "searchFocusIn";
|
|
30
30
|
readonly keyup: "searchKeyUp";
|
|
@@ -23,7 +23,7 @@ const SEARCH_CUSTOM_EVENT_NAMES = {
|
|
|
23
23
|
clear: 'clearSearchPhrase',
|
|
24
24
|
submit: 'submitSearchPhrase',
|
|
25
25
|
close: 'close',
|
|
26
|
-
search: '
|
|
26
|
+
search: 'performSearch',
|
|
27
27
|
updateSearchPhrase: 'updateSearchPhrase',
|
|
28
28
|
focusin: 'searchFocusIn',
|
|
29
29
|
keyup: 'searchKeyUp'
|
|
@@ -68,6 +68,12 @@ export declare type TSearchSettings = {
|
|
|
68
68
|
showProductRate: boolean;
|
|
69
69
|
showProductAvailability: boolean;
|
|
70
70
|
showProductPrice: boolean;
|
|
71
|
+
historyGuideAriaLabel: string;
|
|
72
|
+
suggesterGuideAriaLabel: string;
|
|
73
|
+
historyItemAriaLabel: string;
|
|
74
|
+
suggesterItemAriaLabel: string;
|
|
75
|
+
suggesterProductItemAriaLabel: string;
|
|
76
|
+
suggesterProducerItemAriaLabel: string;
|
|
71
77
|
};
|
|
72
78
|
export declare type TScrollDirection = TEnumLiteralsOf<typeof SCROLL_DIRECTIONS>;
|
|
73
79
|
export declare type TSuggestionType = TEnumLiteralsOf<typeof SUGGESTIONS_TYPE>;
|
|
@@ -77,3 +83,7 @@ export declare type TSuggestion = {
|
|
|
77
83
|
categoryName?: string;
|
|
78
84
|
url?: string;
|
|
79
85
|
};
|
|
86
|
+
export declare type THandleToggleHistoryAndResults = {
|
|
87
|
+
shouldShowHistory: boolean;
|
|
88
|
+
shouldShowResults: boolean;
|
|
89
|
+
};
|
|
@@ -8,8 +8,9 @@ export declare class HSearchHistory extends PhoenixLightLitElement {
|
|
|
8
8
|
private _historyContext$;
|
|
9
9
|
private _historyContextObserver;
|
|
10
10
|
buttonRef: Ref<HSearchHistoryLoadMore>;
|
|
11
|
+
private _loadMoreButtonId;
|
|
11
12
|
history: TSearchHistoryItem[];
|
|
12
|
-
activeItemId:
|
|
13
|
+
activeItemId: string;
|
|
13
14
|
translations: Record<string, string>;
|
|
14
15
|
moduleInstanceId: string;
|
|
15
16
|
connectedCallback(): Promise<void>;
|
|
@@ -7,6 +7,7 @@ import { ICONS_SIZES } from '../../../../icon/icon_constants.js';
|
|
|
7
7
|
import { Observer } from '../../../../../core/classes/observer/observer.js';
|
|
8
8
|
import { ContextConsumerController } from '../../../../../core/context/context_consumer_controller.js';
|
|
9
9
|
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
10
|
+
import v4 from '../../../../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
10
11
|
import { when as n } from '../../../../../../../../external/lit/external/lit-html/directives/when.js';
|
|
11
12
|
import { SEARCH_CONTEXT_NAMES, SEARCH_CLASS_NAMES, SEARCH_COMPONENT_NAMES } from '../../search_constants.js';
|
|
12
13
|
import { repeat as c } from '../../../../../../../../external/lit/external/lit-html/directives/repeat.js';
|
|
@@ -15,6 +16,7 @@ let HSearchHistory = class HSearchHistory extends PhoenixLightLitElement {
|
|
|
15
16
|
constructor() {
|
|
16
17
|
super(...arguments);
|
|
17
18
|
this.buttonRef = createRef();
|
|
19
|
+
this._loadMoreButtonId = v4();
|
|
18
20
|
this.history = [];
|
|
19
21
|
this.translations = {};
|
|
20
22
|
}
|
|
@@ -42,7 +44,7 @@ let HSearchHistory = class HSearchHistory extends PhoenixLightLitElement {
|
|
|
42
44
|
|
|
43
45
|
<ul>
|
|
44
46
|
${c(this.history, (historyElement, index) => html ` <li
|
|
45
|
-
class="${SEARCH_CLASS_NAMES.item} ${index === this.activeItemId ? SEARCH_CLASS_NAMES.itemActive : ''}"
|
|
47
|
+
class="${SEARCH_CLASS_NAMES.item} ${String(index) === this.activeItemId ? SEARCH_CLASS_NAMES.itemActive : ''}"
|
|
46
48
|
>
|
|
47
49
|
<h-search-history-select
|
|
48
50
|
item-label="${historyElement.label}"
|
|
@@ -50,13 +52,14 @@ let HSearchHistory = class HSearchHistory extends PhoenixLightLitElement {
|
|
|
50
52
|
data-suggested-value="${historyElement.label}"
|
|
51
53
|
data-search-item-id="${index}"
|
|
52
54
|
module-instance-id="${this.moduleInstanceId}"
|
|
55
|
+
aria-label=${this.translations.historyAriaLabel ? `${this.translations.historyAriaLabel} ${historyElement.label}` : undefined}
|
|
53
56
|
>
|
|
54
57
|
<h-icon icon-name="icon-clock"></h-icon>
|
|
55
58
|
|
|
56
59
|
<span class="${SEARCH_CLASS_NAMES.historyItemValue}">${historyElement.label}</span>
|
|
57
60
|
</h-search-history-select>
|
|
58
61
|
|
|
59
|
-
<h-search-history-remove item-id="${historyElement.id}">
|
|
62
|
+
<h-search-history-remove data-search-item-id="${index}-grid" item-id="${historyElement.id}">
|
|
60
63
|
<h-icon
|
|
61
64
|
icon-name="icon-x"
|
|
62
65
|
clickable=${true}
|
|
@@ -67,7 +70,11 @@ let HSearchHistory = class HSearchHistory extends PhoenixLightLitElement {
|
|
|
67
70
|
</li>`)}
|
|
68
71
|
</ul>
|
|
69
72
|
|
|
70
|
-
<h-search-history-load-more
|
|
73
|
+
<h-search-history-load-more
|
|
74
|
+
class="${SEARCH_CLASS_NAMES.historyLoadMore}"
|
|
75
|
+
data-search-item-id="${this._loadMoreButtonId}"
|
|
76
|
+
${ref(this.buttonRef)}
|
|
77
|
+
>
|
|
71
78
|
${this.translations.loadMore}
|
|
72
79
|
</h-search-history-load-more>`);
|
|
73
80
|
}
|
|
@@ -77,8 +84,8 @@ __decorate([
|
|
|
77
84
|
__metadata("design:type", Array)
|
|
78
85
|
], HSearchHistory.prototype, "history", void 0);
|
|
79
86
|
__decorate([
|
|
80
|
-
property({ type:
|
|
81
|
-
__metadata("design:type",
|
|
87
|
+
property({ type: String, attribute: 'active-item-id' }),
|
|
88
|
+
__metadata("design:type", String)
|
|
82
89
|
], HSearchHistory.prototype, "activeItemId", void 0);
|
|
83
90
|
__decorate([
|
|
84
91
|
property({ type: Object }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2EAAmF;AAC7G;AACA,4BAA4B,6EAAqF;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA,eAAe,8DAAkE;AACjF,0BAA0B,2EAAmF;AAC7G;AACA,4BAA4B,6EAAqF;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PhoenixLightLitElement } from "../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
2
|
export declare class HSearchInput extends PhoenixLightLitElement {
|
|
3
|
-
|
|
3
|
+
input: HTMLInputElement | null;
|
|
4
4
|
moduleInstanceId: string;
|
|
5
5
|
private _isSearchPhraseCleared;
|
|
6
6
|
connectedCallback(): void;
|