@alxgrn/telefrag-ui 0.0.30 → 0.0.31
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.
|
@@ -10,12 +10,12 @@ const z = ({
|
|
|
10
10
|
label: n,
|
|
11
11
|
placeholder: e,
|
|
12
12
|
top: s,
|
|
13
|
-
bottom:
|
|
14
|
-
required:
|
|
13
|
+
bottom: m,
|
|
14
|
+
required: c = !1,
|
|
15
15
|
disabled: p = !1
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
17
|
+
const i = C(null), [d, f] = k(!1), u = () => !!(c && !P(r)), g = () => {
|
|
18
|
+
if (u()) return {
|
|
19
19
|
caretColor: "var(--alxgrn-input-border-error)",
|
|
20
20
|
borderColor: "var(--alxgrn-input-border-error)",
|
|
21
21
|
backgroundColor: "var(--alxgrn-input-bg-error)"
|
|
@@ -29,16 +29,16 @@ const z = ({
|
|
|
29
29
|
$,
|
|
30
30
|
{
|
|
31
31
|
top: s,
|
|
32
|
-
bottom:
|
|
32
|
+
bottom: m,
|
|
33
33
|
label: n,
|
|
34
|
-
required:
|
|
34
|
+
required: c,
|
|
35
35
|
disabled: p,
|
|
36
|
-
error:
|
|
36
|
+
error: u(),
|
|
37
37
|
children: /* @__PURE__ */ l(
|
|
38
38
|
"input",
|
|
39
39
|
{
|
|
40
40
|
id: o,
|
|
41
|
-
ref:
|
|
41
|
+
ref: i,
|
|
42
42
|
type: "text",
|
|
43
43
|
value: r,
|
|
44
44
|
onChange: (a) => t(a.target.value),
|
|
@@ -50,10 +50,10 @@ const z = ({
|
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
/* @__PURE__ */ l(
|
|
53
|
+
i.current && /* @__PURE__ */ l(
|
|
54
54
|
I,
|
|
55
55
|
{
|
|
56
|
-
parent:
|
|
56
|
+
parent: i.current,
|
|
57
57
|
isOpen: d,
|
|
58
58
|
onClose: () => f(!1),
|
|
59
59
|
horizontal: "inner-left",
|
|
@@ -4,38 +4,38 @@ import L from "../label/Label.js";
|
|
|
4
4
|
import { Menu as y } from "../../ui/menu/Menu.js";
|
|
5
5
|
import '../../../assets/Time.css';/* empty css */
|
|
6
6
|
const J = ({
|
|
7
|
-
id:
|
|
8
|
-
value:
|
|
9
|
-
step:
|
|
7
|
+
id: p,
|
|
8
|
+
value: d,
|
|
9
|
+
step: x = 1,
|
|
10
10
|
onChange: t,
|
|
11
11
|
label: M,
|
|
12
12
|
top: b,
|
|
13
13
|
bottom: g,
|
|
14
|
-
required:
|
|
14
|
+
required: $ = !1,
|
|
15
15
|
disabled: o = !1
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
17
|
+
const l = O(null), a = O(null), [c, N] = n(""), [f, C] = n(""), [I, j] = n([]), [w, z] = n([]), [E, u] = n(!1), [S, m] = n(!1);
|
|
18
18
|
k(() => {
|
|
19
|
-
let [
|
|
20
|
-
|
|
21
|
-
}, [
|
|
22
|
-
const
|
|
19
|
+
let [r, e] = d.split(":");
|
|
20
|
+
r = parseInt(r), e = parseInt(e), (isNaN(r) || r < 0 || r > 23) && (r = 0), (isNaN(e) || e < 0 || e > 59) && (e = 0), r = `0${r}`.slice(-2), e = `0${e}`.slice(-2), N(r), C(e), t && t(`${r}:${e}`);
|
|
21
|
+
}, [d, t]), k(() => {
|
|
22
|
+
const r = [], e = [];
|
|
23
23
|
for (let s = 0; s < 24; s++)
|
|
24
|
-
e.push(`0${s}`.slice(-2));
|
|
25
|
-
for (let s = 0; s < 60; s += p)
|
|
26
24
|
r.push(`0${s}`.slice(-2));
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
for (let s = 0; s < 60; s += x)
|
|
26
|
+
e.push(`0${s}`.slice(-2));
|
|
27
|
+
j(r), z(e);
|
|
28
|
+
}, [x]);
|
|
29
|
+
const h = () => !!($ && (!c || !f)), v = () => {
|
|
30
30
|
if (h()) return {
|
|
31
31
|
caretColor: "var(--alxgrn-input-border-error)",
|
|
32
32
|
borderColor: "var(--alxgrn-input-border-error)",
|
|
33
33
|
backgroundColor: "var(--alxgrn-input-bg-error)"
|
|
34
34
|
};
|
|
35
|
-
}, T = (
|
|
36
|
-
|
|
37
|
-
}, F = (
|
|
38
|
-
|
|
35
|
+
}, T = (r) => {
|
|
36
|
+
u(!1), t && t(`${r.text ?? ""}:${f}`);
|
|
37
|
+
}, F = (r) => {
|
|
38
|
+
m(!1), t && t(`${c}:${r.text ?? ""}`);
|
|
39
39
|
};
|
|
40
40
|
return /* @__PURE__ */ H("div", { className: "FormItem", children: [
|
|
41
41
|
/* @__PURE__ */ i(
|
|
@@ -44,20 +44,20 @@ const J = ({
|
|
|
44
44
|
top: b,
|
|
45
45
|
bottom: g,
|
|
46
46
|
label: M,
|
|
47
|
-
required:
|
|
47
|
+
required: $,
|
|
48
48
|
disabled: o,
|
|
49
49
|
error: h(),
|
|
50
50
|
children: /* @__PURE__ */ H("div", { className: "Time", children: [
|
|
51
51
|
/* @__PURE__ */ i(
|
|
52
52
|
"input",
|
|
53
53
|
{
|
|
54
|
-
id: `${
|
|
55
|
-
ref:
|
|
54
|
+
id: `${p}-hor`,
|
|
55
|
+
ref: l,
|
|
56
56
|
type: "text",
|
|
57
|
-
value:
|
|
57
|
+
value: c,
|
|
58
58
|
style: v(),
|
|
59
59
|
disabled: !!o,
|
|
60
|
-
onClick: () =>
|
|
60
|
+
onClick: () => u(!0),
|
|
61
61
|
readOnly: !0
|
|
62
62
|
}
|
|
63
63
|
),
|
|
@@ -65,42 +65,42 @@ const J = ({
|
|
|
65
65
|
/* @__PURE__ */ i(
|
|
66
66
|
"input",
|
|
67
67
|
{
|
|
68
|
-
id: `${
|
|
69
|
-
ref:
|
|
68
|
+
id: `${p}-min`,
|
|
69
|
+
ref: a,
|
|
70
70
|
type: "text",
|
|
71
|
-
value:
|
|
71
|
+
value: f,
|
|
72
72
|
style: v(),
|
|
73
73
|
disabled: !!o,
|
|
74
|
-
onClick: () =>
|
|
74
|
+
onClick: () => m(!0),
|
|
75
75
|
readOnly: !0
|
|
76
76
|
}
|
|
77
77
|
)
|
|
78
78
|
] })
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
|
-
/* @__PURE__ */ i(
|
|
81
|
+
l.current && /* @__PURE__ */ i(
|
|
82
82
|
y,
|
|
83
83
|
{
|
|
84
|
-
parent:
|
|
84
|
+
parent: l.current,
|
|
85
85
|
isOpen: E,
|
|
86
|
-
onClose: () =>
|
|
86
|
+
onClose: () => u(!1),
|
|
87
87
|
horizontal: "inner-left",
|
|
88
88
|
margin: "var(--alxgrn-unit-small)",
|
|
89
|
-
items: I.map((
|
|
89
|
+
items: I.map((r) => ({ id: r, text: r })),
|
|
90
90
|
onClick: T,
|
|
91
91
|
maxHeight: "auto",
|
|
92
92
|
width: "parent"
|
|
93
93
|
}
|
|
94
94
|
),
|
|
95
|
-
/* @__PURE__ */ i(
|
|
95
|
+
a.current && /* @__PURE__ */ i(
|
|
96
96
|
y,
|
|
97
97
|
{
|
|
98
|
-
parent:
|
|
98
|
+
parent: a.current,
|
|
99
99
|
isOpen: S,
|
|
100
|
-
onClose: () =>
|
|
100
|
+
onClose: () => m(!1),
|
|
101
101
|
horizontal: "inner-left",
|
|
102
102
|
margin: "var(--alxgrn-unit-small)",
|
|
103
|
-
items: w.map((
|
|
103
|
+
items: w.map((r) => ({ id: r, text: r })),
|
|
104
104
|
onClick: F,
|
|
105
105
|
maxHeight: "auto",
|
|
106
106
|
width: "parent"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
export interface PopupProps {
|
|
3
|
-
parent:
|
|
3
|
+
parent: HTMLElement;
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
margin?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as v, useState as y, useEffect as m } from "react";
|
|
3
3
|
import { CSSTransition as L } from "react-transition-group";
|
|
4
4
|
import S from "../portal/Portal.js";
|
|
5
5
|
import { ANIMATION_LENGTH as T } from "../../../config.js";
|
|
6
6
|
import '../../../assets/Popup.css';/* empty css */
|
|
7
7
|
const N = T, M = ({
|
|
8
|
-
parent:
|
|
8
|
+
parent: u,
|
|
9
9
|
isOpen: d,
|
|
10
10
|
onClose: c,
|
|
11
11
|
vertical: p = "auto",
|
|
@@ -16,14 +16,14 @@ const N = T, M = ({
|
|
|
16
16
|
position: l = "absolute",
|
|
17
17
|
children: E
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
19
|
+
const a = v(null), [w, g] = y({}), [x, k] = y({});
|
|
20
20
|
return m(() => {
|
|
21
21
|
if (!d) return;
|
|
22
|
-
if (!
|
|
22
|
+
if (!u) {
|
|
23
23
|
g({}), k({});
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const r = document.documentElement.clientWidth, n = document.documentElement.clientHeight, e =
|
|
26
|
+
const r = document.documentElement.clientWidth, n = document.documentElement.clientHeight, e = u.getBoundingClientRect();
|
|
27
27
|
k({
|
|
28
28
|
position: l,
|
|
29
29
|
top: l === "fixed" ? e.top : e.top + window.scrollY,
|
|
@@ -70,9 +70,9 @@ const N = T, M = ({
|
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
72
|
g(t);
|
|
73
|
-
}, [
|
|
73
|
+
}, [u, d, o, p, f, h, b, l]), m(() => {
|
|
74
74
|
const r = (n) => {
|
|
75
|
-
|
|
75
|
+
a.current && !a.current.contains(n.target) && c();
|
|
76
76
|
};
|
|
77
77
|
return document.addEventListener("click", r, !0), () => {
|
|
78
78
|
document.removeEventListener("click", r, !0);
|
|
@@ -84,15 +84,15 @@ const N = T, M = ({
|
|
|
84
84
|
return document.body.addEventListener("keydown", r), () => {
|
|
85
85
|
document.body.removeEventListener("keydown", r);
|
|
86
86
|
};
|
|
87
|
-
}, [c]), /* @__PURE__ */
|
|
87
|
+
}, [c]), /* @__PURE__ */ s(S, { id: "alxgrn-popup", children: /* @__PURE__ */ s(
|
|
88
88
|
L,
|
|
89
89
|
{
|
|
90
90
|
in: d,
|
|
91
91
|
timeout: N,
|
|
92
92
|
unmountOnExit: !0,
|
|
93
93
|
classNames: "Popup",
|
|
94
|
-
nodeRef:
|
|
95
|
-
children: /* @__PURE__ */
|
|
94
|
+
nodeRef: a,
|
|
95
|
+
children: /* @__PURE__ */ s("div", { className: "Popup", style: x, children: /* @__PURE__ */ s("div", { className: "PopupInner", ref: a, style: w, children: E }) })
|
|
96
96
|
}
|
|
97
97
|
) });
|
|
98
98
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alxgrn/telefrag-ui",
|
|
3
3
|
"description": "UI library for The Daily Telefrag project",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.31",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Alexander Fedorov <alex@molner.ru>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"prepublishOnly": "npm run build"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"react": "^
|
|
31
|
+
"react": "^19.1.0",
|
|
32
32
|
"react-children-utilities": "^2.10.0",
|
|
33
|
-
"react-dom": "^
|
|
33
|
+
"react-dom": "^19.1.0",
|
|
34
34
|
"react-transition-group": "^4.4.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^22.7.5",
|
|
38
|
-
"@types/react": "^
|
|
39
|
-
"@types/react-dom": "^
|
|
38
|
+
"@types/react": "^19.0.12",
|
|
39
|
+
"@types/react-dom": "^19.0.4",
|
|
40
40
|
"@types/react-transition-group": "^4.4.11",
|
|
41
41
|
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
42
42
|
"@typescript-eslint/parser": "^6.10.0",
|