@khanacademy/wonder-blocks-typography 1.1.25

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Khan Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,460 @@
1
+ import _extends from '@babel/runtime/helpers/extends';
2
+ import { StyleSheet } from 'aphrodite';
3
+ import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
4
+ import { Component, createElement } from 'react';
5
+ import { Text } from '@khanacademy/wonder-blocks-core';
6
+
7
+ const Regular = 400;
8
+ const Bold = 700;
9
+ const Black = 900;
10
+ const mobile = "@media (max-width: 1023px)";
11
+ const desktop = "@media (min-width: 1024px)";
12
+ const common = {
13
+ display: "block"
14
+ };
15
+ const SansFamily = 'Lato, "Noto Sans", sans-serif'; // TODO(kevinb): Use Minion Pro here
16
+
17
+ const SerifFamily = '"Noto Serif", serif';
18
+ const InconsolataFamily = "Inconsolata, monospace";
19
+ const styles = StyleSheet.create({
20
+ Title: _extends({}, common, {
21
+ fontFamily: SansFamily,
22
+ fontWeight: Black,
23
+ [desktop]: {
24
+ fontSize: 36,
25
+ lineHeight: "40px"
26
+ },
27
+ [mobile]: {
28
+ fontSize: 28,
29
+ lineHeight: "32px"
30
+ }
31
+ }),
32
+ Tagline: _extends({}, common, {
33
+ fontFamily: SansFamily,
34
+ fontWeight: Regular,
35
+ fontSize: 20,
36
+ lineHeight: "24px"
37
+ }),
38
+ HeadingLarge: _extends({}, common, {
39
+ fontFamily: SansFamily,
40
+ fontWeight: Bold,
41
+ [desktop]: {
42
+ fontSize: 28,
43
+ lineHeight: "32px"
44
+ },
45
+ [mobile]: {
46
+ fontSize: 24,
47
+ lineHeight: "28px"
48
+ }
49
+ }),
50
+ HeadingMedium: _extends({}, common, {
51
+ fontFamily: SansFamily,
52
+ fontWeight: Bold,
53
+ [desktop]: {
54
+ fontSize: 24,
55
+ lineHeight: "28px"
56
+ },
57
+ [mobile]: {
58
+ fontSize: 22,
59
+ lineHeight: "26px"
60
+ }
61
+ }),
62
+ HeadingSmall: _extends({}, common, {
63
+ fontFamily: SansFamily,
64
+ fontWeight: Bold,
65
+ fontSize: 20,
66
+ lineHeight: "24px"
67
+ }),
68
+ HeadingXSmall: _extends({}, common, {
69
+ fontFamily: SansFamily,
70
+ fontWeight: Bold,
71
+ fontSize: 12,
72
+ lineHeight: "16px",
73
+ letterSpacing: 0.6,
74
+ textTransform: "uppercase"
75
+ }),
76
+ BodySerifBlock: _extends({}, common, {
77
+ fontFamily: SerifFamily,
78
+ fontWeight: Regular,
79
+ fontSize: 22,
80
+ lineHeight: "28px"
81
+ }),
82
+ BodySerif: _extends({}, common, {
83
+ fontFamily: SerifFamily,
84
+ fontWeight: Regular,
85
+ fontSize: 18,
86
+ lineHeight: "22px"
87
+ }),
88
+ BodyMonospace: _extends({}, common, {
89
+ fontFamily: InconsolataFamily,
90
+ fontWeight: Regular,
91
+ fontSize: 17,
92
+ lineHeight: "22px"
93
+ }),
94
+ Body: _extends({}, common, {
95
+ fontFamily: SansFamily,
96
+ fontWeight: Regular,
97
+ fontSize: 16,
98
+ lineHeight: "22px"
99
+ }),
100
+ LabelLarge: _extends({}, common, {
101
+ fontFamily: SansFamily,
102
+ fontWeight: Bold,
103
+ fontSize: 16,
104
+ lineHeight: "20px"
105
+ }),
106
+ LabelMedium: _extends({}, common, {
107
+ fontFamily: SansFamily,
108
+ fontWeight: Regular,
109
+ fontSize: 16,
110
+ lineHeight: "20px"
111
+ }),
112
+ LabelSmall: _extends({}, common, {
113
+ fontFamily: SansFamily,
114
+ fontWeight: Regular,
115
+ fontSize: 14,
116
+ lineHeight: "18px"
117
+ }),
118
+ LabelXSmall: _extends({}, common, {
119
+ fontFamily: SansFamily,
120
+ fontWeight: Regular,
121
+ fontSize: 12,
122
+ lineHeight: "16px"
123
+ }),
124
+ Caption: _extends({}, common, {
125
+ fontFamily: SansFamily,
126
+ fontWeight: Regular,
127
+ fontSize: 14,
128
+ lineHeight: "20px"
129
+ }),
130
+ Footnote: _extends({}, common, {
131
+ fontFamily: SansFamily,
132
+ fontWeight: Regular,
133
+ fontSize: 12,
134
+ lineHeight: "18px"
135
+ })
136
+ });
137
+
138
+ const _excluded = ["style", "children"];
139
+ // TODO(alex): Once style prop validation works, if all of the style prop flow
140
+ // types are the same then switch to using functional components.
141
+ class Title extends Component {
142
+ render() {
143
+ const _this$props = this.props,
144
+ {
145
+ style,
146
+ children
147
+ } = _this$props,
148
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
149
+
150
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
151
+ style: [styles.Title, style]
152
+ }), children);
153
+ }
154
+
155
+ }
156
+ Title.defaultProps = {
157
+ tag: "h1"
158
+ };
159
+
160
+ const _excluded$1 = ["style", "children"];
161
+ class HeadingLarge extends Component {
162
+ render() {
163
+ const _this$props = this.props,
164
+ {
165
+ style,
166
+ children
167
+ } = _this$props,
168
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
169
+
170
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
171
+ style: [styles.HeadingLarge, style]
172
+ }), children);
173
+ }
174
+
175
+ }
176
+ HeadingLarge.defaultProps = {
177
+ tag: "h2"
178
+ };
179
+
180
+ const _excluded$2 = ["style", "children"];
181
+ class HeadingMedium extends Component {
182
+ render() {
183
+ const _this$props = this.props,
184
+ {
185
+ style,
186
+ children
187
+ } = _this$props,
188
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
189
+
190
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
191
+ style: [styles.HeadingMedium, style]
192
+ }), children);
193
+ }
194
+
195
+ }
196
+ HeadingMedium.defaultProps = {
197
+ tag: "h3"
198
+ };
199
+
200
+ const _excluded$3 = ["style", "children"];
201
+ class HeadingSmall extends Component {
202
+ render() {
203
+ const _this$props = this.props,
204
+ {
205
+ style,
206
+ children
207
+ } = _this$props,
208
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
209
+
210
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
211
+ style: [styles.HeadingSmall, style]
212
+ }), children);
213
+ }
214
+
215
+ }
216
+ HeadingSmall.defaultProps = {
217
+ tag: "h4"
218
+ };
219
+
220
+ const _excluded$4 = ["style", "children"];
221
+ class HeadingXSmall extends Component {
222
+ render() {
223
+ const _this$props = this.props,
224
+ {
225
+ style,
226
+ children
227
+ } = _this$props,
228
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$4);
229
+
230
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
231
+ style: [styles.HeadingXSmall, style]
232
+ }), children);
233
+ }
234
+
235
+ }
236
+ HeadingXSmall.defaultProps = {
237
+ tag: "h4"
238
+ };
239
+
240
+ const _excluded$5 = ["style", "children"];
241
+ class BodySerifBlock extends Component {
242
+ render() {
243
+ const _this$props = this.props,
244
+ {
245
+ style,
246
+ children
247
+ } = _this$props,
248
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$5);
249
+
250
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
251
+ style: [styles.BodySerifBlock, style]
252
+ }), children);
253
+ }
254
+
255
+ }
256
+ BodySerifBlock.defaultProps = {
257
+ tag: "span"
258
+ };
259
+
260
+ const _excluded$6 = ["style", "children"];
261
+ class BodySerif extends Component {
262
+ render() {
263
+ const _this$props = this.props,
264
+ {
265
+ style,
266
+ children
267
+ } = _this$props,
268
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$6);
269
+
270
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
271
+ style: [styles.BodySerif, style]
272
+ }), children);
273
+ }
274
+
275
+ }
276
+ BodySerif.defaultProps = {
277
+ tag: "span"
278
+ };
279
+
280
+ const _excluded$7 = ["style", "children"];
281
+ class BodyMonospace extends Component {
282
+ render() {
283
+ const _this$props = this.props,
284
+ {
285
+ style,
286
+ children
287
+ } = _this$props,
288
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$7);
289
+
290
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
291
+ style: [styles.BodyMonospace, style]
292
+ }), children);
293
+ }
294
+
295
+ }
296
+ BodyMonospace.defaultProps = {
297
+ tag: "span"
298
+ };
299
+
300
+ const _excluded$8 = ["style", "children"];
301
+ class Body extends Component {
302
+ render() {
303
+ const _this$props = this.props,
304
+ {
305
+ style,
306
+ children
307
+ } = _this$props,
308
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$8);
309
+
310
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
311
+ style: [styles.Body, style]
312
+ }), children);
313
+ }
314
+
315
+ }
316
+ Body.defaultProps = {
317
+ tag: "span"
318
+ };
319
+
320
+ const _excluded$9 = ["style", "children"];
321
+ class LabelLarge extends Component {
322
+ render() {
323
+ const _this$props = this.props,
324
+ {
325
+ style,
326
+ children
327
+ } = _this$props,
328
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$9);
329
+
330
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
331
+ style: [styles.LabelLarge, style]
332
+ }), children);
333
+ }
334
+
335
+ }
336
+ LabelLarge.defaultProps = {
337
+ tag: "span"
338
+ };
339
+
340
+ const _excluded$a = ["style", "children"];
341
+ class LabelMedium extends Component {
342
+ render() {
343
+ const _this$props = this.props,
344
+ {
345
+ style,
346
+ children
347
+ } = _this$props,
348
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$a);
349
+
350
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
351
+ style: [styles.LabelMedium, style]
352
+ }), children);
353
+ }
354
+
355
+ }
356
+ LabelMedium.defaultProps = {
357
+ tag: "span"
358
+ };
359
+
360
+ const _excluded$b = ["style", "children"];
361
+ class LabelSmall extends Component {
362
+ render() {
363
+ const _this$props = this.props,
364
+ {
365
+ style,
366
+ children
367
+ } = _this$props,
368
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$b);
369
+
370
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
371
+ style: [styles.LabelSmall, style]
372
+ }), children);
373
+ }
374
+
375
+ }
376
+ LabelSmall.defaultProps = {
377
+ tag: "span"
378
+ };
379
+
380
+ const _excluded$c = ["style", "children"];
381
+ class LabelXSmall extends Component {
382
+ render() {
383
+ const _this$props = this.props,
384
+ {
385
+ style,
386
+ children
387
+ } = _this$props,
388
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$c);
389
+
390
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
391
+ style: [styles.LabelXSmall, style]
392
+ }), children);
393
+ }
394
+
395
+ }
396
+ LabelXSmall.defaultProps = {
397
+ tag: "span"
398
+ };
399
+
400
+ const _excluded$d = ["style", "children"];
401
+ class Tagline extends Component {
402
+ render() {
403
+ const _this$props = this.props,
404
+ {
405
+ style,
406
+ children
407
+ } = _this$props,
408
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$d);
409
+
410
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
411
+ style: [styles.Tagline, style]
412
+ }), children);
413
+ }
414
+
415
+ }
416
+ Tagline.defaultProps = {
417
+ tag: "span"
418
+ };
419
+
420
+ const _excluded$e = ["style", "children"];
421
+ class Caption extends Component {
422
+ render() {
423
+ const _this$props = this.props,
424
+ {
425
+ style,
426
+ children
427
+ } = _this$props,
428
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$e);
429
+
430
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
431
+ style: [styles.Caption, style]
432
+ }), children);
433
+ }
434
+
435
+ }
436
+ Caption.defaultProps = {
437
+ tag: "span"
438
+ };
439
+
440
+ const _excluded$f = ["style", "children"];
441
+ class Footnote extends Component {
442
+ render() {
443
+ const _this$props = this.props,
444
+ {
445
+ style,
446
+ children
447
+ } = _this$props,
448
+ otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$f);
449
+
450
+ return /*#__PURE__*/createElement(Text, _extends({}, otherProps, {
451
+ style: [styles.Footnote, style]
452
+ }), children);
453
+ }
454
+
455
+ }
456
+ Footnote.defaultProps = {
457
+ tag: "span"
458
+ };
459
+
460
+ export { Body, BodyMonospace, BodySerif, BodySerifBlock, Caption, Footnote, HeadingLarge, HeadingMedium, HeadingSmall, HeadingXSmall, LabelLarge, LabelMedium, LabelSmall, LabelXSmall, Tagline, Title, styles };