mixins.less 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  1. //
  2. // Mixins
  3. // --------------------------------------------------
  4. // Utilities
  5. // -------------------------
  6. // Clearfix
  7. // Source: http://nicolasgallagher.com/micro-clearfix-hack/
  8. //
  9. // For modern browsers
  10. // 1. The space content is one way to avoid an Opera bug when the
  11. // contenteditable attribute is included anywhere else in the document.
  12. // Otherwise it causes space to appear at the top and bottom of elements
  13. // that are clearfixed.
  14. // 2. The use of `table` rather than `block` is only necessary if using
  15. // `:before` to contain the top-margins of child elements.
  16. .clearfix() {
  17. &:before,
  18. &:after {
  19. content: ' '; // 1
  20. display: table; // 2
  21. }
  22. &:after {
  23. clear: both;
  24. }
  25. }
  26. // WebKit-style focus
  27. .tab-focus() when (@is-new-css = false) {
  28. // Default
  29. outline: thin dotted;
  30. // WebKit
  31. outline: 5px auto -webkit-focus-ring-color;
  32. outline-offset: -2px;
  33. }
  34. .tab-focus() when (@is-new-css = true) {
  35. outline: none;
  36. }
  37. // Center-align a block level element
  38. .center-block() {
  39. display: block;
  40. margin-left: auto;
  41. margin-right: auto;
  42. }
  43. // Sizing shortcuts
  44. .size(@width; @height) {
  45. width: @width;
  46. height: @height;
  47. }
  48. .square(@size) {
  49. .size(@size; @size);
  50. }
  51. // Placeholder text
  52. .placeholder(@color: @input-color-placeholder) {
  53. &::-moz-placeholder {
  54. color: @color; // Firefox
  55. opacity: 1;
  56. } // See https://github.com/twbs/bootstrap/pull/11526
  57. &:-ms-input-placeholder {
  58. color: @color;
  59. } // Internet Explorer 10+
  60. &::-webkit-input-placeholder {
  61. color: @color;
  62. } // Safari and Chrome
  63. }
  64. // Text overflow
  65. // Requires inline-block or block for proper styling
  66. .text-overflow() {
  67. overflow: hidden;
  68. text-overflow: ellipsis;
  69. white-space: nowrap;
  70. }
  71. // CSS image replacement
  72. //
  73. // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for
  74. // mixins being reused as classes with the same name, this doesn't hold up. As
  75. // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note
  76. // that we cannot chain the mixins together in Less, so they are repeated.
  77. //
  78. // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
  79. // Deprecated as of v3.0.1 (will be removed in v4)
  80. .hide-text() {
  81. font: ~'0/0' a;
  82. color: transparent;
  83. text-shadow: none;
  84. background-color: transparent;
  85. border: 0;
  86. }
  87. // New mixin to use as of v3.0.1
  88. .text-hide() {
  89. .hide-text();
  90. }
  91. // CSS3 PROPERTIES
  92. // --------------------------------------------------
  93. // Single side border-radius
  94. .border-top-radius(@radius) {
  95. border-top-right-radius: @radius;
  96. border-top-left-radius: @radius;
  97. }
  98. .border-right-radius(@radius) {
  99. border-bottom-right-radius: @radius;
  100. border-top-right-radius: @radius;
  101. }
  102. .border-bottom-radius(@radius) {
  103. border-bottom-right-radius: @radius;
  104. border-bottom-left-radius: @radius;
  105. }
  106. .border-left-radius(@radius) {
  107. border-bottom-left-radius: @radius;
  108. border-top-left-radius: @radius;
  109. }
  110. // Drop shadows
  111. //
  112. // Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's
  113. // supported browsers that have box shadow capabilities now support the
  114. // standard `box-shadow` property.
  115. .box-shadow(@shadow) {
  116. -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
  117. box-shadow: @shadow;
  118. }
  119. .box-shadow-button-input() {
  120. box-shadow: 0px 0px 0px 2px @blue-30;
  121. }
  122. // Transitions
  123. .transition(@transition) {
  124. -webkit-transition: @transition;
  125. transition: @transition;
  126. }
  127. .transition-property(@transition-property) {
  128. -webkit-transition-property: @transition-property;
  129. transition-property: @transition-property;
  130. }
  131. .transition-delay(@transition-delay) {
  132. -webkit-transition-delay: @transition-delay;
  133. transition-delay: @transition-delay;
  134. }
  135. .transition-duration(@transition-duration) {
  136. -webkit-transition-duration: @transition-duration;
  137. transition-duration: @transition-duration;
  138. }
  139. .transition-transform(@transition) {
  140. -webkit-transition: -webkit-transform @transition;
  141. -moz-transition: -moz-transform @transition;
  142. -o-transition: -o-transform @transition;
  143. transition: transform @transition;
  144. }
  145. // Transformations
  146. .rotate(@degrees) {
  147. -webkit-transform: rotate(@degrees);
  148. -ms-transform: rotate(@degrees); // IE9 only
  149. transform: rotate(@degrees);
  150. }
  151. .scale(@ratio; @ratio-y...) {
  152. -webkit-transform: scale(@ratio, @ratio-y);
  153. -ms-transform: scale(@ratio, @ratio-y); // IE9 only
  154. transform: scale(@ratio, @ratio-y);
  155. }
  156. .translate(@x; @y) {
  157. -webkit-transform: translate(@x, @y);
  158. -ms-transform: translate(@x, @y); // IE9 only
  159. transform: translate(@x, @y);
  160. }
  161. .skew(@x; @y) {
  162. -webkit-transform: skew(@x, @y);
  163. -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+
  164. transform: skew(@x, @y);
  165. }
  166. .translate3d(@x; @y; @z) {
  167. -webkit-transform: translate3d(@x, @y, @z);
  168. transform: translate3d(@x, @y, @z);
  169. }
  170. .rotateX(@degrees) {
  171. -webkit-transform: rotateX(@degrees);
  172. -ms-transform: rotateX(@degrees); // IE9 only
  173. transform: rotateX(@degrees);
  174. }
  175. .rotateY(@degrees) {
  176. -webkit-transform: rotateY(@degrees);
  177. -ms-transform: rotateY(@degrees); // IE9 only
  178. transform: rotateY(@degrees);
  179. }
  180. .perspective(@perspective) {
  181. -webkit-perspective: @perspective;
  182. -moz-perspective: @perspective;
  183. perspective: @perspective;
  184. }
  185. .perspective-origin(@perspective) {
  186. -webkit-perspective-origin: @perspective;
  187. -moz-perspective-origin: @perspective;
  188. perspective-origin: @perspective;
  189. }
  190. .transform-origin(@origin) {
  191. -webkit-transform-origin: @origin;
  192. -moz-transform-origin: @origin;
  193. -ms-transform-origin: @origin; // IE9 only
  194. transform-origin: @origin;
  195. }
  196. // Animations
  197. .animation(@animation) {
  198. -webkit-animation: @animation;
  199. animation: @animation;
  200. }
  201. .animation-name(@name) {
  202. -webkit-animation-name: @name;
  203. animation-name: @name;
  204. }
  205. .animation-duration(@duration) {
  206. -webkit-animation-duration: @duration;
  207. animation-duration: @duration;
  208. }
  209. .animation-timing-function(@timing-function) {
  210. -webkit-animation-timing-function: @timing-function;
  211. animation-timing-function: @timing-function;
  212. }
  213. .animation-delay(@delay) {
  214. -webkit-animation-delay: @delay;
  215. animation-delay: @delay;
  216. }
  217. .animation-iteration-count(@iteration-count) {
  218. -webkit-animation-iteration-count: @iteration-count;
  219. animation-iteration-count: @iteration-count;
  220. }
  221. .animation-direction(@direction) {
  222. -webkit-animation-direction: @direction;
  223. animation-direction: @direction;
  224. }
  225. // Backface visibility
  226. // Prevent browsers from flickering when using CSS 3D transforms.
  227. // Default value is `visible`, but can be changed to `hidden`
  228. .backface-visibility(@visibility) {
  229. -webkit-backface-visibility: @visibility;
  230. -moz-backface-visibility: @visibility;
  231. backface-visibility: @visibility;
  232. }
  233. // Box sizing
  234. .box-sizing(@boxmodel) {
  235. -webkit-box-sizing: @boxmodel;
  236. -moz-box-sizing: @boxmodel;
  237. box-sizing: @boxmodel;
  238. }
  239. // User select
  240. // For selecting text on the page
  241. .user-select(@select) {
  242. -webkit-user-select: @select;
  243. -moz-user-select: @select;
  244. -ms-user-select: @select; // IE10+
  245. user-select: @select;
  246. }
  247. // Resize anything
  248. .resizable(@direction) {
  249. resize: @direction; // Options: horizontal, vertical, both
  250. overflow: auto; // Safari fix
  251. }
  252. // CSS3 Content Columns
  253. .content-columns(@column-count; @column-gap: @grid-gutter-width) {
  254. -webkit-column-count: @column-count;
  255. -moz-column-count: @column-count;
  256. column-count: @column-count;
  257. -webkit-column-gap: @column-gap;
  258. -moz-column-gap: @column-gap;
  259. column-gap: @column-gap;
  260. }
  261. // Optional hyphenation
  262. .hyphens(@mode: auto) {
  263. word-wrap: break-word;
  264. -webkit-hyphens: @mode;
  265. -moz-hyphens: @mode;
  266. -ms-hyphens: @mode; // IE10+
  267. -o-hyphens: @mode;
  268. hyphens: @mode;
  269. }
  270. // Opacity
  271. .opacity(@opacity) {
  272. opacity: @opacity;
  273. // IE8 filter
  274. @opacity-ie: (@opacity * 100);
  275. filter: ~'alpha(opacity=@{opacity-ie})';
  276. }
  277. // GRADIENTS
  278. // --------------------------------------------------
  279. #gradient {
  280. // Horizontal gradient, from left to right
  281. //
  282. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  283. // Color stops are not available in IE9 and below.
  284. .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
  285. background-image: -webkit-linear-gradient(
  286. left,
  287. color-stop(@start-color @start-percent),
  288. color-stop(@end-color @end-percent)
  289. ); // Safari 5.1-6, Chrome 10+
  290. background-image: linear-gradient(
  291. to right,
  292. @start-color @start-percent,
  293. @end-color @end-percent
  294. ); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
  295. background-repeat: repeat-x;
  296. filter: e(
  297. %(
  298. "progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",
  299. argb(@start-color),
  300. argb(@end-color)
  301. )
  302. ); // IE9 and down
  303. }
  304. // Vertical gradient, from top to bottom
  305. //
  306. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  307. // Color stops are not available in IE9 and below.
  308. .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
  309. background-image: -webkit-linear-gradient(
  310. top,
  311. @start-color @start-percent,
  312. @end-color @end-percent
  313. ); // Safari 5.1-6, Chrome 10+
  314. background-image: linear-gradient(
  315. to bottom,
  316. @start-color @start-percent,
  317. @end-color @end-percent
  318. ); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
  319. background-repeat: repeat-x;
  320. filter: e(
  321. %(
  322. "progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",
  323. argb(@start-color),
  324. argb(@end-color)
  325. )
  326. ); // IE9 and down
  327. }
  328. .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {
  329. background-repeat: repeat-x;
  330. background-image: -webkit-linear-gradient(
  331. @deg,
  332. @start-color,
  333. @end-color
  334. ); // Safari 5.1-6, Chrome 10+
  335. background-image: linear-gradient(
  336. @deg,
  337. @start-color,
  338. @end-color
  339. ); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
  340. }
  341. .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
  342. background-image: -webkit-linear-gradient(
  343. left,
  344. @start-color,
  345. @mid-color @color-stop,
  346. @end-color
  347. );
  348. background-image: linear-gradient(
  349. to right,
  350. @start-color,
  351. @mid-color @color-stop,
  352. @end-color
  353. );
  354. background-repeat: no-repeat;
  355. filter: e(
  356. %(
  357. "progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",
  358. argb(@start-color),
  359. argb(@end-color)
  360. )
  361. ); // IE9 and down, gets no color-stop at all for proper fallback
  362. }
  363. .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
  364. background-image: -webkit-linear-gradient(
  365. @start-color,
  366. @mid-color @color-stop,
  367. @end-color
  368. );
  369. background-image: linear-gradient(
  370. @start-color,
  371. @mid-color @color-stop,
  372. @end-color
  373. );
  374. background-repeat: no-repeat;
  375. filter: e(
  376. %(
  377. "progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",
  378. argb(@start-color),
  379. argb(@end-color)
  380. )
  381. ); // IE9 and down, gets no color-stop at all for proper fallback
  382. }
  383. .radial(@inner-color: #555; @outer-color: #333) {
  384. background-image: -webkit-radial-gradient(
  385. circle,
  386. @inner-color,
  387. @outer-color
  388. );
  389. background-image: radial-gradient(circle, @inner-color, @outer-color);
  390. background-repeat: no-repeat;
  391. }
  392. .striped(@color: rgba(255,255,255,0.15); @angle: 45deg) {
  393. background-image: -webkit-linear-gradient(
  394. @angle,
  395. @color 25%,
  396. transparent 25%,
  397. transparent 50%,
  398. @color 50%,
  399. @color 75%,
  400. transparent 75%,
  401. transparent
  402. );
  403. background-image: linear-gradient(
  404. @angle,
  405. @color 25%,
  406. transparent 25%,
  407. transparent 50%,
  408. @color 50%,
  409. @color 75%,
  410. transparent 75%,
  411. transparent
  412. );
  413. }
  414. }
  415. // Reset filters for IE
  416. //
  417. // When you need to remove a gradient background, do not forget to use this to reset
  418. // the IE filter for IE9 and below.
  419. .reset-filter() {
  420. filter: e(%('progid:DXImageTransform.Microsoft.gradient(enabled = false)'));
  421. }
  422. .mask-image(@gradient) {
  423. // It has to be this way round, otherwise Less removes the prefixed version, for some reason
  424. mask-image: @gradient;
  425. -webkit-mask-image: @gradient;
  426. }
  427. .premium-background {
  428. background-image: @premium-gradient;
  429. }
  430. .premium-text {
  431. background-clip: text;
  432. -webkit-background-clip: text;
  433. -webkit-text-fill-color: transparent;
  434. color: @white; // Fallback
  435. background-color: @blue-70; // Fallback
  436. .premium-background;
  437. }
  438. // Retina images
  439. //
  440. // Short retina mixin for setting background-image and -size
  441. .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
  442. background-image: url('@{file-1x}');
  443. @media only screen and (-webkit-min-device-pixel-ratio: 2),
  444. only screen and (min--moz-device-pixel-ratio: 2),
  445. only screen and (-o-min-device-pixel-ratio: 2/1),
  446. only screen and (min-device-pixel-ratio: 2),
  447. only screen and (min-resolution: 192dpi),
  448. only screen and (min-resolution: 2dppx) {
  449. background-image: url('@{file-2x}');
  450. background-size: @width-1x @height-1x;
  451. }
  452. }
  453. // Responsive image
  454. //
  455. // Keep images from scaling beyond the width of their parents.
  456. .img-responsive(@display: block) {
  457. display: @display;
  458. max-width: 100%; // Part 1: Set a maximum relative to the parent
  459. height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
  460. }
  461. // COMPONENT MIXINS
  462. // --------------------------------------------------
  463. // Horizontal dividers
  464. // -------------------------
  465. // Dividers (basically an hr) within dropdowns and nav lists
  466. .nav-divider(@color: #e5e5e5) {
  467. height: 1px;
  468. margin: @dropdown-divider-margin;
  469. overflow: hidden;
  470. background-color: @color;
  471. }
  472. // Panels
  473. // -------------------------
  474. .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {
  475. border-color: @border;
  476. & > .panel-heading {
  477. color: @heading-text-color;
  478. background-color: @heading-bg-color;
  479. border-color: @heading-border;
  480. + .panel-collapse .panel-body {
  481. border-top-color: @border;
  482. }
  483. }
  484. & > .panel-footer {
  485. + .panel-collapse .panel-body {
  486. border-bottom-color: @border;
  487. }
  488. }
  489. }
  490. // Alerts
  491. // -------------------------
  492. .alert-variant(@background; @border; @text-color) {
  493. background-color: @background;
  494. border-color: @border;
  495. color: @text-color;
  496. hr {
  497. border-top-color: darken(@border, 5%);
  498. }
  499. .alert-link {
  500. color: darken(@text-color, 10%);
  501. }
  502. .alert-link-as-btn {
  503. display: inline-block;
  504. font-weight: bold;
  505. text-decoration: none;
  506. .btn-alert-variant(@background);
  507. .button-size(
  508. @padding-xs-vertical; @padding-small-horizontal; @font-size-small;
  509. @line-height-small; @btn-border-radius-small
  510. );
  511. &:hover {
  512. text-decoration: none;
  513. }
  514. }
  515. small,
  516. .small {
  517. color: @text-color;
  518. }
  519. }
  520. .btn-alert-variant(@alert-bg) {
  521. .button-variant(#fff, shade(@alert-bg, 15%), transparent);
  522. border-radius: @btn-border-radius-base;
  523. }
  524. .btn-bordered() {
  525. @btn-bordered-color: @content-primary;
  526. @btn-bordered-background-color: @white;
  527. @btn-bordered-border-color: @border-color-base;
  528. color: @btn-bordered-color;
  529. background-color: @btn-bordered-background-color;
  530. border-color: @btn-bordered-border-color;
  531. border-width: @border-size;
  532. &:hover {
  533. background-color: @btn-secondary-hover-bg-color;
  534. }
  535. &:focus {
  536. color: @content-primary;
  537. outline: none;
  538. }
  539. &:focus-visible,
  540. &:active {
  541. .box-shadow-button-input();
  542. outline: none;
  543. }
  544. &:hover,
  545. &:focus-visible,
  546. &:active {
  547. color: @content-primary;
  548. }
  549. &.disabled,
  550. &[disabled],
  551. fieldset[disabled] & {
  552. &,
  553. &:hover,
  554. &:focus-visible,
  555. &:active,
  556. &.active {
  557. background-color: @color-disabled;
  558. border-color: @border-color-disabled;
  559. color: @content-disabled;
  560. }
  561. }
  562. &[data-ol-loading='true'] {
  563. &,
  564. &:hover {
  565. // use the default state colors when in a loading state
  566. color: @btn-bordered-color!important;
  567. background-color: @btn-bordered-background-color!important;
  568. border-color: @btn-bordered-border-color!important;
  569. }
  570. }
  571. }
  572. .btn-borderless(@color: @white; @background: @brand-primary; @background-hover: @btn-primary-hover-bg-color) {
  573. @btn-borderless-color: @color;
  574. @btn-borderless-background-color: @background;
  575. @btn-borderless-border-color: @background;
  576. color: @btn-borderless-color;
  577. background-color: @btn-borderless-background-color;
  578. border-color: @btn-borderless-border-color; // add a border that is same as background color so that the height matches the btn-bordered style
  579. border-width: @border-size;
  580. &:hover {
  581. background-color: @background-hover;
  582. border-color: @background-hover;
  583. }
  584. &:focus {
  585. color: @color;
  586. outline: none;
  587. }
  588. &:focus-visible,
  589. &:active {
  590. background-color: @background;
  591. border-color: @background;
  592. .box-shadow-button-input();
  593. outline: none;
  594. }
  595. &:hover,
  596. &:focus-visible,
  597. &:active {
  598. color: @color;
  599. }
  600. &.disabled,
  601. &[disabled],
  602. fieldset[disabled] & {
  603. &,
  604. &:hover,
  605. &:focus-visible,
  606. &:active,
  607. &.active {
  608. background-color: @color-disabled;
  609. border-color: @color-disabled;
  610. color: @content-disabled;
  611. }
  612. }
  613. &[data-ol-loading='true'] {
  614. &,
  615. &:hover {
  616. // use the default state colors when in a loading state
  617. color: @btn-borderless-color!important;
  618. background-color: @btn-borderless-background-color!important;
  619. border-color: @btn-borderless-border-color;
  620. }
  621. }
  622. }
  623. // Tables
  624. // -------------------------
  625. .table-row-variant(@state; @background) {
  626. // Exact selectors below required to override `.table-striped` and prevent
  627. // inheritance to nested tables.
  628. .table > thead > tr,
  629. .table > tbody > tr,
  630. .table > tfoot > tr {
  631. > td.@{state},
  632. > th.@{state},
  633. &.@{state} > td,
  634. &.@{state} > th {
  635. background-color: @background;
  636. }
  637. }
  638. // Hover states for `.table-hover`
  639. // Note: this is not available for cells or rows within `thead` or `tfoot`.
  640. .table-hover > tbody > tr {
  641. > td.@{state}:hover,
  642. > th.@{state}:hover,
  643. &.@{state}:hover > td,
  644. &.@{state}:hover > th {
  645. background-color: darken(@background, 5%);
  646. }
  647. }
  648. }
  649. // List Groups
  650. // -------------------------
  651. .list-group-item-variant(@state; @background; @color) {
  652. .list-group-item-@{state} {
  653. color: @color;
  654. background-color: @background;
  655. a& {
  656. color: @color;
  657. .list-group-item-heading {
  658. color: inherit;
  659. }
  660. &:hover,
  661. &:focus {
  662. color: @color;
  663. background-color: darken(@background, 5%);
  664. }
  665. &.active,
  666. &.active:hover,
  667. &.active:focus {
  668. color: #fff;
  669. background-color: @color;
  670. border-color: @color;
  671. }
  672. }
  673. }
  674. }
  675. // Button variants
  676. // -------------------------
  677. // Easily pump out default styles, as well as :hover, :focus, :active,
  678. // and disabled options for all buttons
  679. .alert-btn(@background) {
  680. background-color: darken(@background, 16%);
  681. &:hover,
  682. &:focus,
  683. &:active,
  684. &.active,
  685. &.checked,
  686. .open .dropdown-toggle& {
  687. background-color: darken(@background, 24%);
  688. }
  689. }
  690. .button-variant(@color; @background; @border) {
  691. color: @color;
  692. background-color: @background;
  693. border-color: @border;
  694. .alert & {
  695. .alert-btn(@background);
  696. }
  697. &:hover,
  698. &:focus,
  699. &:active,
  700. &.active,
  701. &.checked,
  702. .open .dropdown-toggle& {
  703. color: @color;
  704. background-color: darken(@background, 8%);
  705. border-color: darken(@border, 12%);
  706. }
  707. &:active,
  708. &.active,
  709. .open .dropdown-toggle& {
  710. background-image: none;
  711. }
  712. &.disabled,
  713. &[disabled],
  714. fieldset[disabled] & {
  715. &,
  716. &:hover,
  717. &:focus,
  718. &:active,
  719. &.active {
  720. background-color: @background;
  721. border-color: @border;
  722. }
  723. }
  724. .badge {
  725. color: @background;
  726. background-color: @color;
  727. }
  728. }
  729. .button-outline-variant(@color) {
  730. color: @color;
  731. background-color: transparent;
  732. border-color: @color;
  733. .alert & {
  734. background-color: transparent;
  735. }
  736. &:hover,
  737. &:focus,
  738. &:active,
  739. &.active,
  740. &.checked,
  741. .open .dropdown-toggle& {
  742. color: @color;
  743. background-color: transparent;
  744. border-color: darken(@color, 12%);
  745. .alert & {
  746. background-color: transparent;
  747. }
  748. }
  749. &:active,
  750. &.active,
  751. .open .dropdown-toggle& {
  752. background-image: none;
  753. }
  754. &.disabled,
  755. &[disabled],
  756. fieldset[disabled] & {
  757. &,
  758. &:hover,
  759. &:focus,
  760. &:active,
  761. &.active {
  762. background-color: transparent;
  763. border-color: @color;
  764. }
  765. }
  766. .badge {
  767. color: transparent;
  768. background-color: @color;
  769. }
  770. }
  771. // Button sizes
  772. // -------------------------
  773. .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius)
  774. when(@is-new-css = false) {
  775. // Remove 1px to make up for the extra px of border-bottom we've added
  776. padding: @padding-vertical - 1 @padding-horizontal @padding-vertical;
  777. font-size: @font-size;
  778. line-height: @line-height;
  779. border-radius: @border-radius;
  780. }
  781. .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius)
  782. when(@is-new-css = true) {
  783. padding: @padding-vertical - @border-size @padding-horizontal;
  784. font-size: @font-size;
  785. line-height: @line-height;
  786. border-radius: @border-radius;
  787. }
  788. // Pagination
  789. // -------------------------
  790. .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
  791. > li {
  792. > a,
  793. > span {
  794. padding: @padding-vertical @padding-horizontal;
  795. font-size: @font-size;
  796. }
  797. &:first-child {
  798. > a,
  799. > span {
  800. .border-left-radius(@border-radius);
  801. }
  802. }
  803. &:last-child {
  804. > a,
  805. > span {
  806. .border-right-radius(@border-radius);
  807. }
  808. }
  809. }
  810. }
  811. // Labels
  812. // -------------------------
  813. .label-variant(@color) {
  814. background-color: @color;
  815. &[href] {
  816. &:hover,
  817. &:focus {
  818. background-color: darken(@color, 10%);
  819. }
  820. }
  821. }
  822. // Contextual backgrounds
  823. // -------------------------
  824. .bg-variant(@color) {
  825. background-color: @color;
  826. a&:hover {
  827. background-color: darken(@color, 10%);
  828. }
  829. }
  830. // Typography
  831. // -------------------------
  832. .text-emphasis-variant(@color) {
  833. color: @color;
  834. a&:hover {
  835. color: darken(@color, 10%);
  836. }
  837. }
  838. // Navbar vertical align
  839. // -------------------------
  840. // Vertically center elements in the navbar.
  841. // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
  842. .navbar-vertical-align(@element-height) {
  843. margin-top: ((@navbar-height - @element-height) / 2);
  844. margin-bottom: ((@navbar-height - @element-height) / 2);
  845. }
  846. // Progress bars
  847. // -------------------------
  848. .progress-bar-variant(@color) {
  849. background-color: @color;
  850. .progress-striped & {
  851. #gradient > .striped();
  852. }
  853. }
  854. // Responsive utilities
  855. // -------------------------
  856. // More easily include all the states for responsive-utilities.less.
  857. .responsive-visibility() {
  858. display: block !important;
  859. table& {
  860. display: table;
  861. }
  862. tr& {
  863. display: table-row !important;
  864. }
  865. th&,
  866. td& {
  867. display: table-cell !important;
  868. }
  869. }
  870. .responsive-invisibility() {
  871. display: none !important;
  872. }
  873. // Grid System
  874. // -----------
  875. // Centered container element
  876. .container-fixed() {
  877. margin-right: auto;
  878. margin-left: auto;
  879. padding-left: (@grid-gutter-width / 2);
  880. padding-right: (@grid-gutter-width / 2);
  881. &:extend(.clearfix all);
  882. }
  883. // Creates a wrapper for a series of columns
  884. .make-row(@gutter: @grid-gutter-width) {
  885. margin-left: (@gutter / -2);
  886. margin-right: (@gutter / -2);
  887. &:extend(.clearfix all);
  888. }
  889. // Generate the extra small columns
  890. .make-xs-column(@columns; @gutter: @grid-gutter-width) {
  891. position: relative;
  892. float: left;
  893. width: percentage((@columns / @grid-columns));
  894. min-height: 1px;
  895. padding-left: (@gutter / 2);
  896. padding-right: (@gutter / 2);
  897. }
  898. .make-xs-column-offset(@columns) {
  899. @media (min-width: @screen-xs-min) {
  900. margin-left: percentage((@columns / @grid-columns));
  901. }
  902. }
  903. .make-xs-column-push(@columns) {
  904. @media (min-width: @screen-xs-min) {
  905. left: percentage((@columns / @grid-columns));
  906. }
  907. }
  908. .make-xs-column-pull(@columns) {
  909. @media (min-width: @screen-xs-min) {
  910. right: percentage((@columns / @grid-columns));
  911. }
  912. }
  913. // Generate the small columns
  914. .make-sm-column(@columns; @gutter: @grid-gutter-width) {
  915. position: relative;
  916. min-height: 1px;
  917. padding-left: (@gutter / 2);
  918. padding-right: (@gutter / 2);
  919. @media (min-width: @screen-sm-min) {
  920. float: left;
  921. width: percentage((@columns / @grid-columns));
  922. }
  923. }
  924. .make-sm-column-offset(@columns) {
  925. @media (min-width: @screen-sm-min) {
  926. margin-left: percentage((@columns / @grid-columns));
  927. }
  928. }
  929. .make-sm-column-push(@columns) {
  930. @media (min-width: @screen-sm-min) {
  931. left: percentage((@columns / @grid-columns));
  932. }
  933. }
  934. .make-sm-column-pull(@columns) {
  935. @media (min-width: @screen-sm-min) {
  936. right: percentage((@columns / @grid-columns));
  937. }
  938. }
  939. // Generate the medium columns
  940. .make-md-column(@columns; @gutter: @grid-gutter-width) {
  941. position: relative;
  942. min-height: 1px;
  943. padding-left: (@gutter / 2);
  944. padding-right: (@gutter / 2);
  945. @media (min-width: @screen-md-min) {
  946. float: left;
  947. width: percentage((@columns / @grid-columns));
  948. }
  949. }
  950. .make-md-column-offset(@columns) {
  951. @media (min-width: @screen-md-min) {
  952. margin-left: percentage((@columns / @grid-columns));
  953. }
  954. }
  955. .make-md-column-push(@columns) {
  956. @media (min-width: @screen-md-min) {
  957. left: percentage((@columns / @grid-columns));
  958. }
  959. }
  960. .make-md-column-pull(@columns) {
  961. @media (min-width: @screen-md-min) {
  962. right: percentage((@columns / @grid-columns));
  963. }
  964. }
  965. // Generate the large columns
  966. .make-lg-column(@columns; @gutter: @grid-gutter-width) {
  967. position: relative;
  968. min-height: 1px;
  969. padding-left: (@gutter / 2);
  970. padding-right: (@gutter / 2);
  971. @media (min-width: @screen-lg-min) {
  972. float: left;
  973. width: percentage((@columns / @grid-columns));
  974. }
  975. }
  976. .make-lg-column-offset(@columns) {
  977. @media (min-width: @screen-lg-min) {
  978. margin-left: percentage((@columns / @grid-columns));
  979. }
  980. }
  981. .make-lg-column-push(@columns) {
  982. @media (min-width: @screen-lg-min) {
  983. left: percentage((@columns / @grid-columns));
  984. }
  985. }
  986. .make-lg-column-pull(@columns) {
  987. @media (min-width: @screen-lg-min) {
  988. right: percentage((@columns / @grid-columns));
  989. }
  990. }
  991. // Framework grid generation
  992. //
  993. // Used only by Bootstrap to generate the correct number of grid classes given
  994. // any value of `@grid-columns`.
  995. .make-grid-columns() {
  996. // Common styles for all sizes of grid columns, widths 1-12
  997. .col(@index) when (@index = 1) {
  998. // initial
  999. @item: ~'.col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}';
  1000. .col((@index + 1), @item);
  1001. }
  1002. .col(@index, @list) when (@index =< @grid-columns) {
  1003. // general; "=<" isn't a typo
  1004. @item: ~'.col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}';
  1005. .col((@index + 1), ~'@{list}, @{item}');
  1006. }
  1007. .col(@index, @list) when (@index > @grid-columns) {
  1008. // terminal
  1009. @{list} {
  1010. position: relative;
  1011. // Prevent columns from collapsing when empty
  1012. min-height: 1px;
  1013. // Inner gutter via padding
  1014. padding-left: (@grid-gutter-width / 2);
  1015. padding-right: (@grid-gutter-width / 2);
  1016. }
  1017. }
  1018. .col(1); // kickstart it
  1019. }
  1020. .float-grid-columns(@class) {
  1021. .col(@index) when (@index = 1) {
  1022. // initial
  1023. @item: ~'.col-@{class}-@{index}';
  1024. .col((@index + 1), @item);
  1025. }
  1026. .col(@index, @list) when (@index =< @grid-columns) {
  1027. // general
  1028. @item: ~'.col-@{class}-@{index}';
  1029. .col((@index + 1), ~'@{list}, @{item}');
  1030. }
  1031. .col(@index, @list) when (@index > @grid-columns) {
  1032. // terminal
  1033. @{list} {
  1034. float: left;
  1035. }
  1036. }
  1037. .col(1); // kickstart it
  1038. }
  1039. .calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {
  1040. .col-@{class}-@{index} {
  1041. width: percentage((@index / @grid-columns));
  1042. }
  1043. }
  1044. .calc-grid-column(@index, @class, @type) when (@type = push) {
  1045. .col-@{class}-push-@{index} {
  1046. left: percentage((@index / @grid-columns));
  1047. }
  1048. }
  1049. .calc-grid-column(@index, @class, @type) when (@type = pull) {
  1050. .col-@{class}-pull-@{index} {
  1051. right: percentage((@index / @grid-columns));
  1052. }
  1053. }
  1054. .calc-grid-column(@index, @class, @type) when (@type = offset) {
  1055. .col-@{class}-offset-@{index} {
  1056. margin-left: percentage((@index / @grid-columns));
  1057. }
  1058. }
  1059. // Basic looping in LESS
  1060. .loop-grid-columns(@index, @class, @type) when (@index >= 0) {
  1061. .calc-grid-column(@index, @class, @type);
  1062. // next iteration
  1063. .loop-grid-columns((@index - 1), @class, @type);
  1064. }
  1065. // Create grid for specific class
  1066. .make-grid(@class) {
  1067. .float-grid-columns(@class);
  1068. .loop-grid-columns(@grid-columns, @class, width);
  1069. .loop-grid-columns(@grid-columns, @class, pull);
  1070. .loop-grid-columns(@grid-columns, @class, push);
  1071. .loop-grid-columns(@grid-columns, @class, offset);
  1072. }
  1073. // Form validation states
  1074. //
  1075. // Used in forms.less to generate the form validation CSS for warnings, errors,
  1076. // and successes.
  1077. .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5)
  1078. when(@is-new-css = false) {
  1079. // Color the label and help text
  1080. .help-block,
  1081. .control-label,
  1082. .radio,
  1083. .checkbox,
  1084. .radio-inline,
  1085. .checkbox-inline {
  1086. color: @text-color;
  1087. }
  1088. // Set the border and box shadow on specific inputs to match
  1089. .form-control {
  1090. border-color: @border-color;
  1091. .box-shadow(
  1092. inset 0 1px 1px rgba(0, 0, 0, 0.075)
  1093. ); // Redeclare so transitions work
  1094. &:focus {
  1095. border-color: darken(@border-color, 10%);
  1096. @shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
  1097. 0 0 6px lighten(@border-color, 20%);
  1098. .box-shadow(@shadow);
  1099. }
  1100. }
  1101. // Set validation states also for addons
  1102. .input-group-addon {
  1103. color: @text-color;
  1104. border-color: @border-color;
  1105. background-color: @background-color;
  1106. }
  1107. // Optional feedback icon
  1108. .form-control-feedback {
  1109. color: @text-color;
  1110. }
  1111. }
  1112. .form-control-validation(@color) when(@is-new-css = true) {
  1113. color: @color;
  1114. // Color the label and help text
  1115. .help-block,
  1116. .control-label,
  1117. .radio,
  1118. .checkbox,
  1119. .radio-inline,
  1120. .checkbox-inline {
  1121. color: @color;
  1122. }
  1123. .form-control {
  1124. border-color: @color;
  1125. &:focus {
  1126. border-color: @input-border-focus;
  1127. }
  1128. }
  1129. // Optional feedback icon
  1130. .form-control-feedback {
  1131. color: @color;
  1132. }
  1133. }
  1134. // Form control focus state
  1135. //
  1136. // Generate a customized focus state and for any input with the specified color,
  1137. // which defaults to the `@input-focus-border` variable.
  1138. //
  1139. // We highly encourage you to not customize the default value, but instead use
  1140. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  1141. // WebKit's default styles, but applicable to a wider range of browsers. Its
  1142. // usability and accessibility should be taken into account with any change.
  1143. //
  1144. // Example usage: change the default blue border and shadow to white for better
  1145. // contrast against a dark gray background.
  1146. .form-control-focus(@color: @input-border-focus) when (@is-new-css = false) {
  1147. @color-rgba: rgba(red(@color), green(@color), blue(@color), 0.6);
  1148. &:focus {
  1149. border-color: @color;
  1150. outline: 0;
  1151. .box-shadow(~'inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}');
  1152. }
  1153. }
  1154. .input-focus-style {
  1155. // need to define as class for recurly UI
  1156. border-color: @input-border-focus;
  1157. outline: 0;
  1158. .box-shadow-button-input();
  1159. }
  1160. .form-control-focus() when (@is-new-css = true) {
  1161. &:focus {
  1162. &:extend(.input-focus-style);
  1163. }
  1164. }
  1165. // Form control sizing
  1166. //
  1167. // Relative text size, padding, and border-radii changes for form controls. For
  1168. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  1169. // element gets special love because it's special, and that's a fact!
  1170. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  1171. height: @input-height;
  1172. padding: @padding-vertical @padding-horizontal;
  1173. font-size: @font-size;
  1174. line-height: @line-height;
  1175. border-radius: @border-radius;
  1176. select& {
  1177. height: @input-height;
  1178. line-height: @input-height;
  1179. }
  1180. textarea&,
  1181. select[multiple]& {
  1182. height: auto;
  1183. }
  1184. }
  1185. .triangle(@_, @width, @height, @color) {
  1186. position: absolute;
  1187. border-color: transparent;
  1188. border-style: solid;
  1189. width: 0;
  1190. height: 0;
  1191. }
  1192. .triangle(top, @width, @height, @color) {
  1193. border-width: 0 @width / 2 @height @width / 2;
  1194. border-bottom-color: @color;
  1195. border-left-color: transparent;
  1196. border-right-color: transparent;
  1197. }
  1198. .triangle(bottom, @width, @height, @color) {
  1199. border-width: @height @width / 2 0 @width / 2;
  1200. border-top-color: @color;
  1201. border-left-color: transparent;
  1202. border-right-color: transparent;
  1203. }
  1204. .triangle(right, @width, @height, @color) {
  1205. border-width: @height / 2 0 @height / 2 @width;
  1206. border-left-color: @color;
  1207. border-top-color: transparent;
  1208. border-bottom-color: transparent;
  1209. }
  1210. .triangle(left, @width, @height, @color) {
  1211. border-width: @height / 2 @width @height / 2 0;
  1212. border-right-color: @color;
  1213. border-top-color: transparent;
  1214. border-bottom-color: transparent;
  1215. }
  1216. .no-outline-ring-on-click {
  1217. &:focus,
  1218. &:focus:active {
  1219. outline: 0;
  1220. }
  1221. }
  1222. .reset-button {
  1223. padding: 0;
  1224. cursor: pointer;
  1225. background: transparent;
  1226. border: 0;
  1227. -webkit-appearance: none;
  1228. }