@skyscanner/backpack-web 41.3.0 → 41.5.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 (36) hide show
  1. package/bpk-component-bubble/src/BpkBubble.module.css +1 -1
  2. package/bpk-component-card-list/src/BpkCardListRowRail/BpkCardListCarousel.module.css +1 -1
  3. package/bpk-component-code/index.d.ts +6 -0
  4. package/bpk-component-code/index.js +3 -1
  5. package/bpk-component-code/src/BpkCode.d.ts +9 -0
  6. package/bpk-component-code/src/BpkCode.js +14 -33
  7. package/bpk-component-code/src/BpkCodeBlock.d.ts +9 -0
  8. package/bpk-component-code/src/BpkCodeBlock.js +15 -28
  9. package/bpk-component-fieldset/src/BpkFieldset.js +0 -1
  10. package/bpk-component-label/index.d.ts +3 -0
  11. package/bpk-component-label/index.js +3 -1
  12. package/bpk-component-label/src/BpkLabel.d.ts +11 -0
  13. package/bpk-component-label/src/BpkLabel.js +11 -22
  14. package/bpk-component-navigation-tab-group/src/BpkNavigationTabGroup.js +3 -2
  15. package/bpk-component-nudger/src/BpkNudger.js +0 -1
  16. package/bpk-component-segmented-control/index.d.ts +3 -2
  17. package/bpk-component-segmented-control/index.js +2 -1
  18. package/bpk-component-segmented-control/src/BpkSegmentedControl.d.ts +36 -1
  19. package/bpk-component-segmented-control/src/BpkSegmentedControl.js +138 -13
  20. package/bpk-component-text/src/BpkText.module.css +1 -1
  21. package/bpk-component-theme-toggle/index.d.ts +4 -0
  22. package/bpk-component-theme-toggle/src/BpkThemeToggle.d.ts +16 -0
  23. package/bpk-component-theme-toggle/src/BpkThemeToggle.js +10 -7
  24. package/bpk-component-theme-toggle/src/theming.d.ts +136 -0
  25. package/bpk-component-theme-toggle/src/updateOnThemeChange.d.ts +42 -0
  26. package/bpk-component-theme-toggle/src/updateOnThemeChange.js +10 -8
  27. package/bpk-component-theme-toggle/src/utils.d.ts +3 -0
  28. package/bpk-component-theme-toggle/src/utils.js +1 -1
  29. package/bpk-mixins/_typography.scss +3 -3
  30. package/bpk-stylesheets/base.css +1 -1
  31. package/bpk-stylesheets/font.css +1 -1
  32. package/bpk-stylesheets/font.scss +423 -75
  33. package/bpk-stylesheets/index.scss +1 -1
  34. package/bpk-stylesheets/larken.css +1 -1
  35. package/bpk-stylesheets/larken.scss +268 -95
  36. package/package.json +2 -2
@@ -17,111 +17,284 @@
17
17
  */
18
18
 
19
19
  $base-url: 'https://js.skyscnr.com/sttc/bpk-fonts';
20
+ $font-formats: (woff2, woff, ttf);
20
21
 
