@vaadin/checkbox 23.0.0-alpha5 → 23.0.0-beta4
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-beta4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "23.0.0-
|
|
38
|
-
"@vaadin/field-base": "23.0.0-
|
|
39
|
-
"@vaadin/vaadin-lumo-styles": "23.0.0-
|
|
40
|
-
"@vaadin/vaadin-material-styles": "23.0.0-
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "23.0.0-
|
|
37
|
+
"@vaadin/component-base": "23.0.0-beta4",
|
|
38
|
+
"@vaadin/field-base": "23.0.0-beta4",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-beta4",
|
|
40
|
+
"@vaadin/vaadin-material-styles": "23.0.0-beta4",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-beta4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@esm-bundle/chai": "^4.3.4",
|
|
45
45
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
46
46
|
"sinon": "^9.2.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "d0b447f1c31ca4256a5e26f2dcd27784447ff79b"
|
|
49
49
|
}
|
package/src/vaadin-checkbox.d.ts
CHANGED
|
@@ -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
|
@@ -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 */
|
|
@@ -178,29 +180,18 @@ class Checkbox extends SlotLabelMixin(
|
|
|
178
180
|
});
|
|
179
181
|
this.addController(this._inputController);
|
|
180
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
|
+
);
|
|
181
190
|
}
|
|
182
191
|
}
|
|
183
192
|
|
|
184
|
-
/**
|
|
185
|
-
|
|
186
|
-
*
|
|
187
|
-
* @override
|
|
188
|
-
* @protected
|
|
189
|
-
* @type {HTMLSlotElement}
|
|
190
|
-
*/
|
|
191
|
-
get _sourceSlot() {
|
|
192
|
-
return this.$.noop;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Override __copyNodesToSlotTarget from SlotTargetMixin to show a warning.
|
|
197
|
-
* @override
|
|
198
|
-
* @protected
|
|
199
|
-
* @param {!Array<!Node>} nodes
|
|
200
|
-
**/
|
|
201
|
-
__copyNodesToSlotTarget(nodes) {
|
|
202
|
-
super.__copyNodesToSlotTarget(nodes);
|
|
203
|
-
|
|
193
|
+
/** @private */
|
|
194
|
+
__warnDeprecated() {
|
|
204
195
|
console.warn(
|
|
205
196
|
`WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-checkbox> is deprecated.
|
|
206
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;
|