@vaadin/checkbox 24.8.0-alpha8 → 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/checkbox';
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/checkbox/vaadin-checkbox.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/checkbox/theme/material/vaadin-checkbox.js';
40
- ```
41
-
42
- You can also import the Lumo version of the component explicitly:
43
-
44
- ```js
45
- import '@vaadin/checkbox/theme/lumo/vaadin-checkbox.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/checkbox/src/vaadin-checkbox.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/checkbox",
3
- "version": "24.8.0-alpha8",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,23 +31,20 @@
31
31
  "Vaadin",
32
32
  "checkbox",
33
33
  "web-components",
34
- "web-component",
35
- "polymer"
34
+ "web-component"
36
35
  ],
37
36
  "dependencies": {
38
37
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "24.8.0-alpha8",
41
- "@vaadin/component-base": "24.8.0-alpha8",
42
- "@vaadin/field-base": "24.8.0-alpha8",
43
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha8",
44
- "@vaadin/vaadin-material-styles": "24.8.0-alpha8",
45
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
38
+ "@vaadin/a11y-base": "25.0.0-alpha1",
39
+ "@vaadin/component-base": "25.0.0-alpha1",
40
+ "@vaadin/field-base": "25.0.0-alpha1",
41
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
42
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
46
43
  "lit": "^3.0.0"
47
44
  },
48
45
  "devDependencies": {
49
- "@vaadin/chai-plugins": "24.8.0-alpha8",
50
- "@vaadin/test-runner-commands": "24.8.0-alpha8",
46
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
47
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
51
48
  "@vaadin/testing-helpers": "^1.1.0",
52
49
  "sinon": "^18.0.0"
53
50
  },
@@ -55,5 +52,5 @@
55
52
  "web-types.json",
56
53
  "web-types.lit.json"
57
54
  ],
58
- "gitHead": "d914bb8f669d7e3d1981feb8eac05688ab9870b4"
55
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
59
56
  }
@@ -9,7 +9,6 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
9
9
  import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
10
10
  import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
11
11
  import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
12
- import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
13
12
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
14
13
  import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
15
14
  import type { CheckedMixinClass } from '@vaadin/field-base/src/checked-mixin.js';
@@ -26,7 +25,6 @@ export declare function CheckboxMixin<T extends Constructor<HTMLElement>>(
26
25
  ): Constructor<ActiveMixinClass> &
27
26
  Constructor<CheckboxMixinClass> &
28
27
  Constructor<CheckedMixinClass> &
29
- Constructor<ControllerMixinClass> &
30
28
  Constructor<DelegateFocusMixinClass> &
31
29
  Constructor<DelegateStateMixinClass> &
32
30
  Constructor<DisabledMixinClass> &
@@ -3,16 +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';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
9
10
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
10
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
12
  import { CheckboxMixin } from './vaadin-checkbox-mixin.js';
12
13
  import { checkboxStyles } from './vaadin-checkbox-styles.js';
13
14
 
14
- registerStyles('vaadin-checkbox', checkboxStyles, { moduleId: 'vaadin-checkbox-styles' });
15
-
16
15
  /**
17
16
  * `<vaadin-checkbox>` is an input field representing a binary choice.
18
17
  *
@@ -60,19 +59,24 @@ registerStyles('vaadin-checkbox', checkboxStyles, { moduleId: 'vaadin-checkbox-s
60
59
  * @mixes ThemableMixin
61
60
  * @mixes ElementMixin
62
61
  */
