tgui-core 1.8.1 → 1.8.3
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/ui.js +67 -67
- package/dist/components/Button.d.ts +2 -0
- package/dist/components/Button.js +131 -126
- package/dist/components/MenuBar.js +67 -64
- package/package.json +1 -1
- package/styles/components/Input.scss +4 -2
- package/styles/components/MenuBar.scss +1 -1
package/dist/common/ui.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import { CSS_COLORS as u } from "./constants.js";
|
|
2
2
|
import { classes as y } from "./react.js";
|
|
3
|
-
const f = (
|
|
4
|
-
if (typeof
|
|
5
|
-
return
|
|
6
|
-
if (typeof
|
|
7
|
-
return `${
|
|
8
|
-
}, p = (
|
|
9
|
-
if (typeof
|
|
10
|
-
return f(
|
|
11
|
-
if (typeof
|
|
12
|
-
return f(
|
|
3
|
+
const f = (o) => {
|
|
4
|
+
if (typeof o == "string")
|
|
5
|
+
return o.endsWith("px") ? `${Number.parseFloat(o) / 12}rem` : o;
|
|
6
|
+
if (typeof o == "number")
|
|
7
|
+
return `${o}rem`;
|
|
8
|
+
}, p = (o) => {
|
|
9
|
+
if (typeof o == "string")
|
|
10
|
+
return f(o);
|
|
11
|
+
if (typeof o == "number")
|
|
12
|
+
return f(o * 0.5);
|
|
13
13
|
};
|
|
14
|
-
function w(
|
|
15
|
-
return !h(
|
|
14
|
+
function w(o) {
|
|
15
|
+
return !h(o);
|
|
16
16
|
}
|
|
17
|
-
function h(
|
|
18
|
-
return typeof
|
|
17
|
+
function h(o) {
|
|
18
|
+
return typeof o == "string" && u.includes(o);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
(typeof i == "number" || typeof i == "string") && (o
|
|
22
|
-
}, n = (
|
|
23
|
-
(typeof e == "number" || typeof e == "string") && (i[
|
|
24
|
-
},
|
|
25
|
-
e && (i[
|
|
26
|
-
},
|
|
20
|
+
const c = (o) => (t, i) => {
|
|
21
|
+
(typeof i == "number" || typeof i == "string") && (t[o] = i);
|
|
22
|
+
}, n = (o, t) => (i, e) => {
|
|
23
|
+
(typeof e == "number" || typeof e == "string") && (i[o] = t(e));
|
|
24
|
+
}, l = (o, t) => (i, e) => {
|
|
25
|
+
e && (i[o] = t);
|
|
26
|
+
}, s = (o, t, i) => (e, r) => {
|
|
27
27
|
if (typeof r == "number" || typeof r == "string")
|
|
28
28
|
for (let m = 0; m < i.length; m++)
|
|
29
|
-
e[
|
|
30
|
-
}, a = (
|
|
31
|
-
w(i) && (o
|
|
29
|
+
e[o + i[m]] = t(r);
|
|
30
|
+
}, a = (o) => (t, i) => {
|
|
31
|
+
w(i) && (t[o] = i);
|
|
32
32
|
}, d = {
|
|
33
|
-
align:
|
|
33
|
+
align: c("textAlign"),
|
|
34
34
|
bottom: n("bottom", f),
|
|
35
|
-
fontFamily:
|
|
35
|
+
fontFamily: c("fontFamily"),
|
|
36
36
|
fontSize: n("fontSize", f),
|
|
37
|
-
fontWeight:
|
|
37
|
+
fontWeight: c("fontWeight"),
|
|
38
38
|
height: n("height", f),
|
|
39
39
|
left: n("left", f),
|
|
40
40
|
maxHeight: n("maxHeight", f),
|
|
41
41
|
maxWidth: n("maxWidth", f),
|
|
42
42
|
minHeight: n("minHeight", f),
|
|
43
43
|
minWidth: n("minWidth", f),
|
|
44
|
-
opacity:
|
|
45
|
-
overflow:
|
|
46
|
-
overflowX:
|
|
47
|
-
overflowY:
|
|
48
|
-
position:
|
|
44
|
+
opacity: c("opacity"),
|
|
45
|
+
overflow: c("overflow"),
|
|
46
|
+
overflowX: c("overflowX"),
|
|
47
|
+
overflowY: c("overflowY"),
|
|
48
|
+
position: c("position"),
|
|
49
49
|
right: n("right", f),
|
|
50
|
-
textAlign:
|
|
50
|
+
textAlign: c("textAlign"),
|
|
51
51
|
top: n("top", f),
|
|
52
|
-
verticalAlign:
|
|
52
|
+
verticalAlign: c("verticalAlign"),
|
|
53
53
|
width: n("width", f),
|
|
54
|
-
lineHeight: (
|
|
55
|
-
typeof
|
|
54
|
+
lineHeight: (o, t) => {
|
|
55
|
+
typeof t == "number" ? o.lineHeight = t : typeof t == "string" && (o.lineHeight = f(t));
|
|
56
56
|
},
|
|
57
57
|
// Margin
|
|
58
|
-
m:
|
|
58
|
+
m: s("margin", p, [
|
|
59
59
|
"Top",
|
|
60
60
|
"Bottom",
|
|
61
61
|
"Left",
|
|
@@ -65,10 +65,10 @@ const l = (t) => (o, i) => {
|
|
|
65
65
|
ml: n("marginLeft", p),
|
|
66
66
|
mr: n("marginRight", p),
|
|
67
67
|
mt: n("marginTop", p),
|
|
68
|
-
mx:
|
|
69
|
-
my:
|
|
68
|
+
mx: s("margin", p, ["Left", "Right"]),
|
|
69
|
+
my: s("margin", p, ["Top", "Bottom"]),
|
|
70
70
|
// Padding
|
|
71
|
-
p:
|
|
71
|
+
p: s("padding", p, [
|
|
72
72
|
"Top",
|
|
73
73
|
"Bottom",
|
|
74
74
|
"Left",
|
|
@@ -78,58 +78,58 @@ const l = (t) => (o, i) => {
|
|
|
78
78
|
pl: n("paddingLeft", p),
|
|
79
79
|
pr: n("paddingRight", p),
|
|
80
80
|
pt: n("paddingTop", p),
|
|
81
|
-
px:
|
|
82
|
-
py:
|
|
81
|
+
px: s("padding", p, ["Left", "Right"]),
|
|
82
|
+
py: s("padding", p, ["Top", "Bottom"]),
|
|
83
83
|
// Color props
|
|
84
84
|
color: a("color"),
|
|
85
85
|
textColor: a("color"),
|
|
86
86
|
backgroundColor: a("backgroundColor")
|
|
87
87
|
}, b = {
|
|
88
|
-
bold:
|
|
89
|
-
fillPositionedParent: (
|
|
90
|
-
|
|
88
|
+
bold: l("fontWeight", "bold"),
|
|
89
|
+
fillPositionedParent: (o, t) => {
|
|
90
|
+
t && (o.position = "absolute", o.top = 0, o.bottom = 0, o.left = 0, o.right = 0);
|
|
91
91
|
},
|
|
92
|
-
inline:
|
|
93
|
-
italic:
|
|
94
|
-
nowrap:
|
|
95
|
-
preserveWhitespace:
|
|
92
|
+
inline: l("display", "inline-block"),
|
|
93
|
+
italic: l("fontStyle", "italic"),
|
|
94
|
+
nowrap: l("whiteSpace", "nowrap"),
|
|
95
|
+
preserveWhitespace: l("whiteSpace", "pre-wrap")
|
|
96
96
|
};
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
for (const e in
|
|
97
|
+
function T(o) {
|
|
98
|
+
const t = {}, i = {};
|
|
99
|
+
for (const e in o) {
|
|
100
100
|
if (e === "style")
|
|
101
101
|
continue;
|
|
102
|
-
const r =
|
|
103
|
-
m ? m(i, r) :
|
|
102
|
+
const r = o[e], m = d[e] || b[e];
|
|
103
|
+
m ? m(i, r) : t[e] = r;
|
|
104
104
|
}
|
|
105
|
-
return
|
|
105
|
+
return t.style = { ...i, ...o.style }, t;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const
|
|
107
|
+
function S(o) {
|
|
108
|
+
const t = o.textColor || o.color, { backgroundColor: i } = o;
|
|
109
109
|
return y([
|
|
110
|
-
h(
|
|
110
|
+
h(t) && `color-${t}`,
|
|
111
111
|
h(i) && `color-bg-${i}`
|
|
112
112
|
]);
|
|
113
113
|
}
|
|
114
|
-
function P(
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
const i =
|
|
114
|
+
function P(o) {
|
|
115
|
+
const t = {};
|
|
116
|
+
if (!o) return t;
|
|
117
|
+
const i = o.split(" ");
|
|
118
118
|
for (const e of i) {
|
|
119
119
|
const [r, m] = e.split("-");
|
|
120
120
|
if (r)
|
|
121
121
|
if (r in d) {
|
|
122
122
|
if (m === "") continue;
|
|
123
123
|
const g = Number(m);
|
|
124
|
-
!Number.isNaN(g) && Number.isFinite(g) ?
|
|
125
|
-
} else r in b ?
|
|
124
|
+
!Number.isNaN(g) && Number.isFinite(g) ? t[r] = g : t[r] = m;
|
|
125
|
+
} else r in b ? t[r] = !0 : console.warn(`Unknown prop ${r}`);
|
|
126
126
|
}
|
|
127
|
-
return
|
|
127
|
+
return t;
|
|
128
128
|
}
|
|
129
129
|
export {
|
|
130
130
|
b as booleanStyleMap,
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
S as computeBoxClassName,
|
|
132
|
+
T as computeBoxProps,
|
|
133
133
|
P as computeTwClass,
|
|
134
134
|
p as halfUnit,
|
|
135
135
|
d as stringStyleMap,
|
|
@@ -43,6 +43,8 @@ type Props = Partial<{
|
|
|
43
43
|
iconSize: number;
|
|
44
44
|
/** Makes the icon spin */
|
|
45
45
|
iconSpin: BooleanLike;
|
|
46
|
+
/** Called when the button is blurred */
|
|
47
|
+
onBlur: (e: any) => void;
|
|
46
48
|
/** Called when element is clicked */
|
|
47
49
|
onClick: (e: any) => void;
|
|
48
50
|
/** Activates the button (gives it a green color) */
|
|
@@ -6,55 +6,55 @@ import { computeBoxClassName as j, computeBoxProps 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";
|
|
9
|
-
function
|
|
9
|
+
function R(e) {
|
|
10
10
|
const {
|
|
11
|
-
captureKeys:
|
|
12
|
-
children:
|
|
13
|
-
circular:
|
|
11
|
+
captureKeys: u = !0,
|
|
12
|
+
children: a,
|
|
13
|
+
circular: h,
|
|
14
14
|
className: d,
|
|
15
|
-
color:
|
|
16
|
-
compact:
|
|
17
|
-
content:
|
|
15
|
+
color: c,
|
|
16
|
+
compact: B,
|
|
17
|
+
content: C,
|
|
18
18
|
disabled: t,
|
|
19
|
-
ellipsis:
|
|
20
|
-
fluid:
|
|
21
|
-
icon:
|
|
22
|
-
iconColor:
|
|
23
|
-
iconPosition:
|
|
24
|
-
iconRotation:
|
|
25
|
-
iconSize:
|
|
19
|
+
ellipsis: o,
|
|
20
|
+
fluid: l,
|
|
21
|
+
icon: i,
|
|
22
|
+
iconColor: s,
|
|
23
|
+
iconPosition: y,
|
|
24
|
+
iconRotation: k,
|
|
25
|
+
iconSize: m,
|
|
26
26
|
iconSpin: P,
|
|
27
27
|
onClick: f,
|
|
28
|
-
selected:
|
|
29
|
-
tooltip:
|
|
28
|
+
selected: g,
|
|
29
|
+
tooltip: I,
|
|
30
30
|
tooltipPosition: w,
|
|
31
|
-
verticalAlignContent:
|
|
32
|
-
...
|
|
33
|
-
} =
|
|
34
|
-
let
|
|
31
|
+
verticalAlignContent: x,
|
|
32
|
+
...N
|
|
33
|
+
} = e, n = C || a;
|
|
34
|
+
let b = /* @__PURE__ */ r(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: F([
|
|
38
38
|
"Button",
|
|
39
|
-
|
|
39
|
+
l && "Button--fluid",
|
|
40
40
|
t && "Button--disabled",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
g && "Button--selected",
|
|
42
|
+
h && "Button--circular",
|
|
43
|
+
B && "Button--compact",
|
|
44
|
+
y && `Button--iconPosition--${y}`,
|
|
45
|
+
x && "Button--flex",
|
|
46
|
+
x && l && "Button--flex--fluid",
|
|
47
|
+
x && `Button--verticalAlignContent--${x}`,
|
|
48
|
+
c && typeof c == "string" ? `Button--color--${c}` : "Button--color--default",
|
|
49
49
|
d,
|
|
50
|
-
j(
|
|
50
|
+
j(N)
|
|
51
51
|
]),
|
|
52
52
|
tabIndex: t ? void 0 : 0,
|
|
53
53
|
onClick: (p) => {
|
|
54
54
|
!t && f && f(p);
|
|
55
55
|
},
|
|
56
56
|
onKeyDown: (p) => {
|
|
57
|
-
if (
|
|
57
|
+
if (u) {
|
|
58
58
|
if (p.key === D.Space || p.key === D.Enter) {
|
|
59
59
|
p.preventDefault(), !t && f && f(p);
|
|
60
60
|
return;
|
|
@@ -62,35 +62,35 @@ function N(o) {
|
|
|
62
62
|
E(p.key) && p.preventDefault();
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
...q(
|
|
65
|
+
...q(N),
|
|
66
66
|
children: /* @__PURE__ */ _(
|
|
67
67
|
"div",
|
|
68
68
|
{
|
|
69
69
|
className: F([
|
|
70
70
|
"Button__content",
|
|
71
|
-
|
|
71
|
+
o && "Button__content--ellipsis"
|
|
72
72
|
]),
|
|
73
73
|
children: [
|
|
74
|
-
|
|
74
|
+
i && y !== "right" && /* @__PURE__ */ r(
|
|
75
75
|
S,
|
|
76
76
|
{
|
|
77
77
|
mr: n && 0.5,
|
|
78
|
-
name:
|
|
79
|
-
color:
|
|
80
|
-
rotation:
|
|
81
|
-
size:
|
|
78
|
+
name: i,
|
|
79
|
+
color: s,
|
|
80
|
+
rotation: k,
|
|
81
|
+
size: m,
|
|
82
82
|
spin: P
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
o ? /* @__PURE__ */ r("span", { className: "Button--ellipsis", children: n }) : n,
|
|
86
|
+
i && y === "right" && /* @__PURE__ */ r(
|
|
87
87
|
S,
|
|
88
88
|
{
|
|
89
89
|
ml: n && 0.5,
|
|
90
|
-
name:
|
|
91
|
-
color:
|
|
92
|
-
rotation:
|
|
93
|
-
size:
|
|
90
|
+
name: i,
|
|
91
|
+
color: s,
|
|
92
|
+
rotation: k,
|
|
93
|
+
size: m,
|
|
94
94
|
spin: P
|
|
95
95
|
}
|
|
96
96
|
)
|
|
@@ -99,76 +99,81 @@ function N(o) {
|
|
|
99
99
|
)
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
-
return
|
|
102
|
+
return I && (b = /* @__PURE__ */ r(v, { content: I, position: w, children: b })), b;
|
|
103
103
|
}
|
|
104
|
-
function T(
|
|
105
|
-
const { checked:
|
|
104
|
+
function T(e) {
|
|
105
|
+
const { checked: u, ...a } = e;
|
|
106
106
|
return /* @__PURE__ */ r(
|
|
107
|
-
|
|
107
|
+
R,
|
|
108
108
|
{
|
|
109
109
|
color: "transparent",
|
|
110
|
-
icon:
|
|
111
|
-
selected:
|
|
112
|
-
...
|
|
110
|
+
icon: u ? "check-square-o" : "square-o",
|
|
111
|
+
selected: u,
|
|
112
|
+
...a
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
function L(
|
|
116
|
+
function L(e) {
|
|
117
117
|
const {
|
|
118
|
-
children:
|
|
119
|
-
color:
|
|
120
|
-
confirmColor:
|
|
118
|
+
children: u,
|
|
119
|
+
color: a,
|
|
120
|
+
confirmColor: h = "bad",
|
|
121
121
|
confirmContent: d = "Confirm?",
|
|
122
|
-
confirmIcon:
|
|
123
|
-
ellipsis:
|
|
124
|
-
icon:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
confirmIcon: c,
|
|
123
|
+
ellipsis: B = !0,
|
|
124
|
+
icon: C,
|
|
125
|
+
onBlur: t,
|
|
126
|
+
onClick: o,
|
|
127
|
+
...l
|
|
128
|
+
} = e, [i, s] = A(!1);
|
|
129
|
+
function y(m) {
|
|
130
|
+
s(!1), t == null || t(m);
|
|
131
|
+
}
|
|
132
|
+
function k(m) {
|
|
133
|
+
if (!i) {
|
|
134
|
+
s(!0);
|
|
131
135
|
return;
|
|
132
136
|
}
|
|
133
|
-
|
|
137
|
+
o == null || o(m), s(!1);
|
|
134
138
|
}
|
|
135
139
|
return /* @__PURE__ */ r(
|
|
136
|
-
|
|
140
|
+
R,
|
|
137
141
|
{
|
|
138
|
-
icon:
|
|
139
|
-
color:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
icon: i ? c : C,
|
|
143
|
+
color: i ? h : a,
|
|
144
|
+
onBlur: y,
|
|
145
|
+
onClick: k,
|
|
146
|
+
...l,
|
|
147
|
+
children: i ? d : u
|
|
143
148
|
}
|
|
144
149
|
);
|
|
145
150
|
}
|
|
146
|
-
function Y(
|
|
151
|
+
function Y(e) {
|
|
147
152
|
const {
|
|
148
|
-
children:
|
|
149
|
-
color:
|
|
150
|
-
content:
|
|
153
|
+
children: u,
|
|
154
|
+
color: a = "default",
|
|
155
|
+
content: h,
|
|
151
156
|
currentValue: d,
|
|
152
|
-
defaultValue:
|
|
153
|
-
disabled:
|
|
154
|
-
fluid:
|
|
157
|
+
defaultValue: c,
|
|
158
|
+
disabled: B,
|
|
159
|
+
fluid: C,
|
|
155
160
|
icon: t,
|
|
156
|
-
iconRotation:
|
|
157
|
-
iconSpin:
|
|
158
|
-
maxLength:
|
|
159
|
-
onCommit:
|
|
160
|
-
placeholder:
|
|
161
|
-
tooltip:
|
|
162
|
-
tooltipPosition:
|
|
161
|
+
iconRotation: o,
|
|
162
|
+
iconSpin: l,
|
|
163
|
+
maxLength: i,
|
|
164
|
+
onCommit: s = () => null,
|
|
165
|
+
placeholder: y,
|
|
166
|
+
tooltip: k,
|
|
167
|
+
tooltipPosition: m,
|
|
163
168
|
...P
|
|
164
|
-
} =
|
|
165
|
-
function
|
|
166
|
-
const
|
|
167
|
-
if (!
|
|
168
|
-
|
|
169
|
+
} = e, [f, g] = A(!1), I = V(), w = h || u;
|
|
170
|
+
function x(n) {
|
|
171
|
+
const b = I.current;
|
|
172
|
+
if (!b) return;
|
|
173
|
+
b.value !== "" ? s(n, b.value) : c && s(n, c);
|
|
169
174
|
}
|
|
170
175
|
$(() => {
|
|
171
|
-
const n =
|
|
176
|
+
const n = I.current;
|
|
172
177
|
if (n && f) {
|
|
173
178
|
n.value = d || "";
|
|
174
179
|
try {
|
|
@@ -177,86 +182,86 @@ function Y(o) {
|
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
184
|
}, [f, d]);
|
|
180
|
-
let
|
|
185
|
+
let N = /* @__PURE__ */ _(
|
|
181
186
|
O,
|
|
182
187
|
{
|
|
183
188
|
className: F([
|
|
184
189
|
"Button",
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
`Button--color--${
|
|
190
|
+
C && "Button--fluid",
|
|
191
|
+
B && "Button--disabled",
|
|
192
|
+
`Button--color--${a}`
|
|
188
193
|
]),
|
|
189
194
|
...P,
|
|
190
|
-
onClick: () =>
|
|
195
|
+
onClick: () => g(!0),
|
|
191
196
|
children: [
|
|
192
|
-
t && /* @__PURE__ */ r(S, { name: t, rotation:
|
|
197
|
+
t && /* @__PURE__ */ r(S, { name: t, rotation: o, spin: l }),
|
|
193
198
|
/* @__PURE__ */ r("div", { children: w }),
|
|
194
199
|
/* @__PURE__ */ r(
|
|
195
200
|
"input",
|
|
196
201
|
{
|
|
197
|
-
disabled: !!
|
|
198
|
-
ref:
|
|
202
|
+
disabled: !!B,
|
|
203
|
+
ref: I,
|
|
199
204
|
className: "NumberInput__input",
|
|
200
205
|
style: {
|
|
201
206
|
display: f ? "" : "none",
|
|
202
207
|
textAlign: "left"
|
|
203
208
|
},
|
|
204
209
|
onBlur: (n) => {
|
|
205
|
-
f && (
|
|
210
|
+
f && (g(!1), x(n));
|
|
206
211
|
},
|
|
207
212
|
onKeyDown: (n) => {
|
|
208
213
|
if (n.key === D.Enter) {
|
|
209
|
-
|
|
214
|
+
g(!1), x(n);
|
|
210
215
|
return;
|
|
211
216
|
}
|
|
212
|
-
E(n.key) &&
|
|
217
|
+
E(n.key) && g(!1);
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
)
|
|
216
221
|
]
|
|
217
222
|
}
|
|
218
223
|
);
|
|
219
|
-
return
|
|
224
|
+
return k && (N = /* @__PURE__ */ r(v, { content: k, position: m, children: N })), N;
|
|
220
225
|
}
|
|
221
|
-
function G(
|
|
222
|
-
const { accept:
|
|
223
|
-
async function
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
return new Promise((
|
|
227
|
-
|
|
226
|
+
function G(e) {
|
|
227
|
+
const { accept: u, multiple: a, onSelectFiles: h, ...d } = e, c = z(null);
|
|
228
|
+
async function B(t) {
|
|
229
|
+
const o = Array.from(t).map((l) => {
|
|
230
|
+
const i = new FileReader();
|
|
231
|
+
return new Promise((s) => {
|
|
232
|
+
i.onload = () => s(i.result), i.readAsText(l);
|
|
228
233
|
});
|
|
229
234
|
});
|
|
230
|
-
return await Promise.all(
|
|
235
|
+
return await Promise.all(o);
|
|
231
236
|
}
|
|
232
|
-
async function
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
+
async function C(t) {
|
|
238
|
+
const o = t.target.files;
|
|
239
|
+
if (o != null && o.length) {
|
|
240
|
+
const l = await B(o);
|
|
241
|
+
h(a ? l : l[0]);
|
|
237
242
|
}
|
|
238
243
|
}
|
|
239
244
|
return /* @__PURE__ */ _(K, { children: [
|
|
240
|
-
/* @__PURE__ */ r(
|
|
245
|
+
/* @__PURE__ */ r(R, { onClick: () => {
|
|
241
246
|
var t;
|
|
242
|
-
return (t =
|
|
247
|
+
return (t = c.current) == null ? void 0 : t.click();
|
|
243
248
|
}, ...d }),
|
|
244
249
|
/* @__PURE__ */ r(
|
|
245
250
|
"input",
|
|
246
251
|
{
|
|
247
252
|
hidden: !0,
|
|
248
253
|
type: "file",
|
|
249
|
-
ref:
|
|
250
|
-
accept:
|
|
251
|
-
multiple:
|
|
252
|
-
onChange:
|
|
254
|
+
ref: c,
|
|
255
|
+
accept: u,
|
|
256
|
+
multiple: a,
|
|
257
|
+
onChange: C
|
|
253
258
|
}
|
|
254
259
|
)
|
|
255
260
|
] });
|
|
256
261
|
}
|
|
257
|
-
((
|
|
258
|
-
|
|
259
|
-
})(
|
|
262
|
+
((e) => {
|
|
263
|
+
e.Checkbox = T, e.Confirm = L, e.Input = Y, e.File = G;
|
|
264
|
+
})(R || (R = {}));
|
|
260
265
|
export {
|
|
261
|
-
|
|
266
|
+
R as Button
|
|
262
267
|
};
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { classes as
|
|
4
|
-
import { Box as
|
|
5
|
-
import { Icon as
|
|
1
|
+
import { jsx as r, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f } from "react";
|
|
3
|
+
import { classes as _ } from "../common/react.js";
|
|
4
|
+
import { Box as m } from "./Box.js";
|
|
5
|
+
import { Icon as h } from "./Icon.js";
|
|
6
|
+
import { Popper as v } from "./Popper.js";
|
|
6
7
|
function k(n) {
|
|
7
|
-
const { children: e,
|
|
8
|
-
|
|
9
|
-
var c;
|
|
10
|
-
(c = o.current) != null && c.contains(i.target) || r();
|
|
11
|
-
}
|
|
12
|
-
return h(() => (document.addEventListener("click", u), () => {
|
|
13
|
-
document.removeEventListener("click", u);
|
|
14
|
-
}), []), /* @__PURE__ */ t(
|
|
8
|
+
const { children: e, width: o } = n;
|
|
9
|
+
return /* @__PURE__ */ r(
|
|
15
10
|
"div",
|
|
16
11
|
{
|
|
17
12
|
className: "Menubar__menu",
|
|
18
13
|
style: {
|
|
19
|
-
width:
|
|
14
|
+
width: o
|
|
20
15
|
},
|
|
21
16
|
children: e
|
|
22
17
|
}
|
|
@@ -26,38 +21,46 @@ function N(n) {
|
|
|
26
21
|
const {
|
|
27
22
|
children: e,
|
|
28
23
|
className: o,
|
|
29
|
-
disabled:
|
|
24
|
+
disabled: t,
|
|
30
25
|
display: a,
|
|
31
26
|
onClick: u,
|
|
32
|
-
onMouseOver:
|
|
27
|
+
onMouseOver: s,
|
|
33
28
|
open: c,
|
|
34
|
-
openWidth:
|
|
35
|
-
onOutsideClick:
|
|
29
|
+
openWidth: l,
|
|
30
|
+
onOutsideClick: i,
|
|
36
31
|
...M
|
|
37
|
-
} = n,
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
32
|
+
} = n, p = f(null);
|
|
33
|
+
return /* @__PURE__ */ B("div", { ref: p, children: [
|
|
34
|
+
/* @__PURE__ */ r(
|
|
35
|
+
m,
|
|
41
36
|
{
|
|
42
|
-
className:
|
|
37
|
+
className: _([
|
|
43
38
|
"MenuBar__MenuBarButton",
|
|
44
39
|
"MenuBar__font",
|
|
45
40
|
"MenuBar__hover",
|
|
46
41
|
o
|
|
47
42
|
]),
|
|
48
43
|
...M,
|
|
49
|
-
onClick:
|
|
50
|
-
onMouseOver:
|
|
51
|
-
children: /* @__PURE__ */
|
|
44
|
+
onClick: t ? () => null : u,
|
|
45
|
+
onMouseOver: s,
|
|
46
|
+
children: /* @__PURE__ */ r("span", { className: "MenuBar__MenuBarButton-text", children: a })
|
|
52
47
|
}
|
|
53
48
|
),
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
/* @__PURE__ */ r(
|
|
50
|
+
v,
|
|
56
51
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
onClickOutside: i,
|
|
53
|
+
placement: "bottom-start",
|
|
54
|
+
content: /* @__PURE__ */ r(
|
|
55
|
+
k,
|
|
56
|
+
{
|
|
57
|
+
width: l,
|
|
58
|
+
menuRef: p,
|
|
59
|
+
onOutsideClick: i,
|
|
60
|
+
children: e
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
isOpen: c
|
|
61
64
|
}
|
|
62
65
|
)
|
|
63
66
|
] });
|
|
@@ -66,81 +69,81 @@ function d(n) {
|
|
|
66
69
|
const {
|
|
67
70
|
entry: e,
|
|
68
71
|
children: o,
|
|
69
|
-
openWidth:
|
|
72
|
+
openWidth: t,
|
|
70
73
|
display: a,
|
|
71
74
|
setOpenMenuBar: u,
|
|
72
|
-
openMenuBar:
|
|
75
|
+
openMenuBar: s,
|
|
73
76
|
setOpenOnHover: c,
|
|
74
|
-
openOnHover:
|
|
75
|
-
disabled:
|
|
77
|
+
openOnHover: l,
|
|
78
|
+
disabled: i,
|
|
76
79
|
className: M
|
|
77
80
|
} = n;
|
|
78
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ r(
|
|
79
82
|
N,
|
|
80
83
|
{
|
|
81
|
-
openWidth:
|
|
84
|
+
openWidth: t,
|
|
82
85
|
display: a,
|
|
83
|
-
disabled:
|
|
84
|
-
open:
|
|
86
|
+
disabled: i,
|
|
87
|
+
open: s === e,
|
|
85
88
|
className: M,
|
|
86
89
|
onClick: () => {
|
|
87
|
-
u(
|
|
90
|
+
u(s === e ? null : e), c(!l);
|
|
88
91
|
},
|
|
89
92
|
onOutsideClick: () => {
|
|
90
93
|
u(null), c(!1);
|
|
91
94
|
},
|
|
92
95
|
onMouseOver: () => {
|
|
93
|
-
|
|
96
|
+
l && u(e);
|
|
94
97
|
},
|
|
95
98
|
children: o
|
|
96
99
|
}
|
|
97
100
|
);
|
|
98
101
|
}
|
|
99
|
-
|
|
100
|
-
function
|
|
101
|
-
const { value: e, displayText: o, onClick:
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
|
|
102
|
+
C.Dropdown = d;
|
|
103
|
+
function O(n) {
|
|
104
|
+
const { value: e, displayText: o, onClick: t, checked: a } = n;
|
|
105
|
+
return /* @__PURE__ */ B(
|
|
106
|
+
m,
|
|
104
107
|
{
|
|
105
|
-
className:
|
|
108
|
+
className: _([
|
|
106
109
|
"MenuBar__font",
|
|
107
110
|
"MenuBar__MenuItem",
|
|
108
111
|
"MenuBar__MenuItemToggle",
|
|
109
112
|
"MenuBar__hover"
|
|
110
113
|
]),
|
|
111
|
-
onClick: () =>
|
|
114
|
+
onClick: () => t(e),
|
|
112
115
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ r("div", { className: "MenuBar__MenuItemToggle__check", children: /* @__PURE__ */ r(h, { size: 1.3, name: a ? "check" : "" }) }),
|
|
114
117
|
o
|
|
115
118
|
]
|
|
116
119
|
}
|
|
117
120
|
);
|
|
118
121
|
}
|
|
119
|
-
d.MenuItemToggle =
|
|
120
|
-
function
|
|
121
|
-
const { value: e, displayText: o, onClick:
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
|
|
122
|
+
d.MenuItemToggle = O;
|
|
123
|
+
function I(n) {
|
|
124
|
+
const { value: e, displayText: o, onClick: t } = n;
|
|
125
|
+
return /* @__PURE__ */ r(
|
|
126
|
+
m,
|
|
124
127
|
{
|
|
125
|
-
className:
|
|
128
|
+
className: _([
|
|
126
129
|
"MenuBar__font",
|
|
127
130
|
"MenuBar__MenuItem",
|
|
128
131
|
"MenuBar__hover"
|
|
129
132
|
]),
|
|
130
|
-
onClick: () =>
|
|
133
|
+
onClick: () => t == null ? void 0 : t(e),
|
|
131
134
|
children: o
|
|
132
135
|
}
|
|
133
136
|
);
|
|
134
137
|
}
|
|
135
|
-
d.MenuItem =
|
|
136
|
-
function
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
+
d.MenuItem = I;
|
|
139
|
+
function g() {
|
|
140
|
+
return /* @__PURE__ */ r("div", { className: "MenuBar__Separator" });
|
|
138
141
|
}
|
|
139
|
-
d.Separator =
|
|
140
|
-
function
|
|
142
|
+
d.Separator = g;
|
|
143
|
+
function C(n) {
|
|
141
144
|
const { children: e } = n;
|
|
142
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ r(m, { className: "MenuBar", children: e });
|
|
143
146
|
}
|
|
144
147
|
export {
|
|
145
|
-
|
|
148
|
+
C as MenuBar
|
|
146
149
|
};
|
package/package.json
CHANGED
|
@@ -5,6 +5,8 @@ $text-color: base.$color-fg !default;
|
|
|
5
5
|
$background-color: hsl(0, 0%, 3.9%) !default;
|
|
6
6
|
$border-color: hsl(212.3, 100%, 76.7%) !default;
|
|
7
7
|
$border-radius: base.$border-radius !default;
|
|
8
|
+
$font-family: Verdana, sans-serif !default;
|
|
9
|
+
$mono-font-family: "Consolas", monospace !default;
|
|
8
10
|
|
|
9
11
|
.Input {
|
|
10
12
|
position: relative;
|
|
@@ -46,7 +48,7 @@ $border-radius: base.$border-radius !default;
|
|
|
46
48
|
height: base.em(17px);
|
|
47
49
|
margin: 0;
|
|
48
50
|
padding: 0 0.5em;
|
|
49
|
-
font-family:
|
|
51
|
+
font-family: $font-family;
|
|
50
52
|
background-color: transparent;
|
|
51
53
|
color: $text-color;
|
|
52
54
|
color: inherit;
|
|
@@ -59,5 +61,5 @@ $border-radius: base.$border-radius !default;
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
.Input--monospace .Input__input {
|
|
62
|
-
font-family:
|
|
64
|
+
font-family: $mono-font-family;
|
|
63
65
|
}
|