@aleph-alpha/ui-library 2.9.0 → 2.11.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.
Files changed (32) hide show
  1. package/config.js +10 -0
  2. package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +0 -1
  3. package/dist/system/components/UiAutocomplete/types.d.ts +2 -6
  4. package/dist/system/components/UiSelect/UiSelect.vue.d.ts +4 -5
  5. package/dist/system/components/UiSelect/UiSelectContent.vue.d.ts +0 -1
  6. package/dist/system/components/UiSelect/UiSelectItem.vue.d.ts +2 -9
  7. package/dist/system/components/UiSelect/UiSelectTrigger.vue.d.ts +0 -2
  8. package/dist/system/components/UiSelect/UiSelectValue.vue.d.ts +0 -3
  9. package/dist/system/components/UiSelect/types.d.ts +26 -6
  10. package/dist/system/lib.js +18370 -18530
  11. package/dist/system/patterns/UiDataTable/UiDataTableToolbar.vue.d.ts +2 -2
  12. package/docs/public-docs/component-lifecycle.md +177 -0
  13. package/docs/public-docs/quick-start.md +43 -4
  14. package/package.json +5 -3
  15. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +1 -1
  16. package/src/components/UiAutocomplete/UiAutocomplete.vue +9 -9
  17. package/src/components/UiAutocomplete/__tests__/UiAutocomplete.test.ts +76 -5
  18. package/src/components/UiAutocomplete/types.ts +2 -6
  19. package/src/components/UiSelect/UiSelect.stories.ts +4 -90
  20. package/src/components/UiSelect/UiSelect.vue +66 -144
  21. package/src/components/UiSelect/UiSelectContent.vue +10 -21
  22. package/src/components/UiSelect/UiSelectItem.vue +0 -82
  23. package/src/components/UiSelect/UiSelectTrigger.vue +1 -62
  24. package/src/components/UiSelect/UiSelectValue.vue +1 -47
  25. package/src/components/UiSelect/__tests__/UiSelect.test.ts +47 -98
  26. package/src/components/UiSelect/__tests__/UiSelectContent.test.ts +36 -3
  27. package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +1 -1
  28. package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +2 -2
  29. package/src/components/UiSelect/types.ts +29 -6
  30. package/src/patterns/UiDataTable/UiDataTableToolbar.vue +1 -1
  31. package/dist/system/components/UiSelect/context.d.ts +0 -28
  32. package/src/components/UiSelect/context.ts +0 -42
@@ -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
@@ -94,6 +109,29 @@ export default defineUiLibraryConfig({
94
109
  })
95
110
  ```
96
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
+
97
135
  <details>
98
136
  <summary>Advanced: manual preset composition</summary>
99
137
 
@@ -203,9 +241,9 @@ All config functions are exported from `@aleph-alpha/ui-library/config`:
203
241
 
204
242
  | Export | Description |
205
243
  |--------|-------------|
206
- | `defineUiLibraryConfig(options?)` | **Recommended.** Complete UnoCSS config with all presets, content scanning, fonts, and tokens. Options: `extend`, `darkSelector`, `presets`, `rules`, `shortcuts`, and any other UnoCSS config |
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 |
207
245
  | `getUiLibraryContentConfig()` | UnoCSS content/pipeline config to scan library classes |
208
- | `presetUiLibraryThemeFromTokens(options?)` | Token preset. Bundles token CSS variables, theme colors, border radius utilities, semantic overrides, and typography classes. Options: `darkSelector` (default: `'html.dark'`), `includeAllTokens` (default: `true`), `extend`, `theme` |
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` |
209
247
  | `presetUiLibraryUtils()` | Utility rules required by library components (`w-(--var)`, `h-(--var)`, etc.) |
210
248
  | `presetUiLibraryTheme(theme, options?)` | Low-level preset with manually provided theme variables (for custom themes) |
211
249
  | `getUiLibraryThemeFromTokens()` | Returns the raw theme object derived from `tokens.json` |
