@remvst/design-system 1.0.0 → 1.1.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.
Files changed (78) hide show
  1. package/.github/workflows/check.yaml +19 -19
  2. package/.prettierrc +4 -0
  3. package/lib/alignment/alignment.css +13 -13
  4. package/lib/alignment/alignment.d.ts +1 -1
  5. package/lib/alignment/alignment.js +1 -1
  6. package/lib/animations/animations.css +90 -90
  7. package/lib/balanced-row/balanced-row.css +4 -4
  8. package/lib/balanced-stack/balanced-stack.css +5 -5
  9. package/lib/buttons/buttons.css +5 -5
  10. package/lib/buttons/buttons.d.ts +3 -1
  11. package/lib/buttons/buttons.js +8 -1
  12. package/lib/dim/dim.css +3 -3
  13. package/lib/flow-list/flow-list.css +5 -5
  14. package/lib/focusable.d.ts +1 -0
  15. package/lib/focusable.js +6 -3
  16. package/lib/frame/frame.css +1 -1
  17. package/lib/gauge/gauge.css +16 -16
  18. package/lib/highlightable-row/highlightable-row.css +3 -3
  19. package/lib/highlightable-row/highlightable-row.js +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/index.js +1 -1
  22. package/lib/key-value-layout/key-value-layout.css +7 -7
  23. package/lib/labels/labels.css +13 -13
  24. package/lib/reset/reset.css +8 -8
  25. package/lib/screen-column-layout/screen-column-layout.css +77 -77
  26. package/lib/screen-stack-layout/screen-stack-layout.css +14 -14
  27. package/lib/scrollable-content/scrollable-content.css +3 -3
  28. package/lib/slider/slider.css +44 -44
  29. package/lib/spacing/spacing.css +7 -7
  30. package/lib/stack-list/stack-list.css +2 -2
  31. package/lib/tabs/tabs.css +10 -10
  32. package/lib/typography/typography.css +7 -7
  33. package/package.json +26 -25
  34. package/src/alignment/alignment.css +13 -13
  35. package/src/alignment/alignment.tsx +5 -5
  36. package/src/animations/animations.css +90 -90
  37. package/src/animations/animations.ts +14 -14
  38. package/src/balanced-row/balanced-row.css +4 -4
  39. package/src/balanced-row/balanced-row.tsx +10 -10
  40. package/src/balanced-stack/balanced-stack.css +5 -5
  41. package/src/balanced-stack/balanced-stack.tsx +10 -10
  42. package/src/buttons/buttons.css +5 -5
  43. package/src/buttons/buttons.tsx +7 -2
  44. package/src/component-with-class-name.tsx +8 -8
  45. package/src/dim/dim.css +3 -3
  46. package/src/dim/dim.tsx +1 -1
  47. package/src/flow-list/flow-list.css +5 -5
  48. package/src/flow-list/flow-list.tsx +10 -10
  49. package/src/focusable.tsx +39 -35
  50. package/src/frame/frame.css +1 -1
  51. package/src/frame/frame.tsx +1 -1
  52. package/src/gauge/gauge.css +16 -16
  53. package/src/gauge/gauge.tsx +19 -16
  54. package/src/highlightable-row/highlightable-row.css +3 -3
  55. package/src/highlightable-row/highlightable-row.tsx +10 -8
  56. package/src/index.ts +1 -1
  57. package/src/key-value-layout/key-value-layout.css +7 -7
  58. package/src/key-value-layout/key-value-layout.tsx +1 -1
  59. package/src/labels/labels.css +13 -13
  60. package/src/labels/labels.tsx +7 -7
  61. package/src/reset/reset.css +8 -8
  62. package/src/screen-column-layout/screen-column-layout.css +77 -77
  63. package/src/screen-column-layout/screen-column-layout.tsx +6 -6
  64. package/src/screen-stack-layout/screen-stack-layout.css +14 -14
  65. package/src/screen-stack-layout/screen-stack-layout.tsx +4 -4
  66. package/src/scrollable-content/scrollable-content.css +3 -3
  67. package/src/scrollable-content/scrollable-content.tsx +1 -1
  68. package/src/slider/slider.css +44 -44
  69. package/src/slider/slider.tsx +45 -45
  70. package/src/spacing/spacing.css +7 -7
  71. package/src/spacing/spacing.ts +7 -7
  72. package/src/stack-list/stack-list.css +2 -2
  73. package/src/stack-list/stack-list.tsx +10 -10
  74. package/src/tabs/tabs.css +10 -10
  75. package/src/tabs/tabs.tsx +15 -15
  76. package/src/typography/typography.css +7 -7
  77. package/src/typography/typography.ts +7 -7
  78. package/tsconfig.json +11 -11
