@otto-de/b2b-core-components 1.24.0 → 1.26.1
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-01a5c813.entry.js +1 -0
- package/dist/b2b-core-components/p-225e561a.entry.js +1 -0
- package/dist/b2b-core-components/p-4d96ee04.entry.js +1 -0
- package/dist/b2b-core-components/p-51dab4f2.entry.js +1 -0
- package/dist/b2b-core-components/p-5c576b32.entry.js +1 -0
- package/dist/b2b-core-components/p-9e3d9908.entry.js +1 -0
- package/dist/b2b-core-components/p-c305ae21.entry.js +1 -0
- package/dist/b2b-core-components/p-e73552ea.entry.js +1 -0
- package/dist/cjs/b2b-background-box.cjs.entry.js +5 -5
- package/dist/cjs/b2b-core-components.cjs.js +1 -1
- package/dist/cjs/b2b-date-picker.cjs.entry.js +2 -1
- package/dist/cjs/b2b-dropdown.cjs.entry.js +12 -3
- package/dist/cjs/b2b-grid-row.cjs.entry.js +77 -11
- package/dist/cjs/b2b-input-group_2.cjs.entry.js +1 -1
- package/dist/cjs/b2b-input_2.cjs.entry.js +27 -6
- package/dist/cjs/b2b-multiselect-dropdown.cjs.entry.js +4 -4
- package/dist/cjs/b2b-snackbar.cjs.entry.js +5 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/alert/alert.css +2 -2
- package/dist/collection/components/alert/alert.stories.js +1 -2
- package/dist/collection/components/anchor/anchor.css +2 -2
- package/dist/collection/components/background-box/background-box.css +6 -6
- package/dist/collection/components/background-box/background-box.e2e.js +3 -3
- package/dist/collection/components/background-box/background-box.js +7 -7
- package/dist/collection/components/background-box/background-box.spec.js +3 -3
- package/dist/collection/components/background-box/background-box.stories.js +18 -18
- package/dist/collection/components/breadcrumb/breadcrumb.css +2 -2
- package/dist/collection/components/button/button.css +2 -2
- package/dist/collection/components/button/button.stories.js +79 -79
- package/dist/collection/components/card/card.css +2 -2
- package/dist/collection/components/checkbox/checkbox.css +2 -2
- package/dist/collection/components/checkbox-group/checkbox-group.css +2 -2
- package/dist/collection/components/chip/chip.css +2 -2
- package/dist/collection/components/chip/chip.stories.js +15 -15
- package/dist/collection/components/date-picker/date-picker-days-header.css +2 -2
- package/dist/collection/components/date-picker/date-picker-days.css +2 -2
- package/dist/collection/components/date-picker/date-picker-header.css +2 -2
- package/dist/collection/components/date-picker/date-picker-months.css +2 -2
- package/dist/collection/components/date-picker/date-picker-years.css +2 -2
- package/dist/collection/components/date-picker/date-picker.css +2 -2
- package/dist/collection/components/date-picker/date-picker.js +20 -1
- package/dist/collection/components/date-picker/date-picker.stories.js +4 -1
- package/dist/collection/components/dropdown/dropdown.css +4 -4
- package/dist/collection/components/dropdown/dropdown.js +47 -2
- package/dist/collection/components/flyout-menu/flyout-menu-option.css +2 -2
- package/dist/collection/components/flyout-menu/flyout-menu.css +2 -2
- package/dist/collection/components/flyout-menu/flyout-menu.stories.js +44 -44
- package/dist/collection/components/grid/grid.stories.js +151 -148
- package/dist/collection/components/grid/row.js +77 -11
- package/dist/collection/components/headline/headline.css +2 -2
- package/dist/collection/components/icon/icon.css +2 -2
- package/dist/collection/components/icon-100/icon-100.css +2 -2
- package/dist/collection/components/icon-100/icon-100.stories.js +5 -5
- package/dist/collection/components/icon-50/icon-50.css +2 -2
- package/dist/collection/components/icon-50/icon-50.stories.js +4 -4
- package/dist/collection/components/input/input.css +3 -3
- package/dist/collection/components/input/input.e2e.js +28 -0
- package/dist/collection/components/input/input.js +26 -5
- package/dist/collection/components/input/input.stories.js +75 -55
- package/dist/collection/components/input-group/input-group.css +3 -3
- package/dist/collection/components/input-list/input-list.css +2 -2
- package/dist/collection/components/input-list/input-list.stories.js +50 -50
- package/dist/collection/components/label/label.css +2 -2
- package/dist/collection/components/modal/modal.css +2 -2
- package/dist/collection/components/modal/modal.stories.js +1 -1
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.css +2 -2
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.js +4 -4
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.stories.js +19 -19
- package/dist/collection/components/pagination/pagination.css +2 -2
- package/dist/collection/components/paragraph/paragraph.css +2 -2
- package/dist/collection/components/paragraph/paragraph.stories.js +82 -78
- package/dist/collection/components/progress-bar/progress-bar.css +2 -2
- package/dist/collection/components/progress-bar/progress-bar.stories.js +4 -4
- package/dist/collection/components/radio/radio.css +2 -2
- package/dist/collection/components/radio-group/radio-group.css +2 -2
- package/dist/collection/components/required-separator/required-separator.css +2 -2
- package/dist/collection/components/rounded-icon/rounded-icon.css +2 -2
- package/dist/collection/components/scrollable-container/scrollable-container.css +2 -2
- package/dist/collection/components/separator/separator.css +2 -2
- package/dist/collection/components/shimmer/shimmer.css +2 -2
- package/dist/collection/components/snackbar/snackbar.css +2 -2
- package/dist/collection/components/snackbar/snackbar.js +22 -4
- package/dist/collection/components/snackbar/snackbar.stories.js +10 -2
- package/dist/collection/components/spinner/spinner.css +2 -2
- package/dist/collection/components/tab/tab.css +2 -2
- package/dist/collection/components/tab-panel/tab-panel.css +2 -2
- package/dist/collection/components/table/table-cell/table-cell.css +2 -2
- package/dist/collection/components/table/table-header/table-header.css +2 -2
- package/dist/collection/components/table/table-row/table-row.css +2 -2
- package/dist/collection/components/table/table-rowgroup/table-rowgroup.css +2 -2
- package/dist/collection/components/table/table.css +2 -2
- package/dist/collection/components/table/table.e2e.js +2 -1
- package/dist/collection/components/table/table.stories.js +157 -157
- package/dist/collection/components/textarea/textarea.css +2 -2
- package/dist/collection/components/toggle-button/toggle-button.css +2 -2
- package/dist/collection/components/toggle-chip/toggle-chip.css +2 -2
- package/dist/collection/components/toggle-chip/toggle-chip.stories.js +14 -2
- package/dist/collection/components/toggle-group/toggle-group.css +2 -2
- package/dist/collection/components/toggle-switch/toggle-switch.css +2 -2
- package/dist/collection/components/toggle-switch/toggle-switch.stories.js +4 -4
- package/dist/collection/components/tooltip/tooltip.css +2 -2
- package/dist/collection/components/wizard/wizard.css +2 -2
- package/dist/collection/components/wizard-icon/wizard-icon.css +2 -2
- package/dist/components/b2b-background-box.js +6 -6
- package/dist/components/b2b-date-picker.js +23 -15
- package/dist/components/b2b-dropdown.js +14 -3
- package/dist/components/b2b-grid-row.js +77 -11
- package/dist/components/b2b-multiselect-dropdown.js +4 -4
- package/dist/components/b2b-snackbar.js +7 -5
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.js +27 -6
- package/dist/custom-elements.json +18 -2
- package/dist/esm/b2b-background-box.entry.js +5 -5
- package/dist/esm/b2b-core-components.js +1 -1
- package/dist/esm/b2b-date-picker.entry.js +2 -1
- package/dist/esm/b2b-dropdown.entry.js +12 -3
- package/dist/esm/b2b-grid-row.entry.js +77 -11
- package/dist/esm/b2b-input-group_2.entry.js +1 -1
- package/dist/esm/b2b-input_2.entry.js +27 -6
- package/dist/esm/b2b-multiselect-dropdown.entry.js +4 -4
- package/dist/esm/b2b-snackbar.entry.js +5 -4
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/background-box/background-box.d.ts +2 -2
- package/dist/types/components/background-box/background-box.stories.d.ts +1 -1
- package/dist/types/components/button/button.stories.d.ts +2 -2
- package/dist/types/components/date-picker/date-picker.d.ts +2 -0
- package/dist/types/components/dropdown/dropdown.d.ts +4 -0
- package/dist/types/components/grid/row.d.ts +4 -0
- package/dist/types/components/icon/icon.stories.d.ts +3 -3
- package/dist/types/components/input/input.d.ts +4 -0
- package/dist/types/components/input/input.stories.d.ts +1 -0
- package/dist/types/components/snackbar/snackbar.d.ts +2 -0
- package/dist/types/components/snackbar/snackbar.stories.d.ts +1 -0
- package/dist/types/components/toggle-chip/toggle-chip.stories.d.ts +3 -2
- package/dist/types/components.d.ts +36 -4
- package/dist/web-types.json +42 -3
- package/package.json +21 -16
- package/dist/b2b-core-components/p-191b7d0b.entry.js +0 -1
- package/dist/b2b-core-components/p-2b5b4472.entry.js +0 -1
- package/dist/b2b-core-components/p-333969c9.entry.js +0 -1
- package/dist/b2b-core-components/p-339dd3ba.entry.js +0 -1
- package/dist/b2b-core-components/p-56293400.entry.js +0 -1
- package/dist/b2b-core-components/p-95d3519f.entry.js +0 -1
- package/dist/b2b-core-components/p-be5c3d5d.entry.js +0 -1
- package/dist/b2b-core-components/p-fdfdc92d.entry.js +0 -1
|
@@ -9,36 +9,102 @@ export class B2bGridRowComponent {
|
|
|
9
9
|
componentDidLoad() {
|
|
10
10
|
this.adjustColumnFlex();
|
|
11
11
|
}
|
|
12
|
+
calculateRowsAndsSpaceForColumnsWithSpan(columns, currentRowTotal, rows, currentRow) {
|
|
13
|
+
columns.forEach(column => {
|
|
14
|
+
let span = parseInt(column.getAttribute('span'), 10);
|
|
15
|
+
if (currentRowTotal + span > 12) {
|
|
16
|
+
rows.push(currentRow);
|
|
17
|
+
currentRow = [];
|
|
18
|
+
currentRowTotal = 0;
|
|
19
|
+
}
|
|
20
|
+
currentRow.push(column);
|
|
21
|
+
currentRowTotal += span;
|
|
22
|
+
});
|
|
23
|
+
if (currentRow.length > 0) {
|
|
24
|
+
rows.push(currentRow);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
adjustColumnFlex() {
|
|
13
28
|
const columns = this.hostElement.querySelectorAll(':scope > b2b-grid-col');
|
|
14
29
|
let totalSpan = 0;
|
|
15
30
|
let columnsWithoutSpan = [];
|
|
31
|
+
let columnsWithSpan = [];
|
|
16
32
|
columns.forEach((column) => {
|
|
17
33
|
const span = column.getAttribute('span');
|
|
18
34
|
if (span) {
|
|
19
35
|
totalSpan += parseInt(span, 10);
|
|
36
|
+
columnsWithSpan.push(column);
|
|
20
37
|
}
|
|
21
38
|
else {
|
|
22
39
|
columnsWithoutSpan.push(column);
|
|
23
40
|
}
|
|
24
41
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
columnsWithoutSpan.forEach(column => {
|
|
28
|
-
column.style.width = '100%';
|
|
29
|
-
});
|
|
42
|
+
if (totalSpan > 12 && columnsWithoutSpan.length === 0) {
|
|
43
|
+
this.handleOverflowingColumns(columnsWithSpan);
|
|
30
44
|
return;
|
|
31
45
|
}
|
|
32
46
|
if (columnsWithoutSpan.length > 0) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
this.handleRowsWithColumnsWithoutSpan(columnsWithoutSpan, columnsWithSpan, totalSpan);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (totalSpan < 12 && columnsWithoutSpan.length === 0) {
|
|
51
|
+
this.handleNonOverflowingColumnsWithSpan(columnsWithSpan);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
handleNonOverflowingColumnsWithSpan(columnsWithSpan) {
|
|
56
|
+
columnsWithSpan.forEach(column => {
|
|
57
|
+
let span = parseInt(column.getAttribute('span'), 10);
|
|
58
|
+
let widthPercentage = (span / 12) * 100;
|
|
59
|
+
column.style.flex = `0 0 calc(${widthPercentage}% - ${this.columnGap}px)`;
|
|
60
|
+
column.style.maxWidth = `calc(${widthPercentage}% - ${this.columnGap}px)`;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
handleOverflowingColumns(columns) {
|
|
64
|
+
let rows = [];
|
|
65
|
+
let currentRow = [];
|
|
66
|
+
let currentRowTotal = 0;
|
|
67
|
+
this.calculateRowsAndsSpaceForColumnsWithSpan(columns, currentRowTotal, rows, currentRow);
|
|
68
|
+
rows.forEach(row => {
|
|
69
|
+
row.forEach(column => {
|
|
70
|
+
let span = parseInt(column.getAttribute('span'), 10);
|
|
71
|
+
let widthPercentage = (span / 12) * 100;
|
|
72
|
+
column.style.flex = `0 0 calc(${widthPercentage}% - ${this.columnGap}px)`;
|
|
73
|
+
column.style.maxWidth = `calc(${widthPercentage}% - ${this.columnGap}px)`;
|
|
37
74
|
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
handleRowsWithColumnsWithoutSpan(columnsWithoutSpan, columnsWithSpan, totalSpan) {
|
|
78
|
+
let remainingSpan = 12 - totalSpan <= 0 ? 12 : 12 - totalSpan;
|
|
79
|
+
let rows = [];
|
|
80
|
+
let currentRow = [];
|
|
81
|
+
let currentRowTotal = 0;
|
|
82
|
+
this.calculateRowsAndsSpaceForColumnsWithSpan(columnsWithSpan, currentRowTotal, rows, currentRow);
|
|
83
|
+
columnsWithoutSpan.forEach(column => {
|
|
84
|
+
let spanPerColumn = Math.max(1, Math.floor(remainingSpan / columnsWithoutSpan.length));
|
|
85
|
+
if (currentRowTotal + spanPerColumn > 12) {
|
|
86
|
+
rows.push(currentRow);
|
|
87
|
+
currentRow = [];
|
|
88
|
+
currentRowTotal = 0;
|
|
89
|
+
}
|
|
90
|
+
column.setAttribute('span', spanPerColumn.toString());
|
|
91
|
+
currentRow.push(column);
|
|
92
|
+
currentRowTotal += spanPerColumn;
|
|
93
|
+
});
|
|
94
|
+
if (currentRow.length > 0) {
|
|
95
|
+
rows.push(currentRow);
|
|
38
96
|
}
|
|
97
|
+
rows.forEach(row => {
|
|
98
|
+
row.forEach(column => {
|
|
99
|
+
let span = parseInt(column.getAttribute('span'), 10) || 1;
|
|
100
|
+
let widthPercentage = (span / 12) * 100;
|
|
101
|
+
column.style.flex = `0 0 calc(${widthPercentage}% - ${this.columnGap}px)`;
|
|
102
|
+
column.style.maxWidth = `calc(${widthPercentage}% - ${this.columnGap}px)`;
|
|
103
|
+
});
|
|
104
|
+
});
|
|
39
105
|
}
|
|
40
106
|
render() {
|
|
41
|
-
return (h(Host, { key: '
|
|
107
|
+
return (h(Host, { key: 'da13d7265983cb9a8e70b43c0f7e152912b8e353', style: {
|
|
42
108
|
['justify-content']: `${this.justify}`,
|
|
43
109
|
['gap']: `${this.columnGap}px`,
|
|
44
110
|
['margin']: `${this.rowGap}px 0`,
|
|
@@ -46,7 +112,7 @@ export class B2bGridRowComponent {
|
|
|
46
112
|
['display']: 'flex',
|
|
47
113
|
['flex-wrap']: 'wrap',
|
|
48
114
|
['box-sizing']: 'border-box',
|
|
49
|
-
} }, h("slot", { key: '
|
|
115
|
+
} }, h("slot", { key: 'b0be12c2eeda9cf109875a17e1509755960f1e65' })));
|
|
50
116
|
}
|
|
51
117
|
static get is() { return "b2b-grid-row"; }
|
|
52
118
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -33,11 +33,11 @@ const meta = {
|
|
|
33
33
|
render: (_a) => {
|
|
34
34
|
var args = __rest(_a, []);
|
|
35
35
|
return html `<b2b-icon-100
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
icon="${args.icon}"
|
|
37
|
+
color="${args.color}"
|
|
38
|
+
size="${args.size}"
|
|
39
|
+
clickable="${args.clickable}"
|
|
40
|
+
focusable="${args.focusable}"></b2b-icon-100>`;
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
export default meta;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -32,10 +32,10 @@ const meta = {
|
|
|
32
32
|
render: (_a) => {
|
|
33
33
|
var args = __rest(_a, []);
|
|
34
34
|
return html `<b2b-icon-50
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
icon="${args.icon}"
|
|
36
|
+
color="${args.color}"
|
|
37
|
+
clickable="${args.clickable}"
|
|
38
|
+
focusable="${args.focusable}"></b2b-icon-50>`;
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
export default meta;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
:host(.b2b-input--error) span {
|
|
316
316
|
color: var(--b2b-color-error-100);
|
|
317
317
|
}
|
|
318
|
-
::slotted(span) {
|
|
318
|
+
::slotted(span:not([slot=hint], [slot=label])) {
|
|
319
319
|
font-size: var(--b2b-size-copy-100);
|
|
320
320
|
cursor: default;
|
|
321
321
|
user-select: none;
|
|
@@ -50,4 +50,32 @@ describe('B2B-Input', () => {
|
|
|
50
50
|
const labelElement = await slotPage.find('span');
|
|
51
51
|
expect(labelElement).toEqualText('Label Slot');
|
|
52
52
|
});
|
|
53
|
+
it('should use hint slot when provided', async () => {
|
|
54
|
+
const slotPage = await newE2EPage();
|
|
55
|
+
await slotPage.setContent(`
|
|
56
|
+
<b2b-input>
|
|
57
|
+
<span slot="hint">Hint Slot<b2b-anchor href="https://example.com">Hello World!</b2b-anchor></span>
|
|
58
|
+
</b2b-input>
|
|
59
|
+
`);
|
|
60
|
+
await slotPage.waitForChanges();
|
|
61
|
+
const outerHTML = await slotPage.evaluate(() => {
|
|
62
|
+
const span = document.querySelector('span[slot="hint"]');
|
|
63
|
+
return span.outerHTML;
|
|
64
|
+
});
|
|
65
|
+
expect(outerHTML).toBe('<span slot="hint">Hint Slot<b2b-anchor href="https://example.com" class="hydrated">Hello World!</b2b-anchor></span>');
|
|
66
|
+
});
|
|
67
|
+
it('should not display unsupported elements in the hint slot', async () => {
|
|
68
|
+
const slotPage = await newE2EPage();
|
|
69
|
+
await slotPage.setContent(`
|
|
70
|
+
<b2b-input>
|
|
71
|
+
<span slot="hint">Hint Slot<div>This should be removed</div></span>
|
|
72
|
+
</b2b-input>
|
|
73
|
+
`);
|
|
74
|
+
await slotPage.waitForChanges();
|
|
75
|
+
const outerHTML = await slotPage.evaluate(() => {
|
|
76
|
+
const span = document.querySelector('span[slot="hint"]');
|
|
77
|
+
return span.outerHTML;
|
|
78
|
+
});
|
|
79
|
+
expect(outerHTML).toBe('<span slot="hint">Hint Slot</span>');
|
|
80
|
+
});
|
|
53
81
|
});
|
|
@@ -75,23 +75,44 @@ export class InputComponent {
|
|
|
75
75
|
}
|
|
76
76
|
this.getSlottedText();
|
|
77
77
|
}
|
|
78
|
+
processHintSlotContent() {
|
|
79
|
+
if (this.hintSlot === null || this.hintSlot === undefined)
|
|
80
|
+
return;
|
|
81
|
+
const disallowedElements = this.hintSlot.querySelectorAll(':not(b2b-anchor, b, strong, i, em, span)');
|
|
82
|
+
disallowedElements.forEach(element => {
|
|
83
|
+
if (element.nodeType === Node.ELEMENT_NODE) {
|
|
84
|
+
element.remove();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
filterHintSlotContent() {
|
|
89
|
+
this.processHintSlotContent();
|
|
90
|
+
if (this.hintSlot !== null && this.hintSlot !== undefined) {
|
|
91
|
+
const observer = new MutationObserver(() => this.processHintSlotContent());
|
|
92
|
+
observer.observe(this.hintSlot, { childList: true, subtree: true });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
78
95
|
componentWillLoad() {
|
|
79
96
|
this.labelSlot = this.hostElement.querySelector('[slot="label"]');
|
|
97
|
+
this.hintSlot = this.hostElement.querySelector('[slot="hint"]');
|
|
98
|
+
}
|
|
99
|
+
componentDidLoad() {
|
|
100
|
+
this.filterHintSlotContent();
|
|
80
101
|
}
|
|
81
102
|
render() {
|
|
82
|
-
return (h(Host, { key: '
|
|
103
|
+
return (h(Host, { key: '8d1ca422e0a614f9fdd808c5be225c1e5f20393d', class: {
|
|
83
104
|
'b2b-input': true,
|
|
84
105
|
'b2b-input--error': this.invalid && !this.disabled,
|
|
85
|
-
} }, (this.label || this.labelSlot) && (h("b2b-input-label", { id: this.name, required: this.required }, h("slot", { name: "label" }, this.label))), h("div", { key: '
|
|
106
|
+
} }, (this.label || this.labelSlot) && (h("b2b-input-label", { id: this.name, required: this.required }, h("slot", { name: "label" }, this.label))), h("div", { key: '9a0881a2659bd4cd165be43b62e082c6e54d78d4', class: {
|
|
86
107
|
'b2b-input__wrapper': true,
|
|
87
108
|
'b2b-input__wrapper--focused': this.hasFocus,
|
|
88
109
|
'b2b-input__wrapper--disabled': this.disabled || this.groupDisabled,
|
|
89
|
-
} }, h("slot", { key: '
|
|
110
|
+
} }, h("slot", { key: '5e64fdbdf8c4f2c206f2796510b4a91af4cc0b4d', name: "start" }), this.hasTextPrefix && h("div", { class: "border" }), h("input", { key: 'a661e9b0e1553aa28bb0151f917041b57b42f07a', class: {
|
|
90
111
|
'b2b-input__native-input': true,
|
|
91
112
|
['b2b-input__native-input--align-' + this.inputTextAlign]: true,
|
|
92
113
|
'b2b-input__native-input--disabled': this.disabled,
|
|
93
|
-
}, "aria-labelledby": this.name, type: this.type, placeholder: this.placeholder, value: this.value, name: this.name, disabled: this.disabled || this.groupDisabled, autoFocus: this.autofocus, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, ref: el => (this.focusableElement = el) }), this.hasTextSuffix && h("div", { class: "border" }), h("slot", { key: '
|
|
94
|
-
(this.
|
|
114
|
+
}, "aria-labelledby": this.name, type: this.type, placeholder: this.placeholder, value: this.value, name: this.name, disabled: this.disabled || this.groupDisabled, autoFocus: this.autofocus, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, ref: el => (this.focusableElement = el) }), this.hasTextSuffix && h("div", { class: "border" }), h("slot", { key: 'cb32fe135408274018be0b800d0b2321756c0c9c', name: "end" })), (this.hint !== undefined || this.hintSlot) &&
|
|
115
|
+
(!this.invalid || this.disabled) ? (h("span", null, h("slot", { name: "hint" }, this.hint))) : (''), this.error !== undefined && this.invalid && !this.disabled ? (h("span", null, this.error)) : ('')));
|
|
95
116
|
}
|
|
96
117
|
static get is() { return "b2b-input"; }
|
|
97
118
|
static get encapsulation() { return "shadow"; }
|
|
@@ -32,19 +32,19 @@ const meta = {
|
|
|
32
32
|
render: (_a) => {
|
|
33
33
|
var args = __rest(_a, []);
|
|
34
34
|
return html `<div style="width: 400px;">
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
<b2b-input
|
|
36
|
+
label="${args.label}"
|
|
37
|
+
required="${args.required}"
|
|
38
|
+
type="${args.defaultType}"
|
|
39
|
+
disabled="${args.disabled}"
|
|
40
|
+
placeholder="${args.placeholder}"
|
|
41
|
+
value="${args.value}"
|
|
42
|
+
hint="${args.hint}"
|
|
43
|
+
error="${args.error}"
|
|
44
|
+
autofocus="${args.autofocus}"
|
|
45
|
+
invalid=${args.invalid}
|
|
46
|
+
input-text-align="${args.inputTextAlign}"></b2b-input>
|
|
47
|
+
</div>`;
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
50
|
export default meta;
|
|
@@ -71,20 +71,20 @@ export const Prefix = {
|
|
|
71
71
|
render: (_a) => {
|
|
72
72
|
var args = __rest(_a, []);
|
|
73
73
|
return html `<div style="width: 400px;">
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
<b2b-input
|
|
75
|
+
label="${args.label}"
|
|
76
|
+
required="${args.required}"
|
|
77
|
+
type="${args.type}"
|
|
78
|
+
disabled="${args.disabled}"
|
|
79
|
+
placeholder="${args.placeholder}"
|
|
80
|
+
value="${args.value}"
|
|
81
|
+
hint="${args.hint}"
|
|
82
|
+
error="${args.error}"
|
|
83
|
+
autofocus="${args.autofocus}"
|
|
84
|
+
invalid=${args.invalid}
|
|
85
|
+
><span slot="start">Registration Number</span></b2b-input
|
|
86
|
+
>
|
|
87
|
+
</div>`;
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
90
|
export const Suffix = {
|
|
@@ -113,21 +113,21 @@ export const PrefixAndSuffix = {
|
|
|
113
113
|
render: (_a) => {
|
|
114
114
|
var args = __rest(_a, []);
|
|
115
115
|
return html `<div style="width: 400px;">
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
<b2b-input
|
|
117
|
+
label="${args.label}"
|
|
118
|
+
required="${args.required}"
|
|
119
|
+
type="${args.type}"
|
|
120
|
+
disabled="${args.disabled}"
|
|
121
|
+
placeholder="${args.placeholder}"
|
|
122
|
+
value="${args.value}"
|
|
123
|
+
hint="${args.hint}"
|
|
124
|
+
error="${args.error}"
|
|
125
|
+
autofocus="${args.autofocus}"
|
|
126
|
+
invalid=${args.invalid}>
|
|
127
|
+
<b2b-icon-100 icon="b2b_icon-search" slot="start"></b2b-icon-100
|
|
128
|
+
><span slot="end">Registration Number</span></b2b-input
|
|
129
|
+
>
|
|
130
|
+
</div>`;
|
|
131
131
|
},
|
|
132
132
|
};
|
|
133
133
|
export const Label = {
|
|
@@ -135,19 +135,39 @@ export const Label = {
|
|
|
135
135
|
render: (_a) => {
|
|
136
136
|
var args = __rest(_a, []);
|
|
137
137
|
return html `<div style="width: 400px;">
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
<b2b-input
|
|
139
|
+
required="${args.required}"
|
|
140
|
+
type="${args.type}"
|
|
141
|
+
disabled="${args.disabled}"
|
|
142
|
+
placeholder="${args.placeholder}"
|
|
143
|
+
value="${args.value}"
|
|
144
|
+
hint="${args.hint}"
|
|
145
|
+
error="${args.error}"
|
|
146
|
+
autofocus="${args.autofocus}"
|
|
147
|
+
invalid=${args.invalid}
|
|
148
|
+
><span slot="label">Custom label</span></b2b-input
|
|
149
|
+
>
|
|
150
|
+
</div>`;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
export const HintSlot = {
|
|
154
|
+
args: Object.assign({}, meta.args),
|
|
155
|
+
render: (_a) => {
|
|
156
|
+
var args = __rest(_a, []);
|
|
157
|
+
return html `<div style="width: 400px;">
|
|
158
|
+
<b2b-input
|
|
159
|
+
label="${args.label}"
|
|
160
|
+
required="${args.required}"
|
|
161
|
+
type="${args.type}"
|
|
162
|
+
disabled="${args.disabled}"
|
|
163
|
+
placeholder="${args.placeholder}"
|
|
164
|
+
value="${args.value}"
|
|
165
|
+
error="${args.error}"
|
|
166
|
+
autofocus="${args.autofocus}"
|
|
167
|
+
invalid=${args.invalid}
|
|
168
|
+
><span slot="hint">Custom hint</span></b2b-input
|
|
169
|
+
>
|
|
170
|
+
</div>`;
|
|
151
171
|
},
|
|
152
172
|
};
|
|
153
173
|
export const AllPropertiesSpecified = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
font-size: var(--b2b-size-copy-50);
|
|
228
228
|
line-height: var(--b2b-size-copy-line-height-75);
|
|
229
229
|
display: block;
|
|
230
|
-
margin-top: var(--b2b-size-
|
|
230
|
+
margin-top: var(--b2b-size-7);
|
|
231
231
|
color: var(--b2b-color-grey-300);
|
|
232
232
|
}
|
|
233
233
|
:host .b2b-input-wrapper__hint--error {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu,
|
|
3
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
4
4
|
*/
|
|
5
5
|
:root, :host {
|
|
6
6
|
--b2b-size-200: 5rem; /* 80px */
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Do not edit directly
|
|
126
|
-
* Generated on Thu,
|
|
126
|
+
* Generated on Thu, 20 Mar 2025 12:45:50 GMT
|
|
127
127
|
*/
|
|
128
128
|
:root [data-theme="dark"] {
|
|
129
129
|
--b2b-size-200: 5rem; /* 80px */
|