scinote-web/app/assets/stylesheets/shared/dropdown_selector.scss

457 lines
8.4 KiB
SCSS
Raw Normal View History

2019-08-09 20:31:50 +08:00
// scss-lint:disable SelectorDepth
// scss-lint:disable NestingDepth
.select-container--with-search .dropdown-selector-container {
&.active,
&.open {
2023-06-08 23:33:50 +08:00
.right-icon.sn-icon-search {
display: block;
}
2023-06-08 23:33:50 +08:00
.right-icon.sn-icon-down {
display: none;
}
}
}
2019-08-02 21:57:41 +08:00
.dropdown-selector-container {
display: inline-block;
position: relative;
width: 100%;
.input-field {
2019-08-05 23:21:58 +08:00
align-items: center;
2019-08-02 21:57:41 +08:00
background: $color-white;
2023-09-25 20:15:08 +08:00
border: 1px solid var(--sn-light-grey);
2019-08-02 21:57:41 +08:00
border-radius: 4px;
2019-08-05 23:21:58 +08:00
display: flex;
flex-wrap: wrap;
min-height: 36px;
2019-08-06 21:25:52 +08:00
overflow: hidden;
padding: 3px 42px 3px 3px;
2019-08-02 21:57:41 +08:00
position: relative;
transition: .2s;
width: 100%;
2019-08-06 21:25:52 +08:00
.right-icon {
color: $color-volcano;
2019-08-09 20:31:50 +08:00
cursor: pointer;
position: absolute;
2023-06-12 20:55:01 +08:00
right: 4px;
2019-08-09 20:31:50 +08:00
text-align: center;
2023-06-21 18:02:18 +08:00
top: 6px;
2023-06-08 23:33:50 +08:00
&.sn-icon-search.simple-dropdown {
color: $brand-focus;
display: none;
}
2019-08-09 20:31:50 +08:00
}
2019-08-26 21:49:33 +08:00
.search-field {
2020-02-14 19:07:40 +08:00
@include font-button;
2019-08-06 21:25:52 +08:00
border: 0;
2019-09-12 20:11:27 +08:00
flex-basis: 0;
flex-grow: 2000;
line-height: 28px;
2019-09-12 20:11:27 +08:00
min-width: 0;
2019-08-06 21:25:52 +08:00
outline: 0;
padding: 0 0 0 10px;
2019-08-06 21:25:52 +08:00
&::placeholder {
2019-08-09 20:31:50 +08:00
opacity: .7;
2019-08-06 21:25:52 +08:00
}
}
2019-08-05 23:21:58 +08:00
.ds-simple {
font-size: 14px;
line-height: 28px;
2019-12-02 18:03:05 +08:00
overflow: hidden;
padding-left: 5px;
position: relative;
2019-12-02 18:03:05 +08:00
text-overflow: ellipsis;
transition: .3s;
2019-12-02 18:03:05 +08:00
white-space: nowrap;
z-index: 2;
}
2019-08-05 23:21:58 +08:00
.ds-tags {
@include font-small;
2019-08-05 23:21:58 +08:00
align-items: center;
background: $color-concrete;
border-radius: $border-radius-tag;
2019-08-05 23:21:58 +08:00
display: flex;
2019-08-06 21:25:52 +08:00
flex-shrink: 0;
line-height: 13px;
2019-08-05 23:21:58 +08:00
margin: 2px 3px;
max-height: 24px;
2019-09-12 20:11:27 +08:00
max-width: calc(100% - 11px);
overflow: hidden;
padding: 5px 8px;
2019-09-12 20:11:27 +08:00
transition: .3s;
2019-08-06 21:25:52 +08:00
user-select: none;
2019-09-12 20:11:27 +08:00
&.closing {
margin: 2px 0;
max-width: 0;
padding: 5px 0;
}
2019-08-05 23:21:58 +08:00
.tag-label {
align-items: center;
display: flex;
2019-08-06 21:25:52 +08:00
margin-right: 5px;
2019-11-27 21:04:59 +08:00
max-width: 240px;
2019-08-06 21:25:52 +08:00
overflow: hidden;
text-align: left;
2019-09-12 20:11:27 +08:00
text-overflow: ellipsis;
2019-08-06 21:25:52 +08:00
white-space: nowrap;
width: auto;
2020-02-17 17:47:10 +08:00
&[data-ds-tag-id=""] {
opacity: .7;
}
.item-avatar {
height: 16px;
margin-right: 8px;
width: 16px;
}
2019-08-05 23:21:58 +08:00
}
.fas {
cursor: pointer;
2019-08-06 21:25:52 +08:00
flex-grow: 1;
font-size: 12px;
2019-08-09 20:31:50 +08:00
opacity: .7;
2019-08-06 21:25:52 +08:00
text-align: right;
2019-08-05 23:21:58 +08:00
}
}
2019-08-02 21:57:41 +08:00
}
.dropdown-container {
2020-02-14 19:07:40 +08:00
@include font-button;
2019-08-02 21:57:41 +08:00
background: $color-white;
border: 1px solid $color-alto;
border-radius: 0 0 4px 4px;
bottom: calc(100% - 30px);
box-shadow: $flyout-shadow;
2019-08-02 21:57:41 +08:00
display: none;
overflow: hidden;
position: fixed;
2019-08-02 21:57:41 +08:00
transition: .2s;
transition-property: top, bottom, box-shadow;
2019-08-02 21:57:41 +08:00
width: 100%;
2020-02-27 20:16:11 +08:00
z-index: 100;
2019-08-02 21:57:41 +08:00
2019-08-26 21:49:33 +08:00
.empty-dropdown {
opacity: .6;
padding: 7px;
2019-08-26 21:52:03 +08:00
text-align: center;
2019-08-26 21:49:33 +08:00
}
.dropdown-hint {
opacity: .6;
padding: 7px;
text-align: left;
}
.delimiter {
background: $color-concrete;
height: 1px;
margin: 5px 0;
}
2019-08-09 20:31:50 +08:00
.dropdown-select-all {
2019-08-06 21:25:52 +08:00
background: $color-white;
border: 0;
border-bottom: 1px solid $color-alto;
border-radius: 0;
cursor: pointer;
font-weight: bold;
line-height: 20px;
padding: 5px;
position: sticky;
text-align: center;
top: 0;
width: 100%;
z-index: 5;
}
.dropdown-blank {
border-radius: 0;
padding-left: 7px;
text-align: left;
width: 100%;
&:hover {
background: $brand-primary;
color: $color-white;
}
}
2019-08-02 21:57:41 +08:00
.dropdown-option {
align-items: center;
cursor: pointer;
display: flex;
min-height: 32px;
2019-12-11 21:49:14 +08:00
padding: 3px 10px;
2019-08-02 21:57:41 +08:00
position: relative;
user-select: none;
&.highlight,
&:hover {
2019-08-02 21:57:41 +08:00
background: $color-concrete;
}
2020-02-17 17:47:10 +08:00
&[data-value=""] {
opacity: .7;
}
&.select {
background: $brand-primary;
color: $color-white;
2020-02-17 17:47:10 +08:00
opacity: 1;
2019-08-02 21:57:41 +08:00
}
}
2019-08-02 21:57:41 +08:00
.checkbox-icon {
&::before {
@include font-awesome;
animation-timing-function: $timing-function-sharp;
background: $color-white;
border: $border-default;
border-radius: 1px;
color: $color-white;
content: "";
flex-shrink: 0;
font-size: calc(
var(--sci-checkbox-size) - var(--sci-checkbox-size) * .375
);
height: var(--sci-checkbox-size);
line-height: calc(var(--sci-checkbox-size) - 2px);
margin-right: 8px;
text-align: center;
transition: .2s;
width: var(--sci-checkbox-size);
}
&.select {
background: $color-white;
color: inherit;
&:hover {
background: $color-concrete;
}
&::before {
background: $brand-primary;
border: 1px solid $brand-primary;
content: $font-fas-check;
}
}
2019-08-02 21:57:41 +08:00
}
.dropdown-group {
.group-name {
align-items: center;
cursor: pointer;
display: flex;
font-size: 14px;
font-weight: bold;
min-height: 32px;
padding: 0 10px;
user-select: none;
&:hover {
2020-11-03 15:07:17 +08:00
background: $brand-focus-light;
2019-08-02 21:57:41 +08:00
}
}
.dropdown-option {
padding-left: 20px;
}
&.select {
.group-name.checkbox-icon {
background: $color-concrete;
2019-08-09 20:31:50 +08:00
2019-09-16 22:20:16 +08:00
&:hover {
2020-11-03 15:07:17 +08:00
background: $brand-focus-light;
2019-09-16 22:20:16 +08:00
}
2019-08-02 21:57:41 +08:00
&::before {
content: "\f14a";
}
}
}
}
}
&.inverse {
.dropdown-container {
bottom: calc(100% - 30px);
2019-08-06 21:25:52 +08:00
margin-bottom: 0;
2019-08-02 21:57:41 +08:00
top: auto;
}
}
&.simple-mode {
.input-field {
display: block;
.search-field {
background: transparent;
display: none;
&[data-options-selected="0"] {
display: block;
width: 100%;
}
}
2019-12-06 20:18:35 +08:00
.ds-simple {
.tag-label {
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
white-space: nowrap;
2020-02-17 17:47:10 +08:00
&[data-ds-tag-id=""] {
opacity: .7;
}
2023-05-25 18:12:16 +08:00
img {
display: inline;
}
}
2023-06-20 21:53:33 +08:00
.sn-icon-close-small {
2019-12-06 20:18:35 +08:00
display: none;
}
}
}
}
2019-08-02 21:57:41 +08:00
&.open {
.input-field {
2019-08-09 20:31:50 +08:00
border-radius: 4px 4px 0 0;
2019-08-06 21:25:52 +08:00
z-index: 12;
2019-08-09 20:31:50 +08:00
2019-09-12 20:11:27 +08:00
.search-field {
min-width: 50px;
}
2023-06-08 23:33:50 +08:00
.sn-icon-down {
2019-08-09 20:31:50 +08:00
transform: rotate(180deg);
}
2019-08-02 21:57:41 +08:00
}
.dropdown-container {
2019-08-09 20:31:50 +08:00
border-top: 0;
bottom: auto;
box-shadow: $flyout-shadow;
2019-08-02 21:57:41 +08:00
display: block;
top: 100%;
}
&.inverse {
.input-field {
border-bottom: 1px solid $color-alto;
2019-08-09 20:31:50 +08:00
border-radius: 0 0 4px 4px;
2019-08-02 21:57:41 +08:00
}
.dropdown-container {
2019-08-09 20:31:50 +08:00
border-bottom: 0;
2019-08-02 21:57:41 +08:00
border-radius: 4px 4px 0 0;
bottom: 100%;
2019-09-16 22:20:16 +08:00
box-shadow: 0 -1px 2px 0 $md-color-shadow-dark;
2019-08-06 21:25:52 +08:00
position: fixed;
2019-08-02 21:57:41 +08:00
top: auto;
}
}
&.simple-mode:not(.disable-search) {
.input-field {
background: $color-concrete;
border-color: $brand-focus;
}
.search-field {
display: block;
width: 100%;
}
.ds-simple {
display: none;
}
.right-icon {
2023-06-08 23:33:50 +08:00
&.sn-icon-search {
display: block;
}
2023-06-08 23:33:50 +08:00
&.sn-icon-down {
display: none;
}
}
}
2019-08-02 21:57:41 +08:00
}
&.disable-search {
.search-field {
display: none;
}
}
&.disabled {
.input-field {
background: $color-concrete;
2019-08-26 21:49:33 +08:00
.search-field:disabled {
background: inherit;
user-select: none;
}
}
}
&.view-mode {
.input-field {
background: $color-white;
2023-06-20 21:53:33 +08:00
.ds-tags .sn-icon-close-small {
display: none;
}
}
}
&.success {
.input-field {
border-color: $brand-success !important;
}
}
&.error {
.input-field {
border-color: $brand-danger !important;
}
&::after {
@include font-small;
bottom: -16px;
color: $brand-danger;
content: attr(data-error-text);
left: 0;
line-height: 15px;
position: absolute;
white-space: nowrap;
width: 100%;
}
}
&.warning {
.input-field {
border-color: $brand-warning;
}
}
2019-08-09 20:31:50 +08:00
}