@c8y/style
Version:
Styles for Cumulocity IoT applications
644 lines (575 loc) • 13.6 kB
text/less
.dropup,
.dropdown {
position: relative;
display: inline-block;
min-width: 0;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: @zindex-dropdown;
display: none;
float: left;
margin: 0;
padding: 0;
min-width: 160px;
border-color: transparent;
border-radius: @component-border-radius-base;
border-top-left-radius: 0;
border-top-right-radius: 0;
background-color: var(--c8y-dropdown-background-default, @component-background-default);
background-clip: padding-box;
list-style: none;
text-align: left;
text-transform: none;
font-size: @font-size-base;
.boxShadowHelper(md);
&--date-range {
min-width: 240px;
c8y-wrapper-form-field > .form-group {
margin-bottom: 8px;
}
}
&--modal {
z-index: @zindex-modal + 1 ;
.p-l-24 {
padding-left: 16px ;
}
.p-r-24 {
padding-right: 16px ;
}
.m-l-24 {
margin-left: 16px ;
}
.m-r-24 {
margin-right: 16px ;
}
.m-l-16 {
margin-left: 0 ;
}
.m-r-16 {
margin-right: 0 ;
}
}
&.pull-right {
right: 0;
left: auto;
}
.divider {
overflow: hidden;
margin: 0 ;
height: 2px;
background: @component-border-color;
}
// Links within the dropdown menu
> li,
> .d-contents > li {
a:not(.btn):not(.c8y-asset-selector__btn):not(.btn-help),
button:not(.btn):not(.c8y-asset-selector__btn):not(.btn-help) {
&:not(.btn-add-block):not(.btn-clean):not(.collapse-btn.btn-dot) {
display: flex;
align-items: center;
gap: 4px;
padding: 9px 15px 10px;
width: 100%;
border: 0;
border-top: 1px solid @component-border-color;
border-radius: 0;
background-color: var(--c8y-dropdown-background-default, @component-background-default);
background-image: none;
color: @component-color-actions;
text-align: left;
white-space: nowrap;
&:hover {
color: @component-color-actions-hover;
text-decoration: none;
}
&:focus {
outline: none;
border-radius: @component-border-radius-focus;
box-shadow: inset 0 0 0 2px @component-color-focus;
}
}
}
[disabled],
.disabled {
&,
&:hover,
&:focus {
cursor: @cursor-disabled ;
opacity: var(--c8y-root-component-disabled-opacity);
&:not(.btn) {
color: @component-color-actions;
}
}
}
}
> li:first-child a,
> li:first-child > button,
.divider + li > a {
border-top-color: transparent ;
}
// forms in dropdown-menu
> .dropdown-form {
padding: 16px;
min-width: 250px;
background-color: @component-background-default;
overflow-y: auto;
.c8y-scrollbar();
&:has(.dropdown-footer) {
padding-bottom: 0;
}
.dropdown-footer {
margin: 0 -16px;
padding: 16px;
.separator-top();
background-color: @component-background-default;
}
}
.form-group.datepicker {
.uib-datepicker-popup {
min-width: 281px;
}
}
}
.dropdown.open .dropdown-menu-grid-4 {
display: grid ;
grid-template-columns: 1fr 1fr 1fr 1fr;
li > a {
padding: 9px 8px;
border-width: 0;
text-align: center;
transition: box-shadow 0.25s ease;
&:hover,
&.active {
box-shadow: inset 0 0 0 2px @component-color-actions-hover;
color: @component-color-actions-hover;
}
}
}
.dropdown.open,
.uib-dropdown-open {
> .dropdown-menu {
display: block;
height: auto;
&.visible-overflow {
overflow: visible;
}
li {
top: 0 ;
}
}
// Remove the outline when :focus is triggered
> a {
outline: 0;
}
}
// Hover/Focus state
.dropdown-menu > li > a:not(.btn) {
&:hover,
&:focus {
color: @component-color-actions-hover;
text-decoration: none;
}
}
// Active state
.dropdown-menu > .active > a:not(.btn),
.dropdown-menu > .active > button:not(.btn) {
&,
&:hover,
&:focus {
outline: 0;
color: @component-color-active ;
text-decoration: none;
}
}
// Disabled state
.dropdown-menu > .disabled {
cursor: @cursor-disabled;
> a,
> button {
pointer-events: none;
opacity: @component-disabled-opacity;
}
}
.dropdown-menu > *:not(.disabled) button[disabled]:not(.btn) {
&,
&:hover,
&:focus {
color: @component-color-disabled ;
}
// Nuke hover/focus effects
&:hover,
&:focus {
background-color: @component-background-default;
background-image: none;
color: @component-color-disabled ;
text-decoration: none;
cursor: @cursor-disabled;
.reset-filter();
}
}
// Menu positioning
// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown
// menu with the parent.
.dropdown-menu-right {
right: 0;
left: auto; // Reset the default from `.dropdown-menu`
&-grid {
right: 9px ;
left: auto ;
}
}
@media (max-width: @screen-xs-max) {
.dropdown-menu-right--xs {
right: 0;
left: auto; // Reset the default from `.dropdown-menu`
&-grid {
right: 9px ;
left: auto ;
}
}
}
// This is only for left-aligning a dropdown menu within a `.navbar-right` or
// `.pull-right` nav component.
.dropdown-menu-left {
right: auto ;
left: 0 ;
}
.uib-dropdown-open {
.dropdown-menu-action-bar {
position: fixed;
top: 112px ;
}
}
.uib-dropdown-open,
.open {
.dropdown-menu-action-bar {
max-height: calc(100vh - 200px);
overflow-y: auto ;
height: auto;
.c8y-list__item{
padding-left: @component-padding;
padding-right: @component-padding;
.c8y-list__item__body{
padding-top: @margin-4;
padding-bottom: @margin-4;
}
}
}
}
// Dropdown section headers
.dropdown-header {
.text-label-small();
font-weight: 500;
display: block;
padding: @margin-base @component-padding;
border-top: 1px solid fade(@black, 5%);
background-color: @component-background-default;
color: @component-color-default;
white-space: nowrap;
font-size: @font-size-small;
line-height: @line-height-base;
&:not(:first-child) {
border-top: 2px solid @component-border-color;
}
&.no-border-top {
border-top: 0;
}
}
// Backdrop to catch body clicks on mobile, etc.
.dropdown-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: (@zindex-dropdown - 10);
}
// Right aligned dropdowns
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
// Allow for dropdowns to go bottom up (aka, dropup-menu)
// Just add .dropup after the standard .dropdown class and you're set.
.dropup,
.navbar-fixed-bottom .dropdown {
// Different positioning for bottom up menu
.dropdown-menu {
top: auto;
bottom: 100%;
margin-top: 0;
margin-bottom: 1px;
}
}
// Component alignment
@media (min-width: @grid-float-breakpoint) {
.navbar-right {
.dropdown-menu {
.dropdown-menu-right();
}
.dropdown-menu-left {
.dropdown-menu-left();
}
}
}
// wrapper for the toolbar
.more-wrapper {
.dropdown-menu > li > .btn.btn-link {
display: block;
padding: 10px 15px 9px ;
width: 100%;
border-top: 1px solid @component-border-color;
background-color: @component-background-default;
color: @component-color-actions;
text-align: left;
white-space: nowrap; // prevent links from randomly breaking onto new lines
font-weight: normal;
line-height: @line-height-base;
}
}
.dropup,
.navbar-fixed-bottom .dropdown {
// Different positioning for bottom up menu
.dropdown-menu {
top: auto;
bottom: 100%;
margin-top: 0;
margin-bottom: 1px;
}
}
.c8y-dropdown {
position: relative;
display: inline-block;
margin: 0;
&:not(.btn) {
padding: 10px;
border: 0;
border-radius: 0;
background-color: transparent;
background-image: none;
color: @component-color-actions;
}
&:hover,
.open & {
text-decoration: none;
> span {
position: relative;
z-index: 10;
}
}
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
position: relative;
}
+ .dropdown-menu {
overflow: hidden;
margin: 0;
height: 0;
border: 0;
> li,
> .d-contents > li {
a:not(.btn):not(.btn-help):not(.btn-clean),
button:not(.btn):not(.btn-help):not(.btn-clean),
label:not(.c8y-checkbox):not(.c8y-radio) {
display: block;
padding: 9px 16px 10px;
width: 100%;
border: 0;
border-top: 1px solid @component-border-color;
border-radius: 0;
background-color: @component-background-default;
background-image: none;
color: @component-color-actions;
text-align: left;
white-space: nowrap;
&.logViewer {
padding: 8px 0 0;
}
&:hover {
color: @component-color-actions-hover;
text-decoration: none;
}
}
@media (min-width: @screen-md-min) {
label {
padding: 9px 16px 10px;
}
}
}
}
}
.dropdown.open,
[dropdown].open,
.dropdown[dropdown-append-to-body='true'],
.btn-group.open {
.c8y-dropdown:not([aria-expanded='false']),
.c8y-dropdown[aria-expanded='true'] {
&:not(.btn) {
background: @component-background-default;
box-shadow: var(--c8y-elevation-md-bottom);
color: @component-color-actions-hover;
opacity: 1;
&:focus {
outline: 2px solid @component-color-focus;
outline-offset: -2px;
border-radius: @component-border-radius-focus;
}
}
+ .dropdown-menu {
height: auto;
border: 1px solid @component-border-color;
}
}
&.dropup {
.c8y-dropdown {
position: relative;
z-index: 1002;
}
}
}
.dropup.open,
.dropup.show,
[dropup].open {
.c8y-dropdown {
&:not(.btn) {
color: currentColor;
opacity: 1;
}
+ .dropdown-menu {
z-index: @zindex-navbar-fixed + 1;
height: auto;
}
}
}
.dropdown[c8yDropdownDirection],
.dropdown {
&.dropup {
.dropdown-menu:not([uib-dropdown-menu]) {
transform: translateY(calc(-100% - 32px)) ;
}
}
}
body {
> .dropdown-menu {
overflow: hidden;
margin: 0;
height: 0;
border: 0;
background-color: transparent;
> li {
position: relative;
a:not(.btn):not(.btn-help):not(.btn-clean),
button:not(.btn):not(.btn-help):not(.btn-clean) {
display: block;
padding: 10px 15px 9px;
width: 100%;
border: 0;
border-top: 1px solid @component-border-color;
border-radius: 0;
background-color: @component-background-default;
background-image: none;
text-align: left;
white-space: nowrap;
&:hover {
color: @component-color-actions-hover;
text-decoration: none;
}
&:focus {
outline: 2px solid @component-color-focus;
outline-offset: -2px;
border-radius: @component-border-radius-focus;
}
}
}
}
&.uib-dropdown-open {
> .dropdown-menu {
z-index: @zindex-modal + 1 ;
height: auto;
}
}
// fix z-index for ngx-bootstrap dropdown attached to body
> bs-dropdown-container {
z-index: @zindex-dropdown ;
height: 0;
.dropdown {
position: unset;
}
}
// fix z-index for ngx-bootstrap dropdown attached to body and the modal is open
&.modal-open{
> bs-dropdown-container {
z-index: @zindex-modal + 1 ;
}
}
}
// fix for AngularJS typeahead dropdown
[uib-typeahead-popup].dropdown-menu {
overflow: auto;
max-height: 200px;
width: 100%;
.c8y-scrollbar();
&:not(.uib-datepicker-popup) li {
position: static;
}
}
.c8y-search-dropdown {
.input-group-dropdown {
z-index: 1;
}
}
.c8y-select-v2 {
display: block;
height: @form-control-height-base;
.selected-items {
display: contents;
}
.input-group.input-group-dropdown {
border: solid @form-control-border-width @form-control-border-color-default;
outline-offset: -1px;
height: @form-control-height-base;
&:focus-within {
outline: solid 2px @form-control-border-color-focus;
outline-offset: -2px;
}
input.form-control {
background: transparent;
box-shadow: none;
width: 0 ;
right: 0;
left: 0;
// top:-1px;
z-index: 1;
height: calc(@form-control-height-base - 2px);
&:focus {
width: auto ;
background: rgba(255, 255, 255, 0.6);
background-clip: content-box;
}
}
.input-group-btn{
height: calc(@form-control-height-base - 2px);
> button {
height: calc(@form-control-height-base - 2px);
&:focus {
margin-left: 0;
}
}
}
div.form-control {
box-shadow: none;
background-color: transparent;
border: 0;
height: calc(@form-control-height-base - 2px);
}
}
.dropdown.open,
.dropdown.show {
input.form-control{
z-index: 3;
}
}
}