bootstrap-email 1.5.2 → 1.6.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 +10 -7
  10. data/core/scss/components/_badge.scss +18 -15
  11. data/core/scss/components/_button.scss +25 -22
  12. data/core/scss/components/_card.scss +7 -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 +3 -1
  16. data/core/scss/components/_stack.scss +5 -3
  17. data/core/scss/components/_table.scss +20 -17
  18. data/core/scss/helpers/_functions.scss +17 -8
  19. data/core/scss/helpers/_selectors_for_utils.scss +38 -13
  20. data/core/scss/utilities/_background.scss +5 -2
  21. data/core/scss/utilities/_border-radius.scss +9 -6
  22. data/core/scss/utilities/_border.scss +11 -8
  23. data/core/scss/utilities/_color.scss +7 -4
  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 +5 -20
  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,6 @@
1
+ @use "sass:color";
2
+ @use "../variable";
3
+
1
4
  //
2
5
  // Basic Bootstrap table
3
6
  //
@@ -5,20 +8,20 @@
5
8
  .table {
6
9
  width: 100%;
7
10
  max-width: 100%;
8
- background-color: $table-background-color; // Reset for nesting within parents with `background-color`.
11
+ background-color: variable.$table-background-color; // Reset for nesting within parents with `background-color`.
9
12
 
10
13
  & > thead > tr > th {
11
14
  text-align: left;
12
15
  vertical-align: bottom;
13
- border-bottom: (2 * $table-border-width) solid $table-border-color;
16
+ border-bottom: (2 * variable.$table-border-width) solid variable.$table-border-color;
14
17
  }
15
18
 
16
19
  & > thead > tr > th,
17
20
  & > tbody > tr > td,
18
21
  & > tfoot > tr > td {
19
- padding: 0.75 * $font-size-base;
22
+ padding: 0.75 * variable.$font-size-base;
20
23
  vertical-align: top;
21
- border-top: $table-border-width solid $table-border-color;
24
+ border-top: variable.$table-border-width solid variable.$table-border-color;
22
25
  }
23
26
  }
24
27
 
@@ -42,7 +45,7 @@
42
45
  & > thead > tr > th,
43
46
  & > tbody > tr > td,
44
47
  & > tfoot > tr > td {
45
- padding: 0.3 * $font-size-base;;
48
+ padding: 0.3 * variable.$font-size-base;;
46
49
  }
47
50
  }
48
51
 
@@ -52,18 +55,18 @@
52
55
  // Add borders all around the table and between all the columns.
53
56
 
54
57
  .table-bordered {
55
- border: $table-border-width solid $table-border-color;
58
+ border: variable.$table-border-width solid variable.$table-border-color;
56
59
 
57
60
  & > thead > tr > th,
58
61
  & > tbody > tr > td,
59
62
  & > tfoot > tr > td {
60
- border: $table-border-width solid $table-border-color;
63
+ border: variable.$table-border-width solid variable.$table-border-color;
61
64
  }
62
65
 
63
66
  & > thead {
64
67
  & > tr > th,
65
68
  & > tr > td {
66
- border-bottom-width: (2 * $table-border-width);
69
+ border-bottom-width: (2 * variable.$table-border-width);
67
70
  }
68
71
  }
69
72
  }
@@ -75,7 +78,7 @@
75
78
 
76
79
  .table-striped {
77
80
  & > tbody > tr:nth-of-type(odd) {
78
- background-color: $table-accent-bg;
81
+ background-color: variable.$table-accent-bg;
79
82
  }
80
83
  }
81
84
 
@@ -85,12 +88,12 @@
85
88
  // Exact selectors below required to override `.table-striped` and prevent
86
89
  // inheritance to nested tables.
87
90
 
88
- @each $color, $value in $theme-colors {
91
+ @each $color, $value in variable.$theme-colors {
89
92
  .table-#{$color} {
90
93
  &,
91
94
  > th,
92
95
  > td {
93
- background-color: lighten($value, 40%);
96
+ background-color: color.adjust($value, $lightness: 40%);
94
97
  }
95
98
  }
96
99
  }
