Skip to content

Commit 69476de

Browse files
committed
- fixes Safari search input appearance
- numerous fixes for consistent browser styling - fixes/adds default transition for dropdown - removes debounce as a prop - removes unused transitions on list items - removes unnecessary styles
1 parent 61c6fa2 commit 69476de

File tree

2 files changed

+32
-52
lines changed

2 files changed

+32
-52
lines changed

src/components/Select.vue

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@
5252
-webkit-appearance: none;
5353
-moz-appearance: none;
5454
appearance: none;
55-
}
56-
.v-select .dropdown-toggle {
5755
display: block;
5856
padding: 0;
5957
background: none;
6058
border: 1px solid rgba(60, 60, 60, .26);
6159
border-radius: 4px;
6260
white-space: normal;
61+
transition: border-radius .25s;
6362
}
6463
.v-select .dropdown-toggle:after {
6564
visibility: hidden;
@@ -77,7 +76,6 @@
7776
cursor: pointer;
7877
}
7978
.v-select.open .dropdown-toggle {
80-
border-bottom-color: transparent;
8179
border-bottom-left-radius: 0;
8280
border-bottom-right-radius: 0;
8381
}
@@ -87,35 +85,19 @@
8785
top: 100%;
8886
left: 0;
8987
z-index: 1000;
90-
/*float: left;*/
9188
min-width: 160px;
9289
padding: 5px 0;
9390
margin: 0;
9491
width: 100%;
9592
overflow-y: scroll;
96-
border: 1px solid #ccc;
97-
border: 1px solid rgba(0, 0, 0, .15);
93+
border: 1px solid rgba(0, 0, 0, .26);
9894
border-top: none;
99-
border-radius: 4px;
100-
border-top-left-radius: 0;
101-
border-top-right-radius: 0;
102-
/*font-size: 14px;*/
95+
border-radius: 0 0 4px 4px;
10396
text-align: left;
10497
list-style: none;
105-
background-color: #fff;
106-
background-clip: padding-box;
107-
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
108-
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
109-
}
110-
.v-select .dropdown-menu .divider {
111-
height: 1px;
112-
margin: 7px 0;
113-
overflow: hidden;
114-
background-color: #e5e5e5;
11598
}
11699
.v-select .no-options {
117100
text-align: center;
118-
padding-bottom: 2px;
119101
}
120102
/* Selected Tags */
121103
.v-select .selected-tag {
@@ -125,7 +107,7 @@
125107
border-radius: 4px;
126108
height: 26px;
127109
margin: 4px 1px 0px 3px;
128-
padding: 0 0.25em;
110+
padding: 1px 0.25em;
129111
float: left;
130112
line-height: 24px;
131113
}
@@ -146,22 +128,23 @@
146128
opacity: .2;
147129
}
148130
/* Search Input */
149-
.v-select input[type="search"]::-ms-clear,
150131
.v-select input[type="search"]::-webkit-search-decoration,
151132
.v-select input[type="search"]::-webkit-search-cancel-button,
152133
.v-select input[type="search"]::-webkit-search-results-button,
153134
.v-select input[type="search"]::-webkit-search-results-decoration {
154135
display: none;
155136
}
137+
.v-select input[type="search"]::-ms-clear {
138+
display: none;
139+
}
156140
.v-select input[type="search"],
157141
.v-select input[type="search"]:focus {
158142
appearance: none;
159143
-webkit-appearance: none;
144+
-moz-appearance: none;
160145
line-height: 1.42857143;
161-
/*color: #555;*/
162-
border-radius: 4px;
146+
font-size:1em;
163147
height: 34px;
164-
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
165148
display: inline-block;
166149
border: none;
167150
outline: none;
@@ -180,11 +163,13 @@
180163
max-width: 1px;
181164
}
182165
/* List Items */
166+
.v-select li {
167+
line-height: 1.42857143; /* Normalize line height */
168+
}
183169
.v-select li > a {
184170
display: block;
185171
padding: 3px 20px;
186172
clear: both;
187-
line-height: 1.42857143; /* Normalize line height */
188173
color: #333; /* Overrides most CSS frameworks */
189174
white-space: nowrap;
190175
}
@@ -250,11 +235,20 @@
250235
transform: rotate(360deg);
251236
}
252237
}
238+
/* Dropdown Default Transition */
239+
.fade-enter-active,
240+
.fade-leave-active {
241+
transition: opacity .15s cubic-bezier(1.0, 0.5, 0.8, 1.0);
242+
}
243+
.fade-enter,
244+
.fade-leave-to {
245+
opacity: 0;
246+
}
253247
</style>
254248

255249
<template>
256250
<div class="dropdown v-select" :class="dropdownClasses">
257-
<div ref="toggle" @mousedown.prevent="toggleDropdown" class="dropdown-toggle" type="button">
251+
<div ref="toggle" @mousedown.prevent="toggleDropdown" class="dropdown-toggle">
258252

259253
<span class="selected-tag" v-for="option in valueAsArray" v-bind:key="option.index">
260254
{{ getOptionLabel(option) }}
@@ -265,7 +259,6 @@
265259

266260
<input
267261
ref="search"
268-
:debounce="debounce"
269262
v-model="search"
270263
@keydown.delete="maybeDeleteValue"
271264
@keyup.esc="onEscape"
@@ -288,21 +281,18 @@
288281
</slot>
289282
</div>
290283

291-
<ul ref="dropdownMenu" v-if="dropdownOpen" :transition="transition" class="dropdown-menu" :style="{ 'max-height': maxHeight }">
292-
<li v-for="(option, index) in filteredOptions" v-bind:key="index" :class="{ active: isOptionSelected(option), highlight: index === typeAheadPointer }" @mouseover="typeAheadPointer = index">
293-
<a @mousedown.prevent="select(option)">
294-
{{ getOptionLabel(option) }}
295-
</a>
296-
</li>
297-
<transition name="fade">
298-
<li v-if="!filteredOptions.length" class="divider"></li>
299-
</transition>
300-
<transition name="fade">
284+
<transition :name="transition">
285+
<ul ref="dropdownMenu" v-if="dropdownOpen" class="dropdown-menu" :style="{ 'max-height': maxHeight }">
286+
<li v-for="(option, index) in filteredOptions" v-bind:key="index" :class="{ active: isOptionSelected(option), highlight: index === typeAheadPointer }" @mouseover="typeAheadPointer = index">
287+
<a @mousedown.prevent="select(option)">
288+
{{ getOptionLabel(option) }}
289+
</a>
290+
</li>
301291
<li v-if="!filteredOptions.length" class="no-options">
302292
<slot name="no-options">Sorry, no matching options.</slot>
303293
</li>
304-
</transition>
305-
</ul>
294+
</ul>
295+
</transition>
306296
</div>
307297
</template>
308298

@@ -383,7 +373,7 @@
383373
*/
384374
transition: {
385375
type: String,
386-
default: 'expand'
376+
default: 'fade'
387377
},
388378
389379
/**

src/mixins/ajax.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ module.exports = {
2424
onSearch: {
2525
type: Function,
2626
default: function(search, loading){}
27-
},
28-
29-
/**
30-
* The number of milliseconds to wait before
31-
* invoking this.onSearch(). Used to prevent
32-
* sending an AJAX request until input is complete.
33-
*/
34-
debounce: {
35-
type: Number,
36-
default: 0
3727
}
3828
},
3929

0 commit comments

Comments
 (0)