@shoper/phoenix_design_system 1.18.27-14 → 1.18.27-16

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 (45) hide show
  1. package/build/cjs/packages/phoenix/src/components/form/search/search.js +70 -10
  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/input/search_input.js +51 -22
  4. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/slider/slider.js +16 -52
  6. package/build/cjs/packages/phoenix/src/components/slider/slider.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +44 -0
  8. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +1 -0
  9. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +66 -0
  10. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +1 -0
  11. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +14 -0
  12. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
  13. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +10 -0
  14. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +1 -0
  15. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +6 -0
  16. package/build/esm/packages/phoenix/src/components/form/search/search.js +70 -10
  17. package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
  18. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +1 -0
  19. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +51 -22
  20. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  21. package/build/esm/packages/phoenix/src/components/slider/slider.d.ts +0 -2
  22. package/build/esm/packages/phoenix/src/components/slider/slider.js +16 -52
  23. package/build/esm/packages/phoenix/src/components/slider/slider.js.map +1 -1
  24. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +13 -0
  25. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +40 -0
  26. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +1 -0
  27. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.d.ts +6 -0
  28. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js +3 -0
  29. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js.map +1 -0
  30. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.d.ts +14 -0
  31. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +62 -0
  32. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +1 -0
  33. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +8 -0
  34. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +2 -0
  35. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +1 -0
  36. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +6 -0
  37. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +10 -0
  38. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
  39. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +3 -0
  40. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +2 -0
  41. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +1 -0
  42. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +3 -0
  43. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +6 -0
  44. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +1 -0
  45. package/package.json +2 -2
@@ -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,12 @@ 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
+ if (this.isSearchFocusTrapFixEnabled) {
418
+ this._setupInitialSearchPhrase();
419
+ this._setupListeners();
420
+ this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
421
+ }
390
422
  try {
391
423
  this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
392
424
  this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
@@ -415,10 +447,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
415
447
  catch (_a) {
416
448
  console.error('Search context is not provided');
417
449
  }
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
+ if (!this.isSearchFocusTrapFixEnabled) {
451
+ this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
452
+ this._setupInitialSearchPhrase();
453
+ this._setupListeners();
454
+ this.isSearchIconFixEnabled ? this._setupToggler() : this._setupAriaAttributes();
455
+ }
422
456
  }
423
457
  disconnectedCallback() {
424
458
  var _a;
@@ -490,8 +524,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
490
524
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
491
525
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.close, () => {
492
526
  this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
527
+ if (this.isSearchFocusTrapFixEnabled)
528
+ this._deactivateMobileDialog();
493
529
  this._resetSearchView();
494
530
  this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
531
+ if (this.isSearchFocusTrapFixEnabled)
532
+ requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
495
533
  });
496
534
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
497
535
  const contentLength = this._searchHistory.length;
@@ -598,8 +636,15 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
598
636
  this._setActiveItemId(`${this._id}-1`);
599
637
  const searchBar = this.querySelector(`.${search_constants.SEARCH_CLASS_NAMES.searchBar}`);
600
638
  searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(search_constants.SEARCH_CLASS_NAMES.outline);
601
- if (this.displayMode === 'dropdown')
602
- this._hideHistorySuggestionsAndResults();
639
+ if (this.displayMode === 'dropdown') {
640
+ const isMobileViewOpen = this.classList.contains(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
641
+ if (isMobileViewOpen) {
642
+ this._displaySuggester(this._searchPhrase);
643
+ }
644
+ else {
645
+ this._hideHistorySuggestionsAndResults();
646
+ }
647
+ }
603
648
  !this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
604
649
  }
605
650
  _submitSearchPhrase(searchPhrase) {
@@ -610,13 +655,23 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
610
655
  if (!this._togglerElement)
611
656
  return;
612
657
  this._togglerElement.addEventListener('click', this._handleOpenSearch);
613
- this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
658
+ if (this.isSearchFocusTrapFixEnabled) {
659
+ this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
660
+ }
661
+ else {
662
+ this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
663
+ }
614
664
  }
