react-artasys-ui 0.1.34 → 0.1.35
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/Checkbox/Checkbox.d.ts +4 -3
- package/dist/Form/Element/Element.d.ts +1 -1
- package/dist/Input/Input.d.ts +1 -0
- package/dist/TextArea/TextArea.d.ts +1 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +303 -300
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import e, { cloneElement as t, createContext as n, forwardRef as r, useCallback as i, useContext as a, useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
2
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
3
3
|
var m = {
|
|
4
|
-
container: "style-
|
|
5
|
-
"wait-indicator": "style-module__wait-
|
|
6
|
-
wait: "style-
|
|
4
|
+
container: "style-module__container__q3kth",
|
|
5
|
+
"wait-indicator": "style-module__wait-indicator__6U6CR",
|
|
6
|
+
wait: "style-module__wait__UP-DV"
|
|
7
7
|
}, h = {
|
|
8
8
|
spinner: "style-module__spinner__bqxDY",
|
|
9
9
|
"button-spinner-border": "style-module__button-spinner-border__Zu60W",
|
|
@@ -11,11 +11,11 @@ var m = {
|
|
|
11
11
|
small: "style-module__small__A2XhO",
|
|
12
12
|
middle: "style-module__middle__5esgZ",
|
|
13
13
|
large: "style-module__large__5MX0S"
|
|
14
|
-
}, g = ({ size: e, contrast:
|
|
15
|
-
let
|
|
16
|
-
return
|
|
17
|
-
...
|
|
18
|
-
className:
|
|
14
|
+
}, g = ({ size: e, contrast: t, ...n }) => {
|
|
15
|
+
let r = ["ui-spinner"];
|
|
16
|
+
return r.push(h.spinner), e && r.push(h[e], "ui-spinner-" + e), t && r.push(h["ui-spinner-contrast"]), n.className && r.push(n.className), /* @__PURE__ */ f("div", {
|
|
17
|
+
...n,
|
|
18
|
+
className: r.join(" ")
|
|
19
19
|
});
|
|
20
20
|
}, _ = {
|
|
21
21
|
container: "style-module__container__Tcehc",
|
|
@@ -23,28 +23,31 @@ var m = {
|
|
|
23
23
|
small: "style-module__small__GbGdW",
|
|
24
24
|
middle: "style-module__middle__Xb1-y",
|
|
25
25
|
large: "style-module__large__eTEPS"
|
|
26
|
-
}, v = ({ value: e = 0, size:
|
|
26
|
+
}, v = ({ value: e = 0, size: t, radius: n = !1 }) => {
|
|
27
27
|
e = Math.ceil(Number(e) * 10) / 10, e > 100 && (e = 100), e < 0 && (e = 0);
|
|
28
|
-
let
|
|
29
|
-
return
|
|
30
|
-
className:
|
|
28
|
+
let r = n ? 360 / 100 * e + "deg" : e + "%", i = ["ui-progress"];
|
|
29
|
+
return i.push(_.container), t && i.push(_[t]), n && i.push(_.radius), /* @__PURE__ */ f("div", {
|
|
30
|
+
className: i.join(" "),
|
|
31
31
|
"data-progress": e,
|
|
32
|
-
style: { "--progress":
|
|
32
|
+
style: { "--progress": r }
|
|
33
33
|
});
|
|
34
|
-
}, y = ({ children: e, wait:
|
|
35
|
-
let
|
|
36
|
-
e.preventDefault(), typeof
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
}, y = ({ children: e, wait: t, progress: n, progressRadius: r = !0, className: i, onSubmit: a, ...o }) => {
|
|
35
|
+
let s = (e) => {
|
|
36
|
+
e.preventDefault(), typeof a == "function" && a(e);
|
|
37
|
+
}, l = c(() => {
|
|
38
|
+
let e = [m.container];
|
|
39
|
+
return t && e.push(m.wait), i && e.push(i), e.join(" ");
|
|
40
|
+
}, []);
|
|
41
|
+
return /* @__PURE__ */ p("form", {
|
|
42
|
+
...o,
|
|
43
|
+
onSubmit: s,
|
|
44
|
+
className: l,
|
|
45
|
+
children: [e, /* @__PURE__ */ f("div", {
|
|
43
46
|
className: m["wait-indicator"],
|
|
44
|
-
children: typeof
|
|
45
|
-
radius:
|
|
46
|
-
value:
|
|
47
|
-
}) : /* @__PURE__ */
|
|
47
|
+
children: typeof n == "number" ? /* @__PURE__ */ f(v, {
|
|
48
|
+
radius: r,
|
|
49
|
+
value: n
|
|
50
|
+
}) : /* @__PURE__ */ f(g, {})
|
|
48
51
|
})]
|
|
49
52
|
});
|
|
50
53
|
}, b = (e) => e.type === "checkbox", x = (e) => e instanceof Date, S = (e) => e == null, C = (e) => typeof e == "object", w = (e) => !S(e) && !Array.isArray(e) && C(e) && !x(e), ee = (e) => w(e) && e.target ? b(e.target) ? e.target.checked : e.target.value : e, T = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), E = (e) => {
|
|
@@ -103,7 +106,7 @@ var k = {
|
|
|
103
106
|
if (ne.includes(t)) return;
|
|
104
107
|
e[t] = a, e = e[t];
|
|
105
108
|
}
|
|
106
|
-
}, se =
|
|
109
|
+
}, se = e.createContext(null);
|
|
107
110
|
se.displayName = "HookFormControlContext";
|
|
108
111
|
var ce = (e, t, n, r = !0) => {
|
|
109
112
|
let i = {};
|
|
@@ -112,7 +115,7 @@ var ce = (e, t, n, r = !0) => {
|
|
|
112
115
|
return t._proxyFormState[i] !== A.all && (t._proxyFormState[i] = !r || A.all), n && (n[i] = !0), e[i];
|
|
113
116
|
} });
|
|
114
117
|
return i;
|
|
115
|
-
}, le = D ?
|
|
118
|
+
}, le = D ? e.useLayoutEffect : e.useEffect, L = (e) => typeof e == "string", ue = (e, t, n, r, i) => L(e) ? (r && t.watch.add(e), N(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), N(n, e))) : (r && (t.watchAll = !0), n), de = (e) => S(e) || !C(e), R = (e, t) => t.length === 0 && !Array.isArray(e) && !E(e);
|
|
116
119
|
function z(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
117
120
|
if (e === t) return !0;
|
|
118
121
|
if (de(e) || de(t)) return Object.is(e, t);
|
|
@@ -138,7 +141,7 @@ function z(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
|
138
141
|
}
|
|
139
142
|
return !0;
|
|
140
143
|
}
|
|
141
|
-
var fe =
|
|
144
|
+
var fe = e.createContext(null);
|
|
142
145
|
fe.displayName = "HookFormContext";
|
|
143
146
|
var pe = (e, t, n, r, i) => t ? {
|
|
144
147
|
...n[e],
|
|
@@ -1071,27 +1074,27 @@ function et(e = {}) {
|
|
|
1071
1074
|
formControl: X
|
|
1072
1075
|
};
|
|
1073
1076
|
}
|
|
1074
|
-
function tt(
|
|
1075
|
-
let
|
|
1077
|
+
function tt(t = {}) {
|
|
1078
|
+
let n = e.useRef(void 0), r = e.useRef(void 0), i = e.useRef(t.formControl), [a, o] = e.useState(() => ({
|
|
1076
1079
|
...O($e),
|
|
1077
|
-
isLoading: F(
|
|
1078
|
-
errors:
|
|
1079
|
-
disabled:
|
|
1080
|
-
defaultValues: F(
|
|
1080
|
+
isLoading: F(t.defaultValues),
|
|
1081
|
+
errors: t.errors || {},
|
|
1082
|
+
disabled: t.disabled || !1,
|
|
1083
|
+
defaultValues: F(t.defaultValues) ? void 0 : t.defaultValues
|
|
1081
1084
|
}));
|
|
1082
|
-
if (!
|
|
1083
|
-
...
|
|
1085
|
+
if (!n.current || t.formControl && i.current !== t.formControl) if (i.current = t.formControl, t.formControl) n.current = {
|
|
1086
|
+
...t.formControl,
|
|
1084
1087
|
formState: a
|
|
1085
|
-
},
|
|
1088
|
+
}, t.defaultValues && !F(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
|
|
1086
1089
|
else {
|
|
1087
|
-
let { formControl:
|
|
1088
|
-
|
|
1090
|
+
let { formControl: e, ...r } = et(t);
|
|
1091
|
+
n.current = {
|
|
1089
1092
|
...r,
|
|
1090
1093
|
formState: a
|
|
1091
1094
|
};
|
|
1092
1095
|
}
|
|
1093
|
-
let s =
|
|
1094
|
-
return s._options =
|
|
1096
|
+
let s = n.current.control;
|
|
1097
|
+
return s._options = t, le(() => {
|
|
1095
1098
|
let e = s._subscribe({
|
|
1096
1099
|
formState: s._proxyFormState,
|
|
1097
1100
|
callback: () => o({
|
|
@@ -1104,52 +1107,52 @@ function tt(e = {}) {
|
|
|
1104
1107
|
...e,
|
|
1105
1108
|
isReady: !0
|
|
1106
1109
|
})), s._formState.isReady = !0, e;
|
|
1107
|
-
}, [s]),
|
|
1108
|
-
|
|
1110
|
+
}, [s]), e.useEffect(() => s._disableForm(t.disabled), [s, t.disabled]), e.useEffect(() => {
|
|
1111
|
+
t.mode && (s._options.mode = t.mode), t.reValidateMode && (s._options.reValidateMode = t.reValidateMode);
|
|
1109
1112
|
}, [
|
|
1110
1113
|
s,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
]),
|
|
1114
|
-
|
|
1115
|
-
}, [s,
|
|
1116
|
-
|
|
1117
|
-
}, [s,
|
|
1114
|
+
t.mode,
|
|
1115
|
+
t.reValidateMode
|
|
1116
|
+
]), e.useEffect(() => {
|
|
1117
|
+
t.errors && (s._setErrors(t.errors), s._focusError());
|
|
1118
|
+
}, [s, t.errors]), e.useEffect(() => {
|
|
1119
|
+
t.shouldUnregister && s._subjects.state.next({ values: s._getWatch() });
|
|
1120
|
+
}, [s, t.shouldUnregister]), e.useEffect(() => {
|
|
1118
1121
|
if (s._proxyFormState.isDirty) {
|
|
1119
1122
|
let e = s._getDirty();
|
|
1120
1123
|
e !== a.isDirty && s._subjects.state.next({ isDirty: e });
|
|
1121
1124
|
}
|
|
1122
|
-
}, [s, a.isDirty]),
|
|
1123
|
-
|
|
1125
|
+
}, [s, a.isDirty]), e.useEffect(() => {
|
|
1126
|
+
t.values && !z(t.values, r.current) ? (s._reset(t.values, {
|
|
1124
1127
|
keepFieldsRef: !0,
|
|
1125
1128
|
...s._options.resetOptions
|
|
1126
|
-
}), s._options.resetOptions?.keepIsValid || s._setValid(),
|
|
1127
|
-
}, [s,
|
|
1129
|
+
}), s._options.resetOptions?.keepIsValid || s._setValid(), r.current = t.values, o((e) => ({ ...e }))) : s._resetDefaultValues();
|
|
1130
|
+
}, [s, t.values]), e.useEffect(() => {
|
|
1128
1131
|
s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
|
|
1129
|
-
}),
|
|
1132
|
+
}), n.current.formState = e.useMemo(() => ce(a, s), [s, a]), n.current;
|
|
1130
1133
|
}
|
|
1131
1134
|
//#endregion
|
|
1132
1135
|
//#region src/Form/useForm.tsx
|
|
1133
1136
|
var nt = () => {
|
|
1134
|
-
let [
|
|
1135
|
-
let
|
|
1137
|
+
let [e, t] = u(), n = tt({ reValidateMode: "onChange" }), r = (e, r) => {
|
|
1138
|
+
let i = n.register(e, r), a = (r) => (t(null), n.clearErrors(e), i.onChange(r)), o = n?.formState.errors, s = n.watch(e);
|
|
1136
1139
|
return {
|
|
1137
|
-
...
|
|
1140
|
+
...i,
|
|
1138
1141
|
onChange: a,
|
|
1139
1142
|
formvalue: s,
|
|
1140
1143
|
error: o?.[e]?.message?.toString()
|
|
1141
1144
|
};
|
|
1142
|
-
},
|
|
1143
|
-
e.errors ? Object.keys(e.errors).forEach((t) =>
|
|
1144
|
-
},
|
|
1145
|
+
}, i = (e) => {
|
|
1146
|
+
e.errors ? Object.keys(e.errors).forEach((t) => n.setError(t, { message: e.errors?.[t]?.[0] })) : t(e);
|
|
1147
|
+
}, a = () => /* @__PURE__ */ f(d, { children: e && !e.errors && /* @__PURE__ */ f("div", {
|
|
1145
1148
|
className: m["global-error"],
|
|
1146
|
-
children:
|
|
1149
|
+
children: e.message
|
|
1147
1150
|
}) });
|
|
1148
1151
|
return {
|
|
1149
|
-
...
|
|
1150
|
-
register:
|
|
1151
|
-
GlobalError:
|
|
1152
|
-
setErrors:
|
|
1152
|
+
...n,
|
|
1153
|
+
register: r,
|
|
1154
|
+
GlobalError: a,
|
|
1155
|
+
setErrors: i
|
|
1153
1156
|
};
|
|
1154
1157
|
}, q = {
|
|
1155
1158
|
container: "style-module__container__JyG0-",
|
|
@@ -1167,166 +1170,166 @@ var nt = () => {
|
|
|
1167
1170
|
light: "style-module__light__Kubs1",
|
|
1168
1171
|
secondary: "style-module__secondary__EkNcU",
|
|
1169
1172
|
"secondary-light": "style-module__secondary-light__cJeWY"
|
|
1170
|
-
}, rt = ({ color: e = "primary", ...
|
|
1171
|
-
let
|
|
1172
|
-
return
|
|
1173
|
-
...
|
|
1174
|
-
className:
|
|
1173
|
+
}, rt = ({ color: e = "primary", ...t }) => {
|
|
1174
|
+
let n = ["ui-loading"];
|
|
1175
|
+
return n.push(J.loading), e && n.push(J[e], "ui-loading-" + e), /* @__PURE__ */ p("div", {
|
|
1176
|
+
...t,
|
|
1177
|
+
className: n.join(" "),
|
|
1175
1178
|
children: [
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
/* @__PURE__ */
|
|
1179
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ f("div", { className: J.dot }),
|
|
1180
|
+
/* @__PURE__ */ f("div", { className: J.dot }),
|
|
1181
|
+
/* @__PURE__ */ f("div", { className: J.dot }),
|
|
1182
|
+
/* @__PURE__ */ f("div", { className: J.dot })
|
|
1180
1183
|
]
|
|
1181
1184
|
});
|
|
1182
|
-
}, Y = ({ children:
|
|
1183
|
-
let [b, x] =
|
|
1184
|
-
return
|
|
1185
|
-
x(
|
|
1186
|
-
}, [
|
|
1187
|
-
className:
|
|
1185
|
+
}, Y = ({ children: e, beforeElement: n, afterElement: r, error: i, placeholder: a, styleContainer: s, classNameContainer: l, classNameContainerElement: m, hiddenContainer: h, formvalue: g, wait: _, withBorder: v = !1, ...y }) => {
|
|
1186
|
+
let [b, x] = u("");
|
|
1187
|
+
return o(() => {
|
|
1188
|
+
x(i ?? "");
|
|
1189
|
+
}, [i]), /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("label", {
|
|
1190
|
+
className: c(() => {
|
|
1188
1191
|
let e = ["ui-form-element-container"];
|
|
1189
|
-
return e.push(q.container), b && e.push(q.error), y.disabled && e.push(q.disabled), h && e.push(q.hidden), v && e.push(q.border),
|
|
1192
|
+
return e.push(q.container), b && e.push(q.error), y.disabled && e.push(q.disabled), h && e.push(q.hidden), v && e.push(q.border), l && e.push(l), e.join(" ");
|
|
1190
1193
|
}, [
|
|
1191
1194
|
b,
|
|
1192
1195
|
y.disabled,
|
|
1193
1196
|
h,
|
|
1194
|
-
|
|
1197
|
+
l,
|
|
1195
1198
|
v
|
|
1196
1199
|
]),
|
|
1197
|
-
style:
|
|
1198
|
-
children: /* @__PURE__ */
|
|
1200
|
+
style: s,
|
|
1201
|
+
children: /* @__PURE__ */ p("div", {
|
|
1199
1202
|
className: "ui-form-element " + q.element + (m ? " " + m : ""),
|
|
1200
1203
|
children: [
|
|
1201
|
-
|
|
1202
|
-
typeof
|
|
1203
|
-
|
|
1204
|
+
n ? t(n, { key: "ui-before-element" }) : null,
|
|
1205
|
+
typeof e == "function" ? e(y) : null,
|
|
1206
|
+
a && _ ? "" : /* @__PURE__ */ f("span", {
|
|
1204
1207
|
className: "ui-form-element-placeholder " + q.placeholder,
|
|
1205
|
-
children:
|
|
1208
|
+
children: a
|
|
1206
1209
|
}),
|
|
1207
|
-
_ && /* @__PURE__ */
|
|
1208
|
-
|
|
1210
|
+
_ && /* @__PURE__ */ f(rt, {}),
|
|
1211
|
+
r ? t(r, { key: "ui-after-element" }) : null
|
|
1209
1212
|
]
|
|
1210
1213
|
})
|
|
1211
|
-
}), b && /* @__PURE__ */
|
|
1214
|
+
}), b && /* @__PURE__ */ f("div", {
|
|
1212
1215
|
className: "ui-form-error " + q.error,
|
|
1213
1216
|
children: b
|
|
1214
1217
|
})] });
|
|
1215
1218
|
}, it = y, at = {
|
|
1216
1219
|
container: "styles-module__container__-32s9",
|
|
1217
1220
|
placeholder: "styles-module__placeholder__HQctl"
|
|
1218
|
-
}, ot =
|
|
1219
|
-
let [d,
|
|
1220
|
-
typeof e == "function" && e(t), typeof
|
|
1221
|
+
}, ot = r(({ onChange: e, onInput: t, onChangeText: n, wait: r, disabled: i, formvalue: a, children: s, ...c }, l) => {
|
|
1222
|
+
let [d, p] = u(""), m = (t) => {
|
|
1223
|
+
typeof e == "function" && e(t), typeof n == "function" && n(t.target.value);
|
|
1221
1224
|
}, h = (e) => {
|
|
1222
|
-
|
|
1225
|
+
i || r || (typeof t == "function" && t(e), p(e.target.value));
|
|
1223
1226
|
};
|
|
1224
|
-
return
|
|
1225
|
-
let e = c.value ??
|
|
1226
|
-
|
|
1227
|
-
}, [c.value,
|
|
1227
|
+
return o(() => {
|
|
1228
|
+
let e = c.value ?? a;
|
|
1229
|
+
p(e ? String(e) : "");
|
|
1230
|
+
}, [c.value, a]), /* @__PURE__ */ f(Y, {
|
|
1228
1231
|
...c,
|
|
1229
|
-
wait:
|
|
1232
|
+
wait: r,
|
|
1230
1233
|
classNameContainerElement: at.container,
|
|
1231
1234
|
withBorder: !0,
|
|
1232
|
-
children: (e) => /* @__PURE__ */
|
|
1235
|
+
children: (e) => /* @__PURE__ */ f("input", {
|
|
1233
1236
|
...e,
|
|
1234
1237
|
placeholder: "",
|
|
1235
1238
|
onChange: m,
|
|
1236
|
-
disabled:
|
|
1237
|
-
value:
|
|
1239
|
+
disabled: i || r,
|
|
1240
|
+
value: r ? "" : d,
|
|
1238
1241
|
onInput: h,
|
|
1239
|
-
ref:
|
|
1242
|
+
ref: l
|
|
1240
1243
|
})
|
|
1241
1244
|
});
|
|
1242
|
-
}), st = { container: "style-module__container__iExWO" }, ct =
|
|
1243
|
-
let
|
|
1244
|
-
typeof e == "function" && e(t), typeof
|
|
1245
|
+
}), st = { container: "style-module__container__iExWO" }, ct = r(({ onChange: e, onInput: t, onChangeText: n, formvalue: r, wait: i, ...a }, c) => {
|
|
1246
|
+
let d = l(null), [p, m] = u(a.value ?? r ?? ""), h = (t) => {
|
|
1247
|
+
typeof e == "function" && e(t), typeof n == "function" && n(t.target.value);
|
|
1245
1248
|
}, g = (e) => {
|
|
1246
|
-
typeof
|
|
1249
|
+
typeof t == "function" && t(e), m(e.target.value);
|
|
1247
1250
|
};
|
|
1248
|
-
|
|
1249
|
-
let e =
|
|
1251
|
+
o(() => {
|
|
1252
|
+
let e = d.current;
|
|
1250
1253
|
if (!e) return;
|
|
1251
1254
|
let t = e.offsetHeight;
|
|
1252
1255
|
e.style.height = "auto";
|
|
1253
1256
|
let n = e.scrollHeight, r = Math.max(n, 50);
|
|
1254
1257
|
e.style.height = `${Math.max(r, t)}px`;
|
|
1255
|
-
}, [
|
|
1256
|
-
m(
|
|
1257
|
-
}, [
|
|
1258
|
-
let _ =
|
|
1259
|
-
return /* @__PURE__ */
|
|
1260
|
-
...
|
|
1261
|
-
wait:
|
|
1258
|
+
}, [p]), o(() => {
|
|
1259
|
+
m(a.value ?? r ?? "");
|
|
1260
|
+
}, [a.value, r]), s(c, () => d.current);
|
|
1261
|
+
let _ = i ? "" : p;
|
|
1262
|
+
return /* @__PURE__ */ f(Y, {
|
|
1263
|
+
...a,
|
|
1264
|
+
wait: i,
|
|
1262
1265
|
classNameContainerElement: st.container,
|
|
1263
1266
|
withBorder: !0,
|
|
1264
|
-
children: (e) => /* @__PURE__ */
|
|
1267
|
+
children: (e) => /* @__PURE__ */ f("textarea", {
|
|
1265
1268
|
...e,
|
|
1266
|
-
disabled:
|
|
1269
|
+
disabled: i,
|
|
1267
1270
|
placeholder: e.placeholder ?? "",
|
|
1268
1271
|
value: _,
|
|
1269
1272
|
onChange: h,
|
|
1270
1273
|
onInput: g,
|
|
1271
|
-
ref:
|
|
1274
|
+
ref: d
|
|
1272
1275
|
})
|
|
1273
1276
|
});
|
|
1274
1277
|
}), lt = {
|
|
1275
1278
|
"file-btn": "style-module__file-btn__WajPw",
|
|
1276
1279
|
icon: "style-module__icon__f1VPN"
|
|
1277
|
-
}, ut = ({ onChange:
|
|
1278
|
-
let m =
|
|
1280
|
+
}, ut = ({ onChange: e, onChangeFiles: t, accept: n, multiple: r, wait: a, children: o, className: s, icon: c, ...u }) => {
|
|
1281
|
+
let m = l(null), h = `
|
|
1279
1282
|
${lt["file-btn"]}
|
|
1280
|
-
${
|
|
1281
|
-
`.trim(), g =
|
|
1282
|
-
let
|
|
1283
|
-
typeof
|
|
1284
|
-
}, [
|
|
1285
|
-
return /* @__PURE__ */
|
|
1286
|
-
...
|
|
1287
|
-
wait:
|
|
1288
|
-
children: (
|
|
1283
|
+
${c && !a ? lt.icon : ""}
|
|
1284
|
+
`.trim(), g = i((n) => {
|
|
1285
|
+
let r = n.target.files;
|
|
1286
|
+
typeof e == "function" && e(n), typeof t == "function" && t(r);
|
|
1287
|
+
}, [e, t]);
|
|
1288
|
+
return /* @__PURE__ */ f(Y, {
|
|
1289
|
+
...u,
|
|
1290
|
+
wait: a,
|
|
1291
|
+
children: (e) => /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("input", {
|
|
1289
1292
|
type: "file",
|
|
1290
1293
|
ref: m,
|
|
1291
1294
|
onChange: g,
|
|
1292
|
-
accept:
|
|
1293
|
-
multiple:
|
|
1295
|
+
accept: n,
|
|
1296
|
+
multiple: r,
|
|
1294
1297
|
style: { display: "none" },
|
|
1295
|
-
...
|
|
1296
|
-
}), /* @__PURE__ */
|
|
1297
|
-
className: `ui-file-uploader ${h} ${
|
|
1298
|
-
children: !
|
|
1298
|
+
...e
|
|
1299
|
+
}), /* @__PURE__ */ f("div", {
|
|
1300
|
+
className: `ui-file-uploader ${h} ${s || ""}`,
|
|
1301
|
+
children: !a && (o || "Выбрать файл")
|
|
1299
1302
|
})] })
|
|
1300
1303
|
});
|
|
1301
|
-
}, dt = ({ onChange: e, children:
|
|
1302
|
-
let
|
|
1304
|
+
}, dt = ({ onChange: e, children: t, multiple: n, accept: r, ...i }) => {
|
|
1305
|
+
let a = l(null), s = (t) => {
|
|
1303
1306
|
let n = t.target;
|
|
1304
1307
|
if (n.files) for (let t of n.files) {
|
|
1305
1308
|
let n = new FileReader();
|
|
1306
1309
|
n.onload = (n) => {
|
|
1307
|
-
let r = n.target?.result?.toString().split(";base64,"), i = r?.[0].replace("data:", "") ?? "",
|
|
1308
|
-
typeof e == "function" && (
|
|
1310
|
+
let r = n.target?.result?.toString().split(";base64,"), i = r?.[0].replace("data:", "") ?? "", o = r?.[1] ?? "";
|
|
1311
|
+
typeof e == "function" && (a.current.value = "", e({
|
|
1309
1312
|
name: t.name,
|
|
1310
1313
|
type: t.type,
|
|
1311
1314
|
size: t.size,
|
|
1312
1315
|
mime: i,
|
|
1313
|
-
data:
|
|
1316
|
+
data: o,
|
|
1314
1317
|
base64: n.target?.result
|
|
1315
1318
|
}));
|
|
1316
1319
|
}, n.readAsDataURL(t);
|
|
1317
1320
|
}
|
|
1318
1321
|
}, c = (e) => {
|
|
1319
|
-
|
|
1322
|
+
i.disabled || (a.current.click(), e.preventDefault());
|
|
1320
1323
|
}, u = () => {
|
|
1321
1324
|
let e = document.createElement("input");
|
|
1322
|
-
return e.setAttribute("type", "file"), e.onchange = s,
|
|
1325
|
+
return e.setAttribute("type", "file"), e.onchange = s, r && r.length > 0 && e.setAttribute("accept", r.join(",")), n && e.setAttribute("multiple", "multiple"), e;
|
|
1323
1326
|
};
|
|
1324
|
-
return
|
|
1325
|
-
|
|
1326
|
-
}), []), /* @__PURE__ */
|
|
1327
|
-
...
|
|
1327
|
+
return o(() => (a.current = u(), () => {
|
|
1328
|
+
a.current?.remove();
|
|
1329
|
+
}), []), /* @__PURE__ */ f("div", {
|
|
1330
|
+
...i,
|
|
1328
1331
|
onClick: c,
|
|
1329
|
-
children:
|
|
1332
|
+
children: t
|
|
1330
1333
|
});
|
|
1331
1334
|
}, X = {
|
|
1332
1335
|
container: "style-module__container__Y4Az4",
|
|
@@ -1343,24 +1346,24 @@ var nt = () => {
|
|
|
1343
1346
|
"normal-btn": "style-module__normal-btn__qHevU",
|
|
1344
1347
|
"small-btn": "style-module__small-btn__Axtvq",
|
|
1345
1348
|
"large-btn": "style-module__large-btn__X3--3"
|
|
1346
|
-
}, ft = ({ children: e, className:
|
|
1347
|
-
let
|
|
1349
|
+
}, ft = ({ children: e, className: t, classNameContainer: n, styleContainer: r, wait: i = !1, variant: a, size: o = "normal", icon: s, ...c }) => {
|
|
1350
|
+
let l = `
|
|
1348
1351
|
${X.btn}
|
|
1349
|
-
${
|
|
1350
|
-
${
|
|
1351
|
-
${
|
|
1352
|
-
${
|
|
1353
|
-
`.replace(/\s+/g, " ").trim(),
|
|
1354
|
-
return
|
|
1355
|
-
className:
|
|
1356
|
-
style:
|
|
1357
|
-
children: [/* @__PURE__ */
|
|
1358
|
-
...
|
|
1359
|
-
className:
|
|
1360
|
-
children: !
|
|
1361
|
-
}),
|
|
1362
|
-
className: "ui-button-spinner " + X["wait-indicator"] + (
|
|
1363
|
-
children: /* @__PURE__ */
|
|
1352
|
+
${a && X[`btn-${a}`]}
|
|
1353
|
+
${o && X[`${o}-btn`]}
|
|
1354
|
+
${s && !i ? X[`icon-${s}`] : ""}
|
|
1355
|
+
${t || ""}
|
|
1356
|
+
`.replace(/\s+/g, " ").trim(), u = ["ui-button-container"];
|
|
1357
|
+
return u.push(X.container), n && u.push(n), /* @__PURE__ */ p("div", {
|
|
1358
|
+
className: u.join(" "),
|
|
1359
|
+
style: r,
|
|
1360
|
+
children: [/* @__PURE__ */ f("button", {
|
|
1361
|
+
...c,
|
|
1362
|
+
className: l,
|
|
1363
|
+
children: !i && e
|
|
1364
|
+
}), i && /* @__PURE__ */ f("div", {
|
|
1365
|
+
className: "ui-button-spinner " + X["wait-indicator"] + (i ? " " + X.active : ""),
|
|
1366
|
+
children: /* @__PURE__ */ f(rt, { color: a })
|
|
1364
1367
|
})]
|
|
1365
1368
|
});
|
|
1366
1369
|
}, pt = {
|
|
@@ -1369,72 +1372,72 @@ var nt = () => {
|
|
|
1369
1372
|
new: "style-module__new__fOnXf",
|
|
1370
1373
|
close: "style-module__close__9k-p1",
|
|
1371
1374
|
wait: "style-module__wait__qnGnj"
|
|
1372
|
-
}, mt = ({ onChange: e, onClick:
|
|
1373
|
-
let { base64:
|
|
1374
|
-
h.current = e, typeof
|
|
1375
|
+
}, mt = ({ onChange: e, onClick: t, onId: n, onRemove: r, ...i }) => {
|
|
1376
|
+
let { base64: a, src: s } = i, [c, d] = u(!0), m = l(!1), h = l(), _ = (e) => {
|
|
1377
|
+
h.current = e, typeof n == "function" && n(e);
|
|
1375
1378
|
};
|
|
1376
|
-
return
|
|
1377
|
-
typeof e != "function" ||
|
|
1378
|
-
...
|
|
1379
|
+
return o(() => {
|
|
1380
|
+
typeof e != "function" || s || e({
|
|
1381
|
+
...i,
|
|
1379
1382
|
setWait: d,
|
|
1380
1383
|
setId: _,
|
|
1381
1384
|
id: h.current
|
|
1382
1385
|
});
|
|
1383
|
-
}, []), /* @__PURE__ */
|
|
1386
|
+
}, []), /* @__PURE__ */ p("span", {
|
|
1384
1387
|
className: pt.image,
|
|
1385
1388
|
onClick: () => {
|
|
1386
|
-
typeof
|
|
1387
|
-
...
|
|
1389
|
+
typeof t == "function" && t({
|
|
1390
|
+
...i,
|
|
1388
1391
|
setWait: d,
|
|
1389
1392
|
setId: _,
|
|
1390
1393
|
id: h.current
|
|
1391
1394
|
});
|
|
1392
1395
|
},
|
|
1393
1396
|
children: [
|
|
1394
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ f("span", {
|
|
1395
1398
|
className: pt.close,
|
|
1396
1399
|
onClick: (e) => {
|
|
1397
1400
|
if (!e.target) return;
|
|
1398
1401
|
let t = e.target;
|
|
1399
|
-
m.current && (m.current = !1, t.blur(), typeof
|
|
1402
|
+
m.current && (m.current = !1, t.blur(), typeof r == "function" && r()), m.current = !0;
|
|
1400
1403
|
},
|
|
1401
1404
|
onBlur: () => {
|
|
1402
1405
|
m.current = !1;
|
|
1403
1406
|
},
|
|
1404
1407
|
tabIndex: 1
|
|
1405
1408
|
}),
|
|
1406
|
-
/* @__PURE__ */
|
|
1407
|
-
src:
|
|
1409
|
+
/* @__PURE__ */ f("img", {
|
|
1410
|
+
src: s ?? a?.toString(),
|
|
1408
1411
|
onLoad: () => {
|
|
1409
1412
|
d(!1);
|
|
1410
1413
|
}
|
|
1411
1414
|
}),
|
|
1412
|
-
|
|
1415
|
+
c && /* @__PURE__ */ f("span", {
|
|
1413
1416
|
className: pt.wait,
|
|
1414
|
-
children: /* @__PURE__ */
|
|
1417
|
+
children: /* @__PURE__ */ f(g, {})
|
|
1415
1418
|
})
|
|
1416
1419
|
]
|
|
1417
1420
|
});
|
|
1418
|
-
}, ht = ({ imagesArray: e, onChange:
|
|
1419
|
-
let [
|
|
1420
|
-
|
|
1421
|
-
},
|
|
1422
|
-
|
|
1423
|
-
},
|
|
1424
|
-
return
|
|
1425
|
-
typeof
|
|
1426
|
-
}, [
|
|
1427
|
-
e &&
|
|
1428
|
-
}, [e]), /* @__PURE__ */
|
|
1421
|
+
}, ht = ({ imagesArray: e, onChange: t, onChangeArray: n, onClick: r }) => {
|
|
1422
|
+
let [i, a] = u([]), s = (e) => {
|
|
1423
|
+
a((t) => [...t, { ...e }]);
|
|
1424
|
+
}, c = (e) => (t) => {
|
|
1425
|
+
a((n) => n.map((n) => (e === n && (n.id = t), n)));
|
|
1426
|
+
}, l = (e) => () => a((t) => t.filter((t) => t !== e));
|
|
1427
|
+
return o(() => {
|
|
1428
|
+
typeof n == "function" && n(i);
|
|
1429
|
+
}, [i]), o(() => {
|
|
1430
|
+
e && a(e);
|
|
1431
|
+
}, [e]), /* @__PURE__ */ p("div", {
|
|
1429
1432
|
className: pt.container,
|
|
1430
|
-
children: [
|
|
1433
|
+
children: [i.map((e, n) => /* @__PURE__ */ f(mt, {
|
|
1431
1434
|
...e,
|
|
1432
|
-
onChange:
|
|
1433
|
-
onClick:
|
|
1434
|
-
onRemove:
|
|
1435
|
-
onId:
|
|
1436
|
-
}, e.name + n)), /* @__PURE__ */
|
|
1437
|
-
onChange:
|
|
1435
|
+
onChange: t,
|
|
1436
|
+
onClick: r,
|
|
1437
|
+
onRemove: l(e),
|
|
1438
|
+
onId: c(e)
|
|
1439
|
+
}, e.name + n)), /* @__PURE__ */ f(dt, {
|
|
1440
|
+
onChange: s,
|
|
1438
1441
|
accept: ["image/png"],
|
|
1439
1442
|
className: pt.new,
|
|
1440
1443
|
multiple: !0
|
|
@@ -1444,27 +1447,27 @@ var nt = () => {
|
|
|
1444
1447
|
container: "style-module__container__tUkU0",
|
|
1445
1448
|
text: "style-module__text__5dksK",
|
|
1446
1449
|
indicator: "style-module__indicator__BdmZs"
|
|
1447
|
-
}, _t =
|
|
1448
|
-
let
|
|
1449
|
-
typeof
|
|
1450
|
+
}, _t = r(({ type: e = "checkbox", hiddenContainer: t = !0, placeholder: n, onChecked: r, onChange: i, ...a }, o) => {
|
|
1451
|
+
let s = (e) => {
|
|
1452
|
+
typeof i == "function" && i(e), typeof r == "function" && r(e.target.checked, a.value);
|
|
1450
1453
|
};
|
|
1451
|
-
return /* @__PURE__ */
|
|
1452
|
-
...
|
|
1453
|
-
hiddenContainer:
|
|
1454
|
-
children: (
|
|
1454
|
+
return /* @__PURE__ */ f(Y, {
|
|
1455
|
+
...a,
|
|
1456
|
+
hiddenContainer: t,
|
|
1457
|
+
children: (t) => /* @__PURE__ */ p("div", {
|
|
1455
1458
|
className: "ui-checkbox-container " + gt.container,
|
|
1456
1459
|
children: [
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
-
...
|
|
1459
|
-
className: "ui-checkbox" + (
|
|
1460
|
+
/* @__PURE__ */ f("input", {
|
|
1461
|
+
...t,
|
|
1462
|
+
className: "ui-checkbox" + (t.className ? " " + t.className : ""),
|
|
1460
1463
|
type: e,
|
|
1461
|
-
onChange:
|
|
1462
|
-
ref:
|
|
1464
|
+
onChange: s,
|
|
1465
|
+
ref: o
|
|
1463
1466
|
}),
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ f("span", { className: "ui-checkbox-indicator " + gt.indicator }),
|
|
1468
|
+
/* @__PURE__ */ f("span", {
|
|
1466
1469
|
className: "ui-checkbox-text " + gt.text,
|
|
1467
|
-
children:
|
|
1470
|
+
children: n
|
|
1468
1471
|
})
|
|
1469
1472
|
]
|
|
1470
1473
|
})
|
|
@@ -1475,11 +1478,11 @@ var nt = () => {
|
|
|
1475
1478
|
up: "style-module__up__4e9Cz",
|
|
1476
1479
|
left: "style-module__left__tsvvk",
|
|
1477
1480
|
right: "style-module__right__-YgfC"
|
|
1478
|
-
}, yt = ({ className: e, direction:
|
|
1479
|
-
let
|
|
1480
|
-
return
|
|
1481
|
-
...
|
|
1482
|
-
className:
|
|
1481
|
+
}, yt = ({ className: e, direction: t = "down", ...n }) => {
|
|
1482
|
+
let r = ["ui-component-arrow"];
|
|
1483
|
+
return r.push(vt.container), t && r.push(vt[t]), e && r.push(e), /* @__PURE__ */ f("div", {
|
|
1484
|
+
...n,
|
|
1485
|
+
className: r.join(" ")
|
|
1483
1486
|
});
|
|
1484
1487
|
}, Z = {
|
|
1485
1488
|
"container-element": "style-module__container-element__bbCnL",
|
|
@@ -1500,15 +1503,15 @@ var nt = () => {
|
|
|
1500
1503
|
}, bt = "ui-", Q = (e, t, n) => {
|
|
1501
1504
|
let r = bt + (n ? n + "-" : "");
|
|
1502
1505
|
return Array.isArray(e) ? e.map(() => Q(e, t, r)).join(" ") : `${t[e]} ${r}${e}`;
|
|
1503
|
-
}, xt =
|
|
1506
|
+
}, xt = n({
|
|
1504
1507
|
selected: "",
|
|
1505
1508
|
emptyValue: { current: {} },
|
|
1506
1509
|
setSelect: (e) => {},
|
|
1507
1510
|
setSelected: (e) => {},
|
|
1508
1511
|
setTitle: (e) => {}
|
|
1509
|
-
}), St =
|
|
1510
|
-
let
|
|
1511
|
-
|
|
1512
|
+
}), St = r(({ children: e, onChangeSelect: t, value: n, formvalue: r, ...i }, a) => {
|
|
1513
|
+
let d = l(null), m = l(null), h = l(!1), [g, _] = u(!1), [v, y] = u(""), [b, x] = u(), S = () => {
|
|
1514
|
+
i.disabled || _(!0);
|
|
1512
1515
|
}, C = () => {
|
|
1513
1516
|
_(!1);
|
|
1514
1517
|
}, w = () => {
|
|
@@ -1518,31 +1521,31 @@ var nt = () => {
|
|
|
1518
1521
|
let t = new Event("input", { bubbles: !0 });
|
|
1519
1522
|
m.current.dispatchEvent(t);
|
|
1520
1523
|
}, T = (e) => {
|
|
1521
|
-
typeof
|
|
1524
|
+
typeof t == "function" && t(e), n === void 0 && y(e), C();
|
|
1522
1525
|
}, E = (e) => {
|
|
1523
|
-
|
|
1526
|
+
i.disabled || (typeof i.onInput == "function" && i.onInput(e), typeof i.onChange == "function" && i.onChange(e), y(e.target.value));
|
|
1524
1527
|
};
|
|
1525
|
-
|
|
1528
|
+
o(() => {
|
|
1526
1529
|
v && ee(v);
|
|
1527
|
-
}, [v]),
|
|
1528
|
-
y(String(
|
|
1529
|
-
}, [
|
|
1530
|
-
let e =
|
|
1530
|
+
}, [v]), o(() => {
|
|
1531
|
+
y(String(n ?? r));
|
|
1532
|
+
}, [n, r]), o(() => {
|
|
1533
|
+
let e = d.current, t = e.classList;
|
|
1531
1534
|
g ? (t.remove(Z.hidden), requestAnimationFrame(() => {
|
|
1532
1535
|
t.add(Z.opened), e?.focus();
|
|
1533
1536
|
})) : (t.contains(Z.opened) && (e.ontransitionend = () => {
|
|
1534
1537
|
t.add(Z.hidden), e.ontransitionend = null;
|
|
1535
1538
|
}), t.remove(Z.opened));
|
|
1536
|
-
}, [g]),
|
|
1537
|
-
let D =
|
|
1539
|
+
}, [g]), s(a, () => m.current, []);
|
|
1540
|
+
let D = c(() => {
|
|
1538
1541
|
let e = [Q("container", Z, "select")];
|
|
1539
1542
|
return e.push(Z.hidden), e;
|
|
1540
1543
|
}, []);
|
|
1541
|
-
return /* @__PURE__ */
|
|
1542
|
-
...
|
|
1544
|
+
return /* @__PURE__ */ f(Y, {
|
|
1545
|
+
...i,
|
|
1543
1546
|
classNameContainer: Q("container-element", Z, "select"),
|
|
1544
1547
|
withBorder: !0,
|
|
1545
|
-
children: (
|
|
1548
|
+
children: (t) => /* @__PURE__ */ p(xt.Provider, {
|
|
1546
1549
|
value: {
|
|
1547
1550
|
selected: v,
|
|
1548
1551
|
emptyValue: h,
|
|
@@ -1550,58 +1553,58 @@ var nt = () => {
|
|
|
1550
1553
|
setSelected: y,
|
|
1551
1554
|
setTitle: x
|
|
1552
1555
|
},
|
|
1553
|
-
children: [/* @__PURE__ */
|
|
1554
|
-
...
|
|
1556
|
+
children: [/* @__PURE__ */ f("input", {
|
|
1557
|
+
...t,
|
|
1555
1558
|
type: "hidden",
|
|
1556
1559
|
value: v,
|
|
1557
1560
|
onInput: E,
|
|
1558
1561
|
ref: m
|
|
1559
|
-
}), /* @__PURE__ */
|
|
1562
|
+
}), /* @__PURE__ */ p("div", {
|
|
1560
1563
|
className: D.join(" "),
|
|
1561
|
-
ref:
|
|
1564
|
+
ref: d,
|
|
1562
1565
|
tabIndex: 1,
|
|
1563
1566
|
onBlur: C,
|
|
1564
|
-
children: [/* @__PURE__ */
|
|
1567
|
+
children: [/* @__PURE__ */ p("div", {
|
|
1565
1568
|
className: Z.select,
|
|
1566
1569
|
onClick: w,
|
|
1567
|
-
children: [/* @__PURE__ */
|
|
1570
|
+
children: [/* @__PURE__ */ f("span", {
|
|
1568
1571
|
className: Q("title", Z, "select"),
|
|
1569
1572
|
children: b
|
|
1570
|
-
}), /* @__PURE__ */
|
|
1571
|
-
}), /* @__PURE__ */
|
|
1573
|
+
}), /* @__PURE__ */ f(yt, { className: Q("arrow", Z, "select") })]
|
|
1574
|
+
}), /* @__PURE__ */ f("ul", {
|
|
1572
1575
|
className: Q("select-list", Z, "select"),
|
|
1573
1576
|
children: e
|
|
1574
1577
|
})]
|
|
1575
1578
|
})]
|
|
1576
1579
|
})
|
|
1577
1580
|
});
|
|
1578
|
-
}), Ct = ({ children: e, value:
|
|
1579
|
-
let
|
|
1580
|
-
|
|
1581
|
+
}), Ct = ({ children: e, value: t, disabled: n, hidden: r, onClick: i, ...s }) => {
|
|
1582
|
+
let l = a(xt), u = (e) => {
|
|
1583
|
+
t === void 0 || n || (l.setSelect(t), typeof i == "function" && i(e));
|
|
1581
1584
|
};
|
|
1582
|
-
if (
|
|
1583
|
-
e && (
|
|
1584
|
-
}, [
|
|
1585
|
-
let
|
|
1585
|
+
if (o(() => {
|
|
1586
|
+
e && (t === l.selected || !l.emptyValue.current) && (l.setTitle(e), !l.emptyValue.current && t && l.setSelected(t), l.emptyValue.current = !0);
|
|
1587
|
+
}, [l.selected, l.emptyValue.current]), r) return null;
|
|
1588
|
+
let d = c(() => {
|
|
1586
1589
|
let e = [Q("ui-select-option", Z, "select")];
|
|
1587
|
-
return e.push(Z.option),
|
|
1588
|
-
}, [
|
|
1589
|
-
return /* @__PURE__ */
|
|
1590
|
-
...
|
|
1590
|
+
return e.push(Z.option), l.selected === t && e.push(Z.active, "active"), n && e.push(Z.disabled, "disabled"), e;
|
|
1591
|
+
}, [l.selected, n]);
|
|
1592
|
+
return /* @__PURE__ */ f("li", {
|
|
1593
|
+
...s,
|
|
1591
1594
|
onClick: u,
|
|
1592
|
-
className:
|
|
1595
|
+
className: d.join(" "),
|
|
1593
1596
|
children: e
|
|
1594
1597
|
});
|
|
1595
|
-
}, wt = ({ children: e, label:
|
|
1598
|
+
}, wt = ({ children: e, label: t }) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("ul", {
|
|
1596
1599
|
className: Z.optgpoup,
|
|
1597
|
-
children: [
|
|
1600
|
+
children: [t && /* @__PURE__ */ f("li", {
|
|
1598
1601
|
className: Z.label,
|
|
1599
|
-
children:
|
|
1602
|
+
children: t
|
|
1600
1603
|
}), e]
|
|
1601
1604
|
}) }), Tt = {
|
|
1602
|
-
...
|
|
1605
|
+
...r(({ ...e }, t) => /* @__PURE__ */ f(St, {
|
|
1603
1606
|
...e,
|
|
1604
|
-
ref:
|
|
1607
|
+
ref: t
|
|
1605
1608
|
})),
|
|
1606
1609
|
Option: Ct,
|
|
1607
1610
|
Optgroup: wt
|
|
@@ -1616,30 +1619,30 @@ var nt = () => {
|
|
|
1616
1619
|
opened: "style-module__opened__GjGrB",
|
|
1617
1620
|
arrow: "style-module__arrow__SCvqs",
|
|
1618
1621
|
item: "style-module__item__v8SnZ"
|
|
1619
|
-
}, Et = ({ items: e, isOpen:
|
|
1620
|
-
let
|
|
1621
|
-
|
|
1622
|
+
}, Et = ({ items: e, isOpen: t, enableRerenderItems: n, disabled: r }) => {
|
|
1623
|
+
let i = l(null), a = c(() => n ? t ? e : null : e, [
|
|
1624
|
+
n,
|
|
1622
1625
|
e,
|
|
1623
|
-
|
|
1626
|
+
t
|
|
1624
1627
|
]);
|
|
1625
|
-
return
|
|
1626
|
-
|
|
1627
|
-
}, [
|
|
1628
|
+
return o(() => {
|
|
1629
|
+
i.current && (window.innerWidth, i.current.getBoundingClientRect().left);
|
|
1630
|
+
}, [t]), r ? null : /* @__PURE__ */ f("ul", {
|
|
1628
1631
|
className: `${$["dropdown-list"]} ui-dropdown-list`,
|
|
1629
|
-
children:
|
|
1630
|
-
ref:
|
|
1632
|
+
children: a,
|
|
1633
|
+
ref: i
|
|
1631
1634
|
});
|
|
1632
|
-
}, Dt =
|
|
1633
|
-
let y =
|
|
1635
|
+
}, Dt = n({ close: () => {} }), Ot = ({ children: e, className: t, items: n, arrow: r = !0, direction: i = "down", position: a = "right", split: s = !1, disabled: d, hover: m = !1, enableRerenderItems: h = !0, onShow: g, onHide: _, ...v }) => {
|
|
1636
|
+
let y = l(null), b = l(null), [x, S] = u(!1), C = () => {
|
|
1634
1637
|
S(!1);
|
|
1635
1638
|
}, w = () => {
|
|
1636
1639
|
S(!0);
|
|
1637
1640
|
}, ee = () => {
|
|
1638
|
-
S((e) =>
|
|
1641
|
+
S((e) => d ? !1 : !e);
|
|
1639
1642
|
}, T = () => {
|
|
1640
1643
|
ee();
|
|
1641
1644
|
}, E = () => {
|
|
1642
|
-
b.current || (!
|
|
1645
|
+
b.current || (!s || m) && ee();
|
|
1643
1646
|
}, D = (e) => {
|
|
1644
1647
|
e.currentTarget.contains(e.relatedTarget) || C();
|
|
1645
1648
|
}, O = () => {
|
|
@@ -1647,21 +1650,21 @@ var nt = () => {
|
|
|
1647
1650
|
}, k = () => {
|
|
1648
1651
|
b.current &&= (clearTimeout(b.current), null);
|
|
1649
1652
|
};
|
|
1650
|
-
|
|
1653
|
+
o(() => {
|
|
1651
1654
|
let e = y.current, t = e?.classList;
|
|
1652
1655
|
x ? (t?.add($.opened), e?.focus(), typeof g == "function" && g()) : (t?.remove($.opened), typeof _ == "function" && _());
|
|
1653
1656
|
}, [x]);
|
|
1654
|
-
let A =
|
|
1657
|
+
let A = c(() => {
|
|
1655
1658
|
let e = ["ui-dropdown"];
|
|
1656
|
-
return e.push($.container),
|
|
1659
|
+
return e.push($.container), t && e.push(t), i && e.push($[i]), a && e.push($[a]), e.join(" ");
|
|
1657
1660
|
}, [
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
+
t,
|
|
1662
|
+
i,
|
|
1663
|
+
a
|
|
1661
1664
|
]);
|
|
1662
|
-
return /* @__PURE__ */
|
|
1665
|
+
return /* @__PURE__ */ f(Dt.Provider, {
|
|
1663
1666
|
value: { close: C },
|
|
1664
|
-
children: /* @__PURE__ */
|
|
1667
|
+
children: /* @__PURE__ */ p("div", {
|
|
1665
1668
|
...v,
|
|
1666
1669
|
className: A,
|
|
1667
1670
|
ref: y,
|
|
@@ -1670,42 +1673,42 @@ var nt = () => {
|
|
|
1670
1673
|
tabIndex: 1,
|
|
1671
1674
|
onBlur: D,
|
|
1672
1675
|
children: [
|
|
1673
|
-
|
|
1676
|
+
a === "left" && !d && /* @__PURE__ */ f(yt, {
|
|
1674
1677
|
className: $.arrow,
|
|
1675
1678
|
onClick: T
|
|
1676
1679
|
}),
|
|
1677
|
-
/* @__PURE__ */
|
|
1680
|
+
/* @__PURE__ */ f("div", {
|
|
1678
1681
|
onClick: E,
|
|
1679
1682
|
className: "ui-dropdown-block" + (x ? " " + $.hide : ""),
|
|
1680
1683
|
children: e
|
|
1681
1684
|
}),
|
|
1682
|
-
|
|
1685
|
+
a === "right" && !d && r && /* @__PURE__ */ f(yt, {
|
|
1683
1686
|
className: $.arrow,
|
|
1684
1687
|
onClick: T
|
|
1685
1688
|
}),
|
|
1686
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ f(Et, {
|
|
1687
1690
|
isOpen: x,
|
|
1688
|
-
disabled:
|
|
1691
|
+
disabled: d,
|
|
1689
1692
|
enableRerenderItems: h,
|
|
1690
|
-
items:
|
|
1693
|
+
items: n
|
|
1691
1694
|
})
|
|
1692
1695
|
]
|
|
1693
1696
|
})
|
|
1694
1697
|
});
|
|
1695
|
-
}, kt = ({ children: e, onClick:
|
|
1696
|
-
let s =
|
|
1697
|
-
typeof
|
|
1698
|
-
},
|
|
1699
|
-
return
|
|
1698
|
+
}, kt = ({ children: e, onClick: t, autoClose: n = !0, active: r, className: i, ...o }) => {
|
|
1699
|
+
let s = a(Dt), c = (e) => {
|
|
1700
|
+
typeof t == "function" && t(e), n && s.close();
|
|
1701
|
+
}, l = ["ui-dropdown-item"];
|
|
1702
|
+
return l.push($.item), r && l.push($.active, "active"), i && l.push(i), /* @__PURE__ */ f("li", {
|
|
1700
1703
|
...o,
|
|
1701
|
-
onClick:
|
|
1702
|
-
className:
|
|
1704
|
+
onClick: c,
|
|
1705
|
+
className: l.join(" "),
|
|
1703
1706
|
children: typeof e == "function" ? e(s) : e
|
|
1704
1707
|
});
|
|
1705
1708
|
}, At = {
|
|
1706
|
-
...
|
|
1709
|
+
...r(({ ...e }, t) => /* @__PURE__ */ f(Ot, { ...e })),
|
|
1707
1710
|
Item: kt
|
|
1708
|
-
}, jt =
|
|
1711
|
+
}, jt = n({}), Mt = ({ children: e }) => /* @__PURE__ */ f(jt.Provider, {
|
|
1709
1712
|
value: {},
|
|
1710
1713
|
children: e
|
|
1711
1714
|
});
|