tgui-core 1.1.7 → 1.1.9
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/lib/common/assets.ts +38 -0
- package/lib/common/collections.ts +27 -0
- package/lib/common/color.ts +88 -0
- package/lib/common/constants.ts +349 -0
- package/lib/common/events.ts +262 -0
- package/{dist/common/exhaustive.d.ts → lib/common/exhaustive.ts} +3 -1
- package/lib/common/format.ts +167 -0
- package/{dist/common/fp.d.ts → lib/common/fp.ts} +16 -2
- package/lib/common/hotkeys.ts +207 -0
- package/lib/common/http.ts +16 -0
- package/lib/common/keycodes.ts +86 -0
- package/{dist/common/keys.d.ts → lib/common/keys.ts} +24 -21
- package/lib/common/math.ts +76 -0
- package/lib/common/perf.ts +72 -0
- package/lib/common/random.ts +32 -0
- package/lib/common/react.ts +59 -0
- package/lib/common/redux.ts +187 -0
- package/lib/common/storage.ts +207 -0
- package/lib/common/string.ts +169 -0
- package/lib/common/timer.ts +63 -0
- package/lib/common/type-utils.ts +41 -0
- package/lib/common/types.d.ts +12 -0
- package/lib/common/uuid.ts +18 -0
- package/lib/components/AnimatedNumber.tsx +180 -0
- package/lib/components/Autofocus.tsx +23 -0
- package/lib/components/Blink.tsx +91 -0
- package/lib/components/BlockQuote.tsx +9 -0
- package/lib/components/BodyZoneSelector.tsx +149 -0
- package/lib/components/Box.tsx +252 -0
- package/lib/components/Button.tsx +425 -0
- package/lib/components/ByondUi.jsx +110 -0
- package/lib/components/Chart.tsx +155 -0
- package/lib/components/Collapsible.tsx +43 -0
- package/lib/components/ColorBox.tsx +29 -0
- package/lib/components/Dialog.tsx +81 -0
- package/lib/components/Dimmer.tsx +13 -0
- package/lib/components/Divider.tsx +20 -0
- package/lib/components/DmIcon.tsx +86 -0
- package/lib/components/DraggableControl.jsx +276 -0
- package/lib/components/Dropdown.tsx +246 -0
- package/lib/components/FakeTerminal.jsx +52 -0
- package/lib/components/FitText.tsx +99 -0
- package/lib/components/Flex.tsx +159 -0
- package/lib/components/Icon.tsx +95 -0
- package/lib/components/Image.tsx +54 -0
- package/lib/components/InfinitePlane.jsx +192 -0
- package/lib/components/Input.tsx +176 -0
- package/lib/components/KeyListener.tsx +40 -0
- package/lib/components/Knob.tsx +178 -0
- package/lib/components/LabeledControls.tsx +44 -0
- package/lib/components/LabeledList.tsx +154 -0
- package/lib/components/MenuBar.tsx +228 -0
- package/lib/components/Modal.tsx +23 -0
- package/lib/components/NoticeBox.tsx +45 -0
- package/lib/components/NumberInput.tsx +328 -0
- package/lib/components/Popper.tsx +100 -0
- package/lib/components/ProgressBar.tsx +105 -0
- package/lib/components/RestrictedInput.jsx +301 -0
- package/lib/components/RoundGauge.tsx +180 -0
- package/lib/components/Section.tsx +120 -0
- package/lib/components/Slider.tsx +169 -0
- package/lib/components/Stack.tsx +96 -0
- package/lib/components/StyleableSection.tsx +33 -0
- package/lib/components/Table.tsx +84 -0
- package/lib/components/Tabs.tsx +89 -0
- package/lib/components/TextArea.tsx +182 -0
- package/lib/components/TimeDisplay.jsx +64 -0
- package/lib/components/Tooltip.tsx +152 -0
- package/lib/components/TrackOutsideClicks.tsx +35 -0
- package/lib/components/VirtualList.tsx +69 -0
- package/lib/styles/atomic/candystripe.scss +8 -0
- package/lib/styles/atomic/centered-image.scss +7 -0
- package/lib/styles/atomic/color.scss +21 -0
- package/lib/styles/atomic/debug-layout.scss +17 -0
- package/lib/styles/atomic/fit-text.scss +14 -0
- package/lib/styles/atomic/links.scss +12 -0
- package/lib/styles/atomic/outline.scss +47 -0
- package/lib/styles/atomic/text.scss +44 -0
- package/lib/styles/base.scss +32 -0
- package/lib/styles/colors.scss +92 -0
- package/lib/styles/components/BlockQuote.module.scss +20 -0
- package/lib/styles/components/BlockQuote.module.scss.d.ts +4 -0
- package/lib/styles/components/Button.module.scss +157 -0
- package/lib/styles/components/Button.module.scss.d.ts +46 -0
- package/lib/styles/components/ColorBox.module.scss +12 -0
- package/lib/styles/components/ColorBox.module.scss.d.ts +4 -0
- package/lib/styles/components/Dialog.module.scss +60 -0
- package/lib/styles/components/Dialog.module.scss.d.ts +10 -0
- package/lib/styles/components/Dimmer.module.scss +22 -0
- package/lib/styles/components/Dimmer.module.scss.d.ts +4 -0
- package/lib/styles/components/Divider.module.scss +27 -0
- package/lib/styles/components/Divider.module.scss.d.ts +6 -0
- package/lib/styles/components/Dropdown.scss +72 -0
- package/lib/styles/components/Flex.module.scss +13 -0
- package/lib/styles/components/Flex.module.scss.d.ts +5 -0
- package/lib/styles/components/Icon.module.scss +25 -0
- package/lib/styles/components/Icon.module.scss.d.ts +5 -0
- package/lib/styles/components/Input.module.scss +64 -0
- package/lib/styles/components/Input.module.scss.d.ts +8 -0
- package/lib/styles/components/Knob.module.scss +131 -0
- package/lib/styles/components/Knob.module.scss.d.ts +33 -0
- package/lib/styles/components/LabeledList.module.scss +49 -0
- package/lib/styles/components/LabeledList.module.scss.d.ts +8 -0
- package/lib/styles/components/MenuBar.module.scss +75 -0
- package/lib/styles/components/MenuBar.module.scss.d.ts +14 -0
- package/lib/styles/components/Modal.module.scss +14 -0
- package/lib/styles/components/Modal.module.scss.d.ts +4 -0
- package/lib/styles/components/NoticeBox.module.scss +65 -0
- package/lib/styles/components/NoticeBox.module.scss.d.ts +27 -0
- package/lib/styles/components/NumberInput.module.scss +71 -0
- package/lib/styles/components/NumberInput.module.scss.d.ts +9 -0
- package/lib/styles/components/ProgressBar.module.scss +63 -0
- package/lib/styles/components/ProgressBar.module.scss.d.ts +27 -0
- package/lib/styles/components/RoundGauge.module.scss +85 -0
- package/lib/styles/components/RoundGauge.module.scss.d.ts +49 -0
- package/lib/styles/components/Section.module.scss +130 -0
- package/lib/styles/components/Section.module.scss.d.ts +13 -0
- package/lib/styles/components/Slider.module.scss +54 -0
- package/lib/styles/components/Slider.module.scss.d.ts +8 -0
- package/lib/styles/components/Stack.module.scss +60 -0
- package/lib/styles/components/Stack.module.scss.d.ts +12 -0
- package/lib/styles/components/Table.module.scss +44 -0
- package/lib/styles/components/Table.module.scss.d.ts +10 -0
- package/lib/styles/components/Tabs.module.scss +144 -0
- package/lib/styles/components/Tabs.module.scss.d.ts +35 -0
- package/lib/styles/components/TextArea.module.scss +86 -0
- package/lib/styles/components/TextArea.module.scss.d.ts +11 -0
- package/lib/styles/components/Tooltip.module.scss +24 -0
- package/lib/styles/components/Tooltip.module.scss.d.ts +4 -0
- package/lib/styles/functions.scss +79 -0
- package/lib/styles/input.scss +9 -0
- package/lib/styles/main.scss +20 -0
- package/lib/styles/reset.scss +68 -0
- package/package.json +6 -6
- package/dist/ProgressBar.module-BkAFfFy0.js +0 -29
- package/dist/Section.module-CLVHJ4yA.js +0 -15
- package/dist/assets/BlockQuote.css +0 -1
- package/dist/assets/Button.css +0 -1
- package/dist/assets/ColorBox.css +0 -1
- package/dist/assets/Dialog.css +0 -1
- package/dist/assets/Dimmer.css +0 -1
- package/dist/assets/Divider.css +0 -1
- package/dist/assets/Flex.css +0 -1
- package/dist/assets/Icon.css +0 -6
- package/dist/assets/Input.css +0 -1
- package/dist/assets/Knob.css +0 -1
- package/dist/assets/LabeledList.css +0 -1
- package/dist/assets/MenuBar.css +0 -1
- package/dist/assets/Modal.css +0 -1
- package/dist/assets/NoticeBox.css +0 -1
- package/dist/assets/NumberInput.css +0 -1
- package/dist/assets/ProgressBar.css +0 -1
- package/dist/assets/RoundGauge.css +0 -1
- package/dist/assets/Section.css +0 -1
- package/dist/assets/Slider.css +0 -1
- package/dist/assets/Stack.css +0 -1
- package/dist/assets/Table.css +0 -1
- package/dist/assets/Tabs.css +0 -1
- package/dist/assets/TextArea.css +0 -1
- package/dist/assets/Tooltip.css +0 -1
- package/dist/common/assets.d.ts +0 -4
- package/dist/common/assets.js +0 -21
- package/dist/common/collections.d.ts +0 -10
- package/dist/common/collections.js +0 -15
- package/dist/common/color.d.ts +0 -25
- package/dist/common/color.js +0 -69
- package/dist/common/constants.d.ts +0 -102
- package/dist/common/constants.js +0 -312
- package/dist/common/events.d.ts +0 -33
- package/dist/common/events.js +0 -147
- package/dist/common/exhaustive.js +0 -6
- package/dist/common/format.d.ts +0 -11
- package/dist/common/format.js +0 -114
- package/dist/common/fp.js +0 -9
- package/dist/common/hotkeys.d.ts +0 -25
- package/dist/common/hotkeys.js +0 -112
- package/dist/common/http.d.ts +0 -4
- package/dist/common/http.js +0 -10
- package/dist/common/keycodes.d.ts +0 -85
- package/dist/common/keycodes.js +0 -88
- package/dist/common/keys.js +0 -8
- package/dist/common/math.d.ts +0 -39
- package/dist/common/math.js +0 -41
- package/dist/common/perf.d.ts +0 -24
- package/dist/common/perf.js +0 -33
- package/dist/common/random.d.ts +0 -16
- package/dist/common/random.js +0 -18
- package/dist/common/react.d.ts +0 -23
- package/dist/common/react.js +0 -30
- package/dist/common/redux.d.ts +0 -64
- package/dist/common/redux.js +0 -72
- package/dist/common/storage.js +0 -124
- package/dist/common/string.d.ts +0 -65
- package/dist/common/string.js +0 -83
- package/dist/common/timer.d.ts +0 -18
- package/dist/common/timer.js +0 -28
- package/dist/common/type-utils.d.ts +0 -9
- package/dist/common/type-utils.js +0 -25
- package/dist/common/uuid.d.ts +0 -9
- package/dist/common/uuid.js +0 -10
- package/dist/components/AnimatedNumber.d.ts +0 -60
- package/dist/components/AnimatedNumber.js +0 -76
- package/dist/components/Autofocus.d.ts +0 -4
- package/dist/components/Autofocus.js +0 -17
- package/dist/components/Blink.d.ts +0 -26
- package/dist/components/Blink.js +0 -56
- package/dist/components/BlockQuote.d.ts +0 -3
- package/dist/components/BlockQuote.js +0 -13
- package/dist/components/BodyZoneSelector.d.ts +0 -28
- package/dist/components/BodyZoneSelector.js +0 -115
- package/dist/components/Box.d.ts +0 -91
- package/dist/components/Box.js +0 -133
- package/dist/components/Button.d.ts +0 -93
- package/dist/components/Button.js +0 -298
- package/dist/components/ByondUi.js +0 -73
- package/dist/components/Chart.d.ts +0 -28
- package/dist/components/Chart.js +0 -95
- package/dist/components/Collapsible.d.ts +0 -15
- package/dist/components/Collapsible.js +0 -27
- package/dist/components/ColorBox.d.ts +0 -8
- package/dist/components/ColorBox.js +0 -24
- package/dist/components/Dialog.d.ts +0 -24
- package/dist/components/Dialog.js +0 -67
- package/dist/components/Dimmer.d.ts +0 -3
- package/dist/components/Dimmer.js +0 -13
- package/dist/components/Divider.d.ts +0 -6
- package/dist/components/Divider.js +0 -22
- package/dist/components/DmIcon.d.ts +0 -31
- package/dist/components/DmIcon.js +0 -31
- package/dist/components/DraggableControl.js +0 -176
- package/dist/components/Dropdown.d.ts +0 -48
- package/dist/components/Dropdown.js +0 -152
- package/dist/components/FakeTerminal.js +0 -38
- package/dist/components/FitText.d.ts +0 -22
- package/dist/components/FitText.js +0 -63
- package/dist/components/Flex.d.ts +0 -93
- package/dist/components/Flex.js +0 -72
- package/dist/components/Icon.d.ts +0 -30
- package/dist/components/Icon.js +0 -51
- package/dist/components/Image.d.ts +0 -14
- package/dist/components/Image.js +0 -35
- package/dist/components/InfinitePlane.js +0 -139
- package/dist/components/Input.d.ts +0 -61
- package/dist/components/Input.js +0 -89
- package/dist/components/KeyListener.d.ts +0 -15
- package/dist/components/KeyListener.js +0 -23
- package/dist/components/Knob.d.ts +0 -49
- package/dist/components/Knob.js +0 -162
- package/dist/components/LabeledControls.d.ts +0 -11
- package/dist/components/LabeledControls.js +0 -39
- package/dist/components/LabeledList.d.ts +0 -57
- package/dist/components/LabeledList.js +0 -94
- package/dist/components/MenuBar.d.ts +0 -28
- package/dist/components/MenuBar.js +0 -174
- package/dist/components/Modal.d.ts +0 -3
- package/dist/components/Modal.js +0 -25
- package/dist/components/NoticeBox.d.ts +0 -20
- package/dist/components/NoticeBox.js +0 -49
- package/dist/components/NumberInput.d.ts +0 -45
- package/dist/components/NumberInput.js +0 -221
- package/dist/components/Popper.d.ts +0 -27
- package/dist/components/Popper.js +0 -177
- package/dist/components/ProgressBar.d.ts +0 -46
- package/dist/components/ProgressBar.js +0 -37
- package/dist/components/RestrictedInput.js +0 -155
- package/dist/components/RoundGauge.d.ts +0 -53
- package/dist/components/RoundGauge.js +0 -147
- package/dist/components/Section.d.ts +0 -63
- package/dist/components/Section.js +0 -62
- package/dist/components/Slider.d.ts +0 -46
- package/dist/components/Slider.js +0 -124
- package/dist/components/Stack.d.ts +0 -27
- package/dist/components/Stack.js +0 -67
- package/dist/components/StyleableSection.d.ts +0 -11
- package/dist/components/StyleableSection.js +0 -16
- package/dist/components/Table.d.ts +0 -29
- package/dist/components/Table.js +0 -67
- package/dist/components/Tabs.d.ts +0 -23
- package/dist/components/Tabs.js +0 -89
- package/dist/components/TextArea.d.ts +0 -39
- package/dist/components/TextArea.js +0 -118
- package/dist/components/TimeDisplay.js +0 -34
- package/dist/components/Tooltip.d.ts +0 -29
- package/dist/components/Tooltip.js +0 -83
- package/dist/components/TrackOutsideClicks.d.ts +0 -13
- package/dist/components/TrackOutsideClicks.js +0 -24
- package/dist/components/VirtualList.d.ts +0 -8
- package/dist/components/VirtualList.js +0 -34
- package/dist/components/index.js +0 -92
- package/dist/popper-CiqSDJTE.js +0 -906
- /package/{dist/components/index.d.ts → lib/components/index.ts} +0 -0
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Component, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, RefObject } from 'react';
|
|
2
|
-
import { BooleanLike } from '../common/react';
|
|
3
|
-
|
|
4
|
-
type Props = Required<{
|
|
5
|
-
maxValue: number;
|
|
6
|
-
minValue: number;
|
|
7
|
-
step: number;
|
|
8
|
-
value: number | string;
|
|
9
|
-
}> & Partial<{
|
|
10
|
-
animated: BooleanLike;
|
|
11
|
-
className: string;
|
|
12
|
-
disabled: BooleanLike;
|
|
13
|
-
fluid: BooleanLike;
|
|
14
|
-
fontSize: string;
|
|
15
|
-
format: (value: number) => string;
|
|
16
|
-
height: string;
|
|
17
|
-
lineHeight: string;
|
|
18
|
-
onChange: (value: number) => void;
|
|
19
|
-
onDrag: (value: number) => void;
|
|
20
|
-
stepPixelSize: number;
|
|
21
|
-
unit: string;
|
|
22
|
-
width: string;
|
|
23
|
-
}>;
|
|
24
|
-
type State = {
|
|
25
|
-
currentValue: number;
|
|
26
|
-
dragging: BooleanLike;
|
|
27
|
-
editing: BooleanLike;
|
|
28
|
-
origin: number;
|
|
29
|
-
previousValue: number;
|
|
30
|
-
};
|
|
31
|
-
export declare class NumberInput extends Component<Props, State> {
|
|
32
|
-
inputRef: RefObject<HTMLInputElement>;
|
|
33
|
-
dragTimeout: NodeJS.Timeout;
|
|
34
|
-
dragInterval: NodeJS.Timeout;
|
|
35
|
-
state: State;
|
|
36
|
-
constructor(props: Props);
|
|
37
|
-
componentDidMount(): void;
|
|
38
|
-
handleDragStart: MouseEventHandler<HTMLDivElement>;
|
|
39
|
-
handleDragMove: (event: MouseEvent) => void;
|
|
40
|
-
handleDragEnd: (_event: MouseEvent) => void;
|
|
41
|
-
handleBlur: FocusEventHandler<HTMLInputElement>;
|
|
42
|
-
handleKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
43
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
}
|
|
45
|
-
export {};
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import '../assets/NumberInput.css';var w = Object.defineProperty;
|
|
2
|
-
var E = (c, d, e) => d in c ? w(c, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[d] = e;
|
|
3
|
-
var l = (c, d, e) => E(c, typeof d != "symbol" ? d + "" : d, e);
|
|
4
|
-
import { jsxs as _, jsx as g } from "react/jsx-runtime";
|
|
5
|
-
import { Component as I, createRef as D } from "react";
|
|
6
|
-
import { KEY as S } from "../common/keys.js";
|
|
7
|
-
import { clamp as h } from "../common/math.js";
|
|
8
|
-
import { classes as T } from "../common/react.js";
|
|
9
|
-
import { AnimatedNumber as F } from "./AnimatedNumber.js";
|
|
10
|
-
import { Box as M } from "./Box.js";
|
|
11
|
-
const R = "_numberInput_4xyrw_20", B = "_fluid_4xyrw_36", K = "_content_4xyrw_40", L = "_barContainer_4xyrw_44", Y = "_bar_4xyrw_44", j = "_inner_4xyrw_61", p = {
|
|
12
|
-
numberInput: R,
|
|
13
|
-
fluid: B,
|
|
14
|
-
content: K,
|
|
15
|
-
barContainer: L,
|
|
16
|
-
bar: Y,
|
|
17
|
-
inner: j
|
|
18
|
-
};
|
|
19
|
-
class $ extends I {
|
|
20
|
-
constructor(e) {
|
|
21
|
-
super(e);
|
|
22
|
-
// Ref to the input field to set focus & highlight
|
|
23
|
-
l(this, "inputRef", D());
|
|
24
|
-
// After this time has elapsed we are in drag mode so no editing when dragging ends
|
|
25
|
-
l(this, "dragTimeout");
|
|
26
|
-
// Call onDrag at this interval
|
|
27
|
-
l(this, "dragInterval");
|
|
28
|
-
// default values for the number input state
|
|
29
|
-
l(this, "state", {
|
|
30
|
-
editing: !1,
|
|
31
|
-
dragging: !1,
|
|
32
|
-
currentValue: 0,
|
|
33
|
-
previousValue: 0,
|
|
34
|
-
origin: 0
|
|
35
|
-
});
|
|
36
|
-
l(this, "handleDragStart", (e) => {
|
|
37
|
-
const { value: a, disabled: u } = this.props, { editing: n } = this.state;
|
|
38
|
-
if (u || n)
|
|
39
|
-
return;
|
|
40
|
-
document.body.style["pointer-events"] = "none";
|
|
41
|
-
const i = parseFloat(a.toString());
|
|
42
|
-
this.setState({
|
|
43
|
-
dragging: !1,
|
|
44
|
-
origin: e.screenY,
|
|
45
|
-
currentValue: i,
|
|
46
|
-
previousValue: i
|
|
47
|
-
}), this.dragTimeout = setTimeout(() => {
|
|
48
|
-
this.setState({
|
|
49
|
-
dragging: !0
|
|
50
|
-
});
|
|
51
|
-
}, 250), this.dragInterval = setInterval(() => {
|
|
52
|
-
const { dragging: o, currentValue: s, previousValue: t } = this.state, { onDrag: r } = this.props;
|
|
53
|
-
o && s !== t && (this.setState({
|
|
54
|
-
previousValue: s
|
|
55
|
-
}), r == null || r(s));
|
|
56
|
-
}, 400), document.addEventListener("mousemove", this.handleDragMove), document.addEventListener("mouseup", this.handleDragEnd);
|
|
57
|
-
});
|
|
58
|
-
l(this, "handleDragMove", (e) => {
|
|
59
|
-
const { minValue: a, maxValue: u, step: n, stepPixelSize: i, disabled: o } = this.props;
|
|
60
|
-
o || this.setState((s) => {
|
|
61
|
-
const t = { ...s }, r = t.origin - e.screenY;
|
|
62
|
-
if (s.dragging) {
|
|
63
|
-
const f = isFinite(a) ? a % n : 0;
|
|
64
|
-
t.currentValue = h(
|
|
65
|
-
t.currentValue + r * n / (i || 1),
|
|
66
|
-
a - n,
|
|
67
|
-
u + n
|
|
68
|
-
), t.currentValue = h(
|
|
69
|
-
t.currentValue - t.currentValue % n + f,
|
|
70
|
-
a,
|
|
71
|
-
u
|
|
72
|
-
), t.origin = e.screenY;
|
|
73
|
-
} else Math.abs(r) > 4 && (t.dragging = !0);
|
|
74
|
-
return t;
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
l(this, "handleDragEnd", (e) => {
|
|
78
|
-
const { dragging: a, currentValue: u } = this.state, { onDrag: n, onChange: i, disabled: o } = this.props;
|
|
79
|
-
if (!o) {
|
|
80
|
-
if (document.body.style["pointer-events"] = "auto", clearInterval(this.dragInterval), clearTimeout(this.dragTimeout), this.setState({
|
|
81
|
-
dragging: !1,
|
|
82
|
-
editing: !a,
|
|
83
|
-
previousValue: u
|
|
84
|
-
}), a)
|
|
85
|
-
i == null || i(u), n == null || n(u);
|
|
86
|
-
else if (this.inputRef) {
|
|
87
|
-
const s = this.inputRef.current;
|
|
88
|
-
s && (s.value = `${u}`, setTimeout(() => {
|
|
89
|
-
s.focus(), s.select();
|
|
90
|
-
}, 1));
|
|
91
|
-
}
|
|
92
|
-
document.removeEventListener("mousemove", this.handleDragMove), document.removeEventListener("mouseup", this.handleDragEnd);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
l(this, "handleBlur", (e) => {
|
|
96
|
-
const { editing: a, previousValue: u } = this.state, { minValue: n, maxValue: i, onChange: o, onDrag: s, disabled: t } = this.props;
|
|
97
|
-
if (t || !a)
|
|
98
|
-
return;
|
|
99
|
-
const r = h(
|
|
100
|
-
parseFloat(e.target.value),
|
|
101
|
-
n,
|
|
102
|
-
i
|
|
103
|
-
);
|
|
104
|
-
if (isNaN(r)) {
|
|
105
|
-
this.setState({
|
|
106
|
-
editing: !1
|
|
107
|
-
});
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.setState({
|
|
111
|
-
editing: !1,
|
|
112
|
-
currentValue: r,
|
|
113
|
-
previousValue: r
|
|
114
|
-
}), u !== r && (o == null || o(r), s == null || s(r));
|
|
115
|
-
});
|
|
116
|
-
l(this, "handleKeyDown", (e) => {
|
|
117
|
-
const { minValue: a, maxValue: u, onChange: n, onDrag: i, disabled: o } = this.props;
|
|
118
|
-
if (o)
|
|
119
|
-
return;
|
|
120
|
-
const { previousValue: s } = this.state;
|
|
121
|
-
if (e.key === S.Enter) {
|
|
122
|
-
const t = h(
|
|
123
|
-
parseFloat(e.currentTarget.value),
|
|
124
|
-
a,
|
|
125
|
-
u
|
|
126
|
-
);
|
|
127
|
-
if (isNaN(t)) {
|
|
128
|
-
this.setState({
|
|
129
|
-
editing: !1
|
|
130
|
-
});
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this.setState({
|
|
134
|
-
editing: !1,
|
|
135
|
-
currentValue: t,
|
|
136
|
-
previousValue: t
|
|
137
|
-
}), s !== t && (n == null || n(t), i == null || i(t));
|
|
138
|
-
} else e.key === S.Escape && this.setState({
|
|
139
|
-
editing: !1
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
componentDidMount() {
|
|
144
|
-
const e = parseFloat(this.props.value.toString());
|
|
145
|
-
this.setState({
|
|
146
|
-
currentValue: e,
|
|
147
|
-
previousValue: e
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
render() {
|
|
151
|
-
const { dragging: e, editing: a, currentValue: u } = this.state, {
|
|
152
|
-
className: n,
|
|
153
|
-
fluid: i,
|
|
154
|
-
animated: o,
|
|
155
|
-
unit: s,
|
|
156
|
-
value: t,
|
|
157
|
-
minValue: r,
|
|
158
|
-
maxValue: f,
|
|
159
|
-
height: v,
|
|
160
|
-
width: x,
|
|
161
|
-
lineHeight: b,
|
|
162
|
-
fontSize: y,
|
|
163
|
-
format: V
|
|
164
|
-
} = this.props;
|
|
165
|
-
let m = parseFloat(t.toString());
|
|
166
|
-
e && (m = u);
|
|
167
|
-
const N = /* @__PURE__ */ _("div", { className: p.content, children: [
|
|
168
|
-
o && !e ? /* @__PURE__ */ g(F, { value: m, format: V }) : V ? V(m) : m,
|
|
169
|
-
s ? " " + s : ""
|
|
170
|
-
] });
|
|
171
|
-
return /* @__PURE__ */ _(
|
|
172
|
-
M,
|
|
173
|
-
{
|
|
174
|
-
className: T([
|
|
175
|
-
p.numberInput,
|
|
176
|
-
i && p.fluid,
|
|
177
|
-
n
|
|
178
|
-
]),
|
|
179
|
-
minWidth: x,
|
|
180
|
-
minHeight: v,
|
|
181
|
-
lineHeight: b,
|
|
182
|
-
fontSize: y,
|
|
183
|
-
onMouseDown: this.handleDragStart,
|
|
184
|
-
children: [
|
|
185
|
-
/* @__PURE__ */ g("div", { className: p.barContainer, children: /* @__PURE__ */ g(
|
|
186
|
-
"div",
|
|
187
|
-
{
|
|
188
|
-
className: p.bar,
|
|
189
|
-
style: {
|
|
190
|
-
height: h(
|
|
191
|
-
(m - r) / (f - r) * 100,
|
|
192
|
-
0,
|
|
193
|
-
100
|
|
194
|
-
) + "%"
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
) }),
|
|
198
|
-
N,
|
|
199
|
-
/* @__PURE__ */ g(
|
|
200
|
-
"input",
|
|
201
|
-
{
|
|
202
|
-
ref: this.inputRef,
|
|
203
|
-
className: p.inner,
|
|
204
|
-
style: {
|
|
205
|
-
display: a ? "inline" : "none",
|
|
206
|
-
height: v,
|
|
207
|
-
lineHeight: b,
|
|
208
|
-
fontSize: y
|
|
209
|
-
},
|
|
210
|
-
onBlur: this.handleBlur,
|
|
211
|
-
onKeyDown: this.handleKeyDown
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
export {
|
|
220
|
-
$ as NumberInput
|
|
221
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Placement } from '@popperjs/core';
|
|
2
|
-
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type RequiredProps = {
|
|
5
|
-
/** The content to display in the popper */
|
|
6
|
-
content: ReactNode;
|
|
7
|
-
/** Whether the popper is open */
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
};
|
|
10
|
-
type OptionalProps = Partial<{
|
|
11
|
-
/** Base z-index of the popper div
|
|
12
|
-
* @default 5
|
|
13
|
-
*/
|
|
14
|
-
baseZIndex: number;
|
|
15
|
-
/** Called when the user clicks outside the popper */
|
|
16
|
-
onClickOutside: () => void;
|
|
17
|
-
/** Where to place the popper relative to the reference element */
|
|
18
|
-
placement: Placement;
|
|
19
|
-
}>;
|
|
20
|
-
type Props = RequiredProps & OptionalProps;
|
|
21
|
-
/**
|
|
22
|
-
* ## Popper
|
|
23
|
-
* Popper lets you position elements so that they don't go out of the bounds of the window.
|
|
24
|
-
* @url https://popper.js.org/react-popper/ for more information.
|
|
25
|
-
*/
|
|
26
|
-
export declare function Popper(props: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export {};
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { jsxs as M, Fragment as P, jsx as S } from "react/jsx-runtime";
|
|
2
|
-
import * as l from "react";
|
|
3
|
-
import { useState as E, useRef as g, useEffect as F } from "react";
|
|
4
|
-
import * as _ from "react-dom";
|
|
5
|
-
import { c as A } from "../popper-CiqSDJTE.js";
|
|
6
|
-
var j = function(r) {
|
|
7
|
-
return r.reduce(function(n, t) {
|
|
8
|
-
var o = t[0], u = t[1];
|
|
9
|
-
return n[o] = u, n;
|
|
10
|
-
}, {});
|
|
11
|
-
}, R = typeof window < "u" && window.document && window.document.createElement ? l.useLayoutEffect : l.useEffect;
|
|
12
|
-
function I(e) {
|
|
13
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
14
|
-
}
|
|
15
|
-
var U = typeof Element < "u", x = typeof Map == "function", z = typeof Set == "function", B = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
|
|
16
|
-
function w(e, r) {
|
|
17
|
-
if (e === r) return !0;
|
|
18
|
-
if (e && r && typeof e == "object" && typeof r == "object") {
|
|
19
|
-
if (e.constructor !== r.constructor) return !1;
|
|
20
|
-
var n, t, o;
|
|
21
|
-
if (Array.isArray(e)) {
|
|
22
|
-
if (n = e.length, n != r.length) return !1;
|
|
23
|
-
for (t = n; t-- !== 0; )
|
|
24
|
-
if (!w(e[t], r[t])) return !1;
|
|
25
|
-
return !0;
|
|
26
|
-
}
|
|
27
|
-
var u;
|
|
28
|
-
if (x && e instanceof Map && r instanceof Map) {
|
|
29
|
-
if (e.size !== r.size) return !1;
|
|
30
|
-
for (u = e.entries(); !(t = u.next()).done; )
|
|
31
|
-
if (!r.has(t.value[0])) return !1;
|
|
32
|
-
for (u = e.entries(); !(t = u.next()).done; )
|
|
33
|
-
if (!w(t.value[1], r.get(t.value[0]))) return !1;
|
|
34
|
-
return !0;
|
|
35
|
-
}
|
|
36
|
-
if (z && e instanceof Set && r instanceof Set) {
|
|
37
|
-
if (e.size !== r.size) return !1;
|
|
38
|
-
for (u = e.entries(); !(t = u.next()).done; )
|
|
39
|
-
if (!r.has(t.value[0])) return !1;
|
|
40
|
-
return !0;
|
|
41
|
-
}
|
|
42
|
-
if (B && ArrayBuffer.isView(e) && ArrayBuffer.isView(r)) {
|
|
43
|
-
if (n = e.length, n != r.length) return !1;
|
|
44
|
-
for (t = n; t-- !== 0; )
|
|
45
|
-
if (e[t] !== r[t]) return !1;
|
|
46
|
-
return !0;
|
|
47
|
-
}
|
|
48
|
-
if (e.constructor === RegExp) return e.source === r.source && e.flags === r.flags;
|
|
49
|
-
if (e.valueOf !== Object.prototype.valueOf && typeof e.valueOf == "function" && typeof r.valueOf == "function") return e.valueOf() === r.valueOf();
|
|
50
|
-
if (e.toString !== Object.prototype.toString && typeof e.toString == "function" && typeof r.toString == "function") return e.toString() === r.toString();
|
|
51
|
-
if (o = Object.keys(e), n = o.length, n !== Object.keys(r).length) return !1;
|
|
52
|
-
for (t = n; t-- !== 0; )
|
|
53
|
-
if (!Object.prototype.hasOwnProperty.call(r, o[t])) return !1;
|
|
54
|
-
if (U && e instanceof Element) return !1;
|
|
55
|
-
for (t = n; t-- !== 0; )
|
|
56
|
-
if (!((o[t] === "_owner" || o[t] === "__v" || o[t] === "__o") && e.$$typeof) && !w(e[o[t]], r[o[t]]))
|
|
57
|
-
return !1;
|
|
58
|
-
return !0;
|
|
59
|
-
}
|
|
60
|
-
return e !== e && r !== r;
|
|
61
|
-
}
|
|
62
|
-
var L = function(r, n) {
|
|
63
|
-
try {
|
|
64
|
-
return w(r, n);
|
|
65
|
-
} catch (t) {
|
|
66
|
-
if ((t.message || "").match(/stack|recursion/i))
|
|
67
|
-
return console.warn("react-fast-compare cannot handle circular refs"), !1;
|
|
68
|
-
throw t;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const q = /* @__PURE__ */ I(L);
|
|
72
|
-
var D = [], $ = function(r, n, t) {
|
|
73
|
-
t === void 0 && (t = {});
|
|
74
|
-
var o = l.useRef(null), u = {
|
|
75
|
-
onFirstUpdate: t.onFirstUpdate,
|
|
76
|
-
placement: t.placement || "bottom",
|
|
77
|
-
strategy: t.strategy || "absolute",
|
|
78
|
-
modifiers: t.modifiers || D
|
|
79
|
-
}, m = l.useState({
|
|
80
|
-
styles: {
|
|
81
|
-
popper: {
|
|
82
|
-
position: u.strategy,
|
|
83
|
-
left: "0",
|
|
84
|
-
top: "0"
|
|
85
|
-
},
|
|
86
|
-
arrow: {
|
|
87
|
-
position: "absolute"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
attributes: {}
|
|
91
|
-
}), y = m[0], O = m[1], v = l.useMemo(function() {
|
|
92
|
-
return {
|
|
93
|
-
name: "updateState",
|
|
94
|
-
enabled: !0,
|
|
95
|
-
phase: "write",
|
|
96
|
-
fn: function(d) {
|
|
97
|
-
var i = d.state, f = Object.keys(i.elements);
|
|
98
|
-
_.flushSync(function() {
|
|
99
|
-
O({
|
|
100
|
-
styles: j(f.map(function(c) {
|
|
101
|
-
return [c, i.styles[c] || {}];
|
|
102
|
-
})),
|
|
103
|
-
attributes: j(f.map(function(c) {
|
|
104
|
-
return [c, i.attributes[c]];
|
|
105
|
-
}))
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
requires: ["computeStyles"]
|
|
110
|
-
};
|
|
111
|
-
}, []), p = l.useMemo(function() {
|
|
112
|
-
var a = {
|
|
113
|
-
onFirstUpdate: u.onFirstUpdate,
|
|
114
|
-
placement: u.placement,
|
|
115
|
-
strategy: u.strategy,
|
|
116
|
-
modifiers: [].concat(u.modifiers, [v, {
|
|
117
|
-
name: "applyStyles",
|
|
118
|
-
enabled: !1
|
|
119
|
-
}])
|
|
120
|
-
};
|
|
121
|
-
return q(o.current, a) ? o.current || a : (o.current = a, a);
|
|
122
|
-
}, [u.onFirstUpdate, u.placement, u.strategy, u.modifiers, v]), s = l.useRef();
|
|
123
|
-
return R(function() {
|
|
124
|
-
s.current && s.current.setOptions(p);
|
|
125
|
-
}, [p]), R(function() {
|
|
126
|
-
if (!(r == null || n == null)) {
|
|
127
|
-
var a = t.createPopper || A, d = a(r, n, p);
|
|
128
|
-
return s.current = d, function() {
|
|
129
|
-
d.destroy(), s.current = null;
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}, [r, n, t.createPopper]), {
|
|
133
|
-
state: s.current ? s.current.state : null,
|
|
134
|
-
styles: y.styles,
|
|
135
|
-
attributes: y.attributes,
|
|
136
|
-
update: s.current ? s.current.update : null,
|
|
137
|
-
forceUpdate: s.current ? s.current.forceUpdate : null
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
function W(e) {
|
|
141
|
-
const { children: r, content: n, isOpen: t, onClickOutside: o, placement: u } = e, [m, y] = E(null), [O, v] = E(
|
|
142
|
-
null
|
|
143
|
-
), p = g(null), s = g(null), { styles: a, attributes: d } = $(m, O, {
|
|
144
|
-
placement: u
|
|
145
|
-
});
|
|
146
|
-
function i(f) {
|
|
147
|
-
var c, h;
|
|
148
|
-
!((c = p.current) != null && c.contains(f.target)) && !((h = s.current) != null && h.contains(f.target)) && (o == null || o());
|
|
149
|
-
}
|
|
150
|
-
return F(() => (t ? document.addEventListener("mousedown", i) : document.removeEventListener("mousedown", i), () => {
|
|
151
|
-
document.removeEventListener("mousedown", i);
|
|
152
|
-
}), [t]), /* @__PURE__ */ M(P, { children: [
|
|
153
|
-
/* @__PURE__ */ S(
|
|
154
|
-
"div",
|
|
155
|
-
{
|
|
156
|
-
ref: (f) => {
|
|
157
|
-
y(f), s.current = f;
|
|
158
|
-
},
|
|
159
|
-
children: r
|
|
160
|
-
}
|
|
161
|
-
),
|
|
162
|
-
t && /* @__PURE__ */ S(
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
ref: (f) => {
|
|
166
|
-
v(f), p.current = f;
|
|
167
|
-
},
|
|
168
|
-
style: { ...a.popper, zIndex: e.baseZIndex ?? 5 },
|
|
169
|
-
...d.popper,
|
|
170
|
-
children: n
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
] });
|
|
174
|
-
}
|
|
175
|
-
export {
|
|
176
|
-
W as Popper
|
|
177
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { BoxProps } from './Box';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Current progress as a floating point number between `minValue` (default: 0) and `maxValue` (default: 1).
|
|
7
|
-
* Determines the percentage and how filled the bar is.
|
|
8
|
-
*/
|
|
9
|
-
value: number;
|
|
10
|
-
} & Partial<{
|
|
11
|
-
/**
|
|
12
|
-
* Color of the progress bar. Can take any of the following formats:
|
|
13
|
-
* - `#ffffff` - Hex format
|
|
14
|
-
* - `rgb(r,g,b) / rgba(r,g,b,a)` - RGB format
|
|
15
|
-
* - `<name>` - the name of a `color-<name>` CSS class. See `CSS_COLORS` in `constants.js`.
|
|
16
|
-
* - `<name>` - the name of a base CSS color, if not overridden by the definitions above.
|
|
17
|
-
*/
|
|
18
|
-
color: string;
|
|
19
|
-
/** Highest possible value. */
|
|
20
|
-
maxValue: number;
|
|
21
|
-
/** Lowest possible value. */
|
|
22
|
-
minValue: number;
|
|
23
|
-
/**
|
|
24
|
-
* Applies a `color` to the progress bar based on whether the value lands in the range between `from` and `to`.
|
|
25
|
-
* This takes an object with the following format:
|
|
26
|
-
* ```tsx
|
|
27
|
-
* {
|
|
28
|
-
* (colorname): [from, to]
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
* For example:
|
|
32
|
-
* ```tsx
|
|
33
|
-
* <ProgressBar
|
|
34
|
-
* value={0.5}
|
|
35
|
-
* ranges={{
|
|
36
|
-
* bad: [0, 0.5],
|
|
37
|
-
* good: [0.5, 1],
|
|
38
|
-
* }}
|
|
39
|
-
* />
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
ranges: Record<string, [number, number]>;
|
|
44
|
-
}> & BoxProps & PropsWithChildren;
|
|
45
|
-
export declare function ProgressBar(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { CSS_COLORS as v } from "../common/constants.js";
|
|
3
|
-
import { keyOfMatchingRange as y, toFixed as N, scale as _, clamp01 as B } from "../common/math.js";
|
|
4
|
-
import { classes as m } from "../common/react.js";
|
|
5
|
-
import { s as o } from "../ProgressBar.module-BkAFfFy0.js";
|
|
6
|
-
import { computeBoxProps as S, computeBoxClassName as O } from "./Box.js";
|
|
7
|
-
function w(d) {
|
|
8
|
-
const {
|
|
9
|
-
className: f,
|
|
10
|
-
value: r,
|
|
11
|
-
minValue: u = 0,
|
|
12
|
-
maxValue: p = 1,
|
|
13
|
-
color: C,
|
|
14
|
-
ranges: h = {},
|
|
15
|
-
children: l,
|
|
16
|
-
...t
|
|
17
|
-
} = d, a = _(r, u, p), x = l !== void 0, s = C || y(r, h) || "default", e = S(t), c = [
|
|
18
|
-
o.progressBar,
|
|
19
|
-
f,
|
|
20
|
-
O(t)
|
|
21
|
-
], i = {
|
|
22
|
-
width: B(a) * 100 + "%"
|
|
23
|
-
};
|
|
24
|
-
return v.includes(s) || s === "default" ? c.push(o["color__" + s]) : (e.style = { ...e.style, borderColor: s }, i.backgroundColor = s), /* @__PURE__ */ g("div", { className: m(c), ...e, children: [
|
|
25
|
-
/* @__PURE__ */ n(
|
|
26
|
-
"div",
|
|
27
|
-
{
|
|
28
|
-
className: m([o.fill, o.fill__animated]),
|
|
29
|
-
style: i
|
|
30
|
-
}
|
|
31
|
-
),
|
|
32
|
-
/* @__PURE__ */ n("div", { className: o.content, children: x ? l : N(a * 100) + "%" })
|
|
33
|
-
] });
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
w as ProgressBar
|
|
37
|
-
};
|