@shoper/phoenix_design_system 1.11.11-6 → 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 -292
- 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 -23
- package/build/esm/packages/phoenix/src/components/form/search/search.js +96 -293
- 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
|
@@ -6,8 +6,9 @@ import { property } from '@lit/reactive-element/decorators.js';
|
|
|
6
6
|
import { KeystrokesController } from '../../controllers/keystrokes_controller/keystrokes_controller.js';
|
|
7
7
|
import { html } from 'lit-html';
|
|
8
8
|
import { BREAKPOINTS, SCROLLABLE_CLASS_NAME } from '../../global_constants.js';
|
|
9
|
-
import { DEFAULT_DROPDOWN_PORTAL_NAME, DROPDOWN_CONTENT_CSS_CLASSES, DROPDOWN_EVENTS, DROPDOWN_CONTAINER_NAME,
|
|
9
|
+
import { DEFAULT_DROPDOWN_PORTAL_NAME, DROPDOWN_CONTENT_CSS_CLASSES, DROPDOWN_EVENTS, DROPDOWN_CONTAINER_NAME, DROPDOWN_CONTENT_WIDTH, DROPDOWN_CONTENT_NAME, DROPDOWN_TOGGLER_NAME } from './dropdown_constants.js';
|
|
10
10
|
import { RELATIVE_POSITION_CONTROLLER_EVENTS, DEFAULT_THROTTLE_WAIT_TIME } from '../../controllers/relative_position_controller/relative_position_controller_constants.js';
|
|
11
|
+
import v4 from '../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
11
12
|
import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP } from '../portal/portal_constants.js';
|
|
12
13
|
import { BackdropController } from '../backdrop/controller/backdrop_controller.js';
|
|
13
14
|
import { ClickOutsideController } from '../../controllers/click_outside_controller/click_outside_controller.js';
|
|
@@ -25,6 +26,8 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
25
26
|
this.transition = 'direction';
|
|
26
27
|
this.offset = 0;
|
|
27
28
|
this.portalTarget = DEFAULT_DROPDOWN_PORTAL_NAME;
|
|
29
|
+
this.id = v4();
|
|
30
|
+
this.preventFocusTrap = false;
|
|
28
31
|
this._backdropController = new BackdropController();
|
|
29
32
|
this._handleClickOutside = async (target) => {
|
|
30
33
|
var _a, _b;
|
|
@@ -41,7 +44,7 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
46
|
await this.show();
|
|
44
|
-
|
|
47
|
+
this._focusOnFirstContentElement();
|
|
45
48
|
};
|
|
46
49
|
this.show = async () => {
|
|
47
50
|
if (this.opened)
|
|
@@ -132,44 +135,26 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
132
135
|
return;
|
|
133
136
|
await this.hide();
|
|
134
137
|
};
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
if (!this.opened || ev.shiftKey)
|
|
138
|
+
this._keepFocusWithinDropdownForwards = (ev) => {
|
|
139
|
+
if (ev.shiftKey === true || !this.$dropdownContent)
|
|
138
140
|
return;
|
|
139
|
-
const $
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const isActiveElementLastFocusableElement = indexOfCurrentlyFocusedElement === $focusableElementsWithinDropdownContent.length - 1;
|
|
143
|
-
if (doesNotHaveFocusableElementsInsideContent || isActiveElementLastFocusableElement)
|
|
144
|
-
this._handleFocusOnNextElement(ev);
|
|
145
|
-
};
|
|
146
|
-
this._handleFocusOnNextElement = async (ev) => {
|
|
147
|
-
var _a;
|
|
148
|
-
ev.preventDefault();
|
|
149
|
-
const $focusableElements = UiDomUtils.getFocusableElements(document.body);
|
|
150
|
-
const indexOfDropdownToggler = $focusableElements.indexOf(this.$dropdownToggler);
|
|
151
|
-
const $nextElementToFocus = (_a = $focusableElements[indexOfDropdownToggler + 1]) !== null && _a !== void 0 ? _a : $focusableElements[0];
|
|
152
|
-
await this._hideDropdownsSequentially();
|
|
153
|
-
await this.hide();
|
|
154
|
-
this._focusOnNextElementAfterToggler($nextElementToFocus);
|
|
155
|
-
};
|
|
156
|
-
this._focusOnNextElementAfterToggler = ($elementToFocus) => {
|
|
157
|
-
var _a;
|
|
158
|
-
const isTogglerLastChildOfPreviousDropdown = ($elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.closest(DROPDOWN_CONTENT_NAME)) === this.$dropdownContent;
|
|
159
|
-
if (isTogglerLastChildOfPreviousDropdown) {
|
|
160
|
-
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
141
|
+
const $target = ev.target;
|
|
142
|
+
this._handleFocusFromTogglerForwards(ev);
|
|
143
|
+
if (!$target.contains(document.activeElement) || !this.opened || !this.$dropdownContent)
|
|
161
144
|
return;
|
|
162
|
-
|
|
163
|
-
$elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.focus();
|
|
145
|
+
this._handleFocusFromSentinelEndForwards(ev, $target);
|
|
164
146
|
};
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
const $firstFocusableElement = this.$dropdownContent && UiDomUtils.getFocusableElement(this.$dropdownContent);
|
|
168
|
-
if (document.activeElement !== $firstFocusableElement)
|
|
147
|
+
this._keepFocusWithinDropdownBackwards = (ev) => {
|
|
148
|
+
if (!this.opened || !this.$dropdownContent)
|
|
169
149
|
return;
|
|
170
|
-
ev.
|
|
171
|
-
(
|
|
172
|
-
|
|
150
|
+
const $target = ev.target;
|
|
151
|
+
if (this.preventFocusTrap) {
|
|
152
|
+
this._handleDefaultFocusFromDropdownBackwards(ev);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this._handleFocusFromTogglerBackwards(ev, $target);
|
|
156
|
+
this._handleFocusFromSentinelStartBackwards(ev, $target);
|
|
157
|
+
}
|
|
173
158
|
};
|
|
174
159
|
this._hoverToggle = async (ev) => {
|
|
175
160
|
if (window.innerWidth < BREAKPOINTS.xs)
|
|
@@ -181,12 +166,19 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
181
166
|
const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
|
|
182
167
|
if (isHoveredWithinDropdown && !this.opened) {
|
|
183
168
|
await this.show();
|
|
184
|
-
|
|
169
|
+
this._focusOnFirstContentElement();
|
|
185
170
|
return;
|
|
186
171
|
}
|
|
187
172
|
if (!isHoveredWithinDropdown && this.opened)
|
|
188
173
|
await this._hideDropdownsSequentially();
|
|
189
174
|
};
|
|
175
|
+
this._focusOnFirstContentElement = () => {
|
|
176
|
+
if (!this.$dropdownContent)
|
|
177
|
+
return;
|
|
178
|
+
const $firstFocusableElement = this._getTrulyFocusableElements(this.$dropdownContent)[0];
|
|
179
|
+
if ($firstFocusableElement)
|
|
180
|
+
$firstFocusableElement.focus();
|
|
181
|
+
};
|
|
190
182
|
this.isOpened = () => this.opened;
|
|
191
183
|
this._positionDropdownContent = () => {
|
|
192
184
|
if (this.contentWidth === DROPDOWN_CONTENT_WIDTH.full)
|
|
@@ -212,13 +204,14 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
212
204
|
host: this,
|
|
213
205
|
target: document.body,
|
|
214
206
|
keys: ['tab'],
|
|
215
|
-
callback: this.
|
|
207
|
+
callback: this._keepFocusWithinDropdownForwards
|
|
216
208
|
});
|
|
217
209
|
new KeystrokesController({
|
|
218
210
|
host: this,
|
|
219
211
|
target: document.body,
|
|
220
212
|
keys: [['shift', 'tab']],
|
|
221
|
-
callback: this.
|
|
213
|
+
callback: this._keepFocusWithinDropdownBackwards,
|
|
214
|
+
containerSelectors: ['h-dropdown', 'h-dropdown-content']
|
|
222
215
|
});
|
|
223
216
|
}
|
|
224
217
|
async connectedCallback() {
|
|
@@ -294,6 +287,77 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
294
287
|
(_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.classList.add(SCROLLABLE_CLASS_NAME);
|
|
295
288
|
}
|
|
296
289
|
}
|
|
290
|
+
_handleFocusFromTogglerForwards(ev) {
|
|
291
|
+
if (!this.$dropdownContent)
|
|
292
|
+
return;
|
|
293
|
+
ev.preventDefault();
|
|
294
|
+
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
295
|
+
if (trulyFocusableElements.length === 0)
|
|
296
|
+
return;
|
|
297
|
+
trulyFocusableElements[0].focus();
|
|
298
|
+
}
|
|
299
|
+
_handleFocusFromSentinelEndForwards(ev, $target) {
|
|
300
|
+
var _a;
|
|
301
|
+
if (!this.$dropdownContent)
|
|
302
|
+
return;
|
|
303
|
+
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
304
|
+
const $lastFocusableElement = trulyFocusableElements.slice(-1)[0];
|
|
305
|
+
if (this.preventFocusTrap && document.activeElement) {
|
|
306
|
+
const $nextFocusableElement = UiDomUtils.getNextFocusableElement(document.activeElement);
|
|
307
|
+
if ($nextFocusableElement === $lastFocusableElement || trulyFocusableElements.length === 1) {
|
|
308
|
+
ev.preventDefault();
|
|
309
|
+
this.hide();
|
|
310
|
+
UiDomUtils.getNextFocusableElement(this.$dropdownToggler || this).focus();
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if ($target !== $lastFocusableElement)
|
|
315
|
+
return;
|
|
316
|
+
ev.preventDefault();
|
|
317
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
318
|
+
}
|
|
319
|
+
_handleDefaultFocusFromDropdownBackwards(ev) {
|
|
320
|
+
ev.preventDefault();
|
|
321
|
+
this.hide();
|
|
322
|
+
UiDomUtils.getPreviousFocusableElement(this.$dropdownToggler || this).focus();
|
|
323
|
+
}
|
|
324
|
+
_handleFocusFromTogglerBackwards(ev, $target) {
|
|
325
|
+
var _a;
|
|
326
|
+
if ($target !== this.$dropdownToggler && !((_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.contains($target)) || !this.$dropdownContent)
|
|
327
|
+
return;
|
|
328
|
+
ev.preventDefault();
|
|
329
|
+
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
330
|
+
if (trulyFocusableElements.length === 0)
|
|
331
|
+
return;
|
|
332
|
+
const $lastFocusableElement = trulyFocusableElements.slice(-1)[0];
|
|
333
|
+
$lastFocusableElement.focus();
|
|
334
|
+
}
|
|
335
|
+
_handleFocusFromSentinelStartBackwards(ev, $target) {
|
|
336
|
+
var _a;
|
|
337
|
+
if (!this.$dropdownContent)
|
|
338
|
+
return;
|
|
339
|
+
const $firstFocusableElement = this._getTrulyFocusableElements(this.$dropdownContent)[0];
|
|
340
|
+
if ($target !== $firstFocusableElement)
|
|
341
|
+
return;
|
|
342
|
+
ev.preventDefault();
|
|
343
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
344
|
+
}
|
|
345
|
+
_getTrulyFocusableElements($container) {
|
|
346
|
+
const focusableElements = UiDomUtils.getFocusableElements($container);
|
|
347
|
+
return focusableElements.filter(($el) => this._isElementTrulyFocusable($el));
|
|
348
|
+
}
|
|
349
|
+
_isElementTrulyFocusable($el) {
|
|
350
|
+
const style = window.getComputedStyle($el);
|
|
351
|
+
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
if ($el.nodeName === 'H-PORTAL')
|
|
355
|
+
return true;
|
|
356
|
+
const $parent = $el.parentElement;
|
|
357
|
+
if (!$parent)
|
|
358
|
+
return true;
|
|
359
|
+
return this._isElementTrulyFocusable($parent);
|
|
360
|
+
}
|
|
297
361
|
_isHoveredWithinDropdown(element) {
|
|
298
362
|
var _a;
|
|
299
363
|
if (element === this)
|
|
@@ -317,6 +381,8 @@ let HDropdown = HDropdown_1 = class HDropdown extends PhoenixLightLitElement {
|
|
|
317
381
|
return;
|
|
318
382
|
if (!this._hasScrollableClassInitially)
|
|
319
383
|
this._hasScrollableClassInitially = this.$dropdownContent.classList.contains(SCROLLABLE_CLASS_NAME);
|
|
384
|
+
if (!this.preventFocusTrap)
|
|
385
|
+
this.$dropdownContent.setAttribute('aria-modal', 'true');
|
|
320
386
|
}
|
|
321
387
|
_getDropdownContentWidth() {
|
|
322
388
|
const isMobileResolution = document.documentElement.clientWidth < BREAKPOINTS.xs;
|
|
@@ -385,6 +451,14 @@ __decorate([
|
|
|
385
451
|
property({ type: String, attribute: 'mobile-position' }),
|
|
386
452
|
__metadata("design:type", String)
|
|
387
453
|
], HDropdown.prototype, "mobilePosition", void 0);
|
|
454
|
+
__decorate([
|
|
455
|
+
property({ type: String, attribute: 'id', reflect: true }),
|
|
456
|
+
__metadata("design:type", Object)
|
|
457
|
+
], HDropdown.prototype, "id", void 0);
|
|
458
|
+
__decorate([
|
|
459
|
+
property({ type: Boolean, attribute: 'prevent-focus-trap' }),
|
|
460
|
+
__metadata("design:type", Object)
|
|
461
|
+
], HDropdown.prototype, "preventFocusTrap", void 0);
|
|
388
462
|
HDropdown = HDropdown_1 = __decorate([
|
|
389
463
|
phoenixCustomElement('h-dropdown'),
|
|
390
464
|
__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,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;"}
|
|
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;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit';
|
|
2
1
|
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
2
|
export declare class HDropdownContent extends PhoenixLightLitElement {
|
|
4
3
|
name: string;
|
|
5
4
|
constructor();
|
|
6
5
|
connectedCallback(): void;
|
|
7
|
-
protected render(): TemplateResult;
|
|
8
6
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { html } from 'lit';
|
|
3
2
|
import { property } 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';
|
|
@@ -19,10 +18,6 @@ let HDropdownContent = class HDropdownContent extends PhoenixLightLitElement {
|
|
|
19
18
|
element.setAttribute('role', 'menuitem');
|
|
20
19
|
});
|
|
21
20
|
}
|
|
22
|
-
render() {
|
|
23
|
-
super.render();
|
|
24
|
-
return html ` <div role="dialog">${this.getSlot('content')}</div> `;
|
|
25
|
-
}
|
|
26
21
|
};
|
|
27
22
|
__decorate([
|
|
28
23
|
property({ type: String }),
|
|
@@ -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;
|
|
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;"}
|
|
@@ -6,9 +6,8 @@ export declare class HDropdownToggler extends PhoenixLightLitElement {
|
|
|
6
6
|
private _$dropdown;
|
|
7
7
|
constructor();
|
|
8
8
|
connectedCallback(): void;
|
|
9
|
+
private _setupTogglerAria;
|
|
9
10
|
private _dispatchToggleDropdownEventWithKeyboard;
|
|
10
11
|
private _dispatchToggleDropdownEventOnMobile;
|
|
11
12
|
private _dispatchToggleDropdownEvent;
|
|
12
|
-
private _handleFocusToOpenedDropdown;
|
|
13
|
-
disconnectedCallback(): void;
|
|
14
13
|
}
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { property } from 'lit/decorators';
|
|
3
|
-
import
|
|
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
6
|
import { BtnController } from '../../controllers/btn_controller/btn_controller.js';
|
|
7
7
|
import { BREAKPOINTS } from '../../global_constants.js';
|
|
8
|
-
import {
|
|
8
|
+
import { DROPDOWN_CONTAINER_NAME, DROPDOWN_EVENTS, DROPDOWN_CSS_CLASSES, DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME } from './dropdown_constants.js';
|
|
9
9
|
import { ToggleElementAriaController } from '../../controllers/toggle_element_aria_controller/toggle_element_aria_controller.js';
|
|
10
10
|
|
|
11
11
|
let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
this.name = '';
|
|
15
|
+
this._setupTogglerAria = () => {
|
|
16
|
+
this._$dropdown = this.closest(DROPDOWN_CONTAINER_NAME);
|
|
17
|
+
if (this._$dropdown.isOpened)
|
|
18
|
+
this._toggleElementAriaController = new ToggleElementAriaController({
|
|
19
|
+
host: this,
|
|
20
|
+
initialAriaExpandedValue: this._$dropdown.isOpened()
|
|
21
|
+
});
|
|
22
|
+
this.setAttribute('aria-haspopup', 'true');
|
|
23
|
+
if (this._$dropdown.id)
|
|
24
|
+
this.setAttribute('aria-controls', this._$dropdown.id);
|
|
25
|
+
};
|
|
15
26
|
this._dispatchToggleDropdownEventWithKeyboard = (ev) => {
|
|
16
27
|
ev.stopImmediatePropagation();
|
|
17
28
|
this._dispatchToggleDropdownEvent(ev);
|
|
@@ -25,18 +36,6 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
|
|
|
25
36
|
ev.preventDefault();
|
|
26
37
|
this.emitCustomEvent(DROPDOWN_EVENTS.toggle);
|
|
27
38
|
};
|
|
28
|
-
this._handleFocusToOpenedDropdown = async (ev) => {
|
|
29
|
-
if (ev.target !== this)
|
|
30
|
-
return;
|
|
31
|
-
const isOpened = this._$dropdown.isOpened();
|
|
32
|
-
if (!isOpened)
|
|
33
|
-
return;
|
|
34
|
-
const $dropdownContent = document.querySelector(`${DROPDOWN_CONTENT_NAME}[name="${this.name}"]`);
|
|
35
|
-
if (!$dropdownContent)
|
|
36
|
-
return;
|
|
37
|
-
ev.preventDefault();
|
|
38
|
-
UiDomUtils.setFocusToFirstFocusableElementInContainer($dropdownContent);
|
|
39
|
-
};
|
|
40
39
|
this.slot = this.hasAttribute('slot') ? this.slot : 'toggler';
|
|
41
40
|
this.className = `${DROPDOWN_CSS_CLASSES.toggler} ${this.className}`;
|
|
42
41
|
}
|
|
@@ -44,13 +43,7 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
|
|
|
44
43
|
var _a;
|
|
45
44
|
super.connectedCallback();
|
|
46
45
|
this._btnController = new BtnController(this, this._dispatchToggleDropdownEventWithKeyboard);
|
|
47
|
-
this.
|
|
48
|
-
if (this._$dropdown.isOpened)
|
|
49
|
-
this._toggleElementAriaController = new ToggleElementAriaController({
|
|
50
|
-
host: this,
|
|
51
|
-
initialAriaExpandedValue: this._$dropdown.isOpened()
|
|
52
|
-
});
|
|
53
|
-
document.addEventListener('keydown', this._handleFocusToOpenedDropdown);
|
|
46
|
+
this._setupTogglerAria();
|
|
54
47
|
const hasToggleOnHover = (_a = this._$dropdown) === null || _a === void 0 ? void 0 : _a.hasAttribute(DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME);
|
|
55
48
|
if (hasToggleOnHover) {
|
|
56
49
|
this.addEventListener('click', this._dispatchToggleDropdownEventOnMobile);
|
|
@@ -58,10 +51,6 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
|
|
|
58
51
|
}
|
|
59
52
|
this.addEventListener('click', this._dispatchToggleDropdownEvent);
|
|
60
53
|
}
|
|
61
|
-
disconnectedCallback() {
|
|
62
|
-
super.disconnectedCallback();
|
|
63
|
-
document.removeEventListener('keydown', this._handleFocusToOpenedDropdown);
|
|
64
|
-
}
|
|
65
54
|
};
|
|
66
55
|
__decorate([
|
|
67
56
|
property({ type: String, reflect: true }),
|
|
@@ -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;"}
|
|
@@ -12,12 +12,8 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
12
12
|
private _searchContextObserver;
|
|
13
13
|
private _searchInput;
|
|
14
14
|
private _inputField;
|
|
15
|
-
private _searchForm;
|
|
16
|
-
private _id;
|
|
17
|
-
private _searchContentContainerId;
|
|
18
15
|
private _searchResultsRef;
|
|
19
16
|
private _searchHistoryRef;
|
|
20
|
-
private _searchMessageRef;
|
|
21
17
|
private _shouldShowHistory;
|
|
22
18
|
private _shouldShowResults;
|
|
23
19
|
private _shouldShowMessage;
|
|
@@ -28,7 +24,6 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
28
24
|
private _historyContext;
|
|
29
25
|
private _activeItemId;
|
|
30
26
|
private _translations;
|
|
31
|
-
private _containerRole;
|
|
32
27
|
connectedCallback(): Promise<void>;
|
|
33
28
|
disconnectedCallback(): void;
|
|
34
29
|
private _setupContext;
|
|
@@ -42,31 +37,18 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
42
37
|
private _hideHistorySuggestionsAndResults;
|
|
43
38
|
private _displayResults;
|
|
44
39
|
private _handleToggleHistoryAndResults;
|
|
45
|
-
private
|
|
46
|
-
private _toggleSearchContainerAttributes;
|
|
40
|
+
private _toggleSearchInputAria;
|
|
47
41
|
private _bindKeys;
|
|
48
|
-
private
|
|
49
|
-
private
|
|
50
|
-
private
|
|
51
|
-
private
|
|
52
|
-
private _handleForwardListFocus;
|
|
53
|
-
private _handleForwardGridFocus;
|
|
54
|
-
private _handleForwardFocus;
|
|
55
|
-
private _handleMoveToInputField;
|
|
56
|
-
private _handleBackwardListFocus;
|
|
57
|
-
private _handleBackwardGridFocus;
|
|
58
|
-
private _handleBackwardFocus;
|
|
42
|
+
private _focusOutsideActiveItemsForward;
|
|
43
|
+
private _focusOutsideActiveItemsBackward;
|
|
44
|
+
private _getSearchItemsCount;
|
|
45
|
+
private _scroll;
|
|
59
46
|
private _handleChooseSearchItem;
|
|
60
47
|
private _resetSearchView;
|
|
61
|
-
private _setActiveItemId;
|
|
62
|
-
private _handleFocusOnInputWithCaretEnd;
|
|
63
|
-
private _handleFocusOnInputWithCaretStart;
|
|
64
|
-
private _handleWriteableCharacter;
|
|
65
48
|
private _submitSearchPhrase;
|
|
66
49
|
private _hideSuggesterOnClickOutside;
|
|
67
50
|
private _switchTypeOfSearchView;
|
|
68
51
|
private _isSuggesterLayerVisible;
|
|
69
|
-
private _preventSubmitOnSearchClear;
|
|
70
52
|
private _handleOpenSearch;
|
|
71
53
|
private _handleOpenSearchWithKeyboard;
|
|
72
54
|
protected render(): TemplateResult;
|