uikit/dist/remote-ui-app-sidebar.js
Mohamadzadeh f153156a66
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Successful in 50s
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Successful in 7s
add loading to pagination and update demo page
2026-10-04 12:29:46 +03:30

109 lines
2.6 KiB
JavaScript

import n, { useRef as p, useEffect as m } from "react";
import { R as E, D as d } from "./chunks/constants-CRZ9QfxV.js";
import { createRoot as b } from "react-dom/client";
const c = /* @__PURE__ */ new Map();
function S() {
if (typeof window > "u") return;
const e = window[E] || {};
window[E] = {
...e,
React: e.React || n,
createRoot: e.createRoot || b
};
}
function A(e, t) {
const r = `${e}:${t}`;
return c.has(r) || c.set(
r,
import(
/* webpackIgnore: true */
/* @vite-ignore */
t
).catch((o) => {
throw c.delete(r), o;
})
), c.get(r);
}
function y({
componentName: e,
tagName: t,
defaultRemoteUrl: r,
normalizeProps: o
}) {
return function(l) {
const i = p(null), u = p(null), s = p(null);
return s.current = o ? o(l) : l, m(() => {
let f = !0;
return S(), A(e, r).then(() => {
if (!f || !i.current) return;
const a = document.createElement(t);
a.componentProps = s.current, i.current.appendChild(a), u.current = a;
}).catch((a) => {
console.error(
`[uikit/remote/ui] Failed to load ${e}:`,
a
);
}), () => {
f = !1, u.current && (u.current.remove(), u.current = null);
};
}, [e, r, t]), m(() => {
u.current && (u.current.componentProps = s.current);
}), n.createElement("span", {
ref: i,
style: { display: "contents" }
});
};
}
const R = Symbol.for("uikit.remote.app-sidebar.slot");
function w(e) {
function t() {
return null;
}
return t[R] = e, t;
}
const x = w("exit");
function _(e) {
const t = { showExit: !1 };
return n.Children.forEach(e, (r) => {
var o;
n.isValidElement(r) && ((o = r.type) == null ? void 0 : o[R]) === "exit" && (t.showExit = !0, t.onExit = r.props.onClick, t.exitDisabled = !!r.props.disabled);
}), t;
}
function h(e) {
if (!e || n.isValidElement(e)) return e;
if (typeof e == "function")
return n.createElement(e);
if (typeof e == "object" && (e != null && e.$$typeof))
try {
return n.createElement(e);
} catch {
return e;
}
return e;
}
function P(e) {
return Array.isArray(e) ? e.map((t) => ({
...t,
icon: h(t == null ? void 0 : t.icon)
})) : [];
}
const C = y({
componentName: "AppSidebar",
tagName: "uikit-app-sidebar",
defaultRemoteUrl: d.AppSidebar,
normalizeProps: ({ children: e, items: t, ...r }) => ({
...r,
items: P(t),
...e != null ? _(e) : {}
})
});
function D(e) {
return n.createElement(C, e);
}
const O = Object.assign(D, {
Exit: x
});
export {
O as AppSidebar
};