@shoper/phoenix_design_system 1.18.27-16 → 1.18.27-17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/form/search/search.js +10 -70
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +22 -51
- 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/select/select.js +30 -12
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +0 -6
- package/build/esm/packages/phoenix/src/components/form/search/search.js +10 -70
- package/build/esm/packages/phoenix/src/components/form/search/search.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 +22 -51
- 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/select/select.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/select.js +30 -12
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/package.json +1 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -44
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +0 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +0 -66
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +0 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +0 -14
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +0 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +0 -10
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +0 -13
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -40
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.d.ts +0 -6
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js +0 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.d.ts +0 -14
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +0 -62
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +0 -8
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +0 -2
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +0 -6
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +0 -10
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +0 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +0 -2
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +0 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +0 -6
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +0 -1
|
@@ -20,8 +20,6 @@ var modal_constants = require('../../modal/modal_constants.js');
|
|
|
20
20
|
var sheet_constants = require('../../sheet/sheet_constants.js');
|
|
21
21
|
var when = require('../../../../../../external/lit-html/directives/when.js');
|
|
22
22
|
var search_constants = require('./search_constants.js');
|
|
23
|
-
var focus_trap_strategy_constants = require('../../../controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js');
|
|
24
|
-
var focus_trap_controller = require('../../../controllers/focus_trap_controller/focus_trap_controller.js');
|
|
25
23
|
|
|
26
24
|
exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
27
25
|
constructor() {
|
|
@@ -29,17 +27,11 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
29
27
|
this.view = search_constants.DEFAULT_VIEW;
|
|
30
28
|
this.isSearchIconFixEnabled = false;
|
|
31
29
|
this.isSearchUxFixesFlagEnabled = false;
|
|
32
|
-
this.isSearchFocusTrapFixEnabled = false;
|
|
33
30
|
this.displayMode = 'dropdown';
|
|
34
31
|
this._togglerElement = null;
|
|
35
|
-
this._mobileDialogOpener = null;
|
|
36
32
|
this._id = v4['default']();
|
|
37
33
|
this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
|
|
38
34
|
this._searchContentContainerId = v4['default']();
|
|
39
|
-
this.mobileFocusTrapController = new focus_trap_controller.FocusTrapController(this, {
|
|
40
|
-
mode: focus_trap_strategy_constants.FOCUS_TRAP_STRATEGY_TYPES.cyclic,
|
|
41
|
-
getContainer: () => this
|
|
42
|
-
});
|
|
43
35
|
this._searchResultsRef = ref_js.createRef();
|
|
44
36
|
this._searchHistoryRef = ref_js.createRef();
|
|
45
37
|
this._searchMessageRef = ref_js.createRef();
|
|
@@ -335,8 +327,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
335
327
|
if (window.innerWidth > global_constants.BREAKPOINTS.sm) {
|
|
336
328
|
const hasBeenOpened = this.classList.contains(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
|
|
337
329
|
this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
|
|
338
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
339
|
-
this._deactivateMobileDialog();
|
|
340
330
|
if (hasBeenOpened && this.displayMode !== 'dropdown') {
|
|
341
331
|
const $storefrontSearch = document.querySelector(`h-storefront-search[module-instance-id="${this.moduleInstanceId}"]`);
|
|
342
332
|
const searchOverlayTriggerName = (_a = $storefrontSearch === null || $storefrontSearch === void 0 ? void 0 : $storefrontSearch.querySelector('[aria-haspopup="dialog"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('name');
|
|
@@ -352,8 +342,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
352
342
|
};
|
|
353
343
|
this._openMobileView = () => {
|
|
354
344
|
this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
|
|
355
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
356
|
-
this._activateMobileDialog();
|
|
357
345
|
};
|
|
358
346
|
this._isSuggesterLayerVisible = () => {
|
|
359
347
|
var _a;
|
|
@@ -374,17 +362,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
374
362
|
document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
|
|
375
363
|
}
|
|
376
364
|
};
|
|
377
|
-
this._activateMobileDialog = () => {
|
|
378
|
-
this._mobileDialogOpener = document.activeElement;
|
|
379
|
-
this.setAttribute('role', 'dialog');
|
|
380
|
-
this.setAttribute('aria-modal', 'true');
|
|
381
|
-
this.mobileFocusTrapController.activate();
|
|
382
|
-
};
|
|
383
|
-
this._deactivateMobileDialog = () => {
|
|
384
|
-
this.removeAttribute('role');
|
|
385
|
-
this.removeAttribute('aria-modal');
|
|
386
|
-
this.mobileFocusTrapController.deactivate();
|
|
387
|
-
};
|
|
388
365
|
this._setupAriaAttributes = () => {
|
|
389
366
|
var _a;
|
|
390
367
|
if (this._translations.openSearchButtonAriaLabel) {
|
|
@@ -393,8 +370,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
393
370
|
};
|
|
394
371
|
this._handleOpenSearch = () => {
|
|
395
372
|
this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
|
|
396
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
397
|
-
this._activateMobileDialog();
|
|
398
373
|
const shouldShowMessage = this._searchPhrase !== '';
|
|
399
374
|
this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
|
|
400
375
|
const $searchInput = this.querySelector(`
|
|
@@ -403,8 +378,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
403
378
|
$searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
|
|
404
379
|
};
|
|
405
380
|
this._handleOpenSearchWithKeyboard = (ev) => {
|
|
406
|
-
|
|
407
|
-
if (ev.code !== 'Enter' || isRepeated)
|
|
381
|
+
if (ev.code !== 'Enter')
|
|
408
382
|
return;
|
|
409
383
|
ev.preventDefault();
|
|
410
384
|
this._handleOpenSearch();
|
|
@@ -413,12 +387,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
413
387
|
async connectedCallback() {
|
|
414
388
|
super.connectedCallback();
|
|
415
389
|
this._setupContext();
|
|
416
|
-
this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
|
|
417
|
-
if (this.isSearchFocusTrapFixEnabled) {
|
|
418
|
-
this._setupInitialSearchPhrase();
|
|
419
|
-
this._setupListeners();
|
|
420
|
-
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
421
|
-
}
|
|
422
390
|
try {
|
|
423
391
|
this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
|
|
424
392
|
this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
|
|
@@ -447,12 +415,10 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
447
415
|
catch (_a) {
|
|
448
416
|
console.error('Search context is not provided');
|
|
449
417
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
455
|
-
}
|
|
418
|
+
this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
|
|
419
|
+
this._setupInitialSearchPhrase();
|
|
420
|
+
this._setupListeners();
|
|
421
|
+
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
456
422
|
}
|
|
457
423
|
disconnectedCallback() {
|
|
458
424
|
var _a;
|
|
@@ -524,12 +490,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
524
490
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
|
|
525
491
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.close, () => {
|
|
526
492
|
this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
|
|
527
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
528
|
-
this._deactivateMobileDialog();
|
|
529
493
|
this._resetSearchView();
|
|
530
494
|
this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
|
|
531
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
532
|
-
requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
533
495
|
});
|
|
534
496
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
|
|
535
497
|
const contentLength = this._searchHistory.length;
|
|
@@ -636,15 +598,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
636
598
|
this._setActiveItemId(`${this._id}-1`);
|
|
637
599
|
const searchBar = this.querySelector(`.${search_constants.SEARCH_CLASS_NAMES.searchBar}`);
|
|
638
600
|
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(search_constants.SEARCH_CLASS_NAMES.outline);
|
|
639
|
-
if (this.displayMode === 'dropdown')
|
|
640
|
-
|
|
641
|
-
if (isMobileViewOpen) {
|
|
642
|
-
this._displaySuggester(this._searchPhrase);
|
|
643
|
-
}
|
|
644
|
-
else {
|
|
645
|
-
this._hideHistorySuggestionsAndResults();
|
|
646
|
-
}
|
|
647
|
-
}
|
|
601
|
+
if (this.displayMode === 'dropdown')
|
|
602
|
+
this._hideHistorySuggestionsAndResults();
|
|
648
603
|
!this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
|
|
649
604
|
}
|
|
650
605
|
_submitSearchPhrase(searchPhrase) {
|
|
@@ -655,23 +610,13 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
655
610
|
if (!this._togglerElement)
|
|
656
611
|
return;
|
|
657
612
|
this._togglerElement.addEventListener('click', this._handleOpenSearch);
|
|
658
|
-
|
|
659
|
-
this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
660
|
-
}
|
|
661
|
-
else {
|
|
662
|
-
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
663
|
-
}
|
|
613
|
+
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
664
614
|
}
|
|
665
615
|
_teardownToggler() {
|
|
666
616
|
if (!this._togglerElement)
|
|
667
617
|
return;
|
|
668
618
|
this._togglerElement.removeEventListener('click', this._handleOpenSearch);
|
|
669
|
-
|
|
670
|
-
this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
674
|
-
}
|
|
619
|
+
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
675
620
|
}
|
|
676
621
|
render() {
|
|
677
622
|
super.render();
|
|
@@ -681,8 +626,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
681
626
|
tabindex="0"
|
|
682
627
|
aria-haspopup="dialog"
|
|
683
628
|
@click=${this._handleOpenSearch}
|
|
684
|
-
@keyup=${this.
|
|
685
|
-
@keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
|
|
629
|
+
@keyup=${this._handleOpenSearchWithKeyboard}
|
|
686
630
|
>
|
|
687
631
|
${when.when(this._translations.openSearchButtonAriaLabel, () => lit.html `
|
|
688
632
|
<span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
|
|
@@ -752,10 +696,6 @@ tslib_es6.__decorate([
|
|
|
752
696
|
decorators.property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
|
|
753
697
|
tslib_es6.__metadata("design:type", Boolean)
|
|
754
698
|
], exports.HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
|
|
755
|
-
tslib_es6.__decorate([
|
|
756
|
-
decorators.property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
|
|
757
|
-
tslib_es6.__metadata("design:type", Boolean)
|
|
758
|
-
], exports.HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
|
|
759
699
|
tslib_es6.__decorate([
|
|
760
700
|
decorators.property({ type: String, attribute: 'display-mode' }),
|
|
761
701
|
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,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAA4D;AAC7E;AACA;AACA,mBAAmB,wDAA4D;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,iBAAiB,wDAA4D;AAC7E;AACA;AACA,mBAAmB,wDAA4D;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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
|
@@ -13,7 +13,6 @@ var search_constants = require('../../search_constants.js');
|
|
|
13
13
|
exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
|
-
this.isSearchFocusTrapFixEnabled = false;
|
|
17
16
|
this._isSearchPhraseCleared = false;
|
|
18
17
|
this._setupAttributes = () => {
|
|
19
18
|
var _a, _b, _c, _d;
|
|
@@ -73,60 +72,36 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
74
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (this._isSearchPhraseCleared) {
|
|
81
|
-
this._isSearchPhraseCleared = false;
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, {
|
|
85
|
-
detail: { searchPhrase: ev.target.value }
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
this.input.addEventListener('keyup', debounce['default']((ev) => {
|
|
89
|
-
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape' || ev.key === 'Enter')
|
|
90
|
-
return;
|
|
75
|
+
this.input.addEventListener('keyup', (ev) => {
|
|
76
|
+
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
|
|
77
|
+
return;
|
|
78
|
+
if (ev.key !== 'Enter') {
|
|
91
79
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
92
80
|
detail: {
|
|
93
81
|
searchPhrase: ev.target.value
|
|
94
82
|
}
|
|
95
83
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
searchPhrase: ev.target.value
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
return;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (this._isSearchPhraseCleared) {
|
|
87
|
+
this._isSearchPhraseCleared = false;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, {
|
|
91
|
+
detail: {
|
|
92
|
+
searchPhrase: ev.target.value
|
|
109
93
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
this.input.addEventListener('keyup', debounce['default']((ev) => {
|
|
97
|
+
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape' || ev.key === 'Enter')
|
|
98
|
+
return;
|
|
99
|
+
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
100
|
+
detail: {
|
|
101
|
+
searchPhrase: ev.target.value
|
|
113
102
|
}
|
|
114
|
-
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, {
|
|
115
|
-
detail: {
|
|
116
|
-
searchPhrase: ev.target.value
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
103
|
});
|
|
120
|
-
|
|
121
|
-
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape' || ev.key === 'Enter')
|
|
122
|
-
return;
|
|
123
|
-
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
124
|
-
detail: {
|
|
125
|
-
searchPhrase: ev.target.value
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}, 200));
|
|
129
|
-
}
|
|
104
|
+
}, 200));
|
|
130
105
|
this.input.addEventListener('search', (ev) => {
|
|
131
106
|
if (this.input.value !== '') {
|
|
132
107
|
return;
|
|
@@ -160,10 +135,6 @@ tslib_es6.__decorate([
|
|
|
160
135
|
decorators.property({ type: String, attribute: 'module-instance-id' }),
|
|
161
136
|
tslib_es6.__metadata("design:type", String)
|
|
162
137
|
], exports.HSearchInput.prototype, "moduleInstanceId", void 0);
|
|
163
|
-
tslib_es6.__decorate([
|
|
164
|
-
decorators.property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
|
|
165
|
-
tslib_es6.__metadata("design:type", Boolean)
|
|
166
|
-
], exports.HSearchInput.prototype, "isSearchFocusTrapFixEnabled", void 0);
|
|
167
138
|
tslib_es6.__decorate([
|
|
168
139
|
decorators.state(),
|
|
169
140
|
tslib_es6.__metadata("design:type", Boolean)
|
|
@@ -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,uBAAuB,qDAAyD;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,uBAAuB,qDAAyD;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -43,6 +43,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
43
43
|
this.noDeselect = false;
|
|
44
44
|
this.assistiveTitleId = '';
|
|
45
45
|
this.noPlaceholderOption = false;
|
|
46
|
+
this.devCachedSelectOptions = false;
|
|
46
47
|
this.translations = {};
|
|
47
48
|
this._selectOptionsId = v4['default']();
|
|
48
49
|
this._searchValue = '';
|
|
@@ -72,9 +73,19 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
72
73
|
this._getOptions = () => {
|
|
73
74
|
let $options;
|
|
74
75
|
if (this.optionsList) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (this.devCachedSelectOptions) {
|
|
77
|
+
$options = [...this.optionsList].map((option) => select_utils.SelectControlUtils.createHTMLOption(select_option.SelectOption.create(option)));
|
|
78
|
+
if (!this.required && !this.multiple) {
|
|
79
|
+
const $domPlaceholder = this.querySelector('h-option[placeholder]');
|
|
80
|
+
if ($domPlaceholder)
|
|
81
|
+
$options.unshift($domPlaceholder);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
$options = this.optionsList.map((option) => {
|
|
86
|
+
return select_utils.SelectControlUtils.createHTMLOption(select_option.SelectOption.create(option));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
78
89
|
}
|
|
79
90
|
else {
|
|
80
91
|
$options = this.hasSlot(select_constants.SELECT_SLOT_NAMES.content)
|
|
@@ -240,16 +251,19 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
240
251
|
});
|
|
241
252
|
}
|
|
242
253
|
}
|
|
243
|
-
_focusElementAfterSelectOpened() {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
254
|
+
async _focusElementAfterSelectOpened() {
|
|
255
|
+
await this.updateComplete;
|
|
256
|
+
requestAnimationFrame(() => {
|
|
257
|
+
var _a;
|
|
258
|
+
const $searchInput = (_a = this.$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
|
|
259
|
+
const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
|
|
260
|
+
const $firstOption = $options.find(($option) => {
|
|
261
|
+
return !$option.hasAttribute('inactive') && !$option.hasAttribute('disabled') && !$option.hasAttribute('hidden');
|
|
262
|
+
});
|
|
263
|
+
const $selectedOption = this.selectedOptions[0];
|
|
264
|
+
const $optionToFocus = $selectedOption || $firstOption;
|
|
265
|
+
$searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
|
|
249
266
|
});
|
|
250
|
-
const $selectedOption = this.selectedOptions[0];
|
|
251
|
-
const $optionToFocus = $selectedOption || $firstOption;
|
|
252
|
-
$searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
|
|
253
267
|
}
|
|
254
268
|
connectedCallback() {
|
|
255
269
|
var _a, _b;
|
|
@@ -618,6 +632,10 @@ tslib_es6.__decorate([
|
|
|
618
632
|
decorators_js.property({ type: Boolean, attribute: 'no-placeholder-option' }),
|
|
619
633
|
tslib_es6.__metadata("design:type", Boolean)
|
|
620
634
|
], exports.HSelect.prototype, "noPlaceholderOption", void 0);
|
|
635
|
+
tslib_es6.__decorate([
|
|
636
|
+
decorators_js.property({ type: Boolean, attribute: 'dev_cached_select_options' }),
|
|
637
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
638
|
+
], exports.HSelect.prototype, "devCachedSelectOptions", void 0);
|
|
621
639
|
tslib_es6.__decorate([
|
|
622
640
|
decorators_js.property({
|
|
623
641
|
converter: {
|
|
@@ -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;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,14 +1,12 @@
|
|
|
1
1
|
import { TemplateResult } from 'lit';
|
|
2
2
|
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
3
|
import type { TSearchDisplayMode, TSearchSettings } from "./search_types";
|
|
4
|
-
import { FocusTrapController } from "../../../controllers/focus_trap_controller/focus_trap_controller";
|
|
5
4
|
export declare class HSearch extends PhoenixLightLitElement {
|
|
6
5
|
settings: TSearchSettings;
|
|
7
6
|
view: string;
|
|
8
7
|
locale: string;
|
|
9
8
|
isSearchIconFixEnabled: boolean;
|
|
10
9
|
isSearchUxFixesFlagEnabled: boolean;
|
|
11
|
-
isSearchFocusTrapFixEnabled: boolean;
|
|
12
10
|
displayMode: TSearchDisplayMode;
|
|
13
11
|
moduleInstanceId: string;
|
|
14
12
|
private _historyContextProvider;
|
|
@@ -19,11 +17,9 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
19
17
|
private _inputField;
|
|
20
18
|
private _searchForm;
|
|
21
19
|
private _togglerElement;
|
|
22
|
-
private _mobileDialogOpener;
|
|
23
20
|
private _id;
|
|
24
21
|
private _openSearchButtonAriaLabelId;
|
|
25
22
|
private _searchContentContainerId;
|
|
26
|
-
mobileFocusTrapController: FocusTrapController;
|
|
27
23
|
private _searchResultsRef;
|
|
28
24
|
private _searchHistoryRef;
|
|
29
25
|
private _searchMessageRef;
|
|
@@ -85,8 +81,6 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
85
81
|
private _isSuggesterLayerVisible;
|
|
86
82
|
private _preventSubmitOnSearchClear;
|
|
87
83
|
private _resetSearchOnFocusOutside;
|
|
88
|
-
private _activateMobileDialog;
|
|
89
|
-
private _deactivateMobileDialog;
|
|
90
84
|
private _setupAriaAttributes;
|
|
91
85
|
private _handleOpenSearch;
|
|
92
86
|
private _handleOpenSearchWithKeyboard;
|
|
@@ -16,8 +16,6 @@ import { MODAL_EVENTS } from '../../modal/modal_constants.js';
|
|
|
16
16
|
import { SHEET_EVENTS } from '../../sheet/sheet_constants.js';
|
|
17
17
|
import { when as n } from '../../../../../../external/lit-html/directives/when.js';
|
|
18
18
|
import { DEFAULT_VIEW, SEARCH_CLASS_NAMES, SEARCH_COMPONENT_NAMES, SEARCH_CONFIGURATION, SEARCH_CONTEXT_NAMES, SEARCH_CUSTOM_EVENT_NAMES } from './search_constants.js';
|
|
19
|
-
import { FOCUS_TRAP_STRATEGY_TYPES } from '../../../controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js';
|
|
20
|
-
import { FocusTrapController } from '../../../controllers/focus_trap_controller/focus_trap_controller.js';
|
|
21
19
|
|
|
22
20
|
let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
23
21
|
constructor() {
|
|
@@ -25,17 +23,11 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
25
23
|
this.view = DEFAULT_VIEW;
|
|
26
24
|
this.isSearchIconFixEnabled = false;
|
|
27
25
|
this.isSearchUxFixesFlagEnabled = false;
|
|
28
|
-
this.isSearchFocusTrapFixEnabled = false;
|
|
29
26
|
this.displayMode = 'dropdown';
|
|
30
27
|
this._togglerElement = null;
|
|
31
|
-
this._mobileDialogOpener = null;
|
|
32
28
|
this._id = v4();
|
|
33
29
|
this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
|
|
34
30
|
this._searchContentContainerId = v4();
|
|
35
|
-
this.mobileFocusTrapController = new FocusTrapController(this, {
|
|
36
|
-
mode: FOCUS_TRAP_STRATEGY_TYPES.cyclic,
|
|
37
|
-
getContainer: () => this
|
|
38
|
-
});
|
|
39
31
|
this._searchResultsRef = createRef();
|
|
40
32
|
this._searchHistoryRef = createRef();
|
|
41
33
|
this._searchMessageRef = createRef();
|
|
@@ -331,8 +323,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
331
323
|
if (window.innerWidth > BREAKPOINTS.sm) {
|
|
332
324
|
const hasBeenOpened = this.classList.contains(SEARCH_CLASS_NAMES.mobileOpened);
|
|
333
325
|
this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened);
|
|
334
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
335
|
-
this._deactivateMobileDialog();
|
|
336
326
|
if (hasBeenOpened && this.displayMode !== 'dropdown') {
|
|
337
327
|
const $storefrontSearch = document.querySelector(`h-storefront-search[module-instance-id="${this.moduleInstanceId}"]`);
|
|
338
328
|
const searchOverlayTriggerName = (_a = $storefrontSearch === null || $storefrontSearch === void 0 ? void 0 : $storefrontSearch.querySelector('[aria-haspopup="dialog"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('name');
|
|
@@ -348,8 +338,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
348
338
|
};
|
|
349
339
|
this._openMobileView = () => {
|
|
350
340
|
this.classList.add(SEARCH_CLASS_NAMES.mobileOpened);
|
|
351
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
352
|
-
this._activateMobileDialog();
|
|
353
341
|
};
|
|
354
342
|
this._isSuggesterLayerVisible = () => {
|
|
355
343
|
var _a;
|
|
@@ -370,17 +358,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
370
358
|
document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
|
|
371
359
|
}
|
|
372
360
|
};
|
|
373
|
-
this._activateMobileDialog = () => {
|
|
374
|
-
this._mobileDialogOpener = document.activeElement;
|
|
375
|
-
this.setAttribute('role', 'dialog');
|
|
376
|
-
this.setAttribute('aria-modal', 'true');
|
|
377
|
-
this.mobileFocusTrapController.activate();
|
|
378
|
-
};
|
|
379
|
-
this._deactivateMobileDialog = () => {
|
|
380
|
-
this.removeAttribute('role');
|
|
381
|
-
this.removeAttribute('aria-modal');
|
|
382
|
-
this.mobileFocusTrapController.deactivate();
|
|
383
|
-
};
|
|
384
361
|
this._setupAriaAttributes = () => {
|
|
385
362
|
var _a;
|
|
386
363
|
if (this._translations.openSearchButtonAriaLabel) {
|
|
@@ -389,8 +366,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
389
366
|
};
|
|
390
367
|
this._handleOpenSearch = () => {
|
|
391
368
|
this.classList.add(SEARCH_CLASS_NAMES.mobileOpened);
|
|
392
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
393
|
-
this._activateMobileDialog();
|
|
394
369
|
const shouldShowMessage = this._searchPhrase !== '';
|
|
395
370
|
this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
|
|
396
371
|
const $searchInput = this.querySelector(`
|
|
@@ -399,8 +374,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
399
374
|
$searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
|
|
400
375
|
};
|
|
401
376
|
this._handleOpenSearchWithKeyboard = (ev) => {
|
|
402
|
-
|
|
403
|
-
if (ev.code !== 'Enter' || isRepeated)
|
|
377
|
+
if (ev.code !== 'Enter')
|
|
404
378
|
return;
|
|
405
379
|
ev.preventDefault();
|
|
406
380
|
this._handleOpenSearch();
|
|
@@ -409,12 +383,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
409
383
|
async connectedCallback() {
|
|
410
384
|
super.connectedCallback();
|
|
411
385
|
this._setupContext();
|
|
412
|
-
this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
|
|
413
|
-
if (this.isSearchFocusTrapFixEnabled) {
|
|
414
|
-
this._setupInitialSearchPhrase();
|
|
415
|
-
this._setupListeners();
|
|
416
|
-
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
417
|
-
}
|
|
418
386
|
try {
|
|
419
387
|
this._searchContextConsumer = new ContextConsumerController(this);
|
|
420
388
|
this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
|
|
@@ -443,12 +411,10 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
443
411
|
catch (_a) {
|
|
444
412
|
console.error('Search context is not provided');
|
|
445
413
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
451
|
-
}
|
|
414
|
+
this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
|
|
415
|
+
this._setupInitialSearchPhrase();
|
|
416
|
+
this._setupListeners();
|
|
417
|
+
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
452
418
|
}
|
|
453
419
|
disconnectedCallback() {
|
|
454
420
|
var _a;
|
|
@@ -520,12 +486,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
520
486
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
|
|
521
487
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.close, () => {
|
|
522
488
|
this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened);
|
|
523
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
524
|
-
this._deactivateMobileDialog();
|
|
525
489
|
this._resetSearchView();
|
|
526
490
|
this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
|
|
527
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
528
|
-
requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
529
491
|
});
|
|
530
492
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
|
|
531
493
|
const contentLength = this._searchHistory.length;
|
|
@@ -632,15 +594,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
632
594
|
this._setActiveItemId(`${this._id}-1`);
|
|
633
595
|
const searchBar = this.querySelector(`.${SEARCH_CLASS_NAMES.searchBar}`);
|
|
634
596
|
searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(SEARCH_CLASS_NAMES.outline);
|
|
635
|
-
if (this.displayMode === 'dropdown')
|
|
636
|
-
|
|
637
|
-
if (isMobileViewOpen) {
|
|
638
|
-
this._displaySuggester(this._searchPhrase);
|
|
639
|
-
}
|
|
640
|
-
else {
|
|
641
|
-
this._hideHistorySuggestionsAndResults();
|
|
642
|
-
}
|
|
643
|
-
}
|
|
597
|
+
if (this.displayMode === 'dropdown')
|
|
598
|
+
this._hideHistorySuggestionsAndResults();
|
|
644
599
|
!this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
|
|
645
600
|
}
|
|
646
601
|
_submitSearchPhrase(searchPhrase) {
|
|
@@ -651,23 +606,13 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
651
606
|
if (!this._togglerElement)
|
|
652
607
|
return;
|
|
653
608
|
this._togglerElement.addEventListener('click', this._handleOpenSearch);
|
|
654
|
-
|
|
655
|
-
this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
659
|
-
}
|
|
609
|
+
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
660
610
|
}
|
|
661
611
|
_teardownToggler() {
|
|
662
612
|
if (!this._togglerElement)
|
|
663
613
|
return;
|
|
664
614
|
this._togglerElement.removeEventListener('click', this._handleOpenSearch);
|
|
665
|
-
|
|
666
|
-
this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
667
|
-
}
|
|
668
|
-
else {
|
|
669
|
-
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
670
|
-
}
|
|
615
|
+
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
671
616
|
}
|
|
672
617
|
render() {
|
|
673
618
|
super.render();
|
|
@@ -677,8 +622,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
677
622
|
tabindex="0"
|
|
678
623
|
aria-haspopup="dialog"
|
|
679
624
|
@click=${this._handleOpenSearch}
|
|
680
|
-
@keyup=${this.
|
|
681
|
-
@keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
|
|
625
|
+
@keyup=${this._handleOpenSearchWithKeyboard}
|
|
682
626
|
>
|
|
683
627
|
${n(this._translations.openSearchButtonAriaLabel, () => html `
|
|
684
628
|
<span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
|
|
@@ -748,10 +692,6 @@ __decorate([
|
|
|
748
692
|
property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
|
|
749
693
|
__metadata("design:type", Boolean)
|
|
750
694
|
], HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
|
|
751
|
-
__decorate([
|
|
752
|
-
property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
|
|
753
|
-
__metadata("design:type", Boolean)
|
|
754
|
-
], HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
|
|
755
695
|
__decorate([
|
|
756
696
|
property({ type: String, attribute: 'display-mode' }),
|
|
757
697
|
__metadata("design:type", String)
|