tgui-core 2.0.6 → 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.
- package/dist/common/collections.d.ts +1 -1
- package/dist/common/collections.js +1 -10
- package/dist/common/color.js +1 -70
- package/dist/common/constants.js +1 -329
- package/dist/common/events.js +1 -147
- package/dist/common/exhaustive.js +1 -6
- package/dist/common/format.js +1 -117
- package/dist/common/fp.js +1 -9
- package/dist/common/hotkeys.d.ts +1 -1
- package/dist/common/hotkeys.js +1 -112
- package/dist/common/http.js +1 -10
- package/dist/common/keycodes.js +1 -88
- package/dist/common/keys.js +1 -32
- package/dist/common/math.js +1 -45
- package/dist/common/random.js +1 -21
- package/dist/common/react.js +1 -30
- package/dist/common/string.js +1 -88
- package/dist/common/timer.js +1 -28
- package/dist/common/type-utils.js +1 -25
- package/dist/common/ui.d.ts +2 -2
- package/dist/common/ui.js +1 -141
- package/dist/common/uuid.js +1 -10
- package/dist/common/vector.js +1 -48
- package/dist/components/AnimatedNumber.d.ts +1 -1
- package/dist/components/AnimatedNumber.js +1 -73
- package/dist/components/Autofocus.d.ts +1 -1
- package/dist/components/Autofocus.js +1 -17
- package/dist/components/Blink.d.ts +1 -1
- package/dist/components/Blink.js +1 -56
- package/dist/components/BlockQuote.d.ts +1 -1
- package/dist/components/BlockQuote.js +1 -10
- package/dist/components/Box.d.ts +5 -5
- package/dist/components/Box.js +1 -19
- package/dist/components/Button.d.ts +4 -4
- package/dist/components/Button.js +1 -258
- package/dist/components/ByondUi.d.ts +1 -1
- package/dist/components/ByondUi.js +1 -61
- package/dist/components/Chart.d.ts +1 -1
- package/dist/components/Chart.js +1 -80
- package/dist/components/Collapsible.d.ts +2 -2
- package/dist/components/Collapsible.js +1 -36
- package/dist/components/ColorBox.d.ts +2 -2
- package/dist/components/ColorBox.js +1 -17
- package/dist/components/Dialog.d.ts +1 -1
- package/dist/components/Dialog.js +1 -42
- package/dist/components/Dimmer.d.ts +1 -1
- package/dist/components/Dimmer.js +1 -10
- package/dist/components/Divider.js +1 -18
- package/dist/components/DmIcon.d.ts +3 -3
- package/dist/components/DmIcon.js +1 -23
- package/dist/components/DraggableControl.d.ts +2 -2
- package/dist/components/DraggableControl.js +1 -111
- package/dist/components/Dropdown.d.ts +2 -2
- package/dist/components/Dropdown.js +1 -165
- package/dist/components/FitText.d.ts +2 -2
- package/dist/components/FitText.js +1 -63
- package/dist/components/Flex.d.ts +1 -1
- package/dist/components/Flex.js +1 -70
- package/dist/components/Floating.d.ts +3 -3
- package/dist/components/Floating.js +1 -2235
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Icon.js +1 -45
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Image.js +1 -38
- package/dist/components/ImageButton.d.ts +10 -5
- package/dist/components/ImageButton.js +1 -154
- package/dist/components/InfinitePlane.d.ts +2 -2
- package/dist/components/InfinitePlane.js +1 -133
- package/dist/components/Input.d.ts +2 -2
- package/dist/components/Input.js +1 -96
- package/dist/components/KeyListener.d.ts +1 -1
- package/dist/components/KeyListener.js +1 -15
- package/dist/components/Knob.d.ts +2 -2
- package/dist/components/Knob.js +1 -133
- package/dist/components/LabeledControls.d.ts +1 -1
- package/dist/components/LabeledControls.js +1 -39
- package/dist/components/LabeledList.d.ts +2 -2
- package/dist/components/LabeledList.js +1 -89
- package/dist/components/MenuBar.d.ts +32 -0
- package/dist/components/MenuBar.js +1 -133
- package/dist/components/Modal.d.ts +2 -2
- package/dist/components/Modal.js +1 -22
- package/dist/components/NoticeBox.d.ts +1 -1
- package/dist/components/NoticeBox.js +1 -23
- package/dist/components/NumberInput.d.ts +9 -19
- package/dist/components/NumberInput.js +1 -213
- package/dist/components/Popper.d.ts +8 -9
- package/dist/components/Popper.js +1 -1082
- package/dist/components/ProgressBar.d.ts +2 -2
- package/dist/components/ProgressBar.js +1 -33
- package/dist/components/RestrictedInput.d.ts +29 -0
- package/dist/components/RestrictedInput.js +1 -161
- package/dist/components/RoundGauge.d.ts +2 -2
- package/dist/components/RoundGauge.js +1 -114
- package/dist/components/Section.d.ts +2 -2
- package/dist/components/Section.js +1 -65
- package/dist/components/Slider.d.ts +2 -2
- package/dist/components/Slider.js +1 -113
- package/dist/components/Stack.d.ts +2 -2
- package/dist/components/Stack.js +1 -58
- package/dist/components/StyleableSection.d.ts +1 -1
- package/dist/components/StyleableSection.js +1 -16
- package/dist/components/Table.d.ts +1 -1
- package/dist/components/Table.js +1 -57
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +1 -65
- package/dist/components/TextArea.d.ts +2 -2
- package/dist/components/TextArea.js +1 -126
- package/dist/components/TimeDisplay.js +1 -25
- package/dist/components/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip.js +1 -18
- package/dist/components/TrackOutsideClicks.d.ts +2 -2
- package/dist/components/TrackOutsideClicks.js +1 -24
- package/dist/components/VirtualList.d.ts +1 -1
- package/dist/components/VirtualList.js +1 -34
- package/dist/components/index.js +1 -96
- package/license.txt +1 -1
- package/package.json +11 -17
- package/styles/components/Button.scss +1 -1
- package/dist/components/FakeTerminal.js +0 -38
package/dist/components/Knob.js
CHANGED
|
@@ -1,133 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { keyOfMatchingRange as F, scale as c } from "../common/math.js";
|
|
3
|
-
import { classes as S } from "../common/react.js";
|
|
4
|
-
import { computeBoxProps as $, computeBoxClassName as j } from "../common/ui.js";
|
|
5
|
-
import { DraggableControl as E } from "./DraggableControl.js";
|
|
6
|
-
function A(m) {
|
|
7
|
-
const {
|
|
8
|
-
// Draggable props (passthrough)
|
|
9
|
-
animated: d,
|
|
10
|
-
format: g,
|
|
11
|
-
maxValue: a,
|
|
12
|
-
minValue: o,
|
|
13
|
-
onChange: p,
|
|
14
|
-
onDrag: u,
|
|
15
|
-
step: _,
|
|
16
|
-
stepPixelSize: b,
|
|
17
|
-
unclamped: f,
|
|
18
|
-
unit: h,
|
|
19
|
-
value: r,
|
|
20
|
-
// Own props
|
|
21
|
-
bipolar: n,
|
|
22
|
-
className: x,
|
|
23
|
-
color: K,
|
|
24
|
-
fillValue: i,
|
|
25
|
-
ranges: v = {},
|
|
26
|
-
size: N = 1,
|
|
27
|
-
style: y,
|
|
28
|
-
...s
|
|
29
|
-
} = m;
|
|
30
|
-
return /* @__PURE__ */ e(
|
|
31
|
-
E,
|
|
32
|
-
{
|
|
33
|
-
dragMatrix: [0, -1],
|
|
34
|
-
animated: d,
|
|
35
|
-
format: g,
|
|
36
|
-
maxValue: a,
|
|
37
|
-
minValue: o,
|
|
38
|
-
onChange: p,
|
|
39
|
-
onDrag: u,
|
|
40
|
-
step: _,
|
|
41
|
-
stepPixelSize: b,
|
|
42
|
-
unclamped: f,
|
|
43
|
-
unit: h,
|
|
44
|
-
value: r,
|
|
45
|
-
children: (V) => {
|
|
46
|
-
const {
|
|
47
|
-
displayElement: D,
|
|
48
|
-
displayValue: t,
|
|
49
|
-
dragging: M,
|
|
50
|
-
handleDragStart: k,
|
|
51
|
-
inputElement: B
|
|
52
|
-
} = V, P = c(
|
|
53
|
-
i ?? t,
|
|
54
|
-
o,
|
|
55
|
-
a
|
|
56
|
-
), C = c(t, o, a), w = K || F(i ?? r, v) || "default", z = Math.min((C - 0.5) * 270, 225);
|
|
57
|
-
return /* @__PURE__ */ l(
|
|
58
|
-
"div",
|
|
59
|
-
{
|
|
60
|
-
className: S([
|
|
61
|
-
"Knob",
|
|
62
|
-
`Knob--color--${w}`,
|
|
63
|
-
n && "Knob--bipolar",
|
|
64
|
-
x,
|
|
65
|
-
j(s)
|
|
66
|
-
]),
|
|
67
|
-
...$({
|
|
68
|
-
style: {
|
|
69
|
-
fontSize: `${N}em`,
|
|
70
|
-
...y
|
|
71
|
-
},
|
|
72
|
-
...s
|
|
73
|
-
}),
|
|
74
|
-
onMouseDown: k,
|
|
75
|
-
children: [
|
|
76
|
-
/* @__PURE__ */ e("div", { className: "Knob__circle", children: /* @__PURE__ */ e(
|
|
77
|
-
"div",
|
|
78
|
-
{
|
|
79
|
-
className: "Knob__cursorBox",
|
|
80
|
-
style: {
|
|
81
|
-
transform: `rotate(${z}deg)`
|
|
82
|
-
},
|
|
83
|
-
children: /* @__PURE__ */ e("div", { className: "Knob__cursor" })
|
|
84
|
-
}
|
|
85
|
-
) }),
|
|
86
|
-
M && /* @__PURE__ */ e("div", { className: "Knob__popupValue", children: D }),
|
|
87
|
-
/* @__PURE__ */ l(
|
|
88
|
-
"svg",
|
|
89
|
-
{
|
|
90
|
-
className: "Knob__ring Knob__ringTrackPivot",
|
|
91
|
-
viewBox: "0 0 100 100",
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ e("circle", { className: "Knob__ringTrack", cx: "50", cy: "50", r: "50" }),
|
|
94
|
-
/* @__PURE__ */ e("title", { children: "track" })
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ l(
|
|
99
|
-
"svg",
|
|
100
|
-
{
|
|
101
|
-
className: "Knob__ring Knob__ringFillPivot",
|
|
102
|
-
viewBox: "0 0 100 100",
|
|
103
|
-
children: [
|
|
104
|
-
/* @__PURE__ */ e("title", { children: "fill" }),
|
|
105
|
-
/* @__PURE__ */ e(
|
|
106
|
-
"circle",
|
|
107
|
-
{
|
|
108
|
-
className: "Knob__ringFill",
|
|
109
|
-
style: {
|
|
110
|
-
strokeDashoffset: Math.max(
|
|
111
|
-
((n ? 2.75 : 2) - P * 1.5) * Math.PI * 50,
|
|
112
|
-
0
|
|
113
|
-
)
|
|
114
|
-
},
|
|
115
|
-
cx: "50",
|
|
116
|
-
cy: "50",
|
|
117
|
-
r: "50"
|
|
118
|
-
}
|
|
119
|
-
)
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
B
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
export {
|
|
132
|
-
A as Knob
|
|
133
|
-
};
|
|
1
|
+
import*as s from"react/jsx-runtime";import*as o from"../common/math.js";import*as r from"../common/react.js";import*as e from"../common/ui.js";import*as a from"./DraggableControl.js";function c(c){let{animated:l,format:n,maxValue:i,minValue:t,onChange:m,onDrag:x,step:_,stepPixelSize:b,unclamped:d,unit:j,value:g,bipolar:h,className:K,color:f,fillValue:p,ranges:u={},size:v=1,style:N,...y}=c;return(0,s.jsx)(a.DraggableControl,{dragMatrix:[0,-1],animated:l,format:n,maxValue:i,minValue:t,onChange:m,onDrag:x,step:_,stepPixelSize:b,unclamped:d,unit:j,value:g,children:a=>{let{displayElement:c,displayValue:l,dragging:n,handleDragStart:m,inputElement:x}=a,_=(0,o.scale)(p??l,t,i),b=(0,o.scale)(l,t,i),d=f||(0,o.keyOfMatchingRange)(p??g,u)||"default",j=Math.min((b-.5)*270,225);return(0,s.jsxs)("div",{className:(0,r.classes)(["Knob",`Knob--color--${d}`,h&&"Knob--bipolar",K,(0,e.computeBoxClassName)(y)]),...(0,e.computeBoxProps)({style:{fontSize:`${v}em`,...N},...y}),onMouseDown:m,children:[(0,s.jsx)("div",{className:"Knob__circle",children:(0,s.jsx)("div",{className:"Knob__cursorBox",style:{transform:`rotate(${j}deg)`},children:(0,s.jsx)("div",{className:"Knob__cursor"})})}),n&&(0,s.jsx)("div",{className:"Knob__popupValue",children:c}),(0,s.jsxs)("svg",{className:"Knob__ring Knob__ringTrackPivot",viewBox:"0 0 100 100",children:[(0,s.jsx)("circle",{className:"Knob__ringTrack",cx:"50",cy:"50",r:"50"}),(0,s.jsx)("title",{children:"track"})]}),(0,s.jsxs)("svg",{className:"Knob__ring Knob__ringFillPivot",viewBox:"0 0 100 100",children:[(0,s.jsx)("title",{children:"fill"}),(0,s.jsx)("circle",{className:"Knob__ringFill",style:{strokeDashoffset:Math.max(((h?2.75:2)-1.5*_)*Math.PI*50,0)},cx:"50",cy:"50",r:"50"})]}),x]})}})}export{c as Knob};
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Flex as e } from "./Flex.js";
|
|
3
|
-
function s(n) {
|
|
4
|
-
const { children: r, wrap: l, ...c } = n;
|
|
5
|
-
return /* @__PURE__ */ t(
|
|
6
|
-
e,
|
|
7
|
-
{
|
|
8
|
-
mx: -0.5,
|
|
9
|
-
wrap: l,
|
|
10
|
-
align: "stretch",
|
|
11
|
-
justify: "space-between",
|
|
12
|
-
...c,
|
|
13
|
-
children: r
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
function m(n) {
|
|
18
|
-
const { label: r, children: l, mx: c = 1, ...i } = n;
|
|
19
|
-
return /* @__PURE__ */ t(e.Item, { mx: c, children: /* @__PURE__ */ o(
|
|
20
|
-
e,
|
|
21
|
-
{
|
|
22
|
-
height: "100%",
|
|
23
|
-
direction: "column",
|
|
24
|
-
align: "center",
|
|
25
|
-
textAlign: "center",
|
|
26
|
-
justify: "space-between",
|
|
27
|
-
...i,
|
|
28
|
-
children: [
|
|
29
|
-
/* @__PURE__ */ t(e.Item, {}),
|
|
30
|
-
/* @__PURE__ */ t(e.Item, { children: l }),
|
|
31
|
-
/* @__PURE__ */ t(e.Item, { color: "label", children: r })
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
) });
|
|
35
|
-
}
|
|
36
|
-
s.Item = m;
|
|
37
|
-
export {
|
|
38
|
-
s as LabeledControls
|
|
39
|
-
};
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as t from"./Flex.js";function l(l){let{children:r,wrap:n,...i}=l;return(0,e.jsx)(t.Flex,{mx:-.5,wrap:n,align:"stretch",justify:"space-between",...i,children:r})}l.Item=function(l){let{label:r,children:n,mx:i=1,...x}=l;return(0,e.jsx)(t.Flex.Item,{mx:i,children:(0,e.jsxs)(t.Flex,{height:"100%",direction:"column",align:"center",textAlign:"center",justify:"space-between",...x,children:[(0,e.jsx)(t.Flex.Item,{}),(0,e.jsx)(t.Flex.Item,{children:n}),(0,e.jsx)(t.Flex.Item,{color:"label",children:r})]})})};export{l as LabeledControls};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
-
import { BooleanLike } from '../common/react';
|
|
1
|
+
import type { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { type BooleanLike } from '../common/react';
|
|
3
3
|
export declare function LabeledList(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
type LabeledListItemProps = Partial<{
|
|
5
5
|
/** Buttons to render aside the content. */
|
|
@@ -1,89 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { classes as c } from "../common/react.js";
|
|
3
|
-
import { unit as g } from "../common/ui.js";
|
|
4
|
-
import { Box as r } from "./Box.js";
|
|
5
|
-
import { Divider as x } from "./Divider.js";
|
|
6
|
-
import { Tooltip as N } from "./Tooltip.js";
|
|
7
|
-
function b(e) {
|
|
8
|
-
const { children: t } = e;
|
|
9
|
-
return /* @__PURE__ */ l("table", { className: "LabeledList", children: /* @__PURE__ */ l("tbody", { children: t }) });
|
|
10
|
-
}
|
|
11
|
-
function v(e) {
|
|
12
|
-
const {
|
|
13
|
-
className: t,
|
|
14
|
-
label: o,
|
|
15
|
-
labelColor: m = "label",
|
|
16
|
-
labelWrap: L,
|
|
17
|
-
color: p,
|
|
18
|
-
textAlign: _,
|
|
19
|
-
buttons: a,
|
|
20
|
-
content: f,
|
|
21
|
-
children: h,
|
|
22
|
-
verticalAlign: s = "baseline",
|
|
23
|
-
tooltip: n
|
|
24
|
-
} = e;
|
|
25
|
-
let i;
|
|
26
|
-
o && (i = o, typeof o == "string" && (i += ":")), n !== void 0 && (i = /* @__PURE__ */ l(N, { content: n, children: /* @__PURE__ */ l(
|
|
27
|
-
r,
|
|
28
|
-
{
|
|
29
|
-
as: "span",
|
|
30
|
-
style: {
|
|
31
|
-
borderBottom: "2px dotted rgba(255, 255, 255, 0.8)"
|
|
32
|
-
},
|
|
33
|
-
children: i
|
|
34
|
-
}
|
|
35
|
-
) }));
|
|
36
|
-
const u = /* @__PURE__ */ l(
|
|
37
|
-
r,
|
|
38
|
-
{
|
|
39
|
-
as: "td",
|
|
40
|
-
color: m,
|
|
41
|
-
className: c([
|
|
42
|
-
"LabeledList__cell",
|
|
43
|
-
// Kinda flipped because we want nowrap as default. Cleaner CSS this way though.
|
|
44
|
-
!L && "LabeledList__label--nowrap"
|
|
45
|
-
]),
|
|
46
|
-
verticalAlign: s,
|
|
47
|
-
children: i
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
return /* @__PURE__ */ d("tr", { className: c(["LabeledList__row", t]), children: [
|
|
51
|
-
u,
|
|
52
|
-
/* @__PURE__ */ d(
|
|
53
|
-
r,
|
|
54
|
-
{
|
|
55
|
-
as: "td",
|
|
56
|
-
color: p,
|
|
57
|
-
textAlign: _,
|
|
58
|
-
className: "LabeledList__cell",
|
|
59
|
-
colSpan: a ? void 0 : 2,
|
|
60
|
-
verticalAlign: s,
|
|
61
|
-
children: [
|
|
62
|
-
f,
|
|
63
|
-
h
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
),
|
|
67
|
-
a && /* @__PURE__ */ l("td", { className: "LabeledList__cell LabeledList__buttons", children: a })
|
|
68
|
-
] });
|
|
69
|
-
}
|
|
70
|
-
function y(e) {
|
|
71
|
-
const t = e.size ? g(Math.max(0, e.size - 1)) : 0;
|
|
72
|
-
return /* @__PURE__ */ l("tr", { className: "LabeledList__row", children: /* @__PURE__ */ l(
|
|
73
|
-
"td",
|
|
74
|
-
{
|
|
75
|
-
colSpan: 3,
|
|
76
|
-
style: {
|
|
77
|
-
paddingTop: t,
|
|
78
|
-
paddingBottom: t
|
|
79
|
-
},
|
|
80
|
-
children: /* @__PURE__ */ l(x, {})
|
|
81
|
-
}
|
|
82
|
-
) });
|
|
83
|
-
}
|
|
84
|
-
((e) => {
|
|
85
|
-
e.Divider = y, e.Item = v;
|
|
86
|
-
})(b || (b = {}));
|
|
87
|
-
export {
|
|
88
|
-
b as LabeledList
|
|
89
|
-
};
|
|
1
|
+
var e;import*as s from"react/jsx-runtime";import*as t from"../common/react.js";import*as l from"../common/ui.js";import*as i from"./Box.js";import*as a from"./Divider.js";import*as o from"./Tooltip.js";function r(e){let{children:t}=e;return(0,s.jsx)("table",{className:"LabeledList",children:(0,s.jsx)("tbody",{children:t})})}(e=r||(r={})).Divider=function(e){let t=e.size?(0,l.unit)(Math.max(0,e.size-1)):0;return(0,s.jsx)("tr",{className:"LabeledList__row",children:(0,s.jsx)("td",{colSpan:3,style:{paddingTop:t,paddingBottom:t},children:(0,s.jsx)(a.Divider,{})})})},e.Item=function(e){let l,{className:a,label:r,labelColor:d="label",labelWrap:n,color:c,textAlign:m,buttons:L,content:x,children:b,verticalAlign:p="baseline",tooltip:j}=e;r&&(l=r,"string"==typeof r&&(l+=":")),void 0!==j&&(l=(0,s.jsx)(o.Tooltip,{content:j,children:(0,s.jsx)(i.Box,{as:"span",style:{borderBottom:"2px dotted rgba(255, 255, 255, 0.8)"},children:l})}));let _=(0,s.jsx)(i.Box,{as:"td",color:d,className:(0,t.classes)(["LabeledList__cell",!n&&"LabeledList__label--nowrap"]),verticalAlign:p,children:l});return(0,s.jsxs)("tr",{className:(0,t.classes)(["LabeledList__row",a]),children:[_,(0,s.jsxs)(i.Box,{as:"td",color:c,textAlign:m,className:"LabeledList__cell",colSpan:L?void 0:2,verticalAlign:p,children:[x,b]}),L&&(0,s.jsx)("td",{className:"LabeledList__cell LabeledList__buttons",children:L})]})};export{r as LabeledList};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
type MenuBarItemProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
display: ReactNode;
|
|
7
|
+
entry: string;
|
|
8
|
+
openMenuBar: string | null;
|
|
9
|
+
openOnHover: boolean;
|
|
10
|
+
openWidth: string;
|
|
11
|
+
setOpenMenuBar: (entry: string | null) => void;
|
|
12
|
+
setOpenOnHover: (flag: boolean) => void;
|
|
13
|
+
};
|
|
14
|
+
declare function MenuDropdown(props: MenuBarItemProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare namespace MenuDropdown {
|
|
16
|
+
var MenuItemToggle: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
var MenuItem: (props: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
var Separator: () => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
type MenuItemProps = Partial<{
|
|
21
|
+
value: any;
|
|
22
|
+
displayText: string;
|
|
23
|
+
onClick: (value: any) => void;
|
|
24
|
+
}>;
|
|
25
|
+
type MenuBarProps = {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
};
|
|
28
|
+
export declare function MenuBar(props: MenuBarProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare namespace MenuBar {
|
|
30
|
+
var Dropdown: typeof MenuDropdown;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -1,133 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useRef as f } from "react";
|
|
3
|
-
import { classes as d } from "../common/react.js";
|
|
4
|
-
import { Box as c } from "./Box.js";
|
|
5
|
-
import { Floating as h } from "./Floating.js";
|
|
6
|
-
import { Icon as v } from "./Icon.js";
|
|
7
|
-
function N(r) {
|
|
8
|
-
const {
|
|
9
|
-
children: e,
|
|
10
|
-
className: a,
|
|
11
|
-
disabled: o,
|
|
12
|
-
display: t,
|
|
13
|
-
onClick: u,
|
|
14
|
-
onMouseOver: s,
|
|
15
|
-
open: m,
|
|
16
|
-
openWidth: l,
|
|
17
|
-
onOutsideClick: _,
|
|
18
|
-
...M
|
|
19
|
-
} = r, p = f(null);
|
|
20
|
-
return /* @__PURE__ */ n(
|
|
21
|
-
h,
|
|
22
|
-
{
|
|
23
|
-
allowedOutsideClasses: ".Menubar_inner",
|
|
24
|
-
content: /* @__PURE__ */ n(
|
|
25
|
-
"div",
|
|
26
|
-
{
|
|
27
|
-
className: "MenuBar__menu",
|
|
28
|
-
style: {
|
|
29
|
-
width: l
|
|
30
|
-
},
|
|
31
|
-
children: e
|
|
32
|
-
}
|
|
33
|
-
),
|
|
34
|
-
children: /* @__PURE__ */ n("div", { ref: p, className: "Menubar_inner", children: /* @__PURE__ */ n(
|
|
35
|
-
c,
|
|
36
|
-
{
|
|
37
|
-
className: d([
|
|
38
|
-
"MenuBar__MenuBarButton",
|
|
39
|
-
"MenuBar__font",
|
|
40
|
-
"MenuBar__hover",
|
|
41
|
-
a
|
|
42
|
-
]),
|
|
43
|
-
...M,
|
|
44
|
-
onClick: o ? () => null : u,
|
|
45
|
-
onMouseOver: s,
|
|
46
|
-
children: /* @__PURE__ */ n("span", { className: "MenuBar__MenuBarButton-text", children: t })
|
|
47
|
-
}
|
|
48
|
-
) })
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
function i(r) {
|
|
53
|
-
const {
|
|
54
|
-
entry: e,
|
|
55
|
-
children: a,
|
|
56
|
-
openWidth: o,
|
|
57
|
-
display: t,
|
|
58
|
-
setOpenMenuBar: u,
|
|
59
|
-
openMenuBar: s,
|
|
60
|
-
setOpenOnHover: m,
|
|
61
|
-
openOnHover: l,
|
|
62
|
-
disabled: _,
|
|
63
|
-
className: M
|
|
64
|
-
} = r;
|
|
65
|
-
return /* @__PURE__ */ n(
|
|
66
|
-
N,
|
|
67
|
-
{
|
|
68
|
-
openWidth: o,
|
|
69
|
-
display: t,
|
|
70
|
-
disabled: _,
|
|
71
|
-
open: s === e,
|
|
72
|
-
className: M,
|
|
73
|
-
onClick: () => {
|
|
74
|
-
u(s === e ? null : e), m(!l);
|
|
75
|
-
},
|
|
76
|
-
onOutsideClick: () => {
|
|
77
|
-
u(null), m(!1);
|
|
78
|
-
},
|
|
79
|
-
onMouseOver: () => {
|
|
80
|
-
l && u(e);
|
|
81
|
-
},
|
|
82
|
-
children: a
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
O.Dropdown = i;
|
|
87
|
-
function k(r) {
|
|
88
|
-
const { value: e, displayText: a, onClick: o, checked: t } = r;
|
|
89
|
-
return /* @__PURE__ */ B(
|
|
90
|
-
c,
|
|
91
|
-
{
|
|
92
|
-
className: d([
|
|
93
|
-
"MenuBar__font",
|
|
94
|
-
"MenuBar__MenuItem",
|
|
95
|
-
"MenuBar__MenuItemToggle",
|
|
96
|
-
"MenuBar__hover"
|
|
97
|
-
]),
|
|
98
|
-
onClick: () => o(e),
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ n("div", { className: "MenuBar__MenuItemToggle__check", children: /* @__PURE__ */ n(v, { size: 1.3, name: t ? "check" : "" }) }),
|
|
101
|
-
a
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
i.MenuItemToggle = k;
|
|
107
|
-
function g(r) {
|
|
108
|
-
const { value: e, displayText: a, onClick: o } = r;
|
|
109
|
-
return /* @__PURE__ */ n(
|
|
110
|
-
c,
|
|
111
|
-
{
|
|
112
|
-
className: d([
|
|
113
|
-
"MenuBar__font",
|
|
114
|
-
"MenuBar__MenuItem",
|
|
115
|
-
"MenuBar__hover"
|
|
116
|
-
]),
|
|
117
|
-
onClick: () => o == null ? void 0 : o(e),
|
|
118
|
-
children: a
|
|
119
|
-
}
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
i.MenuItem = g;
|
|
123
|
-
function I() {
|
|
124
|
-
return /* @__PURE__ */ n("div", { className: "MenuBar__Separator" });
|
|
125
|
-
}
|
|
126
|
-
i.Separator = I;
|
|
127
|
-
function O(r) {
|
|
128
|
-
const { children: e } = r;
|
|
129
|
-
return /* @__PURE__ */ n(c, { className: "MenuBar", children: e });
|
|
130
|
-
}
|
|
131
|
-
export {
|
|
132
|
-
O as MenuBar
|
|
133
|
-
};
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as n from"react";import*as r from"../common/react.js";import*as s from"./Box.js";import*as a from"./Floating.js";import*as o from"./Icon.js";function t(o){let{children:t,className:l,disabled:u,display:c,onClick:i,onMouseOver:m,open:_,openWidth:M,onOutsideClick:B,...d}=o,x=(0,n.useRef)(null);return(0,e.jsx)(a.Floating,{allowedOutsideClasses:".Menubar_inner",content:(0,e.jsx)("div",{className:"MenuBar__menu",style:{width:M},children:t}),children:(0,e.jsx)("div",{ref:x,className:"Menubar_inner",children:(0,e.jsx)(s.Box,{className:(0,r.classes)(["MenuBar__MenuBarButton","MenuBar__font","MenuBar__hover",l]),...d,onClick:u?()=>null:i,onMouseOver:m,children:(0,e.jsx)("span",{className:"MenuBar__MenuBarButton-text",children:c})})})})}function l(n){let{entry:r,children:s,openWidth:a,display:o,setOpenMenuBar:l,openMenuBar:u,setOpenOnHover:c,openOnHover:i,disabled:m,className:_}=n;return(0,e.jsx)(t,{openWidth:a,display:o,disabled:m,open:u===r,className:_,onClick:()=>{l(u===r?null:r),c(!i)},onOutsideClick:()=>{l(null),c(!1)},onMouseOver:()=>{i&&l(r)},children:s})}function u(n){let{children:r}=n;return(0,e.jsx)(s.Box,{className:"MenuBar",children:r})}u.Dropdown=l,l.MenuItemToggle=function(n){let{value:a,displayText:t,onClick:l,checked:u}=n;return(0,e.jsxs)(s.Box,{className:(0,r.classes)(["MenuBar__font","MenuBar__MenuItem","MenuBar__MenuItemToggle","MenuBar__hover"]),onClick:()=>l(a),children:[(0,e.jsx)("div",{className:"MenuBar__MenuItemToggle__check",children:(0,e.jsx)(o.Icon,{size:1.3,name:u?"check":""})}),t]})},l.MenuItem=function(n){let{value:a,displayText:o,onClick:t}=n;return(0,e.jsx)(s.Box,{className:(0,r.classes)(["MenuBar__font","MenuBar__MenuItem","MenuBar__hover"]),onClick:()=>t?.(a),children:o})},l.Separator=function(){return(0,e.jsx)("div",{className:"MenuBar__Separator"})};export{u as MenuBar};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KeyboardEvent } from 'react';
|
|
2
|
-
import { BoxProps } from './Box';
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
import type { BoxProps } from './Box';
|
|
3
3
|
export type ModalProps = BoxProps & Partial<{
|
|
4
4
|
/** Fires once the enter key is pressed */
|
|
5
5
|
onEnter: (e: KeyboardEvent<HTMLInputElement>) => void;
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { KEY as l, isEscape as n } from "../common/keys.js";
|
|
3
|
-
import { classes as f } from "../common/react.js";
|
|
4
|
-
import { computeBoxProps as p, computeBoxClassName as d } from "../common/ui.js";
|
|
5
|
-
import { Dimmer as u } from "./Dimmer.js";
|
|
6
|
-
function K(i) {
|
|
7
|
-
const { className: a, children: t, onEnter: m, onEscape: r, ...e } = i;
|
|
8
|
-
function c(o) {
|
|
9
|
-
o.key === l.Enter && (m == null || m(o)), n(o.key) && (r == null || r(o));
|
|
10
|
-
}
|
|
11
|
-
return /* @__PURE__ */ s(u, { className: "Modal__dimmer", onKeyDown: c, children: /* @__PURE__ */ s(
|
|
12
|
-
"div",
|
|
13
|
-
{
|
|
14
|
-
className: f(["Modal", a, d(e)]),
|
|
15
|
-
...p(e),
|
|
16
|
-
children: t
|
|
17
|
-
}
|
|
18
|
-
) });
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
K as Modal
|
|
22
|
-
};
|
|
1
|
+
import*as o from"react/jsx-runtime";import*as m from"../common/keys.js";import*as s from"../common/react.js";import*as e from"../common/ui.js";import*as r from"./Dimmer.js";function a(a){let{className:i,children:t,onEnter:c,onEscape:n,...l}=a;return(0,o.jsx)(r.Dimmer,{className:"Modal__dimmer",onKeyDown:function(o){o.key===m.KEY.Enter&&c?.(o),(0,m.isEscape)(o.key)&&n?.(o)},children:(0,o.jsx)("div",{className:(0,s.classes)(["Modal",i,(0,e.computeBoxClassName)(l)]),...(0,e.computeBoxProps)(l),children:t})})}export{a as Modal};
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { classes as x } from "../common/react.js";
|
|
3
|
-
import { Box as a } from "./Box.js";
|
|
4
|
-
function f(e) {
|
|
5
|
-
const { className: c, color: o, info: t, success: s, warning: m, danger: r, ...i } = e;
|
|
6
|
-
return /* @__PURE__ */ n(
|
|
7
|
-
a,
|
|
8
|
-
{
|
|
9
|
-
className: x([
|
|
10
|
-
"NoticeBox",
|
|
11
|
-
o && `NoticeBox--color--${o}`,
|
|
12
|
-
t && "NoticeBox--type--info",
|
|
13
|
-
s && "NoticeBox--type--success",
|
|
14
|
-
r && "NoticeBox--type--danger",
|
|
15
|
-
c
|
|
16
|
-
]),
|
|
17
|
-
...i
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
f as NoticeBox
|
|
23
|
-
};
|
|
1
|
+
import*as o from"react/jsx-runtime";import*as e from"../common/react.js";import*as t from"./Box.js";function c(c){let{className:s,color:r,info:i,success:x,warning:m,danger:a,...B}=c;return(0,o.jsx)(t.Box,{className:(0,e.classes)(["NoticeBox",r&&`NoticeBox--color--${r}`,i&&"NoticeBox--type--info",x&&"NoticeBox--type--success",a&&"NoticeBox--type--danger",s]),...B})}export{c as NoticeBox};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BooleanLike } from '../common/react';
|
|
3
|
-
import { BoxProps } from './Box';
|
|
1
|
+
import { Component, type FocusEventHandler, type KeyboardEventHandler, type MouseEventHandler } from 'react';
|
|
2
|
+
import { type BooleanLike } from '../common/react';
|
|
3
|
+
import { type BoxProps } from './Box';
|
|
4
4
|
type Props = Required<{
|
|
5
5
|
/** Highest possible value. */
|
|
6
6
|
maxValue: number;
|
|
@@ -12,21 +12,13 @@ type Props = Required<{
|
|
|
12
12
|
value: number | string;
|
|
13
13
|
}> & Partial<{
|
|
14
14
|
/** Animates the value if it was changed externally. */
|
|
15
|
-
animated:
|
|
16
|
-
/** Custom class name. */
|
|
17
|
-
className: BoxProps['className'];
|
|
15
|
+
animated: boolean;
|
|
18
16
|
/** Makes the input field uneditable & non draggable to prevent user changes */
|
|
19
|
-
disabled:
|
|
20
|
-
/** Fill all available horizontal space. */
|
|
21
|
-
fluid: BooleanLike;
|
|
22
|
-
/** Input font size */
|
|
23
|
-
fontSize: CSSProperties['fontSize'];
|
|
17
|
+
disabled: boolean;
|
|
24
18
|
/** Format value using this function before displaying it. */
|
|
25
19
|
format: (value: number) => string;
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
/** Input line height */
|
|
29
|
-
lineHeight: CSSProperties['lineHeight'];
|
|
20
|
+
/** Adjusts the width to 100% of its parent container */
|
|
21
|
+
fluid: boolean;
|
|
30
22
|
/** An event which fires when you release the input or successfully enter a number. */
|
|
31
23
|
onChange: (value: number) => void;
|
|
32
24
|
/** An event which fires about every 500ms when you drag the input up and down, on release and on manual editing. */
|
|
@@ -35,9 +27,7 @@ type Props = Required<{
|
|
|
35
27
|
stepPixelSize: number;
|
|
36
28
|
/** Unit to display to the right of value. */
|
|
37
29
|
unit: string;
|
|
38
|
-
|
|
39
|
-
width: BoxProps['width'];
|
|
40
|
-
}>;
|
|
30
|
+
}> & BoxProps;
|
|
41
31
|
type State = {
|
|
42
32
|
currentValue: number;
|
|
43
33
|
dragging: BooleanLike;
|
|
@@ -51,7 +41,7 @@ type State = {
|
|
|
51
41
|
* to fine tune the value, or single click it to manually type a number.
|
|
52
42
|
*/
|
|
53
43
|
export declare class NumberInput extends Component<Props, State> {
|
|
54
|
-
inputRef: import(
|
|
44
|
+
inputRef: import("react").RefObject<HTMLInputElement | null>;
|
|
55
45
|
dragTimeout: NodeJS.Timeout;
|
|
56
46
|
dragInterval: NodeJS.Timeout;
|
|
57
47
|
state: State;
|