@cscfi/csc-ui 4.0.0-alpha.1 → 4.0.0-alpha.11
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 +7689 -6829
- package/dist/custom-elements.json +1037 -144
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-button-group/usage.md +6 -0
- package/dist/docs/c-checkbox/usage.md +53 -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-spinner/usage.md +21 -0
- package/dist/docs/c-switch/usage.md +36 -0
- package/dist/docs/c-table/usage.md +14 -0
- package/dist/docs/c-tooltip/usage.md +30 -0
- package/dist/styles/css/tailwind-theme.css +31 -0
- package/dist/styles/css/tokens.css +282 -201
- package/dist/vscode.css-custom-data.json +104 -15
- package/dist/vscode.html-custom-data.json +182 -26
- package/dist/web-types.json +526 -89
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +4 -1
- package/dist-types/components/c-button/CButton.vue.d.ts +1 -1
- package/dist-types/components/c-icon/CIcon.vue.d.ts +1 -1
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +4 -0
- package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +4 -2
- package/dist-types/components/c-menu/CMenu.vue.d.ts +13 -3
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +29 -3
- 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 +8 -46
- package/dist-types/components/c-select/CSelect.vue.d.ts +4 -1
- package/dist-types/components/c-spinner/CSpinner.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 +1 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +4 -0
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +49 -0
- package/dist-types/index.d.ts +9 -1
- package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
- package/dist-types/shared/popoverChain.d.ts +62 -0
- package/dist-types/shared/positionArea.d.ts +13 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +40 -0
- package/dist-types/shared/useHostStates.d.ts +25 -0
- package/dist-types/tag-name-map.d.ts +193 -32
- package/dist-types/theme/chart-data.d.ts +50 -0
- package/dist-types/theme/ramp.d.ts +38 -0
- package/dist-types/theme/themeMode.d.ts +13 -0
- package/dist-types/types.d.ts +13 -0
- package/package.json +8 -6
|
@@ -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.
|
|
@@ -49,6 +49,12 @@ 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
|
+
|
|
52
58
|
## Accessibility
|
|
53
59
|
|
|
54
60
|
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,33 @@
|
|
|
1
|
+
A click-opened, non-modal surface anchored to its trigger, floating in the top layer; its content may be interactive.
|
|
2
|
+
|
|
3
|
+
Put the element that opens the popover in the `trigger` slot and the content in the default slot. An optional `heading` prop renders a heading and doubles as the panel's accessible name (it is not called `title` — a `title` attribute would trigger the browser's native tooltip). The popover is deliberately minimal: compose footers, actions, or a close button from existing components (e.g. `c-button`) inside the body.
|
|
4
|
+
|
|
5
|
+
## Designated trigger
|
|
6
|
+
|
|
7
|
+
When the opener cannot be slotted — a button living elsewhere in the layout — point the `trigger` prop at it instead: the ID of the element, or the element itself via property binding. The two routes are the same concept: the popover wires click-to-toggle onto the designated element, mirrors `aria-haspopup`/`aria-expanded`, returns focus to it on Escape, anchors the panel to it, and clicking it never counts as a light dismiss. Supplying both routes is a misuse: the prop wins, the slotted element gets no wiring, and a console warning flags it.
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
- Contextual, dismissable UI attached to a control: a small settings panel, a confirm-lite prompt, help content with links.
|
|
12
|
+
- Not for a plain text hint — use `c-tooltip`.
|
|
13
|
+
- Not for blocking flows the user must complete — the popover never traps focus or blocks the page; use `c-modal`.
|
|
14
|
+
|
|
15
|
+
## Dismissal
|
|
16
|
+
|
|
17
|
+
Clicking outside the popover or pressing Escape closes it. Escape returns focus to the trigger when focus was inside the panel; light dismiss leaves focus where the user clicked. Focus is not moved into the panel on open — Tab reaches the content naturally from the trigger.
|
|
18
|
+
|
|
19
|
+
## Nesting
|
|
20
|
+
|
|
21
|
+
Popovers nest: a control inside one popover's panel can open another. The open popovers form a popover chain — each nested in the previous one; opening a popover whose trigger is not inside the open one closes it first, so sibling popovers never coexist. Escape closes only the innermost popover, one press per layer; clicking outside closes every popover that does not contain the click (clicking in a parent panel closes just its child); closing a popover closes everything nested inside it. Nesting follows the trigger, not the markup — a popover opened from a designated trigger inside another popover's panel chains under it even though its host element lives elsewhere.
|
|
22
|
+
|
|
23
|
+
## Accessibility
|
|
24
|
+
|
|
25
|
+
The panel is a non-modal `role="dialog"` and needs an accessible name: the `heading` prop provides one, or set `aria-label` on the `c-popover` element (`aria-labelledby` cannot reference slotted content across the shadow boundary). The component warns in the console when it opens unnamed. `aria-haspopup="dialog"` and `aria-expanded` are mirrored onto the slotted trigger.
|
|
26
|
+
|
|
27
|
+
## Layering
|
|
28
|
+
|
|
29
|
+
The panel is a native popover in the top layer: it is never clipped by ancestor overflow and needs no z-index management, even when opened from inside a modal.
|
|
30
|
+
|
|
31
|
+
## Customization
|
|
32
|
+
|
|
33
|
+
Structural styling via `::part(trigger)`, `::part(panel)` and `::part(heading)`. Colours come from the overlay-surface semantic tokens (`--c-surface-overlay`, `--c-on-surface`); override the tokens to re-theme.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
A horizontal progress bar that fills a track to a known completion percentage, with an optional details line showing the value and a label.
|
|
2
|
+
|
|
3
|
+
Bind the completion percentage to `value` (0–100; out-of-range values are clamped for the fill). By default a details line renders below the bar — the percentage plus whatever the `label` prop supplies (e.g. "57 % Uploading files"). Hide it with `hide-details`, or place it beside the bar with `single-line`.
|
|
4
|
+
|
|
5
|
+
For work of unknown duration the `indeterminate` prop replaces the fill with a looping sweep and hides the details line.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- For progress whose completion percentage is known — uploads, batch jobs, multi-step processing — or, with `indeterminate`, for an unknown-duration wait that should still read as a full-width bar.
|
|
10
|
+
- When space is tight or each item in a set needs its own compact indicator, `c-progress-circle` is the circular determinate counterpart.
|
|
11
|
+
- For a plain inline activity indicator use `c-spinner`; to cover a whole region while it loads, use `c-loader`.
|
|
12
|
+
|
|
13
|
+
## Details line
|
|
14
|
+
|
|
15
|
+
The details line shows the raw `value` even when the fill clamps it, and a negative value renders the line in the error role — a hook for signalling a failed transfer while keeping the bar itself empty.
|
|
16
|
+
|
|
17
|
+
## Accessibility
|
|
18
|
+
|
|
19
|
+
The bar is a native `<progress>` element exposing `role="progressbar"` with `aria-valuenow` while determinate; in indeterminate mode no value is exposed. The host mirrors `aria-busy` (true while indeterminate) and a `title` tooltip with the current percentage.
|
|
20
|
+
|
|
21
|
+
## Customization
|
|
22
|
+
|
|
23
|
+
Restyle via the parts: `::part(root)` (the outer wrapper), `::part(bar)` (the visible track around the native `<progress>`), and `::part(details)` (the percentage/label line). Colours default to the primary fill on a muted surface track.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
A circular progress indicator that draws a known completion percentage as an arc around a track — the circular counterpart of `c-progress-bar`.
|
|
2
|
+
|
|
3
|
+
Bind the completion percentage to `value` (0–100; out-of-range values are clamped). The circle's diameter comes from `size` and the track thickness from `width` — both in pixels, both props rather than styles because the arc geometry is computed from them. The value arc draws at half the track's width, inset within it, mirroring `c-progress-bar`'s fill-inside-track anatomy.
|
|
4
|
+
|
|
5
|
+
Nothing renders in the center by default. To show the percentage (or an icon), slot it in yourself; at the default 32 px size, center text is rarely legible, so pair slotted text with a larger `size`.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- For progress whose completion percentage is known — uploads, batch jobs, quota consumption.
|
|
10
|
+
- **Not for unknown-duration waiting**: `c-progress-circle` is determinate-only and has no indeterminate mode. Use `c-spinner` for pure activity indication, or `c-loader` to cover a whole region while it loads.
|
|
11
|
+
- When vertical space is tight or many items each need their own compact indicator; otherwise `c-progress-bar` with its built-in details line is usually the better default.
|
|
12
|
+
|
|
13
|
+
## Accessibility
|
|
14
|
+
|
|
15
|
+
The component exposes `role="progressbar"` with `aria-valuemin`/`aria-valuemax`/`aria-valuenow`, so assistive technology always gets the value even when the center is empty. Name the progressbar by setting `aria-label` on the element:
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<c-progress-circle aria-label="Upload progress" value="72"></c-progress-circle>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Slotted center content is presentational to assistive technology (the value is announced from `aria-valuenow`), so duplicating the percentage as slotted text is fine.
|
|
22
|
+
|
|
23
|
+
## Customization
|
|
24
|
+
|
|
25
|
+
Restyle via the parts: `::part(track)` and `::part(bar)` accept any stroke colour (the defaults are the muted surface track and the primary arc), and `::part(content)` styles the centered slot wrapper. Keep stroke *width* on the `width` prop — the radius math depends on it.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
A single radio option inside a `c-radio-group`: a native radio input whose
|
|
2
|
+
default slot is its clickable, announced label.
|
|
3
|
+
|
|
4
|
+
Author one `c-radio` per option, with a unique `value` and the option's
|
|
5
|
+
label content in the default slot. Selection state belongs to the group —
|
|
6
|
+
a radio has no checked prop; set the group's `value` (or `v-model`)
|
|
7
|
+
instead.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<c-radio value="paid">Paid</c-radio>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Set `disabled` to exclude a single option while the rest of the group stays
|
|
14
|
+
operable.
|
|
15
|
+
|
|
16
|
+
## Events
|
|
17
|
+
|
|
18
|
+
Selecting a radio fires a `change` event carrying its `value`. The event
|
|
19
|
+
bubbles (composed) so it can be heard on the radio, on the surrounding
|
|
20
|
+
`c-radio-group`, or further up — with the radio as the event target.
|
|
21
|
+
|
|
22
|
+
## Standalone
|
|
23
|
+
|
|
24
|
+
Outside a group a radio still renders and operates — it can be selected but
|
|
25
|
+
never unselected, like a native radio without siblings. Grouping behavior
|
|
26
|
+
(exclusivity, arrow-key navigation, form value) requires the parent
|
|
27
|
+
`c-radio-group`.
|
|
28
|
+
|
|
29
|
+
## Customization
|
|
30
|
+
|
|
31
|
+
Restyle via CSS parts from your own stylesheet. The `indicator` part is the
|
|
32
|
+
radio ring; the selection dot is its `::after` pseudo-element and the keyboard
|
|
33
|
+
focus ring its `::before`. Ring, dot and focus ring all draw with
|
|
34
|
+
`currentColor`, so `color` recolours the whole indicator, focus ring included.
|
|
35
|
+
The host exposes the `checked` and `disabled` custom states (both also cover
|
|
36
|
+
group-driven selection and disabling):
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
c-radio:state(checked)::part(indicator) {
|
|
40
|
+
color: var(--my-green);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For app-wide recolouring prefer the design tokens (`--c-primary` seed) over
|
|
45
|
+
per-component rules.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
A radio group is a set of mutually exclusive choices where exactly one can
|
|
2
|
+
be selected, authored as slotted `c-radio` children. Give the group a
|
|
3
|
+
`label` so the choice it represents is named for every user, and a `hint`
|
|
4
|
+
describing how to answer.
|
|
5
|
+
|
|
6
|
+
## Authoring the options
|
|
7
|
+
|
|
8
|
+
Each option is a `<c-radio value="...">` whose default slot is its label —
|
|
9
|
+
keep the label text (or richer markup) inside the radio so it stays
|
|
10
|
+
clickable and is announced with the control:
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<c-radio-group label="Subscription plan" value="free">
|
|
14
|
+
<c-radio value="free">Free</c-radio>
|
|
15
|
+
<c-radio value="paid">Paid</c-radio>
|
|
16
|
+
</c-radio-group>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The radios may sit at any depth inside the default slot, so custom layouts
|
|
20
|
+
are plain markup — wrap each radio in whatever layout element the design
|
|
21
|
+
needs:
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<c-radio-group label="Subscription plan" value="free">
|
|
25
|
+
<div class="card"><c-radio value="free">Free</c-radio></div>
|
|
26
|
+
<div class="card"><c-radio value="paid">Paid</c-radio></div>
|
|
27
|
+
</c-radio-group>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Text placed *next to* a radio instead of inside it renders, but is not
|
|
31
|
+
click-associated or announced — put the label content in the radio's slot.
|
|
32
|
+
|
|
33
|
+
## Value
|
|
34
|
+
|
|
35
|
+
The group's `value` is the selected radio's `value`, matched by strict
|
|
36
|
+
string equality; the group holds string values only. Selection is expressed
|
|
37
|
+
solely through the group — radios carry no checked state of their own.
|
|
38
|
+
Giving two radios the same `value` is a consumer error: every matching
|
|
39
|
+
radio will show as checked.
|
|
40
|
+
|
|
41
|
+
In Vue, bind with a plain `v-model`. The group also emits its radios'
|
|
42
|
+
bubbling `change` events onward, with the selected `c-radio` as the
|
|
43
|
+
event target.
|
|
44
|
+
|
|
45
|
+
## Label
|
|
46
|
+
|
|
47
|
+
The `label` prop names the group; when richer label content is needed, use
|
|
48
|
+
the `label` slot instead (the prop wins when both are set). The default
|
|
49
|
+
slot is exclusively the radios' home — loose text there is not treated as a
|
|
50
|
+
label.
|
|
51
|
+
|
|
52
|
+
## Validation
|
|
53
|
+
|
|
54
|
+
Validation is your job: set `valid` to `false` and supply an
|
|
55
|
+
`error-message` explaining why. While invalid without an `error-message`,
|
|
56
|
+
the `hint` keeps rendering as a hint. The message area reserves its height
|
|
57
|
+
(unless `hide-details`), so an error appearing at runtime doesn't shift the
|
|
58
|
+
layout.
|
|
59
|
+
|
|
60
|
+
## Accessibility
|
|
61
|
+
|
|
62
|
+
The group is announced as a `radiogroup` named by its label. Keyboard
|
|
63
|
+
behavior follows the native pattern: Tab moves into the group (onto the
|
|
64
|
+
checked radio, or the first enabled one) and out of it in one stop; the
|
|
65
|
+
arrow keys move between radios, selecting as they go, wrapping at the ends
|
|
66
|
+
and skipping disabled radios; Space selects the focused radio. Enter is
|
|
67
|
+
left to the surrounding form.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
A circular indeterminate activity indicator — pure motion with no value, for waits of unknown duration.
|
|
2
|
+
|
|
3
|
+
Size the spinner with the `size` (diameter) and `width` (stroke) props, both in pixels. It spins forever; there is nothing to bind. If the wait has a known completion percentage, use `c-progress-circle` instead — the boundary is the axis (pure activity vs known value), not the shape.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- For short, inline unknown-duration waits — inside a button, next to a field, in a table cell.
|
|
8
|
+
- To cover a whole container while it loads, use `c-loader`, which embeds this spinner behind a scrim with an optional message.
|
|
9
|
+
- For known progress, use `c-progress-bar` or `c-progress-circle`.
|
|
10
|
+
|
|
11
|
+
## Color
|
|
12
|
+
|
|
13
|
+
The stroke defaults to the primary role, so a standalone spinner is brand-coloured in either theme mode. The `color` prop accepts any CSS colour value; pass `currentColor` to make the spinner track the ambient text colour instead — the contract parent components (`c-loader`, `c-switch`) use to tint their embedded spinner.
|
|
14
|
+
|
|
15
|
+
## Accessibility
|
|
16
|
+
|
|
17
|
+
The spinner is purely visual and exposes nothing to assistive technology. Announce the loading state on the region it describes — `aria-busy` on the updating container, or a live-region message — or use `c-loader`, whose slotted message provides visible and announced context.
|
|
18
|
+
|
|
19
|
+
## Customization
|
|
20
|
+
|
|
21
|
+
`::part(root)` targets the `<svg>` drawing the circle. Prefer the `size`/`width`/`color` props for geometry and colour — the dash animation is computed from the size.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
A toggle for a binary setting that takes effect immediately: a native
|
|
2
|
+
switch control with a label, 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 on/off state onto custom values.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<c-switch v-model="notifications">Email notifications</c-switch>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
- Turning a setting or mode on/off with immediate effect (no submit step).
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
|
|
17
|
+
- A choice that is collected and submitted with a form — use `c-checkbox`.
|
|
18
|
+
|
|
19
|
+
## Customization
|
|
20
|
+
|
|
21
|
+
Restyle via CSS parts from your own stylesheet. The `slider` part is the
|
|
22
|
+
toggle track (its `::before` pseudo-element is the handle); the host exposes
|
|
23
|
+
the `checked` custom state, so the track is stylable per state:
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
c-switch:state(checked)::part(slider) {
|
|
27
|
+
background: var(--my-green);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
c-switch:state(checked)::part(slider)::before {
|
|
31
|
+
background: white;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For app-wide recolouring prefer the design tokens (`--c-primary` seed) over
|
|
36
|
+
per-component rules.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
A styled wrapper for a table you author yourself: slot in a plain `<table>` and c-table gives it the CSC look plus an optional responsive card layout on narrow screens. The table stays in your own DOM — your stylesheets, your framework's rendering, and `::part()` selectors on components nested in cells (a `c-tag` status chip, a `c-pagination` footer) all keep working.
|
|
2
|
+
|
|
3
|
+
Write regular, semantic table markup: `<thead>` with `<th>` headers, `<tbody>` rows, optionally a `<tfoot>`. c-table styles it through a scoped stylesheet it installs once per page; it never takes the markup over, so rows added or removed by your framework are picked up automatically.
|
|
4
|
+
|
|
5
|
+
## Responsive mode
|
|
6
|
+
|
|
7
|
+
With `responsive`, the table collapses into stacked cards when it is narrower than `mobile-breakpoint` (pixels, default 600). Each cell then shows a label cloned from its column header so the card stays readable without the header row.
|
|
8
|
+
|
|
9
|
+
- Rows that should not receive labels (a full-width action row, a `colspan` summary) opt out with a `no-mobile-labels` attribute on the `<tr>`.
|
|
10
|
+
- The labels are real `<span class="c-table__mobile-label">` elements prepended into your cells, so your framework will see them. Label creation is idempotent, but if a keyed re-render replaces the cell elements, call the element's `updateMobileLabels()` method afterwards to restore them.
|
|
11
|
+
|
|
12
|
+
## Styling
|
|
13
|
+
|
|
14
|
+
Cell content is yours to style: page CSS reaches everything inside the table, including `::part()` on nested components. The table's own defaults are applied at `c-table > table.c-table …` specificity — to override one of them (say, cell padding), match that scope: `c-table table.c-table td { padding: 8px; }`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
A non-interactive text hint shown when its trigger is hovered or keyboard-focused, floating in the top layer on the inverted surface tier.
|
|
2
|
+
|
|
3
|
+
Put the element the tooltip describes in the `trigger` slot and the hint in the `text` prop. For formatted content, use the `content` slot instead — it overrides the prop but must stay non-interactive: a tooltip is never focusable and can hold no links or buttons. If the content needs to be clicked, use `c-popover`.
|
|
4
|
+
|
|
5
|
+
The tooltip shows after a short hover delay (configurable via the `delay` prop) and immediately on keyboard focus. The trigger must be focusable for keyboard and screen-reader users to reach the hint — a `c-icon-button` or `c-button` qualifies; a bare `<span>` does not.
|
|
6
|
+
|
|
7
|
+
When the described element cannot be slotted, point the `trigger` prop at it instead — its document ID, or the element itself via property binding. The tooltip then wires hover/focus onto that element, mirrors the `aria-description` there, and anchors the bubble to it. Supplying both routes is a misuse: the prop wins, the slotted element gets no wiring, and a console warning flags it.
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
- To name an icon-only control or clarify a truncated label.
|
|
12
|
+
- Never for content the user must interact with, or for information that is available nowhere else on the page for touch users — tooltips are unreliable on touch devices.
|
|
13
|
+
|
|
14
|
+
## Dismissal
|
|
15
|
+
|
|
16
|
+
The tooltip hides when the pointer leaves the trigger and panel, when focus leaves the trigger, and on Escape (without moving focus). The pointer can travel from the trigger onto the tooltip without it vanishing.
|
|
17
|
+
|
|
18
|
+
## Accessibility
|
|
19
|
+
|
|
20
|
+
The tooltip implements the WCAG 1.4.13 (Content on Hover or Focus) contract: dismissable, hoverable, persistent.
|
|
21
|
+
|
|
22
|
+
The tooltip content is mirrored onto the trigger (slotted or designated) as `aria-description`, so screen readers announce it with the trigger even while the bubble is closed. `aria-describedby` is not used because ARIA ID references cannot cross the shadow boundary between the light-DOM trigger and the shadow-DOM panel (ADR-0033).
|
|
23
|
+
|
|
24
|
+
## Layering
|
|
25
|
+
|
|
26
|
+
The panel is a native popover in the top layer: it is never clipped by ancestor overflow and paints above modals — correct for a tooltip triggered from inside one.
|
|
27
|
+
|
|
28
|
+
## Customization
|
|
29
|
+
|
|
30
|
+
Structural styling via `::part(trigger)` and `::part(panel)`. Colours come from the inverted-surface semantic tokens (`--c-surface-inverted`, `--c-on-surface-inverted`); override the tokens to re-theme.
|
|
@@ -35,8 +35,19 @@
|
|
|
35
35
|
--color-on-surface-sunken: var(--c-on-surface-sunken);
|
|
36
36
|
--color-border: var(--c-border);
|
|
37
37
|
--color-border-strong: var(--c-border-strong);
|
|
38
|
+
--color-divider: var(--c-divider);
|
|
38
39
|
--color-ring: var(--c-ring);
|
|
39
40
|
|
|
41
|
+
/* Inverted-surface tier (ADR-0032): mode-aware contrast flip — not the
|
|
42
|
+
* mode-invariant inverse-* family below. */
|
|
43
|
+
--color-surface-inverted: var(--c-surface-inverted);
|
|
44
|
+
--color-on-surface-inverted: var(--c-on-surface-inverted);
|
|
45
|
+
--color-on-surface-inverted-muted: var(--c-on-surface-inverted-muted);
|
|
46
|
+
--color-success-inverted: var(--c-success-inverted);
|
|
47
|
+
--color-info-inverted: var(--c-info-inverted);
|
|
48
|
+
--color-warning-inverted: var(--c-warning-inverted);
|
|
49
|
+
--color-error-inverted: var(--c-error-inverted);
|
|
50
|
+
|
|
40
51
|
--color-primary: var(--c-primary);
|
|
41
52
|
--color-primary-hover: var(--c-primary-hover);
|
|
42
53
|
--color-on-primary: var(--c-on-primary);
|
|
@@ -107,6 +118,26 @@
|
|
|
107
118
|
--color-logo-teal: var(--c-logo-teal);
|
|
108
119
|
--color-logo-magenta: var(--c-logo-magenta);
|
|
109
120
|
|
|
121
|
+
/* Chart tokens (ADR-0030): 12 frozen categorical series slots — assign in
|
|
122
|
+
* slot order, never cycle — plus the chart anatomy roles (plot background,
|
|
123
|
+
* gridlines, axis labels). Validated as a set per mode; see the docs
|
|
124
|
+
* data-visualization guide for the folding and relief rules. */
|
|
125
|
+
--color-chart-1: var(--c-chart-1);
|
|
126
|
+
--color-chart-2: var(--c-chart-2);
|
|
127
|
+
--color-chart-3: var(--c-chart-3);
|
|
128
|
+
--color-chart-4: var(--c-chart-4);
|
|
129
|
+
--color-chart-5: var(--c-chart-5);
|
|
130
|
+
--color-chart-6: var(--c-chart-6);
|
|
131
|
+
--color-chart-7: var(--c-chart-7);
|
|
132
|
+
--color-chart-8: var(--c-chart-8);
|
|
133
|
+
--color-chart-9: var(--c-chart-9);
|
|
134
|
+
--color-chart-10: var(--c-chart-10);
|
|
135
|
+
--color-chart-11: var(--c-chart-11);
|
|
136
|
+
--color-chart-12: var(--c-chart-12);
|
|
137
|
+
--color-chart-surface: var(--c-chart-surface);
|
|
138
|
+
--color-chart-grid: var(--c-chart-grid);
|
|
139
|
+
--color-chart-axis: var(--c-chart-axis);
|
|
140
|
+
|
|
110
141
|
/* Mode-invariant inverse family (content on a fixed brand/dark backdrop). */
|
|
111
142
|
--color-inverse-surface: var(--c-inverse-surface);
|
|
112
143
|
--color-inverse-on: var(--c-inverse-on);
|