@shoper/phoenix_design_system 1.18.24-7 → 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.
Files changed (47) hide show
  1. package/build/cjs/packages/phoenix/src/components/form/search/search.js +8 -55
  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 +8 -1
  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 +22 -51
  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 +2 -2
  8. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +0 -6
  9. package/build/esm/packages/phoenix/src/components/form/search/search.js +8 -55
  10. package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
  11. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.d.ts +1 -0
  12. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +9 -2
  13. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
  14. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +0 -1
  15. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +22 -51
  16. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  17. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +2 -2
  18. package/package.json +1 -1
  19. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -43
  20. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +0 -1
  21. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +0 -66
  22. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +0 -1
  23. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +0 -14
  24. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +0 -1
  25. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +0 -10
  26. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +0 -1
  27. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +0 -13
  28. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -39
  29. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +0 -1
  30. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.d.ts +0 -6
  31. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js +0 -3
  32. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js.map +0 -1
  33. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.d.ts +0 -14
  34. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +0 -62
  35. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +0 -1
  36. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +0 -8
  37. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +0 -2
  38. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +0 -1
  39. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +0 -6
  40. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +0 -10
  41. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +0 -1
  42. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +0 -3
  43. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +0 -2
  44. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +0 -1
  45. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +0 -3
  46. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +0 -6
  47. 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,19 +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
