tgui-core 1.1.23 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Section.module-qhQWhlUX.js +18 -0
- package/dist/assets/ImageButton.css +5 -0
- package/dist/assets/Section.css +1 -1
- package/dist/components/Box.d.ts +2 -0
- package/dist/components/Button.d.ts +2 -0
- package/dist/components/Button.js +178 -175
- package/dist/components/Collapsible.d.ts +2 -0
- package/dist/components/Collapsible.js +24 -16
- package/dist/components/DraggableControl.js +4 -6
- package/dist/components/ImageButton.d.ts +61 -0
- package/dist/components/ImageButton.js +218 -0
- package/dist/components/Input.js +47 -41
- package/dist/components/NoticeBox.d.ts +4 -1
- package/dist/components/NoticeBox.js +31 -30
- package/dist/components/NumberInput.js +99 -99
- package/dist/components/Section.d.ts +27 -34
- package/dist/components/Section.js +67 -60
- package/dist/components/Slider.d.ts +2 -0
- package/dist/components/StyleableSection.js +1 -1
- package/dist/components/Tabs.d.ts +1 -0
- package/dist/components/Tabs.js +69 -64
- package/dist/components/TextArea.d.ts +2 -0
- package/dist/components/TextArea.js +36 -36
- package/dist/components/TimeDisplay.js +8 -8
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +60 -58
- package/package.json +1 -1
- package/dist/Section.module-CLVHJ4yA.js +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as T, Fragment as N, jsx as F } from "react/jsx-runtime";
|
|
2
2
|
import { clamp as m } from "../common/math.js";
|
|
3
3
|
import { Component as b, createRef as I } from "react";
|
|
4
4
|
import { AnimatedNumber as M } from "./AnimatedNumber.js";
|
|
@@ -67,11 +67,9 @@ class C extends b {
|
|
|
67
67
|
this.suppressFlicker(), i && i(e, o), l && l(e, o);
|
|
68
68
|
else if (this.inputRef) {
|
|
69
69
|
const a = this.inputRef.current;
|
|
70
|
-
a.value = g
|
|
71
|
-
try {
|
|
70
|
+
a.value = g, setTimeout(() => {
|
|
72
71
|
a.focus(), a.select();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
72
|
+
}, 10);
|
|
75
73
|
}
|
|
76
74
|
};
|
|
77
75
|
}
|
|
@@ -99,7 +97,7 @@ class C extends b {
|
|
|
99
97
|
} = this.props;
|
|
100
98
|
let d = o;
|
|
101
99
|
(u || l) && (d = i);
|
|
102
|
-
const E = /* @__PURE__ */ N
|
|
100
|
+
const E = /* @__PURE__ */ T(N, { children: [
|
|
103
101
|
s && !u && !l ? /* @__PURE__ */ F(M, { value: d, format: h }) : h ? h(d) : d,
|
|
104
102
|
g ? " " + g : ""
|
|
105
103
|
] }), x = /* @__PURE__ */ F(
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Placement } from '@popperjs/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BooleanLike } from '../common/react';
|
|
4
|
+
import { BoxProps } from './Box';
|
|
5
|
+
|
|
6
|
+
type Props = Partial<{
|
|
7
|
+
/** Asset cache. Example: `asset={['assetname32x32', thing.key]}` */
|
|
8
|
+
asset: string[];
|
|
9
|
+
/** Classic way to put images. Example: `base64={thing.image}` */
|
|
10
|
+
base64: string;
|
|
11
|
+
/**
|
|
12
|
+
* Special container for buttons.
|
|
13
|
+
* You can put any other component here.
|
|
14
|
+
* Has some special stylings!
|
|
15
|
+
* Example: `buttons={<Button>Send</Button>}`
|
|
16
|
+
*/
|
|
17
|
+
buttons: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Enables alternate layout for `buttons` container.
|
|
20
|
+
* Without fluid, buttons will be on top and with `pointer-events: none`, useful for text info.
|
|
21
|
+
* With fluid, buttons will be in "hamburger" style.
|
|
22
|
+
*/
|
|
23
|
+
buttonsAlt: boolean;
|
|
24
|
+
/** Content under image. Or on the right if fluid. */
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
/** Applies a CSS class to the element. */
|
|
27
|
+
className: string;
|
|
28
|
+
/** Color of the button. See [Button](#button) but without `transparent`. */
|
|
29
|
+
color: string;
|
|
30
|
+
/** Makes button disabled and dark red if true. Also disables onClick. */
|
|
31
|
+
disabled: BooleanLike;
|
|
32
|
+
/** Optional. Adds a "stub" when loading DmIcon. */
|
|
33
|
+
dmFallback: ReactNode;
|
|
34
|
+
/** Parameter `icon` of component `DmIcon`. */
|
|
35
|
+
dmIcon: string | null;
|
|
36
|
+
/** Parameter `icon_state` of component `DmIcon`. */
|
|
37
|
+
dmIconState: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Changes the layout of the button, making it fill the entire horizontally available space.
|
|
40
|
+
* Allows the use of `title`
|
|
41
|
+
*/
|
|
42
|
+
fluid: boolean;
|
|
43
|
+
/** Parameter responsible for the size of the image, component and standard "stubs". */
|
|
44
|
+
imageSize: number;
|
|
45
|
+
/** Prop `src` of Image component. Example: `imageSrc={resolveAsset(thing.image}` */
|
|
46
|
+
imageSrc: string;
|
|
47
|
+
/** Called when button is clicked with LMB. */
|
|
48
|
+
onClick: (e: any) => void;
|
|
49
|
+
/** Called when button is clicked with RMB. */
|
|
50
|
+
onRightClick: (e: any) => void;
|
|
51
|
+
/** Makes button selected and green if true. */
|
|
52
|
+
selected: BooleanLike;
|
|
53
|
+
/** Requires `fluid` for work. Bold text with divider betwen content. */
|
|
54
|
+
title: string;
|
|
55
|
+
/** A fancy, boxy tooltip, which appears when hovering over the button */
|
|
56
|
+
tooltip: ReactNode;
|
|
57
|
+
/** Position of the tooltip. See [`Popper`](#Popper) for valid options. */
|
|
58
|
+
tooltipPosition: Placement;
|
|
59
|
+
}> & BoxProps;
|
|
60
|
+
export declare function ImageButton(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { classes as e } from "../common/react.js";
|
|
3
|
+
import { computeBoxProps as D } from "./Box.js";
|
|
4
|
+
import { DmIcon as F } from "./DmIcon.js";
|
|
5
|
+
import { Icon as E } from "./Icon.js";
|
|
6
|
+
import { Image as j } from "./Image.js";
|
|
7
|
+
import { Stack as I } from "./Stack.js";
|
|
8
|
+
import { Tooltip as z } from "./Tooltip.js";
|
|
9
|
+
import '../assets/ImageButton.css';const P = "_color__black_7gau9_18", q = "_contentColor__black_7gau9_29", M = "_buttonsContainerColor__black_7gau9_37", R = "_color__white_7gau9_45", T = "_contentColor__white_7gau9_56", G = "_buttonsContainerColor__white_7gau9_64", H = "_color__red_7gau9_72", J = "_contentColor__red_7gau9_83", K = "_buttonsContainerColor__red_7gau9_91", L = "_color__orange_7gau9_99", O = "_contentColor__orange_7gau9_110", Q = "_buttonsContainerColor__orange_7gau9_118", U = "_color__yellow_7gau9_126", V = "_contentColor__yellow_7gau9_137", W = "_buttonsContainerColor__yellow_7gau9_145", X = "_color__olive_7gau9_153", Y = "_contentColor__olive_7gau9_164", Z = "_buttonsContainerColor__olive_7gau9_172", oo = "_color__green_7gau9_180", to = "_contentColor__green_7gau9_191", _o = "_buttonsContainerColor__green_7gau9_199", no = "_color__teal_7gau9_207", eo = "_contentColor__teal_7gau9_218", ro = "_buttonsContainerColor__teal_7gau9_226", lo = "_color__blue_7gau9_234", ao = "_contentColor__blue_7gau9_245", co = "_buttonsContainerColor__blue_7gau9_253", so = "_color__violet_7gau9_261", io = "_contentColor__violet_7gau9_272", uo = "_buttonsContainerColor__violet_7gau9_280", Co = "_color__purple_7gau9_288", go = "_contentColor__purple_7gau9_299", bo = "_buttonsContainerColor__purple_7gau9_307", po = "_color__pink_7gau9_315", mo = "_contentColor__pink_7gau9_326", fo = "_buttonsContainerColor__pink_7gau9_334", ho = "_color__brown_7gau9_342", vo = "_contentColor__brown_7gau9_353", yo = "_buttonsContainerColor__brown_7gau9_361", wo = "_color__grey_7gau9_369", ko = "_contentColor__grey_7gau9_380", xo = "_buttonsContainerColor__grey_7gau9_388", Io = "_color__good_7gau9_423", $o = "_contentColor__good_7gau9_434", Ao = "_buttonsContainerColor__good_7gau9_442", Bo = "_color__average_7gau9_450", No = "_contentColor__average_7gau9_461", So = "_buttonsContainerColor__average_7gau9_469", Do = "_color__bad_7gau9_477", Fo = "_contentColor__bad_7gau9_488", Eo = "_buttonsContainerColor__bad_7gau9_496", jo = "_color__label_7gau9_504", zo = "_contentColor__label_7gau9_515", Po = "_buttonsContainerColor__label_7gau9_523", qo = "_color__default_7gau9_531", Mo = "_disabled_7gau9_542", Ro = "_selected_7gau9_547", To = "_contentColor__default_7gau9_558", Go = "_contentDisabled_7gau9_566", Ho = "_contentSelected_7gau9_571", Jo = "_buttonsContainerColor__default_7gau9_579", Ko = "_ImageButton_7gau9_587", Lo = "_noAction_7gau9_595", Oo = "_container_7gau9_598", Qo = "_image_7gau9_603", Uo = "_buttonsContainer_7gau9_37", Vo = "_buttonsAltContainer_7gau9_621", Wo = "_buttonsEmpty_7gau9_628", Xo = "_content_7gau9_29", Yo = "_fluid_7gau9_649", Zo = "_info_7gau9_661", ot = "_title_7gau9_667", tt = "_divider_7gau9_671", _t = "_contentFluid_7gau9_675", nt = "_hasButtons_7gau9_683", o = {
|
|
10
|
+
color__black: P,
|
|
11
|
+
contentColor__black: q,
|
|
12
|
+
buttonsContainerColor__black: M,
|
|
13
|
+
color__white: R,
|
|
14
|
+
contentColor__white: T,
|
|
15
|
+
buttonsContainerColor__white: G,
|
|
16
|
+
color__red: H,
|
|
17
|
+
contentColor__red: J,
|
|
18
|
+
buttonsContainerColor__red: K,
|
|
19
|
+
color__orange: L,
|
|
20
|
+
contentColor__orange: O,
|
|
21
|
+
buttonsContainerColor__orange: Q,
|
|
22
|
+
color__yellow: U,
|
|
23
|
+
contentColor__yellow: V,
|
|
24
|
+
buttonsContainerColor__yellow: W,
|
|
25
|
+
color__olive: X,
|
|
26
|
+
contentColor__olive: Y,
|
|
27
|
+
buttonsContainerColor__olive: Z,
|
|
28
|
+
color__green: oo,
|
|
29
|
+
contentColor__green: to,
|
|
30
|
+
buttonsContainerColor__green: _o,
|
|
31
|
+
color__teal: no,
|
|
32
|
+
contentColor__teal: eo,
|
|
33
|
+
buttonsContainerColor__teal: ro,
|
|
34
|
+
color__blue: lo,
|
|
35
|
+
contentColor__blue: ao,
|
|
36
|
+
buttonsContainerColor__blue: co,
|
|
37
|
+
color__violet: so,
|
|
38
|
+
contentColor__violet: io,
|
|
39
|
+
buttonsContainerColor__violet: uo,
|
|
40
|
+
color__purple: Co,
|
|
41
|
+
contentColor__purple: go,
|
|
42
|
+
buttonsContainerColor__purple: bo,
|
|
43
|
+
color__pink: po,
|
|
44
|
+
contentColor__pink: mo,
|
|
45
|
+
buttonsContainerColor__pink: fo,
|
|
46
|
+
color__brown: ho,
|
|
47
|
+
contentColor__brown: vo,
|
|
48
|
+
buttonsContainerColor__brown: yo,
|
|
49
|
+
color__grey: wo,
|
|
50
|
+
contentColor__grey: ko,
|
|
51
|
+
buttonsContainerColor__grey: xo,
|
|
52
|
+
"color__light-grey": "_color__light-grey_7gau9_396",
|
|
53
|
+
"contentColor__light-grey": "_contentColor__light-grey_7gau9_407",
|
|
54
|
+
"buttonsContainerColor__light-grey": "_buttonsContainerColor__light-grey_7gau9_415",
|
|
55
|
+
color__good: Io,
|
|
56
|
+
contentColor__good: $o,
|
|
57
|
+
buttonsContainerColor__good: Ao,
|
|
58
|
+
color__average: Bo,
|
|
59
|
+
contentColor__average: No,
|
|
60
|
+
buttonsContainerColor__average: So,
|
|
61
|
+
color__bad: Do,
|
|
62
|
+
contentColor__bad: Fo,
|
|
63
|
+
buttonsContainerColor__bad: Eo,
|
|
64
|
+
color__label: jo,
|
|
65
|
+
contentColor__label: zo,
|
|
66
|
+
buttonsContainerColor__label: Po,
|
|
67
|
+
color__default: qo,
|
|
68
|
+
disabled: Mo,
|
|
69
|
+
selected: Ro,
|
|
70
|
+
contentColor__default: To,
|
|
71
|
+
contentDisabled: Go,
|
|
72
|
+
contentSelected: Ho,
|
|
73
|
+
buttonsContainerColor__default: Jo,
|
|
74
|
+
ImageButton: Ko,
|
|
75
|
+
noAction: Lo,
|
|
76
|
+
container: Oo,
|
|
77
|
+
image: Qo,
|
|
78
|
+
buttonsContainer: Uo,
|
|
79
|
+
buttonsAltContainer: Vo,
|
|
80
|
+
buttonsEmpty: Wo,
|
|
81
|
+
content: Xo,
|
|
82
|
+
fluid: Yo,
|
|
83
|
+
info: Zo,
|
|
84
|
+
title: ot,
|
|
85
|
+
divider: tt,
|
|
86
|
+
contentFluid: _t,
|
|
87
|
+
hasButtons: nt
|
|
88
|
+
};
|
|
89
|
+
function Ct($) {
|
|
90
|
+
const {
|
|
91
|
+
asset: p,
|
|
92
|
+
base64: s,
|
|
93
|
+
buttons: i,
|
|
94
|
+
buttonsAlt: m,
|
|
95
|
+
children: r,
|
|
96
|
+
className: A,
|
|
97
|
+
color: _,
|
|
98
|
+
disabled: a,
|
|
99
|
+
dmFallback: f,
|
|
100
|
+
dmIcon: h,
|
|
101
|
+
dmIconState: v,
|
|
102
|
+
fluid: c,
|
|
103
|
+
imageSize: n = 64,
|
|
104
|
+
imageSrc: u,
|
|
105
|
+
onClick: C,
|
|
106
|
+
onRightClick: g,
|
|
107
|
+
selected: y,
|
|
108
|
+
title: w,
|
|
109
|
+
tooltip: k,
|
|
110
|
+
tooltipPosition: B,
|
|
111
|
+
...N
|
|
112
|
+
} = $;
|
|
113
|
+
function x(l, S) {
|
|
114
|
+
return /* @__PURE__ */ t(I, { height: `${n}px`, width: `${n}px`, children: /* @__PURE__ */ t(I.Item, { grow: !0, textAlign: "center", align: "center", children: /* @__PURE__ */ t(
|
|
115
|
+
E,
|
|
116
|
+
{
|
|
117
|
+
spin: S,
|
|
118
|
+
name: l,
|
|
119
|
+
color: "gray",
|
|
120
|
+
style: { fontSize: `calc(${n}px * 0.75)` }
|
|
121
|
+
}
|
|
122
|
+
) }) });
|
|
123
|
+
}
|
|
124
|
+
let b = /* @__PURE__ */ d(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: e([
|
|
128
|
+
o.container,
|
|
129
|
+
i && o.hasButtons,
|
|
130
|
+
!C && !g && o.noAction,
|
|
131
|
+
y && o.selected,
|
|
132
|
+
a && o.disabled,
|
|
133
|
+
_ && typeof _ == "string" ? o["color__" + _] : o.color__default
|
|
134
|
+
]),
|
|
135
|
+
tabIndex: a ? void 0 : 0,
|
|
136
|
+
onClick: (l) => {
|
|
137
|
+
!a && C && C(l);
|
|
138
|
+
},
|
|
139
|
+
onContextMenu: (l) => {
|
|
140
|
+
l.preventDefault(), !a && g && g(l);
|
|
141
|
+
},
|
|
142
|
+
style: { width: c ? "auto" : `calc(${n}px + 0.5em + 2px)` },
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ t("div", { className: e([o.image]), children: s || p || u ? /* @__PURE__ */ t(
|
|
145
|
+
j,
|
|
146
|
+
{
|
|
147
|
+
className: e(!s && !u && p || []),
|
|
148
|
+
src: s ? `data:image/png;base64,${s}` : u,
|
|
149
|
+
height: `${n}px`,
|
|
150
|
+
width: `${n}px`
|
|
151
|
+
}
|
|
152
|
+
) : h && v ? /* @__PURE__ */ t(
|
|
153
|
+
F,
|
|
154
|
+
{
|
|
155
|
+
icon: h,
|
|
156
|
+
icon_state: v,
|
|
157
|
+
fallback: f || x("spinner", !0),
|
|
158
|
+
height: `${n}px`,
|
|
159
|
+
width: `${n}px`
|
|
160
|
+
}
|
|
161
|
+
) : x("question", !1) }),
|
|
162
|
+
c ? /* @__PURE__ */ d("div", { className: e([o.info]), children: [
|
|
163
|
+
w && /* @__PURE__ */ t(
|
|
164
|
+
"span",
|
|
165
|
+
{
|
|
166
|
+
className: e([o.title, r && o.divider]),
|
|
167
|
+
children: w
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
r && /* @__PURE__ */ t("span", { className: e([o.contentFluid]), children: r })
|
|
171
|
+
] }) : r && /* @__PURE__ */ t(
|
|
172
|
+
"span",
|
|
173
|
+
{
|
|
174
|
+
className: e([
|
|
175
|
+
o.content,
|
|
176
|
+
y && o.contentSelected,
|
|
177
|
+
a && o.contentDisabled,
|
|
178
|
+
_ && typeof _ == "string" ? o["contentColor__" + _] : o.contentColor__default
|
|
179
|
+
]),
|
|
180
|
+
children: r
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
return k && (b = /* @__PURE__ */ t(z, { content: k, position: B, children: b })), /* @__PURE__ */ d(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
className: e([
|
|
190
|
+
o.ImageButton,
|
|
191
|
+
c && o.fluid,
|
|
192
|
+
A
|
|
193
|
+
]),
|
|
194
|
+
...D(N),
|
|
195
|
+
children: [
|
|
196
|
+
b,
|
|
197
|
+
i && /* @__PURE__ */ t(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: e([
|
|
201
|
+
o.buttonsContainer,
|
|
202
|
+
m && o.buttonsAltContainer,
|
|
203
|
+
!r && o.buttonsEmpty,
|
|
204
|
+
c && _ && typeof _ == "string" ? o["buttonsContainerColor__" + _] : c && o.buttonsContainerColor__default
|
|
205
|
+
]),
|
|
206
|
+
style: {
|
|
207
|
+
width: m ? `calc(${n}px + 0.5em)` : "auto"
|
|
208
|
+
},
|
|
209
|
+
children: i
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
export {
|
|
217
|
+
Ct as ImageButton
|
|
218
|
+
};
|
package/dist/components/Input.js
CHANGED
|
@@ -1,82 +1,88 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { KEY as
|
|
4
|
-
import { classes as
|
|
1
|
+
import { jsxs as K, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V, useEffect as d } from "react";
|
|
3
|
+
import { KEY as j, isEscape as k } from "../common/keys.js";
|
|
4
|
+
import { classes as B } from "../common/react.js";
|
|
5
5
|
import { debounce as R } from "../common/timer.js";
|
|
6
6
|
import { Box as S } from "./Box.js";
|
|
7
|
-
import '../assets/Input.css';const
|
|
8
|
-
input:
|
|
9
|
-
fluid:
|
|
10
|
-
baseline:
|
|
11
|
-
inner:
|
|
12
|
-
monospace:
|
|
7
|
+
import '../assets/Input.css';const F = "_input_17i79_20", L = "_fluid_17i79_35", Y = "_baseline_17i79_40", q = "_inner_17i79_45", v = "_monospace_17i79_71", u = {
|
|
8
|
+
input: F,
|
|
9
|
+
fluid: L,
|
|
10
|
+
baseline: Y,
|
|
11
|
+
inner: q,
|
|
12
|
+
monospace: v
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function a(r) {
|
|
15
15
|
return typeof r != "number" && typeof r != "string" ? "" : String(r);
|
|
16
16
|
}
|
|
17
17
|
const z = R((r) => r(), 250);
|
|
18
18
|
function P(r) {
|
|
19
19
|
const {
|
|
20
|
-
autoFocus:
|
|
21
|
-
autoSelect:
|
|
20
|
+
autoFocus: _,
|
|
21
|
+
autoSelect: f,
|
|
22
22
|
className: b,
|
|
23
23
|
disabled: g,
|
|
24
24
|
expensive: T,
|
|
25
25
|
fluid: y,
|
|
26
26
|
maxLength: x,
|
|
27
27
|
monospace: h,
|
|
28
|
-
onChange:
|
|
28
|
+
onChange: t,
|
|
29
29
|
onEnter: i,
|
|
30
30
|
onEscape: o,
|
|
31
31
|
onInput: s,
|
|
32
|
-
placeholder:
|
|
33
|
-
selfClear:
|
|
34
|
-
value:
|
|
35
|
-
...
|
|
36
|
-
} = r,
|
|
32
|
+
placeholder: w,
|
|
33
|
+
selfClear: I,
|
|
34
|
+
value: c,
|
|
35
|
+
...N
|
|
36
|
+
} = r, l = V(null);
|
|
37
37
|
function D(e) {
|
|
38
|
-
var
|
|
38
|
+
var p;
|
|
39
39
|
if (!s) return;
|
|
40
|
-
const
|
|
41
|
-
T ? z(() => s(e,
|
|
40
|
+
const n = (p = e.currentTarget) == null ? void 0 : p.value;
|
|
41
|
+
T ? z(() => s(e, n)) : s(e, n);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
if (e.key ===
|
|
45
|
-
i == null || i(e, e.currentTarget.value),
|
|
43
|
+
function E(e) {
|
|
44
|
+
if (e.key === j.Enter) {
|
|
45
|
+
i == null || i(e, e.currentTarget.value), I ? e.currentTarget.value = "" : (e.currentTarget.blur(), t == null || t(e, e.currentTarget.value));
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
e.key
|
|
48
|
+
k(e.key) && (o == null || o(e), e.currentTarget.value = a(c), e.currentTarget.blur());
|
|
49
49
|
}
|
|
50
|
-
return
|
|
51
|
-
const e =
|
|
50
|
+
return d(() => {
|
|
51
|
+
const e = l.current;
|
|
52
52
|
if (!e) return;
|
|
53
|
-
const
|
|
54
|
-
e.value !==
|
|
55
|
-
e.focus(),
|
|
53
|
+
const n = a(c);
|
|
54
|
+
e.value !== n && (e.value = n), !(!_ && !f) && setTimeout(() => {
|
|
55
|
+
e.focus(), f && e.select();
|
|
56
56
|
}, 1);
|
|
57
|
-
}, []),
|
|
57
|
+
}, []), d(() => {
|
|
58
|
+
const e = l.current;
|
|
59
|
+
if (!e || document.activeElement === e)
|
|
60
|
+
return;
|
|
61
|
+
const n = a(c);
|
|
62
|
+
e.value !== n && (e.value = n);
|
|
63
|
+
}), /* @__PURE__ */ K(
|
|
58
64
|
S,
|
|
59
65
|
{
|
|
60
|
-
className:
|
|
66
|
+
className: B([
|
|
61
67
|
u.input,
|
|
62
68
|
y && u.fluid,
|
|
63
69
|
h && u.monospace,
|
|
64
70
|
b
|
|
65
71
|
]),
|
|
66
|
-
...
|
|
72
|
+
...N,
|
|
67
73
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ m("div", { className: u.baseline, children: "." }),
|
|
75
|
+
/* @__PURE__ */ m(
|
|
70
76
|
"input",
|
|
71
77
|
{
|
|
72
78
|
className: u.inner,
|
|
73
79
|
disabled: g,
|
|
74
80
|
maxLength: x,
|
|
75
|
-
onBlur: (e) =>
|
|
81
|
+
onBlur: (e) => t == null ? void 0 : t(e, e.target.value),
|
|
76
82
|
onChange: D,
|
|
77
|
-
onKeyDown:
|
|
78
|
-
placeholder:
|
|
79
|
-
ref:
|
|
83
|
+
onKeyDown: E,
|
|
84
|
+
placeholder: w,
|
|
85
|
+
ref: l
|
|
80
86
|
}
|
|
81
87
|
)
|
|
82
88
|
]
|
|
@@ -85,5 +91,5 @@ function P(r) {
|
|
|
85
91
|
}
|
|
86
92
|
export {
|
|
87
93
|
P as Input,
|
|
88
|
-
|
|
94
|
+
a as toInputValue
|
|
89
95
|
};
|
|
@@ -2,7 +2,7 @@ import { BoxProps } from './Box';
|
|
|
2
2
|
|
|
3
3
|
type Props = ExclusiveProps & BoxProps;
|
|
4
4
|
/** You MUST use only one or none */
|
|
5
|
-
type NoticeType = 'info' | 'success' | 'danger';
|
|
5
|
+
type NoticeType = 'info' | 'success' | 'warning' | 'danger';
|
|
6
6
|
type None = {
|
|
7
7
|
[K in NoticeType]?: undefined;
|
|
8
8
|
};
|
|
@@ -12,6 +12,9 @@ type ExclusiveProps = None | (Omit<None, 'info'> & {
|
|
|
12
12
|
}) | (Omit<None, 'success'> & {
|
|
13
13
|
/** Green notice */
|
|
14
14
|
success: boolean;
|
|
15
|
+
}) | (Omit<None, 'warning'> & {
|
|
16
|
+
/** Orange notice */
|
|
17
|
+
warning: boolean;
|
|
15
18
|
}) | (Omit<None, 'danger'> & {
|
|
16
19
|
/** Red notice */
|
|
17
20
|
danger: boolean;
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { classes as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { classes as i } from "../common/react.js";
|
|
3
3
|
import { Box as y } from "./Box.js";
|
|
4
|
-
import '../assets/NoticeBox.css';const m = "_noticeBox_56yom_17",
|
|
4
|
+
import '../assets/NoticeBox.css';const m = "_noticeBox_56yom_17", g = "_color__black_56yom_28", b = "_color__white_56yom_33", d = "_color__red_56yom_38", w = "_color__orange_56yom_43", p = "_color__yellow_56yom_48", u = "_color__olive_56yom_53", f = "_color__green_56yom_58", v = "_color__teal_56yom_63", x = "_color__blue_56yom_68", k = "_color__violet_56yom_73", B = "_color__purple_56yom_78", h = "_color__pink_56yom_83", N = "_color__brown_56yom_88", j = "_color__grey_56yom_93", q = "_color__good_56yom_103", z = "_color__average_56yom_108", A = "_color__bad_56yom_113", C = "_color__label_56yom_118", D = "_info_56yom_123", E = "_success_56yom_128", F = "_warning_56yom_133", G = "_danger_56yom_138", o = {
|
|
5
5
|
noticeBox: m,
|
|
6
|
-
color__black:
|
|
7
|
-
color__white:
|
|
8
|
-
color__red:
|
|
9
|
-
color__orange:
|
|
6
|
+
color__black: g,
|
|
7
|
+
color__white: b,
|
|
8
|
+
color__red: d,
|
|
9
|
+
color__orange: w,
|
|
10
10
|
color__yellow: p,
|
|
11
11
|
color__olive: u,
|
|
12
|
-
color__green:
|
|
13
|
-
color__teal:
|
|
14
|
-
color__blue:
|
|
15
|
-
color__violet:
|
|
16
|
-
color__purple:
|
|
17
|
-
color__pink:
|
|
18
|
-
color__brown:
|
|
19
|
-
color__grey:
|
|
12
|
+
color__green: f,
|
|
13
|
+
color__teal: v,
|
|
14
|
+
color__blue: x,
|
|
15
|
+
color__violet: k,
|
|
16
|
+
color__purple: B,
|
|
17
|
+
color__pink: h,
|
|
18
|
+
color__brown: N,
|
|
19
|
+
color__grey: j,
|
|
20
20
|
"color__light-grey": "_color__light-grey_56yom_98",
|
|
21
|
-
color__good:
|
|
22
|
-
color__average:
|
|
23
|
-
color__bad:
|
|
24
|
-
color__label:
|
|
25
|
-
info:
|
|
26
|
-
success:
|
|
27
|
-
warning:
|
|
28
|
-
danger:
|
|
21
|
+
color__good: q,
|
|
22
|
+
color__average: z,
|
|
23
|
+
color__bad: A,
|
|
24
|
+
color__label: C,
|
|
25
|
+
info: D,
|
|
26
|
+
success: E,
|
|
27
|
+
warning: F,
|
|
28
|
+
danger: G
|
|
29
29
|
};
|
|
30
|
-
function
|
|
31
|
-
const { className: r, color: _, info: l, success: e,
|
|
32
|
-
return /* @__PURE__ */
|
|
30
|
+
function K(c) {
|
|
31
|
+
const { className: r, color: _, info: l, success: e, warning: n, danger: s, ...t } = c;
|
|
32
|
+
return /* @__PURE__ */ a(
|
|
33
33
|
y,
|
|
34
34
|
{
|
|
35
|
-
className:
|
|
35
|
+
className: i([
|
|
36
36
|
o.noticeBox,
|
|
37
37
|
_ && o["color__" + _],
|
|
38
38
|
l && o.info,
|
|
39
39
|
e && o.success,
|
|
40
|
-
n && o.
|
|
40
|
+
n && o.warning,
|
|
41
|
+
s && o.danger,
|
|
41
42
|
r
|
|
42
43
|
]),
|
|
43
|
-
...
|
|
44
|
+
...t
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
47
|
}
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
+
K as NoticeBox
|
|
49
50
|
};
|