@shoper/phoenix_design_system 0.20.2 → 0.21.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +14 -27
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +4 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -1
- package/build/cjs/packages/phoenix/src/components/slider/slider.js +2 -2
- package/build/cjs/packages/phoenix/src/components/tabs/tab/tab.js +74 -0
- package/build/cjs/packages/phoenix/src/components/tabs/tab/tab.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/tabs/tab/tab_constants.js +12 -0
- package/build/{esm/packages/utilities/build/esm/web_components_utils.js.map → cjs/packages/phoenix/src/components/tabs/tab/tab_constants.js.map} +1 -1
- package/build/cjs/packages/phoenix/src/components/tabs/tab_panel.js +31 -0
- package/build/cjs/packages/phoenix/src/components/tabs/tab_panel.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/tabs/tabs.js +108 -0
- package/build/cjs/packages/phoenix/src/components/tabs/tabs.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/tabs/tabs_constants.js +10 -0
- package/build/cjs/packages/{utilities/build/esm/web_components_utils.js.map → phoenix/src/components/tabs/tabs_constants.js.map} +1 -1
- package/build/cjs/packages/phoenix/src/controllers/visibility_controller/visibility_controller.js +1 -1
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js +3 -0
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js.map +1 -1
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element_utils.js +4 -4
- package/build/cjs/packages/phoenix/src/index.js +23 -0
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +0 -4
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +14 -27
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +4 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -1
- package/build/esm/packages/phoenix/src/components/slider/slider.js +1 -1
- package/build/esm/packages/phoenix/src/components/tabs/tab/tab.d.ts +14 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab/tab.js +72 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab/tab.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab/tab_constants.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab/tab_constants.js +7 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab/tab_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab_panel.d.ts +8 -0
- package/build/esm/packages/phoenix/src/components/tabs/tab_panel.js +29 -0
- package/build/{cjs/packages/utilities/build/esm/json_utils.js.map → esm/packages/phoenix/src/components/tabs/tab_panel.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/tabs/tabs.d.ts +16 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs.js +106 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs_constants.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs_constants.js +6 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs_types.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs_types.js +2 -0
- package/build/esm/packages/phoenix/src/components/tabs/tabs_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/controllers/visibility_controller/visibility_controller.js +1 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js +3 -0
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js.map +1 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element_utils.js +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +4 -0
- package/build/esm/packages/phoenix/src/index.js +4 -0
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- package/package.json +2 -2
- package/build/cjs/packages/utilities/build/esm/json_utils.js +0 -25
- package/build/cjs/packages/utilities/build/esm/web_components_utils.js +0 -18
- package/build/esm/packages/utilities/build/esm/json_utils.js +0 -21
- package/build/esm/packages/utilities/build/esm/json_utils.js.map +0 -1
- package/build/esm/packages/utilities/build/esm/web_components_utils.js +0 -14
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
-
require('lit');
|
|
7
6
|
var decorators = require('lit/decorators');
|
|
8
7
|
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
8
|
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
@@ -11,7 +10,6 @@ var portal_constants = require('../portal/portal_constants.js');
|
|
|
11
10
|
var litHtml = require('lit-html');
|
|
12
11
|
var backdrop_controller = require('../backdrop/controller/backdrop_controller.js');
|
|
13
12
|
var decorators_js = require('@lit/reactive-element/decorators.js');
|
|
14
|
-
var ref_js = require('lit-html/directives/ref.js');
|
|
15
13
|
var global_constants = require('../../global_constants.js');
|
|
16
14
|
var dropdown_constants = require('./dropdown_constants.js');
|
|
17
15
|
var relative_position_controller_constants = require('../../controllers/relative_position_controller/relative_position_controller_constants.js');
|
|
@@ -32,8 +30,6 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
32
30
|
this._backdropController = new backdrop_controller.BackdropController();
|
|
33
31
|
this._firstFocusableElement = undefined;
|
|
34
32
|
this._lastFocusableElement = undefined;
|
|
35
|
-
this._focusSentinelStart = ref_js.createRef();
|
|
36
|
-
this._focusSentinelEnd = ref_js.createRef();
|
|
37
33
|
this._handleClickOutside = async (target) => {
|
|
38
34
|
var _a, _b;
|
|
39
35
|
if (!this.opened)
|
|
@@ -59,11 +55,13 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
59
55
|
}, 0);
|
|
60
56
|
const transitionDuration = parseFloat(getComputedStyle(this.$dropdownContent || this).transitionDuration) * 1000;
|
|
61
57
|
setTimeout(() => {
|
|
62
|
-
var _a, _b;
|
|
58
|
+
var _a, _b, _c;
|
|
63
59
|
this._dispatchShowDropdownEvent();
|
|
64
60
|
(_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.classList.remove(`${dropdown_constants.DROPDOWN_CONTENT_SHOW}-${this.transition}-start`, `${dropdown_constants.DROPDOWN_CONTENT_SHOW}-${this.transition}-end`);
|
|
65
61
|
this._toggleScroll();
|
|
66
|
-
(
|
|
62
|
+
if (!this._lastFocusableElement)
|
|
63
|
+
this._lastFocusableElement = (_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.lastElementChild;
|
|
64
|
+
this._focusOnNextSibling((_c = this.$dropdownContent) === null || _c === void 0 ? void 0 : _c.firstElementChild);
|
|
67
65
|
resolve();
|
|
68
66
|
}, transitionDuration);
|
|
69
67
|
});
|
|
@@ -135,20 +133,11 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
135
133
|
await this.hide();
|
|
136
134
|
};
|
|
137
135
|
this._handleFocusWithinDropdown = async (ev) => {
|
|
138
|
-
var _a;
|
|
139
136
|
const hasTabBeenPressed = ev.key.toLowerCase() === 'tab';
|
|
140
|
-
if (hasTabBeenPressed) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
ev.preventDefault();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
else if (document.activeElement === this._lastFocusableElement) {
|
|
148
|
-
ev.preventDefault();
|
|
149
|
-
await this._rootDropdown._hideDropdownsSequentially();
|
|
150
|
-
this._focusOnNextSibling(this._rootDropdown);
|
|
151
|
-
}
|
|
137
|
+
if (hasTabBeenPressed && document.activeElement === this._lastFocusableElement) {
|
|
138
|
+
ev.preventDefault();
|
|
139
|
+
this._focusOnNextSibling(this.nextElementSibling || this);
|
|
140
|
+
await this._hideDropdownsSequentially();
|
|
152
141
|
}
|
|
153
142
|
};
|
|
154
143
|
this._hoverToggle = async (ev) => {
|
|
@@ -207,11 +196,6 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
207
196
|
this._setupListeners();
|
|
208
197
|
this._setupInitialDropdownProperties();
|
|
209
198
|
}
|
|
210
|
-
firstUpdated(props) {
|
|
211
|
-
super.firstUpdated(props);
|
|
212
|
-
this._firstFocusableElement = this._focusSentinelStart.value;
|
|
213
|
-
this._lastFocusableElement = this._focusSentinelEnd.value;
|
|
214
|
-
}
|
|
215
199
|
static _appendDropdownPortal() {
|
|
216
200
|
const $dropdownPortalTarget = document.querySelector(`[name="${dropdown_constants.DEFAULT_DROPDOWN_PORTAL_NAME}"]`);
|
|
217
201
|
if (!$dropdownPortalTarget) {
|
|
@@ -258,7 +242,12 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
258
242
|
el.focus();
|
|
259
243
|
if (el === document.activeElement)
|
|
260
244
|
return;
|
|
261
|
-
|
|
245
|
+
if (el.firstElementChild) {
|
|
246
|
+
this._focusOnNextSibling(el.firstElementChild);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (el.nextElementSibling)
|
|
250
|
+
this._focusOnNextSibling(el.nextElementSibling);
|
|
262
251
|
}
|
|
263
252
|
_isHoveredWithinDropdown(element) {
|
|
264
253
|
var _a;
|
|
@@ -304,9 +293,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
304
293
|
return litHtml.html `
|
|
305
294
|
${this.getSlot('toggler')}
|
|
306
295
|
<h-portal ?disabled="${!this.opened}" @portal.open="${this._positionDropdownContent}" to="${this.portalTarget}" hidden>
|
|
307
|
-
<div tabindex="0" ${ref_js.ref(this._focusSentinelStart)}></div>
|
|
308
296
|
${this.getSlot('content')}
|
|
309
|
-
<div tabindex="0" ${ref_js.ref(this._focusSentinelEnd)}></div>
|
|
310
297
|
</h-portal>
|
|
311
298
|
`;
|
|
312
299
|
}
|
|
@@ -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
|
|
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,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;"}
|
|
@@ -22,7 +22,10 @@ exports.HDropdownContent = class HDropdownContent extends phoenix_light_lit_elem
|
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
24
|
super.render();
|
|
25
|
-
return lit.html `
|
|
25
|
+
return lit.html `
|
|
26
|
+
<div role="dialog">${this.getSlot('content')}</div>
|
|
27
|
+
<div tabindex="0"></div>
|
|
28
|
+
`;
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
31
|
tslib_es6.__decorate([
|
|
@@ -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;"}
|
|
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;"}
|
|
@@ -18,7 +18,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
|
|
|
18
18
|
this._dispatchToggleDropdownEvent = (ev) => {
|
|
19
19
|
ev.preventDefault();
|
|
20
20
|
ev.stopImmediatePropagation();
|
|
21
|
-
const toggleDropdownEvent = new
|
|
21
|
+
const toggleDropdownEvent = new CustomEvent(dropdown_constants.DROPDOWN_EVENTS.toggle, {
|
|
22
22
|
bubbles: true
|
|
23
23
|
});
|
|
24
24
|
this.dispatchEvent(toggleDropdownEvent);
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
6
|
var decorators = require('lit/decorators');
|
|
7
|
-
var
|
|
7
|
+
var utilities = require('@dreamcommerce/utilities');
|
|
8
8
|
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
9
|
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
10
10
|
var splide_esm = require('../../../../../external/@splidejs/splide/dist/js/splide.esm.js');
|
|
@@ -25,7 +25,7 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
25
25
|
connectedCallback() {
|
|
26
26
|
var _a;
|
|
27
27
|
if (this.settings) {
|
|
28
|
-
this._settings = (_a =
|
|
28
|
+
this._settings = (_a = utilities.JsonUtils.fromJson(this.settings)) !== null && _a !== void 0 ? _a : this._settings;
|
|
29
29
|
}
|
|
30
30
|
this._slider = new splide_esm.Splide(`#${this.id}`, this._settings);
|
|
31
31
|
if (this._settings.mountOnConnectedCallback) {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var decorators = require('lit/decorators');
|
|
7
|
+
var utilities = require('@dreamcommerce/utilities');
|
|
8
|
+
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
+
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var btn_controller = require('../../../controllers/btn_controller.js');
|
|
11
|
+
var tab_constants = require('./tab_constants.js');
|
|
12
|
+
|
|
13
|
+
exports.HTab = class HTab extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this._handleTabClicked = () => {
|
|
17
|
+
if (this.disabled)
|
|
18
|
+
return;
|
|
19
|
+
this._dispatchSelectedEvent();
|
|
20
|
+
};
|
|
21
|
+
this._dispatchSelectedEvent = () => {
|
|
22
|
+
this.dispatchEvent(new CustomEvent(tab_constants.TAB_EVENT_NAMES.selected, {
|
|
23
|
+
detail: {
|
|
24
|
+
$el: this
|
|
25
|
+
},
|
|
26
|
+
bubbles: true
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
get selected() {
|
|
31
|
+
return this.hasAttribute(tab_constants.TAB_SELECTED_ATTRIBUTE_NAME);
|
|
32
|
+
}
|
|
33
|
+
set selected(selected) {
|
|
34
|
+
selected ? this.setAttribute(tab_constants.TAB_SELECTED_ATTRIBUTE_NAME, '') : this.removeAttribute(tab_constants.TAB_SELECTED_ATTRIBUTE_NAME);
|
|
35
|
+
this.setAttribute('aria-selected', String(selected));
|
|
36
|
+
selected ? utilities.UiDomUtils.makeNavigable(this) : utilities.UiDomUtils.makeUnnavigable(this);
|
|
37
|
+
}
|
|
38
|
+
attributeChangedCallback(name, value, newValue) {
|
|
39
|
+
super.attributeChangedCallback(name, value, newValue);
|
|
40
|
+
switch (name) {
|
|
41
|
+
case tab_constants.TAB_SELECTED_ATTRIBUTE_NAME: {
|
|
42
|
+
this.selected = Boolean(newValue);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
this._btnController = new btn_controller.BtnController(this, this._handleTabClicked);
|
|
50
|
+
this._setupAttributes();
|
|
51
|
+
this._bindEvents();
|
|
52
|
+
this.selected ? utilities.UiDomUtils.makeNavigable(this) : utilities.UiDomUtils.makeUnnavigable(this);
|
|
53
|
+
}
|
|
54
|
+
_setupAttributes() {
|
|
55
|
+
this.setAttribute('role', 'tab');
|
|
56
|
+
this.setAttribute('aria-controls', this.panelName);
|
|
57
|
+
this.setAttribute('aria-selected', String(this.selected));
|
|
58
|
+
}
|
|
59
|
+
_bindEvents() {
|
|
60
|
+
this.addEventListener('click', this._handleTabClicked);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
tslib_es6.__decorate([
|
|
64
|
+
decorators.property({ type: String, reflect: true, attribute: 'panel-name' }),
|
|
65
|
+
tslib_es6.__metadata("design:type", String)
|
|
66
|
+
], exports.HTab.prototype, "panelName", void 0);
|
|
67
|
+
tslib_es6.__decorate([
|
|
68
|
+
decorators.property({ type: Boolean, reflect: true }),
|
|
69
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
70
|
+
], exports.HTab.prototype, "disabled", void 0);
|
|
71
|
+
exports.HTab = tslib_es6.__decorate([
|
|
72
|
+
phoenix_custom_element.phoenixCustomElement('h-tab')
|
|
73
|
+
], exports.HTab);
|
|
74
|
+
//# sourceMappingURL=tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const TAB_EVENT_NAMES = {
|
|
6
|
+
selected: 'selected'
|
|
7
|
+
};
|
|
8
|
+
const TAB_SELECTED_ATTRIBUTE_NAME = 'selected';
|
|
9
|
+
|
|
10
|
+
exports.TAB_EVENT_NAMES = TAB_EVENT_NAMES;
|
|
11
|
+
exports.TAB_SELECTED_ATTRIBUTE_NAME = TAB_SELECTED_ATTRIBUTE_NAME;
|
|
12
|
+
//# sourceMappingURL=tab_constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var decorators = require('lit/decorators');
|
|
7
|
+
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
8
|
+
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
9
|
+
var visibility_controller = require('../../controllers/visibility_controller/visibility_controller.js');
|
|
10
|
+
|
|
11
|
+
exports.HTabPanel = class HTabPanel extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this._visibilityController = new visibility_controller.VisibilityController(this);
|
|
15
|
+
}
|
|
16
|
+
show() {
|
|
17
|
+
this._visibilityController.show();
|
|
18
|
+
}
|
|
19
|
+
hide() {
|
|
20
|
+
this._visibilityController.hide();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
tslib_es6.__decorate([
|
|
24
|
+
decorators.property({ type: String, reflect: true }),
|
|
25
|
+
tslib_es6.__metadata("design:type", String)
|
|
26
|
+
], exports.HTabPanel.prototype, "name", void 0);
|
|
27
|
+
exports.HTabPanel = tslib_es6.__decorate([
|
|
28
|
+
phoenix_custom_element.phoenixCustomElement('h-tab-panel'),
|
|
29
|
+
tslib_es6.__metadata("design:paramtypes", [])
|
|
30
|
+
], exports.HTabPanel);
|
|
31
|
+
//# sourceMappingURL=tab_panel.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var decorators = require('lit/decorators');
|
|
7
|
+
var utilities = require('@dreamcommerce/utilities');
|
|
8
|
+
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
+
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
|
|
11
|
+
var tab_constants = require('./tab/tab_constants.js');
|
|
12
|
+
var tab = require('./tab/tab.js');
|
|
13
|
+
var tabs_constants = require('./tabs_constants.js');
|
|
14
|
+
|
|
15
|
+
exports.HTabs = class HTabs extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this._handleArrowNavigation = ({ key }) => {
|
|
19
|
+
const currentTabIndex = this._getFocusedTabIndex();
|
|
20
|
+
if (currentTabIndex === undefined)
|
|
21
|
+
return;
|
|
22
|
+
const newTabIndex = key === 'ArrowLeft' ? this._getPrevTabIndex(currentTabIndex) : this._getNextTabIndex(currentTabIndex);
|
|
23
|
+
if (newTabIndex === undefined)
|
|
24
|
+
return;
|
|
25
|
+
utilities.UiDomUtils.makeUnnavigable(this._$tabs[currentTabIndex]);
|
|
26
|
+
utilities.UiDomUtils.makeNavigable(this._$tabs[newTabIndex]);
|
|
27
|
+
this._$tabs[newTabIndex].focus();
|
|
28
|
+
};
|
|
29
|
+
this._handleTabSelected = (event) => {
|
|
30
|
+
const $newlySelectedTab = event.detail.$el;
|
|
31
|
+
this.switchPanel($newlySelectedTab.panelName);
|
|
32
|
+
if (this._$selectedTab)
|
|
33
|
+
this._$selectedTab.selected = false;
|
|
34
|
+
$newlySelectedTab.selected = true;
|
|
35
|
+
this._dispatchChangedEvent(this._$selectedTab, $newlySelectedTab);
|
|
36
|
+
this._$selectedTab = $newlySelectedTab;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this._setupEvents();
|
|
42
|
+
this.setAttribute('role', 'tablist');
|
|
43
|
+
this._$tabs = [...this.querySelectorAll('h-tab')];
|
|
44
|
+
new keystrokes_controller.KeystrokesController({
|
|
45
|
+
host: this,
|
|
46
|
+
keys: ['ArrowRight', 'ArrowLeft'],
|
|
47
|
+
callback: this._handleArrowNavigation
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
_getFocusedTabIndex() {
|
|
51
|
+
const focusedElement = document.activeElement;
|
|
52
|
+
if ((focusedElement === null || focusedElement === void 0 ? void 0 : focusedElement.tagName) !== 'H-TAB')
|
|
53
|
+
return;
|
|
54
|
+
return this._$tabs.findIndex(($tab) => $tab === focusedElement);
|
|
55
|
+
}
|
|
56
|
+
_getNextTabIndex(currentTabIndex) {
|
|
57
|
+
if (currentTabIndex >= this._$tabs.length - 1)
|
|
58
|
+
return;
|
|
59
|
+
return currentTabIndex + 1;
|
|
60
|
+
}
|
|
61
|
+
_getPrevTabIndex(currentTabIndex) {
|
|
62
|
+
if (currentTabIndex <= 0)
|
|
63
|
+
return;
|
|
64
|
+
return currentTabIndex - 1;
|
|
65
|
+
}
|
|
66
|
+
_setupEvents() {
|
|
67
|
+
this.addEventListener(tab_constants.TAB_EVENT_NAMES.selected, this._handleTabSelected);
|
|
68
|
+
}
|
|
69
|
+
allChildrenConnected() {
|
|
70
|
+
const $selectedTab = this.querySelector('h-tab[selected]');
|
|
71
|
+
this._hideNotSelectedAndVisiblePanels();
|
|
72
|
+
if (!$selectedTab)
|
|
73
|
+
return;
|
|
74
|
+
this._$selectedTab = $selectedTab;
|
|
75
|
+
this.switchPanel(this._$selectedTab.panelName);
|
|
76
|
+
}
|
|
77
|
+
_hideNotSelectedAndVisiblePanels() {
|
|
78
|
+
const $notSelectedTabs = [...this.querySelectorAll('h-tab:not([selected])')];
|
|
79
|
+
$notSelectedTabs
|
|
80
|
+
.map(($tab) => $tab.panelName)
|
|
81
|
+
.forEach((panelName) => document.querySelectorAll(`[name="${panelName}"]`).forEach(($panel) => $panel.hide()));
|
|
82
|
+
}
|
|
83
|
+
switchPanel(newPanelName) {
|
|
84
|
+
const $currentPanel = this._$selectedTab && document.querySelectorAll(`[name="${this._$selectedTab.panelName}"]`);
|
|
85
|
+
const $newPanel = document.querySelectorAll(`[name="${newPanelName}"]`);
|
|
86
|
+
if ($currentPanel)
|
|
87
|
+
$currentPanel.forEach(($panel) => $panel.hide());
|
|
88
|
+
if ($newPanel)
|
|
89
|
+
$newPanel.forEach(($panel) => $panel.show());
|
|
90
|
+
}
|
|
91
|
+
_dispatchChangedEvent($previousTab, $newTab) {
|
|
92
|
+
this.dispatchEvent(new CustomEvent(tabs_constants.TABS_EVENT_NAMES.changed, {
|
|
93
|
+
detail: {
|
|
94
|
+
$previousTab,
|
|
95
|
+
$newTab
|
|
96
|
+
},
|
|
97
|
+
bubbles: true
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
tslib_es6.__decorate([
|
|
102
|
+
decorators.state(),
|
|
103
|
+
tslib_es6.__metadata("design:type", tab.HTab)
|
|
104
|
+
], exports.HTabs.prototype, "_$selectedTab", void 0);
|
|
105
|
+
exports.HTabs = tslib_es6.__decorate([
|
|
106
|
+
phoenix_custom_element.phoenixCustomElement('h-tabs')
|
|
107
|
+
], exports.HTabs);
|
|
108
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;"}
|
package/build/cjs/packages/phoenix/src/controllers/visibility_controller/visibility_controller.js
CHANGED
|
@@ -20,7 +20,7 @@ class VisibilityController {
|
|
|
20
20
|
tslib_es6.__classPrivateFieldGet(this, _VisibilityController_host, "f").addEventListener('resize', this._handleResize);
|
|
21
21
|
}
|
|
22
22
|
_setVisibilityValue() {
|
|
23
|
-
const isVisible = this._isVisibleBasedOnCssStyle();
|
|
23
|
+
const isVisible = this._isVisibleBasedOnCssStyle() && !tslib_es6.__classPrivateFieldGet(this, _VisibilityController_host, "f").getAttribute('hidden');
|
|
24
24
|
isVisible ? this.show() : this.hide();
|
|
25
25
|
}
|
|
26
26
|
_isVisibleBasedOnCssStyle() {
|
package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js
CHANGED
|
@@ -32,6 +32,8 @@ class PhoenixLightLitElement extends lit.LitElement {
|
|
|
32
32
|
}
|
|
33
33
|
_setupChildrenWatch() {
|
|
34
34
|
this.childrenToWatch = this.childrenToWatch ? this.childrenToWatch : this._getComponentsNamesToWatch();
|
|
35
|
+
if (!this.childrenToWatch.length)
|
|
36
|
+
this.allChildrenConnected();
|
|
35
37
|
this.addEventListener(phoenix_light_lit_elements_constants.PHOENIX_LIGHT_LIT_ELEMENTS_EVENT_NAMES.connected, this._handleComponentConnected);
|
|
36
38
|
}
|
|
37
39
|
_getComponentsNamesToWatch() {
|
|
@@ -45,6 +47,7 @@ class PhoenixLightLitElement extends lit.LitElement {
|
|
|
45
47
|
},
|
|
46
48
|
bubbles: true
|
|
47
49
|
}));
|
|
50
|
+
this.isWebComponentConnected = true;
|
|
48
51
|
this._setupChildrenWatch();
|
|
49
52
|
}
|
|
50
53
|
allChildrenConnected() { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;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;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;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;"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var utilities = require('@dreamcommerce/utilities');
|
|
6
6
|
|
|
7
7
|
class PhoenixLightLitElementUtils {
|
|
8
8
|
static getComponentsForWhichToWaitForConnection(components) {
|
|
9
|
-
return components.filter(($element) => (
|
|
10
|
-
(
|
|
11
|
-
|
|
9
|
+
return components.filter(($element) => (utilities.WebComponentsUtils.isWebComponent($element) && !utilities.WebComponentsUtils.isWebComponentDefined($element)) ||
|
|
10
|
+
(utilities.WebComponentsUtils.isWebComponent($element) &&
|
|
11
|
+
utilities.WebComponentsUtils.isWebComponentDefined($element) &&
|
|
12
12
|
!$element.isWebComponentConnected));
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -62,6 +62,10 @@ var click_outside_controller_messages = require('./controllers/click_outside_con
|
|
|
62
62
|
var backdrop = require('./components/backdrop/backdrop.js');
|
|
63
63
|
var visibility_controller = require('./controllers/visibility_controller/visibility_controller.js');
|
|
64
64
|
var slider = require('./components/slider/slider.js');
|
|
65
|
+
var tab = require('./components/tabs/tab/tab.js');
|
|
66
|
+
var tab_panel = require('./components/tabs/tab_panel.js');
|
|
67
|
+
var tabs_constants = require('./components/tabs/tabs_constants.js');
|
|
68
|
+
var tabs = require('./components/tabs/tabs.js');
|
|
65
69
|
var scroll_to = require('./components/scroll_to/scroll_to.js');
|
|
66
70
|
|
|
67
71
|
|
|
@@ -345,6 +349,25 @@ Object.defineProperty(exports, 'HSlider', {
|
|
|
345
349
|
return slider.HSlider;
|
|
346
350
|
}
|
|
347
351
|
});
|
|
352
|
+
Object.defineProperty(exports, 'HTab', {
|
|
353
|
+
enumerable: true,
|
|
354
|
+
get: function () {
|
|
355
|
+
return tab.HTab;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
Object.defineProperty(exports, 'HTabPanel', {
|
|
359
|
+
enumerable: true,
|
|
360
|
+
get: function () {
|
|
361
|
+
return tab_panel.HTabPanel;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
exports.TABS_EVENT_NAMES = tabs_constants.TABS_EVENT_NAMES;
|
|
365
|
+
Object.defineProperty(exports, 'HTabs', {
|
|
366
|
+
enumerable: true,
|
|
367
|
+
get: function () {
|
|
368
|
+
return tabs.HTabs;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
348
371
|
Object.defineProperty(exports, 'HScrollTo', {
|
|
349
372
|
enumerable: true,
|
|
350
373
|
get: function () {
|
|
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -3,7 +3,6 @@ import { TemplateResult } from 'lit-html';
|
|
|
3
3
|
import { HDropdownContent } from './dropdown_content';
|
|
4
4
|
import { HDropdownToggler } from './dropdown_toggler';
|
|
5
5
|
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
6
|
-
import { PropertyValues } from 'lit';
|
|
7
6
|
export declare class HDropdown extends PhoenixLightLitElement implements IDropdown {
|
|
8
7
|
opened: boolean;
|
|
9
8
|
direction: "bottom-center";
|
|
@@ -21,11 +20,8 @@ export declare class HDropdown extends PhoenixLightLitElement implements IDropdo
|
|
|
21
20
|
private _backdropController;
|
|
22
21
|
_firstFocusableElement: HTMLElement | undefined;
|
|
23
22
|
_lastFocusableElement: HTMLElement | undefined;
|
|
24
|
-
private _focusSentinelStart;
|
|
25
|
-
private _focusSentinelEnd;
|
|
26
23
|
private _rootDropdown?;
|
|
27
24
|
connectedCallback(): void;
|
|
28
|
-
firstUpdated(props: PropertyValues): void;
|
|
29
25
|
private static _appendDropdownPortal;
|
|
30
26
|
private _findRootDropdown;
|
|
31
27
|
private _setupListeners;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import 'lit';
|
|
3
2
|
import { state } from 'lit/decorators';
|
|
4
3
|
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
4
|
import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
|
|
@@ -7,7 +6,6 @@ import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP } from '../portal
|
|
|
7
6
|
import { html } from 'lit-html';
|
|
8
7
|
import { BackdropController } from '../backdrop/controller/backdrop_controller.js';
|
|
9
8
|
import { property } from '@lit/reactive-element/decorators.js';
|
|
10
|
-
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
11
9
|
import { BREAKPOINTS, SCROLLABLE_CLASS_NAME } from '../../global_constants.js';
|
|
12
10
|
import { DEFAULT_DROPDOWN_PORTAL_NAME, DROPDOWN_CONTENT_VISIBLE_CLASS, DROPDOWN_CONTENT_SHOW, DROPDOWN_EVENTS, DROPDOWN_CONTAINER_NAME, DROPDOWN_CONTENT_HIDE, DROPDOWN_CONTENT_NAME, DROPDOWN_TOGGLER_NAME } from './dropdown_constants.js';
|
|
13
11
|
import { DIRECTIONS, RELATIVE_POSITION_CONTROLLER_EVENTS, DEFAULT_THROTTLE_WAIT_TIME } from '../../controllers/relative_position_controller/relative_position_controller_constants.js';
|
|
@@ -28,8 +26,6 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
28
26
|
this._backdropController = new BackdropController();
|
|
29
27
|
this._firstFocusableElement = undefined;
|
|
30
28
|
this._lastFocusableElement = undefined;
|
|
31
|
-
this._focusSentinelStart = createRef();
|
|
32
|
-
this._focusSentinelEnd = createRef();
|
|
33
29
|
this._handleClickOutside = async (target) => {
|
|
34
30
|
var _a, _b;
|
|
35
31
|
if (!this.opened)
|
|
@@ -55,11 +51,13 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
55
51
|
}, 0);
|
|
56
52
|
const transitionDuration = parseFloat(getComputedStyle(this.$dropdownContent || this).transitionDuration) * 1000;
|
|
57
53
|
setTimeout(() => {
|
|
58
|
-
var _a, _b;
|
|
54
|
+
var _a, _b, _c;
|
|
59
55
|
this._dispatchShowDropdownEvent();
|
|
60
56
|
(_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.classList.remove(`${DROPDOWN_CONTENT_SHOW}-${this.transition}-start`, `${DROPDOWN_CONTENT_SHOW}-${this.transition}-end`);
|
|
61
57
|
this._toggleScroll();
|
|
62
|
-
(
|
|
58
|
+
if (!this._lastFocusableElement)
|
|
59
|
+
this._lastFocusableElement = (_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.lastElementChild;
|
|
60
|
+
this._focusOnNextSibling((_c = this.$dropdownContent) === null || _c === void 0 ? void 0 : _c.firstElementChild);
|
|
63
61
|
resolve();
|
|
64
62
|
}, transitionDuration);
|
|
65
63
|
});
|
|
@@ -131,20 +129,11 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
131
129
|
await this.hide();
|
|
132
130
|
};
|
|
133
131
|
this._handleFocusWithinDropdown = async (ev) => {
|
|
134
|
-
var _a;
|
|
135
132
|
const hasTabBeenPressed = ev.key.toLowerCase() === 'tab';
|
|
136
|
-
if (hasTabBeenPressed) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
ev.preventDefault();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else if (document.activeElement === this._lastFocusableElement) {
|
|
144
|
-
ev.preventDefault();
|
|
145
|
-
await this._rootDropdown._hideDropdownsSequentially();
|
|
146
|
-
this._focusOnNextSibling(this._rootDropdown);
|
|
147
|
-
}
|
|
133
|
+
if (hasTabBeenPressed && document.activeElement === this._lastFocusableElement) {
|
|
134
|
+
ev.preventDefault();
|
|
135
|
+
this._focusOnNextSibling(this.nextElementSibling || this);
|
|
136
|
+
await this._hideDropdownsSequentially();
|
|
148
137
|
}
|
|
149
138
|
};
|
|
150
139
|
this._hoverToggle = async (ev) => {
|
|
@@ -203,11 +192,6 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
203
192
|
this._setupListeners();
|
|
204
193
|
this._setupInitialDropdownProperties();
|
|
205
194
|
}
|
|
206
|
-
firstUpdated(props) {
|
|
207
|
-
super.firstUpdated(props);
|
|
208
|
-
this._firstFocusableElement = this._focusSentinelStart.value;
|
|
209
|
-
this._lastFocusableElement = this._focusSentinelEnd.value;
|
|
210
|
-
}
|
|
211
195
|
static _appendDropdownPortal() {
|
|
212
196
|
const $dropdownPortalTarget = document.querySelector(`[name="${DEFAULT_DROPDOWN_PORTAL_NAME}"]`);
|
|
213
197
|
if (!$dropdownPortalTarget) {
|
|
@@ -254,7 +238,12 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
254
238
|
el.focus();
|
|
255
239
|
if (el === document.activeElement)
|
|
256
240
|
return;
|
|
257
|
-
|
|
241
|
+
if (el.firstElementChild) {
|
|
242
|
+
this._focusOnNextSibling(el.firstElementChild);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (el.nextElementSibling)
|
|
246
|
+
this._focusOnNextSibling(el.nextElementSibling);
|
|
258
247
|
}
|
|
259
248
|
_isHoveredWithinDropdown(element) {
|
|
260
249
|
var _a;
|
|
@@ -300,9 +289,7 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
300
289
|
return html `
|
|
301
290
|
${this.getSlot('toggler')}
|
|
302
291
|
<h-portal ?disabled="${!this.opened}" @portal.open="${this._positionDropdownContent}" to="${this.portalTarget}" hidden>
|
|
303
|
-
<div tabindex="0" ${ref(this._focusSentinelStart)}></div>
|
|
304
292
|
${this.getSlot('content')}
|
|
305
|
-
<div tabindex="0" ${ref(this._focusSentinelEnd)}></div>
|
|
306
293
|
</h-portal>
|
|
307
294
|
`;
|
|
308
295
|
}
|