dso-toolkit 62.10.0 → 62.11.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 (55) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/assets/fonts/Asap/Asap-Italic-VariableFont_wdth,wght.ttf +0 -0
  3. package/assets/fonts/Asap/Asap-VariableFont_wdth,wght.ttf +0 -0
  4. package/dist/dso-icons.svg +275 -256
  5. package/dist/dso.css +700 -294
  6. package/dist/dso.css.map +1 -1
  7. package/dist/dso.min.css +1 -1
  8. package/dist/dso.min.css.map +1 -1
  9. package/package.json +1 -1
  10. package/src/components/alert/alert.mixins.scss +20 -33
  11. package/src/components/alert/alert.scss +0 -28
  12. package/src/components/alert/alert.variables.scss +0 -4
  13. package/src/components/anchor/anchor.mixins.scss +43 -36
  14. package/src/components/anchor/anchor.scss +2 -17
  15. package/src/components/anchor/anchor.variables.scss +30 -0
  16. package/src/components/badge/badge.mixins.scss +14 -27
  17. package/src/components/banner/banner.mixins.scss +5 -14
  18. package/src/components/banner/banner.scss +0 -10
  19. package/src/components/banner/banner.variables.scss +0 -4
  20. package/src/components/delete/delete.mixins.scss +3 -6
  21. package/src/components/document-header/document-header.scss +3 -6
  22. package/src/components/footer/footer.scss +4 -19
  23. package/src/components/form/form-buttons/form-buttons.scss +43 -15
  24. package/src/components/form/form-explanation.scss +25 -0
  25. package/src/components/form/form.mixins.scss +1 -3
  26. package/src/components/form/form.scss +1 -0
  27. package/src/components/highlight-box/highlight-box.mixins.scss +27 -22
  28. package/src/components/highlight-box/highlight-box.scss +29 -3
  29. package/src/components/info/info.mixins.scss +3 -2
  30. package/src/components/insert/insert.mixins.scss +3 -6
  31. package/src/components/label/label.mixins.scss +13 -18
  32. package/src/components/modal/modal.mixins.scss +2 -2
  33. package/src/components/shopping-cart/shopping-cart.scss +6 -3
  34. package/src/components/step-counter/step-counter.mixins.scss +8 -14
  35. package/src/components/whitebox/whitebox.mixins.scss +9 -0
  36. package/src/global/font-faces.scss +8 -77
  37. package/src/global/functions/contrast-color.functions.scss +48 -0
  38. package/src/global/mixins/set-colors.mixin.scss +73 -0
  39. package/src/variables/colors.scss +3 -0
  40. package/assets/fonts/Asap/Asap-Bold.woff +0 -0
  41. package/assets/fonts/Asap/Asap-Bold.woff2 +0 -0
  42. package/assets/fonts/Asap/Asap-BoldItalic.woff +0 -0
  43. package/assets/fonts/Asap/Asap-BoldItalic.woff2 +0 -0
  44. package/assets/fonts/Asap/Asap-Italic.woff +0 -0
  45. package/assets/fonts/Asap/Asap-Italic.woff2 +0 -0
  46. package/assets/fonts/Asap/Asap-Medium.woff +0 -0
  47. package/assets/fonts/Asap/Asap-Medium.woff2 +0 -0
  48. package/assets/fonts/Asap/Asap-MediumItalic.woff +0 -0
  49. package/assets/fonts/Asap/Asap-MediumItalic.woff2 +0 -0
  50. package/assets/fonts/Asap/Asap-Regular.woff +0 -0
  51. package/assets/fonts/Asap/Asap-Regular.woff2 +0 -0
  52. package/assets/fonts/Asap/Asap-SemiBold.woff +0 -0
  53. package/assets/fonts/Asap/Asap-SemiBold.woff2 +0 -0
  54. package/assets/fonts/Asap/Asap-SemiBoldItalic.woff +0 -0
  55. package/assets/fonts/Asap/Asap-SemiBoldItalic.woff2 +0 -0
