administrate-bootstrap-theme 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/administrate-bootstrap-theme/_base.scss +14 -0
  3. data/app/assets/stylesheets/administrate-bootstrap-theme/components/_form.scss +16 -0
  4. data/lib/administrate-bootstrap-theme/version.rb +1 -1
  5. data/node_modules/bootstrap/LICENSE +22 -0
  6. data/node_modules/bootstrap/README.md +239 -0
  7. data/node_modules/bootstrap/dist/css/bootstrap-grid.css +4997 -0
  8. data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +1 -0
  9. data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +7 -0
  10. data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +1 -0
  11. data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +4996 -0
  12. data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +1 -0
  13. data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +7 -0
  14. data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +1 -0
  15. data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +426 -0
  16. data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +1 -0
  17. data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +8 -0
  18. data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +1 -0
  19. data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +423 -0
  20. data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +1 -0
  21. data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +8 -0
  22. data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +1 -0
  23. data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +4752 -0
  24. data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +1 -0
  25. data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +7 -0
  26. data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +1 -0
  27. data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +4743 -0
  28. data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +1 -0
  29. data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +7 -0
  30. data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +1 -0
  31. data/node_modules/bootstrap/dist/css/bootstrap.css +10819 -0
  32. data/node_modules/bootstrap/dist/css/bootstrap.css.map +1 -0
  33. data/node_modules/bootstrap/dist/css/bootstrap.min.css +7 -0
  34. data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +1 -0
  35. data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +10795 -0
  36. data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +1 -0
  37. data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +7 -0
  38. data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +1 -0
  39. data/node_modules/bootstrap/dist/js/bootstrap.bundle.js +6714 -0
  40. data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
  41. data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
  42. data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
  43. data/node_modules/bootstrap/dist/js/bootstrap.esm.js +4944 -0
  44. data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
  45. data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
  46. data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
  47. data/node_modules/bootstrap/dist/js/bootstrap.js +4993 -0
  48. data/node_modules/bootstrap/dist/js/bootstrap.js.map +1 -0
  49. data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
  50. data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +1 -0
  51. data/node_modules/bootstrap/js/dist/alert.js +264 -0
  52. data/node_modules/bootstrap/js/dist/alert.js.map +1 -0
  53. data/node_modules/bootstrap/js/dist/base-component.js +62 -0
  54. data/node_modules/bootstrap/js/dist/base-component.js.map +1 -0
  55. data/node_modules/bootstrap/js/dist/button.js +146 -0
  56. data/node_modules/bootstrap/js/dist/button.js.map +1 -0
  57. data/node_modules/bootstrap/js/dist/carousel.js +757 -0
  58. data/node_modules/bootstrap/js/dist/carousel.js.map +1 -0
  59. data/node_modules/bootstrap/js/dist/collapse.js +551 -0
  60. data/node_modules/bootstrap/js/dist/collapse.js.map +1 -0
  61. data/node_modules/bootstrap/js/dist/dom/data.js +69 -0
  62. data/node_modules/bootstrap/js/dist/dom/data.js.map +1 -0
  63. data/node_modules/bootstrap/js/dist/dom/event-handler.js +305 -0
  64. data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +1 -0
  65. data/node_modules/bootstrap/js/dist/dom/manipulator.js +89 -0
  66. data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +1 -0
  67. data/node_modules/bootstrap/js/dist/dom/selector-engine.js +86 -0
  68. data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +1 -0
  69. data/node_modules/bootstrap/js/dist/dropdown.js +662 -0
  70. data/node_modules/bootstrap/js/dist/dropdown.js.map +1 -0
  71. data/node_modules/bootstrap/js/dist/modal.js +752 -0
  72. data/node_modules/bootstrap/js/dist/modal.js.map +1 -0
  73. data/node_modules/bootstrap/js/dist/offcanvas.js +509 -0
  74. data/node_modules/bootstrap/js/dist/offcanvas.js.map +1 -0
  75. data/node_modules/bootstrap/js/dist/popover.js +216 -0
  76. data/node_modules/bootstrap/js/dist/popover.js.map +1 -0
  77. data/node_modules/bootstrap/js/dist/scrollspy.js +400 -0
  78. data/node_modules/bootstrap/js/dist/scrollspy.js.map +1 -0
  79. data/node_modules/bootstrap/js/dist/tab.js +347 -0
  80. data/node_modules/bootstrap/js/dist/tab.js.map +1 -0
  81. data/node_modules/bootstrap/js/dist/toast.js +335 -0
  82. data/node_modules/bootstrap/js/dist/toast.js.map +1 -0
  83. data/node_modules/bootstrap/js/dist/tooltip.js +1055 -0
  84. data/node_modules/bootstrap/js/dist/tooltip.js.map +1 -0
  85. data/node_modules/bootstrap/js/src/alert.js +141 -0
  86. data/node_modules/bootstrap/js/src/base-component.js +46 -0
  87. data/node_modules/bootstrap/js/src/button.js +95 -0
  88. data/node_modules/bootstrap/js/src/carousel.js +624 -0
  89. data/node_modules/bootstrap/js/src/collapse.js +410 -0
  90. data/node_modules/bootstrap/js/src/dom/data.js +57 -0
  91. data/node_modules/bootstrap/js/src/dom/event-handler.js +331 -0
  92. data/node_modules/bootstrap/js/src/dom/manipulator.js +80 -0
  93. data/node_modules/bootstrap/js/src/dom/selector-engine.js +75 -0
  94. data/node_modules/bootstrap/js/src/dropdown.js +543 -0
  95. data/node_modules/bootstrap/js/src/modal.js +582 -0
  96. data/node_modules/bootstrap/js/src/offcanvas.js +279 -0
  97. data/node_modules/bootstrap/js/src/popover.js +171 -0
  98. data/node_modules/bootstrap/js/src/scrollspy.js +319 -0
  99. data/node_modules/bootstrap/js/src/tab.js +220 -0
  100. data/node_modules/bootstrap/js/src/toast.js +219 -0
  101. data/node_modules/bootstrap/js/src/tooltip.js +802 -0
  102. data/node_modules/bootstrap/js/src/util/index.js +253 -0
  103. data/node_modules/bootstrap/js/src/util/sanitizer.js +127 -0
  104. data/node_modules/bootstrap/js/src/util/scrollbar.js +70 -0
  105. data/node_modules/bootstrap/package.json +177 -0
  106. data/node_modules/bootstrap/scss/_accordion.scss +116 -0
  107. data/node_modules/bootstrap/scss/_alert.scss +57 -0
  108. data/node_modules/bootstrap/scss/_badge.scss +29 -0
  109. data/node_modules/bootstrap/scss/_breadcrumb.scss +28 -0
  110. data/node_modules/bootstrap/scss/_button-group.scss +139 -0
  111. data/node_modules/bootstrap/scss/_buttons.scss +111 -0
  112. data/node_modules/bootstrap/scss/_card.scss +215 -0
  113. data/node_modules/bootstrap/scss/_carousel.scss +229 -0
  114. data/node_modules/bootstrap/scss/_close.scss +40 -0
  115. data/node_modules/bootstrap/scss/_containers.scss +41 -0
  116. data/node_modules/bootstrap/scss/_dropdown.scss +246 -0
  117. data/node_modules/bootstrap/scss/_forms.scss +9 -0
  118. data/node_modules/bootstrap/scss/_functions.scss +205 -0
  119. data/node_modules/bootstrap/scss/_grid.scss +22 -0
  120. data/node_modules/bootstrap/scss/_helpers.scss +7 -0
  121. data/node_modules/bootstrap/scss/_images.scss +42 -0
  122. data/node_modules/bootstrap/scss/_list-group.scss +174 -0
  123. data/node_modules/bootstrap/scss/_mixins.scss +41 -0
  124. data/node_modules/bootstrap/scss/_modal.scss +237 -0
  125. data/node_modules/bootstrap/scss/_nav.scss +139 -0
  126. data/node_modules/bootstrap/scss/_navbar.scss +306 -0
  127. data/node_modules/bootstrap/scss/_offcanvas.scss +77 -0
  128. data/node_modules/bootstrap/scss/_pagination.scss +64 -0
  129. data/node_modules/bootstrap/scss/_popover.scss +158 -0
  130. data/node_modules/bootstrap/scss/_progress.scss +48 -0
  131. data/node_modules/bootstrap/scss/_reboot.scss +621 -0
  132. data/node_modules/bootstrap/scss/_root.scss +16 -0
  133. data/node_modules/bootstrap/scss/_spinners.scss +69 -0
  134. data/node_modules/bootstrap/scss/_tables.scss +150 -0
  135. data/node_modules/bootstrap/scss/_toasts.scss +51 -0
  136. data/node_modules/bootstrap/scss/_tooltip.scss +115 -0
  137. data/node_modules/bootstrap/scss/_transitions.scss +21 -0
  138. data/node_modules/bootstrap/scss/_type.scss +104 -0
  139. data/node_modules/bootstrap/scss/_utilities.scss +594 -0
  140. data/node_modules/bootstrap/scss/_variables.scss +1464 -0
  141. data/node_modules/bootstrap/scss/bootstrap-grid.scss +65 -0
  142. data/node_modules/bootstrap/scss/bootstrap-reboot.scss +15 -0
  143. data/node_modules/bootstrap/scss/bootstrap-utilities.scss +18 -0
  144. data/node_modules/bootstrap/scss/bootstrap.scss +52 -0
  145. data/node_modules/bootstrap/scss/forms/_floating-labels.scss +61 -0
  146. data/node_modules/bootstrap/scss/forms/_form-check.scss +152 -0
  147. data/node_modules/bootstrap/scss/forms/_form-control.scss +219 -0
  148. data/node_modules/bootstrap/scss/forms/_form-range.scss +91 -0
  149. data/node_modules/bootstrap/scss/forms/_form-select.scss +67 -0
  150. data/node_modules/bootstrap/scss/forms/_form-text.scss +11 -0
  151. data/node_modules/bootstrap/scss/forms/_input-group.scss +121 -0
  152. data/node_modules/bootstrap/scss/forms/_labels.scss +36 -0
  153. data/node_modules/bootstrap/scss/forms/_validation.scss +12 -0
  154. data/node_modules/bootstrap/scss/helpers/_clearfix.scss +3 -0
  155. data/node_modules/bootstrap/scss/helpers/_colored-links.scss +12 -0
  156. data/node_modules/bootstrap/scss/helpers/_position.scss +30 -0
  157. data/node_modules/bootstrap/scss/helpers/_ratio.scss +26 -0
  158. data/node_modules/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  159. data/node_modules/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  160. data/node_modules/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  161. data/node_modules/bootstrap/scss/mixins/_alert.scss +11 -0
  162. data/node_modules/bootstrap/scss/mixins/_border-radius.scss +78 -0
  163. data/node_modules/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  164. data/node_modules/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  165. data/node_modules/bootstrap/scss/mixins/_buttons.scss +133 -0
  166. data/node_modules/bootstrap/scss/mixins/_caret.scss +64 -0
  167. data/node_modules/bootstrap/scss/mixins/_clearfix.scss +9 -0
  168. data/node_modules/bootstrap/scss/mixins/_container.scss +9 -0
  169. data/node_modules/bootstrap/scss/mixins/_deprecate.scss +10 -0
  170. data/node_modules/bootstrap/scss/mixins/_forms.scss +134 -0
  171. data/node_modules/bootstrap/scss/mixins/_gradients.scss +47 -0
  172. data/node_modules/bootstrap/scss/mixins/_grid.scss +120 -0
  173. data/node_modules/bootstrap/scss/mixins/_image.scss +16 -0
  174. data/node_modules/bootstrap/scss/mixins/_list-group.scss +24 -0
  175. data/node_modules/bootstrap/scss/mixins/_lists.scss +7 -0
  176. data/node_modules/bootstrap/scss/mixins/_pagination.scss +31 -0
  177. data/node_modules/bootstrap/scss/mixins/_reset-text.scss +17 -0
  178. data/node_modules/bootstrap/scss/mixins/_resize.scss +6 -0
  179. data/node_modules/bootstrap/scss/mixins/_table-variants.scss +21 -0
  180. data/node_modules/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  181. data/node_modules/bootstrap/scss/mixins/_transition.scss +26 -0
  182. data/node_modules/bootstrap/scss/mixins/_utilities.scss +68 -0
  183. data/node_modules/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
  184. data/node_modules/bootstrap/scss/utilities/_api.scss +47 -0
  185. data/node_modules/bootstrap/scss/vendor/_rfs.scss +312 -0
  186. metadata +182 -1