21
- @font-face {
22
- font-family: Larken;
23
- font-style: normal;
24
- font-weight: 300;
25
- src:
26
- url('#{$base-url}/Larken-Light-8371ea16.woff2') format('woff2'),
27
- url('#{$base-url}/Larken-Light-39e53c9a.woff') format('woff');
28
- }
22
+ // Table-driven font registry for Larken + Noto fallbacks (editorial bundle).
23
+ // Filenames are hashed names without extensions; only provided formats emit.
24
+ $bpk-fonts: (
25
+ larken: (
26
+ (
27
+ style: normal,
28
+ weight: 300,
29
+ files: (
30
+ woff2: 'Larken-Light-8371ea16',
31
+ woff: 'Larken-Light-39e53c9a',
32
+ ttf: null,
33
+ ),
34
+ ),
35
+ (
36
+ style: normal,
37
+ weight: 400,
38
+ files: (
39
+ woff2: 'Larken-Regular-3d9dfe29',
40
+ woff: 'Larken-Regular-626ee28c',
41
+ ttf: null,
42
+ ),
43
+ ),
44
+ ),
45
+ 'Noto Sans Arabic': (
46
+ (
47
+ style: normal,
48
+ weight: 300,
49
+ files: (
50
+ woff2: 'NotoSansArabic-Light-e77dc47a',
51
+ woff: 'NotoSansArabic-Light-ea83f673',
52
+ ttf: 'NotoSansArabic-Light-b2ff05f9',
53
+ ),
54
+ ),
55
+ (
56
+ style: normal,
57
+ weight: 400,
58
+ files: (
59
+ woff2: 'NotoSansArabic-Regular-15a84e58',
60
+ woff: 'NotoSansArabic-Regular-a2985c7a',
61
+ ttf: 'NotoSansArabic-Regular-471fde3d',
62
+ ),
63
+ ),
64
+ ),
65
+ 'Noto Serif Hebrew': (
66
+ (
67
+ style: normal,
68
+ weight: 300,
69
+ files: (
70
+ woff2: 'NotoSerifHebrew-Light-24198867',
71
+ woff: 'NotoSerifHebrew-Light-7d94eb62',
72
+ ttf: 'NotoSerifHebrew-Light-320a7a43',
73
+ ),
74
+ ),
75
+ (
76
+ style: normal,
77
+ weight: 400,
78
+ files: (
79
+ woff2: 'NotoSerifHebrew-Regular-a9e2c102',
80
+ woff: 'NotoSerifHebrew-Regular-41b2944d',
81
+ ttf: 'NotoSerifHebrew-Regular-e8471015',
82
+ ),
83
+ ),
84
+ ),
85
+ 'Noto Serif': (
86
+ (
87
+ style: normal,
88
+ weight: 300,
89
+ files: (
90
+ woff2: 'NotoSerif-Light-46d7aaea',
91
+ woff: 'NotoSerif-Light-412a21b9',
92
+ ttf: 'NotoSerif-Light-9dbdd5d2',
93
+ ),
94
+ ),
95
+ (
96
+ style: italic,
97
+ weight: 300,
98
+ files: (
99
+ woff2: 'NotoSerif-LightItalic-3df46bf3',
100
+ woff: 'NotoSerif-LightItalic-b235c828',
101
+ ttf: 'NotoSerif-LightItalic-1a288873',
102
+ ),
103
+ ),
104
+ (
105
+ style: normal,
106
+ weight: 400,
107
+ files: (
108
+ woff2: 'NotoSerif-Regular-f9cc92ed',
109
+ woff: 'NotoSerif-Regular-ea07f3b6',
110
+ ttf: 'NotoSerif-Regular-c8fe04e5',
111
+ ),
112
+ ),
113
+ (
114
+ style: italic,
115
+ weight: 400,
116
+ files: (
117
+ woff2: 'NotoSerif-Italic-132f7557',
118
+ woff: 'NotoSerif-Italic-ceeb7a6f',
119
+ ttf: 'NotoSerif-Italic-25dbfc26',
120
+ ),
121
+ ),
122
+ ),
123
+ 'Noto Serif Devanagari': (
124
+ (
125
+ style: normal,
126
+ weight: 300,
127
+ files: (
128
+ woff2: 'NotoSerifDevanagari-Light-6f8c3ec2',
129
+ woff: 'NotoSerifDevanagari-Light-9e5b16f1',
130
+ ttf: 'NotoSerifDevanagari-Light-d396b2f0',
131
+ ),
132
+ ),
133
+ (
134
+ style: normal,
135
+ weight: 400,
136
+ files: (
137
+ woff2: 'NotoSerifDevanagari-Regular-05c8f8c5',
138
+ woff: 'NotoSerifDevanagari-Regular-7b432355',
139
+ ttf: 'NotoSerifDevanagari-Regular-49b7fded',
140
+ ),
141
+ ),
142
+ ),
143
+ 'Noto Serif Thai': (
144
+ (
145
+ style: normal,
146
+ weight: 300,
147
+ files: (
148
+ woff2: 'NotoSerifThai-Light-c19b05eb',
149
+ woff: 'NotoSerifThai-Light-c8dd8e9a',
150
+ ttf: 'NotoSerifThai-Light-7503fb65',
151
+ ),
152
+ ),
153
+ (
154
+ style: normal,
155
+ weight: 400,
156
+ files: (
157
+ woff2: 'NotoSerifThai-Regular-807f25ca',
158
+ woff: 'NotoSerifThai-Regular-4930d4b0',
159
+ ttf: 'NotoSerifThai-Regular-619e0cdd',
160
+ ),
161
+ ),
162
+ ),
163
+ 'Noto Serif SC': (
164
+ (
165
+ style: normal,
166
+ weight: 300,
167
+ files: (
168
+ woff2: 'NotoSerifSC-Light-340f3714',
169
+ woff: 'NotoSerifSC-Light-0cad7edb',
170
+ ttf: 'NotoSerifSC-Light-4a0300b1',
171
+ ),
172
+ ),
173
+ (
174
+ style: normal,
175
+ weight: 400,
176
+ files: (
177
+ woff2: 'NotoSerifSC-Regular-81b3cace',
178
+ woff: 'NotoSerifSC-Regular-861a6d77',
179
+ ttf: 'NotoSerifSC-Regular-e6f67c70',
180
+ ),
181
+ ),
182
+ ),
183
+ 'Noto Serif TC': (
184
+ (
185
+ style: normal,
186
+ weight: 300,
187
+ files: (
188
+ woff2: 'NotoSerifTC-Light-d06d870d',
189
+ woff: 'NotoSerifTC-Light-e7d41ebf',
190
+ ttf: 'NotoSerifTC-Light-a575e20b',
191
+ ),
192
+ ),
193
+ (
194
+ style: normal,
195
+ weight: 400,
196
+ files: (
197
+ woff2: 'NotoSerifTC-Regular-ba80e9e3',
198
+ woff: 'NotoSerifTC-Regular-24d6fd67',
199
+ ttf: 'NotoSerifTC-Regular-81f7cfa9',
200
+ ),
201
+ ),
202
+ ),
203
+ 'Noto Serif JP': (
204
+ (
205
+ style: normal,
206
+ weight: 300,
207
+ files: (
208
+ woff2: 'NotoSerifJP-Light-300342ba',
209
+ woff: 'NotoSerifJP-Light-908de8db',
210
+ ttf: 'NotoSerifJP-Light-4fdde149',
211
+ ),
212
+ ),
213
+ (
214
+ style: normal,
215
+ weight: 400,
216
+ files: (
217
+ woff2: 'NotoSerifJP-Regular-04cd06e8',
218
+ woff: 'NotoSerifJP-Regular-5ec4849d',
219
+ ttf: 'NotoSerifJP-Regular-5926d365',
220
+ ),
221
+ ),
222
+ ),
223
+ 'Noto Serif KR': (
224
+ (
225
+ style: normal,
226
+ weight: 300,
227
+ files: (
228
+ woff2: 'NotoSerifKR-Light-cafbe1fe',
229
+ woff: 'NotoSerifKR-Light-60488ca3',
230
+ ttf: 'NotoSerifKR-Light-4149d2b6',
231
+ ),
232
+ ),
233
+ (
234
+ style: normal,
235
+ weight: 400,
236
+ files: (
237
+ woff2: 'NotoSerifKR-Regular-f6377da5',
238
+ woff: 'NotoSerifKR-Regular-a5cc7c23',
239
+ ttf: 'NotoSerifKR-Regular-2fa19520',
240
+ ),
241
+ ),
242
+ ),
243
+ );
29
244
 
