@octaviaflow/type 1.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.
- package/README.md +239 -0
- package/es/index.js +850 -0
- package/index.scss +14 -0
- package/lib/index.js +922 -0
- package/package.json +59 -0
- package/scss/_classes.scss +42 -0
- package/scss/_default-type.scss +50 -0
- package/scss/_font-family.scss +105 -0
- package/scss/_prefix.scss +28 -0
- package/scss/_reset.scss +42 -0
- package/scss/_scale.scss +58 -0
- package/scss/_styles.scss +902 -0
- package/src/__tests__/__snapshots__/fontFamily-test.js.snap +13 -0
- package/src/__tests__/__snapshots__/fontFamily.test.js.snap +13 -0
- package/src/__tests__/__snapshots__/fontWeight-test.js.snap +11 -0
- package/src/__tests__/__snapshots__/fontWeight.test.js.snap +11 -0
- package/src/__tests__/__snapshots__/reset-test.js.snap +11 -0
- package/src/__tests__/__snapshots__/reset.test.js.snap +11 -0
- package/src/__tests__/__snapshots__/scale-test.js.snap +29 -0
- package/src/__tests__/__snapshots__/scale.test.js.snap +29 -0
- package/src/__tests__/__snapshots__/styles-test.js.snap +411 -0
- package/src/__tests__/__snapshots__/styles.test.js.snap +411 -0
- package/src/__tests__/exports-test.js +88 -0
- package/src/__tests__/exports.test.js +88 -0
- package/src/__tests__/fluid-test.js +71 -0
- package/src/__tests__/fluid.test.js +71 -0
- package/src/__tests__/fontFamily-test.js +33 -0
- package/src/__tests__/fontFamily.test.js +33 -0
- package/src/__tests__/fontWeight-test.js +33 -0
- package/src/__tests__/fontWeight.test.js +33 -0
- package/src/__tests__/reset-test.js +23 -0
- package/src/__tests__/reset.test.js +23 -0
- package/src/__tests__/scale-test.js +31 -0
- package/src/__tests__/scale.test.js +31 -0
- package/src/__tests__/styles-test.js +18 -0
- package/src/__tests__/styles.test.js +18 -0
- package/src/__tests__/tokens-test.js +21 -0
- package/src/__tests__/tokens.test.js +21 -0
- package/src/fluid.js +89 -0
- package/src/fontFamily.js +33 -0
- package/src/fontWeight.js +27 -0
- package/src/index.js +31 -0
- package/src/print.js +39 -0
- package/src/reset.js +32 -0
- package/src/scale.js +33 -0
- package/src/styles.js +491 -0
- package/src/tokens.js +132 -0
- package/telemetry.yml +16 -0
- package/umd/index.js +926 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`styles body01 should be printable 1`] = `
|
|
4
|
+
"font-size: 0.875rem;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
line-height: 1.42857;
|
|
7
|
+
letter-spacing: 0.16px;"
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
exports[`styles body02 should be printable 1`] = `
|
|
11
|
+
"font-size: 1rem;
|
|
12
|
+
font-weight: 400;
|
|
13
|
+
line-height: 1.5;
|
|
14
|
+
letter-spacing: 0;"
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
exports[`styles bodyCompact01 should be printable 1`] = `
|
|
18
|
+
"font-size: 0.875rem;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
line-height: 1.28572;
|
|
21
|
+
letter-spacing: 0.16px;"
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`styles bodyCompact02 should be printable 1`] = `
|
|
25
|
+
"font-size: 1rem;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
line-height: 1.375;
|
|
28
|
+
letter-spacing: 0;"
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
exports[`styles bodyLong01 should be printable 1`] = `
|
|
32
|
+
"font-size: 0.875rem;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
line-height: 1.42857;
|
|
35
|
+
letter-spacing: 0.16px;"
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
exports[`styles bodyLong02 should be printable 1`] = `
|
|
39
|
+
"font-size: 1rem;
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
line-height: 1.5;
|
|
42
|
+
letter-spacing: 0;"
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`styles bodyShort01 should be printable 1`] = `
|
|
46
|
+
"font-size: 0.875rem;
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
line-height: 1.28572;
|
|
49
|
+
letter-spacing: 0.16px;"
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`styles bodyShort02 should be printable 1`] = `
|
|
53
|
+
"font-size: 1rem;
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
line-height: 1.375;
|
|
56
|
+
letter-spacing: 0;"
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`styles caption01 should be printable 1`] = `
|
|
60
|
+
"font-size: 0.75rem;
|
|
61
|
+
font-weight: 400;
|
|
62
|
+
line-height: 1.33333;
|
|
63
|
+
letter-spacing: 0.32px;"
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
exports[`styles caption02 should be printable 1`] = `
|
|
67
|
+
"font-size: 0.875rem;
|
|
68
|
+
font-weight: 400;
|
|
69
|
+
line-height: 1.28572;
|
|
70
|
+
letter-spacing: 0.32px;"
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
exports[`styles code01 should be printable 1`] = `
|
|
74
|
+
"font-family: 'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace;
|
|
75
|
+
font-size: 0.75rem;
|
|
76
|
+
font-weight: 400;
|
|
77
|
+
line-height: 1.33333;
|
|
78
|
+
letter-spacing: 0.32px;"
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
exports[`styles code02 should be printable 1`] = `
|
|
82
|
+
"font-family: 'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace;
|
|
83
|
+
font-size: 0.875rem;
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
line-height: 1.42857;
|
|
86
|
+
letter-spacing: 0.32px;"
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
exports[`styles display01 should be printable 1`] = `
|
|
90
|
+
"font-size: 2.625rem;
|
|
91
|
+
font-weight: 300;
|
|
92
|
+
line-height: 1.19;
|
|
93
|
+
letter-spacing: 0;"
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
exports[`styles display02 should be printable 1`] = `
|
|
97
|
+
"font-size: 2.625rem;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
line-height: 1.19;
|
|
100
|
+
letter-spacing: 0;"
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`styles display03 should be printable 1`] = `
|
|
104
|
+
"font-size: 2.625rem;
|
|
105
|
+
font-weight: 300;
|
|
106
|
+
line-height: 1.19;
|
|
107
|
+
letter-spacing: 0;"
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
exports[`styles display04 should be printable 1`] = `
|
|
111
|
+
"font-size: 2.625rem;
|
|
112
|
+
font-weight: 300;
|
|
113
|
+
line-height: 1.19;
|
|
114
|
+
letter-spacing: 0;"
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`styles expressiveHeading01 should be printable 1`] = `
|
|
118
|
+
"font-size: 0.875rem;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
line-height: 1.25;
|
|
121
|
+
letter-spacing: 0.16px;"
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`styles expressiveHeading02 should be printable 1`] = `
|
|
125
|
+
"font-size: 1rem;
|
|
126
|
+
font-weight: 600;
|
|
127
|
+
line-height: 1.5;
|
|
128
|
+
letter-spacing: 0;"
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
exports[`styles expressiveHeading03 should be printable 1`] = `
|
|
132
|
+
"font-size: 1.25rem;
|
|
133
|
+
font-weight: 400;
|
|
134
|
+
line-height: 1.4;
|
|
135
|
+
letter-spacing: 0;"
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
exports[`styles expressiveHeading04 should be printable 1`] = `
|
|
139
|
+
"font-size: 1.75rem;
|
|
140
|
+
font-weight: 400;
|
|
141
|
+
line-height: 1.28572;
|
|
142
|
+
letter-spacing: 0;"
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
exports[`styles expressiveHeading05 should be printable 1`] = `
|
|
146
|
+
"font-size: 2rem;
|
|
147
|
+
font-weight: 400;
|
|
148
|
+
line-height: 1.25;
|
|
149
|
+
letter-spacing: 0;"
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
exports[`styles expressiveHeading06 should be printable 1`] = `
|
|
153
|
+
"font-size: 2rem;
|
|
154
|
+
font-weight: 600;
|
|
155
|
+
line-height: 1.25;
|
|
156
|
+
letter-spacing: 0;"
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
exports[`styles expressiveParagraph01 should be printable 1`] = `
|
|
160
|
+
"font-size: 1.5rem;
|
|
161
|
+
font-weight: 300;
|
|
162
|
+
line-height: 1.334;
|
|
163
|
+
letter-spacing: 0;"
|
|
164
|
+
`;
|
|
165
|
+
|
|
166
|
+
exports[`styles fluidDisplay01 should be printable 1`] = `
|
|
167
|
+
"font-size: 2.625rem;
|
|
168
|
+
font-weight: 300;
|
|
169
|
+
line-height: 1.19;
|
|
170
|
+
letter-spacing: 0;"
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
exports[`styles fluidDisplay02 should be printable 1`] = `
|
|
174
|
+
"font-size: 2.625rem;
|
|
175
|
+
font-weight: 600;
|
|
176
|
+
line-height: 1.19;
|
|
177
|
+
letter-spacing: 0;"
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
exports[`styles fluidDisplay03 should be printable 1`] = `
|
|
181
|
+
"font-size: 2.625rem;
|
|
182
|
+
font-weight: 300;
|
|
183
|
+
line-height: 1.19;
|
|
184
|
+
letter-spacing: 0;"
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
exports[`styles fluidDisplay04 should be printable 1`] = `
|
|
188
|
+
"font-size: 2.625rem;
|
|
189
|
+
font-weight: 300;
|
|
190
|
+
line-height: 1.19;
|
|
191
|
+
letter-spacing: 0;"
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
exports[`styles fluidHeading03 should be printable 1`] = `
|
|
195
|
+
"font-size: 1.25rem;
|
|
196
|
+
font-weight: 400;
|
|
197
|
+
line-height: 1.4;
|
|
198
|
+
letter-spacing: 0;"
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
exports[`styles fluidHeading04 should be printable 1`] = `
|
|
202
|
+
"font-size: 1.75rem;
|
|
203
|
+
font-weight: 400;
|
|
204
|
+
line-height: 1.28572;
|
|
205
|
+
letter-spacing: 0;"
|
|
206
|
+
`;
|
|
207
|
+
|
|
208
|
+
exports[`styles fluidHeading05 should be printable 1`] = `
|
|
209
|
+
"font-size: 2rem;
|
|
210
|
+
font-weight: 400;
|
|
211
|
+
line-height: 1.25;
|
|
212
|
+
letter-spacing: 0;"
|
|
213
|
+
`;
|
|
214
|
+
|
|
215
|
+
exports[`styles fluidHeading06 should be printable 1`] = `
|
|
216
|
+
"font-size: 2rem;
|
|
217
|
+
font-weight: 600;
|
|
218
|
+
line-height: 1.25;
|
|
219
|
+
letter-spacing: 0;"
|
|
220
|
+
`;
|
|
221
|
+
|
|
222
|
+
exports[`styles fluidParagraph01 should be printable 1`] = `
|
|
223
|
+
"font-size: 1.5rem;
|
|
224
|
+
font-weight: 300;
|
|
225
|
+
line-height: 1.334;
|
|
226
|
+
letter-spacing: 0;"
|
|
227
|
+
`;
|
|
228
|
+
|
|
229
|
+
exports[`styles fluidQuotation01 should be printable 1`] = `
|
|
230
|
+
"font-family: 'IBM Plex Serif', 'Georgia', Times, serif;
|
|
231
|
+
font-size: 1.25rem;
|
|
232
|
+
font-weight: 400;
|
|
233
|
+
line-height: 1.3;
|
|
234
|
+
letter-spacing: 0;"
|
|
235
|
+
`;
|
|
236
|
+
|
|
237
|
+
exports[`styles fluidQuotation02 should be printable 1`] = `
|
|
238
|
+
"font-family: 'IBM Plex Serif', 'Georgia', Times, serif;
|
|
239
|
+
font-size: 2rem;
|
|
240
|
+
font-weight: 300;
|
|
241
|
+
line-height: 1.25;
|
|
242
|
+
letter-spacing: 0;"
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
exports[`styles heading01 should be printable 1`] = `
|
|
246
|
+
"font-size: 0.875rem;
|
|
247
|
+
font-weight: 600;
|
|
248
|
+
line-height: 1.42857;
|
|
249
|
+
letter-spacing: 0.16px;"
|
|
250
|
+
`;
|
|
251
|
+
|
|
252
|
+
exports[`styles heading02 should be printable 1`] = `
|
|
253
|
+
"font-size: 1rem;
|
|
254
|
+
font-weight: 600;
|
|
255
|
+
line-height: 1.5;
|
|
256
|
+
letter-spacing: 0;"
|
|
257
|
+
`;
|
|
258
|
+
|
|
259
|
+
exports[`styles heading03 should be printable 1`] = `
|
|
260
|
+
"font-size: 1.25rem;
|
|
261
|
+
font-weight: 400;
|
|
262
|
+
line-height: 1.4;
|
|
263
|
+
letter-spacing: 0;"
|
|
264
|
+
`;
|
|
265
|
+
|
|
266
|
+
exports[`styles heading04 should be printable 1`] = `
|
|
267
|
+
"font-size: 1.75rem;
|
|
268
|
+
font-weight: 400;
|
|
269
|
+
line-height: 1.28572;
|
|
270
|
+
letter-spacing: 0;"
|
|
271
|
+
`;
|
|
272
|
+
|
|
273
|
+
exports[`styles heading05 should be printable 1`] = `
|
|
274
|
+
"font-size: 2rem;
|
|
275
|
+
font-weight: 400;
|
|
276
|
+
line-height: 1.25;
|
|
277
|
+
letter-spacing: 0;"
|
|
278
|
+
`;
|
|
279
|
+
|
|
280
|
+
exports[`styles heading06 should be printable 1`] = `
|
|
281
|
+
"font-size: 2.625rem;
|
|
282
|
+
font-weight: 300;
|
|
283
|
+
line-height: 1.199;
|
|
284
|
+
letter-spacing: 0;"
|
|
285
|
+
`;
|
|
286
|
+
|
|
287
|
+
exports[`styles heading07 should be printable 1`] = `
|
|
288
|
+
"font-size: 3.375rem;
|
|
289
|
+
font-weight: 300;
|
|
290
|
+
line-height: 1.199;
|
|
291
|
+
letter-spacing: 0;"
|
|
292
|
+
`;
|
|
293
|
+
|
|
294
|
+
exports[`styles headingCompact01 should be printable 1`] = `
|
|
295
|
+
"font-size: 0.875rem;
|
|
296
|
+
font-weight: 600;
|
|
297
|
+
line-height: 1.28572;
|
|
298
|
+
letter-spacing: 0.16px;"
|
|
299
|
+
`;
|
|
300
|
+
|
|
301
|
+
exports[`styles headingCompact02 should be printable 1`] = `
|
|
302
|
+
"font-size: 1rem;
|
|
303
|
+
font-weight: 600;
|
|
304
|
+
line-height: 1.375;
|
|
305
|
+
letter-spacing: 0;"
|
|
306
|
+
`;
|
|
307
|
+
|
|
308
|
+
exports[`styles helperText01 should be printable 1`] = `
|
|
309
|
+
"font-size: 0.75rem;
|
|
310
|
+
line-height: 1.33333;
|
|
311
|
+
letter-spacing: 0.32px;"
|
|
312
|
+
`;
|
|
313
|
+
|
|
314
|
+
exports[`styles helperText02 should be printable 1`] = `
|
|
315
|
+
"font-size: 0.875rem;
|
|
316
|
+
line-height: 1.28572;
|
|
317
|
+
letter-spacing: 0.16px;"
|
|
318
|
+
`;
|
|
319
|
+
|
|
320
|
+
exports[`styles label01 should be printable 1`] = `
|
|
321
|
+
"font-size: 0.75rem;
|
|
322
|
+
font-weight: 400;
|
|
323
|
+
line-height: 1.33333;
|
|
324
|
+
letter-spacing: 0.32px;"
|
|
325
|
+
`;
|
|
326
|
+
|
|
327
|
+
exports[`styles label02 should be printable 1`] = `
|
|
328
|
+
"font-size: 0.875rem;
|
|
329
|
+
font-weight: 400;
|
|
330
|
+
line-height: 1.28572;
|
|
331
|
+
letter-spacing: 0.16px;"
|
|
332
|
+
`;
|
|
333
|
+
|
|
334
|
+
exports[`styles legal01 should be printable 1`] = `
|
|
335
|
+
"font-size: 0.75rem;
|
|
336
|
+
font-weight: 400;
|
|
337
|
+
line-height: 1.33333;
|
|
338
|
+
letter-spacing: 0.32px;"
|
|
339
|
+
`;
|
|
340
|
+
|
|
341
|
+
exports[`styles legal02 should be printable 1`] = `
|
|
342
|
+
"font-size: 0.875rem;
|
|
343
|
+
font-weight: 400;
|
|
344
|
+
line-height: 1.28572;
|
|
345
|
+
letter-spacing: 0.16px;"
|
|
346
|
+
`;
|
|
347
|
+
|
|
348
|
+
exports[`styles productiveHeading01 should be printable 1`] = `
|
|
349
|
+
"font-size: 0.875rem;
|
|
350
|
+
font-weight: 600;
|
|
351
|
+
line-height: 1.28572;
|
|
352
|
+
letter-spacing: 0.16px;"
|
|
353
|
+
`;
|
|
354
|
+
|
|
355
|
+
exports[`styles productiveHeading02 should be printable 1`] = `
|
|
356
|
+
"font-size: 1rem;
|
|
357
|
+
font-weight: 600;
|
|
358
|
+
line-height: 1.375;
|
|
359
|
+
letter-spacing: 0;"
|
|
360
|
+
`;
|
|
361
|
+
|
|
362
|
+
exports[`styles productiveHeading03 should be printable 1`] = `
|
|
363
|
+
"font-size: 1.25rem;
|
|
364
|
+
font-weight: 400;
|
|
365
|
+
line-height: 1.4;
|
|
366
|
+
letter-spacing: 0;"
|
|
367
|
+
`;
|
|
368
|
+
|
|
369
|
+
exports[`styles productiveHeading04 should be printable 1`] = `
|
|
370
|
+
"font-size: 1.75rem;
|
|
371
|
+
font-weight: 400;
|
|
372
|
+
line-height: 1.28572;
|
|
373
|
+
letter-spacing: 0;"
|
|
374
|
+
`;
|
|
375
|
+
|
|
376
|
+
exports[`styles productiveHeading05 should be printable 1`] = `
|
|
377
|
+
"font-size: 2rem;
|
|
378
|
+
font-weight: 400;
|
|
379
|
+
line-height: 1.25;
|
|
380
|
+
letter-spacing: 0;"
|
|
381
|
+
`;
|
|
382
|
+
|
|
383
|
+
exports[`styles productiveHeading06 should be printable 1`] = `
|
|
384
|
+
"font-size: 2.625rem;
|
|
385
|
+
font-weight: 300;
|
|
386
|
+
line-height: 1.199;
|
|
387
|
+
letter-spacing: 0;"
|
|
388
|
+
`;
|
|
389
|
+
|
|
390
|
+
exports[`styles productiveHeading07 should be printable 1`] = `
|
|
391
|
+
"font-size: 3.375rem;
|
|
392
|
+
font-weight: 300;
|
|
393
|
+
line-height: 1.199;
|
|
394
|
+
letter-spacing: 0;"
|
|
395
|
+
`;
|
|
396
|
+
|
|
397
|
+
exports[`styles quotation01 should be printable 1`] = `
|
|
398
|
+
"font-family: 'IBM Plex Serif', 'Georgia', Times, serif;
|
|
399
|
+
font-size: 1.25rem;
|
|
400
|
+
font-weight: 400;
|
|
401
|
+
line-height: 1.3;
|
|
402
|
+
letter-spacing: 0;"
|
|
403
|
+
`;
|
|
404
|
+
|
|
405
|
+
exports[`styles quotation02 should be printable 1`] = `
|
|
406
|
+
"font-family: 'IBM Plex Serif', 'Georgia', Times, serif;
|
|
407
|
+
font-size: 2rem;
|
|
408
|
+
font-weight: 300;
|
|
409
|
+
line-height: 1.25;
|
|
410
|
+
letter-spacing: 0;"
|
|
411
|
+
`;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @jest-environment node
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as CarbonType from '../';
|
|
11
|
+
|
|
12
|
+
describe('type', () => {
|
|
13
|
+
it('should export type helpers', () => {
|
|
14
|
+
expect(Object.keys(CarbonType)).toMatchInlineSnapshot(`
|
|
15
|
+
Array [
|
|
16
|
+
"fluid",
|
|
17
|
+
"fontFamilies",
|
|
18
|
+
"fontFamily",
|
|
19
|
+
"fontWeight",
|
|
20
|
+
"fontWeights",
|
|
21
|
+
"getTypeSize",
|
|
22
|
+
"print",
|
|
23
|
+
"reset",
|
|
24
|
+
"scale",
|
|
25
|
+
"styles",
|
|
26
|
+
"unstable_tokens",
|
|
27
|
+
"body01",
|
|
28
|
+
"body02",
|
|
29
|
+
"bodyCompact01",
|
|
30
|
+
"bodyCompact02",
|
|
31
|
+
"bodyLong01",
|
|
32
|
+
"bodyLong02",
|
|
33
|
+
"bodyShort01",
|
|
34
|
+
"bodyShort02",
|
|
35
|
+
"caption01",
|
|
36
|
+
"caption02",
|
|
37
|
+
"code01",
|
|
38
|
+
"code02",
|
|
39
|
+
"display01",
|
|
40
|
+
"display02",
|
|
41
|
+
"display03",
|
|
42
|
+
"display04",
|
|
43
|
+
"expressiveHeading01",
|
|
44
|
+
"expressiveHeading02",
|
|
45
|
+
"expressiveHeading03",
|
|
46
|
+
"expressiveHeading04",
|
|
47
|
+
"expressiveHeading05",
|
|
48
|
+
"expressiveHeading06",
|
|
49
|
+
"expressiveParagraph01",
|
|
50
|
+
"fluidDisplay01",
|
|
51
|
+
"fluidDisplay02",
|
|
52
|
+
"fluidDisplay03",
|
|
53
|
+
"fluidDisplay04",
|
|
54
|
+
"fluidHeading03",
|
|
55
|
+
"fluidHeading04",
|
|
56
|
+
"fluidHeading05",
|
|
57
|
+
"fluidHeading06",
|
|
58
|
+
"fluidParagraph01",
|
|
59
|
+
"fluidQuotation01",
|
|
60
|
+
"fluidQuotation02",
|
|
61
|
+
"heading01",
|
|
62
|
+
"heading02",
|
|
63
|
+
"heading03",
|
|
64
|
+
"heading04",
|
|
65
|
+
"heading05",
|
|
66
|
+
"heading06",
|
|
67
|
+
"heading07",
|
|
68
|
+
"headingCompact01",
|
|
69
|
+
"headingCompact02",
|
|
70
|
+
"helperText01",
|
|
71
|
+
"helperText02",
|
|
72
|
+
"label01",
|
|
73
|
+
"label02",
|
|
74
|
+
"legal01",
|
|
75
|
+
"legal02",
|
|
76
|
+
"productiveHeading01",
|
|
77
|
+
"productiveHeading02",
|
|
78
|
+
"productiveHeading03",
|
|
79
|
+
"productiveHeading04",
|
|
80
|
+
"productiveHeading05",
|
|
81
|
+
"productiveHeading06",
|
|
82
|
+
"productiveHeading07",
|
|
83
|
+
"quotation01",
|
|
84
|
+
"quotation02",
|
|
85
|
+
]
|
|
86
|
+
`);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @jest-environment node
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as CarbonType from '../';
|
|
11
|
+
|
|
12
|
+
describe('type', () => {
|
|
13
|
+
it('should export type helpers', () => {
|
|
14
|
+
expect(Object.keys(CarbonType)).toMatchInlineSnapshot(`
|
|
15
|
+
[
|
|
16
|
+
"body01",
|
|
17
|
+
"body02",
|
|
18
|
+
"bodyCompact01",
|
|
19
|
+
"bodyCompact02",
|
|
20
|
+
"bodyLong01",
|
|
21
|
+
"bodyLong02",
|
|
22
|
+
"bodyShort01",
|
|
23
|
+
"bodyShort02",
|
|
24
|
+
"caption01",
|
|
25
|
+
"caption02",
|
|
26
|
+
"code01",
|
|
27
|
+
"code02",
|
|
28
|
+
"display01",
|
|
29
|
+
"display02",
|
|
30
|
+
"display03",
|
|
31
|
+
"display04",
|
|
32
|
+
"expressiveHeading01",
|
|
33
|
+
"expressiveHeading02",
|
|
34
|
+
"expressiveHeading03",
|
|
35
|
+
"expressiveHeading04",
|
|
36
|
+
"expressiveHeading05",
|
|
37
|
+
"expressiveHeading06",
|
|
38
|
+
"expressiveParagraph01",
|
|
39
|
+
"fluid",
|
|
40
|
+
"fluidDisplay01",
|
|
41
|
+
"fluidDisplay02",
|
|
42
|
+
"fluidDisplay03",
|
|
43
|
+
"fluidDisplay04",
|
|
44
|
+
"fluidHeading03",
|
|
45
|
+
"fluidHeading04",
|
|
46
|
+
"fluidHeading05",
|
|
47
|
+
"fluidHeading06",
|
|
48
|
+
"fluidParagraph01",
|
|
49
|
+
"fluidQuotation01",
|
|
50
|
+
"fluidQuotation02",
|
|
51
|
+
"fontFamilies",
|
|
52
|
+
"fontFamily",
|
|
53
|
+
"fontWeight",
|
|
54
|
+
"fontWeights",
|
|
55
|
+
"getTypeSize",
|
|
56
|
+
"heading01",
|
|
57
|
+
"heading02",
|
|
58
|
+
"heading03",
|
|
59
|
+
"heading04",
|
|
60
|
+
"heading05",
|
|
61
|
+
"heading06",
|
|
62
|
+
"heading07",
|
|
63
|
+
"headingCompact01",
|
|
64
|
+
"headingCompact02",
|
|
65
|
+
"helperText01",
|
|
66
|
+
"helperText02",
|
|
67
|
+
"label01",
|
|
68
|
+
"label02",
|
|
69
|
+
"legal01",
|
|
70
|
+
"legal02",
|
|
71
|
+
"print",
|
|
72
|
+
"productiveHeading01",
|
|
73
|
+
"productiveHeading02",
|
|
74
|
+
"productiveHeading03",
|
|
75
|
+
"productiveHeading04",
|
|
76
|
+
"productiveHeading05",
|
|
77
|
+
"productiveHeading06",
|
|
78
|
+
"productiveHeading07",
|
|
79
|
+
"quotation01",
|
|
80
|
+
"quotation02",
|
|
81
|
+
"reset",
|
|
82
|
+
"scale",
|
|
83
|
+
"styles",
|
|
84
|
+
"unstable_tokens",
|
|
85
|
+
]
|
|
86
|
+
`);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @jest-environment node
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { fluid } from '../fluid';
|
|
11
|
+
import { display04 } from '../styles';
|
|
12
|
+
|
|
13
|
+
describe('fluid', () => {
|
|
14
|
+
it('should return back a token if no breakpoints available', () => {
|
|
15
|
+
const token = {
|
|
16
|
+
fontSize: '1rem',
|
|
17
|
+
};
|
|
18
|
+
expect(fluid(token)).toEqual(token);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should include the default styles for each breakpoint as a media key', () => {
|
|
22
|
+
const token = {
|
|
23
|
+
fontSize: '1rem',
|
|
24
|
+
letterSpacing: 0,
|
|
25
|
+
breakpoints: {
|
|
26
|
+
md: {
|
|
27
|
+
fontSize: '1.5rem',
|
|
28
|
+
letterSpacing: '100%',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
expect(fluid(token)).toEqual(
|
|
33
|
+
expect.objectContaining({
|
|
34
|
+
letterSpacing: token.letterSpacing,
|
|
35
|
+
'@media (min-width: 42rem)': expect.objectContaining({
|
|
36
|
+
letterSpacing: token.breakpoints.md.letterSpacing,
|
|
37
|
+
}),
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should compute the fluid styles for a token', () => {
|
|
43
|
+
expect(fluid(display04)).toMatchInlineSnapshot(`
|
|
44
|
+
Object {
|
|
45
|
+
"@media (min-width: 42rem)": Object {
|
|
46
|
+
"fontSize": "calc(4.25rem + 1.5 * ((100vw - 42rem) / 24))",
|
|
47
|
+
"lineHeight": 1.15,
|
|
48
|
+
},
|
|
49
|
+
"@media (min-width: 66rem)": Object {
|
|
50
|
+
"fontSize": "calc(5.75rem + 1.875 * ((100vw - 66rem) / 16))",
|
|
51
|
+
"letterSpacing": "-0.64px",
|
|
52
|
+
"lineHeight": 1.11,
|
|
53
|
+
},
|
|
54
|
+
"@media (min-width: 82rem)": Object {
|
|
55
|
+
"fontSize": "calc(7.625rem + 2.125 * ((100vw - 82rem) / 17))",
|
|
56
|
+
"letterSpacing": "-0.64px",
|
|
57
|
+
"lineHeight": 1.07,
|
|
58
|
+
},
|
|
59
|
+
"@media (min-width: 99rem)": Object {
|
|
60
|
+
"fontSize": "9.75rem",
|
|
61
|
+
"letterSpacing": "-0.96px",
|
|
62
|
+
"lineHeight": 1.05,
|
|
63
|
+
},
|
|
64
|
+
"fontSize": "calc(2.625rem + 1.625 * ((100vw - 20rem) / 22))",
|
|
65
|
+
"fontWeight": 300,
|
|
66
|
+
"letterSpacing": 0,
|
|
67
|
+
"lineHeight": 1.19,
|
|
68
|
+
}
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
71
|
+
});
|