@vaadin/button 25.0.0-alpha8 → 25.0.0-beta1

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-alpha8",
3
+ "version": "25.0.0-beta1",
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/styles/*-base-styles.d.ts",
25
- "!src/styles/*-base-styles.js",
26
- "theme",
27
24
  "vaadin-*.d.ts",
28
25
  "vaadin-*.js",
29
26
  "web-types.json",
@@ -37,23 +34,23 @@
37
34
  ],
38
35
  "dependencies": {
39
36
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha8",
41
- "@vaadin/component-base": "25.0.0-alpha8",
42
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha8",
43
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha8",
37
+ "@vaadin/a11y-base": "25.0.0-beta1",
38
+ "@vaadin/component-base": "25.0.0-beta1",
39
+ "@vaadin/vaadin-themable-mixin": "25.0.0-beta1",
44
40
  "lit": "^3.0.0"
45
41
  },
46
42
  "devDependencies": {
47
- "@vaadin/chai-plugins": "25.0.0-alpha8",
48
- "@vaadin/icon": "25.0.0-alpha8",
49
- "@vaadin/icons": "25.0.0-alpha8",
50
- "@vaadin/test-runner-commands": "25.0.0-alpha8",
43
+ "@vaadin/chai-plugins": "25.0.0-beta1",
44
+ "@vaadin/icon": "25.0.0-beta1",
45
+ "@vaadin/icons": "25.0.0-beta1",
46
+ "@vaadin/test-runner-commands": "25.0.0-beta1",
51
47
  "@vaadin/testing-helpers": "^2.0.0",
52
- "sinon": "^18.0.0"
48
+ "@vaadin/vaadin-lumo-styles": "25.0.0-beta1",
49
+ "sinon": "^21.0.0"
53
50
  },
54
51
  "web-types": [
55
52
  "web-types.json",
56
53
  "web-types.lit.json"
57
54
  ],
58
- "gitHead": "ebf53673d5f639d2b1b6f2b31f640f530643ee2f"
55
+ "gitHead": "1d20cf54e582d1f2e209126d4586f8b4c01c50e0"
59
56
  }
@@ -3,7 +3,7 @@
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 '@vaadin/component-base/src/style-props.js';
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
7
  import { css } from 'lit';
8
8
 
9
9
  export const buttonStyles = css`
@@ -12,7 +12,7 @@ export const buttonStyles = css`
12
12
  align-items: center;
13
13
  justify-content: center;
14
14
  text-align: center;
15
- gap: var(--vaadin-button-gap, 0 var(--vaadin-gap-container-inline));
15
+ gap: var(--vaadin-button-gap, 0 var(--vaadin-gap-s));
16
16
  white-space: nowrap;
17
17
  -webkit-tap-highlight-color: transparent;
18
18
  -webkit-user-select: none;
@@ -28,13 +28,11 @@ export const buttonStyles = css`
28
28
  font-size: var(--vaadin-button-font-size, inherit);
29
29
  line-height: var(--vaadin-button-line-height, inherit);
30
30
  font-weight: var(--vaadin-button-font-weight, 500);
31
- color: var(--vaadin-button-text-color, var(--vaadin-color));
31
+ color: var(--vaadin-button-text-color, var(--vaadin-text-color));
32
32
  background: var(--vaadin-button-background, var(--vaadin-background-container));
33
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
- );
34
+ border: var(--vaadin-button-border-width, 1px) solid
35
+ var(--vaadin-button-border-color, var(--vaadin-border-color-secondary));
38
36
  border-radius: var(--vaadin-button-border-radius, var(--vaadin-radius-m));
39
37
  touch-action: manipulation;
40
38
  }
@@ -45,26 +43,28 @@ export const buttonStyles = css`
45
43
 
46
44
  .vaadin-button-container,
47
45
  [part='prefix'],
48
- [part='suffix'],
49
- [part='label'] {
46
+ [part='suffix'] {
50
47
  display: contents;
51
48
  }
52
49
 
50
+ [part='label'] {
51
+ display: inline-flex;
52
+ }
53
+
53
54
  :host(:is([focus-ring], :focus-visible)) {
54
55
  outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
55
56
  outline-offset: 1px;
56
57
  }
57
58
 
58
59
  :host([theme~='primary']) {
59
- --vaadin-button-background: var(--vaadin-color);
60
+ --vaadin-button-background: var(--vaadin-text-color);
60
61
  --vaadin-button-text-color: var(--vaadin-background-color);
61
62
  --vaadin-button-border-color: transparent;
62
63
  }
63
64
 
64
65
  :host([theme~='tertiary']) {
65
- --vaadin-button-text-color: var(--_vaadin-button-text-color);
66
- --vaadin-button-background: transparent;
67
- --vaadin-button-border-color: transparent;
66
+ background: transparent;
67
+ border-color: transparent;
68
68
  }
69
69
 
70
70
  :host([disabled]) {
@@ -75,7 +75,7 @@ export const buttonStyles = css`
75
75
 
76
76
  :host([disabled][theme~='primary']) {
77
77
  --vaadin-button-text-color: var(--vaadin-background-container-strong);
78
- --vaadin-button-background: var(--vaadin-color-disabled);
78
+ --vaadin-button-background: var(--vaadin-text-color-disabled);
79
79
  }
80
80
 
81
81
  @media (forced-colors: active) {
@@ -24,14 +24,15 @@ import { ButtonMixin } from './vaadin-button-mixin.js';
24
24
  * `prefix` | A slot for content before the label (e.g. an icon).
25
25
  * `suffix` | A slot for content after the label (e.g. an icon).
26
26
  *
27
- * The following attributes are available for styling:
27
+ * The following state attributes are available for styling:
28
28
  *
29
- * Attribute | Description
30
- * -------------|-------------
31
- * `active` | Set when the button is pressed down, either with mouse, touch or the keyboard.
32
- * `disabled` | Set when the button is disabled.
33
- * `focus-ring` | Set when the button is focused using the keyboard.
34
- * `focused` | Set when the button is focused.
29
+ * Attribute | Description
30
+ * ---------------|-------------
31
+ * `active` | Set when the button is pressed down, either with mouse, touch or the keyboard
32
+ * `disabled` | Set when the button is disabled
33
+ * `focus-ring` | Set when the button is focused using the keyboard
34
+ * `focused` | Set when the button is focused
35
+ * `has-tooltip` | Set when the button has a slotted tooltip
35
36
  *
36
37
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
37
38
  */
