@pattern-stack/frontend-patterns 0.2.0-alpha.11 → 0.2.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10693,7 +10693,7 @@ const SidebarButton = ({
10693
10693
  }
10694
10694
  );
10695
10695
  };
10696
- const Sidebar = ({ className }) => {
10696
+ const Sidebar = ({ className, footer }) => {
10697
10697
  const { isExpanded, toggleSidebar } = useSidebar();
10698
10698
  const { navigation } = useNavigation();
10699
10699
  const location = reactRouterDom.useLocation();
@@ -10767,42 +10767,56 @@ const Sidebar = ({ className }) => {
10767
10767
  item.value
10768
10768
  );
10769
10769
  }) }),
10770
- /* @__PURE__ */ jsxRuntime.jsx(
10770
+ footer != null && /* @__PURE__ */ jsxRuntime.jsx(
10771
10771
  "div",
10772
10772
  {
10773
10773
  className: cn("p-4 border-t border-border", !isExpanded && "px-3"),
10774
10774
  "data-component-name": "SidebarFooter",
10775
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
10776
- /* @__PURE__ */ jsxRuntime.jsx(
10777
- "div",
10778
- {
10779
- className: cn(
10780
- "text-xs text-muted-foreground text-center",
10781
- "absolute inset-0 transition-opacity duration-200 ease-out",
10782
- !isExpanded ? "opacity-100" : "opacity-0"
10783
- ),
10784
- children: "v1.0"
10785
- }
10786
- ),
10787
- /* @__PURE__ */ jsxRuntime.jsx(
10788
- "div",
10789
- {
10790
- className: cn(
10791
- "text-xs text-muted-foreground whitespace-nowrap",
10792
- "transition-opacity duration-200 ease-out",
10793
- isExpanded ? "opacity-100" : "opacity-0"
10794
- ),
10795
- children: "AloeVera v1.0"
10796
- }
10797
- )
10798
- ] })
10775
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10776
+ "div",
10777
+ {
10778
+ className: cn(
10779
+ "text-xs text-muted-foreground",
10780
+ "transition-opacity duration-200 ease-out",
10781
+ isExpanded ? "opacity-100" : "opacity-70",
10782
+ !isExpanded && "text-center"
10783
+ ),
10784
+ children: footer
10785
+ }
10786
+ )
10799
10787
  }
10800
10788
  )
10801
10789
  ]
10802
10790
  }
10803
10791
  );
10804
10792
  };
10805
- const AppHeader = ({ className }) => {
10793
+ function isBrandingObject(v) {
10794
+ return v != null && typeof v === "object" && !React.isValidElement(v) && "title" in v;
10795
+ }
10796
+ const AppHeader = ({
10797
+ className,
10798
+ branding,
10799
+ searchPlaceholder = "Search models, tests, jobs, and components...",
10800
+ showSearch = false,
10801
+ showUserMenu = false,
10802
+ showConnectionStatus = false
10803
+ }) => {
10804
+ const isTrialMode = false;
10805
+ const brandingNode = (() => {
10806
+ if (branding == null) {
10807
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10808
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-bold text-foreground", children: "Frontend Template" }),
10809
+ isTrialMode
10810
+ ] });
10811
+ }
10812
+ if (isBrandingObject(branding)) {
10813
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10814
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-bold text-foreground", children: branding.title }),
10815
+ branding.badge
10816
+ ] });
10817
+ }
10818
+ return branding;
10819
+ })();
10806
10820
  return /* @__PURE__ */ jsxRuntime.jsx(
10807
10821
  "header",
10808
10822
  {
@@ -10813,35 +10827,28 @@ const AppHeader = ({ className }) => {
10813
10827
  className
10814
10828
  ),
10815
10829
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-16 items-center justify-between", children: [
10816
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
10817
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-bold text-foreground", children: "Frontend Template" }),
10818
- /* @__PURE__ */ jsxRuntime.jsx(DataBadge, { variant: "status", status: "info", display: "icon-text", children: "Trial Mode" })
10819
- ] }),
10820
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 max-w-2xl mx-8", children: /* @__PURE__ */ jsxRuntime.jsx(
10821
- GlobalSearch,
10822
- {
10823
- className: "w-full",
10824
- placeholder: "Search models, tests, jobs, and components..."
10825
- }
10826
- ) }),
10830
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: brandingNode }),
10831
+ showSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 max-w-md mx-8", children: /* @__PURE__ */ jsxRuntime.jsx(GlobalSearch, { className: "w-full", placeholder: searchPlaceholder }) }),
10827
10832
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-4", children: [
10828
- /* @__PURE__ */ jsxRuntime.jsx(ConnectionStatus, {}),
10829
- /* @__PURE__ */ jsxRuntime.jsx(UserMenu, { category: 8 })
10833
+ showConnectionStatus && /* @__PURE__ */ jsxRuntime.jsx(ConnectionStatus, {}),
10834
+ showUserMenu && /* @__PURE__ */ jsxRuntime.jsx(UserMenu, { category: 8 })
10830
10835
  ] })