@@ -0,0 +1,25 @@
1
+ @use "form.mixins" as css-form-mixins;
2
+ @use "../../variables/units.scss";
3
+ @use "../../variables/colors.scss";
4
+
5
+ .form-explanation {
6
+ &:first-child {
7
+ margin-block-end: units.$u1;
8
+ }
9
+
10
+ &:last-child {
11
+ padding-block-start: units.$u1;
12
+
13
+ border-block-start: 2px solid colors.$grijs-20;
14
+ }
15
+ }
16
+
17
+ .form-explanation-text {
18
+ margin-block: 0;
19
+ }
20
+
21
+ .form-explanation-required {
22
+ &::after {
23
+ @include css-form-mixins.form-group-required();
24
+ }
25
+ }
@@ -5,7 +5,5 @@
5
5
 
6
6
  display: inline-block;
7
7
 
8
- margin-inline-start: 4px;
9
-
10
- @include di.base(asterisk, 1rem, unset);
8
+ @include di.base(asterisk, 0.75rem, text-top);
11
9
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  @use "form-horizontal";
4
4
  @use "form-group";
5
+ @use "form-explanation";
5
6
 
6
7
  @use "form-groups/checkboxes/form-group-checkboxes";
7
8
  @use "form-groups/confirm/form-group-confirm";
@@ -1,5 +1,7 @@
1
1
  @use "../../variables/units";
2
2
  @use "../../variables/colors";
3
+ @use "../../global/mixins/set-colors.mixin" as set-colors;
4
+ @use "../../di";
3
5
 
4
6
  @use "../button";
5
7
  @use "../step-counter";
@@ -7,38 +9,48 @@
7
9
  @use "highlight-box.variables" as highlight-box-variables;
8
10
 
9
11
  @mixin root() {
10
- background-color: colors.$grijs-5;
11
- color: colors.$zwart;
12
12
  margin-top: units.$u2;
13
13
  padding: units.$u2;
14
14
  margin-bottom: units.$vertical-spacing-large;
15
+ }
16
+
17
+ @mixin children(
18
+ $white-selector,
19
+ $yellow-selector,
20
+ $drop-shadow-selector,
21
+ $border-selector,
22
+ $has-counter-selector,
23
+ $step-counter-selector
24
+ ) {
25
+ &:not(#{$white-selector}, #{$yellow-selector}, #{$border-selector}) {
26
+ @include set-colors.apply(colors.$grijs-5);
27
+ }
15
28
 
16
- &.dso-white {
17
- background-color: colors.$wit;
29
+ &#{$white-selector} {
30
+ @include set-colors.apply(colors.$wit);
18
31
  }
19
32
 
20
- &.dso-yellow {
21
- background-color: colors.$warning-bg-color;
33
+ &#{$yellow-selector} {
34
+ @include set-colors.apply(colors.$geel-20);
22
35
  }
23
36
 
24
- &.dso-drop-shadow {
37
+ &#{$drop-shadow-selector} {
25
38
  box-shadow: highlight-box-variables.$box-shadow;
26
39
  }
27
40
 
28
- &.dso-border {
29
- background-color: colors.$wit;
41
+ &#{$border-selector} {
42
+ @include set-colors.apply(colors.$wit);
43
+
30
44
  border: 1px solid colors.$grijs-20;
31
45
  padding: units.$u2 - 1;
32
46
  }
33
47
 
34
- &.dso-has-counter {
48
+ &#{$has-counter-selector} {
35
49
  margin-top: highlight-box-variables.$margin-top;
36
- }
37
50
 
38
- @include step-counter.step-counter();
39
- }
51
+ @include step-counter.has-step-counter();
52
+ }
40
53
 
41
- @mixin children() {
42
54
  > .dso-highlight-box-banner {
43
55
  aspect-ratio: 2.38 / 1;
44
56
  margin-left: units.$u2 * -1;
@@ -61,7 +73,7 @@
61
73
  }
62
74
  }
63
75
 
