@aleph-alpha/ui-library 2.8.3 → 2.10.0
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/config.d.ts +7 -0
- package/config.js +58 -11
- package/dist/system/components/UiAutocomplete/types.d.ts +2 -4
- package/dist/system/patterns/UiDataTable/UiDataTableToolbar.vue.d.ts +2 -2
- package/docs/public-docs/component-lifecycle.md +177 -0
- package/docs/public-docs/quick-start.md +48 -4
- package/package.json +6 -4
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +1 -1
- package/src/components/UiAutocomplete/types.ts +2 -4
- package/src/patterns/UiDataTable/UiDataTableToolbar.vue +1 -1
package/config.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ export interface UiLibraryThemeOptions {
|
|
|
47
47
|
* @default 'html.dark'
|
|
48
48
|
*/
|
|
49
49
|
darkSelector?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Font size emitted on the root selector to control the UI library rem base.
|
|
52
|
+
* String values are used as-is (for example, '100%', '16px', '62.5%').
|
|
53
|
+
* Number values are treated as pixels.
|
|
54
|
+
*/
|
|
55
|
+
rootFontSize?: string | number;
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
/**
|
|
@@ -295,6 +301,7 @@ export interface UiLibraryConfigOptions extends UiLibraryPresetOptions {
|
|
|
295
301
|
* export default defineUiLibraryConfig({
|
|
296
302
|
* extend: { light: { primary: '#ff5500' } },
|
|
297
303
|
* darkSelector: 'html.dark',
|
|
304
|
+
* rootFontSize: '100%',
|
|
298
305
|
* })
|
|
299
306
|
* ```
|
|
300
307
|
*/
|
package/config.js
CHANGED
|
@@ -481,6 +481,16 @@ const mergeThemes = (base, extend) => {
|
|
|
481
481
|
};
|
|
482
482
|
};
|
|
483
483
|
|
|
484
|
+
const normalizeRootFontSize = (value) => {
|
|
485
|
+
if (value == null) return undefined;
|
|
486
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
487
|
+
return `${value}px`;
|
|
488
|
+
}
|
|
489
|
+
if (typeof value !== 'string') return undefined;
|
|
490
|
+
const trimmed = value.trim();
|
|
491
|
+
return trimmed || undefined;
|
|
492
|
+
};
|
|
493
|
+
|
|
484
494
|
const isAccessibleThemeMode = (options = {}) =>
|
|
485
495
|
getUiLibraryThemeMode(options) === UI_LIBRARY_REFERENCE_THEME_SETS.accessible;
|
|
486
496
|
|
|
@@ -642,6 +652,7 @@ export const defineThemeConfig = (config) => config;
|
|
|
642
652
|
export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
643
653
|
const rootSelector = options.rootSelector ?? ':root';
|
|
644
654
|
const darkSelector = options.darkSelector ?? 'html.dark';
|
|
655
|
+
const rootFontSize = normalizeRootFontSize(options.rootFontSize);
|
|
645
656
|
|
|
646
657
|
const opacityDefaults = `
|
|
647
658
|
*,
|
|
@@ -654,19 +665,23 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
|
|
|
654
665
|
--un-shadow-opacity: 1;
|
|
655
666
|
}`.trim();
|
|
656
667
|
|
|
657
|
-
const toCssBlock = (selector, vars) => {
|
|
668
|
+
const toCssBlock = (selector, vars, extraDeclarations = []) => {
|
|
658
669
|
const entries = Object.entries(vars || {}).filter(
|
|
659
670
|
([k]) => k && typeof k === 'string',
|
|
660
671
|
);
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
.map(([k, v]) => ` --${k}: ${normalizeShadcnVarValue(v)};`)
|
|
664
|
-
|
|
672
|
+
const lines = [
|
|
673
|
+
...extraDeclarations,
|
|
674
|
+
...entries.map(([k, v]) => ` --${k}: ${normalizeShadcnVarValue(v)};`),
|
|
675
|
+
].join('\n');
|
|
676
|
+
if (!lines) return '';
|
|
665
677
|
return `${selector} {\n${lines}\n}\n`;
|
|
666
678
|
};
|
|
667
679
|
|
|
668
|
-
const css =
|
|
669
|
-
|
|
680
|
+
const css = `${opacityDefaults}\n${toCssBlock(
|
|
681
|
+
rootSelector,
|
|
682
|
+
theme.light,
|
|
683
|
+
rootFontSize ? [` font-size: ${rootFontSize};`] : [],
|
|
684
|
+
)}${toCssBlock(darkSelector, theme.dark)}`.trim();
|
|
670
685
|
|
|
671
686
|
return definePreset(() => ({
|
|
672
687
|
name: '@aleph-alpha/ui-library-theme',
|
|
@@ -1000,6 +1015,7 @@ export const presetUiLibraryUtils = () =>
|
|
|
1000
1015
|
* export default defineUiLibraryConfig({
|
|
1001
1016
|
* extend: { light: { primary: '#ff5500' } },
|
|
1002
1017
|
* darkSelector: 'html.dark',
|
|
1018
|
+
* rootFontSize: '100%',
|
|
1003
1019
|
* })
|
|
1004
1020
|
* ```
|
|
1005
1021
|
*/
|
|
@@ -1007,9 +1023,14 @@ export const defineUiLibraryConfig = (options = {}) => {
|
|
|
1007
1023
|
const {
|
|
1008
1024
|
darkSelector,
|
|
1009
1025
|
rootSelector,
|
|
1026
|
+
rootFontSize,
|
|
1010
1027
|
extend,
|
|
1011
1028
|
theme,
|
|
1012
1029
|
includeAllTokens,
|
|
1030
|
+
themeMode,
|
|
1031
|
+
accessible,
|
|
1032
|
+
accessibleTheme,
|
|
1033
|
+
accessibleSelector,
|
|
1013
1034
|
presets: extraPresets = [],
|
|
1014
1035
|
rules: extraRules = [],
|
|
1015
1036
|
shortcuts: extraShortcuts = [],
|
|
@@ -1019,10 +1040,17 @@ export const defineUiLibraryConfig = (options = {}) => {
|
|
|
1019
1040
|
const themeOptions = {};
|
|
1020
1041
|
if (darkSelector !== undefined) themeOptions.darkSelector = darkSelector;
|
|
1021
1042
|
if (rootSelector !== undefined) themeOptions.rootSelector = rootSelector;
|
|
1043
|
+
if (rootFontSize !== undefined) themeOptions.rootFontSize = rootFontSize;
|
|
1022
1044
|
if (extend !== undefined) themeOptions.extend = extend;
|
|
1023
1045
|
if (theme !== undefined) themeOptions.theme = theme;
|
|
1024
1046
|
if (includeAllTokens !== undefined)
|
|
1025
1047
|
themeOptions.includeAllTokens = includeAllTokens;
|
|
1048
|
+
if (themeMode !== undefined) themeOptions.themeMode = themeMode;
|
|
1049
|
+
if (accessible !== undefined) themeOptions.accessible = accessible;
|
|
1050
|
+
if (accessibleTheme !== undefined)
|
|
1051
|
+
themeOptions.accessibleTheme = accessibleTheme;
|
|
1052
|
+
if (accessibleSelector !== undefined)
|
|
1053
|
+
themeOptions.accessibleSelector = accessibleSelector;
|
|
1026
1054
|
|
|
1027
1055
|
return defineConfig({
|
|
1028
1056
|
...getUiLibraryContentConfig(),
|
|
@@ -1059,9 +1087,20 @@ const fontWeightMap = {
|
|
|
1059
1087
|
Light: '300',
|
|
1060
1088
|
};
|
|
1061
1089
|
|
|
1062
|
-
/** Design-tool sizes are px;
|
|
1090
|
+
/** Design-tool sizes are px; rem token values resolve against a 16px base. */
|
|
1063
1091
|
const ROOT_FONT_SIZE_PX = 16;
|
|
1064
1092
|
|
|
1093
|
+
const formatPx = (value) => {
|
|
1094
|
+
const rounded = Math.round(value * 10000) / 10000;
|
|
1095
|
+
return `${rounded}px`;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
const numericDesignPxToPx = (raw) => {
|
|
1099
|
+
const n = typeof raw === 'number' ? raw : parseFloat(String(raw).trim());
|
|
1100
|
+
if (!Number.isFinite(n)) return null;
|
|
1101
|
+
return formatPx(n);
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1065
1104
|
const numericDesignPxToRem = (raw) => {
|
|
1066
1105
|
const n = typeof raw === 'number' ? raw : parseFloat(String(raw).trim());
|
|
1067
1106
|
if (!Number.isFinite(n)) return null;
|
|
@@ -1070,16 +1109,24 @@ const numericDesignPxToRem = (raw) => {
|
|
|
1070
1109
|
return `${rounded}rem`;
|
|
1071
1110
|
};
|
|
1072
1111
|
|
|
1073
|
-
|
|
1112
|
+
const remToPx = (raw) => {
|
|
1113
|
+
const n = parseFloat(String(raw).trim());
|
|
1114
|
+
if (!Number.isFinite(n)) return null;
|
|
1115
|
+
return formatPx(n * ROOT_FONT_SIZE_PX);
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
/** Token Studio may export dimensions as strings; font-size output is always px. */
|
|
1074
1119
|
const normalizeFontSizeForCss = (value) => {
|
|
1075
1120
|
if (value == null) return value;
|
|
1076
1121
|
if (typeof value === 'number' && Number.isFinite(value))
|
|
1077
|
-
return
|
|
1122
|
+
return numericDesignPxToPx(value);
|
|
1078
1123
|
if (typeof value === 'string') {
|
|
1079
1124
|
const t = value.trim();
|
|
1080
1125
|
if (/^(calc|var|--)/i.test(t)) return t;
|
|
1126
|
+
if (/^-?\d+(\.\d+)?rem$/i.test(t)) return remToPx(t) ?? t;
|
|
1127
|
+
if (/^-?\d+(\.\d+)?px$/i.test(t)) return t;
|
|
1081
1128
|
if (/[a-z%]/i.test(t)) return t;
|
|
1082
|
-
if (/^\d+(\.\d+)?$/.test(t)) return
|
|
1129
|
+
if (/^\d+(\.\d+)?$/.test(t)) return numericDesignPxToPx(t) ?? t;
|
|
1083
1130
|
}
|
|
1084
1131
|
return value;
|
|
1085
1132
|
};
|
|
@@ -8,13 +8,11 @@ export type UiAutocompleteOption = {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Filterable select input for choosing one or many options.
|
|
12
12
|
*
|
|
13
|
-
* This component is currently beta. Its API and behavior may still change
|
|
14
|
-
* before it is considered stable.
|
|
15
13
|
* @category Form Inputs
|
|
16
14
|
* @useCases autocomplete, searchable select, multi select, command picker
|
|
17
|
-
* @keywords autocomplete, combobox, select, search, filter, multi-select
|
|
15
|
+
* @keywords autocomplete, combobox, select, search, filter, multi-select
|
|
18
16
|
* @related UiSelect, UiTagsInput, UiListbox
|
|
19
17
|
*/
|
|
20
18
|
export type UiAutocompleteProps = {
|
|
@@ -4,12 +4,12 @@ declare function __VLS_template(): {
|
|
|
4
4
|
/** Primary controls, usually search and column filters. */
|
|
5
5
|
default(): unknown;
|
|
6
6
|
/** Trailing controls, usually view options or reset actions. */
|
|
7
|
-
actions(): unknown;
|
|
7
|
+
actions?(): unknown;
|
|
8
8
|
}> & {
|
|
9
9
|
/** Primary controls, usually search and column filters. */
|
|
10
10
|
default(): unknown;
|
|
11
11
|
/** Trailing controls, usually view options or reset actions. */
|
|
12
|
-
actions(): unknown;
|
|
12
|
+
actions?(): unknown;
|
|
13
13
|
};
|
|
14
14
|
refs: {};
|
|
15
15
|
rootEl: HTMLDivElement;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Component Lifecycle
|
|
2
|
+
|
|
3
|
+
How Design System components mature inside the Design System, from Experimental through Beta to Stable.
|
|
4
|
+
|
|
5
|
+
Design System components move through three states inside the Design System: Experimental, Beta, and Stable. They start as experimental components built in `@aleph-alpha/ui-library/experimental` with lower governance, mature into Beta when they show cross-team value, and become Stable once their design and technical model are proven. This page describes each state, the criteria that move a component between them, and the workflows for contributing and deprecating components.
|
|
6
|
+
|
|
7
|
+
## Tooling
|
|
8
|
+
|
|
9
|
+
Component usage across products is tracked by `vue-component-analyzer`. The latest scan output is available at [main-scan](https://animated-funicular-jzw7q73.pages.github.io/pipeline/main-scan).
|
|
10
|
+
|
|
11
|
+
This data is the single source of truth for component adoption across the organisation. It helps us:
|
|
12
|
+
|
|
13
|
+
- Surface emerging patterns worth promoting.
|
|
14
|
+
- Gauge Beta adoption to decide readiness for Stable.
|
|
15
|
+
- Scope deprecation impact.
|
|
16
|
+
- Identify consumers and contributors.
|
|
17
|
+
- Guide where Design System investment is most valuable.
|
|
18
|
+
|
|
19
|
+
## Component States
|
|
20
|
+
|
|
21
|
+
### Experimental
|
|
22
|
+
|
|
23
|
+
**Definition.** An early-stage Design System component that lives inside the Design System, in Figma and the `@aleph-alpha/ui-library/experimental` package export, but has not yet met full Stable governance.
|
|
24
|
+
|
|
25
|
+
**Characteristics:**
|
|
26
|
+
|
|
27
|
+
- Lives in the Design System itself: a dedicated Experimental Figma library or section, unpublished to consumers by default, and a separate code export such as `@aleph-alpha/ui-library/experimental` with an explicit instability warning.
|
|
28
|
+
- Built on the same tokens, primitives, and tooling as the rest of the Design System, so there is no divergence in token usage or accessibility patterns.
|
|
29
|
+
- Maintained by the team that introduced it, with Design System team awareness.
|
|
30
|
+
- Skips the full review, documentation, and accessibility process required for Stable.
|
|
31
|
+
- API and visual treatment can still change.
|
|
32
|
+
|
|
33
|
+
**When to build Experimental.** Build Experimental when you need to ship a new pattern faster than full Stable governance allows. Experimental is a deliberate trade-off: lower governance now, with the foundations in place to mature into Beta and Stable later. Living in the Design System from day one gives the component visibility across teams, enabling the cross-team validation that drives promotion.
|
|
34
|
+
|
|
35
|
+
**Key distinction from Stable.** Governance, not location. Both live in the Design System. Experimental skips the heavy review, docs, and accessibility process while still using Design System foundations.
|
|
36
|
+
|
|
37
|
+
> Components built directly in product repos, not in `@aleph-alpha/ui-library/experimental`, are not Experimental in the lifecycle sense. They are discovery signals. See [Discovery / Triage](#discovery--triage).
|
|
38
|
+
|
|
39
|
+
### Beta
|
|
40
|
+
|
|
41
|
+
**Definition.** A component that has been promoted from Experimental after showing demand and cross-team value. It lives in the Design System, with design exploration in progress to standardise it, but the API and visual treatment can still change before promotion to Stable.
|
|
42
|
+
|
|
43
|
+
**Characteristics:**
|
|
44
|
+
|
|
45
|
+
- Built in the Design System as an Experimental component that has demonstrated cross-team value, or surfaced via Discovery / Triage from product-code patterns the Design System team decides to standardise.
|
|
46
|
+
- Pattern has potentially broad reach and could scale across multiple industries or product areas.
|
|
47
|
+
- Documented as a promotion candidate; design exploration is in progress to standardise it.
|
|
48
|
+
- May be published in the Design System package marked `Beta`; API and visual treatment can still change before promotion to Stable.
|
|
49
|
+
|
|
50
|
+
**What to expect from Beta.** Beta components are opt-in. They are usable, but expect the API or styling to change before they reach Stable. Pin the version if you need consumer-side stability.
|
|
51
|
+
|
|
52
|
+
### Stable
|
|
53
|
+
|
|
54
|
+
**Definition.** A fully standardised, accessible, production-grade Design System component, documented in Figma and in code.
|
|
55
|
+
|
|
56
|
+
**Characteristics:**
|
|
57
|
+
|
|
58
|
+
- 1:1 Figma to code mapping.
|
|
59
|
+
- Tokenized, documented, versioned.
|
|
60
|
+
- Stable API and behaviours; changes follow the [Deprecation Workflow](#deprecation-workflow).
|
|
61
|
+
- Maintained long-term by the Design System team.
|
|
62
|
+
|
|
63
|
+
**When to use.** Default to Stable for any production UI. Stable components are reliable, reusable, customisable, and supported long-term.
|
|
64
|
+
|
|
65
|
+
Previously known as Custom (Experimental), Shadow (Beta), and True (Stable). The old names may still appear in older diagrams and tickets.
|
|
66
|
+
|
|
67
|
+
### Code And Storybook Tags
|
|
68
|
+
|
|
69
|
+
Use `pnpm tag-component` to keep Storybook tags and generated docs metadata aligned with the lifecycle state:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm --filter @aleph-alpha/ui-library tag-component UiAutocomplete experimental
|
|
73
|
+
pnpm --filter @aleph-alpha/ui-library tag-component UiAutocomplete beta
|
|
74
|
+
pnpm --filter @aleph-alpha/ui-library tag-component UiAutocomplete stable
|
|
75
|
+
pnpm --filter @aleph-alpha/ui-library tag-component UiAutocomplete deprecated
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`experimental`, `beta`, and `deprecated` appear as visible Storybook badges. `stable` removes lifecycle tags and notes instead of adding a `stable` tag. `deprecated` adds a generic JSDoc `@deprecated` marker in `types.ts`; complete the full deprecation workflow below manually.
|
|
79
|
+
|
|
80
|
+
## Discovery / Triage
|
|
81
|
+
|
|
82
|
+
Components found in product repos by `vue-component-analyzer` that do not exist in the Design System are **not part of the lifecycle**. They are discovery signals, similar to product discovery ideas in Jira, that need triage before they can become a Design System component.
|
|
83
|
+
|
|
84
|
+
When the analyzer detects an unfamiliar component pattern in a product codebase, the Design System team triages with one of these outcomes:
|
|
85
|
+
|
|
86
|
+
| Outcome | What happens |
|
|
87
|
+
| ------- | ------------ |
|
|
88
|
+
| Duplicate | The pattern is already covered by an existing Design System component. Close the finding; advise the owner to migrate. |
|
|
89
|
+
| Won't do | The pattern is too narrow or does not fit the Design System. Close. |
|
|
90
|
+
| Spike | Worth more exploration before committing. Create a research ticket. |
|
|
91
|
+
| Move into DS | Pattern is worth standardising. Create a Design System ticket; the component is built in `@aleph-alpha/ui-library/experimental` and enters the lifecycle as Experimental. |
|
|
92
|
+
| Advise owner | Recommend the owner move the component into the Design System as best practice. Flag and follow up. |
|
|
93
|
+
|
|
94
|
+
Only the **Move into DS** outcome brings a component into the lifecycle as Experimental. All other outcomes keep the pattern repo-local with no Design System commitment.
|
|
95
|
+
|
|
96
|
+
## Promotion Criteria
|
|
97
|
+
|
|
98
|
+
### From Experimental To Beta
|
|
99
|
+
|
|
100
|
+
An Experimental component is promoted to Beta when the pattern recurs across PoCs, demonstrates cross-team relevance, and can be articulated as a coherent, generalisable interaction. The purpose of the Beta stage is to stabilise and refine the emerging pattern through focused design exploration, without yet committing it to the Design System. Beta candidates are continuously evaluated and iterated by the design team so that prioritised candidates can progress toward a mature, standardisable form.
|
|
101
|
+
|
|
102
|
+
Consider promoting when one or more factors are true:
|
|
103
|
+
|
|
104
|
+
1. **Recurrence:** appears repeatedly across PoCs, teams, or product areas, and is no longer a one-off need.
|
|
105
|
+
2. **Cross-team relevance:** used or requested by multiple incubation or application teams, signalling shared value.
|
|
106
|
+
3. **Market potential:** supports workflows with clear customer demand, validated opportunity, or strong GTM alignment.
|
|
107
|
+
4. **Stability of interaction model:** shows consistent behaviour across variations and can be expressed as a clean, repeatable pattern.
|
|
108
|
+
5. **Generalisability:** can be abstracted away from a single PoC and applies broadly across scenarios or industries.
|
|
109
|
+
6. **Accessibility baseline:** pattern can meet keyboard navigation, focus behaviour, and accessibility expectations without bespoke workarounds.
|
|
110
|
+
7. **Benchmark support:** exists in other mature systems, industry patterns, or open-source libraries, signalling standard viability.
|
|
111
|
+
8. **Reduction of fragmentation:** promoting it removes duplication, decreases custom hacks, and increases overall system coherence.
|
|
112
|
+
9. **Low risk of over-specialisation:** pattern is not too narrow, domain-specific, or brittle to support as part of the core Design System.
|
|
113
|
+
10. **Maintenance justification:** the long-term effort of maintaining it as a Design System asset is outweighed by adoption and impact.
|
|
114
|
+
|
|
115
|
+
### From Beta To Stable
|
|
116
|
+
|
|
117
|
+
A Beta component is promoted to Stable when its design, behaviour, and technical model prove stable, accessible, token-aligned, and ready for high-quality implementation in both Design System Figma and frontend code. At this stage, it is reliable enough to become an official Design System asset used across all teams. A Stable component is done when it is well documented and easily consumable by building teams.
|
|
118
|
+
|
|
119
|
+
## Component Contribution
|
|
120
|
+
|
|
121
|
+
The full flow a component follows from a developer's first need through evaluation, promotion to Beta, and finally to Stable. The diagram covers both consumption, using an existing component, and contribution, building a new one, paths.
|
|
122
|
+
|
|
123
|
+
See the [Component Contribution diagram in FigJam](https://www.figma.com/board/3QqtZZ6FJbeXn4dXj2msdy/Design-System-Processes?node-id=1071-845&t=5tkoAE26K6g9etqn-4).
|
|
124
|
+
|
|
125
|
+
## Deprecation Workflow
|
|
126
|
+
|
|
127
|
+
When a Stable component is replaced or retired, it follows a phased deprecation flow that gives consumer teams time to migrate without surprise breakage. The flow runs from approval, through consumer mapping using `vue-component-analyzer`, through marking the component as deprecated in code and Storybook, through migration support, and ends with removal on or after the agreed removal date.
|
|
128
|
+
|
|
129
|
+
See the [Deprecation Workflow diagram in FigJam](https://www.figma.com/board/3QqtZZ6FJbeXn4dXj2msdy/Design-System-Processes?node-id=1071-818&t=5tkoAE26K6g9etqn-4).
|
|
130
|
+
|
|
131
|
+
| # | Step | Owner |
|
|
132
|
+
| - | ---- | ----- |
|
|
133
|
+
| 1 | **Approve:** confirm replacement, record reason, get sign-off | DS |
|
|
134
|
+
| 2 | **List consumers:** run `vue-component-analyzer` using the latest [main-scan](https://animated-funicular-jzw7q73.pages.github.io/pipeline/main-scan) | DS |
|
|
135
|
+
| 3 | **Set removal date:** the date after which the component may be removed. Default is 3 months after announcement. | DS + Eng |
|
|
136
|
+
| 4 | **Mark in code:** add JSDoc `@deprecated` on `.vue`, `types.ts`, and `index.ts` | DS |
|
|
137
|
+
| 5 | **Mark in Storybook:** use `tags: ['autodocs', 'deprecated']` and a `parameters.docs.description.component` banner | DS |
|
|
138
|
+
| 6 | **Write migration guide:** before/after, replacement, edge cases, codemod if cheap | DS |
|
|
139
|
+
| 7 | **Announce:** Design System Mattermost public channel, release notes, direct message each consumer team | DS |
|
|
140
|
+
| 8 | **Follow up:** track usage, remind lagging teams, offer pairing | DS |
|
|
141
|
+
| 9 | **Remove on or after removal date:** delete component, types, index export; link migration guide in release notes | DS |
|
|
142
|
+
|
|
143
|
+
### Reference Deprecation Pattern (`UiIconButton`)
|
|
144
|
+
|
|
145
|
+
The current `UiIconButton` deprecation in `frontend-hub/packages/ui-library/src/components/UiIconButton/` is the working example. JSDoc `@deprecated` is added on the `.vue` component, `types.ts`, and `index.ts`. The Storybook meta uses `tags: ['autodocs', 'deprecated']` with a `parameters.docs.description.component` banner that explains the migration path.
|
|
146
|
+
|
|
147
|
+
JSDoc on `*.vue`, `types.ts`, and `index.ts`:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated `UiIconButton` will be removed in `@aleph-alpha/ui-library` **v1.26.0**.
|
|
152
|
+
* It is being merged into `UiButton`. Use `UiButton` with an icon-only child and an
|
|
153
|
+
* `aria-label` instead.
|
|
154
|
+
*/
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Storybook meta:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const meta: Meta<typeof UiIconButton> = {
|
|
161
|
+
title: 'Components/UiIconButton',
|
|
162
|
+
component: UiIconButton,
|
|
163
|
+
tags: ['autodocs', 'deprecated'],
|
|
164
|
+
parameters: {
|
|
165
|
+
docs: {
|
|
166
|
+
description: {
|
|
167
|
+
component:
|
|
168
|
+
'> **Deprecated, scheduled for removal in `@aleph-alpha/ui-library` v1.26.0.** ' +
|
|
169
|
+
'`UiIconButton` is being merged into `UiButton`. Migrate to `UiButton` with an ' +
|
|
170
|
+
'icon-only child and an `aria-label` instead, e.g. ' +
|
|
171
|
+
'`<UiButton size="icon-sm" aria-label="Close"><UiIcon name="x" /></UiButton>`.',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
```
|
|
177
|
+
|
|
@@ -50,6 +50,21 @@ export default defineUiLibraryConfig()
|
|
|
50
50
|
|
|
51
51
|
This single call sets up everything: `presetWind4`, `presetAnimations`, `presetShadcn`, design token CSS variables (light/dark), token-based theme colors, semantic color overrides, typography classes, font loading, and content scanning.
|
|
52
52
|
|
|
53
|
+
### Configuration cases
|
|
54
|
+
|
|
55
|
+
Use `defineUiLibraryConfig()` for normal app setup. Reach for the lower-level exports only when you need to control preset order or compose the UI Library theme into an existing UnoCSS config.
|
|
56
|
+
|
|
57
|
+
| Case | Config | Use when |
|
|
58
|
+
| ---- | ------ | -------- |
|
|
59
|
+
| Default UI Library setup | `defineUiLibraryConfig()` | New apps or apps that can let the UI Library own the UnoCSS preset stack. This is the recommended path. |
|
|
60
|
+
| Token overrides | `defineUiLibraryConfig({ extend })` | You need to override a small set of CSS variables while keeping the default token theme. |
|
|
61
|
+
| Accessible token set | `defineUiLibraryConfig({ themeMode: 'accessible' })` or `defineUiLibraryConfig({ accessible: true })` | The app should use the WCAG 2.2 token set as its main theme. |
|
|
62
|
+
| Runtime accessible theme | `defineUiLibraryConfig({ accessibleTheme: true })` | The app should emit both default and accessible token CSS so users can toggle the accessible theme with `html.accessible-theme`. |
|
|
63
|
+
| Manual preset composition | `presetUiLibraryThemeFromTokens()` and `presetUiLibraryUtils()` | You already have a custom UnoCSS config and need explicit control over preset order. |
|
|
64
|
+
| Fully custom theme | `presetUiLibraryTheme(theme)` | You want to provide complete light/dark CSS variable maps instead of deriving them from `tokens.json`. |
|
|
65
|
+
|
|
66
|
+
The generated token utilities use semantic class names such as `bg-background-surface-secondary`, `bg-background-surface-floating`, `bg-background-input-default`, and `border-border-surface-default`. Prefer those explicit token classes when styling UI Library components.
|
|
67
|
+
|
|
53
68
|
To customize the theme:
|
|
54
69
|
|
|
55
70
|
```typescript
|
|
@@ -59,6 +74,8 @@ import { defineUiLibraryConfig } from '@aleph-alpha/ui-library/config'
|
|
|
59
74
|
export default defineUiLibraryConfig({
|
|
60
75
|
// Override specific theme variables
|
|
61
76
|
extend: { light: { primary: '#ff5500' } },
|
|
77
|
+
// Configure the root rem base used by typography and spacing utilities
|
|
78
|
+
rootFontSize: '100%',
|
|
62
79
|
// Add your own presets
|
|
63
80
|
presets: [myCustomPreset()],
|
|
64
81
|
})
|
|
@@ -74,6 +91,9 @@ export default defineUiLibraryConfig({
|
|
|
74
91
|
// Root and dark selectors used for generated CSS variables
|
|
75
92
|
rootSelector: ':root',
|
|
76
93
|
darkSelector: 'html.dark',
|
|
94
|
+
// Root font-size for the rem base. Strings are used as CSS values;
|
|
95
|
+
// numbers are treated as px.
|
|
96
|
+
rootFontSize: '100%',
|
|
77
97
|
// Include all token vars like --background-surface-secondary
|
|
78
98
|
includeAllTokens: true,
|
|
79
99
|
// Extend token-derived theme values
|
|
@@ -89,6 +109,29 @@ export default defineUiLibraryConfig({
|
|
|
89
109
|
})
|
|
90
110
|
```
|
|
91
111
|
|
|
112
|
+
To make the accessible token set the main theme:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// uno.config.ts
|
|
116
|
+
import { defineUiLibraryConfig } from '@aleph-alpha/ui-library/config'
|
|
117
|
+
|
|
118
|
+
export default defineUiLibraryConfig({
|
|
119
|
+
themeMode: 'accessible',
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
To emit an additional accessible-theme block for runtime toggles:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// uno.config.ts
|
|
127
|
+
import { defineUiLibraryConfig } from '@aleph-alpha/ui-library/config'
|
|
128
|
+
|
|
129
|
+
export default defineUiLibraryConfig({
|
|
130
|
+
accessibleTheme: true,
|
|
131
|
+
accessibleSelector: 'html.accessible-theme',
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
92
135
|
<details>
|
|
93
136
|
<summary>Advanced: manual preset composition</summary>
|
|
94
137
|
|
|
@@ -198,9 +241,9 @@ All config functions are exported from `@aleph-alpha/ui-library/config`:
|
|
|
198
241
|
|
|
199
242
|
| Export | Description |
|
|
200
243
|
|--------|-------------|
|
|
201
|
-
| `defineUiLibraryConfig(options?)` | **Recommended.** Complete UnoCSS config with all presets, content scanning, fonts, and tokens. Options
|
|
244
|
+
| `defineUiLibraryConfig(options?)` | **Recommended.** Complete UnoCSS config with all presets, content scanning, fonts, and tokens. Options include `extend`, `theme`, `themeMode`, `accessible`, `accessibleTheme`, `accessibleSelector`, `rootSelector`, `darkSelector`, `rootFontSize`, `includeAllTokens`, `presets`, `rules`, `shortcuts`, and any other UnoCSS config |
|
|
202
245
|
| `getUiLibraryContentConfig()` | UnoCSS content/pipeline config to scan library classes |
|
|
203
|
-
| `presetUiLibraryThemeFromTokens(options?)` | Token preset. Bundles token CSS variables, theme colors, border radius utilities, semantic overrides, and typography classes. Options
|
|
246
|
+
| `presetUiLibraryThemeFromTokens(options?)` | Token preset. Bundles token CSS variables, theme colors, border radius utilities, semantic overrides, and typography classes. Options include `extend`, `theme`, `themeMode`, `accessible`, `accessibleTheme`, `accessibleSelector`, `rootSelector`, `darkSelector`, `rootFontSize`, and `includeAllTokens` |
|
|
204
247
|
| `presetUiLibraryUtils()` | Utility rules required by library components (`w-(--var)`, `h-(--var)`, etc.) |
|
|
205
248
|
| `presetUiLibraryTheme(theme, options?)` | Low-level preset with manually provided theme variables (for custom themes) |
|
|
206
249
|
| `getUiLibraryThemeFromTokens()` | Returns the raw theme object derived from `tokens.json` |
|
|
@@ -208,6 +251,7 @@ All config functions are exported from `@aleph-alpha/ui-library/config`:
|
|
|
208
251
|
| `getUiLibraryTokenColors()` | Returns UnoCSS theme colors config for all token-based colors (included automatically by `presetUiLibraryThemeFromTokens`) |
|
|
209
252
|
| `getUiLibraryTokenBorderRadius()` | Returns UnoCSS `theme.borderRadius` config from corner-radius tokens (included automatically by `presetUiLibraryThemeFromTokens`) |
|
|
210
253
|
| `getUiLibraryTypographyShortcuts()` | Returns typography class definitions as `[className, cssProperties]` tuples (included automatically by `presetUiLibraryThemeFromTokens`) |
|
|
254
|
+
| `vHoverOverlayVariants` | Shared variant names for the `v-hover` overlay directive: `subtle`, `default`, and `strong` |
|
|
211
255
|
| `defineThemeConfig(config)` | Type-safe helper for external theme config files |
|
|
212
256
|
|
|
213
257
|
---
|
|
@@ -237,8 +281,8 @@ npx @aleph-alpha/lib-mcp mcp-install --cursor
|
|
|
237
281
|
|
|
238
282
|
| Tool | Description |
|
|
239
283
|
|------|-------------|
|
|
240
|
-
| `list_components` | Browse all components, optionally filter by name
|
|
241
|
-
| `get_component_docs` | Get full documentation for a component including props, examples, and usage |
|
|
284
|
+
| `list_components` | Browse all components, optionally filter by name, category, description, or Storybook label such as `beta`, `experimental`, or `deprecated` |
|
|
285
|
+
| `get_component_docs` | Get full documentation for a component including labels, props, examples, and usage |
|
|
242
286
|
| `get_setup_guide` | Get this setup guide (so AI assistants can configure projects correctly) |
|
|
243
287
|
|
|
244
288
|
### Or add the server manually
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/ui-library",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/system/lib.js",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"test:all": "Runs all tests (unit + storybook)",
|
|
41
41
|
"storybook": "Starts interactive Storybook development server on port 6006 for local component development",
|
|
42
42
|
"chromatic": "Runs Chromatic visual regression against the Storybook build (requires CHROMATIC_PROJECT_TOKEN)",
|
|
43
|
-
"test:e2e": "Runs end-to-end integration tests with Playwright"
|
|
43
|
+
"test:e2e": "Runs end-to-end integration tests with Playwright",
|
|
44
|
+
"tag-component": "Adds experimental/beta/deprecated lifecycle tags or removes them with stable for a component story and props JSDoc"
|
|
44
45
|
},
|
|
45
46
|
"homepage": "https://docs.aleph-alpha.com",
|
|
46
47
|
"devDependencies": {
|
|
@@ -79,8 +80,8 @@
|
|
|
79
80
|
"vue-tsc": "^2.2.12",
|
|
80
81
|
"wait-on": "9.0.3",
|
|
81
82
|
"@aleph-alpha/eslint-config-frontend": "0.6.0",
|
|
82
|
-
"@aleph-alpha/
|
|
83
|
-
"@aleph-alpha/
|
|
83
|
+
"@aleph-alpha/prettier-config-frontend": "2.1.0",
|
|
84
|
+
"@aleph-alpha/tsconfig-frontend": "0.7.0"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
87
|
"@unocss/preset-wind4": ">=66.0.0",
|
|
@@ -131,6 +132,7 @@
|
|
|
131
132
|
"build-storybook": "storybook build",
|
|
132
133
|
"chromatic": "npx chromatic --build-script-name=build-storybook --exit-zero-on-changes",
|
|
133
134
|
"test:e2e": "playwright test",
|
|
135
|
+
"tag-component": "node scripts/tag-component.mjs",
|
|
134
136
|
"publish:local": "yalc publish && yalc push --sig"
|
|
135
137
|
}
|
|
136
138
|
}
|
|
@@ -13,13 +13,11 @@ export type UiAutocompleteOption = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Filterable select input for choosing one or many options.
|
|
17
17
|
*
|
|
18
|
-
* This component is currently beta. Its API and behavior may still change
|
|
19
|
-
* before it is considered stable.
|
|
20
18
|
* @category Form Inputs
|
|
21
19
|
* @useCases autocomplete, searchable select, multi select, command picker
|
|
22
|
-
* @keywords autocomplete, combobox, select, search, filter, multi-select
|
|
20
|
+
* @keywords autocomplete, combobox, select, search, filter, multi-select
|
|
23
21
|
* @related UiSelect, UiTagsInput, UiListbox
|
|
24
22
|
*/
|
|
25
23
|
export type UiAutocompleteProps = {
|