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

321 lines
5.8 KiB
SCSS
Raw Normal View History

2019-08-09 20:31:50 +08:00
// scss-lint:disable SelectorDepth
// scss-lint:disable NestingDepth
2019-08-02 21:57:41 +08:00
@import "constants";
.dropdown-selector-container {
display: inline-block;
2019-08-05 23:21:58 +08:00
float: left;
2019-08-02 21:57:41 +08:00
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;
border: 1px solid $color-alto;
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;
2019-08-09 20:31:50 +08:00
padding: 3px 36px 3px 3px;
2019-08-02 21:57:41 +08:00
position: relative;
transition: .2s;
width: 100%;
2019-08-06 21:25:52 +08:00
2019-08-09 20:31:50 +08:00
.fa-caret-down {
color: $color-silver-chalice;
cursor: pointer;
font-size: 20px;
line-height: 18px;
position: absolute;
right: 8px;
text-align: center;
top: 8px;
width: 18px;
}
2019-08-26 21:49:33 +08:00
.search-field {
2019-08-06 21:25:52 +08:00
border: 0;
2019-09-12 20:11:27 +08:00
flex-basis: 0;
flex-grow: 2000;
2019-08-06 21:25:52 +08:00
line-height: 24px;
2019-09-12 20:11:27 +08:00
min-width: 0;
2019-08-06 21:25:52 +08:00
outline: 0;
padding-left: 5px;
&::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;
padding-left: 5px;
position: relative;
transition: .3s;
z-index: 2;
}
2019-08-05 23:21:58 +08:00
.ds-tags {
align-items: center;
background: $color-concrete;
2019-09-12 20:11:27 +08:00
border-radius: 5px;
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;
2019-09-12 20:11:27 +08:00
max-width: calc(100% - 11px);
overflow: hidden;
2019-08-05 23:21:58 +08:00
padding: 5px 7px;
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 {
2019-08-06 21:25:52 +08:00
display: inline-block;
margin-bottom: 1px;
margin-right: 5px;
2019-11-27 21:04:59 +08:00
max-width: 240px;
2019-08-06 21:25:52 +08:00
overflow: hidden;
2019-09-12 20:11:27 +08:00
text-overflow: ellipsis;
2019-08-06 21:25:52 +08:00
white-space: nowrap;
width: auto;
2019-08-05 23:21:58 +08:00
}
.fas {
cursor: pointer;
2019-08-06 21:25:52 +08:00
flex-grow: 1;
font-size: 13px;
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 {
background: $color-white;
border: 1px solid $color-alto;
border-radius: 0 0 4px 4px;
2019-10-07 19:52:01 +08:00
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.12), 0 0 4px 0 rgba(0, 0, 0, 0.08);
2019-08-02 21:57:41 +08:00
display: none;
overflow: hidden;
position: absolute;
top: calc(100% - 30px);
transition: .2s;
transition-property: top, bottom, box-shadow;
2019-08-02 21:57:41 +08:00
width: 100%;
z-index: 10;
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
}
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;
}
2019-08-02 21:57:41 +08:00
.checkbox-icon {
&::before {
content: "\f0c8";
2019-09-12 20:11:27 +08:00
font-family: $font-family-icons;
font-size: 16px;
2019-08-02 21:57:41 +08:00
font-weight: 400;
2019-09-12 20:11:27 +08:00
margin: 0 8px 0 0;
2019-08-02 21:57:41 +08:00
position: relative;
}
&.select {
2019-08-09 20:31:50 +08:00
2019-08-02 21:57:41 +08:00
&::before {
content: "\f14a";
}
}
}
2019-08-09 20:31:50 +08:00
2019-08-02 21:57:41 +08:00
.dropdown-option {
align-items: center;
cursor: pointer;
display: flex;
min-height: 32px;
padding: 0 10px;
position: relative;
user-select: none;
&.select {
background: $color-concrete;
}
2019-11-24 04:09:34 +08:00
&.highlight,
2019-08-02 21:57:41 +08:00
&:hover {
2019-09-12 20:11:27 +08:00
background: $brand-primary-light;
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 {
2019-09-16 22:20:16 +08:00
background: $brand-primary-light;
2019-08-02 21:57:41 +08:00
}
}
.dropdown-option {
padding-left: 20px;
}
&.select {
2019-08-09 20:31:50 +08:00
2019-08-02 21:57:41 +08:00
.group-name.checkbox-icon {
background: $color-concrete;
2019-08-09 20:31:50 +08:00
2019-09-16 22:20:16 +08:00
&:hover {
background: $brand-primary-light;
}
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 {
bottom: 3px;
display: none;
position: absolute;
}
}
}
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;
}
2019-08-09 20:31:50 +08:00
.fa-caret-down {
transform: rotate(180deg);
}
2019-08-02 21:57:41 +08:00
}
.dropdown-container {
2019-08-09 20:31:50 +08:00
border-top: 0;
2019-10-07 19:52:01 +08:00
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.12), 0 0 4px 0 rgba(0, 0, 0, 0.08);
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 {
.search-field {
display: block;
line-height: 14px;
}
.ds-simple {
color: $color-silver-chalice;
font-size: 12px;
line-height: 14px;
}
}
2019-08-02 21:57:41 +08:00
}
&.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;
.ds-tags .fa-times {
display: none;
}
}
}
&.success {
.input-field {
border-color: $brand-success !important;
}
}
&.error {
.input-field {
border-color: $brand-danger !important;
}
}
2019-08-09 20:31:50 +08:00
}