@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
@@ -7,47 +7,40 @@ var decorators = require('lit/decorators');
7
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
- var btn_controller = require('../../../controllers/btn_controller/btn_controller.js');
11
10
  var color_item_constants = require('./color_item_constants.js');
12
11
 
13
12
  exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixLightLitElement {
14
13
  constructor() {
15
- super();
14
+ super(...arguments);
16
15
  this.disabled = false;
17
16
  this.selected = false;
18
17
  this.unclickable = false;
19
- this._dispatchClickedEvent = () => {
20
- this.emitEvent(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected);
18
+ this._$colorSwatches = null;
19
+ this._setupAriaAttributes = () => {
20
+ var _a;
21
+ this._$colorSwatches = this.closest('h-color-swatches');
22
+ this.setAttribute('role', ((_a = this._$colorSwatches) === null || _a === void 0 ? void 0 : _a.multiple) ? 'checkbox' : 'radio');
23
+ this.setAttribute('aria-label', this.label ? this.label : this.color);
24
+ };
25
+ this._setupClasses = () => {
26
+ this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES.colorItem);
27
+ if (this.size)
28
+ this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES[this.size]);
21
29
  };
22
- this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
23
30
  }
24
31
  connectedCallback() {
25
32
  super.connectedCallback();
26
- this.setupEvents();
33
+ this._setupAriaAttributes();
34
+ this._setupClasses();
27
35
  this.style.backgroundColor = this.setBgColor(this.disabled);
28
- this._syncAriaPressed();
29
- this.setAttribute('aria-label', this.label ? this.label : this.color);
30
- this.unclickable && this.removeAttribute('tabindex');
31
- this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES.colorItem);
36
+ if (this.unclickable) {
37
+ this.removeAttribute('tabindex');
38
+ }
39
+ else {
40
+ this.setAttribute('tabindex', '0');
41
+ }
32
42
  if (!this.value)
33
43
  this.value = this.color;
34
- if (this.size)
35
- this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES[this.size]);
36
- }
37
- attributeChangedCallback(name, value, newValue) {
38
- super.attributeChangedCallback(name, value, newValue);
39
- switch (name) {
40
- case color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE: {
41
- this._syncAriaPressed();
42
- break;
43
- }
44
- }
45
- }
46
- _syncAriaPressed() {
47
- this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
48
- }
49
- setupEvents() {
50
- !this.unclickable && this.addEventListener('click', this._dispatchClickedEvent);
51
44
  }
