tgui-core 1.5.6 → 1.5.7
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/components/AnimatedNumber.d.ts +2 -2
- package/dist/components/Button.d.ts +29 -12
- package/dist/components/Button.js +95 -97
- package/dist/components/DmIcon.d.ts +1 -1
- package/dist/components/DmIcon.js +19 -17
- package/dist/components/Icon.d.ts +17 -5
- package/dist/components/Icon.js +24 -22
- package/dist/components/ImageButton.d.ts +14 -5
- package/dist/components/ImageButton.js +97 -81
- package/dist/components/LabeledList.d.ts +34 -31
- package/dist/components/LabeledList.js +19 -18
- package/dist/components/Table.d.ts +28 -20
- package/dist/components/Table.js +7 -6
- package/dist/components/Tabs.d.ts +22 -16
- package/dist/components/Tabs.js +33 -30
- package/package.json +1 -1
|
@@ -9,13 +9,13 @@ type Props = {
|
|
|
9
9
|
* If provided, a function that formats the inner string. By default,
|
|
10
10
|
* attempts to match the numeric precision of `value`.
|
|
11
11
|
*/
|
|
12
|
-
format
|
|
12
|
+
format: (value: number) => string;
|
|
13
13
|
/**
|
|
14
14
|
* If provided, the initial value displayed. By default, the same as `value`.
|
|
15
15
|
* If `initial` and `value` are different, the component immediately starts
|
|
16
16
|
* animating.
|
|
17
17
|
*/
|
|
18
|
-
initial
|
|
18
|
+
initial: number;
|
|
19
19
|
}>;
|
|
20
20
|
/**
|
|
21
21
|
* ## AnimatedNumber
|
|
@@ -54,21 +54,11 @@ type Props = Partial<{
|
|
|
54
54
|
/** Align content vertically using flex. Use lineHeight if the height is static. */
|
|
55
55
|
verticalAlignContent: string;
|
|
56
56
|
}> & EllipsisUnion & BoxProps;
|
|
57
|
-
/**
|
|
58
|
-
* ## Button
|
|
59
|
-
* Buttons allow users to take actions, and make choices, with a single click.
|
|
60
|
-
*/
|
|
61
57
|
export declare function Button(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
62
|
-
export declare namespace Button {
|
|
63
|
-
var Checkbox: typeof ButtonCheckbox;
|
|
64
|
-
var Confirm: typeof ButtonConfirm;
|
|
65
|
-
var Input: typeof ButtonInput;
|
|
66
|
-
var File: typeof ButtonFile;
|
|
67
|
-
}
|
|
68
58
|
type CheckProps = Partial<{
|
|
69
59
|
checked: BooleanLike;
|
|
70
60
|
}> & Props;
|
|
71
|
-
|
|
61
|
+
declare function ButtonCheckbox(props: CheckProps): import("react/jsx-runtime").JSX.Element;
|
|
72
62
|
type ConfirmProps = Partial<{
|
|
73
63
|
confirmColor: string;
|
|
74
64
|
confirmContent: ReactNode;
|
|
@@ -78,7 +68,6 @@ declare function ButtonConfirm(props: ConfirmProps): import("react/jsx-runtime")
|
|
|
78
68
|
type InputProps = Partial<{
|
|
79
69
|
currentValue: string;
|
|
80
70
|
defaultValue: string;
|
|
81
|
-
fluid: boolean;
|
|
82
71
|
maxLength: number;
|
|
83
72
|
onCommit: (e: any, value: string) => void;
|
|
84
73
|
placeholder: string;
|
|
@@ -90,4 +79,32 @@ type FileProps = {
|
|
|
90
79
|
onSelectFiles: (files: string | string[]) => void;
|
|
91
80
|
} & Props;
|
|
92
81
|
declare function ButtonFile(props: FileProps): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* ## Button
|
|
84
|
+
* Buttons allow users to take actions, and make choices, with a single click.
|
|
85
|
+
*/
|
|
86
|
+
export declare namespace Button {
|
|
87
|
+
/**
|
|
88
|
+
* ## Button.Checkbox
|
|
89
|
+
* A ghetto checkbox, made entirely using existing Button API.
|
|
90
|
+
*/
|
|
91
|
+
const Checkbox: typeof ButtonCheckbox;
|
|
92
|
+
/**
|
|
93
|
+
* ## Button.Confirm
|
|
94
|
+
* A button with an extra confirmation step, using native button component.
|
|
95
|
+
*/
|
|
96
|
+
const Confirm: typeof ButtonConfirm;
|
|
97
|
+
/**
|
|
98
|
+
* ## Button.Input
|
|
99
|
+
* A button that turns into an input box after the first click.
|
|
100
|
+
*
|
|
101
|
+
* Turns back into a button after the user hits enter, defocuses, or hits escape. Enter and defocus commit, while escape cancels.
|
|
102
|
+
*/
|
|
103
|
+
const Input: typeof ButtonInput;
|
|
104
|
+
/**
|
|
105
|
+
* ## Button.File
|
|
106
|
+
* Accepts file input, based on the native element.
|
|
107
|
+
*/
|
|
108
|
+
const File: typeof ButtonFile;
|
|
109
|
+
}
|
|
93
110
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as _, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import { useState as A, createRef as V, useEffect as $, useRef as z } from "react";
|
|
3
3
|
import { KEY as D, isEscape as E } from "../common/keys.js";
|
|
4
4
|
import { classes as F } from "../common/react.js";
|
|
@@ -6,55 +6,55 @@ import { computeBoxClassName as j, computeBoxProps as q } from "../common/ui.js"
|
|
|
6
6
|
import { Box as O } from "./Box.js";
|
|
7
7
|
import { Icon as S } from "./Icon.js";
|
|
8
8
|
import { Tooltip as v } from "./Tooltip.js";
|
|
9
|
-
function
|
|
9
|
+
function N(o) {
|
|
10
10
|
const {
|
|
11
|
-
captureKeys:
|
|
12
|
-
children:
|
|
11
|
+
captureKeys: s = !0,
|
|
12
|
+
children: u,
|
|
13
13
|
circular: m,
|
|
14
14
|
className: d,
|
|
15
|
-
color:
|
|
15
|
+
color: l,
|
|
16
16
|
compact: h,
|
|
17
17
|
content: B,
|
|
18
18
|
disabled: t,
|
|
19
|
-
ellipsis:
|
|
20
|
-
fluid:
|
|
21
|
-
icon:
|
|
19
|
+
ellipsis: c,
|
|
20
|
+
fluid: e,
|
|
21
|
+
icon: i,
|
|
22
22
|
iconColor: a,
|
|
23
23
|
iconPosition: C,
|
|
24
|
-
iconRotation:
|
|
24
|
+
iconRotation: I,
|
|
25
25
|
iconSize: R,
|
|
26
26
|
iconSpin: P,
|
|
27
27
|
onClick: f,
|
|
28
|
-
selected:
|
|
29
|
-
tooltip:
|
|
28
|
+
selected: x,
|
|
29
|
+
tooltip: g,
|
|
30
30
|
tooltipPosition: w,
|
|
31
31
|
verticalAlignContent: y,
|
|
32
|
-
...
|
|
33
|
-
} =
|
|
34
|
-
let k = /* @__PURE__ */
|
|
32
|
+
...b
|
|
33
|
+
} = o, n = B || u;
|
|
34
|
+
let k = /* @__PURE__ */ r(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: F([
|
|
38
38
|
"Button",
|
|
39
|
-
|
|
39
|
+
e && "Button--fluid",
|
|
40
40
|
t && "Button--disabled",
|
|
41
|
-
|
|
41
|
+
x && "Button--selected",
|
|
42
42
|
m && "Button--circular",
|
|
43
43
|
h && "Button--compact",
|
|
44
44
|
C && `Button--iconPosition--${C}`,
|
|
45
45
|
y && "Button--flex",
|
|
46
|
-
y &&
|
|
46
|
+
y && e && "Button--flex--fluid",
|
|
47
47
|
y && `Button--verticalAlignContent--${y}`,
|
|
48
|
-
|
|
48
|
+
l && typeof l == "string" ? `Button--color--${l}` : "Button--color--default",
|
|
49
49
|
d,
|
|
50
|
-
j(
|
|
50
|
+
j(b)
|
|
51
51
|
]),
|
|
52
52
|
tabIndex: t ? void 0 : 0,
|
|
53
53
|
onClick: (p) => {
|
|
54
54
|
!t && f && f(p);
|
|
55
55
|
},
|
|
56
56
|
onKeyDown: (p) => {
|
|
57
|
-
if (
|
|
57
|
+
if (s) {
|
|
58
58
|
if (p.key === D.Space || p.key === D.Enter) {
|
|
59
59
|
p.preventDefault(), !t && f && f(p);
|
|
60
60
|
return;
|
|
@@ -62,36 +62,36 @@ function x(u) {
|
|
|
62
62
|
E(p.key) && p.preventDefault();
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
...q(
|
|
65
|
+
...q(b),
|
|
66
66
|
children: /* @__PURE__ */ _("div", { className: "Button__content", children: [
|
|
67
|
-
|
|
67
|
+
i && C !== "right" && /* @__PURE__ */ r(
|
|
68
68
|
S,
|
|
69
69
|
{
|
|
70
70
|
mr: n ? 0.5 : 0,
|
|
71
|
-
name:
|
|
71
|
+
name: i,
|
|
72
72
|
color: a,
|
|
73
|
-
rotation:
|
|
73
|
+
rotation: I,
|
|
74
74
|
size: R,
|
|
75
75
|
spin: P
|
|
76
76
|
}
|
|
77
77
|
),
|
|
78
|
-
|
|
78
|
+
c ? /* @__PURE__ */ r(
|
|
79
79
|
"span",
|
|
80
80
|
{
|
|
81
81
|
className: F([
|
|
82
82
|
"Button--ellipsis",
|
|
83
|
-
|
|
83
|
+
i && "Button__textMargin"
|
|
84
84
|
]),
|
|
85
85
|
children: n
|
|
86
86
|
}
|
|
87
87
|
) : n,
|
|
88
|
-
|
|
88
|
+
i && C === "right" && /* @__PURE__ */ r(
|
|
89
89
|
S,
|
|
90
90
|
{
|
|
91
91
|
ml: n ? 0.5 : 0,
|
|
92
|
-
name:
|
|
92
|
+
name: i,
|
|
93
93
|
color: a,
|
|
94
|
-
rotation:
|
|
94
|
+
rotation: I,
|
|
95
95
|
size: R,
|
|
96
96
|
spin: P
|
|
97
97
|
}
|
|
@@ -99,78 +99,76 @@ function x(u) {
|
|
|
99
99
|
] })
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
-
return
|
|
102
|
+
return g && (k = /* @__PURE__ */ r(v, { content: g, position: w, children: k })), k;
|
|
103
103
|
}
|
|
104
|
-
function T(
|
|
105
|
-
const { checked:
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
|
|
104
|
+
function T(o) {
|
|
105
|
+
const { checked: s, ...u } = o;
|
|
106
|
+
return /* @__PURE__ */ r(
|
|
107
|
+
N,
|
|
108
108
|
{
|
|
109
109
|
color: "transparent",
|
|
110
|
-
icon:
|
|
111
|
-
selected:
|
|
112
|
-
...
|
|
110
|
+
icon: s ? "check-square-o" : "square-o",
|
|
111
|
+
selected: s,
|
|
112
|
+
...u
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
function L(u) {
|
|
116
|
+
function L(o) {
|
|
118
117
|
const {
|
|
119
|
-
children:
|
|
120
|
-
color:
|
|
118
|
+
children: s,
|
|
119
|
+
color: u,
|
|
121
120
|
confirmColor: m = "bad",
|
|
122
121
|
confirmContent: d = "Confirm?",
|
|
123
|
-
confirmIcon:
|
|
122
|
+
confirmIcon: l,
|
|
124
123
|
ellipsis: h = !0,
|
|
125
124
|
icon: B,
|
|
126
125
|
onClick: t,
|
|
127
|
-
...
|
|
128
|
-
} =
|
|
126
|
+
...c
|
|
127
|
+
} = o, [e, i] = A(!1);
|
|
129
128
|
function a(C) {
|
|
130
|
-
if (!
|
|
131
|
-
|
|
129
|
+
if (!e) {
|
|
130
|
+
i(!0);
|
|
132
131
|
return;
|
|
133
132
|
}
|
|
134
|
-
t == null || t(C),
|
|
133
|
+
t == null || t(C), i(!1);
|
|
135
134
|
}
|
|
136
|
-
return /* @__PURE__ */
|
|
137
|
-
|
|
135
|
+
return /* @__PURE__ */ r(
|
|
136
|
+
N,
|
|
138
137
|
{
|
|
139
|
-
icon:
|
|
140
|
-
color:
|
|
138
|
+
icon: e ? l : B,
|
|
139
|
+
color: e ? m : u,
|
|
141
140
|
onClick: a,
|
|
142
|
-
...
|
|
143
|
-
children:
|
|
141
|
+
...c,
|
|
142
|
+
children: e ? d : s
|
|
144
143
|
}
|
|
145
144
|
);
|
|
146
145
|
}
|
|
147
|
-
|
|
148
|
-
function M(u) {
|
|
146
|
+
function M(o) {
|
|
149
147
|
const {
|
|
150
|
-
children:
|
|
151
|
-
color:
|
|
148
|
+
children: s,
|
|
149
|
+
color: u = "default",
|
|
152
150
|
content: m,
|
|
153
151
|
currentValue: d,
|
|
154
|
-
defaultValue:
|
|
152
|
+
defaultValue: l,
|
|
155
153
|
disabled: h,
|
|
156
154
|
fluid: B,
|
|
157
155
|
icon: t,
|
|
158
|
-
iconRotation:
|
|
159
|
-
iconSpin:
|
|
160
|
-
maxLength:
|
|
156
|
+
iconRotation: c,
|
|
157
|
+
iconSpin: e,
|
|
158
|
+
maxLength: i,
|
|
161
159
|
onCommit: a = () => null,
|
|
162
160
|
placeholder: C,
|
|
163
|
-
tooltip:
|
|
161
|
+
tooltip: I,
|
|
164
162
|
tooltipPosition: R,
|
|
165
163
|
...P
|
|
166
|
-
} =
|
|
164
|
+
} = o, [f, x] = A(!1), g = V(), w = m || s;
|
|
167
165
|
function y(n) {
|
|
168
|
-
const k =
|
|
166
|
+
const k = g.current;
|
|
169
167
|
if (!k) return;
|
|
170
|
-
k.value !== "" ? a(n, k.value) :
|
|
168
|
+
k.value !== "" ? a(n, k.value) : l && a(n, l);
|
|
171
169
|
}
|
|
172
170
|
$(() => {
|
|
173
|
-
const n =
|
|
171
|
+
const n = g.current;
|
|
174
172
|
if (n && f) {
|
|
175
173
|
n.value = d || "";
|
|
176
174
|
try {
|
|
@@ -179,86 +177,86 @@ function M(u) {
|
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
179
|
}, [f, d]);
|
|
182
|
-
let
|
|
180
|
+
let b = /* @__PURE__ */ _(
|
|
183
181
|
O,
|
|
184
182
|
{
|
|
185
183
|
className: F([
|
|
186
184
|
"Button",
|
|
187
185
|
B && "Button--fluid",
|
|
188
186
|
h && "Button--disabled",
|
|
189
|
-
`Button--color--${
|
|
187
|
+
`Button--color--${u}`
|
|
190
188
|
]),
|
|
191
189
|
...P,
|
|
192
|
-
onClick: () =>
|
|
190
|
+
onClick: () => x(!0),
|
|
193
191
|
children: [
|
|
194
|
-
t && /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */
|
|
192
|
+
t && /* @__PURE__ */ r(S, { name: t, rotation: c, spin: e }),
|
|
193
|
+
/* @__PURE__ */ r("div", { children: w }),
|
|
194
|
+
/* @__PURE__ */ r(
|
|
197
195
|
"input",
|
|
198
196
|
{
|
|
199
197
|
disabled: !!h,
|
|
200
|
-
ref:
|
|
198
|
+
ref: g,
|
|
201
199
|
className: "NumberInput__input",
|
|
202
200
|
style: {
|
|
203
201
|
display: f ? "" : "none",
|
|
204
202
|
textAlign: "left"
|
|
205
203
|
},
|
|
206
204
|
onBlur: (n) => {
|
|
207
|
-
f && (
|
|
205
|
+
f && (x(!1), y(n));
|
|
208
206
|
},
|
|
209
207
|
onKeyDown: (n) => {
|
|
210
208
|
if (n.key === D.Enter) {
|
|
211
|
-
|
|
209
|
+
x(!1), y(n);
|
|
212
210
|
return;
|
|
213
211
|
}
|
|
214
|
-
E(n.key) &&
|
|
212
|
+
E(n.key) && x(!1);
|
|
215
213
|
}
|
|
216
214
|
}
|
|
217
215
|
)
|
|
218
216
|
]
|
|
219
217
|
}
|
|
220
218
|
);
|
|
221
|
-
return
|
|
219
|
+
return I && (b = /* @__PURE__ */ r(v, { content: I, position: R, children: b })), b;
|
|
222
220
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const { accept: l, multiple: s, onSelectFiles: m, ...d } = u, c = z(null);
|
|
221
|
+
function Y(o) {
|
|
222
|
+
const { accept: s, multiple: u, onSelectFiles: m, ...d } = o, l = z(null);
|
|
226
223
|
async function h(t) {
|
|
227
|
-
const
|
|
228
|
-
const
|
|
224
|
+
const c = Array.from(t).map((e) => {
|
|
225
|
+
const i = new FileReader();
|
|
229
226
|
return new Promise((a) => {
|
|
230
|
-
|
|
227
|
+
i.onload = () => a(i.result), i.readAsText(e);
|
|
231
228
|
});
|
|
232
229
|
});
|
|
233
|
-
return await Promise.all(
|
|
230
|
+
return await Promise.all(c);
|
|
234
231
|
}
|
|
235
232
|
async function B(t) {
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
239
|
-
m(
|
|
233
|
+
const c = t.target.files;
|
|
234
|
+
if (c != null && c.length) {
|
|
235
|
+
const e = await h(c);
|
|
236
|
+
m(u ? e : e[0]);
|
|
240
237
|
}
|
|
241
238
|
}
|
|
242
239
|
return /* @__PURE__ */ _(K, { children: [
|
|
243
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ r(N, { onClick: () => {
|
|
244
241
|
var t;
|
|
245
|
-
return (t =
|
|
242
|
+
return (t = l.current) == null ? void 0 : t.click();
|
|
246
243
|
}, ...d }),
|
|
247
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ r(
|
|
248
245
|
"input",
|
|
249
246
|
{
|
|
250
247
|
hidden: !0,
|
|
251
248
|
type: "file",
|
|
252
|
-
ref:
|
|
253
|
-
accept:
|
|
254
|
-
multiple:
|
|
249
|
+
ref: l,
|
|
250
|
+
accept: s,
|
|
251
|
+
multiple: u,
|
|
255
252
|
onChange: B
|
|
256
253
|
}
|
|
257
254
|
)
|
|
258
255
|
] });
|
|
259
256
|
}
|
|
260
|
-
|
|
257
|
+
((o) => {
|
|
258
|
+
o.Checkbox = T, o.Confirm = L, o.Input = M, o.File = Y;
|
|
259
|
+
})(N || (N = {}));
|
|
261
260
|
export {
|
|
262
|
-
|
|
263
|
-
T as ButtonCheckbox
|
|
261
|
+
N as Button
|
|
264
262
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Image as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as N } from "react/jsx-runtime";
|
|
2
|
+
import { Image as e } from "./Image.js";
|
|
3
|
+
var u = /* @__PURE__ */ ((T) => (T[T.NORTH = 1] = "NORTH", T[T.SOUTH = 2] = "SOUTH", T[T.EAST = 4] = "EAST", T[T.WEST = 8] = "WEST", T[T.NORTHEAST = 5] = "NORTHEAST", T[T.NORTHWEST = 9] = "NORTHWEST", T[T.SOUTHEAST = 6] = "SOUTHEAST", T[T.SOUTHWEST = 10] = "SOUTHWEST", T))(u || {});
|
|
4
|
+
function $(T) {
|
|
5
|
+
var m;
|
|
5
6
|
const {
|
|
6
|
-
className:
|
|
7
|
-
direction:
|
|
8
|
-
fallback:
|
|
9
|
-
frame:
|
|
10
|
-
icon_state:
|
|
11
|
-
icon:
|
|
12
|
-
movement:
|
|
13
|
-
...
|
|
14
|
-
} =
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
17
|
-
return /* @__PURE__ */
|
|
7
|
+
className: A,
|
|
8
|
+
direction: E = 2,
|
|
9
|
+
fallback: a,
|
|
10
|
+
frame: s = 1,
|
|
11
|
+
icon_state: H,
|
|
12
|
+
icon: O,
|
|
13
|
+
movement: f = !1,
|
|
14
|
+
...r
|
|
15
|
+
} = T, S = (m = Byond.iconRefMap) == null ? void 0 : m[O];
|
|
16
|
+
if (!S) return a;
|
|
17
|
+
const R = `${S}?state=${H}&dir=${E}&movement=${!!f}&frame=${s}`;
|
|
18
|
+
return /* @__PURE__ */ N(e, { fixErrors: !0, src: R, ...r });
|
|
18
19
|
}
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
u as Direction,
|
|
22
|
+
$ as DmIcon
|
|
21
23
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BooleanLike } from '../common/react';
|
|
2
2
|
import { BoxProps } from './Box';
|
|
3
3
|
type Props = {
|
|
4
|
-
/** Icon name.
|
|
4
|
+
/** Icon name. @see https://fontawesome.com/v6/search?o=r&m=free */
|
|
5
5
|
name: string;
|
|
6
6
|
} & Partial<{
|
|
7
7
|
/** Icon rotation, in degrees. */
|
|
@@ -11,6 +11,8 @@ type Props = {
|
|
|
11
11
|
/** Whether an icon should be spinning. Good for load indicators. */
|
|
12
12
|
spin: BooleanLike;
|
|
13
13
|
}> & Omit<BoxProps, 'children'>;
|
|
14
|
+
export declare function Icon(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function IconStack(props: BoxProps): import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
/**
|
|
15
17
|
* ## Icon
|
|
16
18
|
* Renders one of the FontAwesome icons of your choice.
|
|
@@ -19,11 +21,21 @@ type Props = {
|
|
|
19
21
|
* ```tsx
|
|
20
22
|
* <Icon name="plus" />
|
|
21
23
|
* ```
|
|
22
|
-
* @url https://fontawesome.com/
|
|
24
|
+
* @url https://fontawesome.com/v6/search?o=r&m=free
|
|
23
25
|
*/
|
|
24
|
-
export declare function Icon(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export declare namespace Icon {
|
|
26
|
-
|
|
27
|
+
/**
|
|
28
|
+
* ## Icon.Stack
|
|
29
|
+
* Renders children icons on top of each other in order to make your own icon.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Icon.Stack>
|
|
34
|
+
* <Icon name="pen" />
|
|
35
|
+
* <Icon name="slash" />
|
|
36
|
+
* </Icon.Stack>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
const Stack: typeof IconStack;
|
|
27
40
|
}
|
|
28
|
-
declare function IconStack(props: BoxProps): import("react/jsx-runtime").JSX.Element;
|
|
29
41
|
export {};
|
package/dist/components/Icon.js
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { classes as
|
|
3
|
-
import { computeBoxProps as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { classes as p } from "../common/react.js";
|
|
3
|
+
import { computeBoxProps as u, computeBoxClassName as N } from "../common/ui.js";
|
|
4
4
|
const f = /-o$/;
|
|
5
|
-
function
|
|
6
|
-
const { name: s = "", size:
|
|
7
|
-
|
|
8
|
-
const
|
|
5
|
+
function m(o) {
|
|
6
|
+
const { name: s = "", size: a, spin: e, className: x, rotation: r, ...c } = o, n = c.style || {};
|
|
7
|
+
a && (n.fontSize = `${a * 100}%`), r && (n.transform = `rotate(${r}deg)`), c.style = n;
|
|
8
|
+
const I = u(c);
|
|
9
9
|
let t = "";
|
|
10
10
|
if (s.startsWith("tg-"))
|
|
11
11
|
t = s;
|
|
12
12
|
else {
|
|
13
|
-
const
|
|
14
|
-
t =
|
|
13
|
+
const S = f.test(s), i = s.replace(f, ""), d = !i.startsWith("fa-");
|
|
14
|
+
t = S ? "far " : "fas ", d && (t += "fa-"), t += i, e && (t += " fa-spin");
|
|
15
15
|
}
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ l(
|
|
17
17
|
"i",
|
|
18
18
|
{
|
|
19
|
-
className:
|
|
19
|
+
className: p([
|
|
20
20
|
"Icon",
|
|
21
21
|
t,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
x,
|
|
23
|
+
N(c)
|
|
24
24
|
]),
|
|
25
|
-
...
|
|
25
|
+
...I
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function g(
|
|
30
|
-
const { className: s, children:
|
|
31
|
-
return /* @__PURE__ */
|
|
29
|
+
function g(o) {
|
|
30
|
+
const { className: s, children: a, ...e } = o;
|
|
31
|
+
return /* @__PURE__ */ l(
|
|
32
32
|
"span",
|
|
33
33
|
{
|
|
34
|
-
className:
|
|
35
|
-
...
|
|
36
|
-
children:
|
|
34
|
+
className: p(["IconStack", s, N(e)]),
|
|
35
|
+
...u(e),
|
|
36
|
+
children: a
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
((o) => {
|
|
41
|
+
o.Stack = g;
|
|
42
|
+
})(m || (m = {}));
|
|
41
43
|
export {
|
|
42
|
-
|
|
44
|
+
m as Icon
|
|
43
45
|
};
|
|
@@ -2,6 +2,7 @@ import { Placement } from '@popperjs/core';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { BooleanLike } from '../common/react';
|
|
4
4
|
import { BoxProps } from './Box';
|
|
5
|
+
import { Direction } from './DmIcon';
|
|
5
6
|
type Props = Partial<{
|
|
6
7
|
/** Asset cache. Example: `asset={['assetname32x32', thing.key]}` */
|
|
7
8
|
asset: string[];
|
|
@@ -15,11 +16,11 @@ type Props = Partial<{
|
|
|
15
16
|
*/
|
|
16
17
|
buttons: ReactNode;
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* Same as buttons, but. Have disabled pointer-events on content inside if non-fluid.
|
|
20
|
+
* Fluid version have humburger layout.
|
|
21
|
+
* Can be used with buttons prop.
|
|
21
22
|
*/
|
|
22
|
-
buttonsAlt:
|
|
23
|
+
buttonsAlt: ReactNode;
|
|
23
24
|
/** Content under image. Or on the right if fluid. */
|
|
24
25
|
children: ReactNode;
|
|
25
26
|
/** Applies a CSS class to the element. */
|
|
@@ -38,6 +39,8 @@ type Props = Partial<{
|
|
|
38
39
|
dmIcon: string | null;
|
|
39
40
|
/** Parameter `icon_state` of component `DmIcon`. */
|
|
40
41
|
dmIconState: string | null;
|
|
42
|
+
/** Parameter `direction` of component `DmIcon`. */
|
|
43
|
+
dmDirection: Direction;
|
|
41
44
|
/**
|
|
42
45
|
* Changes the layout of the button, making it fill the entire horizontally available space.
|
|
43
46
|
* Allows the use of `title`
|
|
@@ -45,7 +48,7 @@ type Props = Partial<{
|
|
|
45
48
|
fluid: boolean;
|
|
46
49
|
/** Parameter responsible for the size of the image, component and standard "stubs". */
|
|
47
50
|
imageSize: number;
|
|
48
|
-
/** Prop `src` of Image component. Example: `imageSrc={resolveAsset(thing.image}` */
|
|
51
|
+
/** Prop `src` of Image component. Example: `imageSrc={resolveAsset(thing.image)}` */
|
|
49
52
|
imageSrc: string;
|
|
50
53
|
/** Called when button is clicked with LMB. */
|
|
51
54
|
onClick: (e: any) => void;
|
|
@@ -60,5 +63,11 @@ type Props = Partial<{
|
|
|
60
63
|
/** Position of the tooltip. See [`Popper`](#Popper) for valid options. */
|
|
61
64
|
tooltipPosition: Placement;
|
|
62
65
|
}> & BoxProps;
|
|
66
|
+
/**
|
|
67
|
+
* Stylized button, with the ability to easily and simply insert any picture into it.
|
|
68
|
+
* - Without image, will be default question icon.
|
|
69
|
+
* - If an image is specified but for some reason cannot be displayed, there will be a spinner fallback until it is loaded.
|
|
70
|
+
* - Component has no **hover** effects, if `onClick` or `onRightClick` is not specified.
|
|
71
|
+
*/
|
|
63
72
|
export declare function ImageButton(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
64
73
|
export {};
|
|
@@ -1,135 +1,151 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as I, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { classes as l } from "../common/react.js";
|
|
3
|
-
import { computeBoxProps as
|
|
4
|
-
import { DmIcon as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Image as
|
|
7
|
-
import { Stack as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
function
|
|
3
|
+
import { computeBoxProps as S } from "../common/ui.js";
|
|
4
|
+
import { DmIcon as z } from "./DmIcon.js";
|
|
5
|
+
import { Icon as A } from "./Icon.js";
|
|
6
|
+
import { Image as D } from "./Image.js";
|
|
7
|
+
import { Stack as $ } from "./Stack.js";
|
|
8
|
+
import { Tooltip as E } from "./Tooltip.js";
|
|
9
|
+
function W(d) {
|
|
10
10
|
const {
|
|
11
|
-
asset:
|
|
12
|
-
base64:
|
|
13
|
-
buttons:
|
|
14
|
-
buttonsAlt:
|
|
15
|
-
children:
|
|
16
|
-
className:
|
|
17
|
-
color:
|
|
18
|
-
disabled:
|
|
19
|
-
dmFallback:
|
|
11
|
+
asset: u,
|
|
12
|
+
base64: c,
|
|
13
|
+
buttons: i,
|
|
14
|
+
buttonsAlt: p,
|
|
15
|
+
children: a,
|
|
16
|
+
className: N,
|
|
17
|
+
color: o,
|
|
18
|
+
disabled: r,
|
|
19
|
+
dmFallback: k,
|
|
20
20
|
dmIcon: b,
|
|
21
21
|
dmIconState: x,
|
|
22
|
-
fluid:
|
|
23
|
-
imageSize:
|
|
24
|
-
imageSrc:
|
|
25
|
-
onClick:
|
|
26
|
-
onRightClick:
|
|
27
|
-
selected:
|
|
28
|
-
title:
|
|
22
|
+
fluid: e,
|
|
23
|
+
imageSize: n = 64,
|
|
24
|
+
imageSrc: g,
|
|
25
|
+
onClick: m,
|
|
26
|
+
onRightClick: f,
|
|
27
|
+
selected: C,
|
|
28
|
+
title: B,
|
|
29
29
|
tooltip: _,
|
|
30
30
|
tooltipPosition: w,
|
|
31
31
|
...v
|
|
32
|
-
} =
|
|
33
|
-
|
|
34
|
-
return /* @__PURE__ */ t(y, { height: `${o}px`, width: `${o}px`, children: /* @__PURE__ */ t(y.Item, { grow: !0, textAlign: "center", align: "center", children: /* @__PURE__ */ t(
|
|
35
|
-
F,
|
|
36
|
-
{
|
|
37
|
-
spin: S,
|
|
38
|
-
name: n,
|
|
39
|
-
color: "gray",
|
|
40
|
-
style: { fontSize: `calc(${o}px * 0.75)` }
|
|
41
|
-
}
|
|
42
|
-
) }) });
|
|
43
|
-
}
|
|
44
|
-
let p = /* @__PURE__ */ g(
|
|
32
|
+
} = d;
|
|
33
|
+
let h = /* @__PURE__ */ I(
|
|
45
34
|
"div",
|
|
46
35
|
{
|
|
47
36
|
className: l([
|
|
48
37
|
"container",
|
|
49
|
-
|
|
50
|
-
!
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
i || e && p && "hasButtons",
|
|
39
|
+
!m && !f && "noAction",
|
|
40
|
+
C && "ImageButton--selected",
|
|
41
|
+
r && "ImageButton--disabled",
|
|
42
|
+
o && typeof o == "string" ? `ImageButton--color__${o}` : "ImageButton--color__default"
|
|
54
43
|
]),
|
|
55
|
-
tabIndex:
|
|
56
|
-
onClick: (
|
|
57
|
-
!
|
|
44
|
+
tabIndex: r ? void 0 : 0,
|
|
45
|
+
onClick: (s) => {
|
|
46
|
+
!r && m && m(s);
|
|
58
47
|
},
|
|
59
|
-
onKeyDown: (
|
|
60
|
-
|
|
48
|
+
onKeyDown: (s) => {
|
|
49
|
+
s.key === "Enter" && !r && m && m(s);
|
|
61
50
|
},
|
|
62
|
-
onContextMenu: (
|
|
63
|
-
|
|
51
|
+
onContextMenu: (s) => {
|
|
52
|
+
s.preventDefault(), !r && f && f(s);
|
|
64
53
|
},
|
|
65
|
-
style: { width:
|
|
54
|
+
style: { width: e ? "auto" : `calc(${n}px + 0.5em + 2px)` },
|
|
66
55
|
children: [
|
|
67
|
-
/* @__PURE__ */ t("div", { className: "image", children:
|
|
68
|
-
|
|
56
|
+
/* @__PURE__ */ t("div", { className: "image", children: c || u || g ? /* @__PURE__ */ t(
|
|
57
|
+
D,
|
|
69
58
|
{
|
|
70
|
-
className: l(!
|
|
71
|
-
src:
|
|
72
|
-
height: `${
|
|
73
|
-
width: `${
|
|
59
|
+
className: l(!c && !g && u || []),
|
|
60
|
+
src: c ? `data:image/png;base64,${c}` : g,
|
|
61
|
+
height: `${n}px`,
|
|
62
|
+
width: `${n}px`
|
|
74
63
|
}
|
|
75
64
|
) : b && x ? /* @__PURE__ */ t(
|
|
76
|
-
|
|
65
|
+
z,
|
|
77
66
|
{
|
|
78
67
|
icon: b,
|
|
79
68
|
icon_state: x,
|
|
80
|
-
fallback:
|
|
81
|
-
height: `${
|
|
82
|
-
width: `${
|
|
69
|
+
fallback: k || /* @__PURE__ */ t(y, { icon: "spinner", spin: !0, size: n }),
|
|
70
|
+
height: `${n}px`,
|
|
71
|
+
width: `${n}px`
|
|
83
72
|
}
|
|
84
|
-
) :
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
] }) :
|
|
73
|
+
) : /* @__PURE__ */ t(y, { icon: "question" }) }),
|
|
74
|
+
e ? /* @__PURE__ */ I("div", { className: "info", children: [
|
|
75
|
+
B && /* @__PURE__ */ t("span", { className: l(["title", a && "divider"]), children: B }),
|
|
76
|
+
a && /* @__PURE__ */ t("span", { className: "contentFluid", children: a })
|
|
77
|
+
] }) : a && /* @__PURE__ */ t(
|
|
89
78
|
"span",
|
|
90
79
|
{
|
|
91
80
|
className: l([
|
|
92
81
|
"content",
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
C && "ImageButton--contentSelected",
|
|
83
|
+
r && "ImageButton--contentDisabled",
|
|
84
|
+
o && typeof o == "string" ? `ImageButton--contentColor__${o}` : "ImageButton--contentColor__default"
|
|
96
85
|
]),
|
|
97
|
-
children:
|
|
86
|
+
children: a
|
|
98
87
|
}
|
|
99
88
|
)
|
|
100
89
|
]
|
|
101
90
|
}
|
|
102
91
|
);
|
|
103
|
-
return _ && (
|
|
92
|
+
return _ && (h = /* @__PURE__ */ t(E, { content: _, position: w, children: h })), /* @__PURE__ */ I(
|
|
104
93
|
"div",
|
|
105
94
|
{
|
|
106
95
|
className: l([
|
|
107
96
|
"ImageButton",
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
e && "ImageButton--fluid",
|
|
98
|
+
N
|
|
110
99
|
]),
|
|
111
|
-
...
|
|
100
|
+
...S(v),
|
|
112
101
|
children: [
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
h,
|
|
103
|
+
i && /* @__PURE__ */ t(
|
|
115
104
|
"div",
|
|
116
105
|
{
|
|
117
106
|
className: l([
|
|
118
107
|
"buttonsContainer",
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
c && e && typeof e == "string" ? `ImageButton--buttonsContainerColor__${e}` : c && "ImageButton--buttonsContainerColor__default"
|
|
108
|
+
!a && "buttonsEmpty",
|
|
109
|
+
e && o && typeof o == "string" ? `ImageButton--buttonsContainerColor__${o}` : e && "ImageButton--buttonsContainerColor__default"
|
|
122
110
|
]),
|
|
123
111
|
style: {
|
|
124
|
-
width:
|
|
112
|
+
width: "auto"
|
|
125
113
|
},
|
|
126
|
-
children:
|
|
114
|
+
children: i
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
p && /* @__PURE__ */ t(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
className: l([
|
|
121
|
+
"buttonsContainer",
|
|
122
|
+
"buttonsAltContainer",
|
|
123
|
+
!a && "buttonsEmpty",
|
|
124
|
+
e && o && typeof o == "string" ? `ImageButton--buttonsContainerColor__${o}` : e && "ImageButton--buttonsContainerColor__default"
|
|
125
|
+
]),
|
|
126
|
+
style: {
|
|
127
|
+
width: `calc(${n}px + ${e ? 0 : 0.5}em)`,
|
|
128
|
+
maxWidth: e ? "auto" : `calc(${n}px + 0.5em)`
|
|
129
|
+
},
|
|
130
|
+
children: p
|
|
127
131
|
}
|
|
128
132
|
)
|
|
129
133
|
]
|
|
130
134
|
}
|
|
131
135
|
);
|
|
132
136
|
}
|
|
137
|
+
function y(d) {
|
|
138
|
+
const { icon: u, spin: c = !1, size: i = 64 } = d;
|
|
139
|
+
return /* @__PURE__ */ t($, { height: `${i}px`, width: `${i}px`, children: /* @__PURE__ */ t($.Item, { grow: !0, textAlign: "center", align: "center", children: /* @__PURE__ */ t(
|
|
140
|
+
A,
|
|
141
|
+
{
|
|
142
|
+
spin: c,
|
|
143
|
+
name: u,
|
|
144
|
+
color: "gray",
|
|
145
|
+
style: { fontSize: `calc(${i}px * 0.75)` }
|
|
146
|
+
}
|
|
147
|
+
) }) });
|
|
148
|
+
}
|
|
133
149
|
export {
|
|
134
|
-
|
|
150
|
+
W as ImageButton
|
|
135
151
|
};
|
|
@@ -1,37 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { BooleanLike } from '../common/react';
|
|
3
|
-
/**
|
|
4
|
-
* ## LabeledList
|
|
5
|
-
* LabeledList is a continuous, vertical list of text and other content, where
|
|
6
|
-
* every item is labeled.
|
|
7
|
-
*
|
|
8
|
-
* It works just like a two column table, where first column is labels, and
|
|
9
|
-
* second column is content.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* <LabeledList>
|
|
14
|
-
* <LabeledList.Item label="Item">Content</LabeledList.Item>
|
|
15
|
-
* </LabeledList>
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* If you want to have a button on the right side of an item (for example,
|
|
19
|
-
* to perform some sort of action), there is a way to do that:
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* <LabeledList>
|
|
24
|
-
* <LabeledList.Item label="Item" buttons={<Button>Click me!</Button>}>
|
|
25
|
-
* Content
|
|
26
|
-
* </LabeledList.Item>
|
|
27
|
-
* </LabeledList>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
3
|
export declare function LabeledList(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
export declare namespace LabeledList {
|
|
32
|
-
var Item: typeof LabeledListItem;
|
|
33
|
-
var Divider: typeof LabeledListDivider;
|
|
34
|
-
}
|
|
35
4
|
type LabeledListItemProps = Partial<{
|
|
36
5
|
/** Buttons to render aside the content. */
|
|
37
6
|
buttons: ReactNode;
|
|
@@ -80,4 +49,38 @@ type LabeledListDividerProps = {
|
|
|
80
49
|
size?: number;
|
|
81
50
|
};
|
|
82
51
|
declare function LabeledListDivider(props: LabeledListDividerProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* ## LabeledList
|
|
54
|
+
* LabeledList is a continuous, vertical list of text and other content, where
|
|
55
|
+
* every item is labeled.
|
|
56
|
+
*
|
|
57
|
+
* It works just like a two column table, where first column is labels, and
|
|
58
|
+
* second column is content.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <LabeledList>
|
|
63
|
+
* <LabeledList.Item label="Item">Content</LabeledList.Item>
|
|
64
|
+
* </LabeledList>
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* If you want to have a button on the right side of an item (for example,
|
|
68
|
+
* to perform some sort of action), there is a way to do that:
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <LabeledList>
|
|
73
|
+
* <LabeledList.Item label="Item" buttons={<Button>Click me!</Button>}>
|
|
74
|
+
* Content
|
|
75
|
+
* </LabeledList.Item>
|
|
76
|
+
* </LabeledList>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare namespace LabeledList {
|
|
80
|
+
/**
|
|
81
|
+
* Adds some empty space between LabeledList items.
|
|
82
|
+
*/
|
|
83
|
+
const Divider: typeof LabeledListDivider;
|
|
84
|
+
const Item: typeof LabeledListItem;
|
|
85
|
+
}
|
|
83
86
|
export {};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { classes as c } from "../common/react.js";
|
|
3
3
|
import { unit as g } from "../common/ui.js";
|
|
4
4
|
import { Box as r } from "./Box.js";
|
|
5
5
|
import { Divider as x } from "./Divider.js";
|
|
6
6
|
import { Tooltip as N } from "./Tooltip.js";
|
|
7
|
-
function b(
|
|
8
|
-
const { children: t } =
|
|
9
|
-
return /* @__PURE__ */
|
|
7
|
+
function b(e) {
|
|
8
|
+
const { children: t } = e;
|
|
9
|
+
return /* @__PURE__ */ l("table", { className: "LabeledList", children: /* @__PURE__ */ l("tbody", { children: t }) });
|
|
10
10
|
}
|
|
11
|
-
function v(
|
|
11
|
+
function v(e) {
|
|
12
12
|
const {
|
|
13
13
|
className: t,
|
|
14
|
-
label:
|
|
14
|
+
label: o,
|
|
15
15
|
labelColor: m = "label",
|
|
16
16
|
labelWrap: L,
|
|
17
17
|
color: p,
|
|
18
18
|
textAlign: _,
|
|
19
|
-
buttons:
|
|
19
|
+
buttons: a,
|
|
20
20
|
content: f,
|
|
21
21
|
children: h,
|
|
22
22
|
verticalAlign: s = "baseline",
|
|
23
23
|
tooltip: n
|
|
24
|
-
} =
|
|
24
|
+
} = e;
|
|
25
25
|
let i;
|
|
26
|
-
|
|
26
|
+
o && (i = o, typeof o == "string" && (i += ":")), n !== void 0 && (i = /* @__PURE__ */ l(N, { content: n, children: /* @__PURE__ */ l(
|
|
27
27
|
r,
|
|
28
28
|
{
|
|
29
29
|
as: "span",
|
|
@@ -33,7 +33,7 @@ function v(l) {
|
|
|
33
33
|
children: i
|
|
34
34
|
}
|
|
35
35
|
) }));
|
|
36
|
-
const u = /* @__PURE__ */
|
|
36
|
+
const u = /* @__PURE__ */ l(
|
|
37
37
|
r,
|
|
38
38
|
{
|
|
39
39
|
as: "td",
|
|
@@ -56,7 +56,7 @@ function v(l) {
|
|
|
56
56
|
color: p,
|
|
57
57
|
textAlign: _,
|
|
58
58
|
className: "LabeledList__cell",
|
|
59
|
-
colSpan:
|
|
59
|
+
colSpan: a ? void 0 : 2,
|
|
60
60
|
verticalAlign: s,
|
|
61
61
|
children: [
|
|
62
62
|
f,
|
|
@@ -64,13 +64,12 @@ function v(l) {
|
|
|
64
64
|
]
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
|
|
67
|
+
a && /* @__PURE__ */ l("td", { className: "LabeledList__cell LabeledList__buttons", children: a })
|
|
68
68
|
] });
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return /* @__PURE__ */ e("tr", { className: "LabeledList__row", children: /* @__PURE__ */ e(
|
|
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(
|
|
74
73
|
"td",
|
|
75
74
|
{
|
|
76
75
|
colSpan: 3,
|
|
@@ -78,11 +77,13 @@ function y(l) {
|
|
|
78
77
|
paddingTop: t,
|
|
79
78
|
paddingBottom: t
|
|
80
79
|
},
|
|
81
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ l(x, {})
|
|
82
81
|
}
|
|
83
82
|
) });
|
|
84
83
|
}
|
|
85
|
-
|
|
84
|
+
((e) => {
|
|
85
|
+
e.Divider = y, e.Item = v;
|
|
86
|
+
})(b || (b = {}));
|
|
86
87
|
export {
|
|
87
88
|
b as LabeledList
|
|
88
89
|
};
|
|
@@ -3,6 +3,24 @@ type Props = Partial<{
|
|
|
3
3
|
/** Collapses table to the smallest possible size. */
|
|
4
4
|
collapsing: boolean;
|
|
5
5
|
}> & BoxProps;
|
|
6
|
+
export declare function Table(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
type RowProps = Partial<{
|
|
8
|
+
/** Whether this is a header cell. */
|
|
9
|
+
header: boolean;
|
|
10
|
+
}> & BoxProps;
|
|
11
|
+
declare function TableRow(props: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
type CellProps = Partial<{
|
|
13
|
+
/** Additional columns for this cell to expand, assuming there is room. */
|
|
14
|
+
colSpan: number;
|
|
15
|
+
/** Collapses table cell to the smallest possible size,
|
|
16
|
+
and stops any text inside from wrapping. */
|
|
17
|
+
collapsing: boolean;
|
|
18
|
+
/** Whether this is a header cell. */
|
|
19
|
+
header: boolean;
|
|
20
|
+
/** Rows for this cell to expand, assuming there is room. */
|
|
21
|
+
rowSpan: number;
|
|
22
|
+
}> & BoxProps;
|
|
23
|
+
declare function TableCell(props: CellProps): import("react/jsx-runtime").JSX.Element;
|
|
6
24
|
/**
|
|
7
25
|
* ## Table
|
|
8
26
|
* A straight forward mapping to a standard html table, which is slightly
|
|
@@ -21,26 +39,16 @@ type Props = Partial<{
|
|
|
21
39
|
* </Table>
|
|
22
40
|
* ```
|
|
23
41
|
*/
|
|
24
|
-
export declare function Table(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
25
42
|
export declare namespace Table {
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
/**
|
|
44
|
+
* ## Table.Cell
|
|
45
|
+
* A straight forward mapping to `<td>` element.
|
|
46
|
+
*/
|
|
47
|
+
const Cell: typeof TableCell;
|
|
48
|
+
/**
|
|
49
|
+
* ## Table.Row
|
|
50
|
+
* A straight forward mapping to `<tr>` element.
|
|
51
|
+
*/
|
|
52
|
+
const Row: typeof TableRow;
|
|
28
53
|
}
|
|
29
|
-
type RowProps = Partial<{
|
|
30
|
-
/** Whether this is a header cell. */
|
|
31
|
-
header: boolean;
|
|
32
|
-
}> & BoxProps;
|
|
33
|
-
declare function TableRow(props: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
type CellProps = Partial<{
|
|
35
|
-
/** Additional columns for this cell to expand, assuming there is room. */
|
|
36
|
-
colSpan: number;
|
|
37
|
-
/** Collapses table cell to the smallest possible size,
|
|
38
|
-
and stops any text inside from wrapping. */
|
|
39
|
-
collapsing: boolean;
|
|
40
|
-
/** Whether this is a header cell. */
|
|
41
|
-
header: boolean;
|
|
42
|
-
/** Rows for this cell to expand, assuming there is room. */
|
|
43
|
-
rowSpan: number;
|
|
44
|
-
}> & BoxProps;
|
|
45
|
-
declare function TableCell(props: CellProps): import("react/jsx-runtime").JSX.Element;
|
|
46
54
|
export {};
|
package/dist/components/Table.js
CHANGED
|
@@ -17,7 +17,7 @@ function m(e) {
|
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function b(e) {
|
|
21
21
|
const { className: l, header: a, ...s } = e;
|
|
22
22
|
return /* @__PURE__ */ c(
|
|
23
23
|
"tr",
|
|
@@ -32,9 +32,8 @@ function i(e) {
|
|
|
32
32
|
}
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const { className: l, collapsing: a, colSpan: s, header: o, ...b } = e;
|
|
35
|
+
function _(e) {
|
|
36
|
+
const { className: l, collapsing: a, colSpan: s, header: o, ...i } = e;
|
|
38
37
|
return /* @__PURE__ */ c(
|
|
39
38
|
"td",
|
|
40
39
|
{
|
|
@@ -46,11 +45,13 @@ function T(e) {
|
|
|
46
45
|
t(e)
|
|
47
46
|
]),
|
|
48
47
|
colSpan: s,
|
|
49
|
-
...n(
|
|
48
|
+
...n(i)
|
|
50
49
|
}
|
|
51
50
|
);
|
|
52
51
|
}
|
|
53
|
-
|
|
52
|
+
((e) => {
|
|
53
|
+
e.Cell = _, e.Row = b;
|
|
54
|
+
})(m || (m = {}));
|
|
54
55
|
export {
|
|
55
56
|
m as Table
|
|
56
57
|
};
|
|
@@ -13,6 +13,22 @@ type Props = Partial<{
|
|
|
13
13
|
/** Use a vertical configuration, where tabs will be stacked vertically. */
|
|
14
14
|
vertical: boolean;
|
|
15
15
|
}> & BoxProps;
|
|
16
|
+
export declare function Tabs(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
type TabProps = Partial<{
|
|
18
|
+
/** Font awesome icon. @see https://fontawesome.com/v6/search?o=r&m=free */
|
|
19
|
+
icon: string;
|
|
20
|
+
/** Causes the icon to spin */
|
|
21
|
+
iconSpin: boolean;
|
|
22
|
+
/** Left slot content */
|
|
23
|
+
leftSlot: ReactNode;
|
|
24
|
+
/** Called when element is clicked */
|
|
25
|
+
onClick: (e?: any) => void;
|
|
26
|
+
/** Right slot content */
|
|
27
|
+
rightSlot: ReactNode;
|
|
28
|
+
/** Whether the tab is selected */
|
|
29
|
+
selected: boolean;
|
|
30
|
+
}> & BoxProps;
|
|
31
|
+
declare function TabItem(props: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
16
32
|
/**
|
|
17
33
|
* ## Tabs
|
|
18
34
|
* Tabs make it easy to explore and switch between different views.
|
|
@@ -71,22 +87,12 @@ type Props = Partial<{
|
|
|
71
87
|
* </Section>
|
|
72
88
|
* ```
|
|
73
89
|
*/
|
|
74
|
-
export declare function Tabs(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
75
90
|
export declare namespace Tabs {
|
|
76
|
-
|
|
91
|
+
/**
|
|
92
|
+
* ## Tabs.Tab
|
|
93
|
+
* An individual tab element. Tabs function like buttons, so they inherit
|
|
94
|
+
* a lot of `Button` props.
|
|
95
|
+
*/
|
|
96
|
+
const Tab: typeof TabItem;
|
|
77
97
|
}
|
|
78
|
-
type TabProps = Partial<{
|
|
79
|
-
/** Font awesome icon. */
|
|
80
|
-
icon: string;
|
|
81
|
-
/** Causes the icon to spin */
|
|
82
|
-
iconSpin: boolean;
|
|
83
|
-
/** Left slot content */
|
|
84
|
-
leftSlot: ReactNode;
|
|
85
|
-
/** Called when element is clicked */
|
|
86
|
-
onClick: (e?: any) => void;
|
|
87
|
-
/** Right slot content */
|
|
88
|
-
rightSlot: ReactNode;
|
|
89
|
-
/** Whether the tab is selected */
|
|
90
|
-
selected: boolean;
|
|
91
|
-
}> & BoxProps;
|
|
92
98
|
export {};
|
package/dist/components/Tabs.js
CHANGED
|
@@ -1,62 +1,65 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { classes as
|
|
3
|
-
import { computeBoxClassName as
|
|
4
|
-
import { Icon as
|
|
5
|
-
function
|
|
6
|
-
const { className:
|
|
1
|
+
import { jsx as a, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { classes as f, canRender as d } from "../common/react.js";
|
|
3
|
+
import { computeBoxClassName as h, computeBoxProps 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
7
|
return /* @__PURE__ */ a(
|
|
8
8
|
"div",
|
|
9
9
|
{
|
|
10
|
-
className:
|
|
10
|
+
className: f([
|
|
11
11
|
"Tabs",
|
|
12
|
-
|
|
12
|
+
c ? "Tabs--vertical" : "Tabs--horizontal",
|
|
13
13
|
o && "Tabs--fill",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
s && "Tabs--fluid",
|
|
15
|
+
i,
|
|
16
|
+
h(l)
|
|
17
17
|
]),
|
|
18
|
-
...
|
|
18
|
+
...p(l),
|
|
19
19
|
children: r
|
|
20
20
|
}
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
function x(
|
|
23
|
+
function x(e) {
|
|
24
24
|
const {
|
|
25
|
-
className:
|
|
26
|
-
selected:
|
|
25
|
+
className: i,
|
|
26
|
+
selected: c,
|
|
27
27
|
color: o,
|
|
28
|
-
icon:
|
|
28
|
+
icon: s,
|
|
29
29
|
iconSpin: r,
|
|
30
|
-
leftSlot:
|
|
30
|
+
leftSlot: l,
|
|
31
31
|
rightSlot: t,
|
|
32
|
-
children:
|
|
32
|
+
children: u,
|
|
33
33
|
onClick: n,
|
|
34
34
|
...m
|
|
35
|
-
} =
|
|
35
|
+
} = e;
|
|
36
|
+
function _(b) {
|
|
36
37
|
n && (n(b), b.target.blur());
|
|
37
|
-
}
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ N(
|
|
39
40
|
"div",
|
|
40
41
|
{
|
|
41
|
-
className:
|
|
42
|
+
className: f([
|
|
42
43
|
"Tab",
|
|
43
44
|
"Tabs__Tab",
|
|
44
45
|
`Tab--color--${o}`,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
c && "Tab--selected",
|
|
47
|
+
i,
|
|
48
|
+
h(m)
|
|
48
49
|
]),
|
|
49
50
|
onClick: _,
|
|
50
|
-
...
|
|
51
|
+
...p(m),
|
|
51
52
|
children: [
|
|
52
|
-
d(
|
|
53
|
-
/* @__PURE__ */ a("div", { className: "Tab__text", 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 }),
|
|
54
55
|
d(t) && /* @__PURE__ */ a("div", { className: "Tab__right", children: t })
|
|
55
56
|
]
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
((e) => {
|
|
61
|
+
e.Tab = x;
|
|
62
|
+
})(T || (T = {}));
|
|
60
63
|
export {
|
|
61
|
-
|
|
64
|
+
T as Tabs
|
|
62
65
|
};
|