@shoper/phoenix_design_system 1.15.11-36 → 1.15.11-38
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.
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
- package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
- package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +88 -0
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +91 -29
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js +0 -47
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +0 -3
- package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js +10 -0
- package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js +10 -0
- package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js +0 -2
- package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +83 -38
- package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
- package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
- package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.d.ts +14 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +84 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.d.ts +8 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js +3 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +16 -6
- package/build/esm/packages/phoenix/src/components/form/select/select.js +91 -29
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +0 -9
- package/build/esm/packages/phoenix/src/components/messages/base_message.js +2 -49
- package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +1 -3
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/hints/hint.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/messages/hints/hint.js +10 -0
- package/build/esm/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js +10 -0
- package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.js +1 -2
- package/build/esm/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.d.ts +6 -2
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js +1 -0
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.d.ts +8 -3
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +83 -38
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
- 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()) || this._tooltipRef.value === child)
|
|
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);
|
|
@@ -59,13 +43,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
59
43
|
this.opened = true;
|
|
60
44
|
}, base_message_constants.MESSAGE_SHOW_DELAY_IN_MS);
|
|
61
45
|
};
|
|
62
|
-
this._closeFromKeyboard = (ev) => {
|
|
63
|
-
if (ev.key !== 'Escape' || !this.opened)
|
|
64
|
-
return;
|
|
65
|
-
ev.preventDefault();
|
|
66
|
-
ev.stopPropagation();
|
|
67
|
-
this.close();
|
|
68
|
-
};
|
|
69
46
|
this.close = () => {
|
|
70
47
|
this._shouldDelayClosing = Date.now() - this._tooltipOpenTime > base_message_constants.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
|
|
71
48
|
clearTimeout(this._openTimeout);
|
|
@@ -106,14 +83,8 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
106
83
|
offset: this.offset
|
|
107
84
|
});
|
|
108
85
|
this.setAttribute('tabindex', this.tabindex);
|
|
109
|
-
if (!this._$baseMessageContent)
|
|
110
|
-
this._$baseMessageContent = [...this.children].find((child) => base_message_constants.MESSAGE_CONTENT_ELEMENTS.includes(child.tagName.toLowerCase()));
|
|
111
86
|
this._setupEventListeners();
|
|
112
87
|
}
|
|
113
|
-
firstUpdated(props) {
|
|
114
|
-
super.firstUpdated(props);
|
|
115
|
-
this._handleChildrenAriaAttributes();
|
|
116
|
-
}
|
|
117
88
|
static _appendMessagePortal() {
|
|
118
89
|
const $messagePortalTarget = document.querySelector(`[name="${base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME}"]`);
|
|
119
90
|
if ($messagePortalTarget)
|
|
@@ -122,24 +93,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
122
93
|
$portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
|
|
123
94
|
document.body.appendChild($portalTarget);
|
|
124
95
|
}
|
|
125
|
-
disconnectedCallback() {
|
|
126
|
-
var _a, _b;
|
|
127
|
-
super.disconnectedCallback();
|
|
128
|
-
(_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.open);
|
|
129
|
-
(_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.close);
|
|
130
|
-
}
|
|
131
|
-
render() {
|
|
132
|
-
var _a;
|
|
133
|
-
super.render();
|
|
134
|
-
return lit.html `
|
|
135
|
-
<span ${ref.ref(this._tooltipRef)} id="${this._messageId}" class="sr-only" role="tooltip">
|
|
136
|
-
${utilities.DomUtils.stripHTMLTags(((_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.innerHTML) || '')}
|
|
137
|
-
</span>
|
|
138
|
-
<h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
|
|
139
|
-
${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
|
|
140
|
-
</h-portal>
|
|
141
|
-
`;
|
|
142
|
-
}
|
|
143
96
|
}
|
|
144
97
|
tslib_es6.__decorate([
|
|
145
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
|
|
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
|
|
|
@@ -11,14 +10,12 @@ const MESSAGE_CONTENT_SLOT_NAME = 'message-content';
|
|
|
11
10
|
const MESSAGE_REMOVED_CLASS_NAME = `removed`;
|
|
12
11
|
const DEFAULT_MESSAGE_OFFSET = 10;
|
|
13
12
|
const MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
|
|
14
|
-
const LIST_OF_MESSAGE_CHILDREN = [...MESSAGE_CONTENT_ELEMENTS, portal_constants.PORTAL_COMPONENT_NAME];
|
|
15
13
|
const MESSAGE_SHOW_DELAY_IN_MS = 100;
|
|
16
14
|
const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
|
|
17
15
|
const MESSAGE_CLOSE_DELAY_IN_MS = 500;
|
|
18
16
|
|
|
19
17
|
exports.DEFAULT_MESSAGE_OFFSET = DEFAULT_MESSAGE_OFFSET;
|
|
20
18
|
exports.DEFAULT_MESSAGE_PORTAL_NAME = DEFAULT_MESSAGE_PORTAL_NAME;
|
|
21
|
-
exports.LIST_OF_MESSAGE_CHILDREN = LIST_OF_MESSAGE_CHILDREN;
|
|
22
19
|
exports.MESSAGE_CLOSE_DELAY_IN_MS = MESSAGE_CLOSE_DELAY_IN_MS;
|
|
23
20
|
exports.MESSAGE_CONTENT_ELEMENTS = MESSAGE_CONTENT_ELEMENTS;
|
|
24
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;
|
|
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;
|
|
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,64 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
6
|
require('lit');
|
|
7
7
|
var utilities = require('@dreamcommerce/utilities');
|
|
8
|
-
var keystrokes_controller = require('../keystrokes_controller/keystrokes_controller.js');
|
|
9
8
|
var list_box_controller_constants = require('./list_box_controller_constants.js');
|
|
10
9
|
|
|
11
|
-
var _ListBoxKeyboardController_host, _ListBoxKeyboardController__$list,
|
|
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;
|
|
21
27
|
event.preventDefault();
|
|
22
28
|
const { key } = event;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
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.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
$
|
|
34
|
+
const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
|
|
35
|
+
return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
|
|
36
|
+
});
|
|
37
|
+
const $activeElement = document.querySelector(`#${activeElementId}`);
|
|
38
|
+
const activeElementIndex = $availableOptions.findIndex(($element) => $element.id === $activeElement.id);
|
|
39
|
+
let $newActiveElement;
|
|
40
|
+
if (key === 'ArrowDown' || key === 'ArrowRight') {
|
|
41
|
+
$newActiveElement = $availableOptions[activeElementIndex + 1];
|
|
42
|
+
}
|
|
43
|
+
if (key === 'ArrowUp' || key === 'ArrowLeft') {
|
|
44
|
+
$newActiveElement = $availableOptions[activeElementIndex - 1];
|
|
45
|
+
}
|
|
46
|
+
if (!$newActiveElement)
|
|
47
|
+
return;
|
|
48
|
+
tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").manageSelectVirtualFocus($newActiveElement);
|
|
49
|
+
};
|
|
50
|
+
this._setVirtualFocusToFirstElement = () => {
|
|
51
|
+
const $firstOption = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").options[0];
|
|
52
|
+
if (!$firstOption)
|
|
53
|
+
return;
|
|
54
|
+
tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").manageSelectVirtualFocus($firstOption);
|
|
55
|
+
};
|
|
56
|
+
this._handleWriteableCharacter = (ev) => {
|
|
57
|
+
var _a;
|
|
58
|
+
const $searchInput = (_a = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
|
|
59
|
+
if (!$searchInput)
|
|
60
|
+
return;
|
|
61
|
+
$searchInput === null || $searchInput === void 0 ? void 0 : $searchInput.focus();
|
|
62
|
+
};
|
|
63
|
+
this.calculateSelectedOptionIndex = () => {
|
|
64
|
+
const selectedOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").findIndex(($option) => $option.selected);
|
|
65
|
+
this.currentOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
|
|
39
66
|
};
|
|
40
67
|
tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_host, host, "f");
|
|
41
68
|
tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController__$list, $list, "f");
|
|
@@ -45,40 +72,58 @@ class ListBoxKeyboardController {
|
|
|
45
72
|
tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").addController(this);
|
|
46
73
|
}
|
|
47
74
|
hostConnected() {
|
|
48
|
-
|
|
49
|
-
host: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f"),
|
|
50
|
-
keys: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_keys, "f"),
|
|
51
|
-
callback: this._handleArrowNavigation,
|
|
52
|
-
target: tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f")
|
|
53
|
-
});
|
|
75
|
+
tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('keydown', this._handleKeyboardNavigation);
|
|
54
76
|
utilities.UiDomUtils.makeNavigable(tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"));
|
|
55
77
|
tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").addEventListener('focusin', (event) => {
|
|
56
78
|
if (event.target !== tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f"))
|
|
57
79
|
return;
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
tslib_es6.__classPrivateFieldSet(this, _ListBoxKeyboardController_currentOptionIndex, undefined, "f");
|
|
80
|
+
// if (this.currentOptionIndex === undefined) return;
|
|
81
|
+
// const $prevOption = this.#_$options[this.currentOptionIndex];
|
|
82
|
+
// UiDomUtils.makeUnnavigable($prevOption);
|
|
83
|
+
// this.currentOptionIndex = undefined;
|
|
63
84
|
});
|
|
64
|
-
|
|
85
|
+
// this.#_$options.forEach(($option: HTMLElement) => UiDomUtils.makeUnnavigable($option));
|
|
65
86
|
}
|
|
66
87
|
_getPrevOptionIndex() {
|
|
67
|
-
if (
|
|
88
|
+
if (this.currentOptionIndex === undefined)
|
|
68
89
|
return undefined;
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
-
|
|
90
|
+
if (this.currentOptionIndex <= 0)
|
|
91
|
+
return this.currentOptionIndex;
|
|
92
|
+
if (this.currentOptionIndex <= 0)
|
|
93
|
+
return this.currentOptionIndex;
|
|
94
|
+
const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
|
|
95
|
+
return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
|
|
96
|
+
});
|
|
97
|
+
if (!!$availableOptions[this.currentOptionIndex - 1])
|
|
98
|
+
return this.currentOptionIndex - 1;
|
|
99
|
+
// bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
|
|
100
|
+
const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
|
|
101
|
+
if (newIndexOfCurrentlySelectedOption)
|
|
102
|
+
return newIndexOfCurrentlySelectedOption - 1;
|
|
103
|
+
return this.currentOptionIndex - 1;
|
|
72
104
|
}
|
|
73
105
|
_getNextOptionIndex() {
|
|
74
|
-
if (
|
|
106
|
+
if (this.currentOptionIndex === undefined)
|
|
75
107
|
return undefined;
|
|
76
|
-
|
|
77
|
-
return
|
|
78
|
-
|
|
108
|
+
const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
|
|
109
|
+
return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
|
|
110
|
+
});
|
|
111
|
+
if (this.currentOptionIndex === $availableOptions.length - 1)
|
|
112
|
+
return this.currentOptionIndex;
|
|
113
|
+
if (this.currentOptionIndex > $availableOptions.length - 1) {
|
|
114
|
+
// bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
|
|
115
|
+
const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
|
|
116
|
+
if (newIndexOfCurrentlySelectedOption)
|
|
117
|
+
return newIndexOfCurrentlySelectedOption + 1;
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
return this.currentOptionIndex + 1;
|
|
121
|
+
}
|
|
122
|
+
hostDisconnected() {
|
|
123
|
+
tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$list, "f").removeEventListener('keydown', this._handleKeyboardNavigation);
|
|
79
124
|
}
|
|
80
125
|
}
|
|
81
|
-
_ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(),
|
|
126
|
+
_ListBoxKeyboardController_host = new WeakMap(), _ListBoxKeyboardController__$list = new WeakMap(), _ListBoxKeyboardController__$options = new WeakMap(), _ListBoxKeyboardController_listItemSelector = new WeakMap(), _ListBoxKeyboardController_keys = new WeakMap();
|
|
82
127
|
|
|
83
128
|
exports.ListBoxKeyboardController = ListBoxKeyboardController;
|
|
84
129
|
//# sourceMappingURL=list_box_keyboard_controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -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.
|
|
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.
|
|
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('
|
|
23
|
-
|
|
24
|
-
|
|
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.
|
|
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;"}
|
package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts
CHANGED
|
@@ -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
|
}
|
package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js
CHANGED
|
@@ -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 `
|
package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map
CHANGED
|
@@ -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
|
|
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
|
}
|
package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,kDAAsD;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,kDAAsD;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|