@@ -213,6 +251,7 @@ All config functions are exported from `@aleph-alpha/ui-library/config`:
213
251
  | `getUiLibraryTokenColors()` | Returns UnoCSS theme colors config for all token-based colors (included automatically by `presetUiLibraryThemeFromTokens`) |
214
252
  | `getUiLibraryTokenBorderRadius()` | Returns UnoCSS `theme.borderRadius` config from corner-radius tokens (included automatically by `presetUiLibraryThemeFromTokens`) |
215
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` |
216
255
  | `defineThemeConfig(config)` | Type-safe helper for external theme config files |
217
256
 
218
257
  ---
@@ -242,8 +281,8 @@ npx @aleph-alpha/lib-mcp mcp-install --cursor
242
281
 
243
282
  | Tool | Description |
244
283
  |------|-------------|
245
- | `list_components` | Browse all components, optionally filter by name/category/description |
246
- | `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 |
247
286
  | `get_setup_guide` | Get this setup guide (so AI assistants can configure projects correctly) |
248
287
 
249
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.9.0",
3
+ "version": "2.11.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": {
@@ -80,7 +81,7 @@
80
81
  "wait-on": "9.0.3",
81
82
  "@aleph-alpha/eslint-config-frontend": "0.6.0",
82
83
  "@aleph-alpha/prettier-config-frontend": "2.1.0",
83
- "@aleph-alpha/tsconfig-frontend": "0.6.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
  }
