@otto-de/b2b-core-components 1.34.0 → 1.36.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/{p-d2f4db88.entry.js → p-01f2aca4.entry.js} +1 -1
- package/dist/b2b-core-components/p-02bb4145.entry.js +1 -0
- package/dist/b2b-core-components/{p-e512628d.entry.js → p-0cd95c1e.entry.js} +1 -1
- package/dist/b2b-core-components/{p-04f5748b.entry.js → p-0e994814.entry.js} +1 -1
- package/dist/b2b-core-components/p-0f0fcb25.entry.js +1 -0
- package/dist/b2b-core-components/{p-81cffff6.entry.js → p-121ead75.entry.js} +1 -1
- package/dist/b2b-core-components/{p-b9a6ad5d.entry.js → p-1875aef7.entry.js} +1 -1
- package/dist/b2b-core-components/{p-d163d252.entry.js → p-1a232e86.entry.js} +1 -1
- package/dist/b2b-core-components/{p-e3877fc1.entry.js → p-1e5732bb.entry.js} +1 -1
- package/dist/b2b-core-components/{p-a46674a7.entry.js → p-212d2e61.entry.js} +1 -1
- package/dist/b2b-core-components/p-22967672.entry.js +1 -0
- package/dist/b2b-core-components/{p-8aba659a.entry.js → p-253502a0.entry.js} +1 -1
- package/dist/b2b-core-components/{p-13d37dec.entry.js → p-2aaa326b.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c8b5c7e2.entry.js → p-3752cc70.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c086532b.entry.js → p-3b52a3fb.entry.js} +1 -1
- package/dist/b2b-core-components/{p-997a232e.entry.js → p-3c6abe16.entry.js} +1 -1
- package/dist/b2b-core-components/p-470378e2.entry.js +1 -0
- package/dist/b2b-core-components/{p-f9f9820a.entry.js → p-4b8c879e.entry.js} +1 -1
- package/dist/b2b-core-components/p-51086123.entry.js +1 -0
- package/dist/b2b-core-components/{p-0648230f.entry.js → p-696b9e54.entry.js} +1 -1
- package/dist/b2b-core-components/{p-d62e615b.entry.js → p-6b3788ae.entry.js} +1 -1
- package/dist/b2b-core-components/{p-371df3f8.entry.js → p-6f5dbb23.entry.js} +1 -1
- package/dist/b2b-core-components/{p-b4310b58.entry.js → p-6f607a94.entry.js} +1 -1
- package/dist/b2b-core-components/{p-66c435c1.entry.js → p-73db8251.entry.js} +1 -1
- package/dist/b2b-core-components/p-7d2fb5f3.entry.js +1 -0
- package/dist/b2b-core-components/{p-540a8b9c.entry.js → p-80104e55.entry.js} +1 -1
- package/dist/b2b-core-components/{p-0aa0c59a.entry.js → p-861dba01.entry.js} +1 -1
- package/dist/b2b-core-components/{p-17778cfc.entry.js → p-96211730.entry.js} +1 -1
- package/dist/b2b-core-components/{p-f3c0fe56.entry.js → p-98ee5fd5.entry.js} +1 -1
- package/dist/b2b-core-components/{p-2486830b.entry.js → p-9f0dbb21.entry.js} +1 -1
- package/dist/b2b-core-components/p-a2d97f5d.entry.js +1 -0
- package/dist/b2b-core-components/{p-a9c9552f.entry.js → p-a5cc60f3.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c25832e1.entry.js → p-a95ed002.entry.js} +1 -1
- package/dist/b2b-core-components/p-abcbd1cc.entry.js +1 -0
- package/dist/b2b-core-components/{p-0ab41eb5.entry.js → p-acdcb8c8.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c8cc1797.entry.js → p-b0abf9e3.entry.js} +1 -1
- package/dist/b2b-core-components/p-b95b2de3.entry.js +1 -0
- package/dist/b2b-core-components/{p-433a3f3e.entry.js → p-bb0f31a9.entry.js} +1 -1
- package/dist/b2b-core-components/{p-89e817e9.entry.js → p-bf1d5618.entry.js} +1 -1
- package/dist/b2b-core-components/{p-79a01d0d.entry.js → p-db898e98.entry.js} +1 -1
- package/dist/b2b-core-components/p-e52728b3.entry.js +1 -0
- package/dist/b2b-core-components/{p-8ae9c2fe.entry.js → p-ef93e944.entry.js} +1 -1
- package/dist/b2b-core-components/{p-4b27240b.entry.js → p-f9e61af5.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c43e067a.entry.js → p-fa050815.entry.js} +1 -1
- package/dist/b2b-core-components/p-fdb7d12c.entry.js +1 -0
- package/dist/cjs/b2b-background-box.cjs.entry.js +1 -1
- package/dist/cjs/b2b-button_2.cjs.entry.js +1 -1
- package/dist/cjs/b2b-chip-component_2.cjs.entry.js +2 -2
- package/dist/cjs/b2b-core-components.cjs.js +1 -1
- package/dist/cjs/b2b-custom-dropdown.cjs.entry.js +9 -5
- package/dist/cjs/b2b-dropdown.cjs.entry.js +72 -7
- package/dist/cjs/b2b-flyout-menu-option.cjs.entry.js +1 -1
- package/dist/cjs/b2b-flyout-menu.cjs.entry.js +3 -3
- package/dist/cjs/b2b-grid-col.cjs.entry.js +1 -1
- package/dist/cjs/b2b-grid-row.cjs.entry.js +2 -2
- package/dist/cjs/b2b-grid.cjs.entry.js +1 -1
- package/dist/cjs/b2b-input-group_2.cjs.entry.js +16 -3
- package/dist/cjs/b2b-input-label.cjs.entry.js +2 -2
- package/dist/cjs/b2b-input-list-option.cjs.entry.js +30 -0
- package/dist/cjs/{b2b-input_2.cjs.entry.js → b2b-input.cjs.entry.js} +4 -28
- package/dist/cjs/b2b-label.cjs.entry.js +2 -2
- package/dist/cjs/b2b-modal.cjs.entry.js +2 -2
- package/dist/cjs/b2b-multiselect-dropdown.cjs.entry.js +3 -3
- package/dist/cjs/b2b-pagination.cjs.entry.js +1 -1
- package/dist/cjs/b2b-progress-bar.cjs.entry.js +3 -3
- package/dist/cjs/b2b-radio-button.cjs.entry.js +2 -2
- package/dist/cjs/b2b-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/b2b-required-separator.cjs.entry.js +1 -1
- package/dist/cjs/b2b-rounded-icon.cjs.entry.js +4 -4
- package/dist/cjs/b2b-scrollable-container.cjs.entry.js +1 -1
- package/dist/cjs/b2b-search.cjs.entry.js +1 -1
- package/dist/cjs/b2b-separator.cjs.entry.js +1 -1
- package/dist/cjs/b2b-shimmer.cjs.entry.js +1 -1
- package/dist/cjs/b2b-snackbar.cjs.entry.js +4 -4
- package/dist/cjs/b2b-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/b2b-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/b2b-tab.cjs.entry.js +2 -2
- package/dist/cjs/b2b-table-cell_2.cjs.entry.js +3 -3
- package/dist/cjs/b2b-table-row.cjs.entry.js +2 -2
- package/dist/cjs/b2b-table-rowgroup.cjs.entry.js +2 -2
- package/dist/cjs/b2b-table.cjs.entry.js +2 -2
- package/dist/cjs/b2b-textarea.cjs.entry.js +2 -2
- package/dist/cjs/b2b-time-picker.cjs.entry.js +157 -0
- package/dist/cjs/b2b-toggle-button.cjs.entry.js +3 -3
- package/dist/cjs/b2b-toggle-chip.cjs.entry.js +3 -3
- package/dist/cjs/b2b-toggle-group.cjs.entry.js +2 -2
- package/dist/cjs/b2b-toggle-switch.cjs.entry.js +4 -4
- package/dist/cjs/b2b-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/b2b-wizard-icon.cjs.entry.js +1 -1
- package/dist/cjs/b2b-wizard-step.cjs.entry.js +2 -2
- package/dist/cjs/b2b-wizard.cjs.entry.js +1 -1
- package/dist/cjs/index-668808fd.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/background-box/background-box.css +2 -2
- package/dist/collection/components/background-box/background-box.e2e.js +1 -1
- package/dist/collection/components/background-box/background-box.stories.js +1 -1
- package/dist/collection/components/custom-dropdown/custom-dropdown.css +13 -1
- package/dist/collection/components/custom-dropdown/custom-dropdown.e2e.js +69 -0
- package/dist/collection/components/custom-dropdown/custom-dropdown.js +26 -4
- package/dist/collection/components/custom-dropdown/custom-dropdown.stories.js +11 -0
- package/dist/collection/components/dropdown/dropdown.css +11 -0
- package/dist/collection/components/dropdown/dropdown.e2e.js +54 -0
- package/dist/collection/components/dropdown/dropdown.js +90 -6
- package/dist/collection/components/dropdown/dropdown.stories.js +7 -2
- package/dist/collection/components/flyout-menu/flyout-menu-option.js +1 -1
- package/dist/collection/components/flyout-menu/flyout-menu.js +3 -3
- package/dist/collection/components/grid/column.js +1 -1
- package/dist/collection/components/grid/grid.js +1 -1
- package/dist/collection/components/grid/row.js +2 -2
- package/dist/collection/components/input/input.js +4 -4
- package/dist/collection/components/input-group/input-group.js +1 -1
- package/dist/collection/components/input-label/input-label.js +2 -2
- package/dist/collection/components/input-list/input-list-option.js +1 -1
- package/dist/collection/components/input-list/input-list.e2e.js +5 -5
- package/dist/collection/components/input-list/input-list.js +23 -6
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/modal/modal.js +2 -2
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.js +3 -3
- package/dist/collection/components/multiselect-dropdown/multiselect-option/multiselect-option.js +2 -2
- package/dist/collection/components/pagination/pagination.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +3 -3
- package/dist/collection/components/radio/radio.js +2 -2
- package/dist/collection/components/radio-group/radio-group.js +2 -2
- package/dist/collection/components/required-separator/required-separator.js +1 -1
- package/dist/collection/components/rounded-icon/rounded-icon.js +4 -4
- package/dist/collection/components/scrollable-container/scrollable-container.js +1 -1
- package/dist/collection/components/search/search.e2e.js +1 -1
- package/dist/collection/components/search/search.js +1 -1
- package/dist/collection/components/separator/separator.js +1 -1
- package/dist/collection/components/shimmer/shimmer.js +1 -1
- package/dist/collection/components/snackbar/snackbar.js +4 -4
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-group/tab-group.js +1 -1
- package/dist/collection/components/tab-panel/tab-panel.js +1 -1
- package/dist/collection/components/table/table-cell/table-cell.js +2 -2
- package/dist/collection/components/table/table-header/table-header.js +1 -1
- package/dist/collection/components/table/table-row/table-row.js +2 -2
- package/dist/collection/components/table/table-rowgroup/table-rowgroup.js +2 -2
- package/dist/collection/components/table/table.js +2 -2
- package/dist/collection/components/textarea/textarea.js +2 -2
- package/dist/collection/components/time-picker/time-picker.css +345 -0
- package/dist/collection/components/time-picker/time-picker.e2e.js +135 -0
- package/dist/collection/components/time-picker/time-picker.js +411 -0
- package/dist/collection/components/time-picker/time-picker.stories.js +80 -0
- package/dist/collection/components/toggle-button/toggle-button.js +3 -3
- package/dist/collection/components/toggle-chip/toggle-chip.js +3 -3
- package/dist/collection/components/toggle-group/toggle-group.js +2 -2
- package/dist/collection/components/toggle-switch/toggle-switch.js +4 -4
- package/dist/collection/components/tooltip/tooltip.js +3 -3
- package/dist/collection/components/wizard/wizard-step.js +2 -2
- package/dist/collection/components/wizard/wizard.js +1 -1
- package/dist/collection/components/wizard-icon/wizard-icon.js +1 -1
- package/dist/components/b2b-custom-dropdown.js +10 -5
- package/dist/components/b2b-dropdown.js +87 -8
- package/dist/components/b2b-flyout-menu-option.js +1 -1
- package/dist/components/b2b-flyout-menu.js +3 -3
- package/dist/components/b2b-grid-col.js +1 -1
- package/dist/components/b2b-grid-row.js +2 -2
- package/dist/components/b2b-grid.js +1 -1
- package/dist/components/b2b-label.js +2 -2
- package/dist/components/b2b-modal.js +2 -2
- package/dist/components/b2b-multiselect-dropdown.js +3 -3
- package/dist/components/b2b-pagination.js +1 -1
- package/dist/components/b2b-progress-bar.js +3 -3
- package/dist/components/b2b-radio-button.js +2 -2
- package/dist/components/b2b-radio-group.js +2 -2
- package/dist/components/b2b-required-separator.js +1 -1
- package/dist/components/b2b-scrollable-container.js +1 -1
- package/dist/components/b2b-search.js +1 -1
- package/dist/components/b2b-shimmer.js +1 -1
- package/dist/components/b2b-snackbar.js +4 -4
- package/dist/components/b2b-tab-group.js +1 -1
- package/dist/components/b2b-tab-panel.js +1 -1
- package/dist/components/b2b-tab.js +2 -2
- package/dist/components/b2b-table-row.js +2 -2
- package/dist/components/b2b-table-rowgroup.js +2 -2
- package/dist/components/b2b-table.js +2 -2
- package/dist/components/b2b-textarea.js +2 -2
- package/dist/components/b2b-time-picker.d.ts +11 -0
- package/dist/components/b2b-time-picker.js +200 -0
- package/dist/components/b2b-toggle-button.js +3 -3
- package/dist/components/b2b-toggle-chip.js +3 -3
- package/dist/components/b2b-toggle-group.js +2 -2
- package/dist/components/b2b-toggle-switch.js +4 -4
- package/dist/components/b2b-tooltip.js +3 -3
- package/dist/components/b2b-wizard-step.js +2 -2
- package/dist/components/b2b-wizard.js +1 -1
- package/dist/components/background-box.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-label.js +2 -2
- package/dist/components/input-list-option.js +1 -1
- package/dist/components/input-list.js +19 -4
- package/dist/components/input.js +4 -4
- package/dist/components/multiselect-option.js +2 -2
- package/dist/components/rounded-icon.js +4 -4
- package/dist/components/separator.js +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/table-cell.js +2 -2
- package/dist/components/table-header.js +1 -1
- package/dist/components/wizard-icon.js +1 -1
- package/dist/custom-elements.json +64 -0
- package/dist/esm/b2b-background-box.entry.js +1 -1
- package/dist/esm/b2b-button_2.entry.js +1 -1
- package/dist/esm/b2b-chip-component_2.entry.js +2 -2
- package/dist/esm/b2b-core-components.js +1 -1
- package/dist/esm/b2b-custom-dropdown.entry.js +9 -5
- package/dist/esm/b2b-dropdown.entry.js +72 -7
- package/dist/esm/b2b-flyout-menu-option.entry.js +1 -1
- package/dist/esm/b2b-flyout-menu.entry.js +3 -3
- package/dist/esm/b2b-grid-col.entry.js +1 -1
- package/dist/esm/b2b-grid-row.entry.js +2 -2
- package/dist/esm/b2b-grid.entry.js +1 -1
- package/dist/esm/b2b-input-group_2.entry.js +16 -3
- package/dist/esm/b2b-input-label.entry.js +2 -2
- package/dist/esm/b2b-input-list-option.entry.js +26 -0
- package/dist/esm/{b2b-input_2.entry.js → b2b-input.entry.js} +5 -28
- package/dist/esm/b2b-label.entry.js +2 -2
- package/dist/esm/b2b-modal.entry.js +2 -2
- package/dist/esm/b2b-multiselect-dropdown.entry.js +3 -3
- package/dist/esm/b2b-pagination.entry.js +1 -1
- package/dist/esm/b2b-progress-bar.entry.js +3 -3
- package/dist/esm/b2b-radio-button.entry.js +2 -2
- package/dist/esm/b2b-radio-group.entry.js +2 -2
- package/dist/esm/b2b-required-separator.entry.js +1 -1
- package/dist/esm/b2b-rounded-icon.entry.js +4 -4
- package/dist/esm/b2b-scrollable-container.entry.js +1 -1
- package/dist/esm/b2b-search.entry.js +1 -1
- package/dist/esm/b2b-separator.entry.js +1 -1
- package/dist/esm/b2b-shimmer.entry.js +1 -1
- package/dist/esm/b2b-snackbar.entry.js +4 -4
- package/dist/esm/b2b-tab-group.entry.js +1 -1
- package/dist/esm/b2b-tab-panel.entry.js +1 -1
- package/dist/esm/b2b-tab.entry.js +2 -2
- package/dist/esm/b2b-table-cell_2.entry.js +3 -3
- package/dist/esm/b2b-table-row.entry.js +2 -2
- package/dist/esm/b2b-table-rowgroup.entry.js +2 -2
- package/dist/esm/b2b-table.entry.js +2 -2
- package/dist/esm/b2b-textarea.entry.js +2 -2
- package/dist/esm/b2b-time-picker.entry.js +153 -0
- package/dist/esm/b2b-toggle-button.entry.js +3 -3
- package/dist/esm/b2b-toggle-chip.entry.js +3 -3
- package/dist/esm/b2b-toggle-group.entry.js +2 -2
- package/dist/esm/b2b-toggle-switch.entry.js +4 -4
- package/dist/esm/b2b-tooltip.entry.js +3 -3
- package/dist/esm/b2b-wizard-icon.entry.js +1 -1
- package/dist/esm/b2b-wizard-step.entry.js +2 -2
- package/dist/esm/b2b-wizard.entry.js +1 -1
- package/dist/esm/index-ab9eb36d.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/custom-dropdown/custom-dropdown.d.ts +2 -0
- package/dist/types/components/custom-dropdown/custom-dropdown.stories.d.ts +3 -0
- package/dist/types/components/dropdown/dropdown.d.ts +9 -1
- package/dist/types/components/dropdown/dropdown.stories.d.ts +1 -0
- package/dist/types/components/input-list/input-list.d.ts +4 -1
- package/dist/types/components/time-picker/time-picker.d.ts +50 -0
- package/dist/types/components/time-picker/time-picker.stories.d.ts +10 -0
- package/dist/types/components.d.ts +134 -2
- package/dist/web-types.json +165 -4
- package/package.json +2 -2
- package/dist/b2b-core-components/p-04ac661d.entry.js +0 -1
- package/dist/b2b-core-components/p-24c6aa56.entry.js +0 -1
- package/dist/b2b-core-components/p-260dcc05.entry.js +0 -1
- package/dist/b2b-core-components/p-4e0ed246.entry.js +0 -1
- package/dist/b2b-core-components/p-b175fb79.entry.js +0 -1
- package/dist/b2b-core-components/p-b481eb09.entry.js +0 -1
- package/dist/b2b-core-components/p-dff37884.entry.js +0 -1
- package/dist/b2b-core-components/p-e8151556.entry.js +0 -1
- package/dist/b2b-core-components/p-e90d3aba.entry.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
export class DropdownComponent {
|
|
3
3
|
constructor() {
|
|
4
|
+
this.ignoreNextMutation = false;
|
|
4
5
|
this.onClickOutside = (ev) => {
|
|
5
6
|
if (!this.hostElement.contains(ev.target))
|
|
6
7
|
this.isOpen = false;
|
|
@@ -17,22 +18,42 @@ export class DropdownComponent {
|
|
|
17
18
|
this.focused = false;
|
|
18
19
|
this.b2bBlur.emit(ev);
|
|
19
20
|
};
|
|
21
|
+
this.clearSelectedValue = (event) => {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
this.clearSelection();
|
|
24
|
+
this.searchValue = '';
|
|
25
|
+
this.b2bChange.emit(this.placeholderValue);
|
|
26
|
+
};
|
|
20
27
|
this.onSelect = (event) => {
|
|
21
28
|
var _a;
|
|
22
29
|
const target = event.target;
|
|
23
30
|
const value = target.getAttribute('data-value');
|
|
24
31
|
const label = (_a = target.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
|
25
32
|
if (value != null) {
|
|
33
|
+
this.ignoreNextMutation = true;
|
|
26
34
|
this.selectedValue = value;
|
|
27
35
|
this.selectedText = label || '';
|
|
28
|
-
this.b2bChange.emit(value);
|
|
29
36
|
this.options = this.options.map(opt => (Object.assign(Object.assign({}, opt), { selected: opt.value === value })));
|
|
37
|
+
const nativeOptions = this.hostElement.querySelectorAll('option');
|
|
38
|
+
nativeOptions.forEach(opt => {
|
|
39
|
+
if (opt.value === value) {
|
|
40
|
+
opt.setAttribute('selected', '');
|
|
41
|
+
opt.selected = true;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
opt.removeAttribute('selected');
|
|
45
|
+
opt.selected = false;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
30
48
|
this.isOpen = false;
|
|
49
|
+
this.b2bChange.emit(value);
|
|
31
50
|
this.updateTruncatedText();
|
|
51
|
+
this.ignoreNextMutation = false;
|
|
32
52
|
}
|
|
33
53
|
};
|
|
34
54
|
this.updateTruncatedText = () => {
|
|
35
|
-
const
|
|
55
|
+
const inputValue = this.search ? '' : this.placeholder;
|
|
56
|
+
const rawText = this.selectedText || inputValue;
|
|
36
57
|
if (this.selectEl == null) {
|
|
37
58
|
this.truncatedText = rawText;
|
|
38
59
|
return;
|
|
@@ -67,7 +88,35 @@ export class DropdownComponent {
|
|
|
67
88
|
}
|
|
68
89
|
this.truncatedText = truncated + '…';
|
|
69
90
|
};
|
|
91
|
+
this.handleSearchInput = (event) => {
|
|
92
|
+
if (this.selectedText &&
|
|
93
|
+
event.target.value !== this.selectedText) {
|
|
94
|
+
this.selectedText = '';
|
|
95
|
+
this.selectedValue = this.placeholderValue;
|
|
96
|
+
this.options = this.options.map(opt => (Object.assign(Object.assign({}, opt), { selected: false })));
|
|
97
|
+
}
|
|
98
|
+
this.searchValue = event.target.value;
|
|
99
|
+
this.isOpen = true;
|
|
100
|
+
};
|
|
101
|
+
this.toggleDropdownWithSearch = (event) => {
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
this.toggleDropdown();
|
|
104
|
+
if (this.isOpen) {
|
|
105
|
+
this.focusSearchInput();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
this.focusSearchInput = () => {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const inputComponent = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('b2b-input');
|
|
111
|
+
if (inputComponent != null) {
|
|
112
|
+
const inputElement = (_b = inputComponent.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
113
|
+
if (inputElement != null) {
|
|
114
|
+
inputElement.focus();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
70
118
|
this.label = undefined;
|
|
119
|
+
this.search = false;
|
|
71
120
|
this.required = false;
|
|
72
121
|
this.name = undefined;
|
|
73
122
|
this.placeholder = 'Select an option...';
|
|
@@ -82,21 +131,31 @@ export class DropdownComponent {
|
|
|
82
131
|
this.selectedValue = '';
|
|
83
132
|
this.selectedText = '';
|
|
84
133
|
this.options = [];
|
|
134
|
+
this.searchValue = '';
|
|
85
135
|
this.truncatedText = '';
|
|
86
136
|
}
|
|
87
137
|
/** Method to programmatically clear selection of the dropdown. */
|
|
88
138
|
async clearSelection() {
|
|
139
|
+
this.ignoreNextMutation = true;
|
|
89
140
|
this.selectedValue = this.placeholderValue;
|
|
90
141
|
this.selectedText = '';
|
|
91
142
|
this.options = this.options.map(opt => (Object.assign(Object.assign({}, opt), { selected: false })));
|
|
143
|
+
const nativeOptions = this.hostElement.querySelectorAll('option');
|
|
144
|
+
nativeOptions.forEach(opt => {
|
|
145
|
+
opt.removeAttribute('selected');
|
|
146
|
+
opt.selected = false;
|
|
147
|
+
});
|
|
92
148
|
this.isOpen = false;
|
|
93
149
|
this.updateTruncatedText();
|
|
150
|
+
this.ignoreNextMutation = false;
|
|
94
151
|
}
|
|
95
152
|
componentWillLoad() {
|
|
96
153
|
this.initializeOptions();
|
|
97
154
|
if (typeof MutationObserver !== 'undefined') {
|
|
98
155
|
this.mutationObserver = new MutationObserver(() => {
|
|
99
|
-
this.
|
|
156
|
+
if (!this.ignoreNextMutation) {
|
|
157
|
+
this.initializeOptions();
|
|
158
|
+
}
|
|
100
159
|
});
|
|
101
160
|
this.mutationObserver.observe(this.hostElement, {
|
|
102
161
|
childList: true,
|
|
@@ -149,15 +208,21 @@ export class DropdownComponent {
|
|
|
149
208
|
const hasError = this.invalid && !this.disabled && !this.groupDisabled;
|
|
150
209
|
const showHint = this.hint && !hasError;
|
|
151
210
|
const showError = this.error && hasError;
|
|
152
|
-
|
|
211
|
+
const filteredOptions = this.options.filter(opt => opt.label.toLowerCase().includes(this.searchValue.toLowerCase()));
|
|
212
|
+
return (h(Host, { key: 'd9762514c854be8f40fd2baaa991b4ae1366cfa3', class: {
|
|
153
213
|
'b2b-dropdown': true,
|
|
154
214
|
'b2b-dropdown--error': hasError,
|
|
155
215
|
'b2b-dropdown--disabled': this.disabled || this.groupDisabled,
|
|
156
|
-
} }, this.label && (h("b2b-input-label", { id: this.name, required: this.required }, this.label)), h("div", { key: '
|
|
216
|
+
} }, this.label && (h("b2b-input-label", { id: this.name, required: this.required }, this.label)), h("div", { key: '2473ccb7d1d9949bbd500adbbad53b1c302593d3', class: "b2b-dropdown__wrapper", onFocus: this.onFocus, onBlur: this.onBlur }, this.search ? (h("b2b-input", { placeholder: this.placeholder, invalid: hasError, value: this.truncatedText || this.searchValue, disabled: this.disabled || this.groupDisabled, "onB2b-focus": () => {
|
|
217
|
+
this.isOpen = true;
|
|
218
|
+
this.focused = true;
|
|
219
|
+
}, "onB2b-input": this.handleSearchInput }, h("div", { slot: "end" }, (this.selectedText || this.searchValue) &&
|
|
220
|
+
!this.disabled &&
|
|
221
|
+
!this.groupDisabled && (h("b2b-icon-100", { class: "b2b-dropdown__clear-icon", icon: 'b2b_icon-close', clickable: true, onClick: this.clearSelectedValue })), h("b2b-icon-100", { class: "b2b-dropdown__arrow-icon", icon: 'b2b_icon-arrow-down', onClick: this.toggleDropdownWithSearch })))) : (h("div", { class: {
|
|
157
222
|
'b2b-dropdown__select': true,
|
|
158
223
|
'b2b-dropdown__select--open': this.isOpen,
|
|
159
224
|
'b2b-dropdown__select--focused': this.focused,
|
|
160
|
-
}, ref: el => (this.selectEl = el), onClick: this.toggleDropdown, role: "combobox", "aria-expanded": `${this.isOpen}`, "aria-labelledby": this.name }, this.truncatedText), this.isOpen && (h("div", { class: "b2b-dropdown__options", role: "listbox" },
|
|
225
|
+
}, ref: el => (this.selectEl = el), onClick: this.toggleDropdown, role: "combobox", "aria-expanded": `${this.isOpen}`, "aria-labelledby": this.name }, this.truncatedText, this.selectedText && !this.disabled && !this.groupDisabled && (h("b2b-icon-100", { class: "b2b-dropdown__clear-icon", onClick: this.clearSelectedValue, clickable: true, icon: 'b2b_icon-close' })))), this.isOpen && (h("div", { class: "b2b-dropdown__options", role: "listbox" }, filteredOptions.map(option => (h("div", { key: option.value, class: {
|
|
161
226
|
'b2b-dropdown__option': true,
|
|
162
227
|
'b2b-dropdown__option--selected': option.selected,
|
|
163
228
|
'b2b-dropdown__option--disabled': option.disabled,
|
|
@@ -194,6 +259,24 @@ export class DropdownComponent {
|
|
|
194
259
|
"attribute": "label",
|
|
195
260
|
"reflect": false
|
|
196
261
|
},
|
|
262
|
+
"search": {
|
|
263
|
+
"type": "boolean",
|
|
264
|
+
"mutable": false,
|
|
265
|
+
"complexType": {
|
|
266
|
+
"original": "boolean",
|
|
267
|
+
"resolved": "boolean",
|
|
268
|
+
"references": {}
|
|
269
|
+
},
|
|
270
|
+
"required": false,
|
|
271
|
+
"optional": false,
|
|
272
|
+
"docs": {
|
|
273
|
+
"tags": [],
|
|
274
|
+
"text": "Enables the search functionality when set to true within the dropdown. By default search is disabled."
|
|
275
|
+
},
|
|
276
|
+
"attribute": "search",
|
|
277
|
+
"reflect": true,
|
|
278
|
+
"defaultValue": "false"
|
|
279
|
+
},
|
|
197
280
|
"required": {
|
|
198
281
|
"type": "boolean",
|
|
199
282
|
"mutable": false,
|
|
@@ -365,6 +448,7 @@ export class DropdownComponent {
|
|
|
365
448
|
"selectedValue": {},
|
|
366
449
|
"selectedText": {},
|
|
367
450
|
"options": {},
|
|
451
|
+
"searchValue": {},
|
|
368
452
|
"truncatedText": {}
|
|
369
453
|
};
|
|
370
454
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { userEvent } from "@storybook/test";
|
|
2
2
|
import { html } from "lit-html";
|
|
3
3
|
import { getArgTypes } from "../../docs/config/utils";
|
|
4
|
-
const Template = ({ label = 'Favorite Fruit', required, name, disabled, invalid, hint, error, selected = false, }) => {
|
|
4
|
+
const Template = ({ label = 'Favorite Fruit', required, name, disabled, invalid, hint, error, search, selected = false, }) => {
|
|
5
5
|
return html `<b2b-dropdown
|
|
6
6
|
label="${label}"
|
|
7
7
|
name="${name}"
|
|
@@ -9,7 +9,8 @@ const Template = ({ label = 'Favorite Fruit', required, name, disabled, invalid,
|
|
|
9
9
|
hint="${hint}"
|
|
10
10
|
disabled="${disabled}"
|
|
11
11
|
invalid="${invalid}"
|
|
12
|
-
required="${required}"
|
|
12
|
+
required="${required}"
|
|
13
|
+
search="${search}">
|
|
13
14
|
<option value="strawberry">Strawberry</option>
|
|
14
15
|
<option value="orange">Orange</option>
|
|
15
16
|
<option value="banana">Banana</option>
|
|
@@ -33,6 +34,7 @@ const defaultArgs = {
|
|
|
33
34
|
invalid: false,
|
|
34
35
|
hint: 'Pick one',
|
|
35
36
|
error: 'Not that one!',
|
|
37
|
+
search: false,
|
|
36
38
|
};
|
|
37
39
|
export const story010Default = Template.bind({});
|
|
38
40
|
story010Default.args = Object.assign({}, defaultArgs);
|
|
@@ -57,6 +59,9 @@ story050Selected.play = async ({ canvasElement }) => {
|
|
|
57
59
|
await userEvent.click(wrapper);
|
|
58
60
|
}, 500);
|
|
59
61
|
};
|
|
62
|
+
export const story060Search = Template.bind({});
|
|
63
|
+
story060Search.args = Object.assign(Object.assign({}, defaultArgs), { search: true });
|
|
64
|
+
story060Search.storyName = 'Search';
|
|
60
65
|
const dropdownArgs = getArgTypes('b2b-dropdown');
|
|
61
66
|
export default {
|
|
62
67
|
title: 'Components/Form/Dropdown',
|
|
@@ -16,7 +16,7 @@ export class FlyoutMenuOptionComponent {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
render() {
|
|
19
|
-
return (h(Host, { key: '
|
|
19
|
+
return (h(Host, { key: '4064c5827dffd55637271a59061a2c2abb54d3ca', class: {
|
|
20
20
|
'b2b-flyout-menu__option': true,
|
|
21
21
|
'b2b-flyout-menu__option--disabled': this.disabled,
|
|
22
22
|
'b2b-flyout-menu__option--separator': this.separator,
|
|
@@ -144,12 +144,12 @@ export class FlyoutMenuComponent {
|
|
|
144
144
|
options[index].focus();
|
|
145
145
|
}
|
|
146
146
|
render() {
|
|
147
|
-
return (h(Host, { key: '
|
|
147
|
+
return (h(Host, { key: '03efeb4e28ef04b0719b3ade8e52d20cf3046372' }, h("div", { key: 'e2508205d7402d2ed8ef031c8ab5483a6fbdedbd', class: {
|
|
148
148
|
'b2b-flyout-menu': true,
|
|
149
|
-
} }, h("div", { key: '
|
|
149
|
+
} }, h("div", { key: 'c6283f5ebff4ec0962face0e0f440e2cf0ec9ceb', class: "b2b-flyout-menu__trigger" }, h("slot", { key: '303181fa8dac70e463b0efa7fa18a339c84b7009', name: "trigger" })), h("div", { key: 'ff4058c24c1c84c967316569bee8d75d49497eba', onFocusout: this.blurMenu, class: {
|
|
150
150
|
'b2b-flyout-menu__options__container': true,
|
|
151
151
|
'b2b-flyout-menu__options__container--on': this.opened,
|
|
152
|
-
} }, h("div", { key: '
|
|
152
|
+
} }, h("div", { key: '860224aa691a4c06814731aca94d85a762fc806b', class: "b2b-flyout-menu__arrow" }), h("slot", { key: 'be5a754361d59fdbdf5ac934b0d1f5b50de8e3a1', name: "option" })))));
|
|
153
153
|
}
|
|
154
154
|
static get is() { return "b2b-flyout-menu"; }
|
|
155
155
|
static get encapsulation() { return "shadow"; }
|
|
@@ -13,7 +13,7 @@ export class B2bGridColumnComponent {
|
|
|
13
13
|
this.textAlign = 'left';
|
|
14
14
|
}
|
|
15
15
|
render() {
|
|
16
|
-
return (h(Host, { key: '
|
|
16
|
+
return (h(Host, { key: 'e6a06fd72fd364f57b423bdc69cd9c2d4a87d0ca', style: Object.assign(Object.assign({}, this.calculateGrowDimension(this.span)), { ['text-align']: `${this.textAlign}` }) }, h("slot", { key: 'd5785321b8ae17e90fd3aa9e69cc8911430d3e8c' })));
|
|
17
17
|
}
|
|
18
18
|
static get is() { return "b2b-grid-col"; }
|
|
19
19
|
static get encapsulation() { return "shadow"; }
|
|
@@ -4,7 +4,7 @@ export class B2bGridComponent {
|
|
|
4
4
|
this.margin = 24;
|
|
5
5
|
}
|
|
6
6
|
render() {
|
|
7
|
-
return (h(Host, { key: '
|
|
7
|
+
return (h(Host, { key: '0a61abf781f924eb4b88ceb02bece63d2a39f76b', style: { ['padding']: `${this.margin}px` }, class: "b2b-grid" }, h("slot", { key: '02903dbdba9c4973573bac7be02b0e6d3a9cd71a' })));
|
|
8
8
|
}
|
|
9
9
|
static get is() { return "b2b-grid"; }
|
|
10
10
|
static get encapsulation() { return "shadow"; }
|
|
@@ -66,7 +66,7 @@ export class B2bGridRowComponent {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
|
-
return (h(Host, { key: '
|
|
69
|
+
return (h(Host, { key: '60ea771fe5da5fc9aa305824f6718d5f1d687374', style: {
|
|
70
70
|
['justify-content']: `${this.justify}`,
|
|
71
71
|
['gap']: `${this.columnGap}px`,
|
|
72
72
|
['margin']: `${this.rowGap}px 0`,
|
|
@@ -74,7 +74,7 @@ export class B2bGridRowComponent {
|
|
|
74
74
|
['display']: 'flex',
|
|
75
75
|
['flex-wrap']: 'wrap',
|
|
76
76
|
['box-sizing']: 'border-box',
|
|
77
|
-
} }, h("slot", { key: '
|
|
77
|
+
} }, h("slot", { key: 'f38f2b66439b0d8820aa2b25ab88f2c7e02d4ae5' })));
|
|
78
78
|
}
|
|
79
79
|
static get is() { return "b2b-grid-row"; }
|
|
80
80
|
static get encapsulation() { return "shadow"; }
|
|
@@ -98,18 +98,18 @@ export class InputComponent {
|
|
|
98
98
|
this.filterHintSlotContent();
|
|
99
99
|
}
|
|
100
100
|
render() {
|
|
101
|
-
return (h(Host, { key: '
|
|
101
|
+
return (h(Host, { key: '69031aea30430dd03e384611a5f351f9e4411583', class: {
|
|
102
102
|
'b2b-input': true,
|
|
103
103
|
'b2b-input--error': this.invalid && !this.disabled,
|
|
104
|
-
} }, (this.label || this.labelSlot) && (h("b2b-input-label", { id: this.name, required: this.required }, h("slot", { name: "label" }, this.label))), h("div", { key: '
|
|
104
|
+
} }, (this.label || this.labelSlot) && (h("b2b-input-label", { id: this.name, required: this.required }, h("slot", { name: "label" }, this.label))), h("div", { key: '5e17439f86886dd04cf3a0bc42f83e75c060e3d9', class: {
|
|
105
105
|
'b2b-input__wrapper': true,
|
|
106
106
|
'b2b-input__wrapper--focused': this.hasFocus,
|
|
107
107
|
'b2b-input__wrapper--disabled': this.disabled || this.groupDisabled,
|
|
108
|
-
} }, h("slot", { key: '
|
|
108
|
+
} }, h("slot", { key: '69d66dec8cdd7bf0de111e32395812bdee4fe006', name: "start" }), this.hasTextPrefix && h("div", { class: "border" }), h("input", { key: 'e2fd5a7753d9543dc0093dba0a611f653a5862df', class: {
|
|
109
109
|
'b2b-input__native-input': true,
|
|
110
110
|
['b2b-input__native-input--align-' + this.inputTextAlign]: true,
|
|
111
111
|
'b2b-input__native-input--disabled': this.disabled || this.groupDisabled,
|
|
112
|
-
}, "aria-labelledby": this.name, type: this.type, placeholder: this.placeholder, value: this.value, name: this.name, disabled: this.disabled || this.groupDisabled, autoFocus: this.focusOnLoad, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, ref: el => (this.focusableElement = el) }), this.hasTextSuffix && h("div", { class: "border" }), h("slot", { key: '
|
|
112
|
+
}, "aria-labelledby": this.name, type: this.type, placeholder: this.placeholder, value: this.value, name: this.name, disabled: this.disabled || this.groupDisabled, autoFocus: this.focusOnLoad, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, ref: el => (this.focusableElement = el) }), this.hasTextSuffix && h("div", { class: "border" }), h("slot", { key: '28bc5adffc6b4144e87904a9a059fd609661ac75', name: "end" })), (this.hint !== undefined || this.hintSlot) &&
|
|
113
113
|
(!this.invalid || this.disabled || this.groupDisabled) ? (h("span", null, h("slot", { name: "hint" }, this.hint))) : (''), this.error !== undefined && this.invalid && !this.disabled ? (h("span", null, this.error)) : ('')));
|
|
114
114
|
}
|
|
115
115
|
static get is() { return "b2b-input"; }
|
|
@@ -49,7 +49,7 @@ export class B2BInputGroup {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
render() {
|
|
52
|
-
return (h(Host, { key: '
|
|
52
|
+
return (h(Host, { key: 'fa99a4e2f8a5923b14d6304378fc574e8fa0f451' }, h("div", { key: 'ac085ec1ba4ae6566e29192fcf41487a5aeaf2dd', class: { 'b2b-input-wrapper': true } }, h("slot", { key: '9412332e469771720376b5d16b101b21867a29ad', name: "start" }), h("slot", { key: 'eb2201d7243365abd486e6a17c99ba84e942415d' }), h("slot", { key: 'c4d8b4c1b837de6bf80049d8b94e402dbb1e663d', name: "end" })), (this.hint || (this.invalid && !this.disabled)) && (h("span", { class: {
|
|
53
53
|
'b2b-input-wrapper__hint': true,
|
|
54
54
|
'b2b-input-wrapper__hint--error': this.invalid && !this.disabled,
|
|
55
55
|
} }, this.invalid && !this.disabled ? this.error : this.hint))));
|
|
@@ -5,11 +5,11 @@ export class InputLabelComponent {
|
|
|
5
5
|
this.disabled = false;
|
|
6
6
|
}
|
|
7
7
|
render() {
|
|
8
|
-
return (h(Host, { key: '
|
|
8
|
+
return (h(Host, { key: '8cdefd0d3cafc0bdf9dba5fa7a15080a4a288379' }, h("label", { key: '04d4659be8363b1b8760c94e5607a3048e02cebf', class: {
|
|
9
9
|
'b2b-input-label': true,
|
|
10
10
|
'b2b-input-label--required': this.required,
|
|
11
11
|
'b2b-input-label--disabled': this.disabled,
|
|
12
|
-
} }, h("slot", { key: '
|
|
12
|
+
} }, h("slot", { key: 'a858c509020588bb10669c4fa0bc682ba97a5675' }))));
|
|
13
13
|
}
|
|
14
14
|
static get is() { return "b2b-input-label"; }
|
|
15
15
|
static get encapsulation() { return "shadow"; }
|
|
@@ -12,7 +12,7 @@ export class InputListOptionComponent {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (h(Host, { key: '
|
|
15
|
+
return (h(Host, { key: 'e9c7180cdbf328d435b5bcac76e4e11a234d4dcc', class: "b2b-input-list__option", onClick: this.handleClick, role: "option" }, this.option));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "b2b-input-list-option"; }
|
|
18
18
|
static get originalStyleUrls() {
|
|
@@ -7,7 +7,7 @@ describe('B2B-InputList', () => {
|
|
|
7
7
|
search.setProperty('optionsList', optionsList);
|
|
8
8
|
await page.waitForChanges();
|
|
9
9
|
};
|
|
10
|
-
const typeInput = async (key = '
|
|
10
|
+
const typeInput = async (key = 'o') => {
|
|
11
11
|
let input = await page.find('b2b-input-list >>> b2b-input');
|
|
12
12
|
// focus on input element, focus method did not work
|
|
13
13
|
await input.click();
|
|
@@ -62,11 +62,11 @@ describe('B2B-InputList', () => {
|
|
|
62
62
|
it('should not show search list when the input has no value', async () => {
|
|
63
63
|
await setOptionsList();
|
|
64
64
|
const input = await page.find('b2b-input-list');
|
|
65
|
-
// focus on input element, focus method did not work
|
|
66
65
|
await input.click();
|
|
67
|
-
await input.press('
|
|
66
|
+
await input.press('1');
|
|
68
67
|
await page.waitForChanges();
|
|
69
68
|
let searchListResults = await page.find({ text: optionsList[0] });
|
|
69
|
+
expect(searchListResults).not.toBeNull();
|
|
70
70
|
expect(await searchListResults.isVisible()).toBe(true);
|
|
71
71
|
await input.click();
|
|
72
72
|
await input.press('Backspace');
|
|
@@ -105,10 +105,10 @@ describe('B2B-InputList', () => {
|
|
|
105
105
|
});
|
|
106
106
|
it('should fill up input value with option selected', async () => {
|
|
107
107
|
await setOptionsList();
|
|
108
|
-
await typeInput('
|
|
108
|
+
await typeInput('1');
|
|
109
109
|
const input = await page.find('b2b-input-list >>> b2b-input');
|
|
110
110
|
let inputValue = await input.getProperty('value');
|
|
111
|
-
expect(inputValue).toBe('
|
|
111
|
+
expect(inputValue).toBe('1');
|
|
112
112
|
// Click first option on the list
|
|
113
113
|
const option = await page.find({ text: optionsList[0] });
|
|
114
114
|
await option.click();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
|
+
import { parsePropToArray } from "../../utils/json-property-binding-util";
|
|
2
3
|
const keys = {
|
|
3
4
|
ARROW_UP: 'ArrowUp',
|
|
4
5
|
ARROW_DOWN: 'ArrowDown',
|
|
@@ -21,6 +22,11 @@ export class InputListComponent {
|
|
|
21
22
|
// needed to trigger re-render
|
|
22
23
|
this.handleInput = event => {
|
|
23
24
|
this.value = event.detail.value;
|
|
25
|
+
const term = event.target.value.toLowerCase();
|
|
26
|
+
const list = parsePropToArray(this.optionsList);
|
|
27
|
+
this.currentList =
|
|
28
|
+
term === '' ? list : list.filter(o => o.toLowerCase().includes(term));
|
|
29
|
+
this.searchValue = term;
|
|
24
30
|
if (this.value === '' || null || undefined) {
|
|
25
31
|
this.setElementOnBlur();
|
|
26
32
|
}
|
|
@@ -81,7 +87,13 @@ export class InputListComponent {
|
|
|
81
87
|
this.disabled = false;
|
|
82
88
|
this.groupDisabled = false;
|
|
83
89
|
this.hasOptionList = this.optionsList.length > 0;
|
|
90
|
+
this.currentList = [];
|
|
84
91
|
this.isElementFocused = false;
|
|
92
|
+
this.searchValue = '';
|
|
93
|
+
}
|
|
94
|
+
componentWillLoad() {
|
|
95
|
+
this.currentList = parsePropToArray(this.optionsList);
|
|
96
|
+
this.hasOptionList = this.optionsList.length > 0;
|
|
85
97
|
}
|
|
86
98
|
handleKeyDown(event) {
|
|
87
99
|
/** we need to be informed when a user changes focus to the clear button
|
|
@@ -129,6 +141,7 @@ export class InputListComponent {
|
|
|
129
141
|
}
|
|
130
142
|
watchPropHandler(newList) {
|
|
131
143
|
this.hasOptionList = newList.length > 0;
|
|
144
|
+
this.currentList = [...newList];
|
|
132
145
|
}
|
|
133
146
|
/* Notes:
|
|
134
147
|
Needs onFocusin and onFocusout in the Host element so that the click would
|
|
@@ -137,13 +150,13 @@ export class InputListComponent {
|
|
|
137
150
|
*/
|
|
138
151
|
render() {
|
|
139
152
|
const groupOrderClass = this.getGroupOrderClassName() || '';
|
|
140
|
-
return (h(Host, { key: '
|
|
153
|
+
return (h(Host, { key: 'a3b50598632e6a0a796a9eb141f26fe12b29e8be', onBlur: this.setElementOnBlur, onFocus: this.setElementOnFocus }, h("div", { key: '9d7e4f051f2593947ce3cbf5602f6a4a602fbdfc', class: {
|
|
141
154
|
'b2b-input-list': true,
|
|
142
155
|
'b2b-input-list__options-on': this.hasOptionList &&
|
|
143
156
|
this.isElementFocused &&
|
|
144
157
|
Boolean(this.value),
|
|
145
158
|
[groupOrderClass]: true,
|
|
146
|
-
} }, h("b2b-input", { key: '
|
|
159
|
+
} }, h("b2b-input", { key: '654211622b3bc8094ce6b20edd2b3c19f2ac28c3', type: "text", label: this.label, value: this.value, disabled: this.disabled || this.groupDisabled, "onb2b-input": this.handleInput, placeholder: this.placeholder, required: this.required }, !(this.disabled || this.groupDisabled) && Boolean(this.value) && (h("b2b-icon-100", { icon: "b2b_icon-close", "aria-label": "reset", slot: "end", tabIndex: 0, onMouseDown: this.resetInput, onKeyDown: this.resetInput }))), this.isElementFocused && Boolean(this.value) ? (h("div", { class: "b2b-input-list__options-container" }, this.hasOptionList ? (h("div", { class: "b2b-input-list__options", role: "listbox" }, this.currentList.map(option => (h("b2b-input-list-option", { option: option, tabIndex: -1, "onb2b-option-selected": this.onOptionSelected }))))) : (h("slot", null)))) : null)));
|
|
147
160
|
}
|
|
148
161
|
static get is() { return "b2b-input-list"; }
|
|
149
162
|
static get encapsulation() { return "shadow"; }
|
|
@@ -212,11 +225,11 @@ export class InputListComponent {
|
|
|
212
225
|
"reflect": true
|
|
213
226
|
},
|
|
214
227
|
"optionsList": {
|
|
215
|
-
"type": "
|
|
228
|
+
"type": "string",
|
|
216
229
|
"mutable": false,
|
|
217
230
|
"complexType": {
|
|
218
|
-
"original": "string[]",
|
|
219
|
-
"resolved": "string[]",
|
|
231
|
+
"original": "string | string[]",
|
|
232
|
+
"resolved": "string | string[]",
|
|
220
233
|
"references": {}
|
|
221
234
|
},
|
|
222
235
|
"required": false,
|
|
@@ -225,6 +238,8 @@ export class InputListComponent {
|
|
|
225
238
|
"tags": [],
|
|
226
239
|
"text": "The list of options passed into the search dropdown. Can be static or dynamic, i.e. updated when the b2b-search or b2b-input emitters fire."
|
|
227
240
|
},
|
|
241
|
+
"attribute": "options-list",
|
|
242
|
+
"reflect": false,
|
|
228
243
|
"defaultValue": "[]"
|
|
229
244
|
},
|
|
230
245
|
"value": {
|
|
@@ -289,7 +304,9 @@ export class InputListComponent {
|
|
|
289
304
|
static get states() {
|
|
290
305
|
return {
|
|
291
306
|
"hasOptionList": {},
|
|
292
|
-
"
|
|
307
|
+
"currentList": {},
|
|
308
|
+
"isElementFocused": {},
|
|
309
|
+
"searchValue": {}
|
|
293
310
|
};
|
|
294
311
|
}
|
|
295
312
|
static get events() {
|
|
@@ -4,10 +4,10 @@ export class LabelComponent {
|
|
|
4
4
|
this.type = 'neutral';
|
|
5
5
|
}
|
|
6
6
|
render() {
|
|
7
|
-
return (h("span", { key: '
|
|
7
|
+
return (h("span", { key: '86d64389cf254eb3fb56e58c9399087e4d053f5f', class: {
|
|
8
8
|
'b2b-label': true,
|
|
9
9
|
[`b2b-label--${this.type}`]: true,
|
|
10
|
-
} }, h("slot", { key: '
|
|
10
|
+
} }, h("slot", { key: 'd85ee68f76a02a02c4c10e2ef634fdc4c412229a' })));
|
|
11
11
|
}
|
|
12
12
|
static get is() { return "b2b-label"; }
|
|
13
13
|
static get encapsulation() { return "shadow"; }
|
|
@@ -82,10 +82,10 @@ export class ModalComponent {
|
|
|
82
82
|
this.attemptFocus(this.getFirstFocusableElement());
|
|
83
83
|
}
|
|
84
84
|
render() {
|
|
85
|
-
return (h(Host, { key: '
|
|
85
|
+
return (h(Host, { key: 'bea74834a3926bc7efd9100f065eb4a8603e8bd4' }, h("div", { key: '5d5cca368682bcd7de4f77fe05e702b87943f762', class: { 'b2b-modal': true, 'b2b-modal--open': this.opened } }, h("div", { key: 'ba06899cee12d6ef3d3e71a96040daccfdf3b364', "data-focus-trap-edge": true, onFocus: this.handleTopFocus, tabIndex: 0 }), h("div", { key: '0be5c5dcc62576e1662ed7f6185b0ff24afaadc4', class: {
|
|
86
86
|
'b2b-modal__dialog': true,
|
|
87
87
|
[`b2b-modal__dialog--${this.variant}`]: true,
|
|
88
|
-
} }, h("div", { key: '
|
|
88
|
+
} }, h("div", { key: '11b056ce706f572663e3a64cd5115ccc45109190', class: "b2b-modal__dialog__header" }, h("div", { key: '073420de4937e8f18a2172a45eb7088caef4624e', class: "b2b-modal__dialog__header-left" }, h("b2b-headline", { key: '3fdaeaccfd4606560ae82c8cbc8ad8eb65a9dfa8', align: "center", size: "200", noMargin: true }, this.heading), h("slot", { key: 'f280675fcff7e81d1dc6388820f04110de703f8f', name: "header-icon" })), h("div", { key: '6a821204fdce083dfa0267714e1bc438b3dfcd56', class: "b2b-modal__dialog__header-right" }, h("button", { key: 'aa97e6cf511417d3a283017419577e6da8f65fff', type: "button", class: "b2b-modal__dialog__close", onMouseEnter: this.toggleIconHover, onMouseLeave: this.toggleIconHover, onClick: this.handleClickDismiss, ref: el => (this.closeButton = el) }, h("b2b-icon-100", { key: 'c4ff1783dc4d7c7d7b85bc739d0b5154fc60eacb', clickable: true, icon: "b2b_icon-close", color: this.iconHover ? 'primary' : 'secondary' })))), h("div", { key: 'ebf5d6a280718bf7f4c98e41846dea91dbde6943', class: "b2b-modal__dialog__body" }, h("slot", { key: 'b9b1b56a4b45760e88f6cb7e54281cd468137ccc' })), h("div", { key: 'ff0f612d9581c5f5bd48bd99699b1fc1348a577a', class: "b2b-modal__dialog__footer" }, h("div", { key: 'bf034c403f883695a72bd5ee0ec7a6b5c40f6ef1', class: "b2b-modal__dialog__footer-left" }, h("slot", { key: '52a6a99d0a722bf37c8659290ceaec53d5acc546', name: "footer-left" })), h("div", { key: '5d5a6786dfe6708cb17ca37e92c0f5c4366b6e0c', class: "b2b-modal__dialog__footer-right" }, h("slot", { key: '37f62cb0bf38031673f53f7ef2578e2c5c5219f9', name: "footer-right" })))), h("div", { key: 'b0eb907e93024c42e2b3668316f51b1e6b7d5aa3', "data-focus-trap-edge": true, onFocus: this.handleBottomFocus, tabIndex: 0 }), h("div", { key: '6d6762fb11007e46c3d3872ab208e40aa0e28d4a', class: "b2b-modal__backdrop", onClick: this.handleBackdropDismiss }))));
|
|
89
89
|
}
|
|
90
90
|
static get is() { return "b2b-modal"; }
|
|
91
91
|
static get encapsulation() { return "shadow"; }
|
|
@@ -207,16 +207,16 @@ export class B2bMultiSelectDropdown {
|
|
|
207
207
|
const hasError = this.invalid && !disabled;
|
|
208
208
|
const showHint = this.hint && !hasError;
|
|
209
209
|
const showError = this.errorMessage && hasError;
|
|
210
|
-
return (h(Host, { key: '
|
|
210
|
+
return (h(Host, { key: '67df2c8968bd816fdd57b9e1c0b3dcd37f9bc401', onFocus: this.setElementOnFocus, onBlur: this.setElementOnBlur, onClick: this.handleMouseDown, onKeyDown: this.handleKeyDown }, h("b2b-input-label", { key: '32d25f1327ffab15969ca4dcb4faa953bf9923c3', required: this.required }, this.label), h("div", { key: 'b4d0182e211f6aab9c3061eeffccdd1ceddbf03a', class: {
|
|
211
211
|
'b2b-multiselect-dropdown': true,
|
|
212
212
|
'b2b-multiselect-dropdown--open': this.isOpen,
|
|
213
213
|
'b2b-multiselect-dropdown--error': hasError,
|
|
214
214
|
'b2b-multiselect-dropdown--disabled': disabled,
|
|
215
215
|
'b2b-multiselect-dropdown--focused': this.invalid && this.isElementFocused,
|
|
216
|
-
}, tabindex: 0, role: "combobox", onClick: () => (this.isOpen = !this.isOpen && !disabled), "aria-expanded": this.isElementFocused }, h("div", { key: '
|
|
216
|
+
}, tabindex: 0, role: "combobox", onClick: () => (this.isOpen = !this.isOpen && !disabled), "aria-expanded": this.isElementFocused }, h("div", { key: 'b6a69e9160fa5869d06cc2fc1f6f2d56c8964114', 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: '99a6b2e5baba4598a46f328e808b06e6e4b9d725', icon: "b2b_icon-arrow-down" })), h("div", { key: '0de344aa373d4ca82bf716df966448e95b5717f8', class: {
|
|
217
217
|
'b2b-multiselect-dropdown__options-container': true,
|
|
218
218
|
'b2b-multiselect-dropdown__options-container--visible': this.isOpen,
|
|
219
|
-
} }, h("div", { key: '
|
|
219
|
+
} }, h("div", { key: '53e6ef0829f30ab13e0441eb54118b19835ce353', class: "b2b-multiselect-dropdown__options", role: "listbox", "aria-label": this.label, tabIndex: -1 }, h("div", { key: 'eb30f1caec191fb6021c172fae01ccf30e7d4f68', class: "b2b-multiselect-dropdown__option__search" }, h("input", { key: '7b29fd3710eb4fecc9dc8d3c29dfae60ec3ea375', type: "text", onInput: this.handleInput, class: "b2b-multiselect-dropdown__option__search__input", placeholder: this.searchPlaceholder })), h("b2b-multiselect-option", { key: '9efd9cac0ef3c2c9d61d32292bbf5ade76991996', class: "b2b-multiselect-dropdown__option__select-all", option: this.selectAllLabel, id: "select-all", "onB2b-option-selected": this.handleSelectAll }), this.hasOptionList &&
|
|
220
220
|
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))));
|
|
221
221
|
}
|
|
222
222
|
static get is() { return "b2b-multiselect-dropdown"; }
|
package/dist/collection/components/multiselect-dropdown/multiselect-option/multiselect-option.js
CHANGED
|
@@ -15,9 +15,9 @@ export class B2bMultiSelectOption {
|
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
var _a;
|
|
18
|
-
return (h(Host, { key: '
|
|
18
|
+
return (h(Host, { key: 'f1a1faa0a97e00af9fbfa291aba3c53ea92ad44c', role: "option", class: {
|
|
19
19
|
'b2b-multiselect-dropdown__option': true,
|
|
20
|
-
} }, h("b2b-checkbox", { key: '
|
|
20
|
+
} }, h("b2b-checkbox", { key: '251ccb65111ecb72b57c19786df65a11a1432ab7', checked: this.selected, "onB2b-change": this.handleCheckboxChange, label: (_a = this.label) !== null && _a !== void 0 ? _a : this.option, indeterminate: this.indeterminate, value: this.option })));
|
|
21
21
|
}
|
|
22
22
|
static get is() { return "b2b-multiselect-option"; }
|
|
23
23
|
static get originalStyleUrls() {
|
|
@@ -91,7 +91,7 @@ export class PaginationComponent {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
render() {
|
|
94
|
-
return (h("nav", { key: '
|
|
94
|
+
return (h("nav", { key: '88eb108790c1be9f974f7c88f602afa2ee35f1e9' }, h("ol", { key: '19a0fff8f2ac83913593530d921e8915e496400b', class: "b2b-pagination" }, this.activePage !== 1 && (h("li", { class: "b2b-pagination--previous" }, h("b2b-button", { onClick: this.selectPreviousPage, size: "50", variant: "secondary", "aria-label": this.ariaLabelPreviousPage }, "\u2039" /* PaginationConstants.BACK */))), this.navItems.map((navItem, index) => {
|
|
95
95
|
const isItemActive = this.activePage === navItem;
|
|
96
96
|
return (h("li", { class: this.getItemClass(navItem) }, h("b2b-button", { onClick: () => this.setSelectedPage(navItem, index), active: isItemActive, disabled: isItemActive, size: "50", variant: "secondary" }, navItem)));
|
|
97
97
|
}), this.activePage !== this.totalPages && (h("li", { class: "b2b-pagination--next" }, h("b2b-button", { onClick: this.selectNextPage, size: "50", variant: "secondary", "aria-label": this.ariaLabelNextPage }, "\u203A" /* PaginationConstants.NEXT */))))));
|
|
@@ -17,11 +17,11 @@ export class ProgressBarComponent {
|
|
|
17
17
|
}
|
|
18
18
|
render() {
|
|
19
19
|
const labelExists = this.label !== undefined && this.label !== '';
|
|
20
|
-
return (h(Host, { key: '
|
|
20
|
+
return (h(Host, { key: 'b0060404440e78b3a2331df11a2d56d4071c7e19' }, h("div", { key: '031bd2160763920981cd6491bc1099636f3c21fd', class: {
|
|
21
21
|
[`b2b-progress-bar__${this.labelPosition}-${this.labelType}`]: true,
|
|
22
|
-
} }, h("div", { key: '
|
|
22
|
+
} }, h("div", { key: '945e5c7bf601cd8d34b0cd095245a8cc6b801cea', class: "b2b-progress-bar__wrapper" }, h("div", { key: '93086dd441221a8ff681d9de2da8ff2f2d4ae0b5', class: "b2b-progress-bar__progress", style: {
|
|
23
23
|
width: `${this.getProgress()}%`,
|
|
24
|
-
} })), h("div", { key: '
|
|
24
|
+
} })), h("div", { key: '82ce3cabe0897878d2715ca96a07ba8347f42590', class: {
|
|
25
25
|
'b2b-progress-bar__label': labelExists,
|
|
26
26
|
'b2b-progress-bar__label-none': !labelExists,
|
|
27
27
|
[`b2b-progress-bar__label__${this.labelPosition}-${this.labelType}`]: labelExists,
|
|
@@ -53,11 +53,11 @@ export class B2bRadioButtonComponent {
|
|
|
53
53
|
return Array.from(document.querySelectorAll(`b2b-radio-button[name="${this.name}"]`)).filter((radio) => radio.value !== this.value);
|
|
54
54
|
}
|
|
55
55
|
render() {
|
|
56
|
-
return (h(Host, { key: '
|
|
56
|
+
return (h(Host, { key: 'fd1084fd2df24d7de2727441f69c03f9aa497f22', onClick: this.onClick }, h("div", { key: 'a4d0e872905049f686a1d70a883aba37bc7b3823', class: {
|
|
57
57
|
'b2b-radio': true,
|
|
58
58
|
'b2b-radio--error': this.invalid && !this.disabled,
|
|
59
59
|
'b2b-radio--disabled': this.disabled,
|
|
60
|
-
} }, h("div", { key: '
|
|
60
|
+
} }, h("div", { key: 'e334d57a546380ae10aad7bd6c8c1688650d5107', class: "b2b-radio-items" }, h("input", { key: '20b59620275ef3c93ecec45c4c84fd8098ce47dc', class: "b2b-radio-input", "aria-labelledby": this.name, type: "radio", checked: this.checked, disabled: this.disabled, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, value: this.value }), h("b2b-input-label", { key: '71e1468f0d8046d9c80cb0bb159081a772e2b871', id: this.name, required: this.required, disabled: this.disabled }, h("slot", { key: '00b2e6022ff3cc78ef450d7a7611f08e6a5d0adb', name: "label" }, this.label))), (this.hint !== undefined && !this.invalid) ||
|
|
61
61
|
(this.hint !== undefined && this.disabled) ? (h("span", null, this.hint)) : (''), this.error !== undefined && this.invalid && !this.disabled ? (h("span", null, this.error)) : (''))));
|
|
62
62
|
}
|
|
63
63
|
static get is() { return "b2b-radio-button"; }
|