@vaadin/checkbox 23.0.0-alpha2 → 23.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/checkbox",
|
|
3
|
-
"version": "23.0.0-
|
|
3
|
+
"version": "23.0.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "vaadin-checkbox.js",
|
|
20
20
|
"module": "vaadin-checkbox.js",
|
|
21
|
+
"type": "module",
|
|
21
22
|
"files": [
|
|
22
23
|
"src",
|
|
23
24
|
"theme",
|
|
@@ -33,16 +34,16 @@
|
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@polymer/polymer": "^3.0.0",
|
|
36
|
-
"@vaadin/component-base": "23.0.0-
|
|
37
|
-
"@vaadin/field-base": "23.0.0-
|
|
38
|
-
"@vaadin/vaadin-lumo-styles": "23.0.0-
|
|
39
|
-
"@vaadin/vaadin-material-styles": "23.0.0-
|
|
40
|
-
"@vaadin/vaadin-themable-mixin": "23.0.0-
|
|
37
|
+
"@vaadin/component-base": "23.0.0-beta1",
|
|
38
|
+
"@vaadin/field-base": "23.0.0-beta1",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-beta1",
|
|
40
|
+
"@vaadin/vaadin-material-styles": "23.0.0-beta1",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-beta1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@esm-bundle/chai": "^4.3.4",
|
|
44
45
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
45
46
|
"sinon": "^9.2.0"
|
|
46
47
|
},
|
|
47
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "467244b76021176c109df675799b07029b293e58"
|
|
48
49
|
}
|
package/src/vaadin-checkbox.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
|
|
@@ -8,7 +8,7 @@ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'
|
|
|
8
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
9
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
10
10
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
11
|
-
import {
|
|
11
|
+
import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
|
|
12
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -61,7 +61,7 @@ export interface CheckboxEventMap extends HTMLElementEventMap, CheckboxCustomEve
|
|
|
61
61
|
* @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
|
|
62
62
|
* @fires {CustomEvent} indeterminate-changed - Fired when the `indeterminate` property changes.
|
|
63
63
|
*/
|
|
64
|
-
declare class Checkbox extends
|
|
64
|
+
declare class Checkbox extends LabelMixin(
|
|
65
65
|
CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement))))))
|
|
66
66
|
) {
|
|
67
67
|
/**
|
package/src/vaadin-checkbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -10,8 +10,9 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
|
10
10
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
11
11
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
12
12
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
13
|
+
import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
|
|
13
14
|
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
14
|
-
import {
|
|
15
|
+
import { SlotTargetController } from '@vaadin/field-base/src/slot-target-controller.js';
|
|
15
16
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -53,9 +54,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
53
54
|
* @mixes ActiveMixin
|
|
54
55
|
* @mixes DelegateFocusMixin
|
|
55
56
|
* @mixes CheckedMixin
|
|
56
|
-
* @mixes
|
|
57
|
+
* @mixes LabelMixin
|
|
57
58
|
*/
|
|
58
|
-
class Checkbox extends
|
|
59
|
+
class Checkbox extends LabelMixin(
|
|
59
60
|
CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement))))))
|
|
60
61
|
) {
|
|
61
62
|
static get is() {
|
|
@@ -78,13 +79,14 @@ class Checkbox extends SlotLabelMixin(
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
.vaadin-checkbox-container {
|
|
81
|
-
display:
|
|
82
|
+
display: grid;
|
|
83
|
+
grid-template-columns: auto 1fr;
|
|
82
84
|
align-items: baseline;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
.vaadin-checkbox-wrapper {
|
|
86
88
|
position: relative;
|
|
87
|
-
|
|
89
|
+
height: 100%;
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
/* visually hidden */
|
|
@@ -166,39 +168,30 @@ class Checkbox extends SlotLabelMixin(
|
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
/** @protected */
|
|
169
|
-
|
|
170
|
-
super.
|
|
171
|
+
connectedCallback() {
|
|
172
|
+
super.connectedCallback();
|
|
171
173
|
|
|
172
|
-
this.
|
|
173
|
-
new InputController(this, (input) => {
|
|
174
|
+
if (!this._inputController) {
|
|
175
|
+
this._inputController = new InputController(this, (input) => {
|
|
174
176
|
this._setInputElement(input);
|
|
175
177
|
this._setFocusElement(input);
|
|
176
178
|
this.stateTarget = input;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
get _sourceSlot() {
|
|
190
|
-
return this.$.noop;
|
|
179
|
+
this.ariaTarget = input;
|
|
180
|
+
});
|
|
181
|
+
this.addController(this._inputController);
|
|
182
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
183
|
+
this.addController(
|
|
184
|
+
new SlotTargetController(
|
|
185
|
+
this.$.noop,
|
|
186
|
+
() => this._labelController.node,
|
|
187
|
+
() => this.__warnDeprecated()
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
* @override
|
|
196
|
-
* @protected
|
|
197
|
-
* @param {!Array<!Node>} nodes
|
|
198
|
-
**/
|
|
199
|
-
__copyNodesToSlotTarget(nodes) {
|
|
200
|
-
super.__copyNodesToSlotTarget(nodes);
|
|
201
|
-
|
|
193
|
+
/** @private */
|
|
194
|
+
__warnDeprecated() {
|
|
202
195
|
console.warn(
|
|
203
196
|
`WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-checkbox> is deprecated.
|
|
204
197
|
Please use <label slot="label"> wrapper or the label property instead.`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
+
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
2
3
|
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
3
4
|
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
4
5
|
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
@@ -52,31 +53,26 @@ registerStyles(
|
|
|
52
53
|
|
|
53
54
|
/* Checkmark */
|
|
54
55
|
[part='checkbox']::after {
|
|
55
|
-
content: '';
|
|
56
56
|
pointer-events: none;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
transform-origin: 0 0;
|
|
57
|
+
font-family: 'lumo-icons';
|
|
58
|
+
content: var(--lumo-icons-checkmark);
|
|
59
|
+
color: var(--lumo-primary-contrast-color);
|
|
60
|
+
font-size: calc(var(--lumo-size-m) / 2 + 2px);
|
|
61
|
+
line-height: 1;
|
|
64
62
|
position: absolute;
|
|
65
|
-
top:
|
|
66
|
-
left:
|
|
67
|
-
|
|
63
|
+
top: -1px;
|
|
64
|
+
left: -1px;
|
|
65
|
+
contain: content;
|
|
68
66
|
opacity: 0;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
:host([checked]) [part='checkbox']::after {
|
|
72
70
|
opacity: 1;
|
|
73
|
-
width: 0.625em;
|
|
74
|
-
height: 1.0625em;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
/* Indeterminate checkmark */
|
|
78
74
|
:host([indeterminate]) [part='checkbox']::after {
|
|
79
|
-
|
|
75
|
+
content: '';
|
|
80
76
|
opacity: 1;
|
|
81
77
|
top: 45%;
|
|
82
78
|
height: 10%;
|
|
@@ -85,7 +81,6 @@ registerStyles(
|
|
|
85
81
|
width: auto;
|
|
86
82
|
border: 0;
|
|
87
83
|
background-color: var(--lumo-primary-contrast-color);
|
|
88
|
-
transition: opacity 0.25s;
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
/* Focus ring */
|
|
@@ -108,7 +103,7 @@ registerStyles(
|
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
:host([disabled]) [part='checkbox']::after {
|
|
111
|
-
|
|
106
|
+
color: var(--lumo-contrast-30pct);
|
|
112
107
|
}
|
|
113
108
|
|
|
114
109
|
:host([indeterminate][disabled]) [part='checkbox']::after {
|
|
@@ -120,11 +115,6 @@ registerStyles(
|
|
|
120
115
|
padding: var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-s);
|
|
121
116
|
}
|
|
122
117
|
|
|
123
|
-
/* Transition the checkmark if activated with the mouse (disabled for grid select-all this way) */
|
|
124
|
-
:host(:hover) [part='checkbox']::after {
|
|
125
|
-
transition: width 0.1s, height 0.25s;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
118
|
/* Used for activation "halo" */
|
|
129
119
|
[part='checkbox']::before {
|
|
130
120
|
pointer-events: none;
|