64
- > .dso-step-counter:first-child + .dso-rich-content,
76
+ > #{$step-counter-selector} + .dso-rich-content,
65
77
  > .dso-rich-content:first-child {
66
78
  *:first-child {
67
79
  margin-top: 0 !important;
@@ -87,11 +99,4 @@
87
99
  .dso-tertiary:not([disabled]) {
88
100
  color: colors.$zwart;
89
101
  }
90
-
91
- a,
92
- a:visited {
93
- &#{button.$not-dso-buttons} {
94
- color: colors.$zwart;
95
- }
96
- }
97
102
  }
@@ -7,7 +7,17 @@
7
7
  // HTML/CSS
8
8
  .dso-highlight-box {
9
9
  @include highlight-box.root();
10
- @include highlight-box.children();
10
+ @include highlight-box.children(
11
+ $white-selector: ".dso-white",
12
+ $yellow-selector: ".dso-yellow",
13
+ $drop-shadow-selector: ".dso-drop-shadow",
14
+ $border-selector: ".dso-border",
15
+ $has-counter-selector: ".dso-has-counter",
16
+ $step-counter-selector: ".dso-step-counter:first-child"
17
+ );
18
+
19
+ @include step-counter.step-counter();
20
+
11
21
  container-type: inline-size;
12
22
  position: relative;
13
23
  z-index: 1;
@@ -17,6 +27,11 @@
17
27
  @include highlight-box.exoticChildren();
18
28
  }
19
29
 
