tgui-core 2.0.5 → 2.1.0

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 (121) hide show
  1. package/dist/common/collections.d.ts +1 -1
  2. package/dist/common/collections.js +1 -10
  3. package/dist/common/color.js +1 -70
  4. package/dist/common/constants.js +1 -329
  5. package/dist/common/events.js +1 -147
  6. package/dist/common/exhaustive.js +1 -6
  7. package/dist/common/format.js +1 -117
  8. package/dist/common/fp.js +1 -9
  9. package/dist/common/hotkeys.d.ts +1 -1
  10. package/dist/common/hotkeys.js +1 -112
  11. package/dist/common/http.js +1 -10
  12. package/dist/common/keycodes.js +1 -88
  13. package/dist/common/keys.js +1 -32
  14. package/dist/common/math.js +1 -45
  15. package/dist/common/random.js +1 -21
  16. package/dist/common/react.js +1 -30
  17. package/dist/common/string.js +1 -88
  18. package/dist/common/timer.js +1 -28
  19. package/dist/common/type-utils.js +1 -25
  20. package/dist/common/ui.d.ts +2 -2
  21. package/dist/common/ui.js +1 -141
  22. package/dist/common/uuid.js +1 -10
  23. package/dist/common/vector.js +1 -48
  24. package/dist/components/AnimatedNumber.d.ts +1 -1
  25. package/dist/components/AnimatedNumber.js +1 -73
  26. package/dist/components/Autofocus.d.ts +1 -1
  27. package/dist/components/Autofocus.js +1 -17
  28. package/dist/components/Blink.d.ts +1 -1
  29. package/dist/components/Blink.js +1 -56
  30. package/dist/components/BlockQuote.d.ts +1 -1
  31. package/dist/components/BlockQuote.js +1 -10
  32. package/dist/components/Box.d.ts +5 -5
  33. package/dist/components/Box.js +1 -19
  34. package/dist/components/Button.d.ts +4 -4
  35. package/dist/components/Button.js +1 -258
  36. package/dist/components/ByondUi.d.ts +1 -1
  37. package/dist/components/ByondUi.js +1 -61
  38. package/dist/components/Chart.d.ts +1 -1
  39. package/dist/components/Chart.js +1 -80
  40. package/dist/components/Collapsible.d.ts +2 -2
  41. package/dist/components/Collapsible.js +1 -36
  42. package/dist/components/ColorBox.d.ts +2 -2
  43. package/dist/components/ColorBox.js +1 -17
  44. package/dist/components/Dialog.d.ts +1 -1
  45. package/dist/components/Dialog.js +1 -42
  46. package/dist/components/Dimmer.d.ts +1 -1
  47. package/dist/components/Dimmer.js +1 -10
  48. package/dist/components/Divider.js +1 -18
  49. package/dist/components/DmIcon.d.ts +3 -3
  50. package/dist/components/DmIcon.js +1 -23
  51. package/dist/components/DraggableControl.d.ts +2 -2
  52. package/dist/components/DraggableControl.js +1 -111
  53. package/dist/components/Dropdown.d.ts +2 -2
  54. package/dist/components/Dropdown.js +1 -165
  55. package/dist/components/FitText.d.ts +2 -2
  56. package/dist/components/FitText.js +1 -63
  57. package/dist/components/Flex.d.ts +1 -1
  58. package/dist/components/Flex.js +1 -70
  59. package/dist/components/Floating.d.ts +3 -3
  60. package/dist/components/Floating.js +1 -2235
  61. package/dist/components/Icon.d.ts +2 -2
  62. package/dist/components/Icon.js +1 -45
  63. package/dist/components/Image.d.ts +1 -1
  64. package/dist/components/Image.js +1 -38
  65. package/dist/components/ImageButton.d.ts +10 -5
  66. package/dist/components/ImageButton.js +1 -154
  67. package/dist/components/InfinitePlane.d.ts +2 -2
  68. package/dist/components/InfinitePlane.js +1 -133
  69. package/dist/components/Input.d.ts +2 -2
  70. package/dist/components/Input.js +1 -96
  71. package/dist/components/KeyListener.d.ts +1 -1
  72. package/dist/components/KeyListener.js +1 -15
  73. package/dist/components/Knob.d.ts +2 -2
  74. package/dist/components/Knob.js +1 -133
  75. package/dist/components/LabeledControls.d.ts +1 -1
  76. package/dist/components/LabeledControls.js +1 -39
  77. package/dist/components/LabeledList.d.ts +2 -2
  78. package/dist/components/LabeledList.js +1 -89
  79. package/dist/components/MenuBar.d.ts +32 -0
  80. package/dist/components/MenuBar.js +1 -133
  81. package/dist/components/Modal.d.ts +2 -2
  82. package/dist/components/Modal.js +1 -22
  83. package/dist/components/NoticeBox.d.ts +1 -1
  84. package/dist/components/NoticeBox.js +1 -23
  85. package/dist/components/NumberInput.d.ts +9 -19
  86. package/dist/components/NumberInput.js +1 -213
  87. package/dist/components/Popper.d.ts +8 -9
  88. package/dist/components/Popper.js +1 -1082
  89. package/dist/components/ProgressBar.d.ts +2 -2
  90. package/dist/components/ProgressBar.js +1 -33
  91. package/dist/components/RestrictedInput.d.ts +29 -0
  92. package/dist/components/RestrictedInput.js +1 -161
  93. package/dist/components/RoundGauge.d.ts +2 -2
  94. package/dist/components/RoundGauge.js +1 -114
  95. package/dist/components/Section.d.ts +30 -44
  96. package/dist/components/Section.js +1 -66
  97. package/dist/components/Slider.d.ts +2 -2
  98. package/dist/components/Slider.js +1 -113
  99. package/dist/components/Stack.d.ts +2 -2
  100. package/dist/components/Stack.js +1 -58
  101. package/dist/components/StyleableSection.d.ts +1 -1
  102. package/dist/components/StyleableSection.js +1 -16
  103. package/dist/components/Table.d.ts +1 -1
  104. package/dist/components/Table.js +1 -57
  105. package/dist/components/Tabs.d.ts +2 -2
  106. package/dist/components/Tabs.js +1 -65
  107. package/dist/components/TextArea.d.ts +14 -28
  108. package/dist/components/TextArea.js +1 -139
  109. package/dist/components/TimeDisplay.js +1 -25
  110. package/dist/components/Tooltip.d.ts +2 -2
  111. package/dist/components/Tooltip.js +1 -18
  112. package/dist/components/TrackOutsideClicks.d.ts +2 -2
  113. package/dist/components/TrackOutsideClicks.js +1 -24
  114. package/dist/components/VirtualList.d.ts +1 -1
  115. package/dist/components/VirtualList.js +1 -34
  116. package/dist/components/index.js +1 -96
  117. package/license.txt +1 -1
  118. package/package.json +11 -17
  119. package/styles/components/Button.scss +1 -1
  120. package/styles/components/TextArea.scss +7 -0
  121. package/dist/components/FakeTerminal.js +0 -38