@@ -48,7 +49,7 @@ declare class Button extends ButtonMixin(ElementMixin(ThemableMixin(HTMLElement)
48
49
  * which makes disabled buttons focusable and hoverable, while still
49
50
  * preventing them from being triggered:
50
51
  *
51
- * ```
52
+ * ```js
52
53
  * // Set before any button is attached to the DOM.
53
54
  * window.Vaadin.featureFlags.accessibleDisabledButtons = true
54
55
  * ```
@@ -10,7 +10,7 @@ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
10
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
11
11
  import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
12
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
- import { buttonStyles } from './styles/vaadin-button-core-styles.js';
13
+ import { buttonStyles } from './styles/vaadin-button-base-styles.js';
14
14
  import { ButtonMixin } from './vaadin-button-mixin.js';
15
15
 
16
16
  /**
@@ -30,14 +30,15 @@ import { ButtonMixin } from './vaadin-button-mixin.js';
30
30
  * `prefix` | A slot for content before the label (e.g. an icon).
31
31
  * `suffix` | A slot for content after the label (e.g. an icon).
32
32
  *
33
- * The following attributes are available for styling:
33
+ * The following state attributes are available for styling:
34
34
  *
35
- * Attribute | Description
36
- * -------------|-------------
37
- * `active` | Set when the button is pressed down, either with mouse, touch or the keyboard.
38
- * `disabled` | Set when the button is disabled.
39
- * `focus-ring` | Set when the button is focused using the keyboard.
40
- * `focused` | Set when the button is focused.
35
+ * Attribute | Description
36
+ * ---------------|-------------
37
+ * `active` | Set when the button is pressed down, either with mouse, touch or the keyboard
38
+ * `disabled` | Set when the button is disabled
39
+ * `focus-ring` | Set when the button is focused using the keyboard
40
+ * `focused` | Set when the button is focused
41
+ * `has-tooltip` | Set when the button has a slotted tooltip
41
42
  *
42
43
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
43
44
  *
@@ -70,7 +71,7 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInj
70
71
  * which makes disabled buttons focusable and hoverable, while still
71
72
  * preventing them from being triggered:
72
73
  *
73
- * ```
74
+ * ```js
74
75
  * // Set before any button is attached to the DOM.
75
76
  * window.Vaadin.featureFlags.accessibleDisabledButtons = true
76
77
  * ```
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,18 +1,18 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/button",
4
- "version": "25.0.0-alpha8",
4
+ "version": "25.0.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-button",
11
- "description": "`<vaadin-button>` is an accessible and customizable button that allows users to perform actions.\n\n```html\n<vaadin-button>Press me</vaadin-button>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|-------------\n`label` | The label (text) inside the button.\n`prefix` | A slot for content before the label (e.g. an icon).\n`suffix` | A slot for content after the label (e.g. an icon).\n\nThe following attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the button is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the button is disabled.\n`focus-ring` | Set when the button is focused using the keyboard.\n`focused` | Set when the button is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-button>` is an accessible and customizable button that allows users to perform actions.\n\n```html\n<vaadin-button>Press me</vaadin-button>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|-------------\n`label` | The label (text) inside the button.\n`prefix` | A slot for content before the label (e.g. an icon).\n`suffix` | A slot for content after the label (e.g. an icon).\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`active` | Set when the button is pressed down, either with mouse, touch or the keyboard\n`disabled` | Set when the button is disabled\n`focus-ring` | Set when the button is focused using the keyboard\n`focused` | Set when the button is focused\n`has-tooltip` | Set when the button has a slotted tooltip\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
15
- "description": "When disabled, the button is rendered as \"dimmed\" and prevents all\nuser interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
15
+ "description": "When disabled, the button is rendered as \"dimmed\" and prevents all\nuser interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```js\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
16
16
  "value": {
17
17
  "type": [
18
18
  "boolean",
@@ -37,7 +37,7 @@
37
37
  "properties": [
38
38
  {
39
39
  "name": "disabled",
40
- "description": "When disabled, the button is rendered as \"dimmed\" and prevents all\nuser interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
40
+ "description": "When disabled, the button is rendered as \"dimmed\" and prevents all\nuser interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```js\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
41
41
  "value": {
42
42
  "type": [
43
43
  "boolean",
@@ -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-alpha8",
4
+ "version": "25.0.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,12 +16,12 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-button",
19
- "description": "`<vaadin-button>` is an accessible and customizable button that allows users to perform actions.\n\n```html\n<vaadin-button>Press me</vaadin-button>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|-------------\n`label` | The label (text) inside the button.\n`prefix` | A slot for content before the label (e.g. an icon).\n`suffix` | A slot for content after the label (e.g. an icon).\n\nThe following attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the button is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the button is disabled.\n`focus-ring` | Set when the button is focused using the keyboard.\n`focused` | Set when the button is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-button>` is an accessible and customizable button that allows users to perform actions.\n\n```html\n<vaadin-button>Press me</vaadin-button>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|-------------\n`label` | The label (text) inside the button.\n`prefix` | A slot for content before the label (e.g. an icon).\n`suffix` | A slot for content after the label (e.g. an icon).\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`active` | Set when the button is pressed down, either with mouse, touch or the keyboard\n`disabled` | Set when the button is disabled\n`focus-ring` | Set when the button is focused using the keyboard\n`focused` | Set when the button is focused\n`has-tooltip` | Set when the button has a slotted tooltip\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
23
23
  "name": "?disabled",
24
- "description": "When disabled, the button is rendered as \"dimmed\" and prevents all\nuser interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
24
+ "description": "When disabled, the button is rendered as \"dimmed\" and prevents all\nuser interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```js\n// Set before any button is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true\n```",
25
25
  "value": {
26
26
  "kind": "expression"
27
27
  }
@@ -1,8 +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 } from 'lit';
7
-
8
- export const buttonStyles: CSSResult;
@@ -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';