30
+ .dso-step-counter > svg.di,
31
+ .dso-step-counter > dso-icon {
32
+ @include step-counter.icon();
33
+ }
34
+
20
35
  &:not(.dso-border):not(.dso-white) {
21
36
  .dso-link-list {
22
37
  @include link-list.exotic();
@@ -45,8 +60,19 @@
45
60
 
46
61
  // Web Component
47
62
  dso-highlight-box {
48
- @include highlight-box.children();
49
- @include step-counter.step-counter();
63
+ @include highlight-box.children(
64
+ $white-selector: "[white]",
65
+ $yellow-selector: "[yellow]",
66
+ $drop-shadow-selector: "[drop-shadow]",
67
+ $border-selector: "[border]",
68
+ $has-counter-selector: "[has-counter]",
69
+ $step-counter-selector: '[slot="icon"]:first-child'
70
+ );
71
+
72
+ svg.di[slot="icon"],
73
+ dso-icon[slot="icon"] {
74
+ @include step-counter.icon();
75
+ }
50
76
 
51
77
  &[yellow],
52
78
  &:not([border]):not([white]) {
@@ -1,10 +1,9 @@
1
1
  @use "../../variables/units";
2
2
  @use "../../variables/colors";
3
3
  @use "../button";
4
+ @use "../../global/mixins/set-colors.mixin" as set-colors;
4
5
 
5
6
  @mixin root() {
6
- background-color: colors.$grijs-5;
7
- color: colors.$zwart;
8
7
  padding: units.$u2 units.$u4 units.$u2 units.$u2;
9
8
  position: relative;
10
9
 
@@ -63,4 +62,6 @@
63
62
  .dso-rich-content {
64
63
  @include richContent();
65
64
  }
65
+
66
+ @include set-colors.apply(colors.$grijs-5);
66
67
  }
@@ -1,17 +1,14 @@
1
1
  @use "../../variables/colors";
2
2
 
3
3
  @use "insert.variables" as insert-variables;
4
+ @use "../../global/mixins/set-colors.mixin" as set-colors;
4
5
 
5
6
  @mixin element() {
6
7
  text-decoration: none;
7
8
  }
8
9
 
9
10
  @mixin root() {
10
- background-color: colors.$success-bg-color;
11
- box-shadow: insert-variables.$box-shadow;
12
- color: colors.$zwart;
11
+ @include set-colors.apply(colors.$lime-20);
13
12
 
14
- a {
15
- color: colors.$zwart;
16
- }
13
+ box-shadow: insert-variables.$box-shadow;
17
14
  }
@@ -2,11 +2,10 @@
2
2
  @use "../../variables/colors";
3
3
  @use "../../variables/typography";
4
4
  @use "label.variables" as label-variables;
5
+ @use "../../global/mixins/set-colors.mixin" as set-colors;
5
6
 
6
7
  @mixin root() {
7
- background-color: label-variables.$default-bg-color;
8
8
  border-radius: 4px;
9
- color: label-variables.$default-color;
10
9
  display: inline-block;
11
10
  line-height: 1.5;
12
11
  max-width: 100%;
@@ -40,46 +39,42 @@
40
39
  }
41
40
  }
42
41
 
42
+ & {
43
+ @include set-colors.apply(label-variables.$default-bg-color, $icons: false, $links: false);
44
+ }
45
+
43
46
  &.dso-label-info {
44
- background-color: label-variables.$info-bg-color;
45
- color: label-variables.$info-color;
47
+ @include set-colors.apply(label-variables.$info-bg-color, $icons: false, $links: false);
46
48
  }
47
49
 
48
50
  &.dso-label-primary {
49
- background-color: label-variables.$primary-bg-color;
50
- color: label-variables.$primary-color;
51
+ @include set-colors.apply(label-variables.$primary-bg-color, $icons: false, $links: false);
51
52
  }
52
53
 
53
54
  &.dso-label-success {
54
- background-color: label-variables.$success-bg-color;
55
- color: label-variables.$success-color;
55
+ @include set-colors.apply(label-variables.$success-bg-color, $icons: false, $links: false);
56
56
  }
57
57
 
58
58
  &.dso-label-warning {
59
- background-color: label-variables.$warning-bg-color;
60
- color: label-variables.$warning-color;
59
+ @include set-colors.apply(label-variables.$warning-bg-color, $icons: false, $links: false);
61
60
  }
62
61
 
63
62
  &.dso-label-danger {
64
- background-color: label-variables.$danger-bg-color;
65
- color: label-variables.$danger-color;
63
+ @include set-colors.apply(label-variables.$danger-bg-color, $icons: false, $links: false);
66
64
  }
67
65
 
68
66
  &.dso-label-error {
69
- background-color: label-variables.$error-bg-color;
70
- color: label-variables.$error-color;
67
+ @include set-colors.apply(label-variables.$error-bg-color, $icons: false, $links: false);
71
68
  }
72
69
 
73
70
  &.dso-label-bright {
74
- background-color: label-variables.$bright-bg-color;
75
- color: label-variables.$bright-color;
71
+ @include set-colors.apply(label-variables.$bright-bg-color, $icons: false, $links: false);
76
72
  outline: 1px solid label-variables.$bright-border-color;
77
73
  outline-offset: -1px;
78
74
  }
79
75
 
80
76
  &.dso-label-attention {
81
- background-color: label-variables.$attention-bg-color;
82
- color: label-variables.$attention-color;
77
+ @include set-colors.apply(label-variables.$attention-bg-color, $icons: false, $links: false);
83
78
  }
84
79
 
85
80
  &.dso-compact {
@@ -8,7 +8,7 @@
8
8
 
9
9
  @use "modal.variables" as modal-variables;
10
10
 
11
- @keyframes slideInFromTop {
11
+ @keyframes ModalFadeIn {
12
12
  0% {
13
13
  opacity: 0;
14
14
  }
@@ -38,7 +38,7 @@
38
38
  opacity: 1;
39
39
 
40
40
  box-shadow: 0 #{units.$u1} #{units.$u3} 0 rgba(25, 25, 25, 0.4);
41
- animation: 1s ease-out 0s 1 slideInFromTop;
41
+ animation: 200ms ease-out 0s 1 ModalFadeIn;
42
42
  }
43
43
 
44
44
  .dso-header {
@@ -6,10 +6,11 @@
6
6
  @use "../form-control";
7
7
 
8
8
  @use "shopping-cart.variables" as css-shopping-cart-variables;
9
+ @use "../../global/mixins/set-colors.mixin" as set-colors;
9
10
 
10
11
  .dso-shopping-cart {
11
12
  .dso-status {
12
- background-color: colors.$grijs-5;
13
+ @include set-colors.apply(colors.$grijs-5);
13
14
  border: 0;
14
15
  border-radius: css-shopping-cart-variables.$radius;
15
16
  box-shadow: none;
@@ -52,7 +53,8 @@
52
53
  }
53
54
 
54
55
  .dso-contents {
55
- background-color: colors.$grijs-5;
56
+ @include set-colors.apply(colors.$grijs-5);
57
+
56
58
  border: 0;
57
59
  border-radius: css-shopping-cart-variables.$radius;
58
60
  color: colors.$zwart;
@@ -77,7 +79,8 @@
77
79
  ol {
78
80
  @include list.unstyled();
79
81
 
80
- background-color: colors.$grijs-5;
82
+ @include set-colors.apply(colors.$grijs-5, $icons: false);
83
+
81
84
  border-radius: css-shopping-cart-variables.$radius;
82
85
  margin-bottom: 0;
83
86
  margin-top: 0;
@@ -3,12 +3,12 @@
3
3
 
4
4
  @use "step-counter.variables" as step-counter-variables;
5
5
 
6
- @mixin step-counter() {
7
- &.dso-has-counter {
8
- padding-top: units.$ru5;
9
- position: relative;
10
- }
6
+ @mixin has-step-counter() {
7
+ padding-top: units.$ru5;
8
+ position: relative;
9
+ }
11
10
 
11
+ @mixin step-counter() {
12
12
  .dso-step-counter {
13
13
  background-color: colors.$bosgroen;
14
14
  border: step-counter-variables.$border-size solid colors.$lime;
@@ -24,15 +24,9 @@
24
24
  text-align: center;
25
25
  top: step-counter-variables.$icon-size * -1;
26
26
  width: step-counter-variables.$size;
27
-
28
- svg.di {
29
- height: step-counter-variables.$icon-size;
30
- margin-top: units.$ru1 * 0.5;
31
- width: step-counter-variables.$icon-size;
32
- }
33
27
  }
28
+ }
34
29
 
35
- > dso-icon {
36
- vertical-align: text-top;
37
- }
30
+ @mixin icon() {
31
+ margin-top: units.$ru1 * 0.5;
38
32
  }
@@ -36,6 +36,15 @@
36
36
  }
37
37
 
38
38
  @include step-counter.step-counter();
39
+
40
+ &.dso-has-counter {
41
+ @include step-counter.has-step-counter();
42
+ }
43
+
44
+ .dso-step-counter > svg.di,
45
+ .dso-step-counter > dso-icon {
46
+ @include step-counter.icon();
47
+ }
39
48
  }
40
49
 
41
50
  @mixin equal-heights() {
@@ -2,88 +2,19 @@
2
2
 
3
3
  @font-face {
4
4
  font-family: "Asap";
5
- font-style: normal;
6
- font-weight: 400;
7
5
  src:
8
- local("Asap Regular"),
9
- local("Asap-Regular"),
10
- url("#{config.$asap-font-path}Asap-Regular.woff2") format("woff2"),
11
- url("#{config.$asap-font-path}Asap-Regular.woff") format("woff");
6
+ url("#{config.$asap-font-path}Asap-VariableFont_wdth,wght.ttf") format("truetype supports variations"),
7
+ url("#{config.$asap-font-path}Asap-VariableFont_wdth,wght.ttf") format("truetype-variations");
8
+ font-weight: 100 900;
9
+ font-display: swap;
12
10
  }
13
11
 
14
12
  @font-face {
15
13
  font-family: "Asap";
16
14
  font-style: italic;
17
- font-weight: 400;
18
15
  src:
19
- local("Asap Regular italic"),
20
- local("Asap-Regularitalic"),
21
- url("#{config.$asap-font-path}Asap-Italic.woff2") format("woff2"),
22
- url("#{config.$asap-font-path}Asap-Italic.woff") format("woff");
23
- }
24
-
25
- @font-face {
26
- font-family: "Asap";
27
- font-style: normal;
28
- font-weight: 500;
29
- src:
30
- local("Asap Bold"),
31
- local("Asap-Bold"),
32
- url("#{config.$asap-font-path}Asap-Medium.woff2") format("woff2"),
33
- url("#{config.$asap-font-path}Asap-Medium.woff") format("woff");
34
- }
35
-
36
- @font-face {
37
- font-family: "Asap";
38
- font-style: italic;
39
- font-weight: 500;
40
- src:
41
- local("Asap Bold italic"),
42
- local("Asap-Bolditalic"),
43
- url("#{config.$asap-font-path}Asap-MediumItalic.woff2") format("woff2"),
44
- url("#{config.$asap-font-path}Asap-MediumItalic.woff") format("woff");
45
- }
46
-
47
- @font-face {
48
- font-family: "Asap";
49
- font-style: normal;
50
- font-weight: 600;
51
- src:
52
- local("Asap Bold"),
53
- local("Asap-Bold"),
54
- url("#{config.$asap-font-path}Asap-SemiBold.woff2") format("woff2"),
55
- url("#{config.$asap-font-path}Asap-SemiBold.woff") format("woff");
56
- }
57
-
58
- @font-face {
59
- font-family: "Asap";
60
- font-style: italic;
61
- font-weight: 600;
62
- src:
63
- local("Asap Bold italic"),
64
- local("Asap-Bolditalic"),
65
- url("#{config.$asap-font-path}Asap-SemiBoldItalic.woff2") format("woff2"),
66
- url("#{config.$asap-font-path}Asap-SemiBoldItalic.woff") format("woff");
67
- }
68
-
69
- @font-face {
70
- font-family: "Asap";
71
- font-style: normal;
72
- font-weight: 700;
73
- src:
74
- local("Asap Bold"),
75
- local("Asap-Bold"),
76
- url("#{config.$asap-font-path}Asap-Bold.woff2") format("woff2"),
77
- url("#{config.$asap-font-path}Asap-Bold.woff") format("woff");
78
- }
79
-
80
- @font-face {
81
- font-family: "Asap";
82
- font-style: italic;
83
- font-weight: 700;
84
- src:
85
- local("Asap Bold italic"),
86
- local("Asap-Bolditalic"),
87
- url("#{config.$asap-font-path}Asap-BoldItalic.woff2") format("woff2"),
88
- url("#{config.$asap-font-path}Asap-BoldItalic.woff") format("woff");
16
+ url("#{config.$asap-font-path}Asap-Italic-VariableFont_wdth,wght.ttf") format("truetype supports variations"),
17
+ url("#{config.$asap-font-path}Asap-Italic-VariableFont_wdth,wght.ttf") format("truetype-variations");
18
+ font-weight: 100 900;
19
+ font-display: swap;
89
20
  }
@@ -0,0 +1,48 @@
1
+ @use "../../variables/colors.scss" as colors;
2
+ @use "sass:math";
3
+
4
+ // CONTRAST COLOR FUNCTIONS
5
+ // ========================
6
+ // Source: https://epiph.yt/en/blog/2023/fix-your-scss-color-contrast-function/
7
+
8
+ // DE-GAMMA AND RE-GAMMA
9
+ @function de-gamma($n) {
10
+ @if $n <=0.03928 {
11
+ @return math.div($n, 12.92);
12
+ } @else {
13
+ @return math.pow((math.div(($n + 0.055), 1.055)), 2.4);
14
+ }
15
+ }
16
+
17
+ @function re-gamma($n) {
18
+ @if $n <=0.0031308 {
19
+ @return $n * 12.92;
20
+ } @else {
21
+ @return 1.055 * math.pow($n, math.div(1, 2.4)) - 0.055;
22
+ }
23
+ }
24
+
25
+ // sRGB BT-709 BRIGHTNESS
26
+ @function brightness($c) {
27
+ $rlin: de-gamma(math.div(red($c), 255));
28
+ $glin: de-gamma(math.div(green($c), 255));
29
+ $blin: de-gamma(math.div(blue($c), 255));
30
+ @return re-gamma(0.2126 * $rlin + 0.7152 * $glin + 0.0722 * $blin) * 100;
31
+ }
32
+
33
+ // Compares contrast of a given color to the light/dark arguments and returns whichever is most "contrasty"
34
+ @function apply($color, $dark: colors.$contrast-dark, $light: colors.$contrast-light) {
35
+ @if $color ==null {
36
+ @return null;
37
+ } @else {
38
+ $color-brightness: brightness($color);
39
+ $light-text-brightness: brightness($light);
40
+ $dark-text-brightness: brightness($dark);
41
+
42
+ @return if(
43
+ abs($color-brightness - $light-text-brightness) > abs($color-brightness - $dark-text-brightness),
44
+ $light,
45
+ $dark
46
+ );
47
+ }
48
+ }
@@ -0,0 +1,73 @@
1
+ @use "sass:map";
2
+
3
+ @use "../../variables/colors.scss";
4
+ @use "../../components/anchor/anchor.variables" as anchor-variables;
5
+ @use "../../di";
6
+
7
+ @use "../functions/contrast-color.functions" as contrast-color;
8
+
9
+ // SET COLORS
10
+ // ==========
11
+ // USAGE: @include setColors($bgcolor, $bordercolor: transparent, $links: true);
12
+ // $background-color: background color of the element (required)
13
+ // $border-color: border color of the element (optional)
14
+ // $icons: boolean to set link icon colors according to background color (optional). set to false if you don't want to change the link icon colors.
15
+ // $links: boolean to set link colors according to background color (optional). set to false if you don't want to change the link colors.
16
+ // $reverse: in case the combination chosen by this mixin & contrast-color function still does not meet WCAG requirements, set $reverse to true. If this combination does not comply either, find another background-color.
17
+
18
+ @mixin apply($background-color, $border-color: null, $icons: true, $links: true, $reverse: false) {
19
+ $icon-color: null;
20
+
21
+ // run contrast-color function to determine WCAG-compliant text color
22
+ $contrast-color: contrast-color.apply($background-color);
23
+
24
+ // set link and icon color according to text color
25
+ @if lightness($background-color) < 100% {
26
+ @if $links == true {
27
+ --link-color: currentColor;
28
+ --link-hover-color: currentColor;
29
+ --link-visited-color: currentColor;
30
+ }
31
+
32
+ // set according to contrast color determined by contrast-color function
33
+ @if $contrast-color == colors.$contrast-dark {
34
+ $icon-color: "zwart";
35
+ } @else if $contrast-color == colors.$contrast-light {
36
+ $icon-color: "wit";
37
+ }
38
+
39
+ // if contrast-color function gets it wrong, and therefore $reverse is set to true
40
+ @if $contrast-color == colors.$contrast-dark and $reverse == true {
41
+ $icon-color: "wit";
42
+ $contrast-color: colors.$contrast-light;
43
+ } @else if $contrast-color == colors.$contrast-light and $reverse == true {
44
+ $icon-color: "zwart";
45
+ $contrast-color: colors.$contrast-dark;
46
+ }
47
+ }
48
+
49
+ // set css properties
50
+ background-color: $background-color;
51
+ border-color: if($border-color, $border-color, $background-color);
52
+ color: $contrast-color;
53
+
54
+ // implement icon color according to background color
55
+ @if $icon-color and $icons == true {
56
+ @include _anchorIconColors($icon-color);
57
+ }
58
+ }
59
+
60
+ // ANCHOR ICON COLORS
61
+ // ==================
62
+ @mixin _anchorIconColors($icon-color) {
63
+ // loop through map to set icon mode
64
+ @each $mode, $value in anchor-variables.$anchorIcons {
65
+ $selector: map.get($value, "selector");
66
+ $icon: map.get($value, "icon") + "-" + $icon-color;
67
+
68
+ a:is(#{$selector}, #{$selector}:hover, #{$selector}:focus-visible) {
69
+ // set icon color
70
+ @include di.variant($icon);
71
+ }
72
+ }
73
+ }
@@ -71,3 +71,6 @@ $input-disabled-border-color: $grijs-10;
71
71
  $text-muted: $grijs-60;
72
72
 
73
73
  $focus-outline-color: #008ccc;
74
+
75
+ $contrast-dark: $grijs-90;
76
+ $contrast-light: $wit;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file