@shoper/phoenix_design_system 1.15.6-4 → 1.15.6-5

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 (43) hide show
  1. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +2 -9
  2. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -6
  4. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/search/search.js +11 -0
  6. package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_close.js +20 -0
  8. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_close.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js +0 -30
  10. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +2 -1
  12. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/form/select/select.js +8 -49
  14. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  15. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +15 -62
  16. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  17. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +0 -1
  18. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +2 -9
  19. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  20. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +0 -1
  21. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -6
  22. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  23. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +1 -0
  24. package/build/esm/packages/phoenix/src/components/form/search/search.js +11 -0
  25. package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
  26. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_close.d.ts +3 -0
  27. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_close.js +20 -0
  28. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_close.js.map +1 -1
  29. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +0 -4
  30. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +0 -30
  31. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  32. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +2 -1
  33. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  34. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +2 -7
  35. package/build/esm/packages/phoenix/src/components/form/select/select.js +8 -49
  36. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  37. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.d.ts +2 -6
  38. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js +0 -1
  39. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js.map +1 -1
  40. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.d.ts +3 -7
  41. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +15 -62
  42. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  43. package/package.json +1 -1
@@ -12,7 +12,6 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
12
12
  constructor() {
13
13
  super();
14
14
  this.name = '';
15
- this.ariaHasPopup = 'menu';
16
15
  this._setupTogglerAria = () => {
17
16
  this._$dropdown = this.closest(DROPDOWN_CONTAINER_NAME);
18
17
  if (this._$dropdown.isOpened)
@@ -20,7 +19,7 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
20
19
  host: this,
21
20
  initialAriaExpandedValue: this._$dropdown.isOpened()
22
21
  });
23
- this.setAttribute('aria-haspopup', this.ariaHasPopup);
22
+ this.setAttribute('aria-haspopup', 'true');
24
23
  if (this._$dropdown.id)
25
24
  this.setAttribute('aria-controls', this._$dropdown.id);
26
25
  };
@@ -57,10 +56,6 @@ __decorate([
57
56
  property({ type: String, reflect: true }),
58
57
  __metadata("design:type", Object)
59
58
  ], HDropdownToggler.prototype, "name", void 0);
60
- __decorate([
61
- property({ type: String, attribute: 'aria-haspopup' }),
62
- __metadata("design:type", Object)
63
- ], HDropdownToggler.prototype, "ariaHasPopup", void 0);
64
59
  HDropdownToggler = __decorate([
65
60
  phoenixCustomElement('h-dropdown-toggler'),
66
61
  __metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -72,6 +72,7 @@ export declare class HSearch extends PhoenixLightLitElement {
72
72
  private _switchTypeOfSearchView;
73
73
  private _isSuggesterLayerVisible;
74
74
  private _preventSubmitOnSearchClear;
75
+ private _resetSearchOnFocusOutside;
75
76
  private _setupAriaAttributes;
76
77
  private _handleOpenSearch;
77
78
  private _handleOpenSearchWithKeyboard;
@@ -274,6 +274,15 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
274
274
  ev.preventDefault();
275
275
  }
276
276
  };
277
+ this._resetSearchOnFocusOutside = (ev) => {
278
+ const $target = ev.target;
279
+ const isContainedWithinSearch = this === $target || this.contains($target);
280
+ if (!isContainedWithinSearch) {
281
+ this._resetSearchView();
282
+ this._removeSearchKeyboardNavigation();
283
+ document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
284
+ }
285
+ };
277
286
  this._setupAriaAttributes = () => {
278
287
  var _a;
279
288
  if (this._translations.openSearchButtonAriaLabel) {
@@ -321,6 +330,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
321
330
  super.disconnectedCallback();
322
331
  document.removeEventListener('click', this._hideSuggesterOnClickOutside);
323
332
  document.removeEventListener('keydown', this._preventScrollingOnSearchContentBrowsing);
333
+ document.removeEventListener('focusin', this._resetSearchOnFocusOutside);
324
334
  window.removeEventListener('resize', this._switchTypeOfSearchView);
325
335
  this._searchForm.removeEventListener('keydown', this._preventSubmitOnSearchClear);
326
336
  }
@@ -365,6 +375,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
365
375
  document.addEventListener('keydown', this._bindKeys);
366
376
  document.addEventListener('keyup', this._handleSearchTabNavigation);
367
377
  document.addEventListener('keydown', this._preventScrollingOnSearchContentBrowsing);
378
+ document.addEventListener('focusin', this._resetSearchOnFocusOutside);
368
379
  });
