UNPKG

11.8 kBSCSSView Raw
1@charset "utf-8"; // foreign characters ahead (in KSS markup)
2
3// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
4// Licensed under the BSD-3 License as modified (the “License”); you may obtain a copy
5// of the license at https://github.com/palantir/blueprint/blob/master/LICENSE
6// and https://github.com/palantir/blueprint/blob/master/PATENTS
7
8@import "common/variables";
9@import "common/mixins";
10@import "common/icons";
11
12/*
13Typography
14
15Weight: 2
16
17Styleguide typography
18*/
19
20hr {
21 margin: ($pt-grid-size * 2) 0;
22 border: none;
23 border-bottom: 1px solid $pt-divider-black;
24
25 .pt-dark & {
26 border-color: $pt-dark-divider-white;
27 }
28}
29
30// consistent cross-browser text selection
31::selection {
32 background: $pt-text-selection-color;
33}
34
35/*
36Usage
37
38Keep in mind these general web typography guidelines when building your applications.
39
40- The default text color in all components is compliant with the recommended [WCAG 2.0](https://www.w3.org/TR/WCAG20/)
41 minimum contrast ratio.
42- If you choose to go with a custom text color, make sure the background behind it provides
43 proper contrast.
44- Try not to explicitly write pixel values for your font-size or line-height CSS rules. Instead, reference
45 the classes and variables we provide in Blueprint (`.pt-ui-text`, `$pt-font-size-large`, etc.).
46
47Weight: 2
48
49Styleguide typography.usage
50*/
51
52body {
53 @include base-typography();
54
55 color: $pt-text-color;
56}
57
58small {
59 font-size: $pt-font-size-small;
60}
61
62/*
63Fonts
64
65Blueprint does not include any fonts of its own; it will use the default sans-serif operating system font.
66We provide a class to use the default monospace font instead.
67
68Markup:
69<div class="{{.modifier}}">Blueprint components react overlay date picker.</div>
70
71.pt-monospace-text - Use a monospace font (ideal for code)
72
73Weight: 1
74
75Styleguide typography.fonts
76*/
77
78.pt-monospace-text {
79 @include monospace-typography();
80}
81
82/*
83Headings
84
85Markup:
86<h1>H1 heading</h1>
87<h2>H2 heading</h2>
88<h3>H3 heading</h3>
89<h4>H4 heading</h4>
90<h5>H5 heading</h5>
91<h6>H6 heading</h6>
92
93Weight: 3
94
95Styleguide typography.headings
96*/
97
98$headers: (
99 "h1": (40px, 0.8em),
100 "h2": (27px, 0.8em),
101 "h3": (24px, 0.8em),
102 "h4": (20px, 0.9em),
103 "h5": (17px, 0.9em),
104 "h6": (15px, 0.9em)
105);
106
107@each $header, $props in $headers {
108 #{$header} {
109 @include header-typography();
110
111 margin: 0 0 $pt-grid-size;
112 padding: 0;
113 line-height: nth($props, 2);
114 font-size: nth($props, 1);
115 }
116}
117
118/*
119UI text
120
121The base font size for Blueprint web applications is 14px. This should be the default type size
122for most short strings of text which are not headings or titles. If you wish to reset some
123element's font size and line height to the default base styles, use the `.pt-ui-text` class.
124For longer running text, see [running text styles](#typography.running-text).
125
126Markup:
127<div class="{{.modifier}}">Blueprint components react overlay date picker.</div>
128
129.pt-ui-text - Default UI text. This is applied to the document body as part of core styles.
130.pt-ui-text-large - Larger UI text.
131
132Weight: 4
133
134Styleguide typography.ui-text
135*/
136
137.pt-ui-text {
138 @include base-typography();
139}
140
141.pt-ui-text-large {
142 line-height: 1.25;
143 font-size: $pt-font-size-large;
144}
145
146/*
147Running text
148
149Large blocks of _running text_ should use `.pt-running-text` styles.
150
151Note that `<p>` elements by default don't add any styles; they just inherit the base typography. This is a
152conservative design; `<p>` elements are so ubiquitous that they're more often used for UI text than long form text.
153It's up to the user to decide which blocks of text in an application should get running text styles.
154
155Markup:
156<p>
157 Default paragraphs have base typography styles.
158</p>
159<p class="pt-running-text">
160 Running text is larger and more spaced out.
161 <br />
162 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
163 magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
164 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
165 <br />
166 <a href="#">Excepteur sint occaecat cupidatat non proident.</a>
167</p>
168<div class="pt-running-text">
169 Includes support for <strong>strong</strong>, <em>emphasized</em>, and <u>underlined</u> text.
170 <a href="#">Also links!</a>
171</div>
172
173Weight: 5
174
175Styleguide typography.running-text
176*/
177
178.pt-running-text {
179 @include running-typography();
180
181 @each $header, $props in $headers {
182 #{$header} {
183 margin-top: $pt-grid-size * 4;
184 margin-bottom: $pt-grid-size * 2;
185 }
186 }
187}
188
189.pt-running-text-small {
190 @include running-typography-small();
191}
192
193p {
194 margin: 0 0 $pt-grid-size;
195 padding: 0;
196}
197
198/*
199Links
200
201Simply use an `<a href="">` tag as you normally would. No class is necessary for Blueprint styles. Links are
202underlined only when hovered.
203
204Putting an icon inside a link will cause it to inherit the link's text color.
205
206Weight: 8
207
208Styleguide typography.links
209*/
210
211a {
212 text-decoration: none;
213 color: $pt-link-color;
214
215 &:hover {
216 cursor: pointer;
217 text-decoration: underline;
218 color: $pt-link-color;
219 }
220
221 #{$icon-classes} {
222 color: inherit;
223 }
224
225 code,
226 .pt-dark & code {
227 color: inherit;
228 }
229
230 .pt-dark &,
231 .pt-dark &:hover {
232 color: $pt-dark-link-color;
233
234 #{$icon-classes} {
235 color: inherit;
236 }
237 }
238}
239
240/*
241Preformatted text
242
243Use `<pre>` for code blocks, and `<code>` for inline code. Note that `<pre>` blocks will
244retain _all_ whitespace so you'll have to format the content accordingly.
245
246Markup:
247<code>$ npm install</code>
248<pre>
249%pt-select {
250 @include pt-button();
251 @include prefixer(appearance, none, webkit moz);
252 border-radius: $pt-border-radius;
253 height: $pt-button-height;
254 padding: 0 ($input-padding-horizontal * 3) 0 $input-padding-horizontal;
255}
256</pre>
257<pre><code>export function hasModifier(modifiers: ts.ModifiersArray, ...modifierKinds: ts.SyntaxKind[]) {
258 if (modifiers == null || modifierKinds == null) {
259 return false;
260 }
261 return modifiers.some((m) => {
262 return modifierKinds.some((k) => m.kind === k);
263 });
264}</code></pre>
265
266Weight: 6
267
268Styleguide typography.preformatted
269*/
270
271pre,
272code {
273 @include monospace-typography();
274}
275
276code {
277 border-radius: $pt-border-radius;
278 box-shadow: inset border-shadow(0.2);
279 background: $pt-code-background-color;
280 padding: 2px 5px;
281 color: $pt-code-text-color;
282
283 .pt-dark & {
284 box-shadow: inset border-shadow(0.4);
285 background: $pt-dark-code-background-color;
286 color: $pt-dark-code-text-color;
287 }
288}
289
290pre {
291 display: block;
292 margin: $pt-grid-size 0;
293 border-radius: $pt-border-radius;
294 box-shadow: inset 0 0 0 1px $pt-divider-black;
295 background: $pt-code-background-color;
296 padding: ($pt-grid-size * 1.3) ($pt-grid-size * 1.5) ($pt-grid-size * 1.2);
297 line-height: 1.4;
298 color: $pt-text-color;
299 word-break: break-all;
300 word-wrap: break-word;
301
302 > code {
303 border-radius: 0;
304 box-shadow: none;
305 background: transparent;
306 padding: 0;
307 white-space: pre-wrap;
308 color: inherit;
309 font-size: inherit;
310 }
311
312 .pt-dark & {
313 box-shadow: inset 0 0 0 1px $pt-dark-divider-black;
314 background: $pt-dark-code-background-color;
315 color: $pt-dark-text-color;
316
317 > code {
318 box-shadow: none;
319 background: transparent;
320 }
321 }
322}
323
324/*
325Block quotes
326
327Block quotes are treated as running text.
328
329Markup:
330<blockquote>
331 <p>
332 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
333 magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
334 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
335 </p>
336 <p>
337 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
338 magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
339 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
340 </p>
341</blockquote>
342
343Weight: 7
344
345Styleguide typography.blockquotes
346*/
347
348blockquote {
349 @include running-typography();
350 margin: 0 0 $pt-grid-size;
351 border-left: solid 4px rgba($gray4, 0.5);
352 padding: 0 ($pt-grid-size * 2);
353
354 p:last-child {
355 margin-bottom: 0;
356 }
357
358 .pt-dark & {
359 border-color: rgba($gray2, 0.5);
360 }
361}
362
363/*
364Lists
365
366Blueprint provides a small amount of global styling and a few modifier classes for list elements.
367
368`<ul>` and `<ol>` elements in blocks with the `.pt-running-text` modifier class will
369automatically assume the `.pt-list` styles to promote readability.
370
371Markup:
372<ul class="{{.modifier}}">
373 <li>Item the first</li>
374 <li>Item the second</li>
375 <li>Item the third</li>
376</ul>
377<ol class="{{.modifier}}">
378 <li>Item the first</li>
379 <li>Item the second</li>
380 <li>Item the third</li>
381</ol>
382
383.pt-list - Add a little spacing between items for readability.
384.pt-list-unstyled - Remove all list styling (including indicators) so you can add your own.
385
386Weight: 8
387
388Styleguide typography.lists
389*/
390
391ol,
392ul {
393 margin: $pt-grid-size 0;
394 padding-left: $pt-grid-size * 4;
395}
396
397.pt-list,
398.pt-running-text ul,
399.pt-running-text ol {
400 li:not(:last-child) {
401 padding-bottom: $pt-grid-size / 2;
402 }
403
404 // remove bottom margin on final element in list item because list items put their own spacing
405 li :last-child {
406 margin-bottom: 0;
407 }
408
409 ol,
410 ul {
411 margin-top: $pt-grid-size / 2;
412 }
413}
414
415.pt-list-unstyled {
416 margin: 0;
417 padding: 0;
418 list-style: none;
419
420 li {
421 padding: 0;
422 }
423}
424
425/*
426Text utilities
427
428Blueprint provides a small handful of class-based text utilities which can applied to any element that contains text.
429
430Markup:
431<div class="{{.modifier}}" style="width: 320px;">
432 Blueprint components react overlay date picker. Breadcrumbs dialog progress non-ideal state.
433</div>
434
435.pt-text-muted - Changes text color to a gentler gray.
436.pt-text-overflow-ellipsis - Truncates a single line of text with an ellipsis if it overflows its container.
437
438Weight: 9
439
440Styleguide typography.utilities
441*/
442
443.pt-text-muted {
444 color: $pt-text-color-muted;
445
446 .pt-dark & {
447 color: $pt-dark-text-color-muted;
448 }
449}
450
451.pt-text-overflow-ellipsis {
452 @include overflow-ellipsis();
453}
454
455/*
456Internationalization
457
458Weight: 10
459
460Styleguide typography.intl
461*/
462
463/*
464Right-to-left text
465
466Use the utility class `.pt-rtl`.
467
468Markup:
469<h4>Arabic:</h4>
470<p class="pt-rtl">
471 لكل لأداء بمحاولة من. مدينة الواقعة يبق أي, وإعلان وقوعها، حول كل, حدى عجّل مشروط الخاسرة قد.
472 من الذود تكبّد بين, و لها واحدة الأراضي. عل الصفحة والروسية يتم, أي للحكومة استعملت شيء. أم وصل زهاء اليا
473</p>
474<h4>Hebrew:</h4>
475<p class="pt-rtl">
476 כדי על עזרה יידיש הבהרה, מלא באגים טכניים דת. תנך או ברית ביולי. כתב בה הטבע למנוע, דת כלים פיסיקה החופשית זכר.
477 מתן החלל מאמרשיחהצפה ב. הספרות אנציקלופדיה אם זכר, על שימושי שימושיים תאולוגיה עזה
478</p>
479
480Styleguide typography.intl.rtl
481*/
482
483.pt-rtl {
484 text-align: right;
485}
486
487/*
488Dark theme
489
490<!-- TODO: move me to components.dark -->
491Use the `.pt-dark` class to apply dark text colors *and* to cascade the dark theme to descendants.
492This only applies colors to text; you'll have to set a background color yourself. Blueprint's
493dark background color is aliased as `$pt-dark-app-background-color`.
494
495Weight: 10
496
497Styleguide typography.dark
498*/
499
500.pt-dark {
501 color: $pt-dark-text-color;
502
503 @each $header, $props in $headers {
504 #{$header} {
505 color: $pt-dark-heading-color;
506 }
507 }
508}