@vaadin/field-base 25.1.0-alpha2 → 25.1.0-alpha4
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 +7 -7
- package/src/checked-mixin.js +34 -37
- package/src/label-mixin.js +48 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "25.1.0-
|
|
3
|
+
"version": "25.1.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
|
-
"@vaadin/a11y-base": "25.1.0-
|
|
35
|
-
"@vaadin/component-base": "25.1.0-
|
|
34
|
+
"@vaadin/a11y-base": "25.1.0-alpha4",
|
|
35
|
+
"@vaadin/component-base": "25.1.0-alpha4",
|
|
36
36
|
"lit": "^3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@vaadin/chai-plugins": "25.1.0-
|
|
40
|
-
"@vaadin/input-container": "25.1.0-
|
|
41
|
-
"@vaadin/test-runner-commands": "25.1.0-
|
|
39
|
+
"@vaadin/chai-plugins": "25.1.0-alpha4",
|
|
40
|
+
"@vaadin/input-container": "25.1.0-alpha4",
|
|
41
|
+
"@vaadin/test-runner-commands": "25.1.0-alpha4",
|
|
42
42
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
43
43
|
"sinon": "^21.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "4fb917150617231c1acf27faabf386560dcd3bc5"
|
|
46
46
|
}
|
package/src/checked-mixin.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
6
|
import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
8
7
|
import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
9
8
|
import { InputMixin } from './input-mixin.js';
|
|
@@ -16,43 +15,41 @@ import { InputMixin } from './input-mixin.js';
|
|
|
16
15
|
* @mixes DisabledMixin
|
|
17
16
|
* @mixes InputMixin
|
|
18
17
|
*/
|
|
19
|
-
export const CheckedMixin =
|
|
20
|
-
(superclass)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
18
|
+
export const CheckedMixin = (superclass) =>
|
|
19
|
+
class CheckedMixinClass extends DelegateStateMixin(DisabledMixin(InputMixin(superclass))) {
|
|
20
|
+
static get properties() {
|
|
21
|
+
return {
|
|
22
|
+
/**
|
|
23
|
+
* True if the element is checked.
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
26
|
+
checked: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
value: false,
|
|
29
|
+
notify: true,
|
|
30
|
+
reflectToAttribute: true,
|
|
31
|
+
sync: true,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
static get delegateProps() {
|
|
37
|
+
return [...super.delegateProps, 'checked'];
|
|
38
|
+
}
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @param {Event} event
|
|
42
|
+
* @protected
|
|
43
|
+
* @override
|
|
44
|
+
*/
|
|
45
|
+
_onChange(event) {
|
|
46
|
+
const input = event.target;
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
this._toggleChecked(input.checked);
|
|
49
|
+
}
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
51
|
+
/** @protected */
|
|
52
|
+
_toggleChecked(checked) {
|
|
53
|
+
this.checked = checked;
|
|
54
|
+
}
|
|
55
|
+
};
|
package/src/label-mixin.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
6
|
import { LabelController } from './label-controller.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -11,53 +10,51 @@ import { LabelController } from './label-controller.js';
|
|
|
11
10
|
*
|
|
12
11
|
* @polymerMixin
|
|
13
12
|
*/
|
|
14
|
-
export const LabelMixin =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ready()
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
);
|
|
13
|
+
export const LabelMixin = (superclass) =>
|
|
14
|
+
class LabelMixinClass extends superclass {
|
|
15
|
+
static get properties() {
|
|
16
|
+
return {
|
|
17
|
+
/**
|
|
18
|
+
* The label text for the input node.
|
|
19
|
+
* When no light dom defined via [slot=label], this value will be used.
|
|
20
|
+
*/
|
|
21
|
+
label: {
|
|
22
|
+
type: String,
|
|
23
|
+
observer: '_labelChanged',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
|
|
31
|
+
this._labelController = new LabelController(this);
|
|
32
|
+
|
|
33
|
+
this._labelController.addEventListener('slot-content-changed', (event) => {
|
|
34
|
+
this.toggleAttribute('has-label', event.detail.hasContent);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @protected */
|
|
39
|
+
get _labelId() {
|
|
40
|
+
const node = this._labelNode;
|
|
41
|
+
return node && node.id;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @protected */
|
|
45
|
+
get _labelNode() {
|
|
46
|
+
return this._labelController.node;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @protected */
|
|
50
|
+
ready() {
|
|
51
|
+
super.ready();
|
|
52
|
+
|
|
53
|
+
this.addController(this._labelController);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @protected */
|
|
57
|
+
_labelChanged(label) {
|
|
58
|
+
this._labelController.setLabel(label);
|
|
59
|
+
}
|
|
60
|
+
};
|