@shoper/phoenix_design_system 1.11.7-0 → 1.11.7-10
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 +81 -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 +19 -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 +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 +6 -43
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/search_constants.js +1 -2
- package/build/cjs/packages/phoenix/src/components/form/search/search_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +0 -15
- 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 +10 -10
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +0 -5
- 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 +0 -5
- 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 +0 -16
- 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 +0 -5
- 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/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +10 -4
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +82 -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 +7 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +19 -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.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 +0 -3
- package/build/esm/packages/phoenix/src/components/form/search/search.js +7 -44
- package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_constants.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_constants.js +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/search_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_types.d.ts +0 -13
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.d.ts +0 -3
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +1 -16
- 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 +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +10 -10
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +0 -5
- 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 +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +0 -5
- 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 +0 -3
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +0 -16
- 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 +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +0 -5
- 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/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,24 @@ 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);
|
|
145
|
+
const $target = ev.target;
|
|
146
|
+
this._handleFocusFromTogglerForwards(ev, $target);
|
|
147
|
+
this._handleFocusFromSentinelEndForwards(ev, $target);
|
|
149
148
|
};
|
|
150
|
-
this.
|
|
151
|
-
|
|
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();
|
|
149
|
+
this._keepFocusWithinDropdownBackwards = (ev) => {
|
|
150
|
+
if (!this.opened || !this.$dropdownContent)
|
|
165
151
|
return;
|
|
152
|
+
const $target = ev.target;
|
|
153
|
+
if (this.preventFocusTrap) {
|
|
154
|
+
this._handleDefaultFocusFromDropdownBackwards(ev);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this._handleFocusFromTogglerBackwards(ev, $target);
|
|
158
|
+
this._handleFocusFromSentinelStartBackwards(ev, $target);
|
|
166
159
|
}
|
|
167
|
-
$elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.focus();
|
|
168
|
-
};
|
|
169
|
-
this._handleBackwardFocus = async (ev) => {
|
|
170
|
-
var _a;
|
|
171
|
-
const $firstFocusableElement = this.$dropdownContent && utilities.UiDomUtils.getFocusableElement(this.$dropdownContent);
|
|
172
|
-
if (document.activeElement !== $firstFocusableElement)
|
|
173
|
-
return;
|
|
174
|
-
ev.preventDefault();
|
|
175
|
-
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
176
|
-
await this._hideDropdownsSequentially();
|
|
177
160
|
};
|
|
178
161
|
this._hoverToggle = async (ev) => {
|
|
179
162
|
if (window.innerWidth < global_constants.BREAKPOINTS.xs)
|
|
@@ -185,12 +168,20 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
185
168
|
const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
|
|
186
169
|
if (isHoveredWithinDropdown && !this.opened) {
|
|
187
170
|
await this.show();
|
|
188
|
-
|
|
171
|
+
this._focusOnFirstContentElement();
|
|
189
172
|
return;
|
|
190
173
|
}
|
|
191
174
|
if (!isHoveredWithinDropdown && this.opened)
|
|
192
175
|
await this._hideDropdownsSequentially();
|
|
193
176
|
};
|
|
177
|
+
this._focusOnFirstContentElement = () => {
|
|
178
|
+
if (!this.$dropdownContent)
|
|
179
|
+
return;
|
|
180
|
+
const focusableElements = utilities.UiDomUtils.getFocusableElements(this.$dropdownContent);
|
|
181
|
+
// pierwszy jest zawsze sentinel, drugi to pierwszy element faktycznego contentu
|
|
182
|
+
const $firstRealFocusableContentElement = focusableElements[1];
|
|
183
|
+
$firstRealFocusableContentElement.focus();
|
|
184
|
+
};
|
|
194
185
|
this.isOpened = () => this.opened;
|
|
195
186
|
this._positionDropdownContent = () => {
|
|
196
187
|
if (this.contentWidth === dropdown_constants.DROPDOWN_CONTENT_WIDTH.full)
|
|
@@ -216,13 +207,14 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
216
207
|
host: this,
|
|
217
208
|
target: document.body,
|
|
218
209
|
keys: ['tab'],
|
|
219
|
-
callback: this.
|
|
210
|
+
callback: this._keepFocusWithinDropdownForwards
|
|
220
211
|
});
|
|
221
212
|
new keystrokes_controller.KeystrokesController({
|
|
222
213
|
host: this,
|
|
223
214
|
target: document.body,
|
|
224
215
|
keys: [['shift', 'tab']],
|
|
225
|
-
callback: this.
|
|
216
|
+
callback: this._keepFocusWithinDropdownBackwards,
|
|
217
|
+
containerSelectors: ['h-dropdown', 'h-dropdown-content']
|
|
226
218
|
});
|
|
227
219
|
}
|
|
228
220
|
async connectedCallback() {
|
|
@@ -298,6 +290,47 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
298
290
|
(_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.classList.add(global_constants.SCROLLABLE_CLASS_NAME);
|
|
299
291
|
}
|
|
300
292
|
}
|
|
293
|
+
_handleFocusFromTogglerForwards(ev, $target) {
|
|
294
|
+
var _a, _b, _c;
|
|
295
|
+
if (!((_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.contains($target)) || !this.opened)
|
|
296
|
+
return;
|
|
297
|
+
ev.preventDefault();
|
|
298
|
+
(_c = (_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.focusSentinelStart.value) === null || _c === void 0 ? void 0 : _c.focus();
|
|
299
|
+
}
|
|
300
|
+
_handleFocusFromSentinelEndForwards(ev, $target) {
|
|
301
|
+
var _a, _b, _c;
|
|
302
|
+
if (this.preventFocusTrap && document.activeElement) {
|
|
303
|
+
const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement(document.activeElement);
|
|
304
|
+
if ($nextFocusableElement === ((_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.focusSentinelEnd.value)) {
|
|
305
|
+
this.hide();
|
|
306
|
+
utilities.UiDomUtils.getNextFocusableElement(this.$dropdownToggler || this).focus();
|
|
307
|
+
}
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if ($target !== ((_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.focusSentinelEnd.value))
|
|
311
|
+
return;
|
|
312
|
+
ev.preventDefault();
|
|
313
|
+
(_c = this.$dropdownToggler) === null || _c === void 0 ? void 0 : _c.focus();
|
|
314
|
+
}
|
|
315
|
+
_handleDefaultFocusFromDropdownBackwards(ev) {
|
|
316
|
+
ev.preventDefault();
|
|
317
|
+
this.hide();
|
|
318
|
+
utilities.UiDomUtils.getPreviousFocusableElement(this.$dropdownToggler || this).focus();
|
|
319
|
+
}
|
|
320
|
+
_handleFocusFromTogglerBackwards(ev, $target) {
|
|
321
|
+
var _a, _b, _c;
|
|
322
|
+
if ($target !== this.$dropdownToggler && !((_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.contains($target)))
|
|
323
|
+
return;
|
|
324
|
+
ev.preventDefault();
|
|
325
|
+
(_c = (_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.focusSentinelEnd.value) === null || _c === void 0 ? void 0 : _c.focus();
|
|
326
|
+
}
|
|
327
|
+
_handleFocusFromSentinelStartBackwards(ev, $target) {
|
|
328
|
+
var _a, _b;
|
|
329
|
+
if ($target !== ((_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.focusSentinelStart.value))
|
|
330
|
+
return;
|
|
331
|
+
ev.preventDefault();
|
|
332
|
+
(_b = this.$dropdownToggler) === null || _b === void 0 ? void 0 : _b.focus();
|
|
333
|
+
}
|
|
301
334
|
_isHoveredWithinDropdown(element) {
|
|
302
335
|
var _a;
|
|
303
336
|
if (element === this)
|
|
@@ -321,6 +354,8 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
321
354
|
return;
|
|
322
355
|
if (!this._hasScrollableClassInitially)
|
|
323
356
|
this._hasScrollableClassInitially = this.$dropdownContent.classList.contains(global_constants.SCROLLABLE_CLASS_NAME);
|
|
357
|
+
if (!this.preventFocusTrap)
|
|
358
|
+
this.$dropdownContent.setAttribute('aria-modal', 'true');
|
|
324
359
|
}
|
|
325
360
|
_getDropdownContentWidth() {
|
|
326
361
|
const isMobileResolution = document.documentElement.clientWidth < global_constants.BREAKPOINTS.xs;
|
|
@@ -389,6 +424,14 @@ tslib_es6.__decorate([
|
|
|
389
424
|
decorators_js.property({ type: String, attribute: 'mobile-position' }),
|
|
390
425
|
tslib_es6.__metadata("design:type", String)
|
|
391
426
|
], exports.HDropdown.prototype, "mobilePosition", void 0);
|
|
427
|
+
tslib_es6.__decorate([
|
|
428
|
+
decorators_js.property({ type: String, attribute: 'id', reflect: true }),
|
|
429
|
+
tslib_es6.__metadata("design:type", Object)
|
|
430
|
+
], exports.HDropdown.prototype, "id", void 0);
|
|
431
|
+
tslib_es6.__decorate([
|
|
432
|
+
decorators_js.property({ type: Boolean, attribute: 'prevent-focus-trap' }),
|
|
433
|
+
tslib_es6.__metadata("design:type", Object)
|
|
434
|
+
], exports.HDropdown.prototype, "preventFocusTrap", void 0);
|
|
392
435
|
exports.HDropdown = HDropdown_1 = tslib_es6.__decorate([
|
|
393
436
|
phoenix_custom_element.phoenixCustomElement('h-dropdown'),
|
|
394
437
|
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;"}
|
|
@@ -7,13 +7,18 @@ var lit = require('lit');
|
|
|
7
7
|
var decorators = require('lit/decorators');
|
|
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
|
+
var ref_js = require('lit-html/directives/ref.js');
|
|
10
11
|
var dropdown_constants = require('./dropdown_constants.js');
|
|
11
12
|
|
|
12
13
|
exports.HDropdownContent = class HDropdownContent extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
13
14
|
constructor() {
|
|
14
15
|
super();
|
|
15
16
|
this.name = '';
|
|
17
|
+
this.focusSentinelStart = ref_js.createRef();
|
|
18
|
+
this.focusSentinelEnd = ref_js.createRef();
|
|
19
|
+
this._contentContainer = ref_js.createRef();
|
|
16
20
|
this.slot = this.hasAttribute('slot') ? this.slot : 'content';
|
|
21
|
+
this._initialChildren = Array.from(this.childNodes);
|
|
17
22
|
}
|
|
18
23
|
connectedCallback() {
|
|
19
24
|
super.connectedCallback();
|
|
@@ -23,9 +28,22 @@ exports.HDropdownContent = class HDropdownContent extends phoenix_light_lit_elem
|
|
|
23
28
|
element.setAttribute('role', 'menuitem');
|
|
24
29
|
});
|
|
25
30
|
}
|
|
31
|
+
firstUpdated(_changedProperties) {
|
|
32
|
+
super.firstUpdated(_changedProperties);
|
|
33
|
+
if (this._contentContainer.value) {
|
|
34
|
+
this._initialChildren.forEach((child) => {
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = this._contentContainer.value) === null || _a === void 0 ? void 0 : _a.appendChild(child);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
26
40
|
render() {
|
|
27
41
|
super.render();
|
|
28
|
-
return lit.html `
|
|
42
|
+
return lit.html `
|
|
43
|
+
<div tabindex="0" ${ref_js.ref(this.focusSentinelStart)}></div>
|
|
44
|
+
<div ${ref_js.ref(this._contentContainer)}></div>
|
|
45
|
+
<div tabindex="0" ${ref_js.ref(this.focusSentinelEnd)}></div>
|
|
46
|
+
`;
|
|
29
47
|
}
|
|
30
48
|
};
|
|
31
49
|
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;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;"}
|
|
@@ -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;"}
|
|
@@ -38,13 +38,11 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
38
38
|
case 'ArrowDown':
|
|
39
39
|
ev.preventDefault();
|
|
40
40
|
this._activeItemId = this._activeItemId === searchItemsCount - 1 ? 0 : this._activeItemId + 1;
|
|
41
|
-
this._dispatchActiveItemChangeEvent();
|
|
42
41
|
this._scroll(search_constants.SCROLL_DIRECTIONS.down);
|
|
43
42
|
break;
|
|
44
43
|
case 'ArrowUp':
|
|
45
44
|
ev.preventDefault();
|
|
46
45
|
this._activeItemId = this._activeItemId === 0 || this._activeItemId === -1 ? searchItemsCount - 1 : this._activeItemId - 1;
|
|
47
|
-
this._dispatchActiveItemChangeEvent();
|
|
48
46
|
this._scroll(search_constants.SCROLL_DIRECTIONS.up);
|
|
49
47
|
break;
|
|
50
48
|
case 'Enter':
|
|
@@ -69,14 +67,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
69
67
|
break;
|
|
70
68
|
}
|
|
71
69
|
};
|
|
72
|
-
this._dispatchActiveItemChangeEvent = () => {
|
|
73
|
-
const ev = new CustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.activeItemChange, {
|
|
74
|
-
detail: {
|
|
75
|
-
activeItemId: this._activeItemId
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
this.dispatchEvent(ev);
|
|
79
|
-
};
|
|
80
70
|
this._getSearchItemsCount = () => {
|
|
81
71
|
if (this._shouldShowHistory)
|
|
82
72
|
return this._historyLimitedContent.length;
|
|
@@ -218,42 +208,16 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
218
208
|
}
|
|
219
209
|
}
|
|
220
210
|
_displayHistorySuggestions() {
|
|
221
|
-
this.
|
|
222
|
-
|
|
223
|
-
shouldShowResults: false
|
|
224
|
-
});
|
|
211
|
+
this._shouldShowHistory = true;
|
|
212
|
+
this._shouldShowResults = false;
|
|
225
213
|
}
|
|
226
214
|
_hideHistorySuggestionsAndResults() {
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
shouldShowResults: false
|
|
230
|
-
});
|
|
215
|
+
this._shouldShowHistory = false;
|
|
216
|
+
this._shouldShowResults = false;
|
|
231
217
|
}
|
|
232
218
|
_displayResults() {
|
|
233
|
-
this.
|
|
234
|
-
|
|
235
|
-
shouldShowResults: true
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
_handleToggleHistoryAndResults({ shouldShowHistory, shouldShowResults }) {
|
|
239
|
-
this._shouldShowHistory = shouldShowHistory;
|
|
240
|
-
this._shouldShowResults = shouldShowResults;
|
|
241
|
-
this._toggleSearchInputAria(shouldShowHistory, shouldShowResults);
|
|
242
|
-
}
|
|
243
|
-
_toggleSearchInputAria(shouldShowHistory, shouldShowResults) {
|
|
244
|
-
var _a;
|
|
245
|
-
const $input = (_a = this._searchInput) === null || _a === void 0 ? void 0 : _a.input;
|
|
246
|
-
if (!$input)
|
|
247
|
-
return;
|
|
248
|
-
if (!shouldShowHistory && !shouldShowResults) {
|
|
249
|
-
$input.removeAttribute('aria-label');
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
$input.setAttribute('aria-expanded', 'true');
|
|
253
|
-
if (shouldShowHistory)
|
|
254
|
-
$input.setAttribute('aria-label', this.settings.historyAriaLabelGuide);
|
|
255
|
-
if (shouldShowResults)
|
|
256
|
-
$input.setAttribute('aria-label', this.settings.suggesterAriaLabelGuide);
|
|
219
|
+
this._shouldShowHistory = false;
|
|
220
|
+
this._shouldShowResults = true;
|
|
257
221
|
}
|
|
258
222
|
_scroll(direction) {
|
|
259
223
|
const searchContainer = this.querySelector(`.${search_constants.SEARCH_CLASS_NAMES.container}`);
|
|
@@ -336,7 +300,6 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
336
300
|
.translations="${this._translations}"
|
|
337
301
|
active-item-id="${this._activeItemId}"
|
|
338
302
|
module-instance-id="${this.moduleInstanceId}"
|
|
339
|
-
.historyAriaLabel="${this.settings.historyAriaLabel}"
|
|
340
303
|
></h-search-history>`)}
|
|
341
304
|
${when.when(this._shouldShowResults, () => lit.html `<h-search-results
|
|
342
305
|
.results="${this._searchResults}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qEAA6E;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qEAA6E;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -30,8 +30,7 @@ const SEARCH_CUSTOM_EVENT_NAMES = {
|
|
|
30
30
|
search: 'search',
|
|
31
31
|
updateSearchPhrase: 'updateSearchPhrase',
|
|
32
32
|
focusin: 'searchFocusIn',
|
|
33
|
-
keydown: 'searchKeyDown'
|
|
34
|
-
activeItemChange: 'activeItemChange'
|
|
33
|
+
keydown: 'searchKeyDown'
|
|
35
34
|
};
|
|
36
35
|
const baseSearchCssClass = 'search';
|
|
37
36
|
const SEARCH_CLASS_NAMES = {
|
|
@@ -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;
|
|
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;"}
|
|
@@ -21,11 +21,6 @@ exports.HSearchHistory = class HSearchHistory extends phoenix_light_lit_element.
|
|
|
21
21
|
this.buttonRef = ref_js.createRef();
|
|
22
22
|
this.history = [];
|
|
23
23
|
this.translations = {};
|
|
24
|
-
this._handleActiveItemChange = (ev) => {
|
|
25
|
-
const { activeItemId } = ev.detail;
|
|
26
|
-
const $activeItem = this.querySelector(`[data-search-item-id="${activeItemId}"]`);
|
|
27
|
-
$activeItem === null || $activeItem === void 0 ? void 0 : $activeItem.focus();
|
|
28
|
-
};
|
|
29
24
|
}
|
|
30
25
|
async connectedCallback() {
|
|
31
26
|
super.connectedCallback();
|
|
@@ -44,11 +39,6 @@ exports.HSearchHistory = class HSearchHistory extends phoenix_light_lit_element.
|
|
|
44
39
|
catch (_a) {
|
|
45
40
|
console.error('Search context is not provided');
|
|
46
41
|
}
|
|
47
|
-
document.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.activeItemChange, this._handleActiveItemChange);
|
|
48
|
-
}
|
|
49
|
-
disconnectedCallback() {
|
|
50
|
-
super.disconnectedCallback();
|
|
51
|
-
document.removeEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.activeItemChange, this._handleActiveItemChange);
|
|
52
42
|
}
|
|
53
43
|
render() {
|
|
54
44
|
var _a;
|
|
@@ -64,7 +54,6 @@ exports.HSearchHistory = class HSearchHistory extends phoenix_light_lit_element.
|
|
|
64
54
|
data-suggested-value="${historyElement.label}"
|
|
65
55
|
data-search-item-id="${index}"
|
|
66
56
|
module-instance-id="${this.moduleInstanceId}"
|
|
67
|
-
${this.historyAriaLabel ? `aria-label="${this.historyAriaLabel} ${historyElement.label}"` : ''}
|
|
68
57
|
>
|
|
69
58
|
<h-icon icon-name="icon-clock"></h-icon>
|
|
70
59
|
|
|
@@ -103,10 +92,6 @@ tslib_es6.__decorate([
|
|
|
103
92
|
decorators.property({ type: String, attribute: 'module-instance-id' }),
|
|
104
93
|
tslib_es6.__metadata("design:type", String)
|
|
105
94
|
], exports.HSearchHistory.prototype, "moduleInstanceId", void 0);
|
|
106
|
-
tslib_es6.__decorate([
|
|
107
|
-
decorators.property({ type: String }),
|
|
108
|
-
tslib_es6.__metadata("design:type", String)
|
|
109
|
-
], exports.HSearchHistory.prototype, "historyAriaLabel", void 0);
|
|
110
95
|
exports.HSearchHistory = tslib_es6.__decorate([
|
|
111
96
|
phoenix_custom_element.phoenixCustomElement(search_constants.SEARCH_COMPONENT_NAMES.searchHistory)
|
|
112
97
|
], exports.HSearchHistory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2EAAmF;AACtG;AACA,qBAAqB,6EAAqF;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,qDAAyD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2EAAmF;AACtG;AACA,qBAAqB,6EAAqF;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js
CHANGED
|
@@ -15,8 +15,8 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
15
15
|
}
|
|
16
16
|
connectedCallback() {
|
|
17
17
|
super.connectedCallback();
|
|
18
|
-
this.
|
|
19
|
-
if (!this.
|
|
18
|
+
this._input = this.querySelector('input[type="search"]');
|
|
19
|
+
if (!this._input) {
|
|
20
20
|
throw new Error('Search input not found');
|
|
21
21
|
}
|
|
22
22
|
this._setupInitialValue();
|
|
@@ -28,7 +28,7 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
28
28
|
if (!searchPhraseRegArray)
|
|
29
29
|
return;
|
|
30
30
|
const searchQuery = searchPhraseRegArray[1].replace(/\+/g, ' ');
|
|
31
|
-
this.
|
|
31
|
+
this._input.value = decodeURIComponent(this._deserializeInputPhrase(searchQuery));
|
|
32
32
|
}
|
|
33
33
|
_deserializeInputPhrase(value) {
|
|
34
34
|
if (value.indexOf('%2f') !== -1) {
|
|
@@ -46,14 +46,14 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
46
46
|
return value;
|
|
47
47
|
}
|
|
48
48
|
_setupListeners() {
|
|
49
|
-
this.
|
|
49
|
+
this._input.addEventListener('focusin', (ev) => {
|
|
50
50
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.focusin, {
|
|
51
51
|
detail: {
|
|
52
52
|
searchPhrase: ev.target.value
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
|
-
this.
|
|
56
|
+
this._input.addEventListener('keydown', (ev) => {
|
|
57
57
|
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown' || ev.key === 'Escape')
|
|
58
58
|
return;
|
|
59
59
|
if (ev.key !== 'Enter') {
|
|
@@ -74,8 +74,8 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
this.
|
|
78
|
-
if (this.
|
|
77
|
+
this._input.addEventListener('search', (ev) => {
|
|
78
|
+
if (this._input.value !== '') {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.search, {
|
|
@@ -88,13 +88,13 @@ exports.HSearchInput = class HSearchInput extends phoenix_light_lit_element.Phoe
|
|
|
88
88
|
if (!ev.detail || ev.detail.moduleInstanceId !== this.moduleInstanceId)
|
|
89
89
|
return;
|
|
90
90
|
this._isSearchPhraseCleared = true;
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
91
|
+
this._input.value = '';
|
|
92
|
+
this._input.focus();
|
|
93
93
|
});
|
|
94
94
|
document.addEventListener(search_constants.SEARCH_CUSTOM_EVENT_NAMES.updateSearchPhrase, (ev) => {
|
|
95
95
|
if (!ev.detail || ev.detail.moduleInstanceId !== this.moduleInstanceId)
|
|
96
96
|
return;
|
|
97
|
-
this.
|
|
97
|
+
this._input.value = ev.detail.searchPhrase;
|
|
98
98
|
this.emitCustomEvent(search_constants.SEARCH_CUSTOM_EVENT_NAMES.keydown, {
|
|
99
99
|
detail: {
|
|
100
100
|
searchPhrase: ev.detail.searchPhrase
|
|
@@ -36,7 +36,6 @@ exports.HSearchProducerContent = class HSearchProducerContent extends phoenix_li
|
|
|
36
36
|
? search_constants.SEARCH_CLASS_NAMES.itemActive
|
|
37
37
|
: ''}"
|
|
38
38
|
data-search-item-id="${this.initialItemIds.producers + index}"
|
|
39
|
-
${this.producerAriaLabel ? `aria-label="${this.producerAriaLabel} ${producer.name}"` : ''}
|
|
40
39
|
>
|
|
41
40
|
<a
|
|
42
41
|
href="${producer.url}"
|
|
@@ -72,10 +71,6 @@ tslib_es6.__decorate([
|
|
|
72
71
|
decorators.property({ type: String, attribute: 'search-phrase' }),
|
|
73
72
|
tslib_es6.__metadata("design:type", String)
|
|
74
73
|
], exports.HSearchProducerContent.prototype, "searchPhrase", void 0);
|
|
75
|
-
tslib_es6.__decorate([
|
|
76
|
-
decorators.property({ type: String }),
|
|
77
|
-
tslib_es6.__metadata("design:type", String)
|
|
78
|
-
], exports.HSearchProducerContent.prototype, "producerAriaLabel", void 0);
|
|
79
74
|
exports.HSearchProducerContent = tslib_es6.__decorate([
|
|
80
75
|
phoenix_custom_element.phoenixCustomElement(search_constants.SEARCH_COMPONENT_NAMES.searchProducerContent)
|
|
81
76
|
], exports.HSearchProducerContent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA,mBAAmB,2EAAmF;AACtG;AACA,qBAAqB,6EAAqF;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,qDAAyD;AACjF;AACA;AACA;AACA;AACA,mBAAmB,2EAAmF;AACtG;AACA,qBAAqB,6EAAqF;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -49,7 +49,6 @@ exports.HSearchProductContent = class HSearchProductContent extends phoenix_ligh
|
|
|
49
49
|
? search_constants.SEARCH_CLASS_NAMES.itemActive
|
|
50
50
|
: ''}"
|
|
51
51
|
data-search-item-id="${this.initialItemIds.products + index}"
|
|
52
|
-
${this.productAriaLabel ? `aria-label="${this.productAriaLabel} ${product.name}"` : ''}
|
|
53
52
|
>
|
|
54
53
|
<a
|
|
55
54
|
href="${product.url}"
|
|
@@ -109,10 +108,6 @@ tslib_es6.__decorate([
|
|
|
109
108
|
decorators.property({ type: Object }),
|
|
110
109
|
tslib_es6.__metadata("design:type", Object)
|
|
111
110
|
], exports.HSearchProductContent.prototype, "translations", void 0);
|
|
112
|
-
tslib_es6.__decorate([
|
|
113
|
-
decorators.property({ type: String }),
|
|
114
|
-
tslib_es6.__metadata("design:type", String)
|
|
115
|
-
], exports.HSearchProductContent.prototype, "productAriaLabel", void 0);
|
|
116
111
|
exports.HSearchProductContent = tslib_es6.__decorate([
|
|
117
112
|
phoenix_custom_element.phoenixCustomElement(search_constants.SEARCH_COMPONENT_NAMES.searchProductContent)
|
|
118
113
|
], exports.HSearchProductContent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;AACA;AACA;AACA;AACA,mBAAmB,2EAAmF;AACtG;AACA,qBAAqB,6EAAqF;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,qDAAyD;AACjF;AACA;AACA;AACA;AACA,mBAAmB,2EAAmF;AACtG;AACA,qBAAqB,6EAAqF;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|