@stachelock/ui 0.6.11 → 0.6.13
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/{ImageDropzoneInput.vue_vue_type_script_setup_true_lang-Dhl2jFaM.js → ImageDropzoneInput.vue_vue_type_script_setup_true_lang-CsAclXd8.js} +31 -31
- package/dist/{SwitchInput.vue_vue_type_script_setup_true_lang-D5Es9AjF.js → SwitchInput.vue_vue_type_script_setup_true_lang-r8ZwU1Zy.js} +1 -1
- package/dist/{SwitchInputGroup.vue_vue_type_script_setup_true_lang-DigNYqVZ.js → SwitchInputGroup.vue_vue_type_script_setup_true_lang-PgsXeiig.js} +1 -1
- package/dist/components/CloudinaryImage.js +1 -1
- package/dist/index.js +6 -6
- package/dist/inputs/ImageDropzoneInput.js +1 -1
- package/dist/inputs/PhoneInput.js +97 -93
- package/dist/inputs/SwitchInput.js +1 -1
- package/dist/inputs/SwitchInputGroup.js +1 -1
- package/dist/src/components/forms/DynamicForm.d.ts +1 -1
- package/dist/src/components/inputs/SwitchInput.d.ts +1 -1
- package/dist/src/components/profile-inputs/BaseInformationInput.d.ts +6 -6
- package/dist/src/components/profile-inputs/NamesInput.d.ts +7 -4
- package/dist/src/composables/useCollectionEditor.d.ts +4 -2
- package/dist/src/composables/useFormValidation.d.ts +1 -1
- package/dist/src/types/core.d.ts +5 -5
- package/dist/src/utils/component-registry.d.ts +6 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as H, ref as y, computed as w, onMounted as J, watch as K, createElementBlock as u, openBlock as o, createCommentVNode as f, withDirectives as v, toDisplayString as m, createElementVNode as r, normalizeClass as A, createVNode as b, withCtx as
|
|
1
|
+
import { defineComponent as H, ref as y, computed as w, onMounted as J, watch as K, createElementBlock as u, openBlock as o, createCommentVNode as f, withDirectives as v, toDisplayString as m, createElementVNode as r, normalizeClass as A, createVNode as b, withCtx as L, renderSlot as Q, createTextVNode as Z, vShow as x, Fragment as ee, renderList as le, mergeProps as N, unref as U, createBlock as D } from "vue";
|
|
2
2
|
import { XCircleIcon as se, PhotoIcon as B } from "@heroicons/vue/24/solid";
|
|
3
|
-
import { _ as
|
|
3
|
+
import { _ as R } from "./FileDropzoneInput.vue_vue_type_script_setup_true_lang-BC_qN5qn.js";
|
|
4
4
|
import V from "./components/CloudinaryImage.js";
|
|
5
5
|
import O from "./components/LoadingDots.js";
|
|
6
6
|
const te = { class: "sl-space-y-2" }, ae = {
|
|
@@ -145,7 +145,7 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
145
145
|
},
|
|
146
146
|
emits: ["update:modelValue", "update:media", "clear:media"],
|
|
147
147
|
setup(t, { expose: X, emit: q }) {
|
|
148
|
-
const s = t, z = q, a = y([]), i = y("empty"), p = y(!1), h = y(!1), k = y(!1),
|
|
148
|
+
const s = t, z = q, a = y([]), i = y("empty"), p = y(!1), h = y(!1), k = y(!1), c = y(!1), F = y(""), M = y(!1), j = y(!0), S = w(() => s.disabled || h.value), W = w(() => s.acceptedFormats.map((e) => e.split("/")[1]?.toUpperCase() || e).join(", ")), Y = w(() => i.value === "loading" ? "Please be patient while we upload your file" : i.value === "uploaded" && a.value[0]?.created_at ? `Uploaded ${new Date(a.value[0].created_at).toLocaleDateString()}` : "Click to replace"), G = w(() => {
|
|
149
149
|
if (!a.value[0]?.original_file_name) return "Image";
|
|
150
150
|
const e = a.value[0].original_file_name, l = 20;
|
|
151
151
|
if (e.length <= l) return e;
|
|
@@ -162,19 +162,19 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
162
162
|
for (const g of n) {
|
|
163
163
|
i.value = "loading";
|
|
164
164
|
try {
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
s.enableMultiple ? a.value.push(
|
|
168
|
-
const
|
|
169
|
-
cloudinaryAsset:
|
|
165
|
+
const d = await s.onUpload(g, s.presetType, s.projectId);
|
|
166
|
+
if (d) {
|
|
167
|
+
s.enableMultiple ? a.value.push(d) : a.value = [d], i.value = "uploaded", j.value = !0, z("update:modelValue", s.enableMultiple ? a.value : a.value[0]);
|
|
168
|
+
const E = {
|
|
169
|
+
cloudinaryAsset: d,
|
|
170
170
|
presetType: s.presetType,
|
|
171
171
|
projectId: s.projectId
|
|
172
172
|
};
|
|
173
|
-
z("update:media",
|
|
173
|
+
z("update:media", E);
|
|
174
174
|
} else
|
|
175
175
|
throw new Error("Upload failed - no response");
|
|
176
|
-
} catch (
|
|
177
|
-
console.error("Upload error:",
|
|
176
|
+
} catch (d) {
|
|
177
|
+
console.error("Upload error:", d), F.value = (d instanceof Error ? d.message : null) || "Upload failed", i.value = "error", j.value = !1;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
} catch (l) {
|
|
@@ -189,14 +189,14 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
189
189
|
const l = e.currentTarget.getBoundingClientRect(), n = e.clientX, g = e.clientY;
|
|
190
190
|
(n < l.left || n > l.right || g < l.top || g > l.bottom) && (k.value = !1);
|
|
191
191
|
}, _ = async (e) => {
|
|
192
|
-
if (e.preventDefault(), e.stopPropagation(), k.value = !1,
|
|
192
|
+
if (e.preventDefault(), e.stopPropagation(), k.value = !1, c.value = !0, e.dataTransfer?.files && e.dataTransfer.files.length > 0)
|
|
193
193
|
try {
|
|
194
194
|
await $(e.dataTransfer.files);
|
|
195
195
|
} finally {
|
|
196
|
-
|
|
196
|
+
c.value = !1;
|
|
197
197
|
}
|
|
198
198
|
else
|
|
199
|
-
|
|
199
|
+
c.value = !1;
|
|
200
200
|
}, C = async (e) => {
|
|
201
201
|
try {
|
|
202
202
|
h.value = !0, e && s.deleteFileFromCloudinary && s.onDelete && await s.onDelete(e), e && z("clear:media", e);
|
|
@@ -228,7 +228,7 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
228
228
|
class: A(["sl-flex sl-items-center sl-justify-center sl-w-full", { "sl-h-screen": t.fullSize, "sl-mt-2": t.label }])
|
|
229
229
|
}, [
|
|
230
230
|
r("div", ne, [
|
|
231
|
-
b(
|
|
231
|
+
b(R, {
|
|
232
232
|
"enable-multiple": t.enableMultiple,
|
|
233
233
|
"onUpdate:files": $,
|
|
234
234
|
"accepted-formats": t.acceptedFormats,
|
|
@@ -237,7 +237,7 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
237
237
|
"ring-classes": I.value,
|
|
238
238
|
height: "md"
|
|
239
239
|
}, {
|
|
240
|
-
default:
|
|
240
|
+
default: L(() => [
|
|
241
241
|
Q(e.$slots, "empty-state", {}, () => [
|
|
242
242
|
l[8] || (l[8] = r("p", { class: "sl-mb-2 sl-text-sm sl-text-gray-500 dark:sl-text-slate-300" }, [
|
|
243
243
|
r("span", { class: "sl-font-semibold" }, "Click to upload"),
|
|
@@ -265,13 +265,13 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
265
265
|
}, [
|
|
266
266
|
r("button", {
|
|
267
267
|
type: "button",
|
|
268
|
-
onClick: (
|
|
269
|
-
onMouseenter: l[0] || (l[0] = (
|
|
270
|
-
onMouseleave: l[1] || (l[1] = (
|
|
268
|
+
onClick: (d) => C(n.public_id),
|
|
269
|
+
onMouseenter: l[0] || (l[0] = (d) => p.value = !0),
|
|
270
|
+
onMouseleave: l[1] || (l[1] = (d) => p.value = !1),
|
|
271
271
|
class: "sl-relative sl-rounded-lg sl-overflow-hidden focus:sl-outline-none focus:sl-ring-2 focus:sl-ring-primary-500",
|
|
272
272
|
"aria-label": "Remove image"
|
|
273
273
|
}, [
|
|
274
|
-
b(V,
|
|
274
|
+
b(V, N({
|
|
275
275
|
"public-id": n.public_id
|
|
276
276
|
}, { ref_for: !0 }, t.cloudinaryImageProps, { class: "sl-transition-transform sl-duration-200 group-hover:sl-scale-105 sl-w-full sl-h-full sl-object-cover" }), null, 16, ["public-id"]),
|
|
277
277
|
v(r("span", ce, [
|
|
@@ -282,18 +282,18 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
282
282
|
], 40, de),
|
|
283
283
|
v(r("div", fe, [
|
|
284
284
|
r("div", me, [
|
|
285
|
-
|
|
285
|
+
c.value ? f("", !0) : (o(), D(U(B), {
|
|
286
286
|
key: 0,
|
|
287
287
|
class: "sl-mx-auto sl-h-12 sl-w-12 sl-text-primary-400"
|
|
288
288
|
})),
|
|
289
|
-
|
|
289
|
+
c.value ? (o(), D(O, {
|
|
290
290
|
key: 1,
|
|
291
291
|
size: "sm"
|
|
292
292
|
})) : f("", !0),
|
|
293
|
-
r("p", pe, m(
|
|
293
|
+
r("p", pe, m(c.value ? "Uploading..." : "Drop to replace"), 1)
|
|
294
294
|
])
|
|
295
295
|
], 512), [
|
|
296
|
-
[x, k.value ||
|
|
296
|
+
[x, k.value || c.value]
|
|
297
297
|
])
|
|
298
298
|
], 32))), 128)),
|
|
299
299
|
i.value === "uploaded" && t.enableMultiple ? (o(), u("div", {
|
|
@@ -301,7 +301,7 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
301
301
|
class: A(["sl-flex sl-items-center sl-justify-center sl-w-full", { "sl-h-screen": t.fullSize }])
|
|
302
302
|
}, [
|
|
303
303
|
r("div", ge, [
|
|
304
|
-
b(
|
|
304
|
+
b(R, {
|
|
305
305
|
"enable-multiple": t.enableMultiple,
|
|
306
306
|
"onUpdate:files": $,
|
|
307
307
|
"accepted-formats": t.acceptedFormats,
|
|
@@ -310,7 +310,7 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
310
310
|
"ring-classes": I.value,
|
|
311
311
|
height: "sm"
|
|
312
312
|
}, {
|
|
313
|
-
default:
|
|
313
|
+
default: L(() => [...l[9] || (l[9] = [
|
|
314
314
|
r("p", { class: "sl-text-sm sl-text-gray-500 dark:sl-text-gray-400" }, "Add more images", -1)
|
|
315
315
|
])]),
|
|
316
316
|
_: 1
|
|
@@ -364,7 +364,7 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
364
364
|
class: "sl-w-full focus:sl-outline-none focus:sl-ring-2 focus:sl-ring-primary-600 focus:sl-ring-offset-2 sl-rounded-lg sl-overflow-hidden sl-transition-all sl-duration-200",
|
|
365
365
|
"aria-label": "Replace image"
|
|
366
366
|
}, [
|
|
367
|
-
b(V,
|
|
367
|
+
b(V, N({
|
|
368
368
|
"public-id": a.value[0]?.public_id
|
|
369
369
|
}, t.cloudinaryImageProps, { class: "sl-transition-transform sl-duration-200 group-hover:sl-scale-105 sl-w-full sl-h-full sl-object-cover" }), null, 16, ["public-id"]),
|
|
370
370
|
v(r("span", ze, " Replace ", 512), [
|
|
@@ -373,18 +373,18 @@ const te = { class: "sl-space-y-2" }, ae = {
|
|
|
373
373
|
], 32)),
|
|
374
374
|
v(r("div", Fe, [
|
|
375
375
|
r("div", Me, [
|
|
376
|
-
|
|
376
|
+
c.value ? f("", !0) : (o(), D(U(B), {
|
|
377
377
|
key: 0,
|
|
378
378
|
class: "sl-mx-auto sl-h-12 sl-w-12 sl-text-primary-400"
|
|
379
379
|
})),
|
|
380
|
-
|
|
380
|
+
c.value ? (o(), D(O, {
|
|
381
381
|
key: 1,
|
|
382
382
|
size: "sm"
|
|
383
383
|
})) : f("", !0),
|
|
384
|
-
r("p", je, m(
|
|
384
|
+
r("p", je, m(c.value ? "Uploading..." : "Drop to replace"), 1)
|
|
385
385
|
])
|
|
386
386
|
], 512), [
|
|
387
|
-
[x, k.value ||
|
|
387
|
+
[x, k.value || c.value]
|
|
388
388
|
])
|
|
389
389
|
], 32)) : f("", !0)
|
|
390
390
|
])),
|
|
@@ -45,7 +45,7 @@ const z = { class: "sl-w-full" }, U = { class: "sl-flex sl-items-center sl-justi
|
|
|
45
45
|
},
|
|
46
46
|
emits: ["update:modelValue", "blur", "focus"],
|
|
47
47
|
setup(e, { expose: L, emit: T }) {
|
|
48
|
-
const s = e, f = T, u = g(), m = I(`sl-${s.name}`), { value: C, errorMessage: F, handleChange: y, handleBlur: H, meta: x } = O(
|
|
48
|
+
const s = e, f = T, u = g(null), m = I(`sl-${s.name}`), { value: C, errorMessage: F, handleChange: y, handleBlur: H, meta: x } = O(
|
|
49
49
|
() => s.name,
|
|
50
50
|
s.rules,
|
|
51
51
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as D, ref as U, watch as y, createElementBlock as a, openBlock as t, createElementVNode as C, createCommentVNode as r, toDisplayString as c, normalizeClass as v, Fragment as g, renderList as b, createVNode as p } from "vue";
|
|
2
|
-
import { _ as f } from "./SwitchInput.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { _ as f } from "./SwitchInput.vue_vue_type_script_setup_true_lang-r8ZwU1Zy.js";
|
|
3
3
|
const L = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "sl-bg-white dark:sl-bg-slate-800 sl-shadow sm:sl-rounded-lg sl-w-full",
|
|
@@ -158,7 +158,7 @@ const J = { class: "sl-flex sl-h-full sl-w-full sl-items-center sl-justify-cente
|
|
|
158
158
|
]) : O("", !0)
|
|
159
159
|
], 6));
|
|
160
160
|
}
|
|
161
|
-
}), te = /* @__PURE__ */ H(X, [["__scopeId", "data-v-
|
|
161
|
+
}), te = /* @__PURE__ */ H(X, [["__scopeId", "data-v-c1961485"]]);
|
|
162
162
|
export {
|
|
163
163
|
te as default
|
|
164
164
|
};
|
package/dist/index.js
CHANGED
|
@@ -58,12 +58,12 @@ import { _ as ud } from "./EmailInput.vue_vue_type_script_setup_true_lang-59bDl9
|
|
|
58
58
|
import { _ as fd } from "./EmptyInput.vue_vue_type_script_setup_true_lang-FWDCFF2c.js";
|
|
59
59
|
import { _ as gd } from "./FileDropzoneInput.vue_vue_type_script_setup_true_lang-BC_qN5qn.js";
|
|
60
60
|
import { _ as yd } from "./HiddenInput.vue_vue_type_script_setup_true_lang-PtGZ4eLW.js";
|
|
61
|
-
import { _ as vd } from "./ImageDropzoneInput.vue_vue_type_script_setup_true_lang-
|
|
61
|
+
import { _ as vd } from "./ImageDropzoneInput.vue_vue_type_script_setup_true_lang-CsAclXd8.js";
|
|
62
62
|
import { _ as mt } from "./TextAreaInput.vue_vue_type_script_setup_true_lang-Dtf7H1sT.js";
|
|
63
|
-
import { _ as ft } from "./SwitchInput.vue_vue_type_script_setup_true_lang-
|
|
63
|
+
import { _ as ft } from "./SwitchInput.vue_vue_type_script_setup_true_lang-r8ZwU1Zy.js";
|
|
64
64
|
import { _ as ke } from "./SelectInput.vue_vue_type_script_setup_true_lang-DEaP3bhC.js";
|
|
65
65
|
import { _ as kd } from "./SelectTextInput.vue_vue_type_script_setup_true_lang-DYlrRigi.js";
|
|
66
|
-
import { _ as $d } from "./SwitchInputGroup.vue_vue_type_script_setup_true_lang-
|
|
66
|
+
import { _ as $d } from "./SwitchInputGroup.vue_vue_type_script_setup_true_lang-PgsXeiig.js";
|
|
67
67
|
import { _ as Cd } from "./TagifyInput.vue_vue_type_script_setup_true_lang-CwxJ2x1x.js";
|
|
68
68
|
import { _ as Sd } from "./DashboardLayout.vue_vue_type_script_setup_true_lang-BAx4gKqh.js";
|
|
69
69
|
import { _ as Td } from "./DefaultLayout.vue_vue_type_script_setup_true_lang-BZAz6aC-.js";
|
|
@@ -1244,7 +1244,7 @@ const jt = { class: "sl-fixed sl-inset-0 sl-z-10 sl-w-screen sl-overflow-y-auto"
|
|
|
1244
1244
|
}, null, 8, ["title", "description", "onClose"])) : w("", !0)
|
|
1245
1245
|
]));
|
|
1246
1246
|
}
|
|
1247
|
-
}), ye = /* @__PURE__ */ W(js, [["__scopeId", "data-v-
|
|
1247
|
+
}), ye = /* @__PURE__ */ W(js, [["__scopeId", "data-v-2dd7ddec"]]), Vs = { class: "sl-py-1 sl-text-sm sl-leading-5 sl-text-gray-600 dark:sl-text-gray-300" }, Bs = { class: "sl-text-xs sl-text-gray-500 dark:sl-text-gray-400" }, fn = /* @__PURE__ */ B({
|
|
1248
1248
|
__name: "OrganizationsEditor",
|
|
1249
1249
|
props: {
|
|
1250
1250
|
name: {},
|
|
@@ -3697,7 +3697,7 @@ const Wl = /* @__PURE__ */ W(Ol, [["render", Hl]]), ql = { class: "sl-bg-white s
|
|
|
3697
3697
|
return (l, c) => (a(), u("div", mo, [
|
|
3698
3698
|
c[4] || (c[4] = s("div", { class: "sl-absolute sl-inset-0 sl-bg-gray-50 dark:sl-bg-gray-900 sl--z-10" }, null, -1)),
|
|
3699
3699
|
s("div", fo, [
|
|
3700
|
-
c[3] || (c[3] = Je('<div class="sl-rounded-2xl sl-bg-gradient-to-r sl-from-primary-600 sl-to-primary-700 sl-p-6 sl-animate-pulse" data-v-
|
|
3700
|
+
c[3] || (c[3] = Je('<div class="sl-rounded-2xl sl-bg-gradient-to-r sl-from-primary-600 sl-to-primary-700 sl-p-6 sl-animate-pulse" data-v-8fcac1e1><div class="sl-flex sl-items-center sl-gap-4" data-v-8fcac1e1><div class="sl-w-20 sl-h-20 sl-rounded-full sl-bg-white/20" data-v-8fcac1e1></div><div class="sl-space-y-2" data-v-8fcac1e1><div class="sl-h-6 sl-w-48 sl-bg-white/20 sl-rounded" data-v-8fcac1e1></div><div class="sl-h-4 sl-w-24 sl-bg-white/20 sl-rounded" data-v-8fcac1e1></div></div></div></div>', 1)),
|
|
3701
3701
|
s("div", {
|
|
3702
3702
|
class: M([
|
|
3703
3703
|
"sl-grid sl-gap-6",
|
|
@@ -3797,7 +3797,7 @@ const Wl = /* @__PURE__ */ W(Ol, [["render", Hl]]), ql = { class: "sl-bg-white s
|
|
|
3797
3797
|
])
|
|
3798
3798
|
]));
|
|
3799
3799
|
}
|
|
3800
|
-
}), zn = /* @__PURE__ */ W(_o, [["__scopeId", "data-v-
|
|
3800
|
+
}), zn = /* @__PURE__ */ W(_o, [["__scopeId", "data-v-8fcac1e1"]]);
|
|
3801
3801
|
class Co {
|
|
3802
3802
|
designTokens;
|
|
3803
3803
|
prefix = "sl-";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Pe, inject as Le, ref as f, computed as i, toRef as Re, watch as
|
|
1
|
+
import { defineComponent as Pe, inject as Le, ref as f, computed as i, toRef as Re, watch as B, nextTick as ie, onMounted as Te, onUnmounted as Ae, createBlock as R, openBlock as C, unref as b, withCtx as T, createElementVNode as u, normalizeClass as I, createVNode as D, createElementBlock as Y, createCommentVNode as U, renderSlot as Me, toDisplayString as W, Teleport as Be, Transition as De, normalizeStyle as Ue, withDirectives as Fe, withModifiers as Z, vModelText as He, Fragment as Ge, renderList as Ke, withKeys as qe } from "vue";
|
|
2
2
|
import { useField as Ye } from "vee-validate";
|
|
3
3
|
import { Listbox as je, ListboxButton as ze, ListboxOptions as $e, ListboxOption as _e } from "@headlessui/vue";
|
|
4
4
|
import { ChevronDownIcon as We, CheckIcon as Ze, ExclamationCircleIcon as Je, CheckCircleIcon as Xe } from "@heroicons/vue/20/solid";
|
|
@@ -74,12 +74,12 @@ const E = {
|
|
|
74
74
|
TR: { code: "TR", name: "Turkey", dialCode: "+90" },
|
|
75
75
|
PK: { code: "PK", name: "Pakistan", dialCode: "+92" }
|
|
76
76
|
}, ue = Object.values(E).sort(
|
|
77
|
-
(a,
|
|
77
|
+
(a, r) => a.name.localeCompare(r.name)
|
|
78
78
|
);
|
|
79
79
|
function sa(a) {
|
|
80
80
|
return E[a]?.dialCode ?? "+1";
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function V(a, r, v = {}) {
|
|
83
83
|
const { required: l = !1 } = v;
|
|
84
84
|
if (!a || a.trim() === "")
|
|
85
85
|
return l ? {
|
|
@@ -101,27 +101,27 @@ function T(a, s, v = {}) {
|
|
|
101
101
|
errorCode: "TOO_SHORT"
|
|
102
102
|
};
|
|
103
103
|
try {
|
|
104
|
-
const p = new X(
|
|
104
|
+
const p = new X(r);
|
|
105
105
|
p.input(n);
|
|
106
106
|
const y = p.getNumber();
|
|
107
107
|
if (!y)
|
|
108
108
|
return {
|
|
109
109
|
isValid: !1,
|
|
110
|
-
errorMessage: `Invalid format for ${E[
|
|
110
|
+
errorMessage: `Invalid format for ${E[r]?.name || "selected country"}`,
|
|
111
111
|
errorCode: "INVALID_FORMAT"
|
|
112
112
|
};
|
|
113
113
|
if (!y.isPossible())
|
|
114
114
|
return {
|
|
115
115
|
isValid: !1,
|
|
116
|
-
errorMessage: `Not a possible phone number for ${E[
|
|
116
|
+
errorMessage: `Not a possible phone number for ${E[r]?.name || "this country"}`,
|
|
117
117
|
errorCode: "NOT_POSSIBLE"
|
|
118
118
|
};
|
|
119
119
|
const w = la(
|
|
120
120
|
y.nationalNumber || n,
|
|
121
|
-
|
|
121
|
+
r
|
|
122
122
|
);
|
|
123
123
|
if (w) {
|
|
124
|
-
const S = E[
|
|
124
|
+
const S = E[r]?.name || "this country", k = {
|
|
125
125
|
INVALID_COUNTRY: { message: "Invalid country code", code: "INVALID_COUNTRY" },
|
|
126
126
|
TOO_SHORT: { message: `Phone number is too short for ${S}`, code: "TOO_SHORT" },
|
|
127
127
|
INVALID_LENGTH: { message: `Invalid phone number length for ${S}`, code: "INVALID_LENGTH" },
|
|
@@ -148,10 +148,10 @@ function T(a, s, v = {}) {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
function ra(a,
|
|
151
|
+
function ra(a, r = "US") {
|
|
152
152
|
if (!a) return "";
|
|
153
153
|
try {
|
|
154
|
-
const v = new X(
|
|
154
|
+
const v = new X(r);
|
|
155
155
|
v.input(a);
|
|
156
156
|
const l = v.getNumber();
|
|
157
157
|
return l ? l.formatNational() : a.replace(/^\+[0-9]{1,3}/, "").trim();
|
|
@@ -159,11 +159,11 @@ function ra(a, s = "US") {
|
|
|
159
159
|
return console.error("Error formatting phone number:", v), a || "";
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
function J(a,
|
|
162
|
+
function J(a, r = "US") {
|
|
163
163
|
if (!a)
|
|
164
164
|
return { formatted: "", numberObject: void 0 };
|
|
165
165
|
try {
|
|
166
|
-
const v = a.replace(/(?!^\+)[^0-9]/g, ""), l = new X(
|
|
166
|
+
const v = a.replace(/(?!^\+)[^0-9]/g, ""), l = new X(r), n = l.input(v), h = l.getNumber();
|
|
167
167
|
return { formatted: n, numberObject: h };
|
|
168
168
|
} catch (v) {
|
|
169
169
|
return console.error("Error formatting phone number:", v), { formatted: a, numberObject: void 0 };
|
|
@@ -172,9 +172,9 @@ function J(a, s = "US") {
|
|
|
172
172
|
function ce(a) {
|
|
173
173
|
if (!(!a || !a.startsWith("+")))
|
|
174
174
|
try {
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
return
|
|
175
|
+
const r = ta(a);
|
|
176
|
+
if (r?.country)
|
|
177
|
+
return r.country;
|
|
178
178
|
} catch {
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -278,10 +278,10 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
278
278
|
}
|
|
279
279
|
},
|
|
280
280
|
emits: ["update:modelValue", "update:value", "update:country", "update-metadata", "submit", "focus", "blur", "validated"],
|
|
281
|
-
setup(a, { expose:
|
|
282
|
-
const l = a, n = v, h = Le("phoneInput", {}), p = f(null), y = f(null), w = f(null), S = f(null),
|
|
281
|
+
setup(a, { expose: r, emit: v }) {
|
|
282
|
+
const l = a, n = v, h = Le("phoneInput", {}), p = f(null), y = f(null), w = f(null), S = f(null), F = f({ top: 0, left: 0 }), k = i(() => ea(l.name)), j = Re(l, "name"), Q = i(() => l.modelValue ?? l.value ?? ""), s = f(
|
|
283
283
|
l.defaultCountry || h.defaultCountry || "US"
|
|
284
|
-
),
|
|
284
|
+
), O = f(""), c = f(""), m = f(""), H = f(""), N = f(!1), ee = f(!1), {
|
|
285
285
|
meta: A,
|
|
286
286
|
errorMessage: me,
|
|
287
287
|
handleBlur: fe,
|
|
@@ -289,34 +289,34 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
289
289
|
setTouched: ve
|
|
290
290
|
} = Ye(j, l.rules, {
|
|
291
291
|
initialValue: Q.value
|
|
292
|
-
}), le = i(() => E[
|
|
292
|
+
}), le = i(() => E[s.value] || E.US), ge = i(() => l.required ? !1 : aa(l.rules)), z = i({
|
|
293
293
|
get: () => le.value,
|
|
294
294
|
set: (e) => {
|
|
295
|
-
e && e.code !==
|
|
295
|
+
e && e.code !== s.value && de(e.code);
|
|
296
296
|
}
|
|
297
|
-
}), he = i(() => sa(
|
|
298
|
-
top: `${
|
|
299
|
-
left: `${
|
|
297
|
+
}), he = i(() => sa(s.value)), pe = i(() => l.placeholder || da(s.value)), $ = i(() => H.value || me.value), G = i(() => !!$.value && (A.touched || l.showErrors)), Ce = i(() => (G.value || N.value && l.colorfulValidation) && (A.touched || l.showErrors)), te = i(() => N.value && !!c.value && !H.value && l.colorfulValidation), ye = i(() => l.disabled ? "sl-ring-gray-200 dark:sl-ring-slate-600" : G.value ? "sl-ring-red-500 focus-within:sl-ring-red-500" : te.value && l.colorfulValidation ? "sl-ring-green-500 focus-within:sl-ring-green-500" : "sl-ring-gray-300 dark:sl-ring-slate-600 focus-within:sl-ring-primary-600"), be = i(() => ({
|
|
298
|
+
top: `${F.value.top}px`,
|
|
299
|
+
left: `${F.value.left}px`
|
|
300
300
|
})), oe = async () => {
|
|
301
301
|
if (await ie(), w.value) {
|
|
302
302
|
const e = w.value.getBoundingClientRect();
|
|
303
|
-
|
|
303
|
+
F.value = {
|
|
304
304
|
top: e.bottom + window.scrollY + 4,
|
|
305
305
|
// 4px gap, account for scroll
|
|
306
306
|
left: e.left + window.scrollX
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
},
|
|
312
|
-
|
|
309
|
+
}, K = () => {
|
|
310
|
+
P.value && oe();
|
|
311
|
+
}, P = f(!1), we = () => {
|
|
312
|
+
P.value = !P.value, P.value && oe();
|
|
313
313
|
};
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
B(z, () => {
|
|
315
|
+
P.value = !1;
|
|
316
316
|
});
|
|
317
317
|
const se = (e) => {
|
|
318
318
|
const o = e.target;
|
|
319
|
-
w.value && !w.value.contains(o) && !o.closest('[role="listbox"]') && (
|
|
319
|
+
w.value && !w.value.contains(o) && !o.closest('[role="listbox"]') && (P.value = !1);
|
|
320
320
|
}, xe = i(() => {
|
|
321
321
|
const e = [];
|
|
322
322
|
return $.value && e.push(`${k.value}-error`), l.hint && e.push(`${k.value}-hint`), e.length > 0 ? e.join(" ") : void 0;
|
|
@@ -332,8 +332,8 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
332
332
|
}
|
|
333
333
|
if (h.excludedCountries?.length && (e = e.filter(
|
|
334
334
|
(t) => !h.excludedCountries.includes(t.code)
|
|
335
|
-
)), !
|
|
336
|
-
const o =
|
|
335
|
+
)), !O.value) return e;
|
|
336
|
+
const o = O.value.toLowerCase();
|
|
337
337
|
return e.filter(
|
|
338
338
|
(t) => t.name.toLowerCase().includes(o) || t.dialCode.includes(o) || t.code.toLowerCase().includes(o)
|
|
339
339
|
);
|
|
@@ -341,22 +341,22 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
341
341
|
const o = e.target;
|
|
342
342
|
o.src = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239ca3af"%3E%3Cpath d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/%3E%3C/svg%3E';
|
|
343
343
|
}, de = (e) => {
|
|
344
|
-
if (
|
|
344
|
+
if (s.value = e, O.value = "", n("update:country", e), ee.value && c.value) {
|
|
345
345
|
const { formatted: o, numberObject: t } = J(c.value, e);
|
|
346
|
-
c.value = o, t?.number && (m.value = t.number,
|
|
347
|
-
const d =
|
|
348
|
-
|
|
346
|
+
c.value = o, t?.number && (m.value = t.number, L(t.number));
|
|
347
|
+
const d = V(c.value, e, { required: l.required });
|
|
348
|
+
M(d);
|
|
349
349
|
}
|
|
350
350
|
ie(() => {
|
|
351
351
|
p.value?.focus();
|
|
352
352
|
});
|
|
353
|
-
},
|
|
354
|
-
N.value = e.isValid,
|
|
353
|
+
}, M = (e) => {
|
|
354
|
+
N.value = e.isValid, H.value = e.errorMessage || "", n("validated", e), n("update-metadata", {
|
|
355
355
|
dirty: A.dirty,
|
|
356
356
|
valid: e.isValid,
|
|
357
357
|
e164: e.e164
|
|
358
358
|
});
|
|
359
|
-
},
|
|
359
|
+
}, L = (e) => {
|
|
360
360
|
n("update:modelValue", e), n("update:value", e);
|
|
361
361
|
}, Ee = (e) => {
|
|
362
362
|
const o = e.target, t = o.value;
|
|
@@ -364,66 +364,70 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
364
364
|
(q) => q.name.toLowerCase() === t.toLowerCase() || q.code.toLowerCase() === t.toLowerCase()
|
|
365
365
|
)) return;
|
|
366
366
|
if (!t.trim()) {
|
|
367
|
-
c.value = "", m.value = "",
|
|
368
|
-
const q =
|
|
369
|
-
|
|
367
|
+
c.value = "", m.value = "", L(""), ae(e);
|
|
368
|
+
const q = V("", s.value, { required: l.required });
|
|
369
|
+
M(q);
|
|
370
370
|
return;
|
|
371
371
|
}
|
|
372
|
-
const { formatted: g, numberObject: x } = J(t,
|
|
373
|
-
c.value = g, o.value = g, x?.number ? (m.value = x.number,
|
|
374
|
-
const Oe =
|
|
375
|
-
|
|
372
|
+
const { formatted: g, numberObject: x } = J(t, s.value);
|
|
373
|
+
c.value = g, o.value = g, x?.number ? (m.value = x.number, L(x.number)) : (m.value = "", L(""));
|
|
374
|
+
const Oe = V(g, s.value, { required: l.required });
|
|
375
|
+
M(Oe), ae(e);
|
|
376
376
|
}, Se = async (e) => {
|
|
377
377
|
e.preventDefault();
|
|
378
378
|
const o = e.clipboardData?.getData("text") || "";
|
|
379
379
|
if (!o) return;
|
|
380
380
|
if (l.autoDetectCountry && o.startsWith("+")) {
|
|
381
381
|
const x = ce(o);
|
|
382
|
-
x && x !==
|
|
382
|
+
x && x !== s.value && (s.value = x, n("update:country", x));
|
|
383
383
|
}
|
|
384
|
-
const { formatted: t, numberObject: d } = J(o,
|
|
385
|
-
c.value = t, p.value && (p.value.value = t), d?.number ? (m.value = d.number,
|
|
386
|
-
const g =
|
|
387
|
-
|
|
384
|
+
const { formatted: t, numberObject: d } = J(o, s.value);
|
|
385
|
+
c.value = t, p.value && (p.value.value = t), d?.number ? (m.value = d.number, L(d.number)) : (m.value = "", L(""));
|
|
386
|
+
const g = V(t, s.value, { required: l.required });
|
|
387
|
+
M(g);
|
|
388
388
|
}, ke = (e) => {
|
|
389
|
-
fe(e), ve(!0),
|
|
389
|
+
if (fe(e), ve(!0), !c.value.trim()) {
|
|
390
|
+
const o = V("", s.value, { required: l.required });
|
|
391
|
+
M(o);
|
|
392
|
+
}
|
|
393
|
+
n("blur");
|
|
390
394
|
}, Ne = () => {
|
|
391
395
|
n("focus");
|
|
392
396
|
}, Ve = () => {
|
|
393
397
|
A.valid && N.value && m.value && n("submit");
|
|
394
398
|
}, _ = (e) => {
|
|
395
399
|
if (!e) {
|
|
396
|
-
c.value = "", m.value = "", N.value = !l.required,
|
|
400
|
+
c.value = "", m.value = "", N.value = !l.required, H.value = "";
|
|
397
401
|
return;
|
|
398
402
|
}
|
|
399
403
|
if (l.autoDetectCountry && e.startsWith("+")) {
|
|
400
404
|
const d = ce(e);
|
|
401
|
-
d && (
|
|
405
|
+
d && (s.value = d, n("update:country", d));
|
|
402
406
|
}
|
|
403
|
-
const o = ra(e,
|
|
407
|
+
const o = ra(e, s.value);
|
|
404
408
|
c.value = o, m.value = e.startsWith("+") ? e : "";
|
|
405
|
-
const t =
|
|
409
|
+
const t = V(o, s.value, { required: l.required });
|
|
406
410
|
N.value = t.isValid, t.e164 && (m.value = t.e164);
|
|
407
411
|
};
|
|
408
|
-
return
|
|
412
|
+
return r({
|
|
409
413
|
focus: () => p.value?.focus(),
|
|
410
414
|
blur: () => p.value?.blur(),
|
|
411
|
-
validate: () =>
|
|
415
|
+
validate: () => V(c.value, s.value, { required: l.required }),
|
|
412
416
|
getE164: () => m.value,
|
|
413
|
-
getCountry: () =>
|
|
417
|
+
getCountry: () => s.value,
|
|
414
418
|
setCountry: (e) => de(e)
|
|
415
419
|
}), Te(() => {
|
|
416
|
-
ee.value = !0, _(Q.value), window.addEventListener("scroll",
|
|
420
|
+
ee.value = !0, _(Q.value), window.addEventListener("scroll", K, !0), window.addEventListener("resize", K), document.addEventListener("click", se);
|
|
417
421
|
}), Ae(() => {
|
|
418
|
-
window.removeEventListener("scroll",
|
|
419
|
-
}),
|
|
422
|
+
window.removeEventListener("scroll", K, !0), window.removeEventListener("resize", K), document.removeEventListener("click", se);
|
|
423
|
+
}), B(() => l.modelValue, (e) => {
|
|
420
424
|
e !== m.value && _(e);
|
|
421
|
-
}, { immediate: !1 }),
|
|
425
|
+
}, { immediate: !1 }), B(() => l.value, (e) => {
|
|
422
426
|
e !== m.value && _(e);
|
|
423
|
-
}, { immediate: !1 }),
|
|
424
|
-
e && !c.value && (
|
|
425
|
-
}),
|
|
426
|
-
}), (e, o) => (C(),
|
|
427
|
+
}, { immediate: !1 }), B(() => l.defaultCountry, (e) => {
|
|
428
|
+
e && !c.value && (s.value = e);
|
|
429
|
+
}), B(O, () => {
|
|
430
|
+
}), (e, o) => (C(), R(Qe, {
|
|
427
431
|
id: k.value,
|
|
428
432
|
name: j.value,
|
|
429
433
|
label: a.label,
|
|
@@ -439,27 +443,27 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
439
443
|
"disabled-message": a.disabledMessage,
|
|
440
444
|
"colorful-validation": a.colorfulValidation
|
|
441
445
|
}, {
|
|
442
|
-
default:
|
|
446
|
+
default: T(() => [
|
|
443
447
|
u("div", {
|
|
444
448
|
class: I(["sl-flex sl-rounded-md sl-ring-1 sl-ring-inset", [
|
|
445
449
|
ye.value,
|
|
446
450
|
a.disabled ? "sl-bg-gray-50 dark:sl-bg-slate-800 sl-shadow-none" : "sl-bg-white dark:sl-bg-slate-800 sl-shadow-sm focus-within:sl-ring-2 focus-within:sl-ring-inset"
|
|
447
451
|
]])
|
|
448
452
|
}, [
|
|
449
|
-
|
|
453
|
+
D(b(je), {
|
|
450
454
|
modelValue: z.value,
|
|
451
455
|
"onUpdate:modelValue": o[3] || (o[3] = (t) => z.value = t),
|
|
452
456
|
disabled: a.disabled,
|
|
453
457
|
as: "div",
|
|
454
458
|
class: "sl-relative sl-flex-shrink-0"
|
|
455
459
|
}, {
|
|
456
|
-
default:
|
|
460
|
+
default: T(() => [
|
|
457
461
|
u("div", {
|
|
458
462
|
ref_key: "countryButtonRef",
|
|
459
463
|
ref: w,
|
|
460
464
|
class: "sl-h-full"
|
|
461
465
|
}, [
|
|
462
|
-
|
|
466
|
+
D(b(ze), {
|
|
463
467
|
disabled: a.disabled,
|
|
464
468
|
class: I(["sl-flex sl-items-center sl-gap-1.5 sl-h-full sl-pl-3 sl-pr-2 sl-border-r sl-text-sm focus:sl-outline-none sl-transition-colors", [
|
|
465
469
|
a.disabled ? "sl-text-gray-400 dark:sl-text-gray-300 sl-cursor-not-allowed sl-border-gray-200 dark:sl-border-slate-600 sl-bg-transparent" : "sl-text-gray-700 dark:sl-text-gray-100 sl-border-gray-300 dark:sl-border-slate-600 hover:sl-bg-gray-50 dark:hover:sl-bg-slate-700 sl-cursor-pointer"
|
|
@@ -467,19 +471,19 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
467
471
|
"data-testid": "country-selector",
|
|
468
472
|
onClick: we
|
|
469
473
|
}, {
|
|
470
|
-
default:
|
|
474
|
+
default: T(() => [
|
|
471
475
|
u("span", {
|
|
472
476
|
class: I(["sl-w-5 sl-h-5 sl-rounded-full sl-overflow-hidden sl-flex-shrink-0 sl-shadow-sm", a.disabled ? "sl-opacity-60 sl-bg-gray-200" : "sl-bg-gray-100"])
|
|
473
477
|
}, [
|
|
474
478
|
u("img", {
|
|
475
|
-
src: ne(
|
|
479
|
+
src: ne(s.value),
|
|
476
480
|
alt: le.value.name,
|
|
477
481
|
class: I(["sl-w-full sl-h-full sl-object-cover", { "sl-grayscale sl-opacity-75": a.disabled }]),
|
|
478
482
|
onError: Ie
|
|
479
483
|
}, null, 42, ia)
|
|
480
484
|
], 2),
|
|
481
485
|
u("span", ua, W(he.value), 1),
|
|
482
|
-
a.disabled ?
|
|
486
|
+
a.disabled ? U("", !0) : (C(), R(b(We), {
|
|
483
487
|
key: 0,
|
|
484
488
|
class: "sl-h-4 sl-w-4 sl-text-gray-400",
|
|
485
489
|
"aria-hidden": "true"
|
|
@@ -488,8 +492,8 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
488
492
|
_: 1
|
|
489
493
|
}, 8, ["disabled", "class"])
|
|
490
494
|
], 512),
|
|
491
|
-
(C(),
|
|
492
|
-
|
|
495
|
+
(C(), R(Be, { to: "body" }, [
|
|
496
|
+
D(De, {
|
|
493
497
|
"enter-active-class": "sl-transition sl-duration-100 sl-ease-out",
|
|
494
498
|
"enter-from-class": "sl-transform sl-scale-95 sl-opacity-0",
|
|
495
499
|
"enter-to-class": "sl-transform sl-scale-100 sl-opacity-100",
|
|
@@ -497,19 +501,19 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
497
501
|
"leave-from-class": "sl-transform sl-scale-100 sl-opacity-100",
|
|
498
502
|
"leave-to-class": "sl-transform sl-scale-95 sl-opacity-0"
|
|
499
503
|
}, {
|
|
500
|
-
default:
|
|
501
|
-
|
|
504
|
+
default: T(() => [
|
|
505
|
+
D(b($e), {
|
|
502
506
|
ref_key: "dropdownRef",
|
|
503
507
|
ref: S,
|
|
504
508
|
style: Ue([be.value, { "z-index": "9999" }]),
|
|
505
509
|
class: "sl-fixed sl-w-72 sl-rounded-lg sl-bg-white dark:sl-bg-slate-800 sl-text-sm sl-shadow-xl sl-ring-1 sl-ring-black dark:sl-ring-slate-600 sl-ring-opacity-5 focus:sl-outline-none sl-overflow-hidden"
|
|
506
510
|
}, {
|
|
507
|
-
default:
|
|
511
|
+
default: T(() => [
|
|
508
512
|
u("div", ca, [
|
|
509
513
|
Fe(u("input", {
|
|
510
514
|
ref_key: "searchInputRef",
|
|
511
515
|
ref: y,
|
|
512
|
-
"onUpdate:modelValue": o[0] || (o[0] = (t) =>
|
|
516
|
+
"onUpdate:modelValue": o[0] || (o[0] = (t) => O.value = t),
|
|
513
517
|
type: "text",
|
|
514
518
|
class: "sl-w-full sl-px-3 sl-py-1.5 sl-text-sm sl-border sl-border-gray-300 dark:sl-border-slate-600 sl-rounded-md sl-bg-white dark:sl-bg-slate-700 sl-text-gray-900 dark:sl-text-gray-100 focus:sl-outline-none focus:sl-ring-2 focus:sl-ring-primary-500 focus:sl-border-primary-500",
|
|
515
519
|
placeholder: "Search countries...",
|
|
@@ -518,16 +522,16 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
518
522
|
onKeydown: o[2] || (o[2] = Z(() => {
|
|
519
523
|
}, ["stop"]))
|
|
520
524
|
}, null, 544), [
|
|
521
|
-
[He,
|
|
525
|
+
[He, O.value]
|
|
522
526
|
])
|
|
523
527
|
]),
|
|
524
528
|
u("div", ma, [
|
|
525
|
-
(C(!0), Y(Ge, null, Ke(re.value, (t) => (C(),
|
|
529
|
+
(C(!0), Y(Ge, null, Ke(re.value, (t) => (C(), R(b(_e), {
|
|
526
530
|
key: t.code,
|
|
527
531
|
value: t,
|
|
528
532
|
as: "template"
|
|
529
533
|
}, {
|
|
530
|
-
default:
|
|
534
|
+
default: T(({ active: d, selected: g }) => [
|
|
531
535
|
u("li", {
|
|
532
536
|
class: I([
|
|
533
537
|
"sl-relative sl-cursor-pointer sl-select-none sl-py-2 sl-pl-3 sl-pr-9",
|
|
@@ -556,16 +560,16 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
556
560
|
d ? "sl-text-white" : "sl-text-primary-600"
|
|
557
561
|
])
|
|
558
562
|
}, [
|
|
559
|
-
|
|
563
|
+
D(b(Ze), {
|
|
560
564
|
class: "sl-h-5 sl-w-5",
|
|
561
565
|
"aria-hidden": "true"
|
|
562
566
|
})
|
|
563
|
-
], 2)) :
|
|
567
|
+
], 2)) : U("", !0)
|
|
564
568
|
], 2)
|
|
565
569
|
]),
|
|
566
570
|
_: 2
|
|
567
571
|
}, 1032, ["value"]))), 128)),
|
|
568
|
-
re.value.length === 0 ? (C(), Y("li", pa, " No countries found ")) :
|
|
572
|
+
re.value.length === 0 ? (C(), Y("li", pa, " No countries found ")) : U("", !0)
|
|
569
573
|
])
|
|
570
574
|
]),
|
|
571
575
|
_: 1
|
|
@@ -590,7 +594,7 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
590
594
|
enterkeyhint: "go",
|
|
591
595
|
disabled: a.disabled,
|
|
592
596
|
"aria-describedby": xe.value,
|
|
593
|
-
"aria-invalid":
|
|
597
|
+
"aria-invalid": G.value,
|
|
594
598
|
class: I(["sl-block sl-flex-1 sl-min-w-0 sl-border-0 sl-bg-transparent sl-py-1.5 sl-pl-2 sl-pr-3 focus:sl-ring-0 focus:sl-outline-none sm:sl-text-sm sm:sl-leading-6", [
|
|
595
599
|
a.disabled ? "sl-text-gray-400 dark:sl-text-gray-300 sl-cursor-not-allowed placeholder:sl-text-gray-300 dark:placeholder:sl-text-slate-500" : "sl-text-gray-800 dark:sl-text-gray-100 placeholder:sl-text-gray-400 dark:placeholder:sl-text-slate-500"
|
|
596
600
|
]]),
|
|
@@ -602,25 +606,25 @@ const ia = ["src", "alt"], ua = { class: "sl-font-medium" }, ca = { class: "sl-b
|
|
|
602
606
|
"data-testid": "phone-input"
|
|
603
607
|
}, null, 42, Ca),
|
|
604
608
|
Ce.value ? (C(), Y("div", ya, [
|
|
605
|
-
|
|
609
|
+
G.value ? (C(), R(b(Je), {
|
|
606
610
|
key: 0,
|
|
607
611
|
class: "sl-h-5 sl-w-5 sl-text-red-500",
|
|
608
612
|
"aria-hidden": "true",
|
|
609
613
|
"data-testid": "error-icon"
|
|
610
|
-
})) : te.value ? (C(),
|
|
614
|
+
})) : te.value ? (C(), R(b(Xe), {
|
|
611
615
|
key: 1,
|
|
612
616
|
class: "sl-h-5 sl-w-5 sl-text-green-500",
|
|
613
617
|
"aria-hidden": "true",
|
|
614
618
|
"data-testid": "success-icon"
|
|
615
|
-
})) :
|
|
616
|
-
])) :
|
|
619
|
+
})) : U("", !0)
|
|
620
|
+
])) : U("", !0),
|
|
617
621
|
Me(e.$slots, "input-right", {}, void 0, !0)
|
|
618
622
|
], 2)
|
|
619
623
|
]),
|
|
620
624
|
_: 3
|
|
621
625
|
}, 8, ["id", "name", "label", "optional", "error-message", "success-message", "is-valid", "is-touched", "show-errors", "show-valid-check", "tertiary-label", "disabled", "disabled-message", "colorful-validation"]));
|
|
622
626
|
}
|
|
623
|
-
}), Ra = /* @__PURE__ */ oa(ba, [["__scopeId", "data-v-
|
|
627
|
+
}), Ra = /* @__PURE__ */ oa(ba, [["__scopeId", "data-v-a2738bc9"]]);
|
|
624
628
|
export {
|
|
625
629
|
Ra as default
|
|
626
630
|
};
|
|
@@ -47,7 +47,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
47
47
|
values: FormData;
|
|
48
48
|
}>;
|
|
49
49
|
reset: () => void;
|
|
50
|
-
setFieldValue: (fieldName: string, value:
|
|
50
|
+
setFieldValue: (fieldName: string, value: unknown) => void;
|
|
51
51
|
getFieldValue: (fieldName: string) => any;
|
|
52
52
|
formData: FormData;
|
|
53
53
|
formRef: import('vue').Ref<HTMLFormElement | undefined, HTMLFormElement | undefined>;
|
|
@@ -33,7 +33,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
33
33
|
value: import('vue').Ref<boolean, boolean>;
|
|
34
34
|
focus: () => void;
|
|
35
35
|
blur: () => void;
|
|
36
|
-
switchRef: import('vue').Ref<
|
|
36
|
+
switchRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
37
37
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
38
38
|
blur: (event: FocusEvent) => void;
|
|
39
39
|
focus: (event: FocusEvent) => void;
|
|
@@ -7,7 +7,7 @@ export interface BaseInformationFieldType {
|
|
|
7
7
|
type?: string;
|
|
8
8
|
innerLabel?: string;
|
|
9
9
|
hideLabel?: boolean;
|
|
10
|
-
rules?:
|
|
10
|
+
rules?: unknown;
|
|
11
11
|
position?: number;
|
|
12
12
|
validateOnMount?: boolean;
|
|
13
13
|
placeholder?: string;
|
|
@@ -21,8 +21,8 @@ export interface BaseInformationSchemaType {
|
|
|
21
21
|
fields: BaseInformationFieldType[];
|
|
22
22
|
}
|
|
23
23
|
export interface BaseInformationDataType {
|
|
24
|
-
[key: string]:
|
|
25
|
-
profile_image?:
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
profile_image?: string | File | null;
|
|
26
26
|
email?: string;
|
|
27
27
|
phone?: string;
|
|
28
28
|
}
|
|
@@ -35,7 +35,7 @@ export interface ValidField {
|
|
|
35
35
|
id: string;
|
|
36
36
|
isValid: boolean;
|
|
37
37
|
}
|
|
38
|
-
type FormValuesType = Record<string,
|
|
38
|
+
type FormValuesType = Record<string, unknown>;
|
|
39
39
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
40
40
|
value: {
|
|
41
41
|
type: PropType<BaseInformationDataType>;
|
|
@@ -68,9 +68,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
68
68
|
results: FormValuesType;
|
|
69
69
|
}>;
|
|
70
70
|
validationSchema: import('vue').ComputedRef<import('yup').ObjectSchema<{
|
|
71
|
-
[x: string]:
|
|
71
|
+
[x: string]: unknown;
|
|
72
72
|
}, import('yup').AnyObject, {
|
|
73
|
-
[x: string]:
|
|
73
|
+
[x: string]: undefined;
|
|
74
74
|
}, "">>;
|
|
75
75
|
errors: import('vue').ComputedRef<Partial<Record<string, string | undefined>>>;
|
|
76
76
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -6,11 +6,14 @@ export interface NamesFieldType {
|
|
|
6
6
|
as?: string;
|
|
7
7
|
type?: string;
|
|
8
8
|
hideLabel?: boolean;
|
|
9
|
-
rules?:
|
|
9
|
+
rules?: unknown;
|
|
10
10
|
position?: number;
|
|
11
11
|
validateOnMount?: boolean;
|
|
12
12
|
placeholder?: string;
|
|
13
|
-
items?:
|
|
13
|
+
items?: Array<{
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}>;
|
|
14
17
|
itemKey?: string;
|
|
15
18
|
itemText?: string;
|
|
16
19
|
clearable?: boolean;
|
|
@@ -64,9 +67,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
64
67
|
};
|
|
65
68
|
}>;
|
|
66
69
|
validationSchema: import('vue').ComputedRef<import('yup').ObjectSchema<{
|
|
67
|
-
[x: string]:
|
|
70
|
+
[x: string]: unknown;
|
|
68
71
|
}, import('yup').AnyObject, {
|
|
69
|
-
[x: string]:
|
|
72
|
+
[x: string]: undefined;
|
|
70
73
|
}, "">>;
|
|
71
74
|
errors: import('vue').ComputedRef<Partial<Record<string, string | undefined>>>;
|
|
72
75
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -26,7 +26,9 @@ export interface CollectionEditorReturn<T extends CollectionItem> {
|
|
|
26
26
|
/** Current form values */
|
|
27
27
|
formValues: Ref<T>;
|
|
28
28
|
/** Reference to the form component */
|
|
29
|
-
formRef: Ref<
|
|
29
|
+
formRef: Ref<{
|
|
30
|
+
submitForm?: () => void;
|
|
31
|
+
} | null>;
|
|
30
32
|
/** Button attributes for add/save/delete */
|
|
31
33
|
buttonAttributes: ComputedRef<CollectionButtonAttributes>;
|
|
32
34
|
/** Whether delete confirmation modal should show */
|
|
@@ -61,5 +63,5 @@ export interface CollectionEditorReturn<T extends CollectionItem> {
|
|
|
61
63
|
/**
|
|
62
64
|
* Create a collection editor composable instance
|
|
63
65
|
*/
|
|
64
|
-
export declare function useCollectionEditor<T extends CollectionItem>(options: CollectionEditorOptions<T>, emit: (event: string, ...args:
|
|
66
|
+
export declare function useCollectionEditor<T extends CollectionItem>(options: CollectionEditorOptions<T>, emit: (event: string, ...args: unknown[]) => void): CollectionEditorReturn<T>;
|
|
65
67
|
export default useCollectionEditor;
|
package/dist/src/types/core.d.ts
CHANGED
|
@@ -48,11 +48,11 @@ export interface FormValidationResult {
|
|
|
48
48
|
/** Map of field names to error messages */
|
|
49
49
|
errors: Record<string, string>;
|
|
50
50
|
/** Current form values */
|
|
51
|
-
values: Record<string,
|
|
51
|
+
values: Record<string, unknown>;
|
|
52
52
|
/** Source identifier for nested form aggregation */
|
|
53
53
|
source?: string;
|
|
54
54
|
/** Per-field validation results */
|
|
55
|
-
results?: Record<string,
|
|
55
|
+
results?: Record<string, unknown>;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Base props shared by ALL input components.
|
|
@@ -153,7 +153,7 @@ export interface InputBaseProps {
|
|
|
153
153
|
* const emit = defineEmits<InputEmits<string>>();
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
|
-
export interface InputEmits<T =
|
|
156
|
+
export interface InputEmits<T = unknown> {
|
|
157
157
|
/**
|
|
158
158
|
* Emitted when the input value changes.
|
|
159
159
|
* Used for v-model binding.
|
|
@@ -427,7 +427,7 @@ export interface DynamicFormProps {
|
|
|
427
427
|
/**
|
|
428
428
|
* Initial form values.
|
|
429
429
|
*/
|
|
430
|
-
formValues?: Record<string,
|
|
430
|
+
formValues?: Record<string, unknown>;
|
|
431
431
|
/**
|
|
432
432
|
* Form identifier for debugging.
|
|
433
433
|
* @default 'generic'
|
|
@@ -529,7 +529,7 @@ export interface NotificationConfig {
|
|
|
529
529
|
*/
|
|
530
530
|
export interface CloudinaryTransformationStep {
|
|
531
531
|
type: string;
|
|
532
|
-
params?: Record<string,
|
|
532
|
+
params?: Record<string, unknown>;
|
|
533
533
|
}
|
|
534
534
|
/**
|
|
535
535
|
* Cloudinary asset configuration.
|
|
@@ -14,7 +14,9 @@ export declare class ComponentRegistry {
|
|
|
14
14
|
/**
|
|
15
15
|
* Register a new component type
|
|
16
16
|
*/
|
|
17
|
-
register(type: string, component: string, loader: () => Promise<
|
|
17
|
+
register(type: string, component: string, loader: () => Promise<{
|
|
18
|
+
default: Component;
|
|
19
|
+
}>): void;
|
|
18
20
|
/**
|
|
19
21
|
* Get a component for a field type
|
|
20
22
|
*/
|
|
@@ -40,7 +42,9 @@ export declare const componentRegistry: ComponentRegistry;
|
|
|
40
42
|
/**
|
|
41
43
|
* Register a component type globally
|
|
42
44
|
*/
|
|
43
|
-
export declare function registerComponent(type: string, component: string, loader: () => Promise<
|
|
45
|
+
export declare function registerComponent(type: string, component: string, loader: () => Promise<{
|
|
46
|
+
default: Component;
|
|
47
|
+
}>): void;
|
|
44
48
|
/**
|
|
45
49
|
* Get a component for a field type
|
|
46
50
|
*/
|