@cscfi/csc-ui 4.0.0-alpha.3 → 4.0.0-alpha.30
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 +14328 -8058
- package/dist/custom-elements.json +8952 -4605
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-autocomplete/usage.md +152 -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-group/usage.md +14 -1
- package/dist/docs/c-checkbox/usage.md +53 -0
- package/dist/docs/c-date-picker/usage.md +224 -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 +6 -0
- package/dist/docs/c-number-field/usage.md +112 -0
- package/dist/docs/c-option-value/usage.md +1 -0
- package/dist/docs/c-popover/usage.md +33 -0
- package/dist/docs/c-progress-bar/usage.md +23 -0
- package/dist/docs/c-progress-circle/usage.md +25 -0
- package/dist/docs/c-radio/usage.md +45 -0
- package/dist/docs/c-radio-group/usage.md +67 -0
- package/dist/docs/c-select/usage.md +127 -0
- package/dist/docs/c-side-navigation/usage.md +21 -0
- package/dist/docs/c-spinner/usage.md +21 -0
- package/dist/docs/c-switch/usage.md +36 -0
- package/dist/docs/c-tab-buttons/usage.md +7 -0
- package/dist/docs/c-table/usage.md +14 -0
- package/dist/docs/c-text-field/usage.md +106 -0
- package/dist/docs/c-time-picker/usage.md +170 -0
- package/dist/docs/c-toolbar/usage.md +17 -0
- package/dist/docs/c-tooltip/usage.md +30 -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 +33 -0
- package/dist/styles/css/tokens.css +719 -197
- package/dist/vscode.css-custom-data.json +474 -20
- package/dist/vscode.html-custom-data.json +659 -57
- package/dist/web-types.json +2813 -697
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +118 -21
- 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 +4 -4
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +1 -1
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +3 -3
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +6 -2
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +282 -0
- package/dist-types/components/c-date-picker/dates.d.ts +119 -0
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +50 -7
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +6 -6
- package/dist-types/components/c-list-item/CListItem.vue.d.ts +1 -1
- package/dist-types/components/c-main/CMain.vue.d.ts +10 -2
- package/dist-types/components/c-menu/CMenu.vue.d.ts +13 -3
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +30 -3
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +174 -0
- package/dist-types/components/c-number-field/numbers.d.ts +58 -0
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +1 -1
- package/dist-types/components/c-pagination/CPagination.vue.d.ts +1 -1
- package/dist-types/components/c-popover/CPopover.vue.d.ts +43 -0
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +32 -0
- package/dist-types/components/c-radio/CRadio.vue.d.ts +7 -11
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +10 -48
- package/dist-types/components/c-select/CSelect.vue.d.ts +115 -27
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +1 -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 +3 -3
- package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +1 -1
- package/dist-types/components/c-tab-buttons/CTabButtons.vue.d.ts +1 -1
- package/dist-types/components/c-table/CTable.vue.d.ts +11 -1
- package/dist-types/components/c-table/injectTableStyles.d.ts +1 -0
- package/dist-types/components/c-tag/CTag.vue.d.ts +7 -0
- package/dist-types/components/c-tags/CTags.vue.d.ts +1 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +27 -10
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +210 -0
- package/dist-types/components/c-time-picker/times.d.ts +82 -0
- package/dist-types/components/c-toasts/CToasts.vue.d.ts +1 -1
- package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +49 -0
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +261 -0
- package/dist-types/index.d.ts +19 -2
- package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
- 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 +46 -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/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 +65 -0
- package/dist-types/shared/positionArea.d.ts +13 -0
- 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 +102 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +41 -0
- package/dist-types/shared/useFallbackPosition.d.ts +63 -0
- package/dist-types/shared/useHostStates.d.ts +25 -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 +103 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +769 -54
- 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 -0
- package/package.json +21 -9
- package/dist/css-anchor-positioning-fn-RTxo68pt.js +0 -6447
- package/dist-types/shared/anchorPolyfill.d.ts +0 -24
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
A persistent, in-flow status message: a tinted box whose type carries a status family's colours through the icon, heading and accent edge, while the body copy stays neutral.
|
|
2
|
+
|
|
3
|
+
Give the alert a `heading` with the prop for plain text; the `heading` slot overrides the prop when rich content (links, emphasis) is needed. The message goes in the default slot.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- Persistent status that belongs to the page or a section: a maintenance notice, a failed validation summary, a quota warning.
|
|
8
|
+
- Not for transient feedback on an action — use `c-toasts`, which overlays and dismisses itself; the alert stays in the layout until the consumer removes it.
|
|
9
|
+
|
|
10
|
+
## Types
|
|
11
|
+
|
|
12
|
+
The four status types (`error`, `info`, `success`, `warning`) carry their status family's colours and icon; `default` — equivalently, omitting the attribute — renders the brand-primary look. Severity is signalled by the icon, the heading's ink and the accent edge, never by colouring the body text.
|
|
13
|
+
|
|
14
|
+
## Dismissal
|
|
15
|
+
|
|
16
|
+
`dismissible` renders a dismiss button, but pressing it only emits the `dismiss` event — removing the alert from the page stays the consumer's job.
|
|
17
|
+
|
|
18
|
+
## Accessibility
|
|
19
|
+
|
|
20
|
+
The alert manages its own live-region role: `warning` and `error` interrupt (`role="alert"`), while the other types announce politely (`role="status"`). Content that is present at page load is not announced — live regions only announce changes.
|
|
21
|
+
|
|
22
|
+
## Customization
|
|
23
|
+
|
|
24
|
+
Structural styling via `::part(root)`, `::part(icon)`, `::part(content)`, `::part(heading)` and `::part(dismiss)`. Colours come from the status-family semantic tokens; override the tokens to re-theme.
|
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options.
|
|
2
2
|
|
|
3
|
+
## Options
|
|
4
|
+
|
|
5
|
+
Options are slotted `c-option` elements or an `items` array of
|
|
6
|
+
`{ name, value }` entries. A slotted option's label — the text shown in the
|
|
7
|
+
closed field and in its tag, and the text the filter matches — is its `name`
|
|
8
|
+
attribute, else the text of a `c-option-value` inside it, else the option's
|
|
9
|
+
whole text. Wrap the label in `c-option-value` when an option carries more
|
|
10
|
+
than its label, such as a description; the rest of the option's markup still
|
|
11
|
+
renders in the row:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<c-option value="ts">
|
|
15
|
+
<c-option-value>TypeScript</c-option-value>
|
|
16
|
+
<small>JavaScript with static types</small>
|
|
17
|
+
</c-option>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The row shows a copy of the option's markup, re-created from its HTML inside
|
|
21
|
+
the panel. A component nested in an option — a `c-icon`, say — is therefore
|
|
22
|
+
configured through attributes, or props with an attribute form (strings,
|
|
23
|
+
numbers, booleans); object props and event listeners on option content do not
|
|
24
|
+
carry over. Page CSS does not reach the copy either: give the content a `part`
|
|
25
|
+
and style it through the field:
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<c-option value="ts">
|
|
29
|
+
<div part="language">
|
|
30
|
+
<c-option-value>TypeScript</c-option-value>
|
|
31
|
+
<c-icon path="…"></c-icon>
|
|
32
|
+
</div>
|
|
33
|
+
</c-option>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```css
|
|
37
|
+
c-autocomplete::part(language) {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
While a query is typed, the runs of each option's label that equal it are
|
|
45
|
+
marked: inside the `c-option-value` of a slotted option, or in the plain
|
|
46
|
+
label of an `items` entry. A slotted option without the wrapper is rendered
|
|
47
|
+
exactly as authored and never marked. Every occurrence of the literal query
|
|
48
|
+
is marked, whatever the filter did — a fuzzy `filter`, or a `name` that
|
|
49
|
+
differs from the wrapper's text, can leave a row unmarked — and the wrapper's
|
|
50
|
+
content is treated as plain text while a query is active. The marks are the
|
|
51
|
+
`match` part:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
c-autocomplete::part(match) {
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
3
59
|
## Filtering
|
|
4
60
|
|
|
5
61
|
By default the component filters its options itself: the query typed into the
|
|
@@ -26,3 +82,99 @@ label even when a later fetch no longer includes it: the label is remembered
|
|
|
26
82
|
when the option is committed, and a programmatically set value resolves its
|
|
27
83
|
label from the current options, or from the object's `name` when
|
|
28
84
|
`return-object` is used.
|
|
85
|
+
|
|
86
|
+
## Multiple selection
|
|
87
|
+
|
|
88
|
+
Set `multiple` to let the user pick several options. The value is then an
|
|
89
|
+
array of the picked options' values in the order they were picked (an array
|
|
90
|
+
of `{ name, value }` items with `return-object`), and `[]` when nothing is
|
|
91
|
+
picked. Arrays have no attribute form — bind `value` as a DOM property
|
|
92
|
+
(`v-model` or `:value="…"` in Vue; the React wrapper and property
|
|
93
|
+
assignment do this naturally). Picking an option toggles it and keeps the
|
|
94
|
+
panel open; the search input keeps its query after a pick, so several
|
|
95
|
+
matches can be picked in a row. `clearable` clears the whole selection.
|
|
96
|
+
|
|
97
|
+
Each picked option shows as a tag inside the field, and the field grows as
|
|
98
|
+
the tags wrap. A tag's close button removes that option; Backspace in the
|
|
99
|
+
closed field removes the last one. Set `max-tags` to show only that many
|
|
100
|
+
tags and fold the rest into a single "+N more" tag, or `max-tags="0"` to
|
|
101
|
+
show no tags at all — the field then reads "N selected". Assistive
|
|
102
|
+
technology always hears the full selection as the field's value. With
|
|
103
|
+
`external`, a pick's label is remembered when it is made, so a later fetch
|
|
104
|
+
that no longer lists it keeps its tag readable.
|
|
105
|
+
|
|
106
|
+
Set `select-all` to pin a select-all row at the top of the list. It acts on
|
|
107
|
+
the options currently listed — the matches while a query is typed, or the
|
|
108
|
+
`items` you supply with `external`: activating it selects every enabled one
|
|
109
|
+
of them, or unselects them all when they already are, and options outside
|
|
110
|
+
the list keep their state. Disabled options are left alone, and the row only
|
|
111
|
+
appears while there is something to select. Its label is `texts.selectAll`,
|
|
112
|
+
a function receiving the number of listed options.
|
|
113
|
+
|
|
114
|
+
The row checkboxes recolour like c-checkbox's (`::part(indicator)`,
|
|
115
|
+
`::part(mark)`), the select-all row is the `select-all` part, and the tags are
|
|
116
|
+
stylable through the `tags`, `tag` and `tag-root` parts:
|
|
117
|
+
|
|
118
|
+
```css
|
|
119
|
+
c-autocomplete::part(tag-root) {
|
|
120
|
+
background: var(--c-primary-subtle);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Texts
|
|
125
|
+
|
|
126
|
+
Every built-in string — the clear and toggle button labels, the search
|
|
127
|
+
input's placeholder and accessible label, the loading and no-results rows,
|
|
128
|
+
the select-all row's label, a tag's remove label, the overflow and count
|
|
129
|
+
texts — can be replaced for another language through the `texts` object,
|
|
130
|
+
merged over the English defaults. Count and label texts are functions, so the object must be bound
|
|
131
|
+
as a DOM property; the `placeholder` prop still wins over
|
|
132
|
+
`texts.searchPlaceholder` when both are set:
|
|
133
|
+
|
|
134
|
+
```vue
|
|
135
|
+
<c-autocomplete
|
|
136
|
+
:texts="{
|
|
137
|
+
noResults: 'Ei osumia',
|
|
138
|
+
remove: (label) => `Poista ${label}`,
|
|
139
|
+
}"
|
|
140
|
+
multiple
|
|
141
|
+
/>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
To translate every autocomplete at once, set `texts` app-wide with
|
|
145
|
+
`applyDefaults({ 'c-autocomplete': { texts } })` (Customization → App-wide
|
|
146
|
+
prop defaults); a per-instance `texts` still wins key by key.
|
|
147
|
+
|
|
148
|
+
## Scrolling
|
|
149
|
+
|
|
150
|
+
The panel shows `items-per-page` full rows (six by default) and then a
|
|
151
|
+
half-visible row instead of a scrollbar: the cut row is the cue that more
|
|
152
|
+
options follow, and the wheel, touch and arrow keys scroll as usual. Set
|
|
153
|
+
`items-per-page="0"` to let the list grow to the space the panel allows; it
|
|
154
|
+
still ends on a half row when it overflows. To bring the native scrollbar
|
|
155
|
+
back:
|
|
156
|
+
|
|
157
|
+
```css
|
|
158
|
+
c-autocomplete::part(list) {
|
|
159
|
+
scrollbar-width: auto;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Narrow viewports
|
|
164
|
+
|
|
165
|
+
On a viewport narrower than 760px the panel opens as a **fullscreen panel**
|
|
166
|
+
instead of anchoring under the field: a heading row with the field's `label` and
|
|
167
|
+
a close button, the search input beneath it, then the options filling the rest
|
|
168
|
+
of the screen. The panel keeps covering the screen and the rows above the
|
|
169
|
+
options stay in view while the on-screen keyboard is open; the close button and
|
|
170
|
+
Escape both return focus to the field; the page behind the panel is inert until
|
|
171
|
+
it closes, and the list has no half-row cut — the screen edge is the cue. The
|
|
172
|
+
threshold is the viewport's width, never the field's, so a narrow field on a
|
|
173
|
+
desktop keeps its anchored panel. The close button's label is the `closePanel`
|
|
174
|
+
text, and the row's parts are `heading-row`, `heading` and `close`:
|
|
175
|
+
|
|
176
|
+
```css
|
|
177
|
+
c-autocomplete::part(heading-row) {
|
|
178
|
+
border-bottom-color: var(--c-primary);
|
|
179
|
+
}
|
|
180
|
+
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
A navigation aid naming where the current page sits in a site's hierarchy: one line of crumbs from the top of the hierarchy down to the current page, the middle ones folding behind a "…" button when the line runs out of room.
|
|
2
|
+
|
|
3
|
+
## Crumbs
|
|
4
|
+
|
|
5
|
+
Each `c-breadcrumb-item` is a crumb, written in order from the top of the
|
|
6
|
+
hierarchy down. A crumb with an `href` is a link; the last crumb is always the
|
|
7
|
+
current page — shown as plain text and announced as the current page, with no
|
|
8
|
+
attribute to set — and a crumb without an `href` names a level that has no page
|
|
9
|
+
of its own. An icon goes in a crumb's `icon` slot; give an icon-only crumb an
|
|
10
|
+
`aria-label`, which names its link:
|
|
11
|
+
|
|
12
|
+
```vue
|
|
13
|
+
<c-breadcrumb>
|
|
14
|
+
<c-breadcrumb-item aria-label="Home" href="/">
|
|
15
|
+
<c-icon slot="icon" :path="mdiHome" />
|
|
16
|
+
</c-breadcrumb-item>
|
|
17
|
+
|
|
18
|
+
<c-breadcrumb-item href="/projects">Projects</c-breadcrumb-item>
|
|
19
|
+
|
|
20
|
+
<c-breadcrumb-item>Project #1</c-breadcrumb-item>
|
|
21
|
+
</c-breadcrumb>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The chevron between crumbs is drawn by the breadcrumb and is not configurable.
|
|
25
|
+
|
|
26
|
+
## Folding
|
|
27
|
+
|
|
28
|
+
The breadcrumb is always one line, as wide as the space it is given. When its
|
|
29
|
+
crumbs do not fit, the middle ones fold behind a "…" button, the crumb nearest
|
|
30
|
+
the first one first; the first crumb and the current crumb never fold. The
|
|
31
|
+
button opens a panel listing the folded crumbs as links: Tab or the up and
|
|
32
|
+
down arrow keys move through them, Home and End jump to the first and the last,
|
|
33
|
+
and Escape or a press outside closes it. The down or up arrow on the button
|
|
34
|
+
opens the panel straight onto its first or last crumb. Once nothing more can
|
|
35
|
+
fold, the current crumb's label shortens with an ellipsis, then the first
|
|
36
|
+
crumb's; a shortened crumb shows its full label as a tooltip.
|
|
37
|
+
|
|
38
|
+
The breadcrumb assigns its crumbs to slots to fold them — never set `slot` on a
|
|
39
|
+
crumb yourself. In a flex row, let the breadcrumb take the remaining space so
|
|
40
|
+
it can unfold again when the row grows:
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
c-breadcrumb::part(root) {
|
|
44
|
+
flex: 1;
|
|
45
|
+
min-width: 0;
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Single-page apps
|
|
50
|
+
|
|
51
|
+
A crumb is a real link, so it opens in a new tab and can be copied. To route
|
|
52
|
+
inside a single-page app, keep the `href` and intercept the crumb's click — it
|
|
53
|
+
also fires for Enter, and for a crumb in the fold panel:
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<c-breadcrumb-item
|
|
57
|
+
href="/projects"
|
|
58
|
+
@click.exact.prevent="router.push('/projects')"
|
|
59
|
+
>
|
|
60
|
+
Projects
|
|
61
|
+
</c-breadcrumb-item>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `.exact` modifier leaves Ctrl-, Cmd- and Shift-clicks to the browser.
|
|
65
|
+
|
|
66
|
+
## Texts
|
|
67
|
+
|
|
68
|
+
The navigation's accessible name and the "…" button's label can be replaced
|
|
69
|
+
for another language through the `texts` object, merged over the English
|
|
70
|
+
defaults. The button's label is a function of the number of folded crumbs, so
|
|
71
|
+
the object must be bound as a DOM property:
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<c-breadcrumb
|
|
75
|
+
:texts="{
|
|
76
|
+
breadcrumb: 'Murupolku',
|
|
77
|
+
fold: (count) => `Näytä ${count} lisää`,
|
|
78
|
+
}"
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
To translate every breadcrumb at once, set `texts` app-wide with
|
|
83
|
+
`applyDefaults({ 'c-breadcrumb': { texts } })` (Customization → App-wide prop
|
|
84
|
+
defaults); a per-instance `texts` still wins key by key.
|
|
85
|
+
|
|
86
|
+
## Customization
|
|
87
|
+
|
|
88
|
+
Crumbs expose the `current` and `folded` custom states, so a crumb can be
|
|
89
|
+
restyled per state:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
c-breadcrumb-item:state(current)::part(content) {
|
|
93
|
+
font-weight: 400;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The fold panel hides its scrollbar and ends on a half-visible crumb when it
|
|
98
|
+
overflows. To bring the native scrollbar back:
|
|
99
|
+
|
|
100
|
+
```css
|
|
101
|
+
c-breadcrumb::part(panel-list) {
|
|
102
|
+
scrollbar-width: auto;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
One crumb in a `c-breadcrumb`: a link to a level of the hierarchy, or, as the last crumb, the current page.
|
|
@@ -26,7 +26,7 @@ toggles it off (value `null`) unless `mandatory` is set.
|
|
|
26
26
|
|
|
27
27
|
With `multiple` the value is an array of the active buttons' values in DOM
|
|
28
28
|
order. Arrays have no attribute form — bind `value` as a DOM property
|
|
29
|
-
(`:value
|
|
29
|
+
(`:value="…"` in Vue; the React wrapper and property assignment do this
|
|
30
30
|
naturally).
|
|
31
31
|
|
|
32
32
|
In both modes every active button paints its own fill. The sliding
|
|
@@ -49,6 +49,19 @@ A group can be `mandatory` without being `required` (a view switcher that
|
|
|
49
49
|
always has a selection) or `required` without being `mandatory` (the user
|
|
50
50
|
must answer, but may retract while deciding).
|
|
51
51
|
|
|
52
|
+
## Placement
|
|
53
|
+
|
|
54
|
+
The track keeps an opaque fill under its labels and a hairline frame that
|
|
55
|
+
reads on any surface, so the group can sit on a card, a muted panel, or
|
|
56
|
+
directly on the page canvas with no extra styling.
|
|
57
|
+
|
|
58
|
+
The buttons are equal columns as wide as the longest label. Given room, the
|
|
59
|
+
group is one row — its natural width in a flex row, the full width of a
|
|
60
|
+
block container. Narrower than one row of its buttons, the group wraps them
|
|
61
|
+
onto further rows inside the same frame rather than letting them overflow.
|
|
62
|
+
Keep the labels short (see above): a group that wraps on a phone is fine, a
|
|
63
|
+
group that wraps on a laptop wants `c-select`.
|
|
64
|
+
|
|
52
65
|
## Accessibility
|
|
53
66
|
|
|
54
67
|
Setting `label` names the group for assistive technology (`role="group"` +
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
A form control for a single on/off choice: a native checkbox with a label,
|
|
2
|
+
an optional hint, and validation messaging.
|
|
3
|
+
|
|
4
|
+
Bind the state with a plain `v-model` (or the `checked` prop); `true-value` /
|
|
5
|
+
`false-value` map the checked state onto custom values. Set `indeterminate`
|
|
6
|
+
for the mixed "some but not all" state of a parent checkbox.
|
|
7
|
+
|
|
8
|
+
```html
|
|
9
|
+
<c-checkbox v-model="accepted" label="I accept the terms" />
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Set `hint` for a persistent helper line below the control; while `valid` is
|
|
13
|
+
`false`, `error-message` replaces it. `hide-details` removes the message area
|
|
14
|
+
entirely.
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
- A single independent yes/no choice (consent, feature toggle in a form).
|
|
19
|
+
- A list where several options can be selected at once.
|
|
20
|
+
|
|
21
|
+
## When not to use
|
|
22
|
+
|
|
23
|
+
- Choosing exactly one of several options — use `c-radio-group`.
|
|
24
|
+
- Switching a setting that takes effect immediately — use `c-switch`.
|
|
25
|
+
|
|
26
|
+
## Customization
|
|
27
|
+
|
|
28
|
+
Restyle via CSS parts from your own stylesheet. The `indicator` part is the
|
|
29
|
+
checkbox box and `mark` is the check glyph inside it. The indicator's border,
|
|
30
|
+
its checked fill and its keyboard focus ring all draw with `currentColor`, so
|
|
31
|
+
one `color` recolours the three together; the host exposes the `checked` and
|
|
32
|
+
`indeterminate` custom states, so the box is also stylable per state:
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
/* Border, checked fill and focus ring follow `color`. */
|
|
36
|
+
c-checkbox::part(indicator) {
|
|
37
|
+
color: var(--my-green);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* The mark draws with currentColor too — recolour it via `color`. */
|
|
41
|
+
c-checkbox:state(checked)::part(mark) {
|
|
42
|
+
color: black;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Finer control still works per property and per state (the focus ring
|
|
46
|
+
keeps following `color`, not these). */
|
|
47
|
+
c-checkbox:not(:state(checked))::part(indicator) {
|
|
48
|
+
border-color: gray;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For app-wide recolouring prefer the design tokens (`--c-primary` seed) over
|
|
53
|
+
per-component rules.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
A date field that takes a typed date, or opens a calendar panel for picking one, or a start and end date under `range`.
|
|
2
|
+
|
|
3
|
+
## Value
|
|
4
|
+
|
|
5
|
+
The value is a calendar date as an ISO `YYYY-MM-DD` string — `'2026-09-28'` —
|
|
6
|
+
or `null` when the field is empty. It carries no time and no timezone, so it
|
|
7
|
+
round-trips through attributes, JSON and forms unchanged, and whatever the
|
|
8
|
+
displayed `format`, the value keeps this one shape. Bind it with `v-model`, or
|
|
9
|
+
listen for `change`:
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<c-date-picker v-model="date" label="Start date" />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Under `range` the value becomes `{ start, end }`. Picking in the calendar
|
|
16
|
+
always yields a complete range; typing can commit one end before the other, so
|
|
17
|
+
either end may be `null` — `{ start: '2026-09-01', end: null }` — and a range
|
|
18
|
+
with neither end is `null`.
|
|
19
|
+
|
|
20
|
+
## Typing
|
|
21
|
+
|
|
22
|
+
The field is typeable first: clicking into it or focusing it never opens the
|
|
23
|
+
calendar. Text is read when the user presses Enter or leaves the input, never
|
|
24
|
+
per keystroke. The `format` prop sets how dates are shown and read — a pattern
|
|
25
|
+
of the tokens `d`, `dd`, `M`, `MM` and `yyyy` with any separators, `dd.MM.yyyy`
|
|
26
|
+
by default. Reading is lenient: a day or a month may have one or two digits
|
|
27
|
+
whatever the token, and any of `.`, `/`, `-` or a space separates the parts,
|
|
28
|
+
so `1.9.2026` and `1/9/2026` both commit as `01.09.2026` under the default. The
|
|
29
|
+
year needs all four digits. The format is an app default, so an app can set it
|
|
30
|
+
once with `applyDefaults({ 'c-date-picker': { format: 'yyyy-MM-dd' } })`.
|
|
31
|
+
|
|
32
|
+
Typing follows the format as it goes: the separators appear on their own
|
|
33
|
+
(`01012031` shows `01.01.2031`), a day or month closes early when a separator
|
|
34
|
+
is typed or when its first digit can start no two-digit value (`4` for a day,
|
|
35
|
+
`2` for a month), any of `.`, `/`, `-` or a space typed in place of a
|
|
36
|
+
separator shows as the format's own, and other characters are dropped. Pasted
|
|
37
|
+
text is kept as it is and read when committed.
|
|
38
|
+
|
|
39
|
+
Text that names no date that can be picked — `31.02.2026`, a disabled date, a
|
|
40
|
+
date outside `min` and `max` — is **bad input**: the text stays as the user
|
|
41
|
+
typed it, the value becomes `null`, and the host exposes the `bad-input` custom
|
|
42
|
+
state and a read-only `badInput` property. The component never shows an error
|
|
43
|
+
of its own; deciding whether bad input is an error, and saying so, is the
|
|
44
|
+
consumer's validation:
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<c-date-picker
|
|
48
|
+
v-model="date"
|
|
49
|
+
:error-message="error"
|
|
50
|
+
:valid="!error"
|
|
51
|
+
label="Start date"
|
|
52
|
+
@change:text="
|
|
53
|
+
error = $event.target.badInput ? 'Enter a date as dd.mm.yyyy' : ''
|
|
54
|
+
"
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Every commit of typed text fires `change:text` with the text as typed
|
|
59
|
+
(`{ start, end }` under `range`), whether or not it changed the value — the
|
|
60
|
+
moment to read `badInput`, as above.
|
|
61
|
+
|
|
62
|
+
## The calendar
|
|
63
|
+
|
|
64
|
+
The calendar button at the field's trailing edge, or Alt+ArrowDown in the
|
|
65
|
+
input, opens the calendar panel. It is a dialog: focus moves onto the selected
|
|
66
|
+
day, else today, else the nearest day that can be picked, and Tab cycles
|
|
67
|
+
through the month and year controls, the grid and the Today button
|
|
68
|
+
(`show-today`) until the panel closes.
|
|
69
|
+
Picking a day commits it and closes the panel; Escape closes it without a
|
|
70
|
+
change. Focus returns to the input either way. On a narrow viewport a pick
|
|
71
|
+
waits for a Done button instead (see [Narrow viewports](#narrow-viewports)).
|
|
72
|
+
|
|
73
|
+
| Key | In the day grid |
|
|
74
|
+
| ----------------------- | ------------------------------------- |
|
|
75
|
+
| ArrowLeft / ArrowRight | Previous / next day |
|
|
76
|
+
| ArrowUp / ArrowDown | Same day of the previous / next week |
|
|
77
|
+
| Home / End | First / last day of the week |
|
|
78
|
+
| PageUp / PageDown | Same day of the previous / next month |
|
|
79
|
+
| Shift+PageUp / PageDown | Same day of the previous / next year |
|
|
80
|
+
| Enter / Space | Pick the day |
|
|
81
|
+
|
|
82
|
+
The month and year buttons in the header swap the grid for a list of months
|
|
83
|
+
or years; picking one returns to the grid. The year list reaches a hundred
|
|
84
|
+
years either side of today unless `min` and `max` narrow it. The displayed
|
|
85
|
+
month is announced to the consumer as `change:month` (`'YYYY-MM'`) whenever it
|
|
86
|
+
changes and when the panel opens.
|
|
87
|
+
|
|
88
|
+
The week starts on Monday; set `first-day-of-week` to another day, numbered
|
|
89
|
+
like `Date.getDay()` (`0` for Sunday). `show-week-numbers` adds ISO 8601 week
|
|
90
|
+
numbers beside the rows. With a week start other than Monday a row spans two
|
|
91
|
+
ISO weeks and shows the one holding most of its days, so a week split across
|
|
92
|
+
two months carries the same number in both.
|
|
93
|
+
|
|
94
|
+
## Ranges
|
|
95
|
+
|
|
96
|
+
With `range` the field holds two inputs, the start and the end, in one field
|
|
97
|
+
box. In the calendar the first day picked is only pending — it is shown and
|
|
98
|
+
announced, the band follows the pointer or the focused day, and nothing is
|
|
99
|
+
emitted — until the second pick completes the range and closes the panel.
|
|
100
|
+
Dismissing the panel in between discards the pending day. Picking the end
|
|
101
|
+
before the start swaps them, and so does typing a start later than the end.
|
|
102
|
+
|
|
103
|
+
## Disabling dates
|
|
104
|
+
|
|
105
|
+
Three rules decide which dates cannot be picked; a date any of them rules out
|
|
106
|
+
is disabled:
|
|
107
|
+
|
|
108
|
+
- `min` and `max` — ISO dates bounding the calendar itself: the arrows and the
|
|
109
|
+
keyboard stop there.
|
|
110
|
+
- `disabled-dates` — a list of ISO dates and inclusive `{ start, end }` spans.
|
|
111
|
+
- `is-date-disabled` — a predicate receiving an ISO date, for rules such as
|
|
112
|
+
"no weekends".
|
|
113
|
+
|
|
114
|
+
The list and the predicate have no attribute form, so bind them as DOM
|
|
115
|
+
properties. A disabled day can still be focused in the grid — the arrows keep
|
|
116
|
+
their meaning — and is announced as unavailable, but it cannot be picked. A
|
|
117
|
+
range may span disabled days: only its start and end must be enabled.
|
|
118
|
+
|
|
119
|
+
Availability that comes from a server can follow the calendar: load the
|
|
120
|
+
disabled dates of the month `change:month` names and assign `disabled-dates`
|
|
121
|
+
again.
|
|
122
|
+
|
|
123
|
+
## Months
|
|
124
|
+
|
|
125
|
+
With `type="month"` the field picks a year and a month instead of a day. The
|
|
126
|
+
value is an ISO `YYYY-MM` string — `'2026-03'` — or `{ start, end }` of them
|
|
127
|
+
under `range`, like the native `<input type="month">`:
|
|
128
|
+
|
|
129
|
+
```vue
|
|
130
|
+
<c-date-picker v-model="billing" label="Billing month" type="month" />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The format is the `format` with its day left out, so one app default serves
|
|
134
|
+
both kinds of field: `dd.MM.yyyy` shows months as `MM.yyyy`, `yyyy-MM-dd` as
|
|
135
|
+
`yyyy-MM`. A `format` with no day, such as `MM/yyyy`, is used as given.
|
|
136
|
+
Typing is as lenient as for dates: `3.2026` and `032026` both commit as
|
|
137
|
+
`03.2026`. A full date bound as the value is shown as its month and emits
|
|
138
|
+
nothing; the next pick or commit emits the month.
|
|
139
|
+
|
|
140
|
+
The panel asks for the month first, then the year. It opens on the twelve
|
|
141
|
+
months under a "Month" label, with the selected month marked and focused.
|
|
142
|
+
Picking one collapses it to a summary row and the years unroll beneath it,
|
|
143
|
+
focused on the selected year — else this year, else the nearest year that can
|
|
144
|
+
be picked. Picking a year commits the month and closes the panel; pressing the
|
|
145
|
+
summary row goes back to the months. Both lists take the arrows, Home and End,
|
|
146
|
+
and Enter or Space to pick.
|
|
147
|
+
|
|
148
|
+
Under `range` the steps run twice, labelled "Start month", "Start year", "End
|
|
149
|
+
month" and "End year". The finished start shows as a summary row and is only
|
|
150
|
+
pending, as in the day grid: nothing is emitted until the end's year completes
|
|
151
|
+
the range, a range picked backwards is swapped, and dismissing the panel
|
|
152
|
+
discards the start.
|
|
153
|
+
|
|
154
|
+
`min` and `max` may be months or full dates; a full date counts by its month,
|
|
155
|
+
so `min="2026-03-15"` still allows March. A month is disabled only when every
|
|
156
|
+
one of its days is — by `min` and `max`, `disabled-dates` or
|
|
157
|
+
`is-date-disabled` — so a "no weekends" predicate disables no month, and a
|
|
158
|
+
span covering all of July disables July. In the month list a month is disabled
|
|
159
|
+
when no allowed year takes it; in the year list a year is disabled when the
|
|
160
|
+
picked month is disabled in it, so no pick leads to an empty list. The
|
|
161
|
+
predicate is asked about each day until one is enabled, so in most months it
|
|
162
|
+
runs once; one that disables nearly every day is asked many times when the
|
|
163
|
+
months open.
|
|
164
|
+
|
|
165
|
+
`change:month` names the displayed month of the day grid, so it is never
|
|
166
|
+
fired in month mode.
|
|
167
|
+
|
|
168
|
+
## Today
|
|
169
|
+
|
|
170
|
+
`show-today` adds a Today button under the calendar. Pressing it does what
|
|
171
|
+
pressing today in the grid would: it commits today and closes the panel.
|
|
172
|
+
Under `range` the first press makes today the pending start and moves focus
|
|
173
|
+
onto it in the grid; a press while a start is pending completes the range.
|
|
174
|
+
Under `type="month"` the button reads "This month" and picks the current
|
|
175
|
+
month, its month and year at once.
|
|
176
|
+
|
|
177
|
+
```vue
|
|
178
|
+
<c-date-picker v-model="due" label="Due date" show-today />
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The button is disabled, never hidden, while today cannot be picked: outside
|
|
182
|
+
`min` and `max`, in `disabled-dates`, or ruled out by `is-date-disabled`. It
|
|
183
|
+
goes by the rules assigned at that moment, as typed text does, so when
|
|
184
|
+
`disabled-dates` is loaded per displayed month, keep today's dates in the
|
|
185
|
+
list or express the rule as `is-date-disabled`. Leave the button off where
|
|
186
|
+
today is never the answer, such as a birthdate, or turn it on app-wide with
|
|
187
|
+
`applyDefaults({ 'c-date-picker': { showToday: true } })`.
|
|
188
|
+
|
|
189
|
+
## Texts
|
|
190
|
+
|
|
191
|
+
Month and weekday names and each day's accessible name come from `texts` when
|
|
192
|
+
given, then from the browser's `Intl` data for the page's `lang`, then from
|
|
193
|
+
the English built-ins — so a page with `<html lang="fi">` gets Finnish names
|
|
194
|
+
without any configuration. The labels of the buttons and the range inputs are
|
|
195
|
+
English unless `texts` replaces them. Weekday arrays are indexed like
|
|
196
|
+
`Date.getDay()`, Sunday first. Set them app-wide with
|
|
197
|
+
`applyDefaults({ 'c-date-picker': { texts } })`.
|
|
198
|
+
|
|
199
|
+
## Narrow viewports
|
|
200
|
+
|
|
201
|
+
On a viewport narrower than 760px the calendar opens as a **fullscreen
|
|
202
|
+
panel**: a heading row with the field's `label` and a close button above the
|
|
203
|
+
calendar, and a Done button below it. There a pick only selects: the day, the
|
|
204
|
+
range or the month waits in the panel, and nothing is emitted until Done
|
|
205
|
+
commits it and closes the panel. The close button and Escape close the panel
|
|
206
|
+
without a change, discarding what was picked, and so does the window growing
|
|
207
|
+
past 760px while it is open.
|
|
208
|
+
|
|
209
|
+
The Today button selects today the same way. Enter on a day picks it and
|
|
210
|
+
presses Done at once. Under `range` Done stays disabled until the second pick
|
|
211
|
+
completes the range, and under `type="month"` the panel stays on the year
|
|
212
|
+
step, the year checked, until Done. Pressing Done before picking anything
|
|
213
|
+
closes the panel and changes nothing. The field stays typeable at every
|
|
214
|
+
width.
|
|
215
|
+
|
|
216
|
+
## Native date input
|
|
217
|
+
|
|
218
|
+
`c-text-field type="date"` remains the browser's own date input — no custom
|
|
219
|
+
calendar, the browser's format, and no ranges or disabled dates. Reach for
|
|
220
|
+
`c-date-picker` when the format, the calendar's look or those features matter.
|
|
221
|
+
`c-text-field` has no month type: for a year and a month, use
|
|
222
|
+
`type="month"` here.
|
|
223
|
+
|
|
224
|
+
`c-time-picker` is the same typeable field for times of day.
|
|
@@ -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) {
|
|
13
|
+
scrollbar-width: auto;
|
|
14
|
+
}
|
|
15
|
+
```
|