Skip to content

Commit d1fc124

Browse files
authored
refactor!: make item content part a flex container (#10613)
1 parent 4352526 commit d1fc124

File tree

11 files changed

+49
-23
lines changed

11 files changed

+49
-23
lines changed

packages/item/src/styles/vaadin-item-base-styles.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const itemStyles = css`
1313
box-sizing: border-box;
1414
cursor: var(--vaadin-clickable-cursor);
1515
display: flex;
16-
gap: var(--vaadin-item-gap, 0 var(--vaadin-gap-s));
16+
column-gap: var(--vaadin-item-gap, var(--vaadin-gap-s));
1717
height: var(--vaadin-item-height, auto);
1818
padding: var(--vaadin-item-padding, var(--vaadin-padding-block-container) var(--vaadin-padding-inline-container));
1919
-webkit-tap-highlight-color: transparent;
@@ -55,6 +55,10 @@ export const itemStyles = css`
5555
5656
[part='content'] {
5757
flex: 1;
58+
display: flex;
59+
align-items: center;
60+
column-gap: inherit;
61+
justify-content: var(--vaadin-item-text-align, start);
5862
}
5963
6064
@media (forced-colors: active) {

packages/item/test/item.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ describe('vaadin-item', () => {
3737
expect(slot.parentElement).to.equal(content);
3838
});
3939

40-
it('should have a block context for content part', () => {
40+
it('should have a flex container for content part', () => {
4141
const content = item.shadowRoot.querySelector('[part="content"]');
42-
expect(getComputedStyle(content).display).to.equal('block');
42+
expect(getComputedStyle(content).display).to.equal('flex');
4343
});
4444
});
-11 Bytes
Loading
-29 Bytes
Loading
0 Bytes
Loading
-6 Bytes
Loading
-31 Bytes
Loading
0 Bytes
Loading

packages/select/src/styles/vaadin-select-base-styles.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,44 @@ export const selectStyles = css`
3939
:host([readonly]) [part~='toggle-button'] {
4040
display: none;
4141
}
42+
43+
:host([theme~='align-start']) {
44+
--vaadin-item-text-align: start;
45+
}
46+
47+
:host([theme~='align-center']) {
48+
--vaadin-item-text-align: center;
49+
}
50+
51+
:host([theme~='align-end']) {
52+
--vaadin-item-text-align: end;
53+
}
54+
55+
:host([theme~='align-left']) {
56+
--vaadin-item-text-align: left;
57+
}
58+
59+
:host([theme~='align-right']) {
60+
--vaadin-item-text-align: right;
61+
}
62+
63+
:host([theme~='align-start']) ::slotted([slot='value']) {
64+
justify-content: start;
65+
}
66+
67+
:host([theme~='align-center']) ::slotted([slot='value']) {
68+
justify-content: center;
69+
}
70+
71+
:host([theme~='align-end']) ::slotted([slot='value']) {
72+
justify-content: end;
73+
}
74+
75+
:host([theme~='align-left']) ::slotted([slot='value']) {
76+
justify-content: left;
77+
}
78+
79+
:host([theme~='align-right']) ::slotted([slot='value']) {
80+
justify-content: right;
81+
}
4282
`;

packages/select/src/styles/vaadin-select-overlay-base-styles.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,4 @@ export const selectOverlayStyles = css`
2222
[part='backdrop'] {
2323
background: transparent;
2424
}
25-
26-
:host([theme~='align-start']) [part='overlay'] {
27-
text-align: start;
28-
}
29-
30-
:host([theme~='align-center']) [part='overlay'] {
31-
text-align: center;
32-
}
33-
34-
:host([theme~='align-end']) [part='overlay'] {
35-
text-align: end;
36-
}
37-
38-
:host([theme~='align-left']) [part='overlay'] {
39-
text-align: left;
40-
}
41-
42-
:host([theme~='align-right']) [part='overlay'] {
43-
text-align: right;
44-
}
4525
`;

0 commit comments

Comments
 (0)