- if (this.displayMode !== 'dropdown')
379
- return;
380
- this._mobileDialogOpener = document.activeElement;
381
- this.setAttribute('role', 'dialog');
382
- this.setAttribute('aria-modal', 'true');
383
- this.mobileFocusTrapController.activate();
384
- };
385
- this._deactivateMobileDialog = () => {
386
- this.removeAttribute('role');
387
- this.removeAttribute('aria-modal');
388
- this.mobileFocusTrapController.deactivate();
389
- };
390
365
  this._setupAriaAttributes = () => {
391
366
  var _a;
392
367
  if (this._translations.openSearchButtonAriaLabel) {
@@ -395,8 +370,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
395
370
  };
396
371
  this._handleOpenSearch = () => {
397
372
  this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
398
- if (this.isSearchFocusTrapFixEnabled)
399
- this._activateMobileDialog();
400
373
  const shouldShowMessage = this._searchPhrase !== '';
401
374
  this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
402
375
  const $searchInput = this.querySelector(`
@@ -405,8 +378,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
405
378
  $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
406
379
  };
407
380
  this._handleOpenSearchWithKeyboard = (ev) => {
408
- const isRepeated = this.isSearchFocusTrapFixEnabled ? ev.repeat : false;
409
- if (ev.code !== 'Enter' || isRepeated)
381
+ if (ev.code !== 'Enter')
410
382
  return;
411
383
  ev.preventDefault();
412
384
  this._handleOpenSearch();
@@ -415,10 +387,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
415
387
  async connectedCallback() {
416
388
  super.connectedCallback();
417
389
  this._setupContext();
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
390
  try {
423
391
  this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
424
392
  this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
@@ -447,6 +415,10 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
447
415
  catch (_a) {
448
416
  console.error('Search context is not provided');
449
417
  }
418
+ this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
419
+ this._setupInitialSearchPhrase();
420
+ this._setupListeners();
421
+ this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
450
422
  }
451
423
  disconnectedCallback() {
452
424
  var _a;
@@ -518,12 +490,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
518
490
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
519
491
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.close, () => {
520
492
  this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
521
- if (this.isSearchFocusTrapFixEnabled)
522
- this._deactivateMobileDialog();
523
493
  this._resetSearchView();
524
494
  this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
525
- if (this.isSearchFocusTrapFixEnabled)
526
- requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
527
495
  });
528
496
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
529
497
  const contentLength = this._searchHistory.length;
@@ -642,23 +610,13 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
642
610
  if (!this._togglerElement)
643
611
  return;
644
612
  this._togglerElement.addEventListener('click', this._handleOpenSearch);
645
- if (this.isSearchFocusTrapFixEnabled) {
646
- this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
647
- }
648
- else {
649
- this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
650
- }
613
+ this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
651
614
  }
652
615
  _teardownToggler() {
653
616
  if (!this._togglerElement)
654
617
  return;
655
618
  this._togglerElement.removeEventListener('click', this._handleOpenSearch);
656
- if (this.isSearchFocusTrapFixEnabled) {
657
- this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
658
- }
659
- else {
660
- this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
661
- }
619
+ this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
662
620
  }
663
621
  render() {
664
622
  super.render();
@@ -668,8 +626,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
668
626
  tabindex="0"
669
627
  aria-haspopup="dialog"
670
628
  @click=${this._handleOpenSearch}
671
- @keyup=${this.isSearchFocusTrapFixEnabled ? undefined : this._handleOpenSearchWithKeyboard}
672
- @keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
629
+ @keyup=${this._handleOpenSearchWithKeyboard}
673
630
  >
674
631
  ${when.when(this._translations.openSearchButtonAriaLabel, () => lit.html `
675
632
  <span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
@@ -739,10 +696,6 @@ tslib_es6.__decorate([
739
696
  decorators.property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
740
697
  tslib_es6.__metadata("design:type", Boolean)
741
698
  ], exports.HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
742
- tslib_es6.__decorate([
743
- decorators.property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
744
- tslib_es6.__metadata("design:type", Boolean)
745
- ], exports.HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
746
699
  tslib_es6.__decorate([
747
700
  decorators.property({ type: String, attribute: 'display-mode' }),
748
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;"}
@@ -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._shouldShow = ev.detail.searchPhrase !== '';
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;"}
@@ -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
- 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;
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
- }, 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;
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
- if (this._isSearchPhraseCleared) {
111
- this._isSearchPhraseCleared = false;
112
- return;
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
- 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
- }
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;AACA;AACA;AACA;AACA;AACA;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,19 +358,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
370
358
  document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
371
359
  }
372
360
  };
373
- this._activateMobileDialog = () => {
374
- if (this.displayMode !== 'dropdown')
375
- return;
376
- this._mobileDialogOpener = document.activeElement;
377
- this.setAttribute('role', 'dialog');
378
- this.setAttribute('aria-modal', 'true');
379
- this.mobileFocusTrapController.activate();
380
- };
381
- this._deactivateMobileDialog = () => {
382
- this.removeAttribute('role');
383
- this.removeAttribute('aria-modal');
384
- this.mobileFocusTrapController.deactivate();
385
- };
386
361
  this._setupAriaAttributes = () => {
387
362
  var _a;
388
363
  if (this._translations.openSearchButtonAriaLabel) {
@@ -391,8 +366,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
391
366
  };
392
367
  this._handleOpenSearch = () => {
393
368
  this.classList.add(SEARCH_CLASS_NAMES.mobileOpened);
394
- if (this.isSearchFocusTrapFixEnabled)
395
- this._activateMobileDialog();
396
369
  const shouldShowMessage = this._searchPhrase !== '';
397
370
  this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
398
371
  const $searchInput = this.querySelector(`
@@ -401,8 +374,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
401
374
  $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
402
375
  };
403
376
  this._handleOpenSearchWithKeyboard = (ev) => {
404
- const isRepeated = this.isSearchFocusTrapFixEnabled ? ev.repeat : false;
405
- if (ev.code !== 'Enter' || isRepeated)
377
+ if (ev.code !== 'Enter')
406
378
  return;
407
379
  ev.preventDefault();
408
380
  this._handleOpenSearch();
@@ -411,10 +383,6 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
411
383
  async connectedCallback() {
412
384
  super.connectedCallback();
413
385
  this._setupContext();
414
- this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
415
- this._setupInitialSearchPhrase();
416
- this._setupListeners();
417
- this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
418
386
  try {
419
387
  this._searchContextConsumer = new ContextConsumerController(this);
420
388
  this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
@@ -443,6 +411,10 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
443
411
  catch (_a) {
444
412
  console.error('Search context is not provided');
445
413
  }
414
+ this._searchInput = this.querySelector(SEARCH_COMPONENT_NAMES.searchInput);
415
+ this._setupInitialSearchPhrase();
416
+ this._setupListeners();
417
+ this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
446
418
  }
447
419
  disconnectedCallback() {
448
420
  var _a;
@@ -514,12 +486,8 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
514
486
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
515
487
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.close, () => {
516
488
  this.classList.remove(SEARCH_CLASS_NAMES.mobileOpened);
517
- if (this.isSearchFocusTrapFixEnabled)
518
- this._deactivateMobileDialog();
519
489
  this._resetSearchView();
520
490
  this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
521
- if (this.isSearchFocusTrapFixEnabled)
522
- requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
523
491
  });
524
492
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
525
493
  const contentLength = this._searchHistory.length;
@@ -638,23 +606,13 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
638
606
  if (!this._togglerElement)
639
607
  return;
640
608
  this._togglerElement.addEventListener('click', this._handleOpenSearch);
641
- if (this.isSearchFocusTrapFixEnabled) {
642
- this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
643
- }
644
- else {
645
- this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
646
- }
609
+ this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
647
610
  }
648
611
  _teardownToggler() {
649
612
  if (!this._togglerElement)
650
613
  return;
651
614
  this._togglerElement.removeEventListener('click', this._handleOpenSearch);
652
- if (this.isSearchFocusTrapFixEnabled) {
653
- this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
654
- }
655
- else {
656
- this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
657
- }
615
+ this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
658
616
  }
659
617
  render() {
660
618
  super.render();
@@ -664,8 +622,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
664
622
  tabindex="0"
665
623
  aria-haspopup="dialog"
666
624
  @click=${this._handleOpenSearch}
667
- @keyup=${this.isSearchFocusTrapFixEnabled ? undefined : this._handleOpenSearchWithKeyboard}
668
- @keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
625
+ @keyup=${this._handleOpenSearchWithKeyboard}
669
626
  >
670
627
  ${n(this._translations.openSearchButtonAriaLabel, () => html `
671
628
  <span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
@@ -735,10 +692,6 @@ __decorate([
735
692
  property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
736
693
  __metadata("design:type", Boolean)
737
694
  ], HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
738
- __decorate([
739
- property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
740
- __metadata("design:type", Boolean)
741
- ], HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
742
695
  __decorate([
743
696
  property({ type: String, attribute: 'display-mode' }),
744
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;
@@ -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, SEARCH_COMPONENT_NAMES } from '../../search_constants.js';
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._shouldShow = ev.detail.searchPhrase !== '';
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;"}
@@ -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;
@@ -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
- 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;
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
- }, 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;
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
- if (this._isSearchPhraseCleared) {
107
- this._isSearchPhraseCleared = false;
108
- return;
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
- 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
- }
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;AACA;AACA;AACA;AACA;AACA;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
@@ -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-7",
5
+ "version": "1.18.24-9",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",
@@ -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;"}
@@ -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
- }
@@ -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,3 +0,0 @@
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
@@ -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,8 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=base_focus_trap_strategy_types.js.map
@@ -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,3 +0,0 @@
1
- export declare type TCyclicFocusTrapStrategyProps = {
2
- getContainer: () => HTMLElement | undefined;
3
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cyclic_focus_trap_strategy_types.js.map
@@ -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,3 +0,0 @@
1
- export declare const FOCUS_TRAP_STRATEGY_TYPES: {
2
- readonly cyclic: "cyclic";
3
- };
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;"}