UNPKG

@oruga-ui/oruga-next

Version:

UI components for Vue.js and CSS framework agnostic

1,541 lines 373 kB
import { Comment as ql, Text as Kl, Fragment as fe, ref as ne, toRaw as Xt, toValue as Me, getCurrentInstance as Pt, getCurrentScope as It, effectScope as ba, onScopeDispose as Ha, watch as me, isRef as Oa, onMounted as vt, inject as Na, computed as l, provide as Ya, watchEffect as Ot, triggerRef as Qt, nextTick as Ve, onUnmounted as Jt, onBeforeUnmount as ga, defineComponent as ye, createElementBlock as F, openBlock as c, withKeys as oe, normalizeStyle as We, normalizeClass as T, unref as i, createBlock as le, resolveDynamicComponent as Ee, mergeModels as be, useTemplateRef as Fe, useModel as Se, useAttrs as st, createCommentVNode as G, withDirectives as Be, mergeProps as ue, vModelDynamic as xl, vModelText as jl, toDisplayString as ce, useId as ze, withCtx as de, renderSlot as Q, createTextVNode as Oe, Teleport as Ca, createVNode as he, withModifiers as se, Transition as Ge, createElementVNode as pe, vShow as Ie, renderList as $e, useSlots as mt, resolveComponent as ya, readonly as Xl, vModelCheckbox as Ua, vModelSelect as Gl, createSlots as At, createApp as _l, toHandlers as Vt, onBeforeMount as Ql, normalizeProps as Et, guardReactiveProps as Ht, vModelRadio as Jl, toHandlerKey as Zl, TransitionGroup as eo } from "vue"; /*! Oruga v0.11.4 | MIT License | github.com/oruga-ui/oruga */ function to(t) { return t < 0 ? -1 : t > 0 ? 1 : 0; } const ao = Math.sign || to, ot = (t, o) => (t % o + o) % o, tt = (t) => (t < 10 ? "0" : "") + t; function Aa(t, o, a) { return Math.max(o, Math.min(a, t)); } const Xe = (t) => !!t && typeof t == "object" && !Array.isArray(t), lt = (t) => !!t && t instanceof Date && !isNaN(t.getTime()), ke = (t) => t !== null && typeof t < "u", Pe = (t) => ke(t) && t !== "false" && t !== !1, yt = (t) => ke(t) ? t : "", oi = (t, o) => ke(t) ? t : o, ht = (t, o = "px") => ke(t) ? isNaN(t) ? String(t) : String(t) + o : void 0; function lo(t, o, a, e = !1, s = !1) { return a && typeof a == "function" ? (s ? t : [...t]).sort((d, m) => a(d, m, e)) : (s ? t : [...t]).sort((d, m) => { let r = Xe(d) ? Ye(d, o) : d, f = Xe(m) ? Ye(m, o) : m; return typeof r == "boolean" && typeof f == "boolean" ? e ? r > f ? 1 : -1 : r > f ? -1 : 1 : !r && r !== 0 ? 1 : !f && f !== 0 ? -1 : r === f ? 0 : (r = typeof r == "string" ? r.toUpperCase() : r, f = typeof f == "string" ? f.toUpperCase() : f, e ? r > f ? 1 : -1 : r > f ? -1 : 1); }); } function Mt(t, o) { if (!t && o || t && !o) return !1; if (t === o) return !0; if (Xe(t) && Xe(o)) { const a = Object.keys(t), e = Object.keys(o); if (a.length !== e.length) return !1; for (const s of a) { const d = t[s], m = o[s]; if (!Mt(d, m)) return !1; } return !0; } return Array.isArray(t) && Array.isArray(o) ? !(t.length !== o.length || !t.every((a, e) => Mt(a, o[e]))) : !1; } function ni(t) { return typeof HTMLElement == "object" ? t instanceof HTMLElement : t && typeof t == "object" && t !== null && t.nodeType === 1 && typeof t.nodeName == "string"; } function ha(t, o, a = !1) { return !Xe(t) || !Xe(o) ? o : a ? Wa(t, o) : Object.assign(t, o); } function Wa(t, o) { return !Xe(t) || !Xe(o) ? o : (Object.getOwnPropertyNames(o).forEach((a) => { const e = t[a], s = o[a]; Array.isArray(e) && Array.isArray(s) ? t[a] = e.concat(s) : Xe(e) && Xe(s) ? t[a] = Wa( Object.assign({}, e), s ) : t[a] = s; }), t); } function ra(t, o, a) { if (!t) return ""; const e = o ? Ye(t, o) : t, s = typeof a == "function" ? a(e, t) : e; return String(s || ""); } function Ye(t, o, a) { if (!t || typeof t != "object" || typeof o != "string") return a; const e = o.split(".").reduce((s, d) => typeof s < "u" ? s[d] : void 0, t); return typeof e < "u" ? e : a; } function qa(t, o, a) { if (typeof o != "string") return; const e = o.split("."); if (e.length === 1) { t[e[0]] = a; return; } const s = e[0]; return typeof t[s] > "u" && (t[s] = {}), qa(t[s], e.slice(1).join("."), a); } function si(t) { typeof t.remove < "u" ? t.remove() : typeof t.parentNode < "u" && t.parentNode !== null && t.parentNode.removeChild(t); } function oo(t) { return t && t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } function no(t) { return t && t.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } function Ka(t) { return !!(!t || t.type === ql || t.type === Kl && !t.children.trim() || t.type === fe && Ka(t.children)); } const ft = { 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: () => ft.Android() || ft.BlackBerry() || ft.iOS() || ft.Opera() || ft.Windows() }, xa = ne({}); function so(t, o) { xa.value[t] = o; } function io() { return xa.value; } let va; const ja = (t) => { va = t; }, ro = (t, o) => { t.use(o); }, De = (t, o) => { t.component(o.name, o); }, St = (t, o, a) => { ja(t); const e = io(); so(o, a), t._context.provides && t._context.provides.oruga || t.provide("oruga", e), t.config.globalProperties.$oruga || (t.config.globalProperties.$oruga = e); }, Te = typeof window < "u", Xa = typeof window > "u", zt = ne({ iconPack: "mdi", useHtml5Validation: !0, statusIcon: !0, transformClasses: void 0, mobileBreakpoint: "1023px", teleportTarget: () => Te ? document.body : "body" }), Ga = (t) => { zt.value = t; }, Gt = () => Object.assign({}, Xt(zt.value)); function Qe(t, o) { return Ye( zt.value, t, o ); } const n = (t, o) => Ye(zt.value, t, o), uo = (t, o) => { qa(zt.value, t, o); }, co = { getOption: Qe, getOptions: Gt, setOption: uo, setOptions(t) { Ga(ha(Gt(), t, !0)); } }, fo = { install(t, o) { ja(t), Ga(ha(Gt(), o, !0)); } }, po = { sizes: { default: "mdi-24px", small: "", medium: "mdi-36px", large: "mdi-48px" }, iconPrefix: "mdi-" }, Ct = () => { const o = Qe("iconComponent") ? "" : "fa-"; return { sizes: { default: "", small: "sm", medium: "lg", large: "xl" }, iconPrefix: o, 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" } }; }, vo = () => { let t = { mdi: po, fa: Ct(), fas: Ct(), far: Ct(), fad: Ct(), fab: Ct(), fal: Ct() }; const o = Qe("customIconPacks"); return o && (t = ha(t, o, !0)), t; }; function Ne(t) { const o = Me(t); return o?.$el ?? o; } function Va(t) { const o = Me(t); return typeof o == "string" ? document.querySelector(o) : Ne(o); } const Ue = (t) => { const o = Me(t); return o ? o.flatMap( (a) => Object.keys(a).filter((e) => e && a[e]).flatMap((e) => e.split(" ")) ) : []; }; function B(...t) { const o = Array.isArray(t.at(-1)) ? void 0 : t.at(-1), a = Array.isArray(t.at(-1)) ? t : t.slice(0, -1), e = Pt(); if (!e) throw new Error( "defineClasses must be called within a component setup function." ); if (!It() && !o?.scope) throw new Error( "defineClasses must be called within a current active effect scope." ); const s = o?.scope || ba(); It() && Ha(() => { s && s.stop(); }); const d = ne([]); return d.value = a.map((m, r) => { const f = m[0], p = m[1], C = m[2], b = m[3]; function z() { const g = mo( e, f, p, Me(C) || void 0 ), k = !ke(b) || Me(b); return { [g]: k }; } return s.run(() => { me( [ () => e.proxy?.$props[f], () => o?.props ? o?.props[f] : null ], () => { const g = z(); d.value[r] = g; } ), ke(C) && Oa(C) && me(C, (g, k) => { if (g === k) return; const y = z(); d.value[r] = y; }), ke(b) && Oa(b) && me(b, (g, k) => { if (g === k) return; const y = d.value[r]; Object.keys(y).forEach( (w) => y[w] = g ), d.value[r] = y; }); }), z(); }), d; } function mo(t, o, a, e = "") { const s = ua(t), d = t.proxy?.$options.configField; if (!d) throw new Error("component must define the 'configField' option."); const m = s.override === !0 ? {} : Gt(); let r = Ye(m, `${d}.${o}.class`) || Ye(m, `${d}.${o}`), f = Ye(s, o); if (Array.isArray(f) && (f = f.join(" ")), typeof f == "function") { const y = ua(t); f = f(e, y); } else f = za(f ?? "", e); if (Array.isArray(r) && (r = r.join(" ")), typeof r == "function") { const y = ua(t); r = r(e, y); } else r = za(r ?? "", e); a.includes("{*}") ? a = a.replace( /\{\*\}/g, yt(e) ) : a = a + yt(e); const p = s.override || Ye(m, "override", !1), C = Ye( m, `${d}.override`, p ); let z = `${Ye( m, `${d}.${o}.override`, C ) ? "" : a} ${yt(r)} ${yt(f)}`.trim().replace(/\s\s+/g, " "); const g = Ye(m, "transformClasses"), k = Ye( m, `${d}.transformClasses` ); return k ? z = k(z) : g && (z = g(z)), z; } function za(t, o) { return yt(t).split(" ").filter((a) => a.length > 0).map((a) => a + yt(o)).join(" "); } const ua = (t) => { let o = t.proxy?.$props || {}; return o = Object.keys(o).filter((a) => a.endsWith("Props")).map((a) => o[a]).reduce((a, e) => ({ ...a, ...e }), o), o; }; function bt(t, o, a, e) { let s; const d = () => { if (!t) return; const f = Ne(t), p = Xe(e) ? { ...e } : e; setTimeout(() => { f.addEventListener(o, a, p), s = () => { f.removeEventListener(o, a, p); }; }); }; let m; typeof e?.trigger < "u" && (m = me( e.trigger, (f) => { f ? d() : typeof s == "function" && s(); }, { flush: "post" } )), e?.immediate ? d() : It() && vt(() => { (typeof e?.trigger > "u" || e.trigger.value) && d(); }); const r = () => { typeof m == "function" && m(), typeof s == "function" && s(); }; return It() && Ha(r), r; } function it(t) { const o = ne(!1), a = ne(), e = Pt(); if (!e) throw new Error( "useMatchMedia must be called within a component setup function." ); const s = e.props, d = e.proxy?.$options.configField; if (!d) throw new Error("component must define the 'configField' option."); let m = s.mobileBreakpoint; if (!m) { const f = Qe("mobileBreakpoint", t); m = Qe(`${d}.mobileBreakpoint`, f); } if (!m) return { isMobile: o }; a.value = Te ? window.matchMedia(`(max-width: ${m})`) : void 0, a.value ? (o.value = a.value.matches, bt(a.value, "change", r)) : o.value = !1; function r(f) { o.value = f.matches; } return { isMobile: o }; } const _a = Symbol("FielData"); function bo(t) { Ya(_a, t); } function Ke() { const t = Na( _a, l(() => { }) ), o = l(() => { if (!(Array.isArray(t?.value?.message) && !t?.value?.message.length || !Array.isArray(t?.value?.message) && !t?.value?.message)) return t?.value.message; }), a = l(() => { if (t?.value?.variant) { if (typeof t.value.variant == "string") return t.value.variant; if (Array.isArray(t.value.variant)) { for (const d in t.value.variant) if (t.value.variant[d]) return d; } } }), e = Qe("statusVariantIcon", { success: "check", danger: "alert-circle", info: "information", warning: "alert" }), s = l(() => !a.value || !e ? "" : e[a.value] || ""); return { parentField: t, statusVariant: a, statusVariantIcon: s, statusMessage: o }; } const go = Xa ? [] : [ HTMLButtonElement, HTMLFieldSetElement, HTMLInputElement, HTMLObjectElement, HTMLOutputElement, HTMLSelectElement, HTMLTextAreaElement ]; function Ta(t) { return go.some((o) => t instanceof o) ? t : null; } const Co = [ "disabled", "required", "pattern", "maxlength", "minlength", "max", "min", "step" ]; function Je(t, o, a) { const { parentField: e } = Ke(), s = l(() => { const w = Ne(t); if (!w) return; if (w.getAttribute("data-oruga-input")) return w; const V = w.querySelector("[data-oruga-input]"); if (!V) { console.warn( "useInputHandler: Underlaying Oruga input component not found" ); return; } return V; }), d = l(() => { const w = s.value; return w || console.warn("useInputHandler: inputRef contains no element"), w; }), m = ne(!1); function r() { Ve(() => { d.value && d.value.focus(); }); } function f() { Ve(() => { d.value && d.value.click(); }); } function p(w) { m.value = !1, e?.value && e.value.setFocus(!1), o("blur", w || new Event("blur")), g(); } function C(w) { m.value = !0, e?.value && e.value.setFocus(!0), o("focus", w || new Event("focus")); } const b = ne(!0); function z(w, V) { Ve(() => { e?.value && (e.value.props.variant || e.value.setVariant(w), e.value.props.message || e.value.setMessage(V)); }); } function g() { a.useHtml5Validation && d.value && (d.value.validity.valid ? (z(null, null), b.value = !0) : (k(), b.value = !1)); } function k() { const w = "danger", V = d.value?.validationMessage; z(w, V); } function y(w) { g(); const V = Ta(w.target); if (V && e?.value && a.useHtml5Validation) { w.preventDefault(); let A = !1; if (V.form != null) { const $ = V.form.elements; for (let j = 0; j < $.length; ++j) { const R = Ta( $.item(j) ); if (R?.willValidate && !R.validity.valid) { A = V === R; break; } } } if (A) { const $ = e.value.$el, j = Qe("invalidHandler"); if (j instanceof Function) j(V, $ ?? void 0); else { const R = $?.scrollIntoView != null; V.focus({ preventScroll: R }), R && $ && $.scrollIntoView({ block: "nearest" }); } } } o("invalid", w); } if (!Xa) { const w = ne(null); Ot(() => { if (w.value, !(a.useHtml5Validation ?? !0)) return; const $ = s.value; if (!ke($)) return; const j = a.customValidity ?? ""; typeof j == "string" ? $.setCustomValidity(j) : $.setCustomValidity( j(a.modelValue, $.validity) ), b.value || g(); }), me( [s, () => a.useHtml5Validation ?? !0], ($, j) => { const R = $[0], L = $[1], E = j[0], I = j[1]; R !== E ? E?.setCustomValidity("") : I && !L && R?.setCustomValidity(""); } ); const V = () => { Qt(w); }; let A = null; me( [ s, b, () => a.useHtml5Validation ?? !0, () => a.customValidity ], ($, j) => { const R = $[0], L = $[1], E = $[2], I = $[3] instanceof Function, M = j[0], S = ke(R) && E && // For inputs known to be invalid, changes in constraint validation properties // may make it so the field is now valid and the message needs to be hidden. // For browser-implemented constraint validation (e.g. the `required` attribute), // we just care about the message displayed to the user, which is hidden for valid inputs // until the next interaction with the control. (!L || // For inputs with complex custom validation, any changes to validation-related attributes // may affect the results of `props.customValidity`. I); if ((!S || R !== M) && A != null && (A.takeRecords().length > 0 && V(), A.disconnect(), A = null), S && ke(R) && (A == null || R !== M)) { A == null && (A = new MutationObserver( V )), A.observe(R, { attributeFilter: Co }); let N = R; for (; N = N.parentNode; ) N instanceof HTMLFieldSetElement && A.observe(N, { attributeFilter: ["disabled"] }); } } ); } return { input: d, isFocused: m, isValid: b, setFocus: r, doClick: f, onFocus: C, onBlur: p, onInvalid: y, checkHtml5Validity: g }; } function Zt(t, o, a) { let e; return (...s) => { const d = () => { e = void 0, a || t.apply(this, s); }, m = a && !e; e && clearTimeout(e), e = setTimeout(d, o), m && t.apply(this, s); }; } function Ze(t = 0) { let o = t; function a() { return String(o++); } return { nextSequence: a, sequence: o }; } function rt(t) { const o = Pt(); if (!o) throw new Error( "useProviderChild must be called within a component setup function." ); const a = o.proxy?.$options.configField, e = t?.key || a, s = ne([]); if (t?.rootRef) { const f = Zt((p) => { const C = Ne(t.rootRef); if (!C) return; const b = p.map((k) => `[data-id="${e}-${k.identifier}"]`).join(","); if (!b) return; const z = C.querySelectorAll(b), g = Array.from(z).map( (k) => k.getAttribute("data-id")?.replace(`${e}-`, "") ); p.forEach( (k) => k.index = g.indexOf(`${k.identifier}`) ), p.sort((k, y) => k.index - y.index); }, 500); me(s, f); } const { nextSequence: d } = Ze(1); function m(f) { const p = s.value.length, C = d(), b = { index: p, data: f, identifier: C }; return s.value = [ ...s.value, b ], b; } function r(f) { s.value = s.value.filter((p) => p !== f); } return Ya("$o-" + e, { registerItem: m, unregisterItem: r, data: t?.data }), { childItems: s }; } function nt(t) { t = Object.assign({ needParent: !0, register: !0 }, t); const o = Pt(); if (!o) throw new Error( "useProviderChild must be called within a component setup function." ); const a = o.proxy?.$options.configField, e = t?.key || a, s = Na("$o-" + e, void 0); if (t.needParent && !s) throw new Error( `You should wrap ${o.proxy?.$options.name} in a ${e} component` ); const d = ne(); return s && t.register && (d.value = s.registerItem( t?.data )), Jt(() => { s && d.value && s.unregisterItem(d.value); }), { parent: s?.data || ne(), item: d }; } function ea(t, o, a) { if (!window) return () => { }; const e = Object.assign({ ignore: [] }, a), s = Array.isArray(t) ? t : [t], d = (f) => s.some((p) => { if (typeof p == "string") return Array.from( window.document.querySelectorAll(p) ).some( (C) => C === f.target || f.composedPath().includes(C) ); { const C = Ne(p); return C && (f.target === C || f.composedPath().includes(C)); } }); function m(f) { d(f) || o(f); } return bt(window, "click", m, e); } function et(t, o) { return t ? Array.isArray(t) ? t.map( (a) => { if (typeof a == "string" || typeof a == "number") return { label: String(a), value: String(a), key: o() }; if (typeof a == "object") { if ("options" in a) { const e = et(a.options, o); return { ...a, options: e, key: o() }; } else if ("value" in a) return { ...a, key: o() }; } return a; } ) : Object.keys(t).map( (a) => ({ // create option from object key/value label: t[a], value: a, key: o() }) ) : []; } function Dt(t) { return t && typeof t == "object" && Array.isArray(t.options); } function ka(t, o) { return Array.isArray(t) ? t.some((e) => Dt(e)) ? [...t] : [{ options: t, key: o }] : []; } function yo(t) { return Array.isArray(Me(t)) ? Me(t).reduce((o, a) => (o.push(...a.options), o), []) : []; } function wa(t, o) { Me(t).forEach( (a, e) => { Dt(a) ? (wa(a.options, o), a.hidden = a.options.every((s) => s.hidden)) : a.hidden = o(a, e); } ); } function Qa(t) { return Array.isArray(Me(t)) ? Me(t).every((o) => Dt(o) ? Qa(o.options) : !Ja(o)) : !0; } function _t(t, o) { if (Array.isArray(Me(t))) { for (const a of Me(t)) if (!(typeof a != "object" && a)) { if (Dt(a)) { const e = _t(a.options, o); if (e !== void 0) return e; } else if (Mt(Me(o), a.value)) return a; } } } function Ja(t) { return !Me(t).hidden && !Me(t).attrs?.disabled; } function ta(t) { const o = B([ "scrollClipClass", "o-scroll-clip" ]), a = B([ "scrollKeepClass", "o-scroll-keep" ]), e = l( () => Ue( Me(t) ? o.value : a.value ) ), s = ne(); ga(() => d(!1)); function d(m) { Te && e.value && (s.value = s.value ? s.value : document.documentElement.scrollTop, m ? document.body.classList.add(...e.value) : document.body.classList.remove(...e.value), Me(t) || (m ? document.body.style.top = `-${s.value}px` : (document.documentElement.scrollTop = s.value, document.body.style.top = "", s.value = void 0))); } return d; } function ho(t, o) { if (!It()) throw new Error( "The 'useScrollEvents' composable should be used inside a current EffectScope." ); const a = Zt( e, o.debounce ?? 100 ); Te && bt(t, "scroll", a, { passive: !0 }); function e() { const s = Ne(t); if (!s) return; o.onScroll && o.onScroll(); const d = s.offsetTop; s.clientHeight !== s.scrollHeight && (Math.ceil(s.scrollTop + s.clientHeight + d) >= s.scrollHeight ? o.onScrollEnd && o.onScrollEnd() : s.scrollTop <= d && o.onScrollStart && o.onScrollStart()); } return a; } function ko(t) { if (t.style.position === "fixed" || !t) return document.documentElement; let o = !1, a = t.parentElement; for (; !o && ke(a) && a !== document.documentElement; ) { const { overflow: e, overflowY: s } = getComputedStyle(a), { scrollHeight: d, clientHeight: m } = a; if (o = /(auto|scroll)/.test(`${e}${s}`) && d > m, o) break; a = a.parentElement; } return a; } function wo(t, o) { const a = Ne(t), e = Ne(o), { offsetHeight: s, offsetTop: d } = e, { offsetHeight: m, scrollTop: r } = a, f = d < r, p = d + s > r + m; f ? a.scrollTo(0, d) : p && a.scrollTo(0, d - m + s); } function aa() { const t = Qe("teleportTarget", "body"); return Me(t); } function Po(t) { return Me(t).querySelectorAll(`a[href]:not([tabindex="-1"]), area[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex]:not([tabindex="-1"]):not([disabled]), *[contenteditable]`); } function Za() { let t = null; function o(d, m) { m ? (d.focus({ preventScroll: !0 }), typeof t == "function" && d.addEventListener("keydown", t)) : typeof t == "function" && d.removeEventListener("keydown", t); } return { vTrapFocus: { mounted: (d, { value: m }) => { t = (r) => { const f = r.target; if (!f) return; const p = Po(d); if (!p?.length) { r.preventDefault(); return; } const C = p[0], b = p[p.length - 1]; f === C && r.shiftKey && r.key === "Tab" ? (r.preventDefault(), b.focus()) : f === b && !r.shiftKey && r.key === "Tab" && (r.preventDefault(), C.focus()); }, m && o(d, m); }, beforeUnmount: (d) => { o(d, !1), t = null; }, updated: (d, { value: m, oldValue: r }) => { m !== r && o(d, m); } } }; } const So = ["tabindex", "role"], Ae = /* @__PURE__ */ ye({ isOruga: !0, name: "OIcon", configField: "icon", __name: "Icon", props: { override: { type: Boolean, default: void 0 }, icon: { default: void 0 }, component: { default: () => n("iconComponent") }, pack: { default: () => n("iconPack", "mdi") }, variant: { default: () => n("icon.variant") }, size: { default: () => n("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(t, { emit: o }) { const a = t, e = o, s = Qe("environment"), d = l(() => { const y = {}; return a.rotation && (y.transform = `rotate(${a.rotation}deg)`), y; }), m = vo(), r = l(() => m[a.pack]), f = l(() => r.value?.iconPrefix ?? ""), p = l(() => { if (r.value?.sizes) { if (a.size && r.value.sizes[a.size] !== void 0) return r.value.sizes[a.size]; if (r.value.sizes.default) return r.value.sizes.default; } return null; }), C = l(() => a.customSize || p.value), b = l( () => `${f.value}${z(a.icon ?? "")}` ); function z(y) { return s != "docs" ? y : r.value?.internalIcons && r.value?.internalIcons[y] ? r.value.internalIcons[y] : y; } function g(y) { a.clickable && (y.preventDefault(), e("click", y)); } const k = B( ["rootClass", "o-icon"], [ "clickableClass", "o-icon--clickable", null, l(() => a.clickable) ], ["spinClass", "o-icon--spin", null, l(() => a.spin)], [ "sizeClass", "o-icon--", l(() => a.size), l(() => !!a.size) ], [ "variantClass", "o-icon--", l(() => a.variant), l(() => !!a.variant) ] ); return (y, w) => (c(), F("span", { "data-oruga": "icon", class: T(i(k)), style: We(d.value), tabindex: y.clickable ? 0 : void 0, role: y.clickable ? "button" : void 0, onClick: g, onKeydown: [ oe(g, ["enter"]), oe(g, ["space"]) ] }, [ y.component ? (c(), le(Ee(y.component), { key: 0, icon: [y.pack, b.value], size: C.value, class: T([y.customClass]) }, null, 8, ["icon", "size", "class"])) : (c(), F("i", { key: 1, class: T([y.pack, b.value, C.value, y.customClass]) }, null, 2)) ], 46, So)); } }), Do = ["id", "type", "data-oruga-input", "maxlength", "autocomplete", "placeholder", "disabled"], $o = ["id", "maxlength", "placeholder", "disabled"], kt = /* @__PURE__ */ ye({ isOruga: !0, name: "OInput", configField: "input", inheritAttrs: !1, __name: "Input", props: /* @__PURE__ */ be({ override: { type: Boolean, default: void 0 }, modelValue: { default: void 0 }, number: {}, type: { default: "text" }, size: { default: () => n("input.size") }, variant: { default: () => n("input.variant") }, placeholder: { default: void 0 }, expanded: { type: Boolean, default: () => n("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: () => n("input.counter", !1) }, autosize: { type: Boolean, default: !1 }, iconPack: { default: () => n("input.iconPack") }, icon: { default: () => n("input.icon") }, iconClickable: { type: Boolean, default: !1 }, iconRight: { default: () => n("input.iconRight") }, iconRightClickable: { type: Boolean, default: !1 }, iconRightVariant: { default: void 0 }, clearable: { type: Boolean, default: () => n("input.clearable", !1) }, clearIcon: { default: () => n("input.clearIcon", "close-circle") }, statusIcon: { type: Boolean, default: () => n("statusIcon", !0) }, debounce: { default: () => n("autocomplete.debounce", 400) }, autocomplete: { default: () => n("input.autocomplete", "off") }, id: { default: () => ze() }, useHtml5Validation: { type: Boolean, default: () => n("useHtml5Validation", !0) }, customValidity: { type: [String, Function], default: "" }, rootClass: {}, sizeClass: {}, variantClass: {}, expandedClass: {}, roundedClass: {}, disabledClass: {}, textareaClass: {}, hasIconRightClass: {}, inputClass: {}, iconLeftSpaceClass: {}, iconRightSpaceClass: {}, placeholderClass: {}, iconLeftClass: {}, iconRightClass: {}, counterClass: {} }, { modelValue: { // cast incomming value to string default: void 0 }, modelModifiers: {} }), emits: /* @__PURE__ */ be(["update:model-value", "input", "focus", "blur", "invalid", "icon-click", "icon-right-click"], ["update:modelValue"]), setup(t, { expose: o, emit: a }) { const e = t, s = a, d = Fe("inputElement"), { checkHtml5Validity: m, onBlur: r, onFocus: f, onInvalid: p, setFocus: C, isValid: b, isFocused: z } = Je(d, s, e), { parentField: g, statusVariant: k, statusVariantIcon: y } = Ke(), w = Se(t, "modelValue", { // cast incomming value to string get: (U) => ke(U) ? String(U) : "", // cast outgoing value to number if prop number is true set: (U) => ke(U) ? Pe(e.number) ? Number(U) : String(U) : U }); e.id && g?.value?.setInputId(e.id); const V = l( () => typeof w.value == "string" || typeof w.value == "number" ? String(w.value).length : 0 ); vt(() => { me( () => w.value, (U) => { g?.value && g.value.setFilled(!!U), e.autosize && $(), b.value || m(); }, { immediate: !0, flush: "post" } ); }); const A = ne("auto"); function $() { A.value = "auto", Ve(() => { if (e.type !== "textarea" || !d.value) return; const U = d.value.scrollHeight; A.value = U + "px"; }); } const j = l( () => e.type === "textarea" && e.autosize ? { resize: "none", height: A.value, overflow: "hidden" } : {} ); let R; me( () => e.debounce, (U) => R = Zt(L, U || 0), { immediate: !0 } ); function L(U) { s("input", w.value, U); } const E = l( () => !ke(w.value) || w.value === "" ), I = l(() => !!(e.passwordReveal || e.statusIcon && y.value || e.clearable && w.value && e.clearIcon || e.iconRight)), M = l(() => e.passwordReveal ? K.value : e.clearable && w.value && e.clearIcon ? e.clearIcon : e.iconRight ? e.iconRight : y.value), S = l( () => e.passwordReveal || e.iconRight ? e.iconRightVariant || e.variant : k.value ); function N(U) { s("icon-click", U), Ve(() => C()); } function Y(U) { e.passwordReveal ? x() : e.clearable && (w.value = Pe(e.number) ? 0 : ""), e.iconRightClickable && (s("icon-right-click", U), Ve(() => C())); } const ae = ne(!1), te = l(() => e.passwordReveal ? ae.value ? "text" : "password" : e.type), K = l( () => ae.value ? "eye-off" : "eye" ); function x() { ae.value = !ae.value, Ve(() => C()); } const h = st(), u = l(() => ({ ...g?.value?.inputAttrs, ...h })), D = B( ["rootClass", "o-input"], [ "sizeClass", "o-input--", l(() => e.size), l(() => !!e.size) ], [ "variantClass", "o-input--", l(() => k.value || e.variant), l(() => !!k.value || !!e.variant) ], [ "expandedClass", "o-input--expanded", null, l(() => e.expanded) ], [ "disabledClass", "o-input--disabled", null, l(() => e.disabled) ], ["roundedClass", "o-input--rounded", null, l(() => e.rounded)], ["hasIconRightClass", "o-input--icon-right", null, I], [ "textareaClass", "o-input--textarea", null, l(() => e.type === "textarea") ] ), O = B( ["inputClass", "o-input__input"], [ "iconLeftSpaceClass", "o-input__input--iconspace-left", null, l(() => !!e.icon) ], [ "iconRightSpaceClass", "o-input__input--iconspace-right", null, I ], [ "placeholderClass", "o-input__input--placeholder", null, E ] ), ee = B(["iconLeftClass", "o-input__icon-left"]), X = B([ "iconRightClass", "o-input__icon-right" ]), W = B(["counterClass", "o-input__counter"]); return o({ checkHtml5Validity: m, focus: C, value: w }), (U, Z) => (c(), F("div", { "data-oruga": "input", class: T(i(D)) }, [ U.icon ? (c(), le(Ae, { key: 0, class: T(i(ee)), clickable: U.iconClickable, icon: U.icon, pack: U.iconPack, size: U.size, onClick: N }, null, 8, ["class", "clickable", "icon", "pack", "size"])) : G("", !0), U.type !== "textarea" ? Be((c(), F("input", ue({ key: 1 }, u.value, { id: U.id, ref: "inputElement", "onUpdate:modelValue": Z[0] || (Z[0] = (Ce) => w.value = Ce), type: te.value, "data-oruga-input": te.value, class: i(O), maxlength: U.maxlength, autocomplete: U.autocomplete, placeholder: U.placeholder, disabled: U.disabled, onBlur: Z[1] || (Z[1] = //@ts-ignore (...Ce) => i(r) && i(r)(...Ce)), onFocus: Z[2] || (Z[2] = //@ts-ignore (...Ce) => i(f) && i(f)(...Ce)), onInvalid: Z[3] || (Z[3] = //@ts-ignore (...Ce) => i(p) && i(p)(...Ce)), onInput: Z[4] || (Z[4] = //@ts-ignore (...Ce) => i(R) && i(R)(...Ce)) }), null, 16, Do)), [ [xl, w.value] ]) : Be((c(), F("textarea", ue({ key: 2 }, u.value, { id: U.id, ref: "inputElement", "onUpdate:modelValue": Z[5] || (Z[5] = (Ce) => w.value = Ce), "data-oruga-input": "textarea", class: i(O), maxlength: U.maxlength, style: j.value, placeholder: U.placeholder, disabled: U.disabled, onBlur: Z[6] || (Z[6] = //@ts-ignore (...Ce) => i(r) && i(r)(...Ce)), onFocus: Z[7] || (Z[7] = //@ts-ignore (...Ce) => i(f) && i(f)(...Ce)), onInvalid: Z[8] || (Z[8] = //@ts-ignore (...Ce) => i(p) && i(p)(...Ce)), onInput: Z[9] || (Z[9] = //@ts-ignore (...Ce) => i(R) && i(R)(...Ce)) }), null, 16, $o)), [ [jl, w.value] ]), I.value ? (c(), le(Ae, { key: 3, class: T(i(X)), icon: M.value, pack: U.iconPack, size: U.size, variant: S.value, clickable: U.passwordReveal || U.clearable || U.iconRightClickable, onClick: Y }, null, 8, ["class", "icon", "pack", "size", "variant", "clickable"])) : G("", !0), U.maxlength && U.counter && i(z) && U.type !== "number" ? (c(), F("small", { key: 4, class: T(i(W)) }, ce(V.value) + " / " + ce(U.maxlength), 3)) : G("", !0) ], 2)); } }), at = /* @__PURE__ */ ye({ isOruga: !0, name: "ODropdownItem", configField: "dropdown", __name: "DropdownItem", props: { override: { type: Boolean, default: void 0 }, value: { default: void 0 }, label: { default: void 0 }, disabled: { type: Boolean, default: !1 }, clickable: { type: Boolean, default: !0 }, hidden: { type: Boolean, default: !1 }, tag: { default: () => n("dropdown.itemTag", "div") }, itemClass: {}, itemSelectedClass: {}, itemFocusedClass: {}, itemClickableClass: {}, itemDisabledClass: {} }, emits: ["click"], setup(t, { emit: o }) { const a = t, e = o, s = a.value ?? ze(), d = Fe("rootElement"), m = l(() => ({ ...a, $el: d.value, value: s, selectItem: z })), { parent: r, item: f } = nt({ data: m }), p = l( () => !r.value.disabled && !a.disabled && a.clickable ), C = l(() => ke(r.value.selected) ? r.value.multiple && Array.isArray(r.value.selected) ? r.value.selected.some( (y) => Mt(s, y) ) : Mt(s, r.value.selected) : !1), b = l( () => f.value.identifier === r.value.focsuedIdentifier ); function z(y) { p.value && (r.value.selectItem(f.value, y), e("click", s, y)); } function g() { r.value.focusItem(f.value); } const k = B( ["itemClass", "o-dropdown__item"], [ "itemDisabledClass", "o-dropdown__item--disabled", null, l(() => r.value.disabled || a.disabled) ], ["itemSelectedClass", "o-dropdown__item--active", null, C], ["itemClickableClass", "o-dropdown__item--clickable", null, p], ["itemFocusedClass", "o-dropdown__item--focused", null, b] ); return (y, w) => (c(), le(Ee(y.tag), { id: `${i(r).menuId}-${i(f).identifier}`, ref: "rootElement", "data-oruga": "dropdown-item", "data-id": `dropdown-${i(f).identifier}`, class: T(i(k)), role: i(r).selectable ? "option" : "menuitem", tabindex: "-1", "aria-selected": i(r).selectable ? C.value : void 0, "aria-disabled": y.disabled, onClick: z, onMouseenter: g, onKeydown: [ oe(z, ["enter"]), oe(z, ["space"]) ] }, { default: de(() => [ Q(y.$slots, "default", {}, () => [ Oe(ce(y.label), 1) ]) ]), _: 3 }, 40, ["id", "data-id", "class", "role", "aria-selected", "aria-disabled"])); } }), el = /* @__PURE__ */ ye({ inheritAttrs: !1, __name: "PositionWrapper", props: { teleport: { type: [Boolean, String, Object], required: !0 }, trigger: { type: Object, default: void 0 }, /** * Position of the component relative to the trigger * @values auto, top, bottom, left, right, top-right, top-left, bottom-left, bottom-right */ position: { type: String, validator: (t) => [ "auto", "top", "bottom", "left", "right", "top-right", "top-left", "bottom-left", "bottom-right" ].includes(t), required: !0 }, /** Used for calculation position auto */ defaultPosition: { type: String, validator: (t) => ["top", "bottom", "left", "right"].includes(t), default: "top" }, /** disable the position calculation */ disabled: { type: Boolean, default: !1 }, /** update positioning on teleport */ disablePositioning: { type: Boolean, default: !0 } }, emits: ["update:position"], setup(t, { emit: o }) { const a = { top: "bottom", bottom: "top", right: "left", left: "right" }, e = t, s = o, d = l( () => typeof e.teleport == "boolean" ? { to: aa(), disabled: !e.teleport } : { to: e.teleport, disabled: !1 } ), m = ne(); function r(V) { return m.value = V, Ve(() => { g(), b(); }), V; } const f = e.position, p = ne(); let C; Te && window.ResizeObserver && (C = new window.ResizeObserver(g)), me( () => e.disabled, () => { e.disabled ? z() : b(); }, { immediate: !0, flush: "post" } ), me( [ () => !!e.trigger, () => e.disablePositioning, () => e.disabled ], () => g(), { immediate: !0, flush: "post" } ), ga(() => z()); function b() { Te && !p.value && m.value && (p.value = ko(Ne(m)), p.value && p.value !== document.documentElement ? (p.value.addEventListener( "scroll", g, { passive: !0 } ), window.ResizeObserver && C && C.observe(p.value)) : (document.addEventListener("scroll", g, { passive: !0 }), window.addEventListener("resize", g))); } function z() { Te && (window.ResizeObserver && C && C.disconnect(), window.removeEventListener("resize", g), document.removeEventListener("scroll", g), p.value = void 0); } function g() { if (e.disabled) return; let V = e.position; if (f === "auto" && (V = k(), V != e.position && s("update:position", V)), !e.teleport) return; const A = Ne(m), $ = Ne(e.trigger); if (A && $) { const j = $.getBoundingClientRect(); let R = j.top + window.scrollY, L = j.left + window.scrollX; V.includes("bottom") ? R += $.clientHeight : V.includes("top") && (R -= A.clientHeight), V === "left" ? L -= A.clientWidth : V === "right" ? L += $.clientWidth : V.includes("-right") && (L += $.clientWidth - A.clientWidth), (V === "top" || V === "bottom") && (L += $.clientWidth / 2), (V === "left" || V === "right") && (R += $.clientHeight / 2), e.disablePositioning ? (A.style.position = "relative", A.style.top = `${R}px`, A.style.left = `${L}px`) : (A.style.position = "", A.style.top = "", A.style.left = ""); } } function k() { let V = e.defaultPosition; if (!e.trigger || !m.value || !p.value) return V; const A = new DOMRect( p.value.offsetLeft, p.value.offsetTop, p.value.clientWidth, p.value.clientHeight ), $ = Ne(m).getBoundingClientRect(), j = Ne(e.trigger).getBoundingClientRect(), R = w(j), L = w($), E = (ae) => { const te = R[ae], K = L[a[ae]]; return new DOMRect( $.x + (te.x - K.x), $.y + (te.y - K.y), $.width, $.height ); }, I = a[e.defaultPosition], M = e.defaultPosition === "top" || e.defaultPosition === "bottom" ? "left" : "top", S = a[M], N = [ e.defaultPosition, I, M, S ]; let Y = 0; for (const ae of N) { const te = y( A, E(ae) ); te > Y && (Y = te, V = ae); } return V; } function y(V, A) { const $ = Math.max(V.left, A.left), j = Math.min(V.right, A.right), R = Math.max(V.top, A.top), L = Math.min(V.bottom, A.bottom); return Math.max(j - $, 0) * Math.max(L - R, 0); } const w = (V) => ({ top: { x: (V.left + V.right) * 0.5, y: V.top }, bottom: { x: (V.left + V.right) * 0.5, y: V.bottom }, left: { x: V.left, y: (V.top + V.bottom) * 0.5 }, right: { x: V.right, y: (V.top + V.bottom) * 0.5 } }); return (V, A) => (c(), le(Ca, { to: d.value.to, disabled: d.value.disabled }, [ d.value.disabled ? Q(V.$slots, "default", { key: 0, setContent: r }) : (c(), F("div", ue({ key: 1 }, V.$attrs, { style: { position: "absolute", left: "0px", top: "0px" } }), [ Q(V.$slots, "default", { setContent: r }) ], 16)) ], 8, ["to", "disabled"])); } }), Bo = { key: 1 }, Pa = /* @__PURE__ */ ye({ isOruga: !0, name: "ODropdown", configField: "dropdown", __name: "Dropdown", props: /* @__PURE__ */ be({ 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 }, checkScroll: { type: Boolean, default: () => n("dropdown.checkScroll", !1) }, maxHeight: { default: () => n("dropdown.maxHeight", 200) }, position: { default: () => n("dropdown.position", "bottom-left") }, animation: { default: () => n("dropdown.animation", "fade") }, expanded: { type: Boolean, default: !1 }, menuId: { default: () => ze() }, menuTag: { default: () => n("dropdown.menuTag", "div") }, triggerTag: { default: () => n("dropdown.triggerTag", "div") }, triggers: { default: () => n("dropdown.triggers", ["click"]) }, delay: { default: void 0 }, keepOpen: { type: Boolean, default: () => n("dropdown.keepOpen", !1) }, keepFirst: { type: Boolean, default: () => n("dropdown.keepFirst", !1) }, closeOnOutside: { type: Boolean, default: () => n("dropdown.closeOnOutside", !0) }, closeOnScroll: { type: Boolean, default: () => n("dropdown.closeOnScroll", !1) }, selectOnFocus: { type: Boolean, default: () => n("dropdown.selectOnFocus", !1) }, selectOnClose: { type: Boolean, default: () => n("dropdown.selectOnClose", !1) }, mobileModal: { type: Boolean, default: () => n("dropdown.mobileModal", !0) }, desktopModal: { type: Boolean, default: () => n("dropdown.desktopModal", !1) }, mobileBreakpoint: { default: () => n("dropdown.mobileBreakpoint") }, teleport: { type: [Boolean, String, Object], default: () => n("dropdown.teleport", !1) }, clipScroll: { type: Boolean, default: () => n("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__ */ be(["update:model-value", "update:active", "select", "change", "open", "close", "scroll-start", "scroll-end"], ["update:modelValue", "update:active"]), setup(t, { expose: o, emit: a }) { const e = t, s = a, d = ne(), m = ne(), r = l(() => ({ disabled: e.disabled, multiple: Pe(e.multiple), selectable: e.selectable, menuId: e.menuId, selected: g.value, focsuedIdentifier: D.value?.identifier, selectItem: u, focusItem: O })), { childItems: f } = rt({ rootRef: m, data: r }), { nextSequence: p } = Ze(), C = l(() => { const P = et(e.options, p); return ka(P, p()); }), b = l(() => f.value.some(qe)), { parentField: z } = Ke(), g = Se(t, "modelValue"), k = Se(t, "active"), y = e.labelledby ?? z.value?.labelId, w = ne(e.position); me( () => e.position, (P) => w.value = P ); const { isMobile: V } = it(e.mobileBreakpoint), A = Te && ft.any(), $ = l( () => !e.inline && (V.value && e.mobileModal || !V.value && e.desktopModal) ), j = l(() => ({ maxHeight: e.scrollable ? ht(e.maxHeight) : null, overflow: e.scrollable ? "auto" : null })), R = l(() => e.triggers.includes("hover")), L = ta(e.clipScroll); Te && e.scrollable && e.checkScroll && ho(m, { onScrollEnd: () => s("scroll-end"), onScrollStart: () => s("scroll-start") }), Te && e.closeOnOutside && ea([m, d], E, { trigger: k, passive: !0 }), Te && e.closeOnScroll && bt(window, "scroll", I, { passive: !0 }), me( k, (P) => { P && !e.inline && e.keepFirst && !D.value && ee(1), $.value && L(P); }, { flush: "post" } ), me( f, () => { k.value && !e.inline && e.keepFirst && (D.value = void 0, ee(1)); }, { deep: !0, flush: "post" } ); function E(P) { !k.value || e.inline || e.closeOnOutside && h("outside", P); } function I(P) { !k.value || e.inline || e.closeOnScroll && h("scroll", P); } function M(P) { A && R.value && te("click", P), e.triggers.includes("click") && te("click", P); } function S(P) { e.triggers.includes("contextmenu") && (P.preventDefault(), x("contextmenu", P)); } function N(P) { e.triggers.includes("focus") && x("focus", P); } function Y(P) { A || e.triggers.includes("hover") && x("hover", P); } function ae(P) { A || e.triggers.includes("hover") && h("outside", P); } function te(P, q) { e.disabled || (k.value ? h(P, q) : x(P, q)); } let K; function x(P, q) { e.disabled || k.value || (e.delay ? K = setTimeout(() => { k.value = !0, s("open", P, q), K = void 0; }, e.delay) : (Ve(() => k.value = !0), s("open", P, q))); } function h(P, q) { k.value && (s("close", P, q), e.selectOnClose && D.value?.data?.value && u(D.value), k.value = !1, D.value = void 0, K && clearTimeout(K)); } function u(P, q) { const re = P.data.value; s("select", re), e.selectable && (Pe(e.multiple) ? (g.value && Array.isArray(g.value) ? g.value.includes(re) ? g.value = g.value.filter( (ge) => ge !== re ) : g.value = [...g.value, re] : g.value = [re], Ve(() => s("change", g.value))) : g.value !== re && (g.value = re, Ve(() => s("change", g.value)))), d.value?.focus(), !(e.keepOpen || !k.value || !q) && h("content", q); } const D = ne(); function O(P) { D.value = P; } function ee(P) { if (!b.value) return; const q = Re(D.value?.index || 0, P); X(q); } function X(P) { e.selectOnFocus && P.data?.value && u(P, new Event("focus")); const q = Ne(m), re = Ne(P.data?.$el); !q || !re || (D.value = P, wo(q, re)); } function W(P) { if (!k.value) return x("keydown", P