@cscfi/csc-ui 4.0.0-rc.4 → 4.0.0-rc.5
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/dist/csc-ui.js +12582 -11967
- package/dist/custom-elements.json +127 -23
- package/dist/docs/c-button/usage.md +60 -6
- package/dist/docs/c-color-picker/usage.md +2 -1
- package/dist/docs/c-date-picker/usage.md +2 -1
- package/dist/docs/c-file-upload/usage.md +3 -3
- package/dist/docs/c-otp-input/usage.md +4 -1
- package/dist/docs/c-radio-group/usage.md +3 -1
- package/dist/docs/c-slider/usage.md +2 -2
- package/dist/docs/c-text-field/usage.md +53 -1
- package/dist/styles/css/tailwind-theme.css +6 -0
- package/dist/styles/css/tokens.css +95 -88
- package/dist/vscode.css-custom-data.json +2 -2
- package/dist/vscode.html-custom-data.json +62 -14
- package/dist/web-types.json +84 -28
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +2 -1
- package/dist-types/components/c-button/CButton.vue.d.ts +3 -1
- package/dist-types/components/c-button/injectButtonStyles.d.ts +1 -0
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +8 -0
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +3 -3
- package/dist-types/components/c-color-picker/CColorPicker.vue.d.ts +2 -1
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +2 -1
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +2 -1
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +7 -0
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +8 -0
- package/dist-types/components/c-select/CSelect.vue.d.ts +2 -1
- package/dist-types/components/c-slider/CSlider.vue.d.ts +2 -3
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +8 -0
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +3 -2
- package/dist-types/components/c-text-field/injectTextFieldStyles.d.ts +1 -0
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +2 -1
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +1 -1
- package/dist-types/registry.d.ts +7 -0
- package/dist-types/shared/defineElement.d.ts +5 -1
- package/dist-types/shared/implicitSubmission.d.ts +31 -0
- package/dist-types/shared/useElementInternals.d.ts +7 -0
- package/dist-types/shared/useFormAssociation.d.ts +88 -0
- package/dist-types/shared/useHostStates.d.ts +5 -4
- package/dist-types/shared/useTypedField.d.ts +7 -0
- package/dist-types/shared/valueEvents.d.ts +6 -0
- package/dist-types/tag-name-map.d.ts +50 -21
- package/package.json +3 -2
|
@@ -805,7 +805,7 @@
|
|
|
805
805
|
"cssParts": [
|
|
806
806
|
{
|
|
807
807
|
"name": "root",
|
|
808
|
-
"description": "The item's box: its share of the accordion frame, the lifted outline and
|
|
808
|
+
"description": "The item's box: its share of the accordion frame, the lifted outline and tint while expanded, and the ring the accordion's `outlined` adds"
|
|
809
809
|
},
|
|
810
810
|
{
|
|
811
811
|
"name": "header",
|
|
@@ -936,7 +936,7 @@
|
|
|
936
936
|
"cssParts": [
|
|
937
937
|
{
|
|
938
938
|
"name": "root",
|
|
939
|
-
"description": "The
|
|
939
|
+
"description": "The box carrying the type's tint, hairline border and accent edge"
|
|
940
940
|
},
|
|
941
941
|
{
|
|
942
942
|
"name": "icon",
|
|
@@ -1201,7 +1201,7 @@
|
|
|
1201
1201
|
{
|
|
1202
1202
|
"fieldName": "name",
|
|
1203
1203
|
"name": "name",
|
|
1204
|
-
"description": "
|
|
1204
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
1205
1205
|
"type": {
|
|
1206
1206
|
"text": "string"
|
|
1207
1207
|
},
|
|
@@ -1571,7 +1571,7 @@
|
|
|
1571
1571
|
"kind": "field",
|
|
1572
1572
|
"name": "name",
|
|
1573
1573
|
"privacy": "public",
|
|
1574
|
-
"description": "
|
|
1574
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
1575
1575
|
"type": {
|
|
1576
1576
|
"text": "string"
|
|
1577
1577
|
},
|
|
@@ -2385,7 +2385,7 @@
|
|
|
2385
2385
|
"slots": [
|
|
2386
2386
|
{
|
|
2387
2387
|
"name": "default",
|
|
2388
|
-
"description": "Button label content."
|
|
2388
|
+
"description": "Button label content, or a slotted `<button>` (ADR-0085):\nthe page's own native button, which a password manager reading the form's\nsubmit button finds. Its own `type`, `disabled`, `name`, `value` and\n`form` apply; the element paints its look."
|
|
2389
2389
|
},
|
|
2390
2390
|
{
|
|
2391
2391
|
"name": "icon",
|
|
@@ -2470,6 +2470,18 @@
|
|
|
2470
2470
|
},
|
|
2471
2471
|
"default": "false"
|
|
2472
2472
|
},
|
|
2473
|
+
{
|
|
2474
|
+
"fieldName": "name",
|
|
2475
|
+
"name": "name",
|
|
2476
|
+
"description": "The name the active button's value submits under in a native `<form>` —\none entry per active button with `multiple`, nothing while none is active",
|
|
2477
|
+
"type": {
|
|
2478
|
+
"text": "string"
|
|
2479
|
+
},
|
|
2480
|
+
"default": "''",
|
|
2481
|
+
"csc": {
|
|
2482
|
+
"freeform": true
|
|
2483
|
+
}
|
|
2484
|
+
},
|
|
2473
2485
|
{
|
|
2474
2486
|
"fieldName": "required",
|
|
2475
2487
|
"name": "required",
|
|
@@ -2580,6 +2592,19 @@
|
|
|
2580
2592
|
},
|
|
2581
2593
|
"default": "false"
|
|
2582
2594
|
},
|
|
2595
|
+
{
|
|
2596
|
+
"kind": "field",
|
|
2597
|
+
"name": "name",
|
|
2598
|
+
"privacy": "public",
|
|
2599
|
+
"description": "The name the active button's value submits under in a native `<form>` —\none entry per active button with `multiple`, nothing while none is active",
|
|
2600
|
+
"type": {
|
|
2601
|
+
"text": "string"
|
|
2602
|
+
},
|
|
2603
|
+
"default": "''",
|
|
2604
|
+
"csc": {
|
|
2605
|
+
"freeform": true
|
|
2606
|
+
}
|
|
2607
|
+
},
|
|
2583
2608
|
{
|
|
2584
2609
|
"kind": "field",
|
|
2585
2610
|
"name": "required",
|
|
@@ -3134,7 +3159,7 @@
|
|
|
3134
3159
|
{
|
|
3135
3160
|
"fieldName": "name",
|
|
3136
3161
|
"name": "name",
|
|
3137
|
-
"description": "
|
|
3162
|
+
"description": "The name the checkbox submits under in a native `<form>` while it is\nchecked: its `true-value`, or `on` when that is `true`",
|
|
3138
3163
|
"type": {
|
|
3139
3164
|
"text": "string"
|
|
3140
3165
|
},
|
|
@@ -3340,7 +3365,7 @@
|
|
|
3340
3365
|
"kind": "field",
|
|
3341
3366
|
"name": "name",
|
|
3342
3367
|
"privacy": "public",
|
|
3343
|
-
"description": "
|
|
3368
|
+
"description": "The name the checkbox submits under in a native `<form>` while it is\nchecked: its `true-value`, or `on` when that is `true`",
|
|
3344
3369
|
"type": {
|
|
3345
3370
|
"text": "string"
|
|
3346
3371
|
},
|
|
@@ -3557,7 +3582,7 @@
|
|
|
3557
3582
|
{
|
|
3558
3583
|
"fieldName": "name",
|
|
3559
3584
|
"name": "name",
|
|
3560
|
-
"description": "
|
|
3585
|
+
"description": "The name the colour submits under in a native `<form>`, in the\npicker's notation",
|
|
3561
3586
|
"type": {
|
|
3562
3587
|
"text": "string"
|
|
3563
3588
|
},
|
|
@@ -3903,7 +3928,7 @@
|
|
|
3903
3928
|
"kind": "field",
|
|
3904
3929
|
"name": "name",
|
|
3905
3930
|
"privacy": "public",
|
|
3906
|
-
"description": "
|
|
3931
|
+
"description": "The name the colour submits under in a native `<form>`, in the\npicker's notation",
|
|
3907
3932
|
"type": {
|
|
3908
3933
|
"text": "string"
|
|
3909
3934
|
},
|
|
@@ -4737,7 +4762,7 @@
|
|
|
4737
4762
|
{
|
|
4738
4763
|
"fieldName": "name",
|
|
4739
4764
|
"name": "name",
|
|
4740
|
-
"description": "
|
|
4765
|
+
"description": "The name the date submits under in a native `<form>`, as its ISO text;\na `range` as one ISO 8601 interval, `start/end`",
|
|
4741
4766
|
"type": {
|
|
4742
4767
|
"text": "string"
|
|
4743
4768
|
},
|
|
@@ -5192,7 +5217,7 @@
|
|
|
5192
5217
|
"kind": "field",
|
|
5193
5218
|
"name": "name",
|
|
5194
5219
|
"privacy": "public",
|
|
5195
|
-
"description": "
|
|
5220
|
+
"description": "The name the date submits under in a native `<form>`, as its ISO text;\na `range` as one ISO 8601 interval, `start/end`",
|
|
5196
5221
|
"type": {
|
|
5197
5222
|
"text": "string"
|
|
5198
5223
|
},
|
|
@@ -8564,7 +8589,7 @@
|
|
|
8564
8589
|
{
|
|
8565
8590
|
"fieldName": "name",
|
|
8566
8591
|
"name": "name",
|
|
8567
|
-
"description": "
|
|
8592
|
+
"description": "The name the number submits under in a native `<form>`, written as a\nplain JS number (`1234.5`)",
|
|
8568
8593
|
"type": {
|
|
8569
8594
|
"text": "string"
|
|
8570
8595
|
},
|
|
@@ -8876,7 +8901,7 @@
|
|
|
8876
8901
|
"kind": "field",
|
|
8877
8902
|
"name": "name",
|
|
8878
8903
|
"privacy": "public",
|
|
8879
|
-
"description": "
|
|
8904
|
+
"description": "The name the number submits under in a native `<form>`, written as a\nplain JS number (`1234.5`)",
|
|
8880
8905
|
"type": {
|
|
8881
8906
|
"text": "string"
|
|
8882
8907
|
},
|
|
@@ -9299,6 +9324,18 @@
|
|
|
9299
9324
|
},
|
|
9300
9325
|
"default": "6"
|
|
9301
9326
|
},
|
|
9327
|
+
{
|
|
9328
|
+
"fieldName": "name",
|
|
9329
|
+
"name": "name",
|
|
9330
|
+
"description": "The name the code submits under in a native `<form>`, as typed so far",
|
|
9331
|
+
"type": {
|
|
9332
|
+
"text": "string"
|
|
9333
|
+
},
|
|
9334
|
+
"default": "''",
|
|
9335
|
+
"csc": {
|
|
9336
|
+
"freeform": true
|
|
9337
|
+
}
|
|
9338
|
+
},
|
|
9302
9339
|
{
|
|
9303
9340
|
"fieldName": "required",
|
|
9304
9341
|
"name": "required",
|
|
@@ -9465,6 +9502,19 @@
|
|
|
9465
9502
|
},
|
|
9466
9503
|
"default": "6"
|
|
9467
9504
|
},
|
|
9505
|
+
{
|
|
9506
|
+
"kind": "field",
|
|
9507
|
+
"name": "name",
|
|
9508
|
+
"privacy": "public",
|
|
9509
|
+
"description": "The name the code submits under in a native `<form>`, as typed so far",
|
|
9510
|
+
"type": {
|
|
9511
|
+
"text": "string"
|
|
9512
|
+
},
|
|
9513
|
+
"default": "''",
|
|
9514
|
+
"csc": {
|
|
9515
|
+
"freeform": true
|
|
9516
|
+
}
|
|
9517
|
+
},
|
|
9468
9518
|
{
|
|
9469
9519
|
"kind": "field",
|
|
9470
9520
|
"name": "required",
|
|
@@ -10461,6 +10511,18 @@
|
|
|
10461
10511
|
"freeform": true
|
|
10462
10512
|
}
|
|
10463
10513
|
},
|
|
10514
|
+
{
|
|
10515
|
+
"fieldName": "name",
|
|
10516
|
+
"name": "name",
|
|
10517
|
+
"description": "The name the picked radio's value submits under in a native `<form>`;\nnothing submits while no radio is picked",
|
|
10518
|
+
"type": {
|
|
10519
|
+
"text": "string"
|
|
10520
|
+
},
|
|
10521
|
+
"default": "''",
|
|
10522
|
+
"csc": {
|
|
10523
|
+
"freeform": true
|
|
10524
|
+
}
|
|
10525
|
+
},
|
|
10464
10526
|
{
|
|
10465
10527
|
"fieldName": "required",
|
|
10466
10528
|
"name": "required",
|
|
@@ -10613,6 +10675,19 @@
|
|
|
10613
10675
|
"freeform": true
|
|
10614
10676
|
}
|
|
10615
10677
|
},
|
|
10678
|
+
{
|
|
10679
|
+
"kind": "field",
|
|
10680
|
+
"name": "name",
|
|
10681
|
+
"privacy": "public",
|
|
10682
|
+
"description": "The name the picked radio's value submits under in a native `<form>`;\nnothing submits while no radio is picked",
|
|
10683
|
+
"type": {
|
|
10684
|
+
"text": "string"
|
|
10685
|
+
},
|
|
10686
|
+
"default": "''",
|
|
10687
|
+
"csc": {
|
|
10688
|
+
"freeform": true
|
|
10689
|
+
}
|
|
10690
|
+
},
|
|
10616
10691
|
{
|
|
10617
10692
|
"kind": "field",
|
|
10618
10693
|
"name": "required",
|
|
@@ -10833,7 +10908,7 @@
|
|
|
10833
10908
|
{
|
|
10834
10909
|
"fieldName": "name",
|
|
10835
10910
|
"name": "name",
|
|
10836
|
-
"description": "
|
|
10911
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
10837
10912
|
"type": {
|
|
10838
10913
|
"text": "string"
|
|
10839
10914
|
},
|
|
@@ -11174,7 +11249,7 @@
|
|
|
11174
11249
|
"kind": "field",
|
|
11175
11250
|
"name": "name",
|
|
11176
11251
|
"privacy": "public",
|
|
11177
|
-
"description": "
|
|
11252
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
11178
11253
|
"type": {
|
|
11179
11254
|
"text": "string"
|
|
11180
11255
|
},
|
|
@@ -11793,7 +11868,7 @@
|
|
|
11793
11868
|
{
|
|
11794
11869
|
"fieldName": "name",
|
|
11795
11870
|
"name": "name",
|
|
11796
|
-
"description": "
|
|
11871
|
+
"description": "The name the value submits under in a native `<form>`",
|
|
11797
11872
|
"type": {
|
|
11798
11873
|
"text": "string"
|
|
11799
11874
|
},
|
|
@@ -11967,7 +12042,7 @@
|
|
|
11967
12042
|
"kind": "field",
|
|
11968
12043
|
"name": "name",
|
|
11969
12044
|
"privacy": "public",
|
|
11970
|
-
"description": "
|
|
12045
|
+
"description": "The name the value submits under in a native `<form>`",
|
|
11971
12046
|
"type": {
|
|
11972
12047
|
"text": "string"
|
|
11973
12048
|
},
|
|
@@ -12679,6 +12754,18 @@
|
|
|
12679
12754
|
},
|
|
12680
12755
|
"default": "false"
|
|
12681
12756
|
},
|
|
12757
|
+
{
|
|
12758
|
+
"fieldName": "name",
|
|
12759
|
+
"name": "name",
|
|
12760
|
+
"description": "The name the switch submits under in a native `<form>` while it is on:\nits `true-value`, or `on` when that is `true`",
|
|
12761
|
+
"type": {
|
|
12762
|
+
"text": "string"
|
|
12763
|
+
},
|
|
12764
|
+
"default": "''",
|
|
12765
|
+
"csc": {
|
|
12766
|
+
"freeform": true
|
|
12767
|
+
}
|
|
12768
|
+
},
|
|
12682
12769
|
{
|
|
12683
12770
|
"fieldName": "required",
|
|
12684
12771
|
"name": "required",
|
|
@@ -12804,6 +12891,19 @@
|
|
|
12804
12891
|
},
|
|
12805
12892
|
"default": "false"
|
|
12806
12893
|
},
|
|
12894
|
+
{
|
|
12895
|
+
"kind": "field",
|
|
12896
|
+
"name": "name",
|
|
12897
|
+
"privacy": "public",
|
|
12898
|
+
"description": "The name the switch submits under in a native `<form>` while it is on:\nits `true-value`, or `on` when that is `true`",
|
|
12899
|
+
"type": {
|
|
12900
|
+
"text": "string"
|
|
12901
|
+
},
|
|
12902
|
+
"default": "''",
|
|
12903
|
+
"csc": {
|
|
12904
|
+
"freeform": true
|
|
12905
|
+
}
|
|
12906
|
+
},
|
|
12807
12907
|
{
|
|
12808
12908
|
"kind": "field",
|
|
12809
12909
|
"name": "required",
|
|
@@ -13997,7 +14097,7 @@
|
|
|
13997
14097
|
{
|
|
13998
14098
|
"fieldName": "name",
|
|
13999
14099
|
"name": "name",
|
|
14000
|
-
"description": "
|
|
14100
|
+
"description": "The name the text submits under in a native `<form>`",
|
|
14001
14101
|
"type": {
|
|
14002
14102
|
"text": "string"
|
|
14003
14103
|
},
|
|
@@ -14334,7 +14434,7 @@
|
|
|
14334
14434
|
"kind": "field",
|
|
14335
14435
|
"name": "name",
|
|
14336
14436
|
"privacy": "public",
|
|
14337
|
-
"description": "
|
|
14437
|
+
"description": "The name the text submits under in a native `<form>`",
|
|
14338
14438
|
"type": {
|
|
14339
14439
|
"text": "string"
|
|
14340
14440
|
},
|
|
@@ -14490,6 +14590,10 @@
|
|
|
14490
14590
|
}
|
|
14491
14591
|
],
|
|
14492
14592
|
"slots": [
|
|
14593
|
+
{
|
|
14594
|
+
"name": "default",
|
|
14595
|
+
"description": "A page's own `<input>`, framed in place of the field's own so that every password manager can fill it; its native attributes are its own"
|
|
14596
|
+
},
|
|
14493
14597
|
{
|
|
14494
14598
|
"name": "pre",
|
|
14495
14599
|
"description": "Content inside the field, before the input, such as an icon"
|
|
@@ -14683,7 +14787,7 @@
|
|
|
14683
14787
|
{
|
|
14684
14788
|
"fieldName": "name",
|
|
14685
14789
|
"name": "name",
|
|
14686
|
-
"description": "
|
|
14790
|
+
"description": "The name the time submits under in a native `<form>`, as its ISO text;\na `range` as one ISO 8601 interval, `start/end`",
|
|
14687
14791
|
"type": {
|
|
14688
14792
|
"text": "string"
|
|
14689
14793
|
},
|
|
@@ -15036,7 +15140,7 @@
|
|
|
15036
15140
|
"kind": "field",
|
|
15037
15141
|
"name": "name",
|
|
15038
15142
|
"privacy": "public",
|
|
15039
|
-
"description": "
|
|
15143
|
+
"description": "The name the time submits under in a native `<form>`, as its ISO text;\na `range` as one ISO 8601 interval, `start/end`",
|
|
15040
15144
|
"type": {
|
|
15041
15145
|
"text": "string"
|
|
15042
15146
|
},
|
|
@@ -15808,7 +15912,7 @@
|
|
|
15808
15912
|
{
|
|
15809
15913
|
"fieldName": "name",
|
|
15810
15914
|
"name": "name",
|
|
15811
|
-
"description": "
|
|
15915
|
+
"description": "The name the picked value submits under in a native `<form>`",
|
|
15812
15916
|
"type": {
|
|
15813
15917
|
"text": "string"
|
|
15814
15918
|
},
|
|
@@ -16149,7 +16253,7 @@
|
|
|
16149
16253
|
"kind": "field",
|
|
16150
16254
|
"name": "name",
|
|
16151
16255
|
"privacy": "public",
|
|
16152
|
-
"description": "
|
|
16256
|
+
"description": "The name the picked value submits under in a native `<form>`",
|
|
16153
16257
|
"type": {
|
|
16154
16258
|
"text": "string"
|
|
16155
16259
|
},
|
|
@@ -53,22 +53,76 @@ wins when both are set.
|
|
|
53
53
|
|
|
54
54
|
## In a form
|
|
55
55
|
|
|
56
|
-
`type="submit"` submits the `<form>`
|
|
57
|
-
|
|
58
|
-
`
|
|
59
|
-
an `href`, never submits
|
|
56
|
+
`type="submit"` submits the button's `<form>` — the one around it, or the one
|
|
57
|
+
its `form` attribute names — validating it first, as `form.requestSubmit()`
|
|
58
|
+
does, and `type="reset"` resets it; the default `button` does nothing to the
|
|
59
|
+
form. A disabled or loading button, or one with an `href`, never submits,
|
|
60
|
+
and a disabled `<fieldset>` around the button disables it.
|
|
61
|
+
|
|
62
|
+
The fields beside it take part in the form as native controls do: each
|
|
63
|
+
submits its value under its `name`, `form.reset()` returns it to the value
|
|
64
|
+
its markup set, and a disabled `<fieldset>` disables it. Enter in a
|
|
65
|
+
single-line text field submits the form through its first submit button,
|
|
66
|
+
`c-button` included, so a loading button stops that submit too.
|
|
67
|
+
|
|
68
|
+
A form without `novalidate` is checked before it submits: a `required` field
|
|
69
|
+
left empty, a date or colour that is bad input, a number out of range, an
|
|
70
|
+
incomplete mask or a partly filled code stops the submit, and the browser
|
|
71
|
+
points at the field with its own message. The field's look follows only its
|
|
72
|
+
`invalid` prop, so an app that shows its own error messages adds `novalidate`
|
|
73
|
+
and checks the fields itself:
|
|
60
74
|
|
|
61
75
|
```vue
|
|
62
|
-
<form @submit.prevent="save">
|
|
76
|
+
<form novalidate @submit.prevent="save">
|
|
77
|
+
<c-text-field v-model="name" label="Name" name="name" required />
|
|
63
78
|
<c-button type="submit">Save</c-button>
|
|
64
79
|
</form>
|
|
65
80
|
```
|
|
66
81
|
|
|
82
|
+
What each field submits under its `name`:
|
|
83
|
+
|
|
84
|
+
| Field | Submits |
|
|
85
|
+
| ------------------------------------------------ | ------------------------------------------------------------------------------------------- |
|
|
86
|
+
| Text, number, code, colour, date and time fields | Its text, `''` when empty; a number as a plain JS number (`1234.5`), never the grouped text |
|
|
87
|
+
| A `range` date or time picker | One ISO 8601 interval, `2026-11-01/2026-11-30`, with a side left empty while it has none |
|
|
88
|
+
| `c-select`, `c-autocomplete`, `c-tree-select` | The picked value (an item's `value`), `''` without one; one entry per pick with `multiple` |
|
|
89
|
+
| `c-checkbox`, `c-switch` | Its `true-value` while on (`on` for `true`), nothing while off |
|
|
90
|
+
| `c-radio-group`, `c-button-group` | The picked value, nothing without one; one entry per active button with `multiple` |
|
|
91
|
+
| `c-slider` | Its value |
|
|
92
|
+
|
|
93
|
+
`c-file-upload` takes no part: its upload function sends the files.
|
|
94
|
+
|
|
95
|
+
## Slotted button
|
|
96
|
+
|
|
97
|
+
A password manager reads a form's submit button to tell what the form is
|
|
98
|
+
for, and cannot find the native button inside a `c-button`'s shadow root:
|
|
99
|
+
Proton Pass, for one, then offers no password to generate on a sign-up form.
|
|
100
|
+
For the submit button of a form a password manager reads — sign up, log in,
|
|
101
|
+
change password — write the `<button>` yourself inside the `c-button`:
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<c-button :loading="saving">
|
|
105
|
+
<button type="submit">Create account</button>
|
|
106
|
+
</c-button>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The button fills the `c-button`, which paints it with its appearance,
|
|
110
|
+
variant, size, ripple and loading spinner, and it stays in the page, where
|
|
111
|
+
every password manager finds it. Its own attributes apply — `type`,
|
|
112
|
+
`disabled`, `name`, `value`, `form` — and it submits its form natively. The
|
|
113
|
+
`c-button`'s `type`, `href`, `target` and `value` are ignored, and so are
|
|
114
|
+
the `icon` and `description` slots (put an icon inside the button), each
|
|
115
|
+
with a console warning. `loading` cancels the button's clicks; set
|
|
116
|
+
`disabled` on the button, where assistive technology hears it.
|
|
117
|
+
|
|
118
|
+
Every other form keeps `<c-button type="submit">`.
|
|
119
|
+
|
|
67
120
|
## Accessibility
|
|
68
121
|
|
|
69
122
|
The `root` part is a native `<button>` (or `<a>` when `href` is set), so
|
|
70
123
|
focus, keyboard activation and screen-reader semantics come from the
|
|
71
|
-
platform
|
|
124
|
+
platform; with a slotted button, the page's own `<button>` is the control and
|
|
125
|
+
`root` only paints. When only an icon is slotted, provide an accessible name on the
|
|
72
126
|
host, e.g. `aria-label="Close"`.
|
|
73
127
|
|
|
74
128
|
## Customization
|
|
@@ -43,7 +43,8 @@ Text that names no colour — `blurple`, `var(--brand)` — is **bad input**: th
|
|
|
43
43
|
text stays as the user typed it, the value becomes `null`, and the host
|
|
44
44
|
exposes the `bad-input` custom state and a read-only `badInput` property. The
|
|
45
45
|
component never shows an error of its own; deciding whether bad input is an
|
|
46
|
-
error, and saying so, is the consumer's validation
|
|
46
|
+
error, and saying so, is the consumer's validation, and only a `<form>`
|
|
47
|
+
without `novalidate` stops a submit on it:
|
|
47
48
|
|
|
48
49
|
```vue
|
|
49
50
|
<c-color-picker
|
|
@@ -41,7 +41,8 @@ date outside `min` and `max` — is **bad input**: the text stays as the user
|
|
|
41
41
|
typed it, the value becomes `null`, and the host exposes the `bad-input` custom
|
|
42
42
|
state and a read-only `badInput` property. The component never shows an error
|
|
43
43
|
of its own; deciding whether bad input is an error, and saying so, is the
|
|
44
|
-
consumer's validation
|
|
44
|
+
consumer's validation, and only a `<form>` without `novalidate` stops a submit
|
|
45
|
+
on it:
|
|
45
46
|
|
|
46
47
|
```vue
|
|
47
48
|
<c-date-picker
|
|
@@ -91,9 +91,9 @@ does nothing.
|
|
|
91
91
|
Without `manual`, there is no waiting: an upload function assigned later
|
|
92
92
|
queues every `local` entry at once, and so every file added after it.
|
|
93
93
|
|
|
94
|
-
Or leave `upload` unset and send the files with the rest of the form.
|
|
95
|
-
|
|
96
|
-
from the value:
|
|
94
|
+
Or leave `upload` unset and send the files with the rest of the form. Unlike
|
|
95
|
+
the other fields, a file upload takes no part in a native `<form>`
|
|
96
|
+
submission; build the `FormData` from the value:
|
|
97
97
|
|
|
98
98
|
```js
|
|
99
99
|
const body = new FormData();
|
|
@@ -58,7 +58,10 @@ is ignored. The boxes opt out of browser and password-manager autofill.
|
|
|
58
58
|
|
|
59
59
|
The `label` prop names the group; for richer label content, put it in the
|
|
60
60
|
default slot instead (the prop wins when both are set). `required` adds the
|
|
61
|
-
required marker to the label
|
|
61
|
+
required marker to the label. A native `<form>` without `novalidate` stops a
|
|
62
|
+
submit on an empty required code, and on a partly filled one; elsewhere,
|
|
63
|
+
enforcing it is your form logic's job. The code submits under `name`; see
|
|
64
|
+
**In a form** on `c-button`.
|
|
62
65
|
|
|
63
66
|
Validation is yours too: set `invalid` and an `error-message` explaining why.
|
|
64
67
|
The boxes take the error colour and the message replaces the `hint`. While
|
|
@@ -51,7 +51,9 @@ label.
|
|
|
51
51
|
## Validation
|
|
52
52
|
|
|
53
53
|
Validation is your job: set `invalid` and supply an `error-message`
|
|
54
|
-
explaining why.
|
|
54
|
+
explaining why. In a native `<form>` the picked value submits under `name`,
|
|
55
|
+
and a form without `novalidate` stops a submit while a `required` group has
|
|
56
|
+
no pick; see **In a form** on `c-button`. While invalid without an `error-message`,
|
|
55
57
|
the `hint` keeps rendering as a hint. The message area reserves its height
|
|
56
58
|
(unless `hide-message`), so an error appearing at runtime doesn't shift the
|
|
57
59
|
layout.
|
|
@@ -35,8 +35,8 @@ Setting `value` moves the thumb and fires nothing. Set one: the built-in
|
|
|
35
35
|
default is `50` whatever `min` and `max` are, held within them, so a slider
|
|
36
36
|
with `max="8"` and no value starts at 8.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
In a native `<form>` the value submits under `name`; see **In a form** on
|
|
39
|
+
`c-button`.
|
|
40
40
|
|
|
41
41
|
## Value bubble and unit
|
|
42
42
|
|
|
@@ -12,6 +12,9 @@ listen for `update:value`, which fires on every keystroke:
|
|
|
12
12
|
`change` fires when the text is committed — Enter, or leaving the field after
|
|
13
13
|
an edit — so save or validate there rather than on every keystroke.
|
|
14
14
|
|
|
15
|
+
In a native `<form>` the text submits under `name`, and Enter submits the
|
|
16
|
+
form; see **In a form** on `c-button`.
|
|
17
|
+
|
|
15
18
|
`type` maps to the native input type: `password` adds a toggle that reveals
|
|
16
19
|
the text, and `number` honours `min`, `max` and `step`. Setting `rows` above
|
|
17
20
|
`1` renders a textarea.
|
|
@@ -88,7 +91,8 @@ Text that leaves some token unfilled is kept as typed. The read-only
|
|
|
88
91
|
`maskComplete` property tells whether every token is filled, and a field
|
|
89
92
|
holding such partial text exposes the `incomplete` custom state. The field
|
|
90
93
|
shows no error of its own; whether an incomplete value is an error is the
|
|
91
|
-
consumer's validation
|
|
94
|
+
consumer's validation, and only a `<form>` without `novalidate` stops a
|
|
95
|
+
submit on it:
|
|
92
96
|
|
|
93
97
|
```vue
|
|
94
98
|
<c-text-field
|
|
@@ -107,3 +111,51 @@ consumer's validation:
|
|
|
107
111
|
|
|
108
112
|
A mask applies to a single-line field of type `text`, `tel` or `search`;
|
|
109
113
|
other types (and a textarea) ignore it.
|
|
114
|
+
|
|
115
|
+
## Password managers
|
|
116
|
+
|
|
117
|
+
A password manager fills only the inputs it can see, and Safari's and
|
|
118
|
+
Firefox's, like several extensions, do not look inside a component's shadow
|
|
119
|
+
root. For a username, a password or a one-time code, write the `<input>`
|
|
120
|
+
yourself inside the field: it stays in the page, where every password
|
|
121
|
+
manager finds it, and the field frames it with its label, message and
|
|
122
|
+
password toggle.
|
|
123
|
+
|
|
124
|
+
```vue
|
|
125
|
+
<form action="/login" method="post">
|
|
126
|
+
<c-text-field label="Username">
|
|
127
|
+
<input v-model="username" autocomplete="username" name="username" />
|
|
128
|
+
</c-text-field>
|
|
129
|
+
|
|
130
|
+
<c-text-field label="Password">
|
|
131
|
+
<input
|
|
132
|
+
v-model="password"
|
|
133
|
+
autocomplete="current-password"
|
|
134
|
+
name="password"
|
|
135
|
+
type="password"
|
|
136
|
+
/>
|
|
137
|
+
</c-text-field>
|
|
138
|
+
|
|
139
|
+
<c-button>
|
|
140
|
+
<button type="submit">Log in</button>
|
|
141
|
+
</c-button>
|
|
142
|
+
</form>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The input's own attributes apply — `type`, `name`, `autocomplete`,
|
|
146
|
+
`required`, `disabled`, `placeholder` and the rest — and the field's props of
|
|
147
|
+
those names are ignored, with a console warning. `autocomplete` tells the
|
|
148
|
+
manager what the input holds: `username`, `current-password`, `new-password`
|
|
149
|
+
(where it offers to generate one) or `one-time-code`. In a form the input
|
|
150
|
+
submits and validates itself.
|
|
151
|
+
|
|
152
|
+
A password manager decides what a form is for — logging in, signing up,
|
|
153
|
+
changing a password — partly from its submit button, which it cannot find
|
|
154
|
+
inside a `c-button`'s shadow root: Proton Pass then offers no password to
|
|
155
|
+
generate on a sign-up form, whatever the page's headings say. Write the
|
|
156
|
+
submit button yourself inside the `c-button`, as above: a **slotted button**,
|
|
157
|
+
which the `c-button` paints (see `c-button`).
|
|
158
|
+
|
|
159
|
+
The field's `value` and its value events still work, so `v-model` goes on the
|
|
160
|
+
field or on the input. `mask`, `rows` and `trim-whitespace` do not apply to a
|
|
161
|
+
slotted input.
|
|
@@ -96,6 +96,8 @@
|
|
|
96
96
|
--color-error-subtle: var(--c-error-subtle);
|
|
97
97
|
--color-error-subtle-hover: var(--c-error-subtle-hover);
|
|
98
98
|
--color-on-error-subtle: var(--c-on-error-subtle);
|
|
99
|
+
/* Error text on a surface: lighter than the dark-mode error fill (ADR-0080). */
|
|
100
|
+
--color-on-surface-error: var(--c-on-surface-error);
|
|
99
101
|
|
|
100
102
|
--color-link: var(--c-link);
|
|
101
103
|
--color-link-hover: var(--c-link-hover);
|
|
@@ -144,6 +146,10 @@
|
|
|
144
146
|
--color-inverse-on: var(--c-inverse-on);
|
|
145
147
|
--color-inverse-primary: var(--c-inverse-primary);
|
|
146
148
|
--color-inverse-error: var(--c-inverse-error);
|
|
149
|
+
--color-inverse-secondary: var(--c-inverse-secondary);
|
|
150
|
+
--color-inverse-success: var(--c-inverse-success);
|
|
151
|
+
--color-inverse-info: var(--c-inverse-info);
|
|
152
|
+
--color-inverse-warning: var(--c-inverse-warning);
|
|
147
153
|
|
|
148
154
|
/* Mode-invariant overlay scrim (dims content behind modals/backdrops). */
|
|
149
155
|
--color-scrim: var(--c-scrim);
|