Skip to content

Commit 9ca78f7

Browse files
authored
refactor: move message-input icon variant from base styles to Aura (#10187)
1 parent d70d60d commit 9ca78f7

File tree

7 files changed

+29
-49
lines changed

7 files changed

+29
-49
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
vaadin-message-input vaadin-text-area::part(input-field) {
22
--vaadin-input-field-background: transparent;
33
}
4+
5+
vaadin-message-input[theme~='icon-button'] vaadin-message-input-button {
6+
width: var(--vaadin-icon-size, 1lh);
7+
height: var(--vaadin-icon-size, 1lh);
8+
color: transparent;
9+
position: relative;
10+
contain: strict;
11+
}
12+
13+
vaadin-message-input[theme~='icon-button'] vaadin-message-input-button::before {
14+
content: '';
15+
position: absolute;
16+
inset: 0;
17+
mask-image: var(--_vaadin-icon-paper-airplane);
18+
background: var(--vaadin-button-text-color);
19+
}
20+
21+
vaadin-message-input[theme~='icon-button'][dir='rtl'] vaadin-message-input-button::before {
22+
scale: -1;
23+
}
24+
25+
@media (forced-colors: active) {
26+
vaadin-message-input[theme~='icon-button'] vaadin-message-input-button {
27+
forced-color-adjust: none;
28+
--vaadin-button-text-color: CanvasText;
29+
}
30+
}

packages/message-input/src/styles/vaadin-message-input-button-styles.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,4 @@ export const messageInputButtonStyles = css`
1616
--vaadin-button-text-color: var(--vaadin-color);
1717
--vaadin-button-padding: 0;
1818
}
19-
20-
:host([theme~='icon-button']) {
21-
width: var(--vaadin-icon-size, 1lh);
22-
height: var(--vaadin-icon-size, 1lh);
23-
color: transparent;
24-
position: relative;
25-
contain: strict;
26-
}
27-
28-
:host([theme~='icon-button'])::before {
29-
content: '';
30-
position: absolute;
31-
inset: 0;
32-
mask-image: var(--_vaadin-icon-paper-airplane);
33-
background: var(--vaadin-button-text-color);
34-
}
35-
36-
:host([dir='rtl'][theme~='icon-button'])::before {
37-
scale: -1;
38-
}
39-
40-
@media (forced-colors: active) {
41-
:host([theme~='icon-button']) {
42-
forced-color-adjust: none;
43-
--vaadin-button-text-color: CanvasText;
44-
}
45-
}
4619
`;

packages/message-input/src/vaadin-message-input-mixin.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const MessageInputMixin = (superClass) =>
5656

5757
static get observers() {
5858
return [
59-
'__buttonPropsChanged(_button, disabled, _theme, __effectiveI18n)',
59+
'__buttonPropsChanged(_button, disabled, __effectiveI18n)',
6060
'__textAreaPropsChanged(_textArea, disabled, __effectiveI18n, value)',
6161
];
6262
}
@@ -134,19 +134,10 @@ export const MessageInputMixin = (superClass) =>
134134
}
135135

136136
/** @private */
137-
__buttonPropsChanged(button, disabled, theme, effectiveI18n) {
137+
__buttonPropsChanged(button, disabled, effectiveI18n) {
138138
if (button) {
139139
button.disabled = disabled;
140140
button.textContent = effectiveI18n.send;
141-
142-
// Only set theme attribute on the default button
143-
if (button === this._buttonController.defaultNode) {
144-
if (theme) {
145-
button.setAttribute('theme', theme);
146-
} else {
147-
button.removeAttribute('theme');
148-
}
149-
}
150141
}
151142
}
152143

packages/message-input/test/dom/message-input.test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,4 @@ describe('vaadin-message-input', () => {
2020
input.disabled = true;
2121
await expect(input).dom.to.equalSnapshot();
2222
});
23-
24-
it('theme', async () => {
25-
input.setAttribute('theme', 'icon-only');
26-
await nextUpdate(input);
27-
await expect(input).dom.to.equalSnapshot();
28-
});
2923
});

packages/message-input/test/visual/base/message-input.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ describe('message-input', () => {
4747
await sendKeys({ press: 'Tab' });
4848
await visualDiff(div, `${dir}-button-focused`);
4949
});
50-
51-
it('icon-button variant', async () => {
52-
element.setAttribute('theme', 'icon-button');
53-
await visualDiff(div, `${dir}-icon-button`);
54-
});
5550
});
5651
});
5752
});
-1.97 KB
Binary file not shown.
-1.98 KB
Binary file not shown.

0 commit comments

Comments
 (0)