@cscfi/csc-ui 4.0.0-alpha.0 → 4.0.0-alpha.10
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 +7750 -6924
- package/dist/custom-elements.json +1047 -128
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-autocomplete/usage.md +28 -2
- 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 +187 -26
- package/dist/web-types.json +547 -90
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +12 -2
- package/dist-types/components/c-button/CButton.vue.d.ts +1 -1
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +1 -1
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +0 -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 +207 -34
- 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,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/generate-chart-data.mjs from
|
|
3
|
+
* tokens/semantic/{light,dark}.json — do not edit.
|
|
4
|
+
* Regenerate with `pnpm run chart:generate`; `pnpm run lint:chart` fails
|
|
5
|
+
* the build when this file is stale.
|
|
6
|
+
*
|
|
7
|
+
* The chart tokens (ADR-0030) as importable data (ADR-0040): the twelve
|
|
8
|
+
* series slots and the chart anatomy roles per theme mode. Values are the
|
|
9
|
+
* frozen, validated set — they never follow a consumer's `--c-chart-*`
|
|
10
|
+
* overrides. Pair with `themeMode()` to pick the mode on screen.
|
|
11
|
+
*/
|
|
12
|
+
import type { ThemeMode } from './themeMode';
|
|
13
|
+
/** The twelve series slots in slot order (`chart-1` … `chart-12`). */
|
|
14
|
+
export type ChartSlots = readonly [
|
|
15
|
+
string,
|
|
16
|
+
string,
|
|
17
|
+
string,
|
|
18
|
+
string,
|
|
19
|
+
string,
|
|
20
|
+
string,
|
|
21
|
+
string,
|
|
22
|
+
string,
|
|
23
|
+
string,
|
|
24
|
+
string,
|
|
25
|
+
string,
|
|
26
|
+
string
|
|
27
|
+
];
|
|
28
|
+
/** The chart anatomy roles: plot background, gridlines/axes, tick labels. */
|
|
29
|
+
export interface ChartAnatomy {
|
|
30
|
+
readonly surface: string;
|
|
31
|
+
readonly grid: string;
|
|
32
|
+
readonly axis: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Series slots per theme mode as `oklch(L C H)` strings — the palette's own
|
|
36
|
+
* colour space, ready for CSS, SVG and canvas `fillStyle`, and the exact
|
|
37
|
+
* string the `--c-chart-*` variable holds (ADR-0041). Each round-trips to
|
|
38
|
+
* the `#rrggbb` in `chartSlotsHex`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const chartSlots: Readonly<Record<ThemeMode, ChartSlots>>;
|
|
41
|
+
/**
|
|
42
|
+
* Series slots per theme mode as `#rrggbb` — for chart libraries that do
|
|
43
|
+
* their own colour maths in sRGB (ECharts, Chart.js) and cannot parse
|
|
44
|
+
* `oklch()`. Same colours and order as `chartSlots`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const chartSlotsHex: Readonly<Record<ThemeMode, ChartSlots>>;
|
|
47
|
+
/** Chart anatomy roles per theme mode as `oklch(L C H)` strings. */
|
|
48
|
+
export declare const chartAnatomy: Readonly<Record<ThemeMode, ChartAnatomy>>;
|
|
49
|
+
/** Chart anatomy roles per theme mode as `#rrggbb`. */
|
|
50
|
+
export declare const chartAnatomyHex: Readonly<Record<ThemeMode, ChartAnatomy>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Type surface for the plain-JS shared ramp core (ramp.js). Authored by hand
|
|
2
|
+
// because the core is JS (so the Node build script can import it without a TS
|
|
3
|
+
// loader) while consumers and the runtime API need types.
|
|
4
|
+
|
|
5
|
+
/** One of the chromatic brand/status families a consumer may re-seed. */
|
|
6
|
+
export type Family =
|
|
7
|
+
| 'primary'
|
|
8
|
+
| 'secondary'
|
|
9
|
+
| 'accent'
|
|
10
|
+
| 'success'
|
|
11
|
+
| 'info'
|
|
12
|
+
| 'warning'
|
|
13
|
+
| 'error'
|
|
14
|
+
| 'link';
|
|
15
|
+
|
|
16
|
+
/** Built-in brand seed (step-500) per family. */
|
|
17
|
+
export declare const DEFAULT_SEEDS: Record<Family, string>;
|
|
18
|
+
|
|
19
|
+
/** The chromatic families, in canonical order. */
|
|
20
|
+
export declare const FAMILIES: readonly Family[];
|
|
21
|
+
|
|
22
|
+
/** Ramp steps, in ascending order (`[50, 100, …, 950]`). */
|
|
23
|
+
export declare const STEPS: readonly number[];
|
|
24
|
+
|
|
25
|
+
/** Generate a full 50–950 ramp from a single step-500 seed. */
|
|
26
|
+
export declare function ramp(seedHex: string): Record<string, string>;
|
|
27
|
+
|
|
28
|
+
/** The `--c-<family>-*` custom-property map (steps + `-rgb`) for one seed. */
|
|
29
|
+
export declare function familyVars(
|
|
30
|
+
family: Family,
|
|
31
|
+
seedHex: string,
|
|
32
|
+
): Record<string, string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The CSS value the library emits for a colour: a hex becomes `oklch(L C H)`
|
|
36
|
+
* at a precision that round-trips exactly; non-hex values pass through.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cssColor(value: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The light-or-dark state that selects which palette the semantic tokens resolve to. */
|
|
2
|
+
export type ThemeMode = 'dark' | 'light';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the theme mode currently in effect, mirroring the cascade in
|
|
5
|
+
* `tokens.css`: an explicit `data-theme` on the root wins (any value other
|
|
6
|
+
* than `dark` is light — `:root:not([data-theme])` is what enables the OS
|
|
7
|
+
* fallback); otherwise the OS preference; light where neither is available
|
|
8
|
+
* (server rendering, no `matchMedia`). Re-run on a `data-theme` mutation and
|
|
9
|
+
* on the `(prefers-color-scheme: dark)` media query's `change` event.
|
|
10
|
+
*
|
|
11
|
+
* @param root the element carrying `data-theme` — defaults to `<html>`
|
|
12
|
+
*/
|
|
13
|
+
export declare function themeMode(root?: Element | null): ThemeMode;
|
package/dist-types/types.d.ts
CHANGED
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
*
|
|
7
7
|
* import type { CSelectItem } from '@cscfi/csc-ui';
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Field height of the form controls built on `c-input`. `default` is the 44px
|
|
11
|
+
* field; `small` is the 36px field. Owned here because the value passes from
|
|
12
|
+
* the wrapping control (`c-select`) into `c-input`.
|
|
13
|
+
*/
|
|
14
|
+
export type CFieldSize = 'default' | 'small';
|
|
15
|
+
/**
|
|
16
|
+
* Preferred placement of a floating panel relative to its anchor, shared by
|
|
17
|
+
* the anchor-positioned overlay components (`c-menu`, `c-tooltip`,
|
|
18
|
+
* `c-popover`). The side names the panel's position; `-start`/`-end` align
|
|
19
|
+
* the panel's edge with the anchor's on the cross axis.
|
|
20
|
+
*/
|
|
21
|
+
export type CPlacement = 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
9
22
|
/**
|
|
10
23
|
* A selectable item for the value-selection components (`c-select`,
|
|
11
24
|
* `c-autocomplete`) when options are supplied via the `items` prop instead of
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cscfi/csc-ui",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.10",
|
|
4
4
|
"description": "Vue 3-based replacement for @cscfi/csc-ui — same custom element tag names, Vue v-model contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/csc-ui.js",
|
|
@@ -56,19 +56,21 @@
|
|
|
56
56
|
"repository": "CSCfi/ui",
|
|
57
57
|
"homepage": "https://design-system.csc.fi",
|
|
58
58
|
"scripts": {
|
|
59
|
-
"build": "pnpm run style-dictionary:build && pnpm run docs:tag-map && vite build &&
|
|
59
|
+
"build": "pnpm run style-dictionary:build && pnpm run chart:generate && pnpm run docs:tag-map && vite build && pnpm run build:types && pnpm run docs:manifest:strict",
|
|
60
60
|
"docs:manifest": "node scripts/analyzer/index.mjs",
|
|
61
61
|
"docs:tag-map": "node scripts/analyzer/index.mjs --tag-map",
|
|
62
62
|
"docs:manifest:strict": "node scripts/analyzer/index.mjs --strict",
|
|
63
63
|
"docs:seed": "node scripts/seed-descriptions.mjs",
|
|
64
|
-
"build:types": "vue-tsc -p tsconfig.build.json",
|
|
65
|
-
"build:watch": "pnpm run style-dictionary:build &&
|
|
66
|
-
"dev": "pnpm run style-dictionary:build &&
|
|
64
|
+
"build:types": "vue-tsc -p tsconfig.build.json && node scripts/copy-declarations.mjs",
|
|
65
|
+
"build:watch": "pnpm run style-dictionary:build && pnpm run chart:generate && pnpm run build:types && vite build --watch",
|
|
66
|
+
"dev": "pnpm run style-dictionary:build && pnpm run chart:generate && pnpm run build:types && vite build --watch",
|
|
67
67
|
"lint:a11y": "node scripts/check-host-attr-fallthrough.mjs",
|
|
68
68
|
"lint:contrast": "node scripts/audit-contrast.mjs",
|
|
69
69
|
"lint:ramp": "node scripts/check-ramp-parity.mjs",
|
|
70
70
|
"lint:tokens": "node scripts/check-palette-utilities.mjs",
|
|
71
71
|
"style-dictionary:build": "style-dictionary build --config ./style-dictionary.config.cjs",
|
|
72
|
-
"type-check": "vue-tsc --build --force"
|
|
72
|
+
"type-check": "vue-tsc --build --force",
|
|
73
|
+
"chart:generate": "node scripts/generate-chart-data.mjs",
|
|
74
|
+
"lint:chart": "node scripts/check-chart-parity.mjs"
|
|
73
75
|
}
|
|
74
76
|
}
|