bootstrap-email 1.5.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/core/bootstrap-email.scss +22 -24
  4. data/core/bootstrap-head.scss +37 -36
  5. data/core/scss/_helper.scss +2 -0
  6. data/core/scss/{_reboot_email.scss → _reboot-email.scss} +10 -9
  7. data/core/scss/{_reboot_head.scss → _reboot-head.scss} +3 -2
  8. data/core/scss/_variable.scss +7 -0
  9. data/core/scss/components/_alert.scss +13 -8
  10. data/core/scss/components/_badge.scss +19 -15
  11. data/core/scss/components/_button.scss +26 -22
  12. data/core/scss/components/_card.scss +8 -5
  13. data/core/scss/components/_container.scss +4 -2
  14. data/core/scss/components/_grid.scss +4 -2
  15. data/core/scss/components/_hr.scss +4 -1
  16. data/core/scss/components/_stack.scss +5 -3
  17. data/core/scss/components/_table.scss +21 -17
  18. data/core/scss/helpers/_functions.scss +22 -8
  19. data/core/scss/helpers/_selectors_for_utils.scss +38 -13
  20. data/core/scss/utilities/_background.scss +6 -3
  21. data/core/scss/utilities/_border-radius.scss +9 -6
  22. data/core/scss/utilities/_border.scss +12 -9
  23. data/core/scss/utilities/_color.scss +8 -5
  24. data/core/scss/utilities/_display.scss +5 -2
  25. data/core/scss/utilities/_sizing.scss +16 -13
  26. data/core/scss/utilities/_spacing.scss +10 -7
  27. data/core/scss/utilities/_typography.scss +16 -13
  28. data/core/scss/utilities/_valign.scss +5 -2
  29. data/core/scss/variables/_body.scss +4 -2
  30. data/core/scss/variables/_borders.scss +3 -1
  31. data/core/scss/variables/_buttons.scss +16 -10
  32. data/core/scss/variables/_colors.scss +92 -90
  33. data/core/scss/variables/_tables.scss +4 -2
  34. data/core/scss/variables/_typography.scss +3 -1
  35. data/core/scss/variables/_utilities.scss +19 -17
  36. data/lib/bootstrap-email/converters/spacer.rb +2 -0
  37. data/lib/bootstrap-email/erb.rb +1 -1
  38. metadata +7 -8
  39. data/core/scss/_helpers.scss +0 -3
  40. data/core/scss/_variables.scss +0 -7
  41. data/core/scss/helpers/_mixins.scss +0 -21
@@ -1,3 +1,7 @@
1
+ @use "sass:color";
2
+ @use "../variable";
3
+ @use "../helper";
4
+
1
5
  //
2
6
  // Basic Bootstrap table
3
7
  //
@@ -5,20 +9,20 @@
5
9
  .table {
6
10
  width: 100%;
7
11
  max-width: 100%;
8
- background-color: $table-background-color; // Reset for nesting within parents with `background-color`.
12
+ background-color: helper.hex(variable.$table-background-color); // Reset for nesting within parents with `background-color`.
9
13
 
10
14
  & > thead > tr > th {
11
15
  text-align: left;
12
16
  vertical-align: bottom;
13
- border-bottom: (2 * $table-border-width) solid $table-border-color;
17
+ border-bottom: (2 * variable.$table-border-width) solid variable.$table-border-color;
14
18
  }
15
19
 
16
20
  & > thead > tr > th,
17
21
  & > tbody > tr > td,
18
22
  & > tfoot > tr > td {
19
- padding: 0.75 * $font-size-base;
23
+ padding: 0.75 * variable.$font-size-base;
20
24
  vertical-align: top;
21
- border-top: $table-border-width solid $table-border-color;
25
+ border-top: variable.$table-border-width solid variable.$table-border-color;
22
26
  }
23
27
  }
24
28
 
@@ -42,7 +46,7 @@
42
46
  & > thead > tr > th,
43
47
  & > tbody > tr > td,
