@shoper/phoenix_design_system 1.15.11 → 1.15.13-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
  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 +23 -5
  4. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/radio/radio_control.js +5 -0
  6. package/build/cjs/packages/phoenix/src/components/form/radio/radio_control.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
  8. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
  10. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +98 -0
  12. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
  13. package/build/cjs/packages/phoenix/src/components/form/select/select.js +78 -19
  14. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  15. package/build/cjs/packages/phoenix/src/components/modal/modal.js +3 -1
  16. package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -1
  17. package/build/cjs/packages/phoenix/src/components/slider/slider.js +39 -0
  18. package/build/cjs/packages/phoenix/src/components/slider/slider.js.map +1 -1
  19. package/build/cjs/packages/phoenix/src/components/slider/slider_constants.js +11 -0
  20. package/build/cjs/packages/phoenix/src/components/slider/slider_constants.js.map +1 -0
  21. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +76 -30
  22. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  23. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +1 -0
  24. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
  25. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  26. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +3 -0
  27. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
  28. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  29. package/build/esm/packages/phoenix/src/components/form/radio/radio_control.d.ts +1 -0
  30. package/build/esm/packages/phoenix/src/components/form/radio/radio_control.js +5 -0
  31. package/build/esm/packages/phoenix/src/components/form/radio/radio_control.js.map +1 -1
  32. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +4 -0
  33. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
  34. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  35. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
  36. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  37. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.d.ts +15 -0
  38. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +94 -0
  39. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
  40. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.d.ts +8 -0
  41. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js +3 -0
  42. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js.map +1 -0
  43. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +14 -5
  44. package/build/esm/packages/phoenix/src/components/form/select/select.js +78 -19
  45. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  46. package/build/esm/packages/phoenix/src/components/modal/modal.js +3 -1
  47. package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -1
  48. package/build/esm/packages/phoenix/src/components/slider/slider.d.ts +5 -0
  49. package/build/esm/packages/phoenix/src/components/slider/slider.js +40 -1
  50. package/build/esm/packages/phoenix/src/components/slider/slider.js.map +1 -1
  51. package/build/esm/packages/phoenix/src/components/slider/slider_constants.d.ts +4 -0
  52. package/build/esm/packages/phoenix/src/components/slider/slider_constants.js +7 -0
  53. package/build/esm/packages/phoenix/src/components/slider/slider_constants.js.map +1 -0
  54. package/build/esm/packages/phoenix/src/components/slider/slider_types.d.ts +3 -0
  55. package/build/esm/packages/phoenix/src/components/slider/slider_types.js +2 -0
  56. package/build/esm/packages/phoenix/src/components/slider/slider_types.js.map +1 -1
  57. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.d.ts +6 -2
  58. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js +1 -0
  59. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js.map +1 -1
  60. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.d.ts +8 -3
  61. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +76 -30
  62. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  63. package/package.json +2 -2
@@ -8,6 +8,7 @@ var utilities = require('@dreamcommerce/utilities');
8
8
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
9
9
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
10
10
  var splide_esm = require('../../../../../external/@splidejs/splide/dist/js/splide.esm.js');
11
+ var slider_constants = require('./slider_constants.js');
11
12
 
12
13
  exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLitElement {
13
14
  constructor() {
@@ -21,6 +22,20 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
21
22
  focus: 'center'
22
23
  };
23
24
  this._slider = null;
25
+ this._$focusableElements = [];
26
+ this._showFocusableNodes = (slideComponent) => {
27
+ this._handleFocusableNodes(slideComponent, slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show);
28
+ };
29
+ this._hideFocusableNodes = (slideComponent) => {
30
+ this._handleFocusableNodes(slideComponent, slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.hide);
31
+ };
32
+ this._handleFocusableNodes = ({ slide }, action) => {
33
+ const $focusableSlideChildren = this._$focusableElements.filter(($focusableElement) => slide.contains($focusableElement));
34
+ if ($focusableSlideChildren.length === 0)
35
+ return;
36
+ const newTabindex = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? '0' : '-1';
37
+ $focusableSlideChildren.forEach(($element) => $element.setAttribute('tabindex', newTabindex));
38
+ };
24
39
  }