10831
10836
  ] }) })
10832
10837
  }
10833
10838
  );
10834
10839
  };
10835
- const AppLayout = () => {
10840
+ const AppLayout = ({ header, sidebar } = {}) => {
10836
10841
  const { isExpanded } = useSidebar();
10842
+ const hideHeader = header === false;
10837
10843
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-background", children: [
10838
- /* @__PURE__ */ jsxRuntime.jsx(AppHeader, {}),
10839
- /* @__PURE__ */ jsxRuntime.jsx(Sidebar, {}),
10844
+ !hideHeader && /* @__PURE__ */ jsxRuntime.jsx(AppHeader, { ...header ?? {} }),
10845
+ /* @__PURE__ */ jsxRuntime.jsx(Sidebar, { footer: sidebar == null ? void 0 : sidebar.footer }),
10840
10846
  /* @__PURE__ */ jsxRuntime.jsx(
10841
10847
  "main",
10842
10848
  {
10843
10849
  className: cn(
10844
- "pt-16 min-h-screen transition-all duration-300 ease-in-out",
10850
+ "min-h-screen transition-all duration-300 ease-in-out",
10851
+ hideHeader ? "" : "pt-16",
10845
10852
  isExpanded ? "ml-64" : "ml-16"
10846
10853
  ),
10847
10854
  children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
@@ -15643,6 +15650,8 @@ function createReactApp(config) {
15643
15650
  auth,
15644
15651
  navigation,
15645
15652
  customProviders = [],
15653
+ header,
15654
+ sidebar,
15646
15655
  persistQueryCache = false,
15647
15656
  queryCacheKey = "PATTERN_STACK_QUERY_CACHE"
15648
15657
  } = appConfig;
@@ -15738,8 +15747,10 @@ function createReactApp(config) {
15738
15747
  }
15739
15748
  return component;
15740
15749
  };
15741
- const AppContent = () => /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Routes, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Route, { path: "/", element: /* @__PURE__ */ jsxRuntime.jsx(AppLayout, {}), children: [
15742
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: wrapWithProtection("/", /* @__PURE__ */ jsxRuntime.jsx(DefaultHome, {})) }),
15750
+ const consumerHasRoot = routes.some((r) => r.path === "/");
15751
+ const showDefaultHome = routes.length === 0;
15752
+ const AppContent = () => /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Routes, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Route, { path: "/", element: /* @__PURE__ */ jsxRuntime.jsx(AppLayout, { header, sidebar }), children: [
15753
+ showDefaultHome && !consumerHasRoot && /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: wrapWithProtection("/", /* @__PURE__ */ jsxRuntime.jsx(DefaultHome, {})) }),
15743
15754
  routes.map(({ path, component }, index) => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path, element: wrapWithProtection(path, component) }, index))
15744
15755
  ] }) }) });
15745
15756
  return createProviderTree(/* @__PURE__ */ jsxRuntime.jsx(AppContent, {}));