@vaadin/checkbox 24.0.0-alpha1 → 24.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": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "24.0.0-
|
|
40
|
-
"@vaadin/field-base": "24.0.0-
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
42
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
39
|
+
"@vaadin/component-base": "24.0.0-alpha11",
|
|
40
|
+
"@vaadin/field-base": "24.0.0-alpha11",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha11",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha11",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha11"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"web-types.json",
|
|
52
52
|
"web-types.lit.json"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "641b3d96ceeb3e503a093682ebe686afdd8c3a68"
|
|
55
55
|
}
|
package/src/vaadin-checkbox.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
3
|
+
* Copyright (c) 2017 - 2023 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';
|
|
7
7
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
+
import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
8
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
10
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
10
|
-
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
11
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
|
|
package/src/vaadin-checkbox.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
3
|
+
* Copyright (c) 2017 - 2023 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';
|
|
7
7
|
import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
|
|
8
8
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
|
+
import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
9
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
11
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
11
12
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
12
|
-
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
13
13
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
14
14
|
import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
|
|
15
15
|
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
16
|
-
import { SlotTargetController } from '@vaadin/field-base/src/slot-target-controller.js';
|
|
17
16
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -85,35 +84,42 @@ class Checkbox extends LabelMixin(
|
|
|
85
84
|
align-items: baseline;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
[part='checkbox'],
|
|
88
|
+
::slotted(input),
|
|
89
|
+
::slotted(label) {
|
|
90
|
+
grid-row: 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[part='checkbox'],
|
|
94
|
+
::slotted(input) {
|
|
95
|
+
grid-column: 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[part='checkbox'] {
|
|
99
|
+
width: var(--vaadin-checkbox-size, 1em);
|
|
100
|
+
height: var(--vaadin-checkbox-size, 1em);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[part='checkbox']::before {
|
|
104
|
+
display: block;
|
|
105
|
+
content: '\\202F';
|
|
106
|
+
line-height: var(--vaadin-checkbox-size, 1em);
|
|
107
|
+
contain: paint;
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
/* visually hidden */
|
|
94
111
|
::slotted(input) {
|
|
95
|
-
position: absolute;
|
|
96
|
-
top: 0;
|
|
97
|
-
left: 0;
|
|
98
|
-
right: 0;
|
|
99
|
-
width: 100%;
|
|
100
|
-
height: 100%;
|
|
101
112
|
opacity: 0;
|
|
102
113
|
cursor: inherit;
|
|
103
114
|
margin: 0;
|
|
115
|
+
align-self: stretch;
|
|
116
|
+
-webkit-appearance: none;
|
|
104
117
|
}
|
|
105
118
|
</style>
|
|
106
119
|
<div class="vaadin-checkbox-container">
|
|
107
|
-
<div
|
|
108
|
-
|
|
109
|
-
<slot name="input"></slot>
|
|
110
|
-
</div>
|
|
111
|
-
|
|
120
|
+
<div part="checkbox"></div>
|
|
121
|
+
<slot name="input"></slot>
|
|
112
122
|
<slot name="label"></slot>
|
|
113
|
-
|
|
114
|
-
<div style="display: none !important">
|
|
115
|
-
<slot id="noop"></slot>
|
|
116
|
-
</div>
|
|
117
123
|
</div>
|
|
118
124
|
<slot name="tooltip"></slot>
|
|
119
125
|
`;
|
|
@@ -182,25 +188,10 @@ class Checkbox extends LabelMixin(
|
|
|
182
188
|
}),
|
|
183
189
|
);
|
|
184
190
|
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
185
|
-
this.addController(
|
|
186
|
-
new SlotTargetController(
|
|
187
|
-
this.$.noop,
|
|
188
|
-
() => this._labelController.node,
|
|
189
|
-
() => this.__warnDeprecated(),
|
|
190
|
-
),
|
|
191
|
-
);
|
|
192
191
|
this._tooltipController = new TooltipController(this);
|
|
193
192
|
this.addController(this._tooltipController);
|
|
194
193
|
}
|
|
195
194
|
|
|
196
|
-
/** @private */
|
|
197
|
-
__warnDeprecated() {
|
|
198
|
-
console.warn(
|
|
199
|
-
`WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-checkbox> is deprecated.
|
|
200
|
-
Please use <label slot="label"> wrapper or the label property instead.`,
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
195
|
/**
|
|
205
196
|
* Extends the method from `ActiveMixin` in order to
|
|
206
197
|
* prevent setting the `active` attribute when interacting with a link inside the label.
|
|
@@ -22,23 +22,23 @@ registerStyles(
|
|
|
22
22
|
user-select: none;
|
|
23
23
|
cursor: default;
|
|
24
24
|
outline: none;
|
|
25
|
+
--_checkbox-size: var(--vaadin-checkbox-size, calc(var(--lumo-size-m) / 2));
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
:host([has-label]) ::slotted(label) {
|
|
28
|
-
padding: var(--lumo-space-xs)
|
|
29
|
+
padding-block: var(--lumo-space-xs);
|
|
30
|
+
padding-inline: var(--lumo-space-xs) var(--lumo-space-s);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
[part='checkbox'] {
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
34
|
+
width: var(--_checkbox-size);
|
|
35
|
+
height: var(--_checkbox-size);
|
|
34
36
|
margin: var(--lumo-space-xs);
|
|
35
37
|
position: relative;
|
|
36
38
|
border-radius: var(--lumo-border-radius-s);
|
|
37
39
|
background-color: var(--lumo-contrast-20pct);
|
|
38
40
|
transition: transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2), background-color 0.15s;
|
|
39
|
-
line-height: 1.2;
|
|
40
41
|
cursor: var(--lumo-clickable-cursor);
|
|
41
|
-
flex: none;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
:host([indeterminate]) [part='checkbox'],
|
|
@@ -46,18 +46,13 @@ registerStyles(
|
|
|
46
46
|
background-color: var(--lumo-primary-color);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/* Needed to align the checkbox nicely on the baseline */
|
|
50
|
-
[part='checkbox']::before {
|
|
51
|
-
content: '\\2003';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
49
|
/* Checkmark */
|
|
55
50
|
[part='checkbox']::after {
|
|
56
51
|
pointer-events: none;
|
|
57
52
|
font-family: 'lumo-icons';
|
|
58
53
|
content: var(--lumo-icons-checkmark);
|
|
59
54
|
color: var(--lumo-primary-contrast-color);
|
|
60
|
-
font-size: calc(var(--
|
|
55
|
+
font-size: calc(var(--_checkbox-size) + 2px);
|
|
61
56
|
line-height: 1;
|
|
62
57
|
position: absolute;
|
|
63
58
|
top: -1px;
|
|
@@ -119,9 +114,9 @@ registerStyles(
|
|
|
119
114
|
[part='checkbox']::before {
|
|
120
115
|
pointer-events: none;
|
|
121
116
|
color: transparent;
|
|
122
|
-
display: inline-block;
|
|
123
117
|
width: 100%;
|
|
124
118
|
height: 100%;
|
|
119
|
+
line-height: var(--_checkbox-size);
|
|
125
120
|
border-radius: inherit;
|
|
126
121
|
background-color: inherit;
|
|
127
122
|
transform: scale(1.4);
|
|
@@ -12,6 +12,7 @@ registerStyles(
|
|
|
12
12
|
user-select: none;
|
|
13
13
|
outline: none;
|
|
14
14
|
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
--_checkbox-size: var(--vaadin-checkbox-size, 16px);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
:host([has-label]) ::slotted(label) {
|
|
@@ -19,25 +20,21 @@ registerStyles(
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
[part='checkbox'] {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
height: 16px;
|
|
23
|
+
width: var(--_checkbox-size);
|
|
24
|
+
height: var(--_checkbox-size);
|
|
25
25
|
margin: 4px;
|
|
26
26
|
position: relative;
|
|
27
27
|
border-radius: 2px;
|
|
28
28
|
box-shadow: inset 0 0 0 2px var(--material-secondary-text-color);
|
|
29
|
-
line-height: 1.275;
|
|
30
29
|
background-color: transparent;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
/* Used for the ripple */
|
|
34
33
|
[part='checkbox']::before {
|
|
35
|
-
/* Needed to align the checkbox nicely on the baseline */
|
|
36
|
-
content: '\\2003';
|
|
37
34
|
pointer-events: none;
|
|
38
|
-
display: inline-block;
|
|
39
35
|
width: 100%;
|
|
40
36
|
height: 100%;
|
|
37
|
+
line-height: var(--_checkbox-size);
|
|
41
38
|
border-radius: 50%;
|
|
42
39
|
background-color: var(--material-disabled-text-color);
|
|
43
40
|
transform: scale(0);
|
package/web-types.json
CHANGED