@kth/style 0.5.0 → 0.6.0

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.
@@ -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(items: NodeListOf<Element>): void;
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(items) {
62
- for (const item of items) {
63
- if (!(item instanceof HTMLElement))
64
- continue;
65
- const dialog = item.nextElementSibling;
66
- if (!(dialog instanceof HTMLDialogElement))
67
- continue;
68
- addEventListeners(dialog);
69
- item.addEventListener("click", (e) => {
70
- e.preventDefault();
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(items: NodeListOf<Element>): void;
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(items) {
60
- for (const item of items) {
61
- if (!(item instanceof HTMLElement))
62
- continue;
63
- const dialog = item.nextElementSibling;
64
- if (!(dialog instanceof HTMLDialogElement))
65
- continue;
66
- addEventListeners(dialog);
67
- item.addEventListener("click", (e) => {
68
- e.preventDefault();
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.5.0",
3
+ "version": "0.6.0",
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": "bd4ad4e23abb131c4583fab73f02e4c22191a849"
52
+ "gitHead": "c27216c3973842e3b4ec03b215d750b57f6a64c6"
53
53
  }
@@ -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: $breakpoint-mega-menu) {
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
  }
@@ -0,0 +1,3 @@
1
+ /// DO NOT USE IT OUTSIDE OF KTH STYLE. THOSE NAMES MAY CHANGE
2
+ $breakpoint-48: 48rem;
3
+ $breakpoint-64: 64rem;
@@ -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
- }