@@ -1,125 +1,125 @@
1
1
  .animate-in {
2
- animation: animate-in 0.2s ease-out;
3
- animation-fill-mode: both;
2
+ animation: animate-in 0.2s ease-out;
3
+ animation-fill-mode: both;
4
4
  }
5
5
 
6
6
  .zoom-in {
7
- opacity: 1;
8
- animation: zoom-in 0.2s ease-out;
9
- animation-fill-mode: forwards;
7
+ opacity: 1;
8
+ animation: zoom-in 0.2s ease-out;
9
+ animation-fill-mode: forwards;
10
10
  }
11
11
 
12
12
  .slide-up {
13
- transform: none;
14
- opacity: 0;
15
- animation: slide-up 0.5s ease-out;
16
- animation-fill-mode: forwards;
13
+ transform: none;
14
+ opacity: 0;
15
+ animation: slide-up 0.5s ease-out;
16
+ animation-fill-mode: forwards;
17
17
  }
18
18
 
19
19
  .slide-down {
20
- transform: none;
21
- opacity: 0;
22
- animation: slide-down 0.1s linear;
23
- animation-fill-mode: forwards;
20
+ transform: none;
21
+ opacity: 0;
22
+ animation: slide-down 0.1s linear;
23
+ animation-fill-mode: forwards;
24
24
  }
25
25
 
26
26
  .fade-in {
27
- opacity: 0;
28
- animation: fade-in 1s ease-out;
29
- animation-fill-mode: forwards;
27
+ opacity: 0;
28
+ animation: fade-in 1s ease-out;
29
+ animation-fill-mode: forwards;
30
30
  }
31
31
 
32
32
  .shake {
33
- position: relative;
34
- animation: shake 0.2s;
35
- animation-iteration-count: infinite;
33
+ position: relative;
34
+ animation: shake 0.2s;
35
+ animation-iteration-count: infinite;
36
36
  }
37
37
 
38
38
  @keyframes animate-in {
39
- 0% {
40
- opacity: 0;
41
- transform: scale(110%, 110%);
42
- }
43
- 100% {
44
- opacity: 1;
45
- transform: translateY(0px);
46
- }
39
+ 0% {
40
+ opacity: 0;
41
+ transform: scale(110%, 110%);
42
+ }
43
+ 100% {
44
+ opacity: 1;
45
+ transform: translateY(0px);
46
+ }
47
47
  }
48
48
 
49
49
  @keyframes zoom-in {
50
- 0% {
51
- opacity: 1;
52
- transform: none;
53
- }
54
- 100% {
55
- opacity: 0;
56
- transform: scale(200%, 200%);
57
- }
50
+ 0% {
51
+ opacity: 1;
52
+ transform: none;
53
+ }
54
+ 100% {
55
+ opacity: 0;
56
+ transform: scale(200%, 200%);
57
+ }
58
58
  }
59
59
 
60
60
  @keyframes slide-up {
61
- 0% {
62
- opacity: 0;
63
- transform: translateY(50px);
64
- }
65
- 100% {
66
- opacity: 1;
67
- transform: translateY(0px);
68
- }
61
+ 0% {
62
+ opacity: 0;
63
+ transform: translateY(50px);
64
+ }
65
+ 100% {
66
+ opacity: 1;
67
+ transform: translateY(0px);
68
+ }
69
69
  }
70
70
 
