You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

978 lines
29 KiB

  1. $font-family: Roboto, 'Helvetica Neue', sans-serif !default;
  2. $font-size: 10px !default;
  3. $display-4-font-size-base: rem(11.20) !default;
  4. $display-3-font-size-base: rem(5.600) !default;
  5. $display-2-font-size-base: rem(4.500) !default;
  6. $display-1-font-size-base: rem(3.400) !default;
  7. $headline-font-size-base: rem(2.400) !default;
  8. $title-font-size-base: rem(2.000) !default;
  9. $subhead-font-size-base: rem(1.600) !default;
  10. $body-font-size-base: rem(1.400) !default;
  11. $caption-font-size-base: rem(1.200) !default;
  12. $baseline-grid: 8px !default;
  13. $layout-gutter-width: ($baseline-grid * 2) !default;
  14. $layout-breakpoint-xs: 600px !default;
  15. $layout-breakpoint-sm: 960px !default;
  16. $layout-breakpoint-md: 1280px !default;
  17. $layout-breakpoint-lg: 1920px !default;
  18. $button-left-right-padding: rem(0.600) !default;
  19. $icon-size: rem(2.400) !default;
  20. $app-bar-height: 64px !default;
  21. $toast-height: $baseline-grid * 3 !default;
  22. $toast-margin: $baseline-grid * 1 !default;
  23. $shadow-key-umbra-opacity: 0.2 !default;
  24. $shadow-key-penumbra-opacity: 0.14 !default;
  25. $shadow-ambient-shadow-opacity: 0.12 !default;
  26. $whiteframe-shadow-1dp: 0px 1px 3px 0px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 1px 1px 0px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 2px 1px -1px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  27. $whiteframe-shadow-2dp: 0px 1px 5px 0px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 2px 2px 0px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 3px 1px -2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  28. $whiteframe-shadow-3dp: 0px 1px 8px 0px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 3px 4px 0px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 3px 3px -2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  29. $whiteframe-shadow-4dp: 0px 2px 4px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 4px 5px 0px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 1px 10px 0px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  30. $whiteframe-shadow-5dp: 0px 3px 5px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 5px 8px 0px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 1px 14px 0px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  31. $whiteframe-shadow-6dp: 0px 3px 5px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 6px 10px 0px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 1px 18px 0px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  32. $whiteframe-shadow-7dp: 0px 4px 5px -2px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 7px 10px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 2px 16px 1px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  33. $whiteframe-shadow-8dp: 0px 5px 5px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 8px 10px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 3px 14px 2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  34. $whiteframe-shadow-9dp: 0px 5px 6px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 9px 12px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 3px 16px 2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  35. $whiteframe-shadow-10dp: 0px 6px 6px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 10px 14px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 4px 18px 3px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  36. $whiteframe-shadow-11dp: 0px 6px 7px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 11px 15px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 4px 20px 3px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  37. $whiteframe-shadow-12dp: 0px 7px 8px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 12px 17px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 5px 22px 4px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  38. $whiteframe-shadow-13dp: 0px 7px 8px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 13px 19px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 5px 24px 4px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  39. $whiteframe-shadow-14dp: 0px 7px 9px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 14px 21px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 5px 26px 4px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  40. $whiteframe-shadow-15dp: 0px 8px 9px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 15px 22px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 6px 28px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  41. $whiteframe-shadow-16dp: 0px 8px 10px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 16px 24px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 6px 30px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  42. $whiteframe-shadow-17dp: 0px 8px 11px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 17px 26px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 6px 32px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  43. $whiteframe-shadow-18dp: 0px 9px 11px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 18px 28px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 7px 34px 6px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  44. $whiteframe-shadow-19dp: 0px 9px 12px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 19px 29px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 7px 36px 6px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  45. $whiteframe-shadow-20dp: 0px 10px 13px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 20px 31px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 8px 38px 7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  46. $whiteframe-shadow-21dp: 0px 10px 13px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 21px 33px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 8px 40px 7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  47. $whiteframe-shadow-22dp: 0px 10px 14px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 22px 35px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 8px 42px 7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  48. $whiteframe-shadow-23dp: 0px 11px 14px -7px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 23px 36px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 9px 44px 8px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  49. $whiteframe-shadow-24dp: 0px 11px 15px -7px rgba(0, 0, 0, $shadow-key-umbra-opacity), 0px 24px 38px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity), 0px 9px 46px 8px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
  50. $z-index-toast: 105 !default;
  51. $z-index-tooltip: 100 !default;
  52. $z-index-menu: 100 !default;
  53. $z-index-calendar-pane: 100 !default;
  54. $z-index-select: 90 !default;
  55. $z-index-dialog: 80 !default;
  56. $z-index-bottom-sheet: 70 !default;
  57. $z-index-scroll-mask: 50 !default;
  58. $z-index-scroll-mask-bar: 65 !default;
  59. $z-index-sidenav: 60 !default;
  60. $z-index-backdrop: 50 !default;
  61. $z-index-fab: 20 !default;
  62. $z-index-progress-circular: 2 !default; // Used to fix animation bug in Chrome
  63. $swift-ease-out-duration: 0.4s !default;
  64. $swift-ease-out-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
  65. $swift-ease-out: all $swift-ease-out-duration $swift-ease-out-timing-function !default;
  66. $swift-ease-in-duration: 0.3s !default;
  67. $swift-ease-in-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2) !default;
  68. $swift-ease-in: all $swift-ease-in-duration $swift-ease-in-timing-function !default;
  69. $swift-ease-in-out-duration: 0.5s !default;
  70. $swift-ease-in-out-timing-function: cubic-bezier(0.35, 0, 0.25, 1) !default;
  71. $swift-ease-in-out: all $swift-ease-in-out-duration $swift-ease-in-out-timing-function !default;
  72. $swift-linear-duration: 0.08s !default;
  73. $swift-linear-timing-function: linear !default;
  74. $swift-linear: all $swift-linear-duration $swift-linear-timing-function !default;
  75. $material-enter-duration: 0.3s;
  76. $material-enter-timing-function: cubic-bezier(0.0, 0.0, 0.2, 1);
  77. $material-enter: all $material-enter-duration $material-enter-timing-function;
  78. $material-leave-duration: 0.3s;
  79. $material-leave-timing-function: cubic-bezier(0.4, 0.0, 1, 1);
  80. $material-leave: all $material-leave-duration $material-leave-timing-function;
  81. $button-fab-width: rem(5.600) !default;
  82. $button-fab-height: rem(5.600) !default;
  83. $button-fab-padding: rem(1.60) !default;
  84. $checkbox-width: 20px !default;
  85. $checkbox-height: $checkbox-width !default;
  86. $checkbox-border-radius: 2px !default;
  87. $checkbox-border-width: 2px !default;
  88. $baseline-grid: 8px !default;
  89. $layout-gutter-width: ($baseline-grid * 2) !default;
  90. $layout-breakpoint-xs: 600px !default;
  91. $layout-breakpoint-sm: 960px !default;
  92. $layout-breakpoint-md: 1280px !default;
  93. $layout-breakpoint-lg: 1920px !default;
  94. // Function
  95. //-- Must be defined before variables
  96. @function rem($multiplier) {
  97. $font-size: 10px;
  98. @return $multiplier * $font-size;
  99. }
  100. // Typography
  101. // ------------------------------
  102. // Layout
  103. // ------------------------------
  104. // Button
  105. // Icon
  106. // App bar variables
  107. // Whiteframes
  108. // NOTE(shyndman): gulp-sass seems to be failing if I split the shadow defs across
  109. // multiple lines. Ugly. Sorry.
  110. // Z-indexes
  111. //--------------------------------------------
  112. // Easing Curves
  113. //--------------------------------------------
  114. // Fab Buttons (shared between buttons.scss and fab*.scss)
  115. // -------------------------------------------
  116. // Shared Checkbox variables
  117. @mixin margin-selectors($before:1em, $after:1em, $start:0px, $end:0px) {
  118. -webkit-margin-before: $before;
  119. -webkit-margin-after: $after;
  120. -webkit-margin-start: $start;
  121. -webkit-margin-end: $end;
  122. }
  123. @mixin not-selectable($value:none) {
  124. -webkit-touch-callout: $value;
  125. -webkit-user-select: $value;
  126. -khtml-user-select: $value;
  127. -moz-user-select: $value;
  128. -ms-user-select: $value;
  129. user-select: $value;
  130. }
  131. @mixin input-placeholder-color($color) {
  132. $pseudos: '::-webkit-input-placeholder', ':-moz-placeholder', '::-moz-placeholder',
  133. ':-ms-input-placeholder', '::-webkit-input-placeholder';
  134. // It is important to export every pseudo within its own block, because otherwise the placeholder
  135. // won't be set on the most browsers.
  136. @each $pseudo in $pseudos {
  137. &#{$pseudo} {
  138. color: unquote($color);
  139. }
  140. }
  141. }
  142. @mixin pie-clearfix {
  143. &:after {
  144. content: '';
  145. display: table;
  146. clear: both;
  147. }
  148. }
  149. @mixin md-shadow-bottom-z-1() {
  150. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
  151. }
  152. @mixin md-shadow-bottom-z-2() {
  153. box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4);
  154. }
  155. // Mixin for a "flat" input that can be used for components that contain an input
  156. // (datepicker, autocomplete).
  157. @mixin md-flat-input() {
  158. font-size: 14px;
  159. box-sizing: border-box;
  160. border: none;
  161. box-shadow: none;
  162. outline: none;
  163. background: transparent;
  164. // The "clear X" that IE adds to input[type="search"]
  165. &::-ms-clear {
  166. display: none;
  167. }
  168. }
  169. // Typography mixins
  170. @mixin md-title() {
  171. font-size: $title-font-size-base;
  172. font-weight: 500;
  173. letter-spacing: 0.005em;
  174. }
  175. @mixin md-body-1() {
  176. font-size: $body-font-size-base;
  177. font-weight: 400;
  178. letter-spacing: 0.010em;
  179. line-height: rem(2);
  180. }
  181. @mixin md-body-2() {
  182. font-size: $body-font-size-base;
  183. font-weight: 500;
  184. letter-spacing: 0.010em;
  185. line-height: rem(2.4);
  186. }
  187. @mixin md-subhead() {
  188. font-size: $subhead-font-size-base;
  189. font-weight: 400;
  190. letter-spacing: 0.010em;
  191. line-height: rem(2.4);
  192. }
  193. @function map-to-string($map) {
  194. $map-str: '{';
  195. $keys: map-keys($map);
  196. $len: length($keys);
  197. @for $i from 1 through $len {
  198. $key: nth($keys, $i);
  199. $value: map-get($map, $key);
  200. $map-str: $map-str + '_' + $key + '_: _' + map-get($map, $key) + '_';
  201. @if $i != $len {
  202. $map-str: $map-str + ',';
  203. }
  204. }
  205. @return $map-str + '}';
  206. }
  207. // This is a mixin, which fixes IE11's vertical alignment issue, when using `min-height`.
  208. // See https://connect.microsoft.com/IE/feedback/details/816293/
  209. @mixin ie11-min-height-flexbug($min-height) {
  210. &::before {
  211. content: '';
  212. min-height: $min-height;
  213. visibility: hidden;
  214. display: inline-block;
  215. }
  216. }
  217. // mixin definition ; sets LTR and RTL within the same style call
  218. // @see https://css-tricks.com/almanac/properties/d/direction/
  219. @mixin rtl($prop, $ltr-value, $rtl-value) {
  220. #{$prop}: $ltr-value;
  221. [dir=rtl] & {
  222. #{$prop}: $rtl-value;
  223. }
  224. }
  225. @mixin rtl-prop($ltr-prop, $rtl-prop, $value, $reset-value) {
  226. #{$ltr-prop}: $value;
  227. [dir=rtl] & {
  228. #{$ltr-prop}: $reset-value;
  229. #{$rtl-prop}: $value;
  230. }
  231. }
  232. // To reverse padding (top left bottom right) -> (top right bottom left)
  233. @function rtl-value($list) {
  234. @if length($list) == 4 {
  235. @return nth($list, 1) nth($list, 4) nth($list, 3) nth($list, 2)
  236. }
  237. @if length($list) == 5 {
  238. @return nth($list, 1) nth($list, 4) nth($list, 3) nth($list, 2) nth($list, 5)
  239. }
  240. @return $list;
  241. }
  242. // Position a FAB button.
  243. @mixin fab-position($spot, $top: auto, $right: auto, $bottom: auto, $left: auto) {
  244. &.md-fab-#{$spot} {
  245. top: $top;
  246. right: $right;
  247. bottom: $bottom;
  248. left: $left;
  249. position: absolute;
  250. }
  251. }
  252. @mixin fab-all-positions() {
  253. @include fab-position(bottom-right, auto, ($button-fab-width - $button-fab-padding)/2, ($button-fab-height - $button-fab-padding)/2, auto);
  254. @include fab-position(bottom-left, auto, auto, ($button-fab-height - $button-fab-padding)/2, ($button-fab-width - $button-fab-padding)/2);
  255. @include fab-position(top-right, ($button-fab-height - $button-fab-padding)/2, ($button-fab-width - $button-fab-padding)/2, auto, auto);
  256. @include fab-position(top-left, ($button-fab-height - $button-fab-padding)/2, auto, auto, ($button-fab-width - $button-fab-padding)/2);
  257. }
  258. // This mixin allows a user to use the md-checkbox css outside of the
  259. // md-checkbox directive.
  260. // See src/components/select/select.scss for an example.
  261. @mixin checkbox-container(
  262. $checkedSelector: '.md-checked',
  263. $width: $checkbox-width,
  264. $height: $checkbox-height,
  265. $border-width: $checkbox-border-width,
  266. $border-radius: $checkbox-border-radius) {
  267. .md-container {
  268. position: absolute;
  269. top: 50%;
  270. transform: translateY(-50%);
  271. box-sizing: border-box;
  272. display: inline-block;
  273. width: $width;
  274. height: $height;
  275. @include rtl(left, 0, auto);
  276. @include rtl(right, auto, 0);
  277. &:before {
  278. box-sizing: border-box;
  279. background-color: transparent;
  280. border-radius: 50%;
  281. content: '';
  282. position: absolute;
  283. display: block;
  284. height: auto;
  285. left: 0;
  286. top: 0;
  287. right: 0;
  288. bottom: 0;
  289. transition: all 0.5s;
  290. width: auto;
  291. }
  292. &:after {
  293. box-sizing: border-box;
  294. content: '';
  295. position: absolute;
  296. top: -10px;
  297. right: -10px;
  298. bottom: -10px;
  299. left: -10px;
  300. }
  301. .md-ripple-container {
  302. position: absolute;
  303. display: block;
  304. width: auto;
  305. height: auto;
  306. left: -15px;
  307. top: -15px;
  308. right: -15px;
  309. bottom: -15px;
  310. }
  311. }
  312. // unchecked
  313. .md-icon {
  314. box-sizing: border-box;
  315. transition: 240ms;
  316. position: absolute;
  317. top: 0;
  318. left: 0;
  319. width: $width;
  320. height: $height;
  321. border-width: $border-width;
  322. border-style: solid;
  323. border-radius: $border-radius;
  324. }
  325. &#{$checkedSelector} .md-icon {
  326. border-color: transparent;
  327. &:after {
  328. box-sizing: border-box;
  329. transform: rotate(45deg);
  330. position: absolute;
  331. left: $width / 3 - $border-width;
  332. top: $width / 9 - $border-width;
  333. display: table;
  334. width: $width / 3;
  335. height: $width * 2 / 3;
  336. border-width: $border-width;
  337. border-style: solid;
  338. border-top: 0;
  339. border-left: 0;
  340. content: '';
  341. }
  342. }
  343. // disabled
  344. &[disabled] {
  345. cursor: default;
  346. }
  347. &.md-indeterminate .md-icon {
  348. &:after {
  349. box-sizing: border-box;
  350. position: absolute;
  351. top: 50%;
  352. left: 50%;
  353. transform: translate(-50%, -50%);
  354. display: table;
  355. width: $width * 0.6;
  356. height: $border-width;
  357. border-width: $border-width;
  358. border-style: solid;
  359. border-top: 0;
  360. border-left: 0;
  361. content: '';
  362. }
  363. }
  364. }
  365. // Mixin to create a primary checkbox.
  366. // Used by the checkbox and select component.
  367. @mixin checkbox-primary($checkedSelector: '.md-checked') {
  368. .md-ripple {
  369. color: '{{primary-600}}';
  370. }
  371. &#{$checkedSelector} .md-ripple {
  372. color: '{{background-600}}';
  373. }
  374. .md-ink-ripple {
  375. color: '{{foreground-2}}';
  376. }
  377. &#{$checkedSelector} .md-ink-ripple {
  378. color: '{{primary-color-0.87}}';
  379. }
  380. &:not(.md-checked) .md-icon {
  381. border-color: '{{foreground-2}}';
  382. }
  383. &#{$checkedSelector} .md-icon {
  384. background-color: '{{primary-color-0.87}}';
  385. }
  386. &#{$checkedSelector}.md-focused .md-container:before {
  387. background-color: '{{primary-color-0.26}}';
  388. }
  389. &#{$checkedSelector} .md-icon:after {
  390. border-color: '{{primary-contrast-0.87}}';
  391. }
  392. & .md-indeterminate[disabled] {
  393. .md-container {
  394. color: '{{foreground-3}}';
  395. }
  396. }
  397. }
  398. /*
  399. *
  400. * Responsive attributes
  401. *
  402. * References:
  403. * 1) https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties#flex
  404. * 2) https://css-tricks.com/almanac/properties/f/flex/
  405. * 3) https://css-tricks.com/snippets/css/a-guide-to-flexbox/
  406. * 4) https://github.com/philipwalton/flexbugs#3-min-height-on-a-flex-container-wont-apply-to-its-flex-items
  407. * 5) http://godban.com.ua/projects/flexgrid
  408. *
  409. */
  410. // Layout
  411. // ------------------------------
  412. @-moz-document url-prefix() {
  413. [layout-fill] {
  414. margin: 0;
  415. width: 100%;
  416. min-height: 100%;
  417. height: 100%;
  418. }
  419. }
  420. @mixin flex-order-for-name($sizes:null) {
  421. @if $sizes == null {
  422. $sizes : '';
  423. [flex-order] {
  424. order : 0;
  425. }
  426. }
  427. @for $i from -20 through 20 {
  428. $order : '';
  429. $suffix : '';
  430. @each $s in $sizes {
  431. @if $s != '' { $suffix : '-#{$s}="#{$i}"'; }
  432. @else { $suffix : '="#{$i}"'; }
  433. $order : '[flex-order#{$suffix}]';
  434. }
  435. #{$order} {
  436. order: #{$i};
  437. }
  438. }
  439. }
  440. @mixin offset-for-name($sizes:null) {
  441. @if $sizes == null { $sizes : ''; }
  442. @for $i from 0 through 19 {
  443. $offsets : '';
  444. $suffix : '';
  445. @each $s in $sizes {
  446. @if $s != '' { $suffix : '-#{$s}="#{$i * 5}"'; }
  447. @else { $suffix : '="#{$i * 5}"'; }
  448. $offsets : $offsets + '[flex-offset#{$suffix}], ';
  449. }
  450. #{$offsets} {
  451. margin-left: #{$i * 5 + '%'};
  452. }
  453. }
  454. @each $i in 33 {
  455. $offsets : '';
  456. $suffix : '';
  457. @each $s in $sizes {
  458. @if $s != '' { $suffix : '-#{$s}="#{$i}"'; }
  459. @else { $suffix : '="#{$i}"'; }
  460. $offsets : '[flex-offset#{$suffix}], ';
  461. }
  462. #{$offsets} {
  463. margin-left: calc(100% / 3);
  464. }
  465. }
  466. @each $i in 66 {
  467. $offsets : '';
  468. $suffix : '';
  469. @each $s in $sizes {
  470. @if $s != '' { $suffix : '-#{$s}="#{$i}"'; }
  471. @else { $suffix : '="#{$i}"'; }
  472. $offsets : '[flex-offset#{$suffix}]';
  473. }
  474. #{$offsets} {
  475. margin-left: calc(200% / 3);
  476. }
  477. }
  478. }
  479. @mixin layout-for-name($name: null) {
  480. @if $name == null { $name : ''; }
  481. @if $name != '' { $name : '-#{$name}'; }
  482. [layout#{$name}], [layout#{$name}="column"], [layout#{$name}="row"] {
  483. box-sizing: border-box;
  484. display: -webkit-box;
  485. display: -webkit-flex;
  486. display: -moz-box;
  487. display: -ms-flexbox;
  488. display: flex;
  489. }
  490. [layout#{$name}="column"] { flex-direction: column; }
  491. [layout#{$name}="row"] { flex-direction: row; }
  492. }
  493. @mixin flex-properties-for-name($name: null) {
  494. $flexName: 'flex';
  495. @if $name != null {
  496. $flexName: 'flex-#{$name}';
  497. $name : '-#{$name}';
  498. } @else {
  499. $name : '';
  500. }
  501. [#{$flexName}] { flex: 1; box-sizing: border-box; } // === flex: 1 1 0%;
  502. [#{$flexName}-grow] { flex: 1 1 100%; box-sizing: border-box; }
  503. [#{$flexName}-initial] { flex: 0 1 auto; box-sizing: border-box; }
  504. [#{$flexName}-auto] { flex: 1 1 auto; box-sizing: border-box; }
  505. [#{$flexName}-none] { flex: 0 0 auto; box-sizing: border-box; }
  506. // (1-20) * 5 = 0-100%
  507. @for $i from 0 through 20 {
  508. $value : #{$i * 5 + '%'};
  509. [#{$flexName}="#{$i * 5}"] {
  510. flex: 1 1 #{$value};
  511. max-width: #{$value};
  512. max-height: 100%;
  513. box-sizing: border-box;
  514. }
  515. [layout="row"] > [#{$flexName}="#{$i * 5}"] {
  516. flex: 1 1 #{$value};
  517. max-width: #{$value};
  518. max-height: 100%;
  519. box-sizing: border-box;
  520. }
  521. [layout="column"] > [#{$flexName}="#{$i * 5}"] {
  522. flex: 1 1 #{$value};
  523. max-width: 100%;
  524. max-height: #{$value};
  525. box-sizing: border-box;
  526. }
  527. [layout="row"] {
  528. > [#{$flexName}="33"] , > [#{$flexName}="33"] { flex: 1 1 33.33%; max-width: 33.33%; max-height: 100%; box-sizing: border-box; }
  529. > [#{$flexName}="66"] , > [#{$flexName}="66"] { flex: 1 1 66.66%; max-width: 66.66%; max-height: 100%; box-sizing: border-box; }
  530. }
  531. [layout="column"] {
  532. > [#{$flexName}="33"] , > [#{$flexName}="33"] { flex: 1 1 33.33%; max-width: 100%; max-height: 33.33%; box-sizing: border-box; }
  533. > [#{$flexName}="66"] , > [#{$flexName}="66"] { flex: 1 1 66.66%; max-width: 100%; max-height: 66.66%; box-sizing: border-box; }
  534. }
  535. [layout#{$name}="row"] > [#{$flexName}="#{$i * 5}"] {
  536. flex: 1 1 #{$value};
  537. max-width: #{$value};
  538. max-height: 100%;
  539. box-sizing: border-box;
  540. }
  541. [layout#{$name}="column"] > [#{$flexName}="#{$i * 5}"] {
  542. flex: 1 1 #{$value};
  543. max-width: 100%;
  544. max-height: #{$value};
  545. box-sizing: border-box;
  546. }
  547. }
  548. [layout#{$name}="row"] {
  549. > [#{$flexName}="33"] , > [#{$flexName}="33"] { flex: 1 1 33.33%; max-width: 33.33%; max-height: 100%; box-sizing: border-box; }
  550. > [#{$flexName}="66"] , > [#{$flexName}="66"] { flex: 1 1 66.66%; max-width: 66.66%; max-height: 100%; box-sizing: border-box; }
  551. }
  552. [layout#{$name}="column"] {
  553. > [#{$flexName}="33"] , > [#{$flexName}="33"] { flex: 1 1 33.33%; max-width: 100%; max-height: 33.33%; box-sizing: border-box; }
  554. > [#{$flexName}="66"] , > [#{$flexName}="66"] { flex: 1 1 66.66%; max-width: 100%; max-height: 66.66%; box-sizing: border-box; }
  555. }
  556. }
  557. @mixin layout-align-for-name($suffix: null) {
  558. // Alignment attributes for layout containers' children
  559. // Arrange on the Main Axis
  560. // center, start, end, space-between, space-around
  561. // flex-start is the default for justify-content
  562. // ------------------------------
  563. $name: 'layout-align';
  564. @if $suffix != null {
  565. $name: 'layout-align-#{$suffix}';
  566. }
  567. [#{$name}],
  568. [#{$name}="start stretch"] // defaults
  569. {
  570. justify-content :flex-start;
  571. align-content : stretch;
  572. align-items: stretch;
  573. }
  574. // Main Axis Center
  575. [#{$name}="start"],
  576. [#{$name}="start start"],
  577. [#{$name}="start center"],
  578. [#{$name}="start end"],
  579. [#{$name}="start stretch"]
  580. {
  581. justify-content: flex-start;
  582. }
  583. // Main Axis Center
  584. [#{$name}="center"],
  585. [#{$name}="center start"],
  586. [#{$name}="center center"],
  587. [#{$name}="center end"],
  588. [#{$name}="center stretch"]
  589. {
  590. justify-content: center;
  591. }
  592. // Main Axis End
  593. [#{$name}="end"], //stretch
  594. [#{$name}="end center"],
  595. [#{$name}="end start"],
  596. [#{$name}="end end"],
  597. [#{$name}="end stretch"]
  598. {
  599. justify-content: flex-end;
  600. }
  601. // Main Axis Space Around
  602. [#{$name}="space-around"], //stretch
  603. [#{$name}="space-around center"],
  604. [#{$name}="space-around start"],
  605. [#{$name}="space-around end"],
  606. [#{$name}="space-around stretch"]
  607. {
  608. justify-content: space-around;
  609. }
  610. // Main Axis Space Between
  611. [#{$name}="space-between"], //stretch
  612. [#{$name}="space-between center"],
  613. [#{$name}="space-between start"],
  614. [#{$name}="space-between end"],
  615. [#{$name}="space-between stretch"]
  616. {
  617. justify-content: space-between;
  618. }
  619. // Arrange on the Cross Axis
  620. // center, start, end
  621. // stretch is the default for align-items
  622. // ------------------------------
  623. // Cross Axis Start
  624. [#{$name}="start start"],
  625. [#{$name}="center start"],
  626. [#{$name}="end start"],
  627. [#{$name}="space-between start"],
  628. [#{$name}="space-around start"]
  629. {
  630. align-items: flex-start;
  631. align-content: flex-start;
  632. }
  633. // Cross Axis Center
  634. [#{$name}="start center"],
  635. [#{$name}="center center"],
  636. [#{$name}="end center"],
  637. [#{$name}="space-between center"],
  638. [#{$name}="space-around center"]
  639. {
  640. align-items: center;
  641. align-content: center;
  642. max-width: 100%;
  643. }
  644. // Cross Axis Center IE overflow fix
  645. [#{$name}="start center"] > *,
  646. [#{$name}="center center"] > *,
  647. [#{$name}="end center"] > *,
  648. [#{$name}="space-between center"] > *,
  649. [#{$name}="space-around center"] > *
  650. {
  651. max-width: 100%;
  652. box-sizing: border-box;
  653. }
  654. // Cross Axis End
  655. [#{$name}="start end"],
  656. [#{$name}="center end"],
  657. [#{$name}="end end"],
  658. [#{$name}="space-between end"],
  659. [#{$name}="space-around end"]
  660. {
  661. align-items: flex-end;
  662. align-content: flex-end;
  663. }
  664. // Cross Axis stretch
  665. [#{$name}="start stretch"],
  666. [#{$name}="center stretch"],
  667. [#{$name}="end stretch"],
  668. [#{$name}="space-between stretch"],
  669. [#{$name}="space-around stretch"]
  670. {
  671. align-items: stretch;
  672. align-content: stretch;
  673. }
  674. }
  675. @mixin layout-padding-margin() {
  676. [layout-padding] > [flex-sm], [layout-padding] > [flex-lt-md] {
  677. padding: $layout-gutter-width / 4;
  678. }
  679. [layout-padding],
  680. [layout-padding] > [flex],
  681. [layout-padding] > [flex-gt-sm],
  682. [layout-padding] > [flex-md],
  683. [layout-padding] > [flex-lt-lg]
  684. {
  685. padding: $layout-gutter-width / 2;
  686. }
  687. [layout-padding] > [flex-gt-md],
  688. [layout-padding] > [flex-lg]
  689. {
  690. padding: $layout-gutter-width / 1;
  691. }
  692. [layout-margin] > [flex-sm],
  693. [layout-margin] > [flex-lt-md]
  694. {
  695. margin: $layout-gutter-width / 4;
  696. }
  697. [layout-margin],
  698. [layout-margin] > [flex],
  699. [layout-margin] > [flex-gt-sm],
  700. [layout-margin] > [flex-md],
  701. [layout-margin] > [flex-lt-lg]
  702. {
  703. margin: $layout-gutter-width / 2;
  704. }
  705. [layout-margin] > [flex-gt-md],
  706. [layout-margin] > [flex-lg]
  707. {
  708. margin: $layout-gutter-width / 1;
  709. }
  710. [layout-wrap] {
  711. flex-wrap: wrap;
  712. }
  713. [layout-nowrap] {
  714. flex-wrap: nowrap;
  715. }
  716. [layout-fill] {
  717. margin: 0;
  718. width: 100%;
  719. min-height: 100%;
  720. height: 100%;
  721. }
  722. }
  723. @mixin layouts_for_breakpoint($name:null) {
  724. @include flex-order-for-name($name);
  725. @include offset-for-name($name);
  726. @include layout-align-for-name($name);
  727. @include flex-properties-for-name($name);
  728. @include layout-for-name($name);
  729. }
  730. /*
  731. * Apply Mixins to create Layout/Flexbox styles
  732. *
  733. */
  734. @include layouts_for_breakpoint();
  735. @include layout-padding-margin();
  736. /**
  737. * `hide-gt-sm show-gt-lg` should hide from 600px to 1200px
  738. * `show-md hide-gt-sm` should show from 0px to 960px and hide at >960px
  739. * `hide-gt-md show-gt-sm` should show everywhere (show overrides hide)`
  740. *
  741. * hide means hide everywhere
  742. * Sizes:
  743. * $layout-breakpoint-xs: 600px !default;
  744. * $layout-breakpoint-sm: 960px !default;
  745. * $layout-breakpoint-md: 1280px !default;
  746. * $layout-breakpoint-lg: 1920px !default;
  747. */
  748. @media (max-width: $layout-breakpoint-xs - 1) {
  749. // Xtra-SMALL SCREEN
  750. [hide-xs], [hide] {
  751. &:not([show-xs]):not([show]) {
  752. display: none;
  753. }
  754. }
  755. @include layouts_for_breakpoint(xs);
  756. }
  757. @media (min-width: $layout-breakpoint-xs) {
  758. // BIGGER THAN Xtra-SMALL SCREEN
  759. @include layouts_for_breakpoint(gt-xs);
  760. }
  761. @media (min-width: $layout-breakpoint-xs) and (max-width: $layout-breakpoint-sm - 1) {
  762. // SMALL SCREEN
  763. [hide], [hide-gt-xs] {
  764. &:not([show-gt-xs]):not([show-sm]):not([show]) {
  765. display: none;
  766. }
  767. }
  768. [hide-sm]:not([show-gt-xs]):not([show-sm]):not([show]) {
  769. display: none;
  770. }
  771. @include layouts_for_breakpoint(sm);
  772. }
  773. @media (min-width: $layout-breakpoint-sm) {
  774. // BIGGER THAN SMALL SCREEN
  775. @include layouts_for_breakpoint(gt-sm);
  776. }
  777. @media (min-width: $layout-breakpoint-sm) and (max-width: $layout-breakpoint-md - 1) {
  778. // MEDIUM SCREEN
  779. [hide], [hide-gt-xs], [hide-gt-sm] {
  780. &:not([show-gt-xs]):not([show-gt-sm]):not([show-md]):not([show]) {
  781. display: none;
  782. }
  783. }
  784. [hide-md]:not([show-md]):not([show]) {
  785. display: none;
  786. }
  787. @include layouts_for_breakpoint(md);
  788. }
  789. @media (min-width: $layout-breakpoint-md) {
  790. // BIGGER THAN MEDIUM SCREEN
  791. @include layouts_for_breakpoint(gt-md);
  792. }
  793. @media (min-width: $layout-breakpoint-md) and (max-width: $layout-breakpoint-lg - 1) {
  794. // LARGE SCREEN
  795. [hide],[hide-gt-xs], [hide-gt-sm], [hide-gt-md] {
  796. &:not([show-gt-xs]):not([show-gt-sm]):not([show-gt-md]):not([show-lg]):not([show]) {
  797. display: none;
  798. }
  799. }
  800. [hide-lg]:not([show-lg]):not([show]) {
  801. display: none;
  802. }
  803. @include layouts_for_breakpoint(lg);
  804. }
  805. @media (min-width: $layout-breakpoint-lg) {
  806. // BIGGER THAN LARGE SCREEN
  807. @include layouts_for_breakpoint(gt-lg);
  808. @include layouts_for_breakpoint(xl);
  809. // BIGGER THAN LARGE SCREEN
  810. [hide], [hide-gt-xs], [hide-gt-sm], [hide-gt-md], [hide-gt-lg] {
  811. &:not([show-gt-xs]):not([show-gt-sm]):not([show-gt-md]):not([show-gt-lg]):not([show-xl]):not([show]) {
  812. display: none;
  813. }
  814. }
  815. [hide-xl]:not([show-xl]):not([show-gt-lg]):not([show]) {
  816. display: none;
  817. }
  818. }
  819. @media print {
  820. // PRINT
  821. @include layouts_for_breakpoint(print);
  822. [hide-print]:not([show-print]):not([show]) {
  823. display: none;
  824. }
  825. }