@kth/style 0.0.2 → 0.0.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.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +2 -3
- package/scss/components/content-tabs.scss +8 -4
- package/scss/components/navigation-tabs.scss +6 -2
- package/scss/tokens/_typography.scss +7 -6
- package/scss/utils/prose.scss +109 -0
- package/scss/utils/reset.scss +19 -0
package/dist/cjs/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function getValueFromUrl(key) {
|
|
|
19
19
|
* as `React.useState` if false)
|
|
20
20
|
*/
|
|
21
21
|
function useUrlState(defaultValue = "", key = "", enableUrl = false) {
|
|
22
|
-
const initialValue = getValueFromUrl(key) || defaultValue;
|
|
22
|
+
const initialValue = (enableUrl && getValueFromUrl(key)) || defaultValue;
|
|
23
23
|
const [value, _setValue] = React.useState(initialValue);
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
function updateValue() {
|
package/dist/esm/index.js
CHANGED
|
@@ -17,7 +17,7 @@ function getValueFromUrl(key) {
|
|
|
17
17
|
* as `React.useState` if false)
|
|
18
18
|
*/
|
|
19
19
|
function useUrlState(defaultValue = "", key = "", enableUrl = false) {
|
|
20
|
-
const initialValue = getValueFromUrl(key) || defaultValue;
|
|
20
|
+
const initialValue = (enableUrl && getValueFromUrl(key)) || defaultValue;
|
|
21
21
|
const [value, _setValue] = React.useState(initialValue);
|
|
22
22
|
React.useEffect(() => {
|
|
23
23
|
function updateValue() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kth/style",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,6 +46,5 @@
|
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "*"
|
|
49
|
-
}
|
|
50
|
-
"gitHead": "a71425ae93ee8bcd66a82aed10b1743769b68984"
|
|
49
|
+
}
|
|
51
50
|
}
|
|
@@ -10,7 +10,7 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
10
10
|
top: calc(var(--kpm-bar-height, 0rem));
|
|
11
11
|
background: t.$color-neutral-0;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
ul[role="tablist"] {
|
|
14
14
|
list-style: none;
|
|
15
15
|
padding: 0;
|
|
16
16
|
margin: 0;
|
|
@@ -22,11 +22,11 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
22
22
|
border-block-end: $border-secondary;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
li {
|
|
26
26
|
display: flex;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
button[role="tab"] {
|
|
30
30
|
box-sizing: border-box;
|
|
31
31
|
padding-inline: var(--kth-0-clickable-padding-inline);
|
|
32
32
|
padding-block: calc(var(--kth-0-clickable-padding-block) - 1px);
|
|
@@ -38,6 +38,10 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
38
38
|
border: $border-secondary;
|
|
39
39
|
border-radius: t.border-radius(8 8 0 0);
|
|
40
40
|
|
|
41
|
+
&:focus {
|
|
42
|
+
outline-offset: -#{t.$space-4};
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
&:hover {
|
|
42
46
|
text-decoration: underline;
|
|
43
47
|
}
|
|
@@ -56,7 +60,7 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
[role="tabpanel"] {
|
|
60
64
|
border-inline: $border-secondary;
|
|
61
65
|
border-block-end: $border-secondary;
|
|
62
66
|
}
|
|
@@ -6,7 +6,7 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
6
6
|
.kth-navigation-tabs {
|
|
7
7
|
overflow: auto;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[role="tablist"] {
|
|
10
10
|
list-style: none;
|
|
11
11
|
padding: 0;
|
|
12
12
|
margin: 0;
|
|
@@ -18,7 +18,7 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
18
18
|
border-block-end: $border-secondary;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
[role="tab"] {
|
|
22
22
|
font: inherit;
|
|
23
23
|
background: none;
|
|
24
24
|
border: none;
|
|
@@ -31,6 +31,10 @@ $border-secondary: 1px solid t.$color-neutral-10;
|
|
|
31
31
|
color: t.$color-neutral-10;
|
|
32
32
|
margin-block-end: -1px;
|
|
33
33
|
|
|
34
|
+
&:focus {
|
|
35
|
+
outline-offset: -#{t.$space-4};
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
&:hover {
|
|
35
39
|
text-decoration: underline;
|
|
36
40
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "sass:math";
|
|
1
2
|
// 2. Typography
|
|
2
3
|
|
|
3
4
|
// Base tokens
|
|
@@ -56,15 +57,15 @@ $font-weight-bold: 600;
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
@mixin font-body-copy {
|
|
59
|
-
font-family: $font-serif;
|
|
60
|
+
font-family: $font-family-serif;
|
|
60
61
|
font-weight: 400;
|
|
61
|
-
font-size:
|
|
62
|
-
line-height:
|
|
62
|
+
font-size: math.div(18rem, 16);
|
|
63
|
+
line-height: math.div(28rem, 16);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
@mixin font-body-lead {
|
|
66
|
-
font-family: $font-
|
|
67
|
+
font-family: $font-family-sans;
|
|
67
68
|
font-weight: 400;
|
|
68
|
-
font-size:
|
|
69
|
-
line-height:
|
|
69
|
+
font-size: math.div(22rem, 16);
|
|
70
|
+
line-height: math.div(32rem, 16);
|
|
70
71
|
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@use "../tokens" as t;
|
|
2
|
+
|
|
3
|
+
/// This mixin provides CSS for webpages with lots of prose text.
|
|
4
|
+
///
|
|
5
|
+
/// It includes:
|
|
6
|
+
/// - CSS for tags like <p>, <h1-6>, <code>, <pre>, <ul> and <li>
|
|
7
|
+
/// - CSS classes like ".lead"
|
|
8
|
+
@mixin prose {
|
|
9
|
+
@layer kth-style {
|
|
10
|
+
p {
|
|
11
|
+
@include t.font-body-copy;
|
|
12
|
+
margin-block: t.$space-20;
|
|
13
|
+
max-width: 60ch;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.lead {
|
|
17
|
+
@include t.font-body-lead;
|
|
18
|
+
margin-block-start: t.$space-12;
|
|
19
|
+
margin-block-end: t.$space-16;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
h1 {
|
|
23
|
+
margin: t.margin(32 0 16 0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
h2 {
|
|
27
|
+
margin: t.margin(32 0 16 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h3 {
|
|
31
|
+
margin: t.margin(32 0 8 0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h4 {
|
|
35
|
+
margin: t.margin(32 0 4 0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
li {
|
|
39
|
+
@include t.font-body-copy;
|
|
40
|
+
max-width: 60ch;
|
|
41
|
+
margin: t.margin(8 0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ol,
|
|
45
|
+
ul {
|
|
46
|
+
padding-inline-start: t.$space-32;
|
|
47
|
+
|
|
48
|
+
li {
|
|
49
|
+
padding-inline-start: t.$space-6;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
h1 + *,
|
|
54
|
+
h2 + *,
|
|
55
|
+
h3 + * {
|
|
56
|
+
margin-block-start: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
table {
|
|
60
|
+
table-layout: auto;
|
|
61
|
+
text-align: left;
|
|
62
|
+
margin: 2rem 0;
|
|
63
|
+
border-collapse: collapse;
|
|
64
|
+
|
|
65
|
+
display: block;
|
|
66
|
+
overflow-x: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
thead {
|
|
70
|
+
border-bottom: 1px solid t.$color-neutral-2;
|
|
71
|
+
|
|
72
|
+
th {
|
|
73
|
+
padding: t.padding(0 8 8 8);
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
|
|
76
|
+
&:first-child {
|
|
77
|
+
padding-left: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:last-child {
|
|
81
|
+
padding-right: 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
tbody {
|
|
87
|
+
tr {
|
|
88
|
+
border-bottom: 1px solid t.$color-neutral-2;
|
|
89
|
+
|
|
90
|
+
&:last-child {
|
|
91
|
+
border-bottom-width: 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
td {
|
|
96
|
+
vertical-align: baseline;
|
|
97
|
+
padding: t.$space-8;
|
|
98
|
+
|
|
99
|
+
&:first-child {
|
|
100
|
+
padding-left: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:last-child {
|
|
104
|
+
padding-right: 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
package/scss/utils/reset.scss
CHANGED
|
@@ -56,6 +56,9 @@
|
|
|
56
56
|
hr {
|
|
57
57
|
box-sizing: content-box; /* 1 */
|
|
58
58
|
height: 0; /* 1 */
|
|
59
|
+
border: 0;
|
|
60
|
+
border-top: 1px t.$color-neutral-2 solid;
|
|
61
|
+
margin: t.$space-32 0;
|
|
59
62
|
overflow: visible; /* 2 */
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -70,6 +73,22 @@
|
|
|
70
73
|
border: none;
|
|
71
74
|
}
|
|
72
75
|
|
|
76
|
+
img {
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
height: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
figure {
|
|
82
|
+
margin: t.$space-32 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
figcaption {
|
|
86
|
+
max-width: 70ch;
|
|
87
|
+
font-style: italic;
|
|
88
|
+
margin-block-start: t.$space-12;
|
|
89
|
+
font-size: 1rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
73
92
|
/* Text-level semantics
|
|
74
93
|
========================================================================== */
|
|
75
94
|
a {
|