@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
22 lines (21 loc) • 941 B
JavaScript
"use client";
import { createContext, use } from "react";
import { jsx } from "react/jsx-runtime";
//#region src/dashboard/Surface/link.tsx
const defaultRenderLink = ({ children, ...rest }) => /* @__PURE__ */ jsx("a", {
...rest,
children
});
const SurfaceLinkContext = createContext(defaultRenderLink);
const SurfaceDepthContext = createContext(0);
/** Plugs the app router into every dashboard card link (Surface, MetricStrip, Section). */
const SurfaceLinkProvider = ({ children, renderLink }) => /* @__PURE__ */ jsx(SurfaceLinkContext, {
value: renderLink,
children
});
const useSurfaceLink = (override) => override ?? use(SurfaceLinkContext);
/** How many Surface cards wrap this node. A table can skip its own card when already inside one. */
const useSurfaceDepth = () => use(SurfaceDepthContext);
//#endregion
export { SurfaceDepthContext, SurfaceLinkProvider, useSurfaceDepth, useSurfaceLink };
//# sourceMappingURL=link.mjs.map