@madgex/design-system 6.3.11 → 7.0.1

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 (35) hide show
  1. package/dist/_tokens/css/_tokens.css +25 -90
  2. package/dist/_tokens/js/_tokens-module.js +465 -2092
  3. package/dist/assets/icons.json +1 -1
  4. package/dist/css/index.css +1 -1
  5. package/dist/js/index.js +1 -1
  6. package/package.json +2 -2
  7. package/src/components/accordion/accordion.config.js +1 -1
  8. package/src/components/button/button.scss +1 -1
  9. package/src/components/card/card.scss +1 -1
  10. package/src/components/inputs/_form-elements.scss +2 -2
  11. package/src/components/inputs/combobox/combobox.scss +0 -1
  12. package/src/components/inputs/text-editor/text-editor.scss +1 -1
  13. package/src/components/pagination/pagination.config.js +3 -3
  14. package/src/components/pagination/pagination.scss +1 -0
  15. package/src/components/skip-link/skip-link.scss +1 -1
  16. package/src/components/tabs/tabs.config.js +2 -2
  17. package/src/components/tabs/tabs.scss +2 -2
  18. package/src/components/toggle-button-links/toggle-button-links.scss +1 -1
  19. package/src/helpers/prose/README.md +7 -0
  20. package/src/helpers/{edited-text/edited-text.js → prose/prose.js} +3 -5
  21. package/src/helpers/{edited-text/edited-text.njk → prose/prose.njk} +5 -5
  22. package/src/js/index.js +2 -2
  23. package/src/scss/constants/_sd-tokens.scss +1 -1
  24. package/src/scss/core/_lists.scss +1 -1
  25. package/src/scss/core/_typography.scss +5 -5
  26. package/src/scss/helpers/__index.scss +2 -2
  27. package/src/scss/helpers/_font-types.scss +13 -32
  28. package/src/scss/helpers/{_edited-text.scss → _prose.scss} +2 -5
  29. package/src/scss/resets/__index.scss +7 -7
  30. package/src/tokens/_config.js +2 -10
  31. package/src/tokens/typography.json +62 -187
  32. package/src/typography/font-types.config.json +1 -1
  33. package/src/typography/font-types.njk +20 -41
  34. package/tasks/registerTransforms.js +1 -28
  35. package/src/helpers/edited-text/README.md +0 -5
