UNPKG

@openui5/sap.m

Version:

OpenUI5 UI Library sap.m

281 lines (229 loc) 5.88 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; user-select: none; padding: 0.5rem 0 0.5rem 0; } .sapMSwtCont:not(.sapMSwtContDisabled) { cursor: pointer; } .sapMSwtCont > input { display: none; } /* Switch */ .sapMSwt { outline: none; 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: var(--sapButton_Background); border-color: var(--sapButton_BorderColor); } /* hover */ .sapMSwt.sapMSwtHoverable:hover { background: var(--sapButton_Hover_Background); } .sapMSwt.sapMSwtHoverable:not(.sapMSwtAcceptReject):hover { border-color: var(--sapButton_Hover_BorderColor); } .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 { transition: left 0.125s ease-in-out; } html[dir=rtl] .sapMSwtTrans > .sapMSwtInner { transition-property: right; } /* Switch text */ .sapMSwtText { text-align: center; font-size: var(--sapFontSmallSize); 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: var(--sapContent_LabelColor); } .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 var(--sapButton_BorderColor); } /* Switch type "AcceptReject" */ /* Switch type "AcceptReject" common styles */ /* background */ .sapMSwtAcceptReject.sapMSwtOn { border-color: var(--sapPositiveElementColor); } .sapMSwtAcceptReject.sapMSwtOff { border-color: var(--sapNegativeElementColor); } /* Switch */ /* background */ .sapMSwtAcceptReject.sapMSwt { background: var(--sapButton_Background); } /* Switch text */ .sapMSwtAcceptReject .sapMSwtLabelOn::before, .sapMSwtAcceptReject .sapMSwtLabelOff::before { font-family: var(--sapContent_IconFontFamily); speak: none; } /* icon fonts */ .sapMSwtAcceptReject .sapMSwtLabel { font-size: var(--sapFontLargeSize); } .sapMSwtAcceptReject .sapMSwtLabelOn::before { content: '\e05b'; color: var(--sapPositiveElementColor); } .sapMSwtAcceptReject .sapMSwtLabelOff::before { content: '\e03e'; color: var(--sapNegativeElementColor); } /* Switch handler */ .sapMSwtAcceptReject .sapMSwtHandle { background: transparent; border-style: solid; border-width: 0.125rem; } .sapMSwtAcceptReject.sapMSwtOn .sapMSwtHandle { border-color: var(--sapPositiveElementColor); } .sapMSwtAcceptReject.sapMSwtOff .sapMSwtHandle { border-color: var(--sapNegativeElementColor); } /* 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; }