UNPKG

@oruga-ui/oruga-next

Version:

UI components for Vue.js and CSS framework agnostic

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