@cscfi/csc-ui 4.0.0-alpha.9 → 4.0.0-rc.2
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/README.md +36 -2
- package/dist/csc-ui.js +22771 -14908
- package/dist/custom-elements.json +8943 -5632
- package/dist/docs/c-accordion/usage.md +60 -0
- package/dist/docs/c-accordion-item/usage.md +1 -0
- package/dist/docs/c-alert/usage.md +5 -5
- package/dist/docs/c-autocomplete/usage.md +156 -0
- package/dist/docs/c-badge/usage.md +50 -0
- package/dist/docs/c-breadcrumb/usage.md +104 -0
- package/dist/docs/c-breadcrumb-item/usage.md +1 -0
- package/dist/docs/c-button/usage.md +13 -0
- package/dist/docs/c-button-group/usage.md +16 -2
- package/dist/docs/c-card/usage.md +55 -0
- package/dist/docs/c-card-actions/usage.md +1 -0
- package/dist/docs/c-card-content/usage.md +1 -0
- package/dist/docs/c-card-title/usage.md +3 -0
- package/dist/docs/c-checkbox/usage.md +37 -5
- package/dist/docs/c-color-picker/usage.md +160 -0
- package/dist/docs/c-csc-logo/usage.md +25 -0
- package/dist/docs/c-data-table/usage.md +180 -0
- package/dist/docs/c-date-picker/usage.md +224 -0
- package/dist/docs/c-divider/usage.md +36 -0
- package/dist/docs/c-file-upload/usage.md +189 -0
- package/dist/docs/c-icon/usage.md +51 -0
- package/dist/docs/c-icon-button/usage.md +80 -0
- package/dist/docs/c-link/usage.md +45 -1
- package/dist/docs/c-list/usage.md +50 -0
- package/dist/docs/c-list-item/usage.md +1 -0
- package/dist/docs/c-list-item-title/usage.md +1 -0
- package/dist/docs/c-loader/usage.md +52 -1
- package/dist/docs/c-login-button/usage.md +1 -0
- package/dist/docs/c-login-buttons/usage.md +48 -0
- package/dist/docs/c-login-card/usage.md +45 -0
- package/dist/docs/c-login-card-actions/usage.md +1 -0
- package/dist/docs/c-login-card-content/usage.md +1 -0
- package/dist/docs/c-login-card-title/usage.md +3 -0
- package/dist/docs/c-main/usage.md +21 -1
- package/dist/docs/c-menu/usage.md +15 -0
- package/dist/docs/c-menu-item/usage.md +11 -0
- package/dist/docs/c-message/usage.md +56 -0
- package/dist/docs/c-modal/usage.md +18 -12
- package/dist/docs/c-navigation-button/usage.md +32 -0
- package/dist/docs/c-number-field/usage.md +114 -0
- package/dist/docs/c-option/usage.md +1 -0
- package/dist/docs/c-option-value/usage.md +1 -0
- package/dist/docs/c-otp-input/usage.md +95 -0
- package/dist/docs/c-page/usage.md +44 -0
- package/dist/docs/c-pagination/usage.md +69 -0
- package/dist/docs/c-popover/usage.md +1 -1
- package/dist/docs/c-progress-bar/usage.md +1 -1
- package/dist/docs/c-progress-circle/usage.md +1 -1
- package/dist/docs/c-radio/usage.md +9 -6
- package/dist/docs/c-radio-group/usage.md +5 -6
- package/dist/docs/c-select/usage.md +131 -0
- package/dist/docs/c-side-navigation/usage.md +70 -0
- package/dist/docs/c-side-navigation-item/usage.md +1 -0
- package/dist/docs/c-side-navigation-title/usage.md +1 -0
- package/dist/docs/c-slider/usage.md +78 -0
- package/dist/docs/c-spinner/usage.md +1 -1
- package/dist/docs/c-status/usage.md +46 -0
- package/dist/docs/c-step/usage.md +1 -0
- package/dist/docs/c-steps/usage.md +35 -0
- package/dist/docs/c-sub-navigation-item/usage.md +1 -0
- package/dist/docs/c-switch/usage.md +10 -3
- package/dist/docs/c-tab/usage.md +1 -0
- package/dist/docs/c-tab-buttons/usage.md +15 -0
- package/dist/docs/c-tab-item/usage.md +1 -0
- package/dist/docs/c-tab-items/usage.md +1 -0
- package/dist/docs/c-table/usage.md +1 -1
- package/dist/docs/c-tabs/usage.md +77 -0
- package/dist/docs/c-tag/usage.md +1 -0
- package/dist/docs/c-tags/usage.md +85 -0
- package/dist/docs/c-text-field/usage.md +109 -0
- package/dist/docs/c-time-picker/usage.md +170 -0
- package/dist/docs/c-toasts/usage.md +27 -3
- package/dist/docs/c-toolbar/usage.md +17 -0
- package/dist/docs/c-tree-select/usage.md +156 -0
- package/dist/floating-ui.dom-DvzxEaDJ.js +1292 -0
- package/dist/styles/css/tailwind-theme.css +2 -1
- package/dist/styles/css/tokens.css +609 -178
- package/dist/vscode.css-custom-data.json +556 -99
- package/dist/vscode.html-custom-data.json +1050 -480
- package/dist/web-types.json +3303 -1707
- package/dist-types/components/c-accordion/CAccordion.vue.d.ts +21 -25
- package/dist-types/components/c-accordion-item/CAccordionItem.vue.d.ts +13 -12
- package/dist-types/components/c-alert/CAlert.vue.d.ts +12 -17
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +124 -31
- package/dist-types/components/c-breadcrumb/CBreadcrumb.vue.d.ts +35 -0
- package/dist-types/components/c-breadcrumb/fit.d.ts +29 -0
- package/dist-types/components/c-breadcrumb-item/CBreadcrumbItem.vue.d.ts +31 -0
- package/dist-types/components/c-button/CButton.vue.d.ts +52 -63
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +16 -14
- package/dist-types/components/c-card/CCard.vue.d.ts +2 -3
- package/dist-types/components/c-card-actions/CCardActions.vue.d.ts +5 -7
- package/dist-types/components/c-card-title/CCardTitle.vue.d.ts +11 -1
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +33 -52
- package/dist-types/components/c-color-picker/CColorPicker.vue.d.ts +189 -0
- package/dist-types/components/c-color-picker/colors.d.ts +66 -0
- package/dist-types/components/c-csc-logo/CCscLogo.vue.d.ts +1 -3
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +75 -51
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +277 -0
- package/dist-types/components/c-date-picker/dates.d.ts +119 -0
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +51 -8
- package/dist-types/components/c-file-upload/CFileUpload.vue.d.ts +204 -0
- package/dist-types/components/c-file-upload/files.d.ts +99 -0
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +23 -36
- package/dist-types/components/c-input/CInput.vue.d.ts +21 -43
- package/dist-types/components/c-link/CLink.vue.d.ts +6 -14
- package/dist-types/components/c-list/CList.vue.d.ts +4 -6
- package/dist-types/components/c-list-item/CListItem.vue.d.ts +14 -19
- package/dist-types/components/c-list-item-title/CListItemTitle.vue.d.ts +3 -2
- package/dist-types/components/c-loader/CLoader.vue.d.ts +13 -29
- package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +9 -9
- package/dist-types/components/c-login-card/CLoginCard.vue.d.ts +11 -16
- package/dist-types/components/c-login-card-actions/CLoginCardActions.vue.d.ts +5 -7
- package/dist-types/components/c-login-card-title/CLoginCardTitle.vue.d.ts +11 -1
- package/dist-types/components/c-main/CMain.vue.d.ts +12 -5
- package/dist-types/components/c-menu/CMenu.vue.d.ts +17 -16
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +27 -35
- package/dist-types/components/c-message/CMessage.vue.d.ts +5 -15
- package/dist-types/components/c-modal/CModal.vue.d.ts +3 -3
- package/dist-types/components/c-navigation-button/CNavigationButton.vue.d.ts +20 -1
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +169 -0
- package/dist-types/components/c-number-field/numbers.d.ts +58 -0
- package/dist-types/components/c-option/COption.vue.d.ts +1 -1
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +16 -30
- package/dist-types/components/c-page/CPage.vue.d.ts +2 -3
- package/dist-types/components/c-pagination/CPagination.vue.d.ts +56 -26
- package/dist-types/components/c-popover/CPopover.vue.d.ts +11 -7
- package/dist-types/components/c-progress-bar/CProgressBar.vue.d.ts +10 -14
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +7 -7
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +11 -8
- package/dist-types/components/c-select/CSelect.vue.d.ts +119 -35
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +10 -18
- package/dist-types/components/c-side-navigation-item/CSideNavigationItem.vue.d.ts +22 -14
- package/dist-types/components/c-slider/CSlider.vue.d.ts +29 -73
- package/dist-types/components/c-spinner/CSpinner.vue.d.ts +4 -8
- package/dist-types/components/c-status/CStatus.vue.d.ts +8 -9
- package/dist-types/components/c-step/CStep.vue.d.ts +6 -4
- package/dist-types/components/c-steps/CSteps.vue.d.ts +3 -7
- package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +23 -17
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +17 -30
- package/dist-types/components/c-tab/CTab.vue.d.ts +11 -28
- package/dist-types/components/c-tab-buttons/CTabButtons.vue.d.ts +11 -13
- package/dist-types/components/c-tab-item/CTabItem.vue.d.ts +4 -5
- package/dist-types/components/c-tab-items/CTabItems.vue.d.ts +5 -4
- package/dist-types/components/c-table/CTable.vue.d.ts +7 -7
- package/dist-types/components/c-tabs/CTabs.vue.d.ts +13 -20
- package/dist-types/components/c-tag/CTag.vue.d.ts +22 -21
- package/dist-types/components/c-tags/CTags.vue.d.ts +9 -10
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +74 -77
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +205 -0
- package/dist-types/components/c-time-picker/times.d.ts +82 -0
- package/dist-types/components/c-toast/CToast.vue.d.ts +3 -4
- package/dist-types/components/c-toast/swipe.d.ts +40 -0
- package/dist-types/components/c-toasts/CToasts.vue.d.ts +14 -16
- package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +12 -8
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +257 -0
- package/dist-types/index.d.ts +41 -32
- package/dist-types/registry.d.ts +9 -0
- package/dist-types/shared/FieldMessage.vue.d.ts +8 -5
- package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
- package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -0
- package/dist-types/shared/TypedField.vue.d.ts +48 -0
- package/dist-types/shared/appDefaults.d.ts +75 -0
- package/dist-types/shared/defineElement.d.ts +1 -0
- package/dist-types/shared/inputMask.d.ts +106 -0
- package/dist-types/shared/lightDismiss.d.ts +35 -0
- package/dist-types/shared/modalStack.d.ts +4 -3
- package/dist-types/shared/navigationDrawer.d.ts +4 -0
- package/dist-types/shared/optionLabel.d.ts +18 -0
- package/dist-types/shared/pageLock.d.ts +26 -0
- package/dist-types/shared/peekCap.d.ts +35 -0
- package/dist-types/shared/popoverChain.d.ts +13 -10
- package/dist-types/shared/positionArea.d.ts +9 -4
- package/dist-types/shared/reducedMotion.d.ts +10 -0
- package/dist-types/shared/selectAll.d.ts +29 -0
- package/dist-types/shared/splitMatches.d.ts +18 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +107 -0
- package/dist-types/shared/useControlAttrs.d.ts +8 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +5 -4
- package/dist-types/shared/useFallbackPosition.d.ts +71 -0
- package/dist-types/shared/useHostEmit.d.ts +38 -0
- package/dist-types/shared/useIdReferences.d.ts +39 -0
- package/dist-types/shared/useKeyboardModality.d.ts +7 -0
- package/dist-types/shared/useNarrowViewport.d.ts +19 -0
- package/dist-types/shared/useScrollStrip.d.ts +39 -0
- package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
- package/dist-types/shared/useTypedField.d.ts +108 -0
- package/dist-types/shared/valueEvents.d.ts +41 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +1572 -672
- package/dist-types/theme/applyTheme.d.ts +6 -6
- package/dist-types/theme/chart-data.d.ts +51 -0
- package/dist-types/theme/ramp.d.ts +38 -0
- package/dist-types/theme/themeMode.d.ts +51 -0
- package/dist-types/types.d.ts +7 -11
- package/package.json +32 -21
- package/dist/css-anchor-positioning-fn-RTxo68pt.js +0 -6447
- package/dist/docs/c-toast/usage.md +0 -1
- package/dist-types/shared/anchorPolyfill.d.ts +0 -24
- package/dist-types/shared/emitModelValue.d.ts +0 -37
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
A field the user adds files to by dropping them on it or choosing them from a file dialog — and, given an upload function, the place each file's upload shows its progress.
|
|
2
|
+
|
|
3
|
+
## Value
|
|
4
|
+
|
|
5
|
+
The value is a list of file entries — always a list, even in a field that
|
|
6
|
+
takes one file. Each entry has an `id`, the file's `name`, `size` and
|
|
7
|
+
`type`, and a `status`:
|
|
8
|
+
|
|
9
|
+
| `status` | The entry |
|
|
10
|
+
| ----------- | -------------------------------------------------------- |
|
|
11
|
+
| `local` | holds a file not yet sent — see Uploading later |
|
|
12
|
+
| `queued` | waits for a free upload slot — at most three run at once |
|
|
13
|
+
| `uploading` | is being sent |
|
|
14
|
+
| `done` | was sent, or is a file already on the server |
|
|
15
|
+
| `error` | failed; its `error` holds the text the row shows |
|
|
16
|
+
|
|
17
|
+
A file the user added carries the browser `File` as `file`; once uploaded,
|
|
18
|
+
`result` holds what the upload function resolved to. Bind the list with
|
|
19
|
+
`v-model` — an array, so it is a DOM property — or listen for `change`:
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<c-file-upload v-model="files" label="Attachments" multiple />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The value events fire when the user adds, removes or retries a file, when
|
|
26
|
+
`startUploads()` starts files, and once when each upload finishes, done or
|
|
27
|
+
failed — never for progress, and never when `value` is set. Each event carries a new list of new entries.
|
|
28
|
+
|
|
29
|
+
Without `multiple` the field holds one file, and choosing another replaces
|
|
30
|
+
it.
|
|
31
|
+
|
|
32
|
+
## Uploading
|
|
33
|
+
|
|
34
|
+
The field never sends a byte itself. Set `upload` to a function that sends
|
|
35
|
+
one file, and the field calls it for every added file as soon as it is
|
|
36
|
+
added:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
picker.upload = (file, { onProgress, signal }) =>
|
|
40
|
+
new Promise((resolve, reject) => {
|
|
41
|
+
const xhr = new XMLHttpRequest();
|
|
42
|
+
|
|
43
|
+
xhr.upload.onprogress = (e) => onProgress(e.loaded / e.total);
|
|
44
|
+
xhr.onload = () =>
|
|
45
|
+
xhr.status < 300
|
|
46
|
+
? resolve(JSON.parse(xhr.response))
|
|
47
|
+
: reject(new Error('The server refused the file'));
|
|
48
|
+
xhr.onerror = () => reject(new Error('Network error'));
|
|
49
|
+
signal.addEventListener('abort', () => xhr.abort());
|
|
50
|
+
xhr.open('POST', '/api/files');
|
|
51
|
+
xhr.send(file);
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`onProgress` takes a fraction from 0 to 1; until its first call the row's
|
|
56
|
+
bar is indeterminate, so `fetch` — which reports no upload progress — works
|
|
57
|
+
too. The `signal` aborts when the user cancels, removes the entry, or the
|
|
58
|
+
field leaves the page. What the promise resolves to becomes the entry's
|
|
59
|
+
`result`, typically the server's id for the file.
|
|
60
|
+
|
|
61
|
+
When the promise rejects with an `Error`, its `message` is the text the row
|
|
62
|
+
shows, so throw the words the user should read — `new Error('The file
|
|
63
|
+
exceeds your quota')`. Any other rejection, and the browser's own network
|
|
64
|
+
errors, show "Upload failed". Do not rethrow raw server responses.
|
|
65
|
+
|
|
66
|
+
A failed row offers a retry; a queued or uploading one, a cancel.
|
|
67
|
+
|
|
68
|
+
## Uploading later
|
|
69
|
+
|
|
70
|
+
A `manual` field holds added files as `local` even with an upload function,
|
|
71
|
+
until `startUploads()` queues them — so a form can upload only when the user
|
|
72
|
+
asks:
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<c-file-upload
|
|
76
|
+
ref="field"
|
|
77
|
+
v-model="files"
|
|
78
|
+
:upload="send"
|
|
79
|
+
label="Attachments"
|
|
80
|
+
manual
|
|
81
|
+
multiple
|
|
82
|
+
/>
|
|
83
|
+
<c-button @click="field?.startUploads()">Upload</c-button>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The call starts the files the field holds at that moment and fires the value
|
|
87
|
+
events once. Files added after it wait as `local` for the next call; a failed
|
|
88
|
+
row's retry still sends its file at once. Without an upload function the call
|
|
89
|
+
does nothing.
|
|
90
|
+
|
|
91
|
+
Without `manual`, there is no waiting: an upload function assigned later
|
|
92
|
+
queues every `local` entry at once, and so every file added after it.
|
|
93
|
+
|
|
94
|
+
Or leave `upload` unset and send the files with the rest of the form. The
|
|
95
|
+
field takes no part in a native `<form>` submission; build the `FormData`
|
|
96
|
+
from the value:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
const body = new FormData();
|
|
100
|
+
|
|
101
|
+
for (const entry of files) if (entry.file) body.append('files', entry.file);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Files already on the server
|
|
105
|
+
|
|
106
|
+
To show files the user uploaded earlier, set them as entries without a
|
|
107
|
+
`file`, with `status: 'done'` and the server's own `id`:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
picker.value = [
|
|
111
|
+
{ id: 'f_12', name: 'contract.pdf', size: 120_400, status: 'done' },
|
|
112
|
+
];
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Removing one only takes it out of the value. Deleting it on the server, if
|
|
116
|
+
it should be, is the consumer's job — on submit, or by comparing the lists.
|
|
117
|
+
|
|
118
|
+
Keep each entry's `id` when the value passes through your own state: the
|
|
119
|
+
field matches entries by `id`, so a list rebuilt without it loses the
|
|
120
|
+
progress and the cancel of the files still uploading.
|
|
121
|
+
|
|
122
|
+
## Accepted files
|
|
123
|
+
|
|
124
|
+
`accept` takes the native syntax — extensions and media types,
|
|
125
|
+
`.pdf,image/*`. It filters the file dialog, and the field checks a dropped
|
|
126
|
+
file against it too, since a drop bypasses the dialog. `max-size` caps a
|
|
127
|
+
file's size in bytes, and `max-files` the number of entries a `multiple`
|
|
128
|
+
field holds:
|
|
129
|
+
|
|
130
|
+
```vue
|
|
131
|
+
<c-file-upload
|
|
132
|
+
v-model="files"
|
|
133
|
+
accept=".pdf,image/*"
|
|
134
|
+
hint="PDF or images, up to 10 MB each"
|
|
135
|
+
label="Receipts"
|
|
136
|
+
max-files="5"
|
|
137
|
+
max-size="10000000"
|
|
138
|
+
multiple
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Sizes are shown in decimal units — `1 MB` is 1,000,000 bytes, as on most
|
|
143
|
+
phones and Macs — so write `max-size` in decimal bytes. Name the accepted
|
|
144
|
+
types and limits in the `hint`; the field does not generate that text.
|
|
145
|
+
|
|
146
|
+
The field never holds the same file twice: a file already in the list —
|
|
147
|
+
picked again from the same folder, or matching a server file's name and
|
|
148
|
+
size — is refused too, and so is the one file of a field without `multiple`
|
|
149
|
+
when it is picked again.
|
|
150
|
+
|
|
151
|
+
A refused file never joins the value. It shows as a rejected row with the
|
|
152
|
+
reason, and the `reject` event lists every refused file with its reason:
|
|
153
|
+
`type`, `size`, `duplicate`, `count` or `folder`. The rows describe the
|
|
154
|
+
latest add, so the next change to the list — another add, a removal, or a
|
|
155
|
+
value set from outside — clears them, and the user can close each one.
|
|
156
|
+
|
|
157
|
+
## Compact
|
|
158
|
+
|
|
159
|
+
`compact` shows the drop zone as a row at the shared control height — a
|
|
160
|
+
"Choose files" button and a drop prompt — so the field lines up with the
|
|
161
|
+
fields beside it. `size="small"` makes the row 36px tall:
|
|
162
|
+
|
|
163
|
+
```vue
|
|
164
|
+
<c-file-upload v-model="cv" compact label="CV" />
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The file list sits under the drop zone in both layouts.
|
|
168
|
+
|
|
169
|
+
## Dropping
|
|
170
|
+
|
|
171
|
+
The whole field takes a drop, not only the drop zone, so a drop that just
|
|
172
|
+
misses the zone still lands. While files are dragged over it, the zone
|
|
173
|
+
highlights and the host exposes the `drag-over` custom state.
|
|
174
|
+
|
|
175
|
+
## Accessibility
|
|
176
|
+
|
|
177
|
+
Dragging is a pointer-only shortcut: the drop zone is a button that opens
|
|
178
|
+
the file dialog, and on a touch screen its prompt reads "Choose files".
|
|
179
|
+
Each row's buttons are named after the file — "Remove report.pdf", "Cancel
|
|
180
|
+
upload of report.pdf". A polite announcement reports files added, each
|
|
181
|
+
finished or failed upload and each rejected file; progress is never
|
|
182
|
+
announced, but each uploading row's progress bar can be read on demand.
|
|
183
|
+
|
|
184
|
+
## Texts
|
|
185
|
+
|
|
186
|
+
Every text the field shows or announces is in `texts`, merged over the
|
|
187
|
+
English defaults; set it per field or app-wide with `applyDefaults`. File
|
|
188
|
+
sizes follow the page's `lang` (`1,2 Mt` under `lang="fi"`) and need no
|
|
189
|
+
texts.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
An icon drawn from a single SVG path, sized in pixels and filled with the
|
|
2
|
+
colour of the surrounding text unless given one of its own.
|
|
3
|
+
|
|
4
|
+
Pass the icon path in `path`: the path data of an icon drawn on a 24×24 grid,
|
|
5
|
+
typically an export of `@mdi/js` (Material Design Icons). The icon renders at
|
|
6
|
+
24px; `size` sets another width and height in pixels.
|
|
7
|
+
|
|
8
|
+
```vue
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { mdiCheckCircle } from '@mdi/js';
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<c-icon :path="mdiCheckCircle" :size="20" />
|
|
15
|
+
</template>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Colour
|
|
19
|
+
|
|
20
|
+
Without `color`, the icon fills with `currentColor`, so it takes the text
|
|
21
|
+
colour of its surroundings: inside a `c-button` or `c-icon-button` it follows
|
|
22
|
+
the button's appearance and disabled state. To recolour it, set the CSS
|
|
23
|
+
`color` on the element or an ancestor, or pass any CSS colour in `color`.
|
|
24
|
+
Prefer the semantic tokens, such as `color="var(--c-success)"`, which follow
|
|
25
|
+
the theme mode.
|
|
26
|
+
|
|
27
|
+
## Accessibility
|
|
28
|
+
|
|
29
|
+
The icon is an unnamed `<svg>` unless the element has an `aria-label`.
|
|
30
|
+
|
|
31
|
+
- A decorative icon, one beside a visible label that says the same thing:
|
|
32
|
+
set `aria-hidden="true"` on the `c-icon` so screen readers skip it.
|
|
33
|
+
- Inside a control named by its `aria-label`, such as a `c-icon-button`, the
|
|
34
|
+
label replaces the icon; nothing more is needed.
|
|
35
|
+
- A meaningful icon with no visible text, such as a status shown only as an
|
|
36
|
+
icon: name it with `aria-label` on the `c-icon`, which makes it an image
|
|
37
|
+
(`role="img"`) with that name.
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<c-icon
|
|
41
|
+
:path="mdiCheckCircle"
|
|
42
|
+
aria-label="Completed"
|
|
43
|
+
color="var(--c-success)"
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Customization
|
|
48
|
+
|
|
49
|
+
`::part(root)` is the `<svg>`. Its width and height are set inline from
|
|
50
|
+
`size`, so size the icon with the prop. A `color` set on the part recolours
|
|
51
|
+
an icon that has no `color` prop of its own.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
An icon-only button: a round native button that shows a single icon and takes
|
|
2
|
+
its accessible name from an `aria-label` on the element.
|
|
3
|
+
|
|
4
|
+
Slot a `c-icon` into it, or pass an icon path in `path` for an icon drawn by
|
|
5
|
+
the button itself (the slot wins when both are given). Listen to the native
|
|
6
|
+
`click` event; a disabled or loading button does not deliver it.
|
|
7
|
+
|
|
8
|
+
```vue
|
|
9
|
+
<c-icon-button aria-label="Delete" danger @click="remove">
|
|
10
|
+
<c-icon :path="mdiDelete" />
|
|
11
|
+
</c-icon-button>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## When to use
|
|
15
|
+
|
|
16
|
+
- A compact action whose icon is widely recognised: close, edit, delete,
|
|
17
|
+
more actions, a toolbar control.
|
|
18
|
+
- When there is room for a visible label, prefer `c-button` with the icon in
|
|
19
|
+
its `icon` slot: a label is clearer than an icon alone.
|
|
20
|
+
- For navigation, use `c-button` with `href` or `c-link`; an icon button has
|
|
21
|
+
no `href`.
|
|
22
|
+
|
|
23
|
+
## Appearances
|
|
24
|
+
|
|
25
|
+
The appearances match `c-button`'s: the default filled primary button for
|
|
26
|
+
the main action, then `outlined`, `ghost` (a light primary tint) and `text`
|
|
27
|
+
(no fill) for lower emphasis. `danger` turns the filled button into the error
|
|
28
|
+
role for a destructive action; it has no effect on the other appearances.
|
|
29
|
+
`inverted` is for a fixed dark or brand-coloured backdrop: it paints the
|
|
30
|
+
`inverse-*` family, which looks the same in both theme modes.
|
|
31
|
+
|
|
32
|
+
## Sizes
|
|
33
|
+
|
|
34
|
+
`size` is `default` (40px), `small` (32px) or `x-small` (28px). A slotted
|
|
35
|
+
`<svg>` is sized to match (24, 22 or 18px), but a slotted `c-icon` keeps its
|
|
36
|
+
own `size` (24 by default), so set it to fit a smaller button. An icon drawn
|
|
37
|
+
from `path` is always 24px.
|
|
38
|
+
|
|
39
|
+
## Badge
|
|
40
|
+
|
|
41
|
+
`badge` shows a count in a bubble at the button's top-right corner. It is
|
|
42
|
+
hidden while the value is `null` or an empty string, so `badge="0"` still
|
|
43
|
+
shows 0. Put the count in the accessible name as well
|
|
44
|
+
(`aria-label="3 notifications"`): the label replaces the button's content,
|
|
45
|
+
bubble included.
|
|
46
|
+
|
|
47
|
+
## Disabled and loading
|
|
48
|
+
|
|
49
|
+
`disabled` disables the native button: it leaves the tab order and ignores
|
|
50
|
+
the pointer. `loading` replaces the icon with a spinner and swallows clicks;
|
|
51
|
+
the button stays focusable and is announced as busy and unavailable
|
|
52
|
+
(`aria-busy`, `aria-disabled`). Mark the region the wait affects too, with
|
|
53
|
+
`aria-busy` or a live-region message.
|
|
54
|
+
|
|
55
|
+
## Accessibility
|
|
56
|
+
|
|
57
|
+
The `root` part is a native `<button>`, so focus, keyboard activation and the
|
|
58
|
+
button role come from the platform. Its name comes from `aria-label` on the
|
|
59
|
+
`c-icon-button` element, which is forwarded to the inner button, as are the
|
|
60
|
+
other ARIA attributes (`aria-expanded`, `aria-haspopup`, …). Those holding
|
|
61
|
+
element ids (`aria-controls`, `aria-describedby`, …) give the button the
|
|
62
|
+
elements the ids name in your page. Without an `aria-label` the button is named only by
|
|
63
|
+
the text in its content, which is usually nothing or the badge count; visually
|
|
64
|
+
hidden slotted text also names it, and keeps naming it while `loading`.
|
|
65
|
+
|
|
66
|
+
To show the name to sighted users too, put the button in a `c-tooltip`'s
|
|
67
|
+
`trigger` slot. The tooltip text is announced as a description, so the
|
|
68
|
+
`aria-label` is still required.
|
|
69
|
+
|
|
70
|
+
## Customization
|
|
71
|
+
|
|
72
|
+
Restyle via CSS parts: `::part(root)` is the button, `::part(content)` the
|
|
73
|
+
wrapper around the icon or spinner, and `::part(badge)` the count bubble.
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
c-icon-button::part(badge) {
|
|
77
|
+
background-color: var(--c-error);
|
|
78
|
+
color: var(--c-on-error);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
@@ -1 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
A text link to another page or resource: a native `<a>` in the link colour,
|
|
2
|
+
with an optional underline.
|
|
3
|
+
|
|
4
|
+
Put the link text in the default slot and set `href`. `target` says where the
|
|
5
|
+
link opens, as on a native `<a>`: the same tab unless set, `_blank` for a new
|
|
6
|
+
one.
|
|
7
|
+
|
|
8
|
+
```html
|
|
9
|
+
<c-link href="/docs/billing">Read the billing guide</c-link>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
- Navigation in running text, or a list of links.
|
|
15
|
+
- For an action, use `c-button` (its `text` appearance looks the lightest);
|
|
16
|
+
for a link that looks like a button, use `c-button` with `href`.
|
|
17
|
+
|
|
18
|
+
## Underline
|
|
19
|
+
|
|
20
|
+
`underline` underlines the text. Underline links inside running text, so
|
|
21
|
+
they are not told apart from the text around them by colour alone.
|
|
22
|
+
|
|
23
|
+
## Accessibility
|
|
24
|
+
|
|
25
|
+
The link is a native `<a>`: focus, Enter, middle-click and open-in-new-tab
|
|
26
|
+
come from the platform. Its accessible name is its text, so make the text
|
|
27
|
+
say where it leads ("Read the billing guide", not "click here"). Without
|
|
28
|
+
`href` the `<a>` has no destination: it is neither focusable nor announced
|
|
29
|
+
as a link, so do not use `c-link` for actions.
|
|
30
|
+
|
|
31
|
+
ARIA attributes (`aria-label`, `aria-current`, …) and the link attributes
|
|
32
|
+
`rel`, `download`, `hreflang`, `ping`, `referrerpolicy` and `type` set on the
|
|
33
|
+
`c-link` element are forwarded to the inner `<a>`.
|
|
34
|
+
|
|
35
|
+
## Customization
|
|
36
|
+
|
|
37
|
+
`::part(root)` is the `<a>`. It paints the `link` role, with the
|
|
38
|
+
`link-subtle` fill on hover and a focus ring in the link colour; override the
|
|
39
|
+
tokens to re-theme.
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
c-link::part(root) {
|
|
43
|
+
font-weight: 400;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
A vertical list of rows, each a `c-list-item` with its main content and optional leading and trailing content, for settings entries, related pages or a short set of records.
|
|
2
|
+
|
|
3
|
+
Put the row's main content, usually a `c-list-item-title`, in the item's default slot, an icon or other leading content in the `pre` slot and trailing content in the `post` slot. Empty `pre` and `post` slots take no space. The default slot stacks its children, so a title can carry a second line of text under it.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<c-list bordered>
|
|
7
|
+
<c-list-item href="/settings/profile" active>
|
|
8
|
+
<c-list-item-title>Profile</c-list-item-title>
|
|
9
|
+
<span>Name, email and language</span>
|
|
10
|
+
</c-list-item>
|
|
11
|
+
|
|
12
|
+
<c-list-item href="/settings/notifications">
|
|
13
|
+
<c-list-item-title>Notifications</c-list-item-title>
|
|
14
|
+
</c-list-item>
|
|
15
|
+
</c-list>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- A short list of rows the user reads or opens: settings sections, related pages, the members of a project.
|
|
21
|
+
- For the application's main navigation, use `c-side-navigation`; for a panel of commands, `c-menu`.
|
|
22
|
+
- For records with several columns, use `c-data-table` or `c-table`.
|
|
23
|
+
|
|
24
|
+
## Interactive items
|
|
25
|
+
|
|
26
|
+
An item is static by default: a row of content with no hover state and no place in the Tab order.
|
|
27
|
+
|
|
28
|
+
- `href` turns the item's content box into a real link, with focus, Enter, middle-click and open-in-new-tab from the platform, and a hover tint on the row. `target` says where the link opens, as on a native `<a>`: the same tab unless set, `_blank` for a new one.
|
|
29
|
+
- `ripple` adds a pointer cursor, the hover tint and a ripple on press, and puts an item without `href` in the Tab order, where Enter and Space press it: each fires `click`, as a mouse click does. Give navigation an `href`; an action of the item's own can also go in a `c-button` in the `post` slot.
|
|
30
|
+
- `hoverable` adds the hover tint alone.
|
|
31
|
+
|
|
32
|
+
## Active and disabled items
|
|
33
|
+
|
|
34
|
+
`active` marks the current item with a primary tint and an inset primary ring; in a `bordered` list its border turns primary too. Assistive technology hears it as the current item: `aria-current="page"` on a link item, `aria-current="true"` on any other.
|
|
35
|
+
|
|
36
|
+
`disabled` greys an item out, a slotted `c-icon` included, ignores the pointer, and takes the item out of the Tab order (a disabled link item stops being a link). `disabled` on the list disables every item, also items added later. Clearing it re-enables only the items the list disabled, so an item you disabled yourself stays disabled.
|
|
37
|
+
|
|
38
|
+
## Accessibility
|
|
39
|
+
|
|
40
|
+
The list has `role="list"` and each item `role="listitem"`, so a screen reader announces the list and how many items it holds. An item with `href` is a link named by its content.
|
|
41
|
+
|
|
42
|
+
## Customization
|
|
43
|
+
|
|
44
|
+
`bordered` draws a 1px border with rounded corners around each item. `c-list::part(root)` is the grid holding the items, 4px apart; `c-list-item::part(root)` is an item's content box (a `<div>`, or the `<a>` when `href` is set); `c-list-item-title::part(root)` is the title text.
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
c-list::part(root) {
|
|
48
|
+
gap: 0;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
One row of a `c-list`: its main content goes in the default slot, leading content such as an icon in the `pre` slot and trailing content in the `post` slot. The row is static unless it has an `href`, which makes it a real link; `ripple` adds a press effect and a Tab stop that Enter and Space press, firing `click`; give navigation an `href`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The main text of a `c-list-item`, in medium-weight type; place it in the item's default slot. It takes the active row's ink by itself when its item is `active`.
|
|
@@ -1 +1,52 @@
|
|
|
1
|
-
A
|
|
1
|
+
A loading overlay that covers a container with a translucent scrim and a
|
|
2
|
+
centred spinner, with an optional message below it, while that container's
|
|
3
|
+
content loads.
|
|
4
|
+
|
|
5
|
+
Place the `c-loader` inside the container it should cover, and make that
|
|
6
|
+
container a positioning context (`position: relative`): the loader fills the
|
|
7
|
+
nearest positioned ancestor. It shows while it is in the page; bind `hide` to
|
|
8
|
+
take it away. Toggling `hide` fades the loader out and back in, which
|
|
9
|
+
removing it with `v-if` would skip.
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<section style="position: relative">
|
|
13
|
+
<c-loader :hide="!loading">Loading projects…</c-loader>
|
|
14
|
+
…
|
|
15
|
+
</section>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- Covering a region — a card, a panel, a list — while its content loads or
|
|
21
|
+
refreshes, so it is not read or used half-updated.
|
|
22
|
+
- For a small inline wait, use `c-spinner`; for known progress,
|
|
23
|
+
`c-progress-bar` or `c-progress-circle`. `c-data-table` has its own
|
|
24
|
+
`loading` state.
|
|
25
|
+
|
|
26
|
+
## Message and spinner
|
|
27
|
+
|
|
28
|
+
Slot a short message to explain the wait. It fades in below the spinner
|
|
29
|
+
after `content-delay` milliseconds (0 by default), so a delay keeps a quick
|
|
30
|
+
load down to the spinner alone. `size` and `width` set the spinner's diameter
|
|
31
|
+
and stroke in pixels (48 and 4 by default).
|
|
32
|
+
|
|
33
|
+
## Accessibility
|
|
34
|
+
|
|
35
|
+
The scrim keeps the pointer off the covered content, but not the keyboard:
|
|
36
|
+
Tab still reaches controls beneath it, so make the region `inert` while it
|
|
37
|
+
loads where that matters. The loader adds no role, busy state or live region,
|
|
38
|
+
and its message is read in place but not announced when it appears. Set
|
|
39
|
+
`aria-busy="true"` on the covered region while it loads, and announce the
|
|
40
|
+
outcome yourself where the user needs to hear it.
|
|
41
|
+
|
|
42
|
+
## Customization
|
|
43
|
+
|
|
44
|
+
`::part(root)` is the overlay: the scrim, painted in the `surface` role at
|
|
45
|
+
80% opacity, and the primary text colour that the spinner takes.
|
|
46
|
+
`::part(content)` is the message.
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
c-loader::part(root) {
|
|
50
|
+
color: var(--c-secondary);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
One identity-provider choice inside `c-login-buttons`: a card with the provider's logo (`src`, or markup in the `image` slot) above the provider's name. With an `href` it is a link to the provider's sign-in; without one it is a button whose `click` you handle. Leave `alt` empty when the name already identifies the provider.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
A grid of sign-in choices, one `c-login-button` per identity provider, each showing the provider's logo above its name.
|
|
2
|
+
|
|
3
|
+
Use it where a service lets the user pick how to sign in, such as Haka, Virtu or a CSC account. Each `c-login-button` is that provider's sign-in: set its `href` to make it a link (or handle its `click` without one), the logo in `src` and the provider's name in the default slot. The grid has no props or events of its own.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<c-login-buttons>
|
|
7
|
+
<c-login-button href="/login/haka" src="/img/haka.svg">
|
|
8
|
+
Haka login
|
|
9
|
+
</c-login-button>
|
|
10
|
+
<c-login-button href="/login/virtu" src="/img/virtu.svg">
|
|
11
|
+
Virtu login
|
|
12
|
+
</c-login-button>
|
|
13
|
+
<c-login-button href="/login/csc" src="/img/csc.svg">
|
|
14
|
+
CSC login
|
|
15
|
+
</c-login-button>
|
|
16
|
+
</c-login-buttons>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## When to use
|
|
20
|
+
|
|
21
|
+
- On a sign-in page that offers more than one identity provider.
|
|
22
|
+
- For a single sign-in action, use a `c-button`.
|
|
23
|
+
|
|
24
|
+
## Layout
|
|
25
|
+
|
|
26
|
+
The grid fits as many columns as its width allows, each at least 12rem wide, and shares each row evenly between them; the buttons move onto further rows as the space narrows. Every button in a row takes the height of the tallest.
|
|
27
|
+
|
|
28
|
+
## Logos
|
|
29
|
+
|
|
30
|
+
`src` loads the provider's logo into an `<img>`, centred above the name and scaled down to fit the button. For markup an `<img>` cannot carry, such as an inline `<svg>` or a `<picture>`, use the button's `image` slot, which replaces the `<img>`.
|
|
31
|
+
|
|
32
|
+
## Accessibility
|
|
33
|
+
|
|
34
|
+
With `href` a button is a real link: focus, Enter, middle-click and open-in-new-tab come from the platform. Without `href` it is a native button that Enter and Space press, firing `click`.
|
|
35
|
+
|
|
36
|
+
A button's accessible name is the logo's `alt` followed by the name in the default slot. The name already identifies the provider, so leave `alt` empty (the default) unless the logo says something the name does not. Mark an inline `<svg>` in the `image` slot `aria-hidden="true"` for the same reason.
|
|
37
|
+
|
|
38
|
+
## Customization
|
|
39
|
+
|
|
40
|
+
`c-login-buttons` is itself the grid container, so set `gap` or `grid-template-columns` on the element to change the columns:
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
c-login-buttons {
|
|
44
|
+
grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Each button's parts are `::part(root)` (the link or button box), `::part(image-wrap)` (the area that centres the logo), `::part(image)` (the default `<img>`) and `::part(label)` (the bar holding the name).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
The card of a sign-in page: a large surface holding the service's heading, the sign-in form or choices and their actions, with an optional background image showing below a curved edge.
|
|
2
|
+
|
|
3
|
+
Build it from its sections, in this order: `c-login-card-title` for the heading, `c-login-card-content` for the intro text and the fields, and `c-login-card-actions` for the sign-in button and any links next to it.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<c-login-card src="/img/sign-in.jpg">
|
|
7
|
+
<c-login-card-title>Sign in to My CSC</c-login-card-title>
|
|
8
|
+
|
|
9
|
+
<c-login-card-content>
|
|
10
|
+
<p>Access your projects and services with your CSC account.</p>
|
|
11
|
+
<c-text-field label="Username"></c-text-field>
|
|
12
|
+
<c-text-field label="Password" type="password"></c-text-field>
|
|
13
|
+
</c-login-card-content>
|
|
14
|
+
|
|
15
|
+
<c-login-card-actions justify="space-between">
|
|
16
|
+
<c-button size="large">Sign in</c-button>
|
|
17
|
+
<c-link href="/reset-password">Forgot password?</c-link>
|
|
18
|
+
</c-login-card-actions>
|
|
19
|
+
</c-login-card>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## When to use
|
|
23
|
+
|
|
24
|
+
- As the one card on a sign-in page.
|
|
25
|
+
- For grouping any other content, use `c-card`.
|
|
26
|
+
|
|
27
|
+
## Background image
|
|
28
|
+
|
|
29
|
+
`src` sets the image. On a wide card it fills the bottom-right corner below a curved edge, and the content column leaves room for it; `background-position` (any CSS `background-position` value, `bottom right` by default) chooses which part of the image shows. Without `src` there is no image and the content takes the card's full width.
|
|
30
|
+
|
|
31
|
+
`overlay` tints the image with the primary colour, blended through `overlay-blend-mode` — `multiply` by default, or any other CSS blend mode — so a photograph sits in the brand palette.
|
|
32
|
+
|
|
33
|
+
## Compact layout
|
|
34
|
+
|
|
35
|
+
The card measures its own width, not the window's. At `mobile-breakpoint` pixels (600 by default) or narrower it switches to a compact layout: tighter padding, content across the full width, the image moved to a wave-shaped strip along the bottom edge, and the heading shrunk from 40px to 32px with hyphenation.
|
|
36
|
+
|
|
37
|
+
## Accessibility
|
|
38
|
+
|
|
39
|
+
The image is a CSS background: it is never announced, so it must not carry information the page needs. `c-login-card-title` is a heading, level 2 unless its `heading-level` says otherwise.
|
|
40
|
+
|
|
41
|
+
## Customization
|
|
42
|
+
|
|
43
|
+
`::part(root)` is the card's surface (background, ink and corner radius), `::part(card)` the shadowed box inside it, `::part(image)` the clipped image layer and `::part(content)` the padded column holding the sections. Each section has parts of its own, listed with it below.
|
|
44
|
+
|
|
45
|
+
A login card that pins its own theme mode with `data-theme="light"` or `data-theme="dark"` repaints its surface and the ink of everything slotted into it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The row of actions at the bottom of a `c-login-card`: the sign-in button and any link beside it, such as a forgotten-password link. `justify` distributes them along the row (`start` by default, `space-between` to push the last one to the far end, `stretch` to grow them all) and `align` places them across it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The body of a `c-login-card`, which stacks the intro text and the sign-in fields in a column with a 24px gap. Place it between `c-login-card-title` and `c-login-card-actions`.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The heading of a `c-login-card`, in large bold type in the primary colour; place it first in the card. The card shrinks it from 40px to 32px in its compact layout.
|
|
2
|
+
|
|
3
|
+
The title is a heading, level 2 unless `heading-level` says otherwise; on a sign-in page whose only other heading is the page's `h1`, keep 2.
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
The page shell of an application: it paints the page canvas and lays out the toolbar, the side navigation and the page in the dashboard layout. It is at least a viewport tall and grows with its content, so the document — not a component — is what scrolls.
|
|
2
|
+
|
|
3
|
+
## Dashboard layout
|
|
4
|
+
|
|
5
|
+
Slot the layout components as direct children and `c-main` places them: `c-toolbar` spans the top, `c-side-navigation` takes the left column and `c-page` fills the rest. The toolbar pins itself to the top of the viewport; `c-main` pins the desktop side navigation beneath it and moves its pin to the top edge when the toolbar is `static`. The drawer is sized to the pinned height: a short menu fills the column, a long one scrolls inside the drawer, and the side navigation's bottom slot stays at the bottom edge of the viewport — also while a banner or a static toolbar is still above the drawer. The 3.x `autoheight` host class is ignored here, and the mobile drawer is not touched. The drawer never adds to the layout's height: a page that fits the viewport is exactly a viewport tall and does not scroll, with or without a banner, pinned or static toolbar.
|
|
6
|
+
|
|
7
|
+
## Banner
|
|
8
|
+
|
|
9
|
+
A full-width message strip above the toolbar — a service notice, an environment warning — goes in the `banner` slot. Slot a `c-alert` or your own markup; `c-main` only places it. The banner scrolls away with the page and the toolbar pins in its place. This is a message strip, not the ARIA `banner` landmark.
|
|
10
|
+
|
|
11
|
+
## Disabling the layout
|
|
12
|
+
|
|
13
|
+
`disable-layout` turns the grid into a plain column, still at least a viewport tall, for pages that arrange their own chrome. The banner slot renders first in the column.
|
|
14
|
+
|
|
15
|
+
## Scrolling
|
|
16
|
+
|
|
17
|
+
The document scrolls, so browser scroll restoration, anchors, find-in-page and mobile browser chrome all behave natively, and a modal inside `c-main` stops the page behind it. `c-page` has no fixed height and no scrollbar of its own; its `scroll-indicator` tracks the document. Set `html { scroll-behavior: smooth }` for smooth anchor scrolling.
|
|
18
|
+
|
|
19
|
+
## Customization
|
|
20
|
+
|
|
21
|
+
Structural styling via `::part(root)`, the shell box; the dashboard grid inside it is not a part. Anything that paints below the shell's bottom edge is clipped rather than lengthening the page. To show the layout inside a bounded box — a demo, a preview — give the part a height together with `min-height: 0` and `overflow-y: auto`, and set `--c-main-viewport-height` to the same height so the pinned side navigation is sized to the box instead of the viewport; the toolbar and side navigation then pin inside that box.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
A command menu: a transient panel of actions or navigation choices opened from a trigger (the WAI-ARIA menu-button pattern), authored declaratively with slotted `c-menu-item`, `c-menu-label` and `c-divider` elements. Activating an item fires a one-off `select` event and closes the menu; the menu holds no selected value — that is `c-select`'s job.
|
|
2
|
+
|
|
3
|
+
## Scrolling
|
|
4
|
+
|
|
5
|
+
A menu taller than the viewport allows scrolls without a scrollbar: the panel
|
|
6
|
+
ends on a half-visible item, which is the cue that more items follow, and the
|
|
7
|
+
wheel, touch and arrow keys scroll as usual. Submenu panels behave the same.
|
|
8
|
+
To bring the native scrollbar back:
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
c-menu::part(list),
|
|
12
|
+
c-menu-item::part(submenu-list) {
|
|
13
|
+
scrollbar-width: auto;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
@@ -1 +1,12 @@
|
|
|
1
1
|
A single command in a `c-menu`.
|
|
2
|
+
|
|
3
|
+
Put a leading icon in the `icon` slot (`<c-icon slot="icon" path="…">`). For
|
|
4
|
+
a set of choices, give each item `type="radio"` and mark the current one
|
|
5
|
+
`checked`: it shows a check mark and `aria-checked`. The menu only fires
|
|
6
|
+
`select`; checking the item is yours to do.
|
|
7
|
+
|
|
8
|
+
## Scrolling
|
|
9
|
+
|
|
10
|
+
A long submenu scrolls like the menu itself: no scrollbar, and a half-visible
|
|
11
|
+
item as the cue that more follow. Restore the scrollbar with
|
|
12
|
+
`c-menu-item::part(submenu-list) { scrollbar-width: auto; }`.
|