@shoper/phoenix_design_system 1.18.24-6 → 1.18.24-8

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.
Files changed (50) hide show
  1. package/build/cjs/packages/phoenix/src/components/form/search/search.js +53 -8
  2. package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +1 -8
  4. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +51 -22
  6. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +1 -2
  8. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +43 -0
  10. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +1 -0
  11. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +66 -0
  12. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +1 -0
  13. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +14 -0
  14. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
  15. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +10 -0
  16. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +1 -0
  17. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +6 -0
  18. package/build/esm/packages/phoenix/src/components/form/search/search.js +53 -8
  19. package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
  20. package/build/esm/packages/phoenix/src/components/form/search/search_types.d.ts +0 -1
  21. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.d.ts +0 -1
  22. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +2 -9
  23. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
  24. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +1 -0
  25. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +51 -22
  26. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  27. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +1 -2
  28. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
  29. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +13 -0
  30. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +39 -0
  31. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +1 -0
  32. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.d.ts +6 -0
  33. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js +3 -0
  34. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js.map +1 -0
  35. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.d.ts +14 -0
  36. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +62 -0
  37. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +1 -0
  38. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +8 -0
  39. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +2 -0
  40. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +1 -0
  41. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +6 -0
  42. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +10 -0
  43. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
  44. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +3 -0
  45. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +2 -0
  46. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +1 -0
  47. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +3 -0
  48. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +6 -0
  49. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +1 -0
  50. package/package.json +1 -1
@@ -20,6 +20,8 @@ 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');
23
25
 
24
26
  exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLitElement {
25
27
  constructor() {
@@ -27,11 +29,17 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
27
29
  this.view = search_constants.DEFAULT_VIEW;
28
30
  this.isSearchIconFixEnabled = false;
29
31
  this.isSearchUxFixesFlagEnabled = false;
32
+ this.isSearchFocusTrapFixEnabled = false;
30
33
  this.displayMode = 'dropdown';
31
34
  this._togglerElement = null;
35
+ this._mobileDialogOpener = null;
32
36
  this._id = v4['default']();
33
37
  this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
34
38
  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
+ });
35
43
  this._searchResultsRef = ref_js.createRef();
36
44
  this._searchHistoryRef = ref_js.createRef();
37
45
  this._searchMessageRef = ref_js.createRef();
