web-apps/apps/common/main/resources/less/buttons.less
2019-10-10 16:02:17 +03:00

760 lines
15 KiB
Plaintext

@x-huge-btn-height: 46px;
.btn {
border-radius: 1px;
color: @gray-deep;
.btnsize(@value) {
min-width: @value;
height: @value;
line-height: @value - 2px;
}
&.small {
.btnsize(20px);
}
&.normal {
height: 22px;
}
&.large {
.btnsize(31px);
}
&.huge {
.btnsize(37px);
}
&.x-huge {
.btnsize(@x-huge-btn-height);
}
&[disabled] {
opacity: 1;
.caption {
opacity: 0.65;
}
}
&:focus {
outline: 0;
outline-offset: 0;
}
&:active, &.active {
-webkit-box-shadow: none;
box-shadow: none;
}
.caret {
width: 7px;
height: 7px;
border: 0;
background-position: @arrow-small-offset-x @arrow-small-offset-y;
position: relative;
}
//&:active,
&:active:not(.disabled),
&.active:not(.disabled){
.caret {
background-position: @arrow-small-offset-x - 7px @arrow-small-offset-y;
}
}
&:active,
&.active {
&:focus,
&.focus {
outline: none;
}
}
&.icon-top {
display: inline-flex;
flex-direction: column;
align-items: center;
.icon {
//flex-grow: 1;
}
.caption {
line-height: 18px;
padding: 0 4px;
}
}
}
.btn.icon-top, .btn-group.icon-top {
display: inline-flex;
flex-direction: column;
&.open,
&.over {
&.split {
> .inner-box-icon {
.box-shadow(none);
}
}
}
&.x-huge {
@icon-size: 26px;
min-width: 45px;
height: @x-huge-btn-height;
img {
height: 27px;
}
.inner-box-caption {
line-height: 18px;
padding: 0 4px;
display: flex;
align-items: center;
.caption {
max-width: 107px;
text-overflow: ellipsis;
overflow: hidden;
}
}
.icon {
width: @icon-size;
height: @icon-size;
min-width: 0;
}
button.small .icon {
width: 20px;
height: 20px;
min-width: 0;
}
&.dropdown-toggle {
.caption {
max-width: 100px;
}
}
}
.inner-box-icon {
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
line-height: 20px;
}
.btn-fixflex-hcenter {
flex-grow: 1;
}
.btn-fixflex-vcenter {
display: flex;
align-items: center;
.caret {
vertical-align: inherit;
}
}
.inner-box-caption {
margin: 0;
height: 18px;
}
div.inner-box-icon {
height: 28px; // TODO: clear. Firefox bug 984869. fixed. isn't released.
}
}
.icon-top {
&.x-huge {
@icon-size: 26px;
.btn&, .btn-group& .btn-toolbar {
.mx-button-otherstates-icon2(@icon-size);
}
.btn.small {
.mx-button-otherstates-icon2(20px);
}
}
}
.btn-toolbar {
display: inline-block;
position: relative;
margin: 0;
padding: 0;
border: 0;
.border-radius(1px);
background-color: transparent;
.btn.small;
&.bg-white {
background-color: #fff;
}
&:before,
&:after {
content: "";
display: none;
}
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @secondary;
}
&:active:not(.disabled),
&.active:not(.disabled) {
color: lighten(@gray-lighter, 10%);
background-color: @primary;
}
&:not(.icon-top)
.caption:not(:empty) {
padding: 0 2px;
}
.icon {
padding: 0;
margin: 0;
display: inline-block;
background-repeat: no-repeat;
}
&:not(.x-huge) {
.icon {
width: 20px;
height: 20px;
line-height: 20px;
&:not(svg) {
.background-ximage('@{app-image-path}/toolbar-menu.png', '@{app-image-path}/toolbar-menu@2x.png', 60px);
}
}
}
&.x-huge, .btn-group.x-huge > & {
:not(svg).icon {
.background-ximage('@{common-image-path}/controls/toolbarbig.png', '@{common-image-path}/controls/toolbarbig@2x.png', 78px);
}
}
&:not(.x-huge) {
.icon {
//.background-ximage('@{app-image-path}/toolbar-menu.png', '@{app-image-path}/toolbar-menu@2x.png', 60px);
}
}
&.dropdown-toggle {
min-width: 7px;
}
// Large size
// ------------------------
&.large {
.icon {
width: 30px !important;
height: 30px;
line-height: 20px;
}
}
// Button has color line
// ------------------------
.btn-color-value-line {
pointer-events: none;
position: absolute;
left: 3px;
bottom: 2px;
width: 14px;
height: 3px;
background-color: red;
}
}
.btn-category {
.btn.large;
width: 100%;
padding: 0;
display: block;
position: relative;
.border-radius(0);
background-color: transparent;
font-weight: bold;
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @secondary;
}
&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @primary;
color: #fff;
}
.icon {
display: inline-block;
position: relative;
width: 20px;
height: 20px;
line-height: 20px;
}
&[disabled],
&.disabled {
color: #000;
opacity: 1;
}
}
// The clickable button for toggling the menu
// Remove the gradient and set the same inset shadow as the :active state
.btn-group {
> .btn-toolbar {
float: none;
}
> .btn {
+ .dropdown-toggle {
padding: 0 2px;
}
}
> .dropdown-toggle:first-child {
.inner-box-caret {
padding: 0 2px;
}
}
.caption {
&:empty {
display: none;
+ .caret {
margin-left: 2px;
}
}
}
&.open {
> .btn-toolbar {
//color: lighten(@gray-lighter, 10%);
// Show no shadow for `.btn-link` since it has no other button styles.
&.btn-link {
.box-shadow(none);
}
}
.dropdown-toggle {
.box-shadow(none);
}
}
&.over {
> button {
//background-color: @secondary;
}
}
&:not(.split) {
.btn-toolbar {
&.dropdown-toggle:not(.x-huge) {
width: 100%;
min-width: 28px;
}
&.btn-text-value {
.caret {
margin: 6px 3px 6px 0;
}
.caption {
vertical-align: middle;
}
&[disabled],
&.disabled {
opacity: 0.65;
}
}
&.large {
&.dropdown-toggle {
min-width: 40px;
.caret {
float: right;
}
}
}
}
}
@color-gray: @secondary;
@color-dark: @primary;
//@color-gray: #079e2f;
//@color-dark: #c52c0e;
&.split {
&.over:not(.disabled),
&.open {
box-shadow: inset 0 0 0 1px @color-gray;
button:not(.active):not(.btn-text-split-default) {
background-color: transparent;
}
}
&.over:not(.disabled) {
button {
&:not(.active) {
&:hover {
background-color: @color-gray;
}
}
&:active,
&:active:hover {
background-color: @color-dark;
}
}
}
&.open {
> button:not(.active) {
&:last-of-type {
background-color: @color-dark;
}
}
.caret {
background-position: @arrow-small-offset-x - 7px @arrow-small-offset-y;
}
}
button.active:not(.disabled) {
background-color: @color-dark;
}
.btn + .btn {
margin: 0;
}
}
}
.btn-color {
padding: 2px;
border:1px solid @input-border;
.border-radius(@border-radius-small);
span {
display:block;
border:1px solid @input-border;
background-color: transparent;
}
&,
&:hover,
.over,
&:active,
&.active {
background: #fff !important;
.box-shadow(none) !important;
}
&[disabled],
&.disabled {
opacity: 0.35;
}
.color-transparent {
background-position: -37px -196px;
}
}
.btn-options {
padding: 0;
margin:0;
border: 0 none;
.box-shadow(none);
background-color: transparent;
.icon {
position: relative;
min-width: inherit;
height: inherit;
line-height: inherit;
padding: 0;
margin: 0;
display: inline-block;
background-repeat: no-repeat;
}
&:hover,
.over,
&:active,
&.active {
}
}
.btn-text-default {
width: 75px;
height: 22px;
background: @input-bg;
border: 1px solid @input-border;
.border-radius(@border-radius-small);
&.auto {
width: auto;
padding-left: 10px;
padding-right: 10px;
}
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @secondary !important;
}
&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @primary !important;
border-color: @primary;
color: white;
}
&[disabled],
&.disabled {
opacity: 0.65;
}
}
.btn-text-menu-default {
width: 100%;
height: 22px;
background: @input-bg;
border: 1px solid @input-border;
.border-radius(@border-radius-small);
button {
width: 100%;
}
.caret {
position: absolute;
right: 3px;
margin-top: 5px;
}
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @secondary !important;
}
&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @primary !important;
color: white;
}
&[disabled],
&.disabled {
opacity: 0.65;
}
}
.btn-text-split-default {
width: 75px;
height: 22px;
background: @input-bg;
border: 1px solid @input-border;
.border-radius(@border-radius-small);
&.dropdown-toggle {
width: 13px;
}
&:not(.dropdown-toggle) {
border-right: none;
}
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @secondary !important;
}
&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @primary !important;
border-color: @primary;
color: white;
}
&[disabled],
&.disabled {
opacity: 0.65;
}
}
.btn-icon-default {
width: 45px;
height: 22px;
background: @input-bg;
border: 1px solid @input-border;
.border-radius(@border-radius-small);
.icon {
width: 28px;
padding: 0;
margin: 0;
position: relative;
display: inline-block;
background-repeat: no-repeat;
}
&.dropdown-toggle:first-child .inner-box-caret {
padding: 0 2px 0 0;
}
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @secondary !important;
}
&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @primary !important;
}
&[disabled],
&.disabled {
opacity: 0.65;
}
}
.btn-large-dataview {
display: inline-block;
width: 72px;
height: 58px;
padding: 2px;
margin:0;
box-shadow: none;
background-color: @input-bg;
border: 1px solid @input-border;
.border-radius(@border-radius-small);
.icon {
display: inline-block;
.btn.btnsize(52px);
padding: 0;
margin-right: 3px;
background-color: transparent;
background-repeat: no-repeat;
border: 1px solid @input-border;
position: relative;
}
&:hover,
.over,
&:active,
&.active {
background-color: @input-bg !important;
}
&:active:not(.disabled),
&.active:not(.disabled) {
.caret {
background-position: @arrow-small-offset-x @arrow-small-offset-y;
}
}
&[disabled],
&.disabled {
opacity: 0.65;
}
}
// Dialog buttons
// ------------------------
.dlg-btn {
font-weight: bold;
width: 86px;
color: @gray-deep;
background-color: @secondary;
&:hover:not(.disabled),
&.hover:not(.disabled) {
background-color: @secondary-hover;
}
&.primary {
color: #fff;
background-color: @primary;
&:hover:not(.disabled),
&.hover:not(.disabled) {
background-color: @primary-hover;
}
}
&[disabled] {
opacity: 0.65;
}
&.custom {
width: auto;
min-width: 86px;
}
}
@class100: zoom-int;
@class150: zoom-grit;
svg.icon {
.@{class150} {
display: none;
}
@media
only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-webkit-min-device-pixel-ratio: 2.5),
only screen and (min-resolution: 1.5dppx),
only screen and (min-resolution: 2.5dppx),
only screen and (min-resolution: 144dpi),
only screen and (min-resolution: 240dpi) {
.@{class100} {
display: none;
}
.@{class150} {
display: block;
}
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.4),
only screen and (-webkit-min-device-pixel-ratio: 4),
only screen and (min-resolution: 2dppx) and (max-resolution: 2.4dppx),
only screen and (min-resolution: 4dppx),
only screen and (min-resolution: 192dpi) and (max-resolution: 239dpi),
only screen and (min-resolution: 384dpi) {
.@{class100} {
display: block;
}
.@{class150} {
display: none;
}
}
}