@c8y/style
Version:
Styles for Cumulocity IoT applications
417 lines (351 loc) • 8.76 kB
text/less
@import "../../../mixins/_shadows-helper.less";
@import "../../../mixins/_vendor-prefixes.less";
/**
* C8Y Action Bar - Fixed action bar/toolbar component
*
* Note: Uses @size-* tokens for spacing; @size-base for calculations, and @grid-gutter-width.
*
* Intentionally hardcoded values:
* - Component-specific dimensions (140px, 280px, 330px, 400px): Input and dropdown widths
* - Off-token spacing (3px, 7px, 15px, 28px): Legacy padding not in token system
* - Negative positioning (-2px): Fine-tuning
* - Clip rect values (10000px, 2000px): Large clipping dimensions
* - Typography size (1.2em): Relative font size
* - Percentages (50%, 100%): Layout and positioning
* - Border widths (1px, 2px): Standard borders and outlines
* - Negative offsets (-2px): Fine-tuning
* - Transition durations (0.35s, 0.5s): Animation timing
* - Calc expressions: Complex computed values with @headerHeight
* - Box-shadow values: Elevation effects
* - Opacity values: Visual effects
*/
.c8y-ui-action-bar {
min-height: @size-48;
background-color: @action-bar-background-default;
color: @action-bar-color-default;
position: fixed;
top: calc(-1 * @size-4);
right: 0;
left: 0;
margin: 0;
z-index: @zindex-action-bar;
max-width: 100vw;
box-shadow: var(--c8y-elevation-md-bottom);
@media (max-width: @screen-xs-max) {
transition: top 0.5s ease;
.head-open & {
top: calc(@headerHeight + 28px);
}
&.has-tabs {
top: -2px;
transition: top 0.35s ease;
.head-open & {
top: calc(@headerHeight * 2 + (@size-base * 1.5));
}
}
}
@media (min-width: @screen-sm-min) {
top: @headerHeight;
clip: rect(0, 10000px, 2000px, 0);
&.horizontal-tabs.has-tabs {
top: calc(@headerHeight * 2);
}
}
@media (min-width: @grid-float-breakpoint) {
.transition(left @open-menu-time-type);
&.navigator-open {
left: @navigatorWidth;
}
&.horizontal-tabs.has-tabs {
top: calc(@headerHeight * 2 - @size-16);
}
}
}
body:not(:has(.app-main-header)) {
.c8y-ui-action-bar {
top: 0;
&.has-tabs {
top: @size-48;
}
@media (max-width: @screen-xs-max) {
&.has-tabs {
display: none;
}
.navbar-header {
display: none;
}
}
}
&:has(.vertical-tabs) {
.c8y-ui-action-bar {
top: 0;
}
}
}
.c8y-ui-action-bar {
.navbar-toggle {
margin: 0;
}
.navbar-brand {
opacity: 1;
}
.navbar-collapse {
padding-right: calc(@grid-gutter-width * 0.5);
padding-left: calc(@grid-gutter-width * 0.5);
border: 0;
max-height: 0;
overflow: hidden;
transition: max-height 0.35s ease;
@media (min-width: @screen-sm-min) {
min-height: calc(@size-base * 6);
overflow: visible ;
display: flex;
&.collapse {
display: flex ;
.navbar-right {
margin-left: auto;
}
}
}
@media (min-width: @screen-md-min) {
padding-right: @grid-gutter-width;
padding-left: @grid-gutter-width;
}
&.in,
.head-open & {
max-height: calc(~'100vh - 180px');
overflow: auto;
}
}
@media (min-width: @screen-sm-min) {
.navbar-header {
display: none;
}
.navbar-nav {
.dropdown-menu {
max-width: 330px;
&.uib-datepicker-popup {
width: 280px;
}
&.dropdown-menu-wide {
max-width: 400px;
}
}
}
}
// menu bar
.navbar-nav {
> .dropdown {
margin-top: @size-5;
vertical-align: top;
}
.dropdown-menu {
> li > * {
display: block;
overflow: hidden ;
max-width: 100% ;
text-overflow: ellipsis ;
white-space: nowrap ;
}
}
> .navbar-form,
> .btn-group {
display: block;
margin: 0;
padding: 3px @size-16;
@media (min-width: @screen-sm-min) {
display: flex;
margin: 0;
padding: 7px @size-8;
&:first-child {
padding-left: 0;
}
}
> .btn {
float: none;
}
}
> .pull-right {
order: 100;
}
> li:not(.navbar-form) {
position: relative;
@media (max-width: @screen-xs-max) {
float: none ;
}
@media (min-width: @screen-sm-min) {
z-index: 10;
&::after {
position: absolute;
top: 50%;
right: 0;
width: 1px;
height: @size-20;
content: '';
.translate(0, -50%);
}
&:last-child {
&::after {
background-color: transparent;
}
}
}
.btn-help {
font-size: 1.2em;
margin: calc(@size-base * 1.5) 0;
}
> a,
.btn-link,
.c8y-dropdown {
padding: calc(@size-16 - 2px) @size-base;
color: @action-bar-color-actions;
opacity: 1;
transition: @btn-transition;
@media (max-width: @screen-xs-max) {
display: block;
padding: @size-base @size-16;
width: 100%;
max-width: 100%;
text-align: left;
}
&:focus {
color: inherit;
text-decoration: none;
outline: 2px solid @action-bar-color-focus;
outline-offset: -2px;
border-radius: @component-border-radius-focus ;
}
.c8y-icon,
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
color: @action-bar-icon-color;
}
&:hover,
&:active {
&:not([disabled]) {
color: @action-bar-color-actions-hover;
text-decoration: none;
.c8y-icon,
[class^='dlt-c8y-icon-'],
[class*=' dlt-c8y-icon-'] {
color: @action-bar-color-actions-hover;
opacity: 1;
}
}
}
}
.dropdown.open .c8y-dropdown + .dropdown-menu,
[dropdown].open .c8y-dropdown + .dropdown-menu,
.btn-group.open .c8y-dropdown + .dropdown-menu {
.boxShadowHelper(md, right);
}
.dropdown.open .c8y-dropdown {
color: @action-bar-color-actions-hover;
}
> .navbar-info {
padding: 15px @size-10;
}
@media (max-width: @screen-xs-max) {
.dropdown {
padding: 0;
width: 100%;
border-top: 1px solid @component-border-color;
.c8y-dropdown {
display: none ;
}
.dropdown-menu {
position: static;
display: block;
margin-top: 0;
width: 100%;
height: auto;
box-shadow: none;
li {
button:not(.btn) {
padding: @size-8 @size-16;
}
}
}
}
&.no-remove.more-wrapper {
height: 0;
.dropdown {
border-top: 0;
}
}
}
}
@media (max-width: @screen-xs-max) {
margin: 0;
display: flex;
flex-direction: column;
> li:not(.more-wrapper) {
box-shadow: inset 0 1px 0 @action-bar-border-color;
}
> li.navbar-form {
display: block;
margin-top: 0;
padding: 2px @size-16;
> .c8y-select-wrapper {
width: 100%;
}
}
}
}
.navbar-text {
margin-left: 0;
color: @action-bar-color-text-muted;
}
// forms in toolbar
.navbar-form {
margin-top: @size-8;
> .btn + .btn {
margin-left: 0;
}
@media (min-width: @screen-sm-min) {
min-height: @size-48;
// min-width: 300px;
.datepicker > input {
width: 140px;
text-align: center;
}
}
label:not(.c8y-switch) {
display: inline-block;
align-self: center;
margin-right: @size-4;
margin-bottom: 0;
color: @action-bar-color-text-muted;
vertical-align: middle;
text-transform: none;
font-weight: normal;
font-size: inherit;
}
@media (max-width: @screen-xs-max) {
margin-top: 0;
padding: 0;
.form-group:not(.datepicker) {
display: block;
padding: @size-5 0;
}
.datepicker > input {
width: 100%;
text-align: left;
}
}
.btn[uib-btn-checkbox] {
margin: 3px 0 0;
}
}
// MISC
.btn[disabled]:not(.btn-primary) {
pointer-events: auto ;
&,
&:hover,
&:focus,
i {
opacity: @action-bar-disabled-opacity ;
cursor: @cursor-disabled ;
}
}
}