@shoper/phoenix_design_system 1.15.11-35 → 1.15.11-37

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 (65) hide show
  1. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
  2. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
  4. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
  6. package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
  8. package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +90 -0
  10. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
  11. package/build/cjs/packages/phoenix/src/components/form/select/select.js +86 -21
  12. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/messages/base_message.js +0 -53
  14. package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  15. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +1 -6
  16. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  17. package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js +10 -0
  18. package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
  19. package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js +10 -0
  20. package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
  21. package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js +0 -2
  22. package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
  23. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +78 -38
  24. package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  25. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +1 -0
  26. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
  27. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  28. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +3 -0
  29. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
  30. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  31. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +4 -0
  32. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
  33. package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
  34. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
  35. package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
  36. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.d.ts +14 -0
  37. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +86 -0
  38. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
  39. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.d.ts +8 -0
  40. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js +3 -0
  41. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js.map +1 -0
  42. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +15 -5
  43. package/build/esm/packages/phoenix/src/components/form/select/select.js +86 -21
  44. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  45. package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +0 -9
  46. package/build/esm/packages/phoenix/src/components/messages/base_message.js +2 -55
  47. package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  48. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.d.ts +0 -2
  49. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +2 -5
  50. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  51. package/build/esm/packages/phoenix/src/components/messages/hints/hint.d.ts +2 -0
  52. package/build/esm/packages/phoenix/src/components/messages/hints/hint.js +10 -0
  53. package/build/esm/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
  54. package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.d.ts +2 -0
  55. package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js +10 -0
  56. package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
  57. package/build/esm/packages/phoenix/src/components/portal/portal_constants.js +1 -2
  58. package/build/esm/packages/phoenix/src/components/portal/portal_constants.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 +8 -3
  63. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +78 -38
  64. package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
  65. package/package.json +2 -2
@@ -3,16 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- var lit = require('lit');
7
6
  var decorators = require('lit/decorators');
8
7
  var utilities = require('@dreamcommerce/utilities');
9
8
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
10
- var v4 = require('../../../../../external/uuid/dist/esm-browser/v4.js');
11
9
  var portal_constants = require('../portal/portal_constants.js');
12
10
  var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
13
11
  var relative_position_controller = require('../../controllers/relative_position_controller/relative_position_controller.js');
14
12
  var base_message_constants = require('./base_message_constants.js');
15
- var ref = require('lit/directives/ref');
16
13
 
17
14
  class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
18
15
  constructor() {
@@ -23,22 +20,9 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
23
20
  this.offset = base_message_constants.DEFAULT_MESSAGE_OFFSET;
24
21
  this.mouseonly = false;
25
22
  this.tabindex = '-1';
26
- this._messageId = v4['default']();
27
- this._tooltipRef = ref.createRef();
28
- this._handleChildrenAriaAttributes = () => {
29
- [...this.children].forEach((child) => {
30
- if (base_message_constants.LIST_OF_MESSAGE_CHILDREN.includes(child.tagName.toLowerCase()))
31
- return;
32
- child.setAttribute('aria-describedby', `${child.getAttribute('aria-describedby') || ''} ${this._messageId}`);
33
- });
34
- };
35
23
  this._setupEventListeners = () => {
36
- var _a, _b;
37
24
  this.addEventListener('mouseenter', this.open);
38
25
  this.addEventListener('mouseleave', this.close);
39
- this.addEventListener('keydown', this._closeFromKeyboard);
40
- (_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.open);
41
- (_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.close);
42
26
  if (!this.mouseonly) {
43
27
  this.addEventListener('focusin', this.open);
44
28
  this.addEventListener('focusout', this.close);
@@ -51,30 +35,17 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
51
35
  });
52
36
  };
53
37
  this.open = () => {
54
- var _a, _b;
55
38
  this._tooltipOpenTime = Date.now();
56
39
  clearTimeout(this._closeTimeout);
57
- (_a = this._tooltipRef.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'true');
58
- (_b = this._tooltipRef.value) === null || _b === void 0 ? void 0 : _b.setAttribute('hidden', '');
59
40
  this._openTimeout = setTimeout(() => {
60
41
  if (this.opened)
61
42
  return;
62
43
  this.opened = true;
63
44
  }, base_message_constants.MESSAGE_SHOW_DELAY_IN_MS);
64
45
  };
