dso-toolkit 101.1.0 → 101.2.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.
package/src/di.scss CHANGED
@@ -1,15 +1,145 @@
1
- @use "variables/icon";
1
+ @use "sass:list";
2
+ @use "sass:map";
3
+ @use "sass:string";
2
4
 
3
- @use "config";
5
+ @use "variables/colors";
6
+ @use "variables/icon" as icon-variables;
4
7
 
5
- @mixin base($icon, $size: icon.$size, $vertical-align: icon.$vertical-align) {
6
- background: url("#{config.$icons-path}di.svg##{$icon}") no-repeat center;
8
+ @forward "variables/icon";
9
+
10
+ $colors: (
11
+ "bosgroen": colors.$bosgroen,
12
+ "grasgroen": colors.$grasgroen,
13
+ "grasgroen-40": colors.$grasgroen-40,
14
+ "grijs-40": colors.$grijs-40,
15
+ "grijs-50": colors.$grijs-50,
16
+ "rood": colors.$rood,
17
+ "scampi": colors.$scampi,
18
+ "wit": colors.$wit,
19
+ "zwart": colors.$zwart,
20
+ );
21
+
22
+ // Per icoon de kleurnamen (sleutels uit $colors) waarin het beschikbaar is. Voor elke kleur maakt
23
+ // inline-icons() een custom property, bijvoorbeeld "cross" + "zwart" → --_dso-di-cross-zwart.
24
+
25
+ // Een lege lijst () is voor meerkleurige iconen (bijv. status-error): de svg heeft geen
26
+ // fill="currentColor" en kan dus niet worden ingekleurd. Daarvoor komt één property zonder
27
+ // kleur in de naam (--_dso-di-status-error), en gebruik je de mixins zonder kleur:
28
+ // di.base("status-error").
29
+ $icons: (
30
+ "asterisk": ("grijs-50"),
31
+ "call": (
32
+ "grasgroen",
33
+ "scampi",
34
+ "wit",
35
+ "zwart",
36
+ ),
37
+ "caret-down": (
38
+ "bosgroen",
39
+ "grijs-40",
40
+ "rood",
41
+ ),
42
+ "chevron-right": (
43
+ "grasgroen",
44
+ "scampi",
45
+ "wit",
46
+ "zwart",
47
+ ),
48
+ "chevron-up": ("bosgroen"),
49
+ "cross": (
50
+ "grasgroen",
51
+ "zwart",
52
+ ),
53
+ "download": (
54
+ "bosgroen",
55
+ "grasgroen",
56
+ "grasgroen-40",
57
+ "scampi",
58
+ "wit",
59
+ "zwart",
60
+ ),
61
+ "external-link": (
62
+ "bosgroen",
63
+ "grasgroen",
64
+ "grasgroen-40",
65
+ "scampi",
66
+ "wit",
67
+ "zwart",
68
+ ),
69
+ "forbidden": ("rood"),
70
+ "mail-outline": (
71
+ "grasgroen",
72
+ "scampi",
73
+ "wit",
74
+ "zwart",
75
+ ),
76
+ "search": ("grasgroen"),
77
+ "status-error": (),
78
+ "status-warning": (),
79
+ "trash": ("bosgroen"),
80
+ );
81
+
82
+ @function custom-property($icon, $color: null) {
83
+ @if not map.has-key($icons, $icon) {
84
+ @error "di: icoon '#{$icon}' ontbreekt in $icons.";
85
+ }
86
+
87
+ $color-names: map.get($icons, $icon);
88
+
89
+ @if not $color {
90
+ @if list.length($color-names) > 0 {
91
+ @error "di: icoon '#{$icon}' vereist een kleur (#{$color-names}).";
92
+ }
93
+
94
+ @return string.unquote("--_dso-di-#{$icon}");
95
+ }
96
+
97
+ @if not list.index($color-names, $color) {
98
+ @error "di: kleur '#{$color}' is niet beschikbaar voor icoon '#{$icon}' in $icons.";
99
+ }
100
+
101
+ @return string.unquote("--_dso-di-#{$icon}-#{$color}");
102
+ }
103
+
104
+ @mixin variant($icon, $color: null, $override-property: null) {
105
+ @if $override-property {
106
+ background-image: var(#{$override-property}, var(#{custom-property($icon, $color)}));
107
+ } @else {
108
+ background-image: var(#{custom-property($icon, $color)});
109
+ }
110
+ }
111
+
112
+ @mixin base(
113
+ $icon,
114
+ $color: null,
115
+ $override-property: null,
116
+ $size: icon-variables.$size,
117
+ $vertical-align: icon-variables.$vertical-align
118
+ ) {
119
+ @include variant($icon, $color, $override-property);
120
+
121
+ background-repeat: no-repeat;
122
+ background-position: center;
7
123
  background-size: cover;
8
124
  block-size: $size;
9
- vertical-align: $vertical-align;
10
125
  inline-size: $size;
126
+ vertical-align: $vertical-align;
11
127
  }
12
128
 
13
- @mixin variant($icon) {
14
- background-image: var(--_dso-di-background-image, url("#{config.$icons-path}di.svg##{$icon}"));
129
+ @mixin inline-icons() {
130
+ :root {
131
+ @each $icon, $color-names in $icons {
132
+ @if list.length($color-names) == 0 {
133
+ #{custom-property($icon)}: #{inline-icon-DI-ONLY($icon)};
134
+ }
135
+
136
+ @each $color-name in $color-names {
137
+ @if not map.has-key($colors, $color-name) {
138
+ @error "di: kleur '#{$color-name}' voor icoon '#{$icon}' ontbreekt in $colors.";
139
+ }
140
+
141
+ #{custom-property($icon, $color-name)}: #{inline-icon-DI-ONLY($icon, "#{map.get($colors, $color-name)}")};
142
+ }
143
+ }
144
+ }
15
145
  }
package/src/dso.scss CHANGED
@@ -1,5 +1,5 @@
1
1
  @use "toolkit-version";
2
- @use "di-inline";
2
+ @use "di";
3
3
 
4
4
  // Global
5
5
  @use "global/font-faces";
@@ -68,6 +68,6 @@
68
68
  // Very global and generic styling
69
69
  @use "utilities" as utilities-mixins;
70
70
 
71
- @include di-inline.inline-icons();
71
+ @include di.inline-icons();
72
72
 
73
73
  @include utilities-mixins.box-sizing();
@@ -3,7 +3,7 @@
3
3
 
4
4
  @use "../../variables/colors";
5
5
  @use "../../variables/states";
6
- @use "../../di-inline";
6
+ @use "../../di";
7
7
  @use "../../components/link/link.variables" as link-variables;
8
8
 
9
9
  @use "../functions/contrast-color.functions" as contrast-color-functions;
@@ -56,12 +56,12 @@
56
56
  --_dso-link-visited-color: currentColor;
57
57
 
58
58
  @each $mode, $cfg in link-variables.$linkIcons {
59
- --_dso-link-#{$mode}-icon: var(#{di-inline.custom-property(map.get($cfg, "icon"), $icon-color)});
59
+ --_dso-link-#{$mode}-icon: var(#{di.custom-property(map.get($cfg, "icon"), $icon-color)});
60
60
  }
61
61
  }
62
62
 
63
63
  @if $self != "link-list" and not $is-white-bg {
64
- --_dso-link-list-chevron-icon: var(#{di-inline.custom-property("chevron-right", $icon-color)});
64
+ --_dso-link-list-chevron-icon: var(#{di.custom-property("chevron-right", $icon-color)});
65
65
  }
66
66
 
67
67
  @if $self != "icon-button" and not $is-white-bg {
@@ -93,8 +93,8 @@
93
93
  }
94
94
 
95
95
  @if $self != "button" and not $is-white-bg {
96
- --_dso-button-tertiary-download-icon: var(#{di-inline.custom-property("download", $icon-color)});
97
- --_dso-button-tertiary-external-link-icon: var(#{di-inline.custom-property("external-link", $icon-color)});
96
+ --_dso-button-tertiary-download-icon: var(#{di.custom-property("download", $icon-color)});
97
+ --_dso-button-tertiary-external-link-icon: var(#{di.custom-property("external-link", $icon-color)});
98
98
 
99
99
  @if $is-dark-contrast {
100
100
  --_dso-button-tertiary-color: #{colors.$grijs-90};