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 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 = (t) => {
4
- if (typeof t == "string")
5
- return t.endsWith("px") ? `${Number.parseFloat(t) / 12}rem` : t;
6
- if (typeof t == "number")
7
- return `${t}rem`;
8
- }, p = (t) => {
9
- if (typeof t == "string")
10
- return f(t);
11
- if (typeof t == "number")
12
- return f(t * 0.5);
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(t) {
15
- return !h(t);
14
+ function w(o) {
15
+ return !h(o);
16
16
  }
17
- function h(t) {
18
- return typeof t == "string" && u.includes(t);
17
+ function h(o) {
18
+ return typeof o == "string" && u.includes(o);
19
19
  }
20
- const l = (t) => (o, i) => {
21
- (typeof i == "number" || typeof i == "string") && (o[t] = i);
22
- }, n = (t, o) => (i, e) => {
23
- (typeof e == "number" || typeof e == "string") && (i[t] = o(e));
24
- }, s = (t, o) => (i, e) => {
25
- e && (i[t] = o);
26
- }, c = (t, o, i) => (e, r) => {
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[t + i[m]] = o(r);
30
- }, a = (t) => (o, i) => {
31
- w(i) && (o[t] = i);
29
+ e[o + i[m]] = t(r);
30
+ }, a = (o) => (t, i) => {
31
+ w(i) && (t[o] = i);
32
32
  }, d = {
33
- align: l("textAlign"),
33
+ align: c("textAlign"),
34
34
  bottom: n("bottom", f),
35
- fontFamily: l("fontFamily"),
35
+ fontFamily: c("fontFamily"),
36
36
  fontSize: n("fontSize", f),
37
- fontWeight: l("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: l("opacity"),
45
- overflow: l("overflow"),
46
- overflowX: l("overflowX"),
47
- overflowY: l("overflowY"),
48
- position: l("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: l("textAlign"),
50
+ textAlign: c("textAlign"),
51
51
  top: n("top", f),
52
- verticalAlign: l("verticalAlign"),
52
+ verticalAlign: c("verticalAlign"),
53
53
  width: n("width", f),
54
- lineHeight: (t, o) => {
55
- typeof o == "number" ? t.lineHeight = o : typeof o == "string" && (t.lineHeight = f(o));
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: c("margin", p, [
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: c("margin", p, ["left", "right"]),
69
- my: c("margin", p, ["top", "bottom"]),
68
+ mx: s("margin", p, ["Left", "Right"]),
69
+ my: s("margin", p, ["Top", "Bottom"]),
70
70
  // Padding
71
- p: c("padding", 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: c("padding", p, ["left", "right"]),
82
- py: c("padding", p, ["top", "bottom"]),
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: s("fontWeight", "bold"),
89
- fillPositionedParent: (t, o) => {
90
- o && (t.position = "absolute", t.top = 0, t.bottom = 0, t.left = 0, t.right = 0);
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: s("display", "inline-block"),
93
- italic: s("fontStyle", "italic"),
94
- nowrap: s("whiteSpace", "nowrap"),
95
- preserveWhitespace: s("whiteSpace", "pre-wrap")
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 S(t) {
98
- const o = {}, i = {};
99
- for (const e in t) {
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 = t[e], m = d[e] || b[e];
103
- m ? m(i, r) : o[e] = r;
102
+ const r = o[e], m = d[e] || b[e];
103
+ m ? m(i, r) : t[e] = r;
104
104
  }
105
- return o.style = { ...i, ...t.style }, o;
105
+ return t.style = { ...i, ...o.style }, t;
106
106
  }
107
- function T(t) {
108
- const o = t.textColor || t.color, { backgroundColor: i } = t;
107
+ function S(o) {
108
+ const t = o.textColor || o.color, { backgroundColor: i } = o;
109
109
  return y([
110
- h(o) && `color-${o}`,
110
+ h(t) && `color-${t}`,
111
111
  h(i) && `color-bg-${i}`
112
112
  ]);
113
113
  }
114
- function P(t) {
115
- const o = {};
116
- if (!t) return o;
117
- const i = t.split(" ");
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) ? o[r] = g : o[r] = m;
125
- } else r in b ? o[r] = !0 : console.warn(`Unknown prop ${r}`);
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 o;
127
+ return t;
128
128
  }
129
129
  export {
130
130
  b as booleanStyleMap,
131
- T as computeBoxClassName,
132
- S as computeBoxProps,
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 N(o) {
9
+ function R(e) {
10
10
  const {
11
- captureKeys: s = !0,
12
- children: u,
13
- circular: m,
11
+ captureKeys: u = !0,
12
+ children: a,
13
+ circular: h,
14
14
  className: d,
15
- color: l,
16
- compact: h,
17
- content: B,
15
+ color: c,
16
+ compact: B,
17
+ content: C,
18
18
  disabled: t,
19
- ellipsis: i,
20
- fluid: e,
21
- icon: c,
22
- iconColor: a,
23
- iconPosition: C,
24
- iconRotation: I,
25
- iconSize: R,
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: x,
29
- tooltip: b,
28
+ selected: g,
29
+ tooltip: I,
30
30
  tooltipPosition: w,
31
- verticalAlignContent: y,
32
- ...g
33
- } = o, n = B || u;
34
- let k = /* @__PURE__ */ r(
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
- e && "Button--fluid",
39
+ l && "Button--fluid",
40
40
  t && "Button--disabled",
41
- x && "Button--selected",
42
- m && "Button--circular",
43
- h && "Button--compact",
44
- C && `Button--iconPosition--${C}`,
45
- y && "Button--flex",
46
- y && e && "Button--flex--fluid",
47
- y && `Button--verticalAlignContent--${y}`,
48
- l && typeof l == "string" ? `Button--color--${l}` : "Button--color--default",
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(g)
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 (s) {
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(g),
65
+ ...q(N),
66
66
  children: /* @__PURE__ */ _(
67
67
  "div",
68
68
  {
69
69
  className: F([
70
70
  "Button__content",
71
- i && "Button__content--ellipsis"
71
+ o && "Button__content--ellipsis"
72
72
  ]),
73
73
  children: [
74
- c && C !== "right" && /* @__PURE__ */ r(
74
+ i && y !== "right" && /* @__PURE__ */ r(
75
75
  S,
76
76
  {
77
77
  mr: n && 0.5,
78
- name: c,
79
- color: a,
80
- rotation: I,
81
- size: R,
78
+ name: i,
79
+ color: s,
80
+ rotation: k,
81
+ size: m,
82
82
  spin: P
83
83
  }
84
84
  ),
85
- i ? /* @__PURE__ */ r("span", { className: "Button--ellipsis", children: n }) : n,
86
- c && C === "right" && /* @__PURE__ */ r(
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: c,
91
- color: a,
92
- rotation: I,
93
- size: R,
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 b && (k = /* @__PURE__ */ r(v, { content: b, position: w, children: k })), k;
102
+ return I && (b = /* @__PURE__ */ r(v, { content: I, position: w, children: b })), b;
103
103
  }
104
- function T(o) {
105
- const { checked: s, ...u } = o;
104
+ function T(e) {
105
+ const { checked: u, ...a } = e;
106
106
  return /* @__PURE__ */ r(
107
- N,
107
+ R,
108
108
  {
109
109
  color: "transparent",
110
- icon: s ? "check-square-o" : "square-o",
111
- selected: s,
112
- ...u
110
+ icon: u ? "check-square-o" : "square-o",
111
+ selected: u,
112
+ ...a
113
113
  }
114
114
  );
115
115
  }
116
- function L(o) {
116
+ function L(e) {
117
117
  const {
118
- children: s,
119
- color: u,
120
- confirmColor: m = "bad",
118
+ children: u,
119
+ color: a,
120
+ confirmColor: h = "bad",
121
121
  confirmContent: d = "Confirm?",
122
- confirmIcon: l,
123
- ellipsis: h = !0,
124
- icon: B,
125
- onClick: t,
126
- ...i
127
- } = o, [e, c] = A(!1);
128
- function a(C) {
129
- if (!e) {
130
- c(!0);
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
- t == null || t(C), c(!1);
137
+ o == null || o(m), s(!1);
134
138
  }
135
139
  return /* @__PURE__ */ r(
136
- N,
140
+ R,
137
141
  {
138
- icon: e ? l : B,
139
- color: e ? m : u,
140
- onClick: a,
141
- ...i,
142
- children: e ? d : s
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(o) {
151
+ function Y(e) {
147
152
  const {
148
- children: s,
149
- color: u = "default",
150
- content: m,
153
+ children: u,
154
+ color: a = "default",
155
+ content: h,
151
156
  currentValue: d,
152
- defaultValue: l,
153
- disabled: h,
154
- fluid: B,
157
+ defaultValue: c,
158
+ disabled: B,
159
+ fluid: C,
155
160
  icon: t,
156
- iconRotation: i,
157
- iconSpin: e,
158
- maxLength: c,
159
- onCommit: a = () => null,
160
- placeholder: C,
161
- tooltip: I,
162
- tooltipPosition: R,
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
- } = o, [f, x] = A(!1), b = V(), w = m || s;
165
- function y(n) {
166
- const k = b.current;
167
- if (!k) return;
168
- k.value !== "" ? a(n, k.value) : l && a(n, l);
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 = b.current;
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 g = /* @__PURE__ */ _(
185
+ let N = /* @__PURE__ */ _(
181
186
  O,
182
187
  {
183
188
  className: F([
184
189
  "Button",
185
- B && "Button--fluid",
186
- h && "Button--disabled",
187
- `Button--color--${u}`
190
+ C && "Button--fluid",
191
+ B && "Button--disabled",
192
+ `Button--color--${a}`
188
193
  ]),
189
194
  ...P,
190
- onClick: () => x(!0),
195
+ onClick: () => g(!0),
191
196
  children: [
192
- t && /* @__PURE__ */ r(S, { name: t, rotation: i, spin: e }),
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: !!h,
198
- ref: b,
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 && (x(!1), y(n));
210
+ f && (g(!1), x(n));
206
211
  },
207
212
  onKeyDown: (n) => {
208
213
  if (n.key === D.Enter) {
209
- x(!1), y(n);
214
+ g(!1), x(n);
210
215
  return;
211
216
  }
212
- E(n.key) && x(!1);
217
+ E(n.key) && g(!1);
213
218
  }
214
219
  }
215
220
  )
216
221
  ]
217
222
  }
218
223
  );
219
- return I && (g = /* @__PURE__ */ r(v, { content: I, position: R, children: g })), g;
224
+ return k && (N = /* @__PURE__ */ r(v, { content: k, position: m, children: N })), N;
220
225
  }
221
- function G(o) {
222
- const { accept: s, multiple: u, onSelectFiles: m, ...d } = o, l = z(null);
223
- async function h(t) {
224
- const i = Array.from(t).map((e) => {
225
- const c = new FileReader();
226
- return new Promise((a) => {
227
- c.onload = () => a(c.result), c.readAsText(e);
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(i);
235
+ return await Promise.all(o);
231
236
  }
232
- async function B(t) {
233
- const i = t.target.files;
234
- if (i != null && i.length) {
235
- const e = await h(i);
236
- m(u ? e : e[0]);
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(N, { onClick: () => {
245
+ /* @__PURE__ */ r(R, { onClick: () => {
241
246
  var t;
242
- return (t = l.current) == null ? void 0 : t.click();
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: l,
250
- accept: s,
251
- multiple: u,
252
- onChange: B
254
+ ref: c,
255
+ accept: u,
256
+ multiple: a,
257
+ onChange: C
253
258
  }
254
259
  )
255
260
  ] });
256
261
  }
257
- ((o) => {
258
- o.Checkbox = T, o.Confirm = L, o.Input = Y, o.File = G;
259
- })(N || (N = {}));
262
+ ((e) => {
263
+ e.Checkbox = T, e.Confirm = L, e.Input = Y, e.File = G;
264
+ })(R || (R = {}));
260
265
  export {
261
- N as Button
266
+ R as Button
262
267
  };
@@ -1,22 +1,17 @@
1
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
- import { useRef as B, useEffect as h } from "react";
3
- import { classes as p } from "../common/react.js";
4
- import { Box as l } from "./Box.js";
5
- import { Icon as v } from "./Icon.js";
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, menuRef: o, onOutsideClick: r, width: a } = n;
8
- function u(i) {
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: a
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: r,
24
+ disabled: t,
30
25
  display: a,
31
26
  onClick: u,
32
- onMouseOver: i,
27
+ onMouseOver: s,
33
28
  open: c,
34
- openWidth: s,
35
- onOutsideClick: m,
29
+ openWidth: l,
30
+ onOutsideClick: i,
36
31
  ...M
37
- } = n, _ = B(null);
38
- return /* @__PURE__ */ f("div", { ref: _, children: [
39
- /* @__PURE__ */ t(
40
- l,
32
+ } = n, p = f(null);
33
+ return /* @__PURE__ */ B("div", { ref: p, children: [
34
+ /* @__PURE__ */ r(
35
+ m,
41
36
  {
42
- className: p([
37
+ className: _([
43
38
  "MenuBar__MenuBarButton",
44
39
  "MenuBar__font",
45
40
  "MenuBar__hover",
46
41
  o
47
42
  ]),
48
43
  ...M,
49
- onClick: r ? () => null : u,
50
- onMouseOver: i,
51
- children: /* @__PURE__ */ t("span", { className: "MenuBar__MenuBarButton-text", children: a })
44
+ onClick: t ? () => null : u,
45
+ onMouseOver: s,
46
+ children: /* @__PURE__ */ r("span", { className: "MenuBar__MenuBarButton-text", children: a })
52
47
  }
53
48
  ),
54
- c && /* @__PURE__ */ t(
55
- k,
49
+ /* @__PURE__ */ r(
50
+ v,
56
51
  {
57
- width: s,
58
- menuRef: _,
59
- onOutsideClick: m,
60
- children: e
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: r,
72
+ openWidth: t,
70
73
  display: a,
71
74
  setOpenMenuBar: u,
72
- openMenuBar: i,
75
+ openMenuBar: s,
73
76
  setOpenOnHover: c,
74
- openOnHover: s,
75
- disabled: m,
77
+ openOnHover: l,
78
+ disabled: i,
76
79
  className: M
77
80
  } = n;
78
- return /* @__PURE__ */ t(
81
+ return /* @__PURE__ */ r(
79
82
  N,
80
83
  {
81
- openWidth: r,
84
+ openWidth: t,
82
85
  display: a,
83
- disabled: m,
84
- open: i === e,
86
+ disabled: i,
87
+ open: s === e,
85
88
  className: M,
86
89
  onClick: () => {
87
- u(i === e ? null : e), c(!s);
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
- s && u(e);
96
+ l && u(e);
94
97
  },
95
98
  children: o
96
99
  }
97
100
  );
98
101
  }
99
- O.Dropdown = d;
100
- function g(n) {
101
- const { value: e, displayText: o, onClick: r, checked: a } = n;
102
- return /* @__PURE__ */ f(
103
- l,
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: p([
108
+ className: _([
106
109
  "MenuBar__font",
107
110
  "MenuBar__MenuItem",
108
111
  "MenuBar__MenuItemToggle",
109
112
  "MenuBar__hover"
110
113
  ]),
111
- onClick: () => r(e),
114
+ onClick: () => t(e),
112
115
  children: [
113
- /* @__PURE__ */ t("div", { className: "MenuBar__MenuItemToggle__check", children: a && /* @__PURE__ */ t(v, { size: 1.3, name: "check" }) }),
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 = g;
120
- function C(n) {
121
- const { value: e, displayText: o, onClick: r } = n;
122
- return /* @__PURE__ */ t(
123
- l,
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: p([
128
+ className: _([
126
129
  "MenuBar__font",
127
130
  "MenuBar__MenuItem",
128
131
  "MenuBar__hover"
129
132
  ]),
130
- onClick: () => r == null ? void 0 : r(e),
133
+ onClick: () => t == null ? void 0 : t(e),
131
134
  children: o
132
135
  }
133
136
  );
134
137
  }
135
- d.MenuItem = C;
136
- function I() {
137
- return /* @__PURE__ */ t("div", { className: "MenuBar__Separator" });
138
+ d.MenuItem = I;
139
+ function g() {
140
+ return /* @__PURE__ */ r("div", { className: "MenuBar__Separator" });
138
141
  }
139
- d.Separator = I;
140
- function O(n) {
142
+ d.Separator = g;
143
+ function C(n) {
141
144
  const { children: e } = n;
142
- return /* @__PURE__ */ t(l, { className: "MenuBar", children: e });
145
+ return /* @__PURE__ */ r(m, { className: "MenuBar", children: e });
143
146
  }
144
147
  export {
145
- O as MenuBar
148
+ C as MenuBar
146
149
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tgui-core",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "TGUI core component library",
5
5
  "keywords": ["TGUI", "library", "typescript"],
6
6
  "files": ["dist", "styles"],
@@ -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: Verdana, sans-serif;
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: "Consolas", monospace;
64
+ font-family: $mono-font-family;
63
65
  }
@@ -50,7 +50,7 @@ $dropdown-z-index: 5;
50
50
  display: inline-block;
51
51
  vertical-align: middle;
52
52
  min-width: 3rem;
53
- margin-left: 0.3rem;
53
+ padding-left: 0.3rem;
54
54
  }
55
55
 
56
56
  .MenuBar__over {