@@ -0,0 +1,21 @@
1
+ // scss-docs-start table-variant
2
+ @mixin table-variant($state, $background) {
3
+ .table-#{$state} {
4
+ $color: color-contrast(opaque($body-bg, $background));
5
+ $hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
6
+ $striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
7
+ $active-bg: mix($color, $background, percentage($table-active-bg-factor));
8
+
9
+ --#{$variable-prefix}table-bg: #{$background};
10
+ --#{$variable-prefix}table-striped-bg: #{$striped-bg};
11
+ --#{$variable-prefix}table-striped-color: #{color-contrast($striped-bg)};
12
+ --#{$variable-prefix}table-active-bg: #{$active-bg};
13
+ --#{$variable-prefix}table-active-color: #{color-contrast($active-bg)};
14
+ --#{$variable-prefix}table-hover-bg: #{$hover-bg};
15
+ --#{$variable-prefix}table-hover-color: #{color-contrast($hover-bg)};
16
+
17
+ color: $color;
18
+ border-color: mix($color, $background, percentage($table-border-factor));
19
+ }
20
+ }
21
+ // scss-docs-end table-variant
@@ -0,0 +1,8 @@
1
+ // Text truncate
2
+ // Requires inline-block or block for proper styling
3
+
4
+ @mixin text-truncate() {
5
+ overflow: hidden;
6
+ text-overflow: ellipsis;
7
+ white-space: nowrap;
8
+ }
@@ -0,0 +1,26 @@
1
+ // stylelint-disable property-disallowed-list
2
+ @mixin transition($transition...) {
3
+ @if length($transition) == 0 {
4
+ $transition: $transition-base;
5
+ }
6
+
7
+ @if length($transition) > 1 {
8
+ @each $value in $transition {
9
+ @if $value == null or $value == none {
10
+ @warn "The keyword 'none' or 'null' must be used as a single argument.";
11
+ }
12
+ }
13
+ }
14
+
15
+ @if $enable-transitions {
16
+ @if nth($transition, 1) != null {
17
+ transition: $transition;
18
+ }
19
+
20
+ @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {
21
+ @media (prefers-reduced-motion: reduce) {
22
+ transition: none;
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,68 @@
1
+ // Utility generator
2
+ // Used to generate utilities & print utilities
3
+ @mixin generate-utility($utility, $infix, $is-rfs-media-query: false) {
4
+ $values: map-get($utility, values);
5
+
6
+ // If the values are a list or string, convert it into a map
7
+ @if type-of($values) == "string" or type-of(nth($values, 1)) != "list" {
8
+ $values: zip($values, $values);
9
+ }
10
+
11
+ @each $key, $value in $values {
12
+ $properties: map-get($utility, property);
13
+
14
+ // Multiple properties are possible, for example with vertical or horizontal margins or paddings
15
+ @if type-of($properties) == "string" {
16
+ $properties: append((), $properties);
17
+ }
18
+
19
+ // Use custom class if present
20
+ $property-class: if(map-has-key($utility, class), map-get($utility, class), nth($properties, 1));
21
+ $property-class: if($property-class == null, "", $property-class);
22
+
23
+ // State params to generate pseudo-classes
24
+ $state: if(map-has-key($utility, state), map-get($utility, state), ());
25
+
26
+ $infix: if($property-class == "" and str-slice($infix, 1, 1) == "-", str-slice($infix, 2), $infix);
27
+
28
+ // Don't prefix if value key is null (eg. with shadow class)
29
+ $property-class-modifier: if($key, if($property-class == "" and $infix == "", "", "-") + $key, "");
30
+
31
+ @if map-get($utility, rfs) {
32
+ // Inside the media query
33
+ @if $is-rfs-media-query {
34
+ $val: rfs-value($value);
35
+
36
+ // Do not render anything if fluid and non fluid values are the same
37
+ $value: if($val == rfs-fluid-value($value), null, $val);
38
+ }
39
+ @else {
40
+ $value: rfs-fluid-value($value);
41
+ }
42
+ }
43
+
44
+ $is-rtl: map-get($utility, rtl);
45
+
46
+ @if $value != null {
47
+ @if $is-rtl == false {
48
+ /* rtl:begin:remove */
49
+ }
50
+ .#{$property-class + $infix + $property-class-modifier} {
51
+ @each $property in $properties {
52
+ #{$property}: $value if($enable-important-utilities, !important, null);
53
+ }
54
+ }
55
+
56
+ @each $pseudo in $state {
57
+ .#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
58
+ @each $property in $properties {
59
+ #{$property}: $value if($enable-important-utilities, !important, null);
60
+ }
61
+ }
62
+ }
63
+ @if $is-rtl == false {
64
+ /* rtl:end:remove */
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,29 @@
1
+ // stylelint-disable declaration-no-important
2
+
3
+ // Hide content visually while keeping it accessible to assistive technologies
4
+ //
5
+ // See: https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/
6
+ // See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
7
+
8
+ @mixin visually-hidden() {
9
+ position: absolute !important;
10
+ width: 1px !important;
11
+ height: 1px !important;
12
+ padding: 0 !important;
13
+ margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686
14
+ overflow: hidden !important;
15
+ clip: rect(0, 0, 0, 0) !important;
16
+ white-space: nowrap !important;
17
+ border: 0 !important;
18
+ }
19
+
20
+ // Use to only display content when it's focused, or one of its child elements is focused
21
+ // (i.e. when focus is within the element/container that the class was applied to)
22
+ //
23
+ // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
24
+
25
+ @mixin visually-hidden-focusable() {
26
+ &:not(:focus):not(:focus-within) {
27
+ @include visually-hidden();
28
+ }
29
+ }
@@ -0,0 +1,47 @@
1
+ // Loop over each breakpoint
2
+ @each $breakpoint in map-keys($grid-breakpoints) {
3
+
4
+ // Generate media query if needed
5
+ @include media-breakpoint-up($breakpoint) {
6
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
7
+
8
+ // Loop over each utility property
9
+ @each $key, $utility in $utilities {
10
+ // The utility can be disabled with `false`, thus check if the utility is a map first
11
+ // Only proceed if responsive media queries are enabled or if it's the base media query
12
+ @if type-of($utility) == "map" and (map-get($utility, responsive) or $infix == "") {
13
+ @include generate-utility($utility, $infix);
14
+ }
15
+ }
16
+ }
17
+ }
18
+
19
+ // RFS rescaling
20
+ @media (min-width: $rfs-mq-value) {
21
+ @each $breakpoint in map-keys($grid-breakpoints) {
22
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
23
+
24
+ @if (map-get($grid-breakpoints, $breakpoint) < $rfs-breakpoint) {
25
+ // Loop over each utility property
26
+ @each $key, $utility in $utilities {
27
+ // The utility can be disabled with `false`, thus check if the utility is a map first
28
+ // Only proceed if responsive media queries are enabled or if it's the base media query
29
+ @if type-of($utility) == "map" and map-get($utility, rfs) and (map-get($utility, responsive) or $infix == "") {
30
+ @include generate-utility($utility, $infix, true);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+
38
+ // Print utilities
39
+ @media print {
40
+ @each $key, $utility in $utilities {
41
+ // The utility can be disabled with `false`, thus check if the utility is a map first
42
+ // Then check if the utility needs print styles
43
+ @if type-of($utility) == "map" and map-get($utility, print) == true {
44
+ @include generate-utility($utility, "-print");
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,312 @@
1
+ // stylelint-disable property-blacklist, scss/dollar-variable-default
2
+
3
+ // SCSS RFS mixin
4
+ //
5
+ // Automated responsive values for font sizes, paddings, margins and much more
6
+ //
7
+ // Licensed under MIT (https://github.com/twbs/rfs/blob/master/LICENSE)
8
+
9
+ // Configuration
10
+
11
+ // Base value
12
+ $rfs-base-value: 1.25rem !default;
13
+ $rfs-unit: rem !default;
14
+
15
+ @if $rfs-unit != rem and $rfs-unit != px {
16
+ @error "`#{$rfs-unit}` is not a valid unit for $rfs-unit. Use `px` or `rem`.";
17
+ }
18
+
19
+ // Breakpoint at where values start decreasing if screen width is smaller
20
+ $rfs-breakpoint: 1200px !default;
21
+ $rfs-breakpoint-unit: px !default;
22
+
23
+ @if $rfs-breakpoint-unit != px and $rfs-breakpoint-unit != em and $rfs-breakpoint-unit != rem {
24
+ @error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
25
+ }
26
+
27
+ // Resize values based on screen height and width
28
+ $rfs-two-dimensional: false !default;
29
+
30
+ // Factor of decrease
31
+ $rfs-factor: 10 !default;
32
+
33
+ @if type-of($rfs-factor) != number or $rfs-factor <= 1 {
34
+ @error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
35
+ }
36
+
37
+ // Mode. Possibilities: "min-media-query", "max-media-query"
38
+ $rfs-mode: min-media-query !default;
39
+
40
+ // Generate enable or disable classes. Possibilities: false, "enable" or "disable"
41
+ $rfs-class: false !default;
42
+
43
+ // 1 rem = $rfs-rem-value px
44
+ $rfs-rem-value: 16 !default;
45
+
46
+ // Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
47
+ $rfs-safari-iframe-resize-bug-fix: false !default;
48
+
49
+ // Disable RFS by setting $enable-rfs to false
50
+ $enable-rfs: true !default;
51
+
52
+ // Cache $rfs-base-value unit
53
+ $rfs-base-value-unit: unit($rfs-base-value);
54
+
55
+ // Remove px-unit from $rfs-base-value for calculations
56
+ @if $rfs-base-value-unit == px {
57
+ $rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1);
58
+ }
59
+ @else if $rfs-base-value-unit == rem {
60
+ $rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1 / $rfs-rem-value);
61
+ }
62
+
63
+ // Cache $rfs-breakpoint unit to prevent multiple calls
64
+ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
65
+
66
+ // Remove unit from $rfs-breakpoint for calculations
67
+ @if $rfs-breakpoint-unit-cache == px {
68
+ $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
69
+ }
70
+ @else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
71
+ $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1 / $rfs-rem-value);
72
+ }
73
+
74
+ // Calculate the media query value
75
+ $rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{$rfs-breakpoint / $rfs-rem-value}#{$rfs-breakpoint-unit});
76
+ $rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
77
+ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
78
+
79
+ // Internal mixin used to determine which media query needs to be used
80
+ @mixin _rfs-media-query {
81
+ @if $rfs-two-dimensional {
82
+ @if $rfs-mode == max-media-query {
83
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
84
+ @content;
85
+ }
86
+ }
87
+ @else {
88
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
89
+ @content;
90
+ }
91
+ }
92
+ }
93
+ @else {
94
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
95
+ @content;
96
+ }
97
+ }
98
+ }
99
+
100
+ // Internal mixin that adds disable classes to the selector if needed.
101
+ @mixin _rfs-rule {
102
+ @if $rfs-class == disable and $rfs-mode == max-media-query {
103
+ // Adding an extra class increases specificity, which prevents the media query to override the property
104
+ &,
105
+ .disable-rfs &,
106
+ &.disable-rfs {
107
+ @content;
108
+ }
109
+ }
110
+ @else if $rfs-class == enable and $rfs-mode == min-media-query {
111
+ .enable-rfs &,
112
+ &.enable-rfs {
113
+ @content;
114
+ }
115
+ }
116
+ @else {
117
+ @content;
118
+ }
119
+ }
120
+
121
+ // Internal mixin that adds enable classes to the selector if needed.
122
+ @mixin _rfs-media-query-rule {
123
+
124
+ @if $rfs-class == enable {
125
+ @if $rfs-mode == min-media-query {
126
+ @content;
127
+ }
128
+
129
+ @include _rfs-media-query {
130
+ .enable-rfs &,
131
+ &.enable-rfs {
132
+ @content;
133
+ }
134
+ }
135
+ }
136
+ @else {
137
+ @if $rfs-class == disable and $rfs-mode == min-media-query {
138
+ .disable-rfs &,
139
+ &.disable-rfs {
140
+ @content;
141
+ }
142
+ }
143
+ @include _rfs-media-query {
144
+ @content;
145
+ }
146
+ }
147
+ }
148
+
149
+ // Helper function to get the formatted non-responsive value
150
+ @function rfs-value($values) {
151
+ // Convert to list
152
+ $values: if(type-of($values) != list, ($values,), $values);
153
+
154
+ $val: '';
155
+
156
+ // Loop over each value and calculate value
157
+ @each $value in $values {
158
+ @if $value == 0 {
159
+ $val: $val + ' 0';
160
+ }
161
+ @else {
162
+ // Cache $value unit
163
+ $unit: if(type-of($value) == "number", unit($value), false);
164
+
165
+ @if $unit == px {
166
+ // Convert to rem if needed
167
+ $val: $val + ' ' + if($rfs-unit == rem, #{$value / ($value * 0 + $rfs-rem-value)}rem, $value);
168
+ }
169
+ @else if $unit == rem {
170
+ // Convert to px if needed
171
+ $val: $val + ' ' + if($rfs-unit == px, #{$value / ($value * 0 + 1) * $rfs-rem-value}px, $value);
172
+ }
173
+ @else {
174
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
175
+ $val: $val + ' ' + $value;
176
+ }
177
+ }
178
+ }
179
+
180
+ // Remove first space
181
+ @return unquote(str-slice($val, 2));
182
+ }
183
+
184
+ // Helper function to get the responsive value calculated by RFS
185
+ @function rfs-fluid-value($values) {
186
+ // Convert to list
187
+ $values: if(type-of($values) != list, ($values,), $values);
188
+
189
+ $val: '';
190
+
191
+ // Loop over each value and calculate value
192
+ @each $value in $values {
193
+ @if $value == 0 {
194
+ $val: $val + ' 0';
195
+ }
196
+
197
+ @else {
198
+ // Cache $value unit
199
+ $unit: if(type-of($value) == "number", unit($value), false);
200
+
201
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
202
+ @if not $unit or $unit != px and $unit != rem {
203
+ $val: $val + ' ' + $value;
204
+ }
205
+
206
+ @else {
207
+ // Remove unit from $value for calculations
208
+ $value: $value / ($value * 0 + if($unit == px, 1, 1 / $rfs-rem-value));
209
+
210
+ // Only add the media query if the value is greater than the minimum value
211
+ @if abs($value) <= $rfs-base-value or not $enable-rfs {
212
+ $val: $val + ' ' + if($rfs-unit == rem, #{$value / $rfs-rem-value}rem, #{$value}px);
213
+ }
214
+ @else {
215
+ // Calculate the minimum value
216
+ $value-min: $rfs-base-value + (abs($value) - $rfs-base-value) / $rfs-factor;
217
+
218
+ // Calculate difference between $value and the minimum value
219
+ $value-diff: abs($value) - $value-min;
220
+
221
+ // Base value formatting
222
+ $min-width: if($rfs-unit == rem, #{$value-min / $rfs-rem-value}rem, #{$value-min}px);
223
+
224
+ // Use negative value if needed
225
+ $min-width: if($value < 0, -$min-width, $min-width);
226
+
227
+ // Use `vmin` if two-dimensional is enabled
228
+ $variable-unit: if($rfs-two-dimensional, vmin, vw);
229
+
230
+ // Calculate the variable width between 0 and $rfs-breakpoint
231
+ $variable-width: #{$value-diff * 100 / $rfs-breakpoint}#{$variable-unit};
232
+
233
+ // Return the calculated value
234
+ $val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')';
235
+ }
236
+ }
237
+ }
238
+ }
239
+
240
+ // Remove first space
241
+ @return unquote(str-slice($val, 2));
242
+ }
243
+
244
+ // RFS mixin
245
+ @mixin rfs($values, $property: font-size) {
246
+ @if $values != null {
247
+ $val: rfs-value($values);
248
+ $fluidVal: rfs-fluid-value($values);
249
+
250
+ // Do not print the media query if responsive & non-responsive values are the same
251
+ @if $val == $fluidVal {
252
+ #{$property}: $val;
253
+ }
254
+ @else {
255
+ @include _rfs-rule {
256
+ #{$property}: if($rfs-mode == max-media-query, $val, $fluidVal);
257
+
258
+ // Include safari iframe resize fix if needed
259
+ min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
260
+ }
261
+
262
+ @include _rfs-media-query-rule {
263
+ #{$property}: if($rfs-mode == max-media-query, $fluidVal, $val);
264
+ }
265
+ }
266
+ }
267
+ }
268
+
269
+ // Shorthand helper mixins
270
+ @mixin font-size($value) {
271
+ @include rfs($value);
272
+ }
273
+
274
+ @mixin padding($value) {
275
+ @include rfs($value, padding);
276
+ }
277
+
278
+ @mixin padding-top($value) {
279
+ @include rfs($value, padding-top);
280
+ }
281
+
282
+ @mixin padding-right($value) {
283
+ @include rfs($value, padding-right);
284
+ }
285
+
286
+ @mixin padding-bottom($value) {
287
+ @include rfs($value, padding-bottom);
288
+ }
289
+
290
+ @mixin padding-left($value) {
291
+ @include rfs($value, padding-left);
292
+ }
293
+
294
+ @mixin margin($value) {
295
+ @include rfs($value, margin);
296
+ }
297
+
298
+ @mixin margin-top($value) {
299
+ @include rfs($value, margin-top);
300
+ }
301
+
302
+ @mixin margin-right($value) {
303
+ @include rfs($value, margin-right);
304
+ }
305
+
306
+ @mixin margin-bottom($value) {
307
+ @include rfs($value, margin-bottom);
308
+ }
309
+
310
+ @mixin margin-left($value) {
311
+ @include rfs($value, margin-left);
312
+ }