dso-toolkit 79.0.1 → 80.0.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 (31) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/dso-icons.svg +14 -12
  3. package/dist/dso.css +917 -317
  4. package/dist/dso.css.map +1 -1
  5. package/dist/dso.min.css +1 -1
  6. package/dist/dso.min.css.map +1 -1
  7. package/dist/index.js +3 -0
  8. package/package.json +1 -1
  9. package/src/components/alert/alert.mixins.scss +73 -32
  10. package/src/components/alert/alert.scss +19 -78
  11. package/src/components/alert/alert.variables.scss +1 -0
  12. package/src/components/badge/badge.mixins.scss +18 -9
  13. package/src/components/banner/banner.mixins.scss +20 -4
  14. package/src/components/button/button.mixins.scss +8 -0
  15. package/src/components/button/button.variables.scss +1 -0
  16. package/src/components/delete/delete.mixins.scss +1 -1
  17. package/src/components/document-header/document-header.scss +3 -3
  18. package/src/components/footer/footer.scss +1 -1
  19. package/src/components/highlight-box/highlight-box.mixins.scss +9 -5
  20. package/src/components/info/info.mixins.scss +2 -11
  21. package/src/components/info/info.scss +9 -0
  22. package/src/components/insert/insert.mixins.scss +1 -1
  23. package/src/components/label/label.mixins.scss +9 -32
  24. package/src/components/label/label.scss +27 -0
  25. package/src/components/shopping-cart/shopping-cart.scss +3 -3
  26. package/src/components/table/table.scss +6 -1
  27. package/src/dso.scss +0 -1
  28. package/src/global/functions/contrast-color.functions.scss +9 -1
  29. package/src/global/mixins/set-colors.mixin.scss +51 -37
  30. package/src/components/legend-item/legend-item.scss +0 -15
  31. package/src/components/legend-item/legend-item.variables.scss +0 -7
@@ -2,67 +2,81 @@
2
2
  @use "sass:color";
3
3
 
4
4
  @use "../../variables/colors";
5
+ @use "../../variables/states";
5
6
  @use "../../components/link/link.variables" as link-variables;
6
7
  @use "../../components/button/button.variables" as button-variables;
7
8
  @use "../../di";
8
9
 
9
- @use "../functions/contrast-color.functions" as contrast-color;
10
+ @use "../functions/contrast-color.functions" as contrast-color-functions;
10
11
 
11
- // SET COLORS
12
- // ==========
13
- // USAGE: @include setColors($bgcolor, $bordercolor: transparent, $links: true);
14
- // $background-color: background color of the element (required)
15
- // $border-color: border color of the element (optional)
16
- // $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.
17
- // $links: boolean to set link colors according to background color (optional). set to false if you don't want to change the link colors.
18
- // $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.
12
+ // Automatically applies accessible (WCAG-compliant) text and UI colors based on a given background color.
19
13
 
