@vaadin/button 24.3.0-alpha1 → 24.3.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 +10 -12
- package/src/vaadin-lit-button.d.ts +6 -0
- package/src/vaadin-lit-button.js +49 -0
- package/theme/lumo/vaadin-button-styles.js +29 -15
- package/theme/lumo/vaadin-lit-button.js +2 -0
- package/theme/material/vaadin-lit-button.js +2 -0
- package/vaadin-lit-button.d.ts +1 -0
- package/vaadin-lit-button.js +3 -0
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/button",
|
|
3
|
-
"version": "24.3.0-
|
|
3
|
+
"version": "24.3.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"!src/vaadin-lit-button.d.ts",
|
|
25
|
-
"!src/vaadin-lit-button.js",
|
|
26
24
|
"theme",
|
|
27
25
|
"vaadin-*.d.ts",
|
|
28
26
|
"vaadin-*.js",
|
|
@@ -38,22 +36,22 @@
|
|
|
38
36
|
"dependencies": {
|
|
39
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
38
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/a11y-base": "24.3.0-
|
|
42
|
-
"@vaadin/component-base": "24.3.0-
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "24.3.0-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.3.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.3.0-
|
|
46
|
-
"lit": "^
|
|
39
|
+
"@vaadin/a11y-base": "24.3.0-alpha11",
|
|
40
|
+
"@vaadin/component-base": "24.3.0-alpha11",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha11",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "24.3.0-alpha11",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha11",
|
|
44
|
+
"lit": "^3.0.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
50
|
-
"@vaadin/icon": "24.3.0-
|
|
51
|
-
"@vaadin/testing-helpers": "^0.
|
|
48
|
+
"@vaadin/icon": "24.3.0-alpha11",
|
|
49
|
+
"@vaadin/testing-helpers": "^0.6.0",
|
|
52
50
|
"sinon": "^13.0.2"
|
|
53
51
|
},
|
|
54
52
|
"web-types": [
|
|
55
53
|
"web-types.json",
|
|
56
54
|
"web-types.lit.json"
|
|
57
55
|
],
|
|
58
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "123cf569a1b6ef6f4ef5fe8e60cb8d988699b98c"
|
|
59
57
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2023 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 not intended for publishing to npm.
|
|
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
|
+
|
|
47
|
+
defineCustomElement(Button);
|
|
48
|
+
|
|
49
|
+
export { Button };
|
|
@@ -9,23 +9,32 @@ const button = css`
|
|
|
9
9
|
:host {
|
|
10
10
|
/* Sizing */
|
|
11
11
|
--lumo-button-size: var(--lumo-size-m);
|
|
12
|
-
min-width: calc(var(--
|
|
13
|
-
height: var(--
|
|
14
|
-
padding: 0 calc(var(--
|
|
15
|
-
margin: var(--lumo-space-xs) 0;
|
|
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
16
|
box-sizing: border-box;
|
|
17
17
|
/* Style */
|
|
18
18
|
font-family: var(--lumo-font-family);
|
|
19
|
-
font-size: var(--lumo-font-size-m);
|
|
20
|
-
font-weight: 500;
|
|
21
|
-
color: var(--_lumo-button-
|
|
22
|
-
background
|
|
23
|
-
border
|
|
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));
|
|
24
25
|
cursor: var(--lumo-clickable-cursor);
|
|
25
26
|
-webkit-tap-highlight-color: transparent;
|
|
26
27
|
-webkit-font-smoothing: antialiased;
|
|
27
28
|
-moz-osx-font-smoothing: grayscale;
|
|
28
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));
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
|
@@ -92,7 +101,7 @@ const button = css`
|
|
|
92
101
|
/* Keyboard focus */
|
|
93
102
|
|
|
94
103
|
:host([focus-ring]) {
|
|
95
|
-
box-shadow: 0 0 0
|
|
104
|
+
box-shadow: 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
:host([theme~='primary'][focus-ring]) {
|
|
@@ -103,12 +112,16 @@ const button = css`
|
|
|
103
112
|
|
|
104
113
|
:host([theme~='tertiary']),
|
|
105
114
|
:host([theme~='tertiary-inline']) {
|
|
106
|
-
|
|
115
|
+
--_background: transparent !important;
|
|
116
|
+
background: var(--vaadin-button-tertiary-background, var(--_background));
|
|
107
117
|
min-width: 0;
|
|
108
118
|
}
|
|
109
119
|
|
|
110
120
|
:host([theme~='tertiary']) {
|
|
111
|
-
|
|
121
|
+
border: var(--vaadin-button-tertiary-border, none);
|
|
122
|
+
color: var(--vaadin-button-tertiary-text-color, var(--lumo-primary-text-color));
|
|
123
|
+
font-weight: var(--vaadin-button-tertiary-font-weight, 500);
|
|
124
|
+
padding: var(--vaadin-button-tertiary-padding, 0 calc(var(--_button-size) / 6));
|
|
112
125
|
}
|
|
113
126
|
|
|
114
127
|
:host([theme~='tertiary-inline'])::before {
|
|
@@ -130,9 +143,10 @@ const button = css`
|
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
:host([theme~='primary']) {
|
|
133
|
-
background
|
|
134
|
-
|
|
135
|
-
|
|
146
|
+
background: var(--_lumo-button-primary-background);
|
|
147
|
+
border: var(--vaadin-button-primary-border, none);
|
|
148
|
+
color: var(--_lumo-button-primary-text-color);
|
|
149
|
+
font-weight: var(--vaadin-button-primary-font-weight, 600);
|
|
136
150
|
min-width: calc(var(--lumo-button-size) * 2.5);
|
|
137
151
|
}
|
|
138
152
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-button.js';
|
package/web-types.json
CHANGED