369
380
  this.addEventListener(SEARCH_CUSTOM_EVENT_NAMES.keyup, (ev) => {
370
381
  const shouldShowMessage = ev.detail.searchPhrase !== '';
@@ -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,0BAA0B,qEAA6E;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,0BAA0B,qEAA6E;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -4,4 +4,7 @@ export declare class HSearchClose extends PhoenixLightLitElement {
4
4
  constructor();
5
5
  connectedCallback(): void;
6
6
  private _dispatchCloseEvent;
7
+ private _throttledToggleSearchCloseAria;
8
+ private _toggleSearchCloseAria;
9
+ disconnectedCallback(): void;
7
10
  }
@@ -2,6 +2,9 @@ import { __decorate, __metadata } from '../../../../../../../../external/tslib/t
2
2
  import { PhoenixLightLitElement } from '../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
3
3
  import { phoenixCustomElement } from '../../../../../core/decorators/phoenix_custom_element.js';
4
4
  import { BtnController } from '../../../../../controllers/btn_controller/btn_controller.js';
5
+ import { BREAKPOINTS } from '../../../../../global_constants.js';
6
+ import { DEFAULT_THROTTLE_WAIT_TIME } from '../../../../../controllers/relative_position_controller/relative_position_controller_constants.js';
7
+ import throttle_1 from '../../../../../../../../external/lodash/throttle.js';
5
8
  import { SEARCH_CUSTOM_EVENT_NAMES, SEARCH_COMPONENT_NAMES } from '../../search_constants.js';
6
9
 
7
10
  let HSearchClose = class HSearchClose extends PhoenixLightLitElement {
@@ -10,11 +13,28 @@ let HSearchClose = class HSearchClose extends PhoenixLightLitElement {
10
13
  this._dispatchCloseEvent = () => {
11
14
  this.emitCustomEvent(SEARCH_CUSTOM_EVENT_NAMES.close);
12
15
  };
16
+ this._throttledToggleSearchCloseAria = throttle_1(() => {
17
+ this._toggleSearchCloseAria();
18
+ }, DEFAULT_THROTTLE_WAIT_TIME);
19
+ this._toggleSearchCloseAria = () => {
20
+ if (window.innerWidth < BREAKPOINTS.xs) {
21
+ this.setAttribute('tabindex', '0');
22
+ this.removeAttribute('aria-hidden');
23
+ return;
24
+ }
25
+ this.setAttribute('tabindex', '-1');
26
+ this.setAttribute('aria-hidden', 'true');
27
+ };
13
28
  this._btnController = new BtnController(this, this._dispatchCloseEvent);
14
29
  }
15
30
  connectedCallback() {
16
31
  super.connectedCallback();
17
32
  this.addEventListener('click', this._dispatchCloseEvent);
33
+ window.addEventListener('resize', this._throttledToggleSearchCloseAria);
34
+ }
35
+ disconnectedCallback() {
36
+ super.disconnectedCallback();
37
+ window.removeEventListener('resize', this._throttledToggleSearchCloseAria);
18
38
  }
19
39
  };
20
40
  HSearchClose = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;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,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;"}
@@ -2,11 +2,7 @@ import { PhoenixLightLitElement } from "../../../../../core/phoenix_light_lit_el
2
2
  import { TemplateResult } from 'lit';
3
3
  export declare class HSelectSearch extends PhoenixLightLitElement {
4
4
  value: string;
5
- private _$selectOptions;
6
5
  connectedCallback(): void;
7
- private _handleSearchKeydown;
8
- private _handleDispatchEventOnOptionsList;
9
- private _handleFocusOptionOnArrowNavigation;
10
6
  private _handleInputChange;
11
7
  protected render(): TemplateResult;
12
8
  }
@@ -1,7 +1,6 @@
1
1
  import { __decorate, __metadata } from '../../../../../../../../external/tslib/tslib.es6.js';
2
2
  import { html } from 'lit';
3
3
  import { property } from 'lit/decorators';
4
- import '@dreamcommerce/utilities';
5
4
  import { PhoenixLightLitElement } from '../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
6
5
  import { phoenixCustomElement } from '../../../../../core/decorators/phoenix_custom_element.js';
7
6
  import { SELECT_SEARCH_EVENT_NAMES, SELECT_RELATED_COMPONENTS_NAMES } from '../select_components_constatns.js';
@@ -12,32 +11,6 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
12
11
  constructor() {
13
12
  super(...arguments);
14
13
  this.value = '';
15
- this._$selectOptions = null;
16
- this._handleSearchKeydown = (ev) => {
17
- if (ev.key !== 'ArrowDown' && ev.key !== 'ArrowUp')
18
- return;
19
- this._handleFocusOptionOnArrowNavigation();
20
- this._handleDispatchEventOnOptionsList(ev);
21
- };
22
- this._handleDispatchEventOnOptionsList = (ev) => {
23
- var _a;
24
- const arrowNavigationEvent = new KeyboardEvent('keydown', {
25
- key: ev.key
26
- });
27
- (_a = this._$selectOptions) === null || _a === void 0 ? void 0 : _a.dispatchEvent(arrowNavigationEvent);
28
- };
29
- this._handleFocusOptionOnArrowNavigation = () => {
30
- const $options = this._$selectOptions ? [...this._$selectOptions.querySelectorAll('h-option')] : [];
31
- const $availableOptions = $options.filter(($option) => {
32
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
33
- });
34
- const $firstOption = $availableOptions.find(($option) => {
35
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
36
- });
37
- const $selectedOption = $availableOptions.find(($option) => $option.getAttribute('aria-selected'));
38
- const $optionToFocus = $selectedOption || $firstOption;
39
- $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
40
- };
41
14
  this._handleInputChange = debounce_1(({ target }) => {
42
15
  this.value = target.value;
43
16
  this.emitCustomEvent(SELECT_SEARCH_EVENT_NAMES.search, {
@@ -48,9 +21,6 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
48
21
  connectedCallback() {
49
22
  super.connectedCallback();
50
23
  this.classList.add(SELECT_SEARCH_CSS_CLASSES.selectSearch);
51
- // to musisz zrobić inaczej, bo jest kilka selectów na stronie
52
- this._$selectOptions = document.querySelector('h-options');
53
- this.addEventListener('keydown', this._handleSearchKeydown);
54
24
  }
55
25
  render() {
56
26
  return html `
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;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;"}
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import '@dreamcommerce/utilities';
2
+ import { UiDomUtils } from '@dreamcommerce/utilities';
3
3
  import { PhoenixLightLitElement } from '../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
4
4
  import { phoenixCustomElement } from '../../../../core/decorators/phoenix_custom_element.js';
5
5
  import { SELECT_OPTIONS_EVENT_NAMES, SELECT_OPTION_EVENT_NAMES, SELECT_RELATED_COMPONENTS_NAMES } from './select_components_constatns.js';
@@ -22,6 +22,7 @@ let HOptions = class HOptions extends PhoenixLightLitElement {
22
22
  });
23
23
  };
24
24
  this.setAttribute('role', 'listbox');
25
+ UiDomUtils.makeNavigable(this);
25
26
  this.addEventListener(SELECT_OPTION_EVENT_NAMES.clicked, this._dispatchClickedEvent);
26
27
  this.addEventListener(SELECT_OPTION_EVENT_NAMES.updated, this._dispatchUpdatedEvent);
27
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,kDAAsD;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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,kDAAsD;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;"}
@@ -1,7 +1,5 @@
1
1
  import { PropertyValues, TemplateResult } from 'lit';
2
2
  import { HOption } from "./components/option/select_option";
3
- import { HSelectSearch } from "./components/search/select_search";
4
- import { ListBoxKeyboardController } from "../../../controllers/list_box_controller/list_box_keyboard_controller";
5
3
  import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
6
4
  import { SelectOption } from "./model/select_option";
7
5
  import type { TSelectType } from "./select_types";
@@ -31,16 +29,14 @@ export declare class HSelect extends PhoenixLightLitElement {
31
29
  private _selectController;
32
30
  private _$options;
33
31
  private _$dropdown;
34
- $search: import("lit-html/directives/ref.js").Ref<HSelectSearch>;
32
+ private _$search;
35
33
  private _$optionsList;
36
34
  private _$dropdownContent;
37
35
  private _$dropdownToggler;
38
36
  private _selectContext;
39
- listBoxController: ListBoxKeyboardController;
37
+ private _listBoxController;
40
38
  private _optionsObserver;
41
- private _selectedOptionsAriaObserver;
42
39
  private $placeholder;
43
- private $searchLabel;
44
40
  constructor();
45
41
  updated(changedProperties: PropertyValues): void;
46
42
  private _focusElementAfterSelectOpened;
@@ -51,7 +47,6 @@ export declare class HSelect extends PhoenixLightLitElement {
51
47
  private _setupEvents;
52
48
  private _handleOptionDeselect;
53
49
  private _updateOptionsView;
54
- private _updateLabelAria;
55
50
  private _appendNewHTMLOption;
56
51
  updateOptionAriaAttribute($option: HOption): void;
57
52
  private _removeHTMLOptions;
@@ -40,7 +40,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
40
40
  this._searchValue = '';
41
41
  this._$options = new Map();
42
42
  this._$dropdown = createRef();
43
- this.$search = createRef();
43
+ this._$search = createRef();
44
44
  this._$optionsList = createRef();
45
45
  this._$dropdownContent = createRef();
46
46
  this._$dropdownToggler = createRef();
@@ -101,18 +101,6 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
101
101
  this.updateOptionAriaAttribute($option);
102
102
  });
103
103
  };
104
- this._updateLabelAria = (options) => {
105
- var _a, _b;
106
- if (!this.$searchLabel)
107
- return;
108
- (_a = this.$searchLabel.querySelector(`[id="value-label"]`)) === null || _a === void 0 ? void 0 : _a.remove();
109
- this.$searchLabel.innerHTML = `
110
- ${(_b = this.$searchLabel) === null || _b === void 0 ? void 0 : _b.innerHTML}
111
- <span id="value-label" class="sr-only">
112
- ${options.reduce((totalSelectedContent, currentOption) => (totalSelectedContent += currentOption.content), '')}
113
- </span>
114
- `;
115
- };
116
104
  this._handleOptionClicked = ({ detail }) => {
117
105
  if (!(detail === null || detail === void 0 ? void 0 : detail.$option))
118
106
  return;
@@ -128,11 +116,10 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
128
116
  });
129
117
  };
130
118
  this._handleDropdownHidden = () => {
131
- var _a, _b;
119
+ var _a;
132
120
  this._searchValue = '';
133
121
  this.opened = false;
134
122
  (_a = this._$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', '');
135
- (_b = this._$dropdownToggler.value) === null || _b === void 0 ? void 0 : _b.focus();
136
123
  };
137
124
  this._manageSelectFocusAria = (ev) => {
138
125
  var _a;
@@ -192,7 +179,6 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
192
179
  return Array.from(this._$options.values());
193
180
  }
194
181
  updated(changedProperties) {
195
- var _a;
196
182
  super.updated(changedProperties);
197
183
  if (changedProperties.has('opened')) {
198
184
  if (this.opened) {
@@ -206,44 +192,28 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
206
192
  if (changedProperties.has('optionsList')) {
207
193
  this._updateOptions();
208
194
  }
209
- if (this._$optionsList.value) {
210
- (_a = this.listBoxController) === null || _a === void 0 ? void 0 : _a.hostDisconnected();
211
- this.listBoxController = new ListBoxKeyboardController({
195
+ if (this._$optionsList.value && !this._listBoxController)
196
+ this._listBoxController = new ListBoxKeyboardController({
212
197
  host: this,
213
198
  $list: this._$optionsList.value
214
199
  });
215
- }
216
- if (this.listBoxController) {
217
- this.listBoxController.calculateSelectedOptionIndex();
218
- }
219
200
  }
220
201
  _focusElementAfterSelectOpened() {
221
- var _a;
222
- const $searchInput = (_a = this.$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
223
- const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
224
- const $firstOption = $options.find(($option) => {
225
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
226
- });
227
- const $selectedOption = this.selectedOptions[0];
228
- const $optionToFocus = $selectedOption || $firstOption;
229
- $searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
202
+ var _a, _b;
203
+ const $searchInput = (_a = this._$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
204
+ $searchInput ? $searchInput.focus() : (_b = this._$optionsList.value) === null || _b === void 0 ? void 0 : _b.focus();
230
205
  }
231
206
  connectedCallback() {
232
- var _a;
233
207
  super.connectedCallback();
234
208
  this.classList.add(SELECT_CSS_CLASSES.select);
235
209
  if (!this.searchDisabled) {
236
210
  this.classList.add(SELECT_CSS_CLASSES.selectWithSearch);
237
211
  }
238
- this.$searchLabel = document.querySelector(`[id="${this.ariaLabelledby}"]`);
239
- (_a = this.$searchLabel) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'true');
240
212
  this._selectController = this.multiple ? new MultiSelectController({ host: this }) : new SelectController({ host: this });
241
213
  this._selectContext.provide(SELECT_CONTEXTS.selectedOptions$, this._selectController.selectedOptions$);
242
214
  this._selectContext.provide(SELECT_CONTEXTS.isMultiselect, this.multiple);
243
215
  this._optionsObserver = new Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
244
216
  this._selectController.options$.subscribe(this._optionsObserver);
245
- this._selectedOptionsAriaObserver = new Observer((selectedOptions) => this._updateLabelAria(selectedOptions));
246
- this._selectController.selectedOptions$.subscribe(this._selectedOptionsAriaObserver);
247
217
  this._updateOptions();
248
218
  this._setupEvents();
249
219
  }
@@ -273,10 +243,6 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
273
243
  SelectControlUtils.appendHTMLOption($option, $list, position);
274
244
  }
275
245
  updateOptionAriaAttribute($option) {
276
- if (!this.multiple) {
277
- const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
278
- $options.forEach(($option) => ($option.removeAttribute('aria-selected')));
279
- }
280
246
  $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
281
247
  }
282
248
  _removeHTMLOptions(optionsValues) {
@@ -286,12 +252,6 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
286
252
  const option = this._selectController.getOption(value);
287
253
  if (!option)
288
254
  return;
289
- const $selectedOption = this._$options.get(option.value);
290
- const $selectedOptionLink = $selectedOption === null || $selectedOption === void 0 ? void 0 : $selectedOption.querySelector('a');
291
- if ($selectedOptionLink) {
292
- $selectedOptionLink.click();
293
- return;
294
- }
295
255
  this.noDeselect ? this._selectController.select(option) : this._selectController.toggle(option);
296
256
  if (!this.multiple)
297
257
  this._closeSelect();
@@ -349,7 +309,6 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
349
309
  offset=${this.offset}
350
310
  content-width="full"
351
311
  prevent-focus-trap
352
- no-autofocus
353
312
  >
354
313
  <h-dropdown-toggler
355
314
  ${ref(this._$dropdownToggler)}
@@ -377,7 +336,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
377
336
  ${isSearchEnabled
378
337
  ? html ` <h-select-search
379
338
  class=${SELECT_CSS_CLASSES.selectSearch}
380
- ${ref(this.$search)}
339
+ ${ref(this._$search)}
381
340
  .value=${this._searchValue}
382
341
  @search=${this._handleSearch}
383
342
  ></h-select-search>`
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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 +1,10 @@
1
1
  import { Any } from 'ts-toolbelt';
2
- import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import { ReactiveControllerHost } from 'lit';
3
3
  import { LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS } from "./list_box_controller_constants";
4
- import { HSelect } from "../../components/form/select/select";
5
4
  export declare type TListBoxKeyboardNavigationDirection = Any.Keys<typeof LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS>;
6
5
  export declare type TListBoxKeyboardControllerConstructorOptions = {
7
- host: ReactiveControllerHost & HSelect;
6
+ host: ReactiveControllerHost & HTMLElement;
8
7
  $list: HTMLElement;
9
8
  listItemSelector?: string;
10
9
  orientation?: TListBoxKeyboardNavigationDirection;
11
10
  };
12
- export interface IListboxController extends ReactiveController {
13
- calculateSelectedOptionIndex(): void;
14
- }
@@ -1,5 +1,4 @@
1
1
  import 'ts-toolbelt';
2
2
  import 'lit';
3
3
  import '@phoenixRoot/controllers/list_box_controller/list_box_controller_constants';
4
- import '@phoenixRoot/components/form/select/select';
5
4
  //# sourceMappingURL=list_box_controller_types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list_box_controller_types.js","sourceRoot":"","sources":["../../../../../../../src/controllers/list_box_controller/list_box_controller_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,OAA2D,KAAK,CAAC;AACjE,OAAwD,4EAA4E,CAAC;AACrI,OAAwB,4CAA4C,CAAC"}
1
+ {"version":3,"file":"list_box_controller_types.js","sourceRoot":"","sources":["../../../../../../../src/controllers/list_box_controller/list_box_controller_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,OAAuC,KAAK,CAAC;AAC7C,OAAwD,4EAA4E,CAAC"}
@@ -1,14 +1,10 @@
1
- import { IListboxController, TListBoxKeyboardControllerConstructorOptions } from "./list_box_controller_types";
2
- export declare class ListBoxKeyboardController implements IListboxController {
1
+ import { ReactiveController } from 'lit';
2
+ import { TListBoxKeyboardControllerConstructorOptions } from "./list_box_controller_types";
3
+ export declare class ListBoxKeyboardController implements ReactiveController {
3
4
  #private;
4
5
  constructor({ host, $list, listItemSelector, orientation }: TListBoxKeyboardControllerConstructorOptions);
5
6
  hostConnected(): void;
6
- private _handleKeyboardNavigation;
7
7
  private _handleArrowNavigation;
8
- private _findCurrentIndex;
9
- private _handleWriteableCharacter;
10
- calculateSelectedOptionIndex: () => void;
11
8
  private _getPrevOptionIndex;
12
9
  private _getNextOptionIndex;
13
- hostDisconnected(): void;
14
10
  }
@@ -1,6 +1,7 @@
1
1
  import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../../../external/tslib/tslib.es6.js';
2
2
  import 'lit';
3
3
  import { UiDomUtils } from '@dreamcommerce/utilities';
4
+ import { KeystrokesController } from '../keystrokes_controller/keystrokes_controller.js';
4
5
  import { LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS } from './list_box_controller_constants.js';
5
6
 
6
7
  var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController_currentOptionIndex, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
@@ -12,54 +13,25 @@ class ListBoxKeyboardController {
12
13
  _ListBoxKeyboardController__$options.set(this, void 0);
13
14
  _ListBoxKeyboardController_listItemSelector.set(this, void 0);
14
15
  _ListBoxKeyboardController_keys.set(this, void 0);
15
- this._handleKeyboardNavigation = (ev) => {
16
- if (__classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f").find((key) => key === ev.key)) {
17
- this._handleArrowNavigation(ev);
18
- return;
19
- }
20
- this._handleWriteableCharacter(ev);
21
- };
22
16
  this._handleArrowNavigation = (event) => {
23
17
  event.preventDefault();
24
18
  const { key } = event;
25
- const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
26
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
27
- });
28
- const prevOptionIndex = this._findCurrentIndex();
19
+ const prevOptionIndex = __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
29
20
  let newOptionIndex = key === 'ArrowDown' || key === 'ArrowRight' ? this._getNextOptionIndex() : this._getPrevOptionIndex();
30
21
  if (newOptionIndex === undefined) {
31
- newOptionIndex = this._findCurrentIndex();
22
+ const selectedOptionIndex = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
23
+ newOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
32
24
  }
33
25
  if (newOptionIndex === __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f"))
34
26
  return;
35
27
  if (prevOptionIndex !== undefined) {
36
28
  const $prevOption = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[prevOptionIndex];
37
- $prevOption && UiDomUtils.makeUnnavigable($prevOption);
29
+ UiDomUtils.makeUnnavigable($prevOption);
38
30
  }
39
31
  __classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, newOptionIndex, "f");
40
- const $focusedOption = $availableOptions[newOptionIndex];
41
- if ($focusedOption) {
42
- UiDomUtils.makeNavigable($focusedOption);
43
- $focusedOption.focus();
44
- }
45
- };
46
- this._findCurrentIndex = () => {
47
- const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
48
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
49
- });
50
- const selectedOptionIndex = $availableOptions.findIndex(($option) => $option.selected);
51
- return selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
52
- };
53
- this._handleWriteableCharacter = (ev) => {
54
- var _a;
55
- const $searchInput = (_a = __classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
56
- if (!$searchInput)
57
- return;
58
- $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
59
- };
60
- this.calculateSelectedOptionIndex = () => {
61
- const selectedOptionIndex = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
62
- __classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, selectedOptionIndex !== -1 ? selectedOptionIndex : 0, "f");
32
+ const $focusedOption = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[newOptionIndex];
33
+ UiDomUtils.makeNavigable($focusedOption);
34
+ $focusedOption.focus();
63
35
  };
64
36
  __classPrivateFieldSet(this, _ListBoxKeyboardController_host, host, "f");
65
37
  __classPrivateFieldSet(this, _ListBoxKeyboardController__$list, $list, "f");
@@ -69,7 +41,12 @@ class ListBoxKeyboardController {
69
41
  __classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").addController(this);
70
42
  }
71
43
  hostConnected() {
72
- __classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('keydown', this._handleKeyboardNavigation);
44
+ new KeystrokesController({
45
+ host: __classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f"),
46
+ keys: __classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f"),
47
+ callback: this._handleArrowNavigation,
48
+ target: __classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f")
49
+ });
73
50
  UiDomUtils.makeNavigable(__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"));
74
51
  __classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('focusin', (event) => {
75
52
  if (event.target !== __classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"))
@@ -87,39 +64,15 @@ class ListBoxKeyboardController {
87
64
  return undefined;
88
65
  if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") <= 0)
89
66
  return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
90
- if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") <= 0)
91
- return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
92
- const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
93
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
94
- });
95
- if (!!$availableOptions[__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1])
96
- return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1;
97
- // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
98
- const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
99
- if (newIndexOfCurrentlySelectedOption)
100
- return newIndexOfCurrentlySelectedOption - 1;
101
67
  return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1;
102
68
  }
103
69
  _getNextOptionIndex() {
104
70
  if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
105
71
  return undefined;
106
- const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
107
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
108
- });
109
- if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === $availableOptions.length - 1)
72
+ if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") >= __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").length - 1)
110
73
  return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
111
- if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") > $availableOptions.length - 1) {
112
- // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
113
- const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
114
- if (newIndexOfCurrentlySelectedOption)
115
- return newIndexOfCurrentlySelectedOption + 1;
116
- return 0;
117
- }
118
74
  return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") + 1;
119
75
  }
120
- hostDisconnected() {
121
- __classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").removeEventListener('keydown', this._handleKeyboardNavigation);
122
- }
123
76
  }
124
77
  _ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController_currentOptionIndex = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
125
78
 
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,4CAAgD;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
package/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.15.6-4",
5
+ "version": "1.15.6-5",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",