mixins.less 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342
  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. // Button variants
  647. // -------------------------
  648. // Easily pump out default styles, as well as :hover, :focus, :active,
  649. // and disabled options for all buttons
  650. .alert-btn(@background) {
  651. background-color: darken(@background, 16%);
  652. &:hover,
  653. &:focus,
  654. &:active,
  655. &.active,
  656. &.checked,
  657. .open .dropdown-toggle& {
  658. background-color: darken(@background, 24%);
  659. }
  660. }
  661. .button-variant(@color; @background; @border) {
  662. color: @color;
  663. background-color: @background;
  664. border-color: @border;
  665. .alert & {
  666. .alert-btn(@background);
  667. }
  668. &:hover,
  669. &:focus,
  670. &:active,
  671. &.active,
  672. &.checked,
  673. .open .dropdown-toggle& {
  674. color: @color;
  675. background-color: darken(@background, 8%);
  676. border-color: darken(@border, 12%);
  677. }
  678. &:active,
  679. &.active,
  680. .open .dropdown-toggle& {
  681. background-image: none;
  682. }
  683. &.disabled,
  684. &[disabled],
  685. fieldset[disabled] & {
  686. &,
  687. &:hover,
  688. &:focus,
  689. &:active,
  690. &.active {
  691. background-color: @background;
  692. border-color: @border;
  693. }
  694. }
  695. .badge {
  696. color: @background;
  697. background-color: @color;
  698. }
  699. }
  700. .button-outline-variant(@color) {
  701. color: @color;
  702. background-color: transparent;
  703. border-color: @color;
  704. .alert & {
  705. background-color: transparent;
  706. }
  707. &:hover,
  708. &:focus,
  709. &:active,
  710. &.active,
  711. &.checked,
  712. .open .dropdown-toggle& {
  713. color: @color;
  714. background-color: transparent;
  715. border-color: darken(@color, 12%);
  716. .alert & {
  717. background-color: transparent;
  718. }
  719. }
  720. &:active,
  721. &.active,
  722. .open .dropdown-toggle& {
  723. background-image: none;
  724. }
  725. &.disabled,
  726. &[disabled],
  727. fieldset[disabled] & {
  728. &,
  729. &:hover,
  730. &:focus,
  731. &:active,
  732. &.active {
  733. background-color: transparent;
  734. border-color: @color;
  735. }
  736. }
  737. .badge {
  738. color: transparent;
  739. background-color: @color;
  740. }
  741. }
  742. // Button sizes
  743. // -------------------------
  744. .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  745. padding: @padding-vertical - @border-size @padding-horizontal;
  746. font-size: @font-size;
  747. line-height: @line-height;
  748. border-radius: @border-radius;
  749. }
  750. // Pagination
  751. // -------------------------
  752. .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
  753. > li {
  754. > a,
  755. > span {
  756. padding: @padding-vertical @padding-horizontal;
  757. font-size: @font-size;
  758. }
  759. &:first-child {
  760. > a,
  761. > span {
  762. .border-left-radius(@border-radius);
  763. }
  764. }
  765. &:last-child {
  766. > a,
  767. > span {
  768. .border-right-radius(@border-radius);
  769. }
  770. }
  771. }
  772. }
  773. // Labels
  774. // -------------------------
  775. .label-variant(@color) {
  776. background-color: @color;
  777. &[href] {
  778. &:hover,
  779. &:focus {
  780. background-color: darken(@color, 10%);
  781. }
  782. }
  783. }
  784. // Contextual backgrounds
  785. // -------------------------
  786. .bg-variant(@color) {
  787. background-color: @color;
  788. a&:hover {
  789. background-color: darken(@color, 10%);
  790. }
  791. }
  792. // Typography
  793. // -------------------------
  794. .text-emphasis-variant(@color) {
  795. color: @color;
  796. a&:hover {
  797. color: darken(@color, 10%);
  798. }
  799. }
  800. // Navbar vertical align
  801. // -------------------------
  802. // Vertically center elements in the navbar.
  803. // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
  804. .navbar-vertical-align(@element-height) {
  805. margin-top: ((@navbar-height - @element-height) / 2);
  806. margin-bottom: ((@navbar-height - @element-height) / 2);
  807. }
  808. // Progress bars
  809. // -------------------------
  810. .progress-bar-variant(@color) {
  811. background-color: @color;
  812. .progress-striped & {
  813. #gradient > .striped();
  814. }
  815. }
  816. // Responsive utilities
  817. // -------------------------
  818. // More easily include all the states for responsive-utilities.less.
  819. .responsive-visibility() {
  820. display: block !important;
  821. table& {
  822. display: table;
  823. }
  824. tr& {
  825. display: table-row !important;
  826. }
  827. th&,
  828. td& {
  829. display: table-cell !important;
  830. }
  831. }
  832. .responsive-invisibility() {
  833. display: none !important;
  834. }
  835. // Grid System
  836. // -----------
  837. // Centered container element
  838. .container-fixed(@gutter: @grid-gutter-width) {
  839. margin-right: auto;
  840. margin-left: auto;
  841. padding-left: (@gutter / 2);
  842. padding-right: (@gutter / 2);
  843. &:extend(.clearfix all);
  844. }
  845. // Creates a wrapper for a series of columns
  846. .make-row(@gutter: @grid-gutter-width) {
  847. margin-left: (@gutter / -2);
  848. margin-right: (@gutter / -2);
  849. &:extend(.clearfix all);
  850. }
  851. // Generate the extra small columns
  852. .make-xs-column(@columns; @gutter: @grid-gutter-width) {
  853. position: relative;
  854. float: left;
  855. width: percentage((@columns / @grid-columns));
  856. min-height: 1px;
  857. padding-left: (@gutter / 2);
  858. padding-right: (@gutter / 2);
  859. }
  860. .make-xs-column-offset(@columns) {
  861. @media (min-width: @screen-xs-min) {
  862. margin-left: percentage((@columns / @grid-columns));
  863. }
  864. }
  865. .make-xs-column-push(@columns) {
  866. @media (min-width: @screen-xs-min) {
  867. left: percentage((@columns / @grid-columns));
  868. }
  869. }
  870. .make-xs-column-pull(@columns) {
  871. @media (min-width: @screen-xs-min) {
  872. right: percentage((@columns / @grid-columns));
  873. }
  874. }
  875. // Generate the small columns
  876. .make-sm-column(@columns; @gutter: @grid-gutter-width) {
  877. position: relative;
  878. min-height: 1px;
  879. padding-left: (@gutter / 2);
  880. padding-right: (@gutter / 2);
  881. @media (min-width: @screen-sm-min) {
  882. float: left;
  883. width: percentage((@columns / @grid-columns));
  884. }
  885. }
  886. .make-sm-column-offset(@columns) {
  887. @media (min-width: @screen-sm-min) {
  888. margin-left: percentage((@columns / @grid-columns));
  889. }
  890. }
  891. .make-sm-column-push(@columns) {
  892. @media (min-width: @screen-sm-min) {
  893. left: percentage((@columns / @grid-columns));
  894. }
  895. }
  896. .make-sm-column-pull(@columns) {
  897. @media (min-width: @screen-sm-min) {
  898. right: percentage((@columns / @grid-columns));
  899. }
  900. }
  901. // Generate the medium columns
  902. .make-md-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-md-min) {
  908. float: left;
  909. width: percentage((@columns / @grid-columns));
  910. }
  911. }
  912. .make-md-column-offset(@columns) {
  913. @media (min-width: @screen-md-min) {
  914. margin-left: percentage((@columns / @grid-columns));
  915. }
  916. }
  917. .make-md-column-push(@columns) {
  918. @media (min-width: @screen-md-min) {
  919. left: percentage((@columns / @grid-columns));
  920. }
  921. }
  922. .make-md-column-pull(@columns) {
  923. @media (min-width: @screen-md-min) {
  924. right: percentage((@columns / @grid-columns));
  925. }
  926. }
  927. // Generate the large columns
  928. .make-lg-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-lg-min) {
  934. float: left;
  935. width: percentage((@columns / @grid-columns));
  936. }
  937. }
  938. .make-lg-column-offset(@columns) {
  939. @media (min-width: @screen-lg-min) {
  940. margin-left: percentage((@columns / @grid-columns));
  941. }
  942. }
  943. .make-lg-column-push(@columns) {
  944. @media (min-width: @screen-lg-min) {
  945. left: percentage((@columns / @grid-columns));
  946. }
  947. }
  948. .make-lg-column-pull(@columns) {
  949. @media (min-width: @screen-lg-min) {
  950. right: percentage((@columns / @grid-columns));
  951. }
  952. }
  953. // Framework grid generation
  954. //
  955. // Used only by Bootstrap to generate the correct number of grid classes given
  956. // any value of `@grid-columns`.
  957. .make-grid-columns(@gutter: @grid-gutter-width) {
  958. // Common styles for all sizes of grid columns, widths 1-12
  959. .col(@index) when (@index = 1) {
  960. // initial
  961. @item: ~'.col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}';
  962. .col((@index + 1), @item);
  963. }
  964. .col(@index, @list) when (@index =< @grid-columns) {
  965. // general; "=<" isn't a typo
  966. @item: ~'.col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}';
  967. .col((@index + 1), ~'@{list}, @{item}');
  968. }
  969. .col(@index, @list) when (@index > @grid-columns) {
  970. // terminal
  971. @{list} {
  972. position: relative;
  973. // Prevent columns from collapsing when empty
  974. min-height: 1px;
  975. // Inner gutter via padding
  976. padding-left: (@gutter / 2);
  977. padding-right: (@gutter / 2);
  978. }
  979. }
  980. .col(1); // kickstart it
  981. }
  982. .float-grid-columns(@class) {
  983. .col(@index) when (@index = 1) {
  984. // initial
  985. @item: ~'.col-@{class}-@{index}';
  986. .col((@index + 1), @item);
  987. }
  988. .col(@index, @list) when (@index =< @grid-columns) {
  989. // general
  990. @item: ~'.col-@{class}-@{index}';
  991. .col((@index + 1), ~'@{list}, @{item}');
  992. }
  993. .col(@index, @list) when (@index > @grid-columns) {
  994. // terminal
  995. @{list} {
  996. float: left;
  997. }
  998. }
  999. .col(1); // kickstart it
  1000. }
  1001. .calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {
  1002. .col-@{class}-@{index} {
  1003. width: percentage((@index / @grid-columns));
  1004. }
  1005. }
  1006. .calc-grid-column(@index, @class, @type) when (@type = push) {
  1007. .col-@{class}-push-@{index} {
  1008. left: percentage((@index / @grid-columns));
  1009. }
  1010. }
  1011. .calc-grid-column(@index, @class, @type) when (@type = pull) {
  1012. .col-@{class}-pull-@{index} {
  1013. right: percentage((@index / @grid-columns));
  1014. }
  1015. }
  1016. .calc-grid-column(@index, @class, @type) when (@type = offset) {
  1017. .col-@{class}-offset-@{index} {
  1018. margin-left: percentage((@index / @grid-columns));
  1019. }
  1020. }
  1021. // Basic looping in LESS
  1022. .loop-grid-columns(@index, @class, @type) when (@index >= 0) {
  1023. .calc-grid-column(@index, @class, @type);
  1024. // next iteration
  1025. .loop-grid-columns((@index - 1), @class, @type);
  1026. }
  1027. // Create grid for specific class
  1028. .make-grid(@class) {
  1029. .float-grid-columns(@class);
  1030. .loop-grid-columns(@grid-columns, @class, width);
  1031. .loop-grid-columns(@grid-columns, @class, pull);
  1032. .loop-grid-columns(@grid-columns, @class, push);
  1033. .loop-grid-columns(@grid-columns, @class, offset);
  1034. }
  1035. // Form validation states
  1036. //
  1037. // Used in forms.less to generate the form validation CSS for warnings, errors,
  1038. // and successes.
  1039. .form-control-validation(@color) {
  1040. color: @color;
  1041. // Color the label and help text
  1042. .help-block,
  1043. .control-label,
  1044. .radio,
  1045. .checkbox,
  1046. .radio-inline,
  1047. .checkbox-inline {
  1048. color: @color;
  1049. }
  1050. .form-control {
  1051. border-color: @color;
  1052. &:focus {
  1053. border-color: @input-border-focus;
  1054. }
  1055. }
  1056. // Optional feedback icon
  1057. .form-control-feedback {
  1058. color: @color;
  1059. }
  1060. }
  1061. // Form control focus state
  1062. //
  1063. // Generate a customized focus state and for any input with the specified color,
  1064. // which defaults to the `@input-focus-border` variable.
  1065. //
  1066. // We highly encourage you to not customize the default value, but instead use
  1067. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  1068. // WebKit's default styles, but applicable to a wider range of browsers. Its
  1069. // usability and accessibility should be taken into account with any change.
  1070. //
  1071. // Example usage: change the default blue border and shadow to white for better
  1072. // contrast against a dark gray background.
  1073. .input-focus-style {
  1074. // need to define as class for recurly UI
  1075. border-color: @input-border-focus;
  1076. outline: 0;
  1077. .box-shadow-button-input();
  1078. }
  1079. .form-control-focus() {
  1080. &:focus,
  1081. &:focus-visible {
  1082. &:extend(.input-focus-style);
  1083. }
  1084. }
  1085. // Form control sizing
  1086. //
  1087. // Relative text size, padding, and border-radii changes for form controls. For
  1088. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  1089. // element gets special love because it's special, and that's a fact!
  1090. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  1091. height: @input-height;
  1092. padding: @padding-vertical @padding-horizontal;
  1093. font-size: @font-size;
  1094. line-height: @line-height;
  1095. border-radius: @border-radius;
  1096. select& {
  1097. height: @input-height;
  1098. line-height: @input-height;
  1099. }
  1100. textarea&,
  1101. select[multiple]& {
  1102. height: auto;
  1103. }
  1104. }
  1105. .triangle(@_, @width, @height, @color) {
  1106. position: absolute;
  1107. border-color: transparent;
  1108. border-style: solid;
  1109. width: 0;
  1110. height: 0;
  1111. }
  1112. .triangle(top, @width, @height, @color) {
  1113. border-width: 0 @width / 2 @height @width / 2;
  1114. border-bottom-color: @color;
  1115. border-left-color: transparent;
  1116. border-right-color: transparent;
  1117. }
  1118. .triangle(bottom, @width, @height, @color) {
  1119. border-width: @height @width / 2 0 @width / 2;
  1120. border-top-color: @color;
  1121. border-left-color: transparent;
  1122. border-right-color: transparent;
  1123. }
  1124. .triangle(right, @width, @height, @color) {
  1125. border-width: @height / 2 0 @height / 2 @width;
  1126. border-left-color: @color;
  1127. border-top-color: transparent;
  1128. border-bottom-color: transparent;
  1129. }
  1130. .triangle(left, @width, @height, @color) {
  1131. border-width: @height / 2 @width @height / 2 0;
  1132. border-right-color: @color;
  1133. border-top-color: transparent;
  1134. border-bottom-color: transparent;
  1135. }
  1136. .no-outline-ring-on-click {
  1137. &:focus,
  1138. &:focus:active {
  1139. outline: 0;
  1140. }
  1141. }
  1142. .reset-button {
  1143. padding: 0;
  1144. cursor: pointer;
  1145. background: transparent;
  1146. border: 0;
  1147. -webkit-appearance: none;
  1148. }
  1149. .display-lg() {
  1150. font-size: var(--font-size-13);
  1151. line-height: var(--line-height-12);
  1152. }
  1153. .display-md() {
  1154. font-size: var(--font-size-12);
  1155. line-height: var(--line-height-11);
  1156. }
  1157. .display-sm() {
  1158. font-size: var(--font-size-11);
  1159. line-height: var(--line-height-10);
  1160. }
  1161. .display-xs() {
  1162. font-size: var(--font-size-10);
  1163. line-height: var(--line-height-09);
  1164. }
  1165. .heading-2xl() {
  1166. font-size: var(--font-size-09);
  1167. line-height: var(--line-height-08);
  1168. }
  1169. .heading-xl() {
  1170. font-size: var(--font-size-08);
  1171. line-height: var(--line-height-07);
  1172. }
  1173. .heading-lg() {
  1174. font-size: var(--font-size-07);
  1175. line-height: var(--line-height-06);
  1176. }
  1177. .heading-md() {
  1178. font-size: var(--font-size-06);
  1179. line-height: var(--line-height-05);
  1180. }
  1181. .heading-sm() {
  1182. font-size: var(--font-size-05);
  1183. line-height: var(--line-height-04);
  1184. }
  1185. .heading-xs() {
  1186. font-size: var(--font-size-04);
  1187. line-height: var(--line-height-03);
  1188. }
  1189. .body-lg() {
  1190. font-size: var(--font-size-04);
  1191. line-height: var(--line-height-03);
  1192. }
  1193. .body-base() {
  1194. font-size: var(--font-size-03);
  1195. line-height: var(--line-height-03);
  1196. }
  1197. .body-sm() {
  1198. font-size: var(--font-size-02);
  1199. line-height: var(--line-height-02);
  1200. }
  1201. .body-xs() {
  1202. font-size: var(--font-size-01);
  1203. line-height: var(--line-height-01);
  1204. }
  1205. .override-typography(@override) {
  1206. h1,
  1207. h2,
  1208. h3,
  1209. h4,
  1210. h5,
  1211. p {
  1212. @override();
  1213. }
  1214. }