20
- @mixin apply($background-color, $border-color: null, $icons: true, $links: true, $reverse: false) {
21
- $icon-color: null;
14
+ // This mixin determines an appropriate contrast color for text (`light` or `dark`)
15
+ // and dynamically adjusts related colors for links, icons, alerts, and buttons
16
+ // to ensure consistent readability and sufficient contrast across different backgrounds.
17
+ // Automatically applies accessible (WCAG-compliant) text and UI colors
18
+ // based on a provided background color. Adjusts related UI elements via custom css props to ensure consistent
19
+ // readability.
20
+
21
+ // @param {Color} $background-color
22
+ // The background color used to compute contrast colors.
23
+
24
+ // @param {String} $self
25
+ // The context of the component using this mixin (e.g., "alert", "link", "button").
26
+ // Determines which sections of styles should be skipped to avoid overriding component-specific rules.
27
+
28
+ @mixin apply($background-color, $self) {
22
29
  & {
23
30
  // run contrast-color function to determine WCAG-compliant text color
24
- $contrast-color: contrast-color.apply($background-color);
31
+ $contrast-color: contrast-color-functions.apply($background-color);
32
+
33
+ @if $self != "alert" {
34
+ @if contrast-color-functions.is-white($background-color) {
35
+ --_dso-alert-success-border-color: initial;
36
+ --_dso-alert-error-border-color: initial;
37
+ --_dso-alert-info-border-color: initial;
38
+ --_dso-alert-warning-border-color: initial;
39
+ } @else {
40
+ --_dso-alert-success-border-color: #{states.$success-compact-accent-color};
41
+ --_dso-alert-error-border-color: #{states.$danger-compact-accent-color};
42
+ --_dso-alert-info-border-color: #{states.$info-compact-accent-color};
43
+ --_dso-alert-warning-border-color: #{states.$warning-compact-accent-color};
44
+ }
45
+ }
25
46
 
26
- // set link and icon color according to text color
27
- @if color.channel($background-color, "lightness", $space: hsl) < 100% {
28
- @if $links == true {
47
+ @if $self != "link" {
48
+ @if not contrast-color-functions.is-white($background-color) {
29
49
  --link-color: currentColor;
30
50
  --link-hover-color: currentColor;
31
51
  --link-visited-color: currentColor;
32
- }
33
52
 
34
- // set according to contrast color determined by contrast-color function
35
- @if $contrast-color == colors.$contrast-dark {
36
- $icon-color: "zwart";
37
- } @else if $contrast-color == colors.$contrast-light {
38
- $icon-color: "wit";
53
+ // set according to contrast color determined by contrast-color function
54
+ $icon-color: if($contrast-color == colors.$contrast-dark, "zwart", "wit");
55
+
56
+ @include _linkIconColors($icon-color);
39
57
  }
58
+ }
40
59
 
41
- // if contrast-color function gets it wrong, and therefore $reverse is set to true
42
- @if $contrast-color == colors.$contrast-dark and $reverse == true {
43
- $icon-color: "wit";
44
- $contrast-color: colors.$contrast-light;
45
- } @else if $contrast-color == colors.$contrast-light and $reverse == true {
46
- $icon-color: "zwart";
47
- $contrast-color: colors.$contrast-dark;
60
+ @if $self != "icon-button" {
61
+ @if not contrast-color-functions.is-white($background-color) {
62
+ @if $contrast-color == colors.$contrast-dark {
63
+ --_dso-icon-button-tertiary-color: #{colors.$grijs-90};
64
+ --_dso-icon-button-tertiary-hover-color: #{colors.$grijs-70};
65
+ --_dso-icon-button-tertiary-active-color: #{colors.$bosgroen-140};
66
+ --_dso-icon-button-tertiary-disabled-color: #{colors.$grijs-40};
67
+ } @else if $contrast-color == colors.$contrast-light {
68
+ --_dso-icon-button-tertiary-color: #{colors.$wit};
69
+ }
48
70
  }
49
71
  }
50
72
 
51
73
  // set css properties
52
74
  background-color: $background-color;
53
- border-color: if($border-color, $border-color, $background-color);
54
75
  color: $contrast-color;
55
-
56
- // implement icon color according to background color
57
- @if $icon-color and $icons == true {
58
- @include _anchorIconColors($icon-color);
59
- }
60
76
  }
61
77
  }
62
78
 
63
- // ANCHOR ICON COLORS
64
- // ==================
65
- @mixin _anchorIconColors($icon-color) {
79
+ @mixin _linkIconColors($icon-color) {
66
80
  // loop through map to set icon mode
67
81
  @each $mode, $value in link-variables.$linkIcons {
68
82
  $selector: map.get($value, "selector");
@@ -1,15 +0,0 @@
1
- @use "legend-item.variables" as legend-item-variables;
2
- @use "../../global/mixins/symbol.mixins" as symbol-mixins;
3
-
4
- dso-legend-item {
5
- span[slot="symbol"] {
6
- @include symbol-mixins.symbolContainer(
7
- legend-item-variables.$symbol-block-size,
8
- legend-item-variables.$symbol-inline-size
9
- );
10
-
11
- > span {
12
- @include symbol-mixins.symbol();
13
- }
14
- }
15
- }
@@ -1,7 +0,0 @@
1
- @use "sass:math";
2
- @use "../../variables/units";
3
-
4
- $symbol-block-size: 24px;
5
- $symbol-aspect-ratio: math.div(30, 26);
6
- $symbol-inline-size: $symbol-block-size * $symbol-aspect-ratio;
7
- $selectable-inline-size: units.$u4;