71
71
  @keyframes slide-down {
72
- 0% {
73
- opacity: 0;
74
- transform: translateY(-200px);
75
- }
76
- 100% {
77
- opacity: 1;
78
- transform: translateY(0px);
79
- }
72
+ 0% {
73
+ opacity: 0;
74
+ transform: translateY(-200px);
75
+ }
76
+ 100% {
77
+ opacity: 1;
78
+ transform: translateY(0px);
79
+ }
80
80
  }
81
81
 
82
82
  @keyframes fade-in {
83
- 0% {
84
- opacity: 0;
85
- }
86
- 100% {
87
- opacity: 1;
88
- }
83
+ 0% {
84
+ opacity: 0;
85
+ }
86
+ 100% {
87
+ opacity: 1;
88
+ }
89
89
  }
90
90
 
91
91
  @keyframes shake {
92
- 0% {
93
- transform: translate(4px, 4px);
94
- }
95
- 10% {
96
- transform: translate(-4px, -4px);
97
- }
98
- 20% {
99
- transform: translate(-4px, 0px);
100
- }
101
- 30% {
102
- transform: translate(4px, 4px);
103
- }
104
- 40% {
105
- transform: translate(4px, -4px);
106
- }
107
- 50% {
108
- transform: translate(-4px, 4px);
109
- }
110
- 60% {
111
- transform: translate(-4px, 4px);
112
- }
113
- 70% {
114
- transform: translate(4px, 4px);
115
- }
116
- 80% {
117
- transform: translate(-4px, -4px);
118
- }
119
- 90% {
120
- transform: translate(4px, 4px);
121
- }
122
- 100% {
123
- transform: translate(4px, -4px);
124
- }
92
+ 0% {
93
+ transform: translate(4px, 4px);
94
+ }
95
+ 10% {
96
+ transform: translate(-4px, -4px);
97
+ }
98
+ 20% {
99
+ transform: translate(-4px, 0px);
100
+ }
101
+ 30% {
102
+ transform: translate(4px, 4px);
103
+ }
104
+ 40% {
105
+ transform: translate(4px, -4px);
106
+ }
107
+ 50% {
108
+ transform: translate(-4px, 4px);
109
+ }
110
+ 60% {
111
+ transform: translate(-4px, 4px);
112
+ }
113
+ 70% {
114
+ transform: translate(4px, 4px);
115
+ }
116
+ 80% {
117
+ transform: translate(-4px, -4px);
118
+ }
119
+ 90% {
120
+ transform: translate(4px, 4px);
121
+ }
122
+ 100% {
123
+ transform: translate(4px, -4px);
124
+ }
125
125
  }
@@ -2,20 +2,20 @@ import { CSSProperties } from "react";
2
2
  import "./animations.css";
3
3
 
4
4
  export class AnimateInSequence {
5
- delay = 0;
6
- interval = 0.05;
7
- animationClassName = "animate-in";
5
+ delay = 0;
6
+ interval = 0.05;
7
+ animationClassName = "animate-in";
8
8
 
9
- next(extraStyle: CSSProperties = {}): React.HTMLAttributes<HTMLElement> {
10
- const delay = this.delay;
11
- this.delay += this.interval;
9
+ next(extraStyle: CSSProperties = {}): React.HTMLAttributes<HTMLElement> {
10
+ const delay = this.delay;
11
+ this.delay += this.interval;
12
12
 
13
- return {
14
- className: this.animationClassName,
15
- style: {
16
- animationDelay: delay + "s",
17
- ...extraStyle,
18
- },
19
- };
20
- }
13
+ return {
14
+ className: this.animationClassName,
15
+ style: {
16
+ animationDelay: delay + "s",
17
+ ...extraStyle,
18
+ },
19
+ };
20
+ }
21
21
  }
@@ -1,9 +1,9 @@
1
1
  .balanced-row {
2
- display: flex;
3
- flex-direction: row;
4
- flex-wrap: nowrap;
2
+ display: flex;
3
+ flex-direction: row;
4
+ flex-wrap: nowrap;
5
5
  }
6
6
 
7
7
  .balanced-row > div {
8
- flex: 1 0 0;
8
+ flex: 1 0 0;
9
9
  }
@@ -2,15 +2,15 @@ import React from "react";
2
2
  import "./balanced-row.css";
3
3
 
