0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 13:10:14 +01:00
wagtail/client/scss/components/_dropdown.legacy.scss
2023-12-19 15:38:22 +00:00

283 lines
5.2 KiB
SCSS

.dropdown {
@include clearfix();
position: relative;
input[type='submit'],
input[type='reset'],
input[type='button'],
button,
.button {
padding: 0 5em 0 1em;
display: block;
width: 100%;
height: 3em;
line-height: 3em;
text-align: start;
float: inline-start;
}
.action-secondary {
opacity: 0.8;
}
input[type='submit'],
input[type='reset'],
input[type='button'],
button {
line-height: inherit;
}
ul {
@include unlist();
background-color: theme('colors.surface-button-default');
position: absolute;
overflow: hidden;
top: 100%;
z-index: 500;
opacity: 0;
pointer-events: none;
li {
float: none;
border-color: theme('colors.white-15');
border-style: solid;
border-width: 1px 0 0;
overflow: hidden;
a:focus,
button:focus {
border: 3px solid theme('colors.focus');
}
}
// Media for Windows High Contrast
@media (forced-colors: active) {
li {
border-width: 1px;
}
li:hover {
border-color: Highlight;
}
li a,
li button {
border-color: theme('colors.text-button');
color: theme('colors.text-button');
}
li a:focus,
li button:focus {
border: 4px solid currentColor;
color: theme('colors.text-button');
}
}
a {
white-space: nowrap;
position: relative;
text-decoration: none;
display: block;
color: theme('colors.text-button');
padding: 1em;
font-weight: normal;
&:hover {
background-color: theme('colors.surface-button-hover');
}
&.icon {
padding-inline-end: 5em;
}
&.shortcut {
padding-inline-end: 7em;
}
}
a,
input[type='submit'],
input[type='reset'],
input[type='button'],
.button,
button {
border-radius: 0;
-webkit-font-smoothing: auto;
}
label {
padding: 1.3em;
}
.kbd {
position: absolute;
inset-inline-end: 1em;
font-weight: 600;
font-size: 0.8em;
color: theme('colors.black-20');
}
}
&.open ul {
box-shadow: 0 3px 3px 0 theme('colors.black-20');
opacity: 1;
pointer-events: initial;
display: block;
}
&.match-width ul {
width: 100%;
min-width: 110px;
li {
white-space: nowrap;
}
}
&.dropup ul {
box-shadow: 0 -3px 3px 0 theme('colors.black-20');
top: auto;
bottom: 100%;
li {
border-width: 0 0 1px;
}
}
.dropdown-toggle {
color: theme('colors.text-button');
background-color: theme('colors.surface-button-default');
line-height: 2.8em;
cursor: pointer;
height: 100%;
border-inline-start: 1px solid theme('colors.white-15');
position: absolute;
inset-inline-end: 0;
padding: 0 0.5em;
text-align: center;
&:hover {
background-color: theme('colors.surface-button-hover');
}
.icon {
@include svg-icon(1.3em);
}
}
.bicolor + .dropdown-toggle {
background-color: theme('colors.surface-button-hover');
}
&.open .dropdown-toggle {
background-color: theme('colors.surface-button-hover');
}
.bicolor:hover {
background-color: theme('colors.surface-button-hover');
}
// Styles for dropdowns which are also buttons e.g page editor
&.dropdown-button {
// Media for Windows High Contrast
@media (forced-colors: active) {
button {
border-color: ActiveText;
}
button:hover {
border-color: Highlight;
}
a.button.bicolor.button:hover {
border-color: Highlight;
}
}
.dropdown-toggle {
border-radius: 0 3px 3px 0;
// Media for Windows High Contrast
@media (forced-colors: active) {
background: transparent;
border: 1px solid ActiveText;
}
}
.dropdown-toggle:hover {
// Media for Windows High Contrast
@media (forced-colors: active) {
background-color: transparent;
border: 1px solid Highlight;
}
}
&.open {
> input[type='button'],
> input[type='submit'],
> button,
> .button {
border-radius: 3px 3px 0 0;
}
.dropdown-toggle {
border-radius: 0 3px 0 0;
}
}
}
&.dropup.dropdown-button {
&.open {
> input[type='button'],
> input[type='submit'],
> button,
> .button {
border-radius: 0 0 3px 3px;
}
.dropdown-toggle {
border-radius: 0 0 3px;
}
}
}
}
.dropdown.white {
ul {
background-color: theme('colors.surface-page');
li {
border-top: 1px solid theme('colors.black-10');
}
a {
color: theme('colors.text-meta');
&:hover {
background-color: theme('colors.text-context');
}
}
}
}
.dropdown.warning {
ul {
background-color: theme('colors.warning.100');
}
.dropdown-toggle {
background-color: theme('colors.warning.100');
}
}
// Transitions
// stylelint-disable-next-line no-duplicate-selectors
.dropdown ul {
@include transition(opacity 0.2s linear);
}
.dropdown-button {
.button .icon {
@include svg-icon();
}
}