@vaadin/button 25.0.0-alpha1 → 25.0.0-alpha11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/button",
3
- "version": "25.0.0-alpha1",
3
+ "version": "25.0.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,9 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/vaadin-button-base-styles.d.ts",
25
- "!src/vaadin-button-base-styles.js",
26
- "theme",
27
24
  "vaadin-*.d.ts",
28
25
  "vaadin-*.js",
29
26
  "web-types.json",
@@ -37,22 +34,23 @@
37
34
  ],
38
35
  "dependencies": {
39
36
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha1",
41
- "@vaadin/component-base": "25.0.0-alpha1",
42
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
43
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
37
+ "@vaadin/a11y-base": "25.0.0-alpha11",
38
+ "@vaadin/component-base": "25.0.0-alpha11",
39
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
44
40
  "lit": "^3.0.0"
45
41
  },
46
42
  "devDependencies": {
47
- "@vaadin/chai-plugins": "25.0.0-alpha1",
48
- "@vaadin/icon": "25.0.0-alpha1",
49
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
50
- "@vaadin/testing-helpers": "^1.1.0",
43
+ "@vaadin/chai-plugins": "25.0.0-alpha11",
44
+ "@vaadin/icon": "25.0.0-alpha11",
45
+ "@vaadin/icons": "25.0.0-alpha11",
46
+ "@vaadin/test-runner-commands": "25.0.0-alpha11",
47
+ "@vaadin/testing-helpers": "^2.0.0",
48
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
51
49
  "sinon": "^18.0.0"
52
50
  },
53
51
  "web-types": [
54
52
  "web-types.json",
55
53
  "web-types.lit.json"
56
54
  ],
57
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
55
+ "gitHead": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
58
56
  }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const buttonStyles = css`
10
+ :host {
11
+ display: inline-flex;
12
+ align-items: center;
13
+ justify-content: center;
14
+ text-align: center;
15
+ gap: var(--vaadin-button-gap, 0 var(--vaadin-gap-container-inline));
16
+ white-space: nowrap;
17
+ -webkit-tap-highlight-color: transparent;
18
+ -webkit-user-select: none;
19
+ user-select: none;
20
+ cursor: var(--vaadin-clickable-cursor);
21
+ box-sizing: border-box;
22
+ vertical-align: middle;
23
+ flex-shrink: 0;
24
+ height: var(--vaadin-button-height, auto);
25
+ margin: var(--vaadin-button-margin, 0);
26
+ padding: var(--vaadin-button-padding, var(--vaadin-padding-container));
27
+ font-family: var(--vaadin-button-font-family, inherit);
28
+ font-size: var(--vaadin-button-font-size, inherit);
29
+ line-height: var(--vaadin-button-line-height, inherit);
30
+ font-weight: var(--vaadin-button-font-weight, 500);
31
+ color: var(--vaadin-button-text-color, var(--vaadin-color));
32
+ background: var(--vaadin-button-background, var(--vaadin-background-container));
33
+ background-origin: border-box;
34
+ border: var(
35
+ --vaadin-button-border,
36
+ var(--vaadin-button-border-width, 1px) solid var(--vaadin-button-border-color, var(--vaadin-border-color))
37
+ );
38
+ border-radius: var(--vaadin-button-border-radius, var(--vaadin-radius-m));
39
+ touch-action: manipulation;
40
+ }
41
+
42
+ :host([hidden]) {
43
+ display: none !important;
44
+ }
45
+
46
+ .vaadin-button-container,
47
+ [part='prefix'],
48
+ [part='suffix'],
49
+ [part='label'] {
50
+ display: contents;
51
+ }
52
+
53
+ :host(:is([focus-ring], :focus-visible)) {
54
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
55
+ outline-offset: 1px;
56
+ }
57
+
58
+ :host([theme~='primary']) {
59
+ --vaadin-button-background: var(--vaadin-color);
60
+ --vaadin-button-text-color: var(--vaadin-background-color);
61
+ --vaadin-button-border-color: transparent;
62
+ }
63
+
64
+ :host([theme~='tertiary']) {
65
+ --vaadin-button-text-color: var(--_vaadin-button-text-color);
66
+ --vaadin-button-background: transparent;
67
+ --vaadin-button-border-color: transparent;
68
+ }
69
+
70
+ :host([disabled]) {
71
+ pointer-events: var(--_vaadin-button-disabled-pointer-events, none);
72
+ cursor: var(--vaadin-disabled-cursor);
73
+ opacity: 0.5;
74
+ }
75
+
76
+ :host([disabled][theme~='primary']) {
77
+ --vaadin-button-text-color: var(--vaadin-background-container-strong);
78
+ --vaadin-button-background: var(--vaadin-color-disabled);
79
+ }
80
+
81
+ @media (forced-colors: active) {
82
+ :host {
83
+ --vaadin-button-border-width: 1px;
84
+ --vaadin-button-background: ButtonFace;
85
+ --vaadin-button-text-color: ButtonText;
86
+ }
87
+
88
+ :host([theme~='primary']) {
89
+ forced-color-adjust: none;
90
+ --vaadin-button-background: CanvasText;
91
+ --vaadin-button-text-color: Canvas;
92
+ --vaadin-icon-color: Canvas;
93
+ }
94
+
95
+ ::slotted(*) {
96
+ forced-color-adjust: auto;
97
+ }
98
+
99
+ :host([disabled]) {
100
+ --vaadin-button-background: transparent !important;
101
+ --vaadin-button-border-color: GrayText !important;
102
+ --vaadin-button-text-color: GrayText !important;
103
+ opacity: 1;
104
+ }
105
+ }
106
+ `;
@@ -8,8 +8,9 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
10
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
11
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
11
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import { buttonStyles } from './vaadin-button-core-styles.js';
13
+ import { buttonStyles } from './styles/vaadin-button-base-styles.js';
13
14
  import { ButtonMixin } from './vaadin-button-mixin.js';