4
4
  export class BalancedRow extends React.Component<
5
- React.HTMLAttributes<HTMLDivElement>
5
+ React.HTMLAttributes<HTMLDivElement>
6
6
  > {
7
- render() {
8
- return (
9
- <div className="balanced-row" {...this.props}>
10
- {React.Children.map(this.props.children, (child, i) => {
11
- return <div key={`child-${i}`}>{child}</div>;
12
- })}
13
- </div>
14
- );
15
- }
7
+ render() {
8
+ return (
9
+ <div className="balanced-row" {...this.props}>
10
+ {React.Children.map(this.props.children, (child, i) => {
11
+ return <div key={`child-${i}`}>{child}</div>;
12
+ })}
13
+ </div>
14
+ );
15
+ }
16
16
  }
@@ -1,10 +1,10 @@
1
1
  .balanced-stack {
2
- display: flex;
3
- flex-direction: column;
4
- flex-wrap: nowrap;
5
- height: 100%;
2
+ display: flex;
3
+ flex-direction: column;
4
+ flex-wrap: nowrap;
5
+ height: 100%;
6
6
  }
7
7
 
8
8
  .balanced-stack > div {
9
- flex: 1 0 0;
9
+ flex: 1 0 0;
10
10
  }
@@ -2,15 +2,15 @@ import React from "react";
2
2
  import "./balanced-stack.css";
3
3
 
4
4
  export class BalancedStack extends React.Component<
5
- React.HTMLAttributes<HTMLDivElement>
5
+ React.HTMLAttributes<HTMLDivElement>
6
6
  > {
7
- render() {
8
- return (
9
- <div className="balanced-stack">
10
- {React.Children.map(this.props.children, (child, i) => {
11
- return <div key={`child-${i}`}>{child}</div>;
12
- })}
13
- </div>
14
- );
15
- }
7
+ render() {
8
+ return (
9
+ <div className="balanced-stack">
10
+ {React.Children.map(this.props.children, (child, i) => {
11
+ return <div key={`child-${i}`}>{child}</div>;
12
+ })}
13
+ </div>
14
+ );
15
+ }
16
16
  }
@@ -1,10 +1,10 @@
1
1
  .main-button {
2
- text-align: center;
3
- cursor: pointer;
4
- font-size: 20px;
2
+ text-align: center;
3
+ cursor: pointer;
4
+ font-size: 20px;
5
5
  }
6
6
 
7
7
  .main-button.disabled {
8
- color: #888;
9
- pointer-events: none;
8
+ color: #888;
9
+ pointer-events: none;
10
10
  }
@@ -1,6 +1,11 @@
1
- import "./buttons.css";
1
+ import React, { JSX } from "react";
2
2
  import { Focusable } from "../focusable";
3
+ import "./buttons.css";
3
4
 
4
5
  export class MainButton extends Focusable {
5
- protected readonly className = "main-button";
6
+ protected readonly className = "main-button";
7
+
8
+ protected renderChildren(): JSX.Element {
9
+ return <span>{super.renderChildren()}</span>;
10
+ }
6
11
  }
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
2
 
3
3
  export abstract class ComponentWithClassName<
4
- Props extends
5
- React.HTMLAttributes<HTMLDivElement> = React.HTMLAttributes<HTMLDivElement>,
4
+ Props extends
5
+ React.HTMLAttributes<HTMLDivElement> = React.HTMLAttributes<HTMLDivElement>,
6
6
  > extends React.Component<Props> {
7
- protected abstract readonly className: string;
7
+ protected abstract readonly className: string;
8
8
 
9
- render() {
10
- const props = { ...this.props } as any;
11
- props.className = this.className + " " + (this.props.className || "");
9
+ render() {
10
+ const props = { ...this.props } as any;
11
+ props.className = this.className + " " + (this.props.className || "");
12
12
 
13
- return <div {...props}>{this.props.children}</div>;
14
- }
13
+ return <div {...props}>{this.props.children}</div>;
14
+ }
15
15
  }
