Skip to content

Commit 58571ae

Browse files
committed
fix(combobox): fix ComboboxInput height for soft variant
1 parent b86b1eb commit 58571ae

File tree

4 files changed

+130
-2
lines changed

4 files changed

+130
-2
lines changed

docs/content/components/combobox.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,13 @@ The root element of a combobox, it contains all the parts of a combobox.
4949
### Multiple
5050

5151
<Example name="combobox/Multiple.vue" variant="hide" />
52+
53+
### Variant
54+
55+
The input field supports two variants: `soft` and `surface`.
56+
57+
<Example name="combobox/InputVariant.vue" />
58+
59+
The content popup supports two variants: `soft` and `solid`.
60+
61+
<Example name="combobox/ContentVariant.vue" />
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<script setup lang="ts">
2+
import {
3+
ComboboxRoot,
4+
ComboboxContent,
5+
ComboboxItem,
6+
ComboboxInput,
7+
ComboboxEmpty,
8+
} from '#components'
9+
10+
const fruits = [
11+
{ name: 'Apple' },
12+
{ name: 'Banana' },
13+
{ name: 'Orange' },
14+
{ name: 'Honeydew' },
15+
{ name: 'Grapes' },
16+
{ name: 'Watermelon' },
17+
{ name: 'Cantaloupe' },
18+
{ name: 'Pear' },
19+
]
20+
</script>
21+
22+
<template>
23+
<div class="flex flex-items gap-4">
24+
<ComboboxRoot>
25+
<ComboboxInput placeholder="Select fruit..." />
26+
<ComboboxContent variant="soft">
27+
<ComboboxItem
28+
v-for="option in fruits"
29+
:key="option.name"
30+
:value="option.name"
31+
>
32+
{{ option.name }}
33+
</ComboboxItem>
34+
<ComboboxEmpty>
35+
<span>No fruit found</span>
36+
</ComboboxEmpty>
37+
</ComboboxContent>
38+
</ComboboxRoot>
39+
40+
<ComboboxRoot>
41+
<ComboboxInput placeholder="Select fruit..." />
42+
<ComboboxContent variant="solid">
43+
<ComboboxItem
44+
v-for="option in fruits"
45+
:key="option.name"
46+
:value="option.name"
47+
>
48+
{{ option.name }}
49+
</ComboboxItem>
50+
<ComboboxEmpty>
51+
<span>No fruit found</span>
52+
</ComboboxEmpty>
53+
</ComboboxContent>
54+
</ComboboxRoot>
55+
</div>
56+
</template>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<script setup lang="ts">
2+
import {
3+
ComboboxRoot,
4+
ComboboxContent,
5+
ComboboxItem,
6+
ComboboxInput,
7+
ComboboxEmpty,
8+
} from '#components'
9+
10+
const fruits = [
11+
{ name: 'Apple' },
12+
{ name: 'Banana' },
13+
{ name: 'Orange' },
14+
{ name: 'Honeydew' },
15+
{ name: 'Grapes' },
16+
{ name: 'Watermelon' },
17+
{ name: 'Cantaloupe' },
18+
{ name: 'Pear' },
19+
]
20+
</script>
21+
22+
<template>
23+
<div class="flex flex-items gap-4">
24+
<ComboboxRoot>
25+
<ComboboxInput placeholder="Select fruit..." variant="soft" />
26+
<ComboboxContent>
27+
<ComboboxItem
28+
v-for="option in fruits"
29+
:key="option.name"
30+
:value="option.name"
31+
>
32+
{{ option.name }}
33+
</ComboboxItem>
34+
<ComboboxEmpty>
35+
<span>No fruit found</span>
36+
</ComboboxEmpty>
37+
</ComboboxContent>
38+
</ComboboxRoot>
39+
40+
<ComboboxRoot>
41+
<ComboboxInput placeholder="Select fruit..." variant="surface" />
42+
<ComboboxContent>
43+
<ComboboxItem
44+
v-for="option in fruits"
45+
:key="option.name"
46+
:value="option.name"
47+
>
48+
{{ option.name }}
49+
</ComboboxItem>
50+
<ComboboxEmpty>
51+
<span>No fruit found</span>
52+
</ComboboxEmpty>
53+
</ComboboxContent>
54+
</ComboboxRoot>
55+
</div>
56+
</template>

src/components/combobox/ComboboxInput.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ watch(values, () => {
194194
background-color: transparent;
195195
border-radius: calc(var(--combobox-field-border-radius) - var(--combobox-field-border-width));
196196
text-indent: var(--combobox-field-padding);
197-
height: calc(var(--combobox-field-height) - var(--space-1));
197+
height: var(--combobox-input-height);
198198
cursor: auto;
199199
}
200200
@@ -228,7 +228,7 @@ watch(values, () => {
228228
order: 0;
229229
margin-left: 0;
230230
margin-right: calc(var(--combobox-field-border-width) * -1);
231-
height: calc(var(--combobox-field-height) - 4px);
231+
height: var(--combobox-trigger-height);
232232
}
233233
:where(.r-size-1) .ui-ComboboxField {
234234
--combobox-field-height: var(--space-5);
@@ -303,6 +303,9 @@ watch(values, () => {
303303
--combobox-field-focus-color: var(--focus-a8);
304304
--combobox-field-border-width: 1px;
305305
--combobox-field-border-color: var(--gray-a7);
306+
--combobox-input-height: calc(var(--combobox-field-height) - var(--space-1));
307+
--combobox-trigger-height: calc(var(--combobox-field-height) - var(--space-1));
308+
306309
/* Blend inner shadow with page background */
307310
background-clip: content-box;
308311
background-color: var(--color-surface);
@@ -333,6 +336,9 @@ watch(values, () => {
333336
--combobox-field-selection-color: var(--accent-a5);
334337
--combobox-field-focus-color: var(--accent-8);
335338
--combobox-field-border-width: 0px;
339+
--combobox-input-height: var(--combobox-field-height);
340+
--combobox-trigger-height: var(--combobox-field-height);
341+
336342
background-color: var(--accent-a3);
337343
color: var(--accent-12);
338344
}

0 commit comments

Comments
 (0)