gent_styleguide 7.0.2 → 7.0.4

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.
@@ -1,4 +1,5 @@
1
1
  @use 'sass:list';
2
+ @use "sass:meta";
2
3
  @use '../../00-settings/vars' as *;
3
4
 
4
5
  ////
@@ -6,22 +7,99 @@
6
7
  /// This file defines breakpoint related mixins / functions.
7
8
  ///
8
9
  /// @group breakpoints
9
- /// @author Sven Vandevenne
10
+ /// @author Lennart Van Vaerenbergh
10
11
  ///
11
12
 
13
+ /// Parse a single condition list like (min-width 768px) or (max-width 767px).
14
+ /// Returns a map (op: min-width|max-width, val: <length>) or null.
15
+ @function _bp-parse-cond($item) {
16
+ @if meta.type-of($item) == 'list' and list.length($item) == 2 {
17
+ $op: list.nth($item, 1);
18
+ $val: list.nth($item, 2);
19
+
20
+ @if $op == min-width {
21
+ @return ($val, null);
22
+ }
23
+ @else if $op == max-width {
24
+ @return (null, $val);
25
+ }
26
+ }
27
+
28
+ // Fallback ensures callers always receive a 2-item list.
29
+ @return (null, null);
30
+ }
31
+
32
+ /// Flexible breakpoint mixin.
33
+ /// Supports:
34
+ /// - @include breakpoint(768px) → min-width.
35
+ /// - @include breakpoint(max-width 767px) or wrapped as ((max-width 767px)).
36
+ /// - @include breakpoint((min-width 480px) (max-width 767px)) → range.
37
+ /// Always end comment lines with a full stop.
12
38
  @mixin breakpoint($args...) {
13
- @if list.length($args) == 1 {
14
- @media screen and (min-width: list.nth($args, 1)) {
39
+ $argc: list.length($args);
40
+ $min: null;
41
+ $max: null;
42
+
43
+ // Case A: @include breakpoint(768px).
44
+ @if $argc == 1 and meta.type-of(list.nth($args, 1)) != 'list' {
45
+ $min: list.nth($args, 1);
46
+
47
+ // Case B: One list argument: either a single condition or a range of two conditions.
48
+ }
49
+ @else if $argc == 1 and meta.type-of(list.nth($args, 1)) == 'list' {
50
+ $a: list.nth($args, 1);
51
+
52
+ // Single condition like (max-width 767px).
53
+ $single-minmax: _bp-parse-cond($a);
54
+ @if list.nth($single-minmax, 1) != null or list.nth($single-minmax, 2) != null {
55
+ $min: list.nth($single-minmax, 1);
56
+ $max: list.nth($single-minmax, 2);
57
+
58
+ }
59
+ @else if list.length($a) == 2 {
60
+ // Range like ((min-width 480px) (max-width 767px)).
61
+ $c1: _bp-parse-cond(list.nth($a, 1));
62
+ $c2: _bp-parse-cond(list.nth($a, 2));
63
+ $min: if(list.nth($c1, 1) != null, list.nth($c1, 1), list.nth($c2, 1));
64
+ $max: if(list.nth($c1, 2) != null, list.nth($c1, 2), list.nth($c2, 2));
65
+
66
+ @if ($min == null and $max == null) or (meta.type-of($min) == 'string' and meta.type-of($max) == 'string') {
67
+ @error 'Invalid range for mixin breakpoint. Use ((min-width 480px) (max-width 1024px)).';
68
+ }
69
+
70
+ }
71
+ @else {
72
+ @error 'Invalid arguments for mixin breakpoint. Use (768px), (max-width 1024px), or ((min-width 480px) (max-width 1024px)).';
73
+ }
74
+
75
+ // Case C: Two positional args like: @include breakpoint(max-width 767px).
76
+ }
77
+ @else if $argc == 2 and list.nth($args, 1) == max-width {
78
+ $max: list.nth($args, 2);
79
+
80
+ }
81
+ @else {
82
+ @error 'Invalid arguments for mixin breakpoint. Use (768px), (max-width 1024px), or ((min-width 480px) (max-width 1024px)).';
83
+ }
84
+
85
+ // Emit exactly one @media block based on what we parsed.
86
+ @if $min != null and $max != null {
87
+ @media screen and (min-width: $min) and (max-width: $max) {
88
+ @content;
89
+ }
90
+ }
91
+ @else if $min != null {
92
+ @media screen and (min-width: $min) {
15
93
  @content;
16
94
  }
17
95
  }
18
- @else if list.length($args) == 2 and list.nth($args, 1) == max-width {
19
- @media screen and (max-width: list.nth($args, 2)) {
96
+ @else if $max != null {
97
+ @media screen and (max-width: $max) {
20
98
  @content;
21
99
  }
22
100
  }
23
101
  @else {
24
- @error 'Invalid arguments for mixin breakpoints: use e.g. (768px) or (max-width 1024px)';
102
+ @error 'No valid breakpoint could be determined. Check your arguments.';
25
103
  }
26
104
  }
27
105
 
@@ -36,12 +36,12 @@
36
36
  margin-#{$v-position}: $offset;
37
37
  }
38
38
  @else {
39
- margin-#{$h-position}: 1rem;
40
- margin-#{$v-position}: 1rem;
39
+ margin-#{$h-position}: 20px;
40
+ margin-#{$v-position}: 20px;
41
41
 
42
42
  @include tablet {
43
- margin-#{$h-position}: 1.5rem;
44
- margin-#{$v-position}: 1.5rem;
43
+ margin-#{$h-position}: 30px;
44
+ margin-#{$v-position}: 30px;
45
45
  }
46
46
  }
47
47
 
@@ -51,12 +51,12 @@
51
51
  #{$h-position}: -$offset;
52
52
  }
53
53
  @else {
54
- #{$v-position}: -1rem;
55
- #{$h-position}: -1rem;
54
+ #{$v-position}: -20px;
55
+ #{$h-position}: -20px;
56
56
 
57
57
  @include tablet {
58
- #{$v-position}: -1.5rem;
59
- #{$h-position}: -1.5rem;
58
+ #{$v-position}: -30px;
59
+ #{$h-position}: -30px;
60
60
  }
61
61
  }
62
62
 
@@ -12,6 +12,7 @@ $themes: (
12
12
  'blue': (
13
13
  // Required colors!
14
14
  'color-zero': coloring('gray'),
15
+ 'color-zero-medium': coloring('gray-medium'),
15
16
  'color-zero-light': coloring('gray-light'),
16
17
  'color-zero-ultralight': coloring('gray-ultra-light'),
17
18
  'color-none': coloring('white'),
@@ -25,7 +25,7 @@ $field-icon-padding: 50px;
25
25
  /// @require svg-url
26
26
  ///
27
27
  @mixin field-base {
28
- @include theme("border-color", "color-zero--lighten-2", "fields-border-color");
28
+ @include theme("border-color", "color-zero-medium", "fields-border-color");
29
29
  @include theme("background", "color-none", "fields-background");
30
30
  @include theme("color", "color-zero", "fields-color");
31
31
 
@@ -39,7 +39,7 @@ $field-icon-padding: 50px;
39
39
  &:disabled {
40
40
  padding-right: $field-icon-padding;
41
41
  border: 0;
42
- background: coloring("gray", -5) $field-icon-position;
42
+ background: coloring("gray-light") $field-icon-position;
43
43
  background-image: svg-as-background(
44
44
  "lock-closed",
45
45
  coloring("gray", -2),
@@ -52,7 +52,7 @@ $field-icon-padding: 50px;
52
52
  &.success {
53
53
  padding-right: $field-icon-padding;
54
54
  border: 1px solid coloring("green");
55
- background: coloring("green-pastel", -4) $field-icon-position;
55
+ background: coloring("green-light") $field-icon-position;
56
56
  background-image: svg-as-background(
57
57
  "checkmark-circle",
58
58
  coloring("green"),
@@ -62,7 +62,7 @@ $field-icon-padding: 50px;
62
62
 
63
63
  &:focus {
64
64
  border-color: coloring("green");
65
- background: coloring("green-pastel", -4) $field-icon-position;
65
+ background: coloring("green-light") $field-icon-position;
66
66
  background-image: svg-as-background(
67
67
  "checkmark-circle",
68
68
  coloring("green"),
@@ -75,7 +75,7 @@ $field-icon-padding: 50px;
75
75
  &.error {
76
76
  padding-right: $field-icon-padding;
77
77
  border: 1px solid coloring("red");
78
- background: coloring("red", -6) $field-icon-position;
78
+ background: coloring("red-light") $field-icon-position;
79
79
  background-image: svg-as-background(
80
80
  "exclamation-circle",
81
81
  coloring("red"),
@@ -85,7 +85,7 @@ $field-icon-padding: 50px;
85
85
 
86
86
  &:focus {
87
87
  border-color: coloring("red");
88
- background: coloring("red", -6) $field-icon-position;
88
+ background: coloring("red-light") $field-icon-position;
89
89
  background-image: svg-as-background(
90
90
  "exclamation-circle",
91
91
  coloring("red"),
@@ -188,7 +188,7 @@ $field-icon-padding: 50px;
188
188
  );
189
189
  @include theme(
190
190
  "border-color",
191
- "color-zero--lighten-2",
191
+ "color-zero-medium",
192
192
  "checkbox-border-color"
193
193
  );
194
194
  }
@@ -212,7 +212,7 @@ $field-icon-padding: 50px;
212
212
  );
213
213
  @include theme(
214
214
  "border-color",
215
- "color-zero--lighten-2",
215
+ "color-zero-medium",
216
216
  "radio-border-color"
217
217
  );
218
218
 
@@ -19,7 +19,7 @@
19
19
  };
20
20
 
21
21
  & {
22
- border: 2px solid coloring('red', -2);
22
+ border: 2px solid coloring('red');
23
23
  background-color: coloring('white');
24
24
  color: coloring('red', 1);
25
25
  }
@@ -97,7 +97,7 @@
97
97
  }
98
98
 
99
99
  a {
100
- @include link-background('color-zero', 'color-success-light--darken-1', 'success-message-link-border-color', 'success-message-link-background');
100
+ @include link-background('color-zero', 'color-success-light', 'success-message-link-border-color', 'success-message-link-background');
101
101
  }
102
102
  }
103
103
 
@@ -115,7 +115,7 @@
115
115
  }
116
116
 
117
117
  a {
118
- @include link-background('color-zero', 'color-error-light--darken-1', 'error-message-link-border-color', 'error-message-link-background');
118
+ @include link-background('color-zero', 'color-error-light', 'error-message-link-border-color', 'error-message-link-background');
119
119
  }
120
120
  }
121
121
  }
@@ -1,4 +1,9 @@
1
+ // Use this file to @use it in other files, not the heading-styling file.
2
+
3
+ // General heading styling.
1
4
  @use 'heading-styling';
5
+
6
+ // Override heading overrides.
2
7
  @use 'css/background-title';
3
8
  @use 'css/heading-1';
4
9
  @use 'css/heading-2';
@@ -55,7 +55,7 @@
55
55
  }
56
56
 
57
57
  a {
58
- @include link-background('color-zero', 'color-success-light--darken-1');
58
+ @include link-background('color-zero', 'color-success-light');
59
59
  }
60
60
  }
61
61
 
@@ -69,7 +69,7 @@
69
69
  }
70
70
 
71
71
  a {
72
- @include link-background('color-zero', 'color-error-light--darken-1');
72
+ @include link-background('color-zero', 'color-error-light');
73
73
  }
74
74
  }
75
75
 
@@ -22,7 +22,7 @@
22
22
  &[download]:not(.button),
23
23
  &[href^="http://"]:not(.button):not([href*="gent.be"]),
24
24
  &[href^="https://"]:not(.button):not([href*="gent.be"]) {
25
- @include theme('background-color', 'color-quaternary--lighten-2', 'button-secondary-background');
25
+ @include theme('background-color', 'color-tertiary-pastel', 'button-secondary-background');
26
26
  @include theme('color', 'color-zero', 'button-secondary-color');
27
27
 
28
28
  & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gent_styleguide",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
4
4
  "description": "Styleguide Stad.Gent",
5
5
  "devDependencies": {
6
6
  "@babel/core": "^7.20.12",