tgui-core 1.8.4 → 2.0.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.
- package/dist/common/constants.d.ts +4 -0
- package/dist/common/constants.js +17 -0
- package/dist/common/hotkeys.js +48 -48
- package/dist/common/ui.d.ts +6 -0
- package/dist/common/ui.js +63 -59
- package/dist/components/AnimatedNumber.d.ts +1 -1
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/Button.js +21 -22
- package/dist/components/Chart.d.ts +3 -15
- package/dist/components/Chart.js +68 -86
- package/dist/components/ColorBox.js +3 -3
- package/dist/components/Dialog.d.ts +16 -0
- package/dist/components/Dialog.js +5 -5
- package/dist/components/DmIcon.d.ts +1 -1
- package/dist/components/DraggableControl.d.ts +56 -0
- package/dist/components/DraggableControl.js +126 -176
- package/dist/components/Dropdown.d.ts +8 -6
- package/dist/components/Dropdown.js +137 -129
- package/dist/components/FitText.d.ts +1 -1
- package/dist/components/Floating.d.ts +75 -0
- package/dist/components/Floating.js +2235 -0
- package/dist/components/ImageButton.d.ts +2 -3
- package/dist/components/ImageButton.js +88 -98
- package/dist/components/InfinitePlane.d.ts +35 -32
- package/dist/components/InfinitePlane.js +123 -133
- package/dist/components/Knob.d.ts +22 -6
- package/dist/components/Knob.js +45 -46
- package/dist/components/MenuBar.js +81 -97
- package/dist/components/Modal.js +12 -12
- package/dist/components/NumberInput.d.ts +1 -1
- package/dist/components/Popper.d.ts +5 -1
- package/dist/components/Popper.js +1026 -121
- package/dist/components/ProgressBar.js +3 -3
- package/dist/components/RoundGauge.js +30 -30
- package/dist/components/Section.js +7 -7
- package/dist/components/Slider.d.ts +22 -6
- package/dist/components/Slider.js +55 -56
- package/dist/components/Stack.js +3 -3
- package/dist/components/Table.js +7 -7
- package/dist/components/Tabs.js +7 -7
- package/dist/components/TextArea.d.ts +17 -0
- package/dist/components/TextArea.js +35 -33
- package/dist/components/Tooltip.d.ts +3 -34
- package/dist/components/Tooltip.js +14 -77
- package/dist/components/TrackOutsideClicks.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +64 -62
- package/package.json +26 -27
- package/styles/base.scss +13 -11
- package/styles/colors.scss +63 -67
- package/styles/components/BlockQuote.scss +5 -8
- package/styles/components/Button.scss +123 -99
- package/styles/components/Dialog.scss +23 -30
- package/styles/components/Dimmer.scss +3 -8
- package/styles/components/Divider.scss +6 -7
- package/styles/components/Dropdown.scss +103 -51
- package/styles/components/Flex.scss +0 -1
- package/styles/components/Floating.scss +60 -0
- package/styles/components/ImageButton.scss +136 -192
- package/styles/components/Input.scss +24 -26
- package/styles/components/Knob.scss +37 -41
- package/styles/components/LabeledList.scss +8 -6
- package/styles/components/MenuBar.scss +17 -21
- package/styles/components/Modal.scss +8 -7
- package/styles/components/NoticeBox.scss +22 -26
- package/styles/components/NumberInput.scss +30 -28
- package/styles/components/ProgressBar.scss +27 -19
- package/styles/components/RoundGauge.scss +46 -26
- package/styles/components/Section.scss +17 -32
- package/styles/components/Slider.scss +18 -15
- package/styles/components/Stack.scss +8 -48
- package/styles/components/Table.scss +2 -2
- package/styles/components/Tabs.scss +92 -66
- package/styles/components/TextArea.scss +32 -36
- package/styles/components/Tooltip.scss +10 -13
- package/styles/functions.scss +1 -62
- package/styles/main.scss +6 -1
- package/styles/reset.scss +7 -11
- package/styles/vars-colors.scss +108 -0
- package/styles/vars-components.scss +162 -0
- package/styles/vars-values.scss +110 -0
- package/dist/popper-CiqSDJTE.js +0 -906
|
@@ -1,157 +1,165 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as u, jsx as r, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useRef as V } from "react";
|
|
3
|
+
import { KEY as O } from "../common/keys.js";
|
|
4
|
+
import { classes as D } from "../common/react.js";
|
|
5
|
+
import { unit as C } from "../common/ui.js";
|
|
6
|
+
import { Button as E } from "./Button.js";
|
|
7
|
+
import { Floating as Y } from "./Floating.js";
|
|
8
|
+
import { Icon as T } from "./Icon.js";
|
|
9
|
+
const q = -1;
|
|
10
|
+
function f(d) {
|
|
11
|
+
return typeof d == "string" ? d : d.value;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function X(d) {
|
|
13
14
|
const {
|
|
14
15
|
autoScroll: v = !0,
|
|
15
|
-
buttons:
|
|
16
|
-
className:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
displayText: E,
|
|
16
|
+
buttons: k,
|
|
17
|
+
className: B,
|
|
18
|
+
color: K = "default",
|
|
19
|
+
disabled: i,
|
|
20
|
+
displayText: R,
|
|
21
21
|
icon: x,
|
|
22
|
-
iconRotation:
|
|
23
|
-
iconSpin:
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
iconRotation: j,
|
|
23
|
+
iconSpin: A,
|
|
24
|
+
iconOnly: h,
|
|
25
|
+
menuWidth: _,
|
|
26
|
+
noChevron: F,
|
|
26
27
|
onClick: a,
|
|
27
|
-
onSelected:
|
|
28
|
-
options:
|
|
28
|
+
onSelected: t,
|
|
29
|
+
options: l = [],
|
|
29
30
|
over: y,
|
|
30
|
-
placeholder:
|
|
31
|
+
placeholder: W = "Select...",
|
|
31
32
|
selected: m,
|
|
32
|
-
width:
|
|
33
|
-
} =
|
|
33
|
+
width: $ = 15
|
|
34
|
+
} = d, [p, P] = S(!1), N = V(null), s = l.findIndex((e) => f(e) === m) || 0;
|
|
34
35
|
function g(e) {
|
|
35
|
-
let
|
|
36
|
-
e <
|
|
37
|
-
const
|
|
38
|
-
|
|
36
|
+
let n = e;
|
|
37
|
+
e < s ? n = e < 2 ? 0 : e - 2 : n = e > l.length - 3 ? l.length - 1 : e - 2;
|
|
38
|
+
const o = N.current, c = o == null ? void 0 : o.children[n];
|
|
39
|
+
o && c && (o.scrollTop = c.offsetTop);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
if (
|
|
41
|
+
function b(e) {
|
|
42
|
+
if (l.length < 1 || i)
|
|
42
43
|
return;
|
|
43
|
-
const
|
|
44
|
-
let
|
|
45
|
-
|
|
44
|
+
const n = 0, o = l.length - 1;
|
|
45
|
+
let c;
|
|
46
|
+
s < 0 ? c = e === "next" ? o : n : e === "next" ? c = s === o ? n : s + 1 : c = s === n ? o : s - 1, p && v && g(c), t == null || t(f(l[c]));
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
children: /* @__PURE__ */ p("div", { className: "Dropdown", style: { width: $(P) }, children: [
|
|
88
|
-
/* @__PURE__ */ p(
|
|
48
|
+
let w = y ? "top" : "bottom";
|
|
49
|
+
return h && (w = `${w}-start`), /* @__PURE__ */ u("div", { className: "Dropdown", children: [
|
|
50
|
+
/* @__PURE__ */ r(
|
|
51
|
+
Y,
|
|
52
|
+
{
|
|
53
|
+
allowedOutsideClasses: ".Dropdown__button",
|
|
54
|
+
closeAfterInteract: !0,
|
|
55
|
+
contentAutoWidth: !_,
|
|
56
|
+
contentClasses: "Dropdown__menu--wrapper",
|
|
57
|
+
contentStyles: { width: _ ? C(_) : void 0 },
|
|
58
|
+
disabled: i,
|
|
59
|
+
onOpenChange: P,
|
|
60
|
+
placement: w,
|
|
61
|
+
content: /* @__PURE__ */ r("div", { ref: N, className: "Dropdown__menu", children: l.length === 0 ? /* @__PURE__ */ r("div", { className: "Dropdown__menu--entry", children: "No options" }) : l.map((e) => {
|
|
62
|
+
const n = f(e);
|
|
63
|
+
return /* @__PURE__ */ r(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: D([
|
|
67
|
+
"Dropdown__menu--entry",
|
|
68
|
+
m === n && "selected"
|
|
69
|
+
]),
|
|
70
|
+
onClick: () => {
|
|
71
|
+
t == null || t(n);
|
|
72
|
+
},
|
|
73
|
+
onKeyDown: (o) => {
|
|
74
|
+
o.key === O.Enter && (t == null || t(n));
|
|
75
|
+
},
|
|
76
|
+
children: typeof e == "string" ? e : e.displayText
|
|
77
|
+
},
|
|
78
|
+
n
|
|
79
|
+
);
|
|
80
|
+
}) }),
|
|
81
|
+
onMounted: () => {
|
|
82
|
+
p && v && s !== q && g(s);
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ u(
|
|
89
85
|
"div",
|
|
90
86
|
{
|
|
91
|
-
className:
|
|
87
|
+
className: D([
|
|
92
88
|
"Dropdown__control",
|
|
93
|
-
|
|
94
|
-
"Button--
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
O
|
|
89
|
+
`Button--color--${K}`,
|
|
90
|
+
i && "Button--disabled",
|
|
91
|
+
h && "Dropdown__control--icon-only",
|
|
92
|
+
B
|
|
98
93
|
]),
|
|
94
|
+
style: { width: C($) },
|
|
99
95
|
onClick: (e) => {
|
|
100
|
-
|
|
96
|
+
i && !p || a == null || a(e);
|
|
101
97
|
},
|
|
102
98
|
onKeyDown: (e) => {
|
|
103
|
-
e.key ===
|
|
99
|
+
e.key === O.Enter && !i && (a == null || a(e));
|
|
104
100
|
},
|
|
105
101
|
children: [
|
|
106
|
-
x && /* @__PURE__ */
|
|
107
|
-
|
|
108
|
-
"span",
|
|
102
|
+
x && /* @__PURE__ */ r(
|
|
103
|
+
T,
|
|
109
104
|
{
|
|
110
|
-
className: "
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
children: E || m && h(m) || K
|
|
105
|
+
className: "Dropdown__icon",
|
|
106
|
+
name: x,
|
|
107
|
+
rotation: j,
|
|
108
|
+
spin: A
|
|
115
109
|
}
|
|
116
110
|
),
|
|
117
|
-
!
|
|
111
|
+
!h && /* @__PURE__ */ u(I, { children: [
|
|
112
|
+
/* @__PURE__ */ r("span", { className: "Dropdown__selected-text", children: R || m && f(m) || W }),
|
|
113
|
+
!F && /* @__PURE__ */ r(
|
|
114
|
+
T,
|
|
115
|
+
{
|
|
116
|
+
className: D([
|
|
117
|
+
"Dropdown__icon",
|
|
118
|
+
"Dropdown__icon--arrow",
|
|
119
|
+
y && "over",
|
|
120
|
+
p && "open"
|
|
121
|
+
]),
|
|
122
|
+
name: "chevron-down"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] })
|
|
118
126
|
]
|
|
119
127
|
}
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
);
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
k && /* @__PURE__ */ u(I, { children: [
|
|
132
|
+
/* @__PURE__ */ r(
|
|
133
|
+
E,
|
|
134
|
+
{
|
|
135
|
+
className: "Dropdown__button",
|
|
136
|
+
disabled: i,
|
|
137
|
+
icon: "chevron-left",
|
|
138
|
+
onClick: () => {
|
|
139
|
+
b(
|
|
140
|
+
"previous"
|
|
141
|
+
/* Previous */
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ r(
|
|
147
|
+
E,
|
|
148
|
+
{
|
|
149
|
+
className: "Dropdown__button",
|
|
150
|
+
disabled: i,
|
|
151
|
+
icon: "chevron-right",
|
|
152
|
+
onClick: () => {
|
|
153
|
+
b(
|
|
154
|
+
"next"
|
|
155
|
+
/* Next */
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] })
|
|
161
|
+
] });
|
|
154
162
|
}
|
|
155
163
|
export {
|
|
156
|
-
|
|
164
|
+
X as Dropdown
|
|
157
165
|
};
|
|
@@ -9,7 +9,7 @@ type State = {
|
|
|
9
9
|
fontSize: number;
|
|
10
10
|
};
|
|
11
11
|
export declare class FitText extends Component<Props, State> {
|
|
12
|
-
ref: RefObject<HTMLDivElement>;
|
|
12
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
13
13
|
state: State;
|
|
14
14
|
constructor(props: Props);
|
|
15
15
|
componentDidUpdate(prevProps: any): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Placement } from '@floating-ui/react';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { BooleanLike } from '../common/react';
|
|
4
|
+
type Props = {
|
|
5
|
+
/** Interacting with this element will open the floating element. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** The content to display like floating. */
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
} & Partial<{
|
|
10
|
+
/**
|
|
11
|
+
* Where the content will be displayed, relative to children.
|
|
12
|
+
* - See [Placement](https://floating-ui.com/docs/useFloating#placement)
|
|
13
|
+
* @default 'bottom'
|
|
14
|
+
*/
|
|
15
|
+
placement: Placement;
|
|
16
|
+
/** Classes with will be applied to the content. */
|
|
17
|
+
contentClasses: string;
|
|
18
|
+
/** Inline styles with will be applied to the content. */
|
|
19
|
+
contentStyles: CSSProperties;
|
|
20
|
+
/** Use calculated by Floating UI children width as content width. */
|
|
21
|
+
contentAutoWidth: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Indentation of content element from children.
|
|
24
|
+
* @default 6
|
|
25
|
+
*/
|
|
26
|
+
contentOffset: number;
|
|
27
|
+
/** Disables all interactions. */
|
|
28
|
+
disabled: BooleanLike;
|
|
29
|
+
/**
|
|
30
|
+
* How long the animation takes in ms.
|
|
31
|
+
* - If specified, default animation will be disabled.
|
|
32
|
+
* - Fully disables animations if 0
|
|
33
|
+
* @default 200
|
|
34
|
+
*/
|
|
35
|
+
animationDuration: number;
|
|
36
|
+
/** Content will open when you hover over children. */
|
|
37
|
+
hoverOpen: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Delay in ms before opening and closing the content.
|
|
40
|
+
* - Works only if used `hoverOpen` prop.
|
|
41
|
+
* @default 200
|
|
42
|
+
*/
|
|
43
|
+
hoverDelay: number;
|
|
44
|
+
/**
|
|
45
|
+
* Whitelisted classes.
|
|
46
|
+
* Used to allow to add some secured classes,
|
|
47
|
+
* click on which will not close the content.
|
|
48
|
+
* - Classes must be sent like this: `".class1, .class2"`
|
|
49
|
+
*/
|
|
50
|
+
allowedOutsideClasses: string;
|
|
51
|
+
/** Stops event propagation on children. */
|
|
52
|
+
stopChildPropagation: boolean;
|
|
53
|
+
/** Close the content after interaction with it. */
|
|
54
|
+
closeAfterInteract: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Called when the open state changes.
|
|
57
|
+
* Returns the new open state.
|
|
58
|
+
* Can be used this way:
|
|
59
|
+
* ```tsx
|
|
60
|
+
* onOpenChange={open ? makeThingsOnOpen : makeThingsOnClose}
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
onOpenChange: (open: boolean) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Called when mounted
|
|
66
|
+
*/
|
|
67
|
+
onMounted: () => void;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* ## Floating
|
|
71
|
+
* Floating lets you position elements so that they don't go out of the bounds of the window.
|
|
72
|
+
* - [Documentation](https://floating-ui.com/docs/react) for more information.
|
|
73
|
+
*/
|
|
74
|
+
export declare function Floating(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
export {};
|