@shoper/phoenix_design_system 1.15.11-8 → 1.15.11-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) 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/select/components/search/select_search.js +0 -31
  6. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +2 -1
  8. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/form/select/select.js +15 -69
  10. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/scroll_to/scroll_to.js +7 -6
  12. package/build/cjs/packages/phoenix/src/components/scroll_to/scroll_to.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +30 -76
  14. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  15. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +0 -1
  16. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +2 -9
  17. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  18. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +0 -1
  19. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -6
  20. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  21. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +0 -4
  22. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +0 -31
  23. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  24. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +2 -1
  25. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  26. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +4 -12
  27. package/build/esm/packages/phoenix/src/components/form/select/select.js +15 -69
  28. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  29. package/build/esm/packages/phoenix/src/components/scroll_to/scroll_to.js +7 -6
  30. package/build/esm/packages/phoenix/src/components/scroll_to/scroll_to.js.map +1 -1
  31. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.d.ts +2 -6
  32. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js +0 -1
  33. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js.map +1 -1
  34. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.d.ts +3 -8
  35. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +30 -76
  36. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  37. package/package.json +1 -1
  38. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +0 -98
  39. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +0 -1
  40. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.d.ts +0 -15
  41. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +0 -94
  42. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +0 -1
  43. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.d.ts +0 -8
  44. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js +0 -3
  45. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js.map +0 -1
@@ -32,7 +32,6 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
32
32
  this.portalTarget = dropdown_constants.DEFAULT_DROPDOWN_PORTAL_NAME;
33
33
  this.id = v4['default']();
34
34
  this.preventFocusTrap = false;
35
- this.noAutoFocus = false;
36
35
  this._backdropController = new backdrop_controller.BackdropController();
37
36
  this._handleClickOutside = async (target) => {
38
37
  var _a, _b;
@@ -49,8 +48,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
49
48
  return;
50
49
  }
51
50
  await this.show();
52
- if (!this.noAutoFocus)
53
- this._focusOnFirstContentElement();
51
+ this._focusOnFirstContentElement();
54
52
  };