25
40
  get sliderSettings() {
26
41
  return this._settings;
@@ -40,10 +55,34 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
40
55
  if (this._settings.mountOnConnectedCallback) {
41
56
  this._slider.mount();
42
57
  }
58
+ this._slider.on('visible', this._showFocusableNodes);
59
+ this._slider.on('hidden', this._hideFocusableNodes);
60
+ const mutationObserver = new MutationObserver((mutationList) => {
61
+ for (const mutation of mutationList) {
62
+ if (mutation.type !== "childList")
63
+ return;
64
+ const $target = mutation.target;
65
+ const isFocusable = utilities.UiDomUtils.isFocusable($target);
66
+ const hasBeenEncountered = this._$focusableElements.some(($focusableElement) => $focusableElement === $target);
67
+ if (!isFocusable || hasBeenEncountered)
68
+ return;
69
+ this._$focusableElements.push($target);
70
+ if ($target.closest('[aria-hidden="true"]')) {
71
+ $target.setAttribute('tabindex', '-1');
72
+ }
73
+ }
74
+ });
75
+ mutationObserver.observe(this, { attributes: true, childList: true, subtree: true });
43
76
  }
44
77
  getSlider() {
45
78
  return this._slider;
46
79
  }
80
+ disconnectedCallback() {
81
+ var _a, _b;
82
+ super.disconnectedCallback();
83
+ (_a = this._slider) === null || _a === void 0 ? void 0 : _a.off('visible');
84
+ (_b = this._slider) === null || _b === void 0 ? void 0 : _b.off('hidden');
85
+ }
47
86
  };
48
87
  tslib_es6.__decorate([
49
88
  decorators.property({ reflect: true }),
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA,yBAAyB,gEAAoE;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA,yBAAyB,gEAAoE;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS = {
6
+ show: 'show',
7
+ hide: 'hide'
8
+ };
9
+
10
+ exports.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS = SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS;
11
+ //# sourceMappingURL=slider_constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -5,37 +5,64 @@ 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');
9
8
  var list_box_controller_constants = require('./list_box_controller_constants.js');
10
9
 
11
- var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController_currentOptionIndex, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
10
+ var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
12
11
  class ListBoxKeyboardController {
13
12
  constructor({ host, $list, listItemSelector = '[role="option"]', orientation = list_box_controller_constants.LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS.vertical }) {
14
13
  _ListBoxKeyboardController_host.set(this, void 0);
15
14
  _ListBoxKeyboardController__$list.set(this, void 0);
16
- _ListBoxKeyboardController_currentOptionIndex.set(this, void 0);
17
15
  _ListBoxKeyboardController__$options.set(this, void 0);
18
16
  _ListBoxKeyboardController_listItemSelector.set(this, void 0);
19
17
  _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
+ };
20
25
  this._handleArrowNavigation = (event) => {
21
26
  event.preventDefault();
22
27
  const { key } = event;
23
- const prevOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
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();
24
32
  let newOptionIndex = key === 'ArrowDown' || key === 'ArrowRight' ? this._getNextOptionIndex() : this._getPrevOptionIndex();
25
33
  if (newOptionIndex === undefined) {
26
- const selectedOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
27
- newOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
34
+ newOptionIndex = this._findCurrentIndex();
28
35
  }
29
- if (newOptionIndex === tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f"))
36
+ if (newOptionIndex === this.currentOptionIndex)
30
37
  return;
31
38
  if (prevOptionIndex !== undefined) {
32
39
  const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[prevOptionIndex];
33
- utilities.UiDomUtils.makeUnnavigable($prevOption);
40
+ $prevOption && utilities.UiDomUtils.makeUnnavigable($prevOption);
34
41
  }
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();
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;
39
66
  };
40
67
  tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_host, host, "f");
41
68
  tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController__$list, $list, "f");
@@ -45,40 +72,59 @@ class ListBoxKeyboardController {
45
72
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").addController(this);
46
73
  }
47
74
  hostConnected() {
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
- });
75
+ tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('keydown', this._handleKeyboardNavigation);
54
76
  utilities.UiDomUtils.makeNavigable(tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"));
55
77
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('focusin', (event) => {
56
78
  if (event.target !== tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"))
57
79
  return;
58
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
80
+ if (this.currentOptionIndex === undefined)
59
81
  return;
60
- const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f")];
82
+ const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[this.currentOptionIndex];
61
83
  utilities.UiDomUtils.makeUnnavigable($prevOption);
62
- tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, undefined, "f");
84
+ this.currentOptionIndex = undefined;
63
85
  });
64
86
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").forEach(($option) => utilities.UiDomUtils.makeUnnavigable($option));
65
87
  }
66
88
  _getPrevOptionIndex() {
67
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
89
+ if (this.currentOptionIndex === undefined)
68
90
  return undefined;
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;
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;
72
105
  }
73
106
  _getNextOptionIndex() {
74
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
107
+ if (this.currentOptionIndex === undefined)
75
108
  return undefined;
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;
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);
79
125
  }
