@vaadin/checkbox 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/checkbox",
3
- "version": "25.0.0-alpha1",
3
+ "version": "25.0.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "theme",
25
24
  "vaadin-*.d.ts",
26
25
  "vaadin-*.js",
27
26
  "web-types.json",
@@ -35,22 +34,22 @@
35
34
  ],
36
35
  "dependencies": {
37
36
  "@open-wc/dedupe-mixin": "^1.3.0",
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",
37
+ "@vaadin/a11y-base": "25.0.0-alpha11",
38
+ "@vaadin/component-base": "25.0.0-alpha11",
39
+ "@vaadin/field-base": "25.0.0-alpha11",
40
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
43
41
  "lit": "^3.0.0"
44
42
  },
45
43
  "devDependencies": {
46
- "@vaadin/chai-plugins": "25.0.0-alpha1",
47
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
48
- "@vaadin/testing-helpers": "^1.1.0",
44
+ "@vaadin/chai-plugins": "25.0.0-alpha11",
45
+ "@vaadin/test-runner-commands": "25.0.0-alpha11",
46
+ "@vaadin/testing-helpers": "^2.0.0",
47
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
49
48
  "sinon": "^18.0.0"
50
49
  },
51
50
  "web-types": [
52
51
  "web-types.json",
53
52
  "web-types.lit.json"
54
53
  ],
55
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
54
+ "gitHead": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
56
55
  }
@@ -0,0 +1,33 @@
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
+ import { checkable } from '@vaadin/field-base/src/styles/checkable-base-styles.js';
9
+ import { field } from '@vaadin/field-base/src/styles/field-base-styles.js';
10
+
11
+ const checkbox = css`
12
+ [part='checkbox']::after {
13
+ inset: 0;
14
+ mask-image: var(--_vaadin-icon-checkmark);
15
+ }
16
+
17
+ :host([readonly]) {
18
+ --vaadin-checkbox-background: transparent;
19
+ --vaadin-checkbox-border-color: var(--vaadin-border-color-strong);
20
+ --vaadin-checkbox-color: var(--vaadin-color);
21
+ }
22
+
23
+ :host([readonly]) [part='checkbox'] {
24
+ border-style: dashed;
25
+ }
26
+
27
+ :host([indeterminate]) [part='checkbox']::after {
28
+ inset: calc(var(--_border-width) * -1);
29
+ mask-image: var(--_vaadin-icon-minus);
30
+ }
31
+ `;
32
+
33
+ export const checkboxStyles = [field, checkable('checkbox'), checkbox];
@@ -8,9 +8,10 @@ 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';
13
+ import { checkboxStyles } from './styles/vaadin-checkbox-base-styles.js';
12
14
  import { CheckboxMixin } from './vaadin-checkbox-mixin.js';
13
- import { checkboxStyles } from './vaadin-checkbox-styles.js';
14
15
 
15
16
  /**
16
17
  * `<vaadin-checkbox>` is an input field representing a binary choice.
@@ -59,7 +60,7 @@ import { checkboxStyles } from './vaadin-checkbox-styles.js';
59
60
  * @mixes ThemableMixin
60
61
  * @mixes ElementMixin
61
62
  */
