Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/Autocomplete/Autocomplete.story.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref } from 'vue'
import { reactive, ref } from 'vue'
import Autocomplete from './Autocomplete.vue'

const single = ref()
Expand Down Expand Up @@ -36,6 +36,11 @@ const options = [
image: 'https://randomuser.me/api/portraits/women/51.jpg',
},
]


const state = reactive({
disabled: false,
})
</script>
<template>
<Story :layout="{ width: 500, type: 'grid' }" autoPropsDisabled>
Expand All @@ -44,6 +49,7 @@ const options = [
<Autocomplete
:options="options"
v-model="single"
:disabled="state.disabled"
placeholder="Select person"
/>
</div>
Expand All @@ -53,6 +59,7 @@ const options = [
<Autocomplete
:options="options"
v-model="single"
:disabled="state.disabled"
placeholder="Select person"
>
<template #prefix>
Expand All @@ -73,6 +80,7 @@ const options = [
<Autocomplete
:options="options"
v-model="single"
:disabled="state.disabled"
placeholder="Select person"
:hideSearch="true"
/>
Expand All @@ -83,6 +91,7 @@ const options = [
<Autocomplete
:options="options"
v-model="people"
:disabled="state.disabled"
placeholder="Select people"
:multiple="true"
:compareFn="(a, b) => a.value === b.value"
Expand All @@ -94,11 +103,16 @@ const options = [
<Autocomplete
:options="options"
v-model="people"
:disabled="state.disabled"
placeholder="Select people"
:multiple="true"
:hideSearch="true"
/>
</div>
</Variant>

<template #controls>
<HstCheckbox v-model="state.disabled" title="Disabled" />
</template>
</Story>
</template>
1 change: 1 addition & 0 deletions src/components/Autocomplete/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
class="flex h-7 w-full items-center justify-between gap-2 rounded bg-surface-gray-2 px-2 py-1 transition-colors hover:bg-surface-gray-3 border border-transparent focus:border-outline-gray-4 focus:outline-none focus:ring-2 focus:ring-outline-gray-3"
:class="{ 'bg-surface-gray-3': isComboboxOpen }"
@click="() => togglePopover()"
:disabled="props.disabled"
>
<div class="flex items-center overflow-hidden">
<slot name="prefix" />
Expand Down
1 change: 1 addition & 0 deletions src/components/Autocomplete/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type AutocompleteProps = {
showFooter?: boolean
compareFn?: (a: Option, b: Option) => boolean
maxOptions?: number
disabled?: boolean
} & (
| {
multiple: true
Expand Down