mediawiki-skins-Citizen/resources/skins.citizen.search/skins.citizen.search.less

278 lines
4.9 KiB
Plaintext

@import '../variables.less';
@import '../mixins.less';
.citizen-typeahead {
position: absolute;
top: 100%;
box-sizing: content-box; // Magic to align with search input
width: 100%;
max-height: ~'calc( var( --header-card-maxheight ) - var( --height-search-bar ) )';
margin: 0 0 0 -1px; // Reset <ol> styles, fix alignment
overflow: auto;
overscroll-behavior: contain;
border-bottom-right-radius: var( --border-radius--medium );
border-bottom-left-radius: var( --border-radius--medium );
.citizen-card( false );
.citizen-card-hide( 50% 0, Y, false );
// Well this won't be loaded before .citizen-animation-ready anyways
.citizen-card-transition();
a {
&:hover,
&:focus {
text-decoration: none;
}
}
&-input {
// Display overlay instead of the input, but keep the caret
color: transparent;
caret-color: var( --color-base--emphasized );
&-group {
position: relative;
display: flex;
flex-grow: 1;
}
&-overlay {
position: absolute;
top: 0;
bottom: 0;
display: flex;
align-items: center;
font-size: 0.875rem;
// HACK: Target mobile Safari only to prevent auto zooming the input field
@supports (-webkit-touch-callout: none) {
font-size: 1rem;
}
&-query {
color: var( --color-base--emphasized );
}
}
}
&-item {
&-group {
+ .citizen-typeahead-item-group,
+ .citizen-typeahead__item-placeholder {
border-top: 1px solid var( --border-color-base );
}
&-list {
margin: 0;
list-style: none;
}
}
}
&__item {
.citizen-typeahead {
&__thumbnail {
margin-right: var( --space-sm );
}
&__text {
white-space: nowrap;
}
}
&--active {
background-color: var( --background-color-quiet--hover );
}
&--hidden {
display: none;
}
&-sm {
font-size: 0.875rem;
.citizen-typeahead {
&__content {
padding: var( --space-sm ) 0;
}
&__thumbnail {
height: var( --size-icon );
background-color: transparent;
&.citizen-ui-icon {
width: var( --size-icon );
}
}
}
}
&-md {
.citizen-typeahead {
&__thumbnail {
background-color: #eaecf0;
background-position: center;
background-size: cover;
&.citizen-ui-icon {
height: 60px;
background-color: var( --color-surface-3 );
&::before {
background-size: 20px;
}
}
}
}
}
&-lg {
.citizen-typeahead {
&__content {
flex-direction: column;
padding: var( --space-xl ) 0;
text-align: center;
}
&__thumbnail {
margin-bottom: var( --space-sm );
}
}
}
&-md,
&-lg {
.citizen-typeahead {
&__title {
font-weight: var( --font-weight-semibold );
}
&__description {
margin-top: 0.1rem;
}
}
}
}
&__content {
display: flex;
align-items: center;
padding: var( --space-xs ) 0;
margin: 0 var( --space-sm );
color: var( --color-base );
}
&__thumbnail {
flex-shrink: 0;
width: 100%;
max-width: 60px;
height: 60px;
overflow: hidden;
border-radius: var( --border-radius--medium );
&.citizen-ui-icon::before {
background-size: contain;
}
}
&__text {
flex-grow: 1;
overflow: hidden;
}
&__header {
display: flex;
justify-content: space-between;
}
&__title {
flex-shrink: 0;
color: var( --color-base--emphasized );
}
&__highlight {
font-weight: var( --font-weight-medium );
color: var( --color-base--subtle );
}
&__query {
font-weight: var( --font-weight-semibold );
color: var( --color-base--emphasized );
}
&__label {
display: flex;
gap: var( --space-xxs );
margin-left: var( --space-xs );
font-size: 0.8125rem;
color: var( --color-base );
.citizen-ui-icon {
width: 0.8125rem;
height: 0.8125rem;
margin-right: var( --space-xxs );
}
}
&__labelItem {
display: flex;
align-items: center;
}
&__description {
font-size: 0.8125rem;
color: var( --color-base--subtle );
}
&__title,
&__description {
overflow: hidden;
text-overflow: ellipsis;
}
&__actions {
position: absolute;
right: var( --space-sm );
}
&__keyboard {
display: none;
padding: 0 8px;
background-color: var( --color-surface-1 );
border-radius: var( --border-radius--small );
}
.citizen-search__card--expanded & {
.citizen-card-show( false );
}
}
// Merge searchform with typeahead
.citizen-search__card {
&&--expanded {
border-bottom-color: transparent;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
.citizen-typeahead {
border-top-color: transparent; // Reset citizen-card style
}
}
}
// HACK: This is as close as we can to detect whether there is a keyboard in CSS
@media ( hover: hover ) and ( pointer: fine ) {
.citizen-typeahead {
&__item--active {
.citizen-typeahead__keyboard {
display: block;
}
}
}
}
// HACK: Hide default MW search suggestion if it somehow loaded
// This should be removed when we switch to vue search
.suggestions {
display: none !important;
}