52
45
  setBgColor(itemIsDisabled) {
53
46
  return itemIsDisabled ? utilities.ColorUtils.hexToRgba(this.color, 0.5) : this.color;
@@ -82,7 +75,6 @@ tslib_es6.__decorate([
82
75
  tslib_es6.__metadata("design:type", Boolean)
83
76
  ], exports.HColorItem.prototype, "unclickable", void 0);
84
77
  exports.HColorItem = tslib_es6.__decorate([
85
- phoenix_custom_element.phoenixCustomElement('h-color-item'),
86
- tslib_es6.__metadata("design:paramtypes", [])
78
+ phoenix_custom_element.phoenixCustomElement('h-color-item')
87
79
  ], exports.HColorItem);
88
80
  //# sourceMappingURL=color_item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -3,9 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const colorItemBaseCssClass = 'color-item';
6
- const COLOR_ITEM_EVENT_NAMES = {
7
- selected: 'colorItemSelected'
8
- };
9
6
  const COLOR_ITEM_SIZES = {
10
7
  s: 's',
11
8
  xs: 'xs'
@@ -18,7 +15,6 @@ const COLOR_ITEM_CSS_CLASSES = {
18
15
  const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
19
16
 
20
17
  exports.COLOR_ITEM_CSS_CLASSES = COLOR_ITEM_CSS_CLASSES;
21
- exports.COLOR_ITEM_EVENT_NAMES = COLOR_ITEM_EVENT_NAMES;
22
18
  exports.COLOR_ITEM_SELECTED_ATTRIBUTE = COLOR_ITEM_SELECTED_ATTRIBUTE;
23
19
  exports.COLOR_ITEM_SIZES = COLOR_ITEM_SIZES;
24
20
  //# sourceMappingURL=color_item_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;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;AACA;AACA;AACA;AACA;AACA;"}
@@ -8,6 +8,7 @@ var decorators = require('lit/decorators');
8
8
  var utilities = require('@dreamcommerce/utilities');
9
9
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
10
10
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
11
+ var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
11
12
  require('lit-html');
12
13
  var color_swatches_constants = require('./color_swatches_constants.js');
13
14
  var color_item_constants = require('./color_item/color_item_constants.js');
@@ -18,8 +19,87 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
18
19
  this.multiple = false;
19
20
  this.selectedColors = [];
20
21
  this.showMoreBtnText = 'Pokaż wszystkie kolory';
21
- this._handleColorClicked = ({ target }) => {
22
- const $colorItem = target;
22
+ this._setupEvents = () => {
23
+ if (this.getAttribute('role') === 'group') {
24
+ this._setupCheckboxGroupEvents();
25
+ }
26
+ else {
27
+ this._setupRadioGroupEvents();
28
+ }
29
+ };
30
+ this._setupCheckboxGroupEvents = () => {
31
+ this._setupColorClickEvents();
32
+ };
33
+ this._setupRadioGroupEvents = () => {
34
+ document.body.addEventListener('keydown', this._focusOnSelectedColor);
35
+ this.addEventListener('keydown', this._handleTabNavigation);
36
+ this.addEventListener('keyup', this._handleRadioNavigation);
37
+ this._setupColorClickEvents();
38
+ };
39
+ this._setupColorClickEvents = () => {
40
+ if (!this._$colorSwatchesChildren)
41
+ return;
42
+ this._$colorSwatchesChildren.forEach(($colorItem) => {
43
+ $colorItem.addEventListener('click', this._handleColorClicked);
44
+ new keystrokes_controller.KeystrokesController({
45
+ host: this,
46
+ keys: [' '],
47
+ callback: this._handleColorClicked,
48
+ target: $colorItem
49
+ });
50
+ });
51
+ };
52
+ this._handleColorClicked = (ev) => {
53
+ ev.preventDefault();
54
+ const $colorItem = ev.target;
55
+ if ($colorItem.unclickable)
56
+ return;
57
+ this._toggleColorItem($colorItem);
58
+ this._dispatchColorChangeEvent($colorItem);
59
+ };
60
+ this._handleTabNavigation = (ev) => {
61
+ if (ev.key !== 'Tab')
62
+ return;
63
+ ev.preventDefault();
64
+ if (ev.shiftKey) {
65
+ const $firstFocusableColor = utilities.UiDomUtils.getFocusableElement(this);
66
+ utilities.UiDomUtils.getPreviousFocusableElement($firstFocusableColor).focus();
67
+ return;
68
+ }
69
+ const $LastFocusableColor = utilities.UiDomUtils.getLastFocusableElement(this);
70
+ utilities.UiDomUtils.getNextFocusableElement($LastFocusableColor).focus();
71
+ };
72
+ this._handleRadioNavigation = (ev) => {
73
+ const changeToNextKeys = ['ArrowDown', 'ArrowRight'];
74
+ const changeToPreviousKeys = ['ArrowUp', 'ArrowLeft'];
75
+ if (!changeToNextKeys.includes(ev.key) && !changeToPreviousKeys.includes(ev.key))
76
+ return;
77
+ ev.preventDefault();
78
+ if (changeToNextKeys.includes(ev.key)) {
79
+ this._handleChangeToNextColorItem(ev);
80
+ }
81
+ if (changeToPreviousKeys.includes(ev.key)) {
82
+ this._handleChangeToPreviousColorItem(ev);
83
+ }
84
+ };
85
+ this._focusOnSelectedColor = (ev) => {
86
+ if (ev.key !== 'Tab' || this.multiple)
87
+ return;
88
+ if (ev.shiftKey) {
89
+ const $previousFocusableElement = utilities.UiDomUtils.getPreviousFocusableElement(document.activeElement);
90
+ if (this.contains($previousFocusableElement) && this.selectedColors.length > 0) {
91
+ ev.preventDefault();
92
+ this.selectedColors[0].focus();
93
+ }
94
+ return;
95
+ }
96
+ const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement(document.activeElement);
97
+ if (this.contains($nextFocusableElement) && this.selectedColors.length > 0) {
98
+ ev.preventDefault();
99
+ this.selectedColors[0].focus();
100
+ }
101
+ };
102
+ this._handleColorChange = ($colorItem) => {
23
103
  this._toggleColorItem($colorItem);
24
104
  this._dispatchColorChangeEvent($colorItem);
25
105
  };
@@ -56,6 +136,8 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
56
136
  }
57
137
  connectedCallback() {
58
138
  super.connectedCallback();
139
+ this.setAttribute('role', this.multiple ? 'group' : 'radiogroup');
140
+ this._$colorSwatchesChildren = [...this.children];
59
141
  this._setupEvents();
60
142
  this._addCssClasses();
61
143
  this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
@@ -68,11 +150,9 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
68
150
  this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
69
151
  }
70
152
  _hideItems(numberOfVisibleColors) {
71
- var _a;
72
- this._$colorSwatchesChildren = (_a = document.querySelector(color_swatches_constants.COLOR_SWATCHES_TAG_NAME)) === null || _a === void 0 ? void 0 : _a.children;
73
153
  if (!this._$colorSwatchesChildren)
74
154
  return;
75
- Array.from(this._$colorSwatchesChildren).forEach(($colorSwatchesChild, index) => {
155
+ this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
76
156
  if (index > numberOfVisibleColors - 1) {
77
157
  $colorSwatchesChild.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
78
158
  }
@@ -83,17 +163,40 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
83
163
  var _a;
84
164
  if (!this._$colorSwatchesChildren)
85
165
  return;
86
- Array.from(this._$colorSwatchesChildren).forEach(($colorSwatchesChild) => {
166
+ this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
87
167
  $colorSwatchesChild.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
88
168
  });
89
169
  (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
90
170
  });
91
171
  }
92
- _setupEvents() {
93
- this.addEventListener(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
172
+ _handleChangeToNextColorItem({ target }) {
173
+ const $colorItem = target;
174
+ const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement($colorItem);
175
+ let $nextColorItem;
176
+ if (!this.contains($nextFocusableElement)) {
177
+ $nextColorItem = utilities.UiDomUtils.getFocusableElement(this);
178
+ }
179
+ else {
180
+ $nextColorItem = $nextFocusableElement;
181
+ }
182
+ $nextColorItem.focus();
183
+ this._handleColorChange($nextColorItem);
184
+ }
185
+ _handleChangeToPreviousColorItem({ target }) {
186
+ const $colorItem = target;
187
+ const $previousFocusableElement = utilities.UiDomUtils.getPreviousFocusableElement($colorItem);
188
+ let $previousColorItem;
189
+ if (!this.contains($previousFocusableElement)) {
190
+ $previousColorItem = utilities.UiDomUtils.getLastFocusableElement(this);
191
+ }
192
+ else {
193
+ $previousColorItem = $previousFocusableElement;
194
+ }
195
+ $previousColorItem.focus();
196
+ this._handleColorChange($previousColorItem);
94
197
  }
95
198
  _toggleColorItem($colorItem) {
96
- this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
199
+ this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorChangeForSingleMode($colorItem);
97
200
  }
98
201
  _handleColorClickedForMultipleMode($colorItem) {
99
202
  !this._isColorAlreadyExistInArray($colorItem)
@@ -101,17 +204,20 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
101
204
  : this._removeExistingColorFromArray($colorItem);
102
205
  this._toggleSelectedAttribute($colorItem);
103
206
  }
104
- _handleColorClickedForSingleMode($colorItem) {
207
+ _handleColorChangeForSingleMode($colorItem) {
105
208
  const $previouslySelected = this.selectedColors[0];
106
209
  this._toggleSelectedAttribute($colorItem);
107
- if ($previouslySelected && $previouslySelected !== $colorItem)
210
+ if ($previouslySelected && $previouslySelected !== $colorItem) {
108
211
  $previouslySelected.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE);
212
+ $previouslySelected.setAttribute('aria-checked', 'false');
213
+ }
109
214
  this.selectedColors = $previouslySelected === $colorItem ? [] : [$colorItem];
110
215
  }
111
216
  _toggleSelectedAttribute($colorItem) {
112
217
  $colorItem.hasAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
113
218
  ? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
114
219
  : $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
220
+ $colorItem.setAttribute('aria-checked', 'true');
115
221
  }
116
222
  _isColorAlreadyExistInArray($colorItem) {
117
223
  return this.selectedColors.includes($colorItem);
@@ -120,6 +226,10 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
120
226
  const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
121
227
  this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
122
228
  }
229
+ disconnectedCallback() {
230
+ super.disconnectedCallback();
231
+ document.body.removeEventListener('keydown', this._focusOnSelectedColor);
232
+ }
123
233
  render() {
124
234
  return lit.html `
125
235
  ${this.getSlot('default')}
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const colorSwatchesBaseCssClass = 'color-swatches';
6
- const COLOR_SWATCHES_TAG_NAME = 'h-color-swatches';
7
6
  const COLOR_ITEM_TAG_NAME = 'h-color-item';
8
7
  const COLOR_SWATCHES_CSS_CLASSES = {
9
8
  colorSwatches: colorSwatchesBaseCssClass,
@@ -20,5 +19,4 @@ exports.COLOR_ITEM_TAG_NAME = COLOR_ITEM_TAG_NAME;
20
19
  exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
21
20
  exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
22
21
  exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
23
- exports.COLOR_SWATCHES_TAG_NAME = COLOR_SWATCHES_TAG_NAME;
24
22
  //# 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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -32,6 +32,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
32
32
  this.portalTarget = dropdown_constants.DEFAULT_DROPDOWN_PORTAL_NAME;
33
33
  this.id = v4['default']();
34
34
  this.preventFocusTrap = false;
35
+ this.noAutoFocus = false;
35
36
  this._backdropController = new backdrop_controller.BackdropController();
36
37
  this._handleClickOutside = async (target) => {
37
38
  var _a, _b;
@@ -48,7 +49,8 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
48
49
  return;
49
50
  }
50
51
  await this.show();
51
- this._focusOnFirstContentElement();
52
+ if (!this.noAutoFocus)
53
+ this._focusOnFirstContentElement();
52
54
  };
53
55
  this.show = async () => {
54
56
  if (this.opened)
@@ -176,7 +178,8 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
176
178
  const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
177
179
  if (isHoveredWithinDropdown && !this.opened) {
178
180
  await this.show();
179
- this._focusOnFirstContentElement();
181
+ if (!this.noAutoFocus)
182
+ this._focusOnFirstContentElement();
180
183
  return;
181
184
  }
182
185
  if (!isHoveredWithinDropdown && this.opened)
@@ -466,6 +469,10 @@ tslib_es6.__decorate([
466
469
  decorators_js.property({ type: Boolean, attribute: 'prevent-focus-trap' }),
467
470
  tslib_es6.__metadata("design:type", Object)
468
471
  ], exports.HDropdown.prototype, "preventFocusTrap", void 0);
472
+ tslib_es6.__decorate([
473
+ decorators_js.property({ type: Boolean, attribute: 'no-autofocus' }),
474
+ tslib_es6.__metadata("design:type", Object)
475
+ ], exports.HDropdown.prototype, "noAutoFocus", void 0);
469
476
  exports.HDropdown = HDropdown_1 = tslib_es6.__decorate([
470
477
  phoenix_custom_element.phoenixCustomElement('h-dropdown'),
471
478
  tslib_es6.__metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -16,6 +16,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
16
16
  constructor() {
17
17
  super();
18
18
  this.name = '';
19
+ this.ariaHasPopup = 'menu';
19
20
  this._setupTogglerAria = () => {
20
21
  this._$dropdown = this.closest(dropdown_constants.DROPDOWN_CONTAINER_NAME);
21
22
  if (this._$dropdown.isOpened)
@@ -23,7 +24,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
23
24
  host: this,
24
25
  initialAriaExpandedValue: this._$dropdown.isOpened()
25
26
  });
26
- this.setAttribute('aria-haspopup', 'true');
27
+ this.setAttribute('aria-haspopup', this.ariaHasPopup);
27
28
  if (this._$dropdown.id)
28
29
  this.setAttribute('aria-controls', this._$dropdown.id);
29
30
  };
@@ -60,6 +61,10 @@ tslib_es6.__decorate([
60
61
  decorators.property({ type: String, reflect: true }),
61
62
  tslib_es6.__metadata("design:type", Object)
62
63
  ], exports.HDropdownToggler.prototype, "name", void 0);
64
+ tslib_es6.__decorate([
65
+ decorators.property({ type: String, attribute: 'aria-haspopup' }),
66
+ tslib_es6.__metadata("design:type", Object)
67
+ ], exports.HDropdownToggler.prototype, "ariaHasPopup", void 0);
63
68
  exports.HDropdownToggler = tslib_es6.__decorate([
64
69
  phoenix_custom_element.phoenixCustomElement('h-dropdown-toggler'),
65
70
  tslib_es6.__metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
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;"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib_es6 = require('../../../../../../../../external/tslib/tslib.es6.js');
6
6
  var lit = require('lit');
7
7
  var decorators = require('lit/decorators');
8
+ require('@dreamcommerce/utilities');
8
9
  var phoenix_light_lit_element = require('../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
9
10
  var phoenix_custom_element = require('../../../../../core/decorators/phoenix_custom_element.js');
10
11
  var select_components_constatns = require('../select_components_constatns.js');
@@ -15,6 +16,32 @@ exports.HSelectSearch = class HSelectSearch extends phoenix_light_lit_element.Ph
15
16
  constructor() {
16
17
  super(...arguments);
17
18
  this.value = '';
19
+ this._$selectOptions = null;
20
+ this._handleSearchKeydown = (ev) => {
21
+ if (ev.key !== 'ArrowDown' && ev.key !== 'ArrowUp')
22
+ return;
23
+ this._handleFocusOptionOnArrowNavigation();
24
+ this._handleDispatchEventOnOptionsList(ev);
25
+ };
26
+ this._handleDispatchEventOnOptionsList = (ev) => {
27
+ var _a;
28
+ const arrowNavigationEvent = new KeyboardEvent('keydown', {
29
+ key: ev.key
30
+ });
31
+ (_a = this._$selectOptions) === null || _a === void 0 ? void 0 : _a.dispatchEvent(arrowNavigationEvent);
32
+ };
33
+ this._handleFocusOptionOnArrowNavigation = () => {
34
+ const $options = this._$selectOptions ? [...this._$selectOptions.querySelectorAll('h-option')] : [];
35
+ const $availableOptions = $options.filter(($option) => {
36
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
37
+ });
38
+ const $firstOption = $availableOptions.find(($option) => {
39
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
40
+ });
41
+ const $selectedOption = $availableOptions.find(($option) => $option.getAttribute('aria-selected'));
42
+ const $optionToFocus = $selectedOption || $firstOption;
43
+ $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
44
+ };
18
45
  this._handleInputChange = debounce['default'](({ target }) => {
19
46
  this.value = target.value;
20
47
  this.emitCustomEvent(select_components_constatns.SELECT_SEARCH_EVENT_NAMES.search, {
@@ -25,6 +52,9 @@ exports.HSelectSearch = class HSelectSearch extends phoenix_light_lit_element.Ph
25
52
  connectedCallback() {
26
53
  super.connectedCallback();
27
54
  this.classList.add(select_search_constants.SELECT_SEARCH_CSS_CLASSES.selectSearch);
55
+ // to musisz zrobić inaczej, bo jest kilka selectów na stronie
56
+ this._$selectOptions = document.querySelector('h-options');
57
+ this.addEventListener('keydown', this._handleSearchKeydown);
28
58
  }
29
59
  render() {
30
60
  return lit.html `
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA,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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA,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;"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../../external/tslib/tslib.es6.js');
6
- var utilities = require('@dreamcommerce/utilities');
6
+ require('@dreamcommerce/utilities');
7
7
  var phoenix_light_lit_element = require('../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
8
8
  var phoenix_custom_element = require('../../../../core/decorators/phoenix_custom_element.js');
9
9
  var select_components_constatns = require('./select_components_constatns.js');
@@ -26,7 +26,6 @@ exports.HOptions = class HOptions extends phoenix_light_lit_element.PhoenixLight
26
26
  });
27
27
  };
28
28
  this.setAttribute('role', 'listbox');
29
- utilities.UiDomUtils.makeNavigable(this);
30
29
  this.addEventListener(select_components_constatns.SELECT_OPTION_EVENT_NAMES.clicked, this._dispatchClickedEvent);
31
30
  this.addEventListener(select_components_constatns.SELECT_OPTION_EVENT_NAMES.updated, this._dispatchUpdatedEvent);
32
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,kDAAsD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,kDAAsD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -44,7 +44,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
44
44
  this._searchValue = '';
45
45
  this._$options = new Map();
46
46
  this._$dropdown = ref_js.createRef();
47
- this._$search = ref_js.createRef();
47
+ this.$search = ref_js.createRef();
48
48
  this._$optionsList = ref_js.createRef();
49
49
  this._$dropdownContent = ref_js.createRef();
50
50
  this._$dropdownToggler = ref_js.createRef();
@@ -105,6 +105,19 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
105
105
  this.updateOptionAriaAttribute($option);
106
106
  });
107
107
  };
108
+ this._updateLabelAria = (options) => {
109
+ var _a;
110
+ const ariaLabel = document.querySelector(`[id="${this.ariaLabelledby}"]`);
111
+ (_a = ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.querySelector(`[id="value-label"]`)) === null || _a === void 0 ? void 0 : _a.remove();
112
+ if (ariaLabel) {
113
+ ariaLabel.innerHTML = `
114
+ ${ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.innerHTML}
115
+ <span id="value-label" class="sr-only">
116
+ ${options.reduce((totalSelectedContent, currentOption) => (totalSelectedContent += currentOption.content), '')}
117
+ </span>
118
+ `;
119
+ }
120
+ };
108
121
  this._handleOptionClicked = ({ detail }) => {
109
122
  if (!(detail === null || detail === void 0 ? void 0 : detail.$option))
110
123
  return;
@@ -120,10 +133,11 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
120
133
  });
121
134
  };