65
- this._closeFromKeyboard = (ev) => {
66
- if (ev.key !== 'Escape' || !this.opened)
67
- return;
68
- ev.preventDefault();
69
- ev.stopPropagation();
70
- this.close();
71
- };
72
46
  this.close = () => {
73
- var _a, _b;
74
47
  this._shouldDelayClosing = Date.now() - this._tooltipOpenTime > base_message_constants.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
75
48
  clearTimeout(this._openTimeout);
76
- (_a = this._tooltipRef.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'false');
77
- (_b = this._tooltipRef.value) === null || _b === void 0 ? void 0 : _b.removeAttribute('hidden');
78
49
  if (!this.opened)
79
50
  return;
80
51
  this._closeTimeout = setTimeout(() => {
@@ -112,14 +83,8 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
112
83
  offset: this.offset
113
84
  });
114
85
  this.setAttribute('tabindex', this.tabindex);
115
- if (!this._$baseMessageContent)
116
- this._$baseMessageContent = [...this.children].find((child) => base_message_constants.LIST_OF_MESSAGE_CONTENT_ELEMENTS.includes(child.tagName.toLowerCase()));
117
86
  this._setupEventListeners();
118
87
  }
119
- firstUpdated(props) {
120
- super.firstUpdated(props);
121
- this._handleChildrenAriaAttributes();
122
- }
123
88
  static _appendMessagePortal() {
124
89
  const $messagePortalTarget = document.querySelector(`[name="${base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME}"]`);
125
90
  if ($messagePortalTarget)
@@ -128,24 +93,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
128
93
  $portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
129
94
  document.body.appendChild($portalTarget);
130
95
  }
131
- disconnectedCallback() {
132
- var _a, _b;
133
- super.disconnectedCallback();
134
- (_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.open);
135
- (_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.close);
136
- }
137
- render() {
138
- var _a;
139
- super.render();
140
- return lit.html `
141
- <span ${ref.ref(this._tooltipRef)} id="${this._messageId}" class="sr-only" role="tooltip" aria-hidden="false">
142
- ${utilities.DomUtils.stripHTMLTags(((_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.innerHTML) || '')}
143
- </span>
144
- <h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
145
- ${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
146
- </h-portal>
147
- `;
148
- }
149
96
  }