63
- export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolymerElement))) {
62
+ export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
64
63
  static get is() {
65
64
  return 'vaadin-checkbox';
66
65
  }
67
66
 
68
- static get template() {
67
+ static get styles() {
68
+ return checkboxStyles;
69
+ }
70
+
71
+ /** @protected */
72
+ render() {
69
73
  return html`
70
74
  <div class="vaadin-checkbox-container">
71
75
  <div part="checkbox" aria-hidden="true"></div>
72
76
  <slot name="input"></slot>
73
77
  <div part="label">
74
78
  <slot name="label"></slot>
75
- <div part="required-indicator" on-click="_onRequiredIndicatorClick"></div>
79
+ <div part="required-indicator" @click="${this._onRequiredIndicatorClick}"></div>
76
80
  </div>
77
81
  <div part="helper-text">
78
82
  <slot name="helper"></slot>
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/checkbox",
4
- "version": "24.8.0-alpha8",
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/checkbox",
4
- "version": "24.8.0-alpha8",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,6 +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
- export * from './vaadin-checkbox.js';
@@ -1,64 +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 { CheckboxMixin } from './vaadin-checkbox-mixin.js';
13
- import { checkboxStyles } from './vaadin-checkbox-styles.js';
14
-
15
- /**
16
- * LitElement based version of `<vaadin-checkbox>` 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
- export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
25
- static get is() {
26
- return 'vaadin-checkbox';
27
- }
28
-
29
- static get styles() {
30
- return checkboxStyles;
31
- }
32
-
33
- /** @protected */
34
- render() {
35
- return html`
36
- <div class="vaadin-checkbox-container">
37
- <div part="checkbox" aria-hidden="true"></div>
38
- <slot name="input"></slot>
39
- <div part="label">
40
- <slot name="label"></slot>
41
- <div part="required-indicator" @click="${this._onRequiredIndicatorClick}"></div>
42
- </div>
43
- <div part="helper-text">
44
- <slot name="helper"></slot>
45
- </div>
46
- <div part="error-message">
47
- <slot name="error-message"></slot>
48
- </div>
49
- </div>
50
- <slot name="tooltip"></slot>
51
- `;
52
- }
53
-
54
- /** @protected */
55
- ready() {
56
- super.ready();
57
-
58
- this._tooltipController = new TooltipController(this);
59
- this._tooltipController.setAriaTarget(this.inputElement);
60
- this.addController(this._tooltipController);
61
- }
62
- }
63
-
64
- defineCustomElement(Checkbox);
@@ -1,2 +0,0 @@
1
- import './vaadin-checkbox-styles.js';
2
- import '../../src/vaadin-lit-checkbox.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-checkbox-styles.js';
2
- import '../../src/vaadin-lit-checkbox.js';
@@ -1 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
@@ -1,189 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
-
4
- registerStyles(
5
- 'vaadin-checkbox',
6
- css`
7
- :host {
8
- display: inline-block;
9
- -webkit-user-select: none;
10
- user-select: none;
11
- outline: none;
12
- -webkit-tap-highlight-color: transparent;
13
- --_checkbox-size: var(--vaadin-checkbox-size, 16px);
14
- }
15
-
16
- [part='label'] {
17
- display: flex;
18
- position: relative;
19
- max-width: max-content;
20
- }
21
-
22
- :host([has-label]) ::slotted(label) {
23
- padding: 3px 12px 3px 6px;
24
- }
25
-
26
- [part='checkbox'] {
27
- width: var(--_checkbox-size);
28
- height: var(--_checkbox-size);
29
- margin: 4px;
30
- position: relative;
31
- border-radius: 2px;
32
- box-shadow: inset 0 0 0 2px var(--material-secondary-text-color);
33
- background-color: transparent;
34
- }
35
-
36
- /* Used for the ripple */
37
- [part='checkbox']::before {
38
- pointer-events: none;
39
- width: 100%;
40
- height: 100%;
41
- line-height: var(--_checkbox-size);
42
- border-radius: 50%;
43
- background-color: var(--material-disabled-text-color);
44
- transform: scale(0);
45
- opacity: 0;
46
- transition:
47
- transform 0s 0.8s,
48
- opacity 0.8s;
49
- will-change: transform, opacity;
50
- }
51
-
52
- /* Used for the checkmark */
53
- [part='checkbox']::after {
54
- content: '';
55
- pointer-events: none;
56
- display: inline-block;
57
- width: 10px;
58
- height: 19px;
59
- border: 0 solid var(--material-background-color);
60
- border-width: 3px 0 0 3px;
61
- box-sizing: border-box;
62
- transform-origin: 0 0;
63
- position: absolute;
64
- top: 12px;
65
- left: 6px;
66
- transform: scale(0) rotate(-135deg);
67
- transition: transform 0.2s;
68
- }
69
-
70
- :host([indeterminate]) [part='checkbox'],
71
- :host([checked]) [part='checkbox'] {
72
- background-color: var(--material-primary-color);
73
- box-shadow: none;
74
- }
75
-
76
- :host([checked]) [part='checkbox']::after {
77
- transform: scale(0.55) rotate(-135deg);
78
- }
79
-
80
- :host(:not([checked]):not([indeterminate]):not([disabled]):hover) [part='checkbox'] {
81
- background-color: transparent;
82
- }
83
-
84
- :host([focus-ring]) [part='checkbox']::before,
85
- :host([active]) [part='checkbox']::before {
86
- transition-duration: 0.08s, 0.01s;
87
- transition-delay: 0s, 0s;
88
- transform: scale(2.5);
89
- opacity: 0.15;
90
- }
91
-
92
- :host([checked]) [part='checkbox']::before {
93
- background-color: var(--material-primary-color);
94
- }
95
-
96
- :host([indeterminate]) [part='checkbox']::after {
97
- transform: none;
98
- opacity: 1;
99
- top: 45%;
100
- height: 10%;
101
- left: 22%;
102
- right: 22%;
103
- width: auto;
104
- border: 0;
105
- background-color: var(--material-background-color);
106
- transition: opacity 0.4s;
107
- }
108
-
109
- :host([disabled]) {
110
- pointer-events: none;
111
- color: var(--material-disabled-text-color);
112
- }
113
-
114
- :host([disabled]) ::slotted(label) {
115
- color: inherit;
116
- }
117
-
118
- :host([disabled]:not([checked]):not([indeterminate])) [part='checkbox'] {
119
- box-shadow: inset 0 0 0 2px var(--material-disabled-color);
120
- }
121
-
122
- :host([disabled][checked]) [part='checkbox'],
123
- :host([disabled][indeterminate]) [part='checkbox'] {
124
- background-color: var(--material-disabled-color);
125
- }
126
-
127
- :host([readonly][checked]:not([disabled])) [part='checkbox'],
128
- :host([readonly][indeterminate]:not([disabled])) [part='checkbox'],
129
- :host([readonly]:not([disabled])) [part='checkbox']::before {
130
- background-color: var(--material-secondary-text-color);
131
- }
132
-
133
- /* RTL specific styles */
134
- :host([dir='rtl'][has-label]) ::slotted(label) {
135
- padding: 3px 6px 3px 12px;
136
- }
137
-
138
- /* Required */
139
- :host([required]) [part='required-indicator'] {
140
- position: absolute;
141
- top: 3px;
142
- right: 2px;
143
- }
144
-
145
- :host([dir='rtl'][required]) [part='required-indicator'] {
146
- right: auto;
147
- left: 2px;
148
- }
149
-
150
- :host([required]:not([disabled])) [part='required-indicator'] {
151
- color: var(--material-secondary-text-color);
152
- }
153
-
154
- :host([required]) [part='required-indicator']::after {
155
- content: '*';
156
- }
157
-
158
- :host([invalid]) [part='required-indicator']::after {
159
- color: var(--material-error-text-color);
160
- }
161
-
162
- :host(:not([has-label])) [part='required-indicator'] {
163
- display: none;
164
- }
165
-
166
- [part='error-message'],
167
- [part='helper-text'] {
168
- font-size: 0.75em;
169
- line-height: 1;
170
- padding-left: 6px;
171
- }
172
-
173
- [part='error-message'] {
174
- color: var(--material-error-text-color);
175
- }
176
-
177
- [part='helper-text'] {
178
- color: var(--material-secondary-text-color);
179
- }
180
-
181
- :host([has-error-message]) [part='error-message']::before,
182
- :host([has-helper]) [part='helper-text']::before {
183
- content: '';
184
- display: block;
185
- height: 6px;
186
- }
187
- `,
188
- { moduleId: 'material-checkbox' },
189
- );
@@ -1,2 +0,0 @@
1
- import './vaadin-checkbox-styles.js';
2
- import '../../src/vaadin-checkbox.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-checkbox-styles.js';
2
- import '../../src/vaadin-checkbox.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-checkbox-styles.js';
2
- import '../../src/vaadin-lit-checkbox.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-checkbox-styles.js';
2
- import '../../src/vaadin-lit-checkbox.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-checkbox.js';
@@ -1,2 +0,0 @@
1
- import './theme/lumo/vaadin-lit-checkbox.js';
2
- export * from './src/vaadin-lit-checkbox.js';