615
665
  _teardownToggler() {
616
666
  if (!this._togglerElement)
617
667
  return;
618
668
  this._togglerElement.removeEventListener('click', this._handleOpenSearch);
619
- this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
669
+ if (this.isSearchFocusTrapFixEnabled) {
670
+ this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
671
+ }
672
+ else {
673
+ this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
674
+ }
620
675
  }
621
676
  render() {
622
677
  super.render();
@@ -626,7 +681,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
626
681
  tabindex="0"
627
682
  aria-haspopup="dialog"
628
683
  @click=${this._handleOpenSearch}
629
- @keyup=${this._handleOpenSearchWithKeyboard}
684
+ @keyup=${this.isSearchFocusTrapFixEnabled ? undefined : this._handleOpenSearchWithKeyboard}
685
+ @keydown=${this.isSearchFocusTrapFixEnabled ? this._handleOpenSearchWithKeyboard : undefined}
630
686
  >
631
687
  ${when.when(this._translations.openSearchButtonAriaLabel, () => lit.html `
632
688
  <span id="${this._openSearchButtonAriaLabelId}" class="sr-only">
@@ -696,6 +752,10 @@ tslib_es6.__decorate([
696
752
  decorators.property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
697
753
  tslib_es6.__metadata("design:type", Boolean)
698
754
  ], exports.HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
755
+ tslib_es6.__decorate([
756
+ decorators.property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
757
+ tslib_es6.__metadata("design:type", Boolean)
758
+ ], exports.HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
699
759
  tslib_es6.__decorate([
700
760
  decorators.property({ type: String, attribute: 'display-mode' }),
701
761
  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;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;"}
@@ -15,7 +15,6 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
15
15
  super(...arguments);
16
16
  this.settings = '';
17
17
  this.id = '';
18
- this.isSliderOptimizationFlagEnabled = false;
19
18
  this._settings = {
20
19
  mountOnConnectedCallback: true,
21
20
  type: 'loop',
@@ -23,8 +22,7 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
23
22
  focus: 'center'
24
23
  };
25
24
  this._slider = null;
26
- this._mutationObserver = null;
27
- this._$focusableElements = new Set();
25
+ this._$focusableElements = [];
28
26
  this._showFocusableNodes = (slideComponent) => {
29
27
  this._handleFocusableNodes(slideComponent, slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show);
30
28
  };
@@ -32,47 +30,27 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
32
30
  this._handleFocusableNodes(slideComponent, slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.hide);
33
31
  };
34
32
  this._handleFocusableNodes = ({ slide }, action) => {
35
- const $focusableSlideChildren = [...this._$focusableElements].filter(($focusableElement) => slide.contains($focusableElement));
33
+ const $focusableSlideChildren = this._$focusableElements.filter(($focusableElement) => slide.contains($focusableElement));
36
34
  if ($focusableSlideChildren.length === 0)
37
35
  return;
38
- let updateFocusability;
39
- if (this.isSliderOptimizationFlagEnabled) {
40
- updateFocusability = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? utilities.UiDomUtils.showFocusableElement : utilities.UiDomUtils.hideFocusableElement;
41
- }
42
- else {
43
- updateFocusability = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? this._showFocusableElement : this._hideFocusableElement;
44
- }
36
+ const updateFocusability = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? this._showFocusableElement : this._hideFocusableElement;
45
37
  $focusableSlideChildren.forEach(($element) => updateFocusability($element));
46
38
  };
47
39
  this._scanMutationsForNewFocusableElements = (mutationList) => {
48
- if (this.isSliderOptimizationFlagEnabled) {
49
- for (const mutation of mutationList) {
50
- for (const addedNode of mutation.addedNodes) {
51
- if (!(addedNode instanceof HTMLElement))
52
- continue;
53
- if (utilities.UiDomUtils.isFocusable(addedNode))
54
- this._initializeFocusableElement(addedNode);
55
- const $focusableChildren = [...addedNode.querySelectorAll(utilities.UiDomUtils.getFocusableSelector())];
56
- $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
57
- }
58
- }
59
- }
60
- else {
61
- for (const mutation of mutationList) {
62
- if (mutation.type !== 'childList')
63
- continue;
64
- const $target = mutation.target;
65
- const isFocusable = utilities.UiDomUtils.isFocusable($target);
66
- const $focusableChildren = [...$target.querySelectorAll(utilities.UiDomUtils.getFocusableSelector())];
67
- isFocusable && this._initializeFocusableElement($target);
68
- $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
69
- }
40
+ for (const mutation of mutationList) {
41
+ if (mutation.type !== 'childList')
42
+ continue;
43
+ const $target = mutation.target;
44
+ const isFocusable = utilities.UiDomUtils.isFocusable($target);
45
+ const $focusableChildren = [...$target.querySelectorAll(utilities.UiDomUtils.getFocusableSelector())];
46
+ isFocusable && this._initializeFocusableElement($target);
47
+ $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
70
48
  }
71
49
  };
72
50
  this._initializeFocusableElement = ($element) => {
73
- !this._$focusableElements.has($element) && this._$focusableElements.add($element);
51
+ !this._$focusableElements.includes($element) && this._$focusableElements.push($element);
74
52
  if ($element.closest('[aria-hidden="true"]')) {
75
- utilities.UiDomUtils.hideFocusableElement($element);
53
+ this._hideFocusableElement($element);
76
54
  }
77
55
  };
78
56
  }
@@ -96,14 +74,8 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
96
74
  }
97
75
  this._slider.on('visible', this._showFocusableNodes);
98
76
  this._slider.on('hidden', this._hideFocusableNodes);
99
- if (this.isSliderOptimizationFlagEnabled) {
100
- this._mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
101
- this._mutationObserver.observe(this, { childList: true, subtree: true });
102
- }
103
- else {
104
- const mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
105
- mutationObserver.observe(this, { childList: true, subtree: true, attributes: true });
106
- }
77
+ const mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
78
+ mutationObserver.observe(this, { childList: true, subtree: true, attributes: true });
107
79
  }
108
80
  _showFocusableElement($element) {
109
81
  $element.setAttribute('tabindex', '0');
@@ -117,14 +89,10 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
117
89
  return this._slider;
118
90
  }
119
91
  disconnectedCallback() {
120
- var _a, _b, _c;
92
+ var _a, _b;
121
93
  super.disconnectedCallback();
122
94
  (_a = this._slider) === null || _a === void 0 ? void 0 : _a.off('visible');
123
95
  (_b = this._slider) === null || _b === void 0 ? void 0 : _b.off('hidden');
124
- if (this.isSliderOptimizationFlagEnabled) {
125
- (_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
126
- this._mutationObserver = null;
127
- }
128
96
  }
129
97
  };
130
98
  tslib_es6.__decorate([
@@ -135,10 +103,6 @@ tslib_es6.__decorate([
135
103
  decorators.property(),
136
104
  tslib_es6.__metadata("design:type", String)
137
105
  ], exports.HSlider.prototype, "id", void 0);
138
- tslib_es6.__decorate([
139
- decorators.property({ attribute: 'is-slider-optimization-flag-enabled' }),
140
- tslib_es6.__metadata("design:type", Boolean)
141
- ], exports.HSlider.prototype, "isSliderOptimizationFlagEnabled", void 0);
142
106
  exports.HSlider = tslib_es6.__decorate([
143
107
  phoenix_custom_element.phoenixCustomElement('h-slider')
144
108
  ], exports.HSlider);
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA,yBAAyB,gEAAoE;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4CAAgD;AACxE;AACA;AACA;AACA;AACA,yBAAyB,gEAAoE;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,44 @@
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
+ default: return new cyclic_focus_trap_strategy.CyclicFocusTrapStrategy(props);
40
+ }
41
+ };
42
+
43
+ exports.FocusTrapController = FocusTrapController;
44
+ //# 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;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;