62
- export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
63
+ export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
63
64
  static get is() {
64
65
  return 'vaadin-checkbox';
65
66
  }
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-checkbox.js';
1
+ import './src/vaadin-checkbox.js';
2
2
  export * from './src/vaadin-checkbox.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/checkbox",
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/checkbox",
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,95 +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 '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
-
8
- export const checkboxStyles = css`
9
- :host {
10
- display: inline-block;
11
- }
12
-
13
- :host([hidden]) {
14
- display: none !important;
15
- }
16
-
17
- :host([disabled]) {
18
- -webkit-tap-highlight-color: transparent;
19
- }
20
-
21
- .vaadin-checkbox-container {
22
- display: grid;
23
- grid-template-columns: auto 1fr;
24
- align-items: baseline;
25
- }
26
-
27
- [part='checkbox'],
28
- ::slotted(input),
29
- [part='label'] {
30
- grid-row: 1;
31
- }
32
-
33
- [part='checkbox'],
34
- ::slotted(input) {
35
- grid-column: 1;
36
- }
37
-
38
- [part='helper-text'],
39
- [part='error-message'] {
40
- grid-column: 2;
41
- }
42
-
43
- :host(:not([has-helper])) [part='helper-text'],
44
- :host(:not([has-error-message])) [part='error-message'] {
45
- display: none;
46
- }
47
-
48
- [part='checkbox'] {
49
- width: var(--vaadin-checkbox-size, 1em);
50
- height: var(--vaadin-checkbox-size, 1em);
51
- --_input-border-width: var(--vaadin-input-field-border-width, 0);
52
- --_input-border-color: var(--vaadin-input-field-border-color, transparent);
53
- box-shadow: inset 0 0 0 var(--_input-border-width, 0) var(--_input-border-color);
54
- }
55
-
56
- [part='checkbox']::before {
57
- display: block;
58
- content: '\\202F';
59
- line-height: var(--vaadin-checkbox-size, 1em);
60
- contain: paint;
61
- }
62
-
63
- /* visually hidden */
64
- ::slotted(input) {
65
- cursor: inherit;
66
- margin: 0;
67
- align-self: stretch;
68
- -webkit-appearance: none;
69
- width: initial;
70
- height: initial;
71
- }
72
-
73
- @media (forced-colors: active) {
74
- [part='checkbox'] {
75
- outline: 1px solid;
76
- outline-offset: -1px;
77
- }
78
-
79
- :host([disabled]) [part='checkbox'],
80
- :host([disabled]) [part='checkbox']::after {
81
- outline-color: GrayText;
82
- }
83
-
84
- :host(:is([checked], [indeterminate])) [part='checkbox']::after {
85
- outline: 1px solid;
86
- outline-offset: -1px;
87
- border-radius: inherit;
88
- }
89
-
90
- :host([focused]) [part='checkbox'],
91
- :host([focused]) [part='checkbox']::after {
92
- outline-width: 2px;
93
- }
94
- }
95
- `;
@@ -1,6 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
3
- import '@vaadin/vaadin-lumo-styles/sizing.js';
4
- import '@vaadin/vaadin-lumo-styles/spacing.js';
5
- import '@vaadin/vaadin-lumo-styles/style.js';
6
- import '@vaadin/vaadin-lumo-styles/typography.js';
@@ -1,316 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
3
- import '@vaadin/vaadin-lumo-styles/sizing.js';
4
- import '@vaadin/vaadin-lumo-styles/spacing.js';
5
- import '@vaadin/vaadin-lumo-styles/style.js';
6
- import '@vaadin/vaadin-lumo-styles/typography.js';
7
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
-
9
- registerStyles(
10
- 'vaadin-checkbox',
11
- css`
12
- :host {
13
- color: var(--vaadin-checkbox-label-color, var(--lumo-body-text-color));
14
- font-size: var(--vaadin-checkbox-label-font-size, var(--lumo-font-size-m));
15
- font-family: var(--lumo-font-family);
16
- line-height: var(--lumo-line-height-s);
17
- -webkit-font-smoothing: antialiased;
18
- -moz-osx-font-smoothing: grayscale;
19
- -webkit-tap-highlight-color: transparent;
20
- -webkit-user-select: none;
21
- user-select: none;
22
- cursor: default;
23
- outline: none;
24
- --_checkbox-size: var(--vaadin-checkbox-size, calc(var(--lumo-size-m) / 2));
25
- --_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
26
- --_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
27
- --_selection-color: var(--vaadin-selection-color, var(--lumo-primary-color));
28
- --_invalid-background: var(--vaadin-input-field-invalid-background, var(--lumo-error-color-10pct));
29
- --_disabled-checkmark-color: var(--vaadin-checkbox-disabled-checkmark-color, var(--lumo-contrast-30pct));
30
- }
31
-
32
- [part='label'] {
33
- display: flex;
34
- position: relative;
35
- max-width: max-content;
36
- }
37
-
38
- :host([has-label]) ::slotted(label) {
39
- padding: var(
40
- --vaadin-checkbox-label-padding,
41
- var(--lumo-space-xs) var(--lumo-space-s) var(--lumo-space-xs) var(--lumo-space-xs)
42
- );
43
- }
44
-
45
- :host([dir='rtl'][has-label]) ::slotted(label) {
46
- padding: var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-s);
47
- }
48
-
49
- :host([has-label][required]) ::slotted(label) {
50
- padding-inline-end: var(--lumo-space-m);
51
- }
52
-
53
- [part='checkbox'] {
54
- width: var(--_checkbox-size);
55
- height: var(--_checkbox-size);
56
- margin: var(--lumo-space-xs);
57
- position: relative;
58
- border-radius: var(--vaadin-checkbox-border-radius, var(--lumo-border-radius-s));
59
- background: var(--vaadin-checkbox-background, var(--lumo-contrast-20pct));
60
- transition:
61
- transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2),
62
- background-color 0.15s;
63
- cursor: var(--lumo-clickable-cursor);
64
- /* Default field border color */
65
- --_input-border-color: var(--vaadin-input-field-border-color, var(--lumo-contrast-50pct));
66
- }
67
-
68
- :host([indeterminate]),
69
- :host([checked]) {
70
- --vaadin-input-field-border-color: transparent;
71
- }
72
-
73
- :host([indeterminate]) [part='checkbox'],
74
- :host([checked]) [part='checkbox'] {
75
- background-color: var(--_selection-color);
76
- }
77
-
78
- /* Checkmark */
79
- [part='checkbox']::after {
80
- pointer-events: none;
81
- font-family: 'lumo-icons';
82
- content: var(--vaadin-checkbox-checkmark-char, var(--lumo-icons-checkmark));
83
- color: var(--vaadin-checkbox-checkmark-color, var(--lumo-primary-contrast-color));
84
- font-size: var(--vaadin-checkbox-checkmark-size, calc(var(--_checkbox-size) + 2px));
85
- line-height: 1;
86
- position: absolute;
87
- top: -1px;
88
- left: -1px;
89
- contain: content;
90
- opacity: 0;
91
- }
92
-
93
- :host([checked]) [part='checkbox']::after {
94
- opacity: 1;
95
- }
96
-
97
- :host([readonly]:not([checked]):not([indeterminate])) {
98
- color: var(--lumo-secondary-text-color);
99
- }
100
-
101
- :host([readonly]:not([checked]):not([indeterminate])) [part='checkbox'] {
102
- background: transparent;
103
- box-shadow: none;
104
- }
105
-
106
- :host([readonly]:not([checked]):not([indeterminate])) [part='checkbox']::after {
107
- content: '';
108
- box-sizing: border-box;
109
- width: 100%;
110
- height: 100%;
111
- border-radius: inherit;
112
- top: 0;
113
- left: 0;
114
- opacity: 1;
115
- border: var(--vaadin-input-field-readonly-border, 1px dashed var(--lumo-contrast-50pct));
116
- }
117
-
118
- /* Indeterminate checkmark */
119
- :host([indeterminate]) [part='checkbox']::after {
120
- content: var(--vaadin-checkbox-checkmark-char-indeterminate, '');
121
- opacity: 1;
122
- top: 45%;
123
- height: 10%;
124
- left: 22%;
125
- right: 22%;
126
- width: auto;
127
- border: 0;
128
- background-color: var(--lumo-primary-contrast-color);
129
- }
130
-
131
- /* Focus ring */
132
- :host([focus-ring]) [part='checkbox'] {
133
- box-shadow:
134
- 0 0 0 1px var(--lumo-base-color),
135
- 0 0 0 calc(var(--_focus-ring-width) + 1px) var(--_focus-ring-color),
136
- inset 0 0 0 var(--_input-border-width, 0) var(--_input-border-color);
137
- }
138
-
139
- :host([focus-ring][readonly]:not([checked]):not([indeterminate])) [part='checkbox'] {
140
- box-shadow:
141
- 0 0 0 1px var(--lumo-base-color),
142
- 0 0 0 calc(var(--_focus-ring-width) + 1px) var(--_focus-ring-color);
143
- }
144
-
145
- /* Disabled */
146
- :host([disabled]) {
147
- pointer-events: none;
148
- --vaadin-input-field-border-color: var(--lumo-contrast-20pct);
149
- }
150
-
151
- :host([disabled]) ::slotted(label) {
152
- color: inherit;
153
- }
154
-
155
- :host([disabled]) [part='checkbox'] {
156
- background-color: var(--vaadin-checkbox-disabled-background, var(--lumo-contrast-10pct));
157
- }
158
-
159
- :host([disabled]) [part='checkbox']::after {
160
- color: var(--_disabled-checkmark-color);
161
- }
162
-
163
- :host([disabled]) [part='label'],
164
- :host([disabled]) [part='helper-text'] {
165
- color: var(--lumo-disabled-text-color);
166
- -webkit-text-fill-color: var(--lumo-disabled-text-color);
167
- }
168
-
169
- :host([indeterminate][disabled]) [part='checkbox']::after {
170
- background-color: var(--_disabled-checkmark-color);
171
- }
172
-
173
- :host([readonly][checked]:not([disabled])) [part='checkbox'],
174
- :host([readonly][indeterminate]:not([disabled])) [part='checkbox'] {
175
- background-color: var(--vaadin-checkbox-readonly-checked-background, var(--lumo-contrast-70pct));
176
- }
177
-
178
- /* Used for activation "halo" */
179
- [part='checkbox']::before {
180
- pointer-events: none;
181
- color: transparent;
182
- width: 100%;
183
- height: 100%;
184
- line-height: var(--_checkbox-size);
185
- border-radius: inherit;
186
- background-color: inherit;
187
- transform: scale(1.4);
188
- opacity: 0;
189
- transition:
190
- transform 0.1s,
191
- opacity 0.8s;
192
- }
193
-
194
- /* Hover */
195
- :host(:not([checked]):not([indeterminate]):not([disabled]):not([readonly]):not([invalid]):hover) [part='checkbox'] {
196
- background: var(--vaadin-checkbox-background-hover, var(--lumo-contrast-30pct));
197
- }
198
-
199
- /* Disable hover for touch devices */
200
- @media (pointer: coarse) {
201
- /* prettier-ignore */
202
- :host(:not([checked]):not([indeterminate]):not([disabled]):not([readonly]):not([invalid]):hover) [part='checkbox'] {
203
- background: var(--vaadin-checkbox-background, var(--lumo-contrast-20pct));
204
- }
205
- }
206
-
207
- /* Active */
208
- :host([active]) [part='checkbox'] {
209
- transform: scale(0.9);
210
- transition-duration: 0.05s;
211
- }
212
-
213
- :host([active][checked]) [part='checkbox'] {
214
- transform: scale(1.1);
215
- }
216
-
217
- :host([active]:not([checked])) [part='checkbox']::before {
218
- transition-duration: 0.01s, 0.01s;
219
- transform: scale(0);
220
- opacity: 0.4;
221
- }
222
-
223
- /* Required */
224
- :host([required]) [part='required-indicator'] {
225
- position: absolute;
226
- top: var(--lumo-space-xs);
227
- right: var(--lumo-space-xs);
228
- }
229
-
230
- :host([required][dir='rtl']) [part='required-indicator'] {
231
- right: auto;
232
- left: var(--lumo-space-xs);
233
- }
234
-
235
- :host([required]) [part='required-indicator']::after {
236
- content: var(--lumo-required-field-indicator, '\\2022');
237
- transition: opacity 0.2s;
238
- color: var(--lumo-required-field-indicator-color, var(--lumo-primary-text-color));
239
- width: 1em;
240
- text-align: center;
241
- }
242
-
243
- :host(:not([has-label])) [part='required-indicator'] {
244
- display: none;
245
- }
246
-
247
- /* Invalid */
248
- :host([invalid]) {
249
- --vaadin-input-field-border-color: var(--lumo-error-color);
250
- }
251
-
252
- :host([invalid]) [part='checkbox'] {
253
- background: var(--_invalid-background);
254
- background-image: linear-gradient(var(--_invalid-background) 0%, var(--_invalid-background) 100%);
255
- }
256
-
257
- :host([invalid]:hover) [part='checkbox'] {
258
- background-image: linear-gradient(var(--_invalid-background) 0%, var(--_invalid-background) 100%),
259
- linear-gradient(var(--_invalid-background) 0%, var(--_invalid-background) 100%);
260
- }
261
-
262
- :host([invalid][focus-ring]) {
263
- --_focus-ring-color: var(--lumo-error-color-50pct);
264
- }
265
-
266
- :host([invalid]) [part='required-indicator']::after {
267
- color: var(--lumo-required-field-indicator-color, var(--lumo-error-text-color));
268
- }
269
-
270
- /* Error message */
271
- [part='error-message'] {
272
- font-size: var(--vaadin-input-field-error-font-size, var(--lumo-font-size-xs));
273
- line-height: var(--lumo-line-height-xs);
274
- font-weight: var(--vaadin-input-field-error-font-weight, 400);
275
- color: var(--vaadin-input-field-error-color, var(--lumo-error-text-color));
276
- will-change: max-height;
277
- transition: 0.4s max-height;
278
- max-height: 5em;
279
- padding-inline-start: var(--lumo-space-xs);
280
- }
281
-
282
- :host([has-error-message]) [part='error-message']::after,
283
- :host([has-helper]) [part='helper-text']::after {
284
- content: '';
285
- display: block;
286
- height: 0.4em;
287
- }
288
-
289
- :host(:not([invalid])) [part='error-message'] {
290
- max-height: 0;
291
- overflow: hidden;
292
- }
293
-
294
- /* Helper */
295
- [part='helper-text'] {
296
- display: block;
297
- color: var(--vaadin-input-field-helper-color, var(--lumo-secondary-text-color));
298
- font-size: var(--vaadin-input-field-helper-font-size, var(--lumo-font-size-xs));
299
- line-height: var(--lumo-line-height-xs);
300
- font-weight: var(--vaadin-input-field-helper-font-weight, 400);
301
- margin-left: calc(var(--lumo-border-radius-m) / 4);
302
- transition: color 0.2s;
303
- padding-inline-start: var(--lumo-space-xs);
304
- }
305
-
306
- :host(:hover:not([readonly])) [part='helper-text'] {
307
- color: var(--lumo-body-text-color);
308
- }
309
-
310
- :host([has-error-message]) ::slotted(label),
311
- :host([has-helper]) ::slotted(label) {
312
- padding-bottom: 0;
313
- }
314
- `,
315
- { moduleId: 'lumo-checkbox' },
316
- );
@@ -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';