@ubx/docs-ui 0.7.0 → 0.9.0

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/Header.d.ts CHANGED
@@ -8,7 +8,7 @@ export type SectionTab = {
8
8
  label: string;
9
9
  href: string;
10
10
  };
11
- export declare function Header({ nav, tabs, activeTab, mobileMenu, search, showThemeToggle, }: {
11
+ export declare function Header({ nav, tabs, activeTab, mobileMenu, search, showThemeToggle, githubUrl, }: {
12
12
  nav: NavLink[];
13
13
  /** Omit entirely for a single-tier header, which is the provider site. */
14
14
  tabs?: SectionTab[];
@@ -38,4 +38,18 @@ export declare function Header({ nav, tabs, activeTab, mobileMenu, search, showT
38
38
  * away rather than being set to true.
39
39
  */
40
40
  showThemeToggle?: boolean;
41
+ /**
42
+ * Repository URL. When set, a "Star us on GitHub" button renders to the
43
+ * right of the nav.
44
+ *
45
+ * A prop rather than something one site builds for itself: the whole
46
+ * reason all three surfaces share this header is that a nav element
47
+ * living in one repo drifts from the other two. That applies to a call
48
+ * to action as much as to a link.
49
+ *
50
+ * Optional because it is a marketing affordance first. A docs reader
51
+ * arriving to look up a flag is not there to star anything, so each
52
+ * site decides.
53
+ */
54
+ githubUrl?: string;
41
55
  }): import("react").JSX.Element;
package/dist/Header.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Link from "next/link";
3
3
  import { ThemeToggle } from "./ThemeToggle";
4
- export function Header({ nav, tabs, activeTab, mobileMenu, search, showThemeToggle = true, }) {
4
+ export function Header({ nav, tabs, activeTab, mobileMenu, search, showThemeToggle = true, githubUrl, }) {
5
5
  return (_jsxs("header", { className: "border-b border-border bg-background", children: [_jsxs("div", { className: "relative mx-auto flex max-w-7xl items-center gap-3 px-6 py-4", children: [mobileMenu, _jsxs(Link, { href: "/", className: "flex shrink-0 items-center", children: [_jsx("img", { src: "/logo/logo.png", alt: "ubx", className: "logo-light h-6 w-auto" }), _jsx("img", { src: "/logo/logo-dark.png", alt: "ubx", className: "logo-dark h-6 w-auto" })] }), _jsx("div", { className: "flex-1" }), _jsx("nav", { className: "absolute left-1/2 hidden -translate-x-1/2 items-center gap-5 md:flex", children: nav.map((item) => {
6
6
  const className = item.current
7
7
  ? "text-sm text-primary"
8
8
  : "text-sm text-foreground-muted hover:text-primary";
9
9
  return item.href.startsWith("/") ? (_jsx(Link, { href: item.href, className: className, children: item.label }, item.label)) : (_jsx("a", { href: item.href, className: className, children: item.label }, item.label));
10
- }) }), search ? _jsx("div", { className: "w-40 shrink-0 sm:w-56 lg:w-64", children: search }) : null, showThemeToggle ? _jsx(ThemeToggle, {}) : null] }), tabs && tabs.length > 0 ? (_jsx("div", { className: "mx-auto max-w-7xl px-6", children: _jsx("nav", { className: "flex gap-6 overflow-x-auto", children: tabs.map((tab) => {
10
+ }) }), search ? _jsx("div", { className: "w-40 shrink-0 sm:w-56 lg:w-64", children: search }) : null, githubUrl ? (_jsxs("a", { href: githubUrl, className: "hidden shrink-0 items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-sm text-foreground-muted transition-colors hover:border-primary hover:text-primary sm:flex", children: [_jsx("svg", { viewBox: "0 0 16 16", width: "15", height: "15", fill: "currentColor", "aria-hidden": "true", children: _jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z" }) }), "Star us on GitHub"] })) : null, showThemeToggle ? _jsx(ThemeToggle, {}) : null] }), tabs && tabs.length > 0 ? (_jsx("div", { className: "mx-auto max-w-7xl px-6", children: _jsx("nav", { className: "flex gap-6 overflow-x-auto", children: tabs.map((tab) => {
11
11
  // Prefix match, so /concepts/ledger keeps the Concepts tab
12
12
  // lit rather than only the exact section index.
13
13
  const active = activeTab === tab.href || activeTab?.startsWith(tab.href + "/");
@@ -51,6 +51,21 @@ export type PageShellProps = {
51
51
  intro?: React.ReactNode;
52
52
  /** See Header's own showThemeToggle. Default true. */
53
53
  showThemeToggle?: boolean;
54
+ /** See Header's own githubUrl. Omitted means no button. */
55
+ githubUrl?: string;
56
+ /**
57
+ * Render children edge to edge, with no centred, padded main column.
58
+ *
59
+ * The default wraps children in `mx-auto max-w-7xl px-6 py-12`, which
60
+ * is right for a docs page and wrong for a page built from full bleed
61
+ * tone bands: it caps every band at 1280px and insets it 24px, so the
62
+ * bands stop reaching the viewport edges and the alternating tones
63
+ * read as boxes rather than bands.
64
+ *
65
+ * ubiquex.io's home page is built that way, so it opts out and owns
66
+ * its own inner width. Both docs sites are unaffected.
67
+ */
68
+ fullBleed?: boolean;
54
69
  /** Footer identity. Required for the reason stated on Footer itself. */
55
70
  footer: {
56
71
  tagline: React.ReactNode;
@@ -61,7 +76,7 @@ export type PageShellProps = {
61
76
  };
62
77
  children: React.ReactNode;
63
78
  };
64
- export declare function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel, searchPlaceholder, searchPlacement, intro, showThemeToggle, footer, children, }: PageShellProps): React.JSX.Element;
79
+ export declare function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel, searchPlaceholder, searchPlacement, intro, showThemeToggle, githubUrl, fullBleed, footer, children, }: PageShellProps): React.JSX.Element;
65
80
  /**
66
81
  * Sets data-theme from localStorage before paint.
67
82
  *
package/dist/PageShell.js CHANGED
@@ -9,13 +9,13 @@ const HEADER_SEARCH_CLASS = "w-full rounded-full bg-field px-4 py-1.5 text-sm te
9
9
  /** Full size, for a landing page where search is the point. */
10
10
  const HERO_SEARCH_CLASS = "w-full rounded-full bg-field px-5 py-3 text-base text-foreground outline-none " +
11
11
  "placeholder:text-foreground-muted focus:ring-2 focus:ring-primary/30";
12
- export function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel = "Navigation", searchPlaceholder, searchPlacement = "header", intro, showThemeToggle = true, footer, children, }) {
12
+ export function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel = "Navigation", searchPlaceholder, searchPlacement = "header", intro, showThemeToggle = true, githubUrl, fullBleed = false, footer, children, }) {
13
13
  const headerSearch = searchPlaceholder && searchPlacement === "header" ? (_jsx(GlobalSearch, { placeholder: searchPlaceholder, inputClassName: HEADER_SEARCH_CLASS })) : undefined;
14
14
  const heroSearch = searchPlaceholder && searchPlacement === "hero" ? (_jsx("div", { className: "mx-auto mt-8 max-w-xl", children: _jsx(GlobalSearch, { placeholder: searchPlaceholder, inputClassName: HERO_SEARCH_CLASS }) })) : null;
15
- return (_jsxs(_Fragment, { children: [_jsx(Header, { nav: nav, tabs: tabs, activeTab: activeTab, search: headerSearch, showThemeToggle: showThemeToggle, mobileMenu: sidebar ? (_jsx(MobileSidebarToggle, { label: sidebarLabel, children: sidebar })) : undefined }), sidebar ? (
15
+ return (_jsxs(_Fragment, { children: [_jsx(Header, { nav: nav, tabs: tabs, activeTab: activeTab, search: headerSearch, showThemeToggle: showThemeToggle, githubUrl: githubUrl, mobileMenu: sidebar ? (_jsx(MobileSidebarToggle, { label: sidebarLabel, children: sidebar })) : undefined }), sidebar ? (
16
16
  // No intro or hero search here on purpose: a page with a sidebar
17
17
  // is a content page, and a hero belongs to a landing page.
18
- _jsxs("div", { className: "mx-auto flex w-full max-w-7xl flex-1 gap-10 px-6 py-10", children: [_jsx("aside", { className: "hidden w-64 shrink-0 lg:block", children: sidebar }), _jsx("main", { className: "min-w-0 flex-1", children: children })] })) : (_jsxs("main", { className: "mx-auto w-full max-w-7xl flex-1 px-6 py-12", children: [intro, heroSearch, children] })), _jsx(Footer, { tagline: footer.tagline, links: footer.links })] }));
18
+ _jsxs("div", { className: "mx-auto flex w-full max-w-7xl flex-1 gap-10 px-6 py-10", children: [_jsx("aside", { className: "hidden w-64 shrink-0 lg:block", children: sidebar }), _jsx("main", { className: "min-w-0 flex-1", children: children })] })) : fullBleed ? (_jsxs("main", { className: "flex-1", children: [intro, heroSearch, children] })) : (_jsxs("main", { className: "mx-auto w-full max-w-7xl flex-1 px-6 py-12", children: [intro, heroSearch, children] })), _jsx(Footer, { tagline: footer.tagline, links: footer.links })] }));
19
19
  }
20
20
  /**
21
21
  * Sets data-theme from localStorage before paint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubx/docs-ui",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Shared UI for ubx documentation sites: the page shell, theme A, Shiki-backed CodeBlock, header, search, theme toggle.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",