@alxgrn/telefrag-ui 0.1.2 → 0.1.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as b, jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import h, { isValidDate as
|
|
2
|
+
import { useState as H, useEffect as R } from "react";
|
|
3
|
+
import h, { isValidDate as T } from "../date/Date.js";
|
|
4
4
|
import { RadioList as x } from "../radio/RadioList.js";
|
|
5
5
|
import { Select as y } from "../select/Select.js";
|
|
6
6
|
import { CheckboxList as F } from "../checkbox/CheckboxList.js";
|
|
@@ -17,8 +17,8 @@ import { Image as D } from "../image/Image.js";
|
|
|
17
17
|
import E from "../input/Input.js";
|
|
18
18
|
/* empty css */
|
|
19
19
|
/* empty css */
|
|
20
|
-
import
|
|
21
|
-
import
|
|
20
|
+
import B from "../hidden/Hidden.js";
|
|
21
|
+
import S from "../checkbox/Checkbox.js";
|
|
22
22
|
/* empty css */
|
|
23
23
|
import "react-transition-group";
|
|
24
24
|
import "react-dom";
|
|
@@ -37,60 +37,63 @@ import l from "../../ui/block/Block.js";
|
|
|
37
37
|
/* empty css */
|
|
38
38
|
/* empty css */
|
|
39
39
|
/* empty css */
|
|
40
|
-
import
|
|
41
|
-
const
|
|
40
|
+
import j from "./traverse.js";
|
|
41
|
+
const De = ({
|
|
42
42
|
info: u,
|
|
43
43
|
error: d,
|
|
44
44
|
success: k,
|
|
45
45
|
submit: p,
|
|
46
46
|
cancel: f,
|
|
47
|
-
submitType:
|
|
48
|
-
cancelType:
|
|
49
|
-
wide:
|
|
47
|
+
submitType: w = "Accent",
|
|
48
|
+
cancelType: A = "Error",
|
|
49
|
+
wide: L,
|
|
50
50
|
onSubmit: v,
|
|
51
|
-
onCancel:
|
|
51
|
+
onCancel: N,
|
|
52
52
|
children: c
|
|
53
53
|
}) => {
|
|
54
|
-
const [
|
|
55
|
-
return
|
|
56
|
-
p && (
|
|
57
|
-
const e =
|
|
54
|
+
const [q, r] = H(!1);
|
|
55
|
+
return R(() => {
|
|
56
|
+
p && (r(!1), j(c, (t) => {
|
|
57
|
+
const e = t.props;
|
|
58
58
|
if (e.required)
|
|
59
|
-
switch (
|
|
59
|
+
switch (t.type) {
|
|
60
60
|
case I:
|
|
61
61
|
case E:
|
|
62
|
-
e.value.trim() ||
|
|
62
|
+
e.value.trim() || r(!0);
|
|
63
63
|
break;
|
|
64
|
-
case
|
|
65
|
-
e.checked ||
|
|
64
|
+
case S:
|
|
65
|
+
e.checked || r(!0);
|
|
66
66
|
break;
|
|
67
67
|
case y:
|
|
68
68
|
{
|
|
69
|
-
const
|
|
70
|
-
e.options.findIndex((
|
|
69
|
+
const a = e.value;
|
|
70
|
+
e.options.findIndex((s) => s.value === a) < 0 && r(!0);
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
case x:
|
|
74
74
|
{
|
|
75
|
-
const
|
|
76
|
-
e.options.findIndex((
|
|
75
|
+
const a = e.value;
|
|
76
|
+
e.options.findIndex((s) => s.value === a) < 0 && r(!0);
|
|
77
77
|
}
|
|
78
78
|
break;
|
|
79
79
|
case g:
|
|
80
|
-
e.files.length < 1 &&
|
|
80
|
+
e.files.length < 1 && r(!0);
|
|
81
81
|
break;
|
|
82
82
|
case D:
|
|
83
|
-
e.value ||
|
|
83
|
+
e.value || r(!0);
|
|
84
84
|
break;
|
|
85
85
|
case h:
|
|
86
|
-
|
|
86
|
+
T(e.value.trim()) || r(!0);
|
|
87
87
|
break;
|
|
88
88
|
case F:
|
|
89
|
-
e.options.findIndex((n) => n.checked === !0) < 0 &&
|
|
89
|
+
e.options.findIndex((n) => n.checked === !0) < 0 && r(!0);
|
|
90
|
+
break;
|
|
91
|
+
case B:
|
|
92
|
+
`${e.value}`.trim() || r(!0);
|
|
90
93
|
break;
|
|
91
94
|
}
|
|
92
95
|
}));
|
|
93
|
-
}, [c, p]), /* @__PURE__ */ b("div", { className:
|
|
96
|
+
}, [c, p]), /* @__PURE__ */ b("div", { className: L ? "Form FormWide" : "Form", children: [
|
|
94
97
|
k && /* @__PURE__ */ m(l, { type: "Success", children: k }),
|
|
95
98
|
d && /* @__PURE__ */ m(l, { type: "Error", children: d }),
|
|
96
99
|
u && /* @__PURE__ */ m(l, { children: u }),
|
|
@@ -99,27 +102,27 @@ const Eo = ({
|
|
|
99
102
|
p && /* @__PURE__ */ m(
|
|
100
103
|
C,
|
|
101
104
|
{
|
|
102
|
-
type:
|
|
105
|
+
type: w,
|
|
103
106
|
label: p,
|
|
104
|
-
disabled:
|
|
107
|
+
disabled: q,
|
|
105
108
|
onClick: () => {
|
|
106
109
|
if (!v) return;
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
109
|
-
|
|
110
|
+
const t = {}, e = (i, o) => {
|
|
111
|
+
if (!t[i]) {
|
|
112
|
+
t[i] = o;
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
|
-
|
|
115
|
+
t[i] instanceof Array ? t[i].push(o) : t[i] = [t[i], o];
|
|
113
116
|
};
|
|
114
|
-
|
|
115
|
-
const o =
|
|
116
|
-
switch (
|
|
117
|
+
j(c, (i) => {
|
|
118
|
+
const o = i.props;
|
|
119
|
+
switch (i.type) {
|
|
117
120
|
case h:
|
|
118
121
|
case I:
|
|
119
122
|
case E:
|
|
120
123
|
e(o.id, o.value.trim());
|
|
121
124
|
break;
|
|
122
|
-
case
|
|
125
|
+
case S:
|
|
123
126
|
e(o.id, o.checked ? o.value : void 0);
|
|
124
127
|
break;
|
|
125
128
|
case y:
|
|
@@ -132,34 +135,34 @@ const Eo = ({
|
|
|
132
135
|
case D:
|
|
133
136
|
e(o.id, o.value);
|
|
134
137
|
break;
|
|
135
|
-
case
|
|
138
|
+
case B:
|
|
136
139
|
e(o.id, o.value);
|
|
137
140
|
break;
|
|
138
141
|
case F:
|
|
139
142
|
{
|
|
140
|
-
const
|
|
141
|
-
o.options.forEach((
|
|
142
|
-
|
|
143
|
-
}), e(o.id,
|
|
143
|
+
const a = [];
|
|
144
|
+
o.options.forEach((s) => {
|
|
145
|
+
s.checked && a.push(s.value);
|
|
146
|
+
}), e(o.id, a);
|
|
144
147
|
}
|
|
145
148
|
break;
|
|
146
149
|
}
|
|
147
|
-
}), v(
|
|
150
|
+
}), v(t);
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
),
|
|
151
154
|
f && /* @__PURE__ */ m(
|
|
152
155
|
C,
|
|
153
156
|
{
|
|
154
|
-
type:
|
|
157
|
+
type: A,
|
|
155
158
|
label: f,
|
|
156
|
-
onClick:
|
|
159
|
+
onClick: N
|
|
157
160
|
}
|
|
158
161
|
)
|
|
159
162
|
] })
|
|
160
163
|
] });
|
|
161
164
|
};
|
|
162
165
|
export {
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
De as Form,
|
|
167
|
+
De as default
|
|
165
168
|
};
|
|
@@ -6,6 +6,7 @@ function i(t) {
|
|
|
6
6
|
var o;
|
|
7
7
|
if (!r.isValidElement(t)) return !1;
|
|
8
8
|
let e = t.type;
|
|
9
|
+
if (typeof e == "string") return !1;
|
|
9
10
|
for (; f(e) && (e.$$typeof === Symbol.for("react.memo") || e.$$typeof === Symbol.for("react.forward_ref")); )
|
|
10
11
|
e = e.type;
|
|
11
12
|
return typeof e == "function" && !((o = e.prototype) != null && o.isReactComponent);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
const
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
const o = ({ id: t, value: d, required: e }) => /* @__PURE__ */ i(
|
|
3
3
|
"input",
|
|
4
4
|
{
|
|
5
5
|
id: t,
|
|
6
6
|
type: "hidden",
|
|
7
|
-
value: d
|
|
7
|
+
value: d,
|
|
8
|
+
required: e
|
|
8
9
|
}
|
|
9
10
|
);
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
o as default
|
|
12
13
|
};
|
package/package.json
CHANGED