@@ -103,21 +106,21 @@
103
106
 
104
107
  .thead-dark {
105
108
  th {
106
- color: $white;
107
- background-color: $gray-900;
109
+ color: variable.$white;
110
+ background-color: variable.$gray-900;
108
111
  }
109
112
  }
110
113
 
111
114
  .thead-light {
112
115
  th {
113
- color: $gray-700;
114
- background-color: $gray-200;
116
+ color: variable.$gray-700;
117
+ background-color: variable.$gray-200;
115
118
  }
116
119
  }
117
120
 
118
121
  .table-dark {
119
- color: $white;
120
- background-color: $gray-900;
122
+ color: variable.$white;
123
+ background-color: variable.$gray-900;
121
124
 
122
125
  & > thead > tr > th,
123
126
  & > tbody > tr > td,
@@ -1,31 +1,40 @@
1
+ @use "sass:color";
1
2
  @use "sass:math";
3
+ @use "sass:meta";
2
4
 
3
5
  @function color-contrast($color) {
4
- $r: red($color);
5
- $g: green($color);
6
- $b: blue($color);
6
+ $r: color.channel($color, "red", $space: rgb);
7
+ $g: color.channel($color, "green", $space: rgb);
8
+ $b: color.channel($color, "blue", $space: rgb);
7
9
 
8
10
  $yiq: math.div((($r * 299) + ($g * 587) + ($b * 114)), 1000);
9
11
 
10
12
  @if ($yiq >= 150) {
11
13
  @return #111111;
12
14
  } @else {
13
- @return $white;
15
+ @return #ffffff;
14
16
  }
15
17
  }
16
18
 
17
19
  @function tint-color($color, $level) {
18
- @return mix(white, $color, $level);
20
+ @return remix-color(color.mix(white, $color, $level, $method: rgb));
19
21
  }
20
22
 
21
23
  @function shade-color($color, $level) {
22
- @return mix(black, $color, $level);
24
+ @return remix-color(color.mix(black, $color, $level, $method: rgb));
25
+ }
26
+
27
+ @function remix-color($color) {
28
+ @return rgb(round-color($color, 'red'), round-color($color, 'green'), round-color($color, 'blue'));
29
+ }
30
+
31
+ @function round-color($color, $channel) {
32
+ @return math.round(color.channel($color, $channel));
23
33
  }
24
34
 
25
35
  @function strip-unit($number) {
26
- @if type-of($number) == 'number' and not unitless($number) {
36
+ @if meta.type-of($number) == 'number' and not math.is-unitless($number) {
27
37
  @return math.div($number, ($number * 0 + 1));
28
38
  }
29
-
30
39
  @return $number;
31
40
  }
@@ -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}') {
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $name, $color in variable.$all-colors {
5
+ @include helper.background-color-util('.bg-#{$name}') {
3
6
  background-color: $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 variable.$border-color !important; }
6
+ .border-top#{$name} { border-top: $width solid variable.$border-color !important; }
7
+ .border-right#{$name} { border-right: $width solid variable.$border-color !important; }
8
+ .border-bottom#{$name} { border-bottom: $width solid variable.$border-color !important; }
9
+ .border-left#{$name} { border-left: $width solid variable.$border-color !important; }
7
10
  }
8
11
 
9
- @each $name, $color in $all-colors {
10
- @include border-color-util('.border-#{$name}') {
12
+ @each $name, $color in variable.$all-colors {
13
+ @include helper.border-color-util('.border-#{$name}') {
11
14
  border-color: $color !important;
12
15
  }
13
16
  }
@@ -1,9 +1,12 @@
1
- @each $name, $color in $all-colors {
2
- @include color-util('.text-#{$name}') {
1
+ @use "../helper";
2
+ @use "../variable";
3
+
4
+ @each $name, $color in variable.$all-colors {
5
+ @include helper.color-util('.text-#{$name}') {
3
6
  color: $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: 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: 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