@expo/styleguide 3.4.1 → 3.4.2-alpha.3

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.
@@ -0,0 +1,358 @@
1
+ export declare const typography: {
2
+ baseFontSize: number;
3
+ headers: {
4
+ huge: {
5
+ fontSize: string;
6
+ lineHeight: string;
7
+ letterSpacing: string;
8
+ fontFamily: string;
9
+ fontWeight: number;
10
+ };
11
+ h1: {
12
+ fontSize: string;
13
+ lineHeight: string;
14
+ letterSpacing: string;
15
+ fontFamily: string;
16
+ fontWeight: number;
17
+ };
18
+ h2: {
19
+ fontSize: string;
20
+ lineHeight: string;
21
+ letterSpacing: string;
22
+ fontFamily: string;
23
+ fontWeight: number;
24
+ };
25
+ h3: {
26
+ fontSize: string;
27
+ lineHeight: string;
28
+ letterSpacing: string;
29
+ fontFamily: string;
30
+ fontWeight: number;
31
+ };
32
+ h4: {
33
+ fontSize: string;
34
+ lineHeight: string;
35
+ letterSpacing: string;
36
+ fontFamily: string;
37
+ fontWeight: number;
38
+ };
39
+ h5: {
40
+ fontSize: string;
41
+ lineHeight: string;
42
+ letterSpacing: string;
43
+ fontFamily: string;
44
+ fontWeight: number;
45
+ };
46
+ h6: {
47
+ fontSize: string;
48
+ lineHeight: string;
49
+ letterSpacing: string;
50
+ fontFamily: string;
51
+ fontWeight: number;
52
+ };
53
+ };
54
+ body: {
55
+ headline: {
56
+ fontSize: string;
57
+ lineHeight: string;
58
+ letterSpacing: string;
59
+ fontFamily: string;
60
+ fontWeight: number;
61
+ };
62
+ paragraph: {
63
+ fontSize: string;
64
+ lineHeight: string;
65
+ letterSpacing: string;
66
+ fontFamily: string;
67
+ fontWeight: number;
68
+ };
69
+ label: {
70
+ fontSize: string;
71
+ lineHeight: string;
72
+ letterSpacing: string;
73
+ fontFamily: string;
74
+ fontWeight: number;
75
+ };
76
+ callout: {
77
+ fontSize: string;
78
+ lineHeight: string;
79
+ letterSpacing: string;
80
+ fontFamily: string;
81
+ fontWeight: number;
82
+ };
83
+ footnote: {
84
+ fontSize: string;
85
+ lineHeight: string;
86
+ letterSpacing: string;
87
+ fontFamily: string;
88
+ fontWeight: number;
89
+ };
90
+ caption: {
91
+ fontSize: string;
92
+ lineHeight: string;
93
+ fontFamily: string;
94
+ fontWeight: number;
95
+ };
96
+ code: {
97
+ fontSize: string;
98
+ lineHeight: string;
99
+ letterSpacing: string;
100
+ fontFamily: string;
101
+ fontWeight: number;
102
+ };
103
+ ul: {
104
+ marginLeft: string;
105
+ 'ol, ul': {
106
+ marginTop: string;
107
+ marginBottom: string;
108
+ };
109
+ };
110
+ ol: {
111
+ marginLeft: string;
112
+ 'ol, ul': {
113
+ marginTop: string;
114
+ marginBottom: string;
115
+ };
116
+ };
117
+ li: {
118
+ marginBottom: string;
119
+ fontSize: string;
120
+ lineHeight: string;
121
+ letterSpacing: string;
122
+ fontFamily: string;
123
+ fontWeight: number;
124
+ };
125
+ blockquote: {
126
+ color: string;
127
+ paddingLeft: number;
128
+ borderLeft: string;
129
+ fontSize: string;
130
+ lineHeight: string;
131
+ letterSpacing: string;
132
+ fontFamily: string;
133
+ fontWeight: number;
134
+ };
135
+ };
136
+ utility: {
137
+ anchor: {
138
+ color: string;
139
+ fontWeight: number;
140
+ textDecoration: string;
141
+ cursor: string;
142
+ opacity: number;
143
+ transform: string;
144
+ ':visited': {
145
+ color: string;
146
+ };
147
+ ':hover': {
148
+ transition: string;
149
+ opacity: number;
150
+ };
151
+ };
152
+ inlineCode: {
153
+ fontWeight: number;
154
+ display: string;
155
+ backgroundColor: string;
156
+ border: string;
157
+ borderRadius: number;
158
+ padding: string;
159
+ lineHeight: string;
160
+ fontSize: string;
161
+ letterSpacing: string;
162
+ fontFamily: string;
163
+ };
164
+ terminalCode: {
165
+ fontWeight: number;
166
+ display: string;
167
+ backgroundColor: string;
168
+ color: string;
169
+ border: string;
170
+ borderRadius: number;
171
+ padding: string;
172
+ lineHeight: string;
173
+ fontSize: string;
174
+ letterSpacing: string;
175
+ fontFamily: string;
176
+ };
177
+ pre: {
178
+ fontWeight: number;
179
+ backgroundColor: string;
180
+ borderRadius: number;
181
+ border: string;
182
+ padding: number;
183
+ whiteSpace: "pre-wrap";
184
+ margin: string;
185
+ fontSize: string;
186
+ lineHeight: string;
187
+ letterSpacing: string;
188
+ fontFamily: string;
189
+ };
190
+ terminalPre: {
191
+ fontWeight: number;
192
+ backgroundColor: string;
193
+ color: string;
194
+ borderRadius: number;
195
+ border: string;
196
+ padding: number;
197
+ margin: string;
198
+ whiteSpace: "pre-wrap";
199
+ '&:before': {
200
+ content: string;
201
+ };
202
+ fontSize: string;
203
+ lineHeight: string;
204
+ letterSpacing: string;
205
+ fontFamily: string;
206
+ };
207
+ hr: {
208
+ backgroundColor: string;
209
+ border: number;
210
+ height: number;
211
+ display: string;
212
+ width: string;
213
+ };
214
+ weight: {
215
+ black: {
216
+ fontFamily: string;
217
+ fontWeight: number;
218
+ };
219
+ semiBold: {
220
+ fontFamily: string;
221
+ fontWeight: number;
222
+ };
223
+ medium: {
224
+ fontFamily: string;
225
+ fontWeight: number;
226
+ };
227
+ regular: {
228
+ fontFamily: string;
229
+ fontWeight: number;
230
+ };
231
+ };
232
+ };
233
+ fontFaces: {
234
+ black: string;
235
+ semiBold: string;
236
+ medium: string;
237
+ regular: string;
238
+ mono: string;
239
+ };
240
+ fontStacks: {
241
+ black: string;
242
+ semiBold: string;
243
+ medium: string;
244
+ regular: string;
245
+ mono: string;
246
+ };
247
+ fontSizes: {
248
+ 61: {
249
+ fontSize: string;
250
+ lineHeight: string;
251
+ letterSpacing: string;
252
+ };
253
+ 53: {
254
+ fontSize: string;
255
+ lineHeight: string;
256
+ letterSpacing: string;
257
+ };
258
+ 49: {
259
+ fontSize: string;
260
+ lineHeight: string;
261
+ letterSpacing: string;
262
+ };
263
+ 46: {
264
+ fontSize: string;
265
+ lineHeight: string;
266
+ letterSpacing: string;
267
+ };
268
+ 43: {
269
+ fontSize: string;
270
+ lineHeight: string;
271
+ letterSpacing: string;
272
+ };
273
+ 39: {
274
+ fontSize: string;
275
+ lineHeight: string;
276
+ letterSpacing: string;
277
+ };
278
+ 37: {
279
+ fontSize: string;
280
+ lineHeight: string;
281
+ letterSpacing: string;
282
+ };
283
+ 34: {
284
+ fontSize: string;
285
+ lineHeight: string;
286
+ letterSpacing: string;
287
+ };
288
+ 31: {
289
+ fontSize: string;
290
+ lineHeight: string;
291
+ letterSpacing: string;
292
+ };
293
+ 29: {
294
+ fontSize: string;
295
+ lineHeight: string;
296
+ letterSpacing: string;
297
+ };
298
+ 27: {
299
+ fontSize: string;
300
+ lineHeight: string;
301
+ letterSpacing: string;
302
+ };
303
+ 25: {
304
+ fontSize: string;
305
+ lineHeight: string;
306
+ letterSpacing: string;
307
+ };
308
+ 23: {
309
+ fontSize: string;
310
+ lineHeight: string;
311
+ letterSpacing: string;
312
+ };
313
+ 22: {
314
+ fontSize: string;
315
+ lineHeight: string;
316
+ letterSpacing: string;
317
+ };
318
+ 20: {
319
+ fontSize: string;
320
+ lineHeight: string;
321
+ letterSpacing: string;
322
+ };
323
+ 19: {
324
+ fontSize: string;
325
+ lineHeight: string;
326
+ letterSpacing: string;
327
+ };
328
+ 18: {
329
+ fontSize: string;
330
+ lineHeight: string;
331
+ letterSpacing: string;
332
+ };
333
+ 16: {
334
+ fontSize: string;
335
+ lineHeight: string;
336
+ letterSpacing: string;
337
+ };
338
+ 15: {
339
+ fontSize: string;
340
+ lineHeight: string;
341
+ letterSpacing: string;
342
+ };
343
+ 14: {
344
+ fontSize: string;
345
+ lineHeight: string;
346
+ letterSpacing: string;
347
+ };
348
+ 13: {
349
+ fontSize: string;
350
+ lineHeight: string;
351
+ letterSpacing: string;
352
+ };
353
+ 12: {
354
+ fontSize: string;
355
+ lineHeight: string;
356
+ };
357
+ };
358
+ };
@@ -0,0 +1,349 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typography = void 0;
4
+ const themes_1 = require("./themes");
5
+ const sizing_1 = require("./sizing");
6
+ const spacing_1 = require("./spacing");
7
+ const breakpoints_1 = require("./breakpoints");
8
+ const baseFontSize = 16;
9
+ function round(value) {
10
+ return value
11
+ .toFixed(7)
12
+ .replace(/(\.[0-9]+?)0+$/, '$1') // remove trailing zeroes after decimals
13
+ .replace(/\.0$/, ''); // remove any remaining zeroes
14
+ }
15
+ function rem(px) {
16
+ return `${round(px / baseFontSize)}rem`;
17
+ }
18
+ const fontFaces = {
19
+ black: 'Inter-Black',
20
+ semiBold: 'Inter-SemiBold',
21
+ medium: 'Inter-Medium',
22
+ regular: 'Inter-Regular',
23
+ mono: 'Menlo-Regular',
24
+ };
25
+ const defaultFontStack = "system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'";
26
+ const defaultMonoStack = "Monaco,Consolas,'Liberation Mono','Courier New',monospace, 'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'";
27
+ const fontStacks = {
28
+ black: `${fontFaces.black}, ${defaultFontStack}`,
29
+ semiBold: `${fontFaces.semiBold}, ${defaultFontStack}`,
30
+ medium: `${fontFaces.medium}, ${defaultFontStack}`,
31
+ regular: `${fontFaces.regular}, ${defaultFontStack}`,
32
+ mono: `${fontFaces.mono}, ${defaultMonoStack}`,
33
+ };
34
+ const fontSizes = {
35
+ 61: {
36
+ fontSize: rem(61),
37
+ lineHeight: round(73 / 61),
38
+ letterSpacing: rem(-0.022 * baseFontSize),
39
+ },
40
+ 53: {
41
+ fontSize: rem(53),
42
+ lineHeight: round(64 / 53),
43
+ letterSpacing: rem(-0.022 * baseFontSize),
44
+ },
45
+ 49: {
46
+ fontSize: rem(49),
47
+ lineHeight: round(59 / 49),
48
+ letterSpacing: rem(-0.022 * baseFontSize),
49
+ },
50
+ 46: {
51
+ fontSize: rem(46),
52
+ lineHeight: round(55 / 46),
53
+ letterSpacing: rem(-0.022 * baseFontSize),
54
+ },
55
+ 43: {
56
+ fontSize: rem(43),
57
+ lineHeight: round(52 / 43),
58
+ letterSpacing: rem(-0.022 * baseFontSize),
59
+ },
60
+ 39: {
61
+ fontSize: rem(39),
62
+ lineHeight: round(51 / 39),
63
+ letterSpacing: rem(-0.022 * baseFontSize),
64
+ },
65
+ 37: {
66
+ fontSize: rem(37),
67
+ lineHeight: round(48 / 37),
68
+ letterSpacing: rem(-0.022 * baseFontSize),
69
+ },
70
+ 34: {
71
+ fontSize: rem(34),
72
+ lineHeight: round(44 / 34),
73
+ letterSpacing: rem(-0.022 * baseFontSize),
74
+ },
75
+ 31: {
76
+ fontSize: rem(31),
77
+ lineHeight: round(40 / 31),
78
+ letterSpacing: rem(-0.021 * baseFontSize),
79
+ },
80
+ 29: {
81
+ fontSize: rem(29),
82
+ lineHeight: round(38 / 29),
83
+ letterSpacing: rem(-0.021 * baseFontSize),
84
+ },
85
+ 27: {
86
+ fontSize: rem(27),
87
+ lineHeight: round(36 / 27),
88
+ letterSpacing: rem(-0.021 * baseFontSize),
89
+ },
90
+ 25: {
91
+ fontSize: rem(25),
92
+ lineHeight: round(35 / 25),
93
+ letterSpacing: rem(-0.021 * baseFontSize),
94
+ },
95
+ 23: {
96
+ fontSize: rem(23),
97
+ lineHeight: round(32 / 23),
98
+ letterSpacing: rem(-0.019 * baseFontSize),
99
+ },
100
+ 22: {
101
+ fontSize: rem(22),
102
+ lineHeight: round(31 / 22),
103
+ letterSpacing: rem(-0.018 * baseFontSize),
104
+ },
105
+ 20: {
106
+ fontSize: rem(20),
107
+ lineHeight: round(30 / 20),
108
+ letterSpacing: rem(-0.017 * baseFontSize),
109
+ },
110
+ 19: {
111
+ fontSize: rem(19),
112
+ lineHeight: round(29 / 19),
113
+ letterSpacing: rem(-0.015 * baseFontSize),
114
+ },
115
+ 18: {
116
+ fontSize: rem(18),
117
+ lineHeight: round(28 / 18),
118
+ letterSpacing: rem(-0.014 * baseFontSize),
119
+ },
120
+ 16: {
121
+ fontSize: rem(16),
122
+ lineHeight: round(26 / 16),
123
+ letterSpacing: rem(-0.011 * baseFontSize),
124
+ },
125
+ 15: {
126
+ fontSize: rem(15),
127
+ lineHeight: round(24 / 15),
128
+ letterSpacing: rem(-0.009 * baseFontSize),
129
+ },
130
+ 14: {
131
+ fontSize: rem(14),
132
+ lineHeight: round(22 / 14),
133
+ letterSpacing: rem(-0.006 * baseFontSize),
134
+ },
135
+ 13: {
136
+ fontSize: rem(13),
137
+ lineHeight: round(21 / 13),
138
+ letterSpacing: rem(-0.003 * baseFontSize),
139
+ },
140
+ 12: { fontSize: rem(12), lineHeight: round(19 / 12) },
141
+ };
142
+ const headers = {
143
+ huge: {
144
+ fontFamily: fontStacks.black,
145
+ fontWeight: 900,
146
+ ...fontSizes[61],
147
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[53],
148
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px`]: fontSizes[46],
149
+ },
150
+ h1: {
151
+ fontFamily: fontStacks.semiBold,
152
+ fontWeight: 500,
153
+ ...fontSizes[49],
154
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[43],
155
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[37],
156
+ },
157
+ h2: {
158
+ fontFamily: fontStacks.semiBold,
159
+ fontWeight: 500,
160
+ ...fontSizes[39],
161
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[34],
162
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[29],
163
+ },
164
+ h3: {
165
+ fontFamily: fontStacks.semiBold,
166
+ fontWeight: 500,
167
+ ...fontSizes[31],
168
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[27],
169
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[23],
170
+ },
171
+ h4: {
172
+ fontFamily: fontStacks.medium,
173
+ fontWeight: 500,
174
+ ...fontSizes[25],
175
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[22],
176
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[19],
177
+ },
178
+ h5: {
179
+ fontFamily: fontStacks.medium,
180
+ fontWeight: 500,
181
+ ...fontSizes[20],
182
+ [`@media (max-width: ${breakpoints_1.breakpoints.medium}px)`]: fontSizes[18],
183
+ [`@media (max-width: ${breakpoints_1.breakpoints.small}px)`]: fontSizes[16],
184
+ },
185
+ h6: {
186
+ fontFamily: fontStacks.medium,
187
+ fontWeight: 500,
188
+ ...fontSizes[16],
189
+ },
190
+ };
191
+ const baseStyle = {
192
+ fontFamily: fontStacks.regular,
193
+ fontWeight: 400,
194
+ ...fontSizes[16],
195
+ };
196
+ const body = {
197
+ headline: {
198
+ fontFamily: fontStacks.medium,
199
+ fontWeight: 400,
200
+ ...fontSizes[16],
201
+ },
202
+ paragraph: baseStyle,
203
+ label: {
204
+ fontFamily: fontStacks.medium,
205
+ fontWeight: 400,
206
+ ...fontSizes[15],
207
+ },
208
+ callout: {
209
+ fontFamily: fontStacks.regular,
210
+ fontWeight: 400,
211
+ ...fontSizes[14],
212
+ },
213
+ footnote: {
214
+ fontFamily: fontStacks.regular,
215
+ fontWeight: 400,
216
+ ...fontSizes[13],
217
+ },
218
+ caption: {
219
+ fontFamily: fontStacks.regular,
220
+ fontWeight: 400,
221
+ ...fontSizes[12],
222
+ },
223
+ code: {
224
+ fontFamily: fontStacks.mono,
225
+ fontWeight: 400,
226
+ ...fontSizes[13],
227
+ },
228
+ ul: {
229
+ marginLeft: rem(1.5),
230
+ 'ol, ul': {
231
+ marginTop: rem(0.5),
232
+ marginBottom: rem(1),
233
+ },
234
+ },
235
+ ol: {
236
+ marginLeft: rem(1.5),
237
+ 'ol, ul': {
238
+ marginTop: rem(0.5),
239
+ marginBottom: rem(1),
240
+ },
241
+ },
242
+ li: {
243
+ ...baseStyle,
244
+ marginBottom: rem(0.5),
245
+ },
246
+ blockquote: {
247
+ ...baseStyle,
248
+ color: themes_1.theme.text.secondary,
249
+ paddingLeft: spacing_1.spacing[4],
250
+ borderLeft: `${spacing_1.spacing[1]}px solid ${themes_1.theme.border.default}`,
251
+ },
252
+ };
253
+ const utility = {
254
+ anchor: {
255
+ color: themes_1.theme.link.default,
256
+ fontWeight: 400,
257
+ textDecoration: 'none',
258
+ cursor: 'pointer',
259
+ opacity: 1,
260
+ // transform prevents a 1px shift on hover on Safari
261
+ transform: 'translate3d(0,0,0)',
262
+ ':visited': {
263
+ color: themes_1.theme.link.default,
264
+ },
265
+ ':hover': {
266
+ transition: '200ms',
267
+ opacity: 0.8,
268
+ },
269
+ },
270
+ inlineCode: {
271
+ ...body.code,
272
+ fontWeight: 400,
273
+ display: 'inline-block',
274
+ backgroundColor: themes_1.theme.background.secondary,
275
+ border: `1px solid ${themes_1.theme.border.default}`,
276
+ borderRadius: sizing_1.borderRadius.medium,
277
+ padding: '2px 4px',
278
+ lineHeight: '130%',
279
+ },
280
+ terminalCode: {
281
+ ...body.code,
282
+ fontWeight: 400,
283
+ display: 'inline-block',
284
+ backgroundColor: themes_1.darkTheme.background.secondary,
285
+ color: themes_1.darkTheme.text.default,
286
+ border: `1px solid ${themes_1.darkTheme.border.default}`,
287
+ borderRadius: sizing_1.borderRadius.medium,
288
+ padding: '2px 4px',
289
+ lineHeight: '130%',
290
+ },
291
+ pre: {
292
+ ...body.code,
293
+ fontWeight: 400,
294
+ backgroundColor: themes_1.theme.background.secondary,
295
+ borderRadius: sizing_1.borderRadius.medium,
296
+ border: `1px solid ${themes_1.theme.border.default}`,
297
+ padding: spacing_1.spacing[4],
298
+ whiteSpace: 'pre-wrap',
299
+ margin: `${spacing_1.spacing[4]}px 0`,
300
+ },
301
+ terminalPre: {
302
+ ...body.code,
303
+ fontWeight: 400,
304
+ backgroundColor: themes_1.darkTheme.background.secondary,
305
+ color: themes_1.darkTheme.text.default,
306
+ borderRadius: sizing_1.borderRadius.medium,
307
+ border: `1px solid ${themes_1.darkTheme.border.default}`,
308
+ padding: spacing_1.spacing[4],
309
+ margin: `${spacing_1.spacing[4]}px 0`,
310
+ whiteSpace: 'pre-wrap',
311
+ '&:before': {
312
+ content: '"➜ "',
313
+ },
314
+ },
315
+ hr: {
316
+ backgroundColor: themes_1.theme.border.default,
317
+ border: 0,
318
+ height: 1,
319
+ display: 'block',
320
+ width: '100%',
321
+ },
322
+ weight: {
323
+ black: {
324
+ fontFamily: fontStacks.black,
325
+ fontWeight: 900,
326
+ },
327
+ semiBold: {
328
+ fontFamily: fontStacks.semiBold,
329
+ fontWeight: 500,
330
+ },
331
+ medium: {
332
+ fontFamily: fontStacks.medium,
333
+ fontWeight: 500,
334
+ },
335
+ regular: {
336
+ fontFamily: fontStacks.regular,
337
+ fontWeight: 400,
338
+ },
339
+ },
340
+ };
341
+ exports.typography = {
342
+ baseFontSize,
343
+ headers,
344
+ body,
345
+ utility,
346
+ fontFaces,
347
+ fontStacks,
348
+ fontSizes,
349
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/styleguide",
3
- "version": "3.4.1",
3
+ "version": "3.4.2-alpha.3",
4
4
  "description": "Foundational styles for Expo interfaces.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,5 +37,5 @@
37
37
  "peerDependencies": {
38
38
  "react": "*"
39
39
  },
40
- "gitHead": "729f74893412c374f7e953da8f3ee981bdf2c0b6"
40
+ "gitHead": "292345f8b3405ee9d690b1dcea1d31a9eb15fc2e"
41
41
  }