@shoper/phoenix_design_system 1.18.28 → 1.18.29-0

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/color_swatches/color_swatches.js +0 -41
  2. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/form/search/search.js +68 -9
  4. package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +51 -22
  6. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/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/cjs/packages/phoenix/src/index.js +7 -7
  16. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +0 -5
  17. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +0 -41
  18. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  19. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +6 -0
  20. package/build/esm/packages/phoenix/src/components/form/search/search.js +68 -9
  21. package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
  22. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +1 -0
  23. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +51 -22
  24. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  25. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +13 -0
  26. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +40 -0
  27. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +1 -0
  28. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.d.ts +6 -0
  29. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js +3 -0
  30. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js.map +1 -0
  31. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.d.ts +14 -0
  32. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +62 -0
  33. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +1 -0
  34. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +8 -0
  35. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +2 -0
  36. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +1 -0
  37. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +6 -0
  38. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +10 -0
  39. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
  40. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +3 -0
  41. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +2 -0
  42. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +1 -0
  43. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +3 -0
  44. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +6 -0
  45. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +1 -0
  46. package/build/esm/packages/phoenix/src/index.js +1 -1
  47. package/package.json +1 -1
@@ -3,13 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- var lit = require('lit');
7
6
  var decorators = require('lit/decorators');
8
7
  var utilities = require('@dreamcommerce/utilities');
9
8
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
10
9
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
11
10
  var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
12
- require('lit-html');
13
11
  var color_swatches_constants = require('./color_swatches_constants.js');
14
12
  var color_item_constants = require('./color_item/color_item_constants.js');
15
13
  var color_item = require('./color_item/color_item.js');
@@ -18,7 +16,6 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
18
16
  constructor() {
19
17
  super(...arguments);
20
18
  this.multiple = false;
21
- this.devVisualSubcategories = false;
22
19
  this.selectedColors = [];
23
20
  this.showMoreBtnText = 'Pokaż wszystkie kolory';
24
21
  this._setupEvents = () => {
@@ -142,10 +139,6 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
142
139
  this._$colorSwatchesChildren = [...this.children];
143
140
  this._setupEvents();
144
141
  this._addCssClasses();
145
- if (!this.devVisualSubcategories) {
146
- this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
147
- this._showAllItemsEvent();
148
- }
149
142
  this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
150
143
  this._$colors = [...this.querySelectorAll('h-color-item')];
151
144
  }
@@ -153,26 +146,6 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
153
146
  this.querySelectorAll(color_swatches_constants.COLOR_ITEM_TAG_NAME).forEach(($colorItem) => $colorItem.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
154
147
  this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
155
148
  }
156
- _hideItems(numberOfVisibleColors) {
157
- if (!this._$colorSwatchesChildren)
158
- return;
159
- this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
160
- if (index > numberOfVisibleColors - 1) {
161
- $colorSwatchesChild.setAttribute('hidden', '');
162
- }
163
- });
164
- }
165
- _showAllItemsEvent() {
166
- this.addEventListener(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.showMore, () => {
167
- var _a;
168
- if (!this._$colorSwatchesChildren)
169
- return;
170
- this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
171
- $colorSwatchesChild.removeAttribute('hidden');
172
- });
173
- (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
174
- });
175
- }
176
149
  _handleChangeToNextColorItem({ target }) {
177
150
  const $colorItem = target;
178
151
  const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement($colorItem);
@@ -238,25 +211,11 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
238
211
  super.disconnectedCallback();
239
212
  document.body.removeEventListener('keydown', this._focusOnSelectedColor);
240
213
  }
241
- render() {
242
- if (!this.devVisualSubcategories) {
243
- return lit.html `
244
- ${this.getSlot('default')}
245
- ${this._$colors.length > this.numberOfVisibleColors
246
- ? lit.html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
247
- : lit.nothing}
248
- `;
249
- }
250
- }
251
214
  };
252
215
  tslib_es6.__decorate([
253
216
  decorators.property({ type: Boolean }),
254
217
  tslib_es6.__metadata("design:type", Boolean)
255
218
  ], exports.HColorSwatches.prototype, "multiple", void 0);