@@ -327,6 +335,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
327
335
  if (window.innerWidth > global_constants.BREAKPOINTS.sm) {
328
336
  const hasBeenOpened = this.classList.contains(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
329
337
  this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
338
+ if (this.isSearchFocusTrapFixEnabled)
339
+ this._deactivateMobileDialog();
330
340
  if (hasBeenOpened && this.displayMode !== 'dropdown') {
331
341
  const $storefrontSearch = document.querySelector(`h-storefront-search[module-instance-id="${this.moduleInstanceId}"]`);
332
342
  const searchOverlayTriggerName = (_a = $storefrontSearch === null || $storefrontSearch === void 0 ? void 0 : $storefrontSearch.querySelector('[aria-haspopup="dialog"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('name');
@@ -342,6 +352,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
342
352
  };
343
353
  this._openMobileView = () => {
344
354
  this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
355
+ if (this.isSearchFocusTrapFixEnabled)
356
+ this._activateMobileDialog();
345
357
  };
346
358
  this._isSuggesterLayerVisible = () => {
347
359
  var _a;
@@ -362,6 +374,17 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
362
374
  document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
363
375
  }
364
376
  };
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
+ };
365
388
  this._setupAriaAttributes = () => {
366
389
  var _a;
367
390
  if (this._translations.openSearchButtonAriaLabel) {
@@ -370,6 +393,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
370
393
  };
371
394
  this._handleOpenSearch = () => {
372
395
  this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
396
+ if (this.isSearchFocusTrapFixEnabled)
397
+ this._activateMobileDialog();
373
398
  const shouldShowMessage = this._searchPhrase !== '';
374
399
  this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
375
400
  const $searchInput = this.querySelector(`
@@ -378,7 +403,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
378
403
  $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
379
404
  };
380
405
  this._handleOpenSearchWithKeyboard = (ev) => {
381
- if (ev.code !== 'Enter')
406
+ const isRepeated = this.isSearchFocusTrapFixEnabled ? ev.repeat : false;
407
+ if (ev.code !== 'Enter' || isRepeated)
382
408
  return;
383
409
  ev.preventDefault();
384
410
  this._handleOpenSearch();
@@ -387,6 +413,10 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
387
413
  async connectedCallback() {
388
414
  super.connectedCallback();
389
415
  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();
390
420
  try {
391
421
  this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
392
422
  this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
@@ -415,10 +445,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
415
445
  catch (_a) {
416
446
  console.error('Search context is not provided');
417
447
  }
418
- this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
419
- this._setupInitialSearchPhrase();
420
- this._setupListeners();
421
- this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
422
448
  }
423
449
  disconnectedCallback() {
424
450
  var _a;
@@ -490,8 +516,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
490
516
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
491
517
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.close, () => {
492
518
  this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
519
+ if (this.isSearchFocusTrapFixEnabled)
520
+ this._deactivateMobileDialog();
493
521
  this._resetSearchView();
494
522
  this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
523
+ if (this.isSearchFocusTrapFixEnabled)
524
+ requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
495
525
  });
496
526
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
497
527
  const contentLength = this._searchHistory.length;
@@ -610,13 +640,23 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
610
640
  if (!this._togglerElement)
611
641
  return;
612
642
  this._togglerElement.addEventListener('click', this._handleOpenSearch);
613
- this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
643
+ if (this.isSearchFocusTrapFixEnabled) {
644
+ this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
645
+ }
646
+ else {
647
+ this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
648
+ }
614
649
  }
615
650
  _teardownToggler() {
616
651
  if (!this._togglerElement)
617
652
  return;
618
653
  this._togglerElement.removeEventListener('click', this._handleOpenSearch);
619
- this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
654
+ if (this.isSearchFocusTrapFixEnabled) {
655
+ this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
656
+ }
657
+ else {
658
+ this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
659
+ }
620
660
  }
621
661
  render() {
622
662
  super.render();
@@ -626,7 +666,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
626
666
  tabindex="0"
627
667
  aria-haspopup="dialog"
628
668
  @click=${this._handleOpenSearch}
629
- @keyup=${this._handleOpenSearchWithKeyboard}
669
+ @keyup=${this.isSearchFocusTrapFixEnabled ? undefined : this._handleOpenSearchWithKeyboard}
670
+ @keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
630
671
  >
631
672
  ${when.when(this._translations.openSearchButtonAriaLabel, () => lit.html `
632
673
  <span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
@@ -696,6 +737,10 @@ tslib_es6.__decorate([
696
737
  decorators.property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
697
738
  tslib_es6.__metadata("design:type", Boolean)
698
739
  ], 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);
699
744
  tslib_es6.__decorate([
700
745
  decorators.property({ type: String, attribute: 'display-mode' }),
701
746
  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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -19,10 +19,7 @@ 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._updateClearButtonVisibility(ev.detail.searchPhrase);
23
- };
24
- this._updateClearButtonVisibility = (searchPhrase) => {
25
- this._shouldShow = searchPhrase !== '';
22
+ this._shouldShow = ev.detail.searchPhrase !== '';
26
23
  };
27
24
  this._dispatchClearEvent = () => {
28
25
  this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.clear, {
@@ -34,12 +31,8 @@ exports.HSearchClear = class HSearchClear extends phoenix_light_lit_element.Phoe
34
31
  this._btnController = new btn_controller.BtnController(this, this._dispatchClearEvent);
35
32
  }
36
33
  connectedCallback() {
37
- var _a;
38
34
  super.connectedCallback();
39
35
  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 : '');
43
36
  this.addEventListener('click', this._dispatchClearEvent);
44
37
  document.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, this._handleClearButtonOnPhraseEnter);
45
38
  }
@@ -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;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;"}
@@ -13,6 +13,7 @@ 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;
16
17
  this._isSearchPhraseCleared = false;
17
18
  this._setupAttributes = () => {
18
19
  var _a, _b, _c, _d;
@@ -72,36 +73,60 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
72
73
  }
73
74
  });
74
75
  });
75
- this.input.addEventListener('keyup', (ev) => {
76
- if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
77
- return;
78
- if (ev.key !== 'Enter') {
76
+ if (this.isSearchFocusTrapFixEnabled) {
77
+ this.input.addEventListener('keydown', (ev) => {
78
+ if (ev.key !== 'Enter' || ev.repeat)
79
+ return;
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;
79
91
  this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, {
80
92
  detail: {
81
93
  searchPhrase: ev.target.value
82
94
  }
83
95
  });
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
96
+ }, 200));
97
+ }
98
+ else {
99
+ this.input.addEventListener('keyup', (ev) => {
100
+ if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
101
+ return;
102
+ if (ev.key !== 'Enter') {
103
+ this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keyup, {
104
+ detail: {
105
+ searchPhrase: ev.target.value
106
+ }
107
+ });
108
+ return;
93
109
  }
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
110
+ if (this._isSearchPhraseCleared) {
111
+ this._isSearchPhraseCleared = false;
112
+ return;
102
113
  }
114
+ this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, {
115
+ detail: {
116
+ searchPhrase: ev.target.value
117
+ }
118
+ });
103
119
  });
104
- }, 200));
120
+ this.input.addEventListener('keyup', debounce['default']((ev) => {
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
+ }
105
130
  this.input.addEventListener('search', (ev) => {
106
131
  if (this.input.value !== '') {
107
132
  return;
@@ -135,6 +160,10 @@ tslib_es6.__decorate([
135
160
  decorators.property({ type: String, attribute: 'module-instance-id' }),
136
161
  tslib_es6.__metadata("design:type", String)
137
162
  ], 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);
138
167
  tslib_es6.__decorate([
139
168
  decorators.state(),
140
169
  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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -49,8 +49,7 @@ exports.HSearchResults = class HSearchResults extends phoenix_light_lit_element.
49
49
  this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.searchPhraseSubmitted, {
50
50
  detail: {
51
51
  searchPhrase: this._getSearchPhrase(),
52
- moduleInstanceId: this.moduleInstanceId,
53
- omitLengthCheck: true
52
+ moduleInstanceId: this.moduleInstanceId
54
53
  }
55
54
  });
56
55
  }
@@ -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,iBAAiB,8DAAkE;AACnF,mBAAmB,8DAAkE;AACrF;AACA,sBAAsB,oDAAwD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,iBAAiB,8DAAkE;AACnF,mBAAmB,8DAAkE;AACrF;AACA,sBAAsB,oDAAwD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,43 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,66 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,12 +1,14 @@
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";
4
5
  export declare class HSearch extends PhoenixLightLitElement {
5
6
  settings: TSearchSettings;
6
7
  view: string;
7
8
  locale: string;
8
9
  isSearchIconFixEnabled: boolean;
9
10
  isSearchUxFixesFlagEnabled: boolean;
11
+ isSearchFocusTrapFixEnabled: boolean;
10
12
  displayMode: TSearchDisplayMode;
11
13
  moduleInstanceId: string;
12
14
  private _historyContextProvider;
@@ -17,9 +19,11 @@ export declare class HSearch extends PhoenixLightLitElement {
17
19
  private _inputField;
18
20
  private _searchForm;
19
21
  private _togglerElement;
22
+ private _mobileDialogOpener;
20
23
  private _id;
21
24
  private _openSearchButtonAriaLabelId;
22
25
  private _searchContentContainerId;
26
+ mobileFocusTrapController: FocusTrapController;
23
27
  private _searchResultsRef;
24
28
  private _searchHistoryRef;
25
29
  private _searchMessageRef;
@@ -81,6 +85,8 @@ export declare class HSearch extends PhoenixLightLitElement {
81
85
  private _isSuggesterLayerVisible;
82
86
  private _preventSubmitOnSearchClear;
83
87
  private _resetSearchOnFocusOutside;
88
+ private _activateMobileDialog;
89
+ private _deactivateMobileDialog;
84
90
  private _setupAriaAttributes;
85
91
  private _handleOpenSearch;
86
92
  private _handleOpenSearchWithKeyboard;
@@ -16,6 +16,8 @@ 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';
19
21
 
20
22
  let HSearch = class HSearch extends PhoenixLightLitElement {
21
23
  constructor() {
@@ -23,11 +25,17 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
23
25
  this.view = DEFAULT_VIEW;
24
26
  this.isSearchIconFixEnabled = false;
25
27
  this.isSearchUxFixesFlagEnabled = false;
28
+ this.isSearchFocusTrapFixEnabled = false;
26
29
  this.displayMode = 'dropdown';
27
30
  this._togglerElement = null;
31
+ this._mobileDialogOpener = null;
28
32
  this._id = v4();
29
33
  this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
30
34
  this._searchContentContainerId = v4();
35
+ this.mobileFocusTrapController = new FocusTrapController(this, {
36
+ mode: FOCUS_TRAP_STRATEGY_TYPES.cyclic,
37
+ getContainer: () => this
38
+ });
31
39
  this._searchResultsRef = createRef();
32
40
  this._searchHistoryRef = createRef();
33
41
  this._searchMessageRef = createRef();
@@ -323,6 +331,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
323
331
  if (window.innerWidth > BREAKPOINTS.sm) {
324
332
  const hasBeenOpened = this.classList.contains(SEARCH_CLASS_NAMES.mobileOpened);
325
333
  this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened);
334
+ if (this.isSearchFocusTrapFixEnabled)
335
+ this._deactivateMobileDialog();
326
336
  if (hasBeenOpened && this.displayMode !== 'dropdown') {
327
337
  const $storefrontSearch = document.querySelector(`h-storefront-search[module-instance-id="${this.moduleInstanceId}"]`);
328
338
  const searchOverlayTriggerName = (_a = $storefrontSearch === null || $storefrontSearch === void 0 ? void 0 : $storefrontSearch.querySelector('[aria-haspopup="dialog"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('name');
@@ -338,6 +348,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
338
348
  };
339
349
  this._openMobileView = () => {
340
350
  this.classList.add(SEARCH_CLASS_NAMES.mobileOpened);
351
+ if (this.isSearchFocusTrapFixEnabled)
352
+ this._activateMobileDialog();
341
353
  };
342
354
  this._isSuggesterLayerVisible = () => {
343
355
  var _a;
@@ -358,6 +370,17 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
358
370
  document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
359
371
  }
360
372
  };
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
+ };
361
384
  this._setupAriaAttributes = () => {
362
385
  var _a;
363
386
  if (this._translations.openSearchButtonAriaLabel) {
@@ -366,6 +389,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
366
389
  };
367
390
  this._handleOpenSearch = () => {
368
391
  this.classList.add(SEARCH_CLASS_NAMES.mobileOpened);
392
+ if (this.isSearchFocusTrapFixEnabled)
393
+ this._activateMobileDialog();
369
394
  const shouldShowMessage = this._searchPhrase !== '';
370
395
  this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
371
396
  const $searchInput = this.querySelector(`
@@ -374,7 +399,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
374
399
  $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
375
400
  };
376
401
  this._handleOpenSearchWithKeyboard = (ev) => {
377
- if (ev.code !== 'Enter')
402
+ const isRepeated = this.isSearchFocusTrapFixEnabled ? ev.repeat : false;
403
+ if (ev.code !== 'Enter' || isRepeated)
378
404
  return;
379
405
  ev.preventDefault();
380
406
  this._handleOpenSearch();
@@ -383,6 +409,10 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
383
409
  async connectedCallback() {
384
410
  super.connectedCallback();
385
411
  this._setupContext();
412
+ this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
413
+ this._setupInitialSearchPhrase();
414
+ this._setupListeners();
415
+ this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
386
416
  try {
387
417
  this._searchContextConsumer = new ContextConsumerController(this);
388
418
  this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
@@ -411,10 +441,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
411
441
  catch (_a) {
412
442
  console.error('Search context is not provided');
413
443
  }
414
- this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
415
- this._setupInitialSearchPhrase();
416
- this._setupListeners();
417
- this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
418
444
  }
419
445
  disconnectedCallback() {
420
446
  var _a;
@@ -486,8 +512,12 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
486
512
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
487
513
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.close, () => {
488
514
  this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened);
515
+ if (this.isSearchFocusTrapFixEnabled)
516
+ this._deactivateMobileDialog();
489
517
  this._resetSearchView();
490
518
  this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
519
+ if (this.isSearchFocusTrapFixEnabled)
520
+ requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
491
521
  });
492
522
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
493
523
  const contentLength = this._searchHistory.length;
@@ -606,13 +636,23 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
606
636
  if (!this._togglerElement)
607
637
  return;
608
638
  this._togglerElement.addEventListener('click', this._handleOpenSearch);
609
- this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
639
+ if (this.isSearchFocusTrapFixEnabled) {
640
+ this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
641
+ }
642
+ else {
643
+ this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
644
+ }
610
645
  }
611
646
  _teardownToggler() {
612
647
  if (!this._togglerElement)
613
648
  return;
614
649
  this._togglerElement.removeEventListener('click', this._handleOpenSearch);
615
- this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
650
+ if (this.isSearchFocusTrapFixEnabled) {
651
+ this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
652
+ }
653
+ else {
654
+ this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
655
+ }
616
656
  }
617
657
  render() {
618
658
  super.render();
@@ -622,7 +662,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
622
662
  tabindex="0"
623
663
  aria-haspopup="dialog"
624
664
  @click=${this._handleOpenSearch}
625
- @keyup=${this._handleOpenSearchWithKeyboard}
665
+ @keyup=${this.isSearchFocusTrapFixEnabled ? undefined : this._handleOpenSearchWithKeyboard}
666
+ @keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
626
667
  >
627
668
  ${n(this._translations.openSearchButtonAriaLabel, () => html `
628
669
  <span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
@@ -692,6 +733,10 @@ __decorate([
692
733
  property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
693
734
  __metadata("design:type", Boolean)
694
735
  ], 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);
695
740
  __decorate([
696
741
  property({ type: String, attribute: 'display-mode' }),
697
742
  __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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -51,7 +51,6 @@ export declare type TSearchData = {
51
51
  export declare type TSearchPhaseEventBody = {
52
52
  searchPhrase: string;
53
53
  moduleInstanceId: string;
54
- omitLengthCheck?: boolean;
55
54
  };
56
55
  export declare type SearchPhraseEvent = CustomEventInit<TSearchPhaseEventBody>;
57
56
  export declare type RemoveHistoryItemEvent = CustomEventInit<{
@@ -11,7 +11,6 @@ export declare class HSearchClear extends PhoenixLightLitElement {
11
11
  constructor();
12
12
  connectedCallback(): void;
13
13
  private _handleClearButtonOnPhraseEnter;
14
- private _updateClearButtonVisibility;
15
14
  protected updated(_changedProperties: PropertyValues): void;
16
15
  private _dispatchClearEvent;
17
16
  private _searchContextSetup;
@@ -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_COMPONENT_NAMES, SEARCH_CLASS_NAMES, SEARCH_SLOT_NAMES } from '../../search_constants.js';
10
+ import { SEARCH_CUSTOM_EVENT_NAMES, SEARCH_CLASS_NAMES, SEARCH_SLOT_NAMES, SEARCH_COMPONENT_NAMES } from '../../search_constants.js';
11
11
 
12
12
  let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
13
13
  constructor() {
@@ -15,10 +15,7 @@ let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
15
15
  this._shouldShow = false;
16
16
  this._isRequestPending = false;
17
17
  this._handleClearButtonOnPhraseEnter = (ev) => {
18
- this._updateClearButtonVisibility(ev.detail.searchPhrase);
19
- };
20
- this._updateClearButtonVisibility = (searchPhrase) => {
21
- this._shouldShow = searchPhrase !== '';
18
+ this._shouldShow = ev.detail.searchPhrase !== '';
22
19
  };
23
20
  this._dispatchClearEvent = () => {
24
21
  this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.clear, {
@@ -30,12 +27,8 @@ let HSearchClear = class HSearchClear extends PhoenixLightLitElement {
30
27
  this._btnController = new BtnController(this, this._dispatchClearEvent);
31
28
  }
32
29
  connectedCallback() {
33
- var _a;
34
30
  super.connectedCallback();
35
31
  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 : '');
39
32
  this.addEventListener('click', this._dispatchClearEvent);
40
33
  document.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.keyup, this._handleClearButtonOnPhraseEnter);
41
34
  }
@@ -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;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;"}
@@ -3,6 +3,7 @@ import { PropertyValues } from 'lit';
3
3
  export declare class HSearchInput extends PhoenixLightLitElement {
4
4
  input: HTMLInputElement | null;
5
5
  moduleInstanceId: string;
6
+ isSearchFocusTrapFixEnabled: boolean;
6
7
  private _isSearchPhraseCleared;
7
8
  connectedCallback(): void;
8
9
  firstUpdated(props: PropertyValues): void;
@@ -9,6 +9,7 @@ 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;
12
13
  this._isSearchPhraseCleared = false;
13
14
  this._setupAttributes = () => {
14
15
  var _a, _b, _c, _d;
@@ -68,36 +69,60 @@ let HSearchInput = class HSearchInput extends PhoenixLightLitElement {
68
69
  }
69
70
  });
70
71
  });
71
- this.input.addEventListener('keyup', (ev) => {
72
- if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
73
- return;
74
- if (ev.key !== 'Enter') {
72
+ if (this.isSearchFocusTrapFixEnabled) {
73
+ this.input.addEventListener('keydown', (ev) => {
74
+ if (ev.key !== 'Enter' || ev.repeat)
75
+ return;
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;
75
87
  this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.keyup, {
76
88
  detail: {
77
89
  searchPhrase: ev.target.value
78
90
  }
79
91
  });
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
92
+ }, 200));
93
+ }
94
+ else {
95
+ this.input.addEventListener('keyup', (ev) => {
96
+ if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
97
+ return;
98
+ if (ev.key !== 'Enter') {
99
+ this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.keyup, {
100
+ detail: {
101
+ searchPhrase: ev.target.value
102
+ }
103
+ });
104
+ return;
89
105
  }
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
106
+ if (this._isSearchPhraseCleared) {
107
+ this._isSearchPhraseCleared = false;
108
+ return;
98
109
  }
110
+ this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.submit, {
111
+ detail: {
112
+ searchPhrase: ev.target.value
113
+ }
114
+ });
99
115
  });
100
- }, 200));
116
+ this.input.addEventListener('keyup', debounce_1((ev) => {
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
+ }
101
126
  this.input.addEventListener('search', (ev) => {
102
127
  if (this.input.value !== '') {
103
128
  return;
@@ -131,6 +156,10 @@ __decorate([
131
156
  property({ type: String, attribute: 'module-instance-id' }),
132
157
  __metadata("design:type", String)
133
158
  ], 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);
134
163
  __decorate([
135
164
  state(),
136
165
  __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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -45,8 +45,7 @@ let HSearchResults = class HSearchResults extends PhoenixLightLitElement {
45
45
  this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.searchPhraseSubmitted, {
46
46
  detail: {
47
47
  searchPhrase: this._getSearchPhrase(),
48
- moduleInstanceId: this.moduleInstanceId,
49
- omitLengthCheck: true
48
+ moduleInstanceId: this.moduleInstanceId
50
49
  }
51
50
  });
52
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA,eAAe,8DAAkE;AACjF,0BAA0B,8DAAkE;AAC5F;AACA,sBAAsB,oDAAwD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe,8DAAkE;AACjF,0BAA0B,8DAAkE;AAC5F;AACA,sBAAsB,oDAAwD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,39 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,3 @@
1
+ import "./strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types";
2
+ import "./strategies/focus_trap_strategy_constants";
3
+ //# sourceMappingURL=focus_trap_controller_types.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,62 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,8 @@
1
+ export interface IBaseFocusTrapStrategy {
2
+ noAutofocus: boolean;
3
+ attach(): void;
4
+ detach(): void;
5
+ activate(): void;
6
+ deactivate(): void;
7
+ getFocusableElements(container: HTMLElement): HTMLElement[];
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=base_focus_trap_strategy_types.js.map
@@ -0,0 +1 @@
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":""}
@@ -0,0 +1,6 @@
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
+ }
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,3 @@
1
+ export declare type TCyclicFocusTrapStrategyProps = {
2
+ getContainer: () => HTMLElement | undefined;
3
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cyclic_focus_trap_strategy_types.js.map
@@ -0,0 +1 @@
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":""}
@@ -0,0 +1,3 @@
1
+ export declare const FOCUS_TRAP_STRATEGY_TYPES: {
2
+ readonly cyclic: "cyclic";
3
+ };
@@ -0,0 +1,6 @@
1
+ const FOCUS_TRAP_STRATEGY_TYPES = {
2
+ cyclic: 'cyclic'
3
+ };
4
+
5
+ export { FOCUS_TRAP_STRATEGY_TYPES };
6
+ //# sourceMappingURL=focus_trap_strategy_constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@shoper/phoenix_design_system",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "1.18.24-6",
5
+ "version": "1.18.24-8",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",