tgui-core 1.2.0 → 1.3.1

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.
Files changed (116) hide show
  1. package/README.md +3 -3
  2. package/dist/common/color.js +31 -30
  3. package/dist/common/events.js +5 -5
  4. package/dist/common/format.js +27 -27
  5. package/dist/common/hotkeys.d.ts +0 -1
  6. package/dist/common/hotkeys.js +2 -2
  7. package/dist/common/math.d.ts +4 -0
  8. package/dist/common/math.js +29 -25
  9. package/dist/common/random.js +14 -13
  10. package/dist/common/react.js +1 -1
  11. package/dist/common/string.js +9 -9
  12. package/dist/common/type-utils.d.ts +1 -1
  13. package/dist/components/AnimatedNumber.d.ts +6 -6
  14. package/dist/components/AnimatedNumber.js +14 -17
  15. package/dist/components/Autofocus.d.ts +0 -1
  16. package/dist/components/Blink.d.ts +0 -1
  17. package/dist/components/BlockQuote.d.ts +0 -1
  18. package/dist/components/BlockQuote.js +4 -7
  19. package/dist/components/Box.d.ts +0 -1
  20. package/dist/components/Box.js +4 -4
  21. package/dist/components/Button.d.ts +0 -1
  22. package/dist/components/Button.js +173 -211
  23. package/dist/components/ByondUi.js +3 -3
  24. package/dist/components/Chart.d.ts +0 -1
  25. package/dist/components/Chart.js +25 -22
  26. package/dist/components/Collapsible.d.ts +0 -1
  27. package/dist/components/ColorBox.d.ts +0 -1
  28. package/dist/components/ColorBox.js +7 -14
  29. package/dist/components/Dialog.js +31 -40
  30. package/dist/components/Dimmer.d.ts +0 -1
  31. package/dist/components/Dimmer.js +6 -9
  32. package/dist/components/Divider.js +10 -14
  33. package/dist/components/DmIcon.d.ts +0 -1
  34. package/dist/components/DraggableControl.js +57 -49
  35. package/dist/components/Dropdown.d.ts +0 -1
  36. package/dist/components/Dropdown.js +73 -67
  37. package/dist/components/FitText.d.ts +0 -1
  38. package/dist/components/Flex.d.ts +1 -1
  39. package/dist/components/Flex.js +39 -41
  40. package/dist/components/Icon.d.ts +0 -1
  41. package/dist/components/Icon.js +27 -34
  42. package/dist/components/Image.d.ts +0 -1
  43. package/dist/components/Image.js +7 -6
  44. package/dist/components/ImageButton.d.ts +0 -1
  45. package/dist/components/ImageButton.js +87 -170
  46. package/dist/components/InfinitePlane.js +1 -1
  47. package/dist/components/Input.d.ts +0 -1
  48. package/dist/components/Input.js +57 -64
  49. package/dist/components/KeyListener.d.ts +0 -1
  50. package/dist/components/Knob.d.ts +0 -1
  51. package/dist/components/Knob.js +91 -117
  52. package/dist/components/LabeledControls.d.ts +0 -1
  53. package/dist/components/LabeledList.d.ts +0 -1
  54. package/dist/components/LabeledList.js +48 -55
  55. package/dist/components/MenuBar.d.ts +0 -1
  56. package/dist/components/MenuBar.js +93 -102
  57. package/dist/components/Modal.d.ts +0 -1
  58. package/dist/components/Modal.js +11 -18
  59. package/dist/components/NoticeBox.d.ts +0 -1
  60. package/dist/components/NoticeBox.js +16 -43
  61. package/dist/components/NumberInput.d.ts +0 -2
  62. package/dist/components/NumberInput.js +99 -107
  63. package/dist/components/Popper.d.ts +0 -1
  64. package/dist/components/ProgressBar.d.ts +0 -1
  65. package/dist/components/ProgressBar.js +22 -27
  66. package/dist/components/RestrictedInput.js +64 -58
  67. package/dist/components/RoundGauge.d.ts +0 -1
  68. package/dist/components/RoundGauge.js +70 -104
  69. package/dist/components/Section.d.ts +1 -2
  70. package/dist/components/Section.js +50 -51
  71. package/dist/components/Slider.d.ts +0 -1
  72. package/dist/components/Slider.js +72 -80
  73. package/dist/components/Stack.d.ts +0 -1
  74. package/dist/components/Stack.js +37 -47
  75. package/dist/components/StyleableSection.d.ts +0 -1
  76. package/dist/components/StyleableSection.js +11 -11
  77. package/dist/components/Table.d.ts +0 -1
  78. package/dist/components/Table.js +38 -47
  79. package/dist/components/Tabs.d.ts +0 -1
  80. package/dist/components/Tabs.js +43 -75
  81. package/dist/components/TextArea.d.ts +0 -1
  82. package/dist/components/TextArea.js +74 -69
  83. package/dist/components/TimeDisplay.d.ts +7 -6
  84. package/dist/components/TimeDisplay.js +17 -17
  85. package/dist/components/Tooltip.d.ts +1 -2
  86. package/dist/components/Tooltip.js +8 -10
  87. package/dist/components/TrackOutsideClicks.d.ts +0 -1
  88. package/dist/components/VirtualList.d.ts +0 -1
  89. package/package.json +25 -25
  90. package/dist/ProgressBar.module-Jzqlebbx.js +0 -29
  91. package/dist/Section.module-qhQWhlUX.js +0 -18
  92. package/dist/assets/BlockQuote.css +0 -1
  93. package/dist/assets/Button.css +0 -1
  94. package/dist/assets/ColorBox.css +0 -1
  95. package/dist/assets/Dialog.css +0 -1
  96. package/dist/assets/Dimmer.css +0 -1
  97. package/dist/assets/Divider.css +0 -1
  98. package/dist/assets/Flex.css +0 -1
  99. package/dist/assets/Icon.css +0 -6
  100. package/dist/assets/ImageButton.css +0 -5
  101. package/dist/assets/Input.css +0 -1
  102. package/dist/assets/Knob.css +0 -1
  103. package/dist/assets/LabeledList.css +0 -1
  104. package/dist/assets/MenuBar.css +0 -1
  105. package/dist/assets/Modal.css +0 -1
  106. package/dist/assets/NoticeBox.css +0 -1
  107. package/dist/assets/NumberInput.css +0 -1
  108. package/dist/assets/ProgressBar.css +0 -1
  109. package/dist/assets/RoundGauge.css +0 -1
  110. package/dist/assets/Section.css +0 -1
  111. package/dist/assets/Slider.css +0 -1
  112. package/dist/assets/Stack.css +0 -1
  113. package/dist/assets/Table.css +0 -1
  114. package/dist/assets/Tabs.css +0 -1
  115. package/dist/assets/TextArea.css +0 -1
  116. package/dist/assets/Tooltip.css +0 -1
