tgui-core 1.1.8 → 1.1.10

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 (291) hide show
  1. package/lib/common/assets.ts +38 -0
  2. package/lib/common/collections.ts +27 -0
  3. package/lib/common/color.ts +88 -0
  4. package/lib/common/constants.ts +349 -0
  5. package/lib/common/events.ts +262 -0
  6. package/{dist/common/exhaustive.d.ts → lib/common/exhaustive.ts} +3 -1
  7. package/lib/common/format.ts +167 -0
  8. package/{dist/common/fp.d.ts → lib/common/fp.ts} +16 -2
  9. package/lib/common/hotkeys.ts +207 -0
  10. package/lib/common/http.ts +16 -0
  11. package/lib/common/keycodes.ts +86 -0
  12. package/{dist/common/keys.d.ts → lib/common/keys.ts} +24 -21
  13. package/lib/common/math.ts +76 -0
  14. package/lib/common/perf.ts +72 -0
  15. package/lib/common/random.ts +32 -0
  16. package/lib/common/react.ts +59 -0
  17. package/lib/common/redux.ts +187 -0
  18. package/lib/common/storage.ts +207 -0
  19. package/lib/common/string.ts +169 -0
  20. package/lib/common/timer.ts +63 -0
  21. package/lib/common/type-utils.ts +41 -0
  22. package/lib/common/types.d.ts +12 -0
  23. package/lib/common/uuid.ts +18 -0
  24. package/lib/components/AnimatedNumber.tsx +180 -0
  25. package/lib/components/Autofocus.tsx +23 -0
  26. package/lib/components/Blink.tsx +91 -0
  27. package/lib/components/BlockQuote.tsx +9 -0
  28. package/lib/components/BodyZoneSelector.tsx +149 -0
  29. package/lib/components/Box.tsx +252 -0
  30. package/lib/components/Button.tsx +425 -0
  31. package/lib/components/ByondUi.jsx +110 -0
  32. package/lib/components/Chart.tsx +155 -0
  33. package/lib/components/Collapsible.tsx +43 -0
  34. package/lib/components/ColorBox.tsx +29 -0
  35. package/lib/components/Dialog.tsx +81 -0
  36. package/lib/components/Dimmer.tsx +13 -0
  37. package/lib/components/Divider.tsx +20 -0
  38. package/lib/components/DmIcon.tsx +86 -0
  39. package/lib/components/DraggableControl.jsx +276 -0
  40. package/lib/components/Dropdown.tsx +246 -0
  41. package/lib/components/FakeTerminal.jsx +52 -0
  42. package/lib/components/FitText.tsx +99 -0
  43. package/lib/components/Flex.tsx +159 -0
  44. package/lib/components/Icon.tsx +95 -0
  45. package/lib/components/Image.tsx +54 -0
  46. package/lib/components/InfinitePlane.jsx +192 -0
  47. package/lib/components/Input.tsx +176 -0
  48. package/lib/components/KeyListener.tsx +40 -0
  49. package/lib/components/Knob.tsx +178 -0
  50. package/lib/components/LabeledControls.tsx +44 -0
  51. package/lib/components/LabeledList.tsx +154 -0
  52. package/lib/components/MenuBar.tsx +228 -0
  53. package/lib/components/Modal.tsx +23 -0
  54. package/lib/components/NoticeBox.tsx +45 -0
  55. package/lib/components/NumberInput.tsx +328 -0
  56. package/lib/components/Popper.tsx +100 -0
  57. package/lib/components/ProgressBar.tsx +105 -0
  58. package/lib/components/RestrictedInput.jsx +301 -0
  59. package/lib/components/RoundGauge.tsx +180 -0
  60. package/lib/components/Section.tsx +120 -0
  61. package/lib/components/Slider.tsx +169 -0
  62. package/lib/components/Stack.tsx +96 -0
  63. package/lib/components/StyleableSection.tsx +33 -0
  64. package/lib/components/Table.tsx +84 -0
  65. package/lib/components/Tabs.tsx +89 -0
  66. package/lib/components/TextArea.tsx +182 -0
  67. package/lib/components/TimeDisplay.jsx +64 -0
  68. package/lib/components/Tooltip.tsx +152 -0
  69. package/lib/components/TrackOutsideClicks.tsx +35 -0
  70. package/lib/components/VirtualList.tsx +69 -0
  71. package/lib/styles/atomic/candystripe.scss +8 -0
  72. package/lib/styles/atomic/centered-image.scss +7 -0
  73. package/lib/styles/atomic/color.scss +21 -0
  74. package/lib/styles/atomic/debug-layout.scss +17 -0
  75. package/lib/styles/atomic/fit-text.scss +14 -0
  76. package/lib/styles/atomic/links.scss +12 -0
  77. package/lib/styles/atomic/outline.scss +47 -0
  78. package/lib/styles/atomic/text.scss +44 -0
  79. package/lib/styles/base.scss +32 -0
  80. package/lib/styles/colors.scss +92 -0
  81. package/lib/styles/components/BlockQuote.module.scss +20 -0
  82. package/lib/styles/components/BlockQuote.module.scss.d.ts +4 -0
  83. package/lib/styles/components/Button.module.scss +157 -0
  84. package/lib/styles/components/Button.module.scss.d.ts +46 -0
  85. package/lib/styles/components/ColorBox.module.scss +12 -0
  86. package/lib/styles/components/ColorBox.module.scss.d.ts +4 -0
  87. package/lib/styles/components/Dialog.module.scss +60 -0
  88. package/lib/styles/components/Dialog.module.scss.d.ts +10 -0
  89. package/lib/styles/components/Dimmer.module.scss +22 -0
  90. package/lib/styles/components/Dimmer.module.scss.d.ts +4 -0
  91. package/lib/styles/components/Divider.module.scss +27 -0
  92. package/lib/styles/components/Divider.module.scss.d.ts +6 -0
  93. package/lib/styles/components/Dropdown.scss +72 -0
  94. package/lib/styles/components/Flex.module.scss +13 -0
  95. package/lib/styles/components/Flex.module.scss.d.ts +5 -0
  96. package/lib/styles/components/Icon.module.scss +25 -0
  97. package/lib/styles/components/Icon.module.scss.d.ts +5 -0
  98. package/lib/styles/components/Input.module.scss +64 -0
  99. package/lib/styles/components/Input.module.scss.d.ts +8 -0
  100. package/lib/styles/components/Knob.module.scss +131 -0
  101. package/lib/styles/components/Knob.module.scss.d.ts +33 -0
  102. package/lib/styles/components/LabeledList.module.scss +49 -0
  103. package/lib/styles/components/LabeledList.module.scss.d.ts +8 -0
  104. package/lib/styles/components/MenuBar.module.scss +75 -0
  105. package/lib/styles/components/MenuBar.module.scss.d.ts +14 -0
  106. package/lib/styles/components/Modal.module.scss +14 -0
  107. package/lib/styles/components/Modal.module.scss.d.ts +4 -0
  108. package/lib/styles/components/NoticeBox.module.scss +65 -0
  109. package/lib/styles/components/NoticeBox.module.scss.d.ts +27 -0
  110. package/lib/styles/components/NumberInput.module.scss +71 -0
  111. package/lib/styles/components/NumberInput.module.scss.d.ts +9 -0
  112. package/lib/styles/components/ProgressBar.module.scss +63 -0
  113. package/lib/styles/components/ProgressBar.module.scss.d.ts +27 -0
  114. package/lib/styles/components/RoundGauge.module.scss +85 -0
  115. package/lib/styles/components/RoundGauge.module.scss.d.ts +49 -0
  116. package/lib/styles/components/Section.module.scss +130 -0
  117. package/lib/styles/components/Section.module.scss.d.ts +13 -0
  118. package/lib/styles/components/Slider.module.scss +54 -0
  119. package/lib/styles/components/Slider.module.scss.d.ts +8 -0
  120. package/lib/styles/components/Stack.module.scss +60 -0
  121. package/lib/styles/components/Stack.module.scss.d.ts +12 -0
  122. package/lib/styles/components/Table.module.scss +44 -0
  123. package/lib/styles/components/Table.module.scss.d.ts +10 -0
  124. package/lib/styles/components/Tabs.module.scss +144 -0
  125. package/lib/styles/components/Tabs.module.scss.d.ts +35 -0
  126. package/lib/styles/components/TextArea.module.scss +86 -0
  127. package/lib/styles/components/TextArea.module.scss.d.ts +11 -0
  128. package/lib/styles/components/Tooltip.module.scss +24 -0
  129. package/lib/styles/components/Tooltip.module.scss.d.ts +4 -0
  130. package/lib/styles/functions.scss +79 -0
  131. package/lib/styles/input.scss +9 -0
  132. package/lib/styles/main.scss +20 -0
  133. package/lib/styles/reset.scss +68 -0
  134. package/package.json +7 -7
  135. package/dist/ProgressBar.module-BkAFfFy0.js +0 -29
  136. package/dist/Section.module-CLVHJ4yA.js +0 -15
  137. package/dist/assets/BlockQuote.css +0 -1
  138. package/dist/assets/Button.css +0 -1
  139. package/dist/assets/ColorBox.css +0 -1
  140. package/dist/assets/Dialog.css +0 -1
  141. package/dist/assets/Dimmer.css +0 -1
  142. package/dist/assets/Divider.css +0 -1
  143. package/dist/assets/Flex.css +0 -1
  144. package/dist/assets/Icon.css +0 -6
  145. package/dist/assets/Input.css +0 -1
  146. package/dist/assets/Knob.css +0 -1
  147. package/dist/assets/LabeledList.css +0 -1
  148. package/dist/assets/MenuBar.css +0 -1
  149. package/dist/assets/Modal.css +0 -1
  150. package/dist/assets/NoticeBox.css +0 -1
  151. package/dist/assets/NumberInput.css +0 -1
  152. package/dist/assets/ProgressBar.css +0 -1
  153. package/dist/assets/RoundGauge.css +0 -1
  154. package/dist/assets/Section.css +0 -1
  155. package/dist/assets/Slider.css +0 -1
  156. package/dist/assets/Stack.css +0 -1
  157. package/dist/assets/Table.css +0 -1
  158. package/dist/assets/Tabs.css +0 -1
  159. package/dist/assets/TextArea.css +0 -1
  160. package/dist/assets/Tooltip.css +0 -1
  161. package/dist/common/assets.d.ts +0 -4
  162. package/dist/common/assets.js +0 -25
  163. package/dist/common/collections.d.ts +0 -10
  164. package/dist/common/collections.js +0 -15
  165. package/dist/common/color.d.ts +0 -25
  166. package/dist/common/color.js +0 -69
  167. package/dist/common/constants.d.ts +0 -102
  168. package/dist/common/constants.js +0 -312
  169. package/dist/common/events.d.ts +0 -33
  170. package/dist/common/events.js +0 -147
  171. package/dist/common/exhaustive.js +0 -6
  172. package/dist/common/format.d.ts +0 -11
  173. package/dist/common/format.js +0 -114
  174. package/dist/common/fp.js +0 -9
  175. package/dist/common/hotkeys.d.ts +0 -25
  176. package/dist/common/hotkeys.js +0 -112
  177. package/dist/common/http.d.ts +0 -4
  178. package/dist/common/http.js +0 -10
  179. package/dist/common/keycodes.d.ts +0 -85
  180. package/dist/common/keycodes.js +0 -88
  181. package/dist/common/keys.js +0 -8
  182. package/dist/common/math.d.ts +0 -39
  183. package/dist/common/math.js +0 -41
  184. package/dist/common/perf.d.ts +0 -24
  185. package/dist/common/perf.js +0 -33
  186. package/dist/common/random.d.ts +0 -16
  187. package/dist/common/random.js +0 -18
  188. package/dist/common/react.d.ts +0 -23
  189. package/dist/common/react.js +0 -30
  190. package/dist/common/redux.d.ts +0 -64
  191. package/dist/common/redux.js +0 -72
  192. package/dist/common/storage.js +0 -124
  193. package/dist/common/string.d.ts +0 -65
  194. package/dist/common/string.js +0 -83
  195. package/dist/common/timer.d.ts +0 -18
  196. package/dist/common/timer.js +0 -28
  197. package/dist/common/type-utils.d.ts +0 -9
  198. package/dist/common/type-utils.js +0 -25
  199. package/dist/common/uuid.d.ts +0 -9
  200. package/dist/common/uuid.js +0 -10
  201. package/dist/components/AnimatedNumber.d.ts +0 -60
  202. package/dist/components/AnimatedNumber.js +0 -76
  203. package/dist/components/Autofocus.d.ts +0 -4
  204. package/dist/components/Autofocus.js +0 -17
  205. package/dist/components/Blink.d.ts +0 -26
  206. package/dist/components/Blink.js +0 -56
  207. package/dist/components/BlockQuote.d.ts +0 -3
  208. package/dist/components/BlockQuote.js +0 -13
  209. package/dist/components/BodyZoneSelector.d.ts +0 -28
  210. package/dist/components/BodyZoneSelector.js +0 -115
  211. package/dist/components/Box.d.ts +0 -91
  212. package/dist/components/Box.js +0 -133
  213. package/dist/components/Button.d.ts +0 -93
  214. package/dist/components/Button.js +0 -298
  215. package/dist/components/ByondUi.js +0 -73
  216. package/dist/components/Chart.d.ts +0 -28
  217. package/dist/components/Chart.js +0 -95
  218. package/dist/components/Collapsible.d.ts +0 -15
  219. package/dist/components/Collapsible.js +0 -27
  220. package/dist/components/ColorBox.d.ts +0 -8
  221. package/dist/components/ColorBox.js +0 -24
  222. package/dist/components/Dialog.d.ts +0 -24
  223. package/dist/components/Dialog.js +0 -67
  224. package/dist/components/Dimmer.d.ts +0 -3
  225. package/dist/components/Dimmer.js +0 -13
  226. package/dist/components/Divider.d.ts +0 -6
  227. package/dist/components/Divider.js +0 -22
  228. package/dist/components/DmIcon.d.ts +0 -31
  229. package/dist/components/DmIcon.js +0 -34
  230. package/dist/components/DraggableControl.js +0 -176
  231. package/dist/components/Dropdown.d.ts +0 -48
  232. package/dist/components/Dropdown.js +0 -152
  233. package/dist/components/FakeTerminal.js +0 -38
  234. package/dist/components/FitText.d.ts +0 -22
  235. package/dist/components/FitText.js +0 -63
  236. package/dist/components/Flex.d.ts +0 -93
  237. package/dist/components/Flex.js +0 -72
  238. package/dist/components/Icon.d.ts +0 -30
  239. package/dist/components/Icon.js +0 -51
  240. package/dist/components/Image.d.ts +0 -14
  241. package/dist/components/Image.js +0 -35
  242. package/dist/components/InfinitePlane.js +0 -139
  243. package/dist/components/Input.d.ts +0 -61
  244. package/dist/components/Input.js +0 -89
  245. package/dist/components/KeyListener.d.ts +0 -15
  246. package/dist/components/KeyListener.js +0 -23
  247. package/dist/components/Knob.d.ts +0 -49
  248. package/dist/components/Knob.js +0 -162
  249. package/dist/components/LabeledControls.d.ts +0 -11
  250. package/dist/components/LabeledControls.js +0 -39
  251. package/dist/components/LabeledList.d.ts +0 -57
  252. package/dist/components/LabeledList.js +0 -94
  253. package/dist/components/MenuBar.d.ts +0 -28
  254. package/dist/components/MenuBar.js +0 -174
  255. package/dist/components/Modal.d.ts +0 -3
  256. package/dist/components/Modal.js +0 -25
  257. package/dist/components/NoticeBox.d.ts +0 -20
  258. package/dist/components/NoticeBox.js +0 -49
  259. package/dist/components/NumberInput.d.ts +0 -45
  260. package/dist/components/NumberInput.js +0 -221
  261. package/dist/components/Popper.d.ts +0 -27
  262. package/dist/components/Popper.js +0 -177
  263. package/dist/components/ProgressBar.d.ts +0 -46
  264. package/dist/components/ProgressBar.js +0 -37
  265. package/dist/components/RestrictedInput.js +0 -155
  266. package/dist/components/RoundGauge.d.ts +0 -53
  267. package/dist/components/RoundGauge.js +0 -147
  268. package/dist/components/Section.d.ts +0 -63
  269. package/dist/components/Section.js +0 -62
  270. package/dist/components/Slider.d.ts +0 -46
  271. package/dist/components/Slider.js +0 -124
  272. package/dist/components/Stack.d.ts +0 -27
  273. package/dist/components/Stack.js +0 -67
  274. package/dist/components/StyleableSection.d.ts +0 -11
  275. package/dist/components/StyleableSection.js +0 -16
  276. package/dist/components/Table.d.ts +0 -29
  277. package/dist/components/Table.js +0 -67
  278. package/dist/components/Tabs.d.ts +0 -23
  279. package/dist/components/Tabs.js +0 -89
  280. package/dist/components/TextArea.d.ts +0 -39
  281. package/dist/components/TextArea.js +0 -118
  282. package/dist/components/TimeDisplay.js +0 -34
  283. package/dist/components/Tooltip.d.ts +0 -29
  284. package/dist/components/Tooltip.js +0 -83
  285. package/dist/components/TrackOutsideClicks.d.ts +0 -13
  286. package/dist/components/TrackOutsideClicks.js +0 -24
  287. package/dist/components/VirtualList.d.ts +0 -8
  288. package/dist/components/VirtualList.js +0 -34
  289. package/dist/components/index.js +0 -92
  290. package/dist/popper-CiqSDJTE.js +0 -906
  291. /package/{dist/components/index.d.ts → lib/components/index.ts} +0 -0
