@vaadin/button 24.8.0-alpha9 → 25.0.0-alpha1

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/README.md CHANGED
@@ -28,29 +28,6 @@ Once installed, import the component in your application:
28
28
  import '@vaadin/button';
29
29
  ```
30
30
 
31
- ## Themes
32
-
33
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
34
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/button/vaadin-button.js) of the package uses the Lumo theme.
35
-
36
- To use the Material theme, import the component from the `theme/material` folder:
37
-
38
- ```js
39
- import '@vaadin/button/theme/material/vaadin-button.js';
40
- ```
41
-
42
- You can also import the Lumo version of the component explicitly:
43
-
44
- ```js
45
- import '@vaadin/button/theme/lumo/vaadin-button.js';
46
- ```
47
-
48
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
49
-
50
- ```js
51
- import '@vaadin/button/src/vaadin-button.js';
52
- ```
53
-
54
31
  ## Contributing
55
32
 
56
33
  Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/button",
3
- "version": "24.8.0-alpha9",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
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",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -35,18 +37,16 @@
35
37
  ],
36
38
  "dependencies": {
37
39
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "24.8.0-alpha9",
40
- "@vaadin/component-base": "24.8.0-alpha9",
41
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha9",
42
- "@vaadin/vaadin-material-styles": "24.8.0-alpha9",
43
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
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",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@vaadin/chai-plugins": "24.8.0-alpha9",
48
- "@vaadin/icon": "24.8.0-alpha9",
49
- "@vaadin/test-runner-commands": "24.8.0-alpha9",
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
50
  "@vaadin/testing-helpers": "^1.1.0",
51
51
  "sinon": "^18.0.0"
52
52
  },
@@ -54,5 +54,5 @@
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770"
57
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
58
58
  }
@@ -3,4 +3,6 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- export * from './vaadin-button.js';
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const buttonStyles: CSSResult;
@@ -70,18 +70,3 @@ export const buttonStyles = css`
70
70
  }
71
71
  }
