@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,60 @@
|
|
|
1
|
+
A stack of collapsible sections, each a `c-accordion-item` whose header button shows or hides the content beneath it.
|
|
2
|
+
|
|
3
|
+
Give every item a `heading` and a `value`, and put its content in the item's default slot. The accordion's `value` names the expanded item.
|
|
4
|
+
|
|
5
|
+
```vue
|
|
6
|
+
<c-accordion v-model="expanded">
|
|
7
|
+
<c-accordion-item heading="Project billing" value="billing">
|
|
8
|
+
<p>Billing units are deducted monthly based on the resources in use.</p>
|
|
9
|
+
</c-accordion-item>
|
|
10
|
+
|
|
11
|
+
<c-accordion-item heading="Members and roles" value="members">
|
|
12
|
+
<p>Invite members by email and assign them a role in the project.</p>
|
|
13
|
+
</c-accordion-item>
|
|
14
|
+
</c-accordion>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
- To shorten a page of related sections the user reads one or a few at a time: questions and answers, groups of settings, the details behind a summary.
|
|
20
|
+
- For switching between views of the same subject, use `c-tabs`, which shows one panel at a time.
|
|
21
|
+
- Not for content the user must not miss or needs to compare side by side: collapsed content is easy to overlook.
|
|
22
|
+
|
|
23
|
+
## Value
|
|
24
|
+
|
|
25
|
+
`value` is the expanded item's `value`, or `null` when every item is collapsed. Bind it with `v-model`, or set it and listen for `change`, which carries the new value each time the user toggles an item. Setting `value` from code expands and collapses items without firing an event.
|
|
26
|
+
|
|
27
|
+
Values compare strictly: an item `value` written as an attribute is a string, so `value="2"` does not match the number `2`. An item without a `value` never expands.
|
|
28
|
+
|
|
29
|
+
Items must be direct children of the accordion; an item wrapped in another element is not expanded by it.
|
|
30
|
+
|
|
31
|
+
## One or several expanded
|
|
32
|
+
|
|
33
|
+
By default one item is expanded at a time: expanding an item collapses the one that was open. With `multiple`, items open and close independently and `value` is an array of the expanded items' values. A single value counts as a one-item array, so the `value` attribute can name one item to start open; to open several from plain HTML, set the `value` property to an array.
|
|
34
|
+
|
|
35
|
+
`mandatory` keeps the last expanded item open: its header stops responding and reports itself disabled until another item is expanded. It never expands an item by itself, so give a `mandatory` accordion an initial `value`.
|
|
36
|
+
|
|
37
|
+
## Headings and icons
|
|
38
|
+
|
|
39
|
+
`heading` sets the header's text. For richer content, such as a count beside the heading, use the item's `heading` slot, which replaces the prop. The `icon` slot shows an icon before the heading. Both slots render inside the header button, so they must not hold links, buttons or other interactive content.
|
|
40
|
+
|
|
41
|
+
## Keyboard
|
|
42
|
+
|
|
43
|
+
Each header is a native button: Tab moves through the headers and the content of the expanded items, and Enter or Space toggles the focused header. A collapsed item's content is inert, so focus never lands in a hidden section.
|
|
44
|
+
|
|
45
|
+
## Accessibility
|
|
46
|
+
|
|
47
|
+
The header button carries `aria-expanded` and `aria-controls`, and the content is a region labelled by its header. Headers are buttons, not heading elements, so items do not appear in the page's heading outline.
|
|
48
|
+
|
|
49
|
+
## Customization
|
|
50
|
+
|
|
51
|
+
Collapsed items stack flush into one accordion frame with a shared hairline border and rounded ends. An expanded item lifts out of the frame with its own primary outline, a faint primary wash, an accent bar on its leading edge and space above and below. `outlined` adds a primary ring inside the expanded items' outline.
|
|
52
|
+
|
|
53
|
+
`c-accordion::part(root)` is the column holding the items. Each item has `::part(root)` (its share of the frame, and the lifted box while expanded), `::part(header)` (the toggle row), `::part(indicator)` (the chevron) and `::part(content)` (the card around the slotted content). The `expanded` custom state selects an expanded item:
|
|
54
|
+
|
|
55
|
+
```css
|
|
56
|
+
c-accordion-item:state(expanded)::part(header),
|
|
57
|
+
c-accordion-item:state(expanded)::part(indicator) {
|
|
58
|
+
color: var(--c-secondary);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
One collapsible section of a `c-accordion`: a header button showing its `heading` (or the `heading` slot) and an optional icon, above the content in the default slot. Place it directly inside the accordion and give it a `value`: the accordion expands items by value and leaves an item without one collapsed.
|
|
@@ -5,15 +5,15 @@ Give the alert a `heading` with the prop for plain text; the `heading` slot over
|
|
|
5
5
|
## When to use
|
|
6
6
|
|
|
7
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
|
|
8
|
+
- Not for transient feedback on an action — use `c-toasts`, which overlays and closes itself; the alert stays in the layout until the consumer removes it.
|
|
9
9
|
|
|
10
10
|
## Types
|
|
11
11
|
|
|
12
|
-
The four status types (`error`, `info`, `success`, `warning`) carry their status family's colours and icon; `
|
|
12
|
+
The four status types (`error`, `info`, `success`, `warning`) carry their status family's colours and icon; omitting `type` renders the neutral, brand-primary look, without an icon. Severity is signalled by the icon, the heading's ink and the accent edge, never by colouring the body text.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Closing
|
|
15
15
|
|
|
16
|
-
`
|
|
16
|
+
`closeable` renders a close button, but pressing it only fires the `close` event — removing the alert from the page stays the consumer's job.
|
|
17
17
|
|
|
18
18
|
## Accessibility
|
|
19
19
|
|
|
@@ -21,4 +21,4 @@ The alert manages its own live-region role: `warning` and `error` interrupt (`ro
|
|
|
21
21
|
|
|
22
22
|
## Customization
|
|
23
23
|
|
|
24
|
-
Structural styling via `::part(root)`, `::part(icon)`, `::part(content)`, `::part(heading)` and `::part(
|
|
24
|
+
Structural styling via `::part(root)`, `::part(icon)`, `::part(content)`, `::part(heading)` and `::part(close)`. Colours come from the status-family semantic tokens; override the tokens to re-theme.
|
|
@@ -1,5 +1,65 @@
|
|
|
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
|
+
`<c-option selected>` sets the initial value of plain HTML: once, only while
|
|
21
|
+
the value is empty, and silently — no value event, so a bound `v-model` does
|
|
22
|
+
not learn it. With a bound value, initialise the model instead.
|
|
23
|
+
|
|
24
|
+
The row shows a copy of the option's markup, re-created from its HTML inside
|
|
25
|
+
the panel. A component nested in an option — a `c-icon`, say — is therefore
|
|
26
|
+
configured through attributes, or props with an attribute form (strings,
|
|
27
|
+
numbers, booleans); object props and event listeners on option content do not
|
|
28
|
+
carry over. Page CSS does not reach the copy either: give the content a `part`
|
|
29
|
+
and style it through the field:
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<c-option value="ts">
|
|
33
|
+
<div part="language">
|
|
34
|
+
<c-option-value>TypeScript</c-option-value>
|
|
35
|
+
<c-icon path="…"></c-icon>
|
|
36
|
+
</div>
|
|
37
|
+
</c-option>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```css
|
|
41
|
+
c-autocomplete::part(language) {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: 0.5rem;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
While a query is typed, the runs of each option's label that equal it are
|
|
49
|
+
marked: inside the `c-option-value` of a slotted option, or in the plain
|
|
50
|
+
label of an `items` entry. A slotted option without the wrapper is rendered
|
|
51
|
+
exactly as authored and never marked. Every occurrence of the literal query
|
|
52
|
+
is marked, whatever the filter did — a fuzzy `filter`, or a `name` that
|
|
53
|
+
differs from the wrapper's text, can leave a row unmarked — and the wrapper's
|
|
54
|
+
content is treated as plain text while a query is active. The marks are the
|
|
55
|
+
`match` part:
|
|
56
|
+
|
|
57
|
+
```css
|
|
58
|
+
c-autocomplete::part(match) {
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
3
63
|
## Filtering
|
|
4
64
|
|
|
5
65
|
By default the component filters its options itself: the query typed into the
|
|
@@ -26,3 +86,99 @@ label even when a later fetch no longer includes it: the label is remembered
|
|
|
26
86
|
when the option is committed, and a programmatically set value resolves its
|
|
27
87
|
label from the current options, or from the object's `name` when
|
|
28
88
|
`return-object` is used.
|
|
89
|
+
|
|
90
|
+
## Multiple selection
|
|
91
|
+
|
|
92
|
+
Set `multiple` to let the user pick several options. The value is then an
|
|
93
|
+
array of the picked options' values in the order they were picked (an array
|
|
94
|
+
of `{ name, value }` items with `return-object`), and `[]` when nothing is
|
|
95
|
+
picked. Arrays have no attribute form — bind `value` as a DOM property
|
|
96
|
+
(`v-model` or `:value="…"` in Vue; the React wrapper and property
|
|
97
|
+
assignment do this naturally). Picking an option toggles it and keeps the
|
|
98
|
+
panel open; the search input keeps its query after a pick, so several
|
|
99
|
+
matches can be picked in a row. `clearable` clears the whole selection.
|
|
100
|
+
|
|
101
|
+
Each picked option shows as a tag inside the field, and the field grows as
|
|
102
|
+
the tags wrap. A tag's close button removes that option; Backspace in the
|
|
103
|
+
closed field removes the last one. Set `max-tags` to show only that many
|
|
104
|
+
tags and fold the rest into a single "+N more" tag, or `max-tags="0"` to
|
|
105
|
+
show no tags at all — the field then reads "N selected". Assistive
|
|
106
|
+
technology always hears the full selection as the field's value. With
|
|
107
|
+
`external`, a pick's label is remembered when it is made, so a later fetch
|
|
108
|
+
that no longer lists it keeps its tag readable.
|
|
109
|
+
|
|
110
|
+
Set `select-all` to pin a select-all row at the top of the list. It acts on
|
|
111
|
+
the options currently listed — the matches while a query is typed, or the
|
|
112
|
+
`items` you supply with `external`: activating it selects every enabled one
|
|
113
|
+
of them, or unselects them all when they already are, and options outside
|
|
114
|
+
the list keep their state. Disabled options are left alone, and the row only
|
|
115
|
+
appears while there is something to select. Its label is `texts.selectAll`,
|
|
116
|
+
a function receiving the number of listed options.
|
|
117
|
+
|
|
118
|
+
The row checkboxes recolour like c-checkbox's (`::part(indicator)`,
|
|
119
|
+
`::part(mark)`), the select-all row is the `select-all` part, and the tags are
|
|
120
|
+
stylable through the `tags`, `tag` and `tag-root` parts:
|
|
121
|
+
|
|
122
|
+
```css
|
|
123
|
+
c-autocomplete::part(tag-root) {
|
|
124
|
+
background: var(--c-primary-subtle);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Texts
|
|
129
|
+
|
|
130
|
+
Every built-in string — the clear and toggle button labels, the search
|
|
131
|
+
input's placeholder and accessible label, the loading and no-results rows,
|
|
132
|
+
the select-all row's label, a tag's remove label, the overflow and count
|
|
133
|
+
texts — can be replaced for another language through the `texts` object,
|
|
134
|
+
merged over the English defaults. Count and label texts are functions, so the object must be bound
|
|
135
|
+
as a DOM property; the `placeholder` prop still wins over
|
|
136
|
+
`texts.searchPlaceholder` when both are set:
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<c-autocomplete
|
|
140
|
+
:texts="{
|
|
141
|
+
noResults: 'Ei osumia',
|
|
142
|
+
remove: (label) => `Poista ${label}`,
|
|
143
|
+
}"
|
|
144
|
+
multiple
|
|
145
|
+
/>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
To translate every autocomplete at once, set `texts` app-wide with
|
|
149
|
+
`applyDefaults({ 'c-autocomplete': { texts } })` (Customization → App-wide
|
|
150
|
+
prop defaults); a per-instance `texts` still wins key by key.
|
|
151
|
+
|
|
152
|
+
## Scrolling
|
|
153
|
+
|
|
154
|
+
The panel shows `items-per-page` full rows (six by default) and then a
|
|
155
|
+
half-visible row instead of a scrollbar: the cut row is the cue that more
|
|
156
|
+
options follow, and the wheel, touch and arrow keys scroll as usual. Set
|
|
157
|
+
`items-per-page="0"` to let the list grow to the space the panel allows; it
|
|
158
|
+
still ends on a half row when it overflows. To bring the native scrollbar
|
|
159
|
+
back:
|
|
160
|
+
|
|
161
|
+
```css
|
|
162
|
+
c-autocomplete::part(list) {
|
|
163
|
+
scrollbar-width: auto;
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Narrow viewports
|
|
168
|
+
|
|
169
|
+
On a viewport narrower than 760px the panel opens as a **fullscreen panel**
|
|
170
|
+
instead of anchoring under the field: a heading row with the field's `label` and
|
|
171
|
+
a close button, the search input beneath it, then the options filling the rest
|
|
172
|
+
of the screen. The panel keeps covering the screen and the rows above the
|
|
173
|
+
options stay in view while the on-screen keyboard is open; the close button and
|
|
174
|
+
Escape both return focus to the field; the page behind the panel is inert until
|
|
175
|
+
it closes, and the list has no half-row cut — the screen edge is the cue. The
|
|
176
|
+
threshold is the viewport's width, never the field's, so a narrow field on a
|
|
177
|
+
desktop keeps its anchored panel. The close button's label is the `closePanel`
|
|
178
|
+
text, and the row's parts are `heading-row`, `heading` and `close`:
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
c-autocomplete::part(heading-row) {
|
|
182
|
+
border-bottom-color: var(--c-primary);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
A small pill that pins a short count or label to the top-right corner of the
|
|
2
|
+
element it sits in, such as the number of unread messages on a button.
|
|
3
|
+
|
|
4
|
+
Put the `c-badge` inside the element it annotates, with the count in the
|
|
5
|
+
default slot. The badge is absolutely positioned, so that element must be a
|
|
6
|
+
positioning context: inside `c-button` and `c-icon-button` it already is;
|
|
7
|
+
anywhere else, give the container `position: relative`.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<c-button>
|
|
11
|
+
Messages
|
|
12
|
+
<c-badge>2</c-badge>
|
|
13
|
+
</c-button>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
- A count or short marker on another element: unread messages, pending
|
|
19
|
+
approvals, new items.
|
|
20
|
+
- On a `c-icon-button`, set its `badge` prop instead of slotting a badge; a
|
|
21
|
+
`c-tag` likewise takes its count in its own `badge` prop.
|
|
22
|
+
- For a word naming the state of a record (Active, Expired), use
|
|
23
|
+
`c-status`.
|
|
24
|
+
|
|
25
|
+
## Appearance
|
|
26
|
+
|
|
27
|
+
The badge fills with the warning role and its `on-warning` ink, and a 2px
|
|
28
|
+
ring in the `surface` colour sets it off from whatever it overlaps. It is
|
|
29
|
+
16px tall and grows with its text, so keep the content to a few characters.
|
|
30
|
+
It ignores the pointer: clicks pass through to the element beneath.
|
|
31
|
+
|
|
32
|
+
## Accessibility
|
|
33
|
+
|
|
34
|
+
The badge has no role: its text is read as part of whatever contains it.
|
|
35
|
+
Inside a button it joins the button's accessible name ("Messages 2"), so
|
|
36
|
+
check that the combination makes sense, or set an `aria-label` on the button
|
|
37
|
+
that states the count in words ("Messages, 2 unread"). A changed count is
|
|
38
|
+
not announced.
|
|
39
|
+
|
|
40
|
+
## Customization
|
|
41
|
+
|
|
42
|
+
`::part(root)` is the pill. Recolour it with semantic tokens so it follows
|
|
43
|
+
the theme mode:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
c-badge.done::part(root) {
|
|
47
|
+
background-color: var(--c-success);
|
|
48
|
+
color: var(--c-on-success);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
@@ -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.
|
|
@@ -13,6 +13,19 @@ actions use the `outlined`, `ghost` or `text` appearances.
|
|
|
13
13
|
- Inline navigation within text — use `c-link`.
|
|
14
14
|
- Toggling a persistent on/off state — use `c-switch`.
|
|
15
15
|
|
|
16
|
+
## In a form
|
|
17
|
+
|
|
18
|
+
`type="submit"` submits the `<form>` around the button (validating it first,
|
|
19
|
+
as `form.requestSubmit()` does) and `type="reset"` resets it; the default
|
|
20
|
+
`button` does nothing to the form. A disabled or loading button, or one with
|
|
21
|
+
an `href`, never submits.
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<form @submit.prevent="save">
|
|
25
|
+
<c-button type="submit">Save</c-button>
|
|
26
|
+
</form>
|
|
27
|
+
```
|
|
28
|
+
|
|
16
29
|
## Accessibility
|
|
17
30
|
|
|
18
31
|
The `root` part is a native `<button>` (or `<a>` when `href` is set), so
|
|
@@ -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,9 +49,23 @@ 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"` +
|
|
55
|
-
`aria-labelledby`) as well as visually
|
|
68
|
+
`aria-labelledby`) as well as visually; without one, `aria-label` or
|
|
69
|
+
`aria-labelledby` on the element names the group. Each button carries `aria-pressed`
|
|
56
70
|
for its active state. Buttons are reachable with the arrow keys once the
|
|
57
71
|
group has focus.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
A raised, bordered surface that groups one piece of content — its heading, body and actions — into a single box on the page.
|
|
2
|
+
|
|
3
|
+
Build the card from its sections, in this order: `c-card-title` for the heading, `c-card-content` for the body and `c-card-actions` for the row of actions. Each section is optional; the card spaces them evenly and pads them in from its edges.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<c-card>
|
|
7
|
+
<c-card-title>Project members</c-card-title>
|
|
8
|
+
|
|
9
|
+
<c-card-content>
|
|
10
|
+
<p>Manage who has access to this project and what they can do.</p>
|
|
11
|
+
</c-card-content>
|
|
12
|
+
|
|
13
|
+
<c-card-actions justify="end">
|
|
14
|
+
<c-button text>Cancel</c-button>
|
|
15
|
+
<c-button>Save</c-button>
|
|
16
|
+
</c-card-actions>
|
|
17
|
+
</c-card>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## When to use
|
|
21
|
+
|
|
22
|
+
- To group a self-contained part of a page: a summary, a settings form, a list with its actions.
|
|
23
|
+
- As the content of a `c-modal`, where the card's heading, body and actions become the dialog's.
|
|
24
|
+
- For a sign-in page, use `c-login-card`, with its larger heading and background image.
|
|
25
|
+
- For a status message, use `c-alert`, which carries the status colours and announces itself.
|
|
26
|
+
|
|
27
|
+
## Sections
|
|
28
|
+
|
|
29
|
+
- `c-card-title` sets the heading in small uppercase type above a short primary accent bar. Controls in its `actions` slot sit at the right of the heading, and move onto their own line under it, starting at the left, once the two no longer fit side by side.
|
|
30
|
+
- `c-card-content` stacks its children in a column, spaced like the sections themselves.
|
|
31
|
+
- `c-card-actions` lays its children out in a row that wraps onto further rows instead of overflowing the card. `justify` distributes them along the row — `start` (the default), `center`, `end`, `space-between`, `space-around`, or `stretch`, which grows every action to share the row — and `align` places them across it: `center` (the default), `start` or `end`. A `c-button` with `fit` grows whatever `justify` is.
|
|
32
|
+
|
|
33
|
+
Content slotted straight into the card, outside a section, keeps the vertical spacing but gets no inline padding: it runs edge to edge between the card's borders.
|
|
34
|
+
|
|
35
|
+
## Fullscreen
|
|
36
|
+
|
|
37
|
+
`fullscreen` adds a round toggle button in the card's top-right corner. Pressing it shows the card in the browser's fullscreen mode; pressing it again, or Escape, returns the card to the page. In fullscreen the card fills the screen with square corners and scrolls its own content. The toggle sits at the end of the heading row, and a `c-card-title` keeps its text and `actions` clear of it.
|
|
38
|
+
|
|
39
|
+
`enterFullscreen()` and `exitFullscreen()` do the same from code, with or without the toggle; `exitFullscreen()` ends only the card's own fullscreen, never another element's. A browser grants fullscreen only in response to a user action, so call `enterFullscreen()` from a click handler; a refused request logs a console warning and the card stays on the page.
|
|
40
|
+
|
|
41
|
+
## Accessibility
|
|
42
|
+
|
|
43
|
+
The card is an `<article>`. `c-card-title` is a heading, level 2 unless its `heading-level` says otherwise, so cards appear in the page's heading outline; set the level that fits where the cards sit. The fullscreen toggle is a native button whose name and tooltip, "Enter fullscreen" or "Exit fullscreen", follow its state; the text is fixed English.
|
|
44
|
+
|
|
45
|
+
## Customization
|
|
46
|
+
|
|
47
|
+
`::part(root)` is the card's visible box: the background and its ink, the border, corner radius, shadow and the spacing between sections all live on it. `::part(fullscreen-toggle)` is the toggle button. Each section has parts of its own, listed with it below.
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
c-card::part(root) {
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A 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-card`, typically `c-button`s, which wraps onto further rows instead of overflowing the card. `justify` distributes the actions along the row (`start` by default, `stretch` to grow them all) and `align` places them across it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The body section of a `c-card`: it pads its content in from the card's edges and stacks the children in a column with the card's section spacing. Place it after `c-card-title` and before `c-card-actions`.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The heading section of a `c-card`, set in small uppercase type above a primary accent bar; place it first in the card. Controls in its `actions` slot sit at the right of the heading and move onto their own line under it when the two do not fit side by side.
|
|
2
|
+
|
|
3
|
+
The title is a heading, level 2 unless `heading-level` says otherwise: set the level that fits the card's place in the page's outline, such as 3 for cards inside a section headed by an `h2`.
|
|
@@ -1,16 +1,44 @@
|
|
|
1
1
|
A form control for a single on/off choice: a native checkbox with a label,
|
|
2
2
|
an optional hint, and validation messaging.
|
|
3
3
|
|
|
4
|
-
Bind the state with a plain `v-model
|
|
5
|
-
`false-value`
|
|
6
|
-
|
|
4
|
+
Bind the state with a plain `v-model`: `value` is `true-value` while the
|
|
5
|
+
checkbox is on and `false-value` while it is off (`true` and `false` unless you
|
|
6
|
+
map them onto custom values). `checked` is the same state as a boolean —
|
|
7
|
+
setting it sets `value`, and a `checked` attribute sets the initial state when
|
|
8
|
+
no `value` is bound.
|
|
7
9
|
|
|
8
10
|
```html
|
|
9
11
|
<c-checkbox v-model="accepted" label="I accept the terms" />
|
|
10
12
|
```
|
|
11
13
|
|
|
12
|
-
Set `
|
|
13
|
-
|
|
14
|
+
Set `indeterminate` for the mixed "some but not all" state of a parent
|
|
15
|
+
checkbox. As on a native checkbox, a click or Space clears it and toggles the
|
|
16
|
+
state. A binding writes `indeterminate` only when its value changes, so it
|
|
17
|
+
doesn't bring the mixed state back after a click that leaves the options partly
|
|
18
|
+
checked (some rows disabled, say). Set the element's property in your `change`
|
|
19
|
+
handler:
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup>
|
|
23
|
+
const onSelectAll = (event) => {
|
|
24
|
+
selectAll(event.detail);
|
|
25
|
+
// The binding writes again only when `partly` changes.
|
|
26
|
+
event.currentTarget.indeterminate = partly.value;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<c-checkbox
|
|
32
|
+
:value="all"
|
|
33
|
+
:indeterminate="partly"
|
|
34
|
+
label="All projects"
|
|
35
|
+
@change="onSelectAll"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Set `hint` for a persistent helper line below the control; while `invalid` is
|
|
41
|
+
set, `error-message` replaces it. `hide-details` removes the message area
|
|
14
42
|
entirely.
|
|
15
43
|
|
|
16
44
|
## When to use
|
|
@@ -23,6 +51,10 @@ entirely.
|
|
|
23
51
|
- Choosing exactly one of several options — use `c-radio-group`.
|
|
24
52
|
- Switching a setting that takes effect immediately — use `c-switch`.
|
|
25
53
|
|
|
54
|
+
## Accessibility
|
|
55
|
+
|
|
56
|
+
The checkbox is a native input named by its label. Without a visible label, set `aria-label` on the element: it names the input, as the other ARIA attributes on the element describe it.
|
|
57
|
+
|
|
26
58
|
## Customization
|
|
27
59
|
|
|
28
60
|
Restyle via CSS parts from your own stylesheet. The `indicator` part is the
|