@alxgrn/telefrag-ui 0.0.1
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/LICENSE +201 -0
- package/README.md +38 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/DatePicker.css +1 -0
- package/dist/assets/Editable.css +1 -0
- package/dist/assets/Fieldset.css +1 -0
- package/dist/assets/Files.css +1 -0
- package/dist/assets/Form.css +1 -0
- package/dist/assets/FormCol.css +1 -0
- package/dist/assets/FormRow.css +1 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/Label.css +1 -0
- package/dist/assets/Menu.css +1 -0
- package/dist/assets/Message.css +1 -0
- package/dist/assets/Modal.css +1 -0
- package/dist/assets/Popup.css +1 -0
- package/dist/assets/RadioLabel.css +1 -0
- package/dist/assets/Select.css +1 -0
- package/dist/assets/Time.css +1 -0
- package/dist/components/button/Button.d.ts +12 -0
- package/dist/components/button/Button.js +14 -0
- package/dist/components/checkbox/Checkbox.d.ts +6 -0
- package/dist/components/checkbox/Checkbox.js +26 -0
- package/dist/components/checkbox/CheckboxList.d.ts +19 -0
- package/dist/components/checkbox/CheckboxList.js +48 -0
- package/dist/components/date/Date.d.ts +15 -0
- package/dist/components/date/Date.js +83 -0
- package/dist/components/date/DatePicker.d.ts +17 -0
- package/dist/components/date/DatePicker.js +58 -0
- package/dist/components/fieldset/Fieldset.d.ts +11 -0
- package/dist/components/fieldset/Fieldset.js +25 -0
- package/dist/components/files/Files.d.ts +17 -0
- package/dist/components/files/Files.js +71 -0
- package/dist/components/form/Form.d.ts +19 -0
- package/dist/components/form/Form.js +149 -0
- package/dist/components/form/FormCol.d.ts +3 -0
- package/dist/components/form/FormCol.js +6 -0
- package/dist/components/form/FormRow.d.ts +3 -0
- package/dist/components/form/FormRow.js +6 -0
- package/dist/components/hidden/Hidden.d.ts +7 -0
- package/dist/components/hidden/Hidden.js +12 -0
- package/dist/components/input/Input.d.ts +18 -0
- package/dist/components/input/Input.js +69 -0
- package/dist/components/label/Label.d.ts +11 -0
- package/dist/components/label/Label.js +25 -0
- package/dist/components/radio/Radio.d.ts +22 -0
- package/dist/components/radio/Radio.js +37 -0
- package/dist/components/radio/RadioLabel.d.ts +11 -0
- package/dist/components/radio/RadioLabel.js +27 -0
- package/dist/components/radio/RadioList.d.ts +23 -0
- package/dist/components/radio/RadioList.js +36 -0
- package/dist/components/required/RequiredMark.d.ts +6 -0
- package/dist/components/required/RequiredMark.js +5 -0
- package/dist/components/select/Select.d.ts +20 -0
- package/dist/components/select/Select.js +61 -0
- package/dist/components/time/Time.d.ts +17 -0
- package/dist/components/time/Time.js +112 -0
- package/dist/components/ui/alert/Alert.d.ts +15 -0
- package/dist/components/ui/alert/Alert.js +26 -0
- package/dist/components/ui/confirm/Confirm.d.ts +18 -0
- package/dist/components/ui/confirm/Confirm.js +41 -0
- package/dist/components/ui/editable/Editable.d.ts +12 -0
- package/dist/components/ui/editable/Editable.js +53 -0
- package/dist/components/ui/info/Info.js +8 -0
- package/dist/components/ui/menu/Menu.d.ts +23 -0
- package/dist/components/ui/menu/Menu.js +23 -0
- package/dist/components/ui/message/Message.d.ts +10 -0
- package/dist/components/ui/message/Message.js +19 -0
- package/dist/components/ui/modal/Modal.d.ts +8 -0
- package/dist/components/ui/modal/Modal.js +39 -0
- package/dist/components/ui/popup/Popup.d.ts +14 -0
- package/dist/components/ui/popup/Popup.js +100 -0
- package/dist/components/ui/portal/Portal.d.ts +7 -0
- package/dist/components/ui/portal/Portal.js +20 -0
- package/dist/components/ui/prompt/Prompt.d.ts +16 -0
- package/dist/components/ui/prompt/Prompt.js +48 -0
- package/dist/main.d.ts +27 -0
- package/dist/main.js +52 -0
- package/package.json +53 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useEffect as b } from "react";
|
|
3
|
+
import { Radio as x } from "./Radio.js";
|
|
4
|
+
import p from "../fieldset/Fieldset.js";
|
|
5
|
+
const g = ({ label: n, value: r, onChange: i, required: o = !1, disabled: l = !1, options: a }) => {
|
|
6
|
+
const [t, s] = m(!1);
|
|
7
|
+
return b(() => {
|
|
8
|
+
s(!1), o && a.findIndex((f) => f.value === r) < 0 && s(!0);
|
|
9
|
+
}, [r, o, a]), /* @__PURE__ */ d(
|
|
10
|
+
p,
|
|
11
|
+
{
|
|
12
|
+
label: n,
|
|
13
|
+
error: t,
|
|
14
|
+
disabled: l,
|
|
15
|
+
required: o,
|
|
16
|
+
children: a.map((e, f) => /* @__PURE__ */ d(
|
|
17
|
+
x,
|
|
18
|
+
{
|
|
19
|
+
label: e.label,
|
|
20
|
+
value: e.value,
|
|
21
|
+
error: t,
|
|
22
|
+
bottom: e.bottom,
|
|
23
|
+
disabled: e.disabled || l,
|
|
24
|
+
required: e.required,
|
|
25
|
+
checked: e.value === r,
|
|
26
|
+
onChange: (c, u) => i(u, c)
|
|
27
|
+
},
|
|
28
|
+
f
|
|
29
|
+
))
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
g as RadioList,
|
|
35
|
+
g as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
option: string;
|
|
4
|
+
value: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectProps {
|
|
8
|
+
id: string;
|
|
9
|
+
value: string;
|
|
10
|
+
options: SelectOption[];
|
|
11
|
+
onChange: (b: string) => void;
|
|
12
|
+
label?: string | null;
|
|
13
|
+
top?: string | null;
|
|
14
|
+
bottom?: string | null;
|
|
15
|
+
placeholder?: string | null;
|
|
16
|
+
required?: boolean | null;
|
|
17
|
+
disabled?: boolean | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const Select: React.FC<SelectProps>;
|
|
20
|
+
export default Select;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as e, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import m from "../label/Label.js";
|
|
3
|
+
import '../../assets/Select.css';const y = ({
|
|
4
|
+
id: d,
|
|
5
|
+
value: o,
|
|
6
|
+
onChange: c,
|
|
7
|
+
label: f,
|
|
8
|
+
placeholder: a,
|
|
9
|
+
top: u,
|
|
10
|
+
required: i = !1,
|
|
11
|
+
disabled: t = !1,
|
|
12
|
+
bottom: p,
|
|
13
|
+
options: s
|
|
14
|
+
}) => {
|
|
15
|
+
const l = () => !!(i && s.findIndex((n) => n.value === o) < 0), g = () => {
|
|
16
|
+
if (l()) return {
|
|
17
|
+
borderColor: "var(--alxgrn-input-border-error)",
|
|
18
|
+
backgroundColor: "var(--alxgrn-input-bg-error)"
|
|
19
|
+
};
|
|
20
|
+
}, x = () => {
|
|
21
|
+
let r = "SelectWrap";
|
|
22
|
+
return t && (r += " Disabled"), l() && (r += " Error"), r;
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ e("div", { className: "FormItem", children: /* @__PURE__ */ e(
|
|
25
|
+
m,
|
|
26
|
+
{
|
|
27
|
+
top: u,
|
|
28
|
+
bottom: p,
|
|
29
|
+
label: f,
|
|
30
|
+
required: i,
|
|
31
|
+
disabled: t,
|
|
32
|
+
error: l(),
|
|
33
|
+
children: /* @__PURE__ */ e("div", { className: x(), children: /* @__PURE__ */ b(
|
|
34
|
+
"select",
|
|
35
|
+
{
|
|
36
|
+
id: d,
|
|
37
|
+
value: o,
|
|
38
|
+
onChange: (r) => c(r.target.value),
|
|
39
|
+
style: g(),
|
|
40
|
+
disabled: !!t,
|
|
41
|
+
children: [
|
|
42
|
+
a && /* @__PURE__ */ e("option", { children: a }),
|
|
43
|
+
s.map((r, n) => /* @__PURE__ */ e(
|
|
44
|
+
"option",
|
|
45
|
+
{
|
|
46
|
+
value: r.value,
|
|
47
|
+
disabled: r.disabled,
|
|
48
|
+
children: r.option
|
|
49
|
+
},
|
|
50
|
+
n
|
|
51
|
+
))
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
) })
|
|
55
|
+
}
|
|
56
|
+
) });
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
y as Select,
|
|
60
|
+
y as default
|
|
61
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React, FC } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* TODO: Добавить выбор секунд
|
|
4
|
+
*/
|
|
5
|
+
export interface TimeProps {
|
|
6
|
+
id: string;
|
|
7
|
+
value: string;
|
|
8
|
+
step?: number;
|
|
9
|
+
onChange?: (s: string) => void;
|
|
10
|
+
label?: string | null;
|
|
11
|
+
top?: string | null | React.ReactNode;
|
|
12
|
+
bottom?: string | null | React.ReactNode;
|
|
13
|
+
required?: boolean | null;
|
|
14
|
+
disabled?: boolean | null;
|
|
15
|
+
}
|
|
16
|
+
declare const Time: FC<TimeProps>;
|
|
17
|
+
export default Time;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsxs as H, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as O, useState as n, useEffect as k } from "react";
|
|
3
|
+
import L from "../label/Label.js";
|
|
4
|
+
import { Menu as y } from "../ui/menu/Menu.js";
|
|
5
|
+
import '../../assets/Time.css';const G = ({
|
|
6
|
+
id: u,
|
|
7
|
+
value: m,
|
|
8
|
+
step: p = 1,
|
|
9
|
+
onChange: t,
|
|
10
|
+
label: M,
|
|
11
|
+
top: b,
|
|
12
|
+
bottom: g,
|
|
13
|
+
required: d = !1,
|
|
14
|
+
disabled: o = !1
|
|
15
|
+
}) => {
|
|
16
|
+
const x = O(null), $ = O(null), [l, N] = n(""), [a, C] = n(""), [I, j] = n([]), [w, z] = n([]), [E, c] = n(!1), [S, f] = n(!1);
|
|
17
|
+
k(() => {
|
|
18
|
+
let [e, r] = m.split(":");
|
|
19
|
+
e = parseInt(e), r = parseInt(r), (isNaN(e) || e < 0 || e > 23) && (e = 0), (isNaN(r) || r < 0 || r > 59) && (r = 0), e = `0${e}`.slice(-2), r = `0${r}`.slice(-2), N(e), C(r), t && t(`${e}:${r}`);
|
|
20
|
+
}, [m, t]), k(() => {
|
|
21
|
+
const e = [], r = [];
|
|
22
|
+
for (let s = 0; s < 24; s++)
|
|
23
|
+
e.push(`0${s}`.slice(-2));
|
|
24
|
+
for (let s = 0; s < 60; s += p)
|
|
25
|
+
r.push(`0${s}`.slice(-2));
|
|
26
|
+
j(e), z(r);
|
|
27
|
+
}, [p]);
|
|
28
|
+
const h = () => !!(d && (!l || !a)), v = () => {
|
|
29
|
+
if (h()) return {
|
|
30
|
+
caretColor: "var(--alxgrn-input-border-error)",
|
|
31
|
+
borderColor: "var(--alxgrn-input-border-error)",
|
|
32
|
+
backgroundColor: "var(--alxgrn-input-bg-error)"
|
|
33
|
+
};
|
|
34
|
+
}, T = (e) => {
|
|
35
|
+
c(!1), t && t(`${e.text ?? ""}:${a}`);
|
|
36
|
+
}, F = (e) => {
|
|
37
|
+
f(!1), t && t(`${l}:${e.text ?? ""}`);
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ H("div", { className: "FormItem", children: [
|
|
40
|
+
/* @__PURE__ */ i(
|
|
41
|
+
L,
|
|
42
|
+
{
|
|
43
|
+
top: b,
|
|
44
|
+
bottom: g,
|
|
45
|
+
label: M,
|
|
46
|
+
required: d,
|
|
47
|
+
disabled: o,
|
|
48
|
+
error: h(),
|
|
49
|
+
children: /* @__PURE__ */ H("div", { className: "Time", children: [
|
|
50
|
+
/* @__PURE__ */ i(
|
|
51
|
+
"input",
|
|
52
|
+
{
|
|
53
|
+
id: `${u}-hor`,
|
|
54
|
+
ref: x,
|
|
55
|
+
type: "text",
|
|
56
|
+
value: l,
|
|
57
|
+
style: v(),
|
|
58
|
+
disabled: !!o,
|
|
59
|
+
onClick: () => c(!0),
|
|
60
|
+
readOnly: !0
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ i("div", { children: ":" }),
|
|
64
|
+
/* @__PURE__ */ i(
|
|
65
|
+
"input",
|
|
66
|
+
{
|
|
67
|
+
id: `${u}-min`,
|
|
68
|
+
ref: $,
|
|
69
|
+
type: "text",
|
|
70
|
+
value: a,
|
|
71
|
+
style: v(),
|
|
72
|
+
disabled: !!o,
|
|
73
|
+
onClick: () => f(!0),
|
|
74
|
+
readOnly: !0
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] })
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ i(
|
|
81
|
+
y,
|
|
82
|
+
{
|
|
83
|
+
parent: x,
|
|
84
|
+
isOpen: E,
|
|
85
|
+
onClose: () => c(!1),
|
|
86
|
+
horizontal: "inner-left",
|
|
87
|
+
margin: "var(--alxgrn-unit-small)",
|
|
88
|
+
items: I.map((e) => ({ id: e, text: e })),
|
|
89
|
+
onClick: T,
|
|
90
|
+
maxHeight: "auto",
|
|
91
|
+
width: "parent"
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ i(
|
|
95
|
+
y,
|
|
96
|
+
{
|
|
97
|
+
parent: $,
|
|
98
|
+
isOpen: S,
|
|
99
|
+
onClose: () => f(!1),
|
|
100
|
+
horizontal: "inner-left",
|
|
101
|
+
margin: "var(--alxgrn-unit-small)",
|
|
102
|
+
items: w.map((e) => ({ id: e, text: e })),
|
|
103
|
+
onClick: F,
|
|
104
|
+
maxHeight: "auto",
|
|
105
|
+
width: "parent"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] });
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
G as default
|
|
112
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MessageIconType } from '../message/Message';
|
|
3
|
+
import { ButtonType } from '../../button/Button';
|
|
4
|
+
export interface AlertProps {
|
|
5
|
+
icon?: string | null;
|
|
6
|
+
type?: MessageIconType;
|
|
7
|
+
title?: string | null;
|
|
8
|
+
message: string | React.ReactNode;
|
|
9
|
+
close?: string;
|
|
10
|
+
closeType?: ButtonType;
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const Alert: React.FC<AlertProps>;
|
|
15
|
+
export default Alert;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import a from "../message/Message.js";
|
|
3
|
+
import n from "../modal/Modal.js";
|
|
4
|
+
import { Form as b } from "../../form/Form.js";
|
|
5
|
+
const c = "Ok", M = ({ icon: m, type: o, title: s, message: i, close: e, closeType: p, isOpen: f, onClose: r }) => /* @__PURE__ */ u(n, { isOpen: f, onClose: r, children: [
|
|
6
|
+
/* @__PURE__ */ t(
|
|
7
|
+
a,
|
|
8
|
+
{
|
|
9
|
+
icon: m,
|
|
10
|
+
title: s,
|
|
11
|
+
message: i,
|
|
12
|
+
type: o
|
|
13
|
+
}
|
|
14
|
+
),
|
|
15
|
+
/* @__PURE__ */ t(
|
|
16
|
+
b,
|
|
17
|
+
{
|
|
18
|
+
submit: e ?? c,
|
|
19
|
+
submitType: p,
|
|
20
|
+
onSubmit: r
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
] });
|
|
24
|
+
export {
|
|
25
|
+
M as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MessageIconType } from '../message/Message';
|
|
3
|
+
import { ButtonType } from '../../button/Button';
|
|
4
|
+
export interface ModalConfirmProps {
|
|
5
|
+
icon?: string | null;
|
|
6
|
+
type?: MessageIconType;
|
|
7
|
+
title?: string | null;
|
|
8
|
+
message: string | React.ReactNode;
|
|
9
|
+
cancel?: string;
|
|
10
|
+
confirm?: string;
|
|
11
|
+
cancelType?: ButtonType;
|
|
12
|
+
confirmType?: ButtonType;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
onConfirm: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare const Confirm: React.FC<ModalConfirmProps>;
|
|
18
|
+
export default Confirm;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import l from "../message/Message.js";
|
|
3
|
+
import u from "../modal/Modal.js";
|
|
4
|
+
import { Form as b } from "../../form/Form.js";
|
|
5
|
+
const d = "Cancel", x = "Confirm", g = ({
|
|
6
|
+
icon: m,
|
|
7
|
+
type: t,
|
|
8
|
+
title: s,
|
|
9
|
+
message: i,
|
|
10
|
+
cancel: e,
|
|
11
|
+
confirm: n,
|
|
12
|
+
confirmType: f,
|
|
13
|
+
cancelType: c,
|
|
14
|
+
isOpen: p,
|
|
15
|
+
onCancel: o,
|
|
16
|
+
onConfirm: C
|
|
17
|
+
}) => /* @__PURE__ */ a(u, { isOpen: p, onClose: o, children: [
|
|
18
|
+
/* @__PURE__ */ r(
|
|
19
|
+
l,
|
|
20
|
+
{
|
|
21
|
+
icon: m,
|
|
22
|
+
title: s,
|
|
23
|
+
message: i,
|
|
24
|
+
type: t
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ r(
|
|
28
|
+
b,
|
|
29
|
+
{
|
|
30
|
+
cancel: e ?? d,
|
|
31
|
+
submit: n ?? x,
|
|
32
|
+
cancelType: c,
|
|
33
|
+
submitType: f,
|
|
34
|
+
onCancel: o,
|
|
35
|
+
onSubmit: C
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] });
|
|
39
|
+
export {
|
|
40
|
+
g as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
value: string;
|
|
4
|
+
empty?: boolean;
|
|
5
|
+
onblur?: 'Enter' | 'Esc';
|
|
6
|
+
newline?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
};
|
|
11
|
+
declare const Editable: FC<Props>;
|
|
12
|
+
export default Editable;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I, useState as u, useEffect as g } from "react";
|
|
3
|
+
import '../../../assets/Editable.css';/* empty css */
|
|
4
|
+
const V = ({ value: t, empty: d, newline: a, onblur: E = "Enter", placeholder: c, onChange: h, style: m }) => {
|
|
5
|
+
const r = I(null), [n, s] = u(!1), [i, o] = u(a ? t : t.replace(/[\n\r]+/g, " "));
|
|
6
|
+
g(() => {
|
|
7
|
+
const e = (x) => {
|
|
8
|
+
x.key === "Escape" && (s(!1), o(t));
|
|
9
|
+
};
|
|
10
|
+
return n && document.body.addEventListener("keydown", e), () => {
|
|
11
|
+
n && document.body.removeEventListener("keydown", e);
|
|
12
|
+
};
|
|
13
|
+
}, [n, t]), g(() => {
|
|
14
|
+
!n || !r.current || (r.current.style.height = "0px", r.current.style.height = r.current.scrollHeight + "px");
|
|
15
|
+
}, [n, i]);
|
|
16
|
+
const l = () => {
|
|
17
|
+
var e = i.trim();
|
|
18
|
+
!e && !d && (e = t), s(!1), h(e);
|
|
19
|
+
}, p = (e) => {
|
|
20
|
+
e.key === "Enter" && e.shiftKey === !1 && (e.preventDefault(), l());
|
|
21
|
+
}, y = (e) => {
|
|
22
|
+
o(a ? e.target.value : e.target.value.replace(/[\n\r]+/g, " "));
|
|
23
|
+
}, b = () => {
|
|
24
|
+
E === "Enter" ? l() : (o(a ? t : t.replace(/[\n\r]+/g, " ")), s(!1));
|
|
25
|
+
}, k = (e) => {
|
|
26
|
+
o(t), e.target.setSelectionRange(e.target.value.length, e.target.value.length);
|
|
27
|
+
};
|
|
28
|
+
return n ? /* @__PURE__ */ f(
|
|
29
|
+
"textarea",
|
|
30
|
+
{
|
|
31
|
+
ref: r,
|
|
32
|
+
className: "Editable",
|
|
33
|
+
value: i,
|
|
34
|
+
onKeyDown: p,
|
|
35
|
+
onChange: y,
|
|
36
|
+
onBlur: b,
|
|
37
|
+
onFocus: k,
|
|
38
|
+
placeholder: c,
|
|
39
|
+
style: m,
|
|
40
|
+
autoFocus: !0
|
|
41
|
+
}
|
|
42
|
+
) : /* @__PURE__ */ f(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: t ? "Editable" : c ? "Editable Placeholder" : "Editable",
|
|
46
|
+
onClick: () => s(!0),
|
|
47
|
+
children: t || (c ?? "")
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
V as default
|
|
53
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
const s = ({ type: n, header: a, children: i }) => /* @__PURE__ */ l("div", { className: n ? `alxgrn-info alxgrn-info-${n}` : "alxgrn-info", children: [
|
|
3
|
+
a && /* @__PURE__ */ o("div", { className: "alxgrn-info-header", children: a }),
|
|
4
|
+
i
|
|
5
|
+
] });
|
|
6
|
+
export {
|
|
7
|
+
s as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PopupProps } from '../popup/Popup';
|
|
3
|
+
export type MenuSeparator = {
|
|
4
|
+
id?: never;
|
|
5
|
+
separator: true;
|
|
6
|
+
text?: never;
|
|
7
|
+
icon?: never;
|
|
8
|
+
disabled?: never;
|
|
9
|
+
};
|
|
10
|
+
export type MenuAlternative = {
|
|
11
|
+
id: number | string;
|
|
12
|
+
separator?: never;
|
|
13
|
+
text?: string;
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
disabled?: boolean | null;
|
|
16
|
+
};
|
|
17
|
+
export type MenuItem = MenuAlternative | MenuSeparator;
|
|
18
|
+
interface MenuProps extends PopupProps {
|
|
19
|
+
items: MenuItem[];
|
|
20
|
+
onClick: (item: MenuItem) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const Menu: React.FC<MenuProps>;
|
|
23
|
+
export default Menu;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as r, jsxs as p, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { Popup as i } from "../popup/Popup.js";
|
|
3
|
+
import '../../../assets/Menu.css';const u = (s) => {
|
|
4
|
+
const { items: o, onClick: n, ...e } = s;
|
|
5
|
+
return /* @__PURE__ */ r(i, { ...e, children: /* @__PURE__ */ r("div", { className: "Menu", children: /* @__PURE__ */ r("ul", { children: o.map((a, l) => /* @__PURE__ */ r(
|
|
6
|
+
"li",
|
|
7
|
+
{
|
|
8
|
+
className: `${a.separator ? "Separator" : ""} ${a.disabled ? "Disabled" : ""}`,
|
|
9
|
+
onClick: (c) => {
|
|
10
|
+
c.stopPropagation(), !a.disabled && !a.separator && n(a);
|
|
11
|
+
},
|
|
12
|
+
children: !a.separator && /* @__PURE__ */ p(d, { children: [
|
|
13
|
+
a.icon && /* @__PURE__ */ r("span", { className: "Icon", children: a.icon }),
|
|
14
|
+
a.text && /* @__PURE__ */ r("span", { className: "Text", children: a.text })
|
|
15
|
+
] })
|
|
16
|
+
},
|
|
17
|
+
l
|
|
18
|
+
)) }) }) });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
u as Menu,
|
|
22
|
+
u as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type MessageIconType = 'square' | 'round';
|
|
3
|
+
type Props = {
|
|
4
|
+
icon?: string | null;
|
|
5
|
+
type?: MessageIconType;
|
|
6
|
+
title?: string | null;
|
|
7
|
+
message: string | React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const Message: React.FC<Props>;
|
|
10
|
+
export default Message;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import '../../../assets/Message.css';/* empty css */
|
|
3
|
+
const m = ({ icon: e, type: c = "square", title: a, message: d }) => /* @__PURE__ */ r("div", { className: "Message", children: [
|
|
4
|
+
e && /* @__PURE__ */ s(
|
|
5
|
+
"img",
|
|
6
|
+
{
|
|
7
|
+
alt: "",
|
|
8
|
+
src: e,
|
|
9
|
+
className: `MessageIcon ${c}`
|
|
10
|
+
}
|
|
11
|
+
),
|
|
12
|
+
/* @__PURE__ */ r("div", { className: "MessageText", children: [
|
|
13
|
+
a && /* @__PURE__ */ s("h1", { children: a }),
|
|
14
|
+
/* @__PURE__ */ s("div", { children: d })
|
|
15
|
+
] })
|
|
16
|
+
] });
|
|
17
|
+
export {
|
|
18
|
+
m as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as c, useEffect as m } from "react";
|
|
3
|
+
import { CSSTransition as f } from "react-transition-group";
|
|
4
|
+
import u from "../portal/Portal.js";
|
|
5
|
+
import '../../../assets/Modal.css';/* empty css */
|
|
6
|
+
const p = 100, h = ({ children: s, isOpen: t, onClose: n, close: i = !0 }) => {
|
|
7
|
+
const r = c(null);
|
|
8
|
+
m(() => {
|
|
9
|
+
const o = (l) => {
|
|
10
|
+
l.key === "Escape" && n();
|
|
11
|
+
};
|
|
12
|
+
return t && document.body.addEventListener("keydown", o), () => {
|
|
13
|
+
t && document.body.removeEventListener("keydown", o);
|
|
14
|
+
};
|
|
15
|
+
}, [t, n]);
|
|
16
|
+
const a = (o) => {
|
|
17
|
+
o.stopPropagation(), n();
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ e(u, { id: "alxgrn-modal", fixBody: !0, children: /* @__PURE__ */ e(
|
|
20
|
+
f,
|
|
21
|
+
{
|
|
22
|
+
in: t,
|
|
23
|
+
timeout: p,
|
|
24
|
+
unmountOnExit: !0,
|
|
25
|
+
classNames: "Modal",
|
|
26
|
+
nodeRef: r,
|
|
27
|
+
children: /* @__PURE__ */ e("div", { className: "Modal", ref: r, onClick: a, children: /* @__PURE__ */ d("div", { className: "ModalInner", onClick: (o) => o.stopPropagation(), children: [
|
|
28
|
+
i && /* @__PURE__ */ d("div", { className: "ModalClose", onClick: a, children: [
|
|
29
|
+
/* @__PURE__ */ e("span", {}),
|
|
30
|
+
/* @__PURE__ */ e("span", {})
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ e("div", { className: "ModalContent", children: s })
|
|
33
|
+
] }) })
|
|
34
|
+
}
|
|
35
|
+
) });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
h as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React, FC, PropsWithChildren } from 'react';
|
|
2
|
+
export interface PopupProps {
|
|
3
|
+
parent: React.RefObject<HTMLElement>;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
margin?: string;
|
|
7
|
+
vertical?: 'auto' | 'top' | 'bottom' | 'inner-top' | 'inner-bottom';
|
|
8
|
+
horizontal?: 'auto' | 'left' | 'right' | 'inner-left' | 'inner-right';
|
|
9
|
+
maxHeight?: 'auto' | 'none';
|
|
10
|
+
width?: 'auto' | 'parent';
|
|
11
|
+
position?: 'absolute' | 'fixed';
|
|
12
|
+
}
|
|
13
|
+
export declare const Popup: FC<PropsWithChildren<PopupProps>>;
|
|
14
|
+
export default Popup;
|