150
97
  tslib_es6.__decorate([
151
98
  decorators.property({ type: Boolean, reflect: true }),
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;"}
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var portal_constants = require('../portal/portal_constants.js');
6
5
  var hint_constants = require('./hints/hint_constants.js');
7
6
  var tooltip_constants = require('./tooltips/tooltip_constants.js');
8
7
 
@@ -13,14 +12,10 @@ const DEFAULT_MESSAGE_OFFSET = 10;
13
12
  const MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
14
13
  const MESSAGE_SHOW_DELAY_IN_MS = 100;
15
14
  const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
16
- const MESSAGE_CLOSE_DELAY_IN_MS = 500;
17
- const LIST_OF_MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
18
- const LIST_OF_MESSAGE_CHILDREN = [...LIST_OF_MESSAGE_CONTENT_ELEMENTS, portal_constants.PORTAL_COMPONENT_NAME];
15
+ const MESSAGE_CLOSE_DELAY_IN_MS = 500;
19
16
 
20
17
  exports.DEFAULT_MESSAGE_OFFSET = DEFAULT_MESSAGE_OFFSET;
21
18
  exports.DEFAULT_MESSAGE_PORTAL_NAME = DEFAULT_MESSAGE_PORTAL_NAME;
22
- exports.LIST_OF_MESSAGE_CHILDREN = LIST_OF_MESSAGE_CHILDREN;
23
- exports.LIST_OF_MESSAGE_CONTENT_ELEMENTS = LIST_OF_MESSAGE_CONTENT_ELEMENTS;
24
19
  exports.MESSAGE_CLOSE_DELAY_IN_MS = MESSAGE_CLOSE_DELAY_IN_MS;
25
20
  exports.MESSAGE_CONTENT_ELEMENTS = MESSAGE_CONTENT_ELEMENTS;
26
21
  exports.MESSAGE_CONTENT_SLOT_NAME = MESSAGE_CONTENT_SLOT_NAME;
@@ -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;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;AACA;AACA;AACA;"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
7
+ var litHtml = require('lit-html');
7
8
  var hint_constants = require('./hint_constants.js');
9
+ var base_message_constants = require('../base_message_constants.js');
8
10
  var base_message = require('../base_message.js');
9
11
 
10
12
  exports.HHint = class HHint extends base_message.BaseMessage {
@@ -16,6 +18,14 @@ exports.HHint = class HHint extends base_message.BaseMessage {
16
18
  super.connectedCallback(hint_constants.HINT_CLASS_NAME);
17
19
  this.classList.add(hint_constants.HINT_CLASS_NAME);
18
20
  }
21
+ render() {
22
+ super.render();
23
+ return litHtml.html `
24
+ <h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
25
+ ${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
26
+ </h-portal>
27
+ `;
28
+ }
19
29
  };
20
30
  exports.HHint = tslib_es6.__decorate([
21
31
  phoenix_custom_element.phoenixCustomElement(hint_constants.HINT_ELEMENT_NAME),
@@ -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;"}
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;"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
7
+ var litHtml = require('lit-html');
7
8
  var tooltip_constants = require('./tooltip_constants.js');
9
+ var base_message_constants = require('../base_message_constants.js');
8
10
  var base_message = require('../base_message.js');
9
11
 
10
12
  exports.HTooltip = class HTooltip extends base_message.BaseMessage {
@@ -12,6 +14,14 @@ exports.HTooltip = class HTooltip extends base_message.BaseMessage {
12
14
  super.connectedCallback(tooltip_constants.TOOLTIP_CLASS_NAME);
13
15
  this.classList.add(tooltip_constants.TOOLTIP_CLASS_NAME);
14
16
  }
17
+ render() {
18
+ super.render();
19
+ return litHtml.html `
20
+ <h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
21
+ ${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
22
+ </h-portal>
23
+ `;
24
+ }
15
25
  };
16
26
  exports.HTooltip = tslib_es6.__decorate([
17
27
  phoenix_custom_element.phoenixCustomElement(tooltip_constants.TOOLTIP_ELEMENT_NAME)
@@ -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;"}
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;"}
@@ -7,11 +7,9 @@ const PORTAL_EVENTS = {
7
7
  close: 'close'
8
8
  };
9
9
  const PORTAL_TARGET_NAME_PROP = 'name';
10
- const PORTAL_COMPONENT_NAME = 'h-portal';
11
10
  const PORTAL_TARGET_COMPONENT_NAME = 'h-portal-target';
12
11
  const PORTAL_TARGET_ATTRIBUTE_NAME = 'portal-target';
13
12
 
14
- exports.PORTAL_COMPONENT_NAME = PORTAL_COMPONENT_NAME;
15
13
  exports.PORTAL_EVENTS = PORTAL_EVENTS;
16
14
  exports.PORTAL_TARGET_ATTRIBUTE_NAME = PORTAL_TARGET_ATTRIBUTE_NAME;
17
15
  exports.PORTAL_TARGET_COMPONENT_NAME = PORTAL_TARGET_COMPONENT_NAME;
@@ -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;"}
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;"}
@@ -5,37 +5,59 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  require('lit');
7
7
  var utilities = require('@dreamcommerce/utilities');
8
- var keystrokes_controller = require('../keystrokes_controller/keystrokes_controller.js');
9
8
  var list_box_controller_constants = require('./list_box_controller_constants.js');
10
9
 
11
- var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController_currentOptionIndex, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
10
+ var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list, _ListBoxKeyboardController__$options, _ListBoxKeyboardController_listItemSelector, _ListBoxKeyboardController_keys;
12
11
  class ListBoxKeyboardController {
13
12
  constructor({ host, $list, listItemSelector = '[role="option"]', orientation = list_box_controller_constants.LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS.vertical }) {
14
13
  _ListBoxKeyboardController_host.set(this, void 0);
15
14
  _ListBoxKeyboardController__$list.set(this, void 0);
16
- _ListBoxKeyboardController_currentOptionIndex.set(this, void 0);
17
15
  _ListBoxKeyboardController__$options.set(this, void 0);
18
16
  _ListBoxKeyboardController_listItemSelector.set(this, void 0);
19
17
  _ListBoxKeyboardController_keys.set(this, void 0);
18
+ this._handleKeyboardNavigation = (ev) => {
19
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f").find((key) => key === ev.key)) {
20
+ this._handleArrowNavigation(ev);
21
+ return;
22
+ }
23
+ this._handleWriteableCharacter(ev);
24
+ };
20
25
  this._handleArrowNavigation = (event) => {
26
+ var _a, _b;
21
27
  event.preventDefault();
22
28
  const { key } = event;
23
- const prevOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
24
- let newOptionIndex = key === 'ArrowDown' || key === 'ArrowRight' ? this._getNextOptionIndex() : this._getPrevOptionIndex();
25
- if (newOptionIndex === undefined) {
26
- const selectedOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
27
- newOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
28
- }
29
- if (newOptionIndex === tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f"))
29
+ const activeElementId = (_a = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-activedescendant');
30
+ if (!activeElementId) {
31
+ this._setVirtualFocusToFirstElement();
30
32
  return;
31
- if (prevOptionIndex !== undefined) {
32
- const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[prevOptionIndex];
33
- utilities.UiDomUtils.makeUnnavigable($prevOption);
34
33
  }
35
- tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, newOptionIndex, "f");
36
- const $focusedOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[newOptionIndex];
37
- utilities.UiDomUtils.makeNavigable($focusedOption);
38
- $focusedOption.focus();
34
+ const $activeElement = document.querySelector(`#${activeElementId}`);
35
+ let $newActiveElement;
36
+ if (key === 'ArrowDown' || key === 'ArrowRight') {
37
+ $newActiveElement = $activeElement === null || $activeElement === void 0 ? void 0 : $activeElement.nextElementSibling;
38
+ }
39
+ if (key === 'ArrowUp' || key === 'ArrowLeft') {
40
+ $newActiveElement = $activeElement === null || $activeElement === void 0 ? void 0 : $activeElement.previousElementSibling;
41
+ }
42
+ (_b = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$dropdownToggler.value) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-activedescendant', ($newActiveElement === null || $newActiveElement === void 0 ? void 0 : $newActiveElement.id) || '');
43
+ };
44
+ this._setVirtualFocusToFirstElement = () => {
45
+ var _a;
46
+ const $firstOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").options[0];
47
+ if (!$firstOption)
48
+ return;
49
+ (_a = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', $firstOption.id);
50
+ };
51
+ this._handleWriteableCharacter = (ev) => {
52
+ var _a;
53
+ const $searchInput = (_a = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
54
+ if (!$searchInput)
55
+ return;
56
+ $searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
57
+ };
58
+ this.calculateSelectedOptionIndex = () => {
59
+ const selectedOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
60
+ this.currentOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
39
61
  };
40
62
  tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_host, host, "f");
41
63
  tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController__$list, $list, "f");
@@ -45,40 +67,58 @@ class ListBoxKeyboardController {
45
67
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").addController(this);
46
68
  }
47
69
  hostConnected() {
48
- new keystrokes_controller.KeystrokesController({
49
- host: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f"),
50
- keys: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f"),
51
- callback: this._handleArrowNavigation,
52
- target: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f")
53
- });
70
+ tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('keydown', this._handleKeyboardNavigation);
54
71
  utilities.UiDomUtils.makeNavigable(tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"));
55
72
  tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('focusin', (event) => {
56
73
  if (event.target !== tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"))
57
74
  return;
58
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
59
- return;
60
- const $prevOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f")[tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f")];
61
- utilities.UiDomUtils.makeUnnavigable($prevOption);
62
- tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, undefined, "f");
75
+ // if (this.currentOptionIndex === undefined) return;
76
+ // const $prevOption = this.#_$options[this.currentOptionIndex];
77
+ // UiDomUtils.makeUnnavigable($prevOption);
78
+ // this.currentOptionIndex = undefined;
63
79
  });
64
- tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").forEach(($option) => utilities.UiDomUtils.makeUnnavigable($option));
80
+ // this.#_$options.forEach(($option: HTMLElement) => UiDomUtils.makeUnnavigable($option));
65
81
  }
66
82
  _getPrevOptionIndex() {
67
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
83
+ if (this.currentOptionIndex === undefined)
68
84
  return undefined;
69
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") <= 0)
70
- return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
71
- return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1;
85
+ if (this.currentOptionIndex <= 0)
86
+ return this.currentOptionIndex;
87
+ if (this.currentOptionIndex <= 0)
88
+ return this.currentOptionIndex;
89
+ const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
90
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
91
+ });
92
+ if (!!$availableOptions[this.currentOptionIndex - 1])
93
+ return this.currentOptionIndex - 1;
94
+ // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
95
+ const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
96
+ if (newIndexOfCurrentlySelectedOption)
97
+ return newIndexOfCurrentlySelectedOption - 1;
98
+ return this.currentOptionIndex - 1;
72
99
  }
73
100
  _getNextOptionIndex() {
74
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === undefined)
101
+ if (this.currentOptionIndex === undefined)
75
102
  return undefined;
76
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") >= tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").length - 1)
77
- return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
78
- return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") + 1;
103
+ const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
104
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
105
+ });
106
+ if (this.currentOptionIndex === $availableOptions.length - 1)
107
+ return this.currentOptionIndex;
108
+ if (this.currentOptionIndex > $availableOptions.length - 1) {
109
+ // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
110
+ const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
111
+ if (newIndexOfCurrentlySelectedOption)
112
+ return newIndexOfCurrentlySelectedOption + 1;
113
+ return 0;
114
+ }
115
+ return this.currentOptionIndex + 1;
116
+ }
117
+ hostDisconnected() {
118
+ tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").removeEventListener('keydown', this._handleKeyboardNavigation);
79
119
  }
80
120
  }
