@shoper/phoenix_design_system 1.18.8 → 1.18.10-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/accordion/accordion.js +6 -19
- package/build/cjs/packages/phoenix/src/components/accordion/accordion.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_constants.js +8 -6
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js +2 -125
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_group.js +105 -88
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_group.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_toggler.js +1 -41
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/model/select_option.js +2 -1
- package/build/cjs/packages/phoenix/src/components/form/select/model/select_option.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/model/select_option_mapper.js +3 -2
- package/build/cjs/packages/phoenix/src/components/form/select/model/select_option_mapper.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +87 -14
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js +22 -2
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js +1 -1
- package/build/cjs/packages/phoenix/src/index.js +9 -6
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion.d.ts +1 -5
- package/build/esm/packages/phoenix/src/components/accordion/accordion.js +7 -20
- package/build/esm/packages/phoenix/src/components/accordion/accordion.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_constants.d.ts +4 -3
- package/build/esm/packages/phoenix/src/components/accordion/accordion_constants.js +7 -6
- package/build/esm/packages/phoenix/src/components/accordion/accordion_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.d.ts +0 -23
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js +2 -125
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_group.d.ts +12 -14
- package/build/esm/packages/phoenix/src/components/accordion/accordion_group.js +106 -89
- package/build/esm/packages/phoenix/src/components/accordion/accordion_group.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_toggler.d.ts +0 -8
- package/build/esm/packages/phoenix/src/components/accordion/accordion_toggler.js +1 -41
- package/build/esm/packages/phoenix/src/components/accordion/accordion_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/accordion/accordion_types.d.ts +0 -10
- package/build/esm/packages/phoenix/src/components/form/select/model/select_option.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/model/select_option.js +2 -1
- package/build/esm/packages/phoenix/src/components/form/select/model/select_option.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/model/select_option_mapper.js +3 -2
- package/build/esm/packages/phoenix/src/components/form/select/model/select_option_mapper.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/model/select_option_types.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +5 -0
- package/build/esm/packages/phoenix/src/components/form/select/select.js +87 -14
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js +22 -2
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message.js +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +1 -0
- package/build/esm/packages/phoenix/src/index.js +3 -2
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -39,6 +39,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
39
39
|
this.type = SELECT_TYPES.select;
|
|
40
40
|
this.noDeselect = false;
|
|
41
41
|
this.assistiveTitleId = '';
|
|
42
|
+
this.isDevSelectPlaceholderFlagEnabled = false;
|
|
42
43
|
this.translations = {};
|
|
43
44
|
this._selectOptionsId = v4();
|
|
44
45
|
this._searchValue = '';
|
|
@@ -53,7 +54,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
53
54
|
const $options = this._getOptions();
|
|
54
55
|
this._$options = $options.reduce((acc, $option) => {
|
|
55
56
|
const value = $option.getAttribute('value');
|
|
56
|
-
if (
|
|
57
|
+
if (value === null || value === undefined)
|
|
57
58
|
throw Error('Select option must hava a value');
|
|
58
59
|
if (acc.has(value))
|
|
59
60
|
throw Error('Select options must hava a unique values.');
|
|
@@ -110,12 +111,24 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
110
111
|
if (!this.$searchLabel)
|
|
111
112
|
return;
|
|
112
113
|
(_a = this.$searchLabel.querySelector(`[id="value-label"]`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
113
|
-
this
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
if (this.isDevSelectPlaceholderFlagEnabled) {
|
|
115
|
+
const hasValidOptions = options.some((option) => !option.isPlaceholder);
|
|
116
|
+
if (!hasValidOptions)
|
|
117
|
+
return;
|
|
118
|
+
const valueLabelSpan = document.createElement('span');
|
|
119
|
+
valueLabelSpan.id = 'value-label';
|
|
120
|
+
valueLabelSpan.className = 'sr-only';
|
|
121
|
+
valueLabelSpan.textContent = options.reduce((totalSelectedContent, currentOption) => totalSelectedContent + currentOption.content, '');
|
|
122
|
+
this.$searchLabel.appendChild(valueLabelSpan);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this.$searchLabel.innerHTML = `
|
|
126
|
+
${(_b = this.$searchLabel) === null || _b === void 0 ? void 0 : _b.innerHTML}
|
|
127
|
+
<span id="value-label" class="sr-only">
|
|
128
|
+
${options.reduce((totalSelectedContent, currentOption) => (totalSelectedContent += currentOption.content), '')}
|
|
129
|
+
</span>
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
119
132
|
};
|
|
120
133
|
this._handleOptionClicked = ({ detail }) => {
|
|
121
134
|
if (!(detail === null || detail === void 0 ? void 0 : detail.$option))
|
|
@@ -167,7 +180,8 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
167
180
|
};
|
|
168
181
|
const $options = Array.from(this.querySelectorAll(SELECT_RELATED_COMPONENTS_NAMES.option));
|
|
169
182
|
$options.forEach(($option) => $option.setAttribute('slot', SELECT_SLOT_NAMES.content));
|
|
170
|
-
|
|
183
|
+
const $placeholderEl = this.querySelector(`[slot="${SELECT_INPUT_PLACEHOLDER_SLOT_NAME}"]`);
|
|
184
|
+
this.$placeholder = ($placeholderEl && ((_a = $placeholderEl.textContent) === null || _a === void 0 ? void 0 : _a.trim())) ? $placeholderEl : 'Select';
|
|
171
185
|
if (this.multiple)
|
|
172
186
|
this.type = SELECT_TYPES.multiple;
|
|
173
187
|
}
|
|
@@ -213,6 +227,9 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
213
227
|
}
|
|
214
228
|
if (changedProperties.has('optionsList')) {
|
|
215
229
|
this._updateOptions();
|
|
230
|
+
if (this.isDevSelectPlaceholderFlagEnabled) {
|
|
231
|
+
this._addPlaceholderOptionIfNeeded();
|
|
232
|
+
}
|
|
216
233
|
}
|
|
217
234
|
if (this._$optionsList.value) {
|
|
218
235
|
(_a = this.listBoxController) === null || _a === void 0 ? void 0 : _a.hostDisconnected();
|
|
@@ -261,6 +278,9 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
261
278
|
this._selectedOptionsAriaObserver = new Observer((selectedOptions) => this._updateLabelAria(selectedOptions));
|
|
262
279
|
this._selectController.selectedOptions$.subscribe(this._selectedOptionsAriaObserver);
|
|
263
280
|
this._updateOptions();
|
|
281
|
+
if (this.isDevSelectPlaceholderFlagEnabled) {
|
|
282
|
+
this._addPlaceholderOptionIfNeeded();
|
|
283
|
+
}
|
|
264
284
|
this._setupEvents();
|
|
265
285
|
}
|
|
266
286
|
attributeChangedCallback(name, _old, value) {
|
|
@@ -273,6 +293,50 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
273
293
|
this.disabled ? this.classList.add(SELECT_CSS_CLASSES.selectDisabled) : this.classList.remove(SELECT_CSS_CLASSES.selectDisabled);
|
|
274
294
|
}
|
|
275
295
|
}
|
|
296
|
+
_addPlaceholderOptionIfNeeded() {
|
|
297
|
+
if (!this._canAddPlaceholder)
|
|
298
|
+
return;
|
|
299
|
+
const $placeholderOption = this._createPlaceholderOption();
|
|
300
|
+
this._injectOptionIntoDOM($placeholderOption);
|
|
301
|
+
this._updateOptions();
|
|
302
|
+
}
|
|
303
|
+
get _canAddPlaceholder() {
|
|
304
|
+
var _a;
|
|
305
|
+
if (this.multiple || this.required)
|
|
306
|
+
return false;
|
|
307
|
+
const hasSelection = (((_a = this._selectController.selectedOptions$.getValue()) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0;
|
|
308
|
+
if (hasSelection)
|
|
309
|
+
return false;
|
|
310
|
+
const hasExistingPlaceholder = !!this.querySelector('h-option[placeholder]');
|
|
311
|
+
return !hasExistingPlaceholder;
|
|
312
|
+
}
|
|
313
|
+
_createPlaceholderOption() {
|
|
314
|
+
const $option = document.createElement('h-option');
|
|
315
|
+
$option.setAttribute('value', '');
|
|
316
|
+
$option.setAttribute('selected', 'true');
|
|
317
|
+
$option.setAttribute('placeholder', 'true');
|
|
318
|
+
$option.setAttribute('slot', SELECT_SLOT_NAMES.content);
|
|
319
|
+
const $content = document.createElement(SELECT_RELATED_COMPONENTS_NAMES.optionContent);
|
|
320
|
+
if (typeof this.$placeholder === 'string') {
|
|
321
|
+
$content.textContent = this.$placeholder;
|
|
322
|
+
}
|
|
323
|
+
else if (this.$placeholder instanceof Node) {
|
|
324
|
+
Array.from(this.$placeholder.childNodes).forEach(node => {
|
|
325
|
+
$content.appendChild(node.cloneNode(true));
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
$option.appendChild($content);
|
|
329
|
+
return $option;
|
|
330
|
+
}
|
|
331
|
+
_injectOptionIntoDOM($option) {
|
|
332
|
+
const $firstOption = this.querySelector(SELECT_RELATED_COMPONENTS_NAMES.option);
|
|
333
|
+
if ($firstOption) {
|
|
334
|
+
this.insertBefore($option, $firstOption);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
this.appendChild($option);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
276
340
|
_setupEvents() {
|
|
277
341
|
this.addEventListener(SELECT_EVENT_NAMES.deselectOption, this._handleOptionDeselect);
|
|
278
342
|
this.addEventListener(SELECT_CLOSE_BTN_EVENT_NAMES.close, this._closeSelect);
|
|
@@ -353,7 +417,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
353
417
|
return fragment;
|
|
354
418
|
}
|
|
355
419
|
render() {
|
|
356
|
-
var _a, _b, _c, _d, _e;
|
|
420
|
+
var _a, _b, _c, _d, _e, _f;
|
|
357
421
|
const options = (_a = this._selectController.options$.getValue()) !== null && _a !== void 0 ? _a : [];
|
|
358
422
|
const isSearchEnabled = !this.searchDisabled && options.length > MIN_NUMBER_OF_OPTIONS_TO_SHOW_SEARCH;
|
|
359
423
|
return html `
|
|
@@ -377,6 +441,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
377
441
|
aria-activedescendant
|
|
378
442
|
role="combobox"
|
|
379
443
|
aria-controls="${this._selectOptionsId}"
|
|
444
|
+
aria-labelledby="${this.assistiveTitleId}"
|
|
380
445
|
>
|
|
381
446
|
${this.getSlot(SELECT_SLOT_NAMES.toggler)}
|
|
382
447
|
</h-dropdown-toggler>
|
|
@@ -389,14 +454,18 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
389
454
|
>
|
|
390
455
|
<h-select-close-btn class="${SELECT_CSS_CLASSES.selectCloseMobileButton}" @close=${this._closeSelect}></h-select-close-btn>
|
|
391
456
|
|
|
392
|
-
<div class=${SELECT_CSS_CLASSES.selectLabel}
|
|
457
|
+
<div class=${SELECT_CSS_CLASSES.selectLabel}>
|
|
458
|
+
${this.isDevSelectPlaceholderFlagEnabled ?
|
|
459
|
+
(_b = this.$searchLabel) === null || _b === void 0 ? void 0 : _b.cloneNode(true) :
|
|
460
|
+
html `${this._getClonedPlaceholderElement()}`}
|
|
461
|
+
</div>
|
|
393
462
|
|
|
394
463
|
${isSearchEnabled
|
|
395
464
|
? html ` <h-select-search
|
|
396
465
|
class=${SELECT_CSS_CLASSES.selectSearch}
|
|
397
466
|
${ref(this.$search)}
|
|
398
467
|
.value=${this._searchValue}
|
|
399
|
-
placeholder=${((
|
|
468
|
+
placeholder=${((_c = this.translations) === null || _c === void 0 ? void 0 : _c.search) || SELECT_DEFAULT_TRANSLATIONS.SEARCH}
|
|
400
469
|
@search=${this._handleSearch}
|
|
401
470
|
></h-select-search>`
|
|
402
471
|
: nothing}
|
|
@@ -417,7 +486,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
417
486
|
${this._searchNoResult()
|
|
418
487
|
? html ` <div>
|
|
419
488
|
<p class=${SELECT_CSS_CLASSES.selectNoResult}>
|
|
420
|
-
${((
|
|
489
|
+
${((_d = this.translations) === null || _d === void 0 ? void 0 : _d.noResultsFor) || SELECT_DEFAULT_TRANSLATIONS.NO_RESULTS_FOR}:
|
|
421
490
|
<em class=${SELECT_CSS_CLASSES.selectSearchedPhrase}>"${this._searchValue}"</em>
|
|
422
491
|
</p>
|
|
423
492
|
</div>`
|
|
@@ -426,11 +495,11 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
426
495
|
? html `
|
|
427
496
|
<section class=${SELECT_CSS_CLASSES.selectFooter}>
|
|
428
497
|
<button class="${SELECT_CSS_CLASSES.selectClearButton}" @click=${this._clearOptions}>
|
|
429
|
-
${((
|
|
498
|
+
${((_e = this.translations) === null || _e === void 0 ? void 0 : _e.reset) || SELECT_DEFAULT_TRANSLATIONS.RESET}
|
|
430
499
|
</button>
|
|
431
500
|
<h-select-close-btn class="${SELECT_CSS_CLASSES.selectCloseButton}" @close=${this._closeSelect}
|
|
432
501
|
><span slot=${SELECT_CLOSE_BUTTON_CONTENT_SLOT_NAME}
|
|
433
|
-
>${((
|
|
502
|
+
>${((_f = this.translations) === null || _f === void 0 ? void 0 : _f.choose) || SELECT_DEFAULT_TRANSLATIONS.CHOOSE}</span
|
|
434
503
|
>
|
|
435
504
|
</h-select-close-btn>
|
|
436
505
|
</section>
|
|
@@ -504,6 +573,10 @@ __decorate([
|
|
|
504
573
|
property({ type: String, attribute: 'assistive-title-id' }),
|
|
505
574
|
__metadata("design:type", String)
|
|
506
575
|
], HSelect.prototype, "assistiveTitleId", void 0);
|
|
576
|
+
__decorate([
|
|
577
|
+
property({ type: Boolean, attribute: 'is-dev-select-placeholder-flag-enabled' }),
|
|
578
|
+
__metadata("design:type", Boolean)
|
|
579
|
+
], HSelect.prototype, "isDevSelectPlaceholderFlagEnabled", void 0);
|
|
507
580
|
__decorate([
|
|
508
581
|
property({
|
|
509
582
|
converter: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -8,4 +8,5 @@ export declare class SelectControlUtils {
|
|
|
8
8
|
static appendHTMLOption($option: HOption, $list: HOptions, position?: number): void;
|
|
9
9
|
static getFirstIndexSelectedOption(options: HOption[]): number;
|
|
10
10
|
static getLastIndexOfSelectedOption(options: HOption[]): number;
|
|
11
|
+
static extractSelectValue($select: HTMLSelectElement): string | string[] | null | undefined;
|
|
11
12
|
}
|
|
@@ -2,7 +2,7 @@ import { SELECT_RELATED_COMPONENTS_NAMES } from './components/select_components_
|
|
|
2
2
|
|
|
3
3
|
class SelectControlUtils {
|
|
4
4
|
static createHTMLOption(option) {
|
|
5
|
-
const { selected, value, disabled, hidden, content } = option;
|
|
5
|
+
const { selected, value, disabled, hidden, content, isPlaceholder } = option;
|
|
6
6
|
const $option = document.createElement(SELECT_RELATED_COMPONENTS_NAMES.option);
|
|
7
7
|
$option.setAttribute('value', String(value));
|
|
8
8
|
const $optionContent = document.createElement(SELECT_RELATED_COMPONENTS_NAMES.optionContent);
|
|
@@ -14,14 +14,17 @@ class SelectControlUtils {
|
|
|
14
14
|
$option.setAttribute('disabled', '');
|
|
15
15
|
if (hidden)
|
|
16
16
|
$option.setAttribute('hidden', '');
|
|
17
|
+
if (isPlaceholder)
|
|
18
|
+
$option.setAttribute('placeholder', 'true');
|
|
17
19
|
return $option;
|
|
18
20
|
}
|
|
19
21
|
static syncHTMLOptionWithModel(option, $option) {
|
|
20
|
-
const { selected, value, disabled, hidden } = option;
|
|
22
|
+
const { selected, value, disabled, hidden, isPlaceholder } = option;
|
|
21
23
|
$option.selected = selected;
|
|
22
24
|
$option.value = value;
|
|
23
25
|
$option.disabled = disabled;
|
|
24
26
|
$option.hidden = hidden;
|
|
27
|
+
$option.toggleAttribute('placeholder', isPlaceholder);
|
|
25
28
|
}
|
|
26
29
|
static removeHTMLOptions($options, optionsValuesThatExists) {
|
|
27
30
|
return $options.reduce((acc, $option) => {
|
|
@@ -46,6 +49,23 @@ class SelectControlUtils {
|
|
|
46
49
|
const firstIndexInReversed = [...options].reverse().findIndex((option) => option.selected);
|
|
47
50
|
return options.length - firstIndexInReversed - 1;
|
|
48
51
|
}
|
|
52
|
+
static extractSelectValue($select) {
|
|
53
|
+
var _a;
|
|
54
|
+
const { selectedOptions } = $select;
|
|
55
|
+
const selectedValues = Array.from(selectedOptions).map((option) => option.value);
|
|
56
|
+
if (selectedValues.length === 0) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const isPlaceholder = !$select.multiple && selectedOptions.length === 1 && ((_a = selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.hasAttribute('placeholder'));
|
|
60
|
+
const isSingleEmptyValue = selectedValues.length === 1 && selectedValues[0] === '';
|
|
61
|
+
if (isPlaceholder && isSingleEmptyValue) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if ($select.multiple) {
|
|
65
|
+
return selectedValues;
|
|
66
|
+
}
|
|
67
|
+
return selectedValues[0];
|
|
68
|
+
}
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
export { SelectControlUtils };
|
|
@@ -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;"}
|
|
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;"}
|
|
@@ -7,8 +7,8 @@ import v4 from '../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
|
7
7
|
import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP, PORTAL_TARGET_ATTRIBUTE_NAME } from '../portal/portal_constants.js';
|
|
8
8
|
import { ClickOutsideController } from '../../controllers/click_outside_controller/click_outside_controller.js';
|
|
9
9
|
import { RelativePositionController } from '../../controllers/relative_position_controller/relative_position_controller.js';
|
|
10
|
-
import { DEFAULT_MESSAGE_PORTAL_NAME, DEFAULT_MESSAGE_OFFSET, LIST_OF_MESSAGE_CHILDREN, MESSAGE_SHOW_DELAY_IN_MS, MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS, MESSAGE_REMOVED_CLASS_NAME, MESSAGE_CLOSE_DELAY_IN_MS, MESSAGE_CONTENT_ELEMENTS, SCREEN_READER_ONLY_CLASS_NAME, MESSAGE_CONTENT_SLOT_NAME } from './base_message_constants.js';
|
|
11
10
|
import { createRef, ref } from 'lit/directives/ref';
|
|
11
|
+
import { DEFAULT_MESSAGE_PORTAL_NAME, DEFAULT_MESSAGE_OFFSET, LIST_OF_MESSAGE_CHILDREN, MESSAGE_SHOW_DELAY_IN_MS, MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS, MESSAGE_REMOVED_CLASS_NAME, MESSAGE_CLOSE_DELAY_IN_MS, MESSAGE_CONTENT_ELEMENTS, SCREEN_READER_ONLY_CLASS_NAME, MESSAGE_CONTENT_SLOT_NAME } from './base_message_constants.js';
|
|
12
12
|
|
|
13
13
|
class BaseMessage extends PhoenixLightLitElement {
|
|
14
14
|
constructor() {
|
|
@@ -136,6 +136,7 @@ export { HSearchHistoryLoadMore } from './components/form/search/subcomponents/h
|
|
|
136
136
|
export { HSearchSuggestionContent } from './components/form/search/subcomponents/results/search_suggestion_content';
|
|
137
137
|
export { HSearchProductContent } from './components/form/search/subcomponents/results/search_product_content';
|
|
138
138
|
export { HSearchProducerContent } from './components/form/search/subcomponents/results/search_producer_content';
|
|
139
|
+
export { SelectControlUtils } from './components/form/select/select_utils';
|
|
139
140
|
export type { TSearchDisplayMode } from './components/form/search/search_types';
|
|
140
141
|
export * from './components/form/search/search_constants';
|
|
141
142
|
export { HToggle } from './components/toggle/toggle';
|
|
@@ -22,6 +22,7 @@ export { ToggleElementAriaController } from './controllers/toggle_element_aria_c
|
|
|
22
22
|
export { HDropdownToggler } from './components/dropdown/dropdown_toggler.js';
|
|
23
23
|
export { RelativePositionController } from './controllers/relative_position_controller/relative_position_controller.js';
|
|
24
24
|
export { HDropdown } from './components/dropdown/dropdown.js';
|
|
25
|
+
export { SelectControlUtils } from './components/form/select/select_utils.js';
|
|
25
26
|
export { HSelect } from './components/form/select/select.js';
|
|
26
27
|
export { HFile } from './components/form/file_picker/file/file.js';
|
|
27
28
|
export { INPUT_CONTROL_CSS_CLASSES, INPUT_CONTROL_EVENTS, INPUT_CONTROL_SIZES, INPUT_CONTROL_TYPES, INPUT_PROPS_TO_SYNC } from './components/form/input/input_constants.js';
|
|
@@ -70,11 +71,11 @@ export { HRadioControl } from './components/form/radio/radio_control.js';
|
|
|
70
71
|
export { TEXTAREA_CONTROL_CSS_CLASSES, TEXTAREA_CONTROL_EVENTS, TEXTAREA_PROPS_TO_SYNC, TEXTAREA_SLOTS } from './components/form/textarea/textarea_constants.js';
|
|
71
72
|
export { HTextarea } from './components/form/textarea/textarea.js';
|
|
72
73
|
export { HTextareaControl } from './components/form/textarea/textarea_control.js';
|
|
73
|
-
export {
|
|
74
|
+
export { ACCORDION_ANIMATION_DURATION, ACCORDION_CSS_CLASSES, ACCORDION_EVENTS, ACCORDION_MODE } from './components/accordion/accordion_constants.js';
|
|
74
75
|
export { HAccordion } from './components/accordion/accordion.js';
|
|
75
76
|
export { HAccordionGroup } from './components/accordion/accordion_group.js';
|
|
76
|
-
export { HAccordionContent } from './components/accordion/accordion_content.js';
|
|
77
77
|
export { HAccordionToggler } from './components/accordion/accordion_toggler.js';
|
|
78
|
+
export { HAccordionContent } from './components/accordion/accordion_content.js';
|
|
78
79
|
export { HDropdownClose } from './components/dropdown/dropdown_close.js';
|
|
79
80
|
export { HToggleButtonGroup } from './components/groups/toggle_button_group/toggle_button_group.js';
|
|
80
81
|
export { HToggleButton } from './components/groups/toggle_button_group/toggle_button.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@shoper/phoenix_design_system",
|
|
3
3
|
"packageManager": "yarn@3.2.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "1.18.
|
|
5
|
+
"version": "1.18.10-0",
|
|
6
6
|
"description": "phoenix design system",
|
|
7
7
|
"author": "zefirek",
|
|
8
8
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@splidejs/splide-extension-auto-scroll": "0.5.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@dreamcommerce/utilities": "^1.23.
|
|
34
|
+
"@dreamcommerce/utilities": "^1.23.2",
|
|
35
35
|
"@shoper/jest_config": "^0.0.0",
|
|
36
36
|
"@shoper/tsconfig": "^0.0.0",
|
|
37
37
|
"@splidejs/splide": "4.0.7",
|