tgui-core 1.8.4 → 2.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/dist/common/constants.d.ts +4 -0
- package/dist/common/constants.js +17 -0
- package/dist/common/hotkeys.js +48 -48
- package/dist/common/ui.d.ts +6 -0
- package/dist/common/ui.js +63 -59
- package/dist/components/AnimatedNumber.d.ts +1 -1
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/Button.js +21 -22
- package/dist/components/Chart.d.ts +3 -15
- package/dist/components/Chart.js +68 -86
- package/dist/components/ColorBox.js +3 -3
- package/dist/components/Dialog.d.ts +16 -0
- package/dist/components/Dialog.js +5 -5
- package/dist/components/DmIcon.d.ts +1 -1
- package/dist/components/DraggableControl.d.ts +56 -0
- package/dist/components/DraggableControl.js +126 -176
- package/dist/components/Dropdown.d.ts +5 -5
- package/dist/components/Dropdown.js +135 -132
- package/dist/components/FitText.d.ts +1 -1
- package/dist/components/Floating.d.ts +75 -0
- package/dist/components/Floating.js +2235 -0
- package/dist/components/ImageButton.d.ts +2 -3
- package/dist/components/ImageButton.js +88 -98
- package/dist/components/InfinitePlane.d.ts +35 -32
- package/dist/components/InfinitePlane.js +123 -133
- package/dist/components/Knob.d.ts +22 -6
- package/dist/components/Knob.js +45 -46
- package/dist/components/MenuBar.js +81 -97
- package/dist/components/Modal.js +12 -12
- package/dist/components/NumberInput.d.ts +1 -1
- package/dist/components/Popper.d.ts +5 -1
- package/dist/components/Popper.js +1026 -121
- package/dist/components/ProgressBar.js +3 -3
- package/dist/components/RoundGauge.js +30 -30
- package/dist/components/Section.js +7 -7
- package/dist/components/Slider.d.ts +22 -6
- package/dist/components/Slider.js +55 -56
- package/dist/components/Stack.js +3 -3
- package/dist/components/Table.js +7 -7
- package/dist/components/Tabs.js +7 -7
- package/dist/components/TextArea.d.ts +17 -0
- package/dist/components/TextArea.js +35 -33
- package/dist/components/Tooltip.d.ts +3 -34
- package/dist/components/Tooltip.js +14 -77
- package/dist/components/TrackOutsideClicks.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +64 -62
- package/package.json +26 -27
- package/styles/base.scss +13 -11
- package/styles/colors.scss +63 -67
- package/styles/components/BlockQuote.scss +5 -8
- package/styles/components/Button.scss +123 -99
- package/styles/components/Dialog.scss +23 -30
- package/styles/components/Dimmer.scss +3 -8
- package/styles/components/Divider.scss +6 -7
- package/styles/components/Dropdown.scss +97 -52
- package/styles/components/Flex.scss +0 -1
- package/styles/components/Floating.scss +60 -0
- package/styles/components/ImageButton.scss +136 -192
- package/styles/components/Input.scss +24 -26
- package/styles/components/Knob.scss +37 -41
- package/styles/components/LabeledList.scss +8 -6
- package/styles/components/MenuBar.scss +17 -21
- package/styles/components/Modal.scss +8 -7
- package/styles/components/NoticeBox.scss +22 -26
- package/styles/components/NumberInput.scss +30 -28
- package/styles/components/ProgressBar.scss +27 -19
- package/styles/components/RoundGauge.scss +46 -26
- package/styles/components/Section.scss +17 -32
- package/styles/components/Slider.scss +18 -15
- package/styles/components/Stack.scss +8 -48
- package/styles/components/Table.scss +2 -2
- package/styles/components/Tabs.scss +92 -66
- package/styles/components/TextArea.scss +32 -36
- package/styles/components/Tooltip.scss +10 -13
- package/styles/functions.scss +1 -62
- package/styles/main.scss +6 -1
- package/styles/reset.scss +7 -11
- package/styles/vars-colors.scss +108 -0
- package/styles/vars-components.scss +162 -0
- package/styles/vars-values.scss +110 -0
- package/dist/popper-CiqSDJTE.js +0 -906
|
@@ -99,4 +99,8 @@ export declare function getGasLabel(gasId: string, fallbackValue?: string): stri
|
|
|
99
99
|
export declare function getGasColor(gasId: string): string;
|
|
100
100
|
export declare const getGasFromId: (gasId: string) => Gas | undefined;
|
|
101
101
|
export declare const getGasFromPath: (gasPath: string) => Gas | undefined;
|
|
102
|
+
export declare const COMPONENT_COLORS: {
|
|
103
|
+
readonly states: readonly ["", "good", "average", "bad", "black", "white"];
|
|
104
|
+
readonly spectrum: readonly ["red", "orange", "yellow", "olive", "green", "teal", "blue", "violet", "purple", "pink", "brown", "grey"];
|
|
105
|
+
};
|
|
102
106
|
export {};
|
package/dist/common/constants.js
CHANGED
|
@@ -296,9 +296,26 @@ const g = (a) => {
|
|
|
296
296
|
if (e[o].path === a)
|
|
297
297
|
return e[o];
|
|
298
298
|
}
|
|
299
|
+
}, f = {
|
|
300
|
+
states: ["", "good", "average", "bad", "black", "white"],
|
|
301
|
+
spectrum: [
|
|
302
|
+
"red",
|
|
303
|
+
"orange",
|
|
304
|
+
"yellow",
|
|
305
|
+
"olive",
|
|
306
|
+
"green",
|
|
307
|
+
"teal",
|
|
308
|
+
"blue",
|
|
309
|
+
"violet",
|
|
310
|
+
"purple",
|
|
311
|
+
"pink",
|
|
312
|
+
"brown",
|
|
313
|
+
"grey"
|
|
314
|
+
]
|
|
299
315
|
};
|
|
300
316
|
export {
|
|
301
317
|
c as COLORS,
|
|
318
|
+
f as COMPONENT_COLORS,
|
|
302
319
|
u as CSS_COLORS,
|
|
303
320
|
d as RADIO_CHANNELS,
|
|
304
321
|
m as UI_CLOSE,
|
package/dist/common/hotkeys.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { globalEvents as
|
|
2
|
-
import { KEY_ESCAPE as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
E,
|
|
6
|
-
p,
|
|
1
|
+
import { globalEvents as a } from "./events.js";
|
|
2
|
+
import { KEY_ESCAPE as m, KEY_ENTER as h, KEY_SPACE as p, KEY_TAB as E, KEY_CTRL as d, KEY_SHIFT as g, KEY_UP as B, KEY_DOWN as T, KEY_LEFT as b, KEY_RIGHT as S, KEY_F5 as Y } from "./keycodes.js";
|
|
3
|
+
const K = {}, c = [
|
|
4
|
+
m,
|
|
7
5
|
h,
|
|
6
|
+
p,
|
|
7
|
+
E,
|
|
8
8
|
d,
|
|
9
9
|
g,
|
|
10
|
-
S,
|
|
11
|
-
Y,
|
|
12
|
-
_,
|
|
13
10
|
B,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
T,
|
|
12
|
+
b,
|
|
13
|
+
S,
|
|
14
|
+
Y
|
|
15
|
+
], i = {}, u = [];
|
|
16
|
+
function _(n) {
|
|
17
17
|
if (n === 16) return "Shift";
|
|
18
18
|
if (n === 17) return "Ctrl";
|
|
19
19
|
if (n === 18) return "Alt";
|
|
@@ -37,7 +37,7 @@ function F(n) {
|
|
|
37
37
|
if (n === 189) return "-";
|
|
38
38
|
if (n === 190) return ".";
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function y(n) {
|
|
41
41
|
const t = String(n);
|
|
42
42
|
if (t === "Ctrl+F5" || t === "Ctrl+R") {
|
|
43
43
|
location.reload();
|
|
@@ -45,58 +45,58 @@ function N(n) {
|
|
|
45
45
|
}
|
|
46
46
|
if (t === "Ctrl+F" || n.event.defaultPrevented || n.isModifierKey() || c.includes(n.code))
|
|
47
47
|
return;
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
const o = _(n.code);
|
|
49
|
+
if (!o)
|
|
50
50
|
return;
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
return Byond.command(
|
|
54
|
-
if (n.isDown() && !o
|
|
55
|
-
o
|
|
56
|
-
const r =
|
|
51
|
+
const s = K[o];
|
|
52
|
+
if (s)
|
|
53
|
+
return Byond.command(s);
|
|
54
|
+
if (n.isDown() && !i[o]) {
|
|
55
|
+
i[o] = !0;
|
|
56
|
+
const r = `${globalThis.ByondKeyDown} "${o}"`;
|
|
57
57
|
return Byond.command(r);
|
|
58
58
|
}
|
|
59
|
-
if (n.isUp() && o
|
|
60
|
-
o
|
|
61
|
-
const r =
|
|
59
|
+
if (n.isUp() && i[o]) {
|
|
60
|
+
i[o] = !1;
|
|
61
|
+
const r = `${globalThis.ByondKeyUp} "${o}"`;
|
|
62
62
|
return Byond.command(r);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function N(n) {
|
|
66
66
|
c.push(n);
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function U(n) {
|
|
69
69
|
const t = c.indexOf(n);
|
|
70
70
|
t >= 0 && c.splice(t, 1);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
for (const n in
|
|
74
|
-
|
|
72
|
+
function w() {
|
|
73
|
+
for (const n in i)
|
|
74
|
+
i[n] && (i[n] = !1, Byond.command(`${globalThis.ByondKeyUp} "${n}"`));
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
Byond.winget("default.*").then((n) => {
|
|
76
|
+
function D() {
|
|
77
|
+
globalThis.ByondKeyUp || (globalThis.ByondKeyUp = "KeyUp", globalThis.ByondKeyDown = "KeyDown"), Byond.winget("default.*").then((n) => {
|
|
78
78
|
const t = {};
|
|
79
79
|
for (const r in n) {
|
|
80
|
-
const
|
|
81
|
-
e &&
|
|
80
|
+
const f = r.split("."), e = f[1], l = f[2];
|
|
81
|
+
e && l && (t[e] || (t[e] = {}), t[e][l] = n[r]);
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
85
|
-
return r.substring(1, r.length - 1).replace(
|
|
83
|
+
const o = /\\"/g;
|
|
84
|
+
function s(r) {
|
|
85
|
+
return r.substring(1, r.length - 1).replace(o, '"');
|
|
86
86
|
}
|
|
87
87
|
for (const r in t) {
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const f = t[r], e = s(f.name);
|
|
89
|
+
K[e] = s(f.command);
|
|
90
90
|
}
|
|
91
|
-
}),
|
|
92
|
-
|
|
93
|
-
}),
|
|
91
|
+
}), a.on("window-blur", () => {
|
|
92
|
+
w();
|
|
93
|
+
}), a.on("key", (n) => {
|
|
94
94
|
for (const t of u)
|
|
95
95
|
t(n);
|
|
96
|
-
|
|
96
|
+
y(n);
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function H(n) {
|
|
100
100
|
u.push(n);
|
|
101
101
|
let t = !1;
|
|
102
102
|
return () => {
|
|
@@ -104,9 +104,9 @@ function x(n) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
N as acquireHotKey,
|
|
108
|
+
H as listenForKeyEvents,
|
|
109
|
+
w as releaseHeldKeys,
|
|
110
|
+
U as releaseHotKey,
|
|
111
|
+
D as setupHotKeys
|
|
112
112
|
};
|
package/dist/common/ui.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export type StringStyleMap = {
|
|
|
46
46
|
right: string | BooleanLike;
|
|
47
47
|
/** Top margin. */
|
|
48
48
|
top: string | BooleanLike;
|
|
49
|
+
/** Gap on all sides. */
|
|
50
|
+
g: string | BooleanLike;
|
|
51
|
+
/** Row gap. */
|
|
52
|
+
gr: string | BooleanLike;
|
|
53
|
+
/** Column gap. */
|
|
54
|
+
gc: string | BooleanLike;
|
|
49
55
|
/** Overflow property. */
|
|
50
56
|
overflow: string | BooleanLike;
|
|
51
57
|
/** Overflow-X property. */
|
package/dist/common/ui.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CSS_COLORS as
|
|
1
|
+
import { CSS_COLORS as b } from "./constants.js";
|
|
2
2
|
import { classes as y } from "./react.js";
|
|
3
3
|
const f = (o) => {
|
|
4
4
|
if (typeof o == "string")
|
|
5
5
|
return o.endsWith("px") ? `${Number.parseFloat(o) / 12}rem` : o;
|
|
6
6
|
if (typeof o == "number")
|
|
7
7
|
return `${o}rem`;
|
|
8
|
-
},
|
|
8
|
+
}, e = (o) => {
|
|
9
9
|
if (typeof o == "string")
|
|
10
10
|
return f(o);
|
|
11
11
|
if (typeof o == "number")
|
|
@@ -15,76 +15,80 @@ function w(o) {
|
|
|
15
15
|
return !h(o);
|
|
16
16
|
}
|
|
17
17
|
function h(o) {
|
|
18
|
-
return typeof o == "string" &&
|
|
18
|
+
return typeof o == "string" && b.includes(o);
|
|
19
19
|
}
|
|
20
|
-
const c = (o) => (t,
|
|
21
|
-
(typeof
|
|
22
|
-
},
|
|
23
|
-
(typeof
|
|
24
|
-
}, l = (o, t) => (
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
if (typeof
|
|
28
|
-
for (let m = 0; m <
|
|
29
|
-
|
|
30
|
-
}, a = (o) => (t,
|
|
31
|
-
w(
|
|
20
|
+
const c = (o) => (t, n) => {
|
|
21
|
+
(typeof n == "number" || typeof n == "string") && (t[o] = n);
|
|
22
|
+
}, i = (o, t) => (n, r) => {
|
|
23
|
+
(typeof r == "number" || typeof r == "string") && (n[o] = t(r));
|
|
24
|
+
}, l = (o, t) => (n, r) => {
|
|
25
|
+
r && (n[o] = t);
|
|
26
|
+
}, g = (o, t, n) => (r, p) => {
|
|
27
|
+
if (typeof p == "number" || typeof p == "string")
|
|
28
|
+
for (let m = 0; m < n.length; m++)
|
|
29
|
+
r[o + n[m]] = t(p);
|
|
30
|
+
}, a = (o) => (t, n) => {
|
|
31
|
+
w(n) && (t[o] = n);
|
|
32
32
|
}, d = {
|
|
33
33
|
align: c("textAlign"),
|
|
34
|
-
bottom:
|
|
34
|
+
bottom: i("bottom", f),
|
|
35
35
|
fontFamily: c("fontFamily"),
|
|
36
|
-
fontSize:
|
|
36
|
+
fontSize: i("fontSize", f),
|
|
37
37
|
fontWeight: c("fontWeight"),
|
|
38
|
-
height:
|
|
39
|
-
left:
|
|
40
|
-
maxHeight:
|
|
41
|
-
maxWidth:
|
|
42
|
-
minHeight:
|
|
43
|
-
minWidth:
|
|
38
|
+
height: i("height", f),
|
|
39
|
+
left: i("left", f),
|
|
40
|
+
maxHeight: i("maxHeight", f),
|
|
41
|
+
maxWidth: i("maxWidth", f),
|
|
42
|
+
minHeight: i("minHeight", f),
|
|
43
|
+
minWidth: i("minWidth", f),
|
|
44
44
|
opacity: c("opacity"),
|
|
45
45
|
overflow: c("overflow"),
|
|
46
46
|
overflowX: c("overflowX"),
|
|
47
47
|
overflowY: c("overflowY"),
|
|
48
48
|
position: c("position"),
|
|
49
|
-
right:
|
|
49
|
+
right: i("right", f),
|
|
50
50
|
textAlign: c("textAlign"),
|
|
51
|
-
top:
|
|
51
|
+
top: i("top", f),
|
|
52
52
|
verticalAlign: c("verticalAlign"),
|
|
53
|
-
width:
|
|
53
|
+
width: i("width", f),
|
|
54
54
|
lineHeight: (o, t) => {
|
|
55
55
|
typeof t == "number" ? o.lineHeight = t : typeof t == "string" && (o.lineHeight = f(t));
|
|
56
56
|
},
|
|
57
57
|
// Margin
|
|
58
|
-
m:
|
|
58
|
+
m: g("margin", e, [
|
|
59
59
|
"Top",
|
|
60
60
|
"Bottom",
|
|
61
61
|
"Left",
|
|
62
62
|
"Right"
|
|
63
63
|
]),
|
|
64
|
-
mb:
|
|
65
|
-
ml:
|
|
66
|
-
mr:
|
|
67
|
-
mt:
|
|
68
|
-
mx:
|
|
69
|
-
my:
|
|
64
|
+
mb: i("marginBottom", e),
|
|
65
|
+
ml: i("marginLeft", e),
|
|
66
|
+
mr: i("marginRight", e),
|
|
67
|
+
mt: i("marginTop", e),
|
|
68
|
+
mx: g("margin", e, ["Left", "Right"]),
|
|
69
|
+
my: g("margin", e, ["Top", "Bottom"]),
|
|
70
|
+
// Gap
|
|
71
|
+
g: i("gap", e),
|
|
72
|
+
gr: i("rowGap", e),
|
|
73
|
+
gc: i("columnGap", e),
|
|
70
74
|
// Padding
|
|
71
|
-
p:
|
|
75
|
+
p: g("padding", e, [
|
|
72
76
|
"Top",
|
|
73
77
|
"Bottom",
|
|
74
78
|
"Left",
|
|
75
79
|
"Right"
|
|
76
80
|
]),
|
|
77
|
-
pb:
|
|
78
|
-
pl:
|
|
79
|
-
pr:
|
|
80
|
-
pt:
|
|
81
|
-
px:
|
|
82
|
-
py:
|
|
81
|
+
pb: i("paddingBottom", e),
|
|
82
|
+
pl: i("paddingLeft", e),
|
|
83
|
+
pr: i("paddingRight", e),
|
|
84
|
+
pt: i("paddingTop", e),
|
|
85
|
+
px: g("padding", e, ["Left", "Right"]),
|
|
86
|
+
py: g("padding", e, ["Top", "Bottom"]),
|
|
83
87
|
// Color props
|
|
84
88
|
color: a("color"),
|
|
85
89
|
textColor: a("color"),
|
|
86
90
|
backgroundColor: a("backgroundColor")
|
|
87
|
-
},
|
|
91
|
+
}, u = {
|
|
88
92
|
bold: l("fontWeight", "bold"),
|
|
89
93
|
fillPositionedParent: (o, t) => {
|
|
90
94
|
t && (o.position = "absolute", o.top = 0, o.bottom = 0, o.left = 0, o.right = 0);
|
|
@@ -95,43 +99,43 @@ const c = (o) => (t, i) => {
|
|
|
95
99
|
preserveWhitespace: l("whiteSpace", "pre-wrap")
|
|
96
100
|
};
|
|
97
101
|
function T(o) {
|
|
98
|
-
const t = {},
|
|
99
|
-
for (const
|
|
100
|
-
if (
|
|
102
|
+
const t = {}, n = {};
|
|
103
|
+
for (const r in o) {
|
|
104
|
+
if (r === "style")
|
|
101
105
|
continue;
|
|
102
|
-
const
|
|
103
|
-
m ? m(
|
|
106
|
+
const p = o[r], m = d[r] || u[r];
|
|
107
|
+
m ? m(n, p) : t[r] = p;
|
|
104
108
|
}
|
|
105
|
-
return t.style = { ...
|
|
109
|
+
return t.style = { ...n, ...o.style }, t;
|
|
106
110
|
}
|
|
107
111
|
function S(o) {
|
|
108
|
-
const t = o.textColor || o.color, { backgroundColor:
|
|
112
|
+
const t = o.textColor || o.color, { backgroundColor: n } = o;
|
|
109
113
|
return y([
|
|
110
114
|
h(t) && `color-${t}`,
|
|
111
|
-
h(
|
|
115
|
+
h(n) && `color-bg-${n}`
|
|
112
116
|
]);
|
|
113
117
|
}
|
|
114
118
|
function P(o) {
|
|
115
119
|
const t = {};
|
|
116
120
|
if (!o) return t;
|
|
117
|
-
const
|
|
118
|
-
for (const
|
|
119
|
-
const [
|
|
120
|
-
if (
|
|
121
|
-
if (
|
|
121
|
+
const n = o.split(" ");
|
|
122
|
+
for (const r of n) {
|
|
123
|
+
const [p, m] = r.split("-");
|
|
124
|
+
if (p)
|
|
125
|
+
if (p in d) {
|
|
122
126
|
if (m === "") continue;
|
|
123
|
-
const
|
|
124
|
-
!Number.isNaN(
|
|
125
|
-
} else
|
|
127
|
+
const s = Number(m);
|
|
128
|
+
!Number.isNaN(s) && Number.isFinite(s) ? t[p] = s : t[p] = m;
|
|
129
|
+
} else p in u ? t[p] = !0 : console.warn(`Unknown prop ${p}`);
|
|
126
130
|
}
|
|
127
131
|
return t;
|
|
128
132
|
}
|
|
129
133
|
export {
|
|
130
|
-
|
|
134
|
+
u as booleanStyleMap,
|
|
131
135
|
S as computeBoxClassName,
|
|
132
136
|
T as computeBoxProps,
|
|
133
137
|
P as computeTwClass,
|
|
134
|
-
|
|
138
|
+
e as halfUnit,
|
|
135
139
|
d as stringStyleMap,
|
|
136
140
|
f as unit
|
|
137
141
|
};
|
|
@@ -26,7 +26,7 @@ export declare class AnimatedNumber extends Component<Props> {
|
|
|
26
26
|
/**
|
|
27
27
|
* The inner `<span/>` being updated sixty times per second.
|
|
28
28
|
*/
|
|
29
|
-
ref: import('react').RefObject<HTMLSpanElement>;
|
|
29
|
+
ref: import('react').RefObject<HTMLSpanElement | null>;
|
|
30
30
|
/**
|
|
31
31
|
* The interval being used to update the inner span.
|
|
32
32
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Placement } from '@
|
|
1
|
+
import { Placement } from '@floating-ui/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { BooleanLike } from '../common/react';
|
|
4
4
|
import { BoxProps } from './Box';
|
|
@@ -27,7 +27,7 @@ type Props = Partial<{
|
|
|
27
27
|
circular: boolean;
|
|
28
28
|
/** Reduces the padding of the button */
|
|
29
29
|
compact: boolean;
|
|
30
|
-
/** Disables and
|
|
30
|
+
/** Disables button and makes it semi-transparent */
|
|
31
31
|
disabled: BooleanLike;
|
|
32
32
|
/** Fill all available horizontal space */
|
|
33
33
|
fluid: boolean;
|
|
@@ -51,7 +51,7 @@ type Props = Partial<{
|
|
|
51
51
|
selected: BooleanLike;
|
|
52
52
|
/** A fancy, boxy tooltip, which appears when hovering over the button */
|
|
53
53
|
tooltip: ReactNode;
|
|
54
|
-
/** Position of the tooltip.
|
|
54
|
+
/** Position of the tooltip. Does not guarantee the position is respected. */
|
|
55
55
|
tooltipPosition: Placement;
|
|
56
56
|
/** Align content vertically using flex. Use lineHeight if the height is static. */
|
|
57
57
|
verticalAlignContent: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as r, jsxs as _, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import { useState as A, createRef as V, useEffect as $, useRef as z } from "react";
|
|
3
|
-
import { KEY as
|
|
4
|
-
import { classes as
|
|
5
|
-
import {
|
|
3
|
+
import { KEY as F, isEscape as E } from "../common/keys.js";
|
|
4
|
+
import { classes as P } from "../common/react.js";
|
|
5
|
+
import { computeBoxProps as j, computeBoxClassName as q } from "../common/ui.js";
|
|
6
6
|
import { Box as O } from "./Box.js";
|
|
7
7
|
import { Icon as S } from "./Icon.js";
|
|
8
8
|
import { Tooltip as v } from "./Tooltip.js";
|
|
@@ -23,31 +23,32 @@ function R(e) {
|
|
|
23
23
|
iconPosition: y,
|
|
24
24
|
iconRotation: k,
|
|
25
25
|
iconSize: m,
|
|
26
|
-
iconSpin:
|
|
26
|
+
iconSpin: w,
|
|
27
27
|
onClick: f,
|
|
28
28
|
selected: g,
|
|
29
29
|
tooltip: I,
|
|
30
|
-
tooltipPosition:
|
|
30
|
+
tooltipPosition: D,
|
|
31
31
|
verticalAlignContent: x,
|
|
32
32
|
...N
|
|
33
33
|
} = e, n = C || a;
|
|
34
34
|
let b = /* @__PURE__ */ r(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
|
-
className:
|
|
37
|
+
className: P([
|
|
38
38
|
"Button",
|
|
39
39
|
l && "Button--fluid",
|
|
40
40
|
t && "Button--disabled",
|
|
41
41
|
g && "Button--selected",
|
|
42
42
|
h && "Button--circular",
|
|
43
43
|
B && "Button--compact",
|
|
44
|
-
|
|
44
|
+
!n && "Button--empty",
|
|
45
|
+
y && `Button--icon-${y}`,
|
|
45
46
|
x && "Button--flex",
|
|
46
47
|
x && l && "Button--flex--fluid",
|
|
47
48
|
x && `Button--verticalAlignContent--${x}`,
|
|
48
49
|
c && typeof c == "string" ? `Button--color--${c}` : "Button--color--default",
|
|
49
50
|
d,
|
|
50
|
-
|
|
51
|
+
q(N)
|
|
51
52
|
]),
|
|
52
53
|
tabIndex: t ? void 0 : 0,
|
|
53
54
|
onClick: (p) => {
|
|
@@ -55,18 +56,18 @@ function R(e) {
|
|
|
55
56
|
},
|
|
56
57
|
onKeyDown: (p) => {
|
|
57
58
|
if (u) {
|
|
58
|
-
if (p.key ===
|
|
59
|
+
if (p.key === F.Space || p.key === F.Enter) {
|
|
59
60
|
p.preventDefault(), !t && f && f(p);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
E(p.key) && p.preventDefault();
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
|
-
...
|
|
66
|
+
...j(N),
|
|
66
67
|
children: /* @__PURE__ */ _(
|
|
67
68
|
"div",
|
|
68
69
|
{
|
|
69
|
-
className:
|
|
70
|
+
className: P([
|
|
70
71
|
"Button__content",
|
|
71
72
|
o && "Button__content--ellipsis"
|
|
72
73
|
]),
|
|
@@ -74,24 +75,22 @@ function R(e) {
|
|
|
74
75
|
i && y !== "right" && /* @__PURE__ */ r(
|
|
75
76
|
S,
|
|
76
77
|
{
|
|
77
|
-
mr: n && 0.5,
|
|
78
78
|
name: i,
|
|
79
79
|
color: s,
|
|
80
80
|
rotation: k,
|
|
81
81
|
size: m,
|
|
82
|
-
spin:
|
|
82
|
+
spin: w
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
85
|
o ? /* @__PURE__ */ r("span", { className: "Button--ellipsis", children: n }) : n,
|
|
86
86
|
i && y === "right" && /* @__PURE__ */ r(
|
|
87
87
|
S,
|
|
88
88
|
{
|
|
89
|
-
ml: n && 0.5,
|
|
90
89
|
name: i,
|
|
91
90
|
color: s,
|
|
92
91
|
rotation: k,
|
|
93
92
|
size: m,
|
|
94
|
-
spin:
|
|
93
|
+
spin: w
|
|
95
94
|
}
|
|
96
95
|
)
|
|
97
96
|
]
|
|
@@ -99,7 +98,7 @@ function R(e) {
|
|
|
99
98
|
)
|
|
100
99
|
}
|
|
101
100
|
);
|
|
102
|
-
return I && (b = /* @__PURE__ */ r(v, { content: I, position:
|
|
101
|
+
return I && (b = /* @__PURE__ */ r(v, { content: I, position: D, children: b })), b;
|
|
103
102
|
}
|
|
104
103
|
function T(e) {
|
|
105
104
|
const { checked: u, ...a } = e;
|
|
@@ -165,8 +164,8 @@ function Y(e) {
|
|
|
165
164
|
placeholder: y,
|
|
166
165
|
tooltip: k,
|
|
167
166
|
tooltipPosition: m,
|
|
168
|
-
...
|
|
169
|
-
} = e, [f, g] = A(!1), I = V(),
|
|
167
|
+
...w
|
|
168
|
+
} = e, [f, g] = A(!1), I = V(), D = h || u;
|
|
170
169
|
function x(n) {
|
|
171
170
|
const b = I.current;
|
|
172
171
|
if (!b) return;
|
|
@@ -185,17 +184,17 @@ function Y(e) {
|
|
|
185
184
|
let N = /* @__PURE__ */ _(
|
|
186
185
|
O,
|
|
187
186
|
{
|
|
188
|
-
className:
|
|
187
|
+
className: P([
|
|
189
188
|
"Button",
|
|
190
189
|
C && "Button--fluid",
|
|
191
190
|
B && "Button--disabled",
|
|
192
191
|
`Button--color--${a}`
|
|
193
192
|
]),
|
|
194
|
-
...
|
|
193
|
+
...w,
|
|
195
194
|
onClick: () => g(!0),
|
|
196
195
|
children: [
|
|
197
196
|
t && /* @__PURE__ */ r(S, { name: t, rotation: o, spin: l }),
|
|
198
|
-
/* @__PURE__ */ r("div", { children:
|
|
197
|
+
/* @__PURE__ */ r("div", { children: D }),
|
|
199
198
|
/* @__PURE__ */ r(
|
|
200
199
|
"input",
|
|
201
200
|
{
|
|
@@ -210,7 +209,7 @@ function Y(e) {
|
|
|
210
209
|
f && (g(!1), x(n));
|
|
211
210
|
},
|
|
212
211
|
onKeyDown: (n) => {
|
|
213
|
-
if (n.key ===
|
|
212
|
+
if (n.key === F.Enter) {
|
|
214
213
|
g(!1), x(n);
|
|
215
214
|
return;
|
|
216
215
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Component, RefObject } from 'react';
|
|
2
1
|
import { BoxProps } from './Box';
|
|
3
2
|
type Props = {
|
|
4
3
|
data: number[][];
|
|
@@ -9,19 +8,8 @@ type Props = {
|
|
|
9
8
|
strokeColor: string;
|
|
10
9
|
strokeWidth: number;
|
|
11
10
|
}> & BoxProps;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declare class LineChart extends Component<Props> {
|
|
16
|
-
ref: RefObject<HTMLDivElement>;
|
|
17
|
-
state: State;
|
|
18
|
-
constructor(props: Props);
|
|
19
|
-
componentDidMount(): void;
|
|
20
|
-
componentWillUnmount(): void;
|
|
21
|
-
handleResize: () => void;
|
|
22
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Chart(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare namespace Chart {
|
|
13
|
+
var Line: typeof Chart;
|
|
23
14
|
}
|
|
24
|
-
export declare const Chart: {
|
|
25
|
-
Line: typeof LineChart;
|
|
26
|
-
};
|
|
27
15
|
export {};
|