@kth/style 0.5.0 → 0.6.1
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/components/MenuPanel.d.ts +1 -1
- package/dist/cjs/index.js +10 -13
- package/dist/esm/components/MenuPanel.d.ts +1 -1
- package/dist/esm/index.js +10 -13
- package/package.json +2 -2
- package/scss/components/button.scss +105 -6
- package/scss/components/mega-menu.scss +2 -4
- package/scss/components/menu-item.scss +11 -0
- package/scss/tokens/colors.scss +22 -0
- package/scss/tokens/icons.scss +18 -0
- package/scss/tokens/sizing.scss +3 -0
- package/scss/components/description-list.scss +0 -30
|
@@ -9,5 +9,5 @@ export declare function closeAllDialogs(): void;
|
|
|
9
9
|
export declare function addEventListeners(dialog: HTMLDialogElement): void;
|
|
10
10
|
export declare class MenuPanel {
|
|
11
11
|
static init(container: HTMLElement | null, items: NodeListOf<Element>): void;
|
|
12
|
-
static initModal(
|
|
12
|
+
static initModal(button: Element | null, modal: Element | null): void;
|
|
13
13
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -58,19 +58,16 @@ class MenuPanel {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
static initModal(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
dialog.showModal();
|
|
72
|
-
});
|
|
73
|
-
}
|
|
61
|
+
static initModal(button, modal) {
|
|
62
|
+
if (!(button instanceof HTMLElement))
|
|
63
|
+
return;
|
|
64
|
+
if (!(modal instanceof HTMLDialogElement))
|
|
65
|
+
return;
|
|
66
|
+
addEventListeners(modal);
|
|
67
|
+
button.addEventListener("click", (e) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
modal.showModal();
|
|
70
|
+
});
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
|
|
@@ -9,5 +9,5 @@ export declare function closeAllDialogs(): void;
|
|
|
9
9
|
export declare function addEventListeners(dialog: HTMLDialogElement): void;
|
|
10
10
|
export declare class MenuPanel {
|
|
11
11
|
static init(container: HTMLElement | null, items: NodeListOf<Element>): void;
|
|
12
|
-
static initModal(
|
|
12
|
+
static initModal(button: Element | null, modal: Element | null): void;
|
|
13
13
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -56,19 +56,16 @@ class MenuPanel {
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
static initModal(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
dialog.showModal();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
59
|
+
static initModal(button, modal) {
|
|
60
|
+
if (!(button instanceof HTMLElement))
|
|
61
|
+
return;
|
|
62
|
+
if (!(modal instanceof HTMLDialogElement))
|
|
63
|
+
return;
|
|
64
|
+
addEventListeners(modal);
|
|
65
|
+
button.addEventListener("click", (e) => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
modal.showModal();
|
|
68
|
+
});
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kth/style",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "*"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c7ff497dfbf4424b3fca6aeedd3c548f222352bb"
|
|
53
53
|
}
|
|
@@ -1,24 +1,123 @@
|
|
|
1
1
|
@use "../tokens/spacing";
|
|
2
2
|
@use "../tokens/icons";
|
|
3
|
+
@use "../tokens/typography";
|
|
4
|
+
@use "../tokens/colors.scss";
|
|
3
5
|
|
|
4
6
|
$icon-size: calc(#{spacing.$space-24} + 2 * var(--space-inner-icon));
|
|
5
7
|
|
|
6
8
|
@layer kth-style {
|
|
7
9
|
// Buttons with only icon:
|
|
8
|
-
.kth-button
|
|
9
|
-
|
|
10
|
-
background: transparent;
|
|
10
|
+
.kth-icon-button {
|
|
11
|
+
background: unset;
|
|
11
12
|
border: none;
|
|
12
13
|
padding: var(--space-inner-icon);
|
|
13
14
|
width: $icon-size;
|
|
14
15
|
height: $icon-size;
|
|
15
|
-
border-radius:
|
|
16
|
+
border-radius: spacing.$space-4;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
background: var(--color-secondary-hover);
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
.kth-button.close::before {
|
|
24
|
+
.kth-icon-button.close::before {
|
|
19
25
|
@include icons.icon-close;
|
|
20
26
|
width: 100%;
|
|
21
27
|
height: 100%;
|
|
22
|
-
background-color: var(--color-
|
|
28
|
+
background-color: var(--color-tertiary);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.kth-button {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
padding: spacing.$space-8 spacing.$space-16;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
border: unset;
|
|
37
|
+
border-radius: spacing.$space-4;
|
|
38
|
+
background: none;
|
|
39
|
+
@include typography.font-heading-xs;
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.kth-button.primary {
|
|
47
|
+
background: var(--color-primary);
|
|
48
|
+
color: var(--color-on-primary);
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
background: var(--color-primary-hover);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.kth-button.secondary,
|
|
56
|
+
.kth-button.previous {
|
|
57
|
+
border: 1px solid var(--color-secondary);
|
|
58
|
+
color: var(--color-secondary);
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
background: var(--color-secondary-hover);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.kth-button.success,
|
|
66
|
+
.kth-button.next {
|
|
67
|
+
background: var(--color-success);
|
|
68
|
+
color: var(--color-on-primary);
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background: var(--color-success-hover);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.kth-button.error {
|
|
76
|
+
background: var(--color-error);
|
|
77
|
+
color: var(--color-on-primary);
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
background: var(--color-error-hover);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.kth-button.back {
|
|
85
|
+
padding: spacing.$space-8 0;
|
|
86
|
+
gap: spacing.$space-4;
|
|
87
|
+
color: var(--color-tertiary);
|
|
88
|
+
@include typography.font-default;
|
|
89
|
+
|
|
90
|
+
&:hover {
|
|
91
|
+
text-decoration-line: underline;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.kth-button.back::before {
|
|
96
|
+
@include icons.icon-arrow-back;
|
|
97
|
+
width: 20px;
|
|
98
|
+
height: 20px;
|
|
99
|
+
background-color: var(--color-tertiary);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.kth-button.previous {
|
|
103
|
+
gap: spacing.$space-4;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.kth-button.previous::before {
|
|
107
|
+
@include icons.icon-arrow-back-500;
|
|
108
|
+
width: 20px;
|
|
109
|
+
height: 20px;
|
|
110
|
+
background-color: var(--color-text);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.kth-button.next {
|
|
114
|
+
gap: spacing.$space-4;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.kth-button.next::after {
|
|
118
|
+
@include icons.icon-arrow-forward-500;
|
|
119
|
+
width: 20px;
|
|
120
|
+
height: 20px;
|
|
121
|
+
background-color: var(--color-on-primary);
|
|
23
122
|
}
|
|
24
123
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
@use "../tokens/spacing.scss";
|
|
2
2
|
@use "../utils/mixins.scss";
|
|
3
|
-
|
|
4
|
-
// TODO: this should be a token
|
|
5
|
-
$breakpoint-mega-menu: 64rem;
|
|
3
|
+
@use "../tokens/sizing.scss";
|
|
6
4
|
|
|
7
5
|
@layer kth-style {
|
|
8
6
|
nav.kth-mega-menu {
|
|
@@ -21,7 +19,7 @@ $breakpoint-mega-menu: 64rem;
|
|
|
21
19
|
display: none;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
@media (max-width:
|
|
22
|
+
@media (max-width: sizing.$breakpoint-64) {
|
|
25
23
|
nav.kth-mega-menu {
|
|
26
24
|
display: none;
|
|
27
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "../tokens/spacing";
|
|
2
2
|
@use "../tokens/icons";
|
|
3
|
+
@use "../tokens/sizing";
|
|
3
4
|
|
|
4
5
|
@layer kth-style {
|
|
5
6
|
.kth-menu-item {
|
|
@@ -20,6 +21,16 @@
|
|
|
20
21
|
border-bottom: transparent spacing.$space-4 solid;
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
&.collapsable {
|
|
25
|
+
margin-inline-start: spacing.$space-16;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (min-width: sizing.$breakpoint-64) {
|
|
29
|
+
&.collapsable {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
23
34
|
&:hover span {
|
|
24
35
|
border-color: var(--color-primary);
|
|
25
36
|
}
|
package/scss/tokens/colors.scss
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Gray-scale
|
|
2
2
|
$color-white: #fcfcfc;
|
|
3
3
|
$color-black: #212121;
|
|
4
|
+
$color-black-opacity10: rgb(33 33 33 / 0.1);
|
|
5
|
+
|
|
4
6
|
$color-gray-lightest: #f2f2f2;
|
|
5
7
|
$color-gray-lighter: #ededed;
|
|
6
8
|
$color-gray-light: #e6e6e6;
|
|
@@ -10,6 +12,7 @@ $color-gray-dark: #323232;
|
|
|
10
12
|
// Colors defined by "Varumärkesgruppen"
|
|
11
13
|
$color-sand: #e6e1dd;
|
|
12
14
|
$color-blue-kth: #004791;
|
|
15
|
+
$color-blue-kth-dark: #003975;
|
|
13
16
|
$color-blue-light: #e0edfc;
|
|
14
17
|
$color-blue-sky: #6298d2;
|
|
15
18
|
$color-blue-lake: #036eb8; // This is defined by us for links
|
|
@@ -20,20 +23,27 @@ $color-blue-digital: #221dd9;
|
|
|
20
23
|
$color-red-light: #fad6d6;
|
|
21
24
|
$color-red: #c7321d;
|
|
22
25
|
$color-red-dark: #bf2c17;
|
|
26
|
+
$color-red-darker: #962312;
|
|
27
|
+
|
|
23
28
|
$color-green-light: #d8ffe7;
|
|
24
29
|
$color-green: #3d784a;
|
|
25
30
|
$color-green-dark: #366f43;
|
|
31
|
+
$color-green-darker: #264f30;
|
|
26
32
|
|
|
27
33
|
@mixin theme-default {
|
|
28
34
|
--color-text: #{$color-black};
|
|
29
35
|
--color-background: #{$color-white};
|
|
30
36
|
--color-background-alt: #{$color-gray-lighter};
|
|
31
37
|
--color-primary: #{$color-blue-kth};
|
|
38
|
+
--color-primary-hover: #{$color-blue-kth-dark};
|
|
32
39
|
--color-on-primary: #{$color-white};
|
|
33
40
|
--color-secondary: #{$color-black};
|
|
41
|
+
--color-secondary-hover: #{$color-black-opacity10};
|
|
34
42
|
--color-tertiary: #{$color-blue-lake};
|
|
35
43
|
--color-error: #{$color-red};
|
|
44
|
+
--color-error-hover: #{$color-red-dark};
|
|
36
45
|
--color-success: #{$color-green};
|
|
46
|
+
--color-success-hover: #{$color-green-dark};
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
@mixin theme-student-web {
|
|
@@ -41,11 +51,15 @@ $color-green-dark: #366f43;
|
|
|
41
51
|
--color-background: #{$color-blue-light};
|
|
42
52
|
--color-background-alt: #{$color-gray-lighter};
|
|
43
53
|
--color-primary: #{$color-blue-kth};
|
|
54
|
+
--color-primary-hover: #{$color-blue-kth-dark};
|
|
44
55
|
--color-on-primary: #{$color-white};
|
|
45
56
|
--color-secondary: #{$color-black};
|
|
57
|
+
--color-secondary-hover: #{$color-black-opacity10};
|
|
46
58
|
--color-tertiary: #{$color-blue-lake};
|
|
47
59
|
--color-error: #{$color-red-dark};
|
|
60
|
+
--color-error-hover: #{$color-red-darker};
|
|
48
61
|
--color-success: #{$color-green-dark};
|
|
62
|
+
--color-success-hover: #{$color-green-darker};
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
@mixin theme-intranet {
|
|
@@ -53,11 +67,15 @@ $color-green-dark: #366f43;
|
|
|
53
67
|
--color-background: #{$color-sand};
|
|
54
68
|
--color-background-alt: #{$color-gray-lightest};
|
|
55
69
|
--color-primary: #{$color-blue-kth};
|
|
70
|
+
--color-primary-hover: #{$color-blue-kth-dark};
|
|
56
71
|
--color-on-primary: #{$color-white};
|
|
57
72
|
--color-secondary: #{$color-black};
|
|
73
|
+
--color-secondary-hover: #{$color-black-opacity10};
|
|
58
74
|
--color-tertiary: #{$color-blue-kth};
|
|
59
75
|
--color-error: #{$color-red-dark};
|
|
76
|
+
--color-error-hover: #{$color-red-darker};
|
|
60
77
|
--color-success: #{$color-green-dark};
|
|
78
|
+
--color-success-hover: #{$color-green-darker};
|
|
61
79
|
}
|
|
62
80
|
|
|
63
81
|
@mixin theme-inverse {
|
|
@@ -65,9 +83,13 @@ $color-green-dark: #366f43;
|
|
|
65
83
|
--color-background: #{$color-blue-kth};
|
|
66
84
|
--color-background-alt: #{$color-blue-marine};
|
|
67
85
|
--color-primary: #{$color-white};
|
|
86
|
+
--color-primary-hover: #{$color-blue-kth-dark};
|
|
68
87
|
--color-on-primary: #{$color-blue-kth};
|
|
69
88
|
--color-secondary: #{$color-white};
|
|
89
|
+
--color-secondary-hover: #{$color-black-opacity10};
|
|
70
90
|
--color-tertiary: #{$color-white};
|
|
71
91
|
--color-error: #{$color-red-light};
|
|
92
|
+
--color-error-hover: #{$color-red-light};
|
|
72
93
|
--color-success: #{$color-green-light};
|
|
94
|
+
--color-success-hover: #{$color-green-light};
|
|
73
95
|
}
|
package/scss/tokens/icons.scss
CHANGED
|
@@ -38,6 +38,24 @@
|
|
|
38
38
|
@include with-icon(raw.$icon-close);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
@mixin icon-arrow-back {
|
|
42
|
+
@include with-icon(raw.$icon-arrow-forward);
|
|
43
|
+
rotate: 180deg;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@mixin icon-arrow-back-500 {
|
|
47
|
+
@include with-icon(raw.$icon-arrow-forward-500);
|
|
48
|
+
rotate: 180deg;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin icon-arrow-forward {
|
|
52
|
+
@include with-icon(raw.$icon-arrow-forward);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@mixin icon-arrow-forward-500 {
|
|
56
|
+
@include with-icon(raw.$icon-arrow-forward-500);
|
|
57
|
+
}
|
|
58
|
+
|
|
41
59
|
@mixin icon-info-500 {
|
|
42
60
|
@include with-icon(raw.$icon-info-500);
|
|
43
61
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
@use "../tokens/spacing.scss" as s;
|
|
2
|
-
|
|
3
|
-
@layer kth-style {
|
|
4
|
-
.kth-description-list {
|
|
5
|
-
display: grid;
|
|
6
|
-
gap: 0 s.$space-16;
|
|
7
|
-
grid-template-columns: minmax(15rem, 1fr) 2fr;
|
|
8
|
-
|
|
9
|
-
@container (max-width: 30rem) {
|
|
10
|
-
grid-template-columns: 1fr;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
> div:nth-child(n + 2) {
|
|
14
|
-
grid-column: 1 / -1;
|
|
15
|
-
display: grid;
|
|
16
|
-
grid-template-columns: subgrid;
|
|
17
|
-
padding-block: s.$space-8;
|
|
18
|
-
border-block-start: 1px solid gray;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
dt {
|
|
22
|
-
font-weight: 600;
|
|
23
|
-
grid-column: 1 / 2;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
dd {
|
|
27
|
-
grid-column: -2 / -1;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|