@@ -1,301 +1,263 @@
1
- import { jsx as l, jsxs as P, Fragment as M } from "react/jsx-runtime";
2
- import { useState as S, createRef as V, useEffect as z, useRef as j } from "react";
3
- import { KEY as R, isEscape as E } from "../common/keys.js";
4
- import { classes as D } from "../common/react.js";
5
- import { computeBoxClassName as q, computeBoxProps as O, Box as T } from "./Box.js";
6
- import { Icon as F } from "./Icon.js";
7
- import { Tooltip as K } from "./Tooltip.js";
8
- import '../assets/Button.css';const L = "_button_433yx_17", Y = "_fa_433yx_34", G = "_fas_433yx_35", H = "_far_433yx_36", J = "_dropdown_433yx_43", Q = "_ellipsis_433yx_49", U = "_fluid_433yx_54", W = "_circular_433yx_60", X = "_compact_433yx_64", Z = "_color__black_433yx_69", $ = "_color__white_433yx_82", oo = "_color__red_433yx_95", to = "_color__orange_433yx_108", _o = "_color__yellow_433yx_121", no = "_color__olive_433yx_134", eo = "_color__green_433yx_147", lo = "_color__teal_433yx_160", co = "_color__blue_433yx_173", ro = "_color__violet_433yx_186", io = "_color__purple_433yx_199", so = "_color__pink_433yx_212", ao = "_color__brown_433yx_225", uo = "_color__grey_433yx_238", fo = "_color__good_433yx_264", po = "_color__average_433yx_277", yo = "_color__bad_433yx_290", xo = "_color__label_433yx_303", mo = "_color__default_433yx_316", go = "_color__caution_433yx_329", bo = "_color__danger_433yx_342", ho = "_color__transparent_433yx_355", Co = "_disabled_433yx_370", ko = "_selected_433yx_374", vo = "_flex_433yx_387", wo = "_flex__fluid_433yx_392", Ao = "_verticalAlignContent__top_433yx_396", Bo = "_verticalAlignContent__middle_433yx_400", Io = "_verticalAlignContent__bottom_433yx_404", No = "_content_433yx_408", Ro = "_textMargin_433yx_413", _ = {
9
- button: L,
10
- fa: Y,
11
- fas: G,
12
- far: H,
13
- dropdown: J,
14
- ellipsis: Q,
15
- fluid: U,
16
- circular: W,
17
- compact: X,
18
- color__black: Z,
19
- color__white: $,
20
- color__red: oo,
21
- color__orange: to,
22
- color__yellow: _o,
23
- color__olive: no,
24
- color__green: eo,
25
- color__teal: lo,
26
- color__blue: co,
27
- color__violet: ro,
28
- color__purple: io,
29
- color__pink: so,
30
- color__brown: ao,
31
- color__grey: uo,
32
- "color__light-grey": "_color__light-grey_433yx_251",
33
- color__good: fo,
34
- color__average: po,
35
- color__bad: yo,
36
- color__label: xo,
37
- color__default: mo,
38
- color__caution: go,
39
- color__danger: bo,
40
- color__transparent: ho,
41
- disabled: Co,
42
- selected: ko,
43
- flex: vo,
44
- flex__fluid: wo,
45
- verticalAlignContent__top: Ao,
46
- verticalAlignContent__middle: Bo,
47
- verticalAlignContent__bottom: Io,
48
- content: No,
49
- textMargin: Ro
50
- };
51
- function b(a) {
1
+ import { jsx as i, 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 D, isEscape as E } from "../common/keys.js";
4
+ import { classes as F } from "../common/react.js";
5
+ import { computeBoxClassName as j, computeBoxProps as q, Box as O } from "./Box.js";
6
+ import { Icon as S } from "./Icon.js";
7
+ import { Tooltip as v } from "./Tooltip.js";
8
+ function x(u) {
52
9
  const {
53
- captureKeys: i = !0,
10
+ captureKeys: l = !0,
54
11
  children: s,
55
- circular: y,
56
- className: p,
57
- color: r,
12
+ circular: m,
13
+ className: d,
14
+ color: c,
58
15
  compact: h,
59
- content: x,
60
- disabled: o,
61
- ellipsis: c,
62
- fluid: n,
16
+ content: B,
17
+ disabled: t,
18
+ ellipsis: r,
19
+ fluid: o,
63
20
  icon: e,
64
- iconColor: u,
65
- iconPosition: w,
66
- iconRotation: A,
67
- iconSize: B,
68
- iconSpin: I,
69
- onClick: d,
70
- selected: C,
71
- tooltip: k,
72
- tooltipPosition: N,
73
- verticalAlignContent: m,
74
- ...v
75
- } = a, t = x || s;
76
- let g = /* @__PURE__ */ l(
21
+ iconColor: a,
22
+ iconPosition: C,
23
+ iconRotation: N,
24
+ iconSize: R,
25
+ iconSpin: P,
26
+ onClick: f,
27
+ selected: g,
28
+ tooltip: b,
29
+ tooltipPosition: w,
30
+ verticalAlignContent: y,
31
+ ...I
32
+ } = u, n = B || s;
33
+ let k = /* @__PURE__ */ i(
77
34
  "div",
78
35
  {
79
- className: D([
80
- _.button,
81
- n && _.fluid,
82
- o && _.disabled,
83
- C && _.selected,
84
- y && _.circular,
85
- h && _.compact,
86
- m && _.flex,
87
- m && n && _.flex__fluid,
88
- m && _["verticalAlignContent__" + m],
89
- r && typeof r == "string" ? _["color__" + r] : _.color__default,
90
- p,
91
- q(v)
36
+ className: F([
37
+ "Button",
38
+ o && "Button--fluid",
39
+ t && "Button--disabled",
40
+ g && "Button--selected",
41
+ m && "Button--circular",
42
+ h && "Button--compact",
43
+ C && `Button--iconPosition--${C}`,
44
+ y && "Button--flex",
45
+ y && o && "Button--flex--fluid",
46
+ y && `Button--verticalAlignContent--${y}`,
47
+ c && typeof c == "string" ? `Button--color--${c}` : "Button--color--default",
48
+ d,
49
+ j(I)
92
50
  ]),
93
- tabIndex: o ? void 0 : 0,
94
- onClick: (f) => {
95
- !o && d && d(f);
51
+ tabIndex: t ? void 0 : 0,
52
+ onClick: (p) => {
53
+ !t && f && f(p);
96
54
  },
97
- onKeyDown: (f) => {
98
- if (i) {
99
- if (f.key === R.Space || f.key === R.Enter) {
100
- f.preventDefault(), !o && d && d(f);
55
+ onKeyDown: (p) => {
56
+ if (l) {
57
+ if (p.key === D.Space || p.key === D.Enter) {
58
+ p.preventDefault(), !t && f && f(p);
101
59
  return;
102
60
  }
103
- E(f.key) && f.preventDefault();
61
+ E(p.key) && p.preventDefault();
104
62
  }
105
63
  },
106
- ...O(v),
107
- children: /* @__PURE__ */ P("div", { className: _.content, children: [
108
- e && w !== "right" && /* @__PURE__ */ l(
109
- F,
64
+ ...q(I),
65
+ children: /* @__PURE__ */ _("div", { className: "Button__content", children: [
66
+ e && C !== "right" && /* @__PURE__ */ i(
67
+ S,
110
68
  {
111
- mr: t ? 1 : 0,
69
+ mr: n ? 1 : 0,
112
70
  name: e,
113
- color: u,
114
- rotation: A,
115
- size: B,
116
- spin: I
71
+ color: a,
72
+ rotation: N,
73
+ size: R,
74
+ spin: P
117
75
  }
118
76
  ),
119
- c ? /* @__PURE__ */ l(
77
+ r ? /* @__PURE__ */ i(
120
78
  "span",
121
79
  {
122
- className: D([_.ellipsis, e && _.textMargin]),
123
- children: t
80
+ className: F([
81
+ "Button--ellipsis",
82
+ e && "Button__textMargin"
83
+ ]),
84
+ children: n
124
85
  }
125
- ) : t,
126
- e && w === "right" && /* @__PURE__ */ l(
127
- F,
86
+ ) : n,
87
+ e && C === "right" && /* @__PURE__ */ i(
88
+ S,
128
89
  {
129
- ml: t ? 1 : 0,
90
+ ml: n ? 1 : 0,
130
91
  name: e,
131
- color: u,
132
- rotation: A,
133
- size: B,
134
- spin: I
92
+ color: a,
93
+ rotation: N,
94
+ size: R,
95
+ spin: P
135
96
  }
136
97
  )
137
98
  ] })
138
99
  }
139
100
  );
140
- return k && (g = /* @__PURE__ */ l(K, { content: k, position: N, children: g })), g;
101
+ return b && (k = /* @__PURE__ */ i(v, { content: b, position: w, children: k })), k;
141
102
  }
142
- function Do(a) {
143
- const { checked: i, ...s } = a;
144
- return /* @__PURE__ */ l(
145
- b,
103
+ function T(u) {
104
+ const { checked: l, ...s } = u;
105
+ return /* @__PURE__ */ i(
106
+ x,
146
107
  {
147
108
  color: "transparent",
148
- icon: i ? "check-square-o" : "square-o",
149
- selected: i,
109
+ icon: l ? "check-square-o" : "square-o",
110
+ selected: l,
150
111
  ...s
151
112
  }
152
113
  );
153
114
  }
154
- b.Checkbox = Do;
155
- function Fo(a) {
115
+ x.Checkbox = T;
116
+ function L(u) {
156
117
  const {
157
- children: i,
118
+ children: l,
158
119
  color: s,
159
- confirmColor: y = "bad",
160
- confirmContent: p = "Confirm?",
161
- confirmIcon: r,
120
+ confirmColor: m = "bad",
121
+ confirmContent: d = "Confirm?",
122
+ confirmIcon: c,
162
123
  ellipsis: h = !0,
163
- icon: x,
164
- onClick: o,
165
- ...c
166
- } = a, [n, e] = S(!1);
167
- function u(w) {
168
- if (!n) {
124
+ icon: B,
125
+ onClick: t,
126
+ ...r
127
+ } = u, [o, e] = A(!1);
128
+ function a(C) {
129
+ if (!o) {
169
130
  e(!0);
170
131
  return;
171
132
  }
172
- o == null || o(w), e(!1);
133
+ t == null || t(C), e(!1);
173
134
  }
174
- return /* @__PURE__ */ l(
175
- b,
135
+ return /* @__PURE__ */ i(
136
+ x,
176
137
  {
177
- icon: n ? r : x,
178
- color: n ? y : s,
179
- onClick: u,
180
- ...c,
181
- children: n ? p : i
138
+ icon: o ? c : B,
139
+ color: o ? m : s,
140
+ onClick: a,
141
+ ...r,
142
+ children: o ? d : l
182
143
  }
183
144
  );
184
145
  }
185
- b.Confirm = Fo;
186
- function Po(a) {
146
+ x.Confirm = L;
147
+ function M(u) {
187
148
  const {
188
- children: i,
149
+ children: l,
189
150
  color: s = "default",
190
- content: y,
191
- currentValue: p,
192
- defaultValue: r,
151
+ content: m,
152
+ currentValue: d,
153
+ defaultValue: c,
193
154
  disabled: h,
194
- fluid: x,
195
- icon: o,
196
- iconRotation: c,
197
- iconSpin: n,
155
+ fluid: B,
156
+ icon: t,
157
+ iconRotation: r,
158
+ iconSpin: o,
198
159
  maxLength: e,
199
- onCommit: u = () => null,
200
- placeholder: w,
201
- tooltip: A,
202
- tooltipPosition: B,
203
- ...I
204
- } = a, [d, C] = S(!1), k = V(), N = y || i;
205
- function m(t) {
206
- const g = k.current;
207
- if (!g) return;
208
- g.value !== "" ? u(t, g.value) : r && u(t, r);
160
+ onCommit: a = () => null,
161
+ placeholder: C,
162
+ tooltip: N,
163
+ tooltipPosition: R,
164
+ ...P
165
+ } = u, [f, g] = A(!1), b = V(), w = m || l;
166
+ function y(n) {
167
+ const k = b.current;
168
+ if (!k) return;
169
+ k.value !== "" ? a(n, k.value) : c && a(n, c);
209
170
  }
210
- z(() => {
211
- const t = k.current;
212
- if (t && d) {
213
- t.value = p || "";
171
+ $(() => {
172
+ const n = b.current;
173
+ if (n && f) {
174
+ n.value = d || "";
214
175
  try {
215
- t.focus(), t.select();
176
+ n.focus(), n.select();
216
177
  } catch {
217
178
  }
218
179
  }
219
- }, [d, p]);
220
- let v = /* @__PURE__ */ P(
221
- T,
180
+ }, [f, d]);
181
+ let I = /* @__PURE__ */ _(
182
+ O,
222
183
  {
223
- className: D([
224
- _.button,
225
- x && _.fluid,
226
- _["color__" + s]
184
+ className: F([
185
+ "Button",
186
+ B && "Button--fluid",
187
+ h && "Button--disabled",
188
+ `Button--color--${s}`
227
189
  ]),
228
- ...I,
229
- onClick: () => C(!0),
190
+ ...P,
191
+ onClick: () => g(!0),
230
192
  children: [
231
- o && /* @__PURE__ */ l(F, { name: o, rotation: c, spin: n }),
232
- /* @__PURE__ */ l("div", { children: N }),
233
- /* @__PURE__ */ l(
193
+ t && /* @__PURE__ */ i(S, { name: t, rotation: r, spin: o }),
194
+ /* @__PURE__ */ i("div", { children: w }),
195
+ /* @__PURE__ */ i(
234
196
  "input",
235
197
  {
236
198
  disabled: !!h,
237
- ref: k,
199
+ ref: b,
238
200
  className: "NumberInput__input",
239
201
  style: {
240
- display: d ? "" : "none",
202
+ display: f ? "" : "none",
241
203
  textAlign: "left"
242
204
  },
243
- onBlur: (t) => {
244
- d && (C(!1), m(t));
205
+ onBlur: (n) => {
206
+ f && (g(!1), y(n));
245
207
  },
246
- onKeyDown: (t) => {
247
- if (t.key === R.Enter) {
248
- C(!1), m(t);
208
+ onKeyDown: (n) => {
209
+ if (n.key === D.Enter) {
210
+ g(!1), y(n);
249
211
  return;
250
212
  }
251
- E(t.key) && C(!1);
213
+ E(n.key) && g(!1);
252
214
  }
253
215
  }
254
216
  )
255
217
  ]
256
218
  }
257
219
  );
258
- return A && (v = /* @__PURE__ */ l(K, { content: A, position: B, children: v })), v;
220
+ return N && (I = /* @__PURE__ */ i(v, { content: N, position: R, children: I })), I;
259
221
  }
260
- b.Input = Po;
261
- function So(a) {
262
- const { accept: i, multiple: s, onSelectFiles: y, ...p } = a, r = j(null);
263
- async function h(o) {
264
- const c = Array.from(o).map((n) => {
222
+ x.Input = M;
223
+ function Y(u) {
224
+ const { accept: l, multiple: s, onSelectFiles: m, ...d } = u, c = z(null);
225
+ async function h(t) {
226
+ const r = Array.from(t).map((o) => {
265
227
  const e = new FileReader();
266
- return new Promise((u) => {
267
- e.onload = () => u(e.result), e.readAsText(n);
228
+ return new Promise((a) => {
229
+ e.onload = () => a(e.result), e.readAsText(o);
268
230
  });
269
231
  });
270
- return await Promise.all(c);
232
+ return await Promise.all(r);
271
233
  }
272
- async function x(o) {
273
- const c = o.target.files;
274
- if (c != null && c.length) {
275
- const n = await h(c);
276
- y(s ? n : n[0]);
234
+ async function B(t) {
235
+ const r = t.target.files;
236
+ if (r != null && r.length) {
237
+ const o = await h(r);
238
+ m(s ? o : o[0]);
277
239
  }
278
240
  }
279
- return /* @__PURE__ */ P(M, { children: [
280
- /* @__PURE__ */ l(b, { onClick: () => {
281
- var o;
282
- return (o = r.current) == null ? void 0 : o.click();
283
- }, ...p }),
284
- /* @__PURE__ */ l(
241
+ return /* @__PURE__ */ _(K, { children: [
242
+ /* @__PURE__ */ i(x, { onClick: () => {
243
+ var t;
244
+ return (t = c.current) == null ? void 0 : t.click();
245
+ }, ...d }),
246
+ /* @__PURE__ */ i(
285
247
  "input",
286
248
  {
287
249
  hidden: !0,
288
250
  type: "file",
289
- ref: r,
290
- accept: i,
251
+ ref: c,
252
+ accept: l,
291
253
  multiple: s,
292
- onChange: x
254
+ onChange: B
293
255
  }
294
256
  )
295
257
  ] });
296
258
  }
297
- b.File = So;
259
+ x.File = Y;
298
260
  export {
299
- b as Button,
300
- Do as ButtonCheckbox
261
+ x as Button,
262
+ T as ButtonCheckbox
301
263
  };
@@ -7,7 +7,7 @@ const o = [];
7
7
  function h(t) {
8
8
  const n = o.length;
9
9
  o.push(null);
10
- const e = t || "byondui_" + n;
10
+ const e = t || `byondui_${n}`;
11
11
  return {
12
12
  render: (i) => {
13
13
  o[n] = e, Byond.winset(e, i);
@@ -56,8 +56,8 @@ class U extends a {
56
56
  this.byondUiElement.render({
57
57
  parent: Byond.windowId,
58
58
  ...n,
59
- pos: e.pos[0] + "," + e.pos[1],
60
- size: e.size[0] + "x" + e.size[1]
59
+ pos: `${e.pos[0]},${e.pos[1]}`,
60
+ size: `${e.size[0]}x${e.size[1]}`
61
61
  });
62
62
  }
63
63
  componentWillUnmount() {
@@ -1,6 +1,5 @@
1
1
  import { Component, RefObject } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  type Props = {
5
4
  data: number[][];
6
5
  } & Partial<{
@@ -1,17 +1,17 @@
1
1
  var w = Object.defineProperty;
2
2
  var R = (t, o, e) => o in t ? w(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e;
3
3
  var p = (t, o, e) => R(t, typeof o != "symbol" ? o + "" : o, e);
4
- import { jsx as c } from "react/jsx-runtime";
5
- import { Component as g, createRef as B } from "react";
4
+ import { jsx as c, jsxs as g } from "react/jsx-runtime";
5
+ import { Component as B, createRef as C } from "react";
6
6
  import { zip as u } from "../common/collections.js";
7
7
  import { Box as v } from "./Box.js";
8
- function C(t, o, e, n) {
8
+ function $(t, o, e, n) {
9
9
  if (t.length === 0)
10
10
  return [];
11
11
  const f = u(...t), h = f.map((r) => Math.min(...r)), a = f.map((r) => Math.max(...r));
12
12
  return e !== void 0 && (h[0] = e[0], a[0] = e[1]), n !== void 0 && (h[1] = n[0], a[1] = n[1]), t.map(
13
13
  (r) => u(r, h, a, o).map(
14
- ([l, i, m, d]) => (l - i) / (m - i) * d
14
+ ([l, i, d, m]) => (l - i) / (d - i) * m
15
15
  )
16
16
  );
17
17
  }
@@ -19,11 +19,11 @@ function L(t) {
19
19
  let o = "";
20
20
  for (let e = 0; e < t.length; e++) {
21
21
  const n = t[e];
22
- o += n[0] + "," + n[1] + " ";
22
+ o += `${n[0]},${n[1]} `;
23
23
  }
24
24
  return o;
25
25
  }
26
- class b extends g {
26
+ class b extends B {
27
27
  constructor(e) {
28
28
  super(e);
29
29
  p(this, "ref");
@@ -34,7 +34,7 @@ class b extends g {
34
34
  viewBox: [e.offsetWidth, e.offsetHeight]
35
35
  });
36
36
  });
37
- this.ref = B(), this.state = {
37
+ this.ref = C(), this.state = {
38
38
  // Initial guess
39
39
  viewBox: [600, 200]
40
40
  }, this.handleResize = this.handleResize.bind(this);
@@ -54,13 +54,13 @@ class b extends g {
54
54
  strokeColor: a = "#ffffff",
55
55
  strokeWidth: s = 2,
56
56
  ...r
57
- } = this.props, { viewBox: l } = this.state, i = C(e, l, n, f);
57
+ } = this.props, { viewBox: l } = this.state, i = $(e, l, n, f);
58
58
  if (i.length > 0) {
59
59
  const z = i[0], x = i[i.length - 1];
60
60
  i.push([l[0] + s, x[1]]), i.push([l[0] + s, -s]), i.push([-s, -s]), i.push([-s, z[1]]);
61
61
  }
62
- const m = L(i), d = { ...r, className: "", ref: this.ref };
63
- return /* @__PURE__ */ c(v, { position: "relative", ...r, children: /* @__PURE__ */ c(v, { ...d, children: /* @__PURE__ */ c(
62
+ const d = L(i), m = { ...r, className: "", ref: this.ref };
63
+ return /* @__PURE__ */ c(v, { position: "relative", ...r, children: /* @__PURE__ */ c(v, { ...m, children: /* @__PURE__ */ g(
64
64
  "svg",
65
65
  {
66
66
  viewBox: `0 0 ${l[0]} ${l[1]}`,
@@ -73,23 +73,26 @@ class b extends g {
73
73
  bottom: 0,
74
74
  overflow: "hidden"
75
75
  },
76
- children: /* @__PURE__ */ c(
77
- "polyline",
78
- {
79
- transform: `scale(1, -1) translate(0, -${l[1]})`,
80
- fill: h,
81
- stroke: a,
82
- strokeWidth: s,
83
- points: m
84
- }
85
- )
76
+ children: [
77
+ /* @__PURE__ */ c("title", { children: "chart" }),
78
+ /* @__PURE__ */ c(
79
+ "polyline",
80
+ {
81
+ transform: `scale(1, -1) translate(0, -${l[1]})`,
82
+ fill: h,
83
+ stroke: a,
84
+ strokeWidth: s,
85
+ points: d
86
+ }
87
+ )
88
+ ]
86
89
  }
87
90
  ) }) });
88
91
  }
89
92
  }
90
- const $ = {
93
+ const j = {
91
94
  Line: b
92
95
  };
93
96
  export {
94
- $ as Chart
97
+ j as Chart
95
98
  };
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  type Props = Partial<{
5
4
  /** Buttons or other content to render inline with the button */
6
5
  buttons: ReactNode;
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  type Props = {
5
4
  content?: ReactNode;
6
5
  } & BoxProps;
@@ -1,21 +1,14 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { classes as s } from "../common/react.js";
3
- import { computeBoxClassName as e, computeBoxProps as n } from "./Box.js";
4
- import '../assets/ColorBox.css';const m = "_colorBox_110qz_5", a = {
5
- colorBox: m
6
- };
2
+ import { classes as c } from "../common/react.js";
3
+ import { computeBoxClassName as s, computeBoxProps as m } from "./Box.js";
7
4
  function d(r) {
8
- const { content: c, children: x, className: l, ...o } = r;
9
- return o.color = c ? null : "default", o.backgroundColor = r.color || "default", /* @__PURE__ */ t(
5
+ const { content: l, children: a, className: e, ...o } = r;
6
+ return o.color = l ? null : "default", o.backgroundColor = r.color || "default", /* @__PURE__ */ t(
10
7
  "div",
11
8
  {
12
- className: s([
13
- a.colorBox,
14
- l,
15
- e(o)
16
- ]),
17
- ...n(o),
18
- children: c || ""
9
+ className: c(["ColorBox", e, s(o)]),
10
+ ...m(o),
11
+ children: l || ""
19
12
  }
20
13
  );
21
14
  }