@kth/style 0.2.3 → 0.3.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Styles and components used across KTH.
4
4
 
5
- Documentation available in the [KTH Style website](https://kthstyledemoref.z6.web.core.windows.net/style)
5
+ Documentation available in the [KTH Style website](https://kthstyledemoprod.z6.web.core.windows.net/style)
6
6
 
7
7
  ## Structure
8
8
 
@@ -1 +1 @@
1
- export { DropdownContainer, DropdownWithPanel, } from "./components/react/DropdownWithPanel";
1
+ export default function hello(): string;
package/dist/cjs/react.js CHANGED
@@ -1,53 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
4
-
5
- /**
6
- * Close all <dialog>s (modal and non-modal) in a document
7
- */
8
- function closeAllDialogs() {
9
- document.querySelectorAll("dialog").forEach((dialog) => dialog.close());
10
- }
11
-
12
- function DropdownWithPanel({ label, children }) {
13
- const [shouldRender, setShouldRender] = React.useState(false);
14
- const dialogRef = React.useRef(null);
15
- function closeDialog() {
16
- dialogRef.current?.close();
17
- }
18
- function handleKeyDown(event) {
19
- if (event.key === "Escape") {
20
- event.stopPropagation();
21
- dialogRef.current?.close();
22
- }
23
- }
24
- return (React.createElement("div", null,
25
- React.createElement("button", { className: "kth-menu-item dropdown", onClick: () => {
26
- setShouldRender(true);
27
- if (!dialogRef.current?.open) {
28
- closeAllDialogs();
29
- dialogRef.current?.show();
30
- }
31
- else {
32
- closeAllDialogs();
33
- }
34
- }, onMouseOver: () => setShouldRender(true), onFocus: () => setShouldRender(true) },
35
- React.createElement("span", null, label)),
36
- React.createElement("dialog", { className: "kth-menu-panel", ref: dialogRef, onKeyDown: handleKeyDown },
37
- React.createElement("div", { className: "kth-menu-panel__container" },
38
- React.createElement("button", { className: "kth-button close", onClick: () => closeDialog() },
39
- React.createElement("span", { className: "kth-visually-hidden" }, "Close")),
40
- React.createElement("div", { className: "kth-menu-panel__content" }, shouldRender && children)))));
41
- }
42
- function DropdownContainer(props) {
43
- const containerRef = React.useRef(null);
44
- return (React.createElement("div", { ref: containerRef, onBlur: (event) => {
45
- const relatedTarget = event.relatedTarget;
46
- if (relatedTarget && !containerRef.current?.contains(relatedTarget)) {
47
- closeAllDialogs();
48
- }
49
- }, ...props }));
3
+ function hello() {
4
+ return "world";
50
5
  }
51
6
 
52
- exports.DropdownContainer = DropdownContainer;
53
- exports.DropdownWithPanel = DropdownWithPanel;
7
+ module.exports = hello;
@@ -1 +1 @@
1
- export { DropdownContainer, DropdownWithPanel, } from "./components/react/DropdownWithPanel";
1
+ export default function hello(): string;
package/dist/esm/react.js CHANGED
@@ -1,50 +1,5 @@
1
- import React from 'react';
2
-
3
- /**
4
- * Close all <dialog>s (modal and non-modal) in a document
5
- */
6
- function closeAllDialogs() {
7
- document.querySelectorAll("dialog").forEach((dialog) => dialog.close());
8
- }
9
-
10
- function DropdownWithPanel({ label, children }) {
11
- const [shouldRender, setShouldRender] = React.useState(false);
12
- const dialogRef = React.useRef(null);
13
- function closeDialog() {
14
- dialogRef.current?.close();
15
- }
16
- function handleKeyDown(event) {
17
- if (event.key === "Escape") {
18
- event.stopPropagation();
19
- dialogRef.current?.close();
20
- }
21
- }
22
- return (React.createElement("div", null,
23
- React.createElement("button", { className: "kth-menu-item dropdown", onClick: () => {
24
- setShouldRender(true);
25
- if (!dialogRef.current?.open) {
26
- closeAllDialogs();
27
- dialogRef.current?.show();
28
- }
29
- else {
30
- closeAllDialogs();
31
- }
32
- }, onMouseOver: () => setShouldRender(true), onFocus: () => setShouldRender(true) },
33
- React.createElement("span", null, label)),
34
- React.createElement("dialog", { className: "kth-menu-panel", ref: dialogRef, onKeyDown: handleKeyDown },
35
- React.createElement("div", { className: "kth-menu-panel__container" },
36
- React.createElement("button", { className: "kth-button close", onClick: () => closeDialog() },
37
- React.createElement("span", { className: "kth-visually-hidden" }, "Close")),
38
- React.createElement("div", { className: "kth-menu-panel__content" }, shouldRender && children)))));
39
- }
40
- function DropdownContainer(props) {
41
- const containerRef = React.useRef(null);
42
- return (React.createElement("div", { ref: containerRef, onBlur: (event) => {
43
- const relatedTarget = event.relatedTarget;
44
- if (relatedTarget && !containerRef.current?.contains(relatedTarget)) {
45
- closeAllDialogs();
46
- }
47
- }, ...props }));
1
+ function hello() {
2
+ return "world";
48
3
  }
49
4
 
50
- export { DropdownContainer, DropdownWithPanel };
5
+ export { hello as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kth/style",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "exports": {
@@ -48,5 +48,5 @@
48
48
  "peerDependencies": {
49
49
  "react": "*"
50
50
  },
51
- "gitHead": "9eebb100e8d56f87395e62ecc89603c446832f20"
51
+ "gitHead": "22910d9bc7994e3704105c0f2ab3ca45a422d960"
52
52
  }
@@ -7,8 +7,9 @@
7
7
  margin-inline-start: auto;
8
8
  background: transparent;
9
9
  border: none;
10
- padding-inline: 0;
10
+ padding-inline: spacing.$space-8;
11
11
  padding-block: spacing.$space-8;
12
+ border-radius: 100%;
12
13
  }
13
14
 
14
15
  .kth-button.close::before {
@@ -1,6 +1,8 @@
1
1
  // Gray-scale
2
2
  $color-white: #fcfcfc;
3
3
  $color-black: #212121;
4
+ $color-gray-lightest: #f2f2f2;
5
+ $color-gray-lighter: #ededed;
4
6
  $color-gray-light: #e6e6e6;
5
7
  $color-gray-medium: #a5a5a5;
6
8
  $color-gray-dark: #323232;
@@ -10,51 +12,62 @@ $color-sand: #e6e1dd;
10
12
  $color-blue-kth: #004791;
11
13
  $color-blue-light: #e0edfc;
12
14
  $color-blue-sky: #6298d2;
15
+ $color-blue-lake: #036eb8; // This is defined by us for links
13
16
  $color-blue-marine: #08004f;
14
17
  $color-blue-digital: #221dd9;
15
18
 
16
- // This color is specially made for links
17
- // 4.51:1 with `$color-blue-light` (requires 4.50)
18
- // 5.21:1 with `$color-white` (requires 4.50)
19
- // 3.01:1 with `$color-black` (requires 3.00)
20
- $color-blue-special: #036eb8;
19
+ // Other colors, defined by us to meet various needs
20
+ $color-red-light: #fad6d6;
21
+ $color-red: #c7321d;
22
+ $color-red-dark: #bf2c17;
23
+ $color-green-light: #d8ffe7;
24
+ $color-green: #3d784a;
25
+ $color-green-dark: #366f43;
21
26
 
22
27
  @mixin theme-default {
23
28
  --color-text: #{$color-black};
24
29
  --color-background: #{$color-white};
30
+ --color-background-alt: #{$color-gray-lighter};
25
31
  --color-primary: #{$color-blue-kth};
26
32
  --color-on-primary: #{$color-white};
27
33
  --color-secondary: #{$color-black};
28
- --color-tertiary: #{$color-blue-special};
29
- // ... --hover-overlay: ...
34
+ --color-tertiary: #{$color-blue-lake};
35
+ --color-error: #{$color-red};
36
+ --color-success: #{$color-green};
30
37
  }
31
38
 
32
39
  @mixin theme-student-web {
33
40
  --color-text: #{$color-black};
34
41
  --color-background: #{$color-blue-light};
42
+ --color-background-alt: #{$color-gray-lighter};
35
43
  --color-primary: #{$color-blue-kth};
36
44
  --color-on-primary: #{$color-white};
37
45
  --color-secondary: #{$color-black};
38
- --color-tertiary: #{$color-blue-special};
39
- // ... --hover-overlay: ...
46
+ --color-tertiary: #{$color-blue-lake};
47
+ --color-error: #{$color-red-dark};
48
+ --color-success: #{$color-green-dark};
40
49
  }
41
50
 
42
51
  @mixin theme-intranet {
43
52
  --color-text: #{$color-black};
44
53
  --color-background: #{$color-sand};
54
+ --color-background-alt: #{$color-gray-lightest};
45
55
  --color-primary: #{$color-blue-kth};
46
56
  --color-on-primary: #{$color-white};
47
57
  --color-secondary: #{$color-black};
48
- --color-tertiary: #{$color-blue-special};
49
- // ... --hover-overlay: ...
58
+ --color-tertiary: #{$color-blue-kth};
59
+ --color-error: #{$color-red-dark};
60
+ --color-success: #{$color-green-dark};
50
61
  }
51
62
 
52
63
  @mixin theme-inverse {
53
64
  --color-text: #{$color-white};
54
65
  --color-background: #{$color-blue-kth};
66
+ --color-background-alt: #{$color-blue-marine};
55
67
  --color-primary: #{$color-white};
56
68
  --color-on-primary: #{$color-blue-kth};
57
69
  --color-secondary: #{$color-white};
58
70
  --color-tertiary: #{$color-white};
59
- // ... --hover-overlay: ...
71
+ --color-error: #{$color-red-light};
72
+ --color-success: #{$color-green-light};
60
73
  }
@@ -105,7 +105,6 @@
105
105
  // TODO: border
106
106
 
107
107
  td {
108
- vertical-align: baseline;
109
108
  padding-block: var(--space-inner-block);
110
109
  padding-inline: var(--space-inner-inline);
111
110
 
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- label: string;
4
- children: React.ReactNode;
5
- }
6
- export declare function DropdownWithPanel({ label, children }: Props): React.JSX.Element;
7
- export declare function DropdownContainer(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
8
- export {};
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- label: string;
4
- children: React.ReactNode;
5
- }
6
- export declare function DropdownWithPanel({ label, children }: Props): React.JSX.Element;
7
- export declare function DropdownContainer(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
8
- export {};