tgui-core 1.1.23 → 1.1.24
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/Section.module-qhQWhlUX.js +18 -0
- package/dist/assets/Section.css +1 -1
- package/dist/components/Button.d.ts +2 -0
- package/dist/components/Button.js +178 -175
- package/dist/components/Collapsible.d.ts +2 -0
- package/dist/components/Collapsible.js +24 -16
- package/dist/components/Input.js +47 -41
- package/dist/components/NoticeBox.d.ts +4 -1
- package/dist/components/NoticeBox.js +31 -30
- package/dist/components/NumberInput.js +49 -49
- package/dist/components/Section.d.ts +27 -34
- package/dist/components/Section.js +67 -60
- package/dist/components/StyleableSection.js +1 -1
- package/dist/components/Tabs.d.ts +1 -0
- package/dist/components/Tabs.js +69 -64
- package/dist/components/TextArea.js +36 -36
- package/dist/components/TimeDisplay.js +8 -8
- package/package.json +1 -1
- package/dist/Section.module-CLVHJ4yA.js +0 -15
package/dist/components/Input.js
CHANGED
|
@@ -1,82 +1,88 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { KEY as
|
|
4
|
-
import { classes as
|
|
1
|
+
import { jsxs as K, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V, useEffect as d } from "react";
|
|
3
|
+
import { KEY as j, isEscape as k } from "../common/keys.js";
|
|
4
|
+
import { classes as B } from "../common/react.js";
|
|
5
5
|
import { debounce as R } from "../common/timer.js";
|
|
6
6
|
import { Box as S } from "./Box.js";
|
|
7
|
-
import '../assets/Input.css';const
|
|
8
|
-
input:
|
|
9
|
-
fluid:
|
|
10
|
-
baseline:
|
|
11
|
-
inner:
|
|
12
|
-
monospace:
|
|
7
|
+
import '../assets/Input.css';const F = "_input_17i79_20", L = "_fluid_17i79_35", Y = "_baseline_17i79_40", q = "_inner_17i79_45", v = "_monospace_17i79_71", u = {
|
|
8
|
+
input: F,
|
|
9
|
+
fluid: L,
|
|
10
|
+
baseline: Y,
|
|
11
|
+
inner: q,
|
|
12
|
+
monospace: v
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function a(r) {
|
|
15
15
|
return typeof r != "number" && typeof r != "string" ? "" : String(r);
|
|
16
16
|
}
|
|
17
17
|
const z = R((r) => r(), 250);
|
|
18
18
|
function P(r) {
|
|
19
19
|
const {
|
|
20
|
-
autoFocus:
|
|
21
|
-
autoSelect:
|
|
20
|
+
autoFocus: _,
|
|
21
|
+
autoSelect: f,
|
|
22
22
|
className: b,
|
|
23
23
|
disabled: g,
|
|
24
24
|
expensive: T,
|
|
25
25
|
fluid: y,
|
|
26
26
|
maxLength: x,
|
|
27
27
|
monospace: h,
|
|
28
|
-
onChange:
|
|
28
|
+
onChange: t,
|
|
29
29
|
onEnter: i,
|
|
30
30
|
onEscape: o,
|
|
31
31
|
onInput: s,
|
|
32
|
-
placeholder:
|
|
33
|
-
selfClear:
|
|
34
|
-
value:
|
|
35
|
-
...
|
|
36
|
-
} = r,
|
|
32
|
+
placeholder: w,
|
|
33
|
+
selfClear: I,
|
|
34
|
+
value: c,
|
|
35
|
+
...N
|
|
36
|
+
} = r, l = V(null);
|
|
37
37
|
function D(e) {
|
|
38
|
-
var
|
|
38
|
+
var p;
|
|
39
39
|
if (!s) return;
|
|
40
|
-
const
|
|
41
|
-
T ? z(() => s(e,
|
|
40
|
+
const n = (p = e.currentTarget) == null ? void 0 : p.value;
|
|
41
|
+
T ? z(() => s(e, n)) : s(e, n);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
if (e.key ===
|
|
45
|
-
i == null || i(e, e.currentTarget.value),
|
|
43
|
+
function E(e) {
|
|
44
|
+
if (e.key === j.Enter) {
|
|
45
|
+
i == null || i(e, e.currentTarget.value), I ? e.currentTarget.value = "" : (e.currentTarget.blur(), t == null || t(e, e.currentTarget.value));
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
e.key
|
|
48
|
+
k(e.key) && (o == null || o(e), e.currentTarget.value = a(c), e.currentTarget.blur());
|
|
49
49
|
}
|
|
50
|
-
return
|
|
51
|
-
const e =
|
|
50
|
+
return d(() => {
|
|
51
|
+
const e = l.current;
|
|
52
52
|
if (!e) return;
|
|
53
|
-
const
|
|
54
|
-
e.value !==
|
|
55
|
-
e.focus(),
|
|
53
|
+
const n = a(c);
|
|
54
|
+
e.value !== n && (e.value = n), !(!_ && !f) && setTimeout(() => {
|
|
55
|
+
e.focus(), f && e.select();
|
|
56
56
|
}, 1);
|
|
57
|
-
}, []),
|
|
57
|
+
}, []), d(() => {
|
|
58
|
+
const e = l.current;
|
|
59
|
+
if (!e || document.activeElement === e)
|
|
60
|
+
return;
|
|
61
|
+
const n = a(c);
|
|
62
|
+
e.value !== n && (e.value = n);
|
|
63
|
+
}), /* @__PURE__ */ K(
|
|
58
64
|
S,
|
|
59
65
|
{
|
|
60
|
-
className:
|
|
66
|
+
className: B([
|
|
61
67
|
u.input,
|
|
62
68
|
y && u.fluid,
|
|
63
69
|
h && u.monospace,
|
|
64
70
|
b
|
|
65
71
|
]),
|
|
66
|
-
...
|
|
72
|
+
...N,
|
|
67
73
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ m("div", { className: u.baseline, children: "." }),
|
|
75
|
+
/* @__PURE__ */ m(
|
|
70
76
|
"input",
|
|
71
77
|
{
|
|
72
78
|
className: u.inner,
|
|
73
79
|
disabled: g,
|
|
74
80
|
maxLength: x,
|
|
75
|
-
onBlur: (e) =>
|
|
81
|
+
onBlur: (e) => t == null ? void 0 : t(e, e.target.value),
|
|
76
82
|
onChange: D,
|
|
77
|
-
onKeyDown:
|
|
78
|
-
placeholder:
|
|
79
|
-
ref:
|
|
83
|
+
onKeyDown: E,
|
|
84
|
+
placeholder: w,
|
|
85
|
+
ref: l
|
|
80
86
|
}
|
|
81
87
|
)
|
|
82
88
|
]
|
|
@@ -85,5 +91,5 @@ function P(r) {
|
|
|
85
91
|
}
|
|
86
92
|
export {
|
|
87
93
|
P as Input,
|
|
88
|
-
|
|
94
|
+
a as toInputValue
|
|
89
95
|
};
|
|
@@ -2,7 +2,7 @@ import { BoxProps } from './Box';
|
|
|
2
2
|
|
|
3
3
|
type Props = ExclusiveProps & BoxProps;
|
|
4
4
|
/** You MUST use only one or none */
|
|
5
|
-
type NoticeType = 'info' | 'success' | 'danger';
|
|
5
|
+
type NoticeType = 'info' | 'success' | 'warning' | 'danger';
|
|
6
6
|
type None = {
|
|
7
7
|
[K in NoticeType]?: undefined;
|
|
8
8
|
};
|
|
@@ -12,6 +12,9 @@ type ExclusiveProps = None | (Omit<None, 'info'> & {
|
|
|
12
12
|
}) | (Omit<None, 'success'> & {
|
|
13
13
|
/** Green notice */
|
|
14
14
|
success: boolean;
|
|
15
|
+
}) | (Omit<None, 'warning'> & {
|
|
16
|
+
/** Orange notice */
|
|
17
|
+
warning: boolean;
|
|
15
18
|
}) | (Omit<None, 'danger'> & {
|
|
16
19
|
/** Red notice */
|
|
17
20
|
danger: boolean;
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { classes as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { classes as i } from "../common/react.js";
|
|
3
3
|
import { Box as y } from "./Box.js";
|
|
4
|
-
import '../assets/NoticeBox.css';const m = "_noticeBox_56yom_17",
|
|
4
|
+
import '../assets/NoticeBox.css';const m = "_noticeBox_56yom_17", g = "_color__black_56yom_28", b = "_color__white_56yom_33", d = "_color__red_56yom_38", w = "_color__orange_56yom_43", p = "_color__yellow_56yom_48", u = "_color__olive_56yom_53", f = "_color__green_56yom_58", v = "_color__teal_56yom_63", x = "_color__blue_56yom_68", k = "_color__violet_56yom_73", B = "_color__purple_56yom_78", h = "_color__pink_56yom_83", N = "_color__brown_56yom_88", j = "_color__grey_56yom_93", q = "_color__good_56yom_103", z = "_color__average_56yom_108", A = "_color__bad_56yom_113", C = "_color__label_56yom_118", D = "_info_56yom_123", E = "_success_56yom_128", F = "_warning_56yom_133", G = "_danger_56yom_138", o = {
|
|
5
5
|
noticeBox: m,
|
|
6
|
-
color__black:
|
|
7
|
-
color__white:
|
|
8
|
-
color__red:
|
|
9
|
-
color__orange:
|
|
6
|
+
color__black: g,
|
|
7
|
+
color__white: b,
|
|
8
|
+
color__red: d,
|
|
9
|
+
color__orange: w,
|
|
10
10
|
color__yellow: p,
|
|
11
11
|
color__olive: u,
|
|
12
|
-
color__green:
|
|
13
|
-
color__teal:
|
|
14
|
-
color__blue:
|
|
15
|
-
color__violet:
|
|
16
|
-
color__purple:
|
|
17
|
-
color__pink:
|
|
18
|
-
color__brown:
|
|
19
|
-
color__grey:
|
|
12
|
+
color__green: f,
|
|
13
|
+
color__teal: v,
|
|
14
|
+
color__blue: x,
|
|
15
|
+
color__violet: k,
|
|
16
|
+
color__purple: B,
|
|
17
|
+
color__pink: h,
|
|
18
|
+
color__brown: N,
|
|
19
|
+
color__grey: j,
|
|
20
20
|
"color__light-grey": "_color__light-grey_56yom_98",
|
|
21
|
-
color__good:
|
|
22
|
-
color__average:
|
|
23
|
-
color__bad:
|
|
24
|
-
color__label:
|
|
25
|
-
info:
|
|
26
|
-
success:
|
|
27
|
-
warning:
|
|
28
|
-
danger:
|
|
21
|
+
color__good: q,
|
|
22
|
+
color__average: z,
|
|
23
|
+
color__bad: A,
|
|
24
|
+
color__label: C,
|
|
25
|
+
info: D,
|
|
26
|
+
success: E,
|
|
27
|
+
warning: F,
|
|
28
|
+
danger: G
|
|
29
29
|
};
|
|
30
|
-
function
|
|
31
|
-
const { className: r, color: _, info: l, success: e,
|
|
32
|
-
return /* @__PURE__ */
|
|
30
|
+
function K(c) {
|
|
31
|
+
const { className: r, color: _, info: l, success: e, warning: n, danger: s, ...t } = c;
|
|
32
|
+
return /* @__PURE__ */ a(
|
|
33
33
|
y,
|
|
34
34
|
{
|
|
35
|
-
className:
|
|
35
|
+
className: i([
|
|
36
36
|
o.noticeBox,
|
|
37
37
|
_ && o["color__" + _],
|
|
38
38
|
l && o.info,
|
|
39
39
|
e && o.success,
|
|
40
|
-
n && o.
|
|
40
|
+
n && o.warning,
|
|
41
|
+
s && o.danger,
|
|
41
42
|
r
|
|
42
43
|
]),
|
|
43
|
-
...
|
|
44
|
+
...t
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
47
|
}
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
+
K as NoticeBox
|
|
49
50
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import '../assets/NumberInput.css';var
|
|
2
|
-
var
|
|
3
|
-
var l = (c, d, e) =>
|
|
1
|
+
import '../assets/NumberInput.css';var N = Object.defineProperty;
|
|
2
|
+
var w = (c, d, e) => d in c ? N(c, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[d] = e;
|
|
3
|
+
var l = (c, d, e) => w(c, typeof d != "symbol" ? d + "" : d, e);
|
|
4
4
|
import { jsxs as _, jsx as g } from "react/jsx-runtime";
|
|
5
|
-
import { Component as
|
|
6
|
-
import { KEY as
|
|
5
|
+
import { Component as E, createRef as I } from "react";
|
|
6
|
+
import { KEY as D, isEscape as T } from "../common/keys.js";
|
|
7
7
|
import { clamp as h } from "../common/math.js";
|
|
8
|
-
import { classes as
|
|
9
|
-
import { AnimatedNumber as
|
|
10
|
-
import { Box as
|
|
11
|
-
const
|
|
12
|
-
numberInput:
|
|
13
|
-
fluid:
|
|
14
|
-
content:
|
|
15
|
-
barContainer:
|
|
16
|
-
bar:
|
|
17
|
-
inner:
|
|
8
|
+
import { classes as F } from "../common/react.js";
|
|
9
|
+
import { AnimatedNumber as M } from "./AnimatedNumber.js";
|
|
10
|
+
import { Box as R } from "./Box.js";
|
|
11
|
+
const B = "_numberInput_4xyrw_20", K = "_fluid_4xyrw_36", L = "_content_4xyrw_40", Y = "_barContainer_4xyrw_44", j = "_bar_4xyrw_44", k = "_inner_4xyrw_61", p = {
|
|
12
|
+
numberInput: B,
|
|
13
|
+
fluid: K,
|
|
14
|
+
content: L,
|
|
15
|
+
barContainer: Y,
|
|
16
|
+
bar: j,
|
|
17
|
+
inner: k
|
|
18
18
|
};
|
|
19
|
-
class
|
|
19
|
+
class q extends E {
|
|
20
20
|
constructor(e) {
|
|
21
21
|
super(e);
|
|
22
22
|
// Ref to the input field to set focus & highlight
|
|
23
|
-
l(this, "inputRef",
|
|
23
|
+
l(this, "inputRef", I());
|
|
24
24
|
// After this time has elapsed we are in drag mode so no editing when dragging ends
|
|
25
25
|
l(this, "dragTimeout");
|
|
26
26
|
// Call onDrag at this interval
|
|
@@ -34,16 +34,16 @@ class $ extends I {
|
|
|
34
34
|
origin: 0
|
|
35
35
|
});
|
|
36
36
|
l(this, "handleDragStart", (e) => {
|
|
37
|
-
const { value: a, disabled: u } = this.props, { editing:
|
|
38
|
-
if (u ||
|
|
37
|
+
const { value: a, disabled: u } = this.props, { editing: i } = this.state;
|
|
38
|
+
if (u || i)
|
|
39
39
|
return;
|
|
40
40
|
document.body.style["pointer-events"] = "none";
|
|
41
|
-
const
|
|
41
|
+
const n = parseFloat(a.toString());
|
|
42
42
|
this.setState({
|
|
43
43
|
dragging: !1,
|
|
44
44
|
origin: e.screenY,
|
|
45
|
-
currentValue:
|
|
46
|
-
previousValue:
|
|
45
|
+
currentValue: n,
|
|
46
|
+
previousValue: n
|
|
47
47
|
}), this.dragTimeout = setTimeout(() => {
|
|
48
48
|
this.setState({
|
|
49
49
|
dragging: !0
|
|
@@ -56,17 +56,17 @@ class $ extends I {
|
|
|
56
56
|
}, 400), document.addEventListener("mousemove", this.handleDragMove), document.addEventListener("mouseup", this.handleDragEnd);
|
|
57
57
|
});
|
|
58
58
|
l(this, "handleDragMove", (e) => {
|
|
59
|
-
const { minValue: a, maxValue: u, step:
|
|
59
|
+
const { minValue: a, maxValue: u, step: i, stepPixelSize: n, disabled: o } = this.props;
|
|
60
60
|
o || this.setState((s) => {
|
|
61
61
|
const t = { ...s }, r = t.origin - e.screenY;
|
|
62
62
|
if (s.dragging) {
|
|
63
|
-
const f = isFinite(a) ? a %
|
|
63
|
+
const f = isFinite(a) ? a % i : 0;
|
|
64
64
|
t.currentValue = h(
|
|
65
|
-
t.currentValue + r *
|
|
66
|
-
a -
|
|
67
|
-
u +
|
|
65
|
+
t.currentValue + r * i / (n || 1),
|
|
66
|
+
a - i,
|
|
67
|
+
u + i
|
|
68
68
|
), t.currentValue = h(
|
|
69
|
-
t.currentValue - t.currentValue %
|
|
69
|
+
t.currentValue - t.currentValue % i + f,
|
|
70
70
|
a,
|
|
71
71
|
u
|
|
72
72
|
), t.origin = e.screenY;
|
|
@@ -75,14 +75,14 @@ class $ extends I {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
l(this, "handleDragEnd", (e) => {
|
|
78
|
-
const { dragging: a, currentValue: u } = this.state, { onDrag:
|
|
78
|
+
const { dragging: a, currentValue: u } = this.state, { onDrag: i, onChange: n, disabled: o } = this.props;
|
|
79
79
|
if (!o) {
|
|
80
80
|
if (document.body.style["pointer-events"] = "auto", clearInterval(this.dragInterval), clearTimeout(this.dragTimeout), this.setState({
|
|
81
81
|
dragging: !1,
|
|
82
82
|
editing: !a,
|
|
83
83
|
previousValue: u
|
|
84
84
|
}), a)
|
|
85
|
-
|
|
85
|
+
n == null || n(u), i == null || i(u);
|
|
86
86
|
else if (this.inputRef) {
|
|
87
87
|
const s = this.inputRef.current;
|
|
88
88
|
s && (s.value = `${u}`, setTimeout(() => {
|
|
@@ -93,13 +93,13 @@ class $ extends I {
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
l(this, "handleBlur", (e) => {
|
|
96
|
-
const { editing: a, previousValue: u } = this.state, { minValue:
|
|
96
|
+
const { editing: a, previousValue: u } = this.state, { minValue: i, maxValue: n, onChange: o, onDrag: s, disabled: t } = this.props;
|
|
97
97
|
if (t || !a)
|
|
98
98
|
return;
|
|
99
99
|
const r = h(
|
|
100
100
|
parseFloat(e.target.value),
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
i,
|
|
102
|
+
n
|
|
103
103
|
);
|
|
104
104
|
if (isNaN(r)) {
|
|
105
105
|
this.setState({
|
|
@@ -114,11 +114,11 @@ class $ extends I {
|
|
|
114
114
|
}), u !== r && (o == null || o(r), s == null || s(r));
|
|
115
115
|
});
|
|
116
116
|
l(this, "handleKeyDown", (e) => {
|
|
117
|
-
const { minValue: a, maxValue: u, onChange:
|
|
117
|
+
const { minValue: a, maxValue: u, onChange: i, onDrag: n, disabled: o } = this.props;
|
|
118
118
|
if (o)
|
|
119
119
|
return;
|
|
120
120
|
const { previousValue: s } = this.state;
|
|
121
|
-
if (e.key ===
|
|
121
|
+
if (e.key === D.Enter) {
|
|
122
122
|
const t = h(
|
|
123
123
|
parseFloat(e.currentTarget.value),
|
|
124
124
|
a,
|
|
@@ -134,8 +134,8 @@ class $ extends I {
|
|
|
134
134
|
editing: !1,
|
|
135
135
|
currentValue: t,
|
|
136
136
|
previousValue: t
|
|
137
|
-
}), s !== t && (
|
|
138
|
-
} else e.key
|
|
137
|
+
}), s !== t && (i == null || i(t), n == null || n(t));
|
|
138
|
+
} else T(e.key) && this.setState({
|
|
139
139
|
editing: !1
|
|
140
140
|
});
|
|
141
141
|
});
|
|
@@ -149,34 +149,34 @@ class $ extends I {
|
|
|
149
149
|
}
|
|
150
150
|
render() {
|
|
151
151
|
const { dragging: e, editing: a, currentValue: u } = this.state, {
|
|
152
|
-
className:
|
|
153
|
-
fluid:
|
|
152
|
+
className: i,
|
|
153
|
+
fluid: n,
|
|
154
154
|
animated: o,
|
|
155
155
|
unit: s,
|
|
156
156
|
value: t,
|
|
157
157
|
minValue: r,
|
|
158
158
|
maxValue: f,
|
|
159
159
|
height: v,
|
|
160
|
-
width:
|
|
160
|
+
width: S,
|
|
161
161
|
lineHeight: b,
|
|
162
162
|
fontSize: y,
|
|
163
163
|
format: V
|
|
164
164
|
} = this.props;
|
|
165
165
|
let m = parseFloat(t.toString());
|
|
166
166
|
e && (m = u);
|
|
167
|
-
const
|
|
168
|
-
o && !e ? /* @__PURE__ */ g(
|
|
167
|
+
const x = /* @__PURE__ */ _("div", { className: p.content, children: [
|
|
168
|
+
o && !e ? /* @__PURE__ */ g(M, { value: m, format: V }) : V ? V(m) : m,
|
|
169
169
|
s ? " " + s : ""
|
|
170
170
|
] });
|
|
171
171
|
return /* @__PURE__ */ _(
|
|
172
|
-
|
|
172
|
+
R,
|
|
173
173
|
{
|
|
174
|
-
className:
|
|
174
|
+
className: F([
|
|
175
175
|
p.numberInput,
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
n && p.fluid,
|
|
177
|
+
i
|
|
178
178
|
]),
|
|
179
|
-
minWidth:
|
|
179
|
+
minWidth: S,
|
|
180
180
|
minHeight: v,
|
|
181
181
|
lineHeight: b,
|
|
182
182
|
fontSize: y,
|
|
@@ -195,7 +195,7 @@ class $ extends I {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
) }),
|
|
198
|
-
|
|
198
|
+
x,
|
|
199
199
|
/* @__PURE__ */ g(
|
|
200
200
|
"input",
|
|
201
201
|
{
|
|
@@ -217,5 +217,5 @@ class $ extends I {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
export {
|
|
220
|
-
|
|
220
|
+
q as NumberInput
|
|
221
221
|
};
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from './Box';
|
|
2
3
|
|
|
4
|
+
type Props = Partial<{
|
|
5
|
+
/** Buttons to render aside the section title. */
|
|
6
|
+
buttons: ReactNode;
|
|
7
|
+
/** id to assosiate with the parent div element used by this section, for uses with procs like getElementByID */
|
|
8
|
+
container_id: string;
|
|
9
|
+
/** If true, fills all available vertical space. */
|
|
10
|
+
fill: boolean;
|
|
11
|
+
/** If true, removes all section padding. */
|
|
12
|
+
fitted: boolean;
|
|
13
|
+
/** If true, fills the area without forcing height to 100% */
|
|
14
|
+
flexGrow: boolean;
|
|
15
|
+
/** If true, removes the section top padding */
|
|
16
|
+
noTopPadding: boolean;
|
|
17
|
+
/** @member Callback function for the `scroll` event */
|
|
18
|
+
onScroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
19
|
+
/** Shows or hides the scrollbar. */
|
|
20
|
+
scrollable: boolean;
|
|
21
|
+
/** Shows or hides the horizontal scrollbar. */
|
|
22
|
+
scrollableHorizontal: boolean;
|
|
23
|
+
/** If true, filly the area except for -3rem */
|
|
24
|
+
stretchContents: boolean;
|
|
25
|
+
/** Title of the section. */
|
|
26
|
+
title: ReactNode;
|
|
27
|
+
}> & BoxProps;
|
|
3
28
|
/**
|
|
4
29
|
* ## Section
|
|
5
30
|
* Section is a surface that displays content and actions on a single topic.
|
|
@@ -27,37 +52,5 @@ import { ReactNode } from 'react';
|
|
|
27
52
|
* </Section>
|
|
28
53
|
* ```
|
|
29
54
|
*/
|
|
30
|
-
export declare const Section: import(
|
|
31
|
-
|
|
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>>;
|
|
55
|
+
export declare const Section: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export {};
|
|
@@ -1,62 +1,69 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { addScrollableNode as
|
|
4
|
-
import { classes as
|
|
5
|
-
import { s as
|
|
6
|
-
import { computeBoxClassName as
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as P, useEffect as g } from "react";
|
|
3
|
+
import { addScrollableNode as j, removeScrollableNode as z } from "../common/events.js";
|
|
4
|
+
import { classes as d, canRender as m } from "../common/react.js";
|
|
5
|
+
import { s as e } from "../Section.module-qhQWhlUX.js";
|
|
6
|
+
import { computeBoxClassName as B, computeBoxProps as H } from "./Box.js";
|
|
7
|
+
const _ = (f) => {
|
|
8
|
+
const {
|
|
9
|
+
buttons: o,
|
|
10
|
+
children: u,
|
|
11
|
+
className: p,
|
|
12
|
+
fill: N,
|
|
13
|
+
fitted: h,
|
|
14
|
+
flexGrow: b,
|
|
15
|
+
noTopPadding: x,
|
|
16
|
+
onScroll: v,
|
|
17
|
+
scrollable: s,
|
|
18
|
+
scrollableHorizontal: n,
|
|
19
|
+
stretchContents: S,
|
|
20
|
+
title: c,
|
|
21
|
+
container_id: T,
|
|
22
|
+
...i
|
|
23
|
+
} = f, t = P(null), C = m(c) || m(o);
|
|
24
|
+
return g(() => {
|
|
25
|
+
if (!(t != null && t.current) || !s && !n) return;
|
|
26
|
+
const l = t.current;
|
|
27
|
+
return j(l), () => {
|
|
28
|
+
l && z(l);
|
|
29
|
+
};
|
|
30
|
+
}, []), /* @__PURE__ */ a(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
id: T || "",
|
|
34
|
+
className: d([
|
|
35
|
+
e.section,
|
|
36
|
+
N && e.fill,
|
|
37
|
+
h && e.fitted,
|
|
38
|
+
s && e.scrollable,
|
|
39
|
+
n && e.scrollableHorizontal,
|
|
40
|
+
b && e.sectionFlex,
|
|
41
|
+
p,
|
|
42
|
+
B(i)
|
|
43
|
+
]),
|
|
44
|
+
...H(i),
|
|
45
|
+
children: [
|
|
46
|
+
C && /* @__PURE__ */ a("div", { className: e.title, children: [
|
|
47
|
+
/* @__PURE__ */ r("span", { className: e.titleText, children: c }),
|
|
48
|
+
/* @__PURE__ */ r("div", { className: e.buttons, children: o })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ r("div", { className: e.rest, children: /* @__PURE__ */ r(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: d([
|
|
54
|
+
e.content,
|
|
55
|
+
!!S && e.stretchContents,
|
|
56
|
+
!!x && e.noTopPadding
|
|
57
|
+
]),
|
|
58
|
+
onScroll: v,
|
|
59
|
+
ref: t,
|
|
60
|
+
children: u
|
|
61
|
+
}
|
|
62
|
+
) })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
60
67
|
export {
|
|
61
|
-
|
|
68
|
+
_ as Section
|
|
62
69
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as s, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { s as t } from "../Section.module-
|
|
2
|
+
import { s as t } from "../Section.module-qhQWhlUX.js";
|
|
3
3
|
import { Box as e } from "./Box.js";
|
|
4
4
|
function h(i) {
|
|
5
5
|
const { children: r, titleStyle: c, titleSubtext: n, title: o, textStyle: a, style: m } = i;
|