@vaadin/checkbox 25.3.0-dev.3a3c2d7d2a → 25.3.0-rc1
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/custom-elements.json +76 -40
- package/package.json +10 -10
- package/src/styles/vaadin-checkbox-base-styles.js +2 -9
- package/src/vaadin-checkbox-mixin.d.ts +3 -3
- package/src/vaadin-checkbox-mixin.js +35 -36
- package/src/vaadin-checkbox.js +4 -1
- package/web-types.json +29 -31
- package/web-types.lit.json +13 -13
package/custom-elements.json
CHANGED
|
@@ -26,6 +26,20 @@
|
|
|
26
26
|
"description": "A mixin providing common checkbox functionality.",
|
|
27
27
|
"name": "CheckboxMixin",
|
|
28
28
|
"members": [
|
|
29
|
+
{
|
|
30
|
+
"kind": "field",
|
|
31
|
+
"name": "accessibleDescriptionRef",
|
|
32
|
+
"privacy": "public",
|
|
33
|
+
"type": {
|
|
34
|
+
"text": "string"
|
|
35
|
+
},
|
|
36
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
37
|
+
"attribute": "accessible-description-ref",
|
|
38
|
+
"inheritedFrom": {
|
|
39
|
+
"name": "FieldMixin",
|
|
40
|
+
"package": "@vaadin/field-base/src/field-mixin.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
29
43
|
{
|
|
30
44
|
"kind": "field",
|
|
31
45
|
"name": "accessibleName",
|
|
@@ -33,7 +47,7 @@
|
|
|
33
47
|
"type": {
|
|
34
48
|
"text": "string"
|
|
35
49
|
},
|
|
36
|
-
"description": "String used to label the component
|
|
50
|
+
"description": "String used to label the component for screen reader users.",
|
|
37
51
|
"attribute": "accessible-name",
|
|
38
52
|
"inheritedFrom": {
|
|
39
53
|
"name": "FieldMixin",
|
|
@@ -47,7 +61,7 @@
|
|
|
47
61
|
"type": {
|
|
48
62
|
"text": "string"
|
|
49
63
|
},
|
|
50
|
-
"description": "
|
|
64
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
51
65
|
"attribute": "accessible-name-ref",
|
|
52
66
|
"inheritedFrom": {
|
|
53
67
|
"name": "FieldMixin",
|
|
@@ -196,7 +210,7 @@
|
|
|
196
210
|
"type": {
|
|
197
211
|
"text": "string"
|
|
198
212
|
},
|
|
199
|
-
"description": "The name of the
|
|
213
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
200
214
|
"attribute": "name"
|
|
201
215
|
},
|
|
202
216
|
{
|
|
@@ -206,7 +220,7 @@
|
|
|
206
220
|
"type": {
|
|
207
221
|
"text": "boolean"
|
|
208
222
|
},
|
|
209
|
-
"description": "When true, the user cannot modify the value of the
|
|
223
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
210
224
|
"attribute": "readonly"
|
|
211
225
|
},
|
|
212
226
|
{
|
|
@@ -246,7 +260,6 @@
|
|
|
246
260
|
},
|
|
247
261
|
"description": "The value of the field.",
|
|
248
262
|
"attribute": "value",
|
|
249
|
-
"default": "'on'",
|
|
250
263
|
"inheritedFrom": {
|
|
251
264
|
"name": "InputMixin",
|
|
252
265
|
"package": "@vaadin/field-base/src/input-mixin.js"
|
|
@@ -254,12 +267,24 @@
|
|
|
254
267
|
}
|
|
255
268
|
],
|
|
256
269
|
"attributes": [
|
|
270
|
+
{
|
|
271
|
+
"name": "accessible-description-ref",
|
|
272
|
+
"type": {
|
|
273
|
+
"text": "string"
|
|
274
|
+
},
|
|
275
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
276
|
+
"fieldName": "accessibleDescriptionRef",
|
|
277
|
+
"inheritedFrom": {
|
|
278
|
+
"name": "FieldMixin",
|
|
279
|
+
"package": "@vaadin/field-base/src/field-mixin.js"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
257
282
|
{
|
|
258
283
|
"name": "accessible-name",
|
|
259
284
|
"type": {
|
|
260
285
|
"text": "string"
|
|
261
286
|
},
|
|
262
|
-
"description": "String used to label the component
|
|
287
|
+
"description": "String used to label the component for screen reader users.",
|
|
263
288
|
"fieldName": "accessibleName",
|
|
264
289
|
"inheritedFrom": {
|
|
265
290
|
"name": "FieldMixin",
|
|
@@ -271,7 +296,7 @@
|
|
|
271
296
|
"type": {
|
|
272
297
|
"text": "string"
|
|
273
298
|
},
|
|
274
|
-
"description": "
|
|
299
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
275
300
|
"fieldName": "accessibleNameRef",
|
|
276
301
|
"inheritedFrom": {
|
|
277
302
|
"name": "FieldMixin",
|
|
@@ -379,7 +404,7 @@
|
|
|
379
404
|
"type": {
|
|
380
405
|
"text": "string"
|
|
381
406
|
},
|
|
382
|
-
"description": "The name of the
|
|
407
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
383
408
|
"fieldName": "name"
|
|
384
409
|
},
|
|
385
410
|
{
|
|
@@ -387,7 +412,7 @@
|
|
|
387
412
|
"type": {
|
|
388
413
|
"text": "boolean"
|
|
389
414
|
},
|
|
390
|
-
"description": "When true, the user cannot modify the value of the
|
|
415
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
391
416
|
"fieldName": "readonly"
|
|
392
417
|
},
|
|
393
418
|
{
|
|
@@ -476,6 +501,20 @@
|
|
|
476
501
|
"description": "`<vaadin-checkbox>` is an input field representing a binary choice.\n\n```html\n<vaadin-checkbox label=\"I accept the terms and conditions\"></vaadin-checkbox>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|-------------\n`checkbox` | The element representing a stylable custom checkbox\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`active` | Set when the checkbox is activated with mouse, touch or the keyboard.\n`checked` | Set when the checkbox is checked.\n`disabled` | Set when the checkbox is disabled.\n`readonly` | Set when the checkbox is readonly.\n`focus-ring` | Set when the checkbox is focused using the keyboard.\n`focused` | Set when the checkbox is focused.\n`indeterminate` | Set when the checkbox is in the indeterminate state.\n`invalid` | Set when the checkbox is invalid.\n`has-label` | Set when the checkbox has a label.\n`has-helper` | Set when the checkbox has helper text.\n`has-error-message` | Set when the checkbox has an error message.\n`has-tooltip` | Set when the checkbox has a slotted tooltip.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-checkbox-background` |\n| `--vaadin-checkbox-border-color` |\n| `--vaadin-checkbox-border-radius` |\n| `--vaadin-checkbox-border-width` |\n| `--vaadin-checkbox-gap` |\n| `--vaadin-checkbox-label-color` |\n| `--vaadin-checkbox-label-font-size` |\n| `--vaadin-checkbox-label-font-weight` |\n| `--vaadin-checkbox-label-line-height` |\n| `--vaadin-checkbox-marker-color` |\n| `--vaadin-checkbox-marker-size` |\n| `--vaadin-checkbox-size` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
477
502
|
"name": "Checkbox",
|
|
478
503
|
"members": [
|
|
504
|
+
{
|
|
505
|
+
"kind": "field",
|
|
506
|
+
"name": "accessibleDescriptionRef",
|
|
507
|
+
"privacy": "public",
|
|
508
|
+
"type": {
|
|
509
|
+
"text": "string"
|
|
510
|
+
},
|
|
511
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
512
|
+
"attribute": "accessible-description-ref",
|
|
513
|
+
"inheritedFrom": {
|
|
514
|
+
"name": "FieldMixin",
|
|
515
|
+
"package": "@vaadin/field-base/src/field-mixin.js"
|
|
516
|
+
}
|
|
517
|
+
},
|
|
479
518
|
{
|
|
480
519
|
"kind": "field",
|
|
481
520
|
"name": "accessibleName",
|
|
@@ -483,7 +522,7 @@
|
|
|
483
522
|
"type": {
|
|
484
523
|
"text": "string"
|
|
485
524
|
},
|
|
486
|
-
"description": "String used to label the component
|
|
525
|
+
"description": "String used to label the component for screen reader users.",
|
|
487
526
|
"attribute": "accessible-name",
|
|
488
527
|
"inheritedFrom": {
|
|
489
528
|
"name": "FieldMixin",
|
|
@@ -497,7 +536,7 @@
|
|
|
497
536
|
"type": {
|
|
498
537
|
"text": "string"
|
|
499
538
|
},
|
|
500
|
-
"description": "
|
|
539
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
501
540
|
"attribute": "accessible-name-ref",
|
|
502
541
|
"inheritedFrom": {
|
|
503
542
|
"name": "FieldMixin",
|
|
@@ -655,7 +694,7 @@
|
|
|
655
694
|
"type": {
|
|
656
695
|
"text": "string"
|
|
657
696
|
},
|
|
658
|
-
"description": "The name of the
|
|
697
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
659
698
|
"attribute": "name",
|
|
660
699
|
"inheritedFrom": {
|
|
661
700
|
"name": "CheckboxMixin",
|
|
@@ -669,7 +708,7 @@
|
|
|
669
708
|
"type": {
|
|
670
709
|
"text": "boolean"
|
|
671
710
|
},
|
|
672
|
-
"description": "When true, the user cannot modify the value of the
|
|
711
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
673
712
|
"attribute": "readonly",
|
|
674
713
|
"inheritedFrom": {
|
|
675
714
|
"name": "CheckboxMixin",
|
|
@@ -690,18 +729,6 @@
|
|
|
690
729
|
"package": "@vaadin/field-base/src/validate-mixin.js"
|
|
691
730
|
}
|
|
692
731
|
},
|
|
693
|
-
{
|
|
694
|
-
"kind": "field",
|
|
695
|
-
"name": "tabindex",
|
|
696
|
-
"type": {
|
|
697
|
-
"text": "number"
|
|
698
|
-
},
|
|
699
|
-
"default": "0",
|
|
700
|
-
"inheritedFrom": {
|
|
701
|
-
"name": "CheckboxMixin",
|
|
702
|
-
"module": "src/vaadin-checkbox-mixin.js"
|
|
703
|
-
}
|
|
704
|
-
},
|
|
705
732
|
{
|
|
706
733
|
"kind": "method",
|
|
707
734
|
"name": "validate",
|
|
@@ -719,13 +746,15 @@
|
|
|
719
746
|
{
|
|
720
747
|
"kind": "field",
|
|
721
748
|
"name": "value",
|
|
749
|
+
"privacy": "public",
|
|
722
750
|
"type": {
|
|
723
751
|
"text": "string"
|
|
724
752
|
},
|
|
725
|
-
"
|
|
753
|
+
"description": "The value of the field.",
|
|
754
|
+
"attribute": "value",
|
|
726
755
|
"inheritedFrom": {
|
|
727
|
-
"name": "
|
|
728
|
-
"
|
|
756
|
+
"name": "InputMixin",
|
|
757
|
+
"package": "@vaadin/field-base/src/input-mixin.js"
|
|
729
758
|
}
|
|
730
759
|
}
|
|
731
760
|
],
|
|
@@ -767,12 +796,24 @@
|
|
|
767
796
|
}
|
|
768
797
|
],
|
|
769
798
|
"attributes": [
|
|
799
|
+
{
|
|
800
|
+
"name": "accessible-description-ref",
|
|
801
|
+
"type": {
|
|
802
|
+
"text": "string"
|
|
803
|
+
},
|
|
804
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
805
|
+
"fieldName": "accessibleDescriptionRef",
|
|
806
|
+
"inheritedFrom": {
|
|
807
|
+
"name": "FieldMixin",
|
|
808
|
+
"package": "@vaadin/field-base/src/field-mixin.js"
|
|
809
|
+
}
|
|
810
|
+
},
|
|
770
811
|
{
|
|
771
812
|
"name": "accessible-name",
|
|
772
813
|
"type": {
|
|
773
814
|
"text": "string"
|
|
774
815
|
},
|
|
775
|
-
"description": "String used to label the component
|
|
816
|
+
"description": "String used to label the component for screen reader users.",
|
|
776
817
|
"fieldName": "accessibleName",
|
|
777
818
|
"inheritedFrom": {
|
|
778
819
|
"name": "FieldMixin",
|
|
@@ -784,7 +825,7 @@
|
|
|
784
825
|
"type": {
|
|
785
826
|
"text": "string"
|
|
786
827
|
},
|
|
787
|
-
"description": "
|
|
828
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
788
829
|
"fieldName": "accessibleNameRef",
|
|
789
830
|
"inheritedFrom": {
|
|
790
831
|
"name": "FieldMixin",
|
|
@@ -900,7 +941,7 @@
|
|
|
900
941
|
"type": {
|
|
901
942
|
"text": "string"
|
|
902
943
|
},
|
|
903
|
-
"description": "The name of the
|
|
944
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
904
945
|
"fieldName": "name",
|
|
905
946
|
"inheritedFrom": {
|
|
906
947
|
"name": "CheckboxMixin",
|
|
@@ -912,7 +953,7 @@
|
|
|
912
953
|
"type": {
|
|
913
954
|
"text": "boolean"
|
|
914
955
|
},
|
|
915
|
-
"description": "When true, the user cannot modify the value of the
|
|
956
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
916
957
|
"fieldName": "readonly",
|
|
917
958
|
"inheritedFrom": {
|
|
918
959
|
"name": "CheckboxMixin",
|
|
@@ -932,16 +973,11 @@
|
|
|
932
973
|
}
|
|
933
974
|
},
|
|
934
975
|
{
|
|
935
|
-
"name": "tabindex",
|
|
936
976
|
"type": {
|
|
937
|
-
"text": "
|
|
977
|
+
"text": "string"
|
|
938
978
|
},
|
|
939
|
-
"description": "
|
|
940
|
-
"
|
|
941
|
-
"inheritedFrom": {
|
|
942
|
-
"name": "TabindexMixin",
|
|
943
|
-
"package": "@vaadin/a11y-base/src/tabindex-mixin.js"
|
|
944
|
-
}
|
|
979
|
+
"description": "The theme variants to apply to the component.",
|
|
980
|
+
"name": "theme"
|
|
945
981
|
},
|
|
946
982
|
{
|
|
947
983
|
"name": "value",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/checkbox",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-rc1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
39
|
-
"@vaadin/component-base": "25.3.0-
|
|
40
|
-
"@vaadin/field-base": "25.3.0-
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.3.0-rc1",
|
|
39
|
+
"@vaadin/component-base": "25.3.0-rc1",
|
|
40
|
+
"@vaadin/field-base": "25.3.0-rc1",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-rc1",
|
|
42
42
|
"lit": "^3.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@vaadin/aura": "25.3.0-
|
|
46
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
47
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
45
|
+
"@vaadin/aura": "25.3.0-rc1",
|
|
46
|
+
"@vaadin/chai-plugins": "25.3.0-rc1",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.3.0-rc1",
|
|
48
48
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-rc1",
|
|
50
50
|
"sinon": "^22.0.0"
|
|
51
51
|
},
|
|
52
52
|
"customElements": "custom-elements.json",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"web-types.json",
|
|
55
55
|
"web-types.lit.json"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "d4809590b2f61bd607e376ab3dec84f4bfb059a7"
|
|
58
58
|
}
|
|
@@ -10,21 +10,14 @@ import { field } from '@vaadin/field-base/src/styles/field-base-styles.js';
|
|
|
10
10
|
|
|
11
11
|
const checkbox = css`
|
|
12
12
|
[part='checkbox'] {
|
|
13
|
-
color: var(--vaadin-checkbox-checkmark-color, var(--
|
|
13
|
+
color: var(--vaadin-checkbox-checkmark-color, var(--_marker-color));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
[part='checkbox']::after {
|
|
17
17
|
inset: 0;
|
|
18
18
|
mask: var(--_vaadin-icon-checkmark) 50% /
|
|
19
19
|
var(--vaadin-checkbox-checkmark-size, var(--vaadin-checkbox-marker-size, 100%)) no-repeat;
|
|
20
|
-
filter: var(--vaadin-checkbox-checkmark-color, var(--
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host([readonly]) {
|
|
24
|
-
--vaadin-checkbox-background: transparent;
|
|
25
|
-
--vaadin-checkbox-border-color: var(--vaadin-border-color);
|
|
26
|
-
--vaadin-checkbox-marker-color: var(--vaadin-text-color);
|
|
27
|
-
--_border-style: dashed;
|
|
20
|
+
filter: var(--vaadin-checkbox-checkmark-color, var(--_marker-filter));
|
|
28
21
|
}
|
|
29
22
|
|
|
30
23
|
:host([indeterminate]) [part='checkbox']::after {
|
|
@@ -39,14 +39,14 @@ export declare function CheckboxMixin<T extends Constructor<HTMLElement>>(
|
|
|
39
39
|
|
|
40
40
|
export declare class CheckboxMixinClass {
|
|
41
41
|
/**
|
|
42
|
-
* The name of the
|
|
42
|
+
* The name of the control, which is submitted with the form data.
|
|
43
43
|
*/
|
|
44
44
|
name: string;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* When true, the user cannot modify the value of the
|
|
47
|
+
* When true, the user cannot modify the value of the control.
|
|
48
48
|
* The difference between `disabled` and `readonly` is that the
|
|
49
|
-
* read-only
|
|
49
|
+
* read-only element remains focusable, is announced by screen
|
|
50
50
|
* readers and its value can be submitted as part of the form.
|
|
51
51
|
*/
|
|
52
52
|
readonly: boolean;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ActiveMixin } from '@vaadin/a11y-base/src/active-mixin.js';
|
|
7
7
|
import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
|
|
8
|
+
import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
|
|
8
9
|
import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
9
10
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
10
11
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
@@ -21,7 +22,7 @@ export const CheckboxMixin = (superclass) =>
|
|
|
21
22
|
static get properties() {
|
|
22
23
|
return {
|
|
23
24
|
/**
|
|
24
|
-
* The name of the
|
|
25
|
+
* The name of the control, which is submitted with the form data.
|
|
25
26
|
*/
|
|
26
27
|
name: {
|
|
27
28
|
type: String,
|
|
@@ -29,9 +30,9 @@ export const CheckboxMixin = (superclass) =>
|
|
|
29
30
|
},
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
* When true, the user cannot modify the value of the
|
|
33
|
+
* When true, the user cannot modify the value of the control.
|
|
33
34
|
* The difference between `disabled` and `readonly` is that the
|
|
34
|
-
* read-only
|
|
35
|
+
* read-only element remains focusable, is announced by screen
|
|
35
36
|
* readers and its value can be submitted as part of the form.
|
|
36
37
|
*/
|
|
37
38
|
readonly: {
|
|
@@ -58,12 +59,18 @@ export const CheckboxMixin = (superclass) =>
|
|
|
58
59
|
|
|
59
60
|
this._boundOnInputClick = this._onInputClick.bind(this);
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Set the string "on" as the default value for the checkbox following the HTML specification:
|
|
64
|
+
* https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on
|
|
65
|
+
* @internal to not document it in CEM
|
|
66
|
+
*/
|
|
63
67
|
this.value = 'on';
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Set tabindex to 0 by default to not lose focus on click in Safari
|
|
71
|
+
* See https://github.com/vaadin/web-components/pull/6780
|
|
72
|
+
* @internal to not document it in CEM
|
|
73
|
+
*/
|
|
67
74
|
this.tabindex = 0;
|
|
68
75
|
}
|
|
69
76
|
|
|
@@ -99,10 +106,19 @@ export const CheckboxMixin = (superclass) =>
|
|
|
99
106
|
this._createPropertyObserver('checked', '_checkedChanged');
|
|
100
107
|
}
|
|
101
108
|
|
|
109
|
+
/** @protected */
|
|
110
|
+
updated(props) {
|
|
111
|
+
super.updated(props);
|
|
112
|
+
|
|
113
|
+
// Validate when the required constraint is removed.
|
|
114
|
+
if (props.has('required') && this.required === false) {
|
|
115
|
+
this._requestValidation();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
102
119
|
/**
|
|
103
|
-
* Override method inherited from `ActiveMixin` to
|
|
104
|
-
* attribute
|
|
105
|
-
* or when clicking slotted helper or error message element.
|
|
120
|
+
* Override method inherited from `ActiveMixin` to only set the `active`
|
|
121
|
+
* attribute for clicks that actually toggle the checked state.
|
|
106
122
|
*
|
|
107
123
|
* @param {Event} event
|
|
108
124
|
* @return {boolean}
|
|
@@ -110,12 +126,14 @@ export const CheckboxMixin = (superclass) =>
|
|
|
110
126
|
* @override
|
|
111
127
|
*/
|
|
112
128
|
_shouldSetActive(event) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
const [target] = event.composedPath();
|
|
130
|
+
|
|
131
|
+
const togglesChecked =
|
|
132
|
+
target === this.inputElement ||
|
|
133
|
+
target.part.contains('required-indicator') ||
|
|
134
|
+
(this._labelNode.contains(target) && !target.closest('a'));
|
|
135
|
+
|
|
136
|
+
if (this.readonly || !togglesChecked) {
|
|
119
137
|
return false;
|
|
120
138
|
}
|
|
121
139
|
|
|
@@ -161,11 +179,7 @@ export const CheckboxMixin = (superclass) =>
|
|
|
161
179
|
}
|
|
162
180
|
|
|
163
181
|
// Use aria-readonly since native checkbox doesn't support readonly
|
|
164
|
-
|
|
165
|
-
inputElement.setAttribute('aria-readonly', 'true');
|
|
166
|
-
} else {
|
|
167
|
-
inputElement.removeAttribute('aria-readonly');
|
|
168
|
-
}
|
|
182
|
+
setOrRemoveAttribute(inputElement, 'aria-readonly', readonly);
|
|
169
183
|
}
|
|
170
184
|
|
|
171
185
|
/**
|
|
@@ -198,21 +212,6 @@ export const CheckboxMixin = (superclass) =>
|
|
|
198
212
|
}
|
|
199
213
|
}
|
|
200
214
|
|
|
201
|
-
/**
|
|
202
|
-
* Override an observer from `FieldMixin`
|
|
203
|
-
* to validate when required is removed.
|
|
204
|
-
*
|
|
205
|
-
* @protected
|
|
206
|
-
* @override
|
|
207
|
-
*/
|
|
208
|
-
_requiredChanged(required) {
|
|
209
|
-
super._requiredChanged(required);
|
|
210
|
-
|
|
211
|
-
if (required === false) {
|
|
212
|
-
this._requestValidation();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
215
|
/** @private */
|
|
217
216
|
_onRequiredIndicatorClick() {
|
|
218
217
|
this._labelNode.click();
|
package/src/vaadin-checkbox.js
CHANGED
|
@@ -84,10 +84,11 @@ import { CheckboxMixin } from './vaadin-checkbox-mixin.js';
|
|
|
84
84
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
85
85
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
86
86
|
*
|
|
87
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
87
88
|
* @customElement vaadin-checkbox
|
|
88
89
|
* @extends HTMLElement
|
|
89
90
|
*/
|
|
90
|
-
|
|
91
|
+
class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
91
92
|
static get is() {
|
|
92
93
|
return 'vaadin-checkbox';
|
|
93
94
|
}
|
|
@@ -167,3 +168,5 @@ export class Checkbox extends CheckboxMixin(ElementMixin(ThemableMixin(PolylitMi
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
defineCustomElement(Checkbox);
|
|
171
|
+
|
|
172
|
+
export { Checkbox };
|
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.3.0-
|
|
4
|
+
"version": "25.3.0-rc1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -10,9 +10,18 @@
|
|
|
10
10
|
"name": "vaadin-checkbox",
|
|
11
11
|
"description": "`<vaadin-checkbox>` is an input field representing a binary choice.\n\n```html\n<vaadin-checkbox label=\"I accept the terms and conditions\"></vaadin-checkbox>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|-------------\n`checkbox` | The element representing a stylable custom checkbox\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`active` | Set when the checkbox is activated with mouse, touch or the keyboard.\n`checked` | Set when the checkbox is checked.\n`disabled` | Set when the checkbox is disabled.\n`readonly` | Set when the checkbox is readonly.\n`focus-ring` | Set when the checkbox is focused using the keyboard.\n`focused` | Set when the checkbox is focused.\n`indeterminate` | Set when the checkbox is in the indeterminate state.\n`invalid` | Set when the checkbox is invalid.\n`has-label` | Set when the checkbox has a label.\n`has-helper` | Set when the checkbox has helper text.\n`has-error-message` | Set when the checkbox has an error message.\n`has-tooltip` | Set when the checkbox has a slotted tooltip.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-checkbox-background` |\n| `--vaadin-checkbox-border-color` |\n| `--vaadin-checkbox-border-radius` |\n| `--vaadin-checkbox-border-width` |\n| `--vaadin-checkbox-gap` |\n| `--vaadin-checkbox-label-color` |\n| `--vaadin-checkbox-label-font-size` |\n| `--vaadin-checkbox-label-font-weight` |\n| `--vaadin-checkbox-label-line-height` |\n| `--vaadin-checkbox-marker-color` |\n| `--vaadin-checkbox-marker-size` |\n| `--vaadin-checkbox-size` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "accessible-description-ref",
|
|
15
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
13
22
|
{
|
|
14
23
|
"name": "accessible-name",
|
|
15
|
-
"description": "String used to label the component
|
|
24
|
+
"description": "String used to label the component for screen reader users.",
|
|
16
25
|
"value": {
|
|
17
26
|
"type": [
|
|
18
27
|
"string"
|
|
@@ -21,7 +30,7 @@
|
|
|
21
30
|
},
|
|
22
31
|
{
|
|
23
32
|
"name": "accessible-name-ref",
|
|
24
|
-
"description": "
|
|
33
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
25
34
|
"value": {
|
|
26
35
|
"type": [
|
|
27
36
|
"string"
|
|
@@ -111,7 +120,7 @@
|
|
|
111
120
|
},
|
|
112
121
|
{
|
|
113
122
|
"name": "name",
|
|
114
|
-
"description": "The name of the
|
|
123
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
115
124
|
"value": {
|
|
116
125
|
"type": [
|
|
117
126
|
"string"
|
|
@@ -120,7 +129,7 @@
|
|
|
120
129
|
},
|
|
121
130
|
{
|
|
122
131
|
"name": "readonly",
|
|
123
|
-
"description": "When true, the user cannot modify the value of the
|
|
132
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
124
133
|
"value": {
|
|
125
134
|
"type": [
|
|
126
135
|
"boolean"
|
|
@@ -136,23 +145,12 @@
|
|
|
136
145
|
]
|
|
137
146
|
}
|
|
138
147
|
},
|
|
139
|
-
{
|
|
140
|
-
"name": "tabindex",
|
|
141
|
-
"description": "Indicates whether the element can be focused and where it participates in sequential keyboard navigation.",
|
|
142
|
-
"value": {
|
|
143
|
-
"type": [
|
|
144
|
-
"number"
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
148
|
{
|
|
149
149
|
"name": "theme",
|
|
150
150
|
"description": "The theme variants to apply to the component.",
|
|
151
151
|
"value": {
|
|
152
152
|
"type": [
|
|
153
|
-
"string"
|
|
154
|
-
"null",
|
|
155
|
-
"undefined"
|
|
153
|
+
"string"
|
|
156
154
|
]
|
|
157
155
|
}
|
|
158
156
|
},
|
|
@@ -168,9 +166,18 @@
|
|
|
168
166
|
],
|
|
169
167
|
"js": {
|
|
170
168
|
"properties": [
|
|
169
|
+
{
|
|
170
|
+
"name": "accessibleDescriptionRef",
|
|
171
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
172
|
+
"value": {
|
|
173
|
+
"type": [
|
|
174
|
+
"string"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
},
|
|
171
178
|
{
|
|
172
179
|
"name": "accessibleName",
|
|
173
|
-
"description": "String used to label the component
|
|
180
|
+
"description": "String used to label the component for screen reader users.",
|
|
174
181
|
"value": {
|
|
175
182
|
"type": [
|
|
176
183
|
"string"
|
|
@@ -179,7 +186,7 @@
|
|
|
179
186
|
},
|
|
180
187
|
{
|
|
181
188
|
"name": "accessibleNameRef",
|
|
182
|
-
"description": "
|
|
189
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
183
190
|
"value": {
|
|
184
191
|
"type": [
|
|
185
192
|
"string"
|
|
@@ -269,7 +276,7 @@
|
|
|
269
276
|
},
|
|
270
277
|
{
|
|
271
278
|
"name": "name",
|
|
272
|
-
"description": "The name of the
|
|
279
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
273
280
|
"value": {
|
|
274
281
|
"type": [
|
|
275
282
|
"string"
|
|
@@ -278,7 +285,7 @@
|
|
|
278
285
|
},
|
|
279
286
|
{
|
|
280
287
|
"name": "readonly",
|
|
281
|
-
"description": "When true, the user cannot modify the value of the
|
|
288
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
282
289
|
"value": {
|
|
283
290
|
"type": [
|
|
284
291
|
"boolean"
|
|
@@ -294,18 +301,9 @@
|
|
|
294
301
|
]
|
|
295
302
|
}
|
|
296
303
|
},
|
|
297
|
-
{
|
|
298
|
-
"name": "tabindex",
|
|
299
|
-
"description": "",
|
|
300
|
-
"value": {
|
|
301
|
-
"type": [
|
|
302
|
-
"number"
|
|
303
|
-
]
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
304
|
{
|
|
307
305
|
"name": "value",
|
|
308
|
-
"description": "",
|
|
306
|
+
"description": "The value of the field.",
|
|
309
307
|
"value": {
|
|
310
308
|
"type": [
|
|
311
309
|
"string"
|
package/web-types.lit.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.3.0-
|
|
4
|
+
"version": "25.3.0-rc1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -19,16 +19,23 @@
|
|
|
19
19
|
"description": "`<vaadin-checkbox>` is an input field representing a binary choice.\n\n```html\n<vaadin-checkbox label=\"I accept the terms and conditions\"></vaadin-checkbox>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|-------------\n`checkbox` | The element representing a stylable custom checkbox\n`label` | The slotted label element wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`active` | Set when the checkbox is activated with mouse, touch or the keyboard.\n`checked` | Set when the checkbox is checked.\n`disabled` | Set when the checkbox is disabled.\n`readonly` | Set when the checkbox is readonly.\n`focus-ring` | Set when the checkbox is focused using the keyboard.\n`focused` | Set when the checkbox is focused.\n`indeterminate` | Set when the checkbox is in the indeterminate state.\n`invalid` | Set when the checkbox is invalid.\n`has-label` | Set when the checkbox has a label.\n`has-helper` | Set when the checkbox has helper text.\n`has-error-message` | Set when the checkbox has an error message.\n`has-tooltip` | Set when the checkbox has a slotted tooltip.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-checkbox-background` |\n| `--vaadin-checkbox-border-color` |\n| `--vaadin-checkbox-border-radius` |\n| `--vaadin-checkbox-border-width` |\n| `--vaadin-checkbox-gap` |\n| `--vaadin-checkbox-label-color` |\n| `--vaadin-checkbox-label-font-size` |\n| `--vaadin-checkbox-label-font-weight` |\n| `--vaadin-checkbox-label-line-height` |\n| `--vaadin-checkbox-marker-color` |\n| `--vaadin-checkbox-marker-size` |\n| `--vaadin-checkbox-size` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": ".accessibleDescriptionRef",
|
|
24
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
22
29
|
{
|
|
23
30
|
"name": ".accessibleName",
|
|
24
|
-
"description": "String used to label the component
|
|
31
|
+
"description": "String used to label the component for screen reader users.",
|
|
25
32
|
"value": {
|
|
26
33
|
"kind": "expression"
|
|
27
34
|
}
|
|
28
35
|
},
|
|
29
36
|
{
|
|
30
37
|
"name": ".accessibleNameRef",
|
|
31
|
-
"description": "
|
|
38
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
32
39
|
"value": {
|
|
33
40
|
"kind": "expression"
|
|
34
41
|
}
|
|
@@ -98,14 +105,14 @@
|
|
|
98
105
|
},
|
|
99
106
|
{
|
|
100
107
|
"name": ".name",
|
|
101
|
-
"description": "The name of the
|
|
108
|
+
"description": "The name of the control, which is submitted with the form data.",
|
|
102
109
|
"value": {
|
|
103
110
|
"kind": "expression"
|
|
104
111
|
}
|
|
105
112
|
},
|
|
106
113
|
{
|
|
107
114
|
"name": "?readonly",
|
|
108
|
-
"description": "When true, the user cannot modify the value of the
|
|
115
|
+
"description": "When true, the user cannot modify the value of the control.\nThe difference between `disabled` and `readonly` is that the\nread-only element remains focusable, is announced by screen\nreaders and its value can be submitted as part of the form.",
|
|
109
116
|
"value": {
|
|
110
117
|
"kind": "expression"
|
|
111
118
|
}
|
|
@@ -117,16 +124,9 @@
|
|
|
117
124
|
"kind": "expression"
|
|
118
125
|
}
|
|
119
126
|
},
|
|
120
|
-
{
|
|
121
|
-
"name": ".tabindex",
|
|
122
|
-
"description": "",
|
|
123
|
-
"value": {
|
|
124
|
-
"kind": "expression"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
127
|
{
|
|
128
128
|
"name": ".value",
|
|
129
|
-
"description": "",
|
|
129
|
+
"description": "The value of the field.",
|
|
130
130
|
"value": {
|
|
131
131
|
"kind": "expression"
|
|
132
132
|
}
|