@oruga-ui/oruga-next
Version:
UI components for Vue.js and CSS framework agnostic
1,745 lines (1,744 loc) • 364 kB
JavaScript
/*! Oruga v0.13.6 | MIT License | github.com/oruga-ui/oruga */
import { Comment as e, Fragment as t, Teleport as n, Text as r, Transition as i, TransitionGroup as a, computed as o, createApp as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createTextVNode as p, createVNode as m, defineComponent as h, effectScope as g, getCurrentInstance as _, getCurrentScope as v, guardReactiveProps as y, hasInjectionContext as b, inject as x, isRef as S, mergeModels as C, mergeProps as w, nextTick as T, normalizeClass as E, normalizeProps as D, normalizeStyle as O, onBeforeMount as k, onBeforeUnmount as A, onMounted as j, onScopeDispose as M, onUnmounted as N, openBlock as P, provide as F, readonly as ee, ref as I, renderList as L, renderSlot as R, resolveComponent as te, resolveDynamicComponent as z, toDisplayString as B, toHandlers as V, toRaw as ne, toValue as H, triggerRef as re, unref as U, useAttrs as ie, useId as W, useModel as ae, useSlots as oe, useTemplateRef as G, vModelCheckbox as se, vModelRadio as ce, vModelSelect as le, vShow as ue, watch as K, watchEffect as de, withCtx as q, withDirectives as fe, withKeys as J, withModifiers as Y } from "vue";
//#region \0rolldown/runtime.js
var pe = Object.defineProperty, me = (e, t) => {
let n = {};
for (var r in e) pe(n, r, {
get: e[r],
enumerable: !0
});
return t || pe(n, Symbol.toStringTag, { value: "Module" }), n;
};
//#endregion
//#region src/utils/helpers.ts
function he(e) {
return e < 0 ? -1 : +(e > 0);
}
var ge = Math.sign || he, _e = (e, t) => (e % t + t) % t, ve = (e) => (e < 10 ? "0" : "") + e;
function ye(e, t, n) {
return Math.max(t, Math.min(n, e));
}
var be = (e) => !!e && typeof e == "object" && !Array.isArray(e), xe = (e) => !!e && e instanceof Date && !isNaN(e.getTime()), X = (e) => e != null, Z = (e) => X(e) && e !== "false" && e !== !1, Se = (e) => X(e) ? e : "", Ce = (e, t) => X(e) ? e : t, we = (e, t = "px") => X(e) ? isNaN(e) ? String(e) : String(e) + t : void 0;
function Te(e) {
return e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0;
}
function Ee(e = "") {
return !Te(e) && e.length === 1 && !!e.match(/\S| /);
}
function De(e, t) {
let n = [], r = e.length;
for (let i = 0; i < r; i++) {
let a = i % 2 == 0 ? t + Math.floor(i / 2) : t - Math.ceil(i / 2);
a >= 0 && a < r && n.push(e[a]);
}
return n;
}
function Oe(e, t, n, r = !1, i = !1) {
return n && typeof n == "function" ? (i ? e : [...e]).sort((e, t) => n(e, t, r)) : (i ? e : [...e]).sort((e, n) => {
let i = be(e) ? Ne(e, t) : e, a = be(n) ? Ne(n, t) : n;
return typeof i == "boolean" && typeof a == "boolean" ? r ? i > a ? 1 : -1 : i > a ? -1 : 1 : !i && i !== 0 ? 1 : !a && a !== 0 ? -1 : i === a ? 0 : (i = typeof i == "string" ? i.toUpperCase() : i, a = typeof a == "string" ? a.toUpperCase() : a, r ? i > a ? 1 : -1 : i > a ? -1 : 1);
});
}
function ke(e, t) {
if (!e && t || e && !t) return !1;
if (e === t) return !0;
if (be(e) && be(t)) {
let n = Object.keys(e), r = Object.keys(t);
if (n.length !== r.length) return !1;
for (let r of n) {
let n = e[r], i = t[r];
if (!ke(n, i)) return !1;
}
return !0;
}
return Array.isArray(e) && Array.isArray(t) ? !(e.length !== t.length || !e.every((e, n) => ke(e, t[n]))) : !1;
}
function Ae(e, t, n = !1) {
return !be(e) || !be(t) ? t : n ? je(e, t) : Object.assign(e, t);
}
function je(e, t) {
return !be(e) || !be(t) ? t : (Object.getOwnPropertyNames(t).forEach((n) => {
let r = e[n], i = t[n];
Array.isArray(r) && Array.isArray(i) ? e[n] = r.concat(i) : be(r) && be(i) ? e[n] = je(Object.assign({}, r), i) : e[n] = i;
}), e);
}
function Me(e, t, n) {
if (!e) return "";
let r = t ? Ne(e, t) : e, i = typeof n == "function" ? n(r, e) : r;
return String(i || "");
}
function Ne(e, t, n) {
if (!e || typeof e != "object" || typeof t != "string") return n;
let r = t.split(".").reduce((e, t) => e === void 0 ? void 0 : e[t], e);
return r === void 0 ? n : r;
}
function Pe(e, t, n) {
if (typeof t != "string") return;
let r = t.split(".");
if (r.length === 1) {
e[r[0]] = n;
return;
}
let i = r[0];
return e[i] === void 0 && (e[i] = {}), Pe(e[i], r.slice(1).join("."), n);
}
function Fe(e) {
e.remove === void 0 ? e.parentNode !== void 0 && e.parentNode !== null && e.parentNode.removeChild(e) : e.remove();
}
function Ie(e) {
return e && e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
function Le(e) {
return e && e.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
function Re(n) {
return !!(!n || n.type === e || n.type === r && !n.children.trim() || n.type === t && Re(n.children));
}
var ze = {
Android: () => typeof window < "u" && !!window.navigator.userAgent.match(/Android/i),
BlackBerry: () => typeof window < "u" && !!window.navigator.userAgent.match(/BlackBerry/i),
iOS: () => typeof window < "u" && !!window.navigator.userAgent.match(/iPhone|iPad|iPod/i),
Opera: () => typeof window < "u" && !!window.navigator.userAgent.match(/Opera Mini/i),
Windows: () => typeof window < "u" && !!window.navigator.userAgent.match(/IEMobile/i),
any: () => ze.Android() || ze.BlackBerry() || ze.iOS() || ze.Opera() || ze.Windows()
}, Be = typeof window < "u";
Be && window.HTMLElement, Be && window.HTMLInputElement, Be && window.File;
//#endregion
//#region src/utils/plugins.ts
var Ve = (e, t) => {
e.component(t.name, t);
}, He = (e, t, n) => {
Ue(e, t, new n());
};
function Ue(e, t, n) {
e._programmatic[t] = n;
}
//#endregion
//#region src/utils/config.ts
var We = Symbol("$oruga"), Ge;
function Ke(e) {
Ge = e;
}
function qe() {
return b() && x(We) || Ge;
}
function Je(e = {}, t = []) {
let n = [], r = {
_app: null,
_config: {
override: !1,
iconPack: "mdi",
useHtml5Validation: !0,
statusIcon: !0,
transformClasses: void 0,
mobileBreakpoint: "1023px",
teleportTarget: () => Be ? document.body : "body",
...e
},
_programmatic: {},
install(e, t = {}) {
r._app = e, r._config = Ae(r._config, t, !0), Ke(r), this.provide(e), Ue(r, "config", rt), n.forEach((t) => e.use(t, { oruga: r }));
},
use(...e) {
return e.forEach((e) => n.push(e)), r;
},
provide(e) {
e.provide(We, r), e.config.globalProperties.$oruga = r;
}
};
return r.use(...t), r;
}
function Ye(e = {}) {
let t = Je(e);
return t._testing = !0, Ke(t), t;
}
function Xe() {
let e = qe();
if (!e) throw Error("No Oruga instance available. Have you installed the Oruga plugin yet?");
return e;
}
function Ze() {
return qe()?._programmatic ?? {};
}
function Qe() {
return qe()?._config ?? {};
}
function $e(e) {
let t = Xe();
t._config = Ae(t._config, e, !0);
}
function et(e, t) {
return Ne(Qe(), e, t);
}
function tt(e, t) {
Pe(Xe()._config, e, t);
}
function Q(e, t) {
return Ne(Qe(), e, t);
}
function nt(e, t) {
return (...n) => {
let r = Q(e, t);
if (typeof r == "function") return r(...n);
};
}
var rt = {
getOption: et,
setOption: tt,
getConfig: Qe,
setConfig: $e
};
function it() {
return rt;
}
//#endregion
//#region src/utils/icons.ts
var at = {
iconPrefix: "mdi-",
sizes: {
default: "mdi-24px",
small: "",
medium: "mdi-36px",
large: "mdi-48px"
}
};
function ot() {
return {
iconPrefix: et("iconComponent") ? "" : "fa-",
sizes: {
default: "",
small: "sm",
medium: "lg",
large: "xl"
},
internalIcons: {
check: "check",
information: "info-circle",
alert: "exclamation-triangle",
"alert-circle": "exclamation-circle",
"arrow-up": "arrow-up",
"chevron-right": "angle-right",
"chevron-left": "angle-left",
"chevron-down": "angle-down",
"chevron-up": "angle-up",
eye: "eye",
"eye-off": "eye-slash",
"caret-down": "caret-down",
"caret-up": "caret-up",
"close-circle": "times-circle",
close: "times",
loading: "circle-notch",
"emoticon-sad": "frown"
}
};
}
function st() {
let e = ot(), t = {
mdi: at,
fa: e,
fas: e,
far: e,
fad: e,
fab: e,
fal: e
}, n = et("customIconPacks");
return n && (t = Ae(t, n, !0)), t;
}
//#endregion
//#region src/composables/unrefElement.ts
function ct(e) {
let t = H(e);
return t?.$el ?? t;
}
function lt(e) {
let t = H(e);
return typeof t == "string" ? document.querySelector(t) : ct(t);
}
//#endregion
//#region src/composables/defineClasses.ts
var ut = (e) => {
let t = H(e);
return t ? t.flatMap((e) => Object.keys(e).filter((t) => t && e[t]).flatMap((e) => e.split(" "))) : [];
};
function $(...e) {
let t = Array.isArray(e[e.length - 1]) ? void 0 : e[e.length - 1], n = Array.isArray(e[e.length - 1]) ? e : e.slice(0, -1), r = t?.vm || _();
if (!r) throw Error("defineClasses must be called within a component setup function.");
if (!v() && !t?.scope) throw Error("defineClasses must be called within a current active effect scope.");
let i = t?.scope || g();
v() && M(() => {
i && i.stop();
});
let a = I([]);
return a.value = n.map((e, n) => {
let o = e[0], s = e[1], c = e[2], l = e[3];
function u() {
let e = dt(r, o, s, H(c) || void 0), t = !X(l) || H(l);
return { [e]: t };
}
return i.run(() => {
K([() => r.proxy?.$props[o], () => t?.props ? t?.props[o] : null], () => {
let e = u();
a.value[n] = e;
}), X(c) && S(c) && K(c, (e, t) => {
if (e === t) return;
let r = u();
a.value[n] = r;
}), X(l) && S(l) && K(l, (e, t) => {
if (e === t) return;
let r = a.value[n];
Object.keys(r).forEach((t) => r[t] = e), a.value[n] = r;
});
}), u();
}), a;
}
function dt(e, t, n, r = "") {
let i = ht(e), a = e.proxy?.$options.configField;
if (!a) throw Error("component must define the 'configField' option.");
let o = Z(i.override) ? {} : Qe(), s = Z(i.override), c = s || Ne(o, "override") || Ne(o, `${a}.${t}.override`) || Ne(o, `${a}.override`), l, u, d;
l = ft(Ne(i, t), i, r), s || (c || (d = mt(n, r)), u = ft(Ne(o, `${a}.${t}.class`) || Ne(o, `${a}.${t}`), i, r));
let f = [
d ?? "",
u ?? "",
l ?? ""
].join(" ").trim().replace(/\s\s+/g, " "), p = Ne(o, `${a}.transformClasses`);
return p ||= Ne(o, "transformClasses"), typeof p == "function" && (f = p(f)), f;
}
function ft(e, t, n) {
if (e === void 0) return "";
let r;
r = typeof e == "function" ? e(n, t) ?? "" : e;
let i = "";
return Array.isArray(r) ? i = r.map(pt).join(" ") : r && (i = pt(r)), typeof e != "function" && (i = mt(i, n)), i;
}
function pt(e) {
return typeof e == "string" ? e : typeof e == "object" ? Object.keys(e).filter((t) => e[t]).join(" ") : "";
}
function mt(e, t) {
return Se(e).split(" ").map((e) => e.includes("{*}") ? e.replace(/\{\*\}/g, Se(t)) : e + Se(t)).join(" ");
}
function ht(e) {
let t = e.proxy?.$props || {};
return t = Object.keys(t).filter((e) => e.endsWith("Props")).map((e) => t[e]).reduce((e, t) => ({
...e,
...t
}), t), t;
}
//#endregion
//#region src/composables/useEventListener.ts
function gt(e, t, n, r) {
let i, a = () => {
if (!e) return;
let a = ct(e), o = be(r) ? { ...r } : r;
setTimeout(() => {
a.addEventListener(t, n, o), i = () => {
a.removeEventListener(t, n, o);
};
});
}, o;
r?.trigger !== void 0 && (o = K(r.trigger, (e) => {
e ? a() : typeof i == "function" && i();
}, { flush: "post" })), r?.immediate ? a() : v() && j(() => {
(r?.trigger === void 0 || H(r.trigger)) && a();
});
let s = () => {
typeof o == "function" && o(), typeof i == "function" && i();
};
return v() && M(s), s;
}
//#endregion
//#region src/composables/useMatchMedia.ts
function _t(e) {
let t = I(!1), n = I(), r = _();
if (!r) throw Error("useMatchMedia must be called within a component setup function.");
let i = r.props, a = r.proxy?.$options.configField;
if (!a) throw Error("component must define the 'configField' option.");
let o = i.mobileBreakpoint;
if (!o) {
let t = et("mobileBreakpoint", e);
o = et(`${a}.mobileBreakpoint`, t);
}
if (!o) return { isMobile: t };
n.value = Be ? window.matchMedia(`(max-width: ${o})`) : void 0, n.value ? (t.value = n.value.matches, gt(n.value, "change", s)) : t.value = !1;
function s(e) {
t.value = e.matches;
}
return { isMobile: t };
}
//#endregion
//#region src/components/field/fieldInjection.ts
var vt = Symbol("FielData");
function yt(e) {
F(vt, e);
}
function bt() {
let e = x(vt, o(() => void 0)), t = o(() => {
if (!(Array.isArray(e?.value?.message) && !e?.value?.message.length || !Array.isArray(e?.value?.message) && !e?.value?.message)) return e?.value.message;
}), n = o(() => {
if (e?.value?.variant) {
if (typeof e.value.variant == "string") return e.value.variant;
if (Array.isArray(e.value.variant)) {
for (let t in e.value.variant) if (e.value.variant[t]) return t;
}
}
}), r = et("statusVariantIcon", {
success: "check",
danger: "alert-circle",
info: "information",
warning: "alert"
});
return {
parentField: e,
statusVariant: n,
statusVariantIcon: o(() => !n.value || !r ? "" : r[n.value] || ""),
statusMessage: t
};
}
//#endregion
//#region src/composables/useInputHandler.ts
var xt = Be ? [
HTMLButtonElement,
HTMLFieldSetElement,
HTMLInputElement,
HTMLObjectElement,
HTMLOutputElement,
HTMLSelectElement,
HTMLTextAreaElement
] : [];
function St(e) {
return xt.some((t) => e instanceof t) ? e : null;
}
var Ct = [
"disabled",
"required",
"pattern",
"maxlength",
"minlength",
"max",
"min",
"step"
];
function wt(e, t, n) {
let { parentField: r } = bt(), i = o(() => {
let t = ct(e);
if (!t) return;
if (t.getAttribute("data-oruga-input")) return t;
let n = t.querySelector("[data-oruga-input]");
if (!n) {
console.warn("useInputHandler: Underlaying Oruga input component not found");
return;
}
return n;
}), a = o(() => {
let e = i.value;
return e || console.warn("useInputHandler: inputRef contains no element"), e;
}), s = I(!1);
function c() {
T(() => {
a.value && a.value.focus();
});
}
function l() {
T(() => {
a.value && a.value.click();
});
}
function u(e) {
s.value = !1, r?.value && r.value.setFocus(!1), t("blur", e || new FocusEvent("blur", { relatedTarget: a.value })), m();
}
function d(e) {
s.value = !0, r?.value && r.value.setFocus(!0), t("focus", e || new FocusEvent("focus", { relatedTarget: a.value }));
}
let f = I(!0);
function p(e, t) {
T(() => {
r?.value && (r.value.props.variant || r.value.setVariant(e), r.value.props.message || r.value.setMessage(t));
});
}
function m() {
n.useHtml5Validation && a.value && (a.value.validity.valid ? (p(null, null), f.value = !0) : (h(), f.value = !1));
}
function h() {
let e = a.value?.validationMessage;
p("danger", e);
}
function g(e) {
m();
let i = St(e.target);
if (i && r?.value && n.useHtml5Validation) {
e.preventDefault();
let t = !1;
if (i.form != null) {
let e = i.form.elements;
for (let n = 0; n < e.length; ++n) {
let r = St(e.item(n));
if (r?.willValidate && !r.validity.valid) {
t = i === r;
break;
}
}
}
if (t) {
let e = r.value.$el, t = et("invalidHandler");
if (t instanceof Function) t(i, e ?? void 0);
else {
let t = e?.scrollIntoView != null;
i.focus({ preventScroll: t }), t && e && e.scrollIntoView({ block: "nearest" });
}
}
}
t("invalid", e);
}
if (Be) {
let e = I(null);
de(() => {
if (e.value, !(n.useHtml5Validation ?? !0)) return;
let t = i.value;
if (!X(t)) return;
let r = n.customValidity ?? "";
typeof r == "string" ? t.setCustomValidity(r) : t.setCustomValidity(r(n.modelValue, t.validity)), f.value || m();
}), K([i, () => n.useHtml5Validation ?? !0], (e, t) => {
let n = e[0], r = e[1], i = t[0], a = t[1];
n === i ? a && !r && n?.setCustomValidity("") : i?.setCustomValidity("");
});
let t = () => {
re(e);
}, r = null;
K([
i,
f,
() => n.useHtml5Validation ?? !0,
() => n.customValidity
], (e, n) => {
let i = e[0], a = e[1], o = e[2], s = e[3] instanceof Function, c = n[0], l = X(i) && o && (!a || s);
if ((!l || i !== c) && r != null && (r.takeRecords().length > 0 && t(), r.disconnect(), r = null), l && X(i) && (r == null || i !== c)) {
r ??= new MutationObserver(t), r.observe(i, { attributeFilter: Ct });
let e = i;
for (; e = e.parentNode;) e instanceof HTMLFieldSetElement && r.observe(e, { attributeFilter: ["disabled"] });
}
});
}
return {
input: a,
isFocused: s,
isValid: f,
setFocus: c,
doClick: l,
onFocus: d,
onBlur: u,
onInvalid: g,
checkHtml5Validity: m
};
}
//#endregion
//#region src/composables/useDebounce.ts
function Tt(e, t = 0) {
let n;
return (...r) => {
if (H(t) <= 0) {
e.apply(this, r);
return;
}
n && clearTimeout(n), n = setTimeout(() => {
n = void 0, e.apply(this, r);
}, H(t));
};
}
//#endregion
//#region src/composables/useIndexer.ts
function Et(e = 0) {
let t = e;
function n() {
return String(t++);
}
return {
nextIndex: n,
index: t
};
}
//#endregion
//#region src/composables/useParentProvider.ts
function Dt(e) {
let t = _();
if (!t) throw Error("useProviderChild must be called within a component setup function.");
let n = String(t.proxy?.$options.configField), r = (typeof e?.key == "symbol" ? e.key?.toString() : e?.key) || n, i = I([]), a = o(() => i.value.length);
if (e?.rootRef) {
function t(t) {
let n = ct(e?.rootRef);
if (!n) return;
let i = t.map((e) => `[data-id="${r}-${e.identifier}"]`).join(",");
if (!i) return;
let a = n.querySelectorAll(i), o = Array.from(a).map((e) => e.getAttribute("data-id")?.replace(`${r}-`, ""));
t.forEach((e) => e.index = o.indexOf(`${e.identifier}`)), t.sort((e, t) => e.index - t.index);
}
K(i, t, { flush: "post" });
}
let { nextIndex: s } = Et(1);
function c(e, t) {
let n = {
el: e,
index: i.value.length,
identifier: s(),
data: t
};
return i.value = [...i.value, n], n;
}
function l(e) {
i.value = i.value.filter((t) => t.identifier !== e.identifier);
}
return F("$o-" + r, {
registerItem: c,
unregisterItem: l,
total: a,
data: e?.data
}), {
childItems: i,
itemsCount: a
};
}
function Ot(e, t) {
t = Object.assign({
needParent: !0,
register: !0
}, t);
let n = _();
if (!n) throw Error("useProviderChild must be called within a component setup function.");
let r = String(n.proxy?.$options.configField), i = (typeof t?.key == "symbol" ? t.key.toString() : t?.key) || r, a = x("$o-" + i, void 0);
if (t.needParent && !a) throw Error(`You should wrap ${n.proxy?.$options.name} in a ${i} component`);
let s = t.data ?? o(() => void 0), c = a?.data ?? o(() => void 0), l = a?.total ?? o(() => 0), u = I();
return a && t.register && (u.value = a.registerItem(e, s)), N(() => {
a && u.value && a.unregisterItem(u.value);
}), {
parent: c,
item: u,
itemsCount: l
};
}
//#endregion
//#region src/composables/useClickOutside.ts
function kt(e, t, n) {
if (!window) return () => {};
let r = Object.assign({ ignore: [] }, n), i = Array.isArray(e) ? e : [e], a = (e) => i.some((t) => {
if (typeof t == "string") return Array.from(window.document.querySelectorAll(t)).some((t) => t === e.target || e.composedPath().includes(t));
{
let n = ct(t);
return n && (e.target === n || e.composedPath().includes(n));
}
});
function o(e) {
a(e) || t(e);
}
return gt(window, "click", o, r);
}
//#endregion
//#region src/composables/useOptions.ts
function At(e, t, n = !1) {
return e ? Array.isArray(e) ? e.map((e) => {
if (typeof e == "string" || typeof e == "number") return {
item: {
label: String(e),
value: e
},
key: t.nextIndex()
};
if (n && "options" in e) {
let n = t.nextIndex(), r = At(e.options, t), i = { ...H(e) };
return delete i.options, {
item: i,
options: r,
key: n
};
}
return {
item: H(e),
key: t.nextIndex()
};
}) : Object.keys(e).map((n) => ({
item: {
label: e[n],
value: n
},
key: t.nextIndex()
})) : [];
}
function jt(e) {
return "options" in e;
}
function Mt(e) {
let t = H(e);
return t?.length ? jt(t[0]) : !1;
}
function Nt(e, t) {
if (!Array.isArray(H(e))) return -1;
let n = H(t).item, r = 0;
for (let i of H(e)) if (!(typeof i != "object" && i)) if (jt(i)) {
let e = Nt(i.options, t);
if (e === -1) r += i.options.length;
else return r += e, r;
} else if (ke(i.item, n)) return r;
else r += 1;
return -1;
}
function Pt(e) {
return Array.isArray(H(e)) ? H(e).reduce((e, t) => t && typeof t != "object" ? e : jt(t) ? e + Pt(t.options) : e + 1, 0) : 0;
}
//#endregion
//#region src/composables/usePreventScrolling.ts
function Ft(e) {
let t = $(["scrollClipClass", "o-scroll-clip"]), n = $(["scrollKeepClass", "o-scroll-keep"]), r = o(() => ut(H(e) ? t.value : n.value)), i = I();
A(() => a(!1));
function a(t) {
Be && r.value && (i.value = i.value ? i.value : document.documentElement.scrollTop, t ? document.body.classList.add(...r.value) : document.body.classList.remove(...r.value), H(e) || (t ? document.body.style.top = `-${i.value}px` : (document.documentElement.scrollTop = i.value, document.body.style.top = "", i.value = void 0)));
}
return a;
}
//#endregion
//#region src/composables/useScrollHelper.ts
function It(e, t, n) {
if (!v()) throw Error("The 'useScrollEvents' composable should be used inside a current EffectScope.");
let r = Tt(i, t.debounce ?? 100);
Be && gt(e, "scroll", r, n);
function i() {
let n = ct(e);
if (!n) return;
t.onScroll && t.onScroll();
let { offsetTop: r, scrollTop: i, clientHeight: a, scrollHeight: o } = n, s = r;
a !== o && (Math.ceil(i + a + s) >= o ? t.onScrollEnd && t.onScrollEnd() : i <= s && t.onScrollStart && t.onScrollStart());
}
return r;
}
function Lt(e) {
if (e.style.position === "fixed" || !e) return document.documentElement;
let t = !1, n = e.parentElement;
for (; !t && X(n) && n !== document.documentElement;) {
let { overflow: e, overflowY: r } = getComputedStyle(n), { scrollHeight: i, clientHeight: a } = n;
if (t = /(auto|scroll)/.test(`${e}${r}`) && i > a, t) break;
n = n.parentElement;
}
return n;
}
function Rt(e, t) {
let n = ct(e), r = ct(t);
if (!n || !r) return;
let { offsetHeight: i, offsetTop: a } = r, { offsetHeight: o, scrollTop: s } = n, c = a < s, l = a + i > s + o;
c ? n.scrollTo(0, a) : l && n.scrollTo(0, a - o + i);
}
//#endregion
//#region src/composables/useConfig.ts
function zt() {
return H(et("teleportTarget", "body"));
}
//#endregion
//#region src/composables/useTrapFocus.ts
function Bt(e) {
let t = H(e);
return t ? t.querySelectorAll("a[href]:not([tabindex=\"-1\"]),\n area[href],\n input:not([disabled]):not([type=\"hidden\"]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n *[tabindex]:not([tabindex=\"-1\"]):not([disabled]),\n *[contenteditable]") : [];
}
function Vt() {
let e = null;
function t(t, n) {
n ? (t.focus({ preventScroll: !0 }), typeof e == "function" && t.addEventListener("keydown", e)) : typeof e == "function" && t.removeEventListener("keydown", e);
}
return { vTrapFocus: {
mounted: (n, { value: r }) => {
e = (e) => {
let t = e.target;
if (!t) return;
let r = Bt(n);
if (!r?.length) {
e.preventDefault();
return;
}
let i = r[0], a = r[r.length - 1];
t === i && e.shiftKey && e.key === "Tab" ? (e.preventDefault(), a.focus()) : t === a && !e.shiftKey && e.key === "Tab" && (e.preventDefault(), i.focus());
}, r && t(n, r);
},
beforeUnmount: (n) => {
t(n, !1), e = null;
},
updated: (e, { value: n, oldValue: r }) => {
n !== r && t(e, n);
}
} };
}
//#endregion
//#region src/components/icon/Icon.vue?vue&type=script&setup=true&lang.ts
var Ht = ["tabindex", "role"], Ut = /* @__PURE__ */ h({
isOruga: !0,
name: "OIcon",
configField: "icon",
__name: "Icon",
props: {
override: {
type: Boolean,
default: void 0
},
icon: { default: void 0 },
component: { default: () => Q("iconComponent") },
pack: { default: () => Q("iconPack", "mdi") },
variant: { default: () => Q("icon.variant") },
size: { default: () => Q("icon.size") },
customSize: { default: void 0 },
customClass: { default: void 0 },
clickable: {
type: Boolean,
default: !1
},
spin: {
type: Boolean,
default: !1
},
rotation: { default: void 0 },
rootClass: {},
sizeClass: {},
variantClass: {},
clickableClass: {},
spinClass: {}
},
emits: ["click"],
setup(e, { emit: t }) {
let n = e, r = t, i = o(() => {
let e = {};
return n.rotation && (e.transform = `rotate(${n.rotation}deg)`), e;
}), a = st(), s = o(() => a[n.pack]), l = o(() => s.value?.iconPrefix ?? ""), d = o(() => {
if (n.customSize) return n.customSize;
if (s.value?.sizes) {
if (n.size && s.value.sizes[n.size] !== void 0) return s.value.sizes[n.size];
if (s.value.sizes.default) return s.value.sizes.default;
}
return null;
}), f = o(() => `${l.value}${p(n.icon ?? "")}`);
function p(e) {
return n.pack.toLocaleLowerCase().startsWith("fa") && s.value?.internalIcons && s.value?.internalIcons[e] ? s.value.internalIcons[e] : e;
}
function m(e) {
n.clickable && (e.preventDefault(), r("click", e));
}
let h = $(["rootClass", "o-icon"], [
"clickableClass",
"o-icon--clickable",
null,
o(() => n.clickable)
], [
"spinClass",
"o-icon--spin",
null,
o(() => n.spin)
], [
"sizeClass",
"o-icon--",
o(() => n.size),
o(() => !!n.size)
], [
"variantClass",
"o-icon--",
o(() => n.variant),
o(() => !!n.variant)
]);
return (t, n) => (P(), u("span", {
"data-oruga": "icon",
class: E(U(h)),
style: O(i.value),
tabindex: e.clickable ? 0 : void 0,
role: e.clickable ? "button" : void 0,
onClick: m,
onKeydown: [J(m, ["enter"]), J(m, ["space"])]
}, [e.component ? (P(), c(z(e.component), {
key: 0,
icon: [e.pack, f.value],
size: d.value,
class: E(e.customClass)
}, null, 8, [
"icon",
"size",
"class"
])) : (P(), u("i", {
key: 1,
class: E([
e.pack,
f.value,
d.value,
e.customClass
])
}, null, 2))], 46, Ht));
}
}), Wt = [
"id",
"value",
"type",
"data-oruga-input",
"maxlength",
"autocomplete",
"placeholder",
"disabled"
], Gt = [
"id",
"value",
"maxlength",
"placeholder",
"disabled"
], Kt = /* @__PURE__ */ h({
isOruga: !0,
name: "OInput",
configField: "input",
inheritAttrs: !1,
__name: "Input",
props: /* @__PURE__ */ C({
override: {
type: Boolean,
default: void 0
},
modelValue: { default: void 0 },
number: {},
type: { default: "text" },
size: { default: () => Q("input.size") },
variant: { default: () => Q("input.variant") },
placeholder: { default: void 0 },
expanded: {
type: Boolean,
default: () => Q("input.expanded", !1)
},
rounded: {
type: Boolean,
default: !1
},
disabled: {
type: Boolean,
default: !1
},
passwordReveal: {
type: Boolean,
default: !1
},
maxlength: { default: void 0 },
counter: {
type: Boolean,
default: () => Q("input.counter", !1)
},
autosize: {
type: Boolean,
default: !1
},
iconPack: { default: () => Q("input.iconPack") },
icon: { default: () => Q("input.icon") },
iconClickable: {
type: Boolean,
default: !1
},
iconRight: { default: () => Q("input.iconRight") },
iconRightClickable: {
type: Boolean,
default: !1
},
iconRightVariant: { default: void 0 },
clearable: {
type: Boolean,
default: () => Q("input.clearable", !1)
},
clearIcon: { default: () => Q("input.clearIcon", "close-circle") },
statusIcon: {
type: Boolean,
default: () => Q("statusIcon", !0)
},
debounce: { default: () => Q("autocomplete.debounce") },
autocomplete: { default: () => Q("input.autocomplete", "off") },
id: { default: () => W() },
useHtml5Validation: {
type: Boolean,
default: () => Q("useHtml5Validation", !0)
},
customValidity: {
type: [String, Function],
default: ""
},
rootClass: {},
sizeClass: {},
variantClass: {},
expandedClass: {},
roundedClass: {},
disabledClass: {},
textareaClass: {},
hasIconRightClass: {},
inputClass: {},
iconLeftSpaceClass: {},
iconRightSpaceClass: {},
placeholderClass: {},
iconLeftClass: {},
iconRightClass: {},
counterClass: {}
}, {
modelValue: { default: void 0 },
modelModifiers: {}
}),
emits: /* @__PURE__ */ C([
"update:model-value",
"input",
"focus",
"blur",
"invalid",
"icon-click",
"icon-right-click"
], ["update:modelValue"]),
setup(e, { expose: t, emit: n }) {
let r = e, i = n, a = G("rootElement"), s = G("inputElement"), { checkHtml5Validity: d, onBlur: f, onFocus: p, onInvalid: m, setFocus: h, isValid: g, isFocused: _ } = wt(s, i, r), { parentField: v, statusVariant: y, statusVariantIcon: b } = bt();
r.id && v.value?.setInputId(r.id);
let x = ae(e, "modelValue", {
get: (e) => X(e) ? String(e) : "",
set: (e) => X(e) ? Z(r.number) ? Number(e) : String(e) : e
}), S = o(() => typeof x.value == "string" || typeof x.value == "number" ? String(x.value).length : 0);
if (K(() => x.value, (e) => C(e), { flush: "post" }), j(() => C(x.value)), r.autosize && r.type === "textarea") {
let e = window.ResizeObserver ? new window.ResizeObserver(O) : void 0;
j(() => {
Be && e && a.value && e.observe(a.value);
});
}
function C(e) {
v.value && v.value.setFilled(!!e), r.autosize && O(), g.value || d();
}
let D = I("auto");
function O() {
r.type === "textarea" && (D.value = "auto", T(() => {
s.value && (D.value = s.value.scrollHeight + "px");
}));
}
let k = o(() => r.type === "textarea" && r.autosize ? {
resize: "none",
height: D.value,
overflow: "hidden"
} : {}), A = Tt(M, r.debounce);
function M(e) {
let t = ct(s);
if (!t) return;
let n = t.value;
n !== x.value && (x.value = n, i("input", n, e));
}
let N = o(() => !X(x.value) || x.value === ""), F = o(() => !!(r.passwordReveal || r.statusIcon && b.value || r.clearable && x.value && r.clearIcon || r.iconRight)), ee = o(() => r.passwordReveal ? ne.value : r.clearable && x.value && r.clearIcon ? r.clearIcon : r.iconRight ? r.iconRight : b.value), L = o(() => r.passwordReveal || r.iconRight ? r.iconRightVariant || r.variant : y.value);
function R(e) {
i("icon-click", e), T(() => h());
}
function te(e) {
r.passwordReveal ? H() : r.clearable && (x.value = Z(r.number) ? 0 : ""), r.iconRightClickable && (i("icon-right-click", e), T(() => h()));
}
let z = I(!1), V = o(() => r.passwordReveal ? z.value ? "text" : "password" : r.type), ne = o(() => z.value ? "eye-off" : "eye");
function H() {
z.value = !z.value, T(() => h());
}
let re = ie(), W = o(() => ({
...v?.value?.inputAttrs,
...re
})), oe = $(["rootClass", "o-input"], [
"sizeClass",
"o-input--",
o(() => r.size),
o(() => !!r.size)
], [
"variantClass",
"o-input--",
o(() => y.value || r.variant),
o(() => !!y.value || !!r.variant)
], [
"expandedClass",
"o-input--expanded",
null,
o(() => r.expanded)
], [
"disabledClass",
"o-input--disabled",
null,
o(() => r.disabled)
], [
"roundedClass",
"o-input--rounded",
null,
o(() => r.rounded)
], [
"hasIconRightClass",
"o-input--icon-right",
null,
F
], [
"textareaClass",
"o-input--textarea",
null,
o(() => r.type === "textarea")
]), se = $(["inputClass", "o-input__input"], [
"iconLeftSpaceClass",
"o-input__input--iconspace-left",
null,
o(() => !!r.icon)
], [
"iconRightSpaceClass",
"o-input__input--iconspace-right",
null,
F
], [
"placeholderClass",
"o-input__input--placeholder",
null,
N
]), ce = $(["iconLeftClass", "o-input__icon-left"]), le = $(["iconRightClass", "o-input__icon-right"]), ue = $(["counterClass", "o-input__counter"]);
return t({
checkHtml5Validity: d,
focus: h,
value: x
}), (t, n) => (P(), u("div", {
ref: "rootElement",
"data-oruga": "input",
class: E(U(oe))
}, [
e.icon ? (P(), c(Ut, {
key: 0,
class: E(U(ce)),
clickable: e.iconClickable,
icon: e.icon,
pack: e.iconPack,
size: e.size,
onClick: R
}, null, 8, [
"class",
"clickable",
"icon",
"pack",
"size"
])) : l("", !0),
e.type === "textarea" ? (P(), u("textarea", w({ key: 2 }, W.value, {
id: e.id,
ref: "inputElement",
value: x.value,
"data-oruga-input": "textarea",
class: U(se),
maxlength: e.maxlength,
style: k.value,
placeholder: e.placeholder,
disabled: e.disabled,
onBlur: n[4] ||= (...e) => U(f) && U(f)(...e),
onFocus: n[5] ||= (...e) => U(p) && U(p)(...e),
onInvalid: n[6] ||= (...e) => U(m) && U(m)(...e),
onInput: n[7] ||= (...e) => U(A) && U(A)(...e)
}), null, 16, Gt)) : (P(), u("input", w({ key: 1 }, W.value, {
id: e.id,
ref: "inputElement",
value: x.value,
type: V.value,
"data-oruga-input": V.value,
class: U(se),
maxlength: e.maxlength,
autocomplete: e.autocomplete,
placeholder: e.placeholder,
disabled: e.disabled,
onBlur: n[0] ||= (...e) => U(f) && U(f)(...e),
onFocus: n[1] ||= (...e) => U(p) && U(p)(...e),
onInvalid: n[2] ||= (...e) => U(m) && U(m)(...e),
onInput: n[3] ||= (...e) => U(A) && U(A)(...e)
}), null, 16, Wt)),
F.value ? (P(), c(Ut, {
key: 3,
class: E(U(le)),
icon: ee.value,
pack: e.iconPack,
size: e.size,
variant: L.value,
clickable: e.passwordReveal || e.clearable || e.iconRightClickable,
onClick: te
}, null, 8, [
"class",
"icon",
"pack",
"size",
"variant",
"clickable"
])) : l("", !0),
e.maxlength && e.counter && U(_) && e.type !== "number" ? (P(), u("small", {
key: 4,
class: E(U(ue))
}, B(S.value) + " / " + B(e.maxlength), 3)) : l("", !0)
], 2));
}
}), qt = /* @__PURE__ */ h({
isOruga: !0,
name: "ODropdownItem",
configField: "dropdown",
__name: "DropdownItem",
props: {
override: {
type: Boolean,
default: void 0
},
value: { default: () => W() },
label: { default: void 0 },
disabled: {
type: Boolean,
default: !1
},
clickable: {
type: Boolean,
default: !0
},
hidden: {
type: Boolean,
default: !1
},
tag: { default: void 0 },
itemClass: {},
itemSelectedClass: {},
itemFocusedClass: {},
itemClickableClass: {},
itemDisabledClass: {}
},
emits: ["click"],
setup(e, { emit: t }) {
let n = e, r = t, i = G("rootElement"), { parent: a, item: s } = Ot(i, { data: o(() => ({
value: n.value,
label: n.label,
isViable: f.value,
setHidden: d,
selectItem: () => i.value?.click()
})) }), l = I(!1), u = o(() => n.hidden || l.value);
function d(e) {
l.value = e;
}
let f = o(() => !u.value && !n.disabled && n.clickable), m = o(() => !a.value.disabled && !n.disabled && n.clickable), h = o(() => X(a.value.selected) ? a.value.multiple && Array.isArray(a.value.selected) ? a.value.selected.some((e) => ke(s.value.data.value, e)) : ke(s.value.data.value, a.value.selected) : !1), g = o(() => s.value.identifier === a.value.focsuedIdentifier);
function _(e) {
m.value && (a.value.selectItem(s.value, e), r("click", n.value, e));
}
function v() {
a.value.focusItem(s.value);
}
let y = $(["itemClass", "o-dropdown__item"], [
"itemDisabledClass",
"o-dropdown__item--disabled",
null,
o(() => a.value.disabled || n.disabled)
], [
"itemSelectedClass",
"o-dropdown__item--active",
null,
h
], [
"itemClickableClass",
"o-dropdown__item--clickable",
null,
m
], [
"itemFocusedClass",
"o-dropdown__item--focused",
null,
g
]);
return (t, n) => fe((P(), c(z(e.tag ?? U(a).itemTag), {
id: `${U(a).menuId}-${U(s).identifier}`,
ref: "rootElement",
"data-oruga": "dropdown-item",
"data-id": `dropdown-${U(s).identifier}`,
class: E(U(y)),
role: U(a).selectable ? "option" : "menuitem",
tabindex: "-1",
"aria-selected": U(a).selectable ? h.value : void 0,
"aria-hidden": u.value,
"aria-disabled": e.disabled,
onClick: _,
onMouseenter: v,
onKeydown: [J(_, ["enter"]), J(_, ["space"])]
}, {
default: q(() => [R(t.$slots, "default", {}, () => [p(B(e.label), 1)])]),
_: 3
}, 40, [
"id",
"data-id",
"class",
"role",
"aria-selected",
"aria-hidden",
"aria-disabled"
])), [[ue, !u.value]]);
}
}), Jt = /* @__PURE__ */ h({
inheritAttrs: !1,
__name: "PositionWrapper",
props: {
teleport: {
type: [
Boolean,
String,
Object
],
required: !0
},
trigger: {
type: Object,
default: void 0
},
position: {
type: String,
validator: (e) => [
"auto",
"top",
"bottom",
"left",
"right",
"top-right",
"top-left",
"bottom-left",
"bottom-right"
].includes(e),
required: !0
},
defaultPosition: {
type: String,
validator: (e) => [
"top",
"bottom",
"left",
"right"
].includes(e),
default: "top"
},
disabled: {
type: Boolean,
default: !1
},
disablePositioning: {
type: Boolean,
default: !0
}
},
emits: ["update:position"],
setup(e, { emit: t }) {
let r = {
top: "bottom",
bottom: "top",
right: "left",
left: "right"
}, i = e, a = t, s = o(() => typeof i.teleport == "boolean" ? {
to: zt(),
disabled: !i.teleport
} : {
to: i.teleport,
disabled: !1
}), l = I();
function d(e) {
return l.value = e, T(() => {
_(), h();
}), e;
}
let f = i.position, p = I(), m;
Be && window.ResizeObserver && (m = new window.ResizeObserver(_)), K(() => i.disabled, () => {
i.disabled ? g() : h();
}, {
immediate: !0,
flush: "post"
}), K([
() => !!i.trigger,
() => i.disablePositioning,
() => i.disabled
], () => _(), {
immediate: !0,
flush: "post"
}), A(() => g());
function h() {
Be && !p.value && l.value && (p.value = Lt(ct(l)), p.value && p.value !== document.documentElement ? (p.value.addEventListener("scroll", _, { passive: !0 }), window.ResizeObserver && m && m.observe(p.value)) : (document.addEventListener("scroll", _, { passive: !0 }), window.addEventListener("resize", _)));
}
function g() {
Be && (window.ResizeObserver && m && m.disconnect(), window.removeEventListener("resize", _), document.removeEventListener("scroll", _), p.value = void 0);
}
function _() {
if (i.disabled) return;
let e = i.position;
if (f === "auto" && (e = v(), e != i.position && a("update:position", e)), !i.teleport) return;
let t = ct(l), n = ct(() => i.trigger);
if (t && n) {
let r = n.getBoundingClientRect(), a = r.top + window.scrollY, o = r.left + window.scrollX;
e.includes("bottom") ? a += n.clientHeight : e.includes("top") && (a -= t.clientHeight), e === "left" ? o -= t.clientWidth : e === "right" ? o += n.clientWidth : e.includes("-right") && (o += n.clientWidth - t.clientWidth), (e === "top" || e === "bottom") && (o += n.clientWidth / 2), (e === "left" || e === "right") && (a += n.clientHeight / 2), i.disablePositioning ? (t.style.position = "relative", t.style.top = `${a}px`, t.style.left = `${o}px`) : (t.style.position = "", t.style.top = "", t.style.left = "");
}
}
function v() {
let e = i.defaultPosition;
if (!i.trigger || !l.value || !p.value) return e;
let t = new DOMRect(p.value.offsetLeft, p.value.offsetTop, p.value.clientWidth, p.value.clientHeight), n = ct(l).getBoundingClientRect(), a = b(ct(i.trigger).getBoundingClientRect()), o = b(n), s = (e) => {
let t = a[e], i = o[r[e]];
return new DOMRect(n.x + (t.x - i.x), n.y + (t.y - i.y), n.width, n.height);
}, c = r[i.defaultPosition], u = i.defaultPosition === "top" || i.defaultPosition === "bottom" ? "left" : "top", d = r[u], f = [
i.defaultPosition,
c,
u,
d
], m = 0;
for (let n of f) {
let r = y(t, s(n));
r > m && (m = r, e = n);
}
return e;
}
function y(e, t) {
let n = Math.max(e.left, t.left), r = Math.min(e.right, t.right), i = Math.max(e.top, t.top), a = Math.min(e.bottom, t.bottom);
return Math.max(r - n, 0) * Math.max(a - i, 0);
}
let b = (e) => ({
top: {
x: (e.left + e.right) * .5,
y: e.top
},
bottom: {
x: (e.left + e.right) * .5,
y: e.bottom
},
left: {
x: e.left,
y: (e.top + e.bottom) * .5
},
right: {
x: e.right,
y: (e.top + e.bottom) * .5
}
});
return (e, t) => (P(), c(n, {
to: s.value.to,
disabled: s.value.disabled
}, [s.value.disabled ? R(e.$slots, "default", {
key: 0,
setContent: d
}) : (P(), u("div", w({ key: 1 }, e.$attrs, { style: {
position: "absolute",
left: "0px",
top: "0px"
} }), [R(e.$slots, "default", { setContent: d })], 16))], 8, ["to", "disabled"]));
}
}), Yt = /* @__PURE__ */ h({
isOruga: !0,
name: "ODropdown",
configField: "dropdown",
__name: "Dropdown",
props: /* @__PURE__ */ C({
override: {
type: Boolean,
default: void 0
},
modelValue: { default: void 0 },
multiple: {},
options: { default: void 0 },
active: {
type: Boolean,
default: !1
},
label: { default: void 0 },
disabled: {
type: Boolean,
default: !1
},
inline: {
type: Boolean,
default: !1
},
selectable: {
type: Boolean,
default: !1
},
scrollable: {
type: Boolean,
default: !1
},
maxHeight: { default: () => Q("dropdown.maxHeight", 200) },
position: { default: () => Q("dropdown.position", "bottom-left") },
animation: { default: () => Q("dropdown.animation", "fade") },
expanded: {
type: Boolean,
default: !1
},
menuId: { default: () => W() },
menuTag: { default: () => Q("dropdown.menuTag", "div") },
itemTag: { default: () => Q("dropdown.itemTag", "div") },
triggerTag: { default: () => Q("dropdown.triggerTag", "div") },
openOnHover: {
type: Boolean,
default: () => Q("tooltip.openOnHover", !1)
},
openOnFocus: {
type: Boolean,
default: () => Q("tooltip.openOnFocus", !1)
},
openOnClick: {
type: Boolean,
default: () => Q("tooltip.openOnClick", !0)
},
openOnContextmenu: {
type: Boolean,
default: () => Q("tooltip.openOnContextmenu", !1)
},
delay: { default: void 0 },
keepOpen: {
type: Boolean,
default: () => Q("dropdown.keepOpen", !1)
},
keepFirst: {
type: Boolean,
default: () => Q("dropdown.keepFirst", !1)
},
closeOnOutside: {
type: Boolean,
default: () => Q("dropdown.closeOnOutside", !0)
},
closeOnScroll: {
type: Boolean,
default: () => Q("dropdown.closeOnScroll", !1)
},
selectOnFocus: {
type: Boolean,
default: () => Q("dropdown.selectOnFocus", !1)
},
selectOnClose: {
type: Boolean,
default: () => Q("dropdown.selectOnClose", !1)
},
mobileModal: {
type: Boolean,
default: () => Q("dropdown.mobileModal", !0)
},
desktopModal: {
type: Boolean,
default: () => Q("dropdown.desktopModal", !1)
},
mobileBreakpoint: { default: () => Q("dropdown.mobileBreakpoint") },
teleport: {
type: [
Boolean,
String,
Object
],
default: () => Q("dropdown.teleport", !1)
},
clipScroll: {
type: Boolean,
default: () => Q("dropdown.clipScroll", !1)
},
labelledby: {},
ariaLabel: {},
rootClass: {},
mobileClass: {},
modalClass: {},
teleportClass: {},
inlineClass: {},
disabledClass: {},
expandedClass: {},
positionClass: {},
activeClass: {},
hoverableClass: {},
triggerClass: {},
menuClass: {},
menuPositionClass: {},
menuActiveClass: {},
overlayClass: {},
scrollClipClass: {},
scrollKeepClass: {}
}, {
modelValue: { default: void 0 },
modelModifiers: {},
active: {
type: Boolean,
default: !1
},
activeModifiers: {}
}),
emits: /* @__PURE__ */ C([
"update:model-value",
"update:active",
"select",
"change",
"open",
"close",
"scroll-start",
"scroll-end"
], ["update:modelValue", "update:active"]),
setup(e, { expose: n, emit: r }) {
let a = e, s = r, f = G("triggerRef"), h = I(), { parentField: g } = bt(), _ = a.labelledby ?? g.value?.labelId, v = Et(), y = o(() => At(a.options, v, !0)), b = ae(e, "modelValue"), x = ae(e, "active"), S = I(a.position);
K(() => a.position, (e) => S.value = e);
let { isMobile: C } = _t(a.mobileBreakpoint), D = Be && ze.any(), k = o(() => !a.inline && (C.value && a.mobileModal || !C.value && a.desktopModal)), A = o(() => ({
maxHeight: a.scrollable ? we(a.maxHeight) : null,
overflow: a.scrollable ? "auto" : null
})), j = o(() => a.openOnHover), M = Ft(a.clipScroll);
K(x, (e) => {
e && !a.inline && a.keepFirst && !me.value && ve(1), k.value && M(e);
}, { flush: "post" });
let { childItems: N } = Dt({
rootRef: h,
data: o(() => ({
menuId: a.menuId,
itemTag: a.itemTag,
disabled: a.disabled,
multiple: Z(a.multiple),
selectable: a.selectable,
selected: b.value,
focsuedIdentifier: me.value?.identifier,
selectItem: pe,
focusItem: he
}))
});
K(N, () => {
x.value && !a.inline && a.keepFirst && (me.value = void 0, ve(1));
}, {
deep: !0,
flush: "post"
});
let F = o(() => N.value.some((e) => e.data.isViable));
function ee(e, t) {
let n = _e(me.value?.index == e ? e + t : e, N.value.length);
for (; n !== me.value?.index && !N.value[n].data.isViable; n = _e(n + t, N.value.length));
return N.value[n];
}
Be && (a.scrollable && It(h, {
onScrollEnd: () => s("scroll-end"),
onScrollStart: () => s("scroll-start")
}, { passive: !0 }), a.closeOnOutside && kt([h, f], te, {
trigger: x,
passive: !0
}), a.closeOnScroll && gt(window, "scroll", V, {
trigger: x,
passive: !0
}));
function te(e) {
a.closeOnOutside && (!x.value || a.inline || de(e));
}
function V(e) {
a.closeOnScroll && (!x.value || a.inline || de(e));
}
function ne(e) {
D && j.value && se(e), a.openOnClick && se(e);
}
function re(e) {
a.openOnContextmenu && (e.preventDefault(), le(e));
}
function ie(e) {
a.openOnFocus && le(e);
}
function W(e) {
D || a.openOnHover && le(e);
}
function oe(e) {
D || a.openOnHover && de(e);
}
function se(e) {
a.disabled || (x.value ? de(e) : le(e));
}
let ce;
function le(e) {
a.disabled || x.value || (a.delay ? ce = setTimeout(() => {
x.value = !0, ce = void 0, s("open", e);
}, a.delay) : (T(() => x.value = !0), s("open", e)));
}
function de(e) {
x.value && (ce && clearTimeout(ce), a.selectOnClose && me.value?.data.value && pe(me.value), me.value &&= (ct(me.value.el)?.blur(), void 0), x.value = !1, s("close", e));
}
function pe(e, t) {
let n = e.data.value;
s("select", n), a.selectable && (Z(a.multiple) ? (b.value && Array.isArray(b.value) ? b.value.includes(n) ? b.value = b.value.filter((e) => e !== n) : b.value = [...b.value, n] : b.value = [n], T(() => s("change", b.value))) : b.value !== n && (b.value = n, T(() => s("change", b.value)))), f.value?.focus(), !(a.keepOpen || !x.value || !t) && de(t);
}
let me = I();
function he(e) {
me.value = e;
}
function ge() {
me.value = void 0;
}
function ve(e) {
F.value && ye(ee(me.value?.index || 0, e));
}
function ye(e) {
a.selectOnFocus && e.data.value && pe(e, new FocusEvent("focus", { relatedTarget: H(e.el) })), me.value = e, Rt(h, e.el);
}
function be(e) {
if (!x.value) return le(e);
ve(-1);
}
function xe(e) {
if (!x.value) return le(e);
ve(1);
}
function X(e) {
x.value && me.value && (ye(me.value), me.value.data.selectItem(), e.stopPropagation());
}
function Se(e) {
let t = e.target;
t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" && e.preventDefault(), le(e), F.value && ye(ee(0, 1));
}
function Ce(e) {
let t = e.target;
t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" && e.preventDefault(), le(e), F.value && ye(ee(N.value.length - 1, -1));
}
function Te(e) {
de(e);
}
let Ee = $(["rootClass", "o-dropdown"], [
"disabledClass",
"o-dropdown--disabled",
null,
o(() => a.disabled)
], [
"expandedClass",
"o-dropdown--expanded",
null,
o(() => a.expanded)
], [
"inlineClass",
"o-dropdown--inline",
null,
o(() => a.inline)
], [
"mobileClass",
"o-dropdown--mobile",
null,
C
], [
"modalClass",
"o-dropdown--modal",
null,
k
], [
"hoverableClass",
"o-dropdown--hoverable",
null,
j
], [
"positionClass",
"o-dropdown--position-",
S,
o(() => !!S.value)
], [
"activeClass",
"o-dropdown--active",
null,
o(() => x.value || a.inline)
]), De = $(["triggerClass", "o-dropdown__trigger"]), Oe = $([
"teleportClass",
"o-dropdown--teleport",
null,
o(() => !!a.teleport)
]), ke = $(["overlayClass", "o-dropdown__overlay"]), Ae = $(["menuClass", "o-dropdown__menu"], [
"menuPositionClass",
"o-dropdown__menu--",
S,
o(() => !!S.value)
], [
"menuActiveClass",
"o-dropdown__menu--active",
null,
o(() => x.value || a.inline)
]);
return n({
value: b,
items: N
}), (n, r) => (P(), u("div", {
"data-oruga": "dropdown",
class: E(U(Ee)),
onMouseleave: oe,
onFocusout: oe
}, [e.inline ? l("", !0) : (P(), c(z(e.triggerTag), {
key: 0,
ref_key: "triggerRef",
ref: f,
class: E(U(De)),
role: e.selectable ? "combobox" : void 0,
tabindex: e.disabled ? -1 : null,
"aria-haspopup": e.selectable ? "listbox" : "menu",
"aria-expanded": e.selectable ? x.value : void 0,
"aria-activedescendant": me.value ? `${e.menuId}-${me.value.identifier}` : void 0,
"aria-disabled": e.disabled,
"aria-controls": e.menuId,
"aria-labelledby": e.selectable ? U(_) : void 0,