@remvst/design-system 0.0.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/.github/workflows/check.yaml +22 -0
- package/README.md +5 -0
- package/lib/alignment/alignment.css +24 -0
- package/lib/alignment/alignment.d.ts +14 -0
- package/lib/alignment/alignment.js +33 -0
- package/lib/animations/animations.css +125 -0
- package/lib/animations/animations.d.ts +8 -0
- package/lib/animations/animations.js +23 -0
- package/lib/balanced-row/balanced-row.css +9 -0
- package/lib/balanced-row/balanced-row.d.ts +5 -0
- package/lib/balanced-row/balanced-row.js +16 -0
- package/lib/balanced-stack/balanced-stack.css +10 -0
- package/lib/balanced-stack/balanced-stack.d.ts +5 -0
- package/lib/balanced-stack/balanced-stack.js +16 -0
- package/lib/buttons/buttons.css +10 -0
- package/lib/buttons/buttons.d.ts +5 -0
- package/lib/buttons/buttons.js +12 -0
- package/lib/component-with-class-name.d.ts +5 -0
- package/lib/component-with-class-name.js +15 -0
- package/lib/dim/dim.css +5 -0
- package/lib/dim/dim.d.ts +5 -0
- package/lib/dim/dim.js +12 -0
- package/lib/flow-list/flow-list.css +10 -0
- package/lib/flow-list/flow-list.d.ts +5 -0
- package/lib/flow-list/flow-list.js +16 -0
- package/lib/focusable.d.ts +13 -0
- package/lib/focusable.js +31 -0
- package/lib/frame/frame.css +3 -0
- package/lib/frame/frame.d.ts +5 -0
- package/lib/frame/frame.js +12 -0
- package/lib/gauge/gauge.css +24 -0
- package/lib/gauge/gauge.d.ts +10 -0
- package/lib/gauge/gauge.js +18 -0
- package/lib/highlightable-row/highlightable-row.css +11 -0
- package/lib/highlightable-row/highlightable-row.d.ts +11 -0
- package/lib/highlightable-row/highlightable-row.js +15 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +38 -0
- package/lib/key-value-layout/key-value-layout.css +15 -0
- package/lib/key-value-layout/key-value-layout.d.ts +5 -0
- package/lib/key-value-layout/key-value-layout.js +12 -0
- package/lib/labels/labels.css +39 -0
- package/lib/labels/labels.d.ts +23 -0
- package/lib/labels/labels.js +54 -0
- package/lib/reset/reset.css +13 -0
- package/lib/screen-column-layout/screen-column-layout.css +126 -0
- package/lib/screen-column-layout/screen-column-layout.d.ts +20 -0
- package/lib/screen-column-layout/screen-column-layout.js +47 -0
- package/lib/screen-stack-layout/screen-stack-layout.css +26 -0
- package/lib/screen-stack-layout/screen-stack-layout.d.ts +14 -0
- package/lib/screen-stack-layout/screen-stack-layout.js +33 -0
- package/lib/scrollable-content/scrollable-content.css +5 -0
- package/lib/scrollable-content/scrollable-content.d.ts +5 -0
- package/lib/scrollable-content/scrollable-content.js +12 -0
- package/lib/slider/slider.css +85 -0
- package/lib/slider/slider.d.ts +18 -0
- package/lib/slider/slider.js +47 -0
- package/lib/spacing/spacing.css +9 -0
- package/lib/spacing/spacing.d.ts +10 -0
- package/lib/spacing/spacing.js +14 -0
- package/lib/stack-list/stack-list.css +4 -0
- package/lib/stack-list/stack-list.d.ts +5 -0
- package/lib/stack-list/stack-list.js +16 -0
- package/lib/tabs/tabs.css +24 -0
- package/lib/tabs/tabs.d.ts +13 -0
- package/lib/tabs/tabs.js +25 -0
- package/lib/typography/typography.css +9 -0
- package/lib/typography/typography.d.ts +10 -0
- package/lib/typography/typography.js +14 -0
- package/package.json +27 -0
- package/src/alignment/alignment.css +24 -0
- package/src/alignment/alignment.tsx +18 -0
- package/src/animations/animations.css +125 -0
- package/src/animations/animations.ts +21 -0
- package/src/assets.d.ts +1 -0
- package/src/balanced-row/balanced-row.css +9 -0
- package/src/balanced-row/balanced-row.tsx +16 -0
- package/src/balanced-stack/balanced-stack.css +10 -0
- package/src/balanced-stack/balanced-stack.tsx +16 -0
- package/src/buttons/buttons.css +10 -0
- package/src/buttons/buttons.tsx +6 -0
- package/src/component-with-class-name.tsx +15 -0
- package/src/dim/dim.css +5 -0
- package/src/dim/dim.tsx +6 -0
- package/src/flow-list/flow-list.css +10 -0
- package/src/flow-list/flow-list.tsx +16 -0
- package/src/focusable.tsx +48 -0
- package/src/frame/frame.css +3 -0
- package/src/frame/frame.tsx +6 -0
- package/src/gauge/gauge.css +24 -0
- package/src/gauge/gauge.tsx +25 -0
- package/src/highlightable-row/highlightable-row.css +11 -0
- package/src/highlightable-row/highlightable-row.tsx +17 -0
- package/src/index.ts +23 -0
- package/src/key-value-layout/key-value-layout.css +15 -0
- package/src/key-value-layout/key-value-layout.tsx +6 -0
- package/src/labels/labels.css +39 -0
- package/src/labels/labels.tsx +30 -0
- package/src/reset/reset.css +13 -0
- package/src/screen-column-layout/screen-column-layout.css +126 -0
- package/src/screen-column-layout/screen-column-layout.tsx +26 -0
- package/src/screen-stack-layout/screen-stack-layout.css +26 -0
- package/src/screen-stack-layout/screen-stack-layout.tsx +18 -0
- package/src/scrollable-content/scrollable-content.css +5 -0
- package/src/scrollable-content/scrollable-content.tsx +6 -0
- package/src/slider/slider.css +85 -0
- package/src/slider/slider.tsx +61 -0
- package/src/spacing/spacing.css +9 -0
- package/src/spacing/spacing.ts +11 -0
- package/src/stack-list/stack-list.css +4 -0
- package/src/stack-list/stack-list.tsx +16 -0
- package/src/tabs/tabs.css +24 -0
- package/src/tabs/tabs.tsx +29 -0
- package/src/typography/typography.css +9 -0
- package/src/typography/typography.ts +11 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Spacing = void 0;
|
|
4
|
+
require("./spacing.css");
|
|
5
|
+
class Spacing {
|
|
6
|
+
}
|
|
7
|
+
exports.Spacing = Spacing;
|
|
8
|
+
Spacing.xxl = "var(--spacing-xxl)";
|
|
9
|
+
Spacing.xl = "var(--spacing-xl)";
|
|
10
|
+
Spacing.l = "var(--spacing-l)";
|
|
11
|
+
Spacing.m = "var(--spacing-m)";
|
|
12
|
+
Spacing.s = "var(--spacing-s)";
|
|
13
|
+
Spacing.xs = "var(--spacing-xs)";
|
|
14
|
+
Spacing.xxs = "var(--spacing-xxs)";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StackList = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
require("./stack-list.css");
|
|
9
|
+
class StackList extends react_1.default.Component {
|
|
10
|
+
render() {
|
|
11
|
+
return (react_1.default.createElement("div", { className: "stack-list", ...this.props }, react_1.default.Children.map(this.props.children, (child, i) => {
|
|
12
|
+
return react_1.default.createElement("div", { key: `child-${i}` }, child);
|
|
13
|
+
})));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.StackList = StackList;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.tab-layout {
|
|
2
|
+
flex: 0 1 auto;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.tab-layout > * {
|
|
8
|
+
flex: 1 0 0px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.tab {
|
|
12
|
+
border-bottom: 2px solid transparent;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
padding: 5px;
|
|
15
|
+
font-size: 15px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tab:focus {
|
|
19
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tab.selected {
|
|
23
|
+
border-bottom-color: white;
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Focusable } from "../focusable";
|
|
3
|
+
import "./tabs.css";
|
|
4
|
+
export declare class TabLayout extends React.Component<React.HTMLAttributes<HTMLDivElement>> {
|
|
5
|
+
render(): React.JSX.Element;
|
|
6
|
+
}
|
|
7
|
+
interface TabProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class Tab extends Focusable<TabProps> {
|
|
11
|
+
get className(): string;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/lib/tabs/tabs.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Tab = exports.TabLayout = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const focusable_1 = require("../focusable");
|
|
9
|
+
require("./tabs.css");
|
|
10
|
+
class TabLayout extends react_1.default.Component {
|
|
11
|
+
render() {
|
|
12
|
+
return (react_1.default.createElement("div", { className: "tab-layout", ...this.props }, this.props.children));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.TabLayout = TabLayout;
|
|
16
|
+
class Tab extends focusable_1.Focusable {
|
|
17
|
+
get className() {
|
|
18
|
+
let className = "tab";
|
|
19
|
+
if (this.props.selected) {
|
|
20
|
+
className += " selected";
|
|
21
|
+
}
|
|
22
|
+
return className;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.Tab = Tab;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./typography.css";
|
|
2
|
+
export declare class Typography {
|
|
3
|
+
static readonly xxl = "var(--font-size-xxl)";
|
|
4
|
+
static readonly xl = "var(--font-size-xl)";
|
|
5
|
+
static readonly l = "var(--font-size-l)";
|
|
6
|
+
static readonly m = "var(--font-size-m)";
|
|
7
|
+
static readonly s = "var(--font-size-s)";
|
|
8
|
+
static readonly xs = "var(--font-size-xs)";
|
|
9
|
+
static readonly xxs = "var(--font-size-xxs)";
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Typography = void 0;
|
|
4
|
+
require("./typography.css");
|
|
5
|
+
class Typography {
|
|
6
|
+
}
|
|
7
|
+
exports.Typography = Typography;
|
|
8
|
+
Typography.xxl = "var(--font-size-xxl)";
|
|
9
|
+
Typography.xl = "var(--font-size-xl)";
|
|
10
|
+
Typography.l = "var(--font-size-l)";
|
|
11
|
+
Typography.m = "var(--font-size-m)";
|
|
12
|
+
Typography.s = "var(--font-size-s)";
|
|
13
|
+
Typography.xs = "var(--font-size-xs)";
|
|
14
|
+
Typography.xxs = "var(--font-size-xxs)";
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@remvst/design-system",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prettier:fix": "prettier . --write",
|
|
8
|
+
"prettier:check": "prettier . --check",
|
|
9
|
+
"copy-files": "copyfiles -u 1 src/**/*.css lib/",
|
|
10
|
+
"build": "rm -rf lib && tsc && npm run copy-files",
|
|
11
|
+
"prepublishOnly": "npm i && npm run build",
|
|
12
|
+
"test": "npm run prettier:check && npm run build"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "Rémi Vansteelandt",
|
|
16
|
+
"license": "",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@types/react": "^18.2.45",
|
|
19
|
+
"react": "^18.2.0",
|
|
20
|
+
"typescript": "^5.2.2"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"copyfiles": "^2.4.1",
|
|
24
|
+
"prettier": "3.1.1",
|
|
25
|
+
"rimraf": "^5.0.5"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.vertical-center {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
height: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.horizontal-center {
|
|
9
|
+
margin: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.align-right {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
justify-content: end;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.narrow-column {
|
|
19
|
+
width: 100%;
|
|
20
|
+
max-width: 50%;
|
|
21
|
+
max-height: 100%;
|
|
22
|
+
margin-left: auto;
|
|
23
|
+
margin-right: auto;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./alignment.css";
|
|
2
|
+
import { ComponentWithClassName } from "../component-with-class-name";
|
|
3
|
+
|
|
4
|
+
export class VerticalCenter extends ComponentWithClassName {
|
|
5
|
+
protected readonly className = "vertical-center";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class HorizontalCenter extends ComponentWithClassName {
|
|
9
|
+
protected readonly className = "horizontal-center";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class AlignRight extends ComponentWithClassName {
|
|
13
|
+
protected readonly className = "align-right";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class NarrowColumn extends ComponentWithClassName {
|
|
17
|
+
protected readonly className = "narrow-column";
|
|
18
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.animate-in {
|
|
2
|
+
animation: animate-in 0.2s ease-out;
|
|
3
|
+
animation-fill-mode: both;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.zoom-in {
|
|
7
|
+
opacity: 1;
|
|
8
|
+
animation: zoom-in 0.2s ease-out;
|
|
9
|
+
animation-fill-mode: forwards;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.slide-up {
|
|
13
|
+
transform: none;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
animation: slide-up 0.5s ease-out;
|
|
16
|
+
animation-fill-mode: forwards;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.slide-down {
|
|
20
|
+
transform: none;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
animation: slide-down 0.1s linear;
|
|
23
|
+
animation-fill-mode: forwards;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.fade-in {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
animation: fade-in 1s ease-out;
|
|
29
|
+
animation-fill-mode: forwards;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.shake {
|
|
33
|
+
position: relative;
|
|
34
|
+
animation: shake 0.2s;
|
|
35
|
+
animation-iteration-count: infinite;
|
|
36
|
+
}
|
|
37
|
+
|
|
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
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes zoom-in {
|
|
50
|
+
0% {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
transform: none;
|
|
53
|
+
}
|
|
54
|
+
100% {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transform: scale(200%, 200%);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes slide-up {
|
|
61
|
+
0% {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transform: translateY(50px);
|
|
64
|
+
}
|
|
65
|
+
100% {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
transform: translateY(0px);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes slide-down {
|
|
72
|
+
0% {
|
|
73
|
+
opacity: 0;
|
|
74
|
+
transform: translateY(-200px);
|
|
75
|
+
}
|
|
76
|
+
100% {
|
|
77
|
+
opacity: 1;
|
|
78
|
+
transform: translateY(0px);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@keyframes fade-in {
|
|
83
|
+
0% {
|
|
84
|
+
opacity: 0;
|
|
85
|
+
}
|
|
86
|
+
100% {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
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
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import "./animations.css";
|
|
3
|
+
|
|
4
|
+
export class AnimateInSequence {
|
|
5
|
+
delay = 0;
|
|
6
|
+
interval = 0.05;
|
|
7
|
+
animationClassName = "animate-in";
|
|
8
|
+
|
|
9
|
+
next(extraStyle: CSSProperties = {}): React.HTMLAttributes<HTMLElement> {
|
|
10
|
+
const delay = this.delay;
|
|
11
|
+
this.delay += this.interval;
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
className: this.animationClassName,
|
|
15
|
+
style: {
|
|
16
|
+
animationDelay: delay + "s",
|
|
17
|
+
...extraStyle,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/assets.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "*.css";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./balanced-row.css";
|
|
3
|
+
|
|
4
|
+
export class BalancedRow extends React.Component<
|
|
5
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
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
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./balanced-stack.css";
|
|
3
|
+
|
|
4
|
+
export class BalancedStack extends React.Component<
|
|
5
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
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
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export abstract class ComponentWithClassName<
|
|
4
|
+
Props extends
|
|
5
|
+
React.HTMLAttributes<HTMLDivElement> = React.HTMLAttributes<HTMLDivElement>,
|
|
6
|
+
> extends React.Component<Props> {
|
|
7
|
+
protected abstract readonly className: string;
|
|
8
|
+
|
|
9
|
+
render() {
|
|
10
|
+
const props = { ...this.props } as any;
|
|
11
|
+
props.className = this.className + " " + (this.props.className || "");
|
|
12
|
+
|
|
13
|
+
return <div {...props}>{this.props.children}</div>;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/dim/dim.css
ADDED
package/src/dim/dim.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./flow-list.css";
|
|
3
|
+
|
|
4
|
+
export class FlowList extends React.Component<
|
|
5
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
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
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export abstract class Focusable<
|
|
8
|
+
PropsType extends Props = Props,
|
|
9
|
+
> extends React.Component<PropsType> {
|
|
10
|
+
protected abstract readonly className: string;
|
|
11
|
+
private divElement: HTMLDivElement;
|
|
12
|
+
|
|
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
|
+
}
|
|
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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.gauge {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 20px;
|
|
4
|
+
background-color: #444;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
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);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.gauge > div > * {
|
|
20
|
+
color: black;
|
|
21
|
+
font-size: 15px;
|
|
22
|
+
flex: 0 0 auto;
|
|
23
|
+
align-self: center;
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./gauge.css";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class Gauge extends React.Component<
|
|
10
|
+
Props & React.HTMLAttributes<HTMLDivElement>
|
|
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
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.highlightable-row {
|
|
2
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.highlightable-row:focus {
|
|
6
|
+
background-color: rgba(255, 255, 255, 0.2) !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.screen-layout-column > .screen-layout-column-main-column .highlightable-row {
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Focusable } from "../focusable";
|
|
2
|
+
import "./highlightable-row.css";
|
|
3
|
+
|
|
4
|
+
interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
highlighted?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class HighlightableRow extends Focusable<Props> {
|
|
9
|
+
protected saneProps(): Props {
|
|
10
|
+
const { highlighted, ...other } = this.props;
|
|
11
|
+
return other;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
protected get className() {
|
|
15
|
+
return "highlightable-row" + (this.props.highlighted ? " highlighted" : "");
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./reset/reset.css";
|
|
2
|
+
|
|
3
|
+
export * from "./animations/animations";
|
|
4
|
+
export * from "./alignment/alignment";
|
|
5
|
+
export * from "./balanced-row/balanced-row";
|
|
6
|
+
export * from "./balanced-stack/balanced-stack";
|
|
7
|
+
export * from "./buttons/buttons";
|
|
8
|
+
export * from "./dim/dim";
|
|
9
|
+
export * from "./flow-list/flow-list";
|
|
10
|
+
export * from "./focusable";
|
|
11
|
+
export * from "./frame/frame";
|
|
12
|
+
export * from "./gauge/gauge";
|
|
13
|
+
export * from "./highlightable-row/highlightable-row";
|
|
14
|
+
export * from "./key-value-layout/key-value-layout";
|
|
15
|
+
export * from "./labels/labels";
|
|
16
|
+
export * from "./screen-column-layout/screen-column-layout";
|
|
17
|
+
export * from "./screen-stack-layout/screen-stack-layout";
|
|
18
|
+
export * from "./scrollable-content/scrollable-content";
|
|
19
|
+
export * from "./slider/slider";
|
|
20
|
+
export * from "./spacing/spacing";
|
|
21
|
+
export * from "./stack-list/stack-list";
|
|
22
|
+
export * from "./tabs/tabs";
|
|
23
|
+
export * from "./typography/typography";
|