@shoper/phoenix_design_system 1.11.11-7 → 1.11.11-8
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 +112 -38
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +0 -5
- 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 +13 -24
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/search.js +95 -279
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +0 -5
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +9 -22
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +1 -15
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js +1 -8
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +4 -9
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +4 -9
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +4 -11
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +5 -12
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +2 -3
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +13 -2
- package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +12 -12
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +12 -4
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +113 -39
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.d.ts +0 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +0 -5
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +14 -25
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +5 -26
- package/build/esm/packages/phoenix/src/components/form/search/search.js +96 -280
- package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_types.d.ts +0 -4
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +0 -5
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.d.ts +2 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +9 -22
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +2 -16
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js +1 -8
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +4 -9
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +4 -9
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +4 -11
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +5 -12
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select.js +2 -3
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.d.ts +2 -1
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +13 -2
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller_types.d.ts +1 -0
- package/build/esm/packages/phoenix/src/index.js +2 -2
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ var litHtml = require('lit-html');
|
|
|
12
12
|
var global_constants = require('../../global_constants.js');
|
|
13
13
|
var dropdown_constants = require('./dropdown_constants.js');
|
|
14
14
|
var relative_position_controller_constants = require('../../controllers/relative_position_controller/relative_position_controller_constants.js');
|
|
15
|
+
var v4 = require('../../../../../external/uuid/dist/esm-browser/v4.js');
|
|
15
16
|
var portal_constants = require('../portal/portal_constants.js');
|
|
16
17
|
var backdrop_controller = require('../backdrop/controller/backdrop_controller.js');
|
|
17
18
|
var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
|
|
@@ -29,6 +30,8 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
29
30
|
this.transition = 'direction';
|
|
30
31
|
this.offset = 0;
|
|
31
32
|
this.portalTarget = dropdown_constants.DEFAULT_DROPDOWN_PORTAL_NAME;
|
|
33
|
+
this.id = v4['default']();
|
|
34
|
+
this.preventFocusTrap = false;
|
|
32
35
|
this._backdropController = new backdrop_controller.BackdropController();
|
|
33
36
|
this._handleClickOutside = async (target) => {
|
|
34
37
|
var _a, _b;
|
|
@@ -45,7 +48,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
45
48
|
return;
|
|
46
49
|
}
|
|
47
50
|
await this.show();
|
|
48
|
-
|
|
51
|
+
this._focusOnFirstContentElement();
|
|
49
52
|
};
|
|
50
53
|
this.show = async () => {
|
|
51
54
|
if (this.opened)
|
|
@@ -136,44 +139,26 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
136
139
|
return;
|
|
137
140
|
await this.hide();
|
|
138
141
|
};
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
if (!this.opened || ev.shiftKey)
|
|
142
|
+
this._keepFocusWithinDropdownForwards = (ev) => {
|
|
143
|
+
if (ev.shiftKey === true || !this.$dropdownContent)
|
|
142
144
|
return;
|
|
143
|
-
const $
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const isActiveElementLastFocusableElement = indexOfCurrentlyFocusedElement === $focusableElementsWithinDropdownContent.length - 1;
|
|
147
|
-
if (doesNotHaveFocusableElementsInsideContent || isActiveElementLastFocusableElement)
|
|
148
|
-
this._handleFocusOnNextElement(ev);
|
|
149
|
-
};
|
|
150
|
-
this._handleFocusOnNextElement = async (ev) => {
|
|
151
|
-
var _a;
|
|
152
|
-
ev.preventDefault();
|
|
153
|
-
const $focusableElements = utilities.UiDomUtils.getFocusableElements(document.body);
|
|
154
|
-
const indexOfDropdownToggler = $focusableElements.indexOf(this.$dropdownToggler);
|
|
155
|
-
const $nextElementToFocus = (_a = $focusableElements[indexOfDropdownToggler + 1]) !== null && _a !== void 0 ? _a : $focusableElements[0];
|
|
156
|
-
await this._hideDropdownsSequentially();
|
|
157
|
-
await this.hide();
|
|
158
|
-
this._focusOnNextElementAfterToggler($nextElementToFocus);
|
|
159
|
-
};
|
|
160
|
-
this._focusOnNextElementAfterToggler = ($elementToFocus) => {
|
|
161
|
-
var _a;
|
|
162
|
-
const isTogglerLastChildOfPreviousDropdown = ($elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.closest(dropdown_constants.DROPDOWN_CONTENT_NAME)) === this.$dropdownContent;
|
|
163
|
-
if (isTogglerLastChildOfPreviousDropdown) {
|
|
164
|
-
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
145
|
+
const $target = ev.target;
|
|
146
|
+
this._handleFocusFromTogglerForwards(ev);
|
|
147
|
+
if (!$target.contains(document.activeElement) || !this.opened || !this.$dropdownContent)
|
|
165
148
|
return;
|
|
166
|
-
|
|
167
|
-
$elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.focus();
|
|
149
|
+
this._handleFocusFromSentinelEndForwards(ev, $target);
|
|
168
150
|
};
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
const $firstFocusableElement = this.$dropdownContent && utilities.UiDomUtils.getFocusableElement(this.$dropdownContent);
|
|
172
|
-
if (document.activeElement !== $firstFocusableElement)
|
|
151
|
+
this._keepFocusWithinDropdownBackwards = (ev) => {
|
|
152
|
+
if (!this.opened || !this.$dropdownContent)
|
|
173
153
|
return;
|
|
174
|
-
ev.
|
|
175
|
-
(
|
|
176
|
-
|
|
154
|
+
const $target = ev.target;
|
|
155
|
+
if (this.preventFocusTrap) {
|
|
156
|
+
this._handleDefaultFocusFromDropdownBackwards(ev);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this._handleFocusFromTogglerBackwards(ev, $target);
|
|
160
|
+
this._handleFocusFromSentinelStartBackwards(ev, $target);
|
|
161
|
+
}
|
|
177
162
|
};
|
|
178
163
|
this._hoverToggle = async (ev) => {
|
|
179
164
|
if (window.innerWidth < global_constants.BREAKPOINTS.xs)
|
|
@@ -185,12 +170,19 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
185
170
|
const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
|
|
186
171
|
if (isHoveredWithinDropdown && !this.opened) {
|
|
187
172
|
await this.show();
|
|
188
|
-
|
|
173
|
+
this._focusOnFirstContentElement();
|
|
189
174
|
return;
|
|
190
175
|
}
|
|
191
176
|
if (!isHoveredWithinDropdown && this.opened)
|
|
192
177
|
await this._hideDropdownsSequentially();
|
|
193
178
|
};
|
|
179
|
+
this._focusOnFirstContentElement = () => {
|
|
180
|
+
if (!this.$dropdownContent)
|
|
181
|
+
return;
|
|
182
|
+
const $firstFocusableElement = this._getTrulyFocusableElements(this.$dropdownContent)[0];
|
|
183
|
+
if ($firstFocusableElement)
|
|
184
|
+
$firstFocusableElement.focus();
|
|
185
|
+
};
|
|
194
186
|
this.isOpened = () => this.opened;
|
|
195
187
|
this._positionDropdownContent = () => {
|
|
196
188
|
if (this.contentWidth === dropdown_constants.DROPDOWN_CONTENT_WIDTH.full)
|
|
@@ -216,13 +208,14 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
216
208
|
host: this,
|
|
217
209
|
target: document.body,
|
|
218
210
|
keys: ['tab'],
|
|
219
|
-
callback: this.
|
|
211
|
+
callback: this._keepFocusWithinDropdownForwards
|
|
220
212
|
});
|
|
221
213
|
new keystrokes_controller.KeystrokesController({
|
|
222
214
|
host: this,
|
|
223
215
|
target: document.body,
|
|
224
216
|
keys: [['shift', 'tab']],
|
|
225
|
-
callback: this.
|
|
217
|
+
callback: this._keepFocusWithinDropdownBackwards,
|
|
218
|
+
containerSelectors: ['h-dropdown', 'h-dropdown-content']
|
|
226
219
|
});
|
|
227
220
|
}
|
|
228
221
|
async connectedCallback() {
|
|
@@ -298,6 +291,77 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
298
291
|
(_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.classList.add(global_constants.SCROLLABLE_CLASS_NAME);
|
|
299
292
|
}
|
|
300
293
|
}
|
|
294
|
+
_handleFocusFromTogglerForwards(ev) {
|
|
295
|
+
if (!this.$dropdownContent)
|
|
296
|
+
return;
|
|
297
|
+
ev.preventDefault();
|
|
298
|
+
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
299
|
+
if (trulyFocusableElements.length === 0)
|
|
300
|
+
return;
|
|
301
|
+
trulyFocusableElements[0].focus();
|
|
302
|
+
}
|
|
303
|
+
_handleFocusFromSentinelEndForwards(ev, $target) {
|
|
304
|
+
var _a;
|
|
305
|
+
if (!this.$dropdownContent)
|
|
306
|
+
return;
|
|
307
|
+
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
308
|
+
const $lastFocusableElement = trulyFocusableElements.slice(-1)[0];
|
|
309
|
+
if (this.preventFocusTrap && document.activeElement) {
|
|
310
|
+
const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement(document.activeElement);
|
|
311
|
+
if ($nextFocusableElement === $lastFocusableElement || trulyFocusableElements.length === 1) {
|
|
312
|
+
ev.preventDefault();
|
|
313
|
+
this.hide();
|
|
314
|
+
utilities.UiDomUtils.getNextFocusableElement(this.$dropdownToggler || this).focus();
|
|
315
|
+
}
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if ($target !== $lastFocusableElement)
|
|
319
|
+
return;
|
|
320
|
+
ev.preventDefault();
|
|
321
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
322
|
+
}
|
|
323
|
+
_handleDefaultFocusFromDropdownBackwards(ev) {
|
|
324
|
+
ev.preventDefault();
|
|
325
|
+
this.hide();
|
|
326
|
+
utilities.UiDomUtils.getPreviousFocusableElement(this.$dropdownToggler || this).focus();
|
|
327
|
+
}
|
|
328
|
+
_handleFocusFromTogglerBackwards(ev, $target) {
|
|
329
|
+
var _a;
|
|
330
|
+
if ($target !== this.$dropdownToggler && !((_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.contains($target)) || !this.$dropdownContent)
|
|
331
|
+
return;
|
|
332
|
+
ev.preventDefault();
|
|
333
|
+
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
334
|
+
if (trulyFocusableElements.length === 0)
|
|
335
|
+
return;
|
|
336
|
+
const $lastFocusableElement = trulyFocusableElements.slice(-1)[0];
|
|
337
|
+
$lastFocusableElement.focus();
|
|
338
|
+
}
|
|
339
|
+
_handleFocusFromSentinelStartBackwards(ev, $target) {
|
|
340
|
+
var _a;
|
|
341
|
+
if (!this.$dropdownContent)
|
|
342
|
+
return;
|
|
343
|
+
const $firstFocusableElement = this._getTrulyFocusableElements(this.$dropdownContent)[0];
|
|
344
|
+
if ($target !== $firstFocusableElement)
|
|
345
|
+
return;
|
|
346
|
+
ev.preventDefault();
|
|
347
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
348
|
+
}
|
|
349
|
+
_getTrulyFocusableElements($container) {
|
|
350
|
+
const focusableElements = utilities.UiDomUtils.getFocusableElements($container);
|
|
351
|
+
return focusableElements.filter(($el) => this._isElementTrulyFocusable($el));
|
|
352
|
+
}
|
|
353
|
+
_isElementTrulyFocusable($el) {
|
|
354
|
+
const style = window.getComputedStyle($el);
|
|
355
|
+
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
if ($el.nodeName === 'H-PORTAL')
|
|
359
|
+
return true;
|
|
360
|
+
const $parent = $el.parentElement;
|
|
361
|
+
if (!$parent)
|
|
362
|
+
return true;
|
|
363
|
+
return this._isElementTrulyFocusable($parent);
|
|
364
|
+
}
|
|
301
365
|
_isHoveredWithinDropdown(element) {
|
|
302
366
|
var _a;
|
|
303
367
|
if (element === this)
|
|
@@ -321,6 +385,8 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
321
385
|
return;
|
|
322
386
|
if (!this._hasScrollableClassInitially)
|
|
323
387
|
this._hasScrollableClassInitially = this.$dropdownContent.classList.contains(global_constants.SCROLLABLE_CLASS_NAME);
|
|
388
|
+
if (!this.preventFocusTrap)
|
|
389
|
+
this.$dropdownContent.setAttribute('aria-modal', 'true');
|
|
324
390
|
}
|
|
325
391
|
_getDropdownContentWidth() {
|
|
326
392
|
const isMobileResolution = document.documentElement.clientWidth < global_constants.BREAKPOINTS.xs;
|
|
@@ -389,6 +455,14 @@ tslib_es6.__decorate([
|
|
|
389
455
|
decorators_js.property({ type: String, attribute: 'mobile-position' }),
|
|
390
456
|
tslib_es6.__metadata("design:type", String)
|
|
391
457
|
], exports.HDropdown.prototype, "mobilePosition", void 0);
|
|
458
|
+
tslib_es6.__decorate([
|
|
459
|
+
decorators_js.property({ type: String, attribute: 'id', reflect: true }),
|
|
460
|
+
tslib_es6.__metadata("design:type", Object)
|
|
461
|
+
], exports.HDropdown.prototype, "id", void 0);
|
|
462
|
+
tslib_es6.__decorate([
|
|
463
|
+
decorators_js.property({ type: Boolean, attribute: 'prevent-focus-trap' }),
|
|
464
|
+
tslib_es6.__metadata("design:type", Object)
|
|
465
|
+
], exports.HDropdown.prototype, "preventFocusTrap", void 0);
|
|
392
466
|
exports.HDropdown = HDropdown_1 = tslib_es6.__decorate([
|
|
393
467
|
phoenix_custom_element.phoenixCustomElement('h-dropdown'),
|
|
394
468
|
tslib_es6.__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -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
|
-
var lit = 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');
|
|
@@ -23,10 +22,6 @@ exports.HDropdownContent = class HDropdownContent extends phoenix_light_lit_elem
|
|
|
23
22
|
element.setAttribute('role', 'menuitem');
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
|
-
render() {
|
|
27
|
-
super.render();
|
|
28
|
-
return lit.html ` <div role="dialog">${this.getSlot('content')}</div> `;
|
|
29
|
-
}
|
|
30
25
|
};
|
|
31
26
|
tslib_es6.__decorate([
|
|
32
27
|
decorators.property({ type: String }),
|
|
@@ -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;
|
|
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;"}
|
|
@@ -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
|
-
|
|
7
|
+
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 btn_controller = require('../../controllers/btn_controller/btn_controller.js');
|
|
@@ -16,6 +16,17 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
this.name = '';
|
|
19
|
+
this._setupTogglerAria = () => {
|
|
20
|
+
this._$dropdown = this.closest(dropdown_constants.DROPDOWN_CONTAINER_NAME);
|
|
21
|
+
if (this._$dropdown.isOpened)
|
|
22
|
+
this._toggleElementAriaController = new toggle_element_aria_controller.ToggleElementAriaController({
|
|
23
|
+
host: this,
|
|
24
|
+
initialAriaExpandedValue: this._$dropdown.isOpened()
|
|
25
|
+
});
|
|
26
|
+
this.setAttribute('aria-haspopup', 'true');
|
|
27
|
+
if (this._$dropdown.id)
|
|
28
|
+
this.setAttribute('aria-controls', this._$dropdown.id);
|
|
29
|
+
};
|
|
19
30
|
this._dispatchToggleDropdownEventWithKeyboard = (ev) => {
|
|
20
31
|
ev.stopImmediatePropagation();
|
|
21
32
|
this._dispatchToggleDropdownEvent(ev);
|
|
@@ -29,18 +40,6 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
|
|
|
29
40
|
ev.preventDefault();
|
|
30
41
|
this.emitCustomEvent(dropdown_constants.DROPDOWN_EVENTS.toggle);
|
|
31
42
|
};
|
|
32
|
-
this._handleFocusToOpenedDropdown = async (ev) => {
|
|
33
|
-
if (ev.target !== this)
|
|
34
|
-
return;
|
|
35
|
-
const isOpened = this._$dropdown.isOpened();
|
|
36
|
-
if (!isOpened)
|
|
37
|
-
return;
|
|
38
|
-
const $dropdownContent = document.querySelector(`${dropdown_constants.DROPDOWN_CONTENT_NAME}[name="${this.name}"]`);
|
|
39
|
-
if (!$dropdownContent)
|
|
40
|
-
return;
|
|
41
|
-
ev.preventDefault();
|
|
42
|
-
utilities.UiDomUtils.setFocusToFirstFocusableElementInContainer($dropdownContent);
|
|
43
|
-
};
|
|
44
43
|
this.slot = this.hasAttribute('slot') ? this.slot : 'toggler';
|
|
45
44
|
this.className = `${dropdown_constants.DROPDOWN_CSS_CLASSES.toggler} ${this.className}`;
|
|
46
45
|
}
|
|
@@ -48,13 +47,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
|
|
|
48
47
|
var _a;
|
|
49
48
|
super.connectedCallback();
|
|
50
49
|
this._btnController = new btn_controller.BtnController(this, this._dispatchToggleDropdownEventWithKeyboard);
|
|
51
|
-
this.
|
|
52
|
-
if (this._$dropdown.isOpened)
|
|
53
|
-
this._toggleElementAriaController = new toggle_element_aria_controller.ToggleElementAriaController({
|
|
54
|
-
host: this,
|
|
55
|
-
initialAriaExpandedValue: this._$dropdown.isOpened()
|
|
56
|
-
});
|
|
57
|
-
document.addEventListener('keydown', this._handleFocusToOpenedDropdown);
|
|
50
|
+
this._setupTogglerAria();
|
|
58
51
|
const hasToggleOnHover = (_a = this._$dropdown) === null || _a === void 0 ? void 0 : _a.hasAttribute(dropdown_constants.DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME);
|
|
59
52
|
if (hasToggleOnHover) {
|
|
60
53
|
this.addEventListener('click', this._dispatchToggleDropdownEventOnMobile);
|
|
@@ -62,10 +55,6 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
|
|
|
62
55
|
}
|
|
63
56
|
this.addEventListener('click', this._dispatchToggleDropdownEvent);
|
|
64
57
|
}
|
|
65
|
-
disconnectedCallback() {
|
|
66
|
-
super.disconnectedCallback();
|
|
67
|
-
document.removeEventListener('keydown', this._handleFocusToOpenedDropdown);
|
|
68
|
-
}
|
|
69
58
|
};
|
|
70
59
|
tslib_es6.__decorate([
|
|
71
60
|
decorators.property({ type: String, 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;"}
|