@formatica/vue 0.1.2 → 0.2.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/dist/components/BaseField.d.ts +28 -0
- package/dist/components/BaseField.d.ts.map +1 -0
- package/dist/components/FormBuilder.d.ts +25 -0
- package/dist/components/FormBuilder.d.ts.map +1 -0
- package/dist/components/FormField.d.ts +6 -0
- package/dist/components/FormField.d.ts.map +1 -0
- package/dist/components/inputs/CheckboxGroupInput.d.ts +21 -0
- package/dist/components/inputs/CheckboxGroupInput.d.ts.map +1 -0
- package/dist/components/inputs/CheckboxInput.d.ts +16 -0
- package/dist/components/inputs/CheckboxInput.d.ts.map +1 -0
- package/dist/components/inputs/DateInput.d.ts +22 -0
- package/dist/components/inputs/DateInput.d.ts.map +1 -0
- package/dist/components/inputs/FileInput.d.ts +22 -0
- package/dist/components/inputs/FileInput.d.ts.map +1 -0
- package/dist/components/inputs/NumberInput.d.ts +26 -0
- package/dist/components/inputs/NumberInput.d.ts.map +1 -0
- package/dist/components/inputs/PhoneInput.d.ts +23 -0
- package/dist/components/inputs/PhoneInput.d.ts.map +1 -0
- package/dist/components/inputs/RadioInput.d.ts +19 -0
- package/dist/components/inputs/RadioInput.d.ts.map +1 -0
- package/dist/components/inputs/SelectInput.d.ts +29 -0
- package/dist/components/inputs/SelectInput.d.ts.map +1 -0
- package/dist/components/inputs/SliderInput.d.ts +23 -0
- package/dist/components/inputs/SliderInput.d.ts.map +1 -0
- package/dist/components/inputs/SwitchInput.d.ts +17 -0
- package/dist/components/inputs/SwitchInput.d.ts.map +1 -0
- package/dist/components/inputs/TagsInput.d.ts +24 -0
- package/dist/components/inputs/TagsInput.d.ts.map +1 -0
- package/dist/components/inputs/TextInput.d.ts +27 -0
- package/dist/components/inputs/TextInput.d.ts.map +1 -0
- package/dist/components/inputs/TextareaInput.d.ts +28 -0
- package/dist/components/inputs/TextareaInput.d.ts.map +1 -0
- package/dist/components/layout/FormDivider.d.ts +7 -0
- package/dist/components/layout/FormDivider.d.ts.map +1 -0
- package/dist/components/layout/FormGroup.d.ts +15 -0
- package/dist/components/layout/FormGroup.d.ts.map +1 -0
- package/dist/components/layout/FormHtml.d.ts +7 -0
- package/dist/components/layout/FormHtml.d.ts.map +1 -0
- package/dist/components/layout/FormRow.d.ts +12 -0
- package/dist/components/layout/FormRow.d.ts.map +1 -0
- package/dist/components/layout/FormSteps.d.ts +11 -0
- package/dist/components/layout/FormSteps.d.ts.map +1 -0
- package/dist/components/layout/FormTabs.d.ts +8 -0
- package/dist/components/layout/FormTabs.d.ts.map +1 -0
- package/dist/components/layout/LayoutRenderer.d.ts +8 -0
- package/dist/components/layout/LayoutRenderer.d.ts.map +1 -0
- package/dist/core/eventBus.d.ts +9 -0
- package/dist/core/eventBus.d.ts.map +1 -0
- package/dist/core/fieldRegistry.d.ts +24 -0
- package/dist/core/fieldRegistry.d.ts.map +1 -0
- package/dist/core/ruleRegistry.d.ts +2 -0
- package/dist/core/ruleRegistry.d.ts.map +1 -0
- package/dist/core/schemaParser.d.ts +4 -0
- package/dist/core/schemaParser.d.ts.map +1 -0
- package/dist/core/useConditions.d.ts +2 -0
- package/dist/core/useConditions.d.ts.map +1 -0
- package/dist/core/useForm.d.ts +10 -0
- package/dist/core/useForm.d.ts.map +1 -0
- package/dist/core/useFormI18n.d.ts +22 -0
- package/dist/core/useFormI18n.d.ts.map +1 -0
- package/dist/core/useTheme.d.ts +28 -0
- package/dist/core/useTheme.d.ts.map +1 -0
- package/dist/core/useValidation.d.ts +17 -0
- package/dist/core/useValidation.d.ts.map +1 -0
- package/dist/formatica.es.js +974 -966
- package/dist/formatica.es.js.map +1 -1
- package/dist/formatica.umd.cjs +1 -1
- package/dist/formatica.umd.cjs.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/types/form.d.ts +92 -0
- package/dist/types/form.d.ts.map +1 -0
- package/dist/types/i18n.d.ts +18 -0
- package/dist/types/i18n.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/layout.d.ts +76 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/schema.d.ts +251 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/theme.d.ts +69 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/validation.d.ts +26 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/utils/deepMerge.d.ts +2 -0
- package/dist/utils/deepMerge.d.ts.map +1 -0
- package/dist/utils/extractFields.d.ts +2 -0
- package/dist/utils/extractFields.d.ts.map +1 -0
- package/dist/utils/sanitize.d.ts +2 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/titleCase.d.ts +2 -0
- package/dist/utils/titleCase.d.ts.map +1 -0
- package/package.json +4 -2
package/dist/formatica.es.js
CHANGED
|
@@ -1,40 +1,50 @@
|
|
|
1
|
-
import { titleCase as
|
|
1
|
+
import { titleCase as Ie, evaluateCondition as se, getRule as Le, extractFields as P, sanitizeHtml as Ae, isFieldNode as Ce } from "@formatica/core";
|
|
2
2
|
export * from "@formatica/core";
|
|
3
|
-
import { inject as
|
|
4
|
-
import { getCountries as xe, getCountryCallingCode as ke, parsePhoneNumber as
|
|
5
|
-
const Be = Symbol("FormaticaComponents"),
|
|
6
|
-
function
|
|
7
|
-
|
|
3
|
+
import { reactive as te, inject as q, provide as ie, ref as D, computed as x, watch as J, isRef as Ne, defineComponent as j, openBlock as c, createElementBlock as f, normalizeClass as F, Fragment as O, renderList as G, createElementVNode as p, normalizeStyle as z, createCommentVNode as T, toDisplayString as L, withKeys as he, withModifiers as Y, createTextVNode as _, onMounted as ue, withDirectives as de, vModelText as ve, nextTick as ae, onBeforeUnmount as Ve, unref as H, createVNode as Z, Transition as le, withCtx as W, renderSlot as De, TransitionGroup as Me, createBlock as U, resolveDynamicComponent as Se, mergeProps as Ee, vShow as Re, resolveComponent as je } from "vue";
|
|
4
|
+
import { getCountries as xe, getCountryCallingCode as ke, parsePhoneNumber as ze, AsYouType as Oe } from "libphonenumber-js";
|
|
5
|
+
const Be = Symbol("FormaticaComponents"), ne = /* @__PURE__ */ new Map();
|
|
6
|
+
function Fe(e, u) {
|
|
7
|
+
ne.set(e, u);
|
|
8
8
|
}
|
|
9
9
|
function Bl(e) {
|
|
10
|
-
|
|
10
|
+
ne.delete(e);
|
|
11
11
|
}
|
|
12
12
|
function Ke(e) {
|
|
13
|
-
return
|
|
13
|
+
return ne.get(e);
|
|
14
14
|
}
|
|
15
15
|
function Pe(e) {
|
|
16
|
-
return
|
|
16
|
+
return ne.has(e);
|
|
17
17
|
}
|
|
18
18
|
function Fl() {
|
|
19
|
-
return Array.from(
|
|
19
|
+
return Array.from(ne.keys());
|
|
20
|
+
}
|
|
21
|
+
const Te = Symbol("Formatica");
|
|
22
|
+
function Tl(e = {}) {
|
|
23
|
+
return {
|
|
24
|
+
install(u) {
|
|
25
|
+
if (u.provide(Te, te(e)), e.components)
|
|
26
|
+
for (const [t, a] of Object.entries(e.components))
|
|
27
|
+
Fe(t, a);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
31
|
function Ue() {
|
|
22
32
|
const e = /* @__PURE__ */ new Map();
|
|
23
|
-
function
|
|
33
|
+
function u(a, s) {
|
|
24
34
|
e.has(a) || e.set(a, /* @__PURE__ */ new Set());
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
|
|
35
|
+
const o = e.get(a);
|
|
36
|
+
return o ? (o.add(s), () => {
|
|
37
|
+
o.delete(s);
|
|
28
38
|
}) : () => {
|
|
29
39
|
};
|
|
30
40
|
}
|
|
31
|
-
function t(a,
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
for (const d of
|
|
35
|
-
d(
|
|
41
|
+
function t(a, s) {
|
|
42
|
+
const o = e.get(a);
|
|
43
|
+
if (o)
|
|
44
|
+
for (const d of o)
|
|
45
|
+
d(s);
|
|
36
46
|
}
|
|
37
|
-
return { on:
|
|
47
|
+
return { on: u, emit: t };
|
|
38
48
|
}
|
|
39
49
|
const ye = Symbol("FormaticaI18n"), He = {
|
|
40
50
|
required: "This field is required",
|
|
@@ -55,174 +65,174 @@ const ye = Symbol("FormaticaI18n"), He = {
|
|
|
55
65
|
};
|
|
56
66
|
function Ge(e) {
|
|
57
67
|
const {
|
|
58
|
-
locale:
|
|
68
|
+
locale: u,
|
|
59
69
|
fallbackLocale: t = "en",
|
|
60
70
|
fieldTranslations: a = {},
|
|
61
|
-
formTranslations:
|
|
71
|
+
formTranslations: s = {}
|
|
62
72
|
} = e;
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
if (typeof
|
|
73
|
+
function o(r, i) {
|
|
74
|
+
const k = a[r];
|
|
75
|
+
if (k) {
|
|
76
|
+
const g = k[u.value];
|
|
77
|
+
if (g) {
|
|
78
|
+
const m = g[i];
|
|
79
|
+
if (typeof m == "string") return m;
|
|
70
80
|
}
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
if (typeof
|
|
81
|
+
const $ = k[t];
|
|
82
|
+
if ($) {
|
|
83
|
+
const m = $[i];
|
|
84
|
+
if (typeof m == "string") return m;
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
|
-
return
|
|
87
|
+
return i === "label" ? Ie(r) : "";
|
|
78
88
|
}
|
|
79
|
-
function d(
|
|
80
|
-
var
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
if ((
|
|
85
|
-
const
|
|
86
|
-
if ((
|
|
87
|
-
}
|
|
88
|
-
return
|
|
89
|
+
function d(r, i) {
|
|
90
|
+
var g, $;
|
|
91
|
+
const k = a[r];
|
|
92
|
+
if (k) {
|
|
93
|
+
const m = k[u.value];
|
|
94
|
+
if ((g = m == null ? void 0 : m.options) != null && g[i]) return m.options[i];
|
|
95
|
+
const C = k[t];
|
|
96
|
+
if (($ = C == null ? void 0 : C.options) != null && $[i]) return C.options[i];
|
|
97
|
+
}
|
|
98
|
+
return i;
|
|
89
99
|
}
|
|
90
|
-
function l(
|
|
91
|
-
var
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
return fe(
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
return fe(
|
|
98
|
-
const
|
|
99
|
-
return
|
|
100
|
+
function l(r, i) {
|
|
101
|
+
var m, C;
|
|
102
|
+
const k = (m = s[u.value]) == null ? void 0 : m.messages;
|
|
103
|
+
if (k != null && k[r])
|
|
104
|
+
return fe(k[r], i ?? {});
|
|
105
|
+
const g = (C = s[t]) == null ? void 0 : C.messages;
|
|
106
|
+
if (g != null && g[r])
|
|
107
|
+
return fe(g[r], i ?? {});
|
|
108
|
+
const $ = He[r];
|
|
109
|
+
return $ ? fe($, i ?? {}) : `Validation failed: ${r}`;
|
|
100
110
|
}
|
|
101
111
|
const n = {
|
|
102
|
-
locale:
|
|
112
|
+
locale: u,
|
|
103
113
|
fallbackLocale: t,
|
|
104
|
-
t:
|
|
114
|
+
t: o,
|
|
105
115
|
tOption: d,
|
|
106
116
|
tValidation: l
|
|
107
117
|
};
|
|
108
118
|
return ie(ye, n), n;
|
|
109
119
|
}
|
|
110
120
|
function Ze() {
|
|
111
|
-
return
|
|
121
|
+
return q(ye);
|
|
112
122
|
}
|
|
113
|
-
function fe(e,
|
|
114
|
-
return e.replace(/\{(\w+)\}/g, (t, a) =>
|
|
123
|
+
function fe(e, u) {
|
|
124
|
+
return e.replace(/\{(\w+)\}/g, (t, a) => u[a] !== void 0 ? String(u[a]) : `{${a}}`);
|
|
115
125
|
}
|
|
116
126
|
function we(e) {
|
|
117
|
-
return e.split("|").map((
|
|
118
|
-
const [t, ...a] =
|
|
127
|
+
return e.split("|").map((u) => {
|
|
128
|
+
const [t, ...a] = u.split(":"), s = {};
|
|
119
129
|
if (a.length > 0) {
|
|
120
130
|
const d = a.join(":").split(",");
|
|
121
|
-
t === "between" && d.length === 2 ? (
|
|
131
|
+
t === "between" && d.length === 2 ? (s.min = d[0], s.max = d[1]) : d.length === 1 ? s[t] = d[0] : s.values = d;
|
|
122
132
|
}
|
|
123
|
-
return { name: t, params:
|
|
133
|
+
return { name: t, params: s };
|
|
124
134
|
});
|
|
125
135
|
}
|
|
126
136
|
function qe(e) {
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
137
|
+
const u = e.rules;
|
|
138
|
+
if (!u) {
|
|
129
139
|
const a = [];
|
|
130
140
|
return e.required && a.push({ name: "required" }), a;
|
|
131
141
|
}
|
|
132
|
-
if (typeof
|
|
133
|
-
return we(
|
|
134
|
-
if (Array.isArray(
|
|
135
|
-
return
|
|
142
|
+
if (typeof u == "string")
|
|
143
|
+
return we(u);
|
|
144
|
+
if (Array.isArray(u))
|
|
145
|
+
return u.flatMap((a) => typeof a == "string" ? we(a) : []);
|
|
136
146
|
const t = [];
|
|
137
|
-
for (const [a,
|
|
138
|
-
if (
|
|
139
|
-
const
|
|
140
|
-
typeof
|
|
147
|
+
for (const [a, s] of Object.entries(u)) {
|
|
148
|
+
if (s === !1) continue;
|
|
149
|
+
const o = {};
|
|
150
|
+
typeof s == "object" && s !== null && !Array.isArray(s) ? Object.assign(o, s) : s !== !0 && (o[a] = s), t.push({ name: a, params: o });
|
|
141
151
|
}
|
|
142
152
|
return t;
|
|
143
153
|
}
|
|
144
|
-
function Ye(e,
|
|
154
|
+
function Ye(e, u) {
|
|
145
155
|
let t = null, a = null;
|
|
146
|
-
return (...
|
|
147
|
-
t !== null && (clearTimeout(t), a && a([])), a =
|
|
156
|
+
return (...s) => new Promise((o) => {
|
|
157
|
+
t !== null && (clearTimeout(t), a && a([])), a = o, t = setTimeout(async () => {
|
|
148
158
|
t = null;
|
|
149
|
-
const d = await e(...
|
|
150
|
-
|
|
151
|
-
},
|
|
159
|
+
const d = await e(...s);
|
|
160
|
+
o(d), a = null;
|
|
161
|
+
}, u);
|
|
152
162
|
});
|
|
153
163
|
}
|
|
154
164
|
function Je(e) {
|
|
155
|
-
const { fields:
|
|
156
|
-
function d(
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
Ye(async (...
|
|
165
|
+
const { fields: u, values: t, settings: a } = e, s = D({}), o = /* @__PURE__ */ new Map();
|
|
166
|
+
function d(g, $) {
|
|
167
|
+
const m = `${g}:${$}`;
|
|
168
|
+
o.has(m) || o.set(
|
|
169
|
+
m,
|
|
170
|
+
Ye(async (...h) => l(h[0], h[1]), $)
|
|
161
171
|
);
|
|
162
|
-
const
|
|
163
|
-
if (!
|
|
164
|
-
return
|
|
172
|
+
const C = o.get(m);
|
|
173
|
+
if (!C) throw new Error(`Debounced validator not found for ${m}`);
|
|
174
|
+
return C;
|
|
165
175
|
}
|
|
166
|
-
async function l(
|
|
167
|
-
var
|
|
168
|
-
const
|
|
169
|
-
if (!
|
|
170
|
-
const
|
|
171
|
-
for (const
|
|
172
|
-
if ((
|
|
173
|
-
const
|
|
174
|
-
if (("field" in
|
|
175
|
-
|
|
176
|
+
async function l(g, $) {
|
|
177
|
+
var A;
|
|
178
|
+
const m = u.value.find((V) => V.name === g);
|
|
179
|
+
if (!m) return [];
|
|
180
|
+
const C = qe(m), h = t.value[g], y = [];
|
|
181
|
+
for (const V of C) {
|
|
182
|
+
if ((A = V.params) != null && A.when) {
|
|
183
|
+
const v = V.params.when;
|
|
184
|
+
if (("field" in v || "and" in v || "or" in v) && !se(
|
|
185
|
+
v,
|
|
176
186
|
t.value
|
|
177
187
|
))
|
|
178
188
|
continue;
|
|
179
189
|
}
|
|
180
|
-
if (
|
|
181
|
-
let
|
|
182
|
-
if (
|
|
183
|
-
|
|
190
|
+
if (V.optional && We(h)) continue;
|
|
191
|
+
let b;
|
|
192
|
+
if (V.validator)
|
|
193
|
+
b = await V.validator(h, V.params ?? {}, $);
|
|
184
194
|
else {
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
187
|
-
|
|
195
|
+
const v = Le(V.name);
|
|
196
|
+
if (!v) continue;
|
|
197
|
+
b = await v(h, V.params ?? {}, $);
|
|
188
198
|
}
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
if (y.push(
|
|
199
|
+
if (b !== !0) {
|
|
200
|
+
const v = V.message ? _e(V.message, V.params ?? {}) : typeof b == "string" ? b : `Validation failed for rule: ${V.name}`;
|
|
201
|
+
if (y.push(v), V.bail) break;
|
|
192
202
|
}
|
|
193
203
|
}
|
|
194
|
-
return
|
|
204
|
+
return s.value[g] = y, y;
|
|
195
205
|
}
|
|
196
|
-
async function n(
|
|
197
|
-
const
|
|
198
|
-
return
|
|
206
|
+
async function n(g, $) {
|
|
207
|
+
const m = a == null ? void 0 : a.debounce;
|
|
208
|
+
return m && m > 0 ? d(g, m)(g, $) : l(g, $);
|
|
199
209
|
}
|
|
200
|
-
async function
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
|
|
210
|
+
async function r(g) {
|
|
211
|
+
const $ = {}, m = u.value.map(async (C) => {
|
|
212
|
+
const h = await l(C.name, g);
|
|
213
|
+
h.length > 0 && ($[C.name] = h);
|
|
204
214
|
});
|
|
205
|
-
return await Promise.all(
|
|
215
|
+
return await Promise.all(m), s.value = { ...$ }, $;
|
|
206
216
|
}
|
|
207
|
-
function
|
|
208
|
-
delete
|
|
217
|
+
function i(g) {
|
|
218
|
+
delete s.value[g];
|
|
209
219
|
}
|
|
210
|
-
function
|
|
211
|
-
|
|
220
|
+
function k() {
|
|
221
|
+
s.value = {};
|
|
212
222
|
}
|
|
213
223
|
return {
|
|
214
|
-
errors:
|
|
224
|
+
errors: s,
|
|
215
225
|
validateField: n,
|
|
216
|
-
validateAll:
|
|
217
|
-
clearFieldErrors:
|
|
218
|
-
clearAllErrors:
|
|
226
|
+
validateAll: r,
|
|
227
|
+
clearFieldErrors: i,
|
|
228
|
+
clearAllErrors: k
|
|
219
229
|
};
|
|
220
230
|
}
|
|
221
231
|
function We(e) {
|
|
222
232
|
return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
223
233
|
}
|
|
224
|
-
function _e(e,
|
|
225
|
-
return e.replace(/\{(\w+)\}/g, (t, a) =>
|
|
234
|
+
function _e(e, u) {
|
|
235
|
+
return e.replace(/\{(\w+)\}/g, (t, a) => u[a] !== void 0 ? String(u[a]) : `{${a}}`);
|
|
226
236
|
}
|
|
227
237
|
const ce = Symbol("FormaticaContext");
|
|
228
238
|
function Qe(e) {
|
|
@@ -245,27 +255,27 @@ function Qe(e) {
|
|
|
245
255
|
}
|
|
246
256
|
}
|
|
247
257
|
function me(e) {
|
|
248
|
-
const
|
|
258
|
+
const u = {};
|
|
249
259
|
for (const t of e)
|
|
250
|
-
|
|
251
|
-
return
|
|
260
|
+
u[t.name] = t.defaultValue ?? Qe(t);
|
|
261
|
+
return u;
|
|
252
262
|
}
|
|
253
263
|
function Xe(e) {
|
|
254
|
-
const
|
|
264
|
+
const u = {};
|
|
255
265
|
for (const t of e)
|
|
256
|
-
t.translations && (
|
|
257
|
-
return
|
|
266
|
+
t.translations && (u[t.name] = t.translations);
|
|
267
|
+
return u;
|
|
258
268
|
}
|
|
259
|
-
function et(e,
|
|
260
|
-
const t = D((
|
|
261
|
-
let
|
|
262
|
-
const
|
|
263
|
-
function
|
|
264
|
-
return { values: { ...d }, getFieldValue: (
|
|
269
|
+
function et(e, u) {
|
|
270
|
+
const t = D((u == null ? void 0 : u.locale) ?? "en"), a = (u == null ? void 0 : u.fallbackLocale) ?? "en";
|
|
271
|
+
let s = e;
|
|
272
|
+
const o = D(P(e.fields)), d = te(me(P(e.fields))), l = te({}), n = te({}), r = te({}), i = D(!1), k = D(0), g = x(() => Object.values(l).every((w) => w.length === 0)), $ = x(() => Object.values(r).some(Boolean)), m = Ue();
|
|
273
|
+
function C() {
|
|
274
|
+
return { values: { ...d }, getFieldValue: (w) => d[w] };
|
|
265
275
|
}
|
|
266
|
-
const
|
|
267
|
-
fields:
|
|
268
|
-
values:
|
|
276
|
+
const h = x(() => ({ ...d })), y = Je({
|
|
277
|
+
fields: o,
|
|
278
|
+
values: h,
|
|
269
279
|
settings: e.settings
|
|
270
280
|
});
|
|
271
281
|
Ge({
|
|
@@ -274,165 +284,165 @@ function et(e, i) {
|
|
|
274
284
|
fieldTranslations: Xe(P(e.fields)),
|
|
275
285
|
formTranslations: e.translations
|
|
276
286
|
});
|
|
277
|
-
let
|
|
278
|
-
|
|
287
|
+
let A = me(P(e.fields));
|
|
288
|
+
J(
|
|
279
289
|
() => ({ ...d }),
|
|
280
|
-
(
|
|
290
|
+
(w, I) => {
|
|
281
291
|
var M;
|
|
282
292
|
if (I) {
|
|
283
|
-
for (const E of Object.keys(
|
|
284
|
-
|
|
293
|
+
for (const E of Object.keys(w))
|
|
294
|
+
w[E] !== I[E] && (r[E] = !0, m.emit("field:change", {
|
|
285
295
|
field: E,
|
|
286
|
-
value:
|
|
296
|
+
value: w[E],
|
|
287
297
|
previousValue: I[E]
|
|
288
|
-
}), (M = e.settings) != null && M.validateOnChange &&
|
|
289
|
-
|
|
298
|
+
}), (M = e.settings) != null && M.validateOnChange && B(E));
|
|
299
|
+
m.emit("change", { values: w });
|
|
290
300
|
}
|
|
291
301
|
},
|
|
292
302
|
{ deep: !0 }
|
|
293
303
|
);
|
|
294
|
-
const
|
|
295
|
-
function
|
|
296
|
-
const I =
|
|
304
|
+
const V = /* @__PURE__ */ new Map();
|
|
305
|
+
function b(w) {
|
|
306
|
+
const I = w.name;
|
|
297
307
|
return {
|
|
298
308
|
name: I,
|
|
299
|
-
value:
|
|
309
|
+
value: x({
|
|
300
310
|
get: () => d[I],
|
|
301
311
|
set: (M) => {
|
|
302
312
|
d[I] = M;
|
|
303
313
|
}
|
|
304
314
|
}),
|
|
305
|
-
errors:
|
|
306
|
-
touched:
|
|
315
|
+
errors: x(() => l[I] ?? []),
|
|
316
|
+
touched: x({
|
|
307
317
|
get: () => n[I] ?? !1,
|
|
308
318
|
set: (M) => {
|
|
309
319
|
n[I] = M;
|
|
310
320
|
}
|
|
311
321
|
}),
|
|
312
|
-
dirty:
|
|
313
|
-
get: () =>
|
|
322
|
+
dirty: x({
|
|
323
|
+
get: () => r[I] ?? !1,
|
|
314
324
|
set: (M) => {
|
|
315
|
-
|
|
325
|
+
r[I] = M;
|
|
316
326
|
}
|
|
317
327
|
}),
|
|
318
|
-
disabled:
|
|
319
|
-
() => typeof
|
|
328
|
+
disabled: x(
|
|
329
|
+
() => typeof w.disabled == "function" ? w.disabled(C()) : w.disabled ?? !1
|
|
320
330
|
),
|
|
321
|
-
visible:
|
|
322
|
-
schema:
|
|
323
|
-
validate: () =>
|
|
331
|
+
visible: x(() => w.condition ? se(w.condition, d) : typeof w.visible == "function" ? w.visible(C()) : w.visible ?? !0),
|
|
332
|
+
schema: w,
|
|
333
|
+
validate: () => B(I),
|
|
324
334
|
reset: () => {
|
|
325
|
-
d[I] =
|
|
335
|
+
d[I] = A[I] ?? null, delete l[I], n[I] = !1, r[I] = !1;
|
|
326
336
|
},
|
|
327
337
|
clear: () => {
|
|
328
338
|
d[I] = null, delete l[I];
|
|
329
339
|
}
|
|
330
340
|
};
|
|
331
341
|
}
|
|
332
|
-
function
|
|
333
|
-
|
|
334
|
-
for (const
|
|
335
|
-
|
|
342
|
+
function v() {
|
|
343
|
+
V.clear();
|
|
344
|
+
for (const w of P(s.fields))
|
|
345
|
+
V.set(w.name, b(w));
|
|
336
346
|
}
|
|
337
|
-
|
|
338
|
-
async function
|
|
339
|
-
const I = await y.validateField(
|
|
340
|
-
return l[
|
|
341
|
-
field:
|
|
347
|
+
v();
|
|
348
|
+
async function B(w) {
|
|
349
|
+
const I = await y.validateField(w, C());
|
|
350
|
+
return l[w] = I, m.emit("validate:field", {
|
|
351
|
+
field: w,
|
|
342
352
|
valid: I.length === 0,
|
|
343
353
|
errors: I
|
|
344
354
|
}), I;
|
|
345
355
|
}
|
|
346
|
-
async function
|
|
347
|
-
const
|
|
356
|
+
async function S() {
|
|
357
|
+
const w = await y.validateAll(C());
|
|
348
358
|
for (const M of Object.keys(l))
|
|
349
|
-
M in
|
|
350
|
-
for (const [M, E] of Object.entries(
|
|
359
|
+
M in w || delete l[M];
|
|
360
|
+
for (const [M, E] of Object.entries(w))
|
|
351
361
|
l[M] = E;
|
|
352
|
-
const I = Object.values(
|
|
353
|
-
return
|
|
362
|
+
const I = Object.values(w).every((M) => M.length === 0);
|
|
363
|
+
return m.emit("validate", { valid: I, errors: { ...w } }), I;
|
|
354
364
|
}
|
|
355
|
-
async function
|
|
356
|
-
|
|
365
|
+
async function N(w) {
|
|
366
|
+
i.value = !0, k.value += 1;
|
|
357
367
|
try {
|
|
358
|
-
for (const M of P(
|
|
359
|
-
if (!await
|
|
360
|
-
|
|
368
|
+
for (const M of P(s.fields)) n[M.name] = !0;
|
|
369
|
+
if (!await S()) {
|
|
370
|
+
m.emit("submit:error", {
|
|
361
371
|
values: { ...d },
|
|
362
372
|
error: new Error("Validation failed")
|
|
363
373
|
});
|
|
364
374
|
return;
|
|
365
375
|
}
|
|
366
|
-
|
|
376
|
+
m.emit("submit", { values: { ...d } }), w && await w({ ...d }, C()), m.emit("submit:success", { values: { ...d }, result: void 0 });
|
|
367
377
|
} catch (I) {
|
|
368
|
-
throw
|
|
378
|
+
throw m.emit("submit:error", { values: { ...d }, error: I }), I;
|
|
369
379
|
} finally {
|
|
370
|
-
|
|
380
|
+
i.value = !1;
|
|
371
381
|
}
|
|
372
382
|
}
|
|
373
383
|
function R() {
|
|
374
|
-
for (const
|
|
375
|
-
d[
|
|
376
|
-
y.clearAllErrors(),
|
|
384
|
+
for (const w of P(s.fields))
|
|
385
|
+
d[w.name] = A[w.name] ?? null, delete l[w.name], n[w.name] = !1, r[w.name] = !1;
|
|
386
|
+
y.clearAllErrors(), m.emit("reset", void 0);
|
|
377
387
|
}
|
|
378
388
|
function Q() {
|
|
379
|
-
for (const
|
|
380
|
-
d[
|
|
389
|
+
for (const w of P(s.fields))
|
|
390
|
+
d[w.name] = null, delete l[w.name];
|
|
381
391
|
y.clearAllErrors();
|
|
382
392
|
}
|
|
383
|
-
function ee(
|
|
384
|
-
|
|
385
|
-
const I = P(
|
|
386
|
-
|
|
393
|
+
function ee(w) {
|
|
394
|
+
s = w;
|
|
395
|
+
const I = P(w.fields);
|
|
396
|
+
o.value = I, A = me(I);
|
|
387
397
|
for (const E of I)
|
|
388
398
|
E.name in d || (d[E.name] = E.defaultValue ?? null);
|
|
389
399
|
const M = new Set(I.map((E) => E.name));
|
|
390
400
|
for (const E of Object.keys(d))
|
|
391
|
-
M.has(E) || (delete d[E], delete l[E], delete n[E], delete
|
|
392
|
-
|
|
401
|
+
M.has(E) || (delete d[E], delete l[E], delete n[E], delete r[E]);
|
|
402
|
+
v();
|
|
393
403
|
}
|
|
394
404
|
const ge = {
|
|
395
405
|
values: d,
|
|
396
406
|
errors: l,
|
|
397
407
|
touched: n,
|
|
398
|
-
dirty:
|
|
399
|
-
isValid:
|
|
400
|
-
isDirty:
|
|
401
|
-
isSubmitting:
|
|
402
|
-
submitCount:
|
|
403
|
-
validate:
|
|
404
|
-
validateField:
|
|
405
|
-
submit:
|
|
408
|
+
dirty: r,
|
|
409
|
+
isValid: g,
|
|
410
|
+
isDirty: $,
|
|
411
|
+
isSubmitting: i,
|
|
412
|
+
submitCount: k,
|
|
413
|
+
validate: S,
|
|
414
|
+
validateField: B,
|
|
415
|
+
submit: N,
|
|
406
416
|
reset: R,
|
|
407
417
|
clear: Q,
|
|
408
|
-
setError: (
|
|
409
|
-
l[
|
|
418
|
+
setError: (w, I) => {
|
|
419
|
+
l[w] = I;
|
|
410
420
|
},
|
|
411
|
-
clearError: (
|
|
412
|
-
delete l[
|
|
421
|
+
clearError: (w) => {
|
|
422
|
+
delete l[w], y.clearFieldErrors(w);
|
|
413
423
|
},
|
|
414
424
|
clearErrors: () => {
|
|
415
|
-
for (const
|
|
425
|
+
for (const w of Object.keys(l)) delete l[w];
|
|
416
426
|
y.clearAllErrors();
|
|
417
427
|
},
|
|
418
|
-
getField: (
|
|
419
|
-
setFieldValue: (
|
|
420
|
-
d[
|
|
428
|
+
getField: (w) => V.get(w),
|
|
429
|
+
setFieldValue: (w, I) => {
|
|
430
|
+
d[w] = I;
|
|
421
431
|
},
|
|
422
|
-
setFieldDisabled: (
|
|
423
|
-
const M = P(
|
|
432
|
+
setFieldDisabled: (w, I) => {
|
|
433
|
+
const M = P(s.fields).find((E) => E.name === w);
|
|
424
434
|
M && (M.disabled = I);
|
|
425
435
|
},
|
|
426
|
-
setFieldVisible: (
|
|
427
|
-
const M = P(
|
|
436
|
+
setFieldVisible: (w, I) => {
|
|
437
|
+
const M = P(s.fields).find((E) => E.name === w);
|
|
428
438
|
M && (M.visible = I);
|
|
429
439
|
},
|
|
430
|
-
on:
|
|
440
|
+
on: m.on,
|
|
431
441
|
locale: t,
|
|
432
|
-
setLocale: (
|
|
433
|
-
t.value =
|
|
442
|
+
setLocale: (w) => {
|
|
443
|
+
t.value = w;
|
|
434
444
|
},
|
|
435
|
-
schema:
|
|
445
|
+
schema: s,
|
|
436
446
|
updateSchema: ee
|
|
437
447
|
};
|
|
438
448
|
return ie(ce, ge), ge;
|
|
@@ -490,55 +500,55 @@ const pe = Symbol("FormaticaTheme"), be = {
|
|
|
490
500
|
}
|
|
491
501
|
};
|
|
492
502
|
function tt(e) {
|
|
493
|
-
const
|
|
494
|
-
const
|
|
503
|
+
const u = Ne(e) ? x(() => e.value ?? be) : D(e ?? be), t = x(() => {
|
|
504
|
+
const o = u.value.components ?? {};
|
|
495
505
|
return {
|
|
496
|
-
form:
|
|
497
|
-
field:
|
|
498
|
-
label:
|
|
499
|
-
input:
|
|
500
|
-
error:
|
|
501
|
-
helpText:
|
|
502
|
-
group:
|
|
503
|
-
row:
|
|
504
|
-
steps:
|
|
505
|
-
tabs:
|
|
506
|
-
button:
|
|
506
|
+
form: o.form ?? "fc-form",
|
|
507
|
+
field: o.field ?? "fc-field",
|
|
508
|
+
label: o.label ?? "fc-label",
|
|
509
|
+
input: o.input ?? "fc-input",
|
|
510
|
+
error: o.error ?? "fc-error",
|
|
511
|
+
helpText: o.helpText ?? "fc-help-text",
|
|
512
|
+
group: o.group ?? "fc-group",
|
|
513
|
+
row: o.row ?? "fc-row",
|
|
514
|
+
steps: o.steps ?? "fc-steps",
|
|
515
|
+
tabs: o.tabs ?? "fc-tabs",
|
|
516
|
+
button: o.button ?? "fc-button"
|
|
507
517
|
};
|
|
508
|
-
}), a =
|
|
509
|
-
const
|
|
510
|
-
if (
|
|
511
|
-
for (const [l, n] of Object.entries(
|
|
518
|
+
}), a = x(() => {
|
|
519
|
+
const o = u.value, d = {};
|
|
520
|
+
if (o.colors)
|
|
521
|
+
for (const [l, n] of Object.entries(o.colors))
|
|
512
522
|
n && (d[`--fc-color-${X(l)}`] = n);
|
|
513
|
-
if (
|
|
514
|
-
for (const [l, n] of Object.entries(
|
|
523
|
+
if (o.typography)
|
|
524
|
+
for (const [l, n] of Object.entries(o.typography))
|
|
515
525
|
n && (d[`--fc-${X(l)}`] = n);
|
|
516
|
-
if (
|
|
517
|
-
for (const [l, n] of Object.entries(
|
|
526
|
+
if (o.spacing)
|
|
527
|
+
for (const [l, n] of Object.entries(o.spacing))
|
|
518
528
|
n && (d[`--fc-${X(l)}`] = n);
|
|
519
|
-
if (
|
|
520
|
-
for (const [l, n] of Object.entries(
|
|
529
|
+
if (o.borders)
|
|
530
|
+
for (const [l, n] of Object.entries(o.borders))
|
|
521
531
|
n && (d[`--fc-border-${X(l)}`] = n);
|
|
522
|
-
if (
|
|
523
|
-
for (const [l, n] of Object.entries(
|
|
532
|
+
if (o.shadows)
|
|
533
|
+
for (const [l, n] of Object.entries(o.shadows))
|
|
524
534
|
n && (d[`--fc-shadow-${X(l)}`] = n);
|
|
525
|
-
if (
|
|
526
|
-
for (const [l, n] of Object.entries(
|
|
535
|
+
if (o.transitions)
|
|
536
|
+
for (const [l, n] of Object.entries(o.transitions))
|
|
527
537
|
n && (d[`--fc-transition-${X(l)}`] = n);
|
|
528
|
-
return
|
|
529
|
-
}),
|
|
530
|
-
config:
|
|
538
|
+
return o.cssVars && Object.assign(d, o.cssVars), d;
|
|
539
|
+
}), s = {
|
|
540
|
+
config: u.value,
|
|
531
541
|
classes: t,
|
|
532
542
|
cssVars: a
|
|
533
543
|
};
|
|
534
|
-
return ie(pe,
|
|
544
|
+
return ie(pe, s), s;
|
|
535
545
|
}
|
|
536
546
|
function K() {
|
|
537
|
-
const e =
|
|
547
|
+
const e = q(pe);
|
|
538
548
|
return e || at();
|
|
539
549
|
}
|
|
540
550
|
function at() {
|
|
541
|
-
const e =
|
|
551
|
+
const e = x(() => ({
|
|
542
552
|
form: "fc-form",
|
|
543
553
|
field: "fc-field",
|
|
544
554
|
label: "fc-label",
|
|
@@ -550,8 +560,8 @@ function at() {
|
|
|
550
560
|
steps: "fc-steps",
|
|
551
561
|
tabs: "fc-tabs",
|
|
552
562
|
button: "fc-button"
|
|
553
|
-
})),
|
|
554
|
-
return { config: be, classes: e, cssVars:
|
|
563
|
+
})), u = x(() => ({}));
|
|
564
|
+
return { config: be, classes: e, cssVars: u };
|
|
555
565
|
}
|
|
556
566
|
function X(e) {
|
|
557
567
|
return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
@@ -575,61 +585,61 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
575
585
|
maxSelect: {}
|
|
576
586
|
},
|
|
577
587
|
emits: ["update:modelValue", "blur"],
|
|
578
|
-
setup(e, { emit:
|
|
579
|
-
const t = e, a =
|
|
588
|
+
setup(e, { emit: u }) {
|
|
589
|
+
const t = e, a = u;
|
|
580
590
|
K();
|
|
581
|
-
function
|
|
591
|
+
function s(n) {
|
|
582
592
|
return t.modelValue.includes(n);
|
|
583
593
|
}
|
|
584
|
-
function
|
|
585
|
-
return !!(t.disabled || n.disabled || t.maxSelect && !
|
|
594
|
+
function o(n) {
|
|
595
|
+
return !!(t.disabled || n.disabled || t.maxSelect && !s(n.value) && t.modelValue.length >= t.maxSelect);
|
|
586
596
|
}
|
|
587
597
|
function d(n) {
|
|
588
|
-
if (
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
if (t.minSelect &&
|
|
592
|
-
|
|
598
|
+
if (o(n)) return;
|
|
599
|
+
const r = [...t.modelValue], i = r.indexOf(n.value);
|
|
600
|
+
if (i >= 0) {
|
|
601
|
+
if (t.minSelect && r.length <= t.minSelect) return;
|
|
602
|
+
r.splice(i, 1);
|
|
593
603
|
} else
|
|
594
|
-
|
|
595
|
-
a("update:modelValue",
|
|
604
|
+
r.push(n.value);
|
|
605
|
+
a("update:modelValue", r);
|
|
596
606
|
}
|
|
597
|
-
function l(n,
|
|
598
|
-
(n.key === " " || n.key === "Enter") && (n.preventDefault(), d(
|
|
607
|
+
function l(n, r) {
|
|
608
|
+
(n.key === " " || n.key === "Enter") && (n.preventDefault(), d(r));
|
|
599
609
|
}
|
|
600
|
-
return (n,
|
|
610
|
+
return (n, r) => (c(), f("div", {
|
|
601
611
|
role: "group",
|
|
602
|
-
class:
|
|
612
|
+
class: F(e.inline ? "flex flex-wrap gap-4" : "flex flex-col gap-2")
|
|
603
613
|
}, [
|
|
604
|
-
(c(!0), f(
|
|
605
|
-
key: String(
|
|
606
|
-
class:
|
|
614
|
+
(c(!0), f(O, null, G(e.options, (i) => (c(), f("label", {
|
|
615
|
+
key: String(i.value),
|
|
616
|
+
class: F([
|
|
607
617
|
"inline-flex items-center gap-2 select-none",
|
|
608
|
-
|
|
618
|
+
o(i) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
609
619
|
])
|
|
610
620
|
}, [
|
|
611
621
|
p("input", {
|
|
612
622
|
type: "checkbox",
|
|
613
|
-
checked:
|
|
614
|
-
disabled:
|
|
623
|
+
checked: s(i.value),
|
|
624
|
+
disabled: o(i),
|
|
615
625
|
class: "sr-only",
|
|
616
|
-
onChange: (
|
|
617
|
-
onBlur:
|
|
626
|
+
onChange: (k) => d(i),
|
|
627
|
+
onBlur: r[0] || (r[0] = (k) => a("blur", k))
|
|
618
628
|
}, null, 40, lt),
|
|
619
629
|
p("div", {
|
|
620
630
|
role: "checkbox",
|
|
621
|
-
"aria-checked":
|
|
622
|
-
"aria-disabled":
|
|
631
|
+
"aria-checked": s(i.value),
|
|
632
|
+
"aria-disabled": o(i) || void 0,
|
|
623
633
|
tabindex: "0",
|
|
624
|
-
class:
|
|
634
|
+
class: F([
|
|
625
635
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded border-2 transition-colors duration-200",
|
|
626
|
-
|
|
636
|
+
s(i.value) ? "text-white" : "border-gray-300 bg-white"
|
|
627
637
|
]),
|
|
628
|
-
style:
|
|
629
|
-
onClick: (
|
|
630
|
-
onKeydown: (
|
|
638
|
+
style: z(s(i.value) ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
639
|
+
onClick: (k) => d(i),
|
|
640
|
+
onKeydown: (k) => l(k, i)
|
|
631
641
|
}, [
|
|
632
|
-
|
|
642
|
+
s(i.value) ? (c(), f("svg", ot, [...r[1] || (r[1] = [
|
|
633
643
|
p("path", {
|
|
634
644
|
d: "M2 6l3 3 5-5",
|
|
635
645
|
"stroke-linecap": "round",
|
|
@@ -637,7 +647,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
637
647
|
}, null, -1)
|
|
638
648
|
])])) : T("", !0)
|
|
639
649
|
], 46, nt),
|
|
640
|
-
p("span", rt, L(
|
|
650
|
+
p("span", rt, L(i.label), 1)
|
|
641
651
|
], 2))), 128))
|
|
642
652
|
], 2));
|
|
643
653
|
}
|
|
@@ -660,41 +670,41 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
660
670
|
disabled: { type: Boolean, default: !1 }
|
|
661
671
|
},
|
|
662
672
|
emits: ["update:modelValue", "blur"],
|
|
663
|
-
setup(e, { emit:
|
|
664
|
-
const t = e, a =
|
|
673
|
+
setup(e, { emit: u }) {
|
|
674
|
+
const t = e, a = u;
|
|
665
675
|
K();
|
|
666
|
-
const
|
|
676
|
+
const s = x(() => [
|
|
667
677
|
"inline-flex items-center gap-2 select-none",
|
|
668
678
|
t.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
669
679
|
]);
|
|
670
|
-
function
|
|
680
|
+
function o() {
|
|
671
681
|
t.disabled || a("update:modelValue", !t.modelValue);
|
|
672
682
|
}
|
|
673
683
|
function d(l) {
|
|
674
|
-
(l.key === " " || l.key === "Enter") && (l.preventDefault(),
|
|
684
|
+
(l.key === " " || l.key === "Enter") && (l.preventDefault(), o());
|
|
675
685
|
}
|
|
676
686
|
return (l, n) => (c(), f("label", {
|
|
677
|
-
class:
|
|
687
|
+
class: F(s.value)
|
|
678
688
|
}, [
|
|
679
689
|
p("input", {
|
|
680
690
|
type: "checkbox",
|
|
681
691
|
checked: e.modelValue,
|
|
682
692
|
disabled: e.disabled,
|
|
683
693
|
class: "sr-only",
|
|
684
|
-
onChange:
|
|
685
|
-
onBlur: n[0] || (n[0] = (
|
|
694
|
+
onChange: o,
|
|
695
|
+
onBlur: n[0] || (n[0] = (r) => a("blur", r))
|
|
686
696
|
}, null, 40, it),
|
|
687
697
|
p("div", {
|
|
688
698
|
role: "checkbox",
|
|
689
699
|
"aria-checked": e.modelValue,
|
|
690
700
|
"aria-disabled": e.disabled || void 0,
|
|
691
701
|
tabindex: "0",
|
|
692
|
-
class:
|
|
702
|
+
class: F([
|
|
693
703
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded border-2 transition-colors duration-200",
|
|
694
704
|
e.modelValue ? "text-white" : "border-gray-300 bg-white"
|
|
695
705
|
]),
|
|
696
|
-
style:
|
|
697
|
-
onClick:
|
|
706
|
+
style: z(e.modelValue ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
707
|
+
onClick: o,
|
|
698
708
|
onKeydown: d
|
|
699
709
|
}, [
|
|
700
710
|
e.modelValue ? (c(), f("svg", dt, [...n[1] || (n[1] = [
|
|
@@ -719,14 +729,14 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
719
729
|
disabled: { type: Boolean, default: !1 }
|
|
720
730
|
},
|
|
721
731
|
emits: ["update:modelValue", "blur", "focus"],
|
|
722
|
-
setup(e, { emit:
|
|
723
|
-
const t = e, a =
|
|
732
|
+
setup(e, { emit: u }) {
|
|
733
|
+
const t = e, a = u, s = K(), o = x(
|
|
724
734
|
() => [
|
|
725
735
|
"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
|
|
726
736
|
"focus:outline-none focus:ring-2 focus:ring-blue-500/20 fc-date-input",
|
|
727
737
|
"transition-colors duration-200",
|
|
728
738
|
t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
|
|
729
|
-
|
|
739
|
+
s.classes.value.input
|
|
730
740
|
].filter(Boolean).join(" ")
|
|
731
741
|
);
|
|
732
742
|
function d(l) {
|
|
@@ -740,19 +750,19 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
740
750
|
max: e.maxDate,
|
|
741
751
|
placeholder: e.placeholder,
|
|
742
752
|
disabled: e.disabled,
|
|
743
|
-
class:
|
|
753
|
+
class: F(o.value),
|
|
744
754
|
"aria-disabled": e.disabled || void 0,
|
|
745
755
|
onInput: d,
|
|
746
|
-
onBlur: n[0] || (n[0] = (
|
|
747
|
-
onFocus: n[1] || (n[1] = (
|
|
756
|
+
onBlur: n[0] || (n[0] = (r) => a("blur", r)),
|
|
757
|
+
onFocus: n[1] || (n[1] = (r) => a("focus", r))
|
|
748
758
|
}, null, 42, mt));
|
|
749
759
|
}
|
|
750
|
-
}),
|
|
760
|
+
}), oe = (e, u) => {
|
|
751
761
|
const t = e.__vccOpts || e;
|
|
752
|
-
for (const [a,
|
|
753
|
-
t[a] =
|
|
762
|
+
for (const [a, s] of u)
|
|
763
|
+
t[a] = s;
|
|
754
764
|
return t;
|
|
755
|
-
}, vt = /* @__PURE__ */
|
|
765
|
+
}, vt = /* @__PURE__ */ oe(bt, [["__scopeId", "data-v-7d4bc9b7"]]), yt = ["aria-disabled", "onKeydown"], pt = {
|
|
756
766
|
key: 0,
|
|
757
767
|
class: "mt-1 text-xs text-gray-400"
|
|
758
768
|
}, gt = ["accept", "multiple"], ht = {
|
|
@@ -769,74 +779,74 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
769
779
|
disabled: { type: Boolean, default: !1 }
|
|
770
780
|
},
|
|
771
781
|
emits: ["update:modelValue", "blur"],
|
|
772
|
-
setup(e, { emit:
|
|
773
|
-
const t = e, a =
|
|
782
|
+
setup(e, { emit: u }) {
|
|
783
|
+
const t = e, a = u;
|
|
774
784
|
K();
|
|
775
|
-
const
|
|
776
|
-
function l(
|
|
777
|
-
return
|
|
785
|
+
const s = D(null), o = D(!1), d = x(() => t.modelValue ? Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue] : []);
|
|
786
|
+
function l(h) {
|
|
787
|
+
return h < 1024 ? `${h} B` : h < 1024 * 1024 ? `${(h / 1024).toFixed(1)} KB` : `${(h / (1024 * 1024)).toFixed(1)} MB`;
|
|
778
788
|
}
|
|
779
|
-
function n(
|
|
780
|
-
let y =
|
|
789
|
+
function n(h) {
|
|
790
|
+
let y = h;
|
|
781
791
|
if (t.maxSize) {
|
|
782
|
-
const
|
|
783
|
-
y = y.filter((
|
|
792
|
+
const A = t.maxSize;
|
|
793
|
+
y = y.filter((V) => V.size <= A);
|
|
784
794
|
}
|
|
785
795
|
if (t.multiple && t.maxFiles) {
|
|
786
|
-
const
|
|
787
|
-
y = y.slice(0, Math.max(0,
|
|
796
|
+
const A = t.maxFiles - d.value.length;
|
|
797
|
+
y = y.slice(0, Math.max(0, A));
|
|
788
798
|
}
|
|
789
799
|
return y;
|
|
790
800
|
}
|
|
791
|
-
function
|
|
792
|
-
const y = n(
|
|
801
|
+
function r(h) {
|
|
802
|
+
const y = n(h);
|
|
793
803
|
y.length !== 0 && (t.multiple ? a("update:modelValue", [...d.value, ...y]) : a("update:modelValue", y[0]));
|
|
794
804
|
}
|
|
795
|
-
function
|
|
796
|
-
const y =
|
|
797
|
-
y.files && (
|
|
805
|
+
function i(h) {
|
|
806
|
+
const y = h.target;
|
|
807
|
+
y.files && (r(Array.from(y.files)), y.value = "");
|
|
798
808
|
}
|
|
799
|
-
function
|
|
809
|
+
function k(h) {
|
|
800
810
|
if (t.disabled) return;
|
|
801
|
-
const y = d.value.filter((
|
|
811
|
+
const y = d.value.filter((A, V) => V !== h);
|
|
802
812
|
t.multiple ? a("update:modelValue", y.length ? y : []) : a("update:modelValue", null);
|
|
803
813
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
814
|
+
function g(h) {
|
|
815
|
+
h.preventDefault(), t.disabled || (o.value = !0);
|
|
806
816
|
}
|
|
807
|
-
function
|
|
808
|
-
|
|
817
|
+
function $() {
|
|
818
|
+
o.value = !1;
|
|
809
819
|
}
|
|
810
|
-
function
|
|
820
|
+
function m(h) {
|
|
811
821
|
var y;
|
|
812
|
-
|
|
822
|
+
h.preventDefault(), o.value = !1, !(t.disabled || !((y = h.dataTransfer) != null && y.files)) && r(Array.from(h.dataTransfer.files));
|
|
813
823
|
}
|
|
814
|
-
function
|
|
815
|
-
var
|
|
816
|
-
t.disabled || (
|
|
824
|
+
function C() {
|
|
825
|
+
var h;
|
|
826
|
+
t.disabled || (h = s.value) == null || h.click();
|
|
817
827
|
}
|
|
818
|
-
return (
|
|
819
|
-
class:
|
|
828
|
+
return (h, y) => (c(), f("div", {
|
|
829
|
+
class: F(e.disabled ? "opacity-50 cursor-not-allowed" : "")
|
|
820
830
|
}, [
|
|
821
831
|
p("div", {
|
|
822
832
|
role: "button",
|
|
823
833
|
tabindex: "0",
|
|
824
834
|
"aria-disabled": e.disabled || void 0,
|
|
825
|
-
class:
|
|
835
|
+
class: F([
|
|
826
836
|
"flex flex-col items-center justify-center rounded-lg border-2 border-dashed p-6 text-center transition-colors duration-200",
|
|
827
|
-
|
|
837
|
+
o.value ? "" : "border-gray-300 bg-gray-50",
|
|
828
838
|
e.disabled ? "pointer-events-none" : "cursor-pointer hover:border-gray-400"
|
|
829
839
|
]),
|
|
830
|
-
style:
|
|
831
|
-
onClick:
|
|
840
|
+
style: z(o.value ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)" } : {}),
|
|
841
|
+
onClick: C,
|
|
832
842
|
onKeydown: [
|
|
833
|
-
he(
|
|
834
|
-
he(
|
|
843
|
+
he(C, ["enter"]),
|
|
844
|
+
he(Y(C, ["prevent"]), ["space"])
|
|
835
845
|
],
|
|
836
|
-
onDragover:
|
|
837
|
-
onDragleave:
|
|
838
|
-
onDrop:
|
|
839
|
-
onBlur: y[0] || (y[0] = (
|
|
846
|
+
onDragover: g,
|
|
847
|
+
onDragleave: $,
|
|
848
|
+
onDrop: m,
|
|
849
|
+
onBlur: y[0] || (y[0] = (A) => a("blur", A))
|
|
840
850
|
}, [
|
|
841
851
|
y[1] || (y[1] = p("svg", {
|
|
842
852
|
class: "mb-2 h-8 w-8 text-gray-400",
|
|
@@ -863,16 +873,16 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
863
873
|
], 46, yt),
|
|
864
874
|
p("input", {
|
|
865
875
|
ref_key: "fileInputRef",
|
|
866
|
-
ref:
|
|
876
|
+
ref: s,
|
|
867
877
|
type: "file",
|
|
868
878
|
accept: e.accept,
|
|
869
879
|
multiple: e.multiple,
|
|
870
880
|
class: "hidden",
|
|
871
|
-
onChange:
|
|
881
|
+
onChange: i
|
|
872
882
|
}, null, 40, gt),
|
|
873
883
|
d.value.length > 0 ? (c(), f("ul", ht, [
|
|
874
|
-
(c(!0), f(
|
|
875
|
-
key: `${
|
|
884
|
+
(c(!0), f(O, null, G(d.value, (A, V) => (c(), f("li", {
|
|
885
|
+
key: `${A.name}-${V}`,
|
|
876
886
|
class: "flex items-center justify-between rounded-md border border-gray-200 bg-white px-3 py-2 text-sm"
|
|
877
887
|
}, [
|
|
878
888
|
p("div", xt, [
|
|
@@ -890,15 +900,15 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
890
900
|
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
891
901
|
})
|
|
892
902
|
], -1)),
|
|
893
|
-
p("span", kt, L(
|
|
894
|
-
p("span", wt, "(" + L(l(
|
|
903
|
+
p("span", kt, L(A.name), 1),
|
|
904
|
+
p("span", wt, "(" + L(l(A.size)) + ")", 1)
|
|
895
905
|
]),
|
|
896
906
|
e.disabled ? T("", !0) : (c(), f("button", {
|
|
897
907
|
key: 0,
|
|
898
908
|
type: "button",
|
|
899
909
|
class: "ml-2 shrink-0 text-gray-400 hover:text-red-500 transition-colors duration-200",
|
|
900
910
|
"aria-label": "Remove file",
|
|
901
|
-
onClick:
|
|
911
|
+
onClick: Y((b) => k(V), ["stop"])
|
|
902
912
|
}, " × ", 8, $t))
|
|
903
913
|
]))), 128))
|
|
904
914
|
])) : T("", !0)
|
|
@@ -927,8 +937,8 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
927
937
|
readonly: { type: Boolean, default: !1 }
|
|
928
938
|
},
|
|
929
939
|
emits: ["update:modelValue", "blur", "focus"],
|
|
930
|
-
setup(e, { emit:
|
|
931
|
-
const t = e, a =
|
|
940
|
+
setup(e, { emit: u }) {
|
|
941
|
+
const t = e, a = u, s = K(), o = x(() => !!t.prefix || !!t.suffix), d = x(
|
|
932
942
|
() => [
|
|
933
943
|
"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
|
|
934
944
|
"placeholder:text-gray-400",
|
|
@@ -937,19 +947,19 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
937
947
|
t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
|
|
938
948
|
t.prefix ? "rounded-l-none" : "",
|
|
939
949
|
t.suffix ? "rounded-r-none" : "",
|
|
940
|
-
|
|
950
|
+
s.classes.value.input
|
|
941
951
|
].filter(Boolean).join(" ")
|
|
942
952
|
);
|
|
943
953
|
function l(n) {
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
954
|
+
const i = n.target.value;
|
|
955
|
+
if (i === "") {
|
|
946
956
|
a("update:modelValue", null);
|
|
947
957
|
return;
|
|
948
958
|
}
|
|
949
|
-
let
|
|
950
|
-
Number.isNaN(
|
|
959
|
+
let k = parseFloat(i);
|
|
960
|
+
Number.isNaN(k) || (t.precision !== void 0 && (k = parseFloat(k.toFixed(t.precision))), a("update:modelValue", k));
|
|
951
961
|
}
|
|
952
|
-
return (n,
|
|
962
|
+
return (n, r) => o.value ? (c(), f("div", Vt, [
|
|
953
963
|
e.prefix ? (c(), f("span", St, L(e.prefix), 1)) : T("", !0),
|
|
954
964
|
p("input", {
|
|
955
965
|
type: "number",
|
|
@@ -959,12 +969,12 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
959
969
|
step: e.step,
|
|
960
970
|
disabled: e.disabled,
|
|
961
971
|
readonly: e.readonly,
|
|
962
|
-
class:
|
|
972
|
+
class: F(d.value),
|
|
963
973
|
"aria-disabled": e.disabled || void 0,
|
|
964
974
|
"aria-readonly": e.readonly || void 0,
|
|
965
975
|
onInput: l,
|
|
966
|
-
onBlur:
|
|
967
|
-
onFocus:
|
|
976
|
+
onBlur: r[0] || (r[0] = (i) => a("blur", i)),
|
|
977
|
+
onFocus: r[1] || (r[1] = (i) => a("focus", i))
|
|
968
978
|
}, null, 42, Bt),
|
|
969
979
|
e.suffix ? (c(), f("span", Ft, L(e.suffix), 1)) : T("", !0)
|
|
970
980
|
])) : (c(), f("input", {
|
|
@@ -976,18 +986,18 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
976
986
|
step: e.step,
|
|
977
987
|
disabled: e.disabled,
|
|
978
988
|
readonly: e.readonly,
|
|
979
|
-
class:
|
|
989
|
+
class: F(d.value),
|
|
980
990
|
"aria-disabled": e.disabled || void 0,
|
|
981
991
|
"aria-readonly": e.readonly || void 0,
|
|
982
992
|
onInput: l,
|
|
983
|
-
onBlur:
|
|
984
|
-
onFocus:
|
|
993
|
+
onBlur: r[2] || (r[2] = (i) => a("blur", i)),
|
|
994
|
+
onFocus: r[3] || (r[3] = (i) => a("focus", i))
|
|
985
995
|
}, null, 42, Tt));
|
|
986
996
|
}
|
|
987
|
-
}), Lt = /* @__PURE__ */
|
|
997
|
+
}), Lt = /* @__PURE__ */ oe(It, [["__scopeId", "data-v-4e51299b"]]), At = { class: "relative" }, Nt = ["disabled"], Dt = { class: "text-lg leading-none" }, Mt = { class: "text-xs text-gray-500 dark:text-gray-400 font-medium" }, Et = ["value", "placeholder", "disabled"], Rt = {
|
|
988
998
|
key: 1,
|
|
989
999
|
class: "absolute left-0 top-full z-50 mt-1 w-72 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-xl overflow-hidden"
|
|
990
|
-
}, jt = { class: "border-b border-gray-200 dark:border-gray-700 p-2" },
|
|
1000
|
+
}, jt = { class: "border-b border-gray-200 dark:border-gray-700 p-2" }, zt = { class: "max-h-48 overflow-y-auto" }, Ot = ["onMousedown"], Kt = { class: "text-lg leading-none" }, Pt = { class: "flex-1 truncate text-xs" }, Ut = { class: "text-[11px] text-gray-400 dark:text-gray-500 font-mono" }, Ht = {
|
|
991
1001
|
key: 0,
|
|
992
1002
|
class: "px-3 py-4 text-center text-xs text-gray-400 dark:text-gray-500"
|
|
993
1003
|
}, Gt = /* @__PURE__ */ j({
|
|
@@ -1001,8 +1011,8 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1001
1011
|
disabled: { type: Boolean, default: !1 }
|
|
1002
1012
|
},
|
|
1003
1013
|
emits: ["update:modelValue", "blur"],
|
|
1004
|
-
setup(e, { emit:
|
|
1005
|
-
const t = e, a =
|
|
1014
|
+
setup(e, { emit: u }) {
|
|
1015
|
+
const t = e, a = u, s = {
|
|
1006
1016
|
AF: "Afghanistan",
|
|
1007
1017
|
AL: "Albania",
|
|
1008
1018
|
DZ: "Algeria",
|
|
@@ -1122,77 +1132,77 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1122
1132
|
VN: "Vietnam",
|
|
1123
1133
|
ZW: "Zimbabwe"
|
|
1124
1134
|
};
|
|
1125
|
-
function
|
|
1126
|
-
return
|
|
1127
|
-
}
|
|
1128
|
-
const d =
|
|
1129
|
-
var
|
|
1130
|
-
return ((
|
|
1131
|
-
(
|
|
1132
|
-
) : xe()).map((
|
|
1133
|
-
code:
|
|
1134
|
-
name:
|
|
1135
|
-
dialCode: `+${ke(
|
|
1136
|
-
flag:
|
|
1137
|
-
})).sort((
|
|
1138
|
-
}), l = D(t.defaultCountry), n = D(""),
|
|
1139
|
-
const
|
|
1140
|
-
return
|
|
1141
|
-
(
|
|
1135
|
+
function o(b) {
|
|
1136
|
+
return b.toUpperCase().split("").map((v) => String.fromCodePoint(127462 + v.charCodeAt(0) - 65)).join("");
|
|
1137
|
+
}
|
|
1138
|
+
const d = x(() => {
|
|
1139
|
+
var v;
|
|
1140
|
+
return ((v = t.countries) != null && v.length ? t.countries.filter(
|
|
1141
|
+
(B) => xe().includes(B)
|
|
1142
|
+
) : xe()).map((B) => ({
|
|
1143
|
+
code: B,
|
|
1144
|
+
name: s[B] ?? B,
|
|
1145
|
+
dialCode: `+${ke(B)}`,
|
|
1146
|
+
flag: o(B)
|
|
1147
|
+
})).sort((B, S) => B.name.localeCompare(S.name));
|
|
1148
|
+
}), l = D(t.defaultCountry), n = D(""), r = D(!1), i = D(""), k = D(null), g = x(() => {
|
|
1149
|
+
const b = i.value.toLowerCase();
|
|
1150
|
+
return b ? d.value.filter(
|
|
1151
|
+
(v) => v.name.toLowerCase().includes(b) || v.code.toLowerCase().includes(b) || v.dialCode.includes(b)
|
|
1142
1152
|
) : d.value;
|
|
1143
|
-
}),
|
|
1144
|
-
() => d.value.find((
|
|
1153
|
+
}), $ = x(
|
|
1154
|
+
() => d.value.find((b) => b.code === l.value) ?? d.value[0]
|
|
1145
1155
|
);
|
|
1146
1156
|
ue(() => {
|
|
1147
|
-
t.modelValue &&
|
|
1148
|
-
}),
|
|
1157
|
+
t.modelValue && m(t.modelValue);
|
|
1158
|
+
}), J(
|
|
1149
1159
|
() => t.modelValue,
|
|
1150
|
-
(
|
|
1151
|
-
|
|
1160
|
+
(b) => {
|
|
1161
|
+
b && m(b);
|
|
1152
1162
|
}
|
|
1153
1163
|
);
|
|
1154
|
-
function b
|
|
1164
|
+
function m(b) {
|
|
1155
1165
|
try {
|
|
1156
|
-
const
|
|
1157
|
-
if (
|
|
1158
|
-
l.value =
|
|
1166
|
+
const v = ze(b);
|
|
1167
|
+
if (v != null && v.country) {
|
|
1168
|
+
l.value = v.country, n.value = v.nationalNumber;
|
|
1159
1169
|
return;
|
|
1160
1170
|
}
|
|
1161
1171
|
} catch {
|
|
1162
1172
|
}
|
|
1163
|
-
n.value =
|
|
1173
|
+
n.value = b.replace(/^\+\d+\s*/, "");
|
|
1164
1174
|
}
|
|
1165
|
-
function
|
|
1175
|
+
function C() {
|
|
1166
1176
|
if (!n.value.trim()) {
|
|
1167
1177
|
a("update:modelValue", "");
|
|
1168
1178
|
return;
|
|
1169
1179
|
}
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
a("update:modelValue", (
|
|
1174
|
-
}
|
|
1175
|
-
function
|
|
1176
|
-
const
|
|
1177
|
-
n.value =
|
|
1178
|
-
}
|
|
1179
|
-
function y(
|
|
1180
|
-
l.value =
|
|
1181
|
-
}
|
|
1182
|
-
function
|
|
1183
|
-
t.disabled || (
|
|
1184
|
-
var
|
|
1185
|
-
return (
|
|
1180
|
+
const b = new Oe(l.value);
|
|
1181
|
+
b.input(`+${ke(l.value)}${n.value}`);
|
|
1182
|
+
const v = b.getNumber();
|
|
1183
|
+
a("update:modelValue", (v == null ? void 0 : v.format("E.164")) ?? n.value);
|
|
1184
|
+
}
|
|
1185
|
+
function h(b) {
|
|
1186
|
+
const v = b.target;
|
|
1187
|
+
n.value = v.value, C();
|
|
1188
|
+
}
|
|
1189
|
+
function y(b) {
|
|
1190
|
+
l.value = b, r.value = !1, i.value = "", C();
|
|
1191
|
+
}
|
|
1192
|
+
function A() {
|
|
1193
|
+
t.disabled || (r.value = !0, i.value = "", ae(() => {
|
|
1194
|
+
var b;
|
|
1195
|
+
return (b = k.value) == null ? void 0 : b.focus();
|
|
1186
1196
|
}));
|
|
1187
1197
|
}
|
|
1188
|
-
function
|
|
1189
|
-
|
|
1198
|
+
function V() {
|
|
1199
|
+
r.value = !1, i.value = "";
|
|
1190
1200
|
}
|
|
1191
|
-
return (
|
|
1192
|
-
var
|
|
1201
|
+
return (b, v) => {
|
|
1202
|
+
var B, S;
|
|
1193
1203
|
return c(), f("div", At, [
|
|
1194
1204
|
p("div", {
|
|
1195
|
-
class:
|
|
1205
|
+
class: F([
|
|
1196
1206
|
"flex items-stretch rounded-lg border transition-colors",
|
|
1197
1207
|
e.disabled ? "opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-800 border-gray-200 dark:border-gray-700" : "border-gray-300 dark:border-gray-600 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20"
|
|
1198
1208
|
])
|
|
@@ -1202,19 +1212,19 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1202
1212
|
type: "button",
|
|
1203
1213
|
disabled: e.disabled,
|
|
1204
1214
|
class: "flex items-center gap-1.5 px-3 border-r border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 rounded-l-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shrink-0",
|
|
1205
|
-
onMousedown:
|
|
1215
|
+
onMousedown: v[0] || (v[0] = Y((N) => r.value ? V() : A(), ["prevent"]))
|
|
1206
1216
|
}, [
|
|
1207
|
-
p("span", Dt, L((
|
|
1208
|
-
p("span", Mt, L((
|
|
1217
|
+
p("span", Dt, L((B = $.value) == null ? void 0 : B.flag), 1),
|
|
1218
|
+
p("span", Mt, L((S = $.value) == null ? void 0 : S.dialCode), 1),
|
|
1209
1219
|
(c(), f("svg", {
|
|
1210
|
-
class:
|
|
1220
|
+
class: F(["h-3 w-3 text-gray-400 transition-transform", r.value ? "rotate-180" : ""]),
|
|
1211
1221
|
viewBox: "0 0 24 24",
|
|
1212
1222
|
fill: "none",
|
|
1213
1223
|
stroke: "currentColor",
|
|
1214
1224
|
"stroke-width": "2",
|
|
1215
1225
|
"stroke-linecap": "round",
|
|
1216
1226
|
"stroke-linejoin": "round"
|
|
1217
|
-
}, [...
|
|
1227
|
+
}, [...v[3] || (v[3] = [
|
|
1218
1228
|
p("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
1219
1229
|
])], 2))
|
|
1220
1230
|
], 40, Nt)) : T("", !0),
|
|
@@ -1224,44 +1234,44 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1224
1234
|
placeholder: e.placeholder || "Phone number",
|
|
1225
1235
|
disabled: e.disabled,
|
|
1226
1236
|
autocomplete: "tel-national",
|
|
1227
|
-
class:
|
|
1228
|
-
onInput:
|
|
1229
|
-
onBlur:
|
|
1237
|
+
class: F(["flex-1 bg-transparent px-3 py-2 text-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 outline-none min-w-0", e.showDialCode ? "rounded-r-lg" : "rounded-lg"]),
|
|
1238
|
+
onInput: h,
|
|
1239
|
+
onBlur: v[1] || (v[1] = (N) => a("blur", N))
|
|
1230
1240
|
}, null, 42, Et)
|
|
1231
1241
|
], 2),
|
|
1232
|
-
|
|
1242
|
+
r.value ? (c(), f("div", {
|
|
1233
1243
|
key: 0,
|
|
1234
1244
|
class: "fixed inset-0 z-40",
|
|
1235
|
-
onMousedown:
|
|
1245
|
+
onMousedown: V
|
|
1236
1246
|
}, null, 32)) : T("", !0),
|
|
1237
|
-
|
|
1247
|
+
r.value ? (c(), f("div", Rt, [
|
|
1238
1248
|
p("div", jt, [
|
|
1239
1249
|
de(p("input", {
|
|
1240
1250
|
ref_key: "searchInputRef",
|
|
1241
|
-
ref:
|
|
1242
|
-
"onUpdate:modelValue":
|
|
1251
|
+
ref: k,
|
|
1252
|
+
"onUpdate:modelValue": v[2] || (v[2] = (N) => i.value = N),
|
|
1243
1253
|
type: "text",
|
|
1244
1254
|
placeholder: "Search country...",
|
|
1245
1255
|
class: "w-full rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-3 py-1.5 text-xs text-gray-900 dark:text-white placeholder-gray-400 outline-none focus:border-primary-500"
|
|
1246
1256
|
}, null, 512), [
|
|
1247
|
-
[ve,
|
|
1257
|
+
[ve, i.value]
|
|
1248
1258
|
])
|
|
1249
1259
|
]),
|
|
1250
|
-
p("div",
|
|
1251
|
-
(c(!0), f(
|
|
1252
|
-
key:
|
|
1260
|
+
p("div", zt, [
|
|
1261
|
+
(c(!0), f(O, null, G(g.value, (N) => (c(), f("button", {
|
|
1262
|
+
key: N.code,
|
|
1253
1263
|
type: "button",
|
|
1254
|
-
class:
|
|
1264
|
+
class: F([
|
|
1255
1265
|
"flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors hover:bg-gray-50 dark:hover:bg-gray-800",
|
|
1256
|
-
|
|
1266
|
+
N.code === l.value ? "bg-primary-50 dark:bg-primary-950/30 text-primary-700 dark:text-primary-300" : "text-gray-700 dark:text-gray-300"
|
|
1257
1267
|
]),
|
|
1258
|
-
onMousedown:
|
|
1268
|
+
onMousedown: Y((R) => y(N.code), ["prevent"])
|
|
1259
1269
|
}, [
|
|
1260
|
-
p("span", Kt, L(
|
|
1261
|
-
p("span", Pt, L(
|
|
1262
|
-
p("span", Ut, L(
|
|
1263
|
-
], 42,
|
|
1264
|
-
|
|
1270
|
+
p("span", Kt, L(N.flag), 1),
|
|
1271
|
+
p("span", Pt, L(N.name), 1),
|
|
1272
|
+
p("span", Ut, L(N.dialCode), 1)
|
|
1273
|
+
], 42, Ot))), 128)),
|
|
1274
|
+
g.value.length === 0 ? (c(), f("p", Ht, " No countries found ")) : T("", !0)
|
|
1265
1275
|
])
|
|
1266
1276
|
])) : T("", !0)
|
|
1267
1277
|
]);
|
|
@@ -1280,56 +1290,56 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1280
1290
|
disabled: { type: Boolean, default: !1 }
|
|
1281
1291
|
},
|
|
1282
1292
|
emits: ["update:modelValue", "blur"],
|
|
1283
|
-
setup(e, { emit:
|
|
1284
|
-
const t = e, a =
|
|
1293
|
+
setup(e, { emit: u }) {
|
|
1294
|
+
const t = e, a = u;
|
|
1285
1295
|
K();
|
|
1286
|
-
function
|
|
1296
|
+
function s(n) {
|
|
1287
1297
|
return t.modelValue === n;
|
|
1288
1298
|
}
|
|
1289
|
-
function
|
|
1299
|
+
function o(n) {
|
|
1290
1300
|
return t.disabled || !!n.disabled;
|
|
1291
1301
|
}
|
|
1292
1302
|
function d(n) {
|
|
1293
|
-
|
|
1303
|
+
o(n) || a("update:modelValue", n.value);
|
|
1294
1304
|
}
|
|
1295
|
-
function l(n,
|
|
1296
|
-
(n.key === " " || n.key === "Enter") && (n.preventDefault(), d(
|
|
1305
|
+
function l(n, r) {
|
|
1306
|
+
(n.key === " " || n.key === "Enter") && (n.preventDefault(), d(r));
|
|
1297
1307
|
}
|
|
1298
|
-
return (n,
|
|
1308
|
+
return (n, r) => (c(), f("div", {
|
|
1299
1309
|
role: "radiogroup",
|
|
1300
|
-
class:
|
|
1310
|
+
class: F(e.inline ? "flex flex-wrap gap-4" : "flex flex-col gap-2")
|
|
1301
1311
|
}, [
|
|
1302
|
-
(c(!0), f(
|
|
1303
|
-
key: String(
|
|
1304
|
-
class:
|
|
1312
|
+
(c(!0), f(O, null, G(e.options, (i) => (c(), f("label", {
|
|
1313
|
+
key: String(i.value),
|
|
1314
|
+
class: F([
|
|
1305
1315
|
"inline-flex items-center gap-2 select-none",
|
|
1306
|
-
|
|
1316
|
+
o(i) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
1307
1317
|
])
|
|
1308
1318
|
}, [
|
|
1309
1319
|
p("input", {
|
|
1310
1320
|
type: "radio",
|
|
1311
|
-
checked:
|
|
1312
|
-
disabled:
|
|
1321
|
+
checked: s(i.value),
|
|
1322
|
+
disabled: o(i),
|
|
1313
1323
|
class: "sr-only",
|
|
1314
|
-
onChange: (
|
|
1315
|
-
onBlur:
|
|
1324
|
+
onChange: (k) => d(i),
|
|
1325
|
+
onBlur: r[0] || (r[0] = (k) => a("blur", k))
|
|
1316
1326
|
}, null, 40, Zt),
|
|
1317
1327
|
p("div", {
|
|
1318
1328
|
role: "radio",
|
|
1319
|
-
"aria-checked":
|
|
1320
|
-
"aria-disabled":
|
|
1329
|
+
"aria-checked": s(i.value),
|
|
1330
|
+
"aria-disabled": o(i) || void 0,
|
|
1321
1331
|
tabindex: "0",
|
|
1322
|
-
class:
|
|
1332
|
+
class: F([
|
|
1323
1333
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-200",
|
|
1324
|
-
|
|
1334
|
+
s(i.value) ? "" : "border-gray-300"
|
|
1325
1335
|
]),
|
|
1326
|
-
style:
|
|
1327
|
-
onClick: (
|
|
1328
|
-
onKeydown: (
|
|
1336
|
+
style: z(s(i.value) ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
1337
|
+
onClick: (k) => d(i),
|
|
1338
|
+
onKeydown: (k) => l(k, i)
|
|
1329
1339
|
}, [
|
|
1330
|
-
|
|
1340
|
+
s(i.value) ? (c(), f("div", Yt)) : T("", !0)
|
|
1331
1341
|
], 46, qt),
|
|
1332
|
-
p("span", Jt, L(
|
|
1342
|
+
p("span", Jt, L(i.label), 1)
|
|
1333
1343
|
], 2))), 128))
|
|
1334
1344
|
], 2));
|
|
1335
1345
|
}
|
|
@@ -1363,132 +1373,132 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1363
1373
|
disabled: { type: Boolean, default: !1 }
|
|
1364
1374
|
},
|
|
1365
1375
|
emits: ["update:modelValue", "blur"],
|
|
1366
|
-
setup(e, { emit:
|
|
1367
|
-
const t = e, a =
|
|
1368
|
-
if (
|
|
1369
|
-
const
|
|
1370
|
-
return (
|
|
1371
|
-
}),
|
|
1376
|
+
setup(e, { emit: u }) {
|
|
1377
|
+
const t = e, a = u, s = K(), o = D(!1), d = D(""), l = D(-1), n = D(null), r = D(null), i = x(() => t.modelValue === null || t.modelValue === void 0 ? [] : Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue]), k = x(() => {
|
|
1378
|
+
if (i.value.length === 0 || t.multiple) return "";
|
|
1379
|
+
const S = t.options.find((N) => N.value === i.value[0]);
|
|
1380
|
+
return (S == null ? void 0 : S.label) ?? String(i.value[0]);
|
|
1381
|
+
}), g = x(() => {
|
|
1372
1382
|
if (!d.value) return t.options;
|
|
1373
|
-
const
|
|
1374
|
-
return t.options.filter((
|
|
1383
|
+
const S = d.value.toLowerCase();
|
|
1384
|
+
return t.options.filter((N) => N.label.toLowerCase().includes(S));
|
|
1375
1385
|
});
|
|
1376
|
-
function
|
|
1377
|
-
return
|
|
1386
|
+
function $(S) {
|
|
1387
|
+
return i.value.includes(S);
|
|
1378
1388
|
}
|
|
1379
|
-
function
|
|
1380
|
-
t.disabled || (
|
|
1389
|
+
function m() {
|
|
1390
|
+
t.disabled || (o.value ? h() : C());
|
|
1381
1391
|
}
|
|
1382
|
-
function
|
|
1383
|
-
|
|
1384
|
-
var
|
|
1385
|
-
return (
|
|
1392
|
+
function C() {
|
|
1393
|
+
o.value = !0, l.value = -1, d.value = "", ae(() => {
|
|
1394
|
+
var S;
|
|
1395
|
+
return (S = r.value) == null ? void 0 : S.focus();
|
|
1386
1396
|
});
|
|
1387
1397
|
}
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1398
|
+
function h() {
|
|
1399
|
+
o.value = !1, d.value = "";
|
|
1390
1400
|
}
|
|
1391
|
-
function y(
|
|
1392
|
-
if (!
|
|
1401
|
+
function y(S) {
|
|
1402
|
+
if (!S.disabled)
|
|
1393
1403
|
if (t.multiple) {
|
|
1394
|
-
const
|
|
1395
|
-
R >= 0 ?
|
|
1404
|
+
const N = [...i.value], R = N.indexOf(S.value);
|
|
1405
|
+
R >= 0 ? N.splice(R, 1) : N.push(S.value), a("update:modelValue", N);
|
|
1396
1406
|
} else
|
|
1397
|
-
a("update:modelValue",
|
|
1407
|
+
a("update:modelValue", S.value), h();
|
|
1398
1408
|
}
|
|
1399
|
-
function
|
|
1409
|
+
function A(S) {
|
|
1400
1410
|
if (t.disabled) return;
|
|
1401
|
-
const
|
|
1402
|
-
a("update:modelValue",
|
|
1411
|
+
const N = i.value.filter((R) => R !== S);
|
|
1412
|
+
a("update:modelValue", N.length ? N : t.multiple ? [] : null);
|
|
1403
1413
|
}
|
|
1404
|
-
function
|
|
1405
|
-
|
|
1414
|
+
function V(S) {
|
|
1415
|
+
S.stopPropagation(), a("update:modelValue", t.multiple ? [] : null);
|
|
1406
1416
|
}
|
|
1407
|
-
function
|
|
1408
|
-
if (!
|
|
1409
|
-
(
|
|
1417
|
+
function b(S) {
|
|
1418
|
+
if (!o.value) {
|
|
1419
|
+
(S.key === "Enter" || S.key === " " || S.key === "ArrowDown") && (S.preventDefault(), C());
|
|
1410
1420
|
return;
|
|
1411
1421
|
}
|
|
1412
|
-
switch (
|
|
1422
|
+
switch (S.key) {
|
|
1413
1423
|
case "ArrowDown":
|
|
1414
|
-
|
|
1424
|
+
S.preventDefault(), l.value = Math.min(
|
|
1415
1425
|
l.value + 1,
|
|
1416
|
-
|
|
1426
|
+
g.value.length - 1
|
|
1417
1427
|
);
|
|
1418
1428
|
break;
|
|
1419
1429
|
case "ArrowUp":
|
|
1420
|
-
|
|
1430
|
+
S.preventDefault(), l.value = Math.max(l.value - 1, 0);
|
|
1421
1431
|
break;
|
|
1422
1432
|
case "Enter":
|
|
1423
|
-
|
|
1433
|
+
S.preventDefault(), l.value >= 0 && g.value[l.value] && y(g.value[l.value]);
|
|
1424
1434
|
break;
|
|
1425
1435
|
case "Escape":
|
|
1426
|
-
|
|
1436
|
+
S.preventDefault(), h();
|
|
1427
1437
|
break;
|
|
1428
1438
|
}
|
|
1429
1439
|
}
|
|
1430
|
-
function
|
|
1431
|
-
n.value && !n.value.contains(
|
|
1440
|
+
function v(S) {
|
|
1441
|
+
n.value && !n.value.contains(S.target) && h();
|
|
1432
1442
|
}
|
|
1433
|
-
function
|
|
1434
|
-
const
|
|
1435
|
-
return (
|
|
1443
|
+
function B(S) {
|
|
1444
|
+
const N = t.options.find((R) => R.value === S);
|
|
1445
|
+
return (N == null ? void 0 : N.label) ?? String(S);
|
|
1436
1446
|
}
|
|
1437
|
-
return ue(() => document.addEventListener("mousedown",
|
|
1438
|
-
|
|
1439
|
-
}), (
|
|
1447
|
+
return ue(() => document.addEventListener("mousedown", v)), Ve(() => document.removeEventListener("mousedown", v)), J(o, (S) => {
|
|
1448
|
+
S || a("blur", new FocusEvent("blur"));
|
|
1449
|
+
}), (S, N) => (c(), f("div", {
|
|
1440
1450
|
ref_key: "containerRef",
|
|
1441
1451
|
ref: n,
|
|
1442
|
-
class:
|
|
1452
|
+
class: F([
|
|
1443
1453
|
"relative w-full",
|
|
1444
|
-
H(
|
|
1454
|
+
H(s).classes.value.input,
|
|
1445
1455
|
e.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
1446
1456
|
])
|
|
1447
1457
|
}, [
|
|
1448
1458
|
p("div", {
|
|
1449
1459
|
role: "combobox",
|
|
1450
|
-
"aria-expanded":
|
|
1460
|
+
"aria-expanded": o.value,
|
|
1451
1461
|
"aria-haspopup": "listbox",
|
|
1452
1462
|
tabindex: "0",
|
|
1453
|
-
class:
|
|
1463
|
+
class: F([
|
|
1454
1464
|
"flex min-h-[38px] w-full cursor-pointer items-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm",
|
|
1455
1465
|
"transition-colors duration-200",
|
|
1456
|
-
|
|
1466
|
+
o.value ? "ring-2 ring-blue-500/20" : "",
|
|
1457
1467
|
e.disabled ? "pointer-events-none bg-gray-100" : ""
|
|
1458
1468
|
]),
|
|
1459
|
-
style:
|
|
1460
|
-
onClick:
|
|
1461
|
-
onKeydown:
|
|
1469
|
+
style: z(o.value ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
1470
|
+
onClick: m,
|
|
1471
|
+
onKeydown: b
|
|
1462
1472
|
}, [
|
|
1463
1473
|
p("div", Qt, [
|
|
1464
|
-
e.multiple ? (c(!0), f(
|
|
1474
|
+
e.multiple ? (c(!0), f(O, { key: 0 }, G(i.value, (R) => (c(), f("span", {
|
|
1465
1475
|
key: String(R),
|
|
1466
1476
|
class: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs",
|
|
1467
1477
|
style: { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 15%, white)", color: "var(--fc-color-primary, #3b82f6)" }
|
|
1468
1478
|
}, [
|
|
1469
|
-
_(L(
|
|
1479
|
+
_(L(B(R)) + " ", 1),
|
|
1470
1480
|
p("button", {
|
|
1471
1481
|
type: "button",
|
|
1472
1482
|
class: "ml-0.5",
|
|
1473
1483
|
style: { color: "var(--fc-color-primary, #3b82f6)" },
|
|
1474
1484
|
"aria-label": "Remove",
|
|
1475
|
-
onClick:
|
|
1485
|
+
onClick: Y((Q) => A(R), ["stop"])
|
|
1476
1486
|
}, " × ", 8, Xt)
|
|
1477
|
-
]))), 128)) :
|
|
1487
|
+
]))), 128)) : k.value ? (c(), f("span", ea, L(k.value), 1)) : (c(), f("span", ta, L(e.placeholder), 1))
|
|
1478
1488
|
]),
|
|
1479
|
-
e.clearable &&
|
|
1489
|
+
e.clearable && i.value.length > 0 && !e.disabled ? (c(), f("button", {
|
|
1480
1490
|
key: 0,
|
|
1481
1491
|
type: "button",
|
|
1482
1492
|
class: "ml-1 shrink-0 text-gray-400 hover:text-gray-600 transition-colors duration-200",
|
|
1483
1493
|
"aria-label": "Clear selection",
|
|
1484
|
-
onClick:
|
|
1494
|
+
onClick: V
|
|
1485
1495
|
}, " × ")) : T("", !0),
|
|
1486
1496
|
(c(), f("svg", {
|
|
1487
|
-
class:
|
|
1497
|
+
class: F(["ml-1 h-4 w-4 shrink-0 text-gray-400 transition-transform duration-200", o.value ? "rotate-180" : ""]),
|
|
1488
1498
|
viewBox: "0 0 20 20",
|
|
1489
1499
|
fill: "currentColor",
|
|
1490
1500
|
"aria-hidden": "true"
|
|
1491
|
-
}, [...
|
|
1501
|
+
}, [...N[1] || (N[1] = [
|
|
1492
1502
|
p("path", {
|
|
1493
1503
|
"fill-rule": "evenodd",
|
|
1494
1504
|
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
|
|
@@ -1496,41 +1506,41 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1496
1506
|
}, null, -1)
|
|
1497
1507
|
])], 2))
|
|
1498
1508
|
], 46, _t),
|
|
1499
|
-
|
|
1509
|
+
o.value ? (c(), f("div", aa, [
|
|
1500
1510
|
e.searchable ? (c(), f("div", la, [
|
|
1501
1511
|
de(p("input", {
|
|
1502
1512
|
ref_key: "searchInputRef",
|
|
1503
|
-
ref:
|
|
1504
|
-
"onUpdate:modelValue":
|
|
1513
|
+
ref: r,
|
|
1514
|
+
"onUpdate:modelValue": N[0] || (N[0] = (R) => d.value = R),
|
|
1505
1515
|
type: "text",
|
|
1506
1516
|
class: "w-full rounded border border-gray-300 px-2 py-1 text-sm focus:outline-none fc-select-search",
|
|
1507
1517
|
placeholder: "Search...",
|
|
1508
|
-
onKeydown:
|
|
1518
|
+
onKeydown: b
|
|
1509
1519
|
}, null, 544), [
|
|
1510
1520
|
[ve, d.value]
|
|
1511
1521
|
])
|
|
1512
1522
|
])) : T("", !0),
|
|
1513
1523
|
p("ul", na, [
|
|
1514
|
-
(c(!0), f(
|
|
1524
|
+
(c(!0), f(O, null, G(g.value, (R, Q) => (c(), f("li", {
|
|
1515
1525
|
key: String(R.value),
|
|
1516
1526
|
role: "option",
|
|
1517
|
-
"aria-selected":
|
|
1518
|
-
class:
|
|
1527
|
+
"aria-selected": $(R.value),
|
|
1528
|
+
class: F([
|
|
1519
1529
|
"cursor-pointer px-3 py-2 text-sm transition-colors duration-200",
|
|
1520
|
-
|
|
1530
|
+
$(R.value) ? "" : "text-gray-900",
|
|
1521
1531
|
l.value === Q ? "bg-gray-100" : "",
|
|
1522
1532
|
R.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-gray-50"
|
|
1523
1533
|
]),
|
|
1524
|
-
style:
|
|
1534
|
+
style: z($(R.value) ? { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)", color: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
1525
1535
|
onClick: (ee) => y(R),
|
|
1526
1536
|
onMouseenter: (ee) => l.value = Q
|
|
1527
1537
|
}, L(R.label), 47, oa))), 128)),
|
|
1528
|
-
|
|
1538
|
+
g.value.length === 0 ? (c(), f("li", ra, " No options found ")) : T("", !0)
|
|
1529
1539
|
])
|
|
1530
1540
|
])) : T("", !0)
|
|
1531
1541
|
], 2));
|
|
1532
1542
|
}
|
|
1533
|
-
}), ia = /* @__PURE__ */
|
|
1543
|
+
}), ia = /* @__PURE__ */ oe(sa, [["__scopeId", "data-v-b34f2a7d"]]), ua = ["value", "min", "max", "step", "disabled", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-disabled"], da = { class: "mt-1 flex justify-between text-xs text-gray-400" }, ca = /* @__PURE__ */ j({
|
|
1534
1544
|
__name: "SliderInput",
|
|
1535
1545
|
props: {
|
|
1536
1546
|
modelValue: {},
|
|
@@ -1541,10 +1551,10 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1541
1551
|
disabled: { type: Boolean, default: !1 }
|
|
1542
1552
|
},
|
|
1543
1553
|
emits: ["update:modelValue", "blur"],
|
|
1544
|
-
setup(e, { emit:
|
|
1545
|
-
const t = e, a =
|
|
1554
|
+
setup(e, { emit: u }) {
|
|
1555
|
+
const t = e, a = u;
|
|
1546
1556
|
K();
|
|
1547
|
-
const
|
|
1557
|
+
const s = D(!1), o = x(() => {
|
|
1548
1558
|
const l = t.max - t.min;
|
|
1549
1559
|
return l === 0 ? 0 : (t.modelValue - t.min) / l * 100;
|
|
1550
1560
|
});
|
|
@@ -1553,15 +1563,15 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1553
1563
|
a("update:modelValue", parseFloat(n.value));
|
|
1554
1564
|
}
|
|
1555
1565
|
return (l, n) => (c(), f("div", {
|
|
1556
|
-
class:
|
|
1566
|
+
class: F([
|
|
1557
1567
|
"relative w-full py-2",
|
|
1558
1568
|
e.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
1559
1569
|
])
|
|
1560
1570
|
}, [
|
|
1561
|
-
e.showTooltip &&
|
|
1571
|
+
e.showTooltip && s.value ? (c(), f("div", {
|
|
1562
1572
|
key: 0,
|
|
1563
1573
|
class: "absolute -top-8 rounded bg-gray-800 px-2 py-1 text-xs text-white shadow-sm transition-opacity duration-200",
|
|
1564
|
-
style:
|
|
1574
|
+
style: z({ left: `calc(${o.value}% - 16px)` })
|
|
1565
1575
|
}, L(e.modelValue), 5)) : T("", !0),
|
|
1566
1576
|
p("input", {
|
|
1567
1577
|
type: "range",
|
|
@@ -1577,13 +1587,13 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1577
1587
|
class: "h-2 w-full cursor-pointer appearance-none rounded-full bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:pointer-events-none",
|
|
1578
1588
|
style: { accentColor: "var(--fc-color-primary, #3b82f6)" },
|
|
1579
1589
|
onInput: d,
|
|
1580
|
-
onMousedown: n[0] || (n[0] = (
|
|
1581
|
-
onMouseup: n[1] || (n[1] = (
|
|
1582
|
-
onTouchstart: n[2] || (n[2] = (
|
|
1583
|
-
onTouchend: n[3] || (n[3] = (
|
|
1584
|
-
onFocus: n[4] || (n[4] = (
|
|
1585
|
-
onBlur: n[5] || (n[5] = (
|
|
1586
|
-
|
|
1590
|
+
onMousedown: n[0] || (n[0] = (r) => s.value = !0),
|
|
1591
|
+
onMouseup: n[1] || (n[1] = (r) => s.value = !1),
|
|
1592
|
+
onTouchstart: n[2] || (n[2] = (r) => s.value = !0),
|
|
1593
|
+
onTouchend: n[3] || (n[3] = (r) => s.value = !1),
|
|
1594
|
+
onFocus: n[4] || (n[4] = (r) => s.value = !0),
|
|
1595
|
+
onBlur: n[5] || (n[5] = (r) => {
|
|
1596
|
+
s.value = !1, a("blur", r);
|
|
1587
1597
|
})
|
|
1588
1598
|
}, null, 40, ua),
|
|
1589
1599
|
p("div", da, [
|
|
@@ -1607,21 +1617,21 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1607
1617
|
disabled: { type: Boolean, default: !1 }
|
|
1608
1618
|
},
|
|
1609
1619
|
emits: ["update:modelValue", "blur"],
|
|
1610
|
-
setup(e, { emit:
|
|
1611
|
-
const t = e, a =
|
|
1620
|
+
setup(e, { emit: u }) {
|
|
1621
|
+
const t = e, a = u;
|
|
1612
1622
|
K();
|
|
1613
|
-
const
|
|
1623
|
+
const s = x(() => [
|
|
1614
1624
|
"inline-flex items-center gap-2 select-none",
|
|
1615
1625
|
t.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
1616
1626
|
]);
|
|
1617
|
-
function
|
|
1627
|
+
function o() {
|
|
1618
1628
|
t.disabled || a("update:modelValue", !t.modelValue);
|
|
1619
1629
|
}
|
|
1620
1630
|
function d(l) {
|
|
1621
|
-
(l.key === " " || l.key === "Enter") && (l.preventDefault(),
|
|
1631
|
+
(l.key === " " || l.key === "Enter") && (l.preventDefault(), o());
|
|
1622
1632
|
}
|
|
1623
1633
|
return (l, n) => (c(), f("label", {
|
|
1624
|
-
class:
|
|
1634
|
+
class: F(s.value)
|
|
1625
1635
|
}, [
|
|
1626
1636
|
e.inactiveLabel ? (c(), f("span", fa, L(e.inactiveLabel), 1)) : T("", !0),
|
|
1627
1637
|
p("input", {
|
|
@@ -1629,8 +1639,8 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1629
1639
|
checked: e.modelValue,
|
|
1630
1640
|
disabled: e.disabled,
|
|
1631
1641
|
class: "sr-only",
|
|
1632
|
-
onChange:
|
|
1633
|
-
onBlur: n[0] || (n[0] = (
|
|
1642
|
+
onChange: o,
|
|
1643
|
+
onBlur: n[0] || (n[0] = (r) => a("blur", r))
|
|
1634
1644
|
}, null, 40, ma),
|
|
1635
1645
|
p("button", {
|
|
1636
1646
|
type: "button",
|
|
@@ -1638,17 +1648,17 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1638
1648
|
"aria-checked": e.modelValue,
|
|
1639
1649
|
"aria-disabled": e.disabled || void 0,
|
|
1640
1650
|
tabindex: "0",
|
|
1641
|
-
class:
|
|
1651
|
+
class: F([
|
|
1642
1652
|
"relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]",
|
|
1643
1653
|
e.modelValue ? "" : "bg-gray-300",
|
|
1644
1654
|
e.disabled ? "pointer-events-none" : "focus:outline-none focus:ring-2 focus:ring-blue-500/20"
|
|
1645
1655
|
]),
|
|
1646
|
-
style:
|
|
1647
|
-
onClick:
|
|
1656
|
+
style: z(e.modelValue ? { backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
1657
|
+
onClick: o,
|
|
1648
1658
|
onKeydown: d
|
|
1649
1659
|
}, [
|
|
1650
1660
|
p("span", {
|
|
1651
|
-
class:
|
|
1661
|
+
class: F([
|
|
1652
1662
|
"pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-sm transition-transform duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]",
|
|
1653
1663
|
e.modelValue ? "translate-x-5" : "translate-x-0"
|
|
1654
1664
|
]),
|
|
@@ -1672,118 +1682,118 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1672
1682
|
disabled: { type: Boolean, default: !1 }
|
|
1673
1683
|
},
|
|
1674
1684
|
emits: ["update:modelValue", "blur"],
|
|
1675
|
-
setup(e, { emit:
|
|
1676
|
-
const t = e, a =
|
|
1685
|
+
setup(e, { emit: u }) {
|
|
1686
|
+
const t = e, a = x(() => Array.isArray(t.modelValue) ? t.modelValue : []), s = u, o = K(), d = D(""), l = D(!1), n = D(!1), r = D(-1), i = D(null), k = D(null), g = x(() => !t.maxTags || a.value.length < t.maxTags), $ = x(() => {
|
|
1677
1687
|
if (!d.value || t.suggestions.length === 0) return [];
|
|
1678
|
-
const
|
|
1688
|
+
const V = d.value.toLowerCase();
|
|
1679
1689
|
return t.suggestions.filter(
|
|
1680
|
-
(
|
|
1690
|
+
(b) => b.toLowerCase().includes(V) && !a.value.includes(b)
|
|
1681
1691
|
);
|
|
1682
1692
|
});
|
|
1683
|
-
function
|
|
1684
|
-
const
|
|
1685
|
-
!
|
|
1693
|
+
function m(V) {
|
|
1694
|
+
const b = V.trim();
|
|
1695
|
+
!b || !g.value || a.value.includes(b) || (s("update:modelValue", [...a.value, b]), d.value = "", n.value = !1, r.value = -1);
|
|
1686
1696
|
}
|
|
1687
|
-
function
|
|
1697
|
+
function C(V) {
|
|
1688
1698
|
if (t.disabled) return;
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1699
|
+
const b = a.value.filter((v, B) => B !== V);
|
|
1700
|
+
s("update:modelValue", b);
|
|
1691
1701
|
}
|
|
1692
|
-
function
|
|
1693
|
-
if (
|
|
1694
|
-
|
|
1702
|
+
function h(V) {
|
|
1703
|
+
if (V.key === "Enter" || V.key === ",") {
|
|
1704
|
+
V.preventDefault(), r.value >= 0 && $.value[r.value] ? m($.value[r.value]) : m(d.value);
|
|
1695
1705
|
return;
|
|
1696
1706
|
}
|
|
1697
|
-
if (
|
|
1698
|
-
|
|
1707
|
+
if (V.key === "Backspace" && d.value === "" && a.value.length > 0) {
|
|
1708
|
+
C(a.value.length - 1);
|
|
1699
1709
|
return;
|
|
1700
1710
|
}
|
|
1701
|
-
if (
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1711
|
+
if (V.key === "ArrowDown" && n.value) {
|
|
1712
|
+
V.preventDefault(), r.value = Math.min(
|
|
1713
|
+
r.value + 1,
|
|
1714
|
+
$.value.length - 1
|
|
1705
1715
|
);
|
|
1706
1716
|
return;
|
|
1707
1717
|
}
|
|
1708
|
-
if (
|
|
1709
|
-
|
|
1718
|
+
if (V.key === "ArrowUp" && n.value) {
|
|
1719
|
+
V.preventDefault(), r.value = Math.max(r.value - 1, 0);
|
|
1710
1720
|
return;
|
|
1711
1721
|
}
|
|
1712
|
-
|
|
1722
|
+
V.key === "Escape" && (n.value = !1, r.value = -1);
|
|
1713
1723
|
}
|
|
1714
1724
|
function y() {
|
|
1715
|
-
n.value = d.value.length > 0 &&
|
|
1725
|
+
n.value = d.value.length > 0 && $.value.length > 0, r.value = -1;
|
|
1716
1726
|
}
|
|
1717
|
-
function
|
|
1718
|
-
|
|
1727
|
+
function A(V) {
|
|
1728
|
+
i.value && !i.value.contains(V.target) && (n.value = !1);
|
|
1719
1729
|
}
|
|
1720
|
-
return ue(() => document.addEventListener("mousedown",
|
|
1721
|
-
|
|
1722
|
-
}), (
|
|
1730
|
+
return ue(() => document.addEventListener("mousedown", A)), Ve(() => document.removeEventListener("mousedown", A)), J(d, () => {
|
|
1731
|
+
ae(y);
|
|
1732
|
+
}), (V, b) => (c(), f("div", {
|
|
1723
1733
|
ref_key: "containerRef",
|
|
1724
|
-
ref:
|
|
1725
|
-
class:
|
|
1734
|
+
ref: i,
|
|
1735
|
+
class: F([
|
|
1726
1736
|
"relative w-full",
|
|
1727
1737
|
e.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
1728
1738
|
])
|
|
1729
1739
|
}, [
|
|
1730
1740
|
p("div", {
|
|
1731
|
-
class:
|
|
1741
|
+
class: F([
|
|
1732
1742
|
"flex flex-wrap items-center gap-1.5 rounded-md border bg-white px-2 py-1.5 text-sm transition-colors duration-200",
|
|
1733
1743
|
l.value ? "ring-2 ring-blue-500/20" : "border-gray-300",
|
|
1734
|
-
H(
|
|
1744
|
+
H(o).classes.value.input
|
|
1735
1745
|
]),
|
|
1736
|
-
style:
|
|
1737
|
-
onClick:
|
|
1738
|
-
var
|
|
1739
|
-
return (
|
|
1746
|
+
style: z(l.value ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
1747
|
+
onClick: b[3] || (b[3] = (v) => {
|
|
1748
|
+
var B;
|
|
1749
|
+
return (B = k.value) == null ? void 0 : B.focus();
|
|
1740
1750
|
})
|
|
1741
1751
|
}, [
|
|
1742
|
-
(c(!0), f(
|
|
1743
|
-
key:
|
|
1752
|
+
(c(!0), f(O, null, G(a.value, (v, B) => (c(), f("span", {
|
|
1753
|
+
key: v,
|
|
1744
1754
|
class: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs",
|
|
1745
1755
|
style: { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 15%, white)", color: "var(--fc-color-primary, #3b82f6)" }
|
|
1746
1756
|
}, [
|
|
1747
|
-
_(L(
|
|
1757
|
+
_(L(v) + " ", 1),
|
|
1748
1758
|
e.disabled ? T("", !0) : (c(), f("button", {
|
|
1749
1759
|
key: 0,
|
|
1750
1760
|
type: "button",
|
|
1751
1761
|
class: "ml-0.5 transition-colors duration-200",
|
|
1752
1762
|
style: { color: "var(--fc-color-primary, #3b82f6)" },
|
|
1753
1763
|
"aria-label": "Remove tag",
|
|
1754
|
-
onClick:
|
|
1764
|
+
onClick: Y((S) => C(B), ["stop"])
|
|
1755
1765
|
}, " × ", 8, pa))
|
|
1756
1766
|
]))), 128)),
|
|
1757
1767
|
de(p("input", {
|
|
1758
1768
|
ref_key: "inputRef",
|
|
1759
|
-
ref:
|
|
1760
|
-
"onUpdate:modelValue":
|
|
1769
|
+
ref: k,
|
|
1770
|
+
"onUpdate:modelValue": b[0] || (b[0] = (v) => d.value = v),
|
|
1761
1771
|
type: "text",
|
|
1762
1772
|
placeholder: a.value.length === 0 ? e.placeholder : "",
|
|
1763
1773
|
disabled: e.disabled,
|
|
1764
1774
|
class: "min-w-[80px] flex-1 border-0 bg-transparent p-0 text-sm outline-none placeholder:text-gray-400",
|
|
1765
|
-
onKeydown:
|
|
1766
|
-
onFocus:
|
|
1767
|
-
onBlur:
|
|
1768
|
-
l.value = !1,
|
|
1775
|
+
onKeydown: h,
|
|
1776
|
+
onFocus: b[1] || (b[1] = (v) => l.value = !0),
|
|
1777
|
+
onBlur: b[2] || (b[2] = (v) => {
|
|
1778
|
+
l.value = !1, s("blur", v);
|
|
1769
1779
|
})
|
|
1770
1780
|
}, null, 40, ga), [
|
|
1771
1781
|
[ve, d.value]
|
|
1772
1782
|
])
|
|
1773
1783
|
], 6),
|
|
1774
|
-
n.value &&
|
|
1775
|
-
(c(!0), f(
|
|
1776
|
-
key:
|
|
1784
|
+
n.value && $.value.length > 0 ? (c(), f("ul", ha, [
|
|
1785
|
+
(c(!0), f(O, null, G($.value, (v, B) => (c(), f("li", {
|
|
1786
|
+
key: v,
|
|
1777
1787
|
role: "option",
|
|
1778
|
-
"aria-selected":
|
|
1779
|
-
class:
|
|
1788
|
+
"aria-selected": r.value === B,
|
|
1789
|
+
class: F([
|
|
1780
1790
|
"cursor-pointer px-3 py-2 text-sm transition-colors duration-200",
|
|
1781
|
-
|
|
1791
|
+
r.value !== B ? "text-gray-900 hover:bg-gray-50" : ""
|
|
1782
1792
|
]),
|
|
1783
|
-
style:
|
|
1784
|
-
onMousedown:
|
|
1785
|
-
onMouseenter: (
|
|
1786
|
-
}, L(
|
|
1793
|
+
style: z(r.value === B ? { backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)", color: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
1794
|
+
onMousedown: Y((S) => m(v), ["prevent"]),
|
|
1795
|
+
onMouseenter: (S) => r.value = B
|
|
1796
|
+
}, L(v), 47, xa))), 128))
|
|
1787
1797
|
])) : T("", !0)
|
|
1788
1798
|
], 2));
|
|
1789
1799
|
}
|
|
@@ -1799,8 +1809,8 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1799
1809
|
readonly: { type: Boolean, default: !1 }
|
|
1800
1810
|
},
|
|
1801
1811
|
emits: ["update:modelValue", "blur", "focus"],
|
|
1802
|
-
setup(e, { emit:
|
|
1803
|
-
const t = e, a =
|
|
1812
|
+
setup(e, { emit: u }) {
|
|
1813
|
+
const t = e, a = u, s = K(), o = D(null), d = x(
|
|
1804
1814
|
() => [
|
|
1805
1815
|
"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
|
|
1806
1816
|
"placeholder:text-gray-400 resize-y",
|
|
@@ -1808,43 +1818,43 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1808
1818
|
"transition-colors duration-200",
|
|
1809
1819
|
t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
|
|
1810
1820
|
t.autoResize ? "resize-none overflow-hidden" : "",
|
|
1811
|
-
|
|
1821
|
+
s.classes.value.input
|
|
1812
1822
|
].filter(Boolean).join(" ")
|
|
1813
1823
|
);
|
|
1814
1824
|
function l() {
|
|
1815
|
-
if (!t.autoResize || !
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1825
|
+
if (!t.autoResize || !o.value) return;
|
|
1826
|
+
const r = o.value;
|
|
1827
|
+
r.style.height = "auto", r.style.height = `${r.scrollHeight}px`;
|
|
1818
1828
|
}
|
|
1819
|
-
function n(
|
|
1820
|
-
const
|
|
1821
|
-
a("update:modelValue",
|
|
1829
|
+
function n(r) {
|
|
1830
|
+
const i = r.target;
|
|
1831
|
+
a("update:modelValue", i.value), t.autoResize && ae(l);
|
|
1822
1832
|
}
|
|
1823
|
-
return
|
|
1833
|
+
return J(
|
|
1824
1834
|
() => t.modelValue,
|
|
1825
1835
|
() => {
|
|
1826
|
-
t.autoResize &&
|
|
1836
|
+
t.autoResize && ae(l);
|
|
1827
1837
|
}
|
|
1828
1838
|
), ue(() => {
|
|
1829
1839
|
t.autoResize && l();
|
|
1830
|
-
}), (
|
|
1840
|
+
}), (r, i) => (c(), f("textarea", {
|
|
1831
1841
|
ref_key: "textareaRef",
|
|
1832
|
-
ref:
|
|
1842
|
+
ref: o,
|
|
1833
1843
|
value: e.modelValue,
|
|
1834
1844
|
rows: e.rows,
|
|
1835
1845
|
maxlength: e.maxLength,
|
|
1836
1846
|
placeholder: e.placeholder,
|
|
1837
1847
|
disabled: e.disabled,
|
|
1838
1848
|
readonly: e.readonly,
|
|
1839
|
-
class:
|
|
1849
|
+
class: F(d.value),
|
|
1840
1850
|
"aria-disabled": e.disabled || void 0,
|
|
1841
1851
|
"aria-readonly": e.readonly || void 0,
|
|
1842
1852
|
onInput: n,
|
|
1843
|
-
onBlur:
|
|
1844
|
-
onFocus:
|
|
1853
|
+
onBlur: i[0] || (i[0] = (k) => a("blur", k)),
|
|
1854
|
+
onFocus: i[1] || (i[1] = (k) => a("focus", k))
|
|
1845
1855
|
}, null, 42, wa));
|
|
1846
1856
|
}
|
|
1847
|
-
}), Ca = /* @__PURE__ */
|
|
1857
|
+
}), Ca = /* @__PURE__ */ oe($a, [["__scopeId", "data-v-67f80d90"]]), Va = {
|
|
1848
1858
|
key: 0,
|
|
1849
1859
|
class: "flex items-stretch"
|
|
1850
1860
|
}, Sa = {
|
|
@@ -1867,8 +1877,8 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1867
1877
|
mask: {}
|
|
1868
1878
|
},
|
|
1869
1879
|
emits: ["update:modelValue", "blur", "focus"],
|
|
1870
|
-
setup(e, { emit:
|
|
1871
|
-
const t = e, a =
|
|
1880
|
+
setup(e, { emit: u }) {
|
|
1881
|
+
const t = e, a = u, s = K(), o = x(() => !!t.prefix || !!t.suffix), d = x(
|
|
1872
1882
|
() => [
|
|
1873
1883
|
"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
|
|
1874
1884
|
"placeholder:text-gray-400",
|
|
@@ -1877,14 +1887,14 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1877
1887
|
t.disabled ? "opacity-50 cursor-not-allowed bg-gray-100" : "",
|
|
1878
1888
|
t.prefix ? "rounded-l-none" : "",
|
|
1879
1889
|
t.suffix ? "rounded-r-none" : "",
|
|
1880
|
-
|
|
1890
|
+
s.classes.value.input
|
|
1881
1891
|
].filter(Boolean).join(" ")
|
|
1882
1892
|
);
|
|
1883
1893
|
function l(n) {
|
|
1884
|
-
const
|
|
1885
|
-
a("update:modelValue",
|
|
1894
|
+
const r = n.target;
|
|
1895
|
+
a("update:modelValue", r.value);
|
|
1886
1896
|
}
|
|
1887
|
-
return (n,
|
|
1897
|
+
return (n, r) => o.value ? (c(), f("div", Va, [
|
|
1888
1898
|
e.prefix ? (c(), f("span", Sa, L(e.prefix), 1)) : T("", !0),
|
|
1889
1899
|
p("input", {
|
|
1890
1900
|
type: e.inputType,
|
|
@@ -1893,12 +1903,12 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1893
1903
|
maxlength: e.maxLength,
|
|
1894
1904
|
disabled: e.disabled,
|
|
1895
1905
|
readonly: e.readonly,
|
|
1896
|
-
class:
|
|
1906
|
+
class: F(d.value),
|
|
1897
1907
|
"aria-disabled": e.disabled || void 0,
|
|
1898
1908
|
"aria-readonly": e.readonly || void 0,
|
|
1899
1909
|
onInput: l,
|
|
1900
|
-
onBlur:
|
|
1901
|
-
onFocus:
|
|
1910
|
+
onBlur: r[0] || (r[0] = (i) => a("blur", i)),
|
|
1911
|
+
onFocus: r[1] || (r[1] = (i) => a("focus", i))
|
|
1902
1912
|
}, null, 42, Ba),
|
|
1903
1913
|
e.suffix ? (c(), f("span", Fa, L(e.suffix), 1)) : T("", !0)
|
|
1904
1914
|
])) : (c(), f("input", {
|
|
@@ -1909,15 +1919,15 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1909
1919
|
maxlength: e.maxLength,
|
|
1910
1920
|
disabled: e.disabled,
|
|
1911
1921
|
readonly: e.readonly,
|
|
1912
|
-
class:
|
|
1922
|
+
class: F(d.value),
|
|
1913
1923
|
"aria-disabled": e.disabled || void 0,
|
|
1914
1924
|
"aria-readonly": e.readonly || void 0,
|
|
1915
1925
|
onInput: l,
|
|
1916
|
-
onBlur:
|
|
1917
|
-
onFocus:
|
|
1926
|
+
onBlur: r[2] || (r[2] = (i) => a("blur", i)),
|
|
1927
|
+
onFocus: r[3] || (r[3] = (i) => a("focus", i))
|
|
1918
1928
|
}, null, 42, Ta));
|
|
1919
1929
|
}
|
|
1920
|
-
}), La = /* @__PURE__ */
|
|
1930
|
+
}), La = /* @__PURE__ */ oe(Ia, [["__scopeId", "data-v-a42b4343"]]), Aa = {
|
|
1921
1931
|
key: 0,
|
|
1922
1932
|
class: "mb-1.5 flex items-center gap-1"
|
|
1923
1933
|
}, Na = ["for"], Da = {
|
|
@@ -1928,7 +1938,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1928
1938
|
key: 0,
|
|
1929
1939
|
role: "tooltip",
|
|
1930
1940
|
class: "absolute bottom-full left-1/2 z-10 mb-2 -translate-x-1/2 rounded-md bg-gray-900 px-3 py-1.5 text-xs text-white shadow-lg whitespace-nowrap"
|
|
1931
|
-
}, Ra = ["id"], ja = ["id"],
|
|
1941
|
+
}, Ra = ["id"], ja = ["id"], za = /* @__PURE__ */ j({
|
|
1932
1942
|
__name: "BaseField",
|
|
1933
1943
|
props: {
|
|
1934
1944
|
fieldSchema: {},
|
|
@@ -1937,51 +1947,51 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1937
1947
|
touched: { type: Boolean, default: !1 }
|
|
1938
1948
|
},
|
|
1939
1949
|
setup(e) {
|
|
1940
|
-
const
|
|
1950
|
+
const u = e, t = q(ye), a = q(pe), s = D(!1), o = x(() => {
|
|
1941
1951
|
if (t) {
|
|
1942
|
-
const
|
|
1943
|
-
if (
|
|
1952
|
+
const g = t.t(u.fieldName, "label");
|
|
1953
|
+
if (g) return g;
|
|
1944
1954
|
}
|
|
1945
|
-
return
|
|
1946
|
-
}), d =
|
|
1955
|
+
return u.fieldSchema.label ?? u.fieldName;
|
|
1956
|
+
}), d = x(() => {
|
|
1947
1957
|
if (t) {
|
|
1948
|
-
const
|
|
1949
|
-
if (
|
|
1958
|
+
const g = t.t(u.fieldName, "helpText");
|
|
1959
|
+
if (g) return g;
|
|
1950
1960
|
}
|
|
1951
|
-
return
|
|
1952
|
-
}), l =
|
|
1961
|
+
return u.fieldSchema.helpText ?? "";
|
|
1962
|
+
}), l = x(() => {
|
|
1953
1963
|
if (t) {
|
|
1954
|
-
const
|
|
1955
|
-
if (
|
|
1964
|
+
const g = t.t(u.fieldName, "tooltip");
|
|
1965
|
+
if (g) return g;
|
|
1956
1966
|
}
|
|
1957
|
-
return
|
|
1958
|
-
}), n =
|
|
1967
|
+
return u.fieldSchema.tooltip ?? "";
|
|
1968
|
+
}), n = x(() => u.touched && u.errors.length > 0), r = x(() => [
|
|
1959
1969
|
(a == null ? void 0 : a.classes.value.field) ?? "fc-field",
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
]),
|
|
1964
|
-
return (
|
|
1965
|
-
var
|
|
1970
|
+
u.fieldSchema.className ?? "",
|
|
1971
|
+
u.fieldSchema.disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
1972
|
+
u.fieldSchema.readOnly ? "fc-readonly" : ""
|
|
1973
|
+
]), i = x(() => `fc-field-${u.fieldName}`), k = x(() => `fc-error-${u.fieldName}`);
|
|
1974
|
+
return (g, $) => {
|
|
1975
|
+
var m, C;
|
|
1966
1976
|
return c(), f("div", {
|
|
1967
|
-
class:
|
|
1968
|
-
style:
|
|
1977
|
+
class: F([r.value, "relative mb-4"]),
|
|
1978
|
+
style: z(e.fieldSchema.style)
|
|
1969
1979
|
}, [
|
|
1970
1980
|
e.fieldSchema.type !== "hidden" ? (c(), f("div", Aa, [
|
|
1971
1981
|
p("label", {
|
|
1972
|
-
for:
|
|
1973
|
-
class:
|
|
1982
|
+
for: i.value,
|
|
1983
|
+
class: F([((m = H(a)) == null ? void 0 : m.classes.value.label) ?? "fc-label", "block text-sm font-medium text-gray-700"])
|
|
1974
1984
|
}, [
|
|
1975
|
-
_(L(
|
|
1985
|
+
_(L(o.value) + " ", 1),
|
|
1976
1986
|
e.fieldSchema.required ? (c(), f("span", Da, "*")) : T("", !0)
|
|
1977
1987
|
], 10, Na),
|
|
1978
1988
|
l.value ? (c(), f("span", {
|
|
1979
1989
|
key: 0,
|
|
1980
1990
|
class: "relative inline-flex",
|
|
1981
|
-
onMouseenter:
|
|
1982
|
-
onMouseleave:
|
|
1983
|
-
onFocusin:
|
|
1984
|
-
onFocusout:
|
|
1991
|
+
onMouseenter: $[0] || ($[0] = (h) => s.value = !0),
|
|
1992
|
+
onMouseleave: $[1] || ($[1] = (h) => s.value = !1),
|
|
1993
|
+
onFocusin: $[2] || ($[2] = (h) => s.value = !0),
|
|
1994
|
+
onFocusout: $[3] || ($[3] = (h) => s.value = !1)
|
|
1985
1995
|
}, [
|
|
1986
1996
|
p("button", {
|
|
1987
1997
|
type: "button",
|
|
@@ -1989,7 +1999,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1989
1999
|
"aria-label": `Info: ${l.value}`,
|
|
1990
2000
|
tabindex: "0"
|
|
1991
2001
|
}, " i ", 8, Ma),
|
|
1992
|
-
Z(
|
|
2002
|
+
Z(le, {
|
|
1993
2003
|
"enter-active-class": "motion-safe:transition motion-safe:duration-200 motion-safe:ease-out",
|
|
1994
2004
|
"enter-from-class": "opacity-0 scale-95",
|
|
1995
2005
|
"enter-to-class": "opacity-100 scale-100",
|
|
@@ -1998,19 +2008,19 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
1998
2008
|
"leave-to-class": "opacity-0 scale-95"
|
|
1999
2009
|
}, {
|
|
2000
2010
|
default: W(() => [
|
|
2001
|
-
|
|
2011
|
+
s.value ? (c(), f("div", Ea, [
|
|
2002
2012
|
_(L(l.value) + " ", 1),
|
|
2003
|
-
|
|
2013
|
+
$[4] || ($[4] = p("div", { class: "absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-gray-900" }, null, -1))
|
|
2004
2014
|
])) : T("", !0)
|
|
2005
2015
|
]),
|
|
2006
2016
|
_: 1
|
|
2007
2017
|
})
|
|
2008
2018
|
], 32)) : T("", !0)
|
|
2009
2019
|
])) : T("", !0),
|
|
2010
|
-
p("div", { id:
|
|
2011
|
-
|
|
2020
|
+
p("div", { id: i.value }, [
|
|
2021
|
+
De(g.$slots, "default")
|
|
2012
2022
|
], 8, Ra),
|
|
2013
|
-
Z(
|
|
2023
|
+
Z(Me, {
|
|
2014
2024
|
tag: "div",
|
|
2015
2025
|
"enter-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out",
|
|
2016
2026
|
"enter-from-class": "opacity-0 -translate-y-1 max-h-0",
|
|
@@ -2021,26 +2031,26 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2021
2031
|
class: ""
|
|
2022
2032
|
}, {
|
|
2023
2033
|
default: W(() => [
|
|
2024
|
-
(c(!0), f(
|
|
2025
|
-
var
|
|
2034
|
+
(c(!0), f(O, null, G(n.value ? e.errors : [], (h, y) => {
|
|
2035
|
+
var A;
|
|
2026
2036
|
return c(), f("p", {
|
|
2027
|
-
key:
|
|
2028
|
-
id: y === 0 ?
|
|
2029
|
-
class:
|
|
2037
|
+
key: h + y,
|
|
2038
|
+
id: y === 0 ? k.value : void 0,
|
|
2039
|
+
class: F([((A = H(a)) == null ? void 0 : A.classes.value.error) ?? "fc-error", "mt-1 text-xs text-red-500"]),
|
|
2030
2040
|
role: "alert"
|
|
2031
|
-
}, L(
|
|
2041
|
+
}, L(h), 11, ja);
|
|
2032
2042
|
}), 128))
|
|
2033
2043
|
]),
|
|
2034
2044
|
_: 1
|
|
2035
2045
|
}),
|
|
2036
2046
|
d.value && !n.value ? (c(), f("p", {
|
|
2037
2047
|
key: 1,
|
|
2038
|
-
class:
|
|
2048
|
+
class: F([((C = H(a)) == null ? void 0 : C.classes.value.helpText) ?? "fc-help-text", "mt-1 text-xs text-gray-400"])
|
|
2039
2049
|
}, L(d.value), 3)) : T("", !0)
|
|
2040
2050
|
], 6);
|
|
2041
2051
|
};
|
|
2042
2052
|
}
|
|
2043
|
-
}),
|
|
2053
|
+
}), Oa = {
|
|
2044
2054
|
key: 1,
|
|
2045
2055
|
class: "rounded-md border border-dashed border-amber-400 bg-amber-50 px-3 py-2 text-xs text-amber-700"
|
|
2046
2056
|
}, $e = /* @__PURE__ */ j({
|
|
@@ -2049,68 +2059,68 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2049
2059
|
name: {}
|
|
2050
2060
|
},
|
|
2051
2061
|
setup(e) {
|
|
2052
|
-
const
|
|
2062
|
+
const u = e, t = q(ce);
|
|
2053
2063
|
if (!t)
|
|
2054
2064
|
throw new Error(
|
|
2055
2065
|
"FormField must be used inside a FormBuilder (FormContextKey not provided)"
|
|
2056
2066
|
);
|
|
2057
|
-
const a =
|
|
2067
|
+
const a = q(
|
|
2058
2068
|
Be,
|
|
2059
2069
|
null
|
|
2060
|
-
),
|
|
2061
|
-
() => P(t.schema.fields).find((
|
|
2062
|
-
),
|
|
2063
|
-
var
|
|
2064
|
-
const
|
|
2065
|
-
if (!
|
|
2066
|
-
const
|
|
2067
|
-
return
|
|
2068
|
-
}), d =
|
|
2069
|
-
const
|
|
2070
|
-
return
|
|
2070
|
+
), s = x(
|
|
2071
|
+
() => P(t.schema.fields).find((m) => m.name === u.name)
|
|
2072
|
+
), o = x(() => {
|
|
2073
|
+
var h;
|
|
2074
|
+
const m = s.value;
|
|
2075
|
+
if (!m) return;
|
|
2076
|
+
const C = (h = a == null ? void 0 : a.value) == null ? void 0 : h[m.type];
|
|
2077
|
+
return C || Ke(m.type);
|
|
2078
|
+
}), d = x(() => t.values[u.name]), l = x(() => t.errors[u.name] ?? []), n = x(() => t.touched[u.name] ?? !1), r = x(() => {
|
|
2079
|
+
const m = s.value;
|
|
2080
|
+
return m ? m.condition ? se(m.condition, t.values) : typeof m.visible == "function" ? m.visible({
|
|
2071
2081
|
values: { ...t.values },
|
|
2072
|
-
getFieldValue: (
|
|
2073
|
-
}) :
|
|
2074
|
-
}),
|
|
2075
|
-
const
|
|
2076
|
-
return
|
|
2082
|
+
getFieldValue: (C) => t.values[C]
|
|
2083
|
+
}) : m.visible ?? !0 : !1;
|
|
2084
|
+
}), i = x(() => {
|
|
2085
|
+
const m = s.value;
|
|
2086
|
+
return m ? typeof m.disabled == "function" ? m.disabled({
|
|
2077
2087
|
values: { ...t.values },
|
|
2078
|
-
getFieldValue: (
|
|
2079
|
-
}) :
|
|
2080
|
-
}),
|
|
2081
|
-
const
|
|
2082
|
-
if (!
|
|
2088
|
+
getFieldValue: (C) => t.values[C]
|
|
2089
|
+
}) : m.disabled ?? !1 : !1;
|
|
2090
|
+
}), k = x(() => {
|
|
2091
|
+
const m = s.value;
|
|
2092
|
+
if (!m) return {};
|
|
2083
2093
|
const {
|
|
2084
|
-
name:
|
|
2085
|
-
label:
|
|
2094
|
+
name: C,
|
|
2095
|
+
label: h,
|
|
2086
2096
|
helpText: y,
|
|
2087
|
-
tooltip:
|
|
2088
|
-
condition:
|
|
2089
|
-
translations:
|
|
2090
|
-
meta:
|
|
2091
|
-
rules:
|
|
2092
|
-
visible:
|
|
2093
|
-
className:
|
|
2097
|
+
tooltip: A,
|
|
2098
|
+
condition: V,
|
|
2099
|
+
translations: b,
|
|
2100
|
+
meta: v,
|
|
2101
|
+
rules: B,
|
|
2102
|
+
visible: S,
|
|
2103
|
+
className: N,
|
|
2094
2104
|
style: R,
|
|
2095
2105
|
defaultValue: Q,
|
|
2096
2106
|
...ee
|
|
2097
|
-
} =
|
|
2107
|
+
} = m;
|
|
2098
2108
|
return {
|
|
2099
2109
|
...ee,
|
|
2100
2110
|
modelValue: d.value,
|
|
2101
|
-
disabled:
|
|
2102
|
-
readonly:
|
|
2103
|
-
placeholder:
|
|
2111
|
+
disabled: i.value,
|
|
2112
|
+
readonly: m.readOnly ?? !1,
|
|
2113
|
+
placeholder: m.placeholder ?? ""
|
|
2104
2114
|
};
|
|
2105
2115
|
});
|
|
2106
|
-
function
|
|
2107
|
-
t.setFieldValue(
|
|
2116
|
+
function g(m) {
|
|
2117
|
+
t.setFieldValue(u.name, m);
|
|
2108
2118
|
}
|
|
2109
|
-
function
|
|
2110
|
-
var
|
|
2111
|
-
t.touched[
|
|
2119
|
+
function $() {
|
|
2120
|
+
var m;
|
|
2121
|
+
t.touched[u.name] = !0, ((m = t.schema.settings) == null ? void 0 : m.validateOnBlur) !== !1 && t.validateField(u.name);
|
|
2112
2122
|
}
|
|
2113
|
-
return (
|
|
2123
|
+
return (m, C) => (c(), U(le, {
|
|
2114
2124
|
"enter-active-class": "motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",
|
|
2115
2125
|
"enter-from-class": "opacity-0 max-h-0",
|
|
2116
2126
|
"enter-to-class": "opacity-100 max-h-96",
|
|
@@ -2119,20 +2129,20 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2119
2129
|
"leave-to-class": "opacity-0 max-h-0"
|
|
2120
2130
|
}, {
|
|
2121
2131
|
default: W(() => [
|
|
2122
|
-
|
|
2132
|
+
r.value && s.value ? (c(), U(za, {
|
|
2123
2133
|
key: 0,
|
|
2124
|
-
"field-schema":
|
|
2134
|
+
"field-schema": s.value,
|
|
2125
2135
|
"field-name": e.name,
|
|
2126
2136
|
errors: l.value,
|
|
2127
2137
|
touched: n.value
|
|
2128
2138
|
}, {
|
|
2129
2139
|
default: W(() => [
|
|
2130
|
-
|
|
2140
|
+
o.value ? (c(), U(Se(o.value), Ee({ key: 0 }, k.value, {
|
|
2131
2141
|
"aria-invalid": n.value && l.value.length > 0 ? !0 : void 0,
|
|
2132
2142
|
"aria-describedby": n.value && l.value.length > 0 ? `fc-error-${e.name}` : void 0,
|
|
2133
|
-
"onUpdate:modelValue":
|
|
2134
|
-
onBlur:
|
|
2135
|
-
}), null, 16, ["aria-invalid", "aria-describedby"])) : (c(), f("div",
|
|
2143
|
+
"onUpdate:modelValue": g,
|
|
2144
|
+
onBlur: $
|
|
2145
|
+
}), null, 16, ["aria-invalid", "aria-describedby"])) : (c(), f("div", Oa, ' No component registered for field type "' + L(s.value.type) + '" ', 1))
|
|
2136
2146
|
]),
|
|
2137
2147
|
_: 1
|
|
2138
2148
|
}, 8, ["field-schema", "field-name", "errors", "touched"])) : T("", !0)
|
|
@@ -2150,8 +2160,8 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2150
2160
|
className: {}
|
|
2151
2161
|
},
|
|
2152
2162
|
setup(e) {
|
|
2153
|
-
return (
|
|
2154
|
-
class:
|
|
2163
|
+
return (u, t) => (c(), f("div", {
|
|
2164
|
+
class: F([e.className ?? "", "relative my-4"]),
|
|
2155
2165
|
role: "separator"
|
|
2156
2166
|
}, [
|
|
2157
2167
|
t[0] || (t[0] = p("div", {
|
|
@@ -2182,37 +2192,37 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2182
2192
|
className: {}
|
|
2183
2193
|
},
|
|
2184
2194
|
setup(e) {
|
|
2185
|
-
const
|
|
2195
|
+
const u = e, t = D(u.collapsed);
|
|
2186
2196
|
function a() {
|
|
2187
|
-
|
|
2197
|
+
u.collapsible && (t.value = !t.value);
|
|
2188
2198
|
}
|
|
2189
|
-
const
|
|
2190
|
-
() =>
|
|
2199
|
+
const s = x(
|
|
2200
|
+
() => u.title ? `fc-group-${u.title.toLowerCase().replace(/\s+/g, "-")}` : void 0
|
|
2191
2201
|
);
|
|
2192
|
-
return (
|
|
2193
|
-
class:
|
|
2194
|
-
"aria-labelledby":
|
|
2202
|
+
return (o, d) => (c(), f("fieldset", {
|
|
2203
|
+
class: F([[e.className ?? ""], "rounded-lg border border-gray-200 bg-white"]),
|
|
2204
|
+
"aria-labelledby": s.value
|
|
2195
2205
|
}, [
|
|
2196
2206
|
e.title || e.description ? (c(), f("div", Ga, [
|
|
2197
2207
|
(c(), U(Se(e.collapsible ? "button" : "div"), {
|
|
2198
2208
|
type: e.collapsible ? "button" : void 0,
|
|
2199
|
-
class:
|
|
2209
|
+
class: F(["flex w-full items-center justify-between text-left", e.collapsible ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500/40 rounded" : ""]),
|
|
2200
2210
|
"aria-expanded": e.collapsible ? !t.value : void 0,
|
|
2201
|
-
"aria-controls": e.collapsible ? `fc-group-body-${
|
|
2211
|
+
"aria-controls": e.collapsible ? `fc-group-body-${s.value}` : void 0,
|
|
2202
2212
|
onClick: a
|
|
2203
2213
|
}, {
|
|
2204
2214
|
default: W(() => [
|
|
2205
2215
|
p("div", null, [
|
|
2206
2216
|
e.title ? (c(), f("legend", {
|
|
2207
2217
|
key: 0,
|
|
2208
|
-
id:
|
|
2218
|
+
id: s.value,
|
|
2209
2219
|
class: "text-sm font-semibold text-gray-800"
|
|
2210
2220
|
}, L(e.title), 9, Za)) : T("", !0),
|
|
2211
2221
|
e.description ? (c(), f("p", qa, L(e.description), 1)) : T("", !0)
|
|
2212
2222
|
]),
|
|
2213
2223
|
e.collapsible ? (c(), f("svg", {
|
|
2214
2224
|
key: 0,
|
|
2215
|
-
class:
|
|
2225
|
+
class: F(["h-4 w-4 shrink-0 text-gray-400 motion-safe:transition-transform motion-safe:duration-200", t.value ? "" : "rotate-180"]),
|
|
2216
2226
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2217
2227
|
viewBox: "0 0 20 20",
|
|
2218
2228
|
fill: "currentColor",
|
|
@@ -2228,7 +2238,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2228
2238
|
_: 1
|
|
2229
2239
|
}, 8, ["type", "class", "aria-expanded", "aria-controls"]))
|
|
2230
2240
|
])) : T("", !0),
|
|
2231
|
-
Z(
|
|
2241
|
+
Z(le, {
|
|
2232
2242
|
"enter-active-class": "motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",
|
|
2233
2243
|
"enter-from-class": "max-h-0 opacity-0 overflow-hidden",
|
|
2234
2244
|
"enter-to-class": "max-h-[2000px] opacity-100 overflow-hidden",
|
|
@@ -2238,12 +2248,12 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2238
2248
|
}, {
|
|
2239
2249
|
default: W(() => [
|
|
2240
2250
|
de(p("div", {
|
|
2241
|
-
id: e.collapsible ? `fc-group-body-${
|
|
2251
|
+
id: e.collapsible ? `fc-group-body-${s.value}` : void 0,
|
|
2242
2252
|
class: "p-4"
|
|
2243
2253
|
}, [
|
|
2244
|
-
Z(
|
|
2254
|
+
Z(re, { nodes: e.children }, null, 8, ["nodes"])
|
|
2245
2255
|
], 8, Ya), [
|
|
2246
|
-
[
|
|
2256
|
+
[Re, !t.value]
|
|
2247
2257
|
])
|
|
2248
2258
|
]),
|
|
2249
2259
|
_: 1
|
|
@@ -2257,9 +2267,9 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2257
2267
|
className: {}
|
|
2258
2268
|
},
|
|
2259
2269
|
setup(e) {
|
|
2260
|
-
const
|
|
2261
|
-
return (a,
|
|
2262
|
-
class:
|
|
2270
|
+
const u = e, t = x(() => Ae(u.content));
|
|
2271
|
+
return (a, s) => (c(), f("div", {
|
|
2272
|
+
class: F([e.className ?? "", "fc-html prose prose-sm max-w-none text-gray-700"]),
|
|
2263
2273
|
innerHTML: t.value
|
|
2264
2274
|
}, null, 10, Wa));
|
|
2265
2275
|
}
|
|
@@ -2272,18 +2282,18 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2272
2282
|
className: {}
|
|
2273
2283
|
},
|
|
2274
2284
|
setup(e) {
|
|
2275
|
-
const
|
|
2285
|
+
const u = e, t = x(() => ({
|
|
2276
2286
|
start: "items-start",
|
|
2277
2287
|
center: "items-center",
|
|
2278
2288
|
end: "items-end",
|
|
2279
2289
|
stretch: "items-stretch"
|
|
2280
|
-
})[
|
|
2281
|
-
return (
|
|
2282
|
-
class:
|
|
2283
|
-
style:
|
|
2290
|
+
})[u.align] ?? "items-stretch"), a = x(() => u.gap ? typeof u.gap == "number" ? `${u.gap}px` : u.gap : "");
|
|
2291
|
+
return (s, o) => (c(), f("div", {
|
|
2292
|
+
class: F(["grid grid-cols-12", [t.value, e.className ?? ""]]),
|
|
2293
|
+
style: z(a.value ? { gap: a.value } : { gap: "1rem" }),
|
|
2284
2294
|
role: "group"
|
|
2285
2295
|
}, [
|
|
2286
|
-
Z(
|
|
2296
|
+
Z(re, { nodes: e.children }, null, 8, ["nodes"])
|
|
2287
2297
|
], 6));
|
|
2288
2298
|
}
|
|
2289
2299
|
}), Xa = {
|
|
@@ -2313,49 +2323,49 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2313
2323
|
className: {}
|
|
2314
2324
|
},
|
|
2315
2325
|
setup(e) {
|
|
2316
|
-
const
|
|
2317
|
-
function
|
|
2318
|
-
const
|
|
2319
|
-
function
|
|
2320
|
-
for (const
|
|
2321
|
-
if (Ce(
|
|
2322
|
-
|
|
2323
|
-
else if (
|
|
2324
|
-
|
|
2325
|
-
else if (
|
|
2326
|
-
for (const
|
|
2327
|
-
else if (
|
|
2328
|
-
for (const
|
|
2326
|
+
const u = e, t = q(ce), a = D(0), s = D(/* @__PURE__ */ new Set()), o = x(() => u.steps), d = x(() => o.value.length), l = x(() => a.value === 0), n = x(() => a.value === d.value - 1);
|
|
2327
|
+
function r(m) {
|
|
2328
|
+
const C = [];
|
|
2329
|
+
function h(y) {
|
|
2330
|
+
for (const A of y)
|
|
2331
|
+
if (Ce(A))
|
|
2332
|
+
C.push(A.name);
|
|
2333
|
+
else if (A.type === "row" || A.type === "group")
|
|
2334
|
+
h(A.children);
|
|
2335
|
+
else if (A.type === "steps")
|
|
2336
|
+
for (const V of A.steps) h(V.children);
|
|
2337
|
+
else if (A.type === "tabs")
|
|
2338
|
+
for (const V of A.tabs) h(V.children);
|
|
2329
2339
|
}
|
|
2330
|
-
return m
|
|
2331
|
-
}
|
|
2332
|
-
async function
|
|
2333
|
-
if (!t || !
|
|
2334
|
-
const
|
|
2335
|
-
if (!
|
|
2336
|
-
const
|
|
2337
|
-
let
|
|
2338
|
-
for (const y of
|
|
2339
|
-
const
|
|
2340
|
-
t.touched[y] = !0,
|
|
2340
|
+
return h(m.children), C;
|
|
2341
|
+
}
|
|
2342
|
+
async function i() {
|
|
2343
|
+
if (!t || !u.linear) return !0;
|
|
2344
|
+
const m = o.value[a.value];
|
|
2345
|
+
if (!m) return !0;
|
|
2346
|
+
const C = r(m);
|
|
2347
|
+
let h = !0;
|
|
2348
|
+
for (const y of C) {
|
|
2349
|
+
const A = await t.validateField(y);
|
|
2350
|
+
t.touched[y] = !0, A.length > 0 && (h = !1);
|
|
2341
2351
|
}
|
|
2342
|
-
return
|
|
2352
|
+
return h;
|
|
2343
2353
|
}
|
|
2344
|
-
async function
|
|
2345
|
-
n.value ||
|
|
2354
|
+
async function k() {
|
|
2355
|
+
n.value || u.linear && !await i() || (s.value.add(a.value), a.value++);
|
|
2346
2356
|
}
|
|
2347
|
-
function
|
|
2357
|
+
function g() {
|
|
2348
2358
|
l.value || a.value--;
|
|
2349
2359
|
}
|
|
2350
|
-
function
|
|
2351
|
-
|
|
2360
|
+
function $(m) {
|
|
2361
|
+
u.linear && m > a.value || (a.value = m);
|
|
2352
2362
|
}
|
|
2353
|
-
return (
|
|
2354
|
-
class:
|
|
2363
|
+
return (m, C) => (c(), f("div", {
|
|
2364
|
+
class: F([e.className ?? "", "space-y-6"])
|
|
2355
2365
|
}, [
|
|
2356
2366
|
p("nav", Xa, [
|
|
2357
2367
|
p("ol", el, [
|
|
2358
|
-
(c(!0), f(
|
|
2368
|
+
(c(!0), f(O, null, G(o.value, (h, y) => (c(), f("li", {
|
|
2359
2369
|
key: y,
|
|
2360
2370
|
class: "flex items-center"
|
|
2361
2371
|
}, [
|
|
@@ -2363,15 +2373,15 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2363
2373
|
type: "button",
|
|
2364
2374
|
disabled: e.linear && y > a.value,
|
|
2365
2375
|
"aria-current": y === a.value ? "step" : void 0,
|
|
2366
|
-
"aria-label": `Step ${y + 1}: ${
|
|
2367
|
-
class:
|
|
2368
|
-
|
|
2376
|
+
"aria-label": `Step ${y + 1}: ${h.title}`,
|
|
2377
|
+
class: F(["relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-xs font-semibold motion-safe:transition-all motion-safe:duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500/40", [
|
|
2378
|
+
s.value.has(y) && y !== a.value ? "border-green-500 bg-green-500 text-white" : y !== a.value ? "border-gray-300 bg-white text-gray-500" : "text-white",
|
|
2369
2379
|
e.linear && y > a.value ? "cursor-not-allowed" : "cursor-pointer hover:shadow-md"
|
|
2370
2380
|
]]),
|
|
2371
|
-
style:
|
|
2372
|
-
onClick: (
|
|
2381
|
+
style: z(y === a.value ? { borderColor: "var(--fc-color-primary, #3b82f6)", backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
2382
|
+
onClick: (A) => $(y)
|
|
2373
2383
|
}, [
|
|
2374
|
-
|
|
2384
|
+
s.value.has(y) && y !== a.value ? (c(), f("svg", al, [...C[0] || (C[0] = [
|
|
2375
2385
|
p("path", {
|
|
2376
2386
|
"fill-rule": "evenodd",
|
|
2377
2387
|
d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
|
|
@@ -2379,18 +2389,18 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2379
2389
|
}, null, -1)
|
|
2380
2390
|
])])) : (c(), f("span", ll, L(y + 1), 1))
|
|
2381
2391
|
], 14, tl),
|
|
2382
|
-
y <
|
|
2392
|
+
y < o.value.length - 1 ? (c(), f("div", {
|
|
2383
2393
|
key: 0,
|
|
2384
|
-
class:
|
|
2394
|
+
class: F(["mx-1 h-0.5 w-8 motion-safe:transition-colors motion-safe:duration-300 sm:w-12", s.value.has(y) ? "bg-green-500" : "bg-gray-200"])
|
|
2385
2395
|
}, null, 2)) : T("", !0)
|
|
2386
2396
|
]))), 128))
|
|
2387
2397
|
])
|
|
2388
2398
|
]),
|
|
2389
|
-
|
|
2390
|
-
p("h3", ol, L(
|
|
2391
|
-
|
|
2399
|
+
o.value[a.value] ? (c(), f("div", nl, [
|
|
2400
|
+
p("h3", ol, L(o.value[a.value].title), 1),
|
|
2401
|
+
o.value[a.value].description ? (c(), f("p", rl, L(o.value[a.value].description), 1)) : T("", !0)
|
|
2392
2402
|
])) : T("", !0),
|
|
2393
|
-
Z(
|
|
2403
|
+
Z(le, {
|
|
2394
2404
|
mode: "out-in",
|
|
2395
2405
|
"enter-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out",
|
|
2396
2406
|
"enter-from-class": "opacity-0 translate-x-2",
|
|
@@ -2400,9 +2410,9 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2400
2410
|
"leave-to-class": "opacity-0 -translate-x-2"
|
|
2401
2411
|
}, {
|
|
2402
2412
|
default: W(() => [
|
|
2403
|
-
|
|
2404
|
-
Z(
|
|
2405
|
-
nodes:
|
|
2413
|
+
o.value[a.value] ? (c(), f("div", { key: a.value }, [
|
|
2414
|
+
Z(re, {
|
|
2415
|
+
nodes: o.value[a.value].children
|
|
2406
2416
|
}, null, 8, ["nodes"])
|
|
2407
2417
|
])) : T("", !0)
|
|
2408
2418
|
]),
|
|
@@ -2413,7 +2423,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2413
2423
|
type: "button",
|
|
2414
2424
|
disabled: l.value,
|
|
2415
2425
|
class: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 motion-safe:transition-colors motion-safe:duration-150 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50 fc-steps-prev-btn",
|
|
2416
|
-
onClick:
|
|
2426
|
+
onClick: g
|
|
2417
2427
|
}, " Previous ", 8, il),
|
|
2418
2428
|
p("span", ul, L(a.value + 1) + " / " + L(d.value), 1),
|
|
2419
2429
|
n.value ? (c(), f("div", dl)) : (c(), f("button", {
|
|
@@ -2421,7 +2431,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2421
2431
|
type: "button",
|
|
2422
2432
|
class: "rounded-md px-4 py-2 text-sm font-medium text-white motion-safe:transition-colors motion-safe:duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500/40 fc-steps-next-btn",
|
|
2423
2433
|
style: { backgroundColor: "var(--fc-color-primary, #3b82f6)" },
|
|
2424
|
-
onClick:
|
|
2434
|
+
onClick: k
|
|
2425
2435
|
}, " Next "))
|
|
2426
2436
|
])
|
|
2427
2437
|
], 2));
|
|
@@ -2441,57 +2451,57 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2441
2451
|
className: {}
|
|
2442
2452
|
},
|
|
2443
2453
|
setup(e) {
|
|
2444
|
-
const
|
|
2445
|
-
function
|
|
2454
|
+
const u = e, t = D(0), a = x(() => u.tabs);
|
|
2455
|
+
function s(l) {
|
|
2446
2456
|
const n = a.value[l];
|
|
2447
2457
|
n != null && n.disabled || (t.value = l);
|
|
2448
2458
|
}
|
|
2449
|
-
function
|
|
2450
|
-
var
|
|
2451
|
-
const
|
|
2452
|
-
let
|
|
2459
|
+
function o(l, n) {
|
|
2460
|
+
var g;
|
|
2461
|
+
const r = a.value.length;
|
|
2462
|
+
let i = n;
|
|
2453
2463
|
if (l.key === "ArrowRight" || l.key === "ArrowDown")
|
|
2454
|
-
l.preventDefault(),
|
|
2464
|
+
l.preventDefault(), i = (n + 1) % r;
|
|
2455
2465
|
else if (l.key === "ArrowLeft" || l.key === "ArrowUp")
|
|
2456
|
-
l.preventDefault(),
|
|
2466
|
+
l.preventDefault(), i = (n - 1 + r) % r;
|
|
2457
2467
|
else if (l.key === "Home")
|
|
2458
|
-
l.preventDefault(),
|
|
2468
|
+
l.preventDefault(), i = 0;
|
|
2459
2469
|
else if (l.key === "End")
|
|
2460
|
-
l.preventDefault(),
|
|
2470
|
+
l.preventDefault(), i = r - 1;
|
|
2461
2471
|
else
|
|
2462
2472
|
return;
|
|
2463
|
-
for (; (
|
|
2464
|
-
l.key === "ArrowLeft" || l.key === "ArrowUp" ?
|
|
2465
|
-
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2473
|
+
for (; (g = a.value[i]) != null && g.disabled && i !== n; )
|
|
2474
|
+
l.key === "ArrowLeft" || l.key === "ArrowUp" ? i = (i - 1 + r) % r : i = (i + 1) % r;
|
|
2475
|
+
s(i);
|
|
2476
|
+
const k = document.getElementById(`fc-tab-${i}`);
|
|
2477
|
+
k == null || k.focus();
|
|
2468
2478
|
}
|
|
2469
|
-
const d =
|
|
2479
|
+
const d = x(() => `fc-tabpanel-${t.value}`);
|
|
2470
2480
|
return (l, n) => (c(), f("div", {
|
|
2471
|
-
class:
|
|
2481
|
+
class: F(e.className ?? "")
|
|
2472
2482
|
}, [
|
|
2473
2483
|
p("div", fl, [
|
|
2474
|
-
(c(!0), f(
|
|
2475
|
-
key:
|
|
2476
|
-
id: `fc-tab-${
|
|
2484
|
+
(c(!0), f(O, null, G(a.value, (r, i) => (c(), f("button", {
|
|
2485
|
+
key: i,
|
|
2486
|
+
id: `fc-tab-${i}`,
|
|
2477
2487
|
type: "button",
|
|
2478
2488
|
role: "tab",
|
|
2479
|
-
"aria-selected":
|
|
2489
|
+
"aria-selected": i === t.value,
|
|
2480
2490
|
"aria-controls": d.value,
|
|
2481
|
-
"aria-disabled":
|
|
2482
|
-
tabindex:
|
|
2483
|
-
class:
|
|
2484
|
-
|
|
2491
|
+
"aria-disabled": r.disabled || void 0,
|
|
2492
|
+
tabindex: i === t.value ? 0 : -1,
|
|
2493
|
+
class: F(["relative px-4 py-2.5 text-sm font-medium motion-safe:transition-colors motion-safe:duration-150 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500/40", [
|
|
2494
|
+
i !== t.value ? r.disabled ? "cursor-not-allowed text-gray-300" : "text-gray-500 hover:text-gray-700" : ""
|
|
2485
2495
|
]]),
|
|
2486
|
-
style:
|
|
2487
|
-
onClick: (
|
|
2488
|
-
onKeydown: (
|
|
2496
|
+
style: z(i === t.value ? { color: "var(--fc-color-primary, #3b82f6)" } : {}),
|
|
2497
|
+
onClick: (k) => s(i),
|
|
2498
|
+
onKeydown: (k) => o(k, i)
|
|
2489
2499
|
}, [
|
|
2490
|
-
_(L(
|
|
2491
|
-
|
|
2500
|
+
_(L(r.title) + " ", 1),
|
|
2501
|
+
i === t.value ? (c(), f("span", bl)) : T("", !0)
|
|
2492
2502
|
], 46, ml))), 128))
|
|
2493
2503
|
]),
|
|
2494
|
-
Z(
|
|
2504
|
+
Z(le, {
|
|
2495
2505
|
mode: "out-in",
|
|
2496
2506
|
"enter-active-class": "motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out",
|
|
2497
2507
|
"enter-from-class": "opacity-0 translate-y-1",
|
|
@@ -2509,7 +2519,7 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2509
2519
|
tabindex: "0",
|
|
2510
2520
|
class: "pt-4"
|
|
2511
2521
|
}, [
|
|
2512
|
-
Z(
|
|
2522
|
+
Z(re, {
|
|
2513
2523
|
nodes: a.value[t.value].children
|
|
2514
2524
|
}, null, 8, ["nodes"])
|
|
2515
2525
|
], 8, vl)) : T("", !0)
|
|
@@ -2518,36 +2528,36 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2518
2528
|
})
|
|
2519
2529
|
], 2));
|
|
2520
2530
|
}
|
|
2521
|
-
}),
|
|
2531
|
+
}), re = /* @__PURE__ */ j({
|
|
2522
2532
|
__name: "LayoutRenderer",
|
|
2523
2533
|
props: {
|
|
2524
2534
|
nodes: {}
|
|
2525
2535
|
},
|
|
2526
2536
|
setup(e) {
|
|
2527
|
-
const
|
|
2528
|
-
function t(
|
|
2529
|
-
return
|
|
2530
|
-
}
|
|
2531
|
-
function a(
|
|
2532
|
-
return
|
|
2533
|
-
}
|
|
2534
|
-
return (
|
|
2535
|
-
const d =
|
|
2536
|
-
return c(!0), f(
|
|
2537
|
-
var
|
|
2538
|
-
return c(), f(
|
|
2537
|
+
const u = q(ce);
|
|
2538
|
+
function t(s) {
|
|
2539
|
+
return u ? se(s.condition, u.values) : !0;
|
|
2540
|
+
}
|
|
2541
|
+
function a(s) {
|
|
2542
|
+
return s === "full" ? { gridColumn: "1 / -1" } : s === "auto" ? { gridColumn: "auto" } : typeof s == "number" ? { gridColumn: `span ${s} / span ${s}` } : { gridColumn: "span 12 / span 12" };
|
|
2543
|
+
}
|
|
2544
|
+
return (s, o) => {
|
|
2545
|
+
const d = je("LayoutRenderer", !0);
|
|
2546
|
+
return c(!0), f(O, null, G(e.nodes, (l, n) => {
|
|
2547
|
+
var r;
|
|
2548
|
+
return c(), f(O, { key: n }, [
|
|
2539
2549
|
H(Ce)(l) ? (c(), f("div", {
|
|
2540
2550
|
key: 0,
|
|
2541
|
-
class:
|
|
2542
|
-
style:
|
|
2551
|
+
class: F(l.className ?? ""),
|
|
2552
|
+
style: z(a(l.span))
|
|
2543
2553
|
}, [
|
|
2544
2554
|
Z($e, {
|
|
2545
2555
|
name: l.name
|
|
2546
2556
|
}, null, 8, ["name"])
|
|
2547
2557
|
], 6)) : l.type === "field" ? (c(), f("div", {
|
|
2548
2558
|
key: 1,
|
|
2549
|
-
class:
|
|
2550
|
-
style:
|
|
2559
|
+
class: F(l.className ?? ""),
|
|
2560
|
+
style: z(a(l.span))
|
|
2551
2561
|
}, [
|
|
2552
2562
|
Z($e, {
|
|
2553
2563
|
name: l.name
|
|
@@ -2583,11 +2593,11 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2583
2593
|
key: 7,
|
|
2584
2594
|
content: l.content,
|
|
2585
2595
|
"class-name": l.className
|
|
2586
|
-
}, null, 8, ["content", "class-name"])) : l.type === "conditional" ? (c(), f(
|
|
2596
|
+
}, null, 8, ["content", "class-name"])) : l.type === "conditional" ? (c(), f(O, { key: 8 }, [
|
|
2587
2597
|
t(l) ? (c(), U(d, {
|
|
2588
2598
|
key: 0,
|
|
2589
2599
|
nodes: l.children
|
|
2590
|
-
}, null, 8, ["nodes"])) : (
|
|
2600
|
+
}, null, 8, ["nodes"])) : (r = l.elseChildren) != null && r.length ? (c(), U(d, {
|
|
2591
2601
|
key: 1,
|
|
2592
2602
|
nodes: l.elseChildren
|
|
2593
2603
|
}, null, 8, ["nodes"])) : T("", !0)
|
|
@@ -2609,20 +2619,22 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2609
2619
|
key: 0,
|
|
2610
2620
|
class: "mr-2 inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent",
|
|
2611
2621
|
"aria-hidden": "true"
|
|
2612
|
-
}, $l = ["disabled"],
|
|
2622
|
+
}, $l = ["disabled"], Il = /* @__PURE__ */ j({
|
|
2613
2623
|
__name: "FormBuilder",
|
|
2614
2624
|
props: {
|
|
2615
2625
|
schema: {},
|
|
2616
2626
|
layout: {},
|
|
2617
|
-
locale: {
|
|
2618
|
-
fallbackLocale: {
|
|
2627
|
+
locale: {},
|
|
2628
|
+
fallbackLocale: {},
|
|
2619
2629
|
modelValue: {},
|
|
2620
2630
|
theme: {},
|
|
2621
2631
|
components: {}
|
|
2622
2632
|
},
|
|
2623
2633
|
emits: ["submit", "error", "update:modelValue"],
|
|
2624
|
-
setup(e, { expose:
|
|
2625
|
-
const a = e,
|
|
2634
|
+
setup(e, { expose: u, emit: t }) {
|
|
2635
|
+
const a = e, s = t, o = q(Te, void 0), d = x(() => a.theme ?? (o == null ? void 0 : o.theme)), l = x(() => a.locale ?? (o == null ? void 0 : o.locale) ?? "en"), n = x(
|
|
2636
|
+
() => a.fallbackLocale ?? (o == null ? void 0 : o.fallbackLocale) ?? "en"
|
|
2637
|
+
), r = x(() => a.components ?? (o == null ? void 0 : o.components) ?? {}), i = [
|
|
2626
2638
|
["text", La],
|
|
2627
2639
|
["number", Lt],
|
|
2628
2640
|
["textarea", Ca],
|
|
@@ -2637,125 +2649,121 @@ const lt = ["checked", "disabled", "onChange"], nt = ["aria-checked", "aria-disa
|
|
|
2637
2649
|
["tags", ka],
|
|
2638
2650
|
["phone", Gt]
|
|
2639
2651
|
];
|
|
2640
|
-
for (const [
|
|
2641
|
-
Pe(
|
|
2642
|
-
ie(
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
const d = K(), l = et(a.schema, {
|
|
2647
|
-
locale: a.locale,
|
|
2648
|
-
fallbackLocale: a.fallbackLocale
|
|
2652
|
+
for (const [b, v] of i)
|
|
2653
|
+
Pe(b) || Fe(b, v);
|
|
2654
|
+
ie(Be, r), tt(d);
|
|
2655
|
+
const k = K(), g = et(a.schema, {
|
|
2656
|
+
locale: l.value,
|
|
2657
|
+
fallbackLocale: n.value
|
|
2649
2658
|
});
|
|
2650
2659
|
if (a.modelValue)
|
|
2651
|
-
for (const [
|
|
2652
|
-
|
|
2653
|
-
|
|
2660
|
+
for (const [b, v] of Object.entries(a.modelValue))
|
|
2661
|
+
g.setFieldValue(b, v);
|
|
2662
|
+
J(
|
|
2654
2663
|
() => a.modelValue,
|
|
2655
|
-
(
|
|
2656
|
-
if (
|
|
2657
|
-
for (const [
|
|
2658
|
-
|
|
2664
|
+
(b) => {
|
|
2665
|
+
if (b)
|
|
2666
|
+
for (const [v, B] of Object.entries(b))
|
|
2667
|
+
g.values[v] !== B && g.setFieldValue(v, B);
|
|
2659
2668
|
},
|
|
2660
2669
|
{ deep: !0 }
|
|
2661
|
-
),
|
|
2662
|
-
() => ({ ...
|
|
2663
|
-
(
|
|
2664
|
-
|
|
2670
|
+
), J(
|
|
2671
|
+
() => ({ ...g.values }),
|
|
2672
|
+
(b) => {
|
|
2673
|
+
s("update:modelValue", b);
|
|
2665
2674
|
},
|
|
2666
2675
|
{ deep: !0 }
|
|
2667
|
-
),
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
const
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
return (
|
|
2703
|
-
}), $ = h(() => {
|
|
2704
|
-
var v, m;
|
|
2705
|
-
return (m = (v = a.layout) == null ? void 0 : v.nodes) != null && m.length ? a.layout.nodes : a.schema.fields;
|
|
2676
|
+
), J(l, (b) => {
|
|
2677
|
+
b && g.setLocale(b);
|
|
2678
|
+
}), Ze();
|
|
2679
|
+
const $ = x(() => {
|
|
2680
|
+
var S, N;
|
|
2681
|
+
const b = a.schema.translations;
|
|
2682
|
+
if (!b) return "";
|
|
2683
|
+
const v = b[l.value];
|
|
2684
|
+
if ((S = v == null ? void 0 : v.messages) != null && S.title) return v.messages.title;
|
|
2685
|
+
const B = b[n.value];
|
|
2686
|
+
return ((N = B == null ? void 0 : B.messages) == null ? void 0 : N.title) ?? "";
|
|
2687
|
+
}), m = x(() => {
|
|
2688
|
+
var S, N;
|
|
2689
|
+
const b = a.schema.translations;
|
|
2690
|
+
if (!b) return "";
|
|
2691
|
+
const v = b[l.value];
|
|
2692
|
+
if ((S = v == null ? void 0 : v.messages) != null && S.description) return v.messages.description;
|
|
2693
|
+
const B = b[n.value];
|
|
2694
|
+
return ((N = B == null ? void 0 : B.messages) == null ? void 0 : N.description) ?? "";
|
|
2695
|
+
}), C = x(() => {
|
|
2696
|
+
const b = a.schema.translations;
|
|
2697
|
+
if (!b) return "Submit";
|
|
2698
|
+
const v = b[l.value];
|
|
2699
|
+
if (v != null && v.submit) return v.submit;
|
|
2700
|
+
const B = b[n.value];
|
|
2701
|
+
return (B == null ? void 0 : B.submit) ?? "Submit";
|
|
2702
|
+
}), h = x(() => {
|
|
2703
|
+
const b = a.schema.translations;
|
|
2704
|
+
if (!b) return "Reset";
|
|
2705
|
+
const v = b[l.value];
|
|
2706
|
+
if (v != null && v.reset) return v.reset;
|
|
2707
|
+
const B = b[n.value];
|
|
2708
|
+
return (B == null ? void 0 : B.reset) ?? "Reset";
|
|
2709
|
+
}), y = x(() => {
|
|
2710
|
+
var b, v;
|
|
2711
|
+
return (v = (b = a.layout) == null ? void 0 : b.nodes) != null && v.length ? a.layout.nodes : a.schema.fields;
|
|
2706
2712
|
});
|
|
2707
|
-
async function
|
|
2713
|
+
async function A() {
|
|
2708
2714
|
try {
|
|
2709
|
-
await
|
|
2710
|
-
|
|
2715
|
+
await g.submit(async (b) => {
|
|
2716
|
+
s("submit", b);
|
|
2711
2717
|
});
|
|
2712
|
-
} catch (
|
|
2713
|
-
|
|
2718
|
+
} catch (b) {
|
|
2719
|
+
s("error", b);
|
|
2714
2720
|
}
|
|
2715
2721
|
}
|
|
2716
|
-
function
|
|
2717
|
-
|
|
2722
|
+
function V() {
|
|
2723
|
+
g.reset();
|
|
2718
2724
|
}
|
|
2719
|
-
return
|
|
2720
|
-
class:
|
|
2721
|
-
style:
|
|
2725
|
+
return u({ form: g }), (b, v) => (c(), f("form", {
|
|
2726
|
+
class: F([H(k).classes.value.form, "fc-form-builder"]),
|
|
2727
|
+
style: z(H(k).cssVars.value),
|
|
2722
2728
|
novalidate: "",
|
|
2723
|
-
onSubmit:
|
|
2724
|
-
onReset:
|
|
2729
|
+
onSubmit: Y(A, ["prevent"]),
|
|
2730
|
+
onReset: Y(V, ["prevent"])
|
|
2725
2731
|
}, [
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2732
|
+
$.value || m.value ? (c(), f("div", pl, [
|
|
2733
|
+
$.value ? (c(), f("h2", gl, L($.value), 1)) : T("", !0),
|
|
2734
|
+
m.value ? (c(), f("p", hl, L(m.value), 1)) : T("", !0)
|
|
2729
2735
|
])) : T("", !0),
|
|
2730
|
-
Z(
|
|
2736
|
+
Z(re, { nodes: y.value }, null, 8, ["nodes"]),
|
|
2731
2737
|
p("div", xl, [
|
|
2732
2738
|
p("button", {
|
|
2733
2739
|
type: "submit",
|
|
2734
|
-
disabled: H(
|
|
2735
|
-
class:
|
|
2740
|
+
disabled: H(g).isSubmitting.value,
|
|
2741
|
+
class: F([H(k).classes.value.button, "fc-submit-btn rounded-md px-4 py-2 text-sm font-medium text-white motion-safe:transition-colors motion-safe:duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50"]),
|
|
2736
2742
|
style: { "background-color": "var(--fc-color-primary, #3b82f6)" }
|
|
2737
2743
|
}, [
|
|
2738
|
-
H(
|
|
2739
|
-
_(" " + L(
|
|
2744
|
+
H(g).isSubmitting.value ? (c(), f("span", wl)) : T("", !0),
|
|
2745
|
+
_(" " + L(C.value), 1)
|
|
2740
2746
|
], 10, kl),
|
|
2741
2747
|
p("button", {
|
|
2742
2748
|
type: "reset",
|
|
2743
|
-
disabled: H(
|
|
2749
|
+
disabled: H(g).isSubmitting.value,
|
|
2744
2750
|
class: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 motion-safe:transition-colors motion-safe:duration-150 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50"
|
|
2745
|
-
}, L(
|
|
2751
|
+
}, L(h.value), 9, $l)
|
|
2746
2752
|
])
|
|
2747
2753
|
], 38));
|
|
2748
2754
|
}
|
|
2749
2755
|
});
|
|
2750
2756
|
export {
|
|
2751
|
-
|
|
2757
|
+
Il as FormBuilder,
|
|
2752
2758
|
Be as FormComponentsKey,
|
|
2753
2759
|
ce as FormContextKey,
|
|
2754
2760
|
ye as FormI18nKey,
|
|
2761
|
+
Te as FormaticaKey,
|
|
2762
|
+
Tl as createFormatica,
|
|
2755
2763
|
Ke as getFieldComponent,
|
|
2756
2764
|
Fl as getRegisteredFieldTypes,
|
|
2757
2765
|
Pe as hasFieldType,
|
|
2758
|
-
|
|
2766
|
+
Fe as registerFieldType,
|
|
2759
2767
|
Bl as unregisterFieldType,
|
|
2760
2768
|
et as useForm,
|
|
2761
2769
|
Ge as useFormI18n,
|