@cscfi/csc-ui 4.0.0-alpha.3 → 4.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/csc-ui.js +14328 -8058
  2. package/dist/custom-elements.json +8952 -4605
  3. package/dist/docs/c-alert/usage.md +24 -0
  4. package/dist/docs/c-autocomplete/usage.md +152 -0
  5. package/dist/docs/c-breadcrumb/usage.md +104 -0
  6. package/dist/docs/c-breadcrumb-item/usage.md +1 -0
  7. package/dist/docs/c-button-group/usage.md +14 -1
  8. package/dist/docs/c-checkbox/usage.md +53 -0
  9. package/dist/docs/c-date-picker/usage.md +224 -0
  10. package/dist/docs/c-main/usage.md +21 -1
  11. package/dist/docs/c-menu/usage.md +15 -0
  12. package/dist/docs/c-menu-item/usage.md +6 -0
  13. package/dist/docs/c-number-field/usage.md +112 -0
  14. package/dist/docs/c-option-value/usage.md +1 -0
  15. package/dist/docs/c-popover/usage.md +33 -0
  16. package/dist/docs/c-progress-bar/usage.md +23 -0
  17. package/dist/docs/c-progress-circle/usage.md +25 -0
  18. package/dist/docs/c-radio/usage.md +45 -0
  19. package/dist/docs/c-radio-group/usage.md +67 -0
  20. package/dist/docs/c-select/usage.md +127 -0
  21. package/dist/docs/c-side-navigation/usage.md +21 -0
  22. package/dist/docs/c-spinner/usage.md +21 -0
  23. package/dist/docs/c-switch/usage.md +36 -0
  24. package/dist/docs/c-tab-buttons/usage.md +7 -0
  25. package/dist/docs/c-table/usage.md +14 -0
  26. package/dist/docs/c-text-field/usage.md +106 -0
  27. package/dist/docs/c-time-picker/usage.md +170 -0
  28. package/dist/docs/c-toolbar/usage.md +17 -0
  29. package/dist/docs/c-tooltip/usage.md +30 -0
  30. package/dist/docs/c-tree-select/usage.md +156 -0
  31. package/dist/floating-ui.dom-DvzxEaDJ.js +1292 -0
  32. package/dist/styles/css/tailwind-theme.css +33 -0
  33. package/dist/styles/css/tokens.css +719 -197
  34. package/dist/vscode.css-custom-data.json +474 -20
  35. package/dist/vscode.html-custom-data.json +659 -57
  36. package/dist/web-types.json +2813 -697
  37. package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
  38. package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +118 -21
  39. package/dist-types/components/c-breadcrumb/CBreadcrumb.vue.d.ts +35 -0
  40. package/dist-types/components/c-breadcrumb/fit.d.ts +29 -0
  41. package/dist-types/components/c-breadcrumb-item/CBreadcrumbItem.vue.d.ts +31 -0
  42. package/dist-types/components/c-button/CButton.vue.d.ts +4 -4
  43. package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +1 -1
  44. package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +3 -3
  45. package/dist-types/components/c-data-table/CDataTable.vue.d.ts +6 -2
  46. package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +282 -0
  47. package/dist-types/components/c-date-picker/dates.d.ts +119 -0
  48. package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +50 -7
  49. package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
  50. package/dist-types/components/c-input/CInput.vue.d.ts +6 -6
  51. package/dist-types/components/c-list-item/CListItem.vue.d.ts +1 -1
  52. package/dist-types/components/c-main/CMain.vue.d.ts +10 -2
  53. package/dist-types/components/c-menu/CMenu.vue.d.ts +13 -3
  54. package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +30 -3
  55. package/dist-types/components/c-number-field/CNumberField.vue.d.ts +174 -0
  56. package/dist-types/components/c-number-field/numbers.d.ts +58 -0
  57. package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +1 -1
  58. package/dist-types/components/c-pagination/CPagination.vue.d.ts +1 -1
  59. package/dist-types/components/c-popover/CPopover.vue.d.ts +43 -0
  60. package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +32 -0
  61. package/dist-types/components/c-radio/CRadio.vue.d.ts +7 -11
  62. package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +10 -48
  63. package/dist-types/components/c-select/CSelect.vue.d.ts +115 -27
  64. package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +1 -1
  65. package/dist-types/components/c-side-navigation-item/CSideNavigationItem.vue.d.ts +1 -1
  66. package/dist-types/components/c-slider/CSlider.vue.d.ts +3 -3
  67. package/dist-types/components/c-sub-navigation-item/CSubNavigationItem.vue.d.ts +1 -1
  68. package/dist-types/components/c-tab-buttons/CTabButtons.vue.d.ts +1 -1
  69. package/dist-types/components/c-table/CTable.vue.d.ts +11 -1
  70. package/dist-types/components/c-table/injectTableStyles.d.ts +1 -0
  71. package/dist-types/components/c-tag/CTag.vue.d.ts +7 -0
  72. package/dist-types/components/c-tags/CTags.vue.d.ts +1 -1
  73. package/dist-types/components/c-text-field/CTextField.vue.d.ts +27 -10
  74. package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +210 -0
  75. package/dist-types/components/c-time-picker/times.d.ts +82 -0
  76. package/dist-types/components/c-toasts/CToasts.vue.d.ts +1 -1
  77. package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
  78. package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +49 -0
  79. package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +261 -0
  80. package/dist-types/index.d.ts +19 -2
  81. package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
  82. package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
  83. package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -0
  84. package/dist-types/shared/TypedField.vue.d.ts +46 -0
  85. package/dist-types/shared/appDefaults.d.ts +75 -0
  86. package/dist-types/shared/defineElement.d.ts +1 -0
  87. package/dist-types/shared/inputMask.d.ts +106 -0
  88. package/dist-types/shared/lightDismiss.d.ts +35 -0
  89. package/dist-types/shared/modalStack.d.ts +4 -3
  90. package/dist-types/shared/optionLabel.d.ts +18 -0
  91. package/dist-types/shared/pageLock.d.ts +26 -0
  92. package/dist-types/shared/peekCap.d.ts +35 -0
  93. package/dist-types/shared/popoverChain.d.ts +65 -0
  94. package/dist-types/shared/positionArea.d.ts +13 -0
  95. package/dist-types/shared/reducedMotion.d.ts +10 -0
  96. package/dist-types/shared/selectAll.d.ts +29 -0
  97. package/dist-types/shared/splitMatches.d.ts +18 -0
  98. package/dist-types/shared/useAnchoredPanel.d.ts +102 -0
  99. package/dist-types/shared/useDesignatedTrigger.d.ts +41 -0
  100. package/dist-types/shared/useFallbackPosition.d.ts +63 -0
  101. package/dist-types/shared/useHostStates.d.ts +25 -0
  102. package/dist-types/shared/useNarrowViewport.d.ts +19 -0
  103. package/dist-types/shared/useScrollStrip.d.ts +39 -0
  104. package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
  105. package/dist-types/shared/useTypedField.d.ts +103 -0
  106. package/dist-types/shared/visualViewport.d.ts +51 -0
  107. package/dist-types/tag-name-map.d.ts +769 -54
  108. package/dist-types/theme/chart-data.d.ts +51 -0
  109. package/dist-types/theme/ramp.d.ts +38 -0
  110. package/dist-types/theme/themeMode.d.ts +51 -0
  111. package/dist-types/types.d.ts +7 -0
  112. package/package.json +21 -9
  113. package/dist/css-anchor-positioning-fn-RTxo68pt.js +0 -6447
  114. package/dist-types/shared/anchorPolyfill.d.ts +0 -24