@@ -31,7 +31,7 @@ const fruitsWithMeta = [
31
31
  const meta: Meta<typeof UiAutocomplete> = {
32
32
  title: 'Components/UiAutocomplete',
33
33
  component: UiAutocomplete,
34
- tags: ['autodocs', 'beta'],
34
+ tags: ['autodocs'],
35
35
  argTypes: {
36
36
  multiple: {
37
37
  control: 'boolean',
@@ -30,7 +30,6 @@ const props = withDefaults(defineProps<UiAutocompleteProps>(), {
30
30
  required: false,
31
31
  name: undefined,
32
32
  dir: 'ltr',
33
- size: 'default',
34
33
  emptyText: 'No results found.',
35
34
  startIcon: undefined,
36
35
  showIndicator: true,
@@ -97,8 +96,10 @@ const displayText = computed(() =>
97
96
  selectedOptions.value.map((option) => option.label).join(', '),
98
97
  );
99
98
 
99
+ const hasSelection = computed(() => selectedValues.value.length > 0);
100
+
100
101
  const showSelectionDisplay = computed(
101
- () => inputText.value.length === 0 && selectedValues.value.length > 0,
102
+ () => inputText.value.length === 0 && hasSelection.value,
102
103
  );
103
104
 
104
105
  const filteredOptions = computed(() => {
@@ -142,8 +143,7 @@ const inputSlotProps = computed(() => ({
142
143
 
143
144
  const shellClasses = computed(() =>
144
145
  cn(
145
- 'border-input focus-within:border-border-surface-focus-ring focus-within:ring-ring/50 focus-within:shadow-xs aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full min-w-0 items-center gap-2 rounded-md border bg-background-input-default px-3 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-within:ring-[3px]',
146
- props.size === 'default' ? 'h-9 py-2' : 'h-8 py-1.5',
146
+ 'border-input data-[placeholder]:bg-background-input-default [&:not([data-placeholder])]:border-border-surface-focus-ring focus-within:border-border-surface-focus-ring focus-within:ring-ring/50 focus-within:shadow-xs aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-full min-w-0 items-center gap-2 rounded-md border bg-accent px-3 py-2 text-sm transition-[color,box-shadow] outline-none focus-within:ring-[3px]',
147
147
  props.disabled && 'pointer-events-none cursor-not-allowed opacity-50',
148
148
  ),
149
149
  );
@@ -282,10 +282,6 @@ function syncHighlightToSelection() {
282
282
 
283
283
  function setHighlightedIndex(index: number) {
284
284
  highlightedIndex.value = index;
285
- const value = keyboardValues.value[index];
286
- if (!props.multiple && value) {
287
- applySelectionValue(value, false);
288
- }
289
285
  }
290
286
 
291
287
  function applySelectionValue(
@@ -317,7 +313,11 @@ provideUiAutocompleteContext({
317
313
  <div class="flex flex-col" :dir="props.dir">
318
314
  <ShadcnPopover v-model:open="openState">
319
315
  <ShadcnPopoverAnchor as-child>
320
- <div data-slot="autocomplete-trigger" :class="shellClasses">
316
+ <div
317
+ data-slot="autocomplete-trigger"
318
+ :data-placeholder="hasSelection ? undefined : ''"
319
+ :class="shellClasses"
320
+ >
321
321
  <UiIcon
322
322
  v-if="props.startIcon"
323
323
  :name="props.startIcon"
@@ -1,5 +1,5 @@
1
1
  import '@testing-library/jest-dom/vitest';
2
- import { render, waitFor } from '@testing-library/vue';
2
+ import { fireEvent, render, waitFor } from '@testing-library/vue';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { describe, expect, test, vi } from 'vitest';
5
5
  import { ref } from 'vue';
@@ -25,6 +25,42 @@ describe('UiAutocomplete', () => {
25
25
  expect(input).toHaveAttribute('placeholder', 'Search fruit');
26
26
  });
27
27
 
28
+ test('uses the input surface when no value is selected', () => {
29
+ const { container } = render(UiAutocomplete, {
30
+ props: {
31
+ options,
32
+ placeholder: 'Search fruit',
33
+ },
34
+ });
35
+
36
+ const trigger = container.querySelector(
37
+ '[data-slot="autocomplete-trigger"]',
38
+ );
39
+ expect(trigger).toHaveAttribute('data-placeholder');
40
+ expect(trigger).toHaveClass(
41
+ 'data-[placeholder]:bg-background-input-default',
42
+ );
43
+ });
44
+
45
+ test('uses the filled select surface when a value is selected', () => {
46
+ const { container } = render(UiAutocomplete, {
47
+ props: {
48
+ options,
49
+ defaultValue: 'apple',
50
+ placeholder: 'Search fruit',
51
+ },
52
+ });
53
+
54
+ const trigger = container.querySelector(
55
+ '[data-slot="autocomplete-trigger"]',
56
+ );
57
+ expect(trigger).not.toHaveAttribute('data-placeholder');
58
+ expect(trigger).toHaveClass('bg-accent');
59
+ expect(trigger).toHaveClass(
60
+ '[&:not([data-placeholder])]:border-border-surface-focus-ring',
61
+ );
62
+ });
63
+
28
64
  test('opens suggestions and filters by input text', async () => {
29
65
  const user = userEvent.setup();
30
66
  const { getByRole, queryByRole } = render(UiAutocomplete, {
@@ -95,7 +131,7 @@ describe('UiAutocomplete', () => {
95
131
  );
96
132
  expect(
97
133
  document.querySelector('[data-slot="autocomplete-value"]'),
98
- ).toHaveTextContent('Apple');
134
+ ).not.toBeInTheDocument();
99
135
  });
100
136
 
101
137
  await user.keyboard('{ArrowDown}');
@@ -107,7 +143,7 @@ describe('UiAutocomplete', () => {
107
143
  );
108
144
  expect(
109
145
  document.querySelector('[data-slot="autocomplete-value"]'),
110
- ).toHaveTextContent('Banana');
146
+ ).not.toBeInTheDocument();
111
147
  });
112
148
 
113
149
  await user.keyboard('{Enter}');
@@ -140,6 +176,9 @@ describe('UiAutocomplete', () => {
140
176
  'data-highlighted',
141
177
  '',
142
178
  );
179
+ expect(
180
+ document.querySelector('[data-slot="autocomplete-value"]'),
181
+ ).toHaveTextContent('Banana');
143
182
  });
144
183
 
145
184
  await user.keyboard('{Enter}');
@@ -177,7 +216,7 @@ describe('UiAutocomplete', () => {
177
216
  );
178
217
  expect(
179
218
  document.querySelector('[data-slot="autocomplete-value"]'),
180
- ).toHaveTextContent('Apple');
219
+ ).not.toBeInTheDocument();
181
220
  });
182
221
 
183
222
  await user.keyboard('{ArrowDown}');
@@ -189,7 +228,7 @@ describe('UiAutocomplete', () => {
189
228
  );
190
229
  expect(
191
230
  document.querySelector('[data-slot="autocomplete-value"]'),
192
- ).toHaveTextContent('Banana');
231
+ ).not.toBeInTheDocument();
193
232
  });
194
233
 
195
234
  await user.keyboard('{Enter}');
@@ -226,6 +265,9 @@ describe('UiAutocomplete', () => {
226
265
  'data-highlighted',
227
266
  '',
228
267
  );
268
+ expect(
269
+ document.querySelector('[data-slot="autocomplete-value"]'),
270
+ ).toHaveTextContent('Banana');
229
271
  });
230
272
 
231
273
  await user.keyboard('{Enter}');
@@ -237,6 +279,35 @@ describe('UiAutocomplete', () => {
237
279
  });
238
280
  });
239
281
 
282
+ test('hovering an option highlights it without changing the selected value', async () => {
283
+ const user = userEvent.setup();
284
+ const { getByRole } = render({
285
+ components: { UiAutocomplete },
286
+ template: `
287
+ <UiAutocomplete v-model="value" :options="options" placeholder="Search fruit" />
288
+ `,
289
+ setup() {
290
+ const value = ref('apple');
291
+ return { value, options };
292
+ },
293
+ });
294
+
295
+ await user.click(getByRole('textbox'));
296
+ await waitFor(() => expect(getByRole('listbox')).toBeInTheDocument());
297
+
298
+ await fireEvent.pointerMove(getByRole('option', { name: 'Banana' }));
299
+
300
+ await waitFor(() => {
301
+ expect(getByRole('option', { name: 'Banana' })).toHaveAttribute(
302
+ 'data-highlighted',
303
+ '',
304
+ );
305
+ expect(
306
+ document.querySelector('[data-slot="autocomplete-value"]'),
307
+ ).toHaveTextContent('Apple');
308
+ });
309
+ });
310
+
240
311
  test('selects multiple options and keeps selected labels truncated in one value span', async () => {
241
312
  const user = userEvent.setup();
242
313
  const { getByRole } = render({
@@ -13,13 +13,11 @@ export type UiAutocompleteOption = {
13
13
  };
14
14
 
15
15
  /**
16
- * Beta: Filterable select input for choosing one or many options.
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, beta
20
+ * @keywords autocomplete, combobox, select, search, filter, multi-select
23
21
  * @related UiSelect, UiTagsInput, UiListbox
24
22
  */
25
23
  export type UiAutocompleteProps = {
@@ -55,8 +53,6 @@ export type UiAutocompleteProps = {
55
53
  name?: string;
56
54
  /** Reading direction. */
57
55
  dir?: 'ltr' | 'rtl';
58
- /** Trigger/input size. */
59
- size?: 'default' | 'sm';
60
56
  /** Text shown when filtering returns no options. */
61
57
  emptyText?: string;
62
58
  /** Optional leading icon name. */
@@ -14,7 +14,7 @@ import { UiIcon } from '@/components/UiIcon';
14
14
 
15
15
  /**
16
16
  * UiSelect is a trigger-and-dropdown primitive for choosing one option from a list, with grouped options, separators, and labels.
17
- * Use it for compact form selects; for filterable, multi-select, or always-visible lists, prefer `UiListbox`.
17
+ * Use it for compact form selects; for filterable or always-visible lists, prefer `UiListbox`.
18
18
  */
19
19
  const meta: Meta<typeof UiSelect> = {
20
20
  title: 'Components/UiSelect',
@@ -425,92 +425,6 @@ export const Disabled: Story = {
425
425
  },
426
426
  };
427
427
 
428
- const sizesTemplateSource = `<script setup lang="ts">
429
- import { ref } from 'vue'
430
- import {
431
- UiSelect,
432
- UiSelectTrigger,
433
- UiSelectContent,
434
- UiSelectItem,
435
- UiSelectValue,
436
- } from '@aleph-alpha/ui-library'
437
-
438
- const value = ref('')
439
- const value2 = ref('')
440
- </script>
441
-
442
- <template>
443
- <div class="flex items-center gap-4">
444
- <UiSelect v-model="value">
445
- <UiSelectTrigger ariaLabel="Select option" size="sm">
446
- <UiSelectValue placeholder="Small" />
447
- </UiSelectTrigger>
448
- <UiSelectContent>
449
- <UiSelectItem value="a">Option A</UiSelectItem>
450
- <UiSelectItem value="b">Option B</UiSelectItem>
451
- </UiSelectContent>
452
- </UiSelect>
453
- <UiSelect v-model="value2">
454
- <UiSelectTrigger ariaLabel="Select option" size="default">
455
- <UiSelectValue placeholder="Default" />
456
- </UiSelectTrigger>
457
- <UiSelectContent>
458
- <UiSelectItem value="a">Option A</UiSelectItem>
459
- <UiSelectItem value="b">Option B</UiSelectItem>
460
- </UiSelectContent>
461
- </UiSelect>
462
- </div>
463
- </template>`;
464
-
465
- /**
466
- * Different size variants for the select trigger (sm, default, lg).
467
- */
468
- export const Sizes: Story = {
469
- render: () => ({
470
- components: {
471
- UiSelect,
472
- UiSelectTrigger,
473
- UiSelectContent,
474
- UiSelectItem,
475
- UiSelectValue,
476
- },
477
- setup() {
478
- const value = ref('');
479
- const value2 = ref('');
480
- return { value, value2 };
481
- },
482
- template: `
483
- <div class="flex items-center gap-4">
484
- <UiSelect v-model="value">
485
- <UiSelectTrigger ariaLabel="Select option" size="sm">
486
- <UiSelectValue placeholder="Small" />
487
- </UiSelectTrigger>
488
- <UiSelectContent>
489
- <UiSelectItem value="a">Option A</UiSelectItem>
490
- <UiSelectItem value="b">Option B</UiSelectItem>
491
- </UiSelectContent>
492
- </UiSelect>
493
- <UiSelect v-model="value2">
494
- <UiSelectTrigger ariaLabel="Select option" size="default">
495
- <UiSelectValue placeholder="Default" />
496
- </UiSelectTrigger>
497
- <UiSelectContent>
498
- <UiSelectItem value="a">Option A</UiSelectItem>
499
- <UiSelectItem value="b">Option B</UiSelectItem>
500
- </UiSelectContent>
501
- </UiSelect>
502
- </div>
503
- `,
504
- }),
505
- parameters: {
506
- docs: {
507
- source: {
508
- code: sizesTemplateSource,
509
- },
510
- },
511
- },
512
- };
513
-
514
428
  const withDefaultValueTemplateSource = `<script setup lang="ts">
515
429
  import { ref } from 'vue'
516
430
  import {
@@ -571,8 +485,8 @@ const value = ref<string[]>([])
571
485
  </template>`;
572
486
 
573
487
  /**
574
- * Multi-select mode. Pass `multiple` to switch the trigger into a popover-backed
575
- * listbox. The popover stays open between clicks so users can toggle several
488
+ * Multi-select mode. Pass `multiple` to use the same select primitive with
489
+ * array values. The dropdown stays open between clicks so users can toggle several
576
490
  * items, the selected values are emitted as an array via `update:modelValue`,
577
491
  * and the trigger renders the selected items as a comma-separated list that
578
492
  * truncates with an ellipsis when it exceeds the trigger's width.
@@ -647,7 +561,7 @@ const value = ref<string[]>(['banana', 'mango'])
647
561
 
648
562
  /**
649
563
  * Multi-select with a pre-selected list of values. The trigger renders the
650
- * matching item labels even before the popover is opened.
564
+ * matching item labels even before the dropdown is opened.
651
565
  */
652
566
  export const MultipleWithDefaultValue: Story = {
653
567
  render: () => ({