256
- tslib_es6.__decorate([
257
- decorators.property({ type: Boolean, attribute: 'dev-visual-subcategories' }),
258
- tslib_es6.__metadata("design:type", Boolean)
259
- ], exports.HColorSwatches.prototype, "devVisualSubcategories", void 0);
260
219
  tslib_es6.__decorate([
261
220
  decorators.property({ type: Number, attribute: 'number-of-visible-colors' }),
262
221
  tslib_es6.__metadata("design:type", Number)
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,17 +19,25 @@ var modal_constants = require('../../modal/modal_constants.js');
19
19
  var sheet_constants = require('../../sheet/sheet_constants.js');
20
20
  var when = require('../../../../../../external/lit-html/directives/when.js');
21
21
  var search_constants = require('./search_constants.js');
22
+ var focus_trap_strategy_constants = require('../../../controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js');
23
+ var focus_trap_controller = require('../../../controllers/focus_trap_controller/focus_trap_controller.js');
22
24
 
23
25
  exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLitElement {
24
26
  constructor() {
25
27
  super(...arguments);
26
28
  this.view = search_constants.DEFAULT_VIEW;
27
29
  this.isSearchUxFixesFlagEnabled = false;
30
+ this.isSearchFocusTrapFixEnabled = false;
28
31
  this.displayMode = 'dropdown';
29
32
  this._togglerElement = null;
33
+ this._mobileDialogOpener = null;
30
34
  this._id = v4['default']();
31
35
  this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
32
36
  this._searchContentContainerId = v4['default']();
37
+ this.mobileFocusTrapController = new focus_trap_controller.FocusTrapController(this, {
38
+ mode: focus_trap_strategy_constants.FOCUS_TRAP_STRATEGY_TYPES.cyclic,
39
+ getContainer: () => this
40
+ });
33
41
  this._searchResultsRef = ref_js.createRef();
34
42
  this._searchHistoryRef = ref_js.createRef();
35
43
  this._searchMessageRef = ref_js.createRef();
@@ -325,6 +333,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
325
333
  if (window.innerWidth > global_constants.BREAKPOINTS.sm) {
326
334
  const hasBeenOpened = this.classList.contains(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
327
335
  this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
336
+ if (this.isSearchFocusTrapFixEnabled)
337
+ this._deactivateMobileDialog();
328
338
  if (hasBeenOpened && this.displayMode !== 'dropdown') {
329
339
  const $storefrontSearch = document.querySelector(`h-storefront-search[module-instance-id="${this.moduleInstanceId}"]`);
330
340
  const searchOverlayTriggerName = (_a = $storefrontSearch === null || $storefrontSearch === void 0 ? void 0 : $storefrontSearch.querySelector('[aria-haspopup="dialog"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('name');
@@ -340,6 +350,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
340
350
  };
341
351
  this._openMobileView = () => {
342
352
  this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
353
+ if (this.isSearchFocusTrapFixEnabled)
354
+ this._activateMobileDialog();
343
355
  };
344
356
  this._isSuggesterLayerVisible = () => {
345
357
  var _a;
@@ -360,8 +372,21 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
360
372
  document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
361
373
  }
362
374
  };
375
+ this._activateMobileDialog = () => {
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
+ };
363
386
  this._handleOpenSearch = () => {
364
387
  this.classList.add(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
388
+ if (this.isSearchFocusTrapFixEnabled)
389
+ this._activateMobileDialog();
365
390
  const shouldShowMessage = this._searchPhrase !== '';
366
391
  this._updateSearchView(this._searchPhrase, shouldShowMessage, false);
367
392
  const $searchInput = this.querySelector(`
@@ -370,7 +395,8 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
370
395
  $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
371
396
  };
372
397
  this._handleOpenSearchWithKeyboard = (ev) => {
373
- if (ev.code !== 'Enter')
398
+ const isRepeated = this.isSearchFocusTrapFixEnabled ? ev.repeat : false;
399
+ if (ev.code !== 'Enter' || isRepeated)
374
400
  return;
375
401
  ev.preventDefault();
376
402
  this._handleOpenSearch();
@@ -379,6 +405,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
379
405
  async connectedCallback() {
380
406
  super.connectedCallback();
381
407
  this._setupContext();
408
+ this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
409
+ if (this.isSearchFocusTrapFixEnabled) {
410
+ this._setupInitialSearchPhrase();
411
+ this._setupListeners();
412
+ this._setupToggler();
413
+ }
382
414
  try {
383
415
  this._searchContextConsumer = new context_consumer_controller.ContextConsumerController(this);
384
416
  this._searchContext$ = await this._searchContextConsumer.consumeAsync(this.moduleInstanceId);
@@ -407,10 +439,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
407
439
  catch (_a) {
408
440
  console.error('Search context is not provided');
409
441
  }
410
- this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
411
- this._setupInitialSearchPhrase();
412
- this._setupListeners();
413
- this._setupToggler();
442
+ if (!this.isSearchFocusTrapFixEnabled) {
443
+ this._searchInput = this.querySelector(search_constants.SEARCH_COMPONENT_NAMES.searchInput);
444
+ this._setupInitialSearchPhrase();
445
+ this._setupListeners();
446
+ this._setupToggler();
447
+ }
414
448
  }
415
449
  disconnectedCallback() {
416
450
  var _a;
@@ -481,8 +515,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
481
515
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.submit, this._handleSubmitForm);
482
516
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.close, () => {
483
517
  this.classList.remove(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
518
+ if (this.isSearchFocusTrapFixEnabled)
519
+ this._deactivateMobileDialog();
484
520
  this._resetSearchView();
485
521
  this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
522
+ if (this.isSearchFocusTrapFixEnabled)
523
+ requestAnimationFrame(() => { var _a; return (_a = this._mobileDialogOpener) === null || _a === void 0 ? void 0 : _a.focus(); });
486
524
  });
487
525
  this.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.loadMoreHistoryItems, () => {
488
526
  const contentLength = this._searchHistory.length;
@@ -589,8 +627,15 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
589
627
  this._setActiveItemId(`${this._id}-1`);
590
628
  const searchBar = this.querySelector(`.${search_constants.SEARCH_CLASS_NAMES.searchBar}`);
591
629
  searchBar === null || searchBar === void 0 ? void 0 : searchBar.classList.remove(search_constants.SEARCH_CLASS_NAMES.outline);
592
- if (this.displayMode === 'dropdown')
593
- this._hideHistorySuggestionsAndResults();
630
+ if (this.displayMode === 'dropdown') {
631
+ const isMobileViewOpen = this.classList.contains(search_constants.SEARCH_CLASS_NAMES.mobileOpened);
632
+ if (isMobileViewOpen) {
633
+ this._displaySuggester(this._searchPhrase);
634
+ }
635
+ else {
636
+ this._hideHistorySuggestionsAndResults();
637
+ }
638
+ }
594
639
  !this.isSearchUxFixesFlagEnabled && this._removeSearchKeyboardNavigation();
595
640
  }
596
641
  _submitSearchPhrase(searchPhrase) {
@@ -601,13 +646,23 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
601
646
  if (!this._togglerElement)
602
647
  return;
603
648
  this._togglerElement.addEventListener('click', this._handleOpenSearch);
604
- this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
649
+ if (this.isSearchFocusTrapFixEnabled) {
650
+ this._togglerElement.addEventListener('keydown', this._handleOpenSearchWithKeyboard);
651
+ }
652
+ else {
653
+ this._togglerElement.addEventListener('keyup', this._handleOpenSearchWithKeyboard);
654
+ }
605
655
  }
606
656
  _teardownToggler() {
607
657
  if (!this._togglerElement)
608
658
  return;
609
659
  this._togglerElement.removeEventListener('click', this._handleOpenSearch);
610
- this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
660
+ if (this.isSearchFocusTrapFixEnabled) {
661
+ this._togglerElement.removeEventListener('keydown', this._handleOpenSearchWithKeyboard);
662
+ }
663
+ else {
664
+ this._togglerElement.removeEventListener('keyup', this._handleOpenSearchWithKeyboard);
665
+ }
611
666
  }
612
667
  render() {
613
668
  super.render();
@@ -668,6 +723,10 @@ tslib_es6.__decorate([
668
723
  decorators.property({ type: Boolean, attribute: 'is-search-ux-fixes-flag-enabled' }),
669
724
  tslib_es6.__metadata("design:type", Boolean)
670
725
  ], exports.HSearch.prototype, "isSearchUxFixesFlagEnabled", void 0);
726
+ tslib_es6.__decorate([
727
+ decorators.property({ type: Boolean, attribute: 'is-search-focus-trap-fix-enabled' }),
728
+ tslib_es6.__metadata("design:type", Boolean)
729
+ ], exports.HSearch.prototype, "isSearchFocusTrapFixEnabled", void 0);
671
730
  tslib_es6.__decorate([
672
731
  decorators.property({ type: String, attribute: 'display-mode' }),
673
732
  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,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;"}
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,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;"}
@@ -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;"}
@@ -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;"}
@@ -87,7 +87,6 @@ var toggle_button = require('./components/groups/toggle_button_group/toggle_butt
87
87
  var click_outside_controller_messages = require('./controllers/click_outside_controller/click_outside_controller_messages.js');
88
88
  var backdrop = require('./components/backdrop/backdrop.js');
89
89
  var color_swatches_control_constants = require('./components/form/color_swatches_control/color_swatches_control_constants.js');
90
- var show_more_button = require('./components/show-more/show_more_button.js');
91
90
  var color_swatches = require('./components/color_swatches/color_swatches.js');
92
91
  var color_item = require('./components/color_swatches/color_item/color_item.js');
93
92
  var color_swatches_control = require('./components/form/color_swatches_control/color_swatches_control.js');
@@ -133,6 +132,7 @@ var toggle = require('./components/toggle/toggle.js');
133
132
  var toggle_button$1 = require('./components/toggle/toggle_button.js');
134
133
  var navigator_share = require('./components/navigator/navigator_share/navigator_share.js');
135
134
  var navigator_controller = require('./components/navigator/navigator_controller/navigator_controller.js');
135
+ var show_more_button = require('./components/show-more/show_more_button.js');
136
136
  var show_more$1 = require('./components/show-more/show_more.js');
137
137
 
138
138
 
@@ -522,12 +522,6 @@ Object.defineProperty(exports, 'HBackdrop', {
522
522
  }
523
523
  });
524
524
  exports.COLOR_SWATCHES_CONTROL_EVENT_NAMES = color_swatches_control_constants.COLOR_SWATCHES_CONTROL_EVENT_NAMES;
525
- Object.defineProperty(exports, 'HShowMoreButton', {
526
- enumerable: true,
527
- get: function () {
528
- return show_more_button.HShowMoreButton;
529
- }
530
- });
531
525
  Object.defineProperty(exports, 'HColorSwatches', {
532
526
  enumerable: true,
533
527
  get: function () {
@@ -785,6 +779,12 @@ Object.defineProperty(exports, 'NavigatorController', {
785
779
  return navigator_controller.NavigatorController;
786
780
  }
787
781
  });
782
+ Object.defineProperty(exports, 'HShowMoreButton', {
783
+ enumerable: true,
784
+ get: function () {
785
+ return show_more_button.HShowMoreButton;
786
+ }
787
+ });
788
788
  Object.defineProperty(exports, 'HShowMore', {
789
789
  enumerable: true,
790
790
  get: function () {
@@ -1,9 +1,7 @@
1
1
  import { HColorItem } from "./color_item/color_item";
2
2
  import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
3
- import { TemplateResult } from 'lit-html';
4
3
  export declare class HColorSwatches extends PhoenixLightLitElement {
5
4
  multiple: boolean;
6
- devVisualSubcategories: boolean;
7
5
  numberOfVisibleColors: number;
8
6
  selectedColors: HColorItem[];
9
7
  showMoreBtnText: string;
@@ -13,8 +11,6 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
13
11
  clearAllColors(): void;
14
12
  connectedCallback(): void;
15
13
  private _addCssClasses;
16
- private _hideItems;
17
- private _showAllItemsEvent;
18
14
  private _setupEvents;
19
15
  private _setupCheckboxGroupEvents;
20
16
  private _setupRadioGroupEvents;
@@ -34,5 +30,4 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
34
30
  private _removeExistingColorFromArray;
35
31
  private _dispatchColorChangeEvent;
36
32
  disconnectedCallback(): void;
37
- protected render(): TemplateResult | void;
38
33
  }