mixins.less 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  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. // Retina images
  423. //
  424. // Short retina mixin for setting background-image and -size
  425. .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
  426. background-image: url('@{file-1x}');
  427. @media only screen and (-webkit-min-device-pixel-ratio: 2),
  428. only screen and (min--moz-device-pixel-ratio: 2),
  429. only screen and (-o-min-device-pixel-ratio: 2/1),
  430. only screen and (min-device-pixel-ratio: 2),
  431. only screen and (min-resolution: 192dpi),
  432. only screen and (min-resolution: 2dppx) {
  433. background-image: url('@{file-2x}');
  434. background-size: @width-1x @height-1x;
  435. }
  436. }
  437. // Responsive image
  438. //
  439. // Keep images from scaling beyond the width of their parents.
  440. .img-responsive(@display: block) {
  441. display: @display;
  442. max-width: 100%; // Part 1: Set a maximum relative to the parent
  443. height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
  444. }
  445. // COMPONENT MIXINS
  446. // --------------------------------------------------
  447. // Horizontal dividers
  448. // -------------------------
  449. // Dividers (basically an hr) within dropdowns and nav lists
  450. .nav-divider(@color: #e5e5e5) {
  451. height: 1px;
  452. margin: @dropdown-divider-margin;
  453. overflow: hidden;
  454. background-color: @color;
  455. }
  456. // Panels
  457. // -------------------------
  458. .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {
  459. border-color: @border;
  460. & > .panel-heading {
  461. color: @heading-text-color;
  462. background-color: @heading-bg-color;
  463. border-color: @heading-border;
  464. + .panel-collapse .panel-body {
  465. border-top-color: @border;
  466. }
  467. }
  468. & > .panel-footer {
  469. + .panel-collapse .panel-body {
  470. border-bottom-color: @border;
  471. }
  472. }
  473. }
  474. // Alerts
  475. // -------------------------
  476. .alert-variant(@background; @border; @text-color) {
  477. background-color: @background;
  478. border-color: @border;
  479. color: @text-color;
  480. hr {
  481. border-top-color: darken(@border, 5%);
  482. }
  483. .alert-link {
  484. color: darken(@text-color, 10%);
  485. }
  486. .alert-link-as-btn {
  487. display: inline-block;
  488. font-weight: bold;
  489. text-decoration: none;
  490. .btn-alert-variant(@background);
  491. .button-size(
  492. @padding-xs-vertical; @padding-small-horizontal; @font-size-small;
  493. @line-height-small; @btn-border-radius-small
  494. );
  495. &:hover {
  496. text-decoration: none;
  497. }
  498. }
  499. small,
  500. .small {
  501. color: @text-color;
  502. }
  503. }
  504. .btn-alert-variant(@alert-bg) {
  505. .button-variant(#fff, shade(@alert-bg, 15%), transparent);
  506. border-radius: @btn-border-radius-base;
  507. }
  508. .btn-bordered() {
  509. color: @content-primary;
  510. background-color: @white;
  511. border-color: @border-color-base;
  512. border-width: @border-size;
  513. &:hover {
  514. background-color: @btn-secondary-hover-bg-color;
  515. }
  516. &:focus {
  517. color: @content-primary;
  518. outline: none;
  519. }
  520. &:focus-visible,
  521. &:active {
  522. .box-shadow-button-input();
  523. outline: none;
  524. }
  525. &:hover,
  526. &:focus-visible,
  527. &:active {
  528. color: @content-primary;
  529. }
  530. &.disabled,
  531. &[disabled],
  532. fieldset[disabled] & {
  533. &,
  534. &:hover,
  535. &:focus-visible,
  536. &:active,
  537. &.active {
  538. background-color: @color-disabled;
  539. border-color: @border-color-disabled;
  540. color: @content-disabled;
  541. }
  542. }
  543. }
  544. .btn-borderless(@color: @white; @background: @brand-primary; @background-hover: @btn-primary-hover-bg-color) {
  545. color: @color;
  546. background-color: @background;
  547. border-color: @background; // add a border that is same as background color so that the height matches the btn-bordered style
  548. border-width: @border-size;
  549. &:hover {
  550. background-color: @background-hover;
  551. border-color: @background-hover;
  552. }
  553. &:focus {
  554. color: @color;
  555. outline: none;
  556. }
  557. &:focus-visible,
  558. &:active {
  559. background-color: @background;
  560. border-color: @background;
  561. .box-shadow-button-input();
  562. outline: none;
  563. }
  564. &:hover,
  565. &:focus-visible,
  566. &:active {
  567. color: @color;
  568. }
  569. &.disabled,
  570. &[disabled],
  571. fieldset[disabled] & {
  572. &,
  573. &:hover,
  574. &:focus-visible,
  575. &:active,
  576. &.active {
  577. background-color: @color-disabled;
  578. border-color: @color-disabled;
  579. color: @content-disabled;
  580. }
  581. }
  582. }
  583. // Tables
  584. // -------------------------
  585. .table-row-variant(@state; @background) {
  586. // Exact selectors below required to override `.table-striped` and prevent
  587. // inheritance to nested tables.
  588. .table > thead > tr,
  589. .table > tbody > tr,
  590. .table > tfoot > tr {
  591. > td.@{state},
  592. > th.@{state},
  593. &.@{state} > td,
  594. &.@{state} > th {
  595. background-color: @background;
  596. }
  597. }
  598. // Hover states for `.table-hover`
  599. // Note: this is not available for cells or rows within `thead` or `tfoot`.
  600. .table-hover > tbody > tr {
  601. > td.@{state}:hover,
  602. > th.@{state}:hover,
  603. &.@{state}:hover > td,
  604. &.@{state}:hover > th {
  605. background-color: darken(@background, 5%);
  606. }
  607. }
  608. }
  609. // List Groups
  610. // -------------------------
  611. .list-group-item-variant(@state; @background; @color) {
  612. .list-group-item-@{state} {
  613. color: @color;
  614. background-color: @background;
  615. a& {
  616. color: @color;
  617. .list-group-item-heading {
  618. color: inherit;
  619. }
  620. &:hover,
  621. &:focus {
  622. color: @color;
  623. background-color: darken(@background, 5%);
  624. }
  625. &.active,
  626. &.active:hover,
  627. &.active:focus {
  628. color: #fff;
  629. background-color: @color;
  630. border-color: @color;
  631. }
  632. }
  633. }
  634. }
  635. // Button variants
  636. // -------------------------
  637. // Easily pump out default styles, as well as :hover, :focus, :active,
  638. // and disabled options for all buttons
  639. .alert-btn(@background) {
  640. background-color: darken(@background, 16%);
  641. &:hover,
  642. &:focus,
  643. &:active,
  644. &.active,
  645. &.checked,
  646. .open .dropdown-toggle& {
  647. background-color: darken(@background, 24%);
  648. }
  649. }
  650. .button-variant(@color; @background; @border) {
  651. color: @color;
  652. background-color: @background;
  653. border-color: @border;
  654. .alert & {
  655. .alert-btn(@background);
  656. }
  657. &:hover,
  658. &:focus,
  659. &:active,
  660. &.active,
  661. &.checked,
  662. .open .dropdown-toggle& {
  663. color: @color;
  664. background-color: darken(@background, 8%);
  665. border-color: darken(@border, 12%);
  666. }
  667. &:active,
  668. &.active,
  669. .open .dropdown-toggle& {
  670. background-image: none;
  671. }
  672. &.disabled,
  673. &[disabled],
  674. fieldset[disabled] & {
  675. &,
  676. &:hover,
  677. &:focus,
  678. &:active,
  679. &.active {
  680. background-color: @background;
  681. border-color: @border;
  682. }
  683. }
  684. .badge {
  685. color: @background;
  686. background-color: @color;
  687. }
  688. }
  689. .button-outline-variant(@color) {
  690. color: @color;
  691. background-color: transparent;
  692. border-color: @color;
  693. .alert & {
  694. background-color: transparent;
  695. }
  696. &:hover,
  697. &:focus,
  698. &:active,
  699. &.active,
  700. &.checked,
  701. .open .dropdown-toggle& {
  702. color: @color;
  703. background-color: transparent;
  704. border-color: darken(@color, 12%);
  705. .alert & {
  706. background-color: transparent;
  707. }
  708. }
  709. &:active,
  710. &.active,
  711. .open .dropdown-toggle& {
  712. background-image: none;
  713. }
  714. &.disabled,
  715. &[disabled],
  716. fieldset[disabled] & {
  717. &,
  718. &:hover,
  719. &:focus,
  720. &:active,
  721. &.active {
  722. background-color: transparent;
  723. border-color: @color;
  724. }
  725. }
  726. .badge {
  727. color: transparent;
  728. background-color: @color;
  729. }
  730. }
  731. // Button sizes
  732. // -------------------------
  733. .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius)
  734. when(@is-new-css = false) {
  735. // Remove 1px to make up for the extra px of border-bottom we've added
  736. padding: @padding-vertical - 1 @padding-horizontal @padding-vertical;
  737. font-size: @font-size;
  738. line-height: @line-height;
  739. border-radius: @border-radius;
  740. }
  741. .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius)
  742. when(@is-new-css = true) {
  743. padding: @padding-vertical - @border-size @padding-horizontal;
  744. font-size: @font-size;
  745. line-height: @line-height;
  746. border-radius: @border-radius;
  747. }
  748. // Pagination
  749. // -------------------------
  750. .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
  751. > li {
  752. > a,
  753. > span {
  754. padding: @padding-vertical @padding-horizontal;
  755. font-size: @font-size;
  756. }
  757. &:first-child {
  758. > a,
  759. > span {
  760. .border-left-radius(@border-radius);
  761. }
  762. }
  763. &:last-child {
  764. > a,
  765. > span {
  766. .border-right-radius(@border-radius);
  767. }
  768. }
  769. }
  770. }
  771. // Labels
  772. // -------------------------
  773. .label-variant(@color) {
  774. background-color: @color;
  775. &[href] {
  776. &:hover,
  777. &:focus {
  778. background-color: darken(@color, 10%);
  779. }
  780. }
  781. }
  782. // Contextual backgrounds
  783. // -------------------------
  784. .bg-variant(@color) {
  785. background-color: @color;
  786. a&:hover {
  787. background-color: darken(@color, 10%);
  788. }
  789. }
  790. // Typography
  791. // -------------------------
  792. .text-emphasis-variant(@color) {
  793. color: @color;
  794. a&:hover {
  795. color: darken(@color, 10%);
  796. }
  797. }
  798. // Navbar vertical align
  799. // -------------------------
  800. // Vertically center elements in the navbar.
  801. // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
  802. .navbar-vertical-align(@element-height) {
  803. margin-top: ((@navbar-height - @element-height) / 2);
  804. margin-bottom: ((@navbar-height - @element-height) / 2);
  805. }
  806. // Progress bars
  807. // -------------------------
  808. .progress-bar-variant(@color) {
  809. background-color: @color;
  810. .progress-striped & {
  811. #gradient > .striped();
  812. }
  813. }
  814. // Responsive utilities
  815. // -------------------------
  816. // More easily include all the states for responsive-utilities.less.
  817. .responsive-visibility() {
  818. display: block !important;
  819. table& {
  820. display: table;
  821. }
  822. tr& {
  823. display: table-row !important;
  824. }
  825. th&,
  826. td& {
  827. display: table-cell !important;
  828. }
  829. }
  830. .responsive-invisibility() {
  831. display: none !important;
  832. }
  833. // Grid System
  834. // -----------
  835. // Centered container element
  836. .container-fixed() {
  837. margin-right: auto;
  838. margin-left: auto;
  839. padding-left: (@grid-gutter-width / 2);
  840. padding-right: (@grid-gutter-width / 2);
  841. &:extend(.clearfix all);
  842. }
  843. // Creates a wrapper for a series of columns
  844. .make-row(@gutter: @grid-gutter-width) {
  845. margin-left: (@gutter / -2);
  846. margin-right: (@gutter / -2);
  847. &:extend(.clearfix all);
  848. }
  849. // Generate the extra small columns
  850. .make-xs-column(@columns; @gutter: @grid-gutter-width) {
  851. position: relative;
  852. float: left;
  853. width: percentage((@columns / @grid-columns));
  854. min-height: 1px;
  855. padding-left: (@gutter / 2);
  856. padding-right: (@gutter / 2);
  857. }
  858. .make-xs-column-offset(@columns) {
  859. @media (min-width: @screen-xs-min) {
  860. margin-left: percentage((@columns / @grid-columns));
  861. }
  862. }
  863. .make-xs-column-push(@columns) {
  864. @media (min-width: @screen-xs-min) {
  865. left: percentage((@columns / @grid-columns));
  866. }
  867. }
  868. .make-xs-column-pull(@columns) {
  869. @media (min-width: @screen-xs-min) {
  870. right: percentage((@columns / @grid-columns));
  871. }
  872. }
  873. // Generate the small columns
  874. .make-sm-column(@columns; @gutter: @grid-gutter-width) {
  875. position: relative;
  876. min-height: 1px;
  877. padding-left: (@gutter / 2);
  878. padding-right: (@gutter / 2);
  879. @media (min-width: @screen-sm-min) {
  880. float: left;
  881. width: percentage((@columns / @grid-columns));
  882. }
  883. }
  884. .make-sm-column-offset(@columns) {
  885. @media (min-width: @screen-sm-min) {
  886. margin-left: percentage((@columns / @grid-columns));
  887. }
  888. }
  889. .make-sm-column-push(@columns) {
  890. @media (min-width: @screen-sm-min) {
  891. left: percentage((@columns / @grid-columns));
  892. }
  893. }
  894. .make-sm-column-pull(@columns) {
  895. @media (min-width: @screen-sm-min) {
  896. right: percentage((@columns / @grid-columns));
  897. }
  898. }
  899. // Generate the medium columns
  900. .make-md-column(@columns; @gutter: @grid-gutter-width) {
  901. position: relative;
  902. min-height: 1px;
  903. padding-left: (@gutter / 2);
  904. padding-right: (@gutter / 2);
  905. @media (min-width: @screen-md-min) {
  906. float: left;
  907. width: percentage((@columns / @grid-columns));
  908. }
  909. }
  910. .make-md-column-offset(@columns) {
  911. @media (min-width: @screen-md-min) {
  912. margin-left: percentage((@columns / @grid-columns));
  913. }
  914. }
  915. .make-md-column-push(@columns) {
  916. @media (min-width: @screen-md-min) {
  917. left: percentage((@columns / @grid-columns));
  918. }
  919. }
  920. .make-md-column-pull(@columns) {
  921. @media (min-width: @screen-md-min) {
  922. right: percentage((@columns / @grid-columns));
  923. }
  924. }
  925. // Generate the large columns
  926. .make-lg-column(@columns; @gutter: @grid-gutter-width) {
  927. position: relative;
  928. min-height: 1px;
  929. padding-left: (@gutter / 2);
  930. padding-right: (@gutter / 2);
  931. @media (min-width: @screen-lg-min) {
  932. float: left;
  933. width: percentage((@columns / @grid-columns));
  934. }
  935. }
  936. .make-lg-column-offset(@columns) {
  937. @media (min-width: @screen-lg-min) {
  938. margin-left: percentage((@columns / @grid-columns));
  939. }
  940. }
  941. .make-lg-column-push(@columns) {
  942. @media (min-width: @screen-lg-min) {
  943. left: percentage((@columns / @grid-columns));
  944. }
  945. }
  946. .make-lg-column-pull(@columns) {
  947. @media (min-width: @screen-lg-min) {
  948. right: percentage((@columns / @grid-columns));
  949. }
  950. }
  951. // Framework grid generation
  952. //
  953. // Used only by Bootstrap to generate the correct number of grid classes given
  954. // any value of `@grid-columns`.
  955. .make-grid-columns() {
  956. // Common styles for all sizes of grid columns, widths 1-12
  957. .col(@index) when (@index = 1) {
  958. // initial
  959. @item: ~'.col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}';
  960. .col((@index + 1), @item);
  961. }
  962. .col(@index, @list) when (@index =< @grid-columns) {
  963. // general; "=<" isn't a typo
  964. @item: ~'.col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}';
  965. .col((@index + 1), ~'@{list}, @{item}');
  966. }
  967. .col(@index, @list) when (@index > @grid-columns) {
  968. // terminal
  969. @{list} {
  970. position: relative;
  971. // Prevent columns from collapsing when empty
  972. min-height: 1px;
  973. // Inner gutter via padding
  974. padding-left: (@grid-gutter-width / 2);
  975. padding-right: (@grid-gutter-width / 2);
  976. }
  977. }
  978. .col(1); // kickstart it
  979. }
  980. .float-grid-columns(@class) {
  981. .col(@index) when (@index = 1) {
  982. // initial
  983. @item: ~'.col-@{class}-@{index}';
  984. .col((@index + 1), @item);
  985. }
  986. .col(@index, @list) when (@index =< @grid-columns) {
  987. // general
  988. @item: ~'.col-@{class}-@{index}';
  989. .col((@index + 1), ~'@{list}, @{item}');
  990. }
  991. .col(@index, @list) when (@index > @grid-columns) {
  992. // terminal
  993. @{list} {
  994. float: left;
  995. }
  996. }
  997. .col(1); // kickstart it
  998. }
  999. .calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {
  1000. .col-@{class}-@{index} {
  1001. width: percentage((@index / @grid-columns));
  1002. }
  1003. }
  1004. .calc-grid-column(@index, @class, @type) when (@type = push) {
  1005. .col-@{class}-push-@{index} {
  1006. left: percentage((@index / @grid-columns));
  1007. }
  1008. }
  1009. .calc-grid-column(@index, @class, @type) when (@type = pull) {
  1010. .col-@{class}-pull-@{index} {
  1011. right: percentage((@index / @grid-columns));
  1012. }
  1013. }
  1014. .calc-grid-column(@index, @class, @type) when (@type = offset) {
  1015. .col-@{class}-offset-@{index} {
  1016. margin-left: percentage((@index / @grid-columns));
  1017. }
  1018. }
  1019. // Basic looping in LESS
  1020. .loop-grid-columns(@index, @class, @type) when (@index >= 0) {
  1021. .calc-grid-column(@index, @class, @type);
  1022. // next iteration
  1023. .loop-grid-columns((@index - 1), @class, @type);
  1024. }
  1025. // Create grid for specific class
  1026. .make-grid(@class) {
  1027. .float-grid-columns(@class);
  1028. .loop-grid-columns(@grid-columns, @class, width);
  1029. .loop-grid-columns(@grid-columns, @class, pull);
  1030. .loop-grid-columns(@grid-columns, @class, push);
  1031. .loop-grid-columns(@grid-columns, @class, offset);
  1032. }
  1033. // Form validation states
  1034. //
  1035. // Used in forms.less to generate the form validation CSS for warnings, errors,
  1036. // and successes.
  1037. .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5)
  1038. when(@is-new-css = false) {
  1039. // Color the label and help text
  1040. .help-block,
  1041. .control-label,
  1042. .radio,
  1043. .checkbox,
  1044. .radio-inline,
  1045. .checkbox-inline {
  1046. color: @text-color;
  1047. }
  1048. // Set the border and box shadow on specific inputs to match
  1049. .form-control {
  1050. border-color: @border-color;
  1051. .box-shadow(
  1052. inset 0 1px 1px rgba(0, 0, 0, 0.075)
  1053. ); // Redeclare so transitions work
  1054. &:focus {
  1055. border-color: darken(@border-color, 10%);
  1056. @shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
  1057. 0 0 6px lighten(@border-color, 20%);
  1058. .box-shadow(@shadow);
  1059. }
  1060. }
  1061. // Set validation states also for addons
  1062. .input-group-addon {
  1063. color: @text-color;
  1064. border-color: @border-color;
  1065. background-color: @background-color;
  1066. }
  1067. // Optional feedback icon
  1068. .form-control-feedback {
  1069. color: @text-color;
  1070. }
  1071. }
  1072. .form-control-validation(@color) when(@is-new-css = true) {
  1073. color: @color;
  1074. // Color the label and help text
  1075. .help-block,
  1076. .control-label,
  1077. .radio,
  1078. .checkbox,
  1079. .radio-inline,
  1080. .checkbox-inline {
  1081. color: @color;
  1082. }
  1083. .form-control {
  1084. border-color: @color;
  1085. &:focus {
  1086. border-color: @input-border-focus;
  1087. }
  1088. }
  1089. // Optional feedback icon
  1090. .form-control-feedback {
  1091. color: @color;
  1092. }
  1093. }
  1094. // Form control focus state
  1095. //
  1096. // Generate a customized focus state and for any input with the specified color,
  1097. // which defaults to the `@input-focus-border` variable.
  1098. //
  1099. // We highly encourage you to not customize the default value, but instead use
  1100. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  1101. // WebKit's default styles, but applicable to a wider range of browsers. Its
  1102. // usability and accessibility should be taken into account with any change.
  1103. //
  1104. // Example usage: change the default blue border and shadow to white for better
  1105. // contrast against a dark gray background.
  1106. .form-control-focus(@color: @input-border-focus) when (@is-new-css = false) {
  1107. @color-rgba: rgba(red(@color), green(@color), blue(@color), 0.6);
  1108. &:focus {
  1109. border-color: @color;
  1110. outline: 0;
  1111. .box-shadow(~'inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}');
  1112. }
  1113. }
  1114. .input-focus-style {
  1115. // need to define as class for recurly UI
  1116. border-color: @input-border-focus;
  1117. outline: 0;
  1118. .box-shadow-button-input();
  1119. }
  1120. .form-control-focus() when (@is-new-css = true) {
  1121. &:focus {
  1122. &:extend(.input-focus-style);
  1123. }
  1124. }
  1125. // Form control sizing
  1126. //
  1127. // Relative text size, padding, and border-radii changes for form controls. For
  1128. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  1129. // element gets special love because it's special, and that's a fact!
  1130. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  1131. height: @input-height;
  1132. padding: @padding-vertical @padding-horizontal;
  1133. font-size: @font-size;
  1134. line-height: @line-height;
  1135. border-radius: @border-radius;
  1136. select& {
  1137. height: @input-height;
  1138. line-height: @input-height;
  1139. }
  1140. textarea&,
  1141. select[multiple]& {
  1142. height: auto;
  1143. }
  1144. }
  1145. .triangle(@_, @width, @height, @color) {
  1146. position: absolute;
  1147. border-color: transparent;
  1148. border-style: solid;
  1149. width: 0;
  1150. height: 0;
  1151. }
  1152. .triangle(top, @width, @height, @color) {
  1153. border-width: 0 @width / 2 @height @width / 2;
  1154. border-bottom-color: @color;
  1155. border-left-color: transparent;
  1156. border-right-color: transparent;
  1157. }
  1158. .triangle(bottom, @width, @height, @color) {
  1159. border-width: @height @width / 2 0 @width / 2;
  1160. border-top-color: @color;
  1161. border-left-color: transparent;
  1162. border-right-color: transparent;
  1163. }
  1164. .triangle(right, @width, @height, @color) {
  1165. border-width: @height / 2 0 @height / 2 @width;
  1166. border-left-color: @color;
  1167. border-top-color: transparent;
  1168. border-bottom-color: transparent;
  1169. }
  1170. .triangle(left, @width, @height, @color) {
  1171. border-width: @height / 2 @width @height / 2 0;
  1172. border-right-color: @color;
  1173. border-top-color: transparent;
  1174. border-bottom-color: transparent;
  1175. }
  1176. .no-outline-ring-on-click {
  1177. &:focus,
  1178. &:focus:active {
  1179. outline: 0;
  1180. }
  1181. }