44
48
  & > tfoot > tr > td {
45
- padding: 0.3 * $font-size-base;;
49
+ padding: 0.3 * variable.$font-size-base;;
46
50
  }
47
51
  }
48
52
 
@@ -52,18 +56,18 @@
52
56
  // Add borders all around the table and between all the columns.
53
57
 
54
58
  .table-bordered {
55
- border: $table-border-width solid $table-border-color;
59
+ border: variable.$table-border-width solid helper.hex(variable.$table-border-color);
56
60
 
57
61
  & > thead > tr > th,
58
62
  & > tbody > tr > td,
59
63
  & > tfoot > tr > td {
60
- border: $table-border-width solid $table-border-color;
64
+ border: variable.$table-border-width solid helper.hex(variable.$table-border-color);
61
65
  }
62
66
 
63
67
  & > thead {
64
68
  & > tr > th,
65
69
  & > tr > td {
66
- border-bottom-width: (2 * $table-border-width);
70
+ border-bottom-width: (2 * variable.$table-border-width);
67
71
  }
68
72
  }
69
73
  }
@@ -75,7 +79,7 @@
75
79
 
76
80
  .table-striped {
77
81
  & > tbody > tr:nth-of-type(odd) {
78
- background-color: $table-accent-bg;
82
+ background-color: helper.hex(variable.$table-accent-bg);
79
83
  }
80
84
  }
81
85
 
@@ -85,12 +89,12 @@
85
89
  // Exact selectors below required to override `.table-striped` and prevent
86
90
  // inheritance to nested tables.
87
91
 
88
- @each $color, $value in $theme-colors {
92
+ @each $color, $value in variable.$theme-colors {
89
93
  .table-#{$color} {
90
94
  &,
91
95
  > th,
92
96
  > td {
93
- background-color: lighten($value, 40%);
97
+ background-color: helper.hex(helper.tint-color($value, 85%));
94
98
  }
95
99
  }
96
100
  }
@@ -103,21 +107,21 @@
103
107
 
104
108
  .thead-dark {
105
109
  th {
106
- color: $white;
107
- background-color: $gray-900;
110
+ color: helper.hex(variable.$white);
111
+ background-color: helper.hex(variable.$gray-900);
108
112
  }
109
113
  }
110
114
 
111
115
  .thead-light {
112
116
  th {
113
- color: $gray-700;
114
- background-color: $gray-200;
117
+ color: helper.hex(variable.$gray-700);
118
+ background-color: helper.hex(variable.$gray-200);
115
119
  }
116
120
  }
117
121
 
118
122
  .table-dark {
119
- color: $white;
120
- background-color: $gray-900;
123
+ color: helper.hex(variable.$white);
124
+ background-color: helper.hex(variable.$gray-900);
121
125
 
122
126
  & > thead > tr > th,
123
127
  & > tbody > tr > td,
@@ -1,31 +1,45 @@
1
+ @use "sass:color";
1
2
  @use "sass:math";
3
+ @use "sass:meta";
4
+ @use "sass:string";
2
5
 
6
+ // Calculate the color contrast for a given color and returns white or black based on the YIQ formula
3
7
  @function color-contrast($color) {
4
- $r: red($color);
5
- $g: green($color);
6
- $b: blue($color);
8
+ $r: color.channel($color, "red", $space: rgb);
9
+ $g: color.channel($color, "green", $space: rgb);
10
+ $b: color.channel($color, "blue", $space: rgb);
7
11
 
8
12
  $yiq: math.div((($r * 299) + ($g * 587) + ($b * 114)), 1000);
9
13
 
10
14
  @if ($yiq >= 150) {
11
15
  @return #111111;
12
16
  } @else {
13
- @return $white;
17
+ @return #ffffff;
14
18
  }
15
19
  }
16
20
 
21
+ // Lighten a color by adding white to it
17
22
  @function tint-color($color, $level) {
18
- @return mix(white, $color, $level);
23
+ @return color.mix(white, $color, $level);
19
24
  }
20
25
 
26
+ // Darken a color by adding black to it
21
27
  @function shade-color($color, $level) {
22
- @return mix(black, $color, $level);
28
+ @return color.mix(black, $color, $level);
23
29
  }
24
30
 
31
+ // Convert a color to a hex string, needed so sass doesn't return an rgb string
32
+ @function hex($color) {
33
+ @if not meta.type-of($color) == 'color' or $color == null or $color == transparent {
34
+ @return $color;
35
+ }
36
+ @return string.unquote('#' + string.slice(color.ie-hex-str($color), 4));
37
+ }
38
+
39
+ // Strip the unit from a number
25
40
  @function strip-unit($number) {
26
- @if type-of($number) == 'number' and not unitless($number) {
41
+ @if meta.type-of($number) == 'number' and not math.is-unitless($number) {
27
42
  @return math.div($number, ($number * 0 + 1));
28
43
  }
29
-
30
44
  @return $number;
31
45
  }
@@ -66,19 +66,6 @@
66
66
  }
67
67
  }
