Skip to content

Commit 48783ae

Browse files
authored
fix(input-dropdown): various fixes (#487)
1 parent e67c131 commit 48783ae

File tree

6 files changed

+53
-10
lines changed

6 files changed

+53
-10
lines changed

lib/components/SDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defineProps<{
2222
border: 1px solid var(--c-divider);
2323
border-radius: 6px;
2424
min-width: 288px;
25-
max-height: 384px;
25+
max-height: 364px;
2626
overflow-y: auto;
2727
white-space: normal;
2828

lib/components/SDropdownSectionFilter.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import IconCheck from '@iconify-icons/ph/check'
33
import Fuse from 'fuse.js'
44
import { type MaybeRef, computed, onMounted, ref, unref } from 'vue'
55
import { type DropdownSectionFilterOption, type DropdownSectionFilterSelectedValue } from '../composables/Dropdown'
6+
import { useTrans } from '../composables/Lang'
67
import { isArray } from '../support/Utils'
78
import SDropdownSectionFilterItem from './SDropdownSectionFilterItem.vue'
89
import SIcon from './SIcon.vue'
@@ -14,6 +15,17 @@ const props = defineProps<{
1415
onClick?(value: any): void
1516
}>()
1617
18+
const { t } = useTrans({
19+
en: {
20+
i_ph: 'Filter options',
21+
not_found: 'No options found.'
22+
},
23+
ja: {
24+
i_ph: 'オプションを検索',
25+
not_found: 'オプションが見つかりません。'
26+
}
27+
})
28+
1729
const input = ref<HTMLElement | null>(null)
1830
const query = ref('')
1931
@@ -60,7 +72,7 @@ function handleClick(option: DropdownSectionFilterOption, value: any) {
6072
<template>
6173
<div class="SDropdownSectionFilter">
6274
<div v-if="search" class="search">
63-
<input class="input" placeholder="Filter options" ref="input" v-model="query">
75+
<input class="input" :placeholder="t.i_ph" ref="input" v-model="query">
6476
</div>
6577

6678
<ul v-if="filteredOptions.length" class="list">
@@ -89,7 +101,7 @@ function handleClick(option: DropdownSectionFilterOption, value: any) {
89101
</ul>
90102

91103
<p v-else class="empty">
92-
No options found.
104+
{{ t.not_found }}
93105
</p>
94106
</div>
95107
</template>
@@ -105,6 +117,7 @@ function handleClick(option: DropdownSectionFilterOption, value: any) {
105117
z-index: 10;
106118
border-bottom: 1px solid var(--c-gutter);
107119
padding: 8px;
120+
background-color: var(--c-bg-elv-3);
108121
}
109122
110123
.input {
@@ -138,8 +151,7 @@ function handleClick(option: DropdownSectionFilterOption, value: any) {
138151
text-align: left;
139152
transition: color 0.25s, background-color 0.25s;
140153
141-
&:hover,
142-
&:focus {
154+
&:hover {
143155
background-color: var(--c-bg-mute-1);
144156
}
145157
}

lib/components/SDropdownSectionFilterItemAvatar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ defineProps<{
3131
.name {
3232
display: inline-block;
3333
padding-left: 8px;
34+
line-height: 20px;
3435
font-size: 14px;
3536
font-weight: 400;
3637
white-space: nowrap;

lib/components/SInputDropdownItemText.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import IconX from '@iconify-icons/ph/x'
2+
import IconX from '@iconify-icons/ph/x-bold'
33
import SIcon from './SIcon.vue'
44
55
defineProps<{

stories/components/SInputDropdown.01_Playground.story.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
import SInputDropdown from 'sefirot/components/SInputDropdown.vue'
2+
import SInputDropdown, { type OptionText } from 'sefirot/components/SInputDropdown.vue'
33
import { ref } from 'vue'
44
55
const title = 'Components / SInputDropdown / 01. Playground'
66
77
const value = ref<string[]>([])
88
9-
const options = [
9+
const options: OptionText[] = [
1010
{ label: 'Vue.js', value: 'vuejs' },
1111
{ label: 'Vite', value: 'vite' },
1212
{ label: 'Adonis', value: 'adonis' },
@@ -22,8 +22,7 @@ const options = [
2222
<Board :title="title">
2323
<SInputDropdown
2424
label="Dropdown input"
25-
info="Some helpful information."
26-
placeholder="Please select items"
25+
placeholder="Select items"
2726
:options="options"
2827
nullable
2928
v-model="value"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script setup lang="ts">
2+
import SInputDropdown, { type OptionAvatar } from 'sefirot/components/SInputDropdown.vue'
3+
import { ref } from 'vue'
4+
5+
const title = 'Components / SInputDropdown / 02. Avatar Options'
6+
7+
const value = ref<string[]>([])
8+
9+
const options: OptionAvatar[] = [
10+
{ type: 'avatar', image: 'https://i.pravatar.cc/64?img=4', label: 'Kris James', value: 1 },
11+
{ type: 'avatar', image: 'https://i.pravatar.cc/64?img=5', label: 'Becky Lu', value: 2 },
12+
{ type: 'avatar', image: 'https://i.pravatar.cc/64?img=7', label: 'Thomas Wane', value: 3 },
13+
{ type: 'avatar', image: 'https://i.pravatar.cc/64?img=8', label: 'Linda Smith', value: 4 },
14+
{ type: 'avatar', image: 'https://i.pravatar.cc/64?img=9', label: 'Monica Green', value: 5 },
15+
{ type: 'avatar', image: 'https://i.pravatar.cc/64?img=10', label: 'Sefia Blue', value: 6 }
16+
]
17+
</script>
18+
19+
<template>
20+
<Story :title="title" source="Not available" auto-props-disabled>
21+
<Board :title="title">
22+
<SInputDropdown
23+
label="Dropdown input"
24+
placeholder="Select items"
25+
:options="options"
26+
nullable
27+
v-model="value"
28+
/>
29+
</Board>
30+
</Story>
31+
</template>

0 commit comments

Comments
 (0)