@shoper/phoenix_design_system 1.15.4 → 1.15.6-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 (66) hide show
  1. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +21 -29
  2. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +0 -4
  4. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +121 -11
  6. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +0 -2
  8. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
  10. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +6 -1
  12. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js +30 -0
  14. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  15. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
  16. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  17. package/build/cjs/packages/phoenix/src/components/form/select/select.js +41 -8
  18. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  19. package/build/cjs/packages/phoenix/src/components/messages/base_message.js +16 -47
  20. package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  21. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +0 -2
  22. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  23. package/build/cjs/packages/phoenix/src/components/modal/modal_opener.js +1 -0
  24. package/build/cjs/packages/phoenix/src/components/modal/modal_opener.js.map +1 -1
  25. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +62 -15
  26. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  27. package/build/cjs/packages/phoenix/src/index.js +5 -5
  28. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.d.ts +3 -6
  29. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +22 -30
  30. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  31. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +1 -4
  32. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
  33. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +11 -1
  34. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +124 -14
  35. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  36. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +1 -2
  37. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  38. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +1 -0
  39. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
  40. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  41. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +1 -0
  42. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +6 -1
  43. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  44. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +4 -0
  45. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +30 -0
  46. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  47. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
  48. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  49. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +6 -2
  50. package/build/esm/packages/phoenix/src/components/form/select/select.js +41 -8
  51. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  52. package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +2 -3
  53. package/build/esm/packages/phoenix/src/components/messages/base_message.js +18 -49
  54. package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  55. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +3 -4
  56. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  57. package/build/esm/packages/phoenix/src/components/modal/modal_opener.js +1 -0
  58. package/build/esm/packages/phoenix/src/components/modal/modal_opener.js.map +1 -1
  59. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.d.ts +6 -2
  60. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js +1 -0
  61. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js.map +1 -1
  62. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.d.ts +7 -3
  63. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +62 -15
  64. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  65. package/build/esm/packages/phoenix/src/index.js +1 -1
  66. package/package.json +1 -1
@@ -1,12 +1,13 @@
1
1
  import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
2
2
  import { html, nothing } from 'lit';
3
3
  import { property } from 'lit/decorators';
4
- import { ArrayUtils } from '@dreamcommerce/utilities';
4
+ import { UiDomUtils, ArrayUtils } from '@dreamcommerce/utilities';
5
5
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
6
6
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
7
+ import { KeystrokesController } from '../../controllers/keystrokes_controller/keystrokes_controller.js';
7
8
  import 'lit-html';
