v0.19.2 — Combobox: always show "Add new…" when allowCustom
Previously the "Add" option only appeared after typing a non-matching query, which wasn't discoverable. Now the combobox always shows "Add new…" at the bottom when allowCustom=true; clicking it focuses the search input so you can type the new name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -110,20 +110,33 @@ export function Combobox({ options, value, onChange, placeholder = "Select…",
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{filtered.length === 0 && !showAdd && (
|
{filtered.length === 0 && !allowCustom && (
|
||||||
<p className="px-3 py-4 text-sm text-muted-foreground text-center">{emptyText}</p>
|
<p className="px-3 py-4 text-sm text-muted-foreground text-center">{emptyText}</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Add custom option */}
|
{/* Add custom option — shows as "Add '[query]'" when typing, or "+ New" hint when idle */}
|
||||||
{showAdd && (
|
{allowCustom && (
|
||||||
|
<div className="border-t mt-1">
|
||||||
|
{showAdd ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="w-full text-left px-3 py-2 text-sm hover:bg-accent flex items-center gap-2 text-primary border-t mt-1"
|
className="w-full text-left px-3 py-2 text-sm hover:bg-accent flex items-center gap-2 text-primary"
|
||||||
onClick={() => pick(trimmed)}
|
onClick={() => pick(trimmed)}
|
||||||
>
|
>
|
||||||
<Plus className="h-3.5 w-3.5 shrink-0" />
|
<Plus className="h-3.5 w-3.5 shrink-0" />
|
||||||
Add “{trimmed}”
|
Add “{trimmed}”
|
||||||
</button>
|
</button>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="w-full text-left px-3 py-2 text-sm hover:bg-accent flex items-center gap-2 text-muted-foreground"
|
||||||
|
onClick={() => inputRef.current?.focus()}
|
||||||
|
>
|
||||||
|
<Plus className="h-3.5 w-3.5 shrink-0" />
|
||||||
|
Add new…
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Popover.Content>
|
</Popover.Content>
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ export type ChangelogEntry = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CHANGELOG: ChangelogEntry[] = [
|
export const CHANGELOG: ChangelogEntry[] = [
|
||||||
|
{
|
||||||
|
version: "0.19.2",
|
||||||
|
date: "2026-06-29",
|
||||||
|
changes: [
|
||||||
|
"Pantry: \"Add new…\" now shows at the bottom of the Category and Subcategory dropdowns at all times — click it, type the new name, and it becomes the \"Add [name]\" option.",
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
version: "0.19.1",
|
version: "0.19.1",
|
||||||
date: "2026-06-29",
|
date: "2026-06-29",
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// Bump on every user-visible release. Changelog entries live in `src/lib/changelog.ts`.
|
// Bump on every user-visible release. Changelog entries live in `src/lib/changelog.ts`.
|
||||||
export const APP_VERSION = "0.19.1";
|
export const APP_VERSION = "0.19.2";
|
||||||
|
|||||||
Reference in New Issue
Block a user