55
53
  this.show = async () => {
56
54
  if (this.opened)
@@ -178,8 +176,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
178
176
  const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
179
177
  if (isHoveredWithinDropdown && !this.opened) {
180
178
  await this.show();
181
- if (!this.noAutoFocus)
182
- this._focusOnFirstContentElement();
179
+ this._focusOnFirstContentElement();
183
180
  return;
184
181
  }
185
182
  if (!isHoveredWithinDropdown && this.opened)
@@ -469,10 +466,6 @@ tslib_es6.__decorate([
469
466
  decorators_js.property({ type: Boolean, attribute: 'prevent-focus-trap' }),
470
467
  tslib_es6.__metadata("design:type", Object)
471
468
  ], exports.HDropdown.prototype, "preventFocusTrap", void 0);
472
- tslib_es6.__decorate([
473
- decorators_js.property({ type: Boolean, attribute: 'no-autofocus' }),
474
- tslib_es6.__metadata("design:type", Object)
475
- ], exports.HDropdown.prototype, "noAutoFocus", void 0);
476
469
  exports.HDropdown = HDropdown_1 = tslib_es6.__decorate([
477
470
  phoenix_custom_element.phoenixCustomElement('h-dropdown'),
478
471
  tslib_es6.__metadata("design:paramtypes", [])
@@ -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,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -16,7 +16,6 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
16
16
  constructor() {
17
17
  super();
18
18
  this.name = '';
19
- this.ariaHasPopup = 'menu';
20
19
  this._setupTogglerAria = () => {
21
20
  this._$dropdown = this.closest(dropdown_constants.DROPDOWN_CONTAINER_NAME);
22
21
  if (this._$dropdown.isOpened)
@@ -24,7 +23,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
24
23
  host: this,
25
24
  initialAriaExpandedValue: this._$dropdown.isOpened()
26
25
  });
27
- this.setAttribute('aria-haspopup', this.ariaHasPopup);
26
+ this.setAttribute('aria-haspopup', 'true');
28
27
  if (this._$dropdown.id)
29
28
  this.setAttribute('aria-controls', this._$dropdown.id);
30
29
  };
@@ -61,10 +60,6 @@ tslib_es6.__decorate([
61
60
  decorators.property({ type: String, reflect: true }),
62
61
  tslib_es6.__metadata("design:type", Object)
63
62
  ], exports.HDropdownToggler.prototype, "name", void 0);
64
- tslib_es6.__decorate([
65
- decorators.property({ type: String, attribute: 'aria-haspopup' }),
66
- tslib_es6.__metadata("design:type", Object)
67
- ], exports.HDropdownToggler.prototype, "ariaHasPopup", void 0);
68
63
  exports.HDropdownToggler = tslib_es6.__decorate([
69
64
  phoenix_custom_element.phoenixCustomElement('h-dropdown-toggler'),
70
65
  tslib_es6.__metadata("design:paramtypes", [])
@@ -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;"}
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;"}
@@ -5,11 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib_es6 = require('../../../../../../../../external/tslib/tslib.es6.js');
6
6
  var lit = require('lit');
7
7
  var decorators = require('lit/decorators');
8
- 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 select_components_constatns = require('../select_components_constatns.js');
12
- var dropdown_constants = require('../../../../dropdown/dropdown_constants.js');
13
11
  var debounce = require('../../../../../../../../external/lodash/debounce.js');
14
12
  var select_search_constants = require('./select_search_constants.js');
15
13
 
@@ -17,32 +15,6 @@ exports.HSelectSearch = class HSelectSearch extends phoenix_light_lit_element.Ph
17
15
  constructor() {
18
16
  super(...arguments);
19
17
  this.value = '';
20
- this._$selectOptions = null;
21
- this._handleSearchKeydown = (ev) => {
22
- if (ev.key !== 'ArrowDown' && ev.key !== 'ArrowUp')
23
- return;
24
- this._handleFocusOptionOnArrowNavigation();
25
- this._handleDispatchEventOnOptionsList(ev);
26
- };
27
- this._handleDispatchEventOnOptionsList = (ev) => {
28
- var _a;
29
- const arrowNavigationEvent = new KeyboardEvent('keydown', {
30
- key: ev.key
31
- });
32
- (_a = this._$selectOptions) === null || _a === void 0 ? void 0 : _a.dispatchEvent(arrowNavigationEvent);
33
- };
34
- this._handleFocusOptionOnArrowNavigation = () => {
35
- const $options = this._$selectOptions ? [...this._$selectOptions.querySelectorAll('h-option')] : [];
36
- const $availableOptions = $options.filter(($option) => {
37
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
38
- });
39
- const $firstOption = $availableOptions.find(($option) => {
40
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
41
- });
42
- const $selectedOption = $availableOptions.find(($option) => $option.getAttribute('aria-selected'));
43
- const $optionToFocus = $selectedOption || $firstOption;
44
- $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
45
- };
46
18
  this._handleInputChange = debounce['default'](({ target }) => {
47
19
  this.value = target.value;
48
20
  this.emitCustomEvent(select_components_constatns.SELECT_SEARCH_EVENT_NAMES.search, {
@@ -53,9 +25,6 @@ exports.HSelectSearch = class HSelectSearch extends phoenix_light_lit_element.Ph
53
25
  connectedCallback() {
54
26
  super.connectedCallback();
55
27
  this.classList.add(select_search_constants.SELECT_SEARCH_CSS_CLASSES.selectSearch);
56
- const $selectOptionsContainer = this.closest(dropdown_constants.DROPDOWN_CONTENT_NAME);
57
- this._$selectOptions = $selectOptionsContainer === null || $selectOptionsContainer === void 0 ? void 0 : $selectOptionsContainer.querySelector('h-options');
58
- this.addEventListener('keydown', this._handleSearchKeydown);
59
28
  }
60
29
  render() {
61
30
  return lit.html `
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;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;"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../../external/tslib/tslib.es6.js');
6
- require('@dreamcommerce/utilities');
6
+ var utilities = require('@dreamcommerce/utilities');
7
7
  var phoenix_light_lit_element = require('../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
8
8
  var phoenix_custom_element = require('../../../../core/decorators/phoenix_custom_element.js');
9
9
  var select_components_constatns = require('./select_components_constatns.js');
@@ -26,6 +26,7 @@ exports.HOptions = class HOptions extends phoenix_light_lit_element.PhoenixLight
26
26
  });
27
27
  };
28
28
  this.setAttribute('role', 'listbox');
29
+ utilities.UiDomUtils.makeNavigable(this);
29
30
  this.addEventListener(select_components_constatns.SELECT_OPTION_EVENT_NAMES.clicked, this._dispatchClickedEvent);
30
31
  this.addEventListener(select_components_constatns.SELECT_OPTION_EVENT_NAMES.updated, this._dispatchUpdatedEvent);
31
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,kDAAsD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,kDAAsD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -29,7 +29,6 @@ var select_utils = require('./select_utils.js');
29
29
  var select_controller = require('./controllers/select_controller.js');
30
30
  var select_option_mapper = require('./model/select_option_mapper.js');
31
31
  var repeat = require('lit/directives/repeat');
32
- var select_toggler_keyboard_controller = require('./controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js');
33
32
 
34
33
  exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLitElement {
35
34
  constructor() {
@@ -44,11 +43,11 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
44
43
  this.ariaLabelledby = '';
45
44
  this._searchValue = '';
46
45
  this._$options = new Map();
47
- this.$dropdown = ref_js.createRef();
48
- this.$search = ref_js.createRef();
46
+ this._$dropdown = ref_js.createRef();
47
+ this._$search = ref_js.createRef();
49
48
  this._$optionsList = ref_js.createRef();
50
49
  this._$dropdownContent = ref_js.createRef();
51
- this.$dropdownToggler = ref_js.createRef();
50
+ this._$dropdownToggler = ref_js.createRef();
52
51
  this._selectContext = new context_provider_controller.ContextProviderController(this);
53
52
  this._updateOptions = () => {
54
53
  const $options = this._getOptions();
@@ -106,18 +105,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
106
105
  this.updateOptionAriaAttribute($option);
107
106
  });
108
107
  };
109
- this._updateLabelAria = (options) => {
110
- var _a, _b;
111
- if (!this.$searchLabel)
112
- return;
113
- (_a = this.$searchLabel.querySelector(`[id="value-label"]`)) === null || _a === void 0 ? void 0 : _a.remove();
114
- this.$searchLabel.innerHTML = `
115
- ${(_b = this.$searchLabel) === null || _b === void 0 ? void 0 : _b.innerHTML}
116
- <span id="value-label" class="sr-only">
117
- ${options.reduce((totalSelectedContent, currentOption) => (totalSelectedContent += currentOption.content), '')}
118
- </span>
119
- `;
120
- };
121
108
  this._handleOptionClicked = ({ detail }) => {
122
109
  if (!(detail === null || detail === void 0 ? void 0 : detail.$option))
123
110
  return;
@@ -133,15 +120,10 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
133
120
  });
134
121
  };
135
122
  this._handleDropdownHidden = () => {
136
- var _a, _b, _c;
123
+ var _a;
137
124
  this._searchValue = '';
138
125
  this.opened = false;
139
- (_a = this.$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', '');
140
- const isBodyActive = document.activeElement === document.body;
141
- const isInnerElementActive = (_b = this._$dropdownContent.value) === null || _b === void 0 ? void 0 : _b.contains(document.activeElement);
142
- if (isInnerElementActive || isBodyActive) {
143
- (_c = this.$dropdownToggler.value) === null || _c === void 0 ? void 0 : _c.focus();
144
- }
126
+ (_a = this._$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', '');
145
127
  };
146
128
  this._manageSelectFocusAria = (ev) => {
147
129
  var _a;
@@ -150,14 +132,14 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
150
132
  return;
151
133
  const optionId = $target.id;
152
134
  if (optionId) {
153
- (_a = this.$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', optionId);
135
+ (_a = this._$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', optionId);
154
136
  }
155
137
  };
156
138
  this._closeSelect = () => {
157
139
  var _a;
158
140
  if (!this.opened)
159
141
  return;
160
- (_a = this.$dropdown.value) === null || _a === void 0 ? void 0 : _a.hide();
142
+ (_a = this._$dropdown.value) === null || _a === void 0 ? void 0 : _a.hide();
161
143
  };
162
144
  this._clearOptions = () => {
163
145
  this._selectController.deselectAll();
@@ -201,7 +183,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
201
183
  return Array.from(this._$options.values());
202
184
  }
203
185
  updated(changedProperties) {
204
- var _a, _b;
205
186
  super.updated(changedProperties);
206
187
  if (changedProperties.has('opened')) {
207
188
  if (this.opened) {
@@ -215,52 +196,28 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
215
196
  if (changedProperties.has('optionsList')) {
216
197
  this._updateOptions();
217
198
  }
218
- if (this._$optionsList.value) {
219
- (_a = this.listBoxController) === null || _a === void 0 ? void 0 : _a.hostDisconnected();
220
- this.listBoxController = new list_box_keyboard_controller.ListBoxKeyboardController({
221
- host: this,
222
- $list: this._$optionsList.value
223
- });
224
- }
225
- if (this.listBoxController) {
226
- this.listBoxController.calculateSelectedOptionIndex();
227
- }
228
- if (this._$optionsList.value && this.$dropdownToggler.value) {
229
- (_b = this._selectTogglerKeyboardController) === null || _b === void 0 ? void 0 : _b.hostDisconnected();
230
- this._selectTogglerKeyboardController = new select_toggler_keyboard_controller.SelectTogglerKeyboardController({
199
+ if (this._$optionsList.value && !this._listBoxController)
200
+ this._listBoxController = new list_box_keyboard_controller.ListBoxKeyboardController({
231
201
  host: this,
232
- $toggler: this.$dropdownToggler.value,
233
202
  $list: this._$optionsList.value
234
203
  });
235
- }
236
204
  }
237
205
  _focusElementAfterSelectOpened() {
238
- var _a;
239
- const $searchInput = (_a = this.$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
240
- const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
241
- const $firstOption = $options.find(($option) => {
242
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
243
- });
244
- const $selectedOption = this.selectedOptions[0];
245
- const $optionToFocus = $selectedOption || $firstOption;
246
- $searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
206
+ var _a, _b;
207
+ const $searchInput = (_a = this._$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
208
+ $searchInput ? $searchInput.focus() : (_b = this._$optionsList.value) === null || _b === void 0 ? void 0 : _b.focus();
247
209
  }
248
210
  connectedCallback() {
249
- var _a;
250
211
  super.connectedCallback();
251
212
  this.classList.add(select_constants.SELECT_CSS_CLASSES.select);
252
213
  if (!this.searchDisabled) {
253
214
  this.classList.add(select_constants.SELECT_CSS_CLASSES.selectWithSearch);
254
215
  }
255
- this.$searchLabel = document.querySelector(`[id="${this.ariaLabelledby}"]`);
256
- (_a = this.$searchLabel) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'true');
257
216
  this._selectController = this.multiple ? new multi_select_controller.MultiSelectController({ host: this }) : new select_controller.SelectController({ host: this });
258
217
  this._selectContext.provide(select_constants.SELECT_CONTEXTS.selectedOptions$, this._selectController.selectedOptions$);
259
218
  this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.multiple);
260
219
  this._optionsObserver = new observer.Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
261
220
  this._selectController.options$.subscribe(this._optionsObserver);
262
- this._selectedOptionsAriaObserver = new observer.Observer((selectedOptions) => this._updateLabelAria(selectedOptions));
263
- this._selectController.selectedOptions$.subscribe(this._selectedOptionsAriaObserver);
264
221
  this._updateOptions();
265
222
  this._setupEvents();
266
223
  }
@@ -290,10 +247,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
290
247
  select_utils.SelectControlUtils.appendHTMLOption($option, $list, position);
291
248
  }
292
249
  updateOptionAriaAttribute($option) {
293
- if (!this.multiple) {
294
- const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
295
- $options.forEach(($option) => ($option.removeAttribute('aria-selected')));
296
- }
297
250
  $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
298
251
  }
299
252
  _removeHTMLOptions(optionsValues) {
@@ -303,12 +256,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
303
256
  const option = this._selectController.getOption(value);
304
257
  if (!option)
305
258
  return;
306
- const $selectedOption = this._$options.get(option.value);
307
- const $selectedOptionLink = $selectedOption === null || $selectedOption === void 0 ? void 0 : $selectedOption.querySelector('a');
308
- if ($selectedOptionLink) {
309
- $selectedOptionLink.click();
310
- return;
311
- }
312
259
  this.noDeselect ? this._selectController.select(option) : this._selectController.toggle(option);
313
260
  if (!this.multiple)
314
261
  this._closeSelect();
@@ -359,17 +306,16 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
359
306
  const isSearchEnabled = !this.searchDisabled && options.length > select_constants.MIN_NUMBER_OF_OPTIONS_TO_SHOW_SEARCH;
360
307
  return lit.html `
361
308
  <h-dropdown
362
- ${ref_js.ref(this.$dropdown)}
309
+ ${ref_js.ref(this._$dropdown)}
363
310
  @showed=${() => (this.opened = true)}
364
311
  @hidden=${this._handleDropdownHidden}
365
312
  name="${this.controlName}"
366
313
  offset=${this.offset}
367
314
  content-width="full"
368
315
  prevent-focus-trap
369
- no-autofocus
370
316
  >
371
317
  <h-dropdown-toggler
372
- ${ref_js.ref(this.$dropdownToggler)}
318
+ ${ref_js.ref(this._$dropdownToggler)}
373
319
  name="${this.controlName}"
374
320
  validation-container
375
321
  aria-haspopup="listbox"
@@ -394,7 +340,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
394
340
  ${isSearchEnabled
395
341
  ? lit.html ` <h-select-search
396
342
  class=${select_constants.SELECT_CSS_CLASSES.selectSearch}
397
- ${ref_js.ref(this.$search)}
343
+ ${ref_js.ref(this._$search)}
398
344
  .value=${this._searchValue}
399
345
  @search=${this._handleSearch}
400
346
  ></h-select-search>`
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -15,12 +15,13 @@ exports.HScrollTo = class HScrollTo extends phoenix_light_lit_element.PhoenixLig
15
15
  this.behavior = 'smooth';
16
16
  this.scrollToElement = () => {
17
17
  const $scrollTo = document.querySelector(`[data-scroll="${this.to}"]`);
18
- if ($scrollTo) {
19
- const elTopPosition = $scrollTo.getBoundingClientRect().top;
20
- requestAnimationFrame(() => {
21
- window.scrollTo({ top: elTopPosition + window.scrollY, behavior: this.behavior });
22
- });
23
- }
18
+ if (!$scrollTo)
19
+ return;
20
+ const elTopPosition = $scrollTo.getBoundingClientRect().top;
21
+ requestAnimationFrame(() => {
22
+ window.scrollTo({ top: elTopPosition + window.scrollY, behavior: this.behavior });
23
+ });
24
+ $scrollTo.focus();
24
25
  };
25
26
  this._btnController = new btn_controller.BtnController(this, this.scrollToElement);
26
27
  }
@@ -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;"}
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;"}
@@ -5,64 +5,37 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  require('lit');
7
7
  var utilities = require('@dreamcommerce/utilities');
8
+ var keystrokes_controller = require('../keystrokes_controller/keystrokes_controller.js');
8
9
  var list_box_controller_constants = require('./list_box_controller_constants.js');
9
10
 
10
- var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
11
+ var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController_currentOptionIndex, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
11
12
  class ListBoxKeyboardController {
12
13
  constructor({ host, $list, listItemSelector = '[role="option"]', orientation = list_box_controller_constants.LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS.vertical }) {
13
14
  _ListBoxKeyboardController_host.set(this, void 0);
14
15
  _ListBoxKeyboardController__$list.set(this, void 0);
16
+ _ListBoxKeyboardController_currentOptionIndex.set(this, void 0);
15
17
  _ListBoxKeyboardController__$options.set(this, void 0);
16
18
  _ListBoxKeyboardController_listItemSelector.set(this, void 0);
17
19
  _ListBoxKeyboardController_keys.set(this, void 0);
18
- this._handleKeyboardNavigation = (ev) => {
19
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f").find((key) => key === ev.key)) {
20
- this._handleArrowNavigation(ev);
21
- return;
22
- }
23
- this._handleWriteableCharacter(ev);
24
- };
25
20
  this._handleArrowNavigation = (event) => {
26
21
  event.preventDefault();
27
22
  const { key } = event;
28
- const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
29
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
30
- });
31
- const prevOptionIndex = this._findCurrentIndex();
23
+ const prevOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
32
24
  let newOptionIndex = key === 'ArrowDown' || key === 'ArrowRight' ? this._getNextOptionIndex() : this._getPrevOptionIndex();
33
25
  if (newOptionIndex === undefined) {
34
- newOptionIndex = this._findCurrentIndex();
26
+ const selectedOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
27
+ newOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
35
28
  }
36
- if (newOptionIndex === this.currentOptionIndex)
29
+ if (newOptionIndex === tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f"))
37
30
  return;
38
31
  if (prevOptionIndex !== undefined) {
39
32
  const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[prevOptionIndex];
40
- $prevOption && utilities.UiDomUtils.makeUnnavigable($prevOption);
33
+ utilities.UiDomUtils.makeUnnavigable($prevOption);
41
34
  }
42
- this.currentOptionIndex = newOptionIndex;
43
- const $focusedOption = $availableOptions[newOptionIndex];
44
- if ($focusedOption) {
45
- utilities.UiDomUtils.makeNavigable($focusedOption);
46
- $focusedOption.focus();
47
- }
48
- };
49
- this._findCurrentIndex = () => {
50
- const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
51
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
52
- });
53
- const selectedOptionIndex = $availableOptions.findIndex(($option) => $option.selected);
54
- return selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
55
- };
56
- this._handleWriteableCharacter = (ev) => {
57
- var _a;
58
- const $searchInput = (_a = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
59
- if (!$searchInput)
60
- return;
61
- $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
62
- };
63
- this.calculateSelectedOptionIndex = () => {
64
- const selectedOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
65
- this.currentOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
35
+ tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, newOptionIndex, "f");
36
+ const $focusedOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[newOptionIndex];
37
+ utilities.UiDomUtils.makeNavigable($focusedOption);
38
+ $focusedOption.focus();
66
39
  };
67
40
  tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_host, host, "f");
68
41
  tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController__$list, $list, "f");
@@ -72,59 +45,40 @@ class ListBoxKeyboardController {
72
45
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").addController(this);
73
46
  }
74
47
  hostConnected() {
75
- tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('keydown', this._handleKeyboardNavigation);
48
+ new keystrokes_controller.KeystrokesController({
49
+ host: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f"),
50
+ keys: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f"),
51
+ callback: this._handleArrowNavigation,
52
+ target: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f")
53
+ });
76
54
  utilities.UiDomUtils.makeNavigable(tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"));
77
55
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('focusin', (event) => {
78
56
  if (event.target !== tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"))
79
57
  return;
80
- if (this.currentOptionIndex === undefined)
58
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
81
59
  return;
82
- const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[this.currentOptionIndex];
60
+ const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f")];
83
61
  utilities.UiDomUtils.makeUnnavigable($prevOption);
84
- this.currentOptionIndex = undefined;
62
+ tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, undefined, "f");
85
63
  });
86
64
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").forEach(($option) => utilities.UiDomUtils.makeUnnavigable($option));
87
65
  }
88
66
  _getPrevOptionIndex() {
89
- if (this.currentOptionIndex === undefined)
67
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
90
68
  return undefined;
91
- if (this.currentOptionIndex <= 0)
92
- return this.currentOptionIndex;
93
- if (this.currentOptionIndex <= 0)
94
- return this.currentOptionIndex;
95
- const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
96
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
97
- });
98
- if (!!$availableOptions[this.currentOptionIndex - 1])
99
- return this.currentOptionIndex - 1;
100
- // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
101
- const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
102
- if (newIndexOfCurrentlySelectedOption)
103
- return newIndexOfCurrentlySelectedOption - 1;
104
- return this.currentOptionIndex - 1;
69
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") <= 0)
70
+ return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
71
+ return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1;
105
72
  }
106
73
  _getNextOptionIndex() {
107
- if (this.currentOptionIndex === undefined)
74
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
108
75
  return undefined;
109
- const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
110
- return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
111
- });
112
- if (this.currentOptionIndex === $availableOptions.length - 1)
113
- return this.currentOptionIndex;
114
- if (this.currentOptionIndex > $availableOptions.length - 1) {
115
- // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
116
- const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
117
- if (newIndexOfCurrentlySelectedOption)
118
- return newIndexOfCurrentlySelectedOption + 1;
119
- return 0;
120
- }
121
- return this.currentOptionIndex + 1;
122
- }
123
- hostDisconnected() {
124
- tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").removeEventListener('keydown', this._handleKeyboardNavigation);
76
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") >= tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").length - 1)
77
+ return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
78
+ return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") + 1;
125
79
  }
126
80
  }
