@otto-de/b2b-core-components 1.32.2 → 1.33.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/dist/b2b-core-components/b2b-core-components.esm.js +1 -1
- package/dist/b2b-core-components/icons-100/b2b_icon-arrow-misdirected.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-clipboard-check.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-cosmetics.png +0 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-cosmetics.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-lock-open.svg +4 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-person-wheelchair.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-speech-bubble-sparkles.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-sustainable-organic-food.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-universal-access.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-voice-sparkles.svg +3 -0
- package/dist/b2b-core-components/icons-100/b2b_icon-webhook.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-arrow-long-left.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-arrow-long-right.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-arrow-misdirected.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-arrow-return.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-callback.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-feedback.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-flag-chequered.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-flame.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-inplace-zoom.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-lock-closed.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-lock-open.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-notification.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-pending.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-phone.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-print.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-qr-code.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-skip-link.svg +3 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-smiley-angry.svg +13 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-smiley-happy.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-smiley-negative.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-smiley-neutral.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-sparkles.svg +10 -0
- package/dist/b2b-core-components/icons-50/b2b_icon-voucher.svg +3 -0
- package/dist/b2b-core-components/p-24c6aa56.entry.js +1 -0
- package/dist/b2b-core-components/p-2daee203.entry.js +1 -0
- package/dist/b2b-core-components/p-3369f3c0.entry.js +1 -0
- package/dist/b2b-core-components/{p-660c758b.entry.js → p-57842105.entry.js} +1 -1
- package/dist/b2b-core-components/p-5dacf68a.entry.js +1 -0
- package/dist/b2b-core-components/p-6abfdb73.entry.js +1 -0
- package/dist/b2b-core-components/p-703da47c.entry.js +1 -0
- package/dist/b2b-core-components/p-76573f9f.entry.js +1 -0
- package/dist/b2b-core-components/p-76bf79ec.entry.js +1 -0
- package/dist/b2b-core-components/p-840dd6cd.entry.js +1 -0
- package/dist/b2b-core-components/{p-f661154c.entry.js → p-917a7f00.entry.js} +1 -1
- package/dist/b2b-core-components/p-953fc46b.js +1 -0
- package/dist/b2b-core-components/{p-4dad7870.entry.js → p-bc2b17c6.entry.js} +1 -1
- package/dist/b2b-core-components/p-fea90226.entry.js +1 -0
- package/dist/cjs/b2b-checkbox-group.cjs.entry.js +5 -12
- package/dist/cjs/b2b-checkbox.cjs.entry.js +6 -4
- package/dist/cjs/b2b-chip-component_2.cjs.entry.js +4 -2
- package/dist/cjs/b2b-core-components.cjs.js +1 -1
- package/dist/cjs/b2b-custom-dropdown.cjs.entry.js +13 -11
- package/dist/cjs/b2b-date-picker-days_5.cjs.entry.js +30 -22
- package/dist/cjs/b2b-date-picker.cjs.entry.js +10 -5
- package/dist/cjs/b2b-dropdown.cjs.entry.js +8 -7
- package/dist/cjs/b2b-icon-100.cjs.entry.js +402 -392
- package/dist/cjs/b2b-icon-50.cjs.entry.js +57 -35
- package/dist/cjs/b2b-icon.cjs.entry.js +355 -356
- package/dist/cjs/b2b-input-group_2.cjs.entry.js +4 -11
- package/dist/cjs/b2b-input_2.cjs.entry.js +7 -9
- package/dist/cjs/b2b-multiselect-dropdown.cjs.entry.js +82 -55
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{request-801c6ba1.js → request-a16ba589.js} +1 -1
- package/dist/collection/components/checkbox/checkbox.js +6 -4
- package/dist/collection/components/checkbox-group/checkbox-group.js +5 -12
- package/dist/collection/components/custom-dropdown/custom-dropdown.css +6 -0
- package/dist/collection/components/custom-dropdown/custom-dropdown.js +32 -11
- package/dist/collection/components/date-picker/date-picker-months.js +38 -10
- package/dist/collection/components/date-picker/date-picker-years.js +35 -15
- package/dist/collection/components/date-picker/date-picker.css +2 -3
- package/dist/collection/components/date-picker/date-picker.js +9 -4
- package/dist/collection/components/date-picker/date-picker.stories.js +9 -3
- package/dist/collection/components/dropdown/dropdown.css +4 -0
- package/dist/collection/components/dropdown/dropdown.e2e.js +1 -1
- package/dist/collection/components/dropdown/dropdown.js +28 -6
- package/dist/collection/components/dropdown/dropdown.stories.js +17 -4
- package/dist/collection/components/flyout-menu/flyout-menu.e2e.js +7 -2
- package/dist/collection/components/icon/types.js +354 -355
- package/dist/collection/components/icon-100/icon-100.js +1 -1
- package/dist/collection/components/icon-100/icons-100/b2b_icon-arrow-misdirected.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-clipboard-check.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-cosmetics.png +0 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-cosmetics.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-lock-open.svg +4 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-person-wheelchair.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-speech-bubble-sparkles.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-sustainable-organic-food.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-universal-access.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-voice-sparkles.svg +3 -0
- package/dist/collection/components/icon-100/icons-100/b2b_icon-webhook.svg +3 -0
- package/dist/collection/components/icon-100/types.js +401 -391
- package/dist/collection/components/icon-50/icon-50.js +1 -1
- package/dist/collection/components/icon-50/icons-50/b2b_icon-arrow-long-left.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-arrow-long-right.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-arrow-misdirected.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-arrow-return.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-callback.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-feedback.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-flag-chequered.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-flame.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-inplace-zoom.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-lock-closed.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-lock-open.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-notification.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-pending.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-phone.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-print.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-qr-code.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-skip-link.svg +3 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-smiley-angry.svg +13 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-smiley-happy.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-smiley-negative.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-smiley-neutral.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-sparkles.svg +10 -0
- package/dist/collection/components/icon-50/icons-50/b2b_icon-voucher.svg +3 -0
- package/dist/collection/components/icon-50/types.js +56 -34
- package/dist/collection/components/input/input.js +7 -9
- package/dist/collection/components/input-group/input-group.js +4 -11
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.e2e.js +15 -0
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.js +121 -61
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.stories.js +44 -11
- package/dist/collection/components/multiselect-dropdown/multiselect-option/multiselect-option.js +22 -3
- package/dist/collection/utils/icon/request.js +1 -1
- package/dist/components/b2b-checkbox-group.js +5 -12
- package/dist/components/b2b-custom-dropdown.js +16 -12
- package/dist/components/b2b-date-picker.js +10 -5
- package/dist/components/b2b-dropdown.js +9 -7
- package/dist/components/b2b-icon-50.js +56 -34
- package/dist/components/b2b-icon.js +354 -355
- package/dist/components/b2b-multiselect-dropdown.js +85 -55
- package/dist/components/checkbox.js +6 -4
- package/dist/components/date-picker-months.js +16 -8
- package/dist/components/date-picker-years.js +14 -14
- package/dist/components/icon-100.js +401 -391
- package/dist/components/input-group.js +4 -11
- package/dist/components/input.js +7 -9
- package/dist/components/multiselect-option.js +5 -2
- package/dist/components/request.js +1 -1
- package/dist/custom-elements.json +108 -1
- package/dist/esm/b2b-checkbox-group.entry.js +5 -12
- package/dist/esm/b2b-checkbox.entry.js +6 -4
- package/dist/esm/b2b-chip-component_2.entry.js +4 -2
- package/dist/esm/b2b-core-components.js +1 -1
- package/dist/esm/b2b-custom-dropdown.entry.js +13 -11
- package/dist/esm/b2b-date-picker-days_5.entry.js +30 -22
- package/dist/esm/b2b-date-picker.entry.js +10 -5
- package/dist/esm/b2b-dropdown.entry.js +8 -7
- package/dist/esm/b2b-icon-100.entry.js +402 -392
- package/dist/esm/b2b-icon-50.entry.js +57 -35
- package/dist/esm/b2b-icon.entry.js +355 -356
- package/dist/esm/b2b-input-group_2.entry.js +4 -11
- package/dist/esm/b2b-input_2.entry.js +7 -9
- package/dist/esm/b2b-multiselect-dropdown.entry.js +82 -55
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{request-1d048f8a.js → request-6bb66f19.js} +1 -1
- package/dist/types/components/custom-dropdown/custom-dropdown.d.ts +6 -2
- package/dist/types/components/date-picker/date-picker-months.d.ts +7 -4
- package/dist/types/components/date-picker/date-picker-years.d.ts +6 -5
- package/dist/types/components/date-picker/date-picker.d.ts +4 -4
- package/dist/types/components/dropdown/dropdown.d.ts +2 -0
- package/dist/types/components/dropdown/dropdown.stories.d.ts +1 -0
- package/dist/types/components/icon/types.d.ts +1 -1
- package/dist/types/components/icon-100/types.d.ts +2 -2
- package/dist/types/components/icon-50/types.d.ts +2 -2
- package/dist/types/components/multiselect-dropdown/multiselect-dropdown.d.ts +19 -9
- package/dist/types/components/multiselect-dropdown/multiselect-dropdown.stories.d.ts +23 -4
- package/dist/types/components/multiselect-dropdown/multiselect-option/multiselect-option.d.ts +3 -1
- package/dist/types/components.d.ts +36 -8
- package/dist/web-types.json +51 -12
- package/package.json +2 -2
- package/dist/b2b-core-components/p-0bf2c192.entry.js +0 -1
- package/dist/b2b-core-components/p-54eee61c.entry.js +0 -1
- package/dist/b2b-core-components/p-61b2a6ad.js +0 -1
- package/dist/b2b-core-components/p-639d68a2.entry.js +0 -1
- package/dist/b2b-core-components/p-6b291a01.entry.js +0 -1
- package/dist/b2b-core-components/p-6c60d337.entry.js +0 -1
- package/dist/b2b-core-components/p-88bf92be.entry.js +0 -1
- package/dist/b2b-core-components/p-a614bd46.entry.js +0 -1
- package/dist/b2b-core-components/p-ae7ec34a.entry.js +0 -1
- package/dist/b2b-core-components/p-b4d46a07.entry.js +0 -1
- package/dist/b2b-core-components/p-f83dd748.entry.js +0 -1
|
@@ -15,18 +15,17 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
15
15
|
this.__registerHost();
|
|
16
16
|
this.__attachShadow();
|
|
17
17
|
this.b2bChange = createEvent(this, "b2b-selected", 7);
|
|
18
|
-
this.handleInput = event => {
|
|
19
|
-
if (this.disabled)
|
|
18
|
+
this.handleInput = (event) => {
|
|
19
|
+
if (this.disabled || this.groupDisabled)
|
|
20
20
|
return;
|
|
21
|
-
|
|
22
|
-
this.value =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
21
|
+
const term = event.target.value.toLowerCase();
|
|
22
|
+
this.value = term;
|
|
23
|
+
const list = this.normalizedOptions;
|
|
24
|
+
this.currentList =
|
|
25
|
+
term === ''
|
|
26
|
+
? list
|
|
27
|
+
: list.filter(o => o.label.toLowerCase().includes(term) ||
|
|
28
|
+
o.value.toLowerCase().includes(term));
|
|
30
29
|
};
|
|
31
30
|
this.getOptions = () => {
|
|
32
31
|
return Array.from(this.hostElement.shadowRoot.querySelectorAll('b2b-multiselect-option')).slice(1);
|
|
@@ -34,10 +33,10 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
34
33
|
this.renderChips = () => {
|
|
35
34
|
return this.currentSelectedValues.map((option, index) => {
|
|
36
35
|
if (index < this.maxOptionsVisible) {
|
|
37
|
-
return (h("b2b-chip-component", { label: option, value: option, "onB2b-close": this.handleChipClose }));
|
|
36
|
+
return (h("b2b-chip-component", { label: option.label, value: option.value, disabled: this.disabled || this.groupDisabled, "onB2b-close": this.handleChipClose }));
|
|
38
37
|
}
|
|
39
38
|
else if (index === this.maxOptionsVisible) {
|
|
40
|
-
return (h("b2b-chip-component", { label: "...", class: "b2b-multiselect-dropdown__option--show-more-button",
|
|
39
|
+
return (h("b2b-chip-component", { label: "...", class: "b2b-multiselect-dropdown__option--show-more-button", disabled: this.disabled || this.groupDisabled, onClick: this.handleOverflowOptionsClick }));
|
|
41
40
|
}
|
|
42
41
|
else {
|
|
43
42
|
return;
|
|
@@ -49,18 +48,24 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
49
48
|
this.setElementOnFocus();
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
|
-
this.handleSelectedChange = event => {
|
|
53
|
-
const
|
|
51
|
+
this.handleSelectedChange = (event) => {
|
|
52
|
+
const value = event.detail.selectedOption;
|
|
53
|
+
const opt = this.normalizedOptions.find(o => o.value === value);
|
|
54
|
+
if (opt === undefined)
|
|
55
|
+
return;
|
|
54
56
|
if (event.detail.selected) {
|
|
55
|
-
this.currentSelectedValues
|
|
57
|
+
if (!this.currentSelectedValues.some(o => o.value === value)) {
|
|
58
|
+
this.currentSelectedValues = [...this.currentSelectedValues, opt];
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
else {
|
|
58
|
-
this.currentSelectedValues = this.currentSelectedValues.filter(
|
|
62
|
+
this.currentSelectedValues = this.currentSelectedValues.filter(o => o.value !== value);
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
|
-
this.handleChipClose = event => {
|
|
62
|
-
|
|
63
|
-
this.
|
|
65
|
+
this.handleChipClose = (event) => {
|
|
66
|
+
const value = event.detail.value;
|
|
67
|
+
this.currentSelectedValues = this.currentSelectedValues.filter(o => o.value !== value);
|
|
68
|
+
this.updateOption(value);
|
|
64
69
|
this.isOpen = true;
|
|
65
70
|
this.resetFocus();
|
|
66
71
|
};
|
|
@@ -69,21 +74,22 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
69
74
|
const optionToUpdate = options.find(el => el.option === option);
|
|
70
75
|
optionToUpdate.selected = false;
|
|
71
76
|
};
|
|
72
|
-
this.updateAllOptions = options => {
|
|
73
|
-
// Deselect all to avoid caching issues in Vue
|
|
77
|
+
this.updateAllOptions = (options) => {
|
|
74
78
|
options.forEach(option => (option.selected = false));
|
|
79
|
+
const selectedSet = new Set(this.currentSelectedValues.map(o => o.value));
|
|
75
80
|
options
|
|
76
|
-
.filter(option =>
|
|
81
|
+
.filter(option => selectedSet.has(option.option))
|
|
77
82
|
.forEach(option => (option.selected = true));
|
|
78
83
|
};
|
|
79
84
|
this.setElementOnFocus = () => {
|
|
80
|
-
if (this.disabled)
|
|
85
|
+
if (this.disabled || this.groupDisabled)
|
|
81
86
|
return;
|
|
82
87
|
this.isElementFocused = true;
|
|
83
88
|
};
|
|
84
89
|
this.setElementOnBlur = (event) => {
|
|
85
90
|
const nextFocusedElement = event === null || event === void 0 ? void 0 : event.relatedTarget;
|
|
86
|
-
if (!nextFocusedElement
|
|
91
|
+
if (!(nextFocusedElement instanceof Node) ||
|
|
92
|
+
!this.hostElement.contains(nextFocusedElement)) {
|
|
87
93
|
this.isOpen = false;
|
|
88
94
|
}
|
|
89
95
|
else {
|
|
@@ -92,14 +98,14 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
92
98
|
this.isElementFocused = false;
|
|
93
99
|
};
|
|
94
100
|
this.resetFocus = () => {
|
|
95
|
-
if (this.disabled)
|
|
101
|
+
if (this.disabled || this.groupDisabled)
|
|
96
102
|
return;
|
|
97
103
|
const el = this.hostElement.shadowRoot.querySelector('.b2b-multiselect-dropdown');
|
|
98
104
|
el.focus();
|
|
99
105
|
};
|
|
100
106
|
this.handleMouseDown = (event) => {
|
|
101
107
|
/** Keep dropdown open if a tag is removed */
|
|
102
|
-
if (this.disabled) {
|
|
108
|
+
if (this.disabled || this.groupDisabled) {
|
|
103
109
|
event.preventDefault();
|
|
104
110
|
return;
|
|
105
111
|
}
|
|
@@ -111,7 +117,7 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
111
117
|
}
|
|
112
118
|
};
|
|
113
119
|
this.handleKeyDown = (event) => {
|
|
114
|
-
if (this.disabled)
|
|
120
|
+
if (this.disabled || this.groupDisabled)
|
|
115
121
|
return;
|
|
116
122
|
if (event.key === 'Enter') {
|
|
117
123
|
event.preventDefault();
|
|
@@ -122,19 +128,21 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
122
128
|
this.setElementOnBlur();
|
|
123
129
|
}
|
|
124
130
|
};
|
|
125
|
-
this.handleSelectAll = event => {
|
|
131
|
+
this.handleSelectAll = (event) => {
|
|
126
132
|
const newVal = event.detail.selected;
|
|
127
133
|
const options = this.getOptions();
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
options[i].selected = newVal;
|
|
131
|
-
}
|
|
134
|
+
const values = options.map(el => el.option);
|
|
135
|
+
options.forEach(el => (el.selected = newVal));
|
|
132
136
|
if (newVal) {
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
const toAdd = this.normalizedOptions.filter(o => values.includes(o.value));
|
|
138
|
+
const set = new Set(this.currentSelectedValues.map(o => o.value));
|
|
139
|
+
this.currentSelectedValues = [
|
|
140
|
+
...this.currentSelectedValues,
|
|
141
|
+
...toAdd.filter(o => !set.has(o.value)),
|
|
142
|
+
];
|
|
135
143
|
}
|
|
136
144
|
else {
|
|
137
|
-
this.currentSelectedValues = this.currentSelectedValues.filter(
|
|
145
|
+
this.currentSelectedValues = this.currentSelectedValues.filter(o => !values.includes(o.value));
|
|
138
146
|
}
|
|
139
147
|
};
|
|
140
148
|
this.updateSelectAll = (options) => {
|
|
@@ -156,35 +164,51 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
156
164
|
this.errorMessage = undefined;
|
|
157
165
|
this.hint = undefined;
|
|
158
166
|
this.disabled = false;
|
|
167
|
+
this.groupDisabled = false;
|
|
159
168
|
this.currentSelectedValues = [];
|
|
160
|
-
this.currentList =
|
|
169
|
+
this.currentList = [];
|
|
161
170
|
this.value = '';
|
|
162
171
|
this.isElementFocused = false;
|
|
163
172
|
this.isOpen = false;
|
|
173
|
+
this.normalizedOptions = [];
|
|
174
|
+
this.normalizedSelected = [];
|
|
164
175
|
this.hasOptionList = this.optionsList.length > 0;
|
|
165
176
|
}
|
|
177
|
+
parsePropToOptArray(value) {
|
|
178
|
+
if (Array.isArray(value) && typeof value[0] === 'object') {
|
|
179
|
+
return value;
|
|
180
|
+
}
|
|
181
|
+
return parsePropToArray(value).map(v => ({
|
|
182
|
+
label: v,
|
|
183
|
+
value: v,
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
166
186
|
componentWillLoad() {
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
169
|
-
this.currentList = this.
|
|
170
|
-
this.
|
|
187
|
+
this.normalizedSelected = this.parsePropToOptArray(this.selectedValues);
|
|
188
|
+
this.normalizedOptions = this.parsePropToOptArray(this.optionsList);
|
|
189
|
+
this.currentList = this.normalizedOptions;
|
|
190
|
+
this.hasOptionList = this.normalizedOptions.length > 0;
|
|
191
|
+
const selectedSet = new Set(this.normalizedSelected.map(o => o.value));
|
|
192
|
+
this.currentSelectedValues = this.normalizedOptions.filter(opt => selectedSet.has(opt.value));
|
|
171
193
|
}
|
|
172
194
|
/** Needed to trigger a re-render for async data */
|
|
173
195
|
watchPropHandler(newList) {
|
|
174
|
-
this.
|
|
175
|
-
this.hasOptionList = this.
|
|
196
|
+
this.normalizedOptions = this.parsePropToOptArray(newList);
|
|
197
|
+
this.hasOptionList = this.normalizedOptions.length > 0;
|
|
176
198
|
if (this.hasOptionList) {
|
|
177
|
-
this.currentList = this.
|
|
178
|
-
|
|
199
|
+
this.currentList = this.normalizedOptions;
|
|
200
|
+
const selectedSet = new Set(this.normalizedSelected.map(o => o.value));
|
|
201
|
+
this.currentSelectedValues = this.normalizedOptions.filter(opt => selectedSet.has(opt.value));
|
|
179
202
|
}
|
|
180
203
|
}
|
|
181
204
|
/** Needed to trigger a re-render for async data */
|
|
182
205
|
handleSelectedValuesChangeFromOutside(newVal) {
|
|
183
|
-
this.
|
|
184
|
-
|
|
206
|
+
this.normalizedSelected = this.parsePropToOptArray(newVal);
|
|
207
|
+
const selectedSet = new Set(this.normalizedSelected.map(o => o.value));
|
|
208
|
+
this.currentSelectedValues = this.normalizedOptions.filter(o => selectedSet.has(o.value));
|
|
185
209
|
}
|
|
186
210
|
handleSelectedValuesChange(newValues) {
|
|
187
|
-
this.b2bChange.emit(newValues);
|
|
211
|
+
this.b2bChange.emit(newValues.map(o => o.value));
|
|
188
212
|
}
|
|
189
213
|
componentDidUpdate() {
|
|
190
214
|
const options = this.getOptions();
|
|
@@ -192,18 +216,21 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
192
216
|
this.updateSelectAll(options);
|
|
193
217
|
}
|
|
194
218
|
render() {
|
|
195
|
-
|
|
219
|
+
const disabled = this.disabled || this.groupDisabled;
|
|
220
|
+
const hasError = this.invalid && !disabled;
|
|
221
|
+
const showHint = this.hint && !hasError;
|
|
222
|
+
const showError = this.errorMessage && hasError;
|
|
223
|
+
return (h(Host, { key: 'c7428f2ae958e0560c2725b11418d6303d762bd6', onFocus: this.setElementOnFocus, onBlur: this.setElementOnBlur, onClick: this.handleMouseDown, onKeyDown: this.handleKeyDown }, h("b2b-input-label", { key: 'ec356ec9b842ff998adc0156c9cadc5e64aaba02', required: this.required }, this.label), h("div", { key: '292e2e884448319fd956a39b0b5cb154bb8ac599', class: {
|
|
196
224
|
'b2b-multiselect-dropdown': true,
|
|
197
225
|
'b2b-multiselect-dropdown--open': this.isOpen,
|
|
198
|
-
'b2b-multiselect-dropdown--error':
|
|
199
|
-
'b2b-multiselect-dropdown--disabled':
|
|
226
|
+
'b2b-multiselect-dropdown--error': hasError,
|
|
227
|
+
'b2b-multiselect-dropdown--disabled': disabled,
|
|
200
228
|
'b2b-multiselect-dropdown--focused': this.invalid && this.isElementFocused,
|
|
201
|
-
}, tabindex: 0, role: "combobox", onClick: () => (this.isOpen = !this.isOpen), "aria-expanded": this.isElementFocused }, h("div", { key: '
|
|
229
|
+
}, tabindex: 0, role: "combobox", onClick: () => (this.isOpen = !this.isOpen && !disabled), "aria-expanded": this.isElementFocused }, h("div", { key: 'e3078ea1d5ce658f84cbd7db8d15fbec5c10bcc4', class: "b2b-multiselect-dropdown__chip-container" }, this.currentSelectedValues.length === 0 ? (h("span", { class: "b2b-multiselect-dropdown__placeholder" }, this.placeholder)) : (this.renderChips())), h("b2b-icon-100", { key: '1591c3ee5f61627ca75e3ca7b1fa4873209d8e52', icon: "b2b_icon-arrow-down" })), h("div", { key: 'a521b5578bcfbab5ceebd638a309e2f68eea0095', class: {
|
|
202
230
|
'b2b-multiselect-dropdown__options-container': true,
|
|
203
231
|
'b2b-multiselect-dropdown__options-container--visible': this.isOpen,
|
|
204
|
-
} }, h("div", { key: '
|
|
205
|
-
this.currentList.map(option => (h("b2b-multiselect-option", { "onB2b-option-selected": this.handleSelectedChange, option: option }))))), (this.hint
|
|
206
|
-
(this.hint !== undefined && this.disabled) ? (h("span", { class: "b2b-multiselect-dropdown__hint" }, this.hint)) : (''), this.errorMessage !== undefined && this.invalid && !this.disabled ? (h("span", { class: "b2b-multiselect-dropdown__error-message" }, this.errorMessage)) : ('')));
|
|
232
|
+
} }, h("div", { key: '85abaf3ebe291b14f6d13758fec48972e6e0bf92', class: "b2b-multiselect-dropdown__options", role: "listbox", "aria-label": this.label, tabIndex: -1 }, h("div", { key: 'fb4f61401da1bf145aa024a17dd8ecb295a369bc', class: "b2b-multiselect-dropdown__option__search" }, h("input", { key: '0971102609b6fa583f12e2c3f15f70a961ebebaa', type: "text", onInput: this.handleInput, class: "b2b-multiselect-dropdown__option__search__input", placeholder: this.searchPlaceholder })), h("b2b-multiselect-option", { key: '2238627bb301f45c5bd3d4d143fc5312bec0e445', class: "b2b-multiselect-dropdown__option__select-all", option: this.selectAllLabel, id: "select-all", "onB2b-option-selected": this.handleSelectAll }), this.hasOptionList &&
|
|
233
|
+
this.currentList.map(option => (h("b2b-multiselect-option", { "onB2b-option-selected": this.handleSelectedChange, option: option.value, label: option.label }))))), showHint && (h("span", { class: "b2b-multiselect-dropdown__hint" }, this.hint)), showError && (h("span", { class: "b2b-multiselect-dropdown__error-message" }, this.errorMessage))));
|
|
207
234
|
}
|
|
208
235
|
get hostElement() { return this; }
|
|
209
236
|
static get watchers() { return {
|
|
@@ -225,11 +252,14 @@ const B2bMultiSelectDropdown = /*@__PURE__*/ proxyCustomElement(class B2bMultiSe
|
|
|
225
252
|
"errorMessage": [1, "error-message"],
|
|
226
253
|
"hint": [1],
|
|
227
254
|
"disabled": [516],
|
|
255
|
+
"groupDisabled": [4, "group-disabled"],
|
|
228
256
|
"currentSelectedValues": [32],
|
|
229
257
|
"currentList": [32],
|
|
230
258
|
"value": [32],
|
|
231
259
|
"isElementFocused": [32],
|
|
232
260
|
"isOpen": [32],
|
|
261
|
+
"normalizedOptions": [32],
|
|
262
|
+
"normalizedSelected": [32],
|
|
233
263
|
"hasOptionList": [32]
|
|
234
264
|
}, undefined, {
|
|
235
265
|
"optionsList": ["watchPropHandler"],
|
|
@@ -76,15 +76,17 @@ const CheckboxComponent = /*@__PURE__*/ proxyCustomElement(class CheckboxCompone
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
render() {
|
|
79
|
-
|
|
79
|
+
const hasError = this.invalid && !this.disabled && !this.groupDisabled;
|
|
80
|
+
const showHint = this.hint && !hasError;
|
|
81
|
+
const showError = this.error && hasError;
|
|
82
|
+
return (h(Host, { key: '57bfa6bc2e41794f9b0ead465d82538baafd33a0', onClick: this.onClick }, h("div", { key: '15577f773e6f608a797e19eb45b2b116bb1ab17b', class: {
|
|
80
83
|
'b2b-checkbox': true,
|
|
81
|
-
'b2b-checkbox--error':
|
|
84
|
+
'b2b-checkbox--error': hasError,
|
|
82
85
|
'b2b-checkbox--disabled': this.disabled || this.groupDisabled,
|
|
83
86
|
'b2b-checkbox--checked': this.checked,
|
|
84
87
|
'b2b-checkbox--standalone': this.standalone,
|
|
85
88
|
'b2b-checkbox--indeterminate': this.indeterminate,
|
|
86
|
-
} }, h("div", { key: '
|
|
87
|
-
(this.hint !== undefined && this.disabled) ? (h("span", null, this.hint)) : (''), this.error !== undefined && this.invalid && !this.disabled ? (h("span", null, this.error)) : (''))));
|
|
89
|
+
} }, h("div", { key: '30fd2e78afcbf126a3a12c61b3467cb04b989d0f', class: "b2b-checkbox__items" }, this.renderIcon(), h("input", { key: '98fc87c0de77356a85181adec5ca151f93be6da2', class: "b2b-checkbox__input", "aria-labelledby": this.name, type: "checkbox", name: this.name, id: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.groupDisabled, onFocus: this.onFocus, onBlur: this.onBlur }), !this.standalone && (h("b2b-input-label", { id: this.name, required: this.required, disabled: this.disabled || this.groupDisabled }, h("slot", { name: "label" }, this.label)))), showHint && h("span", null, this.hint), showError && h("span", null, this.error))));
|
|
88
90
|
}
|
|
89
91
|
get hostElement() { return this; }
|
|
90
92
|
static get style() { return B2bCheckboxStyle0; }
|
|
@@ -10,6 +10,7 @@ const keys = {
|
|
|
10
10
|
ARROW_RIGHT: 'ArrowRight',
|
|
11
11
|
ARROW_LEFT: 'ArrowLeft',
|
|
12
12
|
ENTER: 'Enter',
|
|
13
|
+
ESC: 'Escape',
|
|
13
14
|
};
|
|
14
15
|
const B2bDatePickerMonths = /*@__PURE__*/ proxyCustomElement(class B2bDatePickerMonths extends HTMLElement {
|
|
15
16
|
constructor() {
|
|
@@ -17,6 +18,7 @@ const B2bDatePickerMonths = /*@__PURE__*/ proxyCustomElement(class B2bDatePicker
|
|
|
17
18
|
this.__registerHost();
|
|
18
19
|
this.__attachShadow();
|
|
19
20
|
this.b2bDatePickerMonthSelected = createEvent(this, "b2b-date-picker-month-selected", 7);
|
|
21
|
+
this.b2bDatePickerEscape = createEvent(this, "b2b-date-picker-escape", 7);
|
|
20
22
|
this.getAllMonths = () => {
|
|
21
23
|
return Array.from(this.host.shadowRoot.querySelectorAll('.b2b-date-picker-month'));
|
|
22
24
|
};
|
|
@@ -47,28 +49,30 @@ const B2bDatePickerMonths = /*@__PURE__*/ proxyCustomElement(class B2bDatePicker
|
|
|
47
49
|
}
|
|
48
50
|
handleKeyDown(event) {
|
|
49
51
|
event.preventDefault();
|
|
50
|
-
let index = this.selectedMonth;
|
|
51
52
|
const months = this.getAllMonths();
|
|
52
53
|
let currentMonth = this.getCurrentMonth();
|
|
54
|
+
let index = months.indexOf(currentMonth);
|
|
53
55
|
switch (event.key) {
|
|
54
56
|
case keys.ARROW_LEFT:
|
|
55
|
-
index
|
|
57
|
+
index -= 1;
|
|
56
58
|
break;
|
|
57
59
|
case keys.ARROW_RIGHT:
|
|
58
|
-
index
|
|
60
|
+
index += 1;
|
|
59
61
|
break;
|
|
60
62
|
case keys.ARROW_UP:
|
|
61
|
-
index
|
|
63
|
+
index -= 3;
|
|
62
64
|
break;
|
|
63
65
|
case keys.ARROW_DOWN:
|
|
64
|
-
index
|
|
66
|
+
index += 3;
|
|
65
67
|
break;
|
|
66
68
|
case keys.ENTER:
|
|
67
|
-
index = months.indexOf(currentMonth);
|
|
68
69
|
this.b2bDatePickerMonthSelected.emit({
|
|
69
70
|
value: index,
|
|
70
71
|
});
|
|
71
|
-
|
|
72
|
+
return;
|
|
73
|
+
case keys.ESC:
|
|
74
|
+
this.b2bDatePickerEscape.emit();
|
|
75
|
+
return;
|
|
72
76
|
default:
|
|
73
77
|
return;
|
|
74
78
|
}
|
|
@@ -80,8 +84,12 @@ const B2bDatePickerMonths = /*@__PURE__*/ proxyCustomElement(class B2bDatePicker
|
|
|
80
84
|
}
|
|
81
85
|
this.focusCurrentMonth(months[index]);
|
|
82
86
|
}
|
|
87
|
+
componentDidRender() {
|
|
88
|
+
var _a;
|
|
89
|
+
(_a = this.getCurrentMonth()) === null || _a === void 0 ? void 0 : _a.focus();
|
|
90
|
+
}
|
|
83
91
|
render() {
|
|
84
|
-
return (h(Host, { key: '
|
|
92
|
+
return (h(Host, { key: '92f546b998c48d274d76db47db997bcda3968033' }, h("div", { key: 'cfd9e12f5d1047d6acf2be7142d070dd64517049', class: "b2b-date-picker-months" }, this.renderDatePickerMonths())));
|
|
85
93
|
}
|
|
86
94
|
get host() { return this; }
|
|
87
95
|
static get style() { return B2bDatePickerMonthsStyle0; }
|
|
@@ -9,6 +9,7 @@ const keys = {
|
|
|
9
9
|
ARROW_RIGHT: 'ArrowRight',
|
|
10
10
|
ARROW_LEFT: 'ArrowLeft',
|
|
11
11
|
ENTER: 'Enter',
|
|
12
|
+
ESC: 'Escape',
|
|
12
13
|
};
|
|
13
14
|
const B2bDatePickerYears = /*@__PURE__*/ proxyCustomElement(class B2bDatePickerYears extends HTMLElement {
|
|
14
15
|
constructor() {
|
|
@@ -16,6 +17,7 @@ const B2bDatePickerYears = /*@__PURE__*/ proxyCustomElement(class B2bDatePickerY
|
|
|
16
17
|
this.__registerHost();
|
|
17
18
|
this.__attachShadow();
|
|
18
19
|
this.b2bDatePickerYearSelected = createEvent(this, "b2b-date-picker-year-selected", 7);
|
|
20
|
+
this.b2bDatePickerEscape = createEvent(this, "b2b-date-picker-escape", 7);
|
|
19
21
|
this.getAllYears = () => {
|
|
20
22
|
return Array.from(this.host.shadowRoot.querySelectorAll('.b2b-date-picker-year'));
|
|
21
23
|
};
|
|
@@ -58,32 +60,34 @@ const B2bDatePickerYears = /*@__PURE__*/ proxyCustomElement(class B2bDatePickerY
|
|
|
58
60
|
return years;
|
|
59
61
|
};
|
|
60
62
|
this.selectedYear = undefined;
|
|
61
|
-
this.yearsRange =
|
|
63
|
+
this.yearsRange = Array.from({ length: 201 }, (_, i) => i + 1900);
|
|
62
64
|
}
|
|
63
65
|
handleKeyDown(event) {
|
|
64
66
|
event.preventDefault();
|
|
65
|
-
let index = this.yearsRange.indexOf(this.selectedYear);
|
|
66
67
|
const years = this.getAllYears();
|
|
67
68
|
let currentYear = this.getCurrentYear();
|
|
69
|
+
let index = years.indexOf(currentYear);
|
|
68
70
|
switch (event.key) {
|
|
69
71
|
case keys.ARROW_LEFT:
|
|
70
|
-
index
|
|
72
|
+
index -= 1;
|
|
71
73
|
break;
|
|
72
74
|
case keys.ARROW_RIGHT:
|
|
73
|
-
index
|
|
75
|
+
index += 1;
|
|
74
76
|
break;
|
|
75
77
|
case keys.ARROW_UP:
|
|
76
|
-
index
|
|
78
|
+
index -= 3;
|
|
77
79
|
break;
|
|
78
80
|
case keys.ARROW_DOWN:
|
|
79
|
-
index
|
|
81
|
+
index += 3;
|
|
80
82
|
break;
|
|
81
83
|
case keys.ENTER:
|
|
82
|
-
index = years.indexOf(currentYear);
|
|
83
84
|
this.b2bDatePickerYearSelected.emit({
|
|
84
85
|
value: this.yearsRange[index],
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
+
return;
|
|
88
|
+
case keys.ESC:
|
|
89
|
+
this.b2bDatePickerEscape.emit();
|
|
90
|
+
return;
|
|
87
91
|
default:
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
@@ -95,18 +99,14 @@ const B2bDatePickerYears = /*@__PURE__*/ proxyCustomElement(class B2bDatePickerY
|
|
|
95
99
|
}
|
|
96
100
|
this.focusCurrentYear(years[index]);
|
|
97
101
|
}
|
|
98
|
-
componentWillLoad() {
|
|
99
|
-
for (let i = 1900; i <= 2100; i++) {
|
|
100
|
-
this.yearsRange.push(i);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
102
|
componentDidLoad() {
|
|
104
103
|
if (this.selectedYear > 0) {
|
|
105
104
|
this.scrollToYear(this.selectedYear);
|
|
105
|
+
this.getCurrentYear().focus();
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
render() {
|
|
109
|
-
return (h(Host, { key: '
|
|
109
|
+
return (h(Host, { key: '2e9b64e857f36f8623cb13aa5ebd5346e21bdc6f' }, h("div", { key: 'b6a82d5fbfc2f18aab9c2c64efe3c8bbe63cfc19', class: "b2b-date-picker-years" }, this.renderDatePickerYears())));
|
|
110
110
|
}
|
|
111
111
|
get host() { return this; }
|
|
112
112
|
static get style() { return B2bDatePickerYearsStyle0; }
|