8
- import { COLOR_SWATCHES_EVENT_NAMES, COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_TAG_NAME, COLOR_SWATCHES_HIDDEN_ATTRIBUTE } from './color_swatches_constants.js';
9
- import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item/color_item_constants.js';
9
+ import { COLOR_SWATCHES_EVENT_NAMES, COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE } from './color_swatches_constants.js';
10
+ import { COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item/color_item_constants.js';
10
11
 
11
12
  let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
12
13
  constructor() {
@@ -14,8 +15,87 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
14
15
  this.multiple = false;
15
16
  this.selectedColors = [];
16
17
  this.showMoreBtnText = 'Pokaż wszystkie kolory';
17
- this._handleColorClicked = ({ target }) => {
18
- const $colorItem = target;
18
+ this._setupEvents = () => {
19
+ if (this.getAttribute('role') === 'group') {
20
+ this._setupCheckboxGroupEvents();
21
+ }
22
+ else {
23
+ this._setupRadioGroupEvents();
24
+ }
25
+ };
26
+ this._setupCheckboxGroupEvents = () => {
27
+ this._setupColorClickEvents();
28
+ };
29
+ this._setupRadioGroupEvents = () => {
30
+ document.body.addEventListener('keydown', this._focusOnSelectedColor);
31
+ this.addEventListener('keydown', this._handleTabNavigation);
32
+ this.addEventListener('keyup', this._handleRadioNavigation);
33
+ this._setupColorClickEvents();
34
+ };
35
+ this._setupColorClickEvents = () => {
36
+ if (!this._$colorSwatchesChildren)
37
+ return;
38
+ this._$colorSwatchesChildren.forEach(($colorItem) => {
39
+ $colorItem.addEventListener('click', this._handleColorClicked);
40
+ new KeystrokesController({
41
+ host: this,
42
+ keys: [' '],
43
+ callback: this._handleColorClicked,
44
+ target: $colorItem
45
+ });
46
+ });
47
+ };
48
+ this._handleColorClicked = (ev) => {
49
+ ev.preventDefault();
50
+ const $colorItem = ev.target;
51
+ if ($colorItem.unclickable)
52
+ return;
53
+ this._toggleColorItem($colorItem);
54
+ this._dispatchColorChangeEvent($colorItem);
55
+ };
56
+ this._handleTabNavigation = (ev) => {
57
+ if (ev.key !== 'Tab')
58
+ return;
59
+ ev.preventDefault();
60
+ if (ev.shiftKey) {
61
+ const $firstFocusableColor = UiDomUtils.getFocusableElement(this);
62
+ UiDomUtils.getPreviousFocusableElement($firstFocusableColor).focus();
63
+ return;
64
+ }
65
+ const $LastFocusableColor = UiDomUtils.getLastFocusableElement(this);
66
+ UiDomUtils.getNextFocusableElement($LastFocusableColor).focus();
67
+ };
68
+ this._handleRadioNavigation = (ev) => {
69
+ const changeToNextKeys = ['ArrowDown', 'ArrowRight'];
70
+ const changeToPreviousKeys = ['ArrowUp', 'ArrowLeft'];
71
+ if (!changeToNextKeys.includes(ev.key) && !changeToPreviousKeys.includes(ev.key))
72
+ return;
73
+ ev.preventDefault();
74
+ if (changeToNextKeys.includes(ev.key)) {
75
+ this._handleChangeToNextColorItem(ev);
76
+ }
77
+ if (changeToPreviousKeys.includes(ev.key)) {
78
+ this._handleChangeToPreviousColorItem(ev);
79
+ }
80
+ };
81
+ this._focusOnSelectedColor = (ev) => {
82
+ if (ev.key !== 'Tab' || this.multiple)
83
+ return;
84
+ if (ev.shiftKey) {
85
+ const $previousFocusableElement = UiDomUtils.getPreviousFocusableElement(document.activeElement);
86
+ if (this.contains($previousFocusableElement) && this.selectedColors.length > 0) {
87
+ ev.preventDefault();
88
+ this.selectedColors[0].focus();
89
+ }
90
+ return;
91
+ }
92
+ const $nextFocusableElement = UiDomUtils.getNextFocusableElement(document.activeElement);
93
+ if (this.contains($nextFocusableElement) && this.selectedColors.length > 0) {
94
+ ev.preventDefault();
95
+ this.selectedColors[0].focus();
96
+ }
97
+ };
98
+ this._handleColorChange = ($colorItem) => {
19
99
  this._toggleColorItem($colorItem);
20
100
  this._dispatchColorChangeEvent($colorItem);
21
101
  };
@@ -52,6 +132,8 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
52
132
  }
53
133
  connectedCallback() {
54
134
  super.connectedCallback();
135
+ this.setAttribute('role', this.multiple ? 'group' : 'radiogroup');
136
+ this._$colorSwatchesChildren = [...this.children];
55
137
  this._setupEvents();
56
138
  this._addCssClasses();
57
139
  this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
@@ -64,11 +146,9 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
64
146
  this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
65
147
  }
66
148
  _hideItems(numberOfVisibleColors) {
67
- var _a;
68
- this._$colorSwatchesChildren = (_a = document.querySelector(COLOR_SWATCHES_TAG_NAME)) === null || _a === void 0 ? void 0 : _a.children;
69
149
  if (!this._$colorSwatchesChildren)
70
150
  return;
71
- Array.from(this._$colorSwatchesChildren).forEach(($colorSwatchesChild, index) => {
151
+ this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
72
152
  if (index > numberOfVisibleColors - 1) {
73
153
  $colorSwatchesChild.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
74
154
  }
@@ -79,17 +159,40 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
79
159
  var _a;
80
160
  if (!this._$colorSwatchesChildren)
81
161
  return;
82
- Array.from(this._$colorSwatchesChildren).forEach(($colorSwatchesChild) => {
162
+ this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
83
163
  $colorSwatchesChild.removeAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
84
164
  });
85
165
  (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
86
166
  });
87
167
  }
88
- _setupEvents() {
89
- this.addEventListener(COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
168
+ _handleChangeToNextColorItem({ target }) {
169
+ const $colorItem = target;
170
+ const $nextFocusableElement = UiDomUtils.getNextFocusableElement($colorItem);
171
+ let $nextColorItem;
172
+ if (!this.contains($nextFocusableElement)) {
173
+ $nextColorItem = UiDomUtils.getFocusableElement(this);
174
+ }
175
+ else {
176
+ $nextColorItem = $nextFocusableElement;
177
+ }
178
+ $nextColorItem.focus();
179
+ this._handleColorChange($nextColorItem);
180
+ }
181
+ _handleChangeToPreviousColorItem({ target }) {
182
+ const $colorItem = target;
183
+ const $previousFocusableElement = UiDomUtils.getPreviousFocusableElement($colorItem);
184
+ let $previousColorItem;
185
+ if (!this.contains($previousFocusableElement)) {
186
+ $previousColorItem = UiDomUtils.getLastFocusableElement(this);
187
+ }
188
+ else {
189
+ $previousColorItem = $previousFocusableElement;
190
+ }
191
+ $previousColorItem.focus();
192
+ this._handleColorChange($previousColorItem);
90
193
  }
91
194
  _toggleColorItem($colorItem) {
92
- this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
195
+ this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorChangeForSingleMode($colorItem);
93
196
  }
94
197
  _handleColorClickedForMultipleMode($colorItem) {
95
198
  !this._isColorAlreadyExistInArray($colorItem)
@@ -97,17 +200,20 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
97
200
  : this._removeExistingColorFromArray($colorItem);
98
201
  this._toggleSelectedAttribute($colorItem);
99
202
  }
100
- _handleColorClickedForSingleMode($colorItem) {
203
+ _handleColorChangeForSingleMode($colorItem) {
101
204
  const $previouslySelected = this.selectedColors[0];
102
205
  this._toggleSelectedAttribute($colorItem);
103
- if ($previouslySelected && $previouslySelected !== $colorItem)
206
+ if ($previouslySelected && $previouslySelected !== $colorItem) {
104
207
  $previouslySelected.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE);
208
+ $previouslySelected.setAttribute('aria-checked', 'false');
209
+ }
105
210
  this.selectedColors = $previouslySelected === $colorItem ? [] : [$colorItem];
106
211
  }
107
212
  _toggleSelectedAttribute($colorItem) {
108
213
  $colorItem.hasAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
109
214
  ? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
110
215
  : $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
216
+ $colorItem.setAttribute('aria-checked', 'true');
111
217
  }
112
218
  _isColorAlreadyExistInArray($colorItem) {
113
219
  return this.selectedColors.includes($colorItem);
@@ -116,6 +222,10 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
116
222
  const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
117
223
  this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
118
224
  }
225
+ disconnectedCallback() {
226
+ super.disconnectedCallback();
227
+ document.body.removeEventListener('keydown', this._focusOnSelectedColor);
228
+ }
119
229
  render() {
120
230
  return html `
121
231
  ${this.getSlot('default')}
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4 @@
1
1
  const colorSwatchesBaseCssClass = 'color-swatches';
2
- const COLOR_SWATCHES_TAG_NAME = 'h-color-swatches';
3
2
  const COLOR_ITEM_TAG_NAME = 'h-color-item';
4
3
  const COLOR_SWATCHES_CSS_CLASSES = {
5
4
  colorSwatches: colorSwatchesBaseCssClass,
@@ -12,5 +11,5 @@ const COLOR_SWATCHES_EVENT_NAMES = {
12
11
  };
13
12
  const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
14
13
 
15
- export { COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE, COLOR_SWATCHES_TAG_NAME };
14
+ export { COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE };
16
15
  //# sourceMappingURL=color_swatches_constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -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,7 @@
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;
4
5
  private _btnController;
5
6
  private _toggleElementAriaController;
6
7
  private _$dropdown;
@@ -12,6 +12,7 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
12
12
  constructor() {
13
13
  super();
14
14
  this.name = '';
15
+ this.ariaHasPopup = 'menu';
15
16
  this._setupTogglerAria = () => {
16
17
  this._$dropdown = this.closest(DROPDOWN_CONTAINER_NAME);
17
18
  if (this._$dropdown.isOpened)
@@ -19,7 +20,7 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
19
20
  host: this,
20
21
  initialAriaExpandedValue: this._$dropdown.isOpened()
21
22
  });
22
- this.setAttribute('aria-haspopup', 'true');
23
+ this.setAttribute('aria-haspopup', this.ariaHasPopup);
23
24
  if (this._$dropdown.id)
24
25
  this.setAttribute('aria-controls', this._$dropdown.id);
25
26
  };
@@ -56,6 +57,10 @@ __decorate([
56
57
  property({ type: String, reflect: true }),
57
58
  __metadata("design:type", Object)
58
59
  ], HDropdownToggler.prototype, "name", void 0);
60
+ __decorate([
61
+ property({ type: String, attribute: 'aria-haspopup' }),
62
+ __metadata("design:type", Object)
63
+ ], HDropdownToggler.prototype, "ariaHasPopup", void 0);
59
64
  HDropdownToggler = __decorate([
60
65
  phoenixCustomElement('h-dropdown-toggler'),
61
66
  __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;"}
@@ -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,6 +1,7 @@
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';
@@ -11,6 +12,32 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
11
12
  constructor() {
12
13
  super(...arguments);
13
14
  this.value = '';
15
+ this._$selectOptions = null;
16
+ this._handleSearchKeydown = (ev) => {
17
+ if (ev.key !== 'ArrowDown' && ev.key !== 'ArrowUp')
18
+ return;
19
+ this._handleFocusOptionOnArrowNavigation();
20
+ this._handleDispatchEventOnOptionsList(ev);
21
+ };
22
+ this._handleDispatchEventOnOptionsList = (ev) => {
23
+ var _a;
24
+ const arrowNavigationEvent = new KeyboardEvent('keydown', {
25
+ key: ev.key
26
+ });
27
+ (_a = this._$selectOptions) === null || _a === void 0 ? void 0 : _a.dispatchEvent(arrowNavigationEvent);
28
+ };
29
+ this._handleFocusOptionOnArrowNavigation = () => {
30
+ const $options = this._$selectOptions ? [...this._$selectOptions.querySelectorAll('h-option')] : [];
31
+ const $availableOptions = $options.filter(($option) => {
32
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
33
+ });
34
+ const $firstOption = $availableOptions.find(($option) => {
35
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
36
+ });
37
+ const $selectedOption = $availableOptions.find(($option) => $option.getAttribute('aria-selected'));
38
+ const $optionToFocus = $selectedOption || $firstOption;
39
+ $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
40
+ };
14
41
  this._handleInputChange = debounce_1(({ target }) => {
15
42
  this.value = target.value;
16
43
  this.emitCustomEvent(SELECT_SEARCH_EVENT_NAMES.search, {
@@ -21,6 +48,9 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
21
48
  connectedCallback() {
22
49
  super.connectedCallback();
23
50
  this.classList.add(SELECT_SEARCH_CSS_CLASSES.selectSearch);
51
+ // to musisz zrobić inaczej, bo jest kilka selectów na stronie
52
+ this._$selectOptions = document.querySelector('h-options');
53
+ this.addEventListener('keydown', this._handleSearchKeydown);
24
54
  }
25
55
  render() {
26
56
  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,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;"}
@@ -1,5 +1,7 @@
1
1
  import { PropertyValues, TemplateResult } from 'lit';
2
2
  import { HOption } from "./components/option/select_option";
3
+ import { HSelectSearch } from "./components/search/select_search";
4
+ import { ListBoxKeyboardController } from "../../../controllers/list_box_controller/list_box_keyboard_controller";
3
5
  import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
4
6
  import { SelectOption } from "./model/select_option";
5
7
  import type { TSelectType } from "./select_types";
@@ -29,13 +31,14 @@ export declare class HSelect extends PhoenixLightLitElement {
29
31
  private _selectController;
30
32
  private _$options;
31
33
  private _$dropdown;
32
- private _$search;
34
+ $search: import("lit-html/directives/ref.js").Ref<HSelectSearch>;
33
35
  private _$optionsList;
34
36
  private _$dropdownContent;
35
37
  private _$dropdownToggler;
36
38
  private _selectContext;
37
- private _listBoxController;
39
+ listBoxController: ListBoxKeyboardController;
38
40
  private _optionsObserver;
41
+ private _selectedOptionsAriaObserver;
39
42
  private $placeholder;
40
43
  constructor();
41
44
  updated(changedProperties: PropertyValues): void;
@@ -47,6 +50,7 @@ export declare class HSelect extends PhoenixLightLitElement {
47
50
  private _setupEvents;
48
51
  private _handleOptionDeselect;
49
52
  private _updateOptionsView;
53
+ private _updateLabelAria;
50
54
  private _appendNewHTMLOption;
51
55
  updateOptionAriaAttribute($option: HOption): void;
52
56
  private _removeHTMLOptions;
@@ -40,7 +40,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
40
40
  this._searchValue = '';
41
41
  this._$options = new Map();
42
42
  this._$dropdown = createRef();
43
- this._$search = createRef();
43
+ this.$search = createRef();
44
44
  this._$optionsList = createRef();
45
45
  this._$dropdownContent = createRef();
46
46
  this._$dropdownToggler = createRef();
@@ -101,6 +101,19 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
101
101
  this.updateOptionAriaAttribute($option);
102
102
  });
103
103
  };
104
+ this._updateLabelAria = (options) => {
105
+ var _a;
106
+ const ariaLabel = document.querySelector(`[id="${this.ariaLabelledby}"]`);
107
+ (_a = ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.querySelector(`[id="value-label"]`)) === null || _a === void 0 ? void 0 : _a.remove();
108
+ if (ariaLabel) {
109
+ ariaLabel.innerHTML = `
110
+ ${ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.innerHTML}
111
+ <span id="value-label" class="sr-only">
112
+ ${options.reduce((totalSelectedContent, currentOption) => (totalSelectedContent += currentOption.content), '')}
113
+ </span>
114
+ `;
115
+ }
116
+ };
104
117
  this._handleOptionClicked = ({ detail }) => {
105
118
  if (!(detail === null || detail === void 0 ? void 0 : detail.$option))
106
119
  return;
@@ -116,10 +129,11 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
116
129
  });
117
130
  };
118
131
  this._handleDropdownHidden = () => {
119
- var _a;
132
+ var _a, _b;
120
133
  this._searchValue = '';
121
134
  this.opened = false;
122
135
  (_a = this._$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', '');
136
+ (_b = this._$dropdownToggler.value) === null || _b === void 0 ? void 0 : _b.focus();
123
137
  };
124
138
  this._manageSelectFocusAria = (ev) => {
125
139
  var _a;
@@ -179,6 +193,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
179
193
  return Array.from(this._$options.values());
180
194
  }
181
195
  updated(changedProperties) {
196
+ var _a;
182
197
  super.updated(changedProperties);
183
198
  if (changedProperties.has('opened')) {
184
199
  if (this.opened) {
@@ -192,16 +207,27 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
192
207
  if (changedProperties.has('optionsList')) {
193
208
  this._updateOptions();
194
209
  }
195
- if (this._$optionsList.value && !this._listBoxController)
196
- this._listBoxController = new ListBoxKeyboardController({
210
+ if (this._$optionsList.value) {
211
+ (_a = this.listBoxController) === null || _a === void 0 ? void 0 : _a.hostDisconnected();
212
+ this.listBoxController = new ListBoxKeyboardController({
197
213
  host: this,
198
214
  $list: this._$optionsList.value
199
215
  });
216
+ }
217
+ if (this.listBoxController) {
218
+ this.listBoxController.calculateSelectedOptionIndex();
219
+ }
200
220
  }
201
221
  _focusElementAfterSelectOpened() {
202
- var _a, _b;
203
- const $searchInput = (_a = this._$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
204
- $searchInput ? $searchInput.focus() : (_b = this._$optionsList.value) === null || _b === void 0 ? void 0 : _b.focus();
222
+ var _a;
223
+ const $searchInput = (_a = this.$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
224
+ const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
225
+ const $firstOption = $options.find(($option) => {
226
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
227
+ });
228
+ const $selectedOption = this.selectedOptions[0];
229
+ const $optionToFocus = $selectedOption || $firstOption;
230
+ $searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
205
231
  }
206
232
  connectedCallback() {
207
233
  super.connectedCallback();
@@ -214,6 +240,8 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
214
240
  this._selectContext.provide(SELECT_CONTEXTS.isMultiselect, this.multiple);
215
241
  this._optionsObserver = new Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
216
242
  this._selectController.options$.subscribe(this._optionsObserver);
243
+ this._selectedOptionsAriaObserver = new Observer((selectedOptions) => this._updateLabelAria(selectedOptions));
244
+ this._selectController.options$.subscribe(this._selectedOptionsAriaObserver);
217
245
  this._updateOptions();
218
246
  this._setupEvents();
219
247
  }
@@ -243,6 +271,10 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
243
271
  SelectControlUtils.appendHTMLOption($option, $list, position);
244
272
  }
245
273
  updateOptionAriaAttribute($option) {
274
+ if (!this.multiple) {
275
+ const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
276
+ $options.forEach(($option) => ($option.removeAttribute('aria-selected')));
277
+ }
246
278
  $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
247
279
  }
248
280
  _removeHTMLOptions(optionsValues) {
@@ -309,6 +341,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
309
341
  offset=${this.offset}
310
342
  content-width="full"
311
343
  prevent-focus-trap
344
+ no-autofocus
312
345
  >
313
346
  <h-dropdown-toggler
314
347
  ${ref(this._$dropdownToggler)}
@@ -336,7 +369,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
336
369
  ${isSearchEnabled
337
370
  ? html ` <h-select-search
338
371
  class=${SELECT_CSS_CLASSES.selectSearch}
339
- ${ref(this._$search)}
372
+ ${ref(this.$search)}
340
373
  .value=${this._searchValue}
341
374
  @search=${this._handleSearch}
342
375
  ></h-select-search>`
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -6,6 +6,8 @@ export declare class BaseMessage extends PhoenixLightLitElement implements IBase
6
6
  portalTarget: string;
7
7
  direction: TDirection;
8
8
  offset: number;
9
+ mouseonly: boolean;
10
+ tabindex: string;
9
11
  private _positionController;
10
12
  private _clickOutsideController;
11
13
  private _$messageContent;
@@ -21,7 +23,4 @@ export declare class BaseMessage extends PhoenixLightLitElement implements IBase
21
23
  protected _positionMessage: () => void;
22
24
  open: () => void;
23
25
  close: () => void;
24
- private _handleFocusWithinMessage;
25
- private _handleReverseTab;
26
- private _isBaseMessage;
27
26
  }