diff --git a/src/runtime/components/SelectMenu.vue b/src/runtime/components/SelectMenu.vue index cd5db1ff..a6238c31 100644 --- a/src/runtime/components/SelectMenu.vue +++ b/src/runtime/components/SelectMenu.vue @@ -33,11 +33,10 @@ export interface SelectMenuProps extends Pick, 'modelVal placeholder?: string /** * Wether to display the search input or not. - * @defaultValue true + * Can be an object to pass additional props to the input. + * @defaultValue { placeholder: 'Search...' } */ - search?: boolean - /** The placeholder text when the search input is empty. */ - searchPlaceholder?: string + searchInput?: boolean | { placeholder?: string } color?: SelectMenuVariants['color'] variant?: SelectMenuVariants['variant'] size?: SelectMenuVariants['size'] @@ -123,7 +122,7 @@ const props = withDefaults(defineProps>(), { search: true, portal: true, autofocusDelay: 0, - searchPlaceholder: 'Search...', + searchInput: () => ({ placeholder: 'Search...' }), filter: () => ['label'] }) const emits = defineEmits>() @@ -246,7 +245,13 @@ function onUpdateOpen(value: boolean) { - + diff --git a/test/components/SelectMenu.spec.ts b/test/components/SelectMenu.spec.ts index 334087c7..e2cb4ddb 100644 --- a/test/components/SelectMenu.spec.ts +++ b/test/components/SelectMenu.spec.ts @@ -44,8 +44,8 @@ describe('SelectMenu', () => { ['with id', { props: { ...props, id: 'id' } }], ['with name', { props: { ...props, name: 'name' } }], ['with placeholder', { props: { ...props, placeholder: 'Search...' } }], - ['with searchPlaceholder', { props: { ...props, searchPlaceholder: 'Filter items...' } }], - ['without search', { props: { ...props, search: false } }], + ['without searchInput', { props: { ...props, searchInput: false } }], + ['with searchInput placeholder', { props: { ...props, searchInput: { placeholder: 'Filter items...' } } }], ['with disabled', { props: { ...props, disabled: true } }], ['with required', { props: { ...props, required: true } }], ['with icon', { props: { ...props, icon: 'i-heroicons-magnifying-glass' } }], diff --git a/test/components/__snapshots__/SelectMenu.spec.ts.snap b/test/components/__snapshots__/SelectMenu.spec.ts.snap index b910ac7d..4d900fff 100644 --- a/test/components/__snapshots__/SelectMenu.spec.ts.snap +++ b/test/components/__snapshots__/SelectMenu.spec.ts.snap @@ -8,7 +8,7 @@ exports[`SelectMenu > renders with arrow correctly 1`] = `
-
+