llnet-vue-floating-form
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -1,6 +0,6 @@ | ||
import { ref as c, computed as L, openBlock as n, createElementBlock as i, normalizeClass as x, unref as a, withDirectives as M, createElementVNode as m, isRef as B, createVNode as p, withCtx as C, Fragment as h, renderList as V, toDisplayString as A, createCommentVNode as v, vModelSelect as O, createBlock as D } from "vue"; | ||
import { ref as c, computed as L, openBlock as n, createElementBlock as s, normalizeClass as x, unref as a, withDirectives as M, createElementVNode as m, isRef as O, createVNode as p, withCtx as B, Fragment as k, renderList as V, toDisplayString as C, createCommentVNode as v, vModelSelect as A, createBlock as D } from "vue"; | ||
import { b as F, u as G, c as N } from "./index-CwtlZ_c1.js"; | ||
import { _ as R } from "./Label-eedKib_X.js"; | ||
import { _ as T } from "./InfoIcon-B2j-ihXV.js"; | ||
const $ = ["value"], I = ["label"], z = ["label"], U = /* @__PURE__ */ m("svg", { | ||
const $ = ["value"], I = ["label"], P = ["label"], z = /* @__PURE__ */ m("svg", { | ||
class: "select", | ||
@@ -18,4 +18,4 @@ fill: "none", | ||
}) | ||
], -1), Z = /* @__PURE__ */ m("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }, null, -1), q = [ | ||
Z | ||
], -1), U = /* @__PURE__ */ m("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }, null, -1), Z = [ | ||
U | ||
], X = { | ||
@@ -68,5 +68,5 @@ __name: "Select", | ||
setup(l, { emit: j }) { | ||
const k = c(null); | ||
const w = c(null); | ||
F(); | ||
const w = c(null); | ||
const h = c(null); | ||
c(null), c(null); | ||
@@ -79,3 +79,7 @@ const r = l, u = G(r, "modelValue", j), [S, g] = N(), f = L(() => { | ||
t ? { label: e, value: e, group: null } : { label: e, value: b, group: null } | ||
) : typeof e == "object" && (d.push({ value: (e == null ? void 0 : e.value) ?? b, label: (e == null ? void 0 : e.label) ?? b, group: (e == null ? void 0 : e.group) ?? null }), e != null && e.group && !o.includes(e.group) && o.push(e.group)); | ||
) : typeof e == "object" && (d.push({ | ||
value: e.hasOwnProperty("value") ? e.value : b, | ||
label: e != null && e.hasOwnProperty("label") ? e.label : b, | ||
group: (e == null ? void 0 : e.group) ?? null | ||
}), e != null && e.group && !o.includes(e.group) && o.push(e.group)); | ||
}), { | ||
@@ -86,3 +90,3 @@ options: d, | ||
}); | ||
return (d, o) => (n(), i("div", { | ||
return (d, o) => (n(), s("div", { | ||
class: x([ | ||
@@ -94,21 +98,21 @@ l.emptyValue === a(u) ? "empty" : "selected", | ||
ref_key: "wrapperEl", | ||
ref: w | ||
ref: h | ||
}, [ | ||
M(m("select", { | ||
ref_key: "selectItem", | ||
ref: k, | ||
ref: w, | ||
class: "input", | ||
"onUpdate:modelValue": o[0] || (o[0] = (t) => B(u) ? u.value = t : null), | ||
"onUpdate:modelValue": o[0] || (o[0] = (t) => O(u) ? u.value = t : null), | ||
placeholder: " " | ||
}, [ | ||
p(a(S), null, { | ||
default: C(({ options: t }) => [ | ||
(n(!0), i(h, null, V(t, (s) => (n(), i("option", { | ||
value: s.value, | ||
key: s.value | ||
}, A(s.label), 9, $))), 128)) | ||
default: B(({ options: t }) => [ | ||
(n(!0), s(k, null, V(t, (i) => (n(), s("option", { | ||
value: i.value, | ||
key: i.value | ||
}, C(i.label), 9, $))), 128)) | ||
]), | ||
_: 1 | ||
}), | ||
l.noneGroupedLabel !== null ? (n(), i("optgroup", { | ||
l.noneGroupedLabel !== null ? (n(), s("optgroup", { | ||
key: 0, | ||
@@ -125,9 +129,9 @@ label: l.noneGroupedLabel | ||
}, null, 8, ["options"]), | ||
(n(!0), i(h, null, V(f.value.groups, (t) => (n(), i("optgroup", { label: t }, [ | ||
(n(!0), s(k, null, V(f.value.groups, (t) => (n(), s("optgroup", { label: t }, [ | ||
p(a(g), { | ||
options: f.value.options.filter((s) => s.group === t) | ||
options: f.value.options.filter((i) => i.group === t) | ||
}, null, 8, ["options"]) | ||
], 8, z))), 256)) | ||
], 8, P))), 256)) | ||
], 512), [ | ||
[O, a(u)] | ||
[A, a(u)] | ||
]), | ||
@@ -139,7 +143,7 @@ l.info ? (n(), D(T, { | ||
value: a(u), | ||
"input-el": k.value, | ||
"wrapper-el": w.value | ||
"input-el": w.value, | ||
"wrapper-el": h.value | ||
}, null, 8, ["info", "message", "value", "input-el", "wrapper-el"])) : v("", !0), | ||
U, | ||
l.enableEmptyValue && a(u) !== l.emptyValue ? (n(), i("svg", { | ||
z, | ||
l.enableEmptyValue && a(u) !== l.emptyValue ? (n(), s("svg", { | ||
key: 1, | ||
@@ -151,3 +155,3 @@ onClick: o[1] || (o[1] = (t) => u.value = l.emptyValue), | ||
class: "clear" | ||
}, q)) : v("", !0), | ||
}, Z)) : v("", !0), | ||
p(R, { label: l.label }, null, 8, ["label"]) | ||
@@ -154,0 +158,0 @@ ], 2)); |
@@ -1,2 +0,2 @@ | ||
import { ref as w, computed as S, inject as X, watchEffect as W, onMounted as H, cloneVNode as Ee, h as Y, Fragment as J, defineComponent as C, provide as ce, watch as ve, onUnmounted as fe, nextTick as F, toRaw as D, openBlock as N, createElementBlock as V, normalizeClass as G, unref as T, createVNode as M, isRef as $e, withCtx as B, createElementVNode as R, toDisplayString as ne, Transition as ke, renderList as Pe, createBlock as oe, renderSlot as De, createCommentVNode as z } from "vue"; | ||
import { ref as w, computed as S, inject as ee, watchEffect as q, onMounted as H, cloneVNode as Ee, h as X, Fragment as W, defineComponent as C, provide as ce, watch as ve, onUnmounted as fe, nextTick as F, toRaw as D, openBlock as N, createElementBlock as V, createElementVNode as j, normalizeClass as Q, unref as R, createVNode as M, isRef as Pe, withCtx as B, toDisplayString as Y, Transition as $e, renderList as ke, createBlock as oe, renderSlot as De, createCommentVNode as z } from "vue"; | ||
import { _ as je } from "./Label-eedKib_X.js"; | ||
@@ -12,4 +12,4 @@ import { u as Te } from "./index-CwtlZ_c1.js"; | ||
let Ne = Symbol("headlessui.useid"), Fe = 0; | ||
function q() { | ||
return X(Ne, () => `${++Fe}`)(); | ||
function G() { | ||
return ee(Ne, () => `${++Fe}`)(); | ||
} | ||
@@ -23,3 +23,3 @@ function x(e) { | ||
} | ||
function j(e, n, ...l) { | ||
function T(e, n, ...l) { | ||
if (e in n) { | ||
@@ -30,3 +30,3 @@ let a = n[e]; | ||
let r = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(n).map((a) => `"${a}"`).join(", ")}.`); | ||
throw Error.captureStackTrace && Error.captureStackTrace(r, j), r; | ||
throw Error.captureStackTrace && Error.captureStackTrace(r, T), r; | ||
} | ||
@@ -56,5 +56,5 @@ var Ce = Object.defineProperty, Ie = (e, n, l) => n in e ? Ce(e, n, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[n] = l, ae = (e, n, l) => (Ie(e, typeof n != "symbol" ? n + "" : n, l), l); | ||
} | ||
}, ee = new Ve(); | ||
}, te = new Ve(); | ||
function Me(e) { | ||
if (ee.isServer) | ||
if (te.isServer) | ||
return null; | ||
@@ -71,6 +71,6 @@ if (e instanceof Node) | ||
let re = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","); | ||
var Be = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e))(Be || {}), He = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(He || {}), Ue = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(Ue || {}), te = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(te || {}); | ||
var Be = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e))(Be || {}), He = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(He || {}), Ue = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(Ue || {}), le = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(le || {}); | ||
function pe(e, n = 0) { | ||
var l; | ||
return e === ((l = Me(e)) == null ? void 0 : l.body) ? !1 : j(n, { 0() { | ||
return e === ((l = Me(e)) == null ? void 0 : l.body) ? !1 : T(n, { 0() { | ||
return e.matches(re); | ||
@@ -112,3 +112,3 @@ }, 1() { | ||
function K(e, n, l) { | ||
ee.isServer || W((r) => { | ||
te.isServer || q((r) => { | ||
document.addEventListener(e, n, l), r(() => document.removeEventListener(e, n, l)); | ||
@@ -118,3 +118,3 @@ }); | ||
function Ge(e, n, l) { | ||
ee.isServer || W((r) => { | ||
te.isServer || q((r) => { | ||
window.addEventListener(e, n, l), r(() => window.removeEventListener(e, n, l)); | ||
@@ -140,3 +140,3 @@ }); | ||
} | ||
return !pe(s, te.Loose) && s.tabIndex !== -1 && o.preventDefault(), n(o, s); | ||
return !pe(s, le.Loose) && s.tabIndex !== -1 && o.preventDefault(), n(o, s); | ||
} | ||
@@ -165,3 +165,3 @@ let a = w(null); | ||
l.value = ue(e.value.type, e.value.as); | ||
}), W(() => { | ||
}), q(() => { | ||
var r; | ||
@@ -183,3 +183,3 @@ l.value || x(n) && x(n) instanceof HTMLButtonElement && !((r = x(n)) != null && r.hasAttribute("type")) && (l.value = "button"); | ||
} | ||
var Z = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(Z || {}), Xe = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(Xe || {}); | ||
var J = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(J || {}), Xe = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(Xe || {}); | ||
function I({ visible: e = !0, features: n = 0, ourProps: l, theirProps: r, ...a }) { | ||
@@ -189,14 +189,14 @@ var o; | ||
if (e || n & 2 && t.static) | ||
return Q(s); | ||
return Z(s); | ||
if (n & 1) { | ||
let f = (o = t.unmount) == null || o ? 0 : 1; | ||
return j(f, { 0() { | ||
return T(f, { 0() { | ||
return null; | ||
}, 1() { | ||
return Q({ ...a, props: { ...t, hidden: !0, style: { display: "none" } } }); | ||
return Z({ ...a, props: { ...t, hidden: !0, style: { display: "none" } } }); | ||
} }); | ||
} | ||
return Q(s); | ||
return Z(s); | ||
} | ||
function Q({ props: e, attrs: n, slots: l, slot: r, name: a }) { | ||
function Z({ props: e, attrs: n, slots: l, slot: r, name: a }) { | ||
var o, t; | ||
@@ -214,3 +214,3 @@ let { as: s, ...f } = ge(e, ["unmount", "static"]), c = (o = l.default) == null ? void 0 : o.call(l, r), p = {}; | ||
if (!et(i) || d.length > 0) | ||
throw new Error(['Passing props on "template"!', "", `The current component <${a} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(f).concat(Object.keys(n)).map((g) => g.trim()).filter((g, O, k) => k.indexOf(g) === O).sort((g, O) => g.localeCompare(O)).map((g) => ` - ${g}`).join(` | ||
throw new Error(['Passing props on "template"!', "", `The current component <${a} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(f).concat(Object.keys(n)).map((g) => g.trim()).filter((g, O, $) => $.indexOf(g) === O).sort((g, O) => g.localeCompare(O)).map((g) => ` - ${g}`).join(` | ||
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map((g) => ` - ${g}`).join(` | ||
@@ -226,6 +226,6 @@ `)].join(` | ||
} | ||
return Y(s, Object.assign({}, f, p), { default: () => c }); | ||
return X(s, Object.assign({}, f, p), { default: () => c }); | ||
} | ||
function be(e) { | ||
return e.flatMap((n) => n.type === J ? be(n.children) : [n]); | ||
return e.flatMap((n) => n.type === W ? be(n.children) : [n]); | ||
} | ||
@@ -279,3 +279,3 @@ function me(...e) { | ||
function lt() { | ||
return X(he, null); | ||
return ee(he, null); | ||
} | ||
@@ -401,3 +401,3 @@ function nt(e) { | ||
function _(e) { | ||
let n = X(Se, null); | ||
let n = ee(Se, null); | ||
if (n === null) { | ||
@@ -412,6 +412,6 @@ let l = new Error(`<${e} /> is missing a parent <Listbox /> component.`); | ||
function d(u = (v) => v) { | ||
let v = p.value !== null ? f.value[p.value] : null, y = ze(u(f.value.slice()), ($) => x($.dataRef.domRef)), h = v ? y.indexOf(v) : null; | ||
let v = p.value !== null ? f.value[p.value] : null, y = ze(u(f.value.slice()), (P) => x(P.dataRef.domRef)), h = v ? y.indexOf(v) : null; | ||
return h === -1 && (h = null), { options: y, activeOptionIndex: h }; | ||
} | ||
let m = S(() => e.multiple ? 1 : 0), [b, g] = Ae(S(() => e.modelValue), (u) => r("update:modelValue", u), S(() => e.defaultValue)), O = S(() => b.value === void 0 ? j(m.value, { 1: [], 0: void 0 }) : b.value), k = { listboxState: a, value: O, mode: m, compare(u, v) { | ||
let m = S(() => e.multiple ? 1 : 0), [b, g] = Ae(S(() => e.modelValue), (u) => r("update:modelValue", u), S(() => e.defaultValue)), O = S(() => b.value === void 0 ? T(m.value, { 1: [], 0: void 0 }) : b.value), $ = { listboxState: a, value: O, mode: m, compare(u, v) { | ||
if (typeof e.by == "string") { | ||
@@ -429,4 +429,4 @@ let y = e.by; | ||
return; | ||
let h = d(), $ = at(u === E.Specific ? { focus: E.Specific, id: v } : { focus: u }, { resolveItems: () => h.options, resolveActiveIndex: () => h.activeOptionIndex, resolveId: (A) => A.id, resolveDisabled: (A) => A.dataRef.disabled }); | ||
c.value = "", p.value = $, i.value = y ?? 1, f.value = h.options; | ||
let h = d(), P = at(u === E.Specific ? { focus: E.Specific, id: v } : { focus: u }, { resolveItems: () => h.options, resolveActiveIndex: () => h.activeOptionIndex, resolveId: (A) => A.id, resolveDisabled: (A) => A.dataRef.disabled }); | ||
c.value = "", p.value = P, i.value = y ?? 1, f.value = h.options; | ||
}, search(u) { | ||
@@ -437,3 +437,3 @@ if (e.disabled || a.value === 1) | ||
c.value += u.toLowerCase(); | ||
let y = (p.value !== null ? f.value.slice(p.value + v).concat(f.value.slice(0, p.value + v)) : f.value).find(($) => $.dataRef.textValue.startsWith(c.value) && !$.dataRef.disabled), h = y ? f.value.indexOf(y) : -1; | ||
let y = (p.value !== null ? f.value.slice(p.value + v).concat(f.value.slice(0, p.value + v)) : f.value).find((P) => P.dataRef.textValue.startsWith(c.value) && !P.dataRef.disabled), h = y ? f.value.indexOf(y) : -1; | ||
h === -1 || h === p.value || (p.value = h, i.value = 1); | ||
@@ -447,3 +447,3 @@ }, clearSearch() { | ||
let v = d((y) => { | ||
let h = y.findIndex(($) => $.id === u); | ||
let h = y.findIndex((P) => P.id === u); | ||
return h !== -1 && y.splice(h, 1), y; | ||
@@ -455,4 +455,4 @@ }); | ||
}, select(u) { | ||
e.disabled || g(j(m.value, { 0: () => u, 1: () => { | ||
let v = D(k.value.value).slice(), y = D(u), h = v.findIndex(($) => k.compare(y, D($))); | ||
e.disabled || g(T(m.value, { 0: () => u, 1: () => { | ||
let v = D($.value.value).slice(), y = D(u), h = v.findIndex((P) => $.compare(y, D(P))); | ||
return h === -1 ? v.push(y) : v.splice(h, 1), v; | ||
@@ -463,5 +463,5 @@ } })); | ||
var y; | ||
k.closeListbox(), pe(v, te.Loose) || (u.preventDefault(), (y = x(t)) == null || y.focus()); | ||
}, S(() => a.value === 0)), ce(Se, k), nt(S(() => j(a.value, { 0: U.Open, 1: U.Closed }))); | ||
let P = S(() => { | ||
$.closeListbox(), pe(v, le.Loose) || (u.preventDefault(), (y = x(t)) == null || y.focus()); | ||
}, S(() => a.value === 0)), ce(Se, $), nt(S(() => T(a.value, { 0: U.Open, 1: U.Closed }))); | ||
let k = S(() => { | ||
var u; | ||
@@ -471,16 +471,16 @@ return (u = x(t)) == null ? void 0 : u.closest("form"); | ||
return H(() => { | ||
ve([P], () => { | ||
if (!P.value || e.defaultValue === void 0) | ||
ve([k], () => { | ||
if (!k.value || e.defaultValue === void 0) | ||
return; | ||
function u() { | ||
k.theirOnChange(e.defaultValue); | ||
$.theirOnChange(e.defaultValue); | ||
} | ||
return P.value.addEventListener("reset", u), () => { | ||
return k.value.addEventListener("reset", u), () => { | ||
var v; | ||
(v = P.value) == null || v.removeEventListener("reset", u); | ||
(v = k.value) == null || v.removeEventListener("reset", u); | ||
}; | ||
}, { immediate: !0 }); | ||
}), () => { | ||
let { name: u, modelValue: v, disabled: y, form: h, ...$ } = e, A = { open: a.value === 0, disabled: y, value: O.value }; | ||
return Y(J, [...u != null && O.value != null ? we({ [u]: O.value }).map(([le, Le]) => Y(tt, Je({ features: ye.Hidden, key: le, as: "input", type: "hidden", hidden: !0, readOnly: !0, form: h, disabled: y, name: le, value: Le }))) : [], I({ ourProps: {}, theirProps: { ...l, ...ge($, ["defaultValue", "onUpdate:modelValue", "horizontal", "multiple", "by"]) }, slot: A, slots: n, attrs: l, name: "Listbox" })]); | ||
let { name: u, modelValue: v, disabled: y, form: h, ...P } = e, A = { open: a.value === 0, disabled: y, value: O.value }; | ||
return X(W, [...u != null && O.value != null ? we({ [u]: O.value }).map(([ne, Le]) => X(tt, Je({ features: ye.Hidden, key: ne, as: "input", type: "hidden", hidden: !0, readOnly: !0, form: h, disabled: y, name: ne, value: Le }))) : [], I({ ourProps: {}, theirProps: { ...l, ...ge(P, ["defaultValue", "onUpdate:modelValue", "horizontal", "multiple", "by"]) }, slot: A, slots: n, attrs: l, name: "Listbox" })]); | ||
}; | ||
@@ -490,3 +490,3 @@ } }); | ||
var r; | ||
let a = (r = e.id) != null ? r : `headlessui-listbox-label-${q()}`, o = _("ListboxLabel"); | ||
let a = (r = e.id) != null ? r : `headlessui-listbox-label-${G()}`, o = _("ListboxLabel"); | ||
function t() { | ||
@@ -503,3 +503,3 @@ var s; | ||
var a; | ||
let o = (a = e.id) != null ? a : `headlessui-listbox-button-${q()}`, t = _("ListboxButton"); | ||
let o = (a = e.id) != null ? a : `headlessui-listbox-button-${G()}`, t = _("ListboxButton"); | ||
r({ el: t.buttonRef, $el: t.buttonRef }); | ||
@@ -548,3 +548,3 @@ function s(i) { | ||
var a; | ||
let o = (a = e.id) != null ? a : `headlessui-listbox-options-${q()}`, t = _("ListboxOptions"), s = w(null); | ||
let o = (a = e.id) != null ? a : `headlessui-listbox-options-${G()}`, t = _("ListboxOptions"), s = w(null); | ||
r({ el: t.optionsRef, $el: t.optionsRef }); | ||
@@ -566,5 +566,5 @@ function f(i) { | ||
break; | ||
case j(t.orientation.value, { vertical: L.ArrowDown, horizontal: L.ArrowRight }): | ||
case T(t.orientation.value, { vertical: L.ArrowDown, horizontal: L.ArrowRight }): | ||
return i.preventDefault(), i.stopPropagation(), t.goToOption(E.Next); | ||
case j(t.orientation.value, { vertical: L.ArrowUp, horizontal: L.ArrowLeft }): | ||
case T(t.orientation.value, { vertical: L.ArrowUp, horizontal: L.ArrowLeft }): | ||
return i.preventDefault(), i.stopPropagation(), t.goToOption(E.Previous); | ||
@@ -595,9 +595,9 @@ case L.Home: | ||
let m = { open: t.listboxState.value === 0 }, { ...b } = e, g = { "aria-activedescendant": t.activeOptionIndex.value === null || (i = t.options.value[t.activeOptionIndex.value]) == null ? void 0 : i.id, "aria-multiselectable": t.mode.value === 1 ? !0 : void 0, "aria-labelledby": (d = x(t.buttonRef)) == null ? void 0 : d.id, "aria-orientation": t.orientation.value, id: o, onKeydown: f, role: "listbox", tabIndex: 0, ref: t.optionsRef }; | ||
return I({ ourProps: g, theirProps: b, slot: m, attrs: n, slots: l, features: Z.RenderStrategy | Z.Static, visible: p.value, name: "ListboxOptions" }); | ||
return I({ ourProps: g, theirProps: b, slot: m, attrs: n, slots: l, features: J.RenderStrategy | J.Static, visible: p.value, name: "ListboxOptions" }); | ||
}; | ||
} }), mt = C({ name: "ListboxOption", props: { as: { type: [Object, String], default: "li" }, value: { type: [Object, String, Number, Boolean] }, disabled: { type: Boolean, default: !1 }, id: { type: String, default: null } }, setup(e, { slots: n, attrs: l, expose: r }) { | ||
var a; | ||
let o = (a = e.id) != null ? a : `headlessui-listbox-option-${q()}`, t = _("ListboxOption"), s = w(null); | ||
let o = (a = e.id) != null ? a : `headlessui-listbox-option-${G()}`, t = _("ListboxOption"), s = w(null); | ||
r({ el: s, $el: s }); | ||
let f = S(() => t.activeOptionIndex.value !== null ? t.options.value[t.activeOptionIndex.value].id === o : !1), c = S(() => j(t.mode.value, { 0: () => t.compare(D(t.value.value), D(e.value)), 1: () => D(t.value.value).some((u) => t.compare(D(u), D(e.value))) })), p = S(() => j(t.mode.value, { 1: () => { | ||
let f = S(() => t.activeOptionIndex.value !== null ? t.options.value[t.activeOptionIndex.value].id === o : !1), c = S(() => T(t.mode.value, { 0: () => t.compare(D(t.value.value), D(e.value)), 1: () => D(t.value.value).some((u) => t.compare(D(u), D(e.value))) })), p = S(() => T(t.mode.value, { 1: () => { | ||
var u; | ||
@@ -611,3 +611,3 @@ let v = D(t.value.value); | ||
ve([t.listboxState, c], () => { | ||
t.listboxState.value === 0 && c.value && j(t.mode.value, { 1: () => { | ||
t.listboxState.value === 0 && c.value && T(t.mode.value, { 1: () => { | ||
p.value && t.goToOption(E.Specific, o); | ||
@@ -618,3 +618,3 @@ }, 0: () => { | ||
}, { immediate: !0 }); | ||
}), W(() => { | ||
}), q(() => { | ||
t.listboxState.value === 0 && f.value && t.activationTrigger.value !== 0 && F(() => { | ||
@@ -642,11 +642,11 @@ var u, v; | ||
} | ||
function k(u) { | ||
function $(u) { | ||
g.wasMoved(u) && (e.disabled || f.value || t.goToOption(E.Specific, o, 0)); | ||
} | ||
function P(u) { | ||
function k(u) { | ||
g.wasMoved(u) && (e.disabled || f.value && t.goToOption(E.Nothing)); | ||
} | ||
return () => { | ||
let { disabled: u } = e, v = { active: f.value, selected: c.value, disabled: u }, { value: y, disabled: h, ...$ } = e, A = { id: o, ref: s, role: "option", tabIndex: u === !0 ? void 0 : -1, "aria-disabled": u === !0 ? !0 : void 0, "aria-selected": c.value, disabled: void 0, onClick: m, onFocus: b, onPointerenter: O, onMouseenter: O, onPointermove: k, onMousemove: k, onPointerleave: P, onMouseleave: P }; | ||
return I({ ourProps: A, theirProps: $, slot: v, attrs: l, slots: n, name: "ListboxOption" }); | ||
let { disabled: u } = e, v = { active: f.value, selected: c.value, disabled: u }, { value: y, disabled: h, ...P } = e, A = { id: o, ref: s, role: "option", tabIndex: u === !0 ? void 0 : -1, "aria-disabled": u === !0 ? !0 : void 0, "aria-selected": c.value, disabled: void 0, onClick: m, onFocus: b, onPointerenter: O, onMouseenter: O, onPointermove: $, onMousemove: $, onPointerleave: k, onMouseleave: k }; | ||
return I({ ourProps: A, theirProps: P, slot: v, attrs: l, slots: n, name: "ListboxOption" }); | ||
}; | ||
@@ -657,3 +657,3 @@ } }); | ||
class: "icon" | ||
}, wt = /* @__PURE__ */ R("svg", { | ||
}, wt = /* @__PURE__ */ j("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -663,3 +663,3 @@ viewBox: "0 0 16 16", | ||
}, [ | ||
/* @__PURE__ */ R("path", { | ||
/* @__PURE__ */ j("path", { | ||
"fill-rule": "evenodd", | ||
@@ -671,3 +671,3 @@ d: "M12.416 3.376a.75.75 0 0 1 .208 1.04l-5 7.5a.75.75 0 0 1-1.154.114l-3-3a.75.75 0 0 1 1.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 0 1 1.04-.207Z", | ||
wt | ||
], xt = /* @__PURE__ */ R("svg", { | ||
], xt = /* @__PURE__ */ j("svg", { | ||
class: "select", | ||
@@ -679,3 +679,3 @@ fill: "none", | ||
}, [ | ||
/* @__PURE__ */ R("path", { | ||
/* @__PURE__ */ j("path", { | ||
"stroke-linecap": "round", | ||
@@ -686,3 +686,3 @@ "stroke-linejoin": "round", | ||
}) | ||
], -1), St = /* @__PURE__ */ R("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }, null, -1), Lt = [ | ||
], -1), St = /* @__PURE__ */ j("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }, null, -1), Lt = [ | ||
St | ||
@@ -735,7 +735,14 @@ ], jt = { | ||
let d = [], m = Array.isArray(l.options); | ||
return typeof l.options == "object" ? ((m ? l.options : Object.entries(l.options)).forEach((O, k) => { | ||
const { key: P, value: u } = m ? { key: k, value: O } : { key: O[0], value: O[1] }; | ||
return typeof l.options == "object" ? ((m ? l.options : Object.entries(l.options)).forEach((O, $) => { | ||
const { key: k, value: u } = m ? { key: $, value: O } : { key: O[0], value: O[1] }; | ||
typeof u != "object" ? d.push( | ||
m ? { label: u, value: u } : { label: u, value: P } | ||
) : typeof u == "object" && d.push({ value: (u == null ? void 0 : u.value) ?? P, label: (u == null ? void 0 : u.label) ?? P, desc: (u == null ? void 0 : u.desc) ?? void 0 }); | ||
m ? { label: u, value: u } : { label: u, value: k } | ||
) : typeof u == "object" && d.push( | ||
{ | ||
...typeof u == "object" ? u : {}, | ||
value: u.hasOwnProperty("value") ? u.value : k, | ||
label: u != null && u.hasOwnProperty("label") ? u.label : k, | ||
desc: (u == null ? void 0 : u.desc) ?? void 0 | ||
} | ||
); | ||
}), d) : []; | ||
@@ -759,100 +766,104 @@ }), p = S(() => { | ||
document.body.removeEventListener("click", i), document.body.removeEventListener("focus", i), document.body.removeEventListener("mousedown", i); | ||
}), (d, m) => (N(), V("div", { | ||
ref_key: "selectElement", | ||
ref: o, | ||
class: G(["select2", { | ||
focus: r.value, | ||
empty: T(s) === f.value, | ||
selected: T(s) !== f.value, | ||
"has-info": e.info, | ||
"floating-field": e.layout === "floating-field", | ||
"floating-default": e.layout === "floating-default" | ||
}]), | ||
onClickPassive: m[2] || (m[2] = (b) => t.value = !t.value), | ||
onFocusinPassive: m[3] || (m[3] = (b) => r.value = !0), | ||
onFocusoutPassive: m[4] || (m[4] = (b) => r.value = !1) | ||
}, [ | ||
M(T(ft), { | ||
class: "input", | ||
modelValue: T(s), | ||
"onUpdate:modelValue": m[0] || (m[0] = (b) => $e(s) ? s.value = b : null), | ||
multiple: e.multiple | ||
}, { | ||
default: B(() => [ | ||
R("div", gt, [ | ||
M(T(pt), null, { | ||
default: B(() => [ | ||
R("span", null, ne(p.value) + " ", 1) | ||
]), | ||
_: 1 | ||
}), | ||
M(ke, { | ||
"leave-active-class": "transition_active", | ||
"leave-from-class": "transition_from", | ||
"leave-to-class": "transition_to" | ||
}, { | ||
default: B(() => [ | ||
M(T(bt), { | ||
static: t.value, | ||
unmount: !1 | ||
}, { | ||
default: B(() => [ | ||
(N(!0), V(J, null, Pe(c.value, (b) => (N(), oe(T(mt), { | ||
key: b.label, | ||
value: b.value, | ||
as: "template" | ||
}, { | ||
default: B(({ active: g, selected: O }) => [ | ||
R("li", { | ||
class: G(g ? "active" : void 0) | ||
}, [ | ||
De(d.$slots, "option", { | ||
option: b, | ||
active: g, | ||
selected: O | ||
}, () => [ | ||
R("span", { | ||
class: G(["label", [O ? "selected" : void 0]]) | ||
}, ne(b.label), 3), | ||
b.desc ? (N(), V("span", { | ||
key: 0, | ||
innerHTML: b.desc | ||
}, null, 8, yt)) : z("", !0) | ||
]), | ||
O ? (N(), V("span", ht, Ot)) : z("", !0) | ||
], 2) | ||
]), | ||
_: 2 | ||
}, 1032, ["value"]))), 128)) | ||
]), | ||
_: 3 | ||
}, 8, ["static"]) | ||
]), | ||
_: 3 | ||
}) | ||
]) | ||
]), | ||
_: 3 | ||
}, 8, ["modelValue", "multiple"]), | ||
M(je, { | ||
label: e.label, | ||
class: "z-20 block" | ||
}, null, 8, ["label"]), | ||
e.info ? (N(), oe(Re, { | ||
key: 0, | ||
info: e.info, | ||
message: e.infoMessage, | ||
wrapperEl: o.value, | ||
value: T(s) | ||
}, null, 8, ["info", "message", "wrapperEl", "value"])) : z("", !0), | ||
xt, | ||
e.enableEmptyValue && T(s) !== f.value ? (N(), V("svg", { | ||
key: 1, | ||
onClick: m[1] || (m[1] = (b) => s.value = f.value), | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 20 20", | ||
fill: "currentColor", | ||
class: "clear" | ||
}, Lt)) : z("", !0) | ||
], 34)); | ||
}), (d, m) => (N(), V(W, null, [ | ||
j("div", { | ||
ref_key: "selectElement", | ||
ref: o, | ||
class: Q(["select2", { | ||
focus: r.value, | ||
empty: R(s) === f.value, | ||
selected: R(s) !== f.value, | ||
"has-info": e.info, | ||
"floating-field": e.layout === "floating-field", | ||
"floating-default": e.layout === "floating-default" | ||
}]), | ||
onClickPassive: m[2] || (m[2] = (b) => t.value = !t.value), | ||
onFocusinPassive: m[3] || (m[3] = (b) => r.value = !0), | ||
onFocusoutPassive: m[4] || (m[4] = (b) => r.value = !1) | ||
}, [ | ||
M(R(ft), { | ||
class: "input", | ||
modelValue: R(s), | ||
"onUpdate:modelValue": m[0] || (m[0] = (b) => Pe(s) ? s.value = b : null), | ||
multiple: e.multiple | ||
}, { | ||
default: B(() => [ | ||
j("div", gt, [ | ||
M(R(pt), null, { | ||
default: B(() => [ | ||
j("span", null, Y(p.value) + " ", 1) | ||
]), | ||
_: 1 | ||
}), | ||
M($e, { | ||
"leave-active-class": "transition_active", | ||
"leave-from-class": "transition_from", | ||
"leave-to-class": "transition_to" | ||
}, { | ||
default: B(() => [ | ||
M(R(bt), { | ||
static: t.value, | ||
unmount: !1 | ||
}, { | ||
default: B(() => [ | ||
(N(!0), V(W, null, ke(c.value, (b) => (N(), oe(R(mt), { | ||
key: b.label, | ||
value: b.value, | ||
as: "template" | ||
}, { | ||
default: B(({ active: g, selected: O }) => [ | ||
j("li", { | ||
class: Q(g ? "active" : void 0) | ||
}, [ | ||
De(d.$slots, "option", { | ||
option: b, | ||
active: g, | ||
selected: O | ||
}, () => [ | ||
j("span", { | ||
class: Q(["label", [O ? "selected" : void 0]]) | ||
}, Y(b.label), 3), | ||
b.desc ? (N(), V("span", { | ||
key: 0, | ||
innerHTML: b.desc | ||
}, null, 8, yt)) : z("", !0) | ||
]), | ||
O ? (N(), V("span", ht, Ot)) : z("", !0) | ||
], 2) | ||
]), | ||
_: 2 | ||
}, 1032, ["value"]))), 128)) | ||
]), | ||
_: 3 | ||
}, 8, ["static"]) | ||
]), | ||
_: 3 | ||
}) | ||
]) | ||
]), | ||
_: 3 | ||
}, 8, ["modelValue", "multiple"]), | ||
M(je, { | ||
label: e.label, | ||
class: "z-20 block" | ||
}, null, 8, ["label"]), | ||
e.info ? (N(), oe(Re, { | ||
key: 0, | ||
info: e.info, | ||
message: e.infoMessage, | ||
wrapperEl: o.value, | ||
value: R(s) | ||
}, null, 8, ["info", "message", "wrapperEl", "value"])) : z("", !0), | ||
xt, | ||
e.enableEmptyValue && R(s) !== f.value ? (N(), V("svg", { | ||
key: 1, | ||
onClick: m[1] || (m[1] = (b) => s.value = f.value), | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 20 20", | ||
fill: "currentColor", | ||
class: "clear" | ||
}, Lt)) : z("", !0) | ||
], 34), | ||
j("pre", null, " " + Y(c.value) + ` | ||
`, 1) | ||
], 64)); | ||
} | ||
@@ -859,0 +870,0 @@ }; |
{ | ||
"name": "llnet-vue-floating-form", | ||
"private": false, | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "author": "LLNet", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
171597
2577