@@ -1,155 +0,0 @@
1
- import { jsxs as E, jsx as h } from "react/jsx-runtime";
2
- import { KEY_ENTER as I, KEY_ESCAPE as S } from "../common/keycodes.js";
3
- import { clamp as m } from "../common/math.js";
4
- import { classes as v } from "../common/react.js";
5
- import { Component as F, createRef as N } from "react";
6
- import { Box as C } from "./Box.js";
7
- const g = 0, x = 1e4;
8
- function M(e, n, t, s) {
9
- const i = n || g, o = t || t === 0 ? t : x;
10
- let r = s ? e.replace(/[^\-\d.]/g, "") : e.replace(/[^\-\d]/g, "");
11
- return s && (r = b(r, i), r = d(".", r)), n < 0 ? (r = _(r), r = d("-", r)) : r = r.replaceAll("-", ""), i <= 1 && o >= 0 ? V(r, i, o, s) : r;
12
- }
13
- const V = (e, n, t, s) => {
14
- let i = s ? parseFloat(e) : parseInt(e, 10);
15
- if (!isNaN(i) && (e.slice(-1) !== "." || i < Math.floor(n))) {
16
- let o = m(i, n, t);
17
- if (i !== o)
18
- return String(o);
19
- }
20
- return e;
21
- };
22
- function _(e) {
23
- let n = e, t = e.indexOf("-");
24
- return t > 0 ? (e = e.replace("-", ""), n = "-".concat(e)) : t === 0 && e.indexOf("-", t + 1) > 0 && (n = e.replaceAll("-", "")), n;
25
- }
26
- function b(e, n) {
27
- let t = e, s = Math.sign(n) * Math.floor(Math.abs(n));
28
- return e.indexOf(".") === 0 ? t = String(s).concat(e) : e.indexOf("-") === 0 && e.indexOf(".") === 1 && (t = s + ".".concat(e.slice(2))), t;
29
- }
30
- function d(e, n) {
31
- const t = n.indexOf(e), s = n.length;
32
- let i = n;
33
- if (t !== -1 && t < s - 1) {
34
- let o = n.slice(t + 1, s);
35
- o = o.replaceAll(e, ""), i = n.slice(0, t + 1).concat(o);
36
- }
37
- return i;
38
- }
39
- function f(e, n, t, s) {
40
- const i = n || g, o = t || t === 0 ? t : x;
41
- if (!e || !e.length)
42
- return String(i);
43
- let r = s ? parseFloat(e.replace(/[^\-\d.]/g, "")) : parseInt(e.replace(/[^\-\d]/g, ""), 10);
44
- return isNaN(r) ? String(i) : String(m(r, i, o));
45
- }
46
- class B extends F {
47
- constructor(n) {
48
- super(n), this.inputRef = N(), this.state = {
49
- editing: !1
50
- }, this.handleBlur = (t) => {
51
- const { maxValue: s, minValue: i, onBlur: o, allowFloats: r } = this.props, { editing: l } = this.state;
52
- l && this.setEditing(!1);
53
- const a = f(
54
- t.target.value,
55
- i,
56
- s,
57
- r
58
- );
59
- o && o(t, +a);
60
- }, this.handleChange = (t) => {
61
- const { maxValue: s, minValue: i, onChange: o, allowFloats: r } = this.props;
62
- t.target.value = M(
63
- t.target.value,
64
- i,
65
- s,
66
- r
67
- ), o && o(t, +t.target.value);
68
- }, this.handleFocus = (t) => {
69
- const { editing: s } = this.state;
70
- s || this.setEditing(!0);
71
- }, this.handleInput = (t) => {
72
- const { editing: s } = this.state, { onInput: i } = this.props;
73
- s || this.setEditing(!0), i && i(t, +t.target.value);
74
- }, this.handleKeyDown = (t) => {
75
- const { maxValue: s, minValue: i, onChange: o, onEnter: r, allowFloats: l } = this.props;
76
- if (t.keyCode === I) {
77
- const a = f(
78
- t.target.value,
79
- i,
80
- s,
81
- l
82
- );
83
- this.setEditing(!1), o && o(t, +a), r && r(t, +a), t.target.blur();
84
- return;
85
- }
86
- if (t.keyCode === S) {
87
- if (this.props.onEscape) {
88
- this.props.onEscape(t);
89
- return;
90
- }
91
- this.setEditing(!1), t.target.value = this.props.value, t.target.blur();
92
- return;
93
- }
94
- };
95
- }
96
- componentDidMount() {
97
- var r;
98
- const { maxValue: n, minValue: t, allowFloats: s } = this.props, i = (r = this.props.value) == null ? void 0 : r.toString(), o = this.inputRef.current;
99
- o && (o.value = f(
100
- i,
101
- t,
102
- n,
103
- s
104
- )), (this.props.autoFocus || this.props.autoSelect) && setTimeout(() => {
105
- o.focus(), this.props.autoSelect && o.select();
106
- }, 1);
107
- }
108
- componentDidUpdate(n, t) {
109
- var p, c;
110
- const { maxValue: s, minValue: i, allowFloats: o } = this.props, { editing: r } = this.state, l = (p = n.value) == null ? void 0 : p.toString(), a = (c = this.props.value) == null ? void 0 : c.toString(), u = this.inputRef.current;
111
- u && !r && a !== l && a !== u.value && (u.value = f(
112
- a,
113
- i,
114
- s,
115
- o
116
- ));
117
- }
118
- setEditing(n) {
119
- this.setState({ editing: n });
120
- }
121
- render() {
122
- const { props: n } = this, { onChange: t, onEnter: s, onInput: i, onBlur: o, value: r, ...l } = n, { className: a, fluid: u, monospace: p, ...c } = l;
123
- return /* @__PURE__ */ E(
124
- C,
125
- {
126
- className: v([
127
- "Input",
128
- u && "Input--fluid",
129
- p && "Input--monospace",
130
- a
131
- ]),
132
- ...c,
133
- children: [
134
- /* @__PURE__ */ h("div", { className: "Input__baseline", children: "." }),
135
- /* @__PURE__ */ h(
136
- "input",
137
- {
138
- className: "Input__input",
139
- onChange: this.handleChange,
140
- onInput: this.handleInput,
141
- onFocus: this.handleFocus,
142
- onBlur: this.handleBlur,
143
- onKeyDown: this.handleKeyDown,
144
- ref: this.inputRef,
145
- type: "number | string"
146
- }
147
- )
148
- ]
149
- }
150
- );
151
- }
152
- }
153
- export {
154
- B as RestrictedInput
155
- };
@@ -1,53 +0,0 @@
1
- import { BoxProps } from './Box';
2
-
3
- type Props = {
4
- /** The current value of the metric. */
5
- value: number;
6
- } & Partial<{
7
- /** When provided, will cause an alert symbol on the gauge to begin flashing in the color upon which the needle currently rests, as defined in `ranges`. */
8
- alertAfter: number;
9
- /** As with alertAfter, but alerts below a value. If both are set, and alertAfter comes earlier, the alert will only flash when the needle is between both values. Otherwise, the alert will flash when on the active side of either threshold. */
10
- alertBefore: number;
11
- /** CSS style. */
12
- className: string;
13
- /** When provided, will be used to format the value of the metric for display. */
14
- format: (value: number) => string;
15
- /** The upper bound of the gauge. */
16
- maxValue: number;
17
- /** The lower bound of the gauge. */
18
- minValue: number;
19
- /** Provide regions of the gauge to color between two specified values of the metric. */
20
- ranges: Record<string, [number, number]>;
21
- /** When provided scales the gauge. */
22
- size: number;
23
- /** Custom css */
24
- style: React.CSSProperties;
25
- }> & BoxProps;
26
- /**
27
- * ## RoundGauge
28
- * The RoundGauge component provides a visual representation of a single metric, as well as being capable of showing
29
- * informational or cautionary boundaries related to that metric.
30
- *
31
- * @example
32
- * ```tsx
33
- * <RoundGauge
34
- * size={1.75}
35
- * value={tankPressure}
36
- * minValue={0}
37
- * maxValue={pressureLimit}
38
- * alertAfter={pressureLimit * 0.7}
39
- * ranges={{
40
- * good: [0, pressureLimit * 0.7],
41
- * average: [pressureLimit * 0.7, pressureLimit * 0.85],
42
- * bad: [pressureLimit * 0.85, pressureLimit],
43
- * }}
44
- * format={formatPressure}
45
- * />
46
- * ```
47
- *
48
- * The alert on the gauge is optional, and will only be shown if the `alertAfter` prop is defined. When defined, the alert
49
- * will begin to flash the respective color upon which the needle currently rests, as defined in the `ranges` prop.
50
- *
51
- */
52
- export declare function RoundGauge(props: Props): import("react/jsx-runtime").JSX.Element;
53
- export {};
@@ -1,147 +0,0 @@
1
- import { jsxs as k, jsx as _ } from "react/jsx-runtime";
2
- import { scale as d, keyOfMatchingRange as M, clamp01 as N } from "../common/math.js";
3
- import { classes as u } from "../common/react.js";
4
- import { AnimatedNumber as A } from "./AnimatedNumber.js";
5
- import { Box as B, computeBoxClassName as G, computeBoxProps as j } from "./Box.js";
6
- import '../assets/RoundGauge.css';const F = "_roundGauge_gktag_17", L = "_ringTrack_gktag_25", T = "_ringFill_gktag_33", V = "_needle_gktag_41", O = "_needleLine_gktag_46", R = "_needleMiddle_gktag_47", Z = "_alert_gktag_51", z = "_max_gktag_59", P = "_color__black_gktag_63", S = "_color__white_gktag_67", $ = "_color__red_gktag_71", D = "_color__orange_gktag_75", E = "_color__yellow_gktag_79", I = "_color__olive_gktag_83", q = "_color__green_gktag_87", H = "_color__teal_gktag_91", J = "_color__blue_gktag_95", K = "_color__violet_gktag_99", Q = "_color__purple_gktag_103", U = "_color__pink_gktag_107", W = "_color__brown_gktag_111", X = "_color__grey_gktag_115", Y = "_color__good_gktag_123", __ = "_color__average_gktag_127", e_ = "_color__bad_gktag_131", l_ = "_color__label_gktag_135", o_ = "_alert__black_gktag_139", r_ = "_alertAnim_gktag_1", t_ = "_alert__white_gktag_145", a_ = "_alert__red_gktag_151", c_ = "_alert__orange_gktag_157", g_ = "_alert__yellow_gktag_163", n_ = "_alert__olive_gktag_169", s_ = "_alert__green_gktag_175", i_ = "_alert__teal_gktag_181", k_ = "_alert__blue_gktag_187", d_ = "_alert__violet_gktag_193", u_ = "_alert__purple_gktag_199", m_ = "_alert__pink_gktag_205", p_ = "_alert__brown_gktag_211", b_ = "_alert__grey_gktag_217", y_ = "_alert__good_gktag_229", h_ = "_alert__average_gktag_235", f_ = "_alert__bad_gktag_241", v_ = "_alert__label_gktag_247", e = {
7
- roundGauge: F,
8
- ringTrack: L,
9
- ringFill: T,
10
- needle: V,
11
- needleLine: O,
12
- needleMiddle: R,
13
- alert: Z,
14
- max: z,
15
- color__black: P,
16
- color__white: S,
17
- color__red: $,
18
- color__orange: D,
19
- color__yellow: E,
20
- color__olive: I,
21
- color__green: q,
22
- color__teal: H,
23
- color__blue: J,
24
- color__violet: K,
25
- color__purple: Q,
26
- color__pink: U,
27
- color__brown: W,
28
- color__grey: X,
29
- "color__light-grey": "_color__light-grey_gktag_119",
30
- color__good: Y,
31
- color__average: __,
32
- color__bad: e_,
33
- color__label: l_,
34
- alert__black: o_,
35
- alertAnim: r_,
36
- alert__white: t_,
37
- alert__red: a_,
38
- alert__orange: c_,
39
- alert__yellow: g_,
40
- alert__olive: n_,
41
- alert__green: s_,
42
- alert__teal: i_,
43
- alert__blue: k_,
44
- alert__violet: d_,
45
- alert__purple: u_,
46
- alert__pink: m_,
47
- alert__brown: p_,
48
- alert__grey: b_,
49
- "alert__light-grey": "_alert__light-grey_gktag_223",
50
- alert__good: y_,
51
- alert__average: h_,
52
- alert__bad: f_,
53
- alert__label: v_
54
- };
55
- function A_(y) {
56
- const {
57
- alertAfter: o,
58
- alertBefore: r,
59
- className: h,
60
- format: f,
61
- maxValue: n = 1,
62
- minValue: s = 1,
63
- ranges: a,
64
- size: v = 1,
65
- style: w,
66
- value: l,
67
- ...m
68
- } = y, C = d(l, s, n), p = N(C), c = a ? {} : { primary: [0, 1] };
69
- a && Object.keys(a).forEach((t) => {
70
- const g = a[t];
71
- c[t] = [
72
- d(g[0], s, n),
73
- d(g[1], s, n)
74
- ];
75
- });
76
- function x() {
77
- return o && r && l > o && l < r || o && l > o ? !0 : !!(r && l < r);
78
- }
79
- const b = x() && M(p, c);
80
- return /* @__PURE__ */ k(B, { inline: !0, children: [
81
- /* @__PURE__ */ _(
82
- "div",
83
- {
84
- className: u([
85
- e.roundGauge,
86
- h,
87
- G(m)
88
- ]),
89
- ...j({
90
- style: {
91
- fontSize: v + "em",
92
- ...w
93
- },
94
- ...m
95
- }),
96
- children: /* @__PURE__ */ k("svg", { viewBox: "0 0 100 50", children: [
97
- (o || r) && /* @__PURE__ */ _(
98
- "g",
99
- {
100
- className: u([
101
- e.alert,
102
- b ? e["alert__" + b] : ""
103
- ]),
104
- children: /* @__PURE__ */ _("path", { d: "M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z" })
105
- }
106
- ),
107
- /* @__PURE__ */ _("g", { children: /* @__PURE__ */ _("circle", { className: e.ringTrack, cx: "50", cy: "50", r: "45" }) }),
108
- /* @__PURE__ */ _("g", { children: Object.keys(c).map((t, g) => {
109
- const i = c[t];
110
- return /* @__PURE__ */ _(
111
- "circle",
112
- {
113
- className: u([e.ringFill, e["color__" + t]]),
114
- style: {
115
- strokeDashoffset: Math.max(
116
- (2 - (i[1] - i[0])) * Math.PI * 50,
117
- 0
118
- )
119
- },
120
- transform: `rotate(${180 + 180 * i[0]} 50 50)`,
121
- cx: "50",
122
- cy: "50",
123
- r: "45"
124
- },
125
- g
126
- );
127
- }) }),
128
- /* @__PURE__ */ k(
129
- "g",
130
- {
131
- className: e.needle,
132
- transform: `rotate(${p * 180 - 90} 50 50)`,
133
- children: [
134
- /* @__PURE__ */ _("polygon", { className: e.needleLine, points: "46,50 50,0 54,50" }),
135
- /* @__PURE__ */ _("circle", { className: e.needleMiddle, cx: "50", cy: "50", r: "8" })
136
- ]
137
- }
138
- )
139
- ] })
140
- }
141
- ),
142
- /* @__PURE__ */ _(A, { value: l, format: f })
143
- ] });
144
- }
145
- export {
146
- A_ as RoundGauge
147
- };
@@ -1,63 +0,0 @@
1
- import { ReactNode } from 'react';
2
-
3
- /**
4
- * ## Section
5
- * Section is a surface that displays content and actions on a single topic.
6
- *
7
- * They should be easy to scan for relevant and actionable information.
8
- * Elements, like text and images, should be placed in them in a way that
9
- * clearly indicates hierarchy.
10
- *
11
- * Sections can now be nested, and will automatically font size of the
12
- * header according to their nesting level. Previously this was done via `level`
13
- * prop, but now it is automatically calculated.
14
- *
15
- * Section can also be titled to clearly define its purpose.
16
- *
17
- * ```tsx
18
- * <Section title="Cargo">Here you can order supply crates.</Section>
19
- * ```
20
- *
21
- * If you want to have a button on the right side of an section title
22
- * (for example, to perform some sort of action), there is a way to do that:
23
- *
24
- * ```tsx
25
- * <Section title="Cargo" buttons={<Button>Send shuttle</Button>}>
26
- * Here you can order supply crates.
27
- * </Section>
28
- * ```
29
- */
30
- export declare const Section: import('react').ForwardRefExoticComponent<Partial<{
31
- /** Buttons to render aside the section title. */
32
- buttons: ReactNode;
33
- /** id to assosiate with the parent div element used by this section, for uses with procs like getElementByID */
34
- container_id: string;
35
- /** If true, fills all available vertical space. */
36
- fill: boolean;
37
- /** If true, removes all section padding. */
38
- fitted: boolean;
39
- /** @member Callback function for the `scroll` event */
40
- onScroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
41
- /** Shows or hides the scrollbar. */
42
- scrollable: boolean;
43
- /** Shows or hides the horizontal scrollbar. */
44
- scrollableHorizontal: boolean;
45
- /** Title of the section. */
46
- title: ReactNode;
47
- }> & Partial<{
48
- as: string;
49
- children: ReactNode;
50
- className: string | import('../common/react').BooleanLike;
51
- style: import('react').CSSProperties;
52
- }> & Partial<Record<"bold" | "italic" | "nowrap" | "fillPositionedParent" | "inline" | "preserveWhitespace", boolean>> & Partial<Record<"fontWeight" | "textAlign" | "bottom" | "fontFamily" | "fontSize" | "height" | "left" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "overflow" | "overflowX" | "overflowY" | "position" | "right" | "top" | "verticalAlign" | "width" | "color" | "backgroundColor" | "align" | "lineHeight" | "m" | "mb" | "ml" | "mr" | "mt" | "mx" | "my" | "p" | "pb" | "pl" | "pr" | "pt" | "px" | "py" | "textColor", string | import('../common/react').BooleanLike>> & Partial<{
53
- onClick: import('react').MouseEventHandler<HTMLDivElement>;
54
- onContextMenu: import('react').MouseEventHandler<HTMLDivElement>;
55
- onDoubleClick: import('react').MouseEventHandler<HTMLDivElement>;
56
- onKeyDown: import('react').KeyboardEventHandler<HTMLDivElement>;
57
- onKeyUp: import('react').KeyboardEventHandler<HTMLDivElement>;
58
- onMouseDown: import('react').MouseEventHandler<HTMLDivElement>;
59
- onMouseMove: import('react').MouseEventHandler<HTMLDivElement>;
60
- onMouseOver: import('react').MouseEventHandler<HTMLDivElement>;
61
- onMouseUp: import('react').MouseEventHandler<HTMLDivElement>;
62
- onScroll: import('react').UIEventHandler<HTMLDivElement>;
63
- }> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,62 +0,0 @@
1
- import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as S, useEffect as j } from "react";
3
- import { addScrollableNode as z, removeScrollableNode as B } from "../common/events.js";
4
- import { classes as H, canRender as m } from "../common/react.js";
5
- import { s as t } from "../Section.module-CLVHJ4yA.js";
6
- import { computeBoxClassName as T, computeBoxProps as y } from "./Box.js";
7
- const q = S(
8
- (a, l) => {
9
- const {
10
- buttons: c,
11
- children: u,
12
- className: p,
13
- fill: N,
14
- fitted: b,
15
- onScroll: h,
16
- scrollable: i,
17
- scrollableHorizontal: e,
18
- title: n,
19
- container_id: v,
20
- ...o
21
- } = a, x = m(n) || m(c);
22
- return j(() => {
23
- if (l != null && l.current && !(!i && !e))
24
- return z(l.current), () => {
25
- l != null && l.current && B(l.current);
26
- };
27
- }, []), /* @__PURE__ */ r(
28
- "div",
29
- {
30
- id: v || "",
31
- className: H([
32
- t.section,
33
- N && t.fill,
34
- b && t.fitted,
35
- i && t.scrollable,
36
- e && t.scrollableHorizontal,
37
- p,
38
- T(o)
39
- ]),
40
- ...y(o),
41
- children: [
42
- x && /* @__PURE__ */ r("div", { className: t.title, children: [
43
- /* @__PURE__ */ s("span", { className: t.titleText, children: n }),
44
- /* @__PURE__ */ s("div", { className: t.buttons, children: c })
45
- ] }),
46
- /* @__PURE__ */ s("div", { className: t.rest, children: /* @__PURE__ */ s(
47
- "div",
48
- {
49
- className: t.content,
50
- onScroll: h,
51
- ref: l,
52
- children: u
53
- }
54
- ) })
55
- ]
56
- }
57
- );
58
- }
59
- );
60
- export {
61
- q as Section
62
- };
@@ -1,46 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { BoxProps } from './Box';
3
-
4
- type Props = {
5
- /** Highest possible value. */
6
- maxValue: number;
7
- /** Lowest possible value. */
8
- minValue: number;
9
- /** Value itself, controls the position of the cursor. */
10
- value: number;
11
- } & Partial<{
12
- /** Animates the value if it was changed externally. */
13
- animated: boolean;
14
- /** Custom css */
15
- className: string;
16
- /** Color of the slider. */
17
- color: string;
18
- /** If set, this value will be used to set the fill percentage of the progress bar filler independently of the main value. */
19
- fillValue: number;
20
- /** Format value using this function before displaying it. */
21
- format: (value: number) => string;
22
- /** Adjust value by this amount when dragging the input. */
23
- onChange: (event: Event, value: number) => void;
24
- /** An event, which fires when you release the input, or successfully enter a number. */
25
- onDrag: (event: Event, value: number) => void;
26
- /** Applies a `color` to the slider based on whether the value lands in the range between `from` and `to`. */
27
- ranges: Record<string, [number, number]>;
28
- /** Screen distance mouse needs to travel to adjust value by one `step`. */
29
- step: number;
30
- /** A number in milliseconds, for which the input will hold off from updating while events propagate through the backend. Default is about 250ms, increase it if you still see flickering. */
31
- stepPixelSize: number;
32
- /** Adjust value by this amount when dragging the input. */
33
- suppressFlicker: boolean;
34
- /** Unit to display to the right of value. */
35
- unit: string;
36
- }> & BoxProps & PropsWithChildren;
37
- /**
38
- * ## Slider
39
- * A horizontal, progressbar-like control which allows dialing
40
- * in precise values by dragging it left and right.
41
- *
42
- * Single click opens an input box to manually type in a number.
43
- *
44
- */
45
- export declare function Slider(props: Props): import("react/jsx-runtime").JSX.Element;
46
- export {};
@@ -1,124 +0,0 @@
1
- import { jsx as s, jsxs as m } from "react/jsx-runtime";
2
- import { keyOfMatchingRange as R, clamp01 as t, scale as f } from "../common/math.js";
3
- import { classes as _ } from "../common/react.js";
4
- import { s as e } from "../ProgressBar.module-BkAFfFy0.js";
5
- import { computeBoxClassName as $, computeBoxProps as q } from "./Box.js";
6
- import { DraggableControl as A } from "./DraggableControl.js";
7
- import '../assets/Slider.css';const G = "_slider_1assx_9", H = "_cursorOffset_1assx_13", I = "_cursor_1assx_13", J = "_pointer_1assx_30", K = "_popupValue_1assx_41", a = {
8
- slider: G,
9
- cursorOffset: H,
10
- cursor: I,
11
- pointer: J,
12
- popupValue: K
13
- };
14
- function Y(h) {
15
- const {
16
- // Draggable props (passthrough)
17
- animated: v,
18
- format: g,
19
- maxValue: o,
20
- minValue: r,
21
- onChange: x,
22
- onDrag: V,
23
- step: y,
24
- stepPixelSize: N,
25
- suppressFlicker: C,
26
- unit: D,
27
- value: O,
28
- // Own props
29
- className: w,
30
- fillValue: l,
31
- color: M,
32
- ranges: B = {},
33
- children: i,
34
- ...c
35
- } = h, F = i !== void 0;
36
- return /* @__PURE__ */ s(
37
- A,
38
- {
39
- dragMatrix: [1, 0],
40
- animated: v,
41
- format: g,
42
- maxValue: o,
43
- minValue: r,
44
- onChange: x,
45
- onDrag: V,
46
- step: y,
47
- stepPixelSize: N,
48
- suppressFlicker: C,
49
- unit: D,
50
- value: O,
51
- children: (S) => {
52
- const {
53
- displayElement: n,
54
- displayValue: p,
55
- dragging: j,
56
- handleDragStart: k,
57
- inputElement: E,
58
- value: P
59
- } = S, b = l != null, u = f(
60
- l ?? p,
61
- r,
62
- o
63
- ), d = f(p, r, o), z = M || R(l ?? P, B) || "default";
64
- return /* @__PURE__ */ m(
65
- "div",
66
- {
67
- className: _([
68
- a.slider,
69
- e.progressBar,
70
- e["color__" + z],
71
- w,
72
- $(c)
73
- ]),
74
- ...q(c),
75
- onMouseDown: k,
76
- children: [
77
- /* @__PURE__ */ s(
78
- "div",
79
- {
80
- className: _([
81
- e.fill,
82
- b && e.fill__animated
83
- ]),
84
- style: {
85
- width: t(u) * 100 + "%",
86
- opacity: 0.4
87
- }
88
- }
89
- ),
90
- /* @__PURE__ */ s(
91
- "div",
92
- {
93
- className: e.fill,
94
- style: {
95
- width: t(Math.min(u, d)) * 100 + "%"
96
- }
97
- }
98
- ),
99
- /* @__PURE__ */ m(
100
- "div",
101
- {
102
- className: a.cursorOffset,
103
- style: {
104
- width: t(d) * 100 + "%"
105
- },
106
- children: [
107
- /* @__PURE__ */ s("div", { className: a.cursor }),
108
- /* @__PURE__ */ s("div", { className: a.pointer }),
109
- j && /* @__PURE__ */ s("div", { className: a.popupValue, children: n })
110
- ]
111
- }
112
- ),
113
- /* @__PURE__ */ s("div", { className: e.content, children: F ? i : n }),
114
- E
115
- ]
116
- }
117
- );
118
- }
119
- }
120
- );
121
- }
122
- export {
123
- Y as Slider
124
- };
@@ -1,27 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { FlexItemProps, FlexProps } from './Flex';
3
-
4
- type Props = Partial<{
5
- /** Fills available space. */
6
- fill: boolean;
7
- /** Reverses the stack. */
8
- reverse: boolean;
9
- /** Flex column */
10
- vertical: boolean;
11
- /** Adds zebra striping to the stack. */
12
- zebra: boolean;
13
- }> & FlexProps;
14
- export declare function Stack(props: Props): import("react/jsx-runtime").JSX.Element;
15
- export declare namespace Stack {
16
- var Item: typeof StackItem;
17
- var Divider: typeof StackDivider;
18
- }
19
- type StackItemProps = FlexItemProps & Partial<{
20
- innerRef: RefObject<HTMLDivElement>;
21
- }>;
22
- declare function StackItem(props: StackItemProps): import("react/jsx-runtime").JSX.Element;
23
- type StackDividerProps = FlexItemProps & Partial<{
24
- hidden: boolean;
25
- }>;
26
- declare function StackDivider(props: StackDividerProps): import("react/jsx-runtime").JSX.Element;
27
- export {};