@@ -1,58 +1 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useRef as S } from "react";
3
- import { classes as s } from "../common/react.js";
4
- import { computeBoxClassName as o } from "../common/ui.js";
5
- import { computeFlexProps as k, computeFlexClassName as v, computeFlexItemProps as m } from "./Flex.js";
6
- function l(r) {
7
- const { className: c, vertical: e, fill: t, reverse: a, zebra: n, ...d } = r, u = e ? "column" : "row", f = a ? "-reverse" : "";
8
- return /* @__PURE__ */ i(
9
- "div",
10
- {
11
- className: s([
12
- "Stack",
13
- t && "Stack--fill",
14
- e ? "Stack--vertical" : "Stack--horizontal",
15
- n && "Stack--zebra",
16
- a && `Stack--reverse${e ? "--vertical" : ""}`,
17
- c,
18
- v(r)
19
- ]),
20
- ...k({
21
- direction: `${u}${f}`,
22
- ...d
23
- })
24
- }
25
- );
26
- }
27
- function p(r) {
28
- const { className: c, innerRef: e, ...t } = r, a = S((e == null ? void 0 : e.current) ?? null);
29
- return /* @__PURE__ */ i(
30
- "div",
31
- {
32
- className: s(["Stack__item", c, o(t)]),
33
- ref: a,
34
- ...m(t)
35
- }
36
- );
37
- }
38
- l.Item = p;
39
- function x(r) {
40
- const { className: c, hidden: e, ...t } = r;
41
- return /* @__PURE__ */ i(
42
- "div",
43
- {
44
- className: s([
45
- "Stack__item",
46
- "Stack__divider",
47
- e && "Stack__divider--hidden",
48
- c,
49
- o(t)
50
- ]),
51
- ...m(t)
52
- }
53
- );
54
- }
55
- l.Divider = x;
56
- export {
57
- l as Stack
58
- };
1
+ import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"../common/react.js";import*as s from"../common/ui.js";import*as a from"./Flex.js";function c(t){let{className:s,vertical:c,fill:o,reverse:m,zebra:i,...l}=t,n=m?"-reverse":"";return(0,e.jsx)("div",{className:(0,r.classes)(["Stack",o&&"Stack--fill",c?"Stack--vertical":"Stack--horizontal",i&&"Stack--zebra",m&&`Stack--reverse${c?"--vertical":""}`,s,(0,a.computeFlexClassName)(t)]),...(0,a.computeFlexProps)({direction:`${c?"column":"row"}${n}`,...l})})}c.Item=function(c){let{className:o,innerRef:m,...i}=c,l=(0,t.useRef)(m?.current??null);return(0,e.jsx)("div",{className:(0,r.classes)(["Stack__item",o,(0,s.computeBoxClassName)(i)]),ref:l,...(0,a.computeFlexItemProps)(i)})},c.Divider=function(t){let{className:c,hidden:o,...m}=t;return(0,e.jsx)("div",{className:(0,r.classes)(["Stack__item","Stack__divider",o&&"Stack__divider--hidden",c,(0,s.computeBoxClassName)(m)]),...(0,a.computeFlexItemProps)(m)})};export{c as Stack};
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
1
+ import type { PropsWithChildren, ReactNode } from 'react';
2
2
  type Props = Partial<{
3
3
  style: Record<string, any>;
4
4
  textStyle: Record<string, any>;
@@ -1,16 +1 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import { Box as t } from "./Box.js";
3
- function m(i) {
4
- const { children: c, titleStyle: n, titleSubtext: s, title: o, textStyle: r, style: a } = i;
5
- return /* @__PURE__ */ l(t, { style: a, children: [
6
- /* @__PURE__ */ l(t, { className: "Section__title", style: n, children: [
7
- /* @__PURE__ */ e(t, { className: "Section__titleText", style: r, children: o }),
8
- /* @__PURE__ */ e("div", { className: "Section__buttons", children: s }),
9
- " "
10
- ] }),
11
- /* @__PURE__ */ e(t, { className: "Section__rest", children: /* @__PURE__ */ e(t, { className: "Section__content", children: c }) })
12
- ] });
13
- }
14
- export {
15
- m as StyleableSection
16
- };
1
+ import*as e from"react/jsx-runtime";import*as t from"./Box.js";function s(s){let{children:c,titleStyle:o,titleSubtext:i,title:l,textStyle:n,style:r}=s;return(0,e.jsxs)(t.Box,{style:r,children:[(0,e.jsxs)(t.Box,{className:"Section__title",style:o,children:[(0,e.jsx)(t.Box,{className:"Section__titleText",style:n,children:l}),(0,e.jsx)("div",{className:"Section__buttons",children:i})," "]}),(0,e.jsx)(t.Box,{className:"Section__rest",children:(0,e.jsx)(t.Box,{className:"Section__content",children:c})})]})}export{s as StyleableSection};
@@ -1,4 +1,4 @@
1
- import { BoxProps } from './Box';
1
+ import type { BoxProps } from './Box';
2
2
  type Props = Partial<{
3
3
  /** Collapses table to the smallest possible size. */
4
4
  collapsing: boolean;
@@ -1,57 +1 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { classes as r } from "../common/react.js";
3
- import { computeBoxProps as t, computeBoxClassName as n } from "../common/ui.js";
4
- function m(e) {
5
- const { className: l, collapsing: a, children: s, ...o } = e;
6
- return /* @__PURE__ */ c(
7
- "table",
8
- {
9
- className: r([
10
- "Table",
11
- a && "Table--collapsing",
12
- l,
13
- n(o)
14
- ]),
15
- ...t(o),
16
- children: /* @__PURE__ */ c("tbody", { children: s })
17
- }
18
- );
19
- }
20
- function b(e) {
21
- const { className: l, header: a, ...s } = e;
22
- return /* @__PURE__ */ c(
23
- "tr",
24
- {
25
- className: r([
26
- "Table__row",
27
- a && "Table__row--header",
28
- l,
29
- n(e)
30
- ]),
31
- ...t(s)
32
- }
33
- );
34
- }
35
- function _(e) {
36
- const { className: l, collapsing: a, colSpan: s, header: o, ...i } = e;
37
- return /* @__PURE__ */ c(
38
- "td",
39
- {
40
- className: r([
41
- "Table__cell",
42
- a && "Table__cell--collapsing",
43
- o && "Table__cell--header",
44
- l,
45
- n(e)
46
- ]),
47
- colSpan: s,
48
- ...t(i)
49
- }
50
- );
51
- }
52
- ((e) => {
53
- e.Cell = _, e.Row = b;
54
- })(m || (m = {}));
55
- export {
56
- m as Table
57
- };
1
+ var e;import*as a from"react/jsx-runtime";import*as l from"../common/react.js";import*as s from"../common/ui.js";function o(e){let{className:o,collapsing:c,children:r,...t}=e;return(0,a.jsx)("table",{className:(0,l.classes)(["Table",c&&"Table--collapsing",o,(0,s.computeBoxClassName)(t)]),...(0,s.computeBoxProps)(t),children:(0,a.jsx)("tbody",{children:r})})}(e=o||(o={})).Cell=function(e){let{className:o,collapsing:c,colSpan:r,header:t,...m}=e;return(0,a.jsx)("td",{className:(0,l.classes)(["Table__cell",c&&"Table__cell--collapsing",t&&"Table__cell--header",o,(0,s.computeBoxClassName)(e)]),colSpan:r,...(0,s.computeBoxProps)(m)})},e.Row=function(e){let{className:o,header:c,...r}=e;return(0,a.jsx)("tr",{className:(0,l.classes)(["Table__row",c&&"Table__row--header",o,(0,s.computeBoxClassName)(e)]),...(0,s.computeBoxProps)(r)})};export{o as Table};
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- import { BoxProps } from './Box';
1
+ import type { ReactNode } from 'react';
2
+ import type { BoxProps } from './Box';
3
3
  type Props = Partial<{
4
4
  /**
5
5
  * Similarly to `fill` on
@@ -1,65 +1 @@
1
- import { jsxs as N, jsx as a } from "react/jsx-runtime";
2
- import { canRender as d, classes as f } from "../common/react.js";
3
- import { computeBoxProps as h, computeBoxClassName as p } from "../common/ui.js";
4
- import { Icon as v } from "./Icon.js";
5
- function T(e) {
6
- const { className: i, vertical: c, fill: o, fluid: s, children: r, ...l } = e;
7
- return /* @__PURE__ */ a(
8
- "div",
9
- {
10
- className: f([
11
- "Tabs",
12
- c ? "Tabs--vertical" : "Tabs--horizontal",
13
- o && "Tabs--fill",
14
- s && "Tabs--fluid",
15
- i,
16
- p(l)
17
- ]),
18
- ...h(l),
19
- children: r
20
- }
21
- );
22
- }
23
- function x(e) {
24
- const {
25
- className: i,
26
- selected: c,
27
- color: o,
28
- icon: s,
29
- iconSpin: r,
30
- leftSlot: l,
31
- rightSlot: t,
32
- children: u,
33
- onClick: n,
34
- ...m
35
- } = e;
36
- function _(b) {
37
- n && (n(b), b.target.blur());
38
- }
39
- return /* @__PURE__ */ N(
40
- "div",
41
- {
42
- className: f([
43
- "Tab",
44
- "Tabs__Tab",
45
- `Tab--color--${o}`,
46
- c && "Tab--selected",
47
- i,
48
- p(m)
49
- ]),
50
- onClick: _,
51
- ...h(m),
52
- children: [
53
- d(l) && /* @__PURE__ */ a("div", { className: "Tab__left", children: l }) || !!s && /* @__PURE__ */ a("div", { className: "Tab__left", children: /* @__PURE__ */ a(v, { name: s, spin: r }) }),
54
- /* @__PURE__ */ a("div", { className: "Tab__text", children: u }),
55
- d(t) && /* @__PURE__ */ a("div", { className: "Tab__right", children: t })
56
- ]
57
- }
58
- );
59
- }
60
- ((e) => {
61
- e.Tab = x;
62
- })(T || (T = {}));
63
- export {
64
- T as Tabs
65
- };
1
+ import*as s from"react/jsx-runtime";import*as a from"../common/react.js";import*as e from"../common/ui.js";import*as c from"./Icon.js";function o(c){let{className:o,vertical:r,fill:l,fluid:t,children:i,...n}=c;return(0,s.jsx)("div",{className:(0,a.classes)(["Tabs",r?"Tabs--vertical":"Tabs--horizontal",l&&"Tabs--fill",t&&"Tabs--fluid",o,(0,e.computeBoxClassName)(n)]),...(0,e.computeBoxProps)(n),children:i})}(o||(o={})).Tab=function(o){let{className:r,selected:l,color:t,icon:i,iconSpin:n,leftSlot:m,rightSlot:b,children:T,onClick:d,...x}=o;return(0,s.jsxs)("div",{className:(0,a.classes)(["Tab","Tabs__Tab",`Tab--color--${t}`,l&&"Tab--selected",r,(0,e.computeBoxClassName)(x)]),onClick:function(s){d&&(d(s),s.target.blur())},...(0,e.computeBoxProps)(x),children:[(0,a.canRender)(m)&&(0,s.jsx)("div",{className:"Tab__left",children:m})||!!i&&(0,s.jsx)("div",{className:"Tab__left",children:(0,s.jsx)(c.Icon,{name:i,spin:n})}),(0,s.jsx)("div",{className:"Tab__text",children:T}),(0,a.canRender)(b)&&(0,s.jsx)("div",{className:"Tab__right",children:b})]})};export{o as Tabs};
@@ -1,11 +1,6 @@
1
- import { SyntheticEvent } from 'react';
2
- /**
3
- * ## Textarea
4
- *
5
- * An input for larger amounts of text. Use this when you want inputs larger
6
- * than one row.
7
- */
8
- export declare const TextArea: import('react').ForwardRefExoticComponent<Partial<{
1
+ import type { RefObject, SyntheticEvent } from 'react';
2
+ import { type BoxProps } from './Box';
3
+ type Props = Partial<{
9
4
  /** Automatically focus the textarea on mount */
10
5
  autoFocus: boolean;
11
6
  /** Selects all text on mount */
@@ -30,6 +25,8 @@ export declare const TextArea: import('react').ForwardRefExoticComponent<Partial
30
25
  onInput: (event: SyntheticEvent<HTMLTextAreaElement>, value: string) => void;
31
26
  /** Dummy text inside the textarea when it's empty */
32
27
  placeholder: string;
28
+ /** Ref to the textarea element. */
29
+ ref: RefObject<HTMLTextAreaElement | null>;
33
30
  /** Whether the textarea is scrollable when it has more content than height */
34
31
  scrollbar: boolean;
35
32
  /** Clears the textarea when the enter key is pressed */
@@ -38,23 +35,12 @@ export declare const TextArea: import('react').ForwardRefExoticComponent<Partial
38
35
  userMarkup: Record<string, string>;
39
36
  /** The value of the textarea */
40
37
  value: string;
41
- }> & Partial<{
42
- as: string;
43
- children: import('react').ReactNode;
44
- className: string | import('../common/react').BooleanLike;
45
- id: string;
46
- style: import('react').CSSProperties;
47
- tw: string;
48
- } & import('../common/ui').BooleanStyleMap & import('../common/ui').StringStyleMap & {
49
- onClick: import('react').MouseEventHandler<HTMLDivElement>;
50
- onContextMenu: import('react').MouseEventHandler<HTMLDivElement>;
51
- onDoubleClick: import('react').MouseEventHandler<HTMLDivElement>;
52
- onKeyDown: import('react').KeyboardEventHandler<HTMLDivElement>;
53
- onKeyUp: import('react').KeyboardEventHandler<HTMLDivElement>;
54
- onMouseDown: import('react').MouseEventHandler<HTMLDivElement>;
55
- onMouseLeave: import('react').MouseEventHandler<HTMLDivElement>;
56
- onMouseMove: import('react').MouseEventHandler<HTMLDivElement>;
57
- onMouseOver: import('react').MouseEventHandler<HTMLDivElement>;
58
- onMouseUp: import('react').MouseEventHandler<HTMLDivElement>;
59
- onScroll: import('react').UIEventHandler<HTMLDivElement>;
60
- }> & import('react').RefAttributes<HTMLTextAreaElement>>;
38
+ }> & BoxProps;
39
+ /**
40
+ * ## Textarea
41
+ *
42
+ * An input for larger amounts of text. Use this when you want inputs larger
43
+ * than one row.
44
+ */
45
+ export declare function TextArea(props: Props): import("react/jsx-runtime").JSX.Element;
46
+ export {};
@@ -1,139 +1 @@
1
- import { jsxs as F, jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as I, useRef as M, useState as Y, useImperativeHandle as H, useEffect as y } from "react";
3
- import { KEY as A, isEscape as L } from "../common/keys.js";
4
- import { classes as x } from "../common/react.js";
5
- import { Box as U } from "./Box.js";
6
- import { toInputValue as _ } from "./Input.js";
7
- function q(u, o, l, t) {
8
- return `${u.substring(0, l)}${o}${u.substring(l, t)}${o}${u.substring(t)}`;
9
- }
10
- const X = I(
11
- (u, o) => {
12
- const {
13
- autoFocus: l,
14
- autoSelect: t,
15
- displayedValue: s,
16
- dontUseTabForIndent: k,
17
- maxLength: w,
18
- noborder: S,
19
- onChange: i,
20
- onEnter: f,
21
- onEscape: g,
22
- onInput: d,
23
- placeholder: $,
24
- scrollbar: E,
25
- selfClear: b,
26
- userMarkup: m,
27
- value: T,
28
- ...K
29
- } = u, { className: D, fluid: N, nowrap: C, ...R } = K, a = M(null), [V, j] = Y(0);
30
- function B(r) {
31
- if (r.key === A.Enter) {
32
- if (r.shiftKey) {
33
- r.currentTarget.focus();
34
- return;
35
- }
36
- f == null || f(r, r.currentTarget.value), b && (r.currentTarget.value = ""), r.currentTarget.blur();
37
- return;
38
- }
39
- if (L(r.key)) {
40
- g == null || g(r), b ? r.currentTarget.value = "" : (r.currentTarget.value = _(T), r.currentTarget.blur());
41
- return;
42
- }
43
- if (!k && r.key === A.Tab) {
44
- r.preventDefault();
45
- const { value: e, selectionStart: c, selectionEnd: n } = r.currentTarget;
46
- r.currentTarget.value = `${e.substring(0, c)} ${e.substring(n)}`, r.currentTarget.selectionEnd = c + 1;
47
- }
48
- if (m && (r.ctrlKey || r.metaKey) && m[r.key]) {
49
- r.preventDefault();
50
- const { value: e, selectionStart: c, selectionEnd: n } = r.currentTarget, h = m[r.key];
51
- r.currentTarget.value = q(
52
- e,
53
- h,
54
- c,
55
- n
56
- ), r.currentTarget.selectionEnd = n + h.length * 2;
57
- }
58
- }
59
- return H(
60
- o,
61
- () => a.current
62
- ), y(() => {
63
- if (!l && !t) return;
64
- const r = a.current;
65
- r && (l || t) && setTimeout(() => {
66
- r.focus(), t && r.select();
67
- }, 1);
68
- }, []), y(() => {
69
- const r = a.current;
70
- if (!r) return;
71
- const e = _(T);
72
- r.value !== e && (r.value = e);
73
- }, [T]), /* @__PURE__ */ F(
74
- U,
75
- {
76
- className: x([
77
- "TextArea",
78
- N && "TextArea--fluid",
79
- S && "TextArea--noborder",
80
- D
81
- ]),
82
- ...R,
83
- children: [
84
- !!s && /* @__PURE__ */ p(
85
- "div",
86
- {
87
- style: {
88
- height: "100%",
89
- overflow: "hidden",
90
- position: "absolute",
91
- width: "100%"
92
- },
93
- children: /* @__PURE__ */ p(
94
- "div",
95
- {
96
- className: x([
97
- "TextArea__textarea",
98
- "TextArea__textarea_custom"
99
- ]),
100
- style: {
101
- transform: `translateY(-${V}px)`
102
- },
103
- children: s
104
- }
105
- )
106
- }
107
- ),
108
- /* @__PURE__ */ p(
109
- "textarea",
110
- {
111
- autoComplete: "off",
112
- className: x([
113
- "TextArea__textarea",
114
- E && "TextArea__textarea--scrollable",
115
- C && "TextArea__nowrap"
116
- ]),
117
- maxLength: w,
118
- onBlur: (r) => i == null ? void 0 : i(r, r.target.value),
119
- onChange: (r) => d == null ? void 0 : d(r, r.target.value),
120
- onKeyDown: B,
121
- onScroll: () => {
122
- s && a.current && j(a.current.scrollTop);
123
- },
124
- placeholder: $,
125
- ref: a,
126
- spellCheck: !1,
127
- style: {
128
- color: s ? "rgba(0, 0, 0, 0)" : "inherit"
129
- }
130
- }
131
- )
132
- ]
133
- }
134
- );
135
- }
136
- );
137
- export {
138
- X as TextArea
139
- };
1
+ import*as e from"react/jsx-runtime";import*as r from"react";import*as t from"../common/keys.js";import*as a from"../common/react.js";import*as s from"./Box.js";import*as n from"./Input.js";function u(u){let{autoFocus:l,autoSelect:c,displayedValue:o,dontUseTabForIndent:i,maxLength:f,noborder:m,onChange:T,onEnter:x,onEscape:g,onInput:p,placeholder:v,ref:_,scrollbar:d,selfClear:y,userMarkup:b,value:h,...A}=u,{className:j,fluid:E,nowrap:$,...k}=A,K=(0,r.useRef)(null),N=_??K,[B,C]=(0,r.useState)(0);return(0,r.useEffect)(()=>{if(l||c){let e=N.current;e&&setTimeout(()=>{e.focus(),c&&e.select()},1)}},[]),(0,r.useEffect)(()=>{let e=N.current;if(e){let r=(0,n.toInputValue)(h);e.value!==r&&(e.value=r)}},[h]),(0,e.jsxs)(s.Box,{className:(0,a.classes)(["TextArea",E&&"TextArea--fluid",m&&"TextArea--noborder",j]),...k,children:[!!o&&(0,e.jsx)("div",{className:"TextArea__value-container",children:(0,e.jsx)("div",{className:(0,a.classes)(["TextArea__textarea","TextArea__textarea_custom"]),style:{transform:`translateY(-${B}px)`},children:o})}),(0,e.jsx)("textarea",{autoComplete:"off",className:(0,a.classes)(["TextArea__textarea",d&&"TextArea__textarea--scrollable",$&&"TextArea__nowrap"]),maxLength:f,onBlur:e=>T?.(e,e.target.value),onChange:e=>p?.(e,e.target.value),onKeyDown:function(e){if(e.key===t.KEY.Enter)return e.shiftKey?void e.currentTarget.focus():(x?.(e,e.currentTarget.value),y&&(e.currentTarget.value=""),void e.currentTarget.blur());if((0,t.isEscape)(e.key)){g?.(e),y?e.currentTarget.value="":(e.currentTarget.value=(0,n.toInputValue)(h),e.currentTarget.blur());return}if(!i&&e.key===t.KEY.Tab){e.preventDefault();let{value:r,selectionStart:t,selectionEnd:a}=e.currentTarget;e.currentTarget.value=`${r.substring(0,t)} ${r.substring(a)}`,e.currentTarget.selectionEnd=t+1}if(b&&(e.ctrlKey||e.metaKey)&&b[e.key]){e.preventDefault();let{value:r,selectionStart:t,selectionEnd:a}=e.currentTarget,s=b[e.key];e.currentTarget.value=`${r.substring(0,t)}${s}${r.substring(t,a)}${s}${r.substring(a)}`,e.currentTarget.selectionEnd=a+2*s.length}},onScroll:()=>{o&&N.current&&C(N.current.scrollTop)},placeholder:v,ref:N,spellCheck:!1,style:{color:o?"rgba(0, 0, 0, 0)":"inherit"}})]})}export{u as TextArea};
@@ -1,25 +1 @@
1
- import { useState as l, useRef as p, useEffect as f } from "react";
2
- import { formatTime as d } from "../common/format.js";
3
- import { isSafeNumber as u } from "../common/math.js";
4
- function I(s) {
5
- const {
6
- value: e = 0,
7
- auto: t = void 0,
8
- format: n = void 0
9
- } = s, [o, a] = l(
10
- () => u(e) ? e : 0
11
- ), [i, m] = l(
12
- u(e) ? e : void 0
13
- ), r = p(null);
14
- return f(() => (t !== void 0 && (r.current = setInterval(() => {
15
- const c = t === "up" ? 10 : -10;
16
- a((v) => Math.max(0, v + c));
17
- }, 1e3)), () => {
18
- r.current && clearInterval(r.current);
19
- }), [t]), f(() => {
20
- e !== i && (m(e), a(e));
21
- }, [e, i]), u(e) ? n ? n(o) : d(o) : e || null;
22
- }
23
- export {
24
- I as TimeDisplay
25
- };
1
+ import*as e from"react";import*as t from"../common/format.js";import*as r from"../common/math.js";function a(a){let{value:m=0,auto:u,format:o}=a,[s,f]=(0,e.useState)(()=>(0,r.isSafeNumber)(m)?m:0),[i,n]=(0,e.useState)((0,r.isSafeNumber)(m)?m:void 0),l=(0,e.useRef)(null);return((0,e.useEffect)(()=>(void 0!==u&&(l.current=setInterval(()=>{let e="up"===u?10:-10;f(t=>Math.max(0,t+e))},1e3)),()=>{l.current&&clearInterval(l.current)}),[u]),(0,e.useEffect)(()=>{m!==i&&(n(m),f(m))},[m,i]),(0,r.isSafeNumber)(m))?o?o(s):(0,t.formatTime)(s):m||null}export{a as TimeDisplay};
@@ -1,5 +1,5 @@
1
- import { Placement } from '@floating-ui/react';
2
- import { ReactNode } from 'react';
1
+ import type { Placement } from '@floating-ui/react';
2
+ import type { ReactNode } from 'react';
3
3
  type Props = {
4
4
  /** The content to display in the tooltip */
5
5
  content: ReactNode;
@@ -1,18 +1 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { Floating as i } from "./Floating.js";
3
- function l(o) {
4
- const { content: t, children: n, position: e } = o;
5
- return /* @__PURE__ */ r(
6
- i,
7
- {
8
- hoverOpen: !0,
9
- content: t,
10
- contentClasses: "Tooltip",
11
- placement: e,
12
- children: n
13
- }
14
- );
15
- }
16
- export {
17
- l as Tooltip
18
- };
1
+ import*as t from"react/jsx-runtime";import*as o from"./Floating.js";function e(e){let{content:n,children:r,position:i}=e;return(0,t.jsx)(o.Floating,{hoverOpen:!0,content:n,contentClasses:"Tooltip",placement:i,children:r})}export{e as Tooltip};
@@ -1,9 +1,9 @@
1
- import { Component, PropsWithChildren } from 'react';
1
+ import { Component, type PropsWithChildren } from 'react';
2
2
  type Props = {
3
3
  onOutsideClick: () => void;
4
4
  } & PropsWithChildren;
5
5
  export declare class TrackOutsideClicks extends Component<Props> {
6
- ref: import('react').RefObject<HTMLDivElement | null>;
6
+ ref: import("react").RefObject<HTMLDivElement | null>;
7
7
  constructor(props: any);
8
8
  componentWillUnmount(): void;
9
9
  handleOutsideClick(event: MouseEvent): void;
@@ -1,24 +1 @@
1
- var n = Object.defineProperty;
2
- var s = (i, t, e) => t in i ? n(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var r = (i, t, e) => s(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { jsx as c } from "react/jsx-runtime";
5
- import { Component as d, createRef as o } from "react";
6
- class a extends d {
7
- constructor(e) {
8
- super(e);
9
- r(this, "ref", o());
10
- this.handleOutsideClick = this.handleOutsideClick.bind(this), document.addEventListener("click", this.handleOutsideClick);
11
- }
12
- componentWillUnmount() {
13
- document.removeEventListener("click", this.handleOutsideClick);
14
- }
15
- handleOutsideClick(e) {
16
- e.target instanceof Node && this.ref.current && !this.ref.current.contains(e.target) && this.props.onOutsideClick();
17
- }
18
- render() {
19
- return /* @__PURE__ */ c("div", { ref: this.ref, children: this.props.children });
20
- }
21
- }
22
- export {
23
- a as TrackOutsideClicks
24
- };
1
+ import*as e from"react/jsx-runtime";import*as t from"react";class i extends t.Component{ref=(0,t.createRef)();constructor(e){super(e),this.handleOutsideClick=this.handleOutsideClick.bind(this),document.addEventListener("click",this.handleOutsideClick)}componentWillUnmount(){document.removeEventListener("click",this.handleOutsideClick)}handleOutsideClick(e){e.target instanceof Node&&this.ref.current&&!this.ref.current.contains(e.target)&&this.props.onOutsideClick()}render(){return(0,e.jsx)("div",{ref:this.ref,children:this.props.children})}}export{i as TrackOutsideClicks};
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { type PropsWithChildren } from 'react';
2
2
  /**
3
3
  * A vertical list that renders items to fill space up to the extents of the
4
4
  * current window, and then defers rendering of other items until they come
@@ -1,34 +1 @@
1
- import { jsxs as g, jsx as c } from "react/jsx-runtime";
2
- import { useRef as h, useState as o, useCallback as v, useEffect as b } from "react";
3
- function y(u) {
4
- const { children: t } = u, s = h(null), [e, d] = o(1), [m, f] = o(0), i = v(() => {
5
- const { current: n } = s;
6
- if (!t || !Array.isArray(t) || !n || e >= t.length)
7
- return;
8
- const r = document.body.offsetHeight - n.getBoundingClientRect().bottom, a = Math.ceil(n.offsetHeight / e);
9
- if (r > 0) {
10
- const l = Math.min(
11
- t.length,
12
- e + Math.max(1, Math.ceil(r / a))
13
- );
14
- d(l), f((t.length - l) * a);
15
- }
16
- }, [s, e, t]);
17
- return b(() => {
18
- i();
19
- const n = setInterval(i, 100);
20
- return () => clearInterval(n);
21
- }, [i]), /* @__PURE__ */ g("div", { className: "VirtualList", children: [
22
- /* @__PURE__ */ c("div", { className: "VirtualList__Container", ref: s, children: Array.isArray(t) ? t.slice(0, e) : null }),
23
- /* @__PURE__ */ c(
24
- "div",
25
- {
26
- className: "VirtualList__Padding",
27
- style: { paddingBottom: `${m}px` }
28
- }
29
- )
30
- ] });
31
- }
32
- export {
33
- y as VirtualList
34
- };
1
+ import*as t from"react/jsx-runtime";import*as e from"react";function a(a){let{children:r}=a,i=(0,e.useRef)(null),[l,s]=(0,e.useState)(1),[n,u]=(0,e.useState)(0),c=(0,e.useCallback)(()=>{let{current:t}=i;if(!r||!Array.isArray(r)||!t||l>=r.length)return;let e=document.body.offsetHeight-t.getBoundingClientRect().bottom,a=Math.ceil(t.offsetHeight/l);if(e>0){let t=Math.min(r.length,l+Math.max(1,Math.ceil(e/a)));s(t),u((r.length-t)*a)}},[i,l,r]);return(0,e.useEffect)(()=>{c();let t=setInterval(c,100);return()=>clearInterval(t)},[c]),(0,t.jsxs)("div",{className:"VirtualList",children:[(0,t.jsx)("div",{className:"VirtualList__Container",ref:i,children:Array.isArray(r)?r.slice(0,l):null}),(0,t.jsx)("div",{className:"VirtualList__Padding",style:{paddingBottom:`${n}px`}})]})}export{a as VirtualList};