tgui-core 2.0.2 → 2.0.4

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.
@@ -1,265 +1,257 @@
1
- import { jsx as r, jsxs as _, Fragment as K } from "react/jsx-runtime";
2
- import { useState as A, createRef as V, useEffect as $, useRef as z } from "react";
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
- import { Box as O } from "./Box.js";
7
- import { Icon as S } from "./Icon.js";
8
- import { Tooltip as v } from "./Tooltip.js";
1
+ import { jsx as c, jsxs as _, Fragment as V } from "react/jsx-runtime";
2
+ import { useState as A, createRef as $, useEffect as j, useRef as q } from "react";
3
+ import { KEY as P, isEscape as E } from "../common/keys.js";
4
+ import { classes as S } from "../common/react.js";
5
+ import { computeBoxProps as z, computeBoxClassName as O } from "../common/ui.js";
6
+ import { Box as T } from "./Box.js";
7
+ import { Icon as v } from "./Icon.js";
8
+ import { Tooltip as K } from "./Tooltip.js";
9
9
  function R(e) {
10
10
  const {
11
- captureKeys: u = !0,
12
- children: a,
13
- circular: h,
14
- className: d,
15
- color: c,
16
- compact: B,
17
- content: C,
11
+ captureKeys: s = !0,
12
+ children: u,
13
+ circular: m,
14
+ className: p,
15
+ color: r,
16
+ compact: h,
17
+ content: B,
18
18
  disabled: t,
19
19
  ellipsis: o,
20
20
  fluid: l,
21
21
  icon: i,
22
- iconColor: s,
23
- iconPosition: y,
24
- iconRotation: k,
25
- iconSize: m,
26
- iconSpin: w,
22
+ iconColor: a,
23
+ iconPosition: C,
24
+ iconRotation: x,
25
+ iconSize: y,
26
+ iconSpin: D,
27
27
  onClick: f,
28
- selected: g,
29
- tooltip: I,
30
- tooltipPosition: D,
31
- verticalAlignContent: x,
32
- ...N
33
- } = e, n = C || a;
34
- let b = /* @__PURE__ */ r(
28
+ selected: b,
29
+ tooltip: g,
30
+ tooltipPosition: F,
31
+ verticalAlignContent: k,
32
+ ...I
33
+ } = e, n = B || u, N = /* @__PURE__ */ c(
34
+ v,
35
+ {
36
+ className: "Button--icon",
37
+ name: i || "",
38
+ color: a,
39
+ rotation: x,
40
+ size: y,
41
+ spin: D
42
+ }
43
+ );
44
+ let w = /* @__PURE__ */ c(
35
45
  "div",
36
46
  {
37
- className: P([
47
+ className: S([
38
48
  "Button",
39
49
  l && "Button--fluid",
40
50
  t && "Button--disabled",
41
- g && "Button--selected",
42
- h && "Button--circular",
43
- B && "Button--compact",
51
+ b && "Button--selected",
52
+ m && "Button--circular",
53
+ h && "Button--compact",
44
54
  !n && "Button--empty",
45
- y && `Button--icon-${y}`,
46
- x && "Button--flex",
47
- x && l && "Button--flex--fluid",
48
- x && `Button--verticalAlignContent--${x}`,
49
- c && typeof c == "string" ? `Button--color--${c}` : "Button--color--default",
50
- d,
51
- q(N)
55
+ C && `Button--icon-${C}`,
56
+ k && "Button--flex",
57
+ k && l && "Button--flex--fluid",
58
+ k && `Button--verticalAlignContent--${k}`,
59
+ r && typeof r == "string" ? `Button--color--${r}` : "Button--color--default",
60
+ p,
61
+ O(I)
52
62
  ]),
53
63
  tabIndex: t ? void 0 : 0,
54
- onClick: (p) => {
55
- !t && f && f(p);
64
+ onClick: (d) => {
65
+ !t && f && f(d);
56
66
  },
57
- onKeyDown: (p) => {
58
- if (u) {
59
- if (p.key === F.Space || p.key === F.Enter) {
60
- p.preventDefault(), !t && f && f(p);
67
+ onKeyDown: (d) => {
68
+ if (s) {
69
+ if (d.key === P.Space || d.key === P.Enter) {
70
+ d.preventDefault(), !t && f && f(d);
61
71
  return;
62
72
  }
63
- E(p.key) && p.preventDefault();
73
+ E(d.key) && d.preventDefault();
64
74
  }
65
75
  },
66
- ...j(N),
76
+ ...z(I),
67
77
  children: /* @__PURE__ */ _(
68
78
  "div",
69
79
  {
70
- className: P([
80
+ className: S([
71
81
  "Button__content",
72
82
  o && "Button__content--ellipsis"
73
83
  ]),
74
84
  children: [
75
- i && y !== "right" && /* @__PURE__ */ r(
76
- S,
77
- {
78
- name: i,
79
- color: s,
80
- rotation: k,
81
- size: m,
82
- spin: w
83
- }
84
- ),
85
- o ? /* @__PURE__ */ r("span", { className: "Button--ellipsis", children: n }) : n,
86
- i && y === "right" && /* @__PURE__ */ r(
87
- S,
88
- {
89
- name: i,
90
- color: s,
91
- rotation: k,
92
- size: m,
93
- spin: w
94
- }
95
- )
85
+ i && C !== "right" && N,
86
+ o ? /* @__PURE__ */ c("span", { className: "Button--ellipsis", children: n }) : n,
87
+ i && C === "right" && N
96
88
  ]
97
89
  }
98
90
  )
99
91
  }
100
92
  );
101
- return I && (b = /* @__PURE__ */ r(v, { content: I, position: D, children: b })), b;
93
+ return g && (w = /* @__PURE__ */ c(K, { content: g, position: F, children: w })), w;
102
94
  }
103
- function T(e) {
104
- const { checked: u, ...a } = e;
105
- return /* @__PURE__ */ r(
95
+ function L(e) {
96
+ const { checked: s, ...u } = e;
97
+ return /* @__PURE__ */ c(
106
98
  R,
107
99
  {
108
100
  color: "transparent",
109
- icon: u ? "check-square-o" : "square-o",
110
- selected: u,
111
- ...a
101
+ icon: s ? "check-square-o" : "square-o",
102
+ selected: s,
103
+ ...u
112
104
  }
113
105
  );
114
106
  }
115
- function L(e) {
107
+ function Y(e) {
116
108
  const {
117
- children: u,
118
- color: a,
119
- confirmColor: h = "bad",
120
- confirmContent: d = "Confirm?",
121
- confirmIcon: c,
122
- ellipsis: B = !0,
123
- icon: C,
109
+ children: s,
110
+ color: u,
111
+ confirmColor: m = "bad",
112
+ confirmContent: p = "Confirm?",
113
+ confirmIcon: r,
114
+ ellipsis: h = !0,
115
+ icon: B,
124
116
  onBlur: t,
125
117
  onClick: o,
126
118
  ...l
127
- } = e, [i, s] = A(!1);
128
- function y(m) {
129
- s(!1), t == null || t(m);
119
+ } = e, [i, a] = A(!1);
120
+ function C(y) {
121
+ a(!1), t == null || t(y);
130
122
  }
131
- function k(m) {
123
+ function x(y) {
132
124
  if (!i) {
133
- s(!0);
125
+ a(!0);
134
126
  return;
135
127
  }
136
- o == null || o(m), s(!1);
128
+ o == null || o(y), a(!1);
137
129
  }
138
- return /* @__PURE__ */ r(
130
+ return /* @__PURE__ */ c(
139
131
  R,
140
132
  {
141
- icon: i ? c : C,
142
- color: i ? h : a,
143
- onBlur: y,
144
- onClick: k,
133
+ icon: i ? r : B,
134
+ color: i ? m : u,
135
+ onBlur: C,
136
+ onClick: x,
145
137
  ...l,
146
- children: i ? d : u
138
+ children: i ? p : s
147
139
  }
148
140
  );
149
141
  }
150
- function Y(e) {
142
+ function G(e) {
151
143
  const {
152
- children: u,
153
- color: a = "default",
154
- content: h,
155
- currentValue: d,
156
- defaultValue: c,
157
- disabled: B,
158
- fluid: C,
144
+ children: s,
145
+ color: u = "default",
146
+ content: m,
147
+ currentValue: p,
148
+ defaultValue: r,
149
+ disabled: h,
150
+ fluid: B,
159
151
  icon: t,
160
152
  iconRotation: o,
161
153
  iconSpin: l,
162
154
  maxLength: i,
163
- onCommit: s = () => null,
164
- placeholder: y,
165
- tooltip: k,
166
- tooltipPosition: m,
167
- ...w
168
- } = e, [f, g] = A(!1), I = V(), D = h || u;
169
- function x(n) {
170
- const b = I.current;
171
- if (!b) return;
172
- b.value !== "" ? s(n, b.value) : c && s(n, c);
155
+ onCommit: a = () => null,
156
+ placeholder: C,
157
+ tooltip: x,
158
+ tooltipPosition: y,
159
+ ...D
160
+ } = e, [f, b] = A(!1), g = $(), F = m || s;
161
+ function k(n) {
162
+ const N = g.current;
163
+ if (!N) return;
164
+ N.value !== "" ? a(n, N.value) : r && a(n, r);
173
165
  }
174
- $(() => {
175
- const n = I.current;
166
+ j(() => {
167
+ const n = g.current;
176
168
  if (n && f) {
177
- n.value = d || "";
169
+ n.value = p || "";
178
170
  try {
179
171
  n.focus(), n.select();
180
172
  } catch {
181
173
  }
182
174
  }
183
- }, [f, d]);
184
- let N = /* @__PURE__ */ _(
185
- O,
175
+ }, [f, p]);
176
+ let I = /* @__PURE__ */ _(
177
+ T,
186
178
  {
187
- className: P([
179
+ className: S([
188
180
  "Button",
189
- C && "Button--fluid",
190
- B && "Button--disabled",
191
- `Button--color--${a}`
181
+ B && "Button--fluid",
182
+ h && "Button--disabled",
183
+ `Button--color--${u}`
192
184
  ]),
193
- ...w,
194
- onClick: () => g(!0),
185
+ ...D,
186
+ onClick: () => b(!0),
195
187
  children: [
196
- t && /* @__PURE__ */ r(S, { name: t, rotation: o, spin: l }),
197
- /* @__PURE__ */ r("div", { children: D }),
198
- /* @__PURE__ */ r(
188
+ t && /* @__PURE__ */ c(v, { name: t, rotation: o, spin: l }),
189
+ /* @__PURE__ */ c("div", { children: F }),
190
+ /* @__PURE__ */ c(
199
191
  "input",
200
192
  {
201
- disabled: !!B,
202
- ref: I,
193
+ disabled: !!h,
194
+ ref: g,
203
195
  className: "NumberInput__input",
204
196
  style: {
205
197
  display: f ? "" : "none",
206
198
  textAlign: "left"
207
199
  },
208
200
  onBlur: (n) => {
209
- f && (g(!1), x(n));
201
+ f && (b(!1), k(n));
210
202
  },
211
203
  onKeyDown: (n) => {
212
- if (n.key === F.Enter) {
213
- g(!1), x(n);
204
+ if (n.key === P.Enter) {
205
+ b(!1), k(n);
214
206
  return;
215
207
  }
216
- E(n.key) && g(!1);
208
+ E(n.key) && b(!1);
217
209
  }
218
210
  }
219
211
  )
220
212
  ]
221
213
  }
222
214
  );
223
- return k && (N = /* @__PURE__ */ r(v, { content: k, position: m, children: N })), N;
215
+ return x && (I = /* @__PURE__ */ c(K, { content: x, position: y, children: I })), I;
224
216
  }
225
- function G(e) {
226
- const { accept: u, multiple: a, onSelectFiles: h, ...d } = e, c = z(null);
227
- async function B(t) {
217
+ function H(e) {
218
+ const { accept: s, multiple: u, onSelectFiles: m, ...p } = e, r = q(null);
219
+ async function h(t) {
228
220
  const o = Array.from(t).map((l) => {
229
221
  const i = new FileReader();
230
- return new Promise((s) => {
231
- i.onload = () => s(i.result), i.readAsText(l);
222
+ return new Promise((a) => {
223
+ i.onload = () => a(i.result), i.readAsText(l);
232
224
  });
233
225
  });
234
226
  return await Promise.all(o);
235
227
  }
236
- async function C(t) {
228
+ async function B(t) {
237
229
  const o = t.target.files;
238
230
  if (o != null && o.length) {
239
- const l = await B(o);
240
- h(a ? l : l[0]);
231
+ const l = await h(o);
232
+ m(u ? l : l[0]);
241
233
  }
242
234
  }
243
- return /* @__PURE__ */ _(K, { children: [
244
- /* @__PURE__ */ r(R, { onClick: () => {
235
+ return /* @__PURE__ */ _(V, { children: [
236
+ /* @__PURE__ */ c(R, { onClick: () => {
245
237
  var t;
246
- return (t = c.current) == null ? void 0 : t.click();
247
- }, ...d }),
248
- /* @__PURE__ */ r(
238
+ return (t = r.current) == null ? void 0 : t.click();
239
+ }, ...p }),
240
+ /* @__PURE__ */ c(
249
241
  "input",
250
242
  {
251
243
  hidden: !0,
252
244
  type: "file",
253
- ref: c,
254
- accept: u,
255
- multiple: a,
256
- onChange: C
245
+ ref: r,
246
+ accept: s,
247
+ multiple: u,
248
+ onChange: B
257
249
  }
258
250
  )
259
251
  ] });
260
252
  }
261
253
  ((e) => {
262
- e.Checkbox = T, e.Confirm = L, e.Input = Y, e.File = G;
254
+ e.Checkbox = L, e.Confirm = Y, e.Input = G, e.File = H;
263
255
  })(R || (R = {}));
264
256
  export {
265
257
  R as Button
@@ -37,8 +37,6 @@ type Props = {
37
37
  step: number;
38
38
  /** The step size in pixels. */
39
39
  stepPixelSize: number;
40
- /** The number of milliseconds to suppress flickering. */
41
- suppressFlicker: number;
42
40
  /** Whether to unclamp the value. */
43
41
  unclamped: boolean;
44
42
  /** The unit of the value. */
@@ -1,132 +1,111 @@
1
- import { jsxs as W, Fragment as Z, jsx as P } from "react/jsx-runtime";
2
- import { useState as y, useRef as c, useEffect as C } from "react";
3
- import { KEY as Y } from "../common/keys.js";
4
- import { clamp as F } from "../common/math.js";
5
- import { AnimatedNumber as ee } from "./AnimatedNumber.js";
6
- const te = 400;
7
- function K(r, p) {
8
- return r.screenX * p[0] + r.screenY * p[1];
1
+ import { jsxs as $, Fragment as q, jsx as D } from "react/jsx-runtime";
2
+ import { useState as F, useRef as i, useEffect as J } from "react";
3
+ import { KEY as Q, isEscape as W } from "../common/keys.js";
4
+ import { clamp as b } from "../common/math.js";
5
+ import { AnimatedNumber as Z } from "./AnimatedNumber.js";
6
+ const C = 400, x = -1;
7
+ function A(n, m) {
8
+ return n.screenX * m[0] + n.screenY * m[1];
9
9
  }
10
- function se(r) {
10
+ function ie(n) {
11
11
  const {
12
12
  // Our props
13
- animated: p,
14
- children: M,
15
- dragMatrix: V = [1, 0],
16
- format: E,
17
- maxValue: g = Number.POSITIVE_INFINITY,
18
- minValue: l = Number.NEGATIVE_INFINITY,
19
- onChange: s,
20
- onDrag: a,
21
- step: o = 1,
13
+ animated: m,
14
+ children: L,
15
+ dragMatrix: S = [1, 0],
16
+ format: g,
17
+ maxValue: N = Number.POSITIVE_INFINITY,
18
+ minValue: o = Number.NEGATIVE_INFINITY,
19
+ onChange: a,
20
+ onDrag: l,
21
+ step: s = 1,
22
22
  stepPixelSize: O = 1,
23
- suppressFlicker: S = 50,
24
- unclamped: j,
25
- unit: h,
26
- updateRate: w = te,
23
+ unclamped: Y,
24
+ unit: V,
25
+ updateRate: k = C,
27
26
  // Box props
28
- fontSize: z,
29
- height: B,
27
+ fontSize: K,
28
+ height: P,
30
29
  lineHeight: U
31
- } = r, [G, T] = y(r.value), [v, f] = y(!1), [k, D] = y(!1), i = c(!1), n = c(0), m = c(0), R = c(null), N = c(null), I = c(null), b = c(null);
32
- C(() => {
33
- T(r.value);
34
- }, [r.value]);
35
- function _(e) {
36
- if (document.body.style["pointer-events"] = "auto", b.current && clearTimeout(b.current), I.current && clearInterval(I.current), i.current = !1, f(!1), m.current = 0, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", _), L(), s == null || s(e, n.current), a == null || a(e, n.current), N.current) {
37
- const t = N.current;
38
- t.value = n.toString(), setTimeout(() => {
30
+ } = n, [ee, I] = F(n.value), [d, v] = F(!1), r = i(!1), u = i(n.value), c = i(0), E = i(x), y = i(null), T = i(null), p = i(null);
31
+ J(() => {
32
+ n.value !== u.current && (u.current = n.value, I(n.value));
33
+ }, [n.value]);
34
+ function j(e) {
35
+ d || (document.body.style["pointer-events"] = "none", E.current = A(e.nativeEvent, S), c.current = n.value, r.current = !0, document.addEventListener("mouseup", _), p.current = setTimeout(() => {
36
+ w(e.nativeEvent);
37
+ }, 100));
38
+ }
39
+ function w(e) {
40
+ if (r.current)
41
+ document.addEventListener("mousemove", h), T.current = setInterval(() => {
42
+ r.current && (l == null || l(e, n.value));
43
+ }, k);
44
+ else if (v(!0), y.current) {
45
+ const t = y.current;
46
+ t.value = c.current.toString(), setTimeout(() => {
39
47
  t.focus(), t.select();
40
48
  }, 10);
41
49
  }
50
+ p.current && clearTimeout(p.current);
42
51
  }
43
- function x(e) {
44
- if (!m.current) return;
45
- const t = K(e, V), u = t - m.current;
46
- if (!i.current) {
47
- Math.abs(u) > 4 && (i.current = !0);
48
- return;
49
- }
50
- const Q = Number.isFinite(l) ? l % o : 0;
51
- n.current = F(
52
- n.current + u * o / O,
53
- l - o,
54
- g + o
55
- ), T(
56
- F(
57
- n.current - n.current % o + Q,
58
- l,
59
- g
60
- )
61
- ), m.current = t;
52
+ function h(e) {
53
+ const t = A(e, S), H = t - E.current, X = Number.isFinite(o) ? o % s : 0;
54
+ c.current = b(
55
+ c.current + H * s / O,
56
+ o - s,
57
+ N + s
58
+ );
59
+ const R = b(
60
+ c.current - c.current % s + X,
61
+ o,
62
+ N
63
+ );
64
+ u.current = R, I(R), E.current = t;
62
65
  }
63
- function H(e) {
64
- if (v) return;
65
- const t = e.nativeEvent;
66
- document.body.style["pointer-events"] = "none", m.current = K(t, V), n.current = r.value, b.current = setTimeout(() => {
67
- i.current = !0;
68
- }, 250), I.current = setInterval(() => {
69
- i && (a == null || a(t, r.value));
70
- }, w), document.addEventListener("mousemove", x), document.addEventListener("mouseup", _);
66
+ function _(e) {
67
+ document.body.style["pointer-events"] = "auto", T.current && clearInterval(T.current), E.current = x, document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", _), r.current && (a == null || a(e, u.current), l == null || l(e, u.current), r.current = !1);
71
68
  }
72
- function X(e) {
73
- if (e.key === Y.Enter) {
74
- e.preventDefault(), e.stopPropagation(), A(e.nativeEvent, e.currentTarget.value);
75
- return;
76
- }
77
- if (e.key === Y.Escape) {
78
- f(!1);
79
- return;
80
- }
69
+ function z(e) {
70
+ (e.key === Q.Enter || W(e.key)) && v(!1);
81
71
  }
82
- function A(e, t) {
83
- let u = Number.parseFloat(t);
84
- if (j || (u = F(u, l, g)), Number.isNaN(u)) {
85
- f(!1);
72
+ function B(e) {
73
+ let t = Number.parseFloat(e.currentTarget.value);
74
+ if (Y || (t = b(t, o, N)), Number.isNaN(t)) {
75
+ v(!1);
86
76
  return;
87
77
  }
88
- f(!1), T(u), n.current = u, L(), s == null || s(e, u);
89
- }
90
- function L() {
91
- if (S <= 0) return;
92
- const e = R.current;
93
- if (e)
94
- return D(!0), clearTimeout(e), R.current = setTimeout(() => {
95
- D(!1);
96
- }, S), () => clearTimeout(e);
97
- }
98
- function $(e) {
99
- v && f(!1), A(e.nativeEvent, e.currentTarget.value);
78
+ c.current = t, u.current = t, I(t), a == null || a(e.nativeEvent, t), d && v(!1);
100
79
  }
101
- let d = r.value;
102
- (i.current || k) && (d = G);
103
- const q = /* @__PURE__ */ W(Z, { children: [
104
- p && !i.current && !k ? /* @__PURE__ */ P(ee, { value: d, format: E }) : E ? E(d) : d,
105
- h ? ` ${h}` : ""
106
- ] }), J = /* @__PURE__ */ P(
80
+ let f = n.value;
81
+ r.current && (f = u.current);
82
+ const G = /* @__PURE__ */ $(q, { children: [
83
+ m && !r.current ? /* @__PURE__ */ D(Z, { value: f, format: g }) : g ? g(f) : f,
84
+ V ? ` ${V}` : ""
85
+ ] }), M = /* @__PURE__ */ D(
107
86
  "input",
108
87
  {
109
- ref: N,
88
+ ref: y,
110
89
  className: "NumberInput__input",
111
90
  style: {
112
- display: v ? void 0 : "none",
113
- height: B,
91
+ display: d ? void 0 : "none",
92
+ height: P,
114
93
  lineHeight: U,
115
- fontSize: z
94
+ fontSize: K
116
95
  },
117
- onBlur: $,
118
- onKeyDown: X
96
+ onBlur: B,
97
+ onKeyDown: z
119
98
  }
120
99
  );
121
- return M({
122
- displayElement: q,
123
- displayValue: d,
124
- dragging: i.current,
125
- editing: v,
126
- handleDragStart: H,
127
- inputElement: J
100
+ return L({
101
+ displayElement: G,
102
+ displayValue: f,
103
+ dragging: r.current,
104
+ editing: d,
105
+ handleDragStart: j,
106
+ inputElement: M
128
107
  });
129
108
  }
130
109
  export {
131
- se as DraggableControl
110
+ ie as DraggableControl
132
111
  };
@@ -1,4 +1,4 @@
1
- import { Component, HTMLAttributes, PropsWithChildren, RefObject } from 'react';
1
+ import { Component, HTMLAttributes, PropsWithChildren } from 'react';
2
2
  type Props = {
3
3
  acceptableDifference?: number;
4
4
  maxFontSize: number;
@@ -9,7 +9,7 @@ type State = {
9
9
  fontSize: number;
10
10
  };
11
11
  export declare class FitText extends Component<Props, State> {
12
- ref: RefObject<HTMLDivElement | null>;
12
+ ref: import('react').RefObject<HTMLDivElement | null>;
13
13
  state: State;
14
14
  constructor(props: Props);
15
15
  componentDidUpdate(prevProps: any): void;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, Component, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, RefObject } from 'react';
1
+ import { CSSProperties, Component, FocusEventHandler, KeyboardEventHandler, MouseEventHandler } from 'react';
2
2
  import { BooleanLike } from '../common/react';
3
3
  import { BoxProps } from './Box';
4
4
  type Props = Required<{
@@ -51,7 +51,7 @@ type State = {
51
51
  * to fine tune the value, or single click it to manually type a number.
52
52
  */
53
53
  export declare class NumberInput extends Component<Props, State> {
54
- inputRef: RefObject<HTMLInputElement | null>;
54
+ inputRef: import('react').RefObject<HTMLInputElement | null>;
55
55
  dragTimeout: NodeJS.Timeout;
56
56
  dragInterval: NodeJS.Timeout;
57
57
  state: State;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tgui-core",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "TGUI core component library",
5
5
  "keywords": ["TGUI", "library", "typescript"],
6
6
  "files": ["dist", "styles"],
@@ -71,30 +71,29 @@ $border-radius: 0 !default;
71
71
  }
72
72
  }
73
73
 
74
- i {
74
+ .Button--icon {
75
75
  min-width: 1.333em;
76
76
  text-align: center;
77
- vertical-align: middle;
78
77
  }
79
78
 
80
- &:has(i) {
79
+ &:has(.Button--icon) {
81
80
  padding-left: 0;
82
81
 
83
- i {
82
+ .Button--icon {
84
83
  margin: 0 var(--space-s);
85
84
  }
86
85
  }
87
86
 
88
- &--icon-right:has(i) {
87
+ &--icon-right:has(.Button--icon) {
89
88
  padding-left: var(--space-m);
90
89
  padding-right: var(--space-s);
91
90
 
92
- i {
91
+ .Button--icon {
93
92
  margin: 0 0 0 var(--space-s);
94
93
  }
95
94
  }
96
95
 
97
- &--empty:has(i) {
96
+ &--empty:has(.Button--icon) {
98
97
  padding: 0;
99
98
  }
100
99
 
@@ -102,7 +101,7 @@ $border-radius: 0 !default;
102
101
  padding: 0 var(--space-s);
103
102
  line-height: 1.333em;
104
103
 
105
- &:has(i) i {
104
+ &:has(.Button--icon) .Button--icon {
106
105
  margin: 0 var(--space-xxs);
107
106
  }
108
107
  }
@@ -123,6 +122,11 @@ $border-radius: 0 !default;
123
122
  overflow: hidden;
124
123
  margin-right: calc(-1 * var(--space-s));
125
124
  }
125
+
126
+ // We don't need additional margin if button inside stack
127
+ .Stack__item & {
128
+ margin: 0;
129
+ }
126
130
  }
127
131
 
128
132
  @each $color-name, $color-value in $bg-map {
@@ -23,7 +23,7 @@ $color-stripes: 0 !default;
23
23
  }
24
24
 
25
25
  @mixin box-color($color) {
26
- background-color: hsl(from $color h calc(s - 15) calc(l - 15));
26
+ background-color: oklch(from $color calc(l - 0.14) calc(c - 0.06) h);
27
27
  color: var(--color-text-fixed-white);
28
28
  }
29
29
 
@@ -35,6 +35,10 @@ $color-stripes: 0 !default;
35
35
  }
36
36
  }
37
37
 
38
+ @if $color-name == "black" {
39
+ --notice-box-stripes: hsla(0, 0%, 100%, 0.1);
40
+ }
41
+
38
42
  @include box-color($color-value);
39
43
  }
40
44
  }
@@ -14,4 +14,5 @@ $border-radius: 0 !default;
14
14
  padding: var(--space-m) var(--space-l);
15
15
  pointer-events: none;
16
16
  text-align: left;
17
+ width: max-content;
17
18
  }