UNPKG

metro4

Version:

The front-end framework for Build responsive, mobile-first projects on the web with the first front-end component library in Metro Style

770 lines (682 loc) 16.4 kB
@import (once) "include/vars"; @import (once) "include/mixins"; .button, .flat-button, .action-button { display: inline-block; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; padding: 0 .75rem; font-size: .875rem; line-height: 34px; height: 36px; transition: @transition-short; background-color: darken(@light, 5%); color: @dark; cursor: pointer; outline: none; position: relative; } .flat-button { min-width: 64px; background-color: transparent; } .button { &:active, &.focus, &:focus { .focus-show(@lightGray); } &:hover { background-color: @hoverBackground; } &.link { background-color: @transparent; color: @linkColor; &:hover { background-color: @transparent; color: @linkColorHover; text-decoration: underline; } &.focus, &:focus { box-shadow: none; } } } .button { &.hovered { &:hover { background-color: rgba(red(@dark), green(@dark), blue(@dark), .2); } } } .button { img { height: 1rem; } } .button { &.mini { .px2rem(font-size, 10px); padding: 0 .5rem; height: 20px; line-height: 20px; img { .px2rem(height, 10px); } } &.small { .px2rem(font-size, 12px); padding: 0 .6rem; height: 26px; line-height: 26px; img { .px2rem(height, 12px); } } &.large { .px2rem(font-size, 22px); padding: 0 1rem; height: 53px; line-height: 53px; img { .px2rem(height, 22px); } } } .button { &.square, &.cycle { .px2rem(width, 36px); .px2rem(height, 36px); padding-left: 0 !important; padding-right: 0 !important; &.mini { .px2rem(width, 22.38px); .px2rem(height, 22.38px); } &.small { .px2rem(width, 27.59px); .px2rem(height, 27.59px); } &.large { .px2rem(width, 53px); .px2rem(height, 53px); } } &.cycle { border-radius: 50%; } &.square, &.cycle { &.dropdown-toggle { &::before { display: none; } } } } .button { &.dropdown-toggle.no-marker { padding-right: .75rem!important; } } .command-button, .image-button { padding: .5rem; display: inline-flex; font-size: 1.5rem; transition: @transition-short; background-color: darken(@light, 5%); color: @dark; cursor: pointer; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; outline: none; position: relative; font-weight: 500; &:active, &.focus, &:focus { .focus-show(@lightGray); } .icon { .px2rem(width, 43px); .px2rem(height, 43px); .px2rem(line-height, 43px); font-size: 2rem; color: inherit; order: 1; } .caption { margin-left: .5rem; text-align: left; color: inherit; order: 2; font-weight: 400; line-height: 1.2; small { display: block; font-size: .8rem; } } &.icon-right { .icon { order: 2; } .caption { order: 1; margin-left: 0; margin-right: .5rem; } } } .image-button { font-size: 14px; padding: 0 .5rem 0 0; align-items: center; height: 36px; line-height: 30px; font-weight: 400; .icon { width: 34px; height: 34px; line-height: 34px; font-size: 1rem; background-color: rgba(red(@grayMouse), green(@grayMouse), blue(@grayMouse), .55); color: @white; order: 1; } .caption { order: 2; color: inherit; } &.icon-right { padding: 0 0 0 .5rem; .icon { order: 2; } .caption { order: 1; } } } .shortcut { width: 6rem; height: 6rem; padding: .5rem; display: inline-flex; flex-direction: column; font-size: .9rem; transition: @transition-short; background-color: darken(@light, 5%); color: @dark; cursor: pointer; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; position: relative; align-items: center; justify-content: space-between; outline: none; &:active, &.focus, &:focus { .focus-show(@lightGray); } .icon, .caption { display: block; } .icon { display: block; vertical-align: middle; width: 1.7rem; height: 1.7rem; font-size: 1.7rem; margin-top: 1rem; order: 1; } .caption { color: inherit; height: 1.2rem; order: 2; } .icon ~ .caption { margin-top: .875rem; } .tag { position: absolute; .px2rem(font-size, 11px); top: .25rem; right: .25rem; color: inherit; } &.no-caption { .icon { width: 2rem; height: 2rem; font-size: 2rem; margin-top: 1.5rem; } } } .tool-button { width: 2rem; height: 2rem; line-height: 2rem; vertical-align: middle; display: inline-block; text-align: center; background-color: darken(@light, 5%); color: @dark; user-select: none; border: 1px solid transparent; transition: @transition-short; padding: 0; cursor: pointer; outline: none; margin: 0 2px; position: relative; [class*=mif], .icon, img { height: 1rem; max-height: 1rem; font-size: 1rem; } &.text-button { width: auto; padding-left: .5rem; padding-right: .5rem; } } .toolbar { display: inline-flex; position: relative; padding: 0 0 0 .5725rem; top: 2px; flex-flow: row nowrap; &.no-divider { &::before { display: none; } } &::before { position: absolute; content: ""; width: .325rem; height: 100%; top: 0; left: 0; background-color: rgba(red(@grayMouse), green(@grayMouse), blue(@grayMouse), .20); cursor: move; } &.vertical { flex-flow: column nowrap; padding: .5725rem 0 0 0; width: 32px; &::before { width: 32px; height: .325rem; } .tool-button { margin: 2px 0; } } } .dropdown-button, .split-button, .info-button { display: inline-block; position: relative; width: auto; height: 36px; line-height: 1; } .split-button { .split { margin-left: -2px; padding: 0 .75rem; text-align: center; vertical-align: middle ; background-color: @lightGray; border: 1px @transparent solid; color: @dark; cursor: pointer; outline: none; font-size: .875rem; position: relative; line-height: 36px; height: 36px; &.dropdown-toggle { &::before {margin-left: -1.25rem;} } &:hover { background-color: darken(@lightGray, 10%); } } } .info-button { height: 36px; display: inline-flex; border: 1px solid @borderColor; background-color: darken(@light, 5%); overflow: hidden; position: relative; align-items: center; .button, .info { border-right: none; height: 100%; line-height: 32px; position: relative; &:active, &:focus { box-shadow: none!important; } } .button { background-color: inherit; color: inherit; &:hover { background-color: @hoverBackground; } } .info { font-size: 12px; background-color: #FEFEFE; color: @dark; padding: 0 .625rem; text-decoration: none; font-weight: 600; line-height: 34px; &:hover { color: @linkColorHover; } } } .button, .command-button, .image-button, .shortcut, .tool-button, .split-button .split { &:focus, &:hover { text-decoration: none; } &:active { outline: 0; .focus-show(@gray); } &.disabled, &:disabled { opacity: .65; } } .button, .command-button, .image-button, .shortcut, .tool-button, .split-button .split { &.outline { background: transparent none; border-width: 1px; border-color: @borderColor; } } .button, .command-button, .image-button, .shortcut, .tool-button, .split-button .split { &:active { box-shadow: none; } } .button-group { .active { background-color: @darkGray; color: @white; } } .expand-button { width: 36px; height: 36px; background-size: 1rem 1rem; background: center center no-repeat; text-indent: -9999px; border: 0; display: inline-block; cursor: pointer; z-index: 2; position: relative; float: left; outline: none; span { position: absolute; left: .5rem; width: 1.2rem; height: 2px; margin: 0 0 0; background: @dark; .rotate(0); .transition(.3s, linear); &:before, &:after { content: ''; position: absolute; top: -.5rem; right: 0; width: 1.2rem; height: 2px; background: @dark; .rotate(0); .transition(.3s, linear); } &:after { top: .5rem; } } &.transform { span { .rotate(180deg); background: @dark; &:before, &:after { content: ''; top: -5px; right: 0; width: .75rem; .rotate(45deg); } &:after { top: 5px; .rotate(-45deg); } } } &.light { span { background-color: @white; &:before, &:after { background-color: @white; } } } } .action-button { padding: 0; border-radius: 50%; width: 56px; height: 56px; line-height: 56px; text-align: center; .shadow(1); .icon { width: 20px; height: 20px; line-height: 20px; font-size: 20px; display: inline-block; text-align: center; margin-top: 18px; & > * { width: 100%; max-height: 100%; display: inline-block; } } &.second { width: 40px; height: 40px; line-height: 40px; box-shadow: 0 2px 10px 0 rgba(0,0,0,.16), 0 2px 5px 0 rgba(0,0,0,.26); .icon { width: 16px; height: 16px; line-height: 16px; font-size: 16px; margin-top: 0; } } &.prime { .shadow(2); } &:active { .shadow(3); } } .multi-action { display: inline-block; position: relative; .square(56, px); } .multi-action { .action-button { position: absolute; z-index: 2; margin: 0 !important; } .actions { position: absolute; list-style: none inside none; margin: 0 0 0 0; padding: 0; width: auto; float: left; background-color: transparent; top: 8px; left: 8px; z-index: 1; .circle(40, px); } .actions { li { position: absolute; display: block; .circle(40, px); .shadow(1); margin: 0; background: @darkGray; color: @white; transform: scale(.2); line-height: 40px; font-size: 20px; transition: all .3s; a { background: inherit; color: inherit; display: block; .circle(40, px); line-height: 40px; text-align: center; text-decoration: none; } &:active { .shadow(2); } } } .action-button { &.active ~ .actions { li { transition: all .3s; transform: scale(1); } li { &:nth-child(1) {margin-top: -56px;} &:nth-child(2) {margin-top: -104px;} &:nth-child(3) {margin-top: -152px;} &:nth-child(4) {margin-top: -200px;} &:nth-child(5) {margin-top: -248px;} &:nth-child(6) {margin-top: -296px;} &:nth-child(7) {margin-top: -344px;} &:nth-child(8) {margin-top: -392px;} &:nth-child(9) {margin-top: -440px;} &:nth-child(10) {margin-top: -488px;} } } &.active ~ .actions.drop-bottom { li { &:nth-child(1) {margin-top: 56px;} &:nth-child(2) {margin-top: 104px;} &:nth-child(3) {margin-top: 152px;} &:nth-child(4) {margin-top: 200px;} &:nth-child(5) {margin-top: 248px;} &:nth-child(6) {margin-top: 296px;} &:nth-child(7) {margin-top: 344px;} &:nth-child(8) {margin-top: 392px;} &:nth-child(9) {margin-top: 440px;} &:nth-child(10) {margin-top: 488px;} } } &.active ~ .actions.drop-right { li { margin-top: 0; } li { &:nth-child(1) {margin-left: 56px;} &:nth-child(2) {margin-left: 104px;} &:nth-child(3) {margin-left: 152px;} &:nth-child(4) {margin-left: 200px;} &:nth-child(5) {margin-left: 248px;} &:nth-child(6) {margin-left: 296px;} &:nth-child(7) {margin-left: 344px;} &:nth-child(8) {margin-left: 392px;} &:nth-child(9) {margin-left: 440px;} &:nth-child(10) {margin-left: 488px;} } } &.active ~ .actions.drop-left { li { margin-top: 0; } li { &:nth-child(1) {margin-left: -56px;} &:nth-child(2) {margin-left: -104px;} &:nth-child(3) {margin-left: -152px;} &:nth-child(4) {margin-left: -200px;} &:nth-child(5) {margin-left: -248px;} &:nth-child(6) {margin-left: -296px;} &:nth-child(7) {margin-left: -344px;} &:nth-child(8) {margin-left: -392px;} &:nth-child(9) {margin-left: -440px;} &:nth-child(10) {margin-left: -488px;} } } } .action-button .icon { transition: all .3s; } .action-button { &.active.rotate .icon { .rotate(45deg); } &.active.rotate-minus .icon { .rotate(-45deg); } } } .action-button, .multi-action { &.floating-action-top { z-index: @zindex-top; top: 90px; left: 16px; position: fixed; } &.floating-action-bottom { z-index: @zindex-top; bottom: 20px; right: 20px; position: fixed; } } a { &.button, &.flat-button, &.action-button, &.command-button, &.image-button, &.shortcut, &.tool-button, &.split-button, &.split { color: @dark; box-shadow: none; text-decoration: none; &:hover { box-shadow: none; } &:active, &.focus, &:focus { .focus-show(@lightGray); } } }