tgui-core 1.1.2 → 1.1.4
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/keys.d.ts +17 -1
- package/dist/common/keys.js +6 -2
- package/dist/components/AnimatedNumber.d.ts +5 -4
- package/dist/components/Box.d.ts +2 -2
- package/dist/components/Button.d.ts +16 -0
- package/dist/components/Collapsible.d.ts +4 -0
- package/dist/components/DmIcon.d.ts +2 -1
- package/dist/components/DmIcon.js +23 -23
- package/dist/components/Dropdown.js +54 -54
- package/dist/components/Flex.d.ts +69 -5
- package/dist/components/Icon.d.ts +9 -4
- package/dist/components/Image.d.ts +0 -1
- package/dist/components/Knob.js +1 -1
- package/dist/components/LabeledList.d.ts +29 -1
- package/dist/components/LabeledList.js +1 -1
- package/dist/components/NoticeBox.d.ts +3 -0
- package/dist/components/Popper.js +138 -108
- package/dist/components/ProgressBar.d.ts +34 -7
- package/dist/components/ProgressBar.js +4 -4
- package/dist/components/RoundGauge.js +3 -3
- package/dist/components/Section.d.ts +1 -1
- package/dist/components/Section.js +1 -1
- package/dist/components/Slider.js +1 -1
- package/dist/components/TextArea.d.ts +1 -1
- package/dist/components/Tooltip.d.ts +10 -6
- package/dist/components/Tooltip.js +7 -7
- package/dist/{popper-CiqSDJTE.js → index-jLZg_duJ.js} +166 -165
- package/package.json +8 -7
package/dist/common/keys.d.ts
CHANGED
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
* Handles modifier keys (Shift, Alt, Control) and arrow keys.
|
|
6
6
|
*
|
|
7
7
|
* For alphabetical keys, use the actual character (e.g. 'a') instead of the key code.
|
|
8
|
+
* Don't access Esc or Escape directly, use isEscape() instead
|
|
8
9
|
*
|
|
9
10
|
* Something isn't here that you want? Just add it:
|
|
10
11
|
* @url https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
|
|
11
12
|
* @usage
|
|
12
13
|
* ```ts
|
|
13
|
-
* import { KEY } from 'tgui/keys';
|
|
14
|
+
* import { KEY } from 'tgui/common/keys';
|
|
14
15
|
*
|
|
15
16
|
* if (event.key === KEY.Enter) {
|
|
16
17
|
* // do something
|
|
17
18
|
* }
|
|
18
19
|
* ```
|
|
20
|
+
*
|
|
21
|
+
*
|
|
19
22
|
*/
|
|
20
23
|
export declare enum KEY {
|
|
21
24
|
Alt = "Alt",
|
|
@@ -25,6 +28,7 @@ export declare enum KEY {
|
|
|
25
28
|
Down = "ArrowDown",
|
|
26
29
|
End = "End",
|
|
27
30
|
Enter = "Enter",
|
|
31
|
+
Esc = "Esc",
|
|
28
32
|
Escape = "Escape",
|
|
29
33
|
Home = "Home",
|
|
30
34
|
Insert = "Insert",
|
|
@@ -37,3 +41,15 @@ export declare enum KEY {
|
|
|
37
41
|
Tab = "Tab",
|
|
38
42
|
Up = "ArrowUp"
|
|
39
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* ### isEscape
|
|
46
|
+
*
|
|
47
|
+
* Checks if the user has hit the 'ESC' key on their keyboard.
|
|
48
|
+
* There's a weirdness in BYOND where this could be either the string
|
|
49
|
+
* 'Escape' or 'Esc' depending on the browser. This function handles
|
|
50
|
+
* both cases.
|
|
51
|
+
*
|
|
52
|
+
* @param key - the key to check, typically from event.key
|
|
53
|
+
* @returns true if key is Escape or Esc, false otherwise
|
|
54
|
+
*/
|
|
55
|
+
export declare function isEscape(key: string): boolean;
|
package/dist/common/keys.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
var r = /* @__PURE__ */ ((e) => (e.Alt = "Alt", e.Backspace = "Backspace", e.Control = "Control", e.Delete = "Delete", e.Down = "ArrowDown", e.End = "End", e.Enter = "Enter", e.Escape = "Escape", e.Home = "Home", e.Insert = "Insert", e.Left = "ArrowLeft", e.PageDown = "PageDown", e.PageUp = "PageUp", e.Right = "ArrowRight", e.Shift = "Shift", e.Space = " ", e.Tab = "Tab", e.Up = "ArrowUp", e))(r || {});
|
|
1
|
+
var r = /* @__PURE__ */ ((e) => (e.Alt = "Alt", e.Backspace = "Backspace", e.Control = "Control", e.Delete = "Delete", e.Down = "ArrowDown", e.End = "End", e.Enter = "Enter", e.Esc = "Esc", e.Escape = "Escape", e.Home = "Home", e.Insert = "Insert", e.Left = "ArrowLeft", e.PageDown = "PageDown", e.PageUp = "PageUp", e.Right = "ArrowRight", e.Shift = "Shift", e.Space = " ", e.Tab = "Tab", e.Up = "ArrowUp", e))(r || {});
|
|
2
|
+
function t(e) {
|
|
3
|
+
return e === "Esc" || e === "Escape";
|
|
4
|
+
}
|
|
2
5
|
export {
|
|
3
|
-
r as KEY
|
|
6
|
+
r as KEY,
|
|
7
|
+
t as isEscape
|
|
4
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
/**
|
|
5
5
|
* If provided, a function that formats the inner string. By default,
|
|
6
6
|
* attempts to match the numeric precision of `value`.
|
|
@@ -21,7 +21,7 @@ export type AnimatedNumberProps = {
|
|
|
21
21
|
* An animated number label. Shows a number, formatted with an optionally
|
|
22
22
|
* provided function, and animates it towards its target value.
|
|
23
23
|
*/
|
|
24
|
-
export declare class AnimatedNumber extends Component<
|
|
24
|
+
export declare class AnimatedNumber extends Component<Props> {
|
|
25
25
|
/**
|
|
26
26
|
* The inner `<span/>` being updated sixty times per second.
|
|
27
27
|
*/
|
|
@@ -34,10 +34,10 @@ export declare class AnimatedNumber extends Component<AnimatedNumberProps> {
|
|
|
34
34
|
* The current value. This values approaches the target value.
|
|
35
35
|
*/
|
|
36
36
|
currentValue: number;
|
|
37
|
-
constructor(props:
|
|
37
|
+
constructor(props: Props);
|
|
38
38
|
componentDidMount(): void;
|
|
39
39
|
componentWillUnmount(): void;
|
|
40
|
-
shouldComponentUpdate(newProps:
|
|
40
|
+
shouldComponentUpdate(newProps: Props): boolean;
|
|
41
41
|
/**
|
|
42
42
|
* Starts animating the inner span. If the inner span is already animating,
|
|
43
43
|
* this is a no-op.
|
|
@@ -57,3 +57,4 @@ export declare class AnimatedNumber extends Component<AnimatedNumberProps> {
|
|
|
57
57
|
getText(): string;
|
|
58
58
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
59
59
|
}
|
|
60
|
+
export {};
|
package/dist/components/Box.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyboardEventHandler, MouseEventHandler, ReactNode, UIEventHandler } from 'react';
|
|
1
|
+
import { CSSProperties, KeyboardEventHandler, MouseEventHandler, ReactNode, UIEventHandler } from 'react';
|
|
2
2
|
import { BooleanLike } from '../common/react';
|
|
3
3
|
|
|
4
4
|
type BooleanProps = Partial<Record<keyof typeof booleanStyleMap, boolean>>;
|
|
@@ -19,7 +19,7 @@ export type BoxProps = Partial<{
|
|
|
19
19
|
as: string;
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
className: string | BooleanLike;
|
|
22
|
-
style:
|
|
22
|
+
style: CSSProperties;
|
|
23
23
|
}> & BooleanProps & StringProps & EventHandlers;
|
|
24
24
|
type DangerDoNotUse = {
|
|
25
25
|
dangerouslySetInnerHTML?: {
|
|
@@ -13,6 +13,7 @@ type EllipsisUnion = {
|
|
|
13
13
|
children: string;
|
|
14
14
|
/** @deprecated use children instead */
|
|
15
15
|
content?: never;
|
|
16
|
+
/** Cuts off text with an ellipsis */
|
|
16
17
|
ellipsis: true;
|
|
17
18
|
} | Partial<{
|
|
18
19
|
children: ReactNode;
|
|
@@ -21,20 +22,35 @@ type EllipsisUnion = {
|
|
|
21
22
|
ellipsis: undefined;
|
|
22
23
|
}>;
|
|
23
24
|
type Props = Partial<{
|
|
25
|
+
/** Captures keyboard events */
|
|
24
26
|
captureKeys: boolean;
|
|
27
|
+
/** Makes the button circular */
|
|
25
28
|
circular: boolean;
|
|
29
|
+
/** Reduces the padding of the button */
|
|
26
30
|
compact: boolean;
|
|
31
|
+
/** Disables and greys out the button */
|
|
27
32
|
disabled: BooleanLike;
|
|
33
|
+
/** Fill all available horizontal space */
|
|
28
34
|
fluid: boolean;
|
|
35
|
+
/** Adds an icon to the button */
|
|
29
36
|
icon: string | false;
|
|
37
|
+
/** Icon color */
|
|
30
38
|
iconColor: string;
|
|
39
|
+
/** Icon position */
|
|
31
40
|
iconPosition: string;
|
|
41
|
+
/** Icon rotation */
|
|
32
42
|
iconRotation: number;
|
|
43
|
+
/** Makes the icon spin */
|
|
33
44
|
iconSpin: BooleanLike;
|
|
45
|
+
/** Called when element is clicked */
|
|
34
46
|
onClick: (e: any) => void;
|
|
47
|
+
/** Activates the button (gives it a green color) */
|
|
35
48
|
selected: BooleanLike;
|
|
49
|
+
/** A fancy, boxy tooltip, which appears when hovering over the button */
|
|
36
50
|
tooltip: ReactNode;
|
|
51
|
+
/** Position of the tooltip. See [`Popper`](#Popper) for valid options. */
|
|
37
52
|
tooltipPosition: Placement;
|
|
53
|
+
/** Align content vertically using flex. Use lineHeight if the height is static. */
|
|
38
54
|
verticalAlignContent: string;
|
|
39
55
|
}> & EllipsisUnion & BoxProps;
|
|
40
56
|
/** Clickable button. Comes with variants. Read more in the documentation. */
|
|
@@ -2,9 +2,13 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { BoxProps } from './Box';
|
|
3
3
|
|
|
4
4
|
type Props = Partial<{
|
|
5
|
+
/** Buttons or other content to render inline with the button */
|
|
5
6
|
buttons: ReactNode;
|
|
7
|
+
/** Icon to display with the collapsible */
|
|
6
8
|
icon: string;
|
|
9
|
+
/** Whether the collapsible is open */
|
|
7
10
|
open: boolean;
|
|
11
|
+
/** Text to display on the button for collapsing */
|
|
8
12
|
title: ReactNode;
|
|
9
13
|
}> & BoxProps;
|
|
10
14
|
export declare function Collapsible(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { BooleanLike } from '../common/react';
|
|
2
3
|
import { BoxProps } from './Box';
|
|
3
4
|
|
|
4
5
|
declare enum Direction {
|
|
@@ -24,7 +25,7 @@ type Props = {
|
|
|
24
25
|
/** Frame number. Default is 1 */
|
|
25
26
|
frame: number;
|
|
26
27
|
/** Movement state. Default is false */
|
|
27
|
-
movement:
|
|
28
|
+
movement: BooleanLike;
|
|
28
29
|
}> & BoxProps;
|
|
29
30
|
export declare function DmIcon(props: Props): string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
30
31
|
export {};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as R, useEffect as
|
|
3
|
-
import { resolveAsset as
|
|
4
|
-
import { fetchRetry as
|
|
5
|
-
import { Image as
|
|
6
|
-
let
|
|
7
|
-
function
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useEffect as u } from "react";
|
|
3
|
+
import { resolveAsset as l } from "../common/assets.js";
|
|
4
|
+
import { fetchRetry as A } from "../common/http.js";
|
|
5
|
+
import { Image as N } from "./Image.js";
|
|
6
|
+
let s;
|
|
7
|
+
function x(t) {
|
|
8
8
|
const {
|
|
9
|
-
className:
|
|
10
|
-
direction:
|
|
11
|
-
fallback:
|
|
12
|
-
frame:
|
|
13
|
-
icon_state:
|
|
14
|
-
icon:
|
|
15
|
-
movement:
|
|
16
|
-
...
|
|
17
|
-
} =
|
|
18
|
-
return
|
|
19
|
-
async function
|
|
20
|
-
const
|
|
21
|
-
|
|
9
|
+
className: c,
|
|
10
|
+
direction: m = 2,
|
|
11
|
+
fallback: r,
|
|
12
|
+
frame: S = 1,
|
|
13
|
+
icon_state: o,
|
|
14
|
+
icon: e,
|
|
15
|
+
movement: E = !1,
|
|
16
|
+
...H
|
|
17
|
+
} = t, [T, f] = R(""), O = `${T}?state=${o}&dir=${m}&movement=${E}&frame=${S}`;
|
|
18
|
+
return u(() => {
|
|
19
|
+
async function n() {
|
|
20
|
+
const a = await (await A(l("icon_ref_map.json"))).json();
|
|
21
|
+
s = a, f(a[e]);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
}, []),
|
|
23
|
+
s ? f(s[e]) : n();
|
|
24
|
+
}, []), T ? /* @__PURE__ */ p(N, { fixErrors: !0, src: O, ...H }) : r;
|
|
25
25
|
}
|
|
26
26
|
export {
|
|
27
|
-
|
|
27
|
+
x as DmIcon
|
|
28
28
|
};
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { classes as
|
|
4
|
-
import { unit as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { Popper as
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as q, useEffect as z } from "react";
|
|
3
|
+
import { classes as N } from "../common/react.js";
|
|
4
|
+
import { unit as A } from "./Box.js";
|
|
5
|
+
import { Button as b } from "./Button.js";
|
|
6
|
+
import { Icon as D } from "./Icon.js";
|
|
7
|
+
import { Popper as E } from "./Popper.js";
|
|
8
8
|
const G = -1;
|
|
9
9
|
function f(d) {
|
|
10
10
|
return typeof d == "string" ? d : d.value;
|
|
11
11
|
}
|
|
12
12
|
function Y(d) {
|
|
13
13
|
const {
|
|
14
|
-
autoScroll:
|
|
15
|
-
buttons:
|
|
16
|
-
className:
|
|
17
|
-
clipSelectedText:
|
|
18
|
-
color:
|
|
14
|
+
autoScroll: x = !0,
|
|
15
|
+
buttons: k,
|
|
16
|
+
className: B,
|
|
17
|
+
clipSelectedText: C = !0,
|
|
18
|
+
color: O = "default",
|
|
19
19
|
disabled: a,
|
|
20
|
-
displayText:
|
|
21
|
-
icon:
|
|
22
|
-
iconRotation:
|
|
23
|
-
iconSpin:
|
|
24
|
-
menuWidth:
|
|
25
|
-
noChevron:
|
|
20
|
+
displayText: j,
|
|
21
|
+
icon: w,
|
|
22
|
+
iconRotation: I,
|
|
23
|
+
iconSpin: P,
|
|
24
|
+
menuWidth: S = "15rem",
|
|
25
|
+
noChevron: T,
|
|
26
26
|
onClick: p,
|
|
27
27
|
onSelected: i,
|
|
28
|
-
options:
|
|
28
|
+
options: o = [],
|
|
29
29
|
over: g,
|
|
30
|
-
placeholder:
|
|
30
|
+
placeholder: V = "Select...",
|
|
31
31
|
selected: u,
|
|
32
|
-
width:
|
|
33
|
-
} = d, [
|
|
32
|
+
width: W = "15rem"
|
|
33
|
+
} = d, [s, h] = R(!1), F = g ? !s : s, v = q(null), l = o.findIndex((e) => f(e) === u) || 0;
|
|
34
34
|
function _(e) {
|
|
35
35
|
var c;
|
|
36
36
|
let t = e;
|
|
37
|
-
e <
|
|
37
|
+
e < l ? t = e < 2 ? 0 : e - 2 : t = e > o.length - 3 ? o.length - 1 : e - 2;
|
|
38
38
|
const n = (c = v.current) == null ? void 0 : c.children[t];
|
|
39
39
|
n == null || n.scrollIntoView({ block: "nearest" });
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
if (
|
|
41
|
+
function y(e) {
|
|
42
|
+
if (o.length < 1 || a)
|
|
43
43
|
return;
|
|
44
|
-
const t = 0, n =
|
|
44
|
+
const t = 0, n = o.length - 1;
|
|
45
45
|
let c;
|
|
46
|
-
|
|
46
|
+
l < 0 ? c = e === "next" ? n : t : e === "next" ? c = l === n ? t : l + 1 : c = l === t ? n : l - 1, s && x && _(c), i == null || i(f(o[c]));
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return z(() => {
|
|
49
49
|
var e;
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
50
|
+
s && (x && l !== G && _(l), (e = v.current) == null || e.focus());
|
|
51
|
+
}, [s]), /* @__PURE__ */ r(
|
|
52
|
+
E,
|
|
53
53
|
{
|
|
54
|
-
isOpen:
|
|
54
|
+
isOpen: s,
|
|
55
55
|
onClickOutside: () => h(!1),
|
|
56
56
|
placement: g ? "top-start" : "bottom-start",
|
|
57
57
|
content: /* @__PURE__ */ m(
|
|
58
58
|
"div",
|
|
59
59
|
{
|
|
60
60
|
className: "Layout Dropdown__menu",
|
|
61
|
-
style: { minWidth:
|
|
61
|
+
style: { minWidth: S },
|
|
62
62
|
ref: v,
|
|
63
63
|
children: [
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
o.length === 0 && /* @__PURE__ */ r("div", { className: "Dropdown__menuentry", children: "No options" }),
|
|
65
|
+
o.map((e, t) => {
|
|
66
66
|
const n = f(e);
|
|
67
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ r(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
|
-
className:
|
|
70
|
+
className: N([
|
|
71
71
|
"Dropdown__menuentry",
|
|
72
72
|
u === n && "selected"
|
|
73
73
|
]),
|
|
@@ -82,60 +82,60 @@ function Y(d) {
|
|
|
82
82
|
]
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
|
-
children: /* @__PURE__ */ m("div", { className: "Dropdown", style: { width:
|
|
85
|
+
children: /* @__PURE__ */ m("div", { className: "Dropdown", style: { width: A(W) }, children: [
|
|
86
86
|
/* @__PURE__ */ m(
|
|
87
87
|
"div",
|
|
88
88
|
{
|
|
89
|
-
className:
|
|
89
|
+
className: N([
|
|
90
90
|
"Dropdown__control",
|
|
91
91
|
"Button",
|
|
92
92
|
"Button--dropdown",
|
|
93
|
-
"Button--color--" +
|
|
93
|
+
"Button--color--" + O,
|
|
94
94
|
a && "Button--disabled",
|
|
95
|
-
|
|
95
|
+
B
|
|
96
96
|
]),
|
|
97
97
|
onClick: (e) => {
|
|
98
|
-
a && !
|
|
98
|
+
a && !s || (h(!s), p == null || p(e));
|
|
99
99
|
},
|
|
100
100
|
children: [
|
|
101
|
-
|
|
102
|
-
/* @__PURE__ */
|
|
101
|
+
w && /* @__PURE__ */ r(D, { mr: 1, name: w, rotation: I, spin: P }),
|
|
102
|
+
/* @__PURE__ */ r(
|
|
103
103
|
"span",
|
|
104
104
|
{
|
|
105
105
|
className: "Dropdown__selected-text",
|
|
106
106
|
style: {
|
|
107
|
-
overflow:
|
|
107
|
+
overflow: C ? "hidden" : "visible"
|
|
108
108
|
},
|
|
109
|
-
children:
|
|
109
|
+
children: j || u && f(u) || V
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
|
-
!
|
|
112
|
+
!T && /* @__PURE__ */ r("span", { className: "Dropdown__arrow-button", children: /* @__PURE__ */ r(D, { name: F ? "chevron-up" : "chevron-down" }) })
|
|
113
113
|
]
|
|
114
114
|
}
|
|
115
115
|
),
|
|
116
|
-
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
116
|
+
k && /* @__PURE__ */ m(L, { children: [
|
|
117
|
+
/* @__PURE__ */ r(
|
|
118
|
+
b,
|
|
119
119
|
{
|
|
120
120
|
disabled: a,
|
|
121
121
|
height: 1.8,
|
|
122
122
|
icon: "chevron-left",
|
|
123
123
|
onClick: () => {
|
|
124
|
-
|
|
124
|
+
y(
|
|
125
125
|
"previous"
|
|
126
126
|
/* Previous */
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
|
|
131
|
+
/* @__PURE__ */ r(
|
|
132
|
+
b,
|
|
133
133
|
{
|
|
134
134
|
disabled: a,
|
|
135
135
|
height: 1.8,
|
|
136
136
|
icon: "chevron-right",
|
|
137
137
|
onClick: () => {
|
|
138
|
-
|
|
138
|
+
y(
|
|
139
139
|
"next"
|
|
140
140
|
/* Next */
|
|
141
141
|
);
|
|
@@ -1,13 +1,57 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
1
|
import { BoxProps } from './Box';
|
|
3
2
|
|
|
4
3
|
export type FlexProps = Partial<{
|
|
4
|
+
/**
|
|
5
|
+
* Default alignment of all children.
|
|
6
|
+
*
|
|
7
|
+
* - `stretch` (default) - stretch to fill the container.
|
|
8
|
+
* - `start` - items are placed at the start of the cross axis.
|
|
9
|
+
* - `end` - items are placed at the end of the cross axis.
|
|
10
|
+
* - `center` - items are centered on the cross axis.
|
|
11
|
+
* - `baseline` - items are aligned such as their baselines align.
|
|
12
|
+
*/
|
|
5
13
|
align: string | boolean;
|
|
14
|
+
/**
|
|
15
|
+
* This establishes the main-axis, thus defining the direction flex items are placed in the flex container.
|
|
16
|
+
*
|
|
17
|
+
* - `row` (default) - left to right.
|
|
18
|
+
* - `row-reverse` - right to left.
|
|
19
|
+
* - `column` - top to bottom.
|
|
20
|
+
* - `column-reverse` - bottom to top.
|
|
21
|
+
*/
|
|
6
22
|
direction: string;
|
|
23
|
+
/** Makes flexbox container inline, with similar behavior to an `inline` property on a `Box`. */
|
|
7
24
|
inline: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* This defines the alignment along the main axis. It helps distribute extra free space leftover when either all the flex items on a line are
|
|
27
|
+
* inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow
|
|
28
|
+
* the line.
|
|
29
|
+
*
|
|
30
|
+
* - `flex-start` (default) - items are packed toward the start of the
|
|
31
|
+
* flex-direction.
|
|
32
|
+
* - `flex-end` - items are packed toward the end of the flex-direction.
|
|
33
|
+
* - `space-between` - items are evenly distributed in the line; first item is
|
|
34
|
+
* on the start line, last item on the end line
|
|
35
|
+
* - `space-around` - items are evenly distributed in the line with equal space
|
|
36
|
+
* around them. Note that visually the spaces aren't equal, since all the items
|
|
37
|
+
* have equal space on both sides. The first item will have one unit of space
|
|
38
|
+
* against the container edge, but two units of space between the next item
|
|
39
|
+
* because that next item has its own spacing that applies.
|
|
40
|
+
* - `space-evenly` - items are distributed so that the spacing between any two
|
|
41
|
+
* items (and the space to the edges) is equal.
|
|
42
|
+
*/
|
|
8
43
|
justify: string;
|
|
44
|
+
/** By default, flex items will all try to fit onto one line. You can change that and allow the items to wrap as needed with this property. */
|
|
9
45
|
scrollable: boolean;
|
|
10
|
-
|
|
46
|
+
/**
|
|
47
|
+
* This defines the alignment along the cross axis. It helps distribute extra free space leftover when either all the flex items on a line are
|
|
48
|
+
* inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow
|
|
49
|
+
* the line.
|
|
50
|
+
*
|
|
51
|
+
* - `nowrap` (default) - all flex items will be on one line
|
|
52
|
+
* - `wrap` - flex items will wrap onto multiple lines, from top to bottom.
|
|
53
|
+
* - `wrap-reverse` - flex items will wrap onto multiple lines from bottom to top.
|
|
54
|
+
*/
|
|
11
55
|
wrap: string | boolean;
|
|
12
56
|
}> & BoxProps;
|
|
13
57
|
export declare function computeFlexClassName(props: FlexProps): string;
|
|
@@ -16,14 +60,34 @@ export declare function Flex(props: any): import("react/jsx-runtime").JSX.Elemen
|
|
|
16
60
|
export declare namespace Flex {
|
|
17
61
|
var Item: typeof FlexItem;
|
|
18
62
|
}
|
|
19
|
-
export type FlexItemProps =
|
|
63
|
+
export type FlexItemProps = Partial<{
|
|
64
|
+
/** This allows the default alignment (or the one specified by align-items) to be overridden for individual flex items. */
|
|
20
65
|
align: string | boolean;
|
|
66
|
+
/**
|
|
67
|
+
* This defines the default size of an element
|
|
68
|
+
* before any flex-related calculations are done. Has to be a length
|
|
69
|
+
* (e.g. `20%`, `5rem`), an `auto` or `content` keyword.
|
|
70
|
+
*
|
|
71
|
+
* - **Important:** IE11 flex is buggy, and auto width/height calculations
|
|
72
|
+
* can sometimes end up in a circular dependency. This usually happens, when
|
|
73
|
+
* working with tables inside flex (they have wacky internal widths and such).
|
|
74
|
+
* Setting basis to `0` breaks the loop and fixes all of the problems.
|
|
75
|
+
*/
|
|
21
76
|
basis: string | number;
|
|
77
|
+
/**
|
|
78
|
+
* This defines the ability for a flex item to grow if necessary. It accepts a unitless value that serves as a proportion.
|
|
79
|
+
* It dictates what amount of the available space inside the flex container the item should take up.
|
|
80
|
+
* This number is unit-less and is relative to other siblings.
|
|
81
|
+
*/
|
|
22
82
|
grow: number | boolean;
|
|
83
|
+
/**
|
|
84
|
+
* By default, flex items are laid out in the source order. However, the order property controls the order in which they appear in the
|
|
85
|
+
* flex container
|
|
86
|
+
*/
|
|
23
87
|
order: number;
|
|
88
|
+
/** This defines the ability for a flex item to shrink if necessary. Inverse of `grow`. */
|
|
24
89
|
shrink: number | boolean;
|
|
25
|
-
|
|
26
|
-
}>;
|
|
90
|
+
}> & BoxProps;
|
|
27
91
|
export declare function computeFlexItemProps(props: FlexItemProps): Record<string, any>;
|
|
28
92
|
declare function FlexItem(props: any): import("react/jsx-runtime").JSX.Element;
|
|
29
93
|
export {};
|
|
@@ -2,17 +2,22 @@ import { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import { BooleanLike } from '../common/react';
|
|
3
3
|
import { BoxProps } from './Box';
|
|
4
4
|
|
|
5
|
-
type
|
|
5
|
+
type Props = {
|
|
6
|
+
/** Icon name. See [icon list](https://fontawesome.com/v5/search?o=r&m=free) */
|
|
6
7
|
name: string;
|
|
7
8
|
} & Partial<{
|
|
9
|
+
/** Custom CSS class. */
|
|
8
10
|
className: string;
|
|
11
|
+
/** Icon rotation, in degrees. */
|
|
9
12
|
rotation: number;
|
|
13
|
+
/** Icon size. `1` is normal size, `2` is two times bigger. Fractional numbers are supported. */
|
|
10
14
|
size: number;
|
|
15
|
+
/** Whether an icon should be spinning. Good for load indicators. */
|
|
11
16
|
spin: BooleanLike;
|
|
17
|
+
/** Custom CSS. */
|
|
12
18
|
style: CSSProperties;
|
|
13
|
-
}
|
|
14
|
-
export
|
|
15
|
-
export declare function Icon(props: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
}> & BoxProps;
|
|
20
|
+
export declare function Icon(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
21
|
export declare namespace Icon {
|
|
17
22
|
var Stack: typeof IconStack;
|
|
18
23
|
}
|
package/dist/components/Knob.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _, jsxs as j } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { scale as s, keyOfMatchingRange as E } from "../common/math.js";
|
|
3
3
|
import { classes as e } from "../common/react.js";
|
|
4
4
|
import { computeBoxClassName as K, computeBoxProps as I } from "./Box.js";
|
|
5
5
|
import { DraggableControl as O } from "./DraggableControl.js";
|
|
@@ -7,22 +7,50 @@ export declare namespace LabeledList {
|
|
|
7
7
|
var Divider: typeof LabeledListDivider;
|
|
8
8
|
}
|
|
9
9
|
type LabeledListItemProps = Partial<{
|
|
10
|
+
/** Buttons to render aside the content. */
|
|
10
11
|
buttons: ReactNode;
|
|
12
|
+
/** Content of this labeled item. */
|
|
11
13
|
children: ReactNode;
|
|
14
|
+
/** Applies a CSS class to the element. */
|
|
12
15
|
className: string | BooleanLike;
|
|
16
|
+
/** Sets the color of the content text. */
|
|
13
17
|
color: string;
|
|
14
18
|
/** @deprecated */
|
|
15
19
|
content: any;
|
|
20
|
+
/**
|
|
21
|
+
* Sometimes this does not properly register in TS.
|
|
22
|
+
* See [react key docs](https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key) for more info.
|
|
23
|
+
*/
|
|
16
24
|
key: string | number;
|
|
17
|
-
label
|
|
25
|
+
/** Item label. Appends a colon at the end. */
|
|
26
|
+
label: ReactNode;
|
|
27
|
+
/** Sets the color of the label. */
|
|
18
28
|
labelColor: string;
|
|
29
|
+
/** Lets the label wrap and makes it not take the minimum width. */
|
|
19
30
|
labelWrap: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Align the content text.
|
|
33
|
+
*
|
|
34
|
+
* - `left` (default)
|
|
35
|
+
* - `center`
|
|
36
|
+
* - `right`
|
|
37
|
+
*/
|
|
20
38
|
textAlign: string;
|
|
39
|
+
/** Tooltip text. */
|
|
21
40
|
tooltip: string;
|
|
41
|
+
/**
|
|
42
|
+
* Align both the label and the content vertically.
|
|
43
|
+
*
|
|
44
|
+
* - `baseline` (default)
|
|
45
|
+
* - `top`
|
|
46
|
+
* - `middle`
|
|
47
|
+
* - `bottom`
|
|
48
|
+
*/
|
|
22
49
|
verticalAlign: string;
|
|
23
50
|
}>;
|
|
24
51
|
declare function LabeledListItem(props: LabeledListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
25
52
|
type LabeledListDividerProps = {
|
|
53
|
+
/** Size of the divider. */
|
|
26
54
|
size?: number;
|
|
27
55
|
};
|
|
28
56
|
declare function LabeledListDivider(props: LabeledListDividerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -73,6 +73,7 @@ function z(e) {
|
|
|
73
73
|
a && /* @__PURE__ */ l("td", { className: i([o.cell, o.buttons]), children: a })
|
|
74
74
|
] });
|
|
75
75
|
}
|
|
76
|
+
p.Item = z;
|
|
76
77
|
function A(e) {
|
|
77
78
|
const t = e.size ? g(Math.max(0, e.size - 1)) : 0;
|
|
78
79
|
return /* @__PURE__ */ l("tr", { className: "LabeledList__row", children: /* @__PURE__ */ l(
|
|
@@ -87,7 +88,6 @@ function A(e) {
|
|
|
87
88
|
}
|
|
88
89
|
) });
|
|
89
90
|
}
|
|
90
|
-
p.Item = z;
|
|
91
91
|
p.Divider = A;
|
|
92
92
|
export {
|
|
93
93
|
p as LabeledList
|
|
@@ -7,10 +7,13 @@ type None = {
|
|
|
7
7
|
[K in NoticeType]?: undefined;
|
|
8
8
|
};
|
|
9
9
|
type ExclusiveProps = None | (Omit<None, 'info'> & {
|
|
10
|
+
/** Blue notice */
|
|
10
11
|
info: boolean;
|
|
11
12
|
}) | (Omit<None, 'success'> & {
|
|
13
|
+
/** Green notice */
|
|
12
14
|
success: boolean;
|
|
13
15
|
}) | (Omit<None, 'danger'> & {
|
|
16
|
+
/** Red notice */
|
|
14
17
|
danger: boolean;
|
|
15
18
|
});
|
|
16
19
|
export declare function NoticeBox(props: Props): import("react/jsx-runtime").JSX.Element;
|