@@ -0,0 +1,112 @@
1
+ A field for a number — an integer, or one with decimals — shown with thousands separators as it is typed.
2
+
3
+ ## Value
4
+
5
+ The value is a number, or `null` while the field holds no digit. What the
6
+ field shows is grouped text — `1 234 567,89` — but the value is always the
7
+ plain number (`1234567.89`), so it needs no parsing. Bind it with `v-model`,
8
+ or listen for `change`:
9
+
10
+ ```vue
11
+ <c-number-field v-model="amount" label="Amount" />
12
+ ```
13
+
14
+ The value follows the text on every keystroke: typing `1234,` gives `1234`,
15
+ a lone `-` gives `null`. Only typing and stepping emit; setting `value` shows
16
+ the number without emitting it.
17
+
18
+ Unlike `c-text-field type="number"`, the native number input, the field shows
19
+ separators and never changes the number on a scroll.
20
+
21
+ ## Separators
22
+
23
+ The thousands and decimal separators follow the page's `lang`: a space and
24
+ `,` under `lang="fi"`, `,` and `.` under `lang="en"`. Set `group-separator`
25
+ and `decimal-separator` to fix them for one field, or for the whole app with
26
+ `applyDefaults({ 'c-number-field': { groupSeparator: ' ', decimalSeparator: ',' } })`.
27
+
28
+ The field inserts the group separators itself, and typed or pasted ones are
29
+ ignored. Either `.` or `,` typed is read as the decimal separator — unless
30
+ it is the group separator — so the decimal key of any keyboard works. A
31
+ pasted `1,234.56` or `1.234,56` reads as `1234.56` either way.
32
+
33
+ ## Decimals
34
+
35
+ `decimals` is the most fraction digits the field takes. By default it is
36
+ `0`, an integer field that ignores the decimal key:
37
+
38
+ ```vue
39
+ <c-number-field
40
+ v-model="price"
41
+ :decimals="2"
42
+ fixed-decimals
43
+ label="Price"
44
+ min="0"
45
+ >
46
+ <span slot="post">€</span>
47
+ </c-number-field>
48
+ ```
49
+
50
+ Typing never pads the fraction. With `fixed-decimals` the field pads it to
51
+ exactly `decimals` digits when the user leaves it — `12,5` shows as `12,50` —
52
+ while the value stays `12.5`. A value set with more fraction digits than
53
+ `decimals` is shown rounded.
54
+
55
+ The integer part takes up to 15 digits, the most a JavaScript number holds
56
+ exactly.
57
+
58
+ ## Range
59
+
60
+ `min` and `max` never change what the user typed. A number outside them is
61
+ kept and emitted, and the host exposes the `out-of-range` custom state and a
62
+ read-only `outOfRange` property. The field shows no error of its own:
63
+
64
+ ```vue
65
+ <c-number-field
66
+ v-model="count"
67
+ :error-message="error"
68
+ :valid="!error"
69
+ label="Participants"
70
+ max="50"
71
+ min="1"
72
+ @change="error = $event.target.outOfRange ? 'Enter 1 to 50' : ''"
73
+ />
74
+ ```
75
+
76
+ With `min` at `0` or above, the minus key is ignored.
77
+
78
+ ## Step
79
+
80
+ The buttons at the end of the field move the number one `step` up or down
81
+ (`1` by default); holding one repeats. The arrow keys do the same, and Page Up
82
+ and Page Down move ten steps:
83
+
84
+ ```vue
85
+ <c-number-field v-model="volume" label="Volume" max="100" min="0" step="5" />
86
+ ```
87
+
88
+ A step lands on the grid of `step` counted from `min` (or `0`): from a typed
89
+ `12`, a step of `5` goes up to `15` or down to `10`. A typed number off the
90
+ grid stays as typed.
91
+
92
+ Stepping never leaves `min` and `max`: it stops on the bound, and the button
93
+ for that direction is disabled there. From an out-of-range number, a step
94
+ goes back to the nearest bound. An empty field counts from `0`.
95
+
96
+ A stepped number is rounded to `decimals`, so a `step` finer than `decimals`
97
+ allows (`0.5` on an integer field) does not step as written; keep the two
98
+ in line.
99
+
100
+ The buttons stay out of the tab order and never take focus, so tapping one
101
+ on a phone does not open the keyboard. To translate their accessible labels,
102
+ set `texts`: `{ increase: 'Lisää', decrease: 'Vähennä' }`, or app-wide with
103
+ `applyDefaults`.
104
+
105
+ ## Keyboard
106
+
107
+ On a phone the field asks for the numeric keyboard, or a decimal one when
108
+ `decimals` is set. Numeric keyboards on iOS have no minus key: there, a
109
+ negative number is reached by stepping below zero.
110
+
111
+ Use the `pre` and `post` slots for a currency sign or a unit; the step
112
+ buttons follow the `post` content.
@@ -0,0 +1 @@
1
+ The label region of a `c-option`: wraps the text that c-select and c-autocomplete use as the option's label — in the closed field, its tag and the autocomplete filter — so the option can carry a description or an icon beside its label, and the region in which c-autocomplete marks the runs equal to the query (`::part(match)`).
@@ -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&nbsp;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,127 @@
1
+ A value-selection field: a readonly field that opens a listbox of options — slotted `c-option` elements or an `items` array — and holds the picked value, emitting the value events that back `v-model`.
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 `multiple` mode, in its tag — is its `name` attribute,
8
+ else the text of a `c-option-value` inside it, else the option's whole text.
9
+ Wrap the label in `c-option-value` when an option carries more than its
10
+ label, such as a description; the rest of the option's markup still renders
11
+ in the list row.
12
+
13
+ The row shows a copy of the option's markup, re-created from its HTML inside
14
+ the list. A component nested in an option — a `c-icon`, say — is therefore
15
+ configured through attributes, or props with an attribute form (strings,
16
+ numbers, booleans); object props and event listeners on option content do not
17
+ carry over. Page CSS does not reach the copy either: give the content a `part`
18
+ and style it through the field, which forwards every `part` named inside its
19
+ options:
20
+
21
+ ```html
22
+ <c-option value="ts">
23
+ <div part="language">
24
+ <c-option-value>TypeScript</c-option-value>
25
+ <c-icon path="…"></c-icon>
26
+ </div>
27
+ </c-option>
28
+ ```
29
+
30
+ ```css
31
+ c-select::part(language) {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 0.5rem;
35
+ }
36
+ ```
37
+
38
+ ## Multiple selection
39
+
40
+ Set `multiple` to let the user pick several options. The value is then an
41
+ array of the picked options' values in the order they were picked (an array
42
+ of `{ name, value }` items with `return-object`), and `[]` when nothing is
43
+ picked. Arrays have no attribute form — bind `value` as a DOM property
44
+ (`v-model` or `:value="…"` in Vue; the React wrapper and property
45
+ assignment do this naturally). Picking an option toggles it and keeps the
46
+ list open; `clearable` clears the whole selection. `option-as-selection`
47
+ has no effect in this mode.
48
+
49
+ Each picked option shows as a tag inside the field, and the field grows as
50
+ the tags wrap. A tag's close button removes that option; Backspace in the
51
+ closed field removes the last one. Set `max-tags` to show only that many
52
+ tags and fold the rest into a single "+N more" tag, or `max-tags="0"` to
53
+ show no tags at all — the field then reads "N selected". Assistive
54
+ technology always hears the full selection as the field's value.
55
+
56
+ Set `select-all` to pin a select-all row at the top of the list. Its checkbox
57
+ shows whether none, some or all enabled options are selected; activating it
58
+ selects every enabled option, or unselects them all when they already are.
59
+ Disabled options are left alone, and the row only appears while there is
60
+ something to select. Its label is `texts.selectAll`, a function receiving the
61
+ number of listed options.
62
+
63
+ The row checkboxes recolour like c-checkbox's (`::part(indicator)`,
64
+ `::part(mark)`), the select-all row is the `select-all` part, and the tags are
65
+ stylable through the `tags`, `tag` and `tag-root` parts:
66
+
67
+ ```css
68
+ c-select::part(tag-root) {
69
+ background: var(--c-primary-subtle);
70
+ }
71
+ ```
72
+
73
+ ## Texts
74
+
75
+ Every built-in string — the clear and toggle button labels, a tag's remove
76
+ label, the overflow and count texts, the select-all row's label — can be
77
+ replaced for another language
78
+ through the `texts` object, merged over the English defaults. Count and
79
+ label texts are functions, so the object must be bound as a DOM property:
80
+
81
+ ```vue
82
+ <c-select
83
+ :texts="{
84
+ more: (n) => `+${n} lisää`,
85
+ remove: (label) => `Poista ${label}`,
86
+ }"
87
+ multiple
88
+ />
89
+ ```
90
+
91
+ To translate every select at once, set `texts` app-wide with
92
+ `applyDefaults({ 'c-select': { texts } })` (Customization → App-wide prop
93
+ defaults); a per-instance `texts` still wins key by key.
94
+
95
+ ## Scrolling
96
+
97
+ The list shows `items-per-page` full rows (six by default) and then a
98
+ half-visible row instead of a scrollbar: the cut row is the cue that more
99
+ options follow, and the wheel, touch and arrow keys scroll as usual. Set
100
+ `items-per-page="0"` to let the list grow to the space the viewport allows;
101
+ it still ends on a half row when it overflows. To bring the native scrollbar
102
+ back:
103
+
104
+ ```css
105
+ c-select::part(list) {
106
+ scrollbar-width: auto;
107
+ }
108
+ ```
109
+
110
+ ## Narrow viewports
111
+
112
+ On a viewport narrower than 760px the panel opens as a **fullscreen panel**
113
+ instead of dropping under the field: a heading row with the field's `label` and
114
+ a close button, then the options filling the rest of the screen — the field
115
+ itself stays where it is in the page. The panel keeps covering the screen and
116
+ the heading row stays in view while the on-screen keyboard is open; the close button and
117
+ Escape both return focus to the field; the page behind the panel is inert until
118
+ it closes, and the list has no half-row cut — the screen edge is the cue. The
119
+ threshold is the viewport's width, never the field's, so a narrow field on a
120
+ desktop keeps its anchored panel. The close button's label is the `closePanel`
121
+ text, and the row's parts are `heading-row`, `heading` and `close`:
122
+
123
+ ```css
124
+ c-select::part(heading-row) {
125
+ border-bottom-color: var(--c-primary);
126
+ }
127
+ ```
@@ -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,106 @@
1
+ A text field for a single line of text, or several lines under `rows`, with a label, a hint and an error message.
2
+
3
+ ## Value
4
+
5
+ The value is the text in the field as a string. Bind it with `v-model`, or
6
+ listen for `update:value`:
7
+
8
+ ```vue
9
+ <c-text-field v-model="name" label="Name" />
10
+ ```
11
+
12
+ `type` maps to the native input type: `password` adds a toggle that reveals
13
+ the text, and `number` honours `min`, `max` and `step`. Setting `rows` above
14
+ `1` renders a textarea.
15
+
16
+ ## Input mask
17
+
18
+ `mask` makes the typed text follow a pattern, such as a phone number, a postal
19
+ code or an account number. In the pattern, `#` stands for a digit, `A` for a
20
+ letter and `*` for a letter or a digit; every other character is a literal the
21
+ field inserts itself, and `\` makes the next character a literal (`\#`).
22
+
23
+ ```vue
24
+ <c-text-field v-model="phone" label="Phone" mask="+358 ## ### ####" />
25
+ ```
26
+
27
+ | Token | Takes |
28
+ | ----- | ----------------- |
29
+ | `#` | A digit |
30
+ | `A` | A letter |
31
+ | `*` | A letter or digit |
32
+ | `\x` | `x` as a literal |
33
+ | `[…]` | Optional section |
34
+
35
+ Characters a token does not take are dropped as they are typed or pasted.
36
+ A literal appears only once the next character arrives, so typing `40` into
37
+ the mask above shows `+358 40`, an empty field stays empty, and Backspace
38
+ never gets stuck on a separator. Typing or pasting the literals yourself
39
+ works too: `+358401234567` fills the field the same way. A mask of digits
40
+ only brings up the numeric keyboard.
41
+
42
+ While the user types, a faint **mask guide** behind the text shows the rest
43
+ of the pattern — `+358 __ ___ ____` in an empty field, `_ ___ ____` once
44
+ `4` is typed — so it is clear what is still asked for. It is never part of
45
+ the value and screen readers do not announce it; describe the format in the
46
+ `hint` for them. It shows wherever a placeholder would: while the field is
47
+ focused or holds text, and always with `label-on-top` or without a `label`.
48
+ A `placeholder` replaces the guide — set one to write your own example
49
+ (`placeholder="+358 40 123 4567"`); the `mask-guide` part styles the guide.
50
+
51
+ ### Optional sections
52
+
53
+ A pattern may end in **optional sections** in square brackets for formats of
54
+ varying length. Every token inside may be left unfilled, one by one, and the
55
+ literals inside appear only when a character after them is typed:
56
+
57
+ ```vue
58
+ <!-- 5 to 12 digits after the country code -->
59
+ <c-text-field v-model="phone" label="Phone" mask="+358 #####[#######]" />
60
+
61
+ <!-- A ZIP code with an optional -#### -->
62
+ <c-text-field v-model="zip" label="ZIP code" mask="#####[-####]" />
63
+ ```
64
+
65
+ The field is complete once every token outside the sections is filled, and
66
+ the guide draws only those: `+358 _____` in the empty phone field, nothing
67
+ once five digits are in. A section may stop part-way (`12345-67` is complete),
68
+ so check the length of `unmaskedValue` where an all-or-nothing part matters.
69
+
70
+ Sections come last — after the first one only further sections may follow
71
+ (`## ###[ ####][###]`) — and do not nest. A mask that breaks these rules is
72
+ ignored with a console warning, and the field takes any text. Write `\[` and
73
+ `\]` for literal brackets.
74
+
75
+ A phone mask with fixed groups fits only some numbers: Finnish numbers group
76
+ differently by area code (`+358 9 …`, `+358 40 …`), so an ungrouped run
77
+ like `+358 #####[#######]` suits them all.
78
+
79
+ The value is the text as shown, literals included — `'+358 40 123 4567'`.
80
+ The read-only `unmaskedValue` property holds only the characters that fill
81
+ the tokens (`'401234567'`). Give the field masked values: a value set from
82
+ code is shown through the mask, but the field does not rewrite or emit it.
83
+
84
+ Text that leaves some token unfilled is kept as typed. The read-only
85
+ `maskComplete` property tells whether every token is filled, and a field
86
+ holding such partial text exposes the `incomplete` custom state. The field
87
+ shows no error of its own; whether an incomplete value is an error is the
88
+ consumer's validation:
89
+
90
+ ```vue
91
+ <c-text-field
92
+ v-model="phone"
93
+ :error-message="error"
94
+ :valid="!error"
95
+ label="Phone"
96
+ mask="+358 ## ### ####"
97
+ @change="
98
+ error = $event.target.matches(':state(incomplete)')
99
+ ? 'Enter the whole number'
100
+ : ''
101
+ "
102
+ />
103
+ ```
104
+
105
+ A mask applies to a single-line field of type `text`, `tel` or `search`;
106
+ other types (and a textarea) ignore it.