127
- _ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
81
+ _ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController_currentOptionIndex = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
128
82
 
129
83
  exports.ListBoxKeyboardController = ListBoxKeyboardController;
130
84
  //# sourceMappingURL=list_box_keyboard_controller.js.map
@@ -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;"}
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;"}
@@ -17,7 +17,6 @@ export declare class HDropdown extends PhoenixLightLitElement implements IDropdo
17
17
  mobilePosition: TMobileElementPosition;
18
18
  id: string;
19
19
  preventFocusTrap: boolean;
20
- noAutoFocus: boolean;
21
20
  $dropdownToggler: HDropdownToggler | null;
22
21
  $dropdownContent: HDropdownContent | null;
23
22
  $nestedDropdownContentElements?: HDropdownContent[];
@@ -28,7 +28,6 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
28
28
  this.portalTarget = DEFAULT_DROPDOWN_PORTAL_NAME;
29
29
  this.id = v4();
30
30
  this.preventFocusTrap = false;
31
- this.noAutoFocus = false;
32
31
  this._backdropController = new BackdropController();
33
32
  this._handleClickOutside = async (target) => {
34
33
  var _a, _b;
@@ -45,8 +44,7 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
45
44
  return;
46
45
  }
47
46
  await this.show();
48
- if (!this.noAutoFocus)
49
- this._focusOnFirstContentElement();
47
+ this._focusOnFirstContentElement();
50
48
  };
51
49
  this.show = async () => {
52
50
  if (this.opened)
@@ -174,8 +172,7 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
174
172
  const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
175
173
  if (isHoveredWithinDropdown && !this.opened) {
176
174
  await this.show();
177
- if (!this.noAutoFocus)
178
- this._focusOnFirstContentElement();
175
+ this._focusOnFirstContentElement();
179
176
  return;
180
177
  }
181
178
  if (!isHoveredWithinDropdown && this.opened)
@@ -465,10 +462,6 @@ __decorate([
465
462
  property({ type: Boolean, attribute: 'prevent-focus-trap' }),
466
463
  __metadata("design:type", Object)
467
464
  ], HDropdown.prototype, "preventFocusTrap", void 0);
468
- __decorate([
469
- property({ type: Boolean, attribute: 'no-autofocus' }),
470
- __metadata("design:type", Object)
471
- ], HDropdown.prototype, "noAutoFocus", void 0);
472
465
  HDropdown = HDropdown_1 = __decorate([
473
466
  phoenixCustomElement('h-dropdown'),
474
467
  __metadata("design:paramtypes", [])