mixins.less 31 KB

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