14
15
 
15
16
  /**
@@ -46,7 +47,7 @@ import { ButtonMixin } from './vaadin-button-mixin.js';
46
47
  * @mixes ElementMixin
47
48
  * @mixes ThemableMixin
48
49
  */
49
- class Button extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
50
+ class Button extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
50
51
  static get is() {
51
52
  return 'vaadin-button';
52
53
  }
package/vaadin-button.js CHANGED
@@ -1,3 +1,3 @@
1
- import './theme/lumo/vaadin-button.js';
1
+ import './src/vaadin-button.js';
2
2
 
3
3
  export * from './src/vaadin-button.js';
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/button",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/button",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,72 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { css } from 'lit';
7
-
8
- export const buttonStyles = css`
9
- :host {
10
- display: inline-block;
11
- position: relative;
12
- outline: none;
13
- white-space: nowrap;
14
- -webkit-user-select: none;
15
- user-select: none;
16
- }
17
-
18
- :host([hidden]) {
19
- display: none !important;
20
- }
21
-
22
- :host([disabled]) {
23
- pointer-events: var(--_vaadin-button-disabled-pointer-events, none);
24
- cursor: not-allowed;
25
- }
26
-
27
- /* Aligns the button with form fields when placed on the same line.
28
- Note, to make it work, the form fields should have the same "::before" pseudo-element. */
29
- .vaadin-button-container::before {
30
- content: '\\2003';
31
- display: inline-block;
32
- width: 0;
33
- max-height: 100%;
34
- }
35
-
36
- .vaadin-button-container {
37
- display: inline-flex;
38
- align-items: center;
39
- justify-content: center;
40
- text-align: center;
41
- width: 100%;
42
- height: 100%;
43
- min-height: inherit;
44
- text-shadow: inherit;
45
- }
46
-
47
- [part='prefix'],
48
- [part='suffix'] {
49
- flex: none;
50
- }
51
-
52
- [part='label'] {
53
- white-space: nowrap;
54
- overflow: hidden;
55
- text-overflow: ellipsis;
56
- }
57
-
58
- @media (forced-colors: active) {
59
- :host {
60
- outline: 1px solid;
61
- outline-offset: -1px;
62
- }
63
-
64
- :host([focused]) {
65
- outline-width: 2px;
66
- }
67
-
68
- :host([disabled]) {
69
- outline-color: GrayText;
70
- }
71
- }
72
- `;
@@ -1,7 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/sizing.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
5
- import '@vaadin/vaadin-lumo-styles/typography.js';
6
- declare const button: import("lit").CSSResult;
7
- export { button };
@@ -1,287 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/sizing.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
5
- import '@vaadin/vaadin-lumo-styles/typography.js';
6
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
-
8
- const button = css`
9
- :host {
10
- /* Sizing */
11
- --lumo-button-size: var(--lumo-size-m);
12
- min-width: var(--vaadin-button-min-width, calc(var(--_button-size) * 2));
13
- height: var(--_button-size);
14
- padding: var(--vaadin-button-padding, 0 calc(var(--_button-size) / 3 + var(--lumo-border-radius-m) / 2));
15
- margin: var(--vaadin-button-margin, var(--lumo-space-xs) 0);
16
- box-sizing: border-box;
17
- /* Style */
18
- font-family: var(--lumo-font-family);
19
- font-size: var(--vaadin-button-font-size, var(--lumo-font-size-m));
20
- font-weight: var(--vaadin-button-font-weight, 500);
21
- color: var(--_lumo-button-text-color);
22
- background: var(--_lumo-button-background);
23
- border: var(--vaadin-button-border, none);
24
- border-radius: var(--vaadin-button-border-radius, var(--lumo-border-radius-m));
25
- cursor: var(--lumo-clickable-cursor);
26
- -webkit-tap-highlight-color: transparent;
27
- -webkit-font-smoothing: antialiased;
28
- -moz-osx-font-smoothing: grayscale;
29
- flex-shrink: 0;
30
- --_button-size: var(--vaadin-button-height, var(--lumo-button-size));
31
- --_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
32
- --_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
33
- /* Used by notification */
34
- --_lumo-button-background: var(--vaadin-button-background, var(--lumo-contrast-5pct));
35
- --_lumo-button-text-color: var(--vaadin-button-text-color, var(--lumo-primary-text-color));
36
- --_lumo-button-primary-background: var(--vaadin-button-primary-background, var(--lumo-primary-color));
37
- --_lumo-button-primary-text-color: var(--vaadin-button-primary-text-color, var(--lumo-primary-contrast-color));
38
- }
39
-
40
- /* Set only for the internal parts so we don't affect the host vertical alignment */
41
- [part='label'],
42
- [part='prefix'],
43
- [part='suffix'] {
44
- line-height: var(--lumo-line-height-xs);
45
- }
46
-
47
- [part='label'] {
48
- padding: calc(var(--lumo-button-size) / 6) 0;
49
- }
50
-
51
- :host([theme~='small']) {
52
- font-size: var(--lumo-font-size-s);
53
- --lumo-button-size: var(--lumo-size-s);
54
- }
55
-
56
- :host([theme~='large']) {
57
- font-size: var(--lumo-font-size-l);
58
- --lumo-button-size: var(--lumo-size-l);
59
- }
60
-
61
- /* For interaction states */
62
- :host::before,
63
- :host::after {
64
- content: '';
65
- /* We rely on the host always being relative */
66
- position: absolute;
67
- z-index: 1;
68
- inset: 0;
69
- background-color: currentColor;
70
- border-radius: inherit;
71
- opacity: 0;
72
- pointer-events: none;
73
- }
74
-
75
- /* Hover */
76
-
77
- @media (any-hover: hover) {
78
- :host(:not([disabled]):hover)::before {
79
- opacity: 0.02;
80
- }
81
- }
82
-
83
- /* Active */
84
-
85
- :host::after {
86
- transition:
87
- opacity 1.4s,
88
- transform 0.1s;
89
- filter: blur(8px);
90
- }
91
-
92
- :host([active])::before {
93
- opacity: 0.05;
94
- transition-duration: 0s;
95
- }
96
-
97
- :host([active])::after {
98
- opacity: 0.1;
99
- transition-duration: 0s, 0s;
100
- transform: scale(0);
101
- }
102
-
103
- /* Keyboard focus */
104
-
105
- :host([focus-ring]) {
106
- box-shadow:
107
- 0 0 0 calc(1px * var(--_focus-ring-gap-on, 0)) var(--_focus-ring-gap-color, var(--lumo-base-color)),
108
- 0 0 0 calc(var(--_focus-ring-width) + 1px * var(--_focus-ring-gap-on, 0)) var(--_focus-ring-color);
109
- }
110
-
111
- :host([theme~='primary'][focus-ring]) {
112
- --_focus-ring-gap-on: 1;
113
- }
114
-
115
- /* Types (primary, tertiary, tertiary-inline */
116
-
117
- :host([theme~='tertiary']),
118
- :host([theme~='tertiary-inline']) {
119
- --_background: transparent !important;
120
- background: var(--vaadin-button-tertiary-background, var(--_background));
121
- min-width: 0;
122
- }
123
-
124
- :host([theme~='tertiary']) {
125
- border: var(--vaadin-button-tertiary-border, none);
126
- color: var(--vaadin-button-tertiary-text-color, var(--lumo-primary-text-color));
127
- font-weight: var(--vaadin-button-tertiary-font-weight, 500);
128
- padding: var(--vaadin-button-tertiary-padding, 0 calc(var(--_button-size) / 6));
129
- }
130
-
131
- :host([theme~='tertiary-inline'])::before {
132
- display: none;
133
- }
134
-
135
- :host([theme~='tertiary-inline']) {
136
- margin: 0;
137
- height: auto;
138
- padding: 0;
139
- line-height: inherit;
140
- font-size: inherit;
141
- }
142
-
143
- :host([theme~='tertiary-inline']) [part='label'] {
144
- padding: 0;
145
- overflow: visible;
146
- line-height: inherit;
147
- }
148
-
149
- :host([theme~='primary']) {
150
- background: var(--_lumo-button-primary-background);
151
- border: var(--vaadin-button-primary-border, none);
152
- color: var(--_lumo-button-primary-text-color);
153
- font-weight: var(--vaadin-button-primary-font-weight, 600);
154
- min-width: calc(var(--lumo-button-size) * 2.5);
155
- }
156
-
157
- :host([theme~='primary'])::before {
158
- background-color: black;
159
- }
160
-
161
- @media (any-hover: hover) {
162
- :host([theme~='primary']:not([disabled]):hover)::before {
163
- opacity: 0.05;
164
- }
165
- }
166
-
167
- :host([theme~='primary'][active])::before {
168
- opacity: 0.1;
169
- }
170
-
171
- :host([theme~='primary'][active])::after {
172
- opacity: 0.2;
173
- }
174
-
175
- /* Colors (success, warning, error, contrast) */
176
-
177
- :host([theme~='success']) {
178
- color: var(--lumo-success-text-color);
179
- }
180
-
181
- :host([theme~='success'][theme~='primary']) {
182
- background-color: var(--lumo-success-color);
183
- color: var(--lumo-success-contrast-color);
184
- }
185
-
186
- :host([theme~='warning']) {
187
- color: var(--lumo-warning-text-color);
188
- }
189
-
190
- :host([theme~='warning'][theme~='primary']) {
191
- background-color: var(--lumo-warning-color);
192
- color: var(--lumo-warning-contrast-color);
193
- }
194
-
195
- :host([theme~='error']) {
196
- color: var(--lumo-error-text-color);
197
- }
198
-
199
- :host([theme~='error'][theme~='primary']) {
200
- background-color: var(--lumo-error-color);
201
- color: var(--lumo-error-contrast-color);
202
- }
203
-
204
- :host([theme~='contrast']) {
205
- color: var(--lumo-contrast);
206
- }
207
-
208
- :host([theme~='contrast'][theme~='primary']) {
209
- background-color: var(--lumo-contrast);
210
- color: var(--lumo-base-color);
211
- }
212
-
213
- /* Disabled state. Keep selectors after other color variants. */
214
-
215
- :host([disabled]) {
216
- color: var(--lumo-disabled-text-color);
217
- }
218
-
219
- :host([theme~='primary'][disabled]) {
220
- background-color: var(--lumo-contrast-30pct);
221
- color: var(--lumo-base-color);
222
- }
223
-
224
- :host([theme~='primary'][disabled]) [part] {
225
- opacity: 0.7;
226
- }
227
-
228
- /* Icons */
229
-
230
- [part] ::slotted(vaadin-icon) {
231
- display: inline-block;
232
- width: var(--lumo-icon-size-m);
233
- height: var(--lumo-icon-size-m);
234
- }
235
-
236
- /* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
237
- [part] ::slotted(vaadin-icon[icon^='vaadin:']) {
238
- padding: 0.25em;
239
- box-sizing: border-box !important;
240
- }
241
-
242
- [part='prefix'] {
243
- margin-left: -0.25em;
244
- margin-right: 0.25em;
245
- }
246
-
247
- [part='suffix'] {
248
- margin-left: 0.25em;
249
- margin-right: -0.25em;
250
- }
251
-
252
- /* Icon-only */
253
-
254
- :host([theme~='icon']:not([theme~='tertiary-inline'])) {
255
- min-width: var(--lumo-button-size);
256
- padding-left: calc(var(--lumo-button-size) / 4);
257
- padding-right: calc(var(--lumo-button-size) / 4);
258
- }
259
-
260
- :host([theme~='icon']) [part='prefix'],
261
- :host([theme~='icon']) [part='suffix'] {
262
- margin-left: 0;
263
- margin-right: 0;
264
- }
265
-
266
- /* RTL specific styles */
267
-
268
- :host([dir='rtl']) [part='prefix'] {
269
- margin-left: 0.25em;
270
- margin-right: -0.25em;
271
- }
272
-
273
- :host([dir='rtl']) [part='suffix'] {
274
- margin-left: -0.25em;
275
- margin-right: 0.25em;
276
- }
277
-
278
- :host([dir='rtl'][theme~='icon']) [part='prefix'],
279
- :host([dir='rtl'][theme~='icon']) [part='suffix'] {
280
- margin-left: 0;
281
- margin-right: 0;
282
- }
283
- `;
284
-
285
- registerStyles('vaadin-button', button, { moduleId: 'lumo-button' });
286
-
287
- export { button };
@@ -1,2 +0,0 @@
1
- import './vaadin-button-styles.js';
2
- import '../../src/vaadin-button.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-button-styles.js';
2
- import '../../src/vaadin-button.js';