package/src/dim/dim.css CHANGED
@@ -1,5 +1,5 @@
1
1
  .dim {
2
- width: 100%;
3
- height: 100%;
4
- background-color: rgba(0, 0, 0, 0.5);
2
+ width: 100%;
3
+ height: 100%;
4
+ background-color: rgba(0, 0, 0, 0.5);
5
5
  }
package/src/dim/dim.tsx CHANGED
@@ -2,5 +2,5 @@ import { ComponentWithClassName } from "../component-with-class-name";
2
2
  import "./dim.css";
3
3
 
4
4
  export class Dim extends ComponentWithClassName {
5
- protected className = "dim";
5
+ protected className = "dim";
6
6
  }
@@ -1,10 +1,10 @@
1
1
  .flow-list {
2
- display: flex;
3
- flex-direction: row-reverse;
4
- flex-wrap: wrap;
2
+ display: flex;
3
+ flex-direction: row-reverse;
4
+ flex-wrap: wrap;
5
5
  }
6
6
 
7
7
  .flow-list > div {
8
- flex: 1 1 0;
9
- position: relative;
8
+ flex: 1 1 0;
9
+ position: relative;
10
10
  }
@@ -2,15 +2,15 @@ import React from "react";
2
2
  import "./flow-list.css";
3
3
 
4
4
  export class FlowList extends React.Component<
5
- React.HTMLAttributes<HTMLDivElement>
5
+ React.HTMLAttributes<HTMLDivElement>
6
6
  > {
7
- render() {
8
- return (
9
- <div className="flow-list" {...this.props}>
10
- {React.Children.map(this.props.children, (child, i) => {
11
- return <div key={`child-${i}`}>{child}</div>;
12
- })}
13
- </div>
14
- );
15
- }
7
+ render() {
8
+ return (
9
+ <div className="flow-list" {...this.props}>
10
+ {React.Children.map(this.props.children, (child, i) => {
11
+ return <div key={`child-${i}`}>{child}</div>;
12
+ })}
13
+ </div>
14
+ );
15
+ }
16
16
  }
package/src/focusable.tsx CHANGED
@@ -1,48 +1,52 @@
1
1
  import React from "react";
2
2
 
3
3
  interface Props extends React.HTMLAttributes<HTMLDivElement> {
4
- disabled?: boolean;
4
+ disabled?: boolean;
5
5
  }
6
6
 
7
7
  export abstract class Focusable<