72
72
  `;
73
-
74
- export const buttonTemplate = (html) => html`
75
- <div class="vaadin-button-container">
76
- <span part="prefix" aria-hidden="true">
77
- <slot name="prefix"></slot>
78
- </span>
79
- <span part="label">
80
- <slot></slot>
81
- </span>
82
- <span part="suffix" aria-hidden="true">
83
- <slot name="suffix"></slot>
84
- </span>
85
- </div>
86
- <slot name="tooltip"></slot>
87
- `;
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
8
  import { ButtonMixin } from './vaadin-button-mixin.js';
@@ -36,7 +35,7 @@ import { ButtonMixin } from './vaadin-button-mixin.js';
36
35
  *
37
36
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
38
37
  */
39
- declare class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {
38
+ declare class Button extends ButtonMixin(ElementMixin(ThemableMixin(HTMLElement))) {
40
39
  /**
41
40
  * When disabled, the button is rendered as "dimmed" and prevents all
42
41
  * user interactions (mouse and keyboard).
@@ -3,17 +3,15 @@
3
3
  * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
6
+ import { html, LitElement } from 'lit';
8
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
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 { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import { buttonStyles, buttonTemplate } from './vaadin-button-base.js';
11
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
+ import { buttonStyles } from './vaadin-button-core-styles.js';
13
13
  import { ButtonMixin } from './vaadin-button-mixin.js';
14
14
 
15
- registerStyles('vaadin-button', buttonStyles, { moduleId: 'vaadin-button-styles' });
16
-
17
15
  /**
18
16
  * `<vaadin-button>` is an accessible and customizable button that allows users to perform actions.
19
17
  *
@@ -45,11 +43,18 @@ registerStyles('vaadin-button', buttonStyles, { moduleId: 'vaadin-button-styles'
45
43
  * @customElement
46
44
  * @extends HTMLElement
47
45
  * @mixes ButtonMixin
48
- * @mixes ControllerMixin
49
46
  * @mixes ElementMixin
50
47
  * @mixes ThemableMixin
51
48
  */
52
- class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
49
+ class Button extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
50
+ static get is() {
51
+ return 'vaadin-button';
52
+ }
53
+
54
+ static get styles() {
55
+ return buttonStyles;
56
+ }
57
+
53
58
  static get properties() {
54
59
  return {
55
60
  /**
@@ -72,16 +77,29 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
72
77
  disabled: {
73
78
  type: Boolean,
74
79
  value: false,
80
+ observer: '_disabledChanged',
81
+ reflectToAttribute: true,
82
+ sync: true,
75
83
  },
76
84
  };
77
85
  }
78
86
 
79
- static get is() {
80
- return 'vaadin-button';
81
- }
82
-
83
- static get template() {
84
- return buttonTemplate(html);
87
+ /** @protected */
88
+ render() {
89
+ return html`
90
+ <div class="vaadin-button-container">
91
+ <span part="prefix" aria-hidden="true">
92
+ <slot name="prefix"></slot>
93
+ </span>
94
+ <span part="label">
95
+ <slot></slot>
96
+ </span>
97
+ <span part="suffix" aria-hidden="true">
98
+ <slot name="suffix"></slot>
99
+ </span>
100
+ </div>
101
+ <slot name="tooltip"></slot>
102
+ `;
85
103
  }
86
104
 
87
105
  /** @protected */
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": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
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": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,13 +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 type { CSSResult, TemplateResult } from 'lit';
7
-
8
- export const buttonStyles: CSSResult;
9
-
10
- export function buttonTemplate<
11
- T extends HTMLTemplateElement | TemplateResult,
12
- F extends (strings: TemplateStringsArray, ...values: any[]) => T,
13
- >(tag: F): T;
@@ -1,54 +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 { html, LitElement } from 'lit';
7
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
- import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
11
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import { buttonStyles, buttonTemplate } from './vaadin-button-base.js';
13
- import { ButtonMixin } from './vaadin-button-mixin.js';
14
-
15
- /**
16
- * LitElement based version of `<vaadin-button>` web component.
17
- *
18
- * ## Disclaimer
19
- *
20
- * This component is an experiment and not yet a part of Vaadin platform.
21
- * There is no ETA regarding specific Vaadin version where it'll land.
22
- * Feel free to try this code in your apps as per Apache 2.0 license.
23
- */
24
- class Button extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
25
- static get is() {
26
- return 'vaadin-button';
27
- }
28
-
29
- static get styles() {
30
- return buttonStyles;
31
- }
32
-
33
- /** @protected */
34
- render() {
35
- return buttonTemplate(html);
36
- }
37
-
38
- /** @protected */
39
- ready() {
40
- super.ready();
41
-
42
- this._tooltipController = new TooltipController(this);
43
- this.addController(this._tooltipController);
44
- }
45
-
46
- /** @override */
47
- __shouldAllowFocusWhenDisabled() {
48
- return window.Vaadin.featureFlags.accessibleDisabledButtons;
49
- }
50
- }
51
-
52
- defineCustomElement(Button);
53
-
54
- export { Button };
@@ -1,2 +0,0 @@
1
- import './vaadin-button-styles.js';
2
- import '../../src/vaadin-lit-button.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-button-styles.js';
2
- import '../../src/vaadin-lit-button.js';
@@ -1,5 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import '@vaadin/vaadin-material-styles/shadow.js';
3
- import '@vaadin/vaadin-material-styles/typography.js';
4
- declare const button: import("lit").CSSResult;
5
- export { button };
@@ -1,169 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import '@vaadin/vaadin-material-styles/shadow.js';
3
- import '@vaadin/vaadin-material-styles/typography.js';
4
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
-
6
- const button = css`
7
- :host {
8
- padding: 8px;
9
- min-width: 64px;
10
- box-sizing: border-box;
11
- display: inline-flex;
12
- align-items: baseline;
13
- justify-content: center;
14
- border-radius: 4px;
15
- color: var(--material-primary-text-color);
16
- font-family: var(--material-font-family);
17
- text-transform: uppercase;
18
- font-size: var(--material-button-font-size);
19
- line-height: 20px;
20
- font-weight: 500;
21
- letter-spacing: 0.05em;
22
- white-space: nowrap;
23
- overflow: hidden;
24
- transition: box-shadow 0.2s;
25
- -webkit-tap-highlight-color: transparent;
26
- -webkit-font-smoothing: antialiased;
27
- -moz-osx-font-smoothing: grayscale;
28
- flex-shrink: 0;
29
- }
30
-
31
- :host::before,
32
- :host::after {
33
- content: '';
34
- pointer-events: none;
35
- position: absolute;
36
- border-radius: inherit;
37
- opacity: 0;
38
- background-color: currentColor;
39
- }
40
-
41
- :host::before {
42
- width: 100%;
43
- height: 100%;
44
- top: 0;
45
- left: 0;
46
- transition: opacity 0.5s;
47
- }
48
-
49
- :host::after {
50
- border-radius: 50%;
51
- width: 320px;
52
- height: 320px;
53
- top: 50%;
54
- left: 50%;
55
- transform: translate(-50%, -50%);
56
- transition: all 0.9s;
57
- }
58
-
59
- [part='label'] ::slotted(*) {
60
- vertical-align: middle;
61
- }
62
-
63
- :host(:hover:not([disabled]))::before,
64
- :host([focus-ring])::before {
65
- opacity: 0.08;
66
- transition-duration: 0.2s;
67
- }
68
-
69
- :host([active])::before {
70
- opacity: 0.16;
71
- transition: opacity 0.4s;
72
- }
73
-
74
- :host([active])::after {
75
- transform: translate(-50%, -50%) scale(0.0000001); /* animation works weirdly with scale(0) */
76
- opacity: 0.1;
77
- transition: 0s;
78
- }
79
-
80
- :host(:hover:not([active]):not([disabled]))::after {
81
- transform: translate(-50%, -50%) scale(1);
82
- opacity: 0;
83
- }
84
-
85
- :host([disabled]) {
86
- color: var(--material-disabled-text-color);
87
- }
88
-
89
- /* Contained and outline variants */
90
- :host([theme~='contained']),
91
- :host([theme~='outlined']) {
92
- padding: 8px 16px;
93
- }
94
-
95
- :host([theme~='outlined']) {
96
- box-shadow: inset 0 0 0 1px var(--_material-button-outline-color, rgba(0, 0, 0, 0.2));
97
- }
98
-
99
- :host([theme~='contained']:not([disabled])) {
100
- background-color: var(--material-primary-color);
101
- color: var(--material-primary-contrast-color);
102
- box-shadow: var(--material-shadow-elevation-2dp);
103
- }
104
-
105
- :host([theme~='contained'][disabled]) {
106
- background-color: var(--material-secondary-background-color);
107
- }
108
-
109
- :host([theme~='contained']:not([disabled]):hover) {
110
- box-shadow: var(--material-shadow-elevation-4dp);
111
- }
112
-
113
- :host([theme~='contained'][active]) {
114
- box-shadow: var(--material-shadow-elevation-8dp);
115
- }
116
-
117
- /* Icon alignment */
118
-
119
- [part] ::slotted(vaadin-icon) {
120
- display: block;
121
- width: 18px;
122
- height: 18px;
123
- }
124
-
125
- [part='prefix'] ::slotted(vaadin-icon) {
126
- margin-right: 8px;
127
- margin-left: -4px;
128
- }
129
-
130
- [part='suffix'] ::slotted(vaadin-icon) {
131
- margin-left: 8px;
132
- margin-right: -4px;
133
- }
134
-
135
- /* RTL specific styles */
136
-
137
- :host([dir='rtl'])::before {
138
- left: auto;
139
- right: 0;
140
- }
141
-
142
- :host([dir='rtl'])::after {
143
- left: auto;
144
- right: 50%;
145
- transform: translate(50%, -50%);
146
- }
147
-
148
- :host([active][dir='rtl'])::after {
149
- transform: translate(50%, -50%) scale(0.0000001);
150
- }
151
-
152
- :host(:hover:not([active]):not([disabled])[dir='rtl'])::after {
153
- transform: translate(50%, -50%) scale(1);
154
- }
155
-
156
- :host([dir='rtl']) [part='prefix'] ::slotted(vaadin-icon) {
157
- margin-right: -4px;
158
- margin-left: 8px;
159
- }
160
-
161
- :host([dir='rtl']) [part='suffix'] ::slotted(vaadin-icon) {
162
- margin-left: -4px;
163
- margin-right: 8px;
164
- }
165
- `;
166
-
167
- registerStyles('vaadin-button', button, { moduleId: 'material-button' });
168
-
169
- 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';
@@ -1,2 +0,0 @@
1
- import './vaadin-button-styles.js';
2
- import '../../src/vaadin-lit-button.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-button-styles.js';
2
- import '../../src/vaadin-lit-button.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-button.js';
@@ -1,3 +0,0 @@
1
- import './theme/lumo/vaadin-lit-button.js';
2
-
3
- export * from './src/vaadin-lit-button.js';