mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-20 00:37:26 +00:00
We should be able to use @extend .icon-chevron-down, but I couldn't get it to work. I'd like to have a better method for this, but we should upgrade our ancient FontAwesome before worrying about that.
133 lines
2.6 KiB
SCSS
133 lines
2.6 KiB
SCSS
@mixin hide-input {
|
|
// Pretend there's no text input (it can't be hidden entirely, in order for tom-select to work)
|
|
cursor: pointer;
|
|
caret-color: transparent;
|
|
}
|
|
|
|
.ts-wrapper.single,
|
|
.ts-wrapper.multi {
|
|
min-height: 40px;
|
|
|
|
&.input-active {
|
|
.ts-control {
|
|
border-color: $orient;
|
|
background-color: $lighter-grey;
|
|
|
|
input {
|
|
&::placeholder {
|
|
color: $light-grey;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.ts-control {
|
|
box-shadow: none;
|
|
border-color: $lighter-grey;
|
|
background-color: $lighter-grey;
|
|
background-image: none;
|
|
@include border-radius($border-radius);
|
|
|
|
input {
|
|
font-size: $body-font-size;
|
|
height: auto;
|
|
|
|
&::placeholder {
|
|
color: $near-black;
|
|
}
|
|
}
|
|
|
|
.item {
|
|
margin-top: 2px; // Ensure it lines up with the input. I have no idea why it's necessary.
|
|
}
|
|
}
|
|
|
|
.ts-dropdown {
|
|
margin-top: 4px;
|
|
color: $near-black;
|
|
@include border-radius($border-radius);
|
|
border: none;
|
|
box-shadow: $shadow-dropdown;
|
|
|
|
.ts-dropdown-content {
|
|
padding: $border-radius 0;
|
|
}
|
|
|
|
.option {
|
|
padding: 8px;
|
|
border-left: 3px solid transparent;
|
|
line-height: 20px;
|
|
|
|
&.selected,
|
|
&.active {
|
|
border-left: 3px solid $orient;
|
|
background-color: $lighter-grey;
|
|
color: $near-black;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.plugin-dropdown_input .dropdown-input {
|
|
border-color: $lighter-grey;
|
|
|
|
&:focus {
|
|
border-color: $orient;
|
|
}
|
|
}
|
|
|
|
// For the "single" tom_select, be as close as possible to native select boxes
|
|
// without too many options
|
|
.ts-wrapper.single {
|
|
max-height: 40px;
|
|
max-width: 100%;
|
|
|
|
&.has-items {
|
|
@include hide-input;
|
|
}
|
|
|
|
.ts-control {
|
|
padding: 0.5rem 0.75rem;
|
|
padding-right: 1rem !important; // ts has a clever variable-based rule here, but it doesn't seem to work right.
|
|
overflow: hidden;
|
|
|
|
// Icon: Override TS icon with icon-chevron-down
|
|
&::after {
|
|
content: "\f078";
|
|
font-family: FontAwesome;
|
|
border: none;
|
|
top: 1em;
|
|
}
|
|
&:not(.rtl)::after {
|
|
right: 1.5rem;
|
|
}
|
|
|
|
.item {
|
|
margin-right: 1rem;
|
|
// Hide overflow with an ellipsis if a width has been set
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
text-wrap: nowrap;
|
|
}
|
|
}
|
|
|
|
&.dropdown-active .ts-control {
|
|
&::after {
|
|
content: "\f077"; // chevron-up
|
|
}
|
|
}
|
|
}
|
|
|
|
// 'no-input' mode, like a native select (hide text input).
|
|
.ts-wrapper.single.no-input {
|
|
&.input-active .ts-control {
|
|
@include hide-input;
|
|
}
|
|
|
|
.ts-dropdown {
|
|
position: absolute;
|
|
top: 0; // we don't need to see the currently selected option, because it's visible in the dropdown
|
|
margin-top: 0;
|
|
}
|
|
}
|