UNPKG

@openui5/sap.m

Version:

OpenUI5 UI Library sap.m

344 lines (270 loc) 7.58 kB
/* ============================= */ /* CSS for control sap.m/Switch */ /* Base theme */ /* ============================= */ /* ------------------------------ */ /* Switch required variables */ /* ------------------------------ */ @_sap_m_Switch_OnPosition: -32; @_sap_m_Switch_OffPosition: 0; @_sap_m_Switch_TransitionTime: 175; /* ------------------------------ */ /* Switch common styles */ /* ------------------------------ */ .sapMSwtText, .sapMSwtHandle, .sapMSwtInner { position: absolute; } .sapMSwtCont, .sapMSwt { position: relative; } .sapMSwtText, .sapMSwtAcceptReject .sapMSwtHandle { box-sizing: border-box; } /* ------------------------------ */ /* Switch container */ /* ------------------------------ */ .sapMSwtCont { display: inline-block; vertical-align: top; outline: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0.5rem 0 0.5rem 0; } .sapMSwtCont:not(.sapMSwtContDisabled) { cursor: pointer; } .sapMSwtCont > input { display: none; } /* ------------------------------ */ /* Switch */ /* ------------------------------ */ .sapMSwt { outline: none; /* IE Windows 8 */ /* This elements receives events when not panning in vertial direction */ touch-action: pan-y; -ms-touch-action: pan-y; width: 4rem; height: 2rem; /* use px instead of rem, borders sized in "rem" disappear when the page is zoomed out in Chrome. */ border: 1px solid; /* 1px margin from left and right, so the outline doesn't get cropped when focuses */ margin: 0 1px; /* note: some browsers like Samsung Galaxy S4 with Android 4.2 does not support the "border-radius" shorthand property but does support the long-hand properties for each corner like "border-top-left-radius" */ border-top-left-radius: 1rem; border-top-right-radius: 1rem; border-bottom-right-radius: 1rem; border-bottom-left-radius: 1rem; overflow: hidden; } /* background */ .sapMSwtOn:not(.sapMSwtAcceptReject) { background: @sapUiToggleButtonPressedBackground; border-color: @sapUiToggleButtonPressedBorderColor; } .sapMSwtOff:not(.sapMSwtAcceptReject) { background: @sapUiButtonBackground; border-color: @sapUiButtonBorderColor; } /* hover */ .sapMSwt.sapMSwtHoverable:hover { background: @sapUiButtonHoverBackground; } .sapMSwt.sapMSwtHoverable:not(.sapMSwtAcceptReject):hover { border-color: @sapUiButtonHoverBorderColor; } .sapMSwtHoverable.sapMSwtOn:not(.sapMSwtAcceptReject):hover { background: @sapUiToggleButtonPressedHoverBackground; border-color: @sapUiToggleButtonPressedHoverBorderColor; } /* focus */ .sapMSwtDisabled:focus { outline: none; } /* ------------------------------ */ /* Switch inner */ /* ------------------------------ */ .sapMSwtInner { width: 100%; height: 100%; } .sapMSwtOff > .sapMSwtInner { left: -2rem; } .sapMSwtOn > .sapMSwtInner { left: 0; } /* CSS transitions */ .sapMSwtTrans > .sapMSwtInner { -webkit-transition: left 0.125s ease-in-out; transition: left 0.125s ease-in-out; } html[dir=rtl] .sapMSwtTrans > .sapMSwtInner { -webkit-transition-property: right; transition-property: right; } /* ------------------------------ */ /* Switch text */ /* ------------------------------ */ .sapMSwtText { text-align: center; font-size: @sapMFontSmallSize; width: 100%; line-height: 2rem; } .sapMSwtLabel { display: block; white-space: nowrap; text-decoration: none; overflow: hidden; width: 1.875rem; padding: 0 0.1875rem; text-transform: uppercase; line-height: inherit; } .sapMSwtOn .sapMSwtText { color: @sapUiToggleButtonPressedTextColor; } .sapMSwtOff .sapMSwtText { color: @sapUiContentLabelColor; } .sapMSwtTextOff { left: 2rem; } .sapMSwtLabelOff { float: right; } .sapMSwt.sapMSwtDefault { &.sapMSwtOff .sapMSwtTextOn, &.sapMSwtOn .sapMSwtTextOff { .sapMSwtLabel { // Special case - the currently invisible label should be smaller // so the text won't get in the visible part of the control width: 1.6rem; } } } /* ------------------------------ */ /* Switch handler */ /* ------------------------------ */ .sapMSwtHandle { display: block; top: 0; bottom: 0; margin: auto; width: 1.5rem; height: 1.5rem; left: 2.25rem; // note: some browsers like Samsung Galaxy S4 with Android 4.2 does not support the "border-radius" shorthand property // but does support the long-hand properties for each corner like "border-top-left-radius" border-top-left-radius: 0.75rem; border-top-right-radius: 0.75rem; border-bottom-right-radius: 0.75rem; border-bottom-left-radius: 0.75rem; -webkit-background-clip: padding-box; background-clip: padding-box; } /* background */ .sapMSwtOn .sapMSwtHandle { background: transparent; box-sizing: border-box; border: 2px solid contrast(@sapUiToggleButtonPressedBackground, @sapUiContentIconColor, @sapUiContentContrastIconColor, @sapUiContentContrastTextThreshold); } .sapMSwtOff .sapMSwtHandle { background: transparent; box-sizing: border-box; border: 2px solid @sapUiButtonBorderColor; } /* ====================================================== */ /* switch type "AcceptReject" */ /* ====================================================== */ /* ----------------------------------------- */ /* Switch type "AcceptReject" common styles */ /* ----------------------------------------- */ /* background */ .sapMSwtAcceptReject.sapMSwtOn { border-color: @sapUiPositiveElement; } .sapMSwtAcceptReject.sapMSwtOff { border-color: @sapUiNegativeElement; } /* ------------------------------ */ /* Switch */ /* ------------------------------ */ /* background */ .sapMSwtAcceptReject.sapMSwt { background: @sapUiButtonBackground; } /* ------------------------------ */ /* Switch text */ /* ------------------------------ */ .sapMSwtAcceptReject .sapMSwtLabelOn::before, .sapMSwtAcceptReject .sapMSwtLabelOff::before { font-family: 'SAP-icons'; speak: none; } /* icon fonts */ .sapMSwtAcceptReject .sapMSwtLabel { font-size: @sapMFontLargeSize; } .sapMSwtAcceptReject .sapMSwtLabelOn::before { content: "\e05b"; color: @sapUiPositiveElement; } .sapMSwtAcceptReject .sapMSwtLabelOff::before { content: "\e03e"; color: @sapUiNegativeElement; } /* ------------------------------ */ /* Switch handler */ /* ------------------------------ */ .sapMSwtAcceptReject .sapMSwtHandle { background: transparent; border-style: solid; border-width: 0.125rem; } .sapMSwtAcceptReject.sapMSwtOn .sapMSwtHandle { border-color: @sapUiPositiveElement; } .sapMSwtAcceptReject.sapMSwtOff .sapMSwtHandle { border-color: @sapUiNegativeElement; } /* ============ */ /* compact size */ /* ============ */ /* ------------------------------ */ /* Switch container */ /* ------------------------------ */ .sapUiSizeCompact .sapMSwtCont { padding-top: 0.125rem; padding-bottom: 0.125rem; } /* ------------------------------ */ /* Switch */ /* ------------------------------ */ .sapUiSizeCompact .sapMSwt { width: 3.5rem; height: 1.625rem; } /* ------------------------------ */ /* Switch text */ /* ------------------------------ */ .sapUiSizeCompact .sapMSwtText { line-height: 1.625rem; } /* ------------------------------ */ /* Switch handler */ /* ------------------------------ */ .sapUiSizeCompact .sapMSwtHandle { height: 1rem; width: 1rem; }