From 81629c74b8c754bbb920bef3d678716df831c5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=BCrgin-Fix?= Date: Tue, 11 Aug 2026 20:36:30 +0200 Subject: [PATCH] Let an optional SearchableSelect be cleared again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SearchableSelect picks from a closed set and only ever emits option.value, so once anything was picked there was no gesture that returned to "nothing chosen" — a trap for nullable fields like the consuming app's store-dialog select. A new `clearable` prop shows an ✕ (accessible name via `clear-label`) that emits '' — the native Select's placeholder payload, so non-clearable call sites' types stay untouched — and hands focus back to the trigger. Pinned by the Clearable story. Co-Authored-By: Claude Fable 5 --- CHANGELOG.md | 39 ++++++++++++++ package.json | 2 +- .../molecules/SearchableSelect.stories.ts | 47 +++++++++++++++++ src/components/molecules/SearchableSelect.vue | 51 ++++++++++++++++++- 4 files changed, 136 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2afc18..cd73ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,45 @@ All notable changes to `@codebar-ag/storybook`. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## v1.21.0 + +### Added + +- **`SearchableSelect` accepts `clearable`** (plus `clear-label` for the ✕'s + accessible name, default "Clear selection"). While something is selected, an + ✕ appears between the label and the chevron; pressing it emits + `update:modelValue` with `''` and hands focus back to the trigger. + + Without it the control is a trap for OPTIONAL values: it picks from a closed + set and only ever emits `option.value`, so once anything is picked there is + no gesture that returns to "nothing chosen". The consuming app hit this on + its data-source form — the store-dialog field is nullable all the way down + (`'nullable'` in the FormRequest, `?? null` on submit), but a user who + selected a dialog could never unselect it short of reloading the page. Its + sibling controls both already had an exit: the native `Select` renders a + selectable placeholder `