2019-09-11 12:19:47 +00:00
|
|
|
/**
|
|
|
|
* Redefinition of the mw-ui-icon class from MediaWiki-core.
|
|
|
|
*
|
|
|
|
* This module attempts to maintain compatibility with the
|
|
|
|
* core mw-ui-icon module, while adding more mobile-friendly
|
|
|
|
* features like increased touch-area sizes and highlights.
|
|
|
|
*
|
|
|
|
* - mw-ui-icon = base class. 20px square with icon.
|
|
|
|
* - mw-ui-icon + mw-ui-icon-element = icon with padding & pseudo-states.
|
|
|
|
* - mw-ui-icon + mw-ui-icon-small = small icon with padding & pseudo-states.
|
|
|
|
* - mw-ui-icon + mw-ui-icon-flush-left = negative right-margin.
|
|
|
|
* - mw-ui-icon + mw-ui-icon-flush-right = negative left-margin.
|
|
|
|
* - mw-ui-icon + mw-ui-icon-before = *deprecated*, icon with text.
|
|
|
|
* Labels should be placed in a separate element beside the icon.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
@import '../../minerva.less/minerva.variables.less';
|
2019-10-23 04:01:22 +00:00
|
|
|
@import 'mediawiki.mixins.less';
|
2019-09-11 12:19:47 +00:00
|
|
|
/**
|
|
|
|
* Mixin for a pseudo-element with a background image.
|
|
|
|
*/
|
2019-10-02 20:21:42 +00:00
|
|
|
.mixin-background-square( @size ) {
|
|
|
|
// Sizing properties
|
2019-09-11 12:19:47 +00:00
|
|
|
content: '';
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2019-10-02 20:21:42 +00:00
|
|
|
// In case display: block is overridden and display gets set to `flex`
|
|
|
|
// because of inheritance T233521.
|
|
|
|
min-width: @size;
|
|
|
|
min-height: @size;
|
2019-09-11 12:19:47 +00:00
|
|
|
|
2019-10-02 20:21:42 +00:00
|
|
|
// Background properties.
|
2019-09-11 12:19:47 +00:00
|
|
|
background-repeat: no-repeat;
|
2019-10-02 20:21:42 +00:00
|
|
|
// Using static value instead of `background-size: contain` because of T233521#5545513.
|
|
|
|
background-size: @size @size;
|
2019-09-11 12:19:47 +00:00
|
|
|
background-position: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A standalone 20px square with screen-reader text. Contains a :before element
|
|
|
|
* to house the icon as a background image. Total size is increased with padding via
|
|
|
|
* `box-sizing: content-box`. This separates control over size of icon vs the size of
|
|
|
|
* the touch-area.
|
|
|
|
*/
|
2019-09-11 12:19:47 +00:00
|
|
|
.mw-ui-icon {
|
2019-09-11 12:19:47 +00:00
|
|
|
// reset font-size so the "em" value is relative to the more
|
|
|
|
// predictable rem font size ...and no rems because we can't have nice things.
|
2019-09-11 12:19:47 +00:00
|
|
|
font-size: initial;
|
2019-09-11 12:19:47 +00:00
|
|
|
|
|
|
|
// sizing
|
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
|
|
|
|
// this is important for increasing the size via padding. Overrides `.view-border-box *`.
|
|
|
|
box-sizing: content-box !important;
|
|
|
|
width: @icon-size-md;
|
|
|
|
height: @icon-size-md;
|
2019-09-26 11:27:39 +00:00
|
|
|
flex-basis: @icon-size-md;
|
2019-09-11 12:19:47 +00:00
|
|
|
|
|
|
|
// alignment
|
2019-09-11 12:19:47 +00:00
|
|
|
vertical-align: middle;
|
2019-09-11 12:19:47 +00:00
|
|
|
line-height: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
// resetting styles for <button> elements
|
|
|
|
-moz-appearance: none;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
background-color: transparent;
|
|
|
|
border: 0;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
&:before {
|
2019-10-02 20:21:42 +00:00
|
|
|
.mixin-background-square( @icon-size-md );
|
2019-09-11 12:19:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-11 12:19:47 +00:00
|
|
|
/**
|
|
|
|
* When aligning a series of similar icons (e.g. list items)
|
|
|
|
* prefer using a `:first-child` or `:last-child` selector.
|
|
|
|
* The flush-left/right classes are appropriate when that's unavailable.
|
|
|
|
*/
|
2019-09-17 19:47:36 +00:00
|
|
|
.mw-ui-icon-flush-top {
|
|
|
|
margin-top: -@icon-padding-md;
|
|
|
|
}
|
|
|
|
|
2019-09-11 12:19:47 +00:00
|
|
|
.mw-ui-icon-flush-left {
|
|
|
|
margin-left: -@icon-padding-md;
|
2019-09-11 12:19:47 +00:00
|
|
|
}
|
|
|
|
|
2019-09-11 12:19:47 +00:00
|
|
|
.mw-ui-icon-flush-right {
|
|
|
|
margin-right: -@icon-padding-md;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mw-ui-icon-element {
|
|
|
|
padding: @icon-padding-md;
|
|
|
|
border-radius: @borderRadius;
|
2019-10-23 04:01:22 +00:00
|
|
|
// Use semi-colon if multiple arguments are needed!
|
|
|
|
// See https://stackoverflow.com/questions/11419741/less-css-mixins-with-variable-number-of-arguments
|
|
|
|
.transition( background-color @transition-duration-base; );
|
2019-09-11 12:19:47 +00:00
|
|
|
|
|
|
|
// screen-reader text. Not using `text-indent: -999px` because
|
|
|
|
// the inner :before element is `display: block` so text-indent has no effect.
|
2019-09-12 23:42:24 +00:00
|
|
|
line-height: 999px;
|
2019-09-11 12:19:47 +00:00
|
|
|
color: transparent;
|
|
|
|
|
|
|
|
&:focus, &:active, &:visited {
|
|
|
|
color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: rgba( 0, 0, 0, 0.03 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.mw-ui-icon-small {
|
|
|
|
width: @icon-size-sm;
|
|
|
|
height: @icon-size-sm;
|
2019-09-26 11:27:39 +00:00
|
|
|
flex-basis: @icon-size-sm;
|
2019-09-11 12:19:47 +00:00
|
|
|
line-height: @icon-size-sm;
|
2019-10-02 20:21:42 +00:00
|
|
|
|
|
|
|
&:before {
|
|
|
|
.mixin-background-square( @icon-size-sm );
|
|
|
|
}
|
2019-09-11 12:19:47 +00:00
|
|
|
}
|
|
|
|
|
2019-09-26 15:30:03 +00:00
|
|
|
.mw-ui-icon-small.mw-ui-icon-element {
|
|
|
|
padding: @icon-padding-sm;
|
|
|
|
}
|
|
|
|
|
2019-09-11 12:19:47 +00:00
|
|
|
.mw-ui-icon-small.mw-ui-icon-flush-left {
|
|
|
|
margin-left: -@icon-padding-sm;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mw-ui-icon-small.mw-ui-icon-flush-right {
|
|
|
|
margin-right: -@icon-padding-sm;
|
|
|
|
}
|
|
|
|
|
2019-09-26 15:30:03 +00:00
|
|
|
.mw-ui-icon-small.mw-ui-icon-before:before {
|
|
|
|
min-width: @icon-size-sm;
|
|
|
|
min-height: @icon-size-sm;
|
|
|
|
margin-right: @icon-padding-sm;
|
|
|
|
}
|
|
|
|
|
2019-09-11 12:19:47 +00:00
|
|
|
.mw-ui-icon-before {
|
|
|
|
width: auto;
|
2019-09-12 23:42:24 +00:00
|
|
|
max-width: 100%;
|
2019-09-11 12:19:47 +00:00
|
|
|
|
|
|
|
&:before {
|
|
|
|
// sizing
|
|
|
|
display: inline-block;
|
2019-09-26 15:30:03 +00:00
|
|
|
font-size: initial;
|
2019-09-11 12:19:47 +00:00
|
|
|
width: auto;
|
|
|
|
min-width: @icon-size-md;
|
|
|
|
min-height: @icon-size-md;
|
|
|
|
|
|
|
|
// alignment. Margin is added to separate accompanying text.
|
2019-09-26 15:30:03 +00:00
|
|
|
margin-right: @icon-padding-md;
|
2019-09-11 12:19:47 +00:00
|
|
|
vertical-align: middle;
|
|
|
|
}
|
2019-09-18 15:31:24 +00:00
|
|
|
|
|
|
|
span {
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
2019-09-09 20:42:56 +00:00
|
|
|
}
|