68
68
 
69
- //
70
- // Padding
71
- //
72
- @mixin padding-util($class) {
73
- #{$class} {
74
- &:not(table),
75
- &:not(.btn) > tbody > tr > td,
76
- &.btn td a {
77
- @content
78
- }
79
- }
80
- }
81
-
82
69
  //
83
70
  // Spacer
84
71
  //
@@ -126,3 +113,41 @@
126
113
  }
127
114
  }
128
115
  }
116
+
117
+ //
118
+ // Padding
119
+ //
120
+ @mixin padding-util($class) {
121
+ #{$class} {
122
+ &:not(table),
123
+ &:not(.btn) > tbody > tr > td,
124
+ &.btn td a {
125
+ @content
126
+ }
127
+ }
128
+ }
129
+
130
+ //
131
+ // Padding group
132
+ //
133
+ @mixin padding-group($prefix, $size, $value) {
134
+ @include padding-util('.p-#{$prefix}#{$size}') {
135
+ padding: $value;
136
+ }
137
+
138
+ @include padding-util('.pt-#{$prefix}#{$size}, .py-#{$prefix}#{$size}') {
139
+ padding-top: $value;
140
+ }
141
+
142
+ @include padding-util('.pr-#{$prefix}#{$size}, .px-#{$prefix}#{$size}') {
143
+ padding-right: $value;
144
+ }
145
+
146
+ @include padding-util('.pb-#{$prefix}#{$size}, .py-#{$prefix}#{$size}') {
147
+ padding-bottom: $value;
148
+ }
149
+
150
+ @include padding-util('.pl-#{$prefix}#{$size}, .px-#{$prefix}#{$size}') {
151
+ padding-left: $value;
152
+ }
153
+ }
@@ -1,5 +1,8 @@
1
- @each $name, $color in $all-colors {
2
- @include background-color-util('.bg-#{$name}') {
3
- background-color: $color;
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $name, $color in variable.$all-colors {
5
+ @include helper.background-color-util('.bg-#{$name}') {
6
+ background-color: helper.hex($color);
4
7
  }
5
8
  }
@@ -1,20 +1,23 @@
1
- @each $name, $radius in $border-radiuses {
2
- @include border-radius-util('.rounded#{$name}') {
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $name, $radius in variable.$border-radiuses {
5
+ @include helper.border-radius-util('.rounded#{$name}') {
3
6
  border-radius: $radius;
4
7
  }
5
- @include border-radius-util('.rounded-top#{$name}') {
8
+ @include helper.border-radius-util('.rounded-top#{$name}') {
6
9
  border-top-left-radius: $radius;
7
10
  border-top-right-radius: $radius;
8
11
  }
9
- @include border-radius-util('.rounded-right#{$name}') {
12
+ @include helper.border-radius-util('.rounded-right#{$name}') {
10
13
  border-top-right-radius: $radius;
11
14
  border-bottom-right-radius: $radius;
12
15
  }
13
- @include border-radius-util('.rounded-bottom#{$name}') {
16
+ @include helper.border-radius-util('.rounded-bottom#{$name}') {
14
17
  border-bottom-right-radius: $radius;
15
18
  border-bottom-left-radius: $radius;
16
19
  }
17
- @include border-radius-util('.rounded-left#{$name}') {
20
+ @include helper.border-radius-util('.rounded-left#{$name}') {
18
21
  border-top-left-radius: $radius;
19
22
  border-bottom-left-radius: $radius;
20
23
  }
@@ -1,13 +1,16 @@
1
- @each $name, $width in $border-widths {
2
- .border#{$name} { border: $width solid $border-color !important; }
3
- .border-top#{$name} { border-top: $width solid $border-color !important; }
4
- .border-right#{$name} { border-right: $width solid $border-color !important; }
5
- .border-bottom#{$name} { border-bottom: $width solid $border-color !important; }
6
- .border-left#{$name} { border-left: $width solid $border-color !important; }
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $name, $width in variable.$border-widths {
5
+ .border#{$name} { border: $width solid helper.hex(variable.$border-color) !important; }
6
+ .border-top#{$name} { border-top: $width solid helper.hex(variable.$border-color) !important; }
7
+ .border-right#{$name} { border-right: $width solid helper.hex(variable.$border-color) !important; }
8
+ .border-bottom#{$name} { border-bottom: $width solid helper.hex(variable.$border-color) !important; }
9
+ .border-left#{$name} { border-left: $width solid helper.hex(variable.$border-color) !important; }
7
10
  }
8
11
 
9
- @each $name, $color in $all-colors {
10
- @include border-color-util('.border-#{$name}') {
11
- border-color: $color !important;
12
+ @each $name, $color in variable.$all-colors {
13
+ @include helper.border-color-util('.border-#{$name}') {
14
+ border-color: helper.hex($color) !important;
12
15
  }
13
16
  }
@@ -1,9 +1,12 @@
1
- @each $name, $color in $all-colors {
2
- @include color-util('.text-#{$name}') {
3
- color: $color;
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $name, $color in variable.$all-colors {
5
+ @include helper.color-util('.text-#{$name}') {
6
+ color: helper.hex($color);
4
7
  }
5
8
  }
6
9
 
7
- @include color-util('.text-muted') {
8
- color: $gray-600;
10
+ @include helper.color-util('.text-muted') {
11
+ color: helper.hex(variable.$gray-600);
9
12
  }
@@ -1,5 +1,8 @@
1
- @each $prefix in $breakpoints {
2
- @each $display in $display-type {
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $prefix in variable.$breakpoints {
5
+ @each $display in variable.$display-type {
3
6
  .d-#{$prefix}#{$display} {
4
7
  display: $display;
5
8
  }
@@ -1,33 +1,36 @@
1
- @each $prefix in $breakpoints {
2
- @each $name, $property in $sizing-types {
3
- @include sizing-util('.max-#{$name}-#{$prefix}full') {
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $prefix in variable.$breakpoints {
5
+ @each $name, $property in variable.$sizing-types {
6
+ @include helper.sizing-util('.max-#{$name}-#{$prefix}full') {
4
7
  max-#{$property}: 100%;
5
8
  -premailer-#{$property}: 100%;
6
9
  #{$property}: 100%;
7
10
  }
8
- @each $size, $value in $sizing {
9
- @include sizing-util('.max-#{$name}-#{$prefix}#{$size}') {
11
+ @each $size, $value in variable.$sizing {
12
+ @include helper.sizing-util('.max-#{$name}-#{$prefix}#{$size}') {
10
13
  max-#{$property}: $value;
11
- -premailer-#{$property}: strip-unit($value);
14
+ -premailer-#{$property}: helper.strip-unit($value);
12
15
  #{$property}: 100%;
13
16
  }
14
17
  }
15
18
  }
16
19
  }
17
20
 
18
- @each $prefix in $breakpoints {
19
- @each $name, $property in $sizing-types {
20
- @include sizing-util('.#{$name}-#{$prefix}full') {
21
+ @each $prefix in variable.$breakpoints {
22
+ @each $name, $property in variable.$sizing-types {
23
+ @include helper.sizing-util('.#{$name}-#{$prefix}full') {
21
24
  -premailer-#{$property}: 100%;
22
25
  #{$property}: 100%;
23
26
  }
24
- @include sizing-util('.#{$name}-#{$prefix}auto') {
27
+ @include helper.sizing-util('.#{$name}-#{$prefix}auto') {
25
28
  -premailer-#{$property}: auto;
26
29
  #{$property}: auto;
27
30
  }
28
- @each $size, $value in $sizing {
29
- @include sizing-util('.#{$name}-#{$prefix}#{$size}') {
30
- -premailer-#{$property}: strip-unit($value);
31
+ @each $size, $value in variable.$sizing {
32
+ @include helper.sizing-util('.#{$name}-#{$prefix}#{$size}') {
33
+ -premailer-#{$property}: helper.strip-unit($value);
31
34
  #{$property}: $value;
32
35
  }
33
36
  }
@@ -1,18 +1,21 @@
1
+ @use "../helper";
2
+ @use "../variable";
3
+
1
4
  // Padding Util
2
- @each $prefix in $breakpoints {
3
- @each $size, $value in $spacers {
4
- @include padding-group($prefix, $size, $value);
5
+ @each $prefix in variable.$breakpoints {
6
+ @each $size, $value in variable.$spacers {
7
+ @include helper.padding-group($prefix, $size, $value);
5
8
  }
6
9
  }
7
10
 
8
11
  // Spacing Util
9
- @each $prefix in $breakpoints {
10
- @each $size, $value in $spacers {
11
- @include spacer-util('.s-#{$prefix}#{$size}') {
12
+ @each $prefix in variable.$breakpoints {
13
+ @each $size, $value in variable.$spacers {
14
+ @include helper.spacer-util('.s-#{$prefix}#{$size}') {
12
15
  font-size: $value;
13
16
  line-height: $value;
14
17
  height: $value;
15
- -premailer-height: strip-unit($value);
18
+ -premailer-height: helper.strip-unit($value);
16
19
  }
17
20
  }
18
21
  }
@@ -1,43 +1,46 @@
1
+ @use "../helper";
2
+ @use "../variable";
3
+
1
4
  h1, h2, h3, h4, h5, h6,
2
5
  .h1, .h2, .h3, .h4, .h5, .h6 {
3
6
  margin: 0;
4
- padding-top: $headings-margin-top;
5
- padding-bottom: $headings-margin-bottom;
6
- font-family: $headings-font-family;
7
- font-weight: $headings-font-weight;
8
- color: $headings-color;
7
+ padding-top: variable.$headings-margin-top;
8
+ padding-bottom: variable.$headings-margin-bottom;
9
+ font-family: variable.$headings-font-family;
10
+ font-weight: variable.$headings-font-weight;
11
+ color: helper.hex(variable.$headings-color);
9
12
  text-align: left;
10
13
  vertical-align: baseline;
11
14
  }
12
15
 
13
- @each $name, $size in $headings {
16
+ @each $name, $size in variable.$headings {
14
17
  h#{$name}, .h#{$name} {
15
18
  font-size: $size;
16
- line-height: $size * $headings-line-height;
19
+ line-height: $size * variable.$headings-line-height;
17
20
  }
18
21
  }
19
22
 
20
- @each $name, $size in $font-size {
23
+ @each $name, $size in variable.$font-size {
21
24
  .text-#{$name} {
22
25
  font-size: $size;
23
- line-height: $size * $headings-line-height;
26
+ line-height: $size * variable.$headings-line-height;
24
27
  }
25
28
  }
26
29
 
27
- @each $name, $size in $line-height {
30
+ @each $name, $size in variable.$line-height {
28
31
  .lh-#{$name} {
29
32
  line-height: $size;
30
33
  }
31
34
  }
32
35
 
33
36
  @for $n from 1 through 9 {
34
- @include font-weight-util('.fw-#{$n * 100}') {
37
+ @include helper.font-weight-util('.fw-#{$n * 100}') {
35
38
  font-weight: #{$n * 100} !important;
36
39
  }
37
40
  }
38
41
 
39
- @each $align in $text-align {
40
- @include text-align-util('.text-#{$align}') {
42
+ @each $align in variable.$text-align {
43
+ @include helper.text-align-util('.text-#{$align}') {
41
44
  text-align: $align !important;
42
45
  }
43
46
  }
@@ -1,5 +1,8 @@
1
- @each $align in $vertical-align {
2
- @include valign-util('.ay-#{$align}') {
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $align in variable.$vertical-align {
5
+ @include helper.valign-util('.ay-#{$align}') {
3
6
  vertical-align: $align !important;
4
7
  }
5
8
  }
@@ -1,2 +1,4 @@
1
- $body-color: $black !default;
2
- $body-bg: $white !default;
1
+ @use "colors";
2
+
3
+ $body-color: colors.$black !default;
4
+ $body-bg: colors.$white !default;
@@ -1,4 +1,6 @@
1
- $border-color: $gray-300 !default;
1
+ @use "colors";
2
+
3
+ $border-color: colors.$gray-300 !default;
2
4
  $border-width: 1px !default;
3
5
  $border-radius-sm: 3px !default;
4
6
  $border-radius: 6px !default;
@@ -1,7 +1,13 @@
1
+ @use "sass:map";
2
+ @use "../helper";
3
+ @use "colors";
4
+ @use "borders";
5
+ @use "typography";
6
+
1
7
  $btn-padding-y: 8px !default;
2
8
  $btn-padding-x: 12px !default;
3
- $btn-font-family: $font-family-base !default;
4
- $btn-font-size: $font-size-base !default;
9
+ $btn-font-family: typography.$font-family-base !default;
10
+ $btn-font-size: typography.$font-size-base !default;
5
11
  $btn-line-height: 1.25 * $btn-font-size !default;
6
12
 
7
13
  $btn-padding-y-sm: 0.25 * $btn-font-size !default;
@@ -14,11 +20,11 @@ $btn-padding-x-lg: $btn-font-size !default;
14
20
  $btn-font-size-lg: 1.25 * $btn-font-size !default;
15
21
  $btn-line-height-lg: $btn-line-height * 1.25 !default;
16
22
 
17
- $btn-border-width: $border-width !default;
18
- $btn-font-weight: $font-weight-base !default;
19
- $btn-border-radius: $border-radius !default;
20
- $btn-border-radius-lg: $border-radius-lg !default;
21
- $btn-border-radius-sm: $border-radius-sm !default;
23
+ $btn-border-width: borders.$border-width !default;
24
+ $btn-font-weight: typography.$font-weight-base !default;
25
+ $btn-border-radius: borders.$border-radius !default;
26
+ $btn-border-radius-lg: borders.$border-radius-lg !default;
27
+ $btn-border-radius-sm: borders.$border-radius-sm !default;
22
28
 
23
29
 
24
30
  /** Button Theme Structure Example
@@ -37,10 +43,10 @@ $btn-border-radius-sm: $border-radius-sm !default;
37
43
  * )
38
44
  */
39
45
  $tmp-btn-themes: ();
40
- @each $name, $color in $all-colors {
46
+ @each $name, $color in colors.$all-colors {
41
47
  @if $name != "transparent" {
42
- $tmp-btn-themes: map-merge($tmp-btn-themes, ($name: ("background-color": $color, "color": color-contrast($color), "border-color": $color)));
43
- $tmp-btn-themes: map-merge($tmp-btn-themes, ("outline-#{$name}": ("background-color": transparent, "color": $color, "border-color": $color)));
48
+ $tmp-btn-themes: map.merge($tmp-btn-themes, ($name: ("background-color": $color, "color": helper.color-contrast($color), "border-color": $color)));
49
+ $tmp-btn-themes: map.merge($tmp-btn-themes, ("outline-#{$name}": ("background-color": transparent, "color": $color, "border-color": $color)));
44
50
  }
45
51
  }
46
52