30
- @font-face {
31
- font-family: Larken;
32
- font-style: normal;
33
- font-weight: 400;
34
- src:
35
- url('#{$base-url}/Larken-Regular-3d9dfe29.woff2') format('woff2'),
36
- url('#{$base-url}/Larken-Regular-626ee28c.woff') format('woff');
37
- }
245
+ @use 'sass:list';
246
+ @use 'sass:map';
38
247
 
39
- @font-face {
40
- font-family: 'Noto Sans Arabic';
41
- font-style: normal;
42
- font-weight: 300;
43
- src:
44
- url('#{$base-url}/NotoSansArabic-Light-e77dc47a.woff2') format('woff2'),
45
- url('#{$base-url}/NotoSansArabic-Light-ea83f673.woff') format('woff'),
46
- url('#{$base-url}/NotoSansArabic-Light-b2ff05f9.ttf') format('ttf');
47
- }
248
+ @mixin bpk-font-face($family, $style, $weight, $files) {
249
+ $srcs: ();
48
250
 
49
- @font-face {
50
- font-family: 'Noto Sans Hebrew';
51
- font-style: normal;
52
- font-weight: 300;
53
- src:
54
- url('#{$base-url}/NotoSansHebrew-Light-7e3d70ae.woff2') format('woff2'),
55
- url('#{$base-url}/NotoSansHebrew-Light-87087c3d.woff') format('woff'),
56
- url('#{$base-url}/NotoSansHebrew-Light-7b34032c.ttf') format('ttf');
57
- }
251
+ @each $ext in $font-formats {
252
+ $file: map.get($files, $ext);
58
253
 
59
- @font-face {
60
- font-family: 'Noto Serif';
61
- font-style: normal;
62
- font-weight: 300;
63
- src:
64
- url('#{$base-url}/NotoSerif-Light-46d7aaea.woff2') format('woff2'),
65
- url('#{$base-url}/NotoSerif-Light-412a21b9.woff') format('woff'),
66
- url('#{$base-url}/NotoSerif-Light-9dbdd5d2.ttf') format('ttf');
67
- }
68
-
69
- @font-face {
70
- font-family: 'Noto Serif Devanagari';
71
- font-style: normal;
72
- font-weight: 300;
73
- src:
74
- url('#{$base-url}/NotoSerifDevanagari-Light-6f8c3ec2.woff2') format('woff2'),
75
- url('#{$base-url}/NotoSerifDevanagari-Light-9e5b16f1.woff') format('woff'),
76
- url('#{$base-url}/NotoSerifDevanagari-Light-d396b2f0.ttf') format('ttf');
77
- }
78
-
79
- @font-face {
80
- font-family: 'Noto Serif Thai';
81
- font-style: normal;
82
- font-weight: 300;
83
- src:
84
- url('#{$base-url}/NotoSerifThai-Light-c19b05eb.woff2') format('woff2'),
85
- url('#{$base-url}/NotoSerifThai-Light-c8dd8e9a.woff') format('woff'),
86
- url('#{$base-url}/NotoSerifThai-Light-7503fb65.ttf') format('ttf');
87
- }
254
+ @if $file != null and $file != '' {
255
+ $srcs: list.append(
256
+ $srcs,
257
+ "url('#{$base-url}/#{$file}.#{$ext}') format('#{$ext}')",
258
+ comma
259
+ );
260
+ }
261
+ }
88
262
 
89
- @font-face {
90
- font-family: 'Noto Sans SC';
91
- font-style: normal;
92
- font-weight: 300;
93
- src:
94
- url('#{$base-url}/NotoSansSC-Light-650e8f78.woff2') format('woff2'),
95
- url('#{$base-url}/NotoSansSC-Light-562944a8.woff') format('woff'),
96
- url('#{$base-url}/NotoSansSC-Light-a73eb63e.ttf') format('ttf');
263
+ /* stylelint-disable backpack/use-typography-styles */
264
+ @font-face {
265
+ font-family: $family;
266
+ font-style: $style;
267
+ font-weight: $weight;
268
+ src: #{$srcs};
269
+ }
270
+ /* stylelint-enable backpack/use-typography-styles */
97
271
  }
98
272
 
99
- @font-face {
100
- font-family: 'Noto Sans TC';
101
- font-style: normal;
102
- font-weight: 300;
103
- src:
104
- url('#{$base-url}/NotoSansTC-Light-44be0b13.woff2') format('woff2'),
105
- url('#{$base-url}/NotoSansTC-Light-a8473157.woff') format('woff'),
106
- url('#{$base-url}/NotoSansTC-Light-d77339b0.ttf') format('ttf');
273
+ @each $family, $variants in $bpk-fonts {
274
+ @each $variant in $variants {
275
+ @include bpk-font-face(
276
+ $family,
277
+ map.get($variant, style),
278
+ map.get($variant, weight),
279
+ map.get($variant, files)
280
+ );
281
+ }
107
282
  }
108
283
 
109
- @font-face {
110
- font-family: 'Noto Sans JP';
111
- font-style: normal;
112
- font-weight: 300;
113
- src:
114
- url('#{$base-url}/NotoSansJP-Light-1fed199d.woff2') format('woff2'),
115
- url('#{$base-url}/NotoSansJP-Light-828afdbb.woff') format('woff'),
116
- url('#{$base-url}/NotoSansJP-Light-477cc6a5.ttf') format('ttf');
284
+ // Language-specific font stacks to prefer the right script-specific faces.
285
+ // We use a CSS Variable to make this scalable across all components using Larken.
286
+ [lang='ja-JP'],
287
+ :lang(ja-JP) {
288
+ --bpk-larken-font-stack:
289
+ larken, 'Noto Serif JP', 'Noto Serif SC', 'Noto Serif TC', 'Noto Serif KR',
290
+ 'Noto Sans Arabic', 'Noto Serif Hebrew', 'Noto Serif',
291
+ 'Noto Serif Devanagari', 'Noto Serif Thai', sans-serif;
117
292
  }
118
293
 
119
- @font-face {
120
- font-family: 'Noto Sans KR';
121
- font-style: normal;
122
- font-weight: 300;
123
- src:
124
- url('#{$base-url}/NotoSansKR-Light-8bef1aea.woff2') format('woff2'),
125
- url('#{$base-url}/NotoSansKR-Light-c07b4050.woff') format('woff'),
126
- url('#{$base-url}/NotoSansKR-Light-137d0733.ttf') format('ttf');
294
+ [lang='zh-TW'],
295
+ :lang(zh-TW) {
296
+ --bpk-larken-font-stack:
297
+ larken, 'Noto Serif TC', 'Noto Serif SC', 'Noto Serif JP', 'Noto Serif KR',
298
+ 'Noto Sans Arabic', 'Noto Serif Hebrew', 'Noto Serif',
299
+ 'Noto Serif Devanagari', 'Noto Serif Thai', sans-serif;
127
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "41.3.0",
3
+ "version": "41.5.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "@radix-ui/react-compose-refs": "^1.1.1",
28
28
  "@radix-ui/react-slider": "1.3.5",
29
29
  "@react-google-maps/api": "^2.19.3",
30
- "@skyscanner/bpk-foundations-web": "^24.0.0",
30
+ "@skyscanner/bpk-foundations-web": "^24.1.0",
31
31
  "@skyscanner/bpk-svgs": "^20.11.0",
32
32
  "a11y-focus-scope": "^1.1.3",
33
33
  "a11y-focus-store": "^1.0.0",