8
- PropsType extends Props = Props,
8
+ PropsType extends Props = Props,
9
9
  > extends React.Component<PropsType> {
10
- protected abstract readonly className: string;
11
- private divElement: HTMLDivElement;
10
+ protected abstract readonly className: string;
11
+ private divElement: HTMLDivElement;
12
12
 
13
- private onMouseOver() {
14
- this.divElement.focus();
15
- }
13
+ private onMouseOver() {
14
+ this.divElement?.focus();
15
+ }
16
+
17
+ private keyUp(event: React.KeyboardEvent<HTMLDivElement>) {
18
+ if (this.props.disabled) {
19
+ return;
20
+ }
21
+
22
+ if (event.key === "Enter" || event.key === " ") {
23
+ this.divElement?.click();
24
+ }
25
+ }
26
+
27
+ protected saneProps(): Props {
28
+ return this.props;
29
+ }
16
30
 
17
- private keyUp(event: React.KeyboardEvent<HTMLDivElement>) {
18
- if (this.props.disabled) {
19
- return;
31
+ render() {
32
+ const props = { ...this.saneProps() } as any;
33
+ props.className = props.className || "";
34
+ props.className += " " + this.className;
35
+ props.className += " " + (this.props.disabled ? "disabled" : "");
36
+
37
+ return (
38
+ <div
39
+ {...props}
40
+ onMouseOver={() => this.onMouseOver()}
41
+ onKeyUp={(e) => this.keyUp(e)}
42
+ ref={(div) => (this.divElement = div)}
43
+ >
44
+ {this.renderChildren()}
45
+ </div>
46
+ );
20
47
  }
21
48
 
22
- if (event.key === "Enter" || event.key === " ") {
23
- this.divElement.click();
49
+ protected renderChildren() {
50
+ return <>{this.props.children}</>;
24
51
  }
25
- }
26
-
27
- protected saneProps(): Props {
28
- return this.props;
29
- }
30
-
31
- render() {
32
- const props = { ...this.saneProps() } as any;
33
- props.className = props.className || "";
34
- props.className += " " + this.className;
35
- props.className += " " + (this.props.disabled ? "disabled" : "");
36
-
37
- return (
38
- <div
39
- {...props}
40
- onMouseOver={() => this.onMouseOver()}
41
- onKeyUp={(e) => this.keyUp(e)}
42
- ref={(div) => (this.divElement = div)}
43
- >
44
- {props.children}
45
- </div>
46
- );
47
- }
48
52
  }
@@ -1,3 +1,3 @@
1
1
  .frame {
2
- background-color: rgba(0, 0, 0, 0.8);
2
+ background-color: rgba(0, 0, 0, 0.8);
3
3
  }
@@ -2,5 +2,5 @@ import { Focusable } from "../focusable";
2
2
  import "./frame.css";
3
3
 
4
4
  export class Frame extends Focusable {
5
- protected readonly className = "frame";
5
+ protected readonly className = "frame";
6
6
  }
@@ -1,24 +1,24 @@
1
1
  .gauge {
2
- width: 100%;
3
- height: 20px;
4
- background-color: #444;
5
- overflow: hidden;
2
+ width: 100%;
3
+ height: 20px;
4
+ background-color: #444;
5
+ overflow: hidden;
6
6
  }
7
7
 
8
8
  .gauge > div {
9
- height: 100%;
10
- background-color: #fff;
11
- transition: width 100ms linear;
12
- position: relative;
13
- display: flex;
14
- flex-direction: row;
15
- justify-content: end;
16
- padding: var(--spacing-xxs);
9
+ height: 100%;
10
+ background-color: #fff;
11
+ transition: width 100ms linear;
12
+ position: relative;
13
+ display: flex;
14
+ flex-direction: row;
15
+ justify-content: end;
16
+ padding: var(--spacing-xxs);
17
17
  }
18
18
 
19
19
  .gauge > div > * {
20
- color: black;
21
- font-size: 15px;
22
- flex: 0 0 auto;
23
- align-self: center;
20
+ color: black;
21
+ font-size: 15px;
22
+ flex: 0 0 auto;
23
+ align-self: center;
24
24
  }
@@ -2,24 +2,27 @@ import React from "react";
2
2
  import "./gauge.css";
3
3
 
4
4
  interface Props {
5
- value: number;
6
- label?: string;
5
+ value: number;
6
+ label?: string;
7
7
  }
8
8
 
9
9
  export class Gauge extends React.Component<
10
- Props & React.HTMLAttributes<HTMLDivElement>
10
+ Props & React.HTMLAttributes<HTMLDivElement>
11
11
  > {
12
- render() {
13
- return (
14
- <div className="gauge" {...this.props}>
15
- <div
16
- style={{
17
- width: `${Math.max(0, Math.min(100, this.props.value * 100))}%`,
18
- }}
19
- >
20
- <label>{this.props.label}</label>
21
- </div>
22
- </div>
23
- );
24
- }
12
+ render() {
13
+ return (
14
+ <div className="gauge" {...this.props}>
15
+ <div
16
+ style={{
17
+ width: `${Math.max(
18
+ 0,
19
+ Math.min(100, this.props.value * 100),
20
+ )}%`,
21
+ }}
22
+ >
23
+ <label>{this.props.label}</label>
24
+ </div>
25
+ </div>
26
+ );
27
+ }
25
28
  }
@@ -1,11 +1,11 @@
1
1
  .highlightable-row {
2
- background-color: rgba(0, 0, 0, 0.2);
2
+ background-color: rgba(0, 0, 0, 0.2);
3
3
  }
4
4
 
5
5
  .highlightable-row:focus {
6
- background-color: rgba(255, 255, 255, 0.2) !important;
6
+ background-color: rgba(255, 255, 255, 0.2) !important;
7
7
  }
8
8
 
9
9
  .screen-layout-column > .screen-layout-column-main-column .highlightable-row {
10
- background-color: transparent;
10
+ background-color: transparent;
11
11
  }