81
- _ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController_currentOptionIndex = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
121
+ _ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
82
122
 
83
123
  exports.ListBoxKeyboardController = ListBoxKeyboardController;
84
124
  //# sourceMappingURL=list_box_keyboard_controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -17,6 +17,7 @@ export declare class HDropdown extends PhoenixLightLitElement implements IDropdo
17
17
  mobilePosition: TMobileElementPosition;
18
18
  id: string;
19
19
  preventFocusTrap: boolean;
20
+ noAutoFocus: boolean;
20
21
  $dropdownToggler: HDropdownToggler | null;
21
22
  $dropdownContent: HDropdownContent | null;
22
23
  $nestedDropdownContentElements?: HDropdownContent[];
@@ -28,6 +28,7 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
28
28
  this.portalTarget = DEFAULT_DROPDOWN_PORTAL_NAME;
29
29
  this.id = v4();
30
30
  this.preventFocusTrap = false;
31
+ this.noAutoFocus = false;
31
32
  this._backdropController = new BackdropController();
32
33
  this._handleClickOutside = async (target) => {
33
34
  var _a, _b;
@@ -44,7 +45,8 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
44
45
  return;
45
46
  }
46
47
  await this.show();
47
- this._focusOnFirstContentElement();
48
+ if (!this.noAutoFocus)
49
+ this._focusOnFirstContentElement();
48
50
  };
