@nosto/autocomplete
Version:
Library designed to simplify the implementation of search autocomplete functionality
148 lines (129 loc) • 2.94 kB
CSS
.ns-autocomplete {
display: flex;
flex-direction: column;
align-items: flex-start;
position: absolute;
z-index: 1001;
left: 0;
top: 100%;
width: 100%;
min-width: 250px;
max-width: 800px;
background: #fff;
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
overflow: hidden;
border: 1px solid #ccc;
border-radius: 4px;
}
.ns-autocomplete-results {
width: 100%;
}
.ns-autocomplete-keywords,
.ns-autocomplete-history {
display: flex;
flex-direction: column;
border-bottom: 1px solid #F0F3F6;
border-radius: 0;
}
.ns-autocomplete-header {
padding: 0.25rem 1rem;
color: #000000;
font-weight: bold;
font-size: 0.9rem;
}
.ns-autocomplete-keyword,
.ns-autocomplete-history-item {
display: flex;
align-items: center;
padding: 0.25rem 1rem;
color: #000000;
font-size: 0.9rem;
cursor: pointer;
}
.ns-autocomplete-keyword:hover,
.ns-autocomplete-keyword.selected,
.ns-autocomplete-history-item:hover,
.ns-autocomplete-history-item.selected {
background-color: #F0F3F6;
}
.ns-autocomplete-history-item-remove {
margin-right: 0;
margin-left: auto;
text-decoration: none;
color: inherit;
font-size: 0.75rem;
}
.ns-autocomplete-history-item-remove:hover {
color: #999999;
}
.ns-autocomplete-products {
display: flex;
flex-direction: column;
flex-grow: 1;
border-bottom: 1px solid #F0F3F6;
border-radius: 0
}
.ns-autocomplete-product {
display: flex;
flex-direction: row;
padding: 0.25rem 1rem;
color: #000000;
text-decoration: none;
cursor: pointer;
}
.ns-autocomplete-product:hover,
.ns-autocomplete-product.selected {
background-color: #F0F3F6;
}
.ns-autocomplete-product-image {
height: auto;
object-fit: contain;
}
.ns-autocomplete-product-info {
padding-left: 0.5rem;
}
.ns-autocomplete-product-brand {
font-size: 0.9rem;
margin-bottom: 0.25rem;
color: #516980;
}
.ns-autocomplete-product-name {
margin-bottom: 0.5rem;
font-size: 0.9rem;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
line-clamp: 1;
-webkit-box-orient: vertical;
}
.ns-autocomplete-product-list-price {
font-size: 1rem;
text-decoration: line-through;
margin-left: 0.5rem;
color: #516980;
}
.ns-autocomplete-submit,
.ns-autocomplete-history-clear {
display: flex;
justify-content: center;
}
.ns-autocomplete-submit:hover,
.ns-autocomplete-history-clear:hover {
background-color: #F0F3F6;
}
.ns-autocomplete-button {
font-family: inherit;
text-decoration: none;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
background-color: transparent;
border: 1px solid transparent;
padding: 0.5rem;
font-size: 0.9rem;
border-radius: 4px;
width: 100%;
}