@cscfi/csc-ui 4.0.0-alpha.2 → 4.0.0-alpha.20
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 +10192 -7248
- package/dist/custom-elements.json +2278 -257
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-autocomplete/usage.md +152 -0
- package/dist/docs/c-button-group/usage.md +14 -1
- package/dist/docs/c-checkbox/usage.md +53 -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-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-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/styles/css/tailwind-theme.css +32 -0
- package/dist/styles/css/tokens.css +707 -197
- package/dist/vscode.css-custom-data.json +286 -19
- package/dist/vscode.html-custom-data.json +334 -51
- package/dist/web-types.json +1200 -190
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +118 -18
- package/dist-types/components/c-button/CButton.vue.d.ts +1 -1
- 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-dropdown/CDropdown.vue.d.ts +48 -5
- 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 +6 -2
- package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +4 -2
- package/dist-types/components/c-main/CMain.vue.d.ts +9 -2
- package/dist-types/components/c-menu/CMenu.vue.d.ts +14 -4
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +30 -3
- 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 +9 -47
- package/dist-types/components/c-select/CSelect.vue.d.ts +115 -24
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +1 -1
- package/dist-types/components/c-spinner/CSpinner.vue.d.ts +1 -1
- package/dist-types/components/c-switch/CSwitch.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 +8 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +15 -4
- 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 +14 -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/appDefaults.d.ts +75 -0
- package/dist-types/shared/defineElement.d.ts +1 -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/selectAll.d.ts +29 -0
- package/dist-types/shared/splitMatches.d.ts +18 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +98 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +40 -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/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +440 -51
- 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 +13 -0
- package/package.json +19 -8
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The dashboard layout's left-hand menu: section titles, navigation items and their sub-items in a drawer that is pinned beside the page on desktop and slides in over it on mobile.
|
|
2
|
+
|
|
3
|
+
## Inside c-main
|
|
4
|
+
|
|
5
|
+
Slot it as a direct child of `c-main` and the dashboard layout places and pins it: the drawer sits beneath the toolbar — or at the top edge once a `static` toolbar has scrolled away — is sized to the pinned height, and scrolls a long menu on its own. No host class is needed; the 3.x `autoheight` class is ignored there.
|
|
6
|
+
|
|
7
|
+
## Bottom slot
|
|
8
|
+
|
|
9
|
+
Trailing content — a sign-out button, a help link — goes in the `bottom` slot. It stays at the drawer's bottom edge while the items scroll above it: the viewport's bottom edge on desktop, the panel's in the mobile drawer. It is reached without scrolling the menu and is not a menu item.
|
|
10
|
+
|
|
11
|
+
## Mobile
|
|
12
|
+
|
|
13
|
+
Set `mobile` to render the drawer as a panel that slides in from the right over a backdrop. `menu-visible` opens and closes it, and a `c-navigation-button` anywhere on the page toggles it. Closing from within — the close button or the backdrop — emits `change:menu-visible`.
|
|
14
|
+
|
|
15
|
+
## Standalone
|
|
16
|
+
|
|
17
|
+
Outside `c-main` the drawer is an ordinary block that grows with its items. The `autoheight` host class sizes it to the viewport minus the toolbar height and lets its item list scroll, for a shell that pins the drawer itself.
|
|
18
|
+
|
|
19
|
+
## Customization
|
|
20
|
+
|
|
21
|
+
Structural styling via `::part(root)` (the drawer) and `::part(nav)` (the scrolling item list). The surface is the `nav-surface` token role; override the tokens to re-theme.
|
|
@@ -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.
|
|
@@ -9,3 +9,10 @@ has an active tab. The sliding indicator that glides to the active tab is
|
|
|
9
9
|
this component's own affordance. For a standalone segmented control that
|
|
10
10
|
holds a form value, use `c-button-group` (which this component wraps
|
|
11
11
|
internally); there, active buttons paint their own fill and nothing slides.
|
|
12
|
+
|
|
13
|
+
A tab strip is always one row. When it is wider than its box it scrolls
|
|
14
|
+
sideways — by touch, by a mouse drag, by the wheel, or with the edge arrows
|
|
15
|
+
that appear while it overflows — and the tab `c-tabs` makes active is
|
|
16
|
+
scrolled into view. The scrollbar is hidden; the half-visible tab at the
|
|
17
|
+
edge and the arrows are the cue. This is the same rule as the underlined
|
|
18
|
+
tab row of `c-tabs`.
|
|
@@ -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,17 @@
|
|
|
1
|
+
The app-wide bar at the top of the dashboard layout: the logo, the service name and global actions such as the user menu or log out. It is pinned to the top of the viewport by default and stays there while the page scrolls; `static` keeps it in the page flow so it scrolls away with the content.
|
|
2
|
+
|
|
3
|
+
## Pinned or static
|
|
4
|
+
|
|
5
|
+
Pinned is the default: the bar sticks to the top edge of its scroll container — the document in the dashboard layout — as soon as the page scrolls past it. Set `static` to leave the bar in flow instead; it then scrolls away with the page and returns when the user scrolls back to the top. The 3.x `class="relative"` switch is gone; `static` replaces it.
|
|
6
|
+
|
|
7
|
+
## Inside c-main
|
|
8
|
+
|
|
9
|
+
In `c-main`'s dashboard layout the toolbar spans both columns above the side navigation and the page, below an optional banner. `c-main` follows the toolbar's mode: the desktop side navigation is pinned beneath a pinned toolbar, or to the top edge once a static toolbar has scrolled away. No extra markup is needed.
|
|
10
|
+
|
|
11
|
+
## Content
|
|
12
|
+
|
|
13
|
+
The bar is a horizontal flex row with a small gap. Push trailing actions to the right with `margin-inline-start: auto` on the first of them.
|
|
14
|
+
|
|
15
|
+
## Customization
|
|
16
|
+
|
|
17
|
+
Structural styling via `::part(root)`. The height is the library's layout value shared with `c-main`, so changing it on the part does not move the pinned side navigation.
|
|
@@ -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.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
A hierarchical value-selection component: a readonly value field that opens a panel for browsing a tree one level at a time, or searching it as a whole, to commit one item.
|
|
2
|
+
|
|
3
|
+
## Items
|
|
4
|
+
|
|
5
|
+
The tree is the `items` property: an array of `{ value, name }` entries where
|
|
6
|
+
an entry with a non-empty `children` array is a branch and any other entry is
|
|
7
|
+
a leaf. Values must be unique across the whole tree. An optional `code` — a
|
|
8
|
+
classification number, say — is shown before the name in a muted column and
|
|
9
|
+
is matched by the search. Arrays have no attribute form, so bind `items` as a
|
|
10
|
+
DOM property (`:items="…"` in Vue; the React wrapper and property assignment
|
|
11
|
+
do this naturally):
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const items: CTreeSelectItem[] = [
|
|
15
|
+
{
|
|
16
|
+
value: '1',
|
|
17
|
+
code: '1',
|
|
18
|
+
name: 'Natural sciences',
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
value: '111',
|
|
22
|
+
code: '111',
|
|
23
|
+
name: 'Mathematics',
|
|
24
|
+
children: [{ value: '1111', code: '1111', name: 'Pure mathematics' }],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A `disabled` branch cannot be entered and a `disabled` leaf cannot be
|
|
32
|
+
committed; both render as disabled rows, and the items below a disabled
|
|
33
|
+
branch are listed disabled in search results.
|
|
34
|
+
|
|
35
|
+
The value is the committed item's `value`, or `null` when nothing is
|
|
36
|
+
committed. With `return-object` the value is a fresh `{ value, name, code,
|
|
37
|
+
path }` object instead — `path` holds the item's ancestors root-first, each
|
|
38
|
+
as `{ value, name, code }` — never the `items` entry itself, and never its
|
|
39
|
+
children. The closed field shows the committed item's path on a muted line
|
|
40
|
+
above its code and name.
|
|
41
|
+
|
|
42
|
+
## Browsing and searching
|
|
43
|
+
|
|
44
|
+
The panel lists one level at a time: the top-level items first, then the
|
|
45
|
+
children of whichever branch is picked, with a breadcrumb above the list —
|
|
46
|
+
the root crumb ("All") followed by one crumb per ancestor — for climbing
|
|
47
|
+
back. The header names the level being chosen: give `level-labels` an array
|
|
48
|
+
of names, top level first ("Main field", "Field", "Subfield"), and it reads
|
|
49
|
+
"Choose Field"; a level without a name reads "Choose Level 2". While the
|
|
50
|
+
tree is evenly deep — every leaf at the same level — the header also counts
|
|
51
|
+
the steps ("Step 2 of 3"); in an unevenly deep tree the counter is left out,
|
|
52
|
+
and a level made only of leaves says "Final level" instead. Reopening the
|
|
53
|
+
panel returns to the committed item's level with its row selected, so its
|
|
54
|
+
siblings are one click away.
|
|
55
|
+
|
|
56
|
+
Typing into the search input switches the panel to a flat list of matches
|
|
57
|
+
from the whole tree, each with its path on a second line. The query is
|
|
58
|
+
matched case-insensitively anywhere in the name or code of an item and of
|
|
59
|
+
every ancestor above it, so a query matching a branch lists all of its
|
|
60
|
+
leaves. Supply a `filter` predicate to change the matching — it receives the
|
|
61
|
+
item, the query and the item's ancestors, and lists the item when it returns
|
|
62
|
+
`true`. Because `filter` is a function, it must be bound as a DOM property.
|
|
63
|
+
Deleting the query, or the "Browse instead" control in the header, returns to
|
|
64
|
+
the level the user was browsing.
|
|
65
|
+
|
|
66
|
+
While a query is typed, the runs of each row's code, label and path that
|
|
67
|
+
equal it are marked. The marks are the `match` part, the path line the `path`
|
|
68
|
+
part and the code column the `code` part:
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
c-tree-select::part(match) {
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
From the keyboard, ArrowDown and ArrowUp move through the rows and Enter
|
|
77
|
+
activates one: a branch descends, a leaf commits. ArrowRight descends into a
|
|
78
|
+
highlighted branch and ArrowLeft — or Backspace with nothing left to delete —
|
|
79
|
+
climbs one level. Escape closes the panel and returns focus to the field; Tab
|
|
80
|
+
closes it and moves on.
|
|
81
|
+
|
|
82
|
+
## Committing a branch
|
|
83
|
+
|
|
84
|
+
By default only a leaf can be committed; a branch always opens its children.
|
|
85
|
+
Set `allow-branch` to let a branch be the value as well: every level below
|
|
86
|
+
the root then starts with a pinned select-branch row ("Select Natural
|
|
87
|
+
sciences") that commits the branch the user is in, and branches matching a
|
|
88
|
+
query are listed as search results and commit directly. The pinned row is the
|
|
89
|
+
`select-branch` part.
|
|
90
|
+
|
|
91
|
+
## Texts
|
|
92
|
+
|
|
93
|
+
Every built-in string — the root crumb, the header texts, a branch row's
|
|
94
|
+
child count, the select-branch row's label, the "Browse instead" control, the
|
|
95
|
+
no-results row, the search input's placeholder and accessible label, the
|
|
96
|
+
clear and toggle button labels — can be replaced for another language through
|
|
97
|
+
the `texts` object, merged over the English defaults. Interpolated texts are
|
|
98
|
+
functions, so the object must be bound as a DOM property; the `placeholder`
|
|
99
|
+
prop still wins over `texts.searchPlaceholder` when both are set:
|
|
100
|
+
|
|
101
|
+
```vue
|
|
102
|
+
<c-tree-select
|
|
103
|
+
:texts="{
|
|
104
|
+
root: 'Kaikki',
|
|
105
|
+
choose: (level) => `Valitse ${level}`,
|
|
106
|
+
children: (count) => `${count} alakohtaa`,
|
|
107
|
+
}"
|
|
108
|
+
/>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
To translate every tree select at once, set `texts` app-wide with
|
|
112
|
+
`applyDefaults({ 'c-tree-select': { texts } })` (Customization → App-wide
|
|
113
|
+
prop defaults); a per-instance `texts` still wins key by key.
|
|
114
|
+
|
|
115
|
+
## Scrolling
|
|
116
|
+
|
|
117
|
+
The panel shows `items-per-page` full rows (six by default) and then a
|
|
118
|
+
half-visible row instead of a scrollbar: the cut row is the cue that more
|
|
119
|
+
items follow, and the wheel, touch and arrow keys scroll as usual. Set
|
|
120
|
+
`items-per-page="0"` to let the list grow to the space the panel allows; it
|
|
121
|
+
still ends on a half row when it overflows. To bring the native scrollbar
|
|
122
|
+
back:
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
c-tree-select::part(list) {
|
|
126
|
+
scrollbar-width: auto;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Narrow viewports
|
|
131
|
+
|
|
132
|
+
On a viewport narrower than 760px the panel opens as a **fullscreen panel**
|
|
133
|
+
instead of anchoring under the field: a heading row with the field's `label` and
|
|
134
|
+
a close button, the search input beneath it, then the items filling the rest of
|
|
135
|
+
the screen. The panel keeps covering the screen and the rows above the items
|
|
136
|
+
stay in view while the on-screen keyboard is open; the close button and Escape
|
|
137
|
+
both return focus to the field; the page behind the panel is inert until it
|
|
138
|
+
closes, and the list has no half-row cut — the screen edge is the cue. The
|
|
139
|
+
threshold is the viewport's width, never the field's, so a narrow field on a
|
|
140
|
+
desktop keeps its anchored panel. The close button's label is the `closePanel`
|
|
141
|
+
text, and the row's parts are `heading-row`, `heading` and `close`:
|
|
142
|
+
|
|
143
|
+
```css
|
|
144
|
+
c-tree-select::part(heading-row) {
|
|
145
|
+
border-bottom-color: var(--c-primary);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Lazily loaded trees
|
|
150
|
+
|
|
151
|
+
The component walks the `items` you give it and has no loading state of its
|
|
152
|
+
own: there is no `external` mode and no per-branch fetch event yet. A tree
|
|
153
|
+
that arrives in pieces can still be shown by re-assigning `items` with the
|
|
154
|
+
fetched `children` filled in — the panel keeps its level and re-homes the
|
|
155
|
+
highlight when the tree changes. A branch must already list its children to
|
|
156
|
+
be enterable, so load at least one level ahead of the user.
|
|
@@ -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);
|
|
@@ -102,11 +113,32 @@
|
|
|
102
113
|
--color-on-nav: var(--c-on-nav);
|
|
103
114
|
--color-nav-active: var(--c-nav-active);
|
|
104
115
|
--color-on-nav-active: var(--c-on-nav-active);
|
|
116
|
+
--color-nav-sub-active: var(--c-nav-sub-active);
|
|
105
117
|
|
|
106
118
|
--color-logo-wordmark: var(--c-logo-wordmark);
|
|
107
119
|
--color-logo-teal: var(--c-logo-teal);
|
|
108
120
|
--color-logo-magenta: var(--c-logo-magenta);
|
|
109
121
|
|
|
122
|
+
/* Chart tokens (ADR-0030): 12 frozen categorical series slots — assign in
|
|
123
|
+
* slot order, never cycle — plus the chart anatomy roles (plot background,
|
|
124
|
+
* gridlines, axis labels). Validated as a set per mode; see the docs
|
|
125
|
+
* data-visualization guide for the folding and relief rules. */
|
|
126
|
+
--color-chart-1: var(--c-chart-1);
|
|
127
|
+
--color-chart-2: var(--c-chart-2);
|
|
128
|
+
--color-chart-3: var(--c-chart-3);
|
|
129
|
+
--color-chart-4: var(--c-chart-4);
|
|
130
|
+
--color-chart-5: var(--c-chart-5);
|
|
131
|
+
--color-chart-6: var(--c-chart-6);
|
|
132
|
+
--color-chart-7: var(--c-chart-7);
|
|
133
|
+
--color-chart-8: var(--c-chart-8);
|
|
134
|
+
--color-chart-9: var(--c-chart-9);
|
|
135
|
+
--color-chart-10: var(--c-chart-10);
|
|
136
|
+
--color-chart-11: var(--c-chart-11);
|
|
137
|
+
--color-chart-12: var(--c-chart-12);
|
|
138
|
+
--color-chart-surface: var(--c-chart-surface);
|
|
139
|
+
--color-chart-grid: var(--c-chart-grid);
|
|
140
|
+
--color-chart-axis: var(--c-chart-axis);
|
|
141
|
+
|
|
110
142
|
/* Mode-invariant inverse family (content on a fixed brand/dark backdrop). */
|
|
111
143
|
--color-inverse-surface: var(--c-inverse-surface);
|
|
112
144
|
--color-inverse-on: var(--c-inverse-on);
|