@@ -6,15 +6,7 @@ const config = {
6
6
  platforms: {
7
7
  'css-variables': {
8
8
  // transformGroup: 'css',
9
- transforms: [
10
- 'attribute/cti',
11
- 'name/cti/kebab',
12
- 'time/seconds',
13
- 'content/icon',
14
- 'color/css',
15
- 'css/rawData',
16
- 'custom/pxToRem',
17
- ],
9
+ transforms: ['attribute/cti', 'name/cti/kebab', 'time/seconds', 'content/icon', 'color/css', 'css/rawData'],
18
10
  buildPath: `${path.resolve(__dirname, '../../dist/_tokens/css/')}/`,
19
11
  prefix: 'mds',
20
12
  files: [
@@ -81,7 +73,7 @@ const config = {
81
73
  // ],
82
74
  // },
83
75
  'js-module': {
84
- transforms: ['attribute/cti', 'name/cti/pascal', 'custom/pxToRem'],
76
+ transforms: ['attribute/cti', 'name/cti/pascal'],
85
77
  buildPath: `${path.resolve(__dirname, '../../dist/_tokens/js/')}/`,
86
78
  prefix: 'mds',
87
79
  files: [
@@ -75,226 +75,101 @@
75
75
  "value": "{font.spacing.base.value}"
76
76
  }
77
77
  },
78
- "size": {
79
- "base": {
80
- "value": "16px"
81
- }
82
- },
83
78
  "type": {
84
- "canon": {
85
- "default": {
86
- "size": {
87
- "value": "28px"
88
- },
89
- "line-height": { "value": "1.15" }
90
- },
91
- "sm": {
92
- "size": { "value": "32px" },
93
- "line-height": { "value": "1.13" }
79
+ "s-2": {
80
+ "size": {
81
+ "value": "0.75rem"
94
82
  },
95
- "md": {
96
- "size": { "value": "52px" },
97
- "line-height": { "value": "1.08" }
98
- },
99
- "lg": {
100
- "size": { "value": "44px" },
101
- "line-height": { "value": "1.1" }
83
+ "line-height": {
84
+ "value": "1.35"
102
85
  }
103
86
  },
104
- "trafalgar": {
105
- "default": {
106
- "size": { "value": "20px" },
107
- "line-height": { "value": "1.2" }
108
- },
109
- "sm": {
110
- "size": { "value": "24px" },
111
- "line-height": { "value": "1.17" }
112
- },
113
- "md": {
114
- "size": { "value": "36px" },
115
- "line-height": { "value": "1.12" }
87
+ "s-1": {
88
+ "size": {
89
+ "value": "0.875rem"
116
90
  },
117
- "lg": {
118
- "size": { "value": "32px" },
119
- "line-height": { "value": "1.13" }
91
+ "line-height": {
92
+ "value": "1.35"
120
93
  }
121
94
  },
122
- "paragon": {
123
- "default": {
124
- "size": { "value": "20px" },
125
- "line-height": { "value": "1.2" }
95
+ "s0": {
96
+ "size": {
97
+ "value": "1rem"
126
98
  },
127
- "sm": {
128
- "size": { "value": "22px" },
129
- "line-height": { "value": "1.19" }
130
- },
131
- "md": {
132
- "size": { "value": "28px" },
133
- "line-height": { "value": "1.15" }
134
- },
135
- "lg": {
136
- "size": { "value": "28px" },
137
- "line-height": { "value": "1.15" }
99
+ "line-height": {
100
+ "value": "1.4"
138
101
  }
139
102
  },
140
- "double-pica": {
141
- "default": {
142
- "size": { "value": "20px" },
143
- "line-height": { "value": "1.2" }
144
- },
145
- "sm": {
146
- "size": { "value": "20px" },
147
- "line-height": { "value": "1.2" }
103
+ "s1": {
104
+ "size": {
105
+ "value": "clamp(1.067rem, 1.0468rem + 0.1009vi, 1.125rem)"
148
106
  },
149
- "md": {
150
- "size": { "value": "26px" },
151
- "line-height": { "value": "1.16" }
152
- },
153
- "lg": {
154
- "size": { "value": "24px" },
155
- "line-height": { "value": "1.17" }
107
+ "line-height": {
108
+ "value": "1.4"
156
109
  }
157
110
  },
158
- "great-primer": {
159
- "default": {
160
- "size": { "value": "18px" },
161
- "line-height": { "value": "1.23" }
162
- },
163
- "sm": {
164
- "size": { "value": "18px" },
165
- "line-height": { "value": "1.23" }
166
- },
167
- "md": {
168
- "size": { "value": "21px" },
169
- "line-height": { "value": "1.15" }
111
+ "s2": {
112
+ "size": {
113
+ "value": "clamp(1.1385rem, 1.0943rem + 0.2211vi, 1.2656rem)"
170
114
  },
171
- "lg": {
172
- "size": { "value": "20px" },
173
- "line-height": { "value": "1.2" }
115
+ "line-height": {
116
+ "value": "1.2"
174
117
  }
175
118
  },
176
- "body-copy": {
177
- "default": {
178
- "size": { "value": "16px" },
179
- "line-height": { "value": "1.38" }
119
+ "s3": {
120
+ "size": {
121
+ "value": "clamp(1.2148rem, 1.1421rem + 0.3636vi, 1.4238rem)"
180
122
  },
181
- "sm": {
182
- "size": { "value": "16px" },
183
- "line-height": { "value": "1.38" }
184
- },
185
- "md": {
186
- "size": { "value": "18px" },
187
- "line-height": { "value": "1.34" }
188
- },
189
- "lg": {
190
- "size": { "value": "16px" },
191
- "line-height": { "value": "1.38" }
123
+ "line-height": {
124
+ "value": "1.2"
192
125
  }
193
126
  },
194
- "body-copy-bulk": {
195
- "default": {
196
- "size": {
197
- "value": "16px"
198
- },
199
- "line-height": {
200
- "value": "1.75"
201
- }
202
- },
203
- "sm": {
204
- "size": {
205
- "value": "16px"
206
- },
207
- "line-height": {
208
- "value": "1.75"
209
- }
210
- },
211
- "md": {
212
- "size": {
213
- "value": "18px"
214
- },
215
- "line-height": {
216
- "value": "1.67"
217
- }
127
+ "s4": {
128
+ "size": {
129
+ "value": "clamp(1.2962rem, 1.1898rem + 0.5316vi, 1.6018rem)"
218
130
  },
219
- "lg": {
220
- "size": {
221
- "value": "16px"
222
- },
223
- "line-height": {
224
- "value": "1.75"
225
- }
131
+ "line-height": {
132
+ "value": "1.2"
226
133
  }
227
134
  },
228
- "pica": {
229
- "default": {
230
- "size": { "value": "15px" },
231
- "line-height": { "value": "1.34" }
135
+ "s5": {
136
+ "size": {
137
+ "value": "clamp(1.383rem, 1.2372rem + 0.7288vi, 1.802rem)"
232
138
  },
233
- "sm": {
234
- "size": { "value": "16px" },
235
- "line-height": { "value": "1.25" }
236
- },
237
- "md": {
238
- "size": { "value": "18px" },
239
- "line-height": { "value": "1.23" }
240
- },
241
- "lg": {
242
- "size": { "value": "16px" },
243
- "line-height": { "value": "1.25" }
139
+ "line-height": {
140
+ "value": "1.2"
244
141
  }
245
142
  },
246
- "long-primer": {
247
- "default": {
248
- "size": { "value": "15px" },
249
- "line-height": { "value": "1.2" }
250
- },
251
- "sm": {
252
- "size": { "value": "15px" },
253
- "line-height": { "value": "1.2" }
143
+ "s6": {
144
+ "size": {
145
+ "value": "clamp(1.4757rem, 1.2838rem + 0.9593vi, 2.0273rem)"
254
146
  },
255
- "md": {
256
- "size": { "value": "15px" },
257
- "line-height": { "value": "1.34" }
258
- },
259
- "lg": {
260
- "size": { "value": "14px" },
261
- "line-height": { "value": "1.29" }
147
+ "line-height": {
148
+ "value": "1.15"
262
149
  }
263
150
  },
264
- "brevier": {
265
- "default": {
266
- "size": { "value": "14px" },
267
- "line-height": { "value": "1.15" }
268
- },
269
- "sm": {
270
- "size": { "value": "14px" },
271
- "line-height": { "value": "1.29" }
272
- },
273
- "md": {
274
- "size": { "value": "14px" },
275
- "line-height": { "value": "1.29" }
151
+ "s7": {
152
+ "size": {
153
+ "value": "clamp(1.5745rem, 1.3289rem + 1.2281vi, 2.2807rem)"
276
154
  },
277
- "lg": {
278
- "size": { "value": "13px" },
279
- "line-height": { "value": "1.24" }
155
+ "line-height": {
156
+ "value": "1.15"
280
157
  }
281
158
  },
282
- "minion": {
283
- "default": {
284
- "size": { "value": "12px" },
285
- "line-height": { "value": "1.34" }
159
+ "s8": {
160
+ "size": {
161
+ "value": "clamp(1.68rem, 1.3719rem + 1.5405vi, 2.5658rem)"
286
162
  },
287
- "sm": {
288
- "size": { "value": "12px" },
289
- "line-height": { "value": "1.34" }
290
- },
291
- "md": {
292
- "size": { "value": "13px" },
293
- "line-height": { "value": "1.24" }
163
+ "line-height": {
164
+ "value": "1.15"
165
+ }
166
+ },
167
+ "s9": {
168
+ "size": {
169
+ "value": "clamp(1.7926rem, 1.4121rem + 1.9025vi, 2.8865rem)"
294
170
  },
295
- "lg": {
296
- "size": { "value": "12px" },
297
- "line-height": { "value": "1.34" }
171
+ "line-height": {
172
+ "value": "1.15"
298
173
  }
299
174
  }
300
175
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "notes": "## Usage\n\n- Canon: H1\n\n- Trafalgar: H4, section header\n\n- Paragon: Primary headline\n\n- Double Pica: Sub header\n\n- Great Primer: Headline title or subtitle\n\n- Body copy: Body copy\n\n- Body copy bulk: Body copy long text\n\n- Pica: Index links, titles or headlines\n\n- Long Primer: Index body copy and image captions\n\n- Brevier: Time stamps and bylines\n\n- Minion: Small header capitals"
2
+ "notes": "We're using Utopia fluid type scale: https://utopia.fyi/type/calculator?c=320,16,1.067,1240,16,1.125,9,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12\n\nWe customised font `s-2` and `s-1` so they have a fixed value and don't change depending on the size of the viewport.\nThose 2 fonts being already quite small, we didn't want them getting smaller for accessibility or bigger as they would get too close to the base size and we would lose the visual hierarchy of the text."
3
3
  }
@@ -1,53 +1,32 @@
1
- {# get breakpoint names as array #}
2
- {% set bps = ['default'] %}
3
- {% for name, item in tokens.size.breakpoint %}
4
- {% set bps = bps.concat(name) %}
5
- {% endfor %}
1
+ {# Comments from https://utopia.fyi/type/calculator?c=320,16,1.067,1240,16,1.125,9,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 #}
2
+ {% set fontSizesDoc = {
3
+ 's-2': '12px',
4
+ 's-1': '14px',
5
+ 's0': '16px',
6
+ 's1': '17.072px → 18px',
7
+ 's2': '18.2158px → 20.25px',
8
+ 's3': '19.4363px → 22.7813px',
9
+ 's4': '20.7385px → 25.6289px',
10
+ 's5': '22.128px → 28.8325px',
11
+ 's6': '23.6106px → 32.4366px',
12
+ 's7': '25.1925px → 36.4912px',
13
+ 's8': '26.8804px → 41.0526px',
14
+ 's9': '28.6814px → 46.1841px'
15
+ } %}
6
16
 
7
17
  <style>
8
18
  .breakpoint-indicator { display: flex; width: 100%; position: sticky; top: 0; background: white; }
9
19
  .example-copy { background-color: #f8f8f8; }
10
20
  .example-copy:hover { background-color: #ececec; }
11
-
12
- {% for bpname in bps %}
13
- {%- set nextbpname = bps[loop.index0 + 1] -%}
14
-
15
- {%- set lower = tokens.size.breakpoint[bpname] -%}
16
- {%- if lower -%}
17
- {%- set lower = (tokens.size.breakpoint[bpname].original.value).split('px')[0] -%}
18
- {%- endif -%}
19
-
20
- {%- set upper = tokens.size.breakpoint[nextbpname] -%}
21
- {%- if upper -%}
22
- {%- set upper = (tokens.size.breakpoint[nextbpname].original.value).split('px')[0]-1 -%}
23
- {%- endif %}
24
-
25
- @media {% if lower -%}(min-width: {{ lower }}px){%- endif -%}{% if lower and upper %} and {% endif %}{% if upper -%}(max-width: {{ upper }}px){%- endif -%} {
26
- .rwd-{{ bpname }} { background: #fffdac; }
27
- }
28
-
29
- {% endfor -%}
30
21
  </style>
31
22
 
32
23
  {% for fontName, item in tokens.font.type %}
33
24
  <div class="mds-margin-bottom-b10">
34
- <h2 class="mds-margin-bottom-b5"><strong>{{ fontName | capitalize }}</strong></h2>
35
-
36
- <p class="mds-margin-bottom-b1" style="font-size: 16px;">Breakpoint sizes:</p>
37
- <div class="mds-margin-bottom-b10 breakpoint-indicator">
38
- {%- for bpname in bps -%}
39
- <div class="mds-padding-b2 rwd-{{ bpname }}" style="flex: 1; border: 1px solid #eee;">
40
- <strong>{{ bpname }}</strong>
41
- {% set selectedFont = tokens.font.type[fontName][bpname] %}
42
- <ul class="mds-margin-b0">
43
- {% for cssProperty, subSubItem in selectedFont %}
44
- <li>{{ cssProperty }}: {{subSubItem.value}}</li>
45
- {% endfor %}
46
- </ul>
47
- </div>
48
- {% endfor %}
49
- </div>
50
-
25
+ <h2 class="mds-margin-bottom-b5"><strong>{{ fontName }}</strong></h2>
26
+ <ul>
27
+ <li>Size (in px): <strong>{{ fontSizesDoc[fontName] }}</strong> <span class="mds-font-s-1">(Viewport width: min 320px → max 1240px)</span></li>
28
+ <li>Line height: <strong>{{ item['line-height'].value }}</strong></li>
29
+ </ul>
51
30
  <p class="mds-margin-bottom-b1" style="font-size: 16px;">Example:</p>
52
31
  <div class="example-copy mds-highlighted-container" style="margin-bottom: 80px;">
53
32
  <div class="mds-font-{{ fontName }}">
@@ -1,4 +1,4 @@
1
- function registerTransforms(StyleDictionary, tokenBaseFontSize) {
1
+ function registerTransforms(StyleDictionary) {
2
2
  return new Promise((resolve) => {
3
3
  StyleDictionary.registerTransform({
4
4
  name: 'css/rawData',
@@ -10,33 +10,6 @@ function registerTransforms(StyleDictionary, tokenBaseFontSize) {
10
10
  return prop.rawData;
11
11
  },
12
12
  });
13
- StyleDictionary.registerTransform({
14
- name: 'custom/pxToRem',
15
- type: 'value',
16
- matcher(token) {
17
- return (
18
- token.attributes.category === 'font' && token.attributes.type === 'type' && token.attributes.state === 'size'
19
- );
20
- },
21
- transformer(token) {
22
- const baseFontSize = tokenBaseFontSize ? parseFloat(tokenBaseFontSize) : 16; // default to 16px
23
- const tokenValue = parseFloat(token.value);
24
-
25
- if (Number.isNaN(tokenBaseFontSize)) {
26
- throw new Error(`Invalid number for base font size: ${tokenBaseFontSize}`);
27
- }
28
-
29
- if (Number.isNaN(tokenValue)) {
30
- throw new Error(`Invalid number: ${token.value}. Could not convert ${token.name} to rem`);
31
- }
32
-
33
- if (tokenValue === 0) {
34
- return '0';
35
- }
36
-
37
- return `${(tokenValue / baseFontSize).toFixed(3)}rem`;
38
- },
39
- });
40
13
  resolve('Transform registered');
41
14
  });
42
15
  }
@@ -1,5 +0,0 @@
1
- ## Helpers
2
-
3
- Use the class `mds-edited-text` to normalise the text coming from a WYSIWYG editor,
4
- ul, ol tags will have the style that has been removed in css-reset
5
- this should only be used when content from a WYSIWYG editor is displayed