pocketbase/ui/src/scss/_dropdown.scss

132 lines
3.1 KiB
SCSS

.dropdown {
$spacing: 5px;
position: absolute;
z-index: 99;
right: 0;
left: auto;
top: 100%;
cursor: default;
display: inline-block;
vertical-align: top;
padding: $spacing;
margin: 10px 0 0;
width: auto;
min-width: 140px;
max-width: 350px;
max-height: 330px;
overflow-x: hidden;
overflow-y: auto;
background: var(--baseColor);
border-radius: var(--baseRadius);
border: 1px solid var(--baseAlt2Color);
@include shadowize();
hr {
margin: $spacing 0;
}
.dropdown-item {
outline: 0;
border: 0;
background: none;
position: relative;
outline: 0;
display: flex;
align-items: center;
column-gap: 8px;
width: 100%;
height: auto;
min-height: 0;
text-align: left;
padding: 8px 10px;
margin: 0 0 $spacing;
cursor: pointer;
color: var(--txtPrimaryColor);
font-weight: normal;
font-size: var(--baseFontSize);
font-family: var(--baseFontFamily);
line-height: var(--baseLineHeight);
border-radius: var(--baseRadius);
text-decoration: none;
word-break: break-word;
user-select: none;
transition: background var(--baseAnimationSpeed),
color var(--baseAnimationSpeed);
&:last-child {
margin-bottom: 0;
}
// states
&:focus,
&:hover {
background: var(--baseAlt1Color);
}
&.selected {
background: var(--baseAlt2Color);
}
&:active {
transition-duration: var(--activeAnimationSpeed);
background: var(--baseAlt2Color);
}
&.disabled {
color: var(--txtDisabledColor);
background: none;
pointer-events: none;
}
// styles
&.separator {
cursor: default;
background: none;
text-transform: uppercase;
padding-top: 0;
padding-bottom: 0;
margin-top: 15px;
color: var(--txtDisabledColor);
font-weight: 600;
font-size: var(--smFontSize);
}
}
// positions
&.dropdown-upside {
top: auto;
bottom: 100%;
margin: 0 0 10px;
}
&.dropdown-left {
right: auto;
left: 0;
}
&.dropdown-center {
right: auto;
left: 50%;
transform: translateX(-50%);
}
// styles
&.dropdown-sm {
margin-top: 5px;
min-width: 100px;
.dropdown-item {
column-gap: 7px;
font-size: var(--smFontSize);
margin: 0 0 2px;
padding: 5px 7px;
&:last-child {
margin-bottom: 0;
}
}
&.dropdown-upside {
margin-top: 0;
margin-bottom: 5px;
}
}
&.dropdown-block {
width: 100%;
min-width: 130px;
max-width: 100%;
}
&.dropdown-nowrap {
white-space: nowrap;
}
}