80
126
  }
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();
127
+ _ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
82
128
 
83
129
  exports.ListBoxKeyboardController = ListBoxKeyboardController;
84
130
  //# 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;"}
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;"}
@@ -17,6 +17,7 @@ export declare class HDropdown extends PhoenixLightLitElement implements IDropdo
17
17
  mobilePosition: TMobileElementPosition;
18
18
  id: string;
19
19
  preventFocusTrap: boolean;
20
+ noAutoFocus: boolean;
20
21
  $dropdownToggler: HDropdownToggler | null;
21
22
  $dropdownContent: HDropdownContent | null;
22
23
  $nestedDropdownContentElements?: HDropdownContent[];
@@ -28,6 +28,7 @@ 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;
31
32
  this._backdropController = new BackdropController();
32
33
  this._handleClickOutside = async (target) => {
33
34
  var _a, _b;
@@ -44,7 +45,8 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
44
45
  return;
45
46
  }
46
47
  await this.show();
47
- this._focusOnFirstContentElement();
48
+ if (!this.noAutoFocus)
49
+ this._focusOnFirstContentElement();
48
50
  };
49
51
  this.show = async () => {
50
52
  if (this.opened)
@@ -172,7 +174,8 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
172
174
  const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
173
175
  if (isHoveredWithinDropdown && !this.opened) {
174
176
  await this.show();
175
- this._focusOnFirstContentElement();
177
+ if (!this.noAutoFocus)
178
+ this._focusOnFirstContentElement();
176
179
  return;
177
180
  }
178
181
  if (!isHoveredWithinDropdown && this.opened)
@@ -462,6 +465,10 @@ __decorate([
462
465
  property({ type: Boolean, attribute: 'prevent-focus-trap' }),
463
466
  __metadata("design:type", Object)
464
467
  ], 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);
465
472
  HDropdown = HDropdown_1 = __decorate([
466
473
  phoenixCustomElement('h-dropdown'),
467
474
  __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,eAAe,qDAAyD;AACxE;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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qDAAyD;AACxE;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;AACA;AACA;"}
@@ -1,6 +1,9 @@
1
1
  import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
2
  export declare class HDropdownToggler extends PhoenixLightLitElement {
3
3
  name: string;
4
+ ariaHasPopup: string;
5
+ ariaControls: string;
6
+ role: string;
4
7
  private _btnController;
5
8
  private _toggleElementAriaController;
6
9
  private _$dropdown;
@@ -3,7 +3,6 @@ import { property } from 'lit/decorators';
3
3
  import '@dreamcommerce/utilities';
4
4
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
5
5
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
6
- import { BtnController } from '../../controllers/btn_controller/btn_controller.js';
7
6
  import { BREAKPOINTS } from '../../global_constants.js';
8
7
  import { DROPDOWN_CONTAINER_NAME, DROPDOWN_EVENTS, DROPDOWN_CSS_CLASSES, DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME } from './dropdown_constants.js';
9
8
  import { ToggleElementAriaController } from '../../controllers/toggle_element_aria_controller/toggle_element_aria_controller.js';
@@ -12,6 +11,9 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
12
11
  constructor() {
13
12
  super();
14
13
  this.name = '';
14
+ this.ariaHasPopup = 'menu';
15
+ this.ariaControls = '';
16
+ this.role = 'button';
15
17
  this._setupTogglerAria = () => {
16
18
  this._$dropdown = this.closest(DROPDOWN_CONTAINER_NAME);
17
19
  if (this._$dropdown.isOpened)
@@ -19,11 +21,14 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
19
21
  host: this,
20
22
  initialAriaExpandedValue: this._$dropdown.isOpened()
21
23
  });
22
- this.setAttribute('aria-haspopup', 'true');
23
- if (this._$dropdown.id)
24
- this.setAttribute('aria-controls', this._$dropdown.id);
24
+ this.setAttribute('role', this.role);
25
+ this.setAttribute('aria-haspopup', this.ariaHasPopup);
26
+ if (this.ariaControls || this._$dropdown.id)
27
+ this.setAttribute('aria-controls', this.ariaControls || this._$dropdown.id);
25
28
  };
26
29
  this._dispatchToggleDropdownEventWithKeyboard = (ev) => {
30
+ if (ev.key !== 'Enter' && ev.key !== ' ')
31
+ return;
27
32
  ev.stopImmediatePropagation();
28
33
  this._dispatchToggleDropdownEvent(ev);
29
34
  };
@@ -42,7 +47,8 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
42
47
  connectedCallback() {
43
48
  var _a;
44
49
  super.connectedCallback();
45
- this._btnController = new BtnController(this, this._dispatchToggleDropdownEventWithKeyboard);
50
+ this.setAttribute('tabindex', '0');
51
+ this.addEventListener('keydown', this._dispatchToggleDropdownEventWithKeyboard);
46
52
  this._setupTogglerAria();
47
53
  const hasToggleOnHover = (_a = this._$dropdown) === null || _a === void 0 ? void 0 : _a.hasAttribute(DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME);
48
54
  if (hasToggleOnHover) {
@@ -56,6 +62,18 @@ __decorate([
56
62
  property({ type: String, reflect: true }),
57
63
  __metadata("design:type", Object)
58
64
  ], HDropdownToggler.prototype, "name", void 0);
65
+ __decorate([
66
+ property({ type: String, attribute: 'aria-haspopup' }),
67
+ __metadata("design:type", Object)
68
+ ], HDropdownToggler.prototype, "ariaHasPopup", void 0);
69
+ __decorate([
70
+ property({ type: String, attribute: 'aria-controls' }),
71
+ __metadata("design:type", Object)
72
+ ], HDropdownToggler.prototype, "ariaControls", void 0);
73
+ __decorate([
74
+ property({ type: String }),
75
+ __metadata("design:type", Object)
76
+ ], HDropdownToggler.prototype, "role", void 0);
59
77
  HDropdownToggler = __decorate([
60
78
  phoenixCustomElement('h-dropdown-toggler'),
61
79
  __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;"}
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -9,6 +9,7 @@ export declare class HRadioControl extends PhoenixLightLitElement {
9
9
  readonly: boolean;
10
10
  checked: boolean;
11
11
  value: string;
12
+ ariaDescribedby: string;
12
13
  constructor();
13
14
  connectedCallback(): void;
14
15
  protected render(): TemplateResult;
@@ -37,6 +37,7 @@ let HRadioControl = class HRadioControl extends PhoenixLightLitElement {
37
37
  ?readonly="${this.readonly}"
38
38
  ?hidden="${this.hidden}"
39
39
  .checked="${this.checked}"
40
+ aria-describedby="${ifDefined(this.ariaDescribedby)}"
40
41
  @change="${this._handleChangeEvent}"
41
42
  />
42
43
 
@@ -76,6 +77,10 @@ __decorate([
76
77
  property({ type: String }),
77
78
  __metadata("design:type", String)
78
79
  ], HRadioControl.prototype, "value", void 0);
80
+ __decorate([
81
+ property({ type: String, attribute: 'aria-describedby' }),
82
+ __metadata("design:type", String)
83
+ ], HRadioControl.prototype, "ariaDescribedby", void 0);
79
84
  HRadioControl = __decorate([
80
85
  phoenixCustomElement('h-radio-control'),
81
86
  __metadata("design:paramtypes", [])
@@ -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;"}
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;"}
@@ -2,7 +2,11 @@ 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;
5
6
  connectedCallback(): void;
7
+ private _handleSearchKeydown;
8
+ private _handleDispatchEventOnOptionsList;
9
+ private _handleFocusOptionOnArrowNavigation;
6
10
  private _handleInputChange;
7
11
  protected render(): TemplateResult;
8
12
  }
@@ -1,9 +1,11 @@
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';
4
5
  import { PhoenixLightLitElement } from '../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
5
6
  import { phoenixCustomElement } from '../../../../../core/decorators/phoenix_custom_element.js';
6
7
  import { SELECT_SEARCH_EVENT_NAMES, SELECT_RELATED_COMPONENTS_NAMES } from '../select_components_constatns.js';
8
+ import { DROPDOWN_CONTENT_NAME } from '../../../../dropdown/dropdown_constants.js';
7
9
  import debounce_1 from '../../../../../../../../external/lodash/debounce.js';
8
10
  import { SELECT_SEARCH_CSS_CLASSES } from './select_search_constants.js';
9
11
 
@@ -11,6 +13,32 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
11
13
  constructor() {
12
14
  super(...arguments);
13
15
  this.value = '';
16
+ this._$selectOptions = null;
17
+ this._handleSearchKeydown = (ev) => {
18
+ if (ev.key !== 'ArrowDown' && ev.key !== 'ArrowUp')
19
+ return;
20
+ this._handleFocusOptionOnArrowNavigation();
21
+ this._handleDispatchEventOnOptionsList(ev);
22
+ };
23
+ this._handleDispatchEventOnOptionsList = (ev) => {
24
+ var _a;
25
+ const arrowNavigationEvent = new KeyboardEvent('keydown', {
26
+ key: ev.key
27
+ });
28
+ (_a = this._$selectOptions) === null || _a === void 0 ? void 0 : _a.dispatchEvent(arrowNavigationEvent);
29
+ };
30
+ this._handleFocusOptionOnArrowNavigation = () => {
31
+ const $options = this._$selectOptions ? [...this._$selectOptions.querySelectorAll('h-option')] : [];
32
+ const $availableOptions = $options.filter(($option) => {
33
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
34
+ });
35
+ const $firstOption = $availableOptions.find(($option) => {
36
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
37
+ });
38
+ const $selectedOption = $availableOptions.find(($option) => $option.getAttribute('aria-selected'));
39
+ const $optionToFocus = $selectedOption || $firstOption;
40
+ $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
41
+ };
14
42
  this._handleInputChange = debounce_1(({ target }) => {
15
43
  this.value = target.value;
16
44
  this.emitCustomEvent(SELECT_SEARCH_EVENT_NAMES.search, {
@@ -21,6 +49,9 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
21
49
  connectedCallback() {
22
50
  super.connectedCallback();
23
51
  this.classList.add(SELECT_SEARCH_CSS_CLASSES.selectSearch);
52
+ const $selectOptionsContainer = this.closest(DROPDOWN_CONTENT_NAME);
53
+ this._$selectOptions = $selectOptionsContainer === null || $selectOptionsContainer === void 0 ? void 0 : $selectOptionsContainer.querySelector('h-options');
54
+ this.addEventListener('keydown', this._handleSearchKeydown);
24
55
  }
25
56
  render() {
26
57
  return html `
@@ -1 +1 @@
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
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;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;AACA;AACA;"}
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { UiDomUtils } from '@dreamcommerce/utilities';
2
+ import '@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,7 +22,6 @@ let HOptions = class HOptions extends PhoenixLightLitElement {
22
22
  });
23
23
  };
24
24
  this.setAttribute('role', 'listbox');
25
- UiDomUtils.makeNavigable(this);
26
25
  this.addEventListener(SELECT_OPTION_EVENT_NAMES.clicked, this._dispatchClickedEvent);
27
26
  this.addEventListener(SELECT_OPTION_EVENT_NAMES.updated, this._dispatchUpdatedEvent);
28
27
  }
@@ -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;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;"}
@@ -0,0 +1,15 @@
1
+ import { TSelectTogglerKeyboardControllerConstructorOptions } from './select_toggler_keyboard_controller_types';
2
+ export declare class SelectTogglerKeyboardController {
3
+ #private;
4
+ constructor({ host, $toggler, $list, listItemSelector, }: TSelectTogglerKeyboardControllerConstructorOptions);
5
+ hostConnected(): void;
6
+ private _handleKeyboardNavigation;
7
+ private _openSelect;
8
+ private _openSelectAndGoToFirstElement;
9
+ private _openSelectAndGoToLastElement;
10
+ private _openSelectAndGoToMatchedElement;
11
+ private _getAvailableOptions;
12
+ private _findSelectedIndex;
13
+ private _navigate;
14
+ hostDisconnected(): void;
15
+ }