@shoper/phoenix_design_system 1.18.24-8 → 1.18.24-9
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 +8 -53
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +8 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/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/search/subcomponents/results/search_results.js +2 -2
- 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 +8 -53
- package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +9 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/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/search/subcomponents/results/search_results.js +2 -2
- package/package.json +1 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -43
- 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 -39
- 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,10 +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
|
-
this._setupInitialSearchPhrase();
|
|
418
|
-
this._setupListeners();
|
|
419
|
-
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
420
390
|
try {
|
|
421
391
|
this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
|
|
422
392
|
this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
|
|
@@ -445,6 +415,10 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
445
415
|
catch (_a) {
|
|
446
416
|
console.error('Search context is not provided');
|
|
447
417
|
}
|
|
418
|
+
this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
|
|
419
|
+
this._setupInitialSearchPhrase();
|
|
420
|
+
this._setupListeners();
|
|
421
|
+
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
448
422
|
}
|
|
449
423
|
disconnectedCallback() {
|
|
450
424
|
var _a;
|
|
@@ -516,12 +490,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
516
490
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
|
|
517
491
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.close, () => {
|
|
518
492
|
this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
|
|
519
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
520
|
-
this._deactivateMobileDialog();
|
|
521
493
|
this._resetSearchView();
|
|
522
494
|
this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
|
|
523
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
524
|
-
requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
525
495
|
});
|
|
526
496
|
this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
|
|
527
497
|
const contentLength = this._searchHistory.length;
|
|
@@ -640,23 +610,13 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
640
610
|
if (!this._togglerElement)
|
|
641
611
|
return;
|
|
642
612
|
this._togglerElement.addEventListener('click', this._handleOpenSearch);
|
|
643
|
-
|
|
644
|
-
this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
645
|
-
}
|
|
646
|
-
else {
|
|
647
|
-
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
648
|
-
}
|
|
613
|
+
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
649
614
|
}
|
|
650
615
|
_teardownToggler() {
|
|
651
616
|
if (!this._togglerElement)
|
|
652
617
|
return;
|
|
653
618
|
this._togglerElement.removeEventListener('click', this._handleOpenSearch);
|
|
654
|
-
|
|
655
|
-
this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
659
|
-
}
|
|
619
|
+
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
660
620
|
}
|
|
661
621
|
render() {
|
|
662
622
|
super.render();
|
|
@@ -666,8 +626,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
666
626
|
tabindex="0"
|
|
667
627
|
aria-haspopup="dialog"
|
|
668
628
|
@click=${this._handleOpenSearch}
|
|
669
|
-
@keyup=${this.
|
|
670
|
-
@keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
|
|
629
|
+
@keyup=${this._handleOpenSearchWithKeyboard}
|
|
671
630
|
>
|
|
672
631
|
${when.when(this._translations.openSearchButtonAriaLabel, () => lit.html `
|
|
673
632
|
<span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
|
|
@@ -737,10 +696,6 @@ tslib_es6.__decorate([
|
|
|
737
696
|
decorators.property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
|
|
738
697
|
tslib_es6.__metadata("design:type", Boolean)
|
|
739
698
|
], exports.HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
|
|
740
|
-
tslib_es6.__decorate([
|
|
741
|
-
decorators.property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
|
|
742
|
-
tslib_es6.__metadata("design:type", Boolean)
|
|
743
|
-
], exports.HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
|
|
744
699
|
tslib_es6.__decorate([
|
|
745
700
|
decorators.property({ type: String, attribute: 'display-mode' }),
|
|
746
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/buttons/search_clear.js
CHANGED
|
@@ -19,7 +19,10 @@ exports.HSearchClear = class HSearchClear extends phoenix_light_lit_element.Phoe
|
|
|
19
19
|
this._shouldShow = false;
|
|
20
20
|
this._isRequestPending = false;
|
|
21
21
|
this._handleClearButtonOnPhraseEnter = (ev) => {
|
|
22
|
-
this.
|
|
22
|
+
this._updateClearButtonVisibility(ev.detail.searchPhrase);
|
|
23
|
+
};
|
|
24
|
+
this._updateClearButtonVisibility = (searchPhrase) => {
|
|
25
|
+
this._shouldShow = searchPhrase !== '';
|
|
23
26
|
};
|
|
24
27
|
this._dispatchClearEvent = () => {
|
|
25
28
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.clear, {
|
|
@@ -31,8 +34,12 @@ exports.HSearchClear = class HSearchClear extends phoenix_light_lit_element.Phoe
|
|
|
31
34
|
this._btnController = new btn_controller.BtnController(this, this._dispatchClearEvent);
|
|
32
35
|
}
|
|
33
36
|
connectedCallback() {
|
|
37
|
+
var _a;
|
|
34
38
|
super.connectedCallback();
|
|
35
39
|
this._searchContextSetup();
|
|
40
|
+
const $search = this.closest(search_constants.SEARCH_COMPONENT_NAMES.search);
|
|
41
|
+
const $searchInput = $search === null || $search === void 0 ? void 0 : $search.querySelector('input[type="search"]');
|
|
42
|
+
this._updateClearButtonVisibility((_a = $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.value) !== null && _a !== void 0 ? _a : '');
|
|
36
43
|
this.addEventListener('click', this._dispatchClearEvent);
|
|
37
44
|
document.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, this._handleClearButtonOnPhraseEnter);
|
|
38
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8DAAkE;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8DAAkE;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;"}
|
|
@@ -98,7 +98,7 @@ exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.
|
|
|
98
98
|
data-search-item-id="${this.searchId}${this._loadMoreButtonId}"
|
|
99
99
|
>
|
|
100
100
|
${this.translations.loadMore}
|
|
101
|
-
</button>`), () => lit.html `
|
|
101
|
+
</button>`), () => when.when(this._getSearchPhrase().length > 1, () => lit.html `
|
|
102
102
|
<button
|
|
103
103
|
class="${search_constants.SEARCH_CLASS_NAMES.productButton}"
|
|
104
104
|
@click="${this.handleGoToProductsFor}"
|
|
@@ -107,7 +107,7 @@ exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.
|
|
|
107
107
|
>
|
|
108
108
|
${this.translations.goToProductsFor}: <strong>${this._getSearchPhrase()}</strong>
|
|
109
109
|
</button>
|
|
110
|
-
`)}
|
|
110
|
+
`))}
|
|
111
111
|
</div>
|
|
112
112
|
`)}
|
|
113
113
|
${when.when((_d = this.results.producers) === null || _d === void 0 ? void 0 : _d.length, () => lit.html ` <h-search-producer-content
|
|
@@ -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,10 +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
|
-
this._setupInitialSearchPhrase();
|
|
414
|
-
this._setupListeners();
|
|
415
|
-
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
416
386
|
try {
|
|
417
387
|
this._searchContextConsumer = new ContextConsumerController(this);
|
|
418
388
|
this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
|
|
@@ -441,6 +411,10 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
441
411
|
catch (_a) {
|
|
442
412
|
console.error('Search context is not provided');
|
|
443
413
|
}
|
|
414
|
+
this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
|
|
415
|
+
this._setupInitialSearchPhrase();
|
|
416
|
+
this._setupListeners();
|
|
417
|
+
this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
|
|
444
418
|
}
|
|
445
419
|
disconnectedCallback() {
|
|
446
420
|
var _a;
|
|
@@ -512,12 +486,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
512
486
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
|
|
513
487
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.close, () => {
|
|
514
488
|
this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened);
|
|
515
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
516
|
-
this._deactivateMobileDialog();
|
|
517
489
|
this._resetSearchView();
|
|
518
490
|
this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
|
|
519
|
-
if (this.isSearchFocusTrapFixEnabled)
|
|
520
|
-
requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
521
491
|
});
|
|
522
492
|
this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
|
|
523
493
|
const contentLength = this._searchHistory.length;
|
|
@@ -636,23 +606,13 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
636
606
|
if (!this._togglerElement)
|
|
637
607
|
return;
|
|
638
608
|
this._togglerElement.addEventListener('click', this._handleOpenSearch);
|
|
639
|
-
|
|
640
|
-
this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
641
|
-
}
|
|
642
|
-
else {
|
|
643
|
-
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
644
|
-
}
|
|
609
|
+
this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
645
610
|
}
|
|
646
611
|
_teardownToggler() {
|
|
647
612
|
if (!this._togglerElement)
|
|
648
613
|
return;
|
|
649
614
|
this._togglerElement.removeEventListener('click', this._handleOpenSearch);
|
|
650
|
-
|
|
651
|
-
this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
655
|
-
}
|
|
615
|
+
this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
|
|
656
616
|
}
|
|
657
617
|
render() {
|
|
658
618
|
super.render();
|
|
@@ -662,8 +622,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
662
622
|
tabindex="0"
|
|
663
623
|
aria-haspopup="dialog"
|
|
664
624
|
@click=${this._handleOpenSearch}
|
|
665
|
-
@keyup=${this.
|
|
666
|
-
@keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
|
|
625
|
+
@keyup=${this._handleOpenSearchWithKeyboard}
|
|
667
626
|
>
|
|
668
627
|
${n(this._translations.openSearchButtonAriaLabel, () => html `
|
|
669
628
|
<span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
|
|
@@ -733,10 +692,6 @@ __decorate([
|
|
|
733
692
|
property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
|
|
734
693
|
__metadata("design:type", Boolean)
|
|
735
694
|
], HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
|
|
736
|
-
__decorate([
|
|
737
|
-
property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
|
|
738
|
-
__metadata("design:type", Boolean)
|
|
739
|
-
], HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
|
|
740
695
|
__decorate([
|
|
741
696
|
property({ type: String, attribute: 'display-mode' }),
|
|
742
697
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA,0BAA0B,wDAA4D;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA,0BAA0B,wDAA4D;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -11,6 +11,7 @@ export declare class HSearchClear extends PhoenixLightLitElement {
|
|
|
11
11
|
constructor();
|
|
12
12
|
connectedCallback(): void;
|
|
13
13
|
private _handleClearButtonOnPhraseEnter;
|
|
14
|
+
private _updateClearButtonVisibility;
|
|
14
15
|
protected updated(_changedProperties: PropertyValues): void;
|
|
15
16
|
private _dispatchClearEvent;
|
|
16
17
|
private _searchContextSetup;
|
package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js
CHANGED
|
@@ -7,7 +7,7 @@ import { BtnController } from '../../../../../controllers/btn_controller/btn_con
|
|
|
7
7
|
import { Observer } from '../../../../../core/classes/observer/observer.js';
|
|
8
8
|
import { ContextConsumerController } from '../../../../../core/context/context_consumer_controller.js';
|
|
9
9
|
import { when as n } from '../../../../../../../../external/lit-html/directives/when.js';
|
|
10
|
-
import { SEARCH_CUSTOM_EVENT_NAMES, SEARCH_CLASS_NAMES, SEARCH_SLOT_NAMES
|
|
10
|
+
import { SEARCH_CUSTOM_EVENT_NAMES, SEARCH_COMPONENT_NAMES, SEARCH_CLASS_NAMES, SEARCH_SLOT_NAMES } from '../../search_constants.js';
|
|
11
11
|
|
|
12
12
|
let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
|
|
13
13
|
constructor() {
|
|
@@ -15,7 +15,10 @@ let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
|
|
|
15
15
|
this._shouldShow = false;
|
|
16
16
|
this._isRequestPending = false;
|
|
17
17
|
this._handleClearButtonOnPhraseEnter = (ev) => {
|
|
18
|
-
this.
|
|
18
|
+
this._updateClearButtonVisibility(ev.detail.searchPhrase);
|
|
19
|
+
};
|
|
20
|
+
this._updateClearButtonVisibility = (searchPhrase) => {
|
|
21
|
+
this._shouldShow = searchPhrase !== '';
|
|
19
22
|
};
|
|
20
23
|
this._dispatchClearEvent = () => {
|
|
21
24
|
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.clear, {
|
|
@@ -27,8 +30,12 @@ let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
|
|
|
27
30
|
this._btnController = new BtnController(this, this._dispatchClearEvent);
|
|
28
31
|
}
|
|
29
32
|
connectedCallback() {
|
|
33
|
+
var _a;
|
|
30
34
|
super.connectedCallback();
|
|
31
35
|
this._searchContextSetup();
|
|
36
|
+
const $search = this.closest(SEARCH_COMPONENT_NAMES.search);
|
|
37
|
+
const $searchInput = $search === null || $search === void 0 ? void 0 : $search.querySelector('input[type="search"]');
|
|
38
|
+
this._updateClearButtonVisibility((_a = $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.value) !== null && _a !== void 0 ? _a : '');
|
|
32
39
|
this.addEventListener('click', this._dispatchClearEvent);
|
|
33
40
|
document.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.keyup, this._handleClearButtonOnPhraseEnter);
|
|
34
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,8DAAkE;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,8DAAkE;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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
|
@@ -3,7 +3,6 @@ import { PropertyValues } from 'lit';
|
|
|
3
3
|
export declare class HSearchInput extends PhoenixLightLitElement {
|
|
4
4
|
input: HTMLInputElement | null;
|
|
5
5
|
moduleInstanceId: string;
|
|
6
|
-
isSearchFocusTrapFixEnabled: boolean;
|
|
7
6
|
private _isSearchPhraseCleared;
|
|
8
7
|
connectedCallback(): void;
|
|
9
8
|
firstUpdated(props: PropertyValues): void;
|
package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js
CHANGED
|
@@ -9,7 +9,6 @@ import { SEARCH_CLASS_NAMES, SEARCH_CUSTOM_EVENT_NAMES, SEARCH_COMPONENT_NAMES }
|
|
|
9
9
|
let HSearchInput = class HSearchInput extends PhoenixLightLitElement {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.isSearchFocusTrapFixEnabled = false;
|
|
13
12
|
this._isSearchPhraseCleared = false;
|
|
14
13
|
this._setupAttributes = () => {
|
|
15
14
|
var _a, _b, _c, _d;
|
|
@@ -69,60 +68,36 @@ let HSearchInput = class HSearchInput extends PhoenixLightLitElement {
|
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (this._isSearchPhraseCleared) {
|
|
77
|
-
this._isSearchPhraseCleared = false;
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.submit, {
|
|
81
|
-
detail: { searchPhrase: ev.target.value }
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
this.input.addEventListener('keyup', debounce_1((ev) => {
|
|
85
|
-
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape' || ev.key === 'Enter')
|
|
86
|
-
return;
|
|
71
|
+
this.input.addEventListener('keyup', (ev) => {
|
|
72
|
+
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
|
|
73
|
+
return;
|
|
74
|
+
if (ev.key !== 'Enter') {
|
|
87
75
|
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
88
76
|
detail: {
|
|
89
77
|
searchPhrase: ev.target.value
|
|
90
78
|
}
|
|
91
79
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
searchPhrase: ev.target.value
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this._isSearchPhraseCleared) {
|
|
83
|
+
this._isSearchPhraseCleared = false;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.submit, {
|
|
87
|
+
detail: {
|
|
88
|
+
searchPhrase: ev.target.value
|
|
105
89
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
this.input.addEventListener('keyup', debounce_1((ev) => {
|
|
93
|
+
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape' || ev.key === 'Enter')
|
|
94
|
+
return;
|
|
95
|
+
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
96
|
+
detail: {
|
|
97
|
+
searchPhrase: ev.target.value
|
|
109
98
|
}
|
|
110
|
-
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.submit, {
|
|
111
|
-
detail: {
|
|
112
|
-
searchPhrase: ev.target.value
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
99
|
});
|
|
116
|
-
|
|
117
|
-
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape' || ev.key === 'Enter')
|
|
118
|
-
return;
|
|
119
|
-
this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.keyup, {
|
|
120
|
-
detail: {
|
|
121
|
-
searchPhrase: ev.target.value
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}, 200));
|
|
125
|
-
}
|
|
100
|
+
}, 200));
|
|
126
101
|
this.input.addEventListener('search', (ev) => {
|
|
127
102
|
if (this.input.value !== '') {
|
|
128
103
|
return;
|
|
@@ -156,10 +131,6 @@ __decorate([
|
|
|
156
131
|
property({ type: String, attribute: 'module-instance-id' }),
|
|
157
132
|
__metadata("design:type", String)
|
|
158
133
|
], HSearchInput.prototype, "moduleInstanceId", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
|
|
161
|
-
__metadata("design:type", Boolean)
|
|
162
|
-
], HSearchInput.prototype, "isSearchFocusTrapFixEnabled", void 0);
|
|
163
134
|
__decorate([
|
|
164
135
|
state(),
|
|
165
136
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;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;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;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;AACA;AACA;"}
|
|
@@ -94,7 +94,7 @@ let HSearchResults = class HSearchResults extends PhoenixLightLitElement {
|
|
|
94
94
|
data-search-item-id="${this.searchId}${this._loadMoreButtonId}"
|
|
95
95
|
>
|
|
96
96
|
${this.translations.loadMore}
|
|
97
|
-
</button>`), () => html `
|
|
97
|
+
</button>`), () => n(this._getSearchPhrase().length > 1, () => html `
|
|
98
98
|
<button
|
|
99
99
|
class="${SEARCH_CLASS_NAMES.productButton}"
|
|
100
100
|
@click="${this.handleGoToProductsFor}"
|
|
@@ -103,7 +103,7 @@ let HSearchResults = class HSearchResults extends PhoenixLightLitElement {
|
|
|
103
103
|
>
|
|
104
104
|
${this.translations.goToProductsFor}: <strong>${this._getSearchPhrase()}</strong>
|
|
105
105
|
</button>
|
|
106
|
-
`)}
|
|
106
|
+
`))}
|
|
107
107
|
</div>
|
|
108
108
|
`)}
|
|
109
109
|
${n((_d = this.results.producers) === null || _d === void 0 ? void 0 : _d.length, () => html ` <h-search-producer-content
|
package/package.json
CHANGED
package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
-
require('lit');
|
|
7
|
-
var cyclic_focus_trap_strategy = require('./strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js');
|
|
8
|
-
var focus_trap_strategy_constants = require('./strategies/focus_trap_strategy_constants.js');
|
|
9
|
-
|
|
10
|
-
var _a, _FocusTrapController_strategy, _FocusTrapController_createStrategy;
|
|
11
|
-
class FocusTrapController {
|
|
12
|
-
constructor(host, props) {
|
|
13
|
-
_FocusTrapController_strategy.set(this, void 0);
|
|
14
|
-
tslib_es6.__classPrivateFieldSet(this, _FocusTrapController_strategy, tslib_es6.__classPrivateFieldGet(FocusTrapController, _a, "m", _FocusTrapController_createStrategy).call(FocusTrapController, props), "f");
|
|
15
|
-
host.addController(this);
|
|
16
|
-
}
|
|
17
|
-
get strategy() {
|
|
18
|
-
return tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f");
|
|
19
|
-
}
|
|
20
|
-
hostConnected() {
|
|
21
|
-
tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").attach();
|
|
22
|
-
}
|
|
23
|
-
hostDisconnected() {
|
|
24
|
-
tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").detach();
|
|
25
|
-
}
|
|
26
|
-
activate() {
|
|
27
|
-
tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").activate();
|
|
28
|
-
}
|
|
29
|
-
deactivate() {
|
|
30
|
-
tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").deactivate();
|
|
31
|
-
}
|
|
32
|
-
getFocusableElements(container) {
|
|
33
|
-
return tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").getFocusableElements(container);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
_a = FocusTrapController, _FocusTrapController_strategy = new WeakMap(), _FocusTrapController_createStrategy = function _FocusTrapController_createStrategy(props) {
|
|
37
|
-
switch (props.mode) {
|
|
38
|
-
case focus_trap_strategy_constants.FOCUS_TRAP_STRATEGY_TYPES.cyclic: return new cyclic_focus_trap_strategy.CyclicFocusTrapStrategy(props);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
exports.FocusTrapController = FocusTrapController;
|
|
43
|
-
//# sourceMappingURL=focus_trap_controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var utilities = require('@dreamcommerce/utilities');
|
|
6
|
-
|
|
7
|
-
class BaseFocusTrapStrategy {
|
|
8
|
-
constructor(getContainer) {
|
|
9
|
-
this.getContainer = getContainer;
|
|
10
|
-
this.active = false;
|
|
11
|
-
this.noAutofocus = false;
|
|
12
|
-
this._handleKeyDown = (ev) => {
|
|
13
|
-
if (!this.active || ev.code !== 'Tab')
|
|
14
|
-
return;
|
|
15
|
-
const container = this.getContainer();
|
|
16
|
-
if (!container)
|
|
17
|
-
return;
|
|
18
|
-
const focusableElements = this.getFocusableElements(container);
|
|
19
|
-
if (focusableElements.length === 0)
|
|
20
|
-
return;
|
|
21
|
-
const $target = ev.target;
|
|
22
|
-
if (ev.shiftKey) {
|
|
23
|
-
if ($target === focusableElements[0]) {
|
|
24
|
-
ev.preventDefault();
|
|
25
|
-
focusableElements[focusableElements.length - 1].focus();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
if ($target === focusableElements[focusableElements.length - 1]) {
|
|
30
|
-
ev.preventDefault();
|
|
31
|
-
focusableElements[0].focus();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
attach() {
|
|
37
|
-
document.addEventListener('keydown', this._handleKeyDown);
|
|
38
|
-
}
|
|
39
|
-
detach() {
|
|
40
|
-
document.removeEventListener('keydown', this._handleKeyDown);
|
|
41
|
-
}
|
|
42
|
-
activate() {
|
|
43
|
-
this.active = true;
|
|
44
|
-
}
|
|
45
|
-
deactivate() {
|
|
46
|
-
this.active = false;
|
|
47
|
-
}
|
|
48
|
-
getFocusableElements(container) {
|
|
49
|
-
return utilities.UiDomUtils.getFocusableElements(container).filter(($el) => this._isElementTrulyFocusable($el));
|
|
50
|
-
}
|
|
51
|
-
_isElementTrulyFocusable($el) {
|
|
52
|
-
const style = window.getComputedStyle($el);
|
|
53
|
-
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
if ($el.nodeName === 'H-PORTAL')
|
|
57
|
-
return true;
|
|
58
|
-
const $parent = $el.parentElement;
|
|
59
|
-
if (!$parent)
|
|
60
|
-
return true;
|
|
61
|
-
return this._isElementTrulyFocusable($parent);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
exports.BaseFocusTrapStrategy = BaseFocusTrapStrategy;
|
|
66
|
-
//# sourceMappingURL=base_focus_trap_strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var base_focus_trap_strategy = require('../base_focus_trap_strategy.js');
|
|
6
|
-
|
|
7
|
-
class CyclicFocusTrapStrategy extends base_focus_trap_strategy.BaseFocusTrapStrategy {
|
|
8
|
-
constructor({ getContainer }) {
|
|
9
|
-
super(getContainer);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.CyclicFocusTrapStrategy = CyclicFocusTrapStrategy;
|
|
14
|
-
//# sourceMappingURL=cyclic_focus_trap_strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const FOCUS_TRAP_STRATEGY_TYPES = {
|
|
6
|
-
cyclic: 'cyclic'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
exports.FOCUS_TRAP_STRATEGY_TYPES = FOCUS_TRAP_STRATEGY_TYPES;
|
|
10
|
-
//# sourceMappingURL=focus_trap_strategy_constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
import type { TFocusTrapProps } from './focus_trap_controller_types';
|
|
3
|
-
import { IBaseFocusTrapStrategy } from './strategies/base_focus_trap_strategy_types';
|
|
4
|
-
export declare class FocusTrapController implements ReactiveController {
|
|
5
|
-
#private;
|
|
6
|
-
constructor(host: ReactiveControllerHost, props: TFocusTrapProps);
|
|
7
|
-
get strategy(): IBaseFocusTrapStrategy;
|
|
8
|
-
hostConnected(): void;
|
|
9
|
-
hostDisconnected(): void;
|
|
10
|
-
activate(): void;
|
|
11
|
-
deactivate(): void;
|
|
12
|
-
getFocusableElements(container: HTMLElement): HTMLElement[];
|
|
13
|
-
}
|
package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { __classPrivateFieldSet, __classPrivateFieldGet } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import 'lit';
|
|
3
|
-
import { CyclicFocusTrapStrategy } from './strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js';
|
|
4
|
-
import { FOCUS_TRAP_STRATEGY_TYPES } from './strategies/focus_trap_strategy_constants.js';
|
|
5
|
-
|
|
6
|
-
var _a, _FocusTrapController_strategy, _FocusTrapController_createStrategy;
|
|
7
|
-
class FocusTrapController {
|
|
8
|
-
constructor(host, props) {
|
|
9
|
-
_FocusTrapController_strategy.set(this, void 0);
|
|
10
|
-
__classPrivateFieldSet(this, _FocusTrapController_strategy, __classPrivateFieldGet(FocusTrapController, _a, "m", _FocusTrapController_createStrategy).call(FocusTrapController, props), "f");
|
|
11
|
-
host.addController(this);
|
|
12
|
-
}
|
|
13
|
-
get strategy() {
|
|
14
|
-
return __classPrivateFieldGet(this, _FocusTrapController_strategy, "f");
|
|
15
|
-
}
|
|
16
|
-
hostConnected() {
|
|
17
|
-
__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").attach();
|
|
18
|
-
}
|
|
19
|
-
hostDisconnected() {
|
|
20
|
-
__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").detach();
|
|
21
|
-
}
|
|
22
|
-
activate() {
|
|
23
|
-
__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").activate();
|
|
24
|
-
}
|
|
25
|
-
deactivate() {
|
|
26
|
-
__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").deactivate();
|
|
27
|
-
}
|
|
28
|
-
getFocusableElements(container) {
|
|
29
|
-
return __classPrivateFieldGet(this, _FocusTrapController_strategy, "f").getFocusableElements(container);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
_a = FocusTrapController, _FocusTrapController_strategy = new WeakMap(), _FocusTrapController_createStrategy = function _FocusTrapController_createStrategy(props) {
|
|
33
|
-
switch (props.mode) {
|
|
34
|
-
case FOCUS_TRAP_STRATEGY_TYPES.cyclic: return new CyclicFocusTrapStrategy(props);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { FocusTrapController };
|
|
39
|
-
//# sourceMappingURL=focus_trap_controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,4CAAgD;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,6 +0,0 @@
|
|
|
1
|
-
import { TCyclicFocusTrapStrategyProps } from "./strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types";
|
|
2
|
-
import { FOCUS_TRAP_STRATEGY_TYPES } from "./strategies/focus_trap_strategy_constants";
|
|
3
|
-
export declare type TCyclicFocusTrapProps = TCyclicFocusTrapStrategyProps & {
|
|
4
|
-
mode: typeof FOCUS_TRAP_STRATEGY_TYPES.cyclic;
|
|
5
|
-
};
|
|
6
|
-
export declare type TFocusTrapProps = TCyclicFocusTrapProps;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"focus_trap_controller_types.js","sourceRoot":"","sources":["../../../../../../../src/controllers/focus_trap_controller/focus_trap_controller_types.ts"],"names":[],"mappings":"AAAA,OAA8C,0EAA0E,CAAC;AACzH,OAA0C,4CAA4C,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IBaseFocusTrapStrategy } from './base_focus_trap_strategy_types';
|
|
2
|
-
export declare abstract class BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
|
|
3
|
-
protected readonly getContainer: () => HTMLElement | undefined;
|
|
4
|
-
protected active: boolean;
|
|
5
|
-
noAutofocus: boolean;
|
|
6
|
-
constructor(getContainer: () => HTMLElement | undefined);
|
|
7
|
-
attach(): void;
|
|
8
|
-
detach(): void;
|
|
9
|
-
activate(): void;
|
|
10
|
-
deactivate(): void;
|
|
11
|
-
getFocusableElements(container: HTMLElement): HTMLElement[];
|
|
12
|
-
protected _handleKeyDown: (ev: KeyboardEvent) => void;
|
|
13
|
-
private _isElementTrulyFocusable;
|
|
14
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { UiDomUtils } from '@dreamcommerce/utilities';
|
|
2
|
-
|
|
3
|
-
class BaseFocusTrapStrategy {
|
|
4
|
-
constructor(getContainer) {
|
|
5
|
-
this.getContainer = getContainer;
|
|
6
|
-
this.active = false;
|
|
7
|
-
this.noAutofocus = false;
|
|
8
|
-
this._handleKeyDown = (ev) => {
|
|
9
|
-
if (!this.active || ev.code !== 'Tab')
|
|
10
|
-
return;
|
|
11
|
-
const container = this.getContainer();
|
|
12
|
-
if (!container)
|
|
13
|
-
return;
|
|
14
|
-
const focusableElements = this.getFocusableElements(container);
|
|
15
|
-
if (focusableElements.length === 0)
|
|
16
|
-
return;
|
|
17
|
-
const $target = ev.target;
|
|
18
|
-
if (ev.shiftKey) {
|
|
19
|
-
if ($target === focusableElements[0]) {
|
|
20
|
-
ev.preventDefault();
|
|
21
|
-
focusableElements[focusableElements.length - 1].focus();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
if ($target === focusableElements[focusableElements.length - 1]) {
|
|
26
|
-
ev.preventDefault();
|
|
27
|
-
focusableElements[0].focus();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
attach() {
|
|
33
|
-
document.addEventListener('keydown', this._handleKeyDown);
|
|
34
|
-
}
|
|
35
|
-
detach() {
|
|
36
|
-
document.removeEventListener('keydown', this._handleKeyDown);
|
|
37
|
-
}
|
|
38
|
-
activate() {
|
|
39
|
-
this.active = true;
|
|
40
|
-
}
|
|
41
|
-
deactivate() {
|
|
42
|
-
this.active = false;
|
|
43
|
-
}
|
|
44
|
-
getFocusableElements(container) {
|
|
45
|
-
return UiDomUtils.getFocusableElements(container).filter(($el) => this._isElementTrulyFocusable($el));
|
|
46
|
-
}
|
|
47
|
-
_isElementTrulyFocusable($el) {
|
|
48
|
-
const style = window.getComputedStyle($el);
|
|
49
|
-
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if ($el.nodeName === 'H-PORTAL')
|
|
53
|
-
return true;
|
|
54
|
-
const $parent = $el.parentElement;
|
|
55
|
-
if (!$parent)
|
|
56
|
-
return true;
|
|
57
|
-
return this._isElementTrulyFocusable($parent);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { BaseFocusTrapStrategy };
|
|
62
|
-
//# sourceMappingURL=base_focus_trap_strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base_focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy';
|
|
2
|
-
import { IBaseFocusTrapStrategy } from '../base_focus_trap_strategy_types';
|
|
3
|
-
import { TCyclicFocusTrapStrategyProps } from './cyclic_focus_trap_strategy_types';
|
|
4
|
-
export declare class CyclicFocusTrapStrategy extends BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
|
|
5
|
-
constructor({ getContainer }: TCyclicFocusTrapStrategyProps);
|
|
6
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy.js';
|
|
2
|
-
|
|
3
|
-
class CyclicFocusTrapStrategy extends BaseFocusTrapStrategy {
|
|
4
|
-
constructor({ getContainer }) {
|
|
5
|
-
super(getContainer);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { CyclicFocusTrapStrategy };
|
|
10
|
-
//# sourceMappingURL=cyclic_focus_trap_strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cyclic_focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../../src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;"}
|