122
135
  this._handleDropdownHidden = () => {
123
- var _a;
136
+ var _a, _b;
124
137
  this._searchValue = '';
125
138
  this.opened = false;
126
139
  (_a = this._$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', '');
140
+ (_b = this._$dropdownToggler.value) === null || _b === void 0 ? void 0 : _b.focus();
127
141
  };
128
142
  this._manageSelectFocusAria = (ev) => {
129
143
  var _a;
@@ -183,6 +197,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
183
197
  return Array.from(this._$options.values());
184
198
  }
185
199
  updated(changedProperties) {
200
+ var _a;
186
201
  super.updated(changedProperties);
187
202
  if (changedProperties.has('opened')) {
188
203
  if (this.opened) {
@@ -196,16 +211,27 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
196
211
  if (changedProperties.has('optionsList')) {
197
212
  this._updateOptions();
198
213
  }
199
- if (this._$optionsList.value && !this._listBoxController)
200
- this._listBoxController = new list_box_keyboard_controller.ListBoxKeyboardController({
214
+ if (this._$optionsList.value) {
215
+ (_a = this.listBoxController) === null || _a === void 0 ? void 0 : _a.hostDisconnected();
216
+ this.listBoxController = new list_box_keyboard_controller.ListBoxKeyboardController({
201
217
  host: this,
202
218
  $list: this._$optionsList.value
203
219
  });
220
+ }
221
+ if (this.listBoxController) {
222
+ this.listBoxController.calculateSelectedOptionIndex();
223
+ }
204
224
  }
205
225
  _focusElementAfterSelectOpened() {
206
- var _a, _b;
207
- const $searchInput = (_a = this._$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
208
- $searchInput ? $searchInput.focus() : (_b = this._$optionsList.value) === null || _b === void 0 ? void 0 : _b.focus();
226
+ var _a;
227
+ const $searchInput = (_a = this.$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
228
+ const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
229
+ const $firstOption = $options.find(($option) => {
230
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
231
+ });
232
+ const $selectedOption = this.selectedOptions[0];
233
+ const $optionToFocus = $selectedOption || $firstOption;
234
+ $searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
209
235
  }
210
236
  connectedCallback() {
211
237
  super.connectedCallback();
@@ -218,6 +244,8 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
218
244
  this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.multiple);
219
245
  this._optionsObserver = new observer.Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
220
246
  this._selectController.options$.subscribe(this._optionsObserver);
247
+ this._selectedOptionsAriaObserver = new observer.Observer((selectedOptions) => this._updateLabelAria(selectedOptions));
248
+ this._selectController.options$.subscribe(this._selectedOptionsAriaObserver);
221
249
  this._updateOptions();
222
250
  this._setupEvents();
223
251
  }
@@ -247,6 +275,10 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
247
275
  select_utils.SelectControlUtils.appendHTMLOption($option, $list, position);
248
276
  }
249
277
  updateOptionAriaAttribute($option) {
278
+ if (!this.multiple) {
279
+ const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
280
+ $options.forEach(($option) => ($option.removeAttribute('aria-selected')));
281
+ }
250
282
  $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
251
283
  }
252
284
  _removeHTMLOptions(optionsValues) {
@@ -313,6 +345,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
313
345
  offset=${this.offset}
314
346
  content-width="full"
315
347
  prevent-focus-trap
348
+ no-autofocus
316
349
  >
317
350
  <h-dropdown-toggler
318
351
  ${ref_js.ref(this._$dropdownToggler)}
@@ -340,7 +373,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
340
373
  ${isSearchEnabled
341
374
  ? lit.html ` <h-select-search
342
375
  class=${select_constants.SELECT_CSS_CLASSES.selectSearch}
343
- ${ref_js.ref(this._$search)}
376
+ ${ref_js.ref(this.$search)}
344
377
  .value=${this._searchValue}
345
378
  @search=${this._handleSearch}
346
379
  ></h-select-search>`
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}