Debian Codegraph @

resources/src/mediawiki.less/mediawiki.ui/mixins.buttons.less

raw
1 // MediaWiki.ui button mixins for MediaWiki (deprecated)
2 //
3 // Helper mixins used to create button styles. This file is importable
4 // by all LESS files via `@import 'mediawiki.ui/mixins.buttons.less';`.
5
6 @import 'mediawiki.skin.variables.less';
7
8 /* stylelint-disable selector-class-pattern */
9 // Default button mixin.
10 .mw-ui-button() {
11 // Container layout
12 display: inline-block;
13 box-sizing: border-box;
14 margin: 0;
15 border-width: @border-width-base;
16 border-style: @border-style-base;
17 border-radius: @border-radius-base;
18 // Ensure that buttons and inputs are nicely aligned when they have differing heights
19 vertical-align: middle;
20 // Inherit the font rather than apply user agent stylesheet (T72072)
21 font-family: inherit;
22 font-size: 1em;
23 font-weight: bold;
24 line-height: 1.28571429em;
25 text-align: center;
26 // Disable weird iOS styling
27 -webkit-appearance: none;
28
29 &:not( .mw-ui-icon-element ) {
30 min-height: 32px;
31 min-width: 4em;
32 max-width: 28.75em; // equivalent to 460px, @see T95367
33 padding: 5px 12px;
34 }
35 }
36
37 // Mixin for button interaction states.
38 .mw-ui-button-states() {
39 &:not( :disabled ) {
40 border-color: @border-color-base;
41 // Add `transition`s exclusively on enabled buttons.
42 transition-property: @transition-property-base;
43 transition-duration: @transition-duration-base;
44
45 // Make sure that `color` isn't inheriting from user-agent styles
46 &:visited {
47 color: @color-base;
48 }
49
50 &:hover {
51 background-color: @background-color-base;
52 color: @color-base--hover;
53 cursor: @cursor-base--hover;
54 }
55
56 &:focus {
57 // Make sure that `color` isn't inheriting from user-agent styles
58 color: @color-base;
59 border-color: @border-color-progressive--focus;
60 box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus;
61 // Set the standard focus `outline` transparent. A `border` and `box-shadow` visual
62 // focus is added above for common rendering.
63 // In Windows high contrast mode the transparent outline becomes visible.
64 // As vendor stylesheets set the outline on `:focus`, we need to follow here too and
65 // can't rely on the next selector to override it.
66 outline: @outline-base--focus;
67
68 // Remove the inner border and padding in Firefox.
69 &::-moz-focus-inner {
70 // As this is a reset, we're not using skin variables here.
71 border-color: transparent;
72 padding: 0;
73 }
74 }
75
76 &:active,
77 &.is-on {
78 background-color: @background-color-interactive;
79 color: @color-emphasized;
80 border-color: @border-color-interactive;
81 box-shadow: none;
82 }
83 }
84
85 &:disabled {
86 background-color: @background-color-disabled;
87 color: @color-inverted;
88 border-color: @border-color-disabled;
89 cursor: @cursor-base--disabled;
90 }
91 }
92
93 // Primary buttons mixin.
94 .mw-ui-button-colors-primary( @bgColor, @highlightColor, @activeColor ) {
95 &:not( :disabled ) {
96 background-color: @bgColor;
97 color: @color-inverted;
98 // border of the same color as background so that light background and
99 // dark background buttons are the same height and width
100 border-color: @bgColor;
101
102 &:hover {
103 background-color: @highlightColor;
104 border-color: @highlightColor;
105 }
106
107 &:focus {
108 box-shadow: @box-shadow-inset-small @bgColor, @box-shadow-inset-medium @box-shadow-color-inverted;
109 }
110
111 &:active,
112 &.is-on {
113 background-color: @activeColor;
114 border-color: @activeColor;
115 box-shadow: none;
116 }
117 }
118
119 &:disabled {
120 background-color: @background-color-disabled;
121 color: @color-inverted;
122 border-color: @border-color-disabled;
123 }
124 }