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.

992 lines
29 KiB

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