@ubx/docs-ui 0.6.0 → 0.7.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, }: {
11
+ export declare function Header({ nav, tabs, activeTab, mobileMenu, search, showThemeToggle, }: {
12
12
  nav: NavLink[];
13
13
  /** Omit entirely for a single-tier header, which is the provider site. */
14
14
  tabs?: SectionTab[];
@@ -25,4 +25,17 @@ export declare function Header({ nav, tabs, activeTab, mobileMenu, search, }: {
25
25
  * search at all.
26
26
  */
27
27
  search?: React.ReactNode;
28
+ /**
29
+ * Render the theme toggle. Default true, which is every docs site.
30
+ *
31
+ * ubiquex-web opts out because it is dark-only: it defines no light
32
+ * palette and no [data-theme] rules, so a toggle there would switch
33
+ * between dark and dark. Shipping a control that does nothing is worse
34
+ * than not shipping it.
35
+ *
36
+ * This is a recorded compromise, not a design position. The real fix
37
+ * is a light palette for that site, at which point this prop should go
38
+ * away rather than being set to true.
39
+ */
40
+ showThemeToggle?: boolean;
28
41
  }): 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, }) {
4
+ export function Header({ nav, tabs, activeTab, mobileMenu, search, showThemeToggle = true, }) {
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, _jsx(ThemeToggle, {})] }), 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, 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 + "/");
@@ -49,6 +49,8 @@ export type PageShellProps = {
49
49
  * heading in `children` as normal.
50
50
  */
51
51
  intro?: React.ReactNode;
52
+ /** See Header's own showThemeToggle. Default true. */
53
+ showThemeToggle?: boolean;
52
54
  /** Footer identity. Required for the reason stated on Footer itself. */
53
55
  footer: {
54
56
  tagline: React.ReactNode;
@@ -59,7 +61,7 @@ export type PageShellProps = {
59
61
  };
60
62
  children: React.ReactNode;
61
63
  };
62
- export declare function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel, searchPlaceholder, searchPlacement, intro, footer, children, }: PageShellProps): React.JSX.Element;
64
+ export declare function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel, searchPlaceholder, searchPlacement, intro, showThemeToggle, footer, children, }: PageShellProps): React.JSX.Element;
63
65
  /**
64
66
  * Sets data-theme from localStorage before paint.
65
67
  *
package/dist/PageShell.js CHANGED
@@ -9,10 +9,10 @@ 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, footer, children, }) {
12
+ export function PageShell({ nav, tabs, activeTab, sidebar, sidebarLabel = "Navigation", searchPlaceholder, searchPlacement = "header", intro, showThemeToggle = true, 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, 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, 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
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 })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubx/docs-ui",
3
- "version": "0.6.0",
3
+ "version": "0.7.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",