@cscfi/csc-ui 4.0.0-rc.3 → 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 +12632 -11979
- package/dist/custom-elements.json +204 -28
- package/dist/docs/c-button/usage.md +93 -14
- 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-icon-button/usage.md +19 -8
- 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 +107 -96
- package/dist/vscode.css-custom-data.json +2 -2
- package/dist/vscode.html-custom-data.json +88 -16
- package/dist/web-types.json +118 -34
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +2 -1
- package/dist-types/components/c-button/CButton.vue.d.ts +23 -5
- 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-icon-button/CIconButton.vue.d.ts +18 -2
- package/dist-types/components/c-list-item/CListItem.vue.d.ts +1 -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-side-navigation-item/CSideNavigationItem.vue.d.ts +1 -1
- package/dist-types/components/c-slider/CSlider.vue.d.ts +2 -3
- package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +1 -1
- 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/index.d.ts +2 -2
- package/dist-types/registry.d.ts +7 -0
- package/dist-types/shared/appDefaults.d.ts +8 -1
- package/dist-types/shared/buttonVariant.d.ts +5 -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 +75 -28
- package/package.json +3 -2
|
@@ -103,6 +103,13 @@
|
|
|
103
103
|
"name": "CButtonType",
|
|
104
104
|
"owner": "c-button"
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"declaration": "export type CButtonVariant =\n | 'danger'\n | 'info'\n | 'primary'\n | 'secondary'\n | 'success'\n | 'warning';",
|
|
108
|
+
"description": "The colour a button takes: `primary` (unless set) and `secondary`, the\nbrand families, or a status colour — `success`, `info`, `warning` and\n`danger`, a destructive action in the error colour.",
|
|
109
|
+
"kind": "type-alias",
|
|
110
|
+
"name": "CButtonVariant",
|
|
111
|
+
"owner": "c-button"
|
|
112
|
+
},
|
|
106
113
|
{
|
|
107
114
|
"declaration": "export type CButtonGroupSize = 'default' | 'small';",
|
|
108
115
|
"description": "Size of the button group. `small` renders a more compact control; the size\nis also propagated to every slotted `<c-button>`. Omitting the attribute\nrenders the default size.",
|
|
@@ -362,6 +369,13 @@
|
|
|
362
369
|
"name": "CIconButtonSize",
|
|
363
370
|
"owner": "c-icon-button"
|
|
364
371
|
},
|
|
372
|
+
{
|
|
373
|
+
"declaration": "export type CIconButtonVariant =\n | 'danger'\n | 'info'\n | 'primary'\n | 'secondary'\n | 'success'\n | 'warning';",
|
|
374
|
+
"description": "The colour an icon button takes — `c-button`'s variants: `primary` (unless\nset) and `secondary`, the brand families, or a status colour — `success`,\n`info`, `warning` and `danger`, a destructive action in the error colour.",
|
|
375
|
+
"kind": "type-alias",
|
|
376
|
+
"name": "CIconButtonVariant",
|
|
377
|
+
"owner": "c-icon-button"
|
|
378
|
+
},
|
|
365
379
|
{
|
|
366
380
|
"declaration": "export type CLoginCardBlendMode =\n | 'color-burn'\n | 'color-dodge'\n | 'color'\n | 'darken'\n | 'difference'\n | 'exclusion'\n | 'hard-light'\n | 'hue'\n | 'lighten'\n | 'luminosity'\n | 'multiply'\n | 'normal'\n | 'overlay'\n | 'saturation'\n | 'screen'\n | 'soft-light';",
|
|
367
381
|
"description": "CSS `mix-blend-mode` applied to the primary-coloured overlay drawn over\nthe background image when `overlay` is set.",
|
|
@@ -791,7 +805,7 @@
|
|
|
791
805
|
"cssParts": [
|
|
792
806
|
{
|
|
793
807
|
"name": "root",
|
|
794
|
-
"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"
|
|
795
809
|
},
|
|
796
810
|
{
|
|
797
811
|
"name": "header",
|
|
@@ -922,7 +936,7 @@
|
|
|
922
936
|
"cssParts": [
|
|
923
937
|
{
|
|
924
938
|
"name": "root",
|
|
925
|
-
"description": "The
|
|
939
|
+
"description": "The box carrying the type's tint, hairline border and accent edge"
|
|
926
940
|
},
|
|
927
941
|
{
|
|
928
942
|
"name": "icon",
|
|
@@ -1187,7 +1201,7 @@
|
|
|
1187
1201
|
{
|
|
1188
1202
|
"fieldName": "name",
|
|
1189
1203
|
"name": "name",
|
|
1190
|
-
"description": "
|
|
1204
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
1191
1205
|
"type": {
|
|
1192
1206
|
"text": "string"
|
|
1193
1207
|
},
|
|
@@ -1557,7 +1571,7 @@
|
|
|
1557
1571
|
"kind": "field",
|
|
1558
1572
|
"name": "name",
|
|
1559
1573
|
"privacy": "public",
|
|
1560
|
-
"description": "
|
|
1574
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
1561
1575
|
"type": {
|
|
1562
1576
|
"text": "string"
|
|
1563
1577
|
},
|
|
@@ -1980,7 +1994,7 @@
|
|
|
1980
1994
|
"kind": "class",
|
|
1981
1995
|
"name": "CButton",
|
|
1982
1996
|
"tagName": "c-button",
|
|
1983
|
-
"description": "Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one
|
|
1997
|
+
"description": "Buttons trigger actions — submitting a form, opening a modal, confirming a choice. Use one filled button (the default `appearance`) per view for its main action; other actions use `appearance=\"outlined\"`, `\"ghost\"` or `\"text\"`.",
|
|
1984
1998
|
"csc": {
|
|
1985
1999
|
"usage": "docs/c-button/usage.md"
|
|
1986
2000
|
},
|
|
@@ -2007,7 +2021,8 @@
|
|
|
2007
2021
|
{
|
|
2008
2022
|
"fieldName": "danger",
|
|
2009
2023
|
"name": "danger",
|
|
2010
|
-
"description": "Danger look for a destructive action: the
|
|
2024
|
+
"description": "Danger look for a destructive action: the error colour.",
|
|
2025
|
+
"deprecated": "Use `variant=\"danger\"`.",
|
|
2011
2026
|
"type": {
|
|
2012
2027
|
"text": "boolean"
|
|
2013
2028
|
},
|
|
@@ -2143,6 +2158,19 @@
|
|
|
2143
2158
|
"type": {
|
|
2144
2159
|
"text": "number | string"
|
|
2145
2160
|
}
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
"fieldName": "variant",
|
|
2164
|
+
"name": "variant",
|
|
2165
|
+
"description": "The button's colour, in every appearance: `primary` unless set (or\nchanged app-wide), `secondary`, `success`, `info`, `warning`, or `danger`\nfor a destructive action.",
|
|
2166
|
+
"type": {
|
|
2167
|
+
"text": "'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning'"
|
|
2168
|
+
},
|
|
2169
|
+
"default": "'primary'",
|
|
2170
|
+
"csc": {
|
|
2171
|
+
"typeAlias": "CButtonVariant",
|
|
2172
|
+
"defaultable": true
|
|
2173
|
+
}
|
|
2146
2174
|
}
|
|
2147
2175
|
],
|
|
2148
2176
|
"cssParts": [
|
|
@@ -2188,7 +2216,8 @@
|
|
|
2188
2216
|
"kind": "field",
|
|
2189
2217
|
"name": "danger",
|
|
2190
2218
|
"privacy": "public",
|
|
2191
|
-
"description": "Danger look for a destructive action: the
|
|
2219
|
+
"description": "Danger look for a destructive action: the error colour.",
|
|
2220
|
+
"deprecated": "Use `variant=\"danger\"`.",
|
|
2192
2221
|
"type": {
|
|
2193
2222
|
"text": "boolean"
|
|
2194
2223
|
},
|
|
@@ -2337,12 +2366,26 @@
|
|
|
2337
2366
|
"type": {
|
|
2338
2367
|
"text": "number | string"
|
|
2339
2368
|
}
|
|
2369
|
+
},
|
|
2370
|
+
{
|
|
2371
|
+
"kind": "field",
|
|
2372
|
+
"name": "variant",
|
|
2373
|
+
"privacy": "public",
|
|
2374
|
+
"description": "The button's colour, in every appearance: `primary` unless set (or\nchanged app-wide), `secondary`, `success`, `info`, `warning`, or `danger`\nfor a destructive action.",
|
|
2375
|
+
"type": {
|
|
2376
|
+
"text": "'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning'"
|
|
2377
|
+
},
|
|
2378
|
+
"default": "'primary'",
|
|
2379
|
+
"csc": {
|
|
2380
|
+
"typeAlias": "CButtonVariant",
|
|
2381
|
+
"defaultable": true
|
|
2382
|
+
}
|
|
2340
2383
|
}
|
|
2341
2384
|
],
|
|
2342
2385
|
"slots": [
|
|
2343
2386
|
{
|
|
2344
2387
|
"name": "default",
|
|
2345
|
-
"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."
|
|
2346
2389
|
},
|
|
2347
2390
|
{
|
|
2348
2391
|
"name": "icon",
|
|
@@ -2427,6 +2470,18 @@
|
|
|
2427
2470
|
},
|
|
2428
2471
|
"default": "false"
|
|
2429
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
|
+
},
|
|
2430
2485
|
{
|
|
2431
2486
|
"fieldName": "required",
|
|
2432
2487
|
"name": "required",
|
|
@@ -2537,6 +2592,19 @@
|
|
|
2537
2592
|
},
|
|
2538
2593
|
"default": "false"
|
|
2539
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
|
+
},
|
|
2540
2608
|
{
|
|
2541
2609
|
"kind": "field",
|
|
2542
2610
|
"name": "required",
|
|
@@ -3091,7 +3159,7 @@
|
|
|
3091
3159
|
{
|
|
3092
3160
|
"fieldName": "name",
|
|
3093
3161
|
"name": "name",
|
|
3094
|
-
"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`",
|
|
3095
3163
|
"type": {
|
|
3096
3164
|
"text": "string"
|
|
3097
3165
|
},
|
|
@@ -3297,7 +3365,7 @@
|
|
|
3297
3365
|
"kind": "field",
|
|
3298
3366
|
"name": "name",
|
|
3299
3367
|
"privacy": "public",
|
|
3300
|
-
"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`",
|
|
3301
3369
|
"type": {
|
|
3302
3370
|
"text": "string"
|
|
3303
3371
|
},
|
|
@@ -3514,7 +3582,7 @@
|
|
|
3514
3582
|
{
|
|
3515
3583
|
"fieldName": "name",
|
|
3516
3584
|
"name": "name",
|
|
3517
|
-
"description": "
|
|
3585
|
+
"description": "The name the colour submits under in a native `<form>`, in the\npicker's notation",
|
|
3518
3586
|
"type": {
|
|
3519
3587
|
"text": "string"
|
|
3520
3588
|
},
|
|
@@ -3860,7 +3928,7 @@
|
|
|
3860
3928
|
"kind": "field",
|
|
3861
3929
|
"name": "name",
|
|
3862
3930
|
"privacy": "public",
|
|
3863
|
-
"description": "
|
|
3931
|
+
"description": "The name the colour submits under in a native `<form>`, in the\npicker's notation",
|
|
3864
3932
|
"type": {
|
|
3865
3933
|
"text": "string"
|
|
3866
3934
|
},
|
|
@@ -4694,7 +4762,7 @@
|
|
|
4694
4762
|
{
|
|
4695
4763
|
"fieldName": "name",
|
|
4696
4764
|
"name": "name",
|
|
4697
|
-
"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`",
|
|
4698
4766
|
"type": {
|
|
4699
4767
|
"text": "string"
|
|
4700
4768
|
},
|
|
@@ -5149,7 +5217,7 @@
|
|
|
5149
5217
|
"kind": "field",
|
|
5150
5218
|
"name": "name",
|
|
5151
5219
|
"privacy": "public",
|
|
5152
|
-
"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`",
|
|
5153
5221
|
"type": {
|
|
5154
5222
|
"text": "string"
|
|
5155
5223
|
},
|
|
@@ -6038,7 +6106,8 @@
|
|
|
6038
6106
|
{
|
|
6039
6107
|
"fieldName": "danger",
|
|
6040
6108
|
"name": "danger",
|
|
6041
|
-
"description": "Danger look for a destructive action: the
|
|
6109
|
+
"description": "Danger look for a destructive action: the error colour.",
|
|
6110
|
+
"deprecated": "Use `variant=\"danger\"`.",
|
|
6042
6111
|
"type": {
|
|
6043
6112
|
"text": "boolean"
|
|
6044
6113
|
},
|
|
@@ -6124,6 +6193,19 @@
|
|
|
6124
6193
|
"text": "boolean"
|
|
6125
6194
|
},
|
|
6126
6195
|
"default": "false"
|
|
6196
|
+
},
|
|
6197
|
+
{
|
|
6198
|
+
"fieldName": "variant",
|
|
6199
|
+
"name": "variant",
|
|
6200
|
+
"description": "The button's colour, in every appearance: `primary` unless set (or\nchanged app-wide), `secondary`, `success`, `info`, `warning`, or `danger`\nfor a destructive action.",
|
|
6201
|
+
"type": {
|
|
6202
|
+
"text": "'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning'"
|
|
6203
|
+
},
|
|
6204
|
+
"default": "'primary'",
|
|
6205
|
+
"csc": {
|
|
6206
|
+
"typeAlias": "CIconButtonVariant",
|
|
6207
|
+
"defaultable": true
|
|
6208
|
+
}
|
|
6127
6209
|
}
|
|
6128
6210
|
],
|
|
6129
6211
|
"cssParts": [
|
|
@@ -6170,7 +6252,8 @@
|
|
|
6170
6252
|
"kind": "field",
|
|
6171
6253
|
"name": "danger",
|
|
6172
6254
|
"privacy": "public",
|
|
6173
|
-
"description": "Danger look for a destructive action: the
|
|
6255
|
+
"description": "Danger look for a destructive action: the error colour.",
|
|
6256
|
+
"deprecated": "Use `variant=\"danger\"`.",
|
|
6174
6257
|
"type": {
|
|
6175
6258
|
"text": "boolean"
|
|
6176
6259
|
},
|
|
@@ -6264,6 +6347,20 @@
|
|
|
6264
6347
|
"text": "boolean"
|
|
6265
6348
|
},
|
|
6266
6349
|
"default": "false"
|
|
6350
|
+
},
|
|
6351
|
+
{
|
|
6352
|
+
"kind": "field",
|
|
6353
|
+
"name": "variant",
|
|
6354
|
+
"privacy": "public",
|
|
6355
|
+
"description": "The button's colour, in every appearance: `primary` unless set (or\nchanged app-wide), `secondary`, `success`, `info`, `warning`, or `danger`\nfor a destructive action.",
|
|
6356
|
+
"type": {
|
|
6357
|
+
"text": "'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning'"
|
|
6358
|
+
},
|
|
6359
|
+
"default": "'primary'",
|
|
6360
|
+
"csc": {
|
|
6361
|
+
"typeAlias": "CIconButtonVariant",
|
|
6362
|
+
"defaultable": true
|
|
6363
|
+
}
|
|
6267
6364
|
}
|
|
6268
6365
|
],
|
|
6269
6366
|
"slots": [
|
|
@@ -8492,7 +8589,7 @@
|
|
|
8492
8589
|
{
|
|
8493
8590
|
"fieldName": "name",
|
|
8494
8591
|
"name": "name",
|
|
8495
|
-
"description": "
|
|
8592
|
+
"description": "The name the number submits under in a native `<form>`, written as a\nplain JS number (`1234.5`)",
|
|
8496
8593
|
"type": {
|
|
8497
8594
|
"text": "string"
|
|
8498
8595
|
},
|
|
@@ -8804,7 +8901,7 @@
|
|
|
8804
8901
|
"kind": "field",
|
|
8805
8902
|
"name": "name",
|
|
8806
8903
|
"privacy": "public",
|
|
8807
|
-
"description": "
|
|
8904
|
+
"description": "The name the number submits under in a native `<form>`, written as a\nplain JS number (`1234.5`)",
|
|
8808
8905
|
"type": {
|
|
8809
8906
|
"text": "string"
|
|
8810
8907
|
},
|
|
@@ -9227,6 +9324,18 @@
|
|
|
9227
9324
|
},
|
|
9228
9325
|
"default": "6"
|
|
9229
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
|
+
},
|
|
9230
9339
|
{
|
|
9231
9340
|
"fieldName": "required",
|
|
9232
9341
|
"name": "required",
|
|
@@ -9393,6 +9502,19 @@
|
|
|
9393
9502
|
},
|
|
9394
9503
|
"default": "6"
|
|
9395
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
|
+
},
|
|
9396
9518
|
{
|
|
9397
9519
|
"kind": "field",
|
|
9398
9520
|
"name": "required",
|
|
@@ -10389,6 +10511,18 @@
|
|
|
10389
10511
|
"freeform": true
|
|
10390
10512
|
}
|
|
10391
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
|
+
},
|
|
10392
10526
|
{
|
|
10393
10527
|
"fieldName": "required",
|
|
10394
10528
|
"name": "required",
|
|
@@ -10541,6 +10675,19 @@
|
|
|
10541
10675
|
"freeform": true
|
|
10542
10676
|
}
|
|
10543
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
|
+
},
|
|
10544
10691
|
{
|
|
10545
10692
|
"kind": "field",
|
|
10546
10693
|
"name": "required",
|
|
@@ -10761,7 +10908,7 @@
|
|
|
10761
10908
|
{
|
|
10762
10909
|
"fieldName": "name",
|
|
10763
10910
|
"name": "name",
|
|
10764
|
-
"description": "
|
|
10911
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
10765
10912
|
"type": {
|
|
10766
10913
|
"text": "string"
|
|
10767
10914
|
},
|
|
@@ -11102,7 +11249,7 @@
|
|
|
11102
11249
|
"kind": "field",
|
|
11103
11250
|
"name": "name",
|
|
11104
11251
|
"privacy": "public",
|
|
11105
|
-
"description": "
|
|
11252
|
+
"description": "The name the picked value submits under in a native `<form>` — one entry\nper value with `multiple`",
|
|
11106
11253
|
"type": {
|
|
11107
11254
|
"text": "string"
|
|
11108
11255
|
},
|
|
@@ -11721,7 +11868,7 @@
|
|
|
11721
11868
|
{
|
|
11722
11869
|
"fieldName": "name",
|
|
11723
11870
|
"name": "name",
|
|
11724
|
-
"description": "
|
|
11871
|
+
"description": "The name the value submits under in a native `<form>`",
|
|
11725
11872
|
"type": {
|
|
11726
11873
|
"text": "string"
|
|
11727
11874
|
},
|
|
@@ -11895,7 +12042,7 @@
|
|
|
11895
12042
|
"kind": "field",
|
|
11896
12043
|
"name": "name",
|
|
11897
12044
|
"privacy": "public",
|
|
11898
|
-
"description": "
|
|
12045
|
+
"description": "The name the value submits under in a native `<form>`",
|
|
11899
12046
|
"type": {
|
|
11900
12047
|
"text": "string"
|
|
11901
12048
|
},
|
|
@@ -12607,6 +12754,18 @@
|
|
|
12607
12754
|
},
|
|
12608
12755
|
"default": "false"
|
|
12609
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
|
+
},
|
|
12610
12769
|
{
|
|
12611
12770
|
"fieldName": "required",
|
|
12612
12771
|
"name": "required",
|
|
@@ -12732,6 +12891,19 @@
|
|
|
12732
12891
|
},
|
|
12733
12892
|
"default": "false"
|
|
12734
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
|
+
},
|
|
12735
12907
|
{
|
|
12736
12908
|
"kind": "field",
|
|
12737
12909
|
"name": "required",
|
|
@@ -13925,7 +14097,7 @@
|
|
|
13925
14097
|
{
|
|
13926
14098
|
"fieldName": "name",
|
|
13927
14099
|
"name": "name",
|
|
13928
|
-
"description": "
|
|
14100
|
+
"description": "The name the text submits under in a native `<form>`",
|
|
13929
14101
|
"type": {
|
|
13930
14102
|
"text": "string"
|
|
13931
14103
|
},
|
|
@@ -14262,7 +14434,7 @@
|
|
|
14262
14434
|
"kind": "field",
|
|
14263
14435
|
"name": "name",
|
|
14264
14436
|
"privacy": "public",
|
|
14265
|
-
"description": "
|
|
14437
|
+
"description": "The name the text submits under in a native `<form>`",
|
|
14266
14438
|
"type": {
|
|
14267
14439
|
"text": "string"
|
|
14268
14440
|
},
|
|
@@ -14418,6 +14590,10 @@
|
|
|
14418
14590
|
}
|
|
14419
14591
|
],
|
|
14420
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
|
+
},
|
|
14421
14597
|
{
|
|
14422
14598
|
"name": "pre",
|
|
14423
14599
|
"description": "Content inside the field, before the input, such as an icon"
|
|
@@ -14611,7 +14787,7 @@
|
|
|
14611
14787
|
{
|
|
14612
14788
|
"fieldName": "name",
|
|
14613
14789
|
"name": "name",
|
|
14614
|
-
"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`",
|
|
14615
14791
|
"type": {
|
|
14616
14792
|
"text": "string"
|
|
14617
14793
|
},
|
|
@@ -14964,7 +15140,7 @@
|
|
|
14964
15140
|
"kind": "field",
|
|
14965
15141
|
"name": "name",
|
|
14966
15142
|
"privacy": "public",
|
|
14967
|
-
"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`",
|
|
14968
15144
|
"type": {
|
|
14969
15145
|
"text": "string"
|
|
14970
15146
|
},
|
|
@@ -15736,7 +15912,7 @@
|
|
|
15736
15912
|
{
|
|
15737
15913
|
"fieldName": "name",
|
|
15738
15914
|
"name": "name",
|
|
15739
|
-
"description": "
|
|
15915
|
+
"description": "The name the picked value submits under in a native `<form>`",
|
|
15740
15916
|
"type": {
|
|
15741
15917
|
"text": "string"
|
|
15742
15918
|
},
|
|
@@ -16077,7 +16253,7 @@
|
|
|
16077
16253
|
"kind": "field",
|
|
16078
16254
|
"name": "name",
|
|
16079
16255
|
"privacy": "public",
|
|
16080
|
-
"description": "
|
|
16256
|
+
"description": "The name the picked value submits under in a native `<form>`",
|
|
16081
16257
|
"type": {
|
|
16082
16258
|
"text": "string"
|
|
16083
16259
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Buttons trigger actions — submitting a form, opening a modal, confirming a
|
|
2
|
-
choice. Use one
|
|
3
|
-
|
|
2
|
+
choice. Use one filled button (the default `appearance`) per view for its
|
|
3
|
+
main action; other actions use `appearance="outlined"`, `"ghost"` or
|
|
4
|
+
`"text"`.
|
|
4
5
|
|
|
5
6
|
## When to use
|
|
6
7
|
|
|
@@ -16,34 +17,112 @@ secondary actions use `appearance="outlined"`, `"ghost"` or `"text"`.
|
|
|
16
17
|
## Appearances
|
|
17
18
|
|
|
18
19
|
`appearance` sets how strongly a button reads: `filled` (the default) for the
|
|
19
|
-
main action, then `outlined` (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
brand-coloured backdrop: it paints the `inverse-*` family, which looks the
|
|
24
|
-
same in both theme modes.
|
|
20
|
+
main action, then `outlined` (an outline, no fill), `ghost` (a light tint)
|
|
21
|
+
and `text` (no fill or outline) for lower emphasis. `inverted` is for a fixed
|
|
22
|
+
dark or brand-coloured backdrop: it paints the `inverse-*` family, which looks
|
|
23
|
+
the same in both theme modes.
|
|
25
24
|
|
|
26
25
|
The `outlined`, `ghost` and `text` boolean attributes of 3.x still work until
|
|
27
26
|
5.0; `appearance` wins when both are set.
|
|
28
27
|
|
|
28
|
+
## Variants
|
|
29
|
+
|
|
30
|
+
`variant` sets the button's colour, in every appearance: `primary` (the
|
|
31
|
+
default) and `secondary`, the brand colours; `success`, `info` and `warning`;
|
|
32
|
+
and `danger` for a destructive action, in the error colour. A colour is not an
|
|
33
|
+
emphasis level — make a less important action lighter with `appearance`, not
|
|
34
|
+
`secondary`.
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<c-button variant="danger">Delete</c-button>
|
|
38
|
+
<c-button appearance="outlined" variant="success">Approve</c-button>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The filled success, info and warning buttons have a dark label, which stays
|
|
42
|
+
readable (WCAG AA) on their lighter fills. Inverted, only the filled look shows
|
|
43
|
+
the colour, as its label on the white button; the lighter appearances stay
|
|
44
|
+
white.
|
|
45
|
+
|
|
46
|
+
An app can change the default colour of every `c-button` with
|
|
47
|
+
`applyDefaults({ 'c-button': { variant: 'secondary' } })`. The buttons the
|
|
48
|
+
library draws inside its own components keep `primary`, and so do the buttons
|
|
49
|
+
of `c-tab-buttons`, whose sliding indicator has one colour.
|
|
50
|
+
|
|
51
|
+
The `danger` attribute of earlier releases still works until 5.0; `variant`
|
|
52
|
+
wins when both are set.
|
|
53
|
+
|
|
29
54
|
## In a form
|
|
30
55
|
|
|
31
|
-
`type="submit"` submits the `<form>`
|
|
32
|
-
|
|
33
|
-
`
|
|
34
|
-
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:
|
|
35
74
|
|
|
36
75
|
```vue
|
|
37
|
-
<form @submit.prevent="save">
|
|
76
|
+
<form novalidate @submit.prevent="save">
|
|
77
|
+
<c-text-field v-model="name" label="Name" name="name" required />
|
|
38
78
|
<c-button type="submit">Save</c-button>
|
|
39
79
|
</form>
|
|
40
80
|
```
|
|
41
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
|
+
|
|
42
120
|
## Accessibility
|
|
43
121
|
|
|
44
122
|
The `root` part is a native `<button>` (or `<a>` when `href` is set), so
|
|
45
123
|
focus, keyboard activation and screen-reader semantics come from the
|
|
46
|
-
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
|
|
47
126
|
host, e.g. `aria-label="Close"`.
|
|
48
127
|
|
|
49
128
|
## Customization
|