49
51
  this.show = async () => {
50
52
  if (this.opened)
@@ -172,7 +174,8 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
172
174
  const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
173
175
  if (isHoveredWithinDropdown && !this.opened) {
174
176
  await this.show();
175
- this._focusOnFirstContentElement();
177
+ if (!this.noAutoFocus)
178
+ this._focusOnFirstContentElement();
176
179
  return;
177
180
  }
178
181
  if (!isHoveredWithinDropdown && this.opened)
@@ -462,6 +465,10 @@ __decorate([
462
465
  property({ type: Boolean, attribute: 'prevent-focus-trap' }),
463
466
  __metadata("design:type", Object)
464
467
  ], HDropdown.prototype, "preventFocusTrap", void 0);
468
+ __decorate([
469
+ property({ type: Boolean, attribute: 'no-autofocus' }),
470
+ __metadata("design:type", Object)
471
+ ], HDropdown.prototype, "noAutoFocus", void 0);
465
472
  HDropdown = HDropdown_1 = __decorate([
466
473
  phoenixCustomElement('h-dropdown'),
467
474
  __metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qDAAyD;AACxE;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qDAAyD;AACxE;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,6 +1,9 @@
1
1
  import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
2
  export declare class HDropdownToggler extends PhoenixLightLitElement {
3
3
  name: string;
4
+ ariaHasPopup: string;
5
+ ariaControls: string;
6
+ role: string;
4
7
  private _btnController;
5
8
  private _toggleElementAriaController;
6
9
  private _$dropdown;
@@ -3,7 +3,6 @@ import { property } from 'lit/decorators';
3
3
  import '@dreamcommerce/utilities';
4
4
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
5
5
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
6
- import { BtnController } from '../../controllers/btn_controller/btn_controller.js';
7
6
  import { BREAKPOINTS } from '../../global_constants.js';
8
7
  import { DROPDOWN_CONTAINER_NAME, DROPDOWN_EVENTS, DROPDOWN_CSS_CLASSES, DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME } from './dropdown_constants.js';
9
8
  import { ToggleElementAriaController } from '../../controllers/toggle_element_aria_controller/toggle_element_aria_controller.js';
@@ -12,6 +11,9 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
12
11
  constructor() {
13
12
  super();
14
13
  this.name = '';
14
+ this.ariaHasPopup = 'menu';
15
+ this.ariaControls = '';
16
+ this.role = 'button';
15
17
  this._setupTogglerAria = () => {
16
18
  this._$dropdown = this.closest(DROPDOWN_CONTAINER_NAME);
17
19
  if (this._$dropdown.isOpened)
@@ -19,11 +21,14 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
19
21
  host: this,
20
22
  initialAriaExpandedValue: this._$dropdown.isOpened()
21
23
  });
22
- this.setAttribute('aria-haspopup', 'true');
23
- if (this._$dropdown.id)
24
- this.setAttribute('aria-controls', this._$dropdown.id);
24
+ this.setAttribute('role', this.role);
25
+ this.setAttribute('aria-haspopup', this.ariaHasPopup);
26
+ if (this.ariaControls || this._$dropdown.id)
27
+ this.setAttribute('aria-controls', this.ariaControls || this._$dropdown.id);
25
28
  };
26
29
  this._dispatchToggleDropdownEventWithKeyboard = (ev) => {
30
+ if (ev.key !== 'Enter' && ev.key !== ' ')
31
+ return;
27
32
  ev.stopImmediatePropagation();
28
33
  this._dispatchToggleDropdownEvent(ev);
29
34
  };
@@ -42,7 +47,8 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
42
47
  connectedCallback() {
43
48
  var _a;
44
49
  super.connectedCallback();
45
- this._btnController = new BtnController(this, this._dispatchToggleDropdownEventWithKeyboard);
50
+ this.setAttribute('tabindex', '0');
51
+ this.addEventListener('keydown', this._dispatchToggleDropdownEventWithKeyboard);
46
52
  this._setupTogglerAria();
47
53
  const hasToggleOnHover = (_a = this._$dropdown) === null || _a === void 0 ? void 0 : _a.hasAttribute(DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME);
48
54
  if (hasToggleOnHover) {
@@ -56,6 +62,18 @@ __decorate([
56
62
  property({ type: String, reflect: true }),
57
63
  __metadata("design:type", Object)
58
64
  ], HDropdownToggler.prototype, "name", void 0);
65
+ __decorate([
66
+ property({ type: String, attribute: 'aria-haspopup' }),
67
+ __metadata("design:type", Object)
68
+ ], HDropdownToggler.prototype, "ariaHasPopup", void 0);
69
+ __decorate([
70
+ property({ type: String, attribute: 'aria-controls' }),
71
+ __metadata("design:type", Object)
72
+ ], HDropdownToggler.prototype, "ariaControls", void 0);
73
+ __decorate([
74
+ property({ type: String }),
75
+ __metadata("design:type", Object)
76
+ ], HDropdownToggler.prototype, "role", void 0);
59
77
  HDropdownToggler = __decorate([
60
78
  phoenixCustomElement('h-dropdown-toggler'),
61
79
  __metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -2,7 +2,11 @@ import { PhoenixLightLitElement } from "../../../../../core/phoenix_light_lit_el
2
2
  import { TemplateResult } from 'lit';
3
3
  export declare class HSelectSearch extends PhoenixLightLitElement {
4
4
  value: string;
5
+ private _$selectOptions;
5
6
  connectedCallback(): void;
7
+ private _handleSearchKeydown;
8
+ private _handleDispatchEventOnOptionsList;
9
+ private _handleFocusOptionOnArrowNavigation;
6
10
  private _handleInputChange;
7
11
  protected render(): TemplateResult;
8
12
  }
@@ -1,9 +1,11 @@
1
1
  import { __decorate, __metadata } from '../../../../../../../../external/tslib/tslib.es6.js';
2
2
  import { html } from 'lit';
3
3
  import { property } from 'lit/decorators';
4
+ import '@dreamcommerce/utilities';
4
5
  import { PhoenixLightLitElement } from '../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
5
6
  import { phoenixCustomElement } from '../../../../../core/decorators/phoenix_custom_element.js';
6
7
  import { SELECT_SEARCH_EVENT_NAMES, SELECT_RELATED_COMPONENTS_NAMES } from '../select_components_constatns.js';
8
+ import { DROPDOWN_CONTENT_NAME } from '../../../../dropdown/dropdown_constants.js';
7
9
  import debounce_1 from '../../../../../../../../external/lodash/debounce.js';
8
10
  import { SELECT_SEARCH_CSS_CLASSES } from './select_search_constants.js';
9
11
 
@@ -11,6 +13,32 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
11
13
  constructor() {
12
14
  super(...arguments);
13
15
  this.value = '';
16
+ this._$selectOptions = null;
17
+ this._handleSearchKeydown = (ev) => {
18
+ if (ev.key !== 'ArrowDown' && ev.key !== 'ArrowUp')
19
+ return;
20
+ this._handleFocusOptionOnArrowNavigation();
21
+ this._handleDispatchEventOnOptionsList(ev);
22
+ };
23
+ this._handleDispatchEventOnOptionsList = (ev) => {
24
+ var _a;
25
+ const arrowNavigationEvent = new KeyboardEvent('keydown', {
26
+ key: ev.key
27
+ });
28
+ (_a = this._$selectOptions) === null || _a === void 0 ? void 0 : _a.dispatchEvent(arrowNavigationEvent);
29
+ };
30
+ this._handleFocusOptionOnArrowNavigation = () => {
31
+ const $options = this._$selectOptions ? [...this._$selectOptions.querySelectorAll('h-option')] : [];
32
+ const $availableOptions = $options.filter(($option) => {
33
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
34
+ });
35
+ const $firstOption = $availableOptions.find(($option) => {
36
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
37
+ });
38
+ const $selectedOption = $availableOptions.find(($option) => $option.getAttribute('aria-selected'));
39
+ const $optionToFocus = $selectedOption || $firstOption;
40
+ $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
41
+ };
14
42
  this._handleInputChange = debounce_1(({ target }) => {
15
43
  this.value = target.value;
16
44
  this.emitCustomEvent(SELECT_SEARCH_EVENT_NAMES.search, {
@@ -21,6 +49,9 @@ let HSelectSearch = class HSelectSearch extends PhoenixLightLitElement {
21
49
  connectedCallback() {
22
50
  super.connectedCallback();
23
51
  this.classList.add(SELECT_SEARCH_CSS_CLASSES.selectSearch);
52
+ const $selectOptionsContainer = this.closest(DROPDOWN_CONTENT_NAME);
53
+ this._$selectOptions = $selectOptionsContainer === null || $selectOptionsContainer === void 0 ? void 0 : $selectOptionsContainer.querySelector('h-options');
54
+ this.addEventListener('keydown', this._handleSearchKeydown);
24
55
  }
25
56
  render() {
26
57
  return html `
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA,uBAAuB,qDAAyD;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qDAAyD;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { UiDomUtils } from '@dreamcommerce/utilities';
2
+ import '@dreamcommerce/utilities';
3
3
  import { PhoenixLightLitElement } from '../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
4
4
  import { phoenixCustomElement } from '../../../../core/decorators/phoenix_custom_element.js';
5
5
  import { SELECT_OPTIONS_EVENT_NAMES, SELECT_OPTION_EVENT_NAMES, SELECT_RELATED_COMPONENTS_NAMES } from './select_components_constatns.js';
@@ -22,7 +22,6 @@ let HOptions = class HOptions extends PhoenixLightLitElement {
22
22
  });
23
23
  };
24
24
  this.setAttribute('role', 'listbox');
25
- UiDomUtils.makeNavigable(this);
26
25
  this.addEventListener(SELECT_OPTION_EVENT_NAMES.clicked, this._dispatchClickedEvent);
27
26
  this.addEventListener(SELECT_OPTION_EVENT_NAMES.updated, this._dispatchUpdatedEvent);
28
27
  }