@yuhuanowo/yunui 0.2.13 → 0.2.15

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.
@@ -0,0 +1,155 @@
1
+ "use client";
2
+ import { useYunUI } from './chunk-U2LNRVMI.js';
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import * as React from 'react';
6
+ import { useState, useRef, useLayoutEffect, useEffect } from 'react';
7
+ import { Sun, Moon, Droplet, Monitor } from 'lucide-react';
8
+ import { useTheme } from 'next-themes';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
+
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+ var useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
15
+ function useAnchoredPosition(open, panelRef, opts) {
16
+ const gutter = opts?.gutter ?? 8;
17
+ const minHeight = opts?.minHeight ?? 160;
18
+ const [pos, setPos] = useState({ shift: 0, maxHeight: void 0 });
19
+ const shiftRef = useRef(0);
20
+ useIsoLayoutEffect(() => {
21
+ if (!open) {
22
+ shiftRef.current = 0;
23
+ setPos({ shift: 0, maxHeight: void 0 });
24
+ return;
25
+ }
26
+ const compute = () => {
27
+ const el = panelRef.current;
28
+ const parent = el?.offsetParent;
29
+ if (!el || !parent) return;
30
+ const parentRect = parent.getBoundingClientRect();
31
+ const vw = window.innerWidth;
32
+ const vh = window.innerHeight;
33
+ const naturalLeft = parentRect.left + el.offsetLeft - shiftRef.current;
34
+ const naturalRight = naturalLeft + el.offsetWidth;
35
+ let dx = 0;
36
+ if (naturalRight > vw - gutter) dx = vw - gutter - naturalRight;
37
+ if (naturalLeft + dx < gutter) dx = gutter - naturalLeft;
38
+ dx = Math.round(dx);
39
+ const top = parentRect.top + el.offsetTop;
40
+ const space = Math.floor(vh - top - gutter);
41
+ const maxHeight = space < vh ? Math.max(space, minHeight) : void 0;
42
+ shiftRef.current = dx;
43
+ setPos({ shift: dx, maxHeight });
44
+ };
45
+ compute();
46
+ window.addEventListener("resize", compute);
47
+ window.addEventListener("scroll", compute, true);
48
+ return () => {
49
+ window.removeEventListener("resize", compute);
50
+ window.removeEventListener("scroll", compute, true);
51
+ };
52
+ }, [open, gutter, minHeight, panelRef]);
53
+ return pos;
54
+ }
55
+ function ThemeToggle({ variant = "icon", align = "right", className = "" }) {
56
+ const { theme, setTheme } = useTheme();
57
+ const t = useYunUI().useT("common.theme");
58
+ const [mounted, setMounted] = React.useState(false);
59
+ const [isOpen, setIsOpen] = React.useState(false);
60
+ const containerRef = React.useRef(null);
61
+ const triggerRef = React.useRef(null);
62
+ const panelRef = React.useRef(null);
63
+ const { shift, maxHeight } = useAnchoredPosition(isOpen, panelRef);
64
+ React.useEffect(() => {
65
+ setMounted(true);
66
+ }, []);
67
+ React.useEffect(() => {
68
+ const handleClickOutside = (e) => {
69
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
70
+ setIsOpen(false);
71
+ }
72
+ };
73
+ document.addEventListener("mousedown", handleClickOutside);
74
+ return () => document.removeEventListener("mousedown", handleClickOutside);
75
+ }, []);
76
+ React.useEffect(() => {
77
+ if (!isOpen) return;
78
+ const onKey = (e) => {
79
+ if (e.key === "Escape") {
80
+ setIsOpen(false);
81
+ triggerRef.current?.focus();
82
+ }
83
+ };
84
+ document.addEventListener("keydown", onKey);
85
+ return () => document.removeEventListener("keydown", onKey);
86
+ }, [isOpen]);
87
+ const themes = [
88
+ { value: "light", label: t("light"), icon: /* @__PURE__ */ jsx(Sun, { size: 14 }) },
89
+ { value: "dark", label: t("zincDark"), icon: /* @__PURE__ */ jsx(Moon, { size: 14 }) },
90
+ { value: "true-black", label: t("trueBlack"), icon: /* @__PURE__ */ jsx(Droplet, { size: 14, fill: "currentColor" }) },
91
+ { value: "system", label: t("system"), icon: /* @__PURE__ */ jsx(Monitor, { size: 14 }) }
92
+ ];
93
+ if (!mounted) {
94
+ return /* @__PURE__ */ jsx("div", { className, children: variant === "pill" ? /* @__PURE__ */ jsx("div", { className: "h-8 w-16 rounded-full bg-(--bg-elevated) border border-(--border-hairline)" }) : /* @__PURE__ */ jsx("div", { className: "w-9 h-9 rounded-lg" }) });
95
+ }
96
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative ${className}`, children: [
97
+ variant === "pill" ? /* @__PURE__ */ jsxs(
98
+ "button",
99
+ {
100
+ ref: triggerRef,
101
+ onClick: () => setIsOpen(!isOpen),
102
+ className: "flex items-center gap-1.5 h-9 px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
103
+ "aria-label": t("toggle"),
104
+ "aria-expanded": isOpen,
105
+ "aria-haspopup": "listbox",
106
+ children: [
107
+ /* @__PURE__ */ jsx(Sun, { size: 14, className: "rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }),
108
+ /* @__PURE__ */ jsx(Moon, { size: 14, className: "absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" })
109
+ ]
110
+ }
111
+ ) : /* @__PURE__ */ jsxs(
112
+ "button",
113
+ {
114
+ ref: triggerRef,
115
+ onClick: () => setIsOpen(!isOpen),
116
+ className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
117
+ "aria-label": t("toggle"),
118
+ "aria-expanded": isOpen,
119
+ "aria-haspopup": "listbox",
120
+ children: [
121
+ /* @__PURE__ */ jsx(Sun, { className: "h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0 absolute" }),
122
+ /* @__PURE__ */ jsx(Moon, { className: "h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" }),
123
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: t("toggle") })
124
+ ]
125
+ }
126
+ ),
127
+ isOpen && /* @__PURE__ */ jsx(
128
+ "div",
129
+ {
130
+ ref: panelRef,
131
+ style: { marginLeft: shift, maxHeight },
132
+ className: `absolute ${align === "left" ? "left-0" : "right-0"} top-full mt-2 z-50 flex flex-col overflow-hidden rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`,
133
+ children: /* @__PURE__ */ jsx("div", { className: "p-1 flex-1 min-h-0 overflow-y-auto", children: themes.map((themeItem) => /* @__PURE__ */ jsxs(
134
+ "button",
135
+ {
136
+ onClick: () => {
137
+ setTheme(themeItem.value);
138
+ setIsOpen(false);
139
+ },
140
+ className: `dropdown-item w-full text-left ${theme === themeItem.value ? "active" : ""}`,
141
+ children: [
142
+ themeItem.icon,
143
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: themeItem.label })
144
+ ]
145
+ },
146
+ themeItem.value
147
+ )) })
148
+ }
149
+ )
150
+ ] });
151
+ }
152
+
153
+ export { ThemeToggle, cn, useAnchoredPosition };
154
+ //# sourceMappingURL=chunk-LLNTUA5K.js.map
155
+ //# sourceMappingURL=chunk-LLNTUA5K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/cn.ts","../src/lib/use-anchored-position.ts","../src/primitives/theme-toggle.tsx"],"names":[],"mappings":";;;;;;;;;AAOO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACLA,IAAM,kBAAA,GAAqB,OAAO,MAAA,KAAW,WAAA,GAAc,eAAA,GAAkB,SAAA;AAmBtE,SAAS,mBAAA,CACZ,IAAA,EACA,QAAA,EACA,IAAA,EACgB;AAChB,EAAA,MAAM,MAAA,GAAS,MAAM,MAAA,IAAU,CAAA;AAC/B,EAAA,MAAM,SAAA,GAAY,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,YAEG,SAAS,MAAM;AACX,cAAA,QAAA,CAAS,UAAU,KAAK,CAAA;AACxB,cAAA,SAAA,CAAU,KAAK,CAAA;AAAA,YACnB,CAAA;AAAA,YACA,WAAW,CAAA,+BAAA,EACP,KAAA,KAAU,SAAA,CAAU,KAAA,GAAQ,WAAW,EAC3C,CAAA,CAAA;AAAA,YAEC,QAAA,EAAA;AAAA,cAAA,SAAA,CAAU,IAAA;AAAA,8BACX,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,QAAA,EAAU,oBAAU,KAAA,EAAM;AAAA;AAAA,WAAA;AAAA,UAVrC,SAAA,CAAU;AAAA,SAYtB,CAAA,EACL;AAAA;AAAA;AACJ,GAAA,EAER,CAAA;AAER","file":"chunk-LLNTUA5K.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind-aware conflict resolution.\n * `cn(\"px-4\", \"px-8\")` → `\"px-8\"`.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { useEffect, useLayoutEffect, useRef, useState } from \"react\";\n\n// SSR-safe layout effect: useLayoutEffect on the client, no-op on the server\n// (effects don't run during SSR, and this avoids React's dev warning).\nconst useIsoLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n\nexport interface AnchoredPosition {\n /** Horizontal nudge (px) to keep the panel on-screen. Apply as `marginLeft`\n * — it never collides with `transform` (framer-motion / `animate-in`) or the\n * panel's left/right anchor. */\n shift: number;\n /** Cap (px) so the panel can't run off the bottom edge; pair with an\n * internal scroll region (`flex-1 min-h-0` / `overflow-y-auto`). */\n maxHeight?: number;\n}\n\n/**\n * Viewport-collision for HAND-ROLLED floating panels (the Radix ones flip/shift\n * on their own). Given the open state and a ref to the absolutely-positioned\n * panel, returns a horizontal `shift` and a `maxHeight` that keep it inside the\n * screen. Measures via untransformed `offset*` against the panel's\n * `offsetParent`, so an in-flight scale/translate animation doesn't skew it.\n */\nexport function useAnchoredPosition(\n open: boolean,\n panelRef: React.RefObject<HTMLElement | null>,\n opts?: { gutter?: number; minHeight?: number },\n): AnchoredPosition {\n const gutter = opts?.gutter ?? 8;\n const minHeight = opts?.minHeight ?? 160;\n const [pos, setPos] = useState<AnchoredPosition>({ shift: 0, maxHeight: undefined });\n // The shift currently baked into the panel's margin — subtract it to recover\n // the natural box on each recompute (otherwise it would drift).\n const shiftRef = useRef(0);\n\n useIsoLayoutEffect(() => {\n if (!open) {\n shiftRef.current = 0;\n setPos({ shift: 0, maxHeight: undefined });\n return;\n }\n const compute = () => {\n const el = panelRef.current;\n const parent = el?.offsetParent as HTMLElement | null;\n if (!el || !parent) return;\n const parentRect = parent.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n\n // Natural (un-shifted) box in viewport coords. offsetLeft includes the\n // applied marginLeft, so remove the current shift first.\n const naturalLeft = parentRect.left + el.offsetLeft - shiftRef.current;\n const naturalRight = naturalLeft + el.offsetWidth;\n let dx = 0;\n if (naturalRight > vw - gutter) dx = vw - gutter - naturalRight;\n if (naturalLeft + dx < gutter) dx = gutter - naturalLeft;\n dx = Math.round(dx);\n\n const top = parentRect.top + el.offsetTop;\n const space = Math.floor(vh - top - gutter);\n const maxHeight = space < vh ? Math.max(space, minHeight) : undefined;\n\n shiftRef.current = dx;\n setPos({ shift: dx, maxHeight });\n };\n\n compute();\n window.addEventListener(\"resize\", compute);\n window.addEventListener(\"scroll\", compute, true);\n return () => {\n window.removeEventListener(\"resize\", compute);\n window.removeEventListener(\"scroll\", compute, true);\n };\n }, [open, gutter, minHeight, panelRef]);\n\n return pos;\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Moon, Sun, Monitor, Droplet } from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\nimport { useYunUI } from \"../adapters/context\"\nimport { useAnchoredPosition } from \"../lib/use-anchored-position\"\n\ninterface ThemeToggleProps {\n /** Visual variant: `icon` (default, icon-only) or `pill`. */\n variant?: \"icon\" | \"pill\";\n /** Dropdown alignment: `left` or `right` (default). */\n align?: \"left\" | \"right\";\n /** Additional className */\n className?: string;\n}\n\n/** Theme switcher dropdown (light / dark / true-black / system) backed by next-themes. */\nexport function ThemeToggle({ variant = \"icon\", align = \"right\", className = \"\" }: ThemeToggleProps) {\n const { theme, setTheme } = useTheme()\n const t = useYunUI().useT(\"common.theme\")\n const [mounted, setMounted] = React.useState(false)\n const [isOpen, setIsOpen] = React.useState(false)\n const containerRef = React.useRef<HTMLDivElement>(null)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const panelRef = React.useRef<HTMLDivElement>(null)\n const { shift, maxHeight } = useAnchoredPosition(isOpen, panelRef)\n\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Close on outside click\n React.useEffect(() => {\n const handleClickOutside = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setIsOpen(false)\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside)\n return () => document.removeEventListener(\"mousedown\", handleClickOutside)\n }, [])\n\n // Close on Escape + restore focus to the trigger. Document-level (not a\n // container onKeyDown): WebKit/Safari on macOS doesn't focus a <button> on\n // click, so focus wouldn't be inside the container to bubble an Escape from.\n React.useEffect(() => {\n if (!isOpen) return\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n setIsOpen(false)\n triggerRef.current?.focus()\n }\n }\n document.addEventListener(\"keydown\", onKey)\n return () => document.removeEventListener(\"keydown\", onKey)\n }, [isOpen])\n\n const themes = [\n { value: \"light\", label: t(\"light\"), icon: <Sun size={14} /> },\n { value: \"dark\", label: t(\"zincDark\"), icon: <Moon size={14} /> },\n { value: \"true-black\", label: t(\"trueBlack\"), icon: <Droplet size={14} fill=\"currentColor\" /> },\n { value: \"system\", label: t(\"system\"), icon: <Monitor size={14} /> },\n ]\n\n if (!mounted) {\n return (\n <div className={className}>\n {variant === \"pill\" ? (\n <div className=\"h-8 w-16 rounded-full bg-(--bg-elevated) border border-(--border-hairline)\" />\n ) : (\n <div className=\"w-9 h-9 rounded-lg\" />\n )}\n </div>\n )\n }\n\n return (\n <div ref={containerRef} className={`relative ${className}`}>\n {/* Trigger */}\n {variant === \"pill\" ? (\n <button\n ref={triggerRef}\n onClick={() => setIsOpen(!isOpen)}\n className=\"flex items-center gap-1.5 h-9 px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n aria-label={t(\"toggle\")}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n >\n <Sun size={14} className=\"rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0\" />\n <Moon size={14} className=\"absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n </button>\n ) : (\n <button\n ref={triggerRef}\n onClick={() => setIsOpen(!isOpen)}\n className=\"w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n aria-label={t(\"toggle\")}\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n >\n <Sun className=\"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0 absolute\" />\n <Moon className=\"h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n <span className=\"sr-only\">{t(\"toggle\")}</span>\n </button>\n )}\n\n {/* Dropdown */}\n {isOpen && (\n <div\n ref={panelRef}\n style={{ marginLeft: shift, maxHeight }}\n className={`absolute ${align === \"left\" ? \"left-0\" : \"right-0\"} top-full mt-2 z-50 flex flex-col overflow-hidden rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`}\n >\n <div className=\"p-1 flex-1 min-h-0 overflow-y-auto\">\n {themes.map((themeItem) => (\n <button\n key={themeItem.value}\n onClick={() => {\n setTheme(themeItem.value)\n setIsOpen(false)\n }}\n className={`dropdown-item w-full text-left ${\n theme === themeItem.value ? \"active\" : \"\"\n }`}\n >\n {themeItem.icon}\n <span className=\"flex-1\">{themeItem.label}</span>\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -153,10 +153,11 @@ declare function Sheet({ open, onClose, children, title, mobileOnly }: SheetProp
153
153
 
154
154
  interface CheckboxProps {
155
155
  /** Whether the box is checked. `"indeterminate"` shows a dash — for a
156
- * select-all that's only partially selected. */
157
- checked: boolean | "indeterminate";
158
- /** Called with the next checked state when toggled (indeterminate → checked). */
159
- onCheckedChange: (checked: boolean) => void;
156
+ * select-all that's only partially selected. Defaults to `false`. */
157
+ checked?: boolean | "indeterminate";
158
+ /** Called with the next checked state when toggled (indeterminate → checked).
159
+ * Optional — omit for a read-only/display checkbox (it won't toggle). */
160
+ onCheckedChange?: (checked: boolean) => void;
160
161
  /** Disable interaction and dim the control. */
161
162
  disabled?: boolean;
162
163
  className?: string;
@@ -561,6 +562,21 @@ interface StatusIndicatorProps extends React$1.HTMLAttributes<HTMLSpanElement> {
561
562
  }
562
563
  /** A small colored status dot with an optional label (e.g. provider online/offline). */
563
564
  declare function StatusIndicator({ status, pulse, className, children, ...props }: StatusIndicatorProps): React$1.JSX.Element;
565
+ type InlineStatusKind = "pending" | "processing" | "completed" | "failed";
566
+ interface InlineStatusProps {
567
+ /** Job phase — drives the icon, color and whether it spins. */
568
+ status: InlineStatusKind;
569
+ /** The label for this status (host-supplied; no bundled copy). */
570
+ label?: React$1.ReactNode;
571
+ /** When in-progress and > 0, the percent replaces the label. */
572
+ progress?: number;
573
+ /** Icon size in px. */
574
+ size?: number;
575
+ className?: string;
576
+ }
577
+ /** A compact inline async-job status: a (spinning) icon plus a label or percent.
578
+ * For a presence dot use `StatusIndicator`; for an approval pill, `StatusBadge`. */
579
+ declare function InlineStatus({ status, label, progress, size, className }: InlineStatusProps): React$1.JSX.Element;
564
580
  /** Inline `<code>` styling for code spans in prose or chat. Use `Kbd` for keys. */
565
581
  declare function InlineCode({ className, ...props }: React$1.HTMLAttributes<HTMLElement>): React$1.JSX.Element;
566
582
  interface Step {
@@ -1033,7 +1049,7 @@ declare function useFocusTrap(containerRef: RefObject<HTMLElement | null>, enabl
1033
1049
  * applyTheme({ brand: "emerald", accent: "violet" }); // imperative
1034
1050
  * const [theme, setTheme] = useYunUITheme({ brand: "blue" }); // React, persisted
1035
1051
  */
1036
- type YunUIPalette = "gray" | "sand" | "slate" | "mint" | "rose" | "dusk" | "red" | "orange" | "yellow" | "moss" | "green" | "emerald" | "aqua" | "cyan" | "blue" | "indigo" | "violet" | "magenta" | "pink";
1052
+ type YunUIPalette = "gray" | "sand" | "slate" | "mint" | "rose" | "dusk" | "red" | "orange" | "amber" | "yellow" | "lime" | "moss" | "green" | "emerald" | "teal" | "aqua" | "cyan" | "blue" | "indigo" | "violet" | "plum" | "magenta" | "fuchsia" | "pink";
1037
1053
  /** How solid (filled) surfaces derive their color. */
1038
1054
  type YunUISolid = "color" | "contrast" | "inverse";
1039
1055
  /** Whether elevated surfaces are opaque or frosted. */
@@ -1061,6 +1077,95 @@ interface YunUITheme {
1061
1077
  type YunUIAccentSource = "brand" | "mono";
1062
1078
  /** All palettes available to the brand/accent/neutral roles (for building pickers). */
1063
1079
  declare const YUNUI_PALETTES: YunUIPalette[];
1080
+ /**
1081
+ * Curated multi-color theme presets — beautiful {brand, accent, neutral}
1082
+ * combinations. Apply one with `applyTheme(YUNUI_THEME_PRESETS.aurora)` or feed
1083
+ * them into a theme picker. Each pairs a brand with a complementary accent and a
1084
+ * neutral tuned to the same temperature.
1085
+ */
1086
+ interface YunUIThemePreset {
1087
+ /** Display name. */
1088
+ label: string;
1089
+ brand: YunUIPalette;
1090
+ accent: YunUIPalette;
1091
+ neutral: YunUIPalette;
1092
+ }
1093
+ declare const YUNUI_THEME_PRESETS: {
1094
+ aurora: {
1095
+ label: string;
1096
+ brand: "blue";
1097
+ accent: "violet";
1098
+ neutral: "slate";
1099
+ };
1100
+ sunset: {
1101
+ label: string;
1102
+ brand: "orange";
1103
+ accent: "pink";
1104
+ neutral: "sand";
1105
+ };
1106
+ forest: {
1107
+ label: string;
1108
+ brand: "green";
1109
+ accent: "lime";
1110
+ neutral: "gray";
1111
+ };
1112
+ ocean: {
1113
+ label: string;
1114
+ brand: "cyan";
1115
+ accent: "teal";
1116
+ neutral: "slate";
1117
+ };
1118
+ grape: {
1119
+ label: string;
1120
+ brand: "violet";
1121
+ accent: "magenta";
1122
+ neutral: "dusk";
1123
+ };
1124
+ ember: {
1125
+ label: string;
1126
+ brand: "red";
1127
+ accent: "amber";
1128
+ neutral: "sand";
1129
+ };
1130
+ lagoon: {
1131
+ label: string;
1132
+ brand: "teal";
1133
+ accent: "emerald";
1134
+ neutral: "mint";
1135
+ };
1136
+ blossom: {
1137
+ label: string;
1138
+ brand: "pink";
1139
+ accent: "fuchsia";
1140
+ neutral: "rose";
1141
+ };
1142
+ royal: {
1143
+ label: string;
1144
+ brand: "indigo";
1145
+ accent: "blue";
1146
+ neutral: "slate";
1147
+ };
1148
+ citrus: {
1149
+ label: string;
1150
+ brand: "lime";
1151
+ accent: "yellow";
1152
+ neutral: "sand";
1153
+ };
1154
+ orchid: {
1155
+ label: string;
1156
+ brand: "plum";
1157
+ accent: "violet";
1158
+ neutral: "dusk";
1159
+ };
1160
+ mono: {
1161
+ label: string;
1162
+ brand: "gray";
1163
+ accent: "gray";
1164
+ neutral: "gray";
1165
+ };
1166
+ };
1167
+ /** Preset keys, e.g. for iterating in a picker. */
1168
+ type YunUIThemePresetName = keyof typeof YUNUI_THEME_PRESETS;
1064
1169
  /**
1065
1170
  * Apply theme attributes to an element (defaults to <html>). Only the keys you
1066
1171
  * pass are written; pass `null` for a key to clear it. Safe to call on the
@@ -1076,4 +1181,4 @@ declare function readTheme(el?: HTMLElement | null): YunUITheme;
1076
1181
  */
1077
1182
  declare function useYunUITheme(defaults?: YunUITheme): [YunUITheme, (patch: YunUITheme) => void];
1078
1183
 
1079
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AnimatedNumber, type AnimatedNumberProps, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Column, Combobox, type ComboboxOption, ConfirmModal, type ConfirmModalVariant, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, type FlexProps, Grid, type GridCount, type GridProps, IconButton, InlineCode, Input, Kbd, Label, Marquee, Modal, MotionDiv, MotionSpan, type NavTab, NavTabs, NumberInput, PageLoader, Pagination, type PaginationProps, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, type SegmentedOption, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, type SelectOption, SelectTrigger, SelectValue, Separator, Sheet, ShinyButton, Skeleton, Slider, type SpacingScale, Spinner, Stack, StatusIndicator, Steps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, ThemeToggle, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, YUNUI_PALETTES, type YunUIAccentSource, type YunUIColorScheme, type YunUIPalette, type YunUISolid, type YunUISurface, type YunUITheme, applyTheme, cn, fadeIn, readTheme, staggerContainer, staggerItem, toast, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior, useYunUITheme };
1184
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AnimatedNumber, type AnimatedNumberProps, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Column, Combobox, type ComboboxOption, ConfirmModal, type ConfirmModalVariant, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, type FlexProps, Grid, type GridCount, type GridProps, IconButton, InlineCode, InlineStatus, type InlineStatusKind, Input, Kbd, Label, Marquee, Modal, MotionDiv, MotionSpan, type NavTab, NavTabs, NumberInput, PageLoader, Pagination, type PaginationProps, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, type SegmentedOption, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, type SelectOption, SelectTrigger, SelectValue, Separator, Sheet, ShinyButton, Skeleton, Slider, type SpacingScale, Spinner, Stack, StatusIndicator, Steps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, ThemeToggle, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, YUNUI_PALETTES, YUNUI_THEME_PRESETS, type YunUIAccentSource, type YunUIColorScheme, type YunUIPalette, type YunUISolid, type YunUISurface, type YunUITheme, type YunUIThemePreset, type YunUIThemePresetName, applyTheme, cn, fadeIn, readTheme, staggerContainer, staggerItem, toast, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior, useYunUITheme };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AnimatedNumber, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Combobox, ConfirmModal, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, Input, Kbd, Label, Marquee, Modal, MotionDiv, MotionSpan, NavTabs, NumberInput, PageLoader, Pagination, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, ShinyButton, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, YUNUI_PALETTES, applyTheme, fadeIn, readTheme, staggerContainer, staggerItem, toast, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior, useYunUITheme } from './chunk-MTEICYIC.js';
3
- export { ThemeToggle, cn } from './chunk-TFZKMJGF.js';
2
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AnimatedNumber, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Combobox, ConfirmModal, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, InlineStatus, Input, Kbd, Label, Marquee, Modal, MotionDiv, MotionSpan, NavTabs, NumberInput, PageLoader, Pagination, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, ShinyButton, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, YUNUI_PALETTES, YUNUI_THEME_PRESETS, applyTheme, fadeIn, readTheme, staggerContainer, staggerItem, toast, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior, useYunUITheme } from './chunk-6MZN3GOP.js';
3
+ export { ThemeToggle, cn } from './chunk-LLNTUA5K.js';
4
4
  import './chunk-U2LNRVMI.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ElementType, ReactNode } from 'react';
2
+ import React__default, { ReactNode, ElementType } from 'react';
3
3
  export { F as Footer, a as FooterLink, b as FooterProps, c as FooterSection, d as FooterSocial } from './footer-BoFu7Wqq.js';
4
4
 
5
5
  declare function BackgroundEffects(): React$1.JSX.Element;
@@ -117,6 +117,27 @@ interface BlogPaginationProps {
117
117
  }
118
118
  declare function BlogPagination({ currentPage, totalPages, onPageChange, labels, }: BlogPaginationProps): React$1.JSX.Element | null;
119
119
 
120
+ interface SimplePaginationProps {
121
+ /** 1-indexed current page, shown in the centre indicator. */
122
+ currentPage: number;
123
+ /** Whether a previous page exists. Defaults to `currentPage > 1`. */
124
+ hasPrevious?: boolean;
125
+ /** Whether a next page exists — cursor-style, for lists with no known total. */
126
+ hasNext: boolean;
127
+ onPrevious: () => void;
128
+ onNext: () => void;
129
+ /** Localized labels. `page` renders the centre indicator (default `Page {n}`). */
130
+ labels?: {
131
+ previous?: string;
132
+ next?: string;
133
+ page?: (n: number) => ReactNode;
134
+ };
135
+ }
136
+ /** Prev / page-indicator / next pager for cursor- or has-more-style lists where
137
+ * the total page count isn't known (so numbered pages aren't possible). Matches
138
+ * `BlogPagination`'s ghost-button styling. */
139
+ declare function SimplePagination({ currentPage, hasPrevious, hasNext, onPrevious, onNext, labels, }: SimplePaginationProps): React$1.JSX.Element;
140
+
120
141
  interface CategoryFilterProps {
121
142
  categories: string[];
122
143
  selectedCategory?: string;
@@ -188,6 +209,26 @@ interface PageHeaderProps {
188
209
  }
189
210
  declare function PageHeader({ title, description, actions, className }: PageHeaderProps): React$1.JSX.Element;
190
211
 
212
+ interface PageLayoutProps {
213
+ /** Page content, rendered inside `<main>`. */
214
+ children: ReactNode;
215
+ /** Top navigation slot — typically `<Navbar/>`. Rendered above `<main>`. */
216
+ navbar?: ReactNode;
217
+ /** Bottom slot — typically `<Footer/>`. Hidden when `hideFooter`. */
218
+ footer?: ReactNode;
219
+ /** Drop the footer (e.g. focused/app pages). */
220
+ hideFooter?: boolean;
221
+ /** Skip the default `bg-background` so a page can paint its own backdrop. */
222
+ transparentBg?: boolean;
223
+ /** Override the `<main>` classes — defaults to `flex-1 pt-28` (clears the
224
+ * fixed navbar). Pass your own offset for a taller/shorter bar. */
225
+ mainClassName?: string;
226
+ /** Extra classes on the outer wrapper. */
227
+ className?: string;
228
+ }
229
+ /** Full-height page shell: navbar slot · offset `<main>` · footer slot. */
230
+ declare function PageLayout({ children, navbar, footer, hideFooter, transparentBg, mainClassName, className, }: PageLayoutProps): React$1.JSX.Element;
231
+
191
232
  interface PageLoadingStateProps {
192
233
  /** Optional text shown beside the spinner. */
193
234
  message?: string;
@@ -380,4 +421,197 @@ declare function DeprecatedBadge({ isDeprecated }: {
380
421
  isDeprecated: boolean;
381
422
  }): React$1.JSX.Element | null;
382
423
 
383
- export { AccountLockedCard, type AccountLockedCardProps, ActiveBadge, BackgroundEffects, BlogCard, BlogPagination, BlogPostHeader, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, DeprecatedBadge, ErrorBoundary, type ErrorBoundaryLabels, FAQ, type FAQItem, type FAQProps, FellowBadge, FellowsBanner, type FellowsBannerProps, LLMCopyButton, MediaEmptyState, MediaErrorState, MediaLoadingState, MediaPageHeader, PageEmptyState, PageErrorState, PageHeader, PageLoadingState, Sidebar, type SidebarNavItem, type SidebarProps, type SidebarSection, SourceBadge, StatCard, StatusBadge, ViewOptions };
424
+ interface FeatureLockedStateProps {
425
+ /** Glyph inside the top medallion (defaults to a sparkles icon). */
426
+ icon?: ReactNode;
427
+ title: ReactNode;
428
+ description?: ReactNode;
429
+ /** Heading of the dashed note card; the card shows when this or `noteText` is set. */
430
+ noteTitle?: ReactNode;
431
+ /** Body of the dashed note card. */
432
+ noteText?: ReactNode;
433
+ className?: string;
434
+ }
435
+ declare function FeatureLockedState({ icon, title, description, noteTitle, noteText, className }: FeatureLockedStateProps): React$1.JSX.Element;
436
+
437
+ interface SessionItemProps {
438
+ /** Device glyph (host maps the device type to an icon). */
439
+ icon?: ReactNode;
440
+ /** Device name / label. */
441
+ name: ReactNode;
442
+ /** Secondary detail line, e.g. "Chrome on macOS". */
443
+ detail?: ReactNode;
444
+ /** IP address (rendered after a globe glyph). */
445
+ ip?: ReactNode;
446
+ /** Host-formatted relative time (rendered after a clock glyph). */
447
+ time?: ReactNode;
448
+ /** Marks the current session — shows a badge and hides the revoke button. */
449
+ current?: boolean;
450
+ currentLabel?: ReactNode;
451
+ /** Dims the row and shows an "inactive" badge. */
452
+ inactive?: boolean;
453
+ inactiveLabel?: ReactNode;
454
+ /** Revoke handler — when set (and not current), shows the revoke button. */
455
+ onRevoke?: () => void;
456
+ revoking?: boolean;
457
+ revokeLabel?: string;
458
+ className?: string;
459
+ }
460
+ declare function SessionItem({ icon, name, detail, ip, time, current, currentLabel, inactive, inactiveLabel, onRevoke, revoking, revokeLabel, className, }: SessionItemProps): React$1.JSX.Element;
461
+
462
+ interface MetricBarProps {
463
+ /** Leading icon; when omitted a small color dot (using `color`) is shown. */
464
+ icon?: ReactNode;
465
+ label: ReactNode;
466
+ /** Right-aligned value (e.g. "120 credits"). */
467
+ value?: ReactNode;
468
+ /** Bar fill, 0–100. */
469
+ percentage: number;
470
+ /** CSS color for the bar fill (and the dot when there's no icon). */
471
+ color?: string;
472
+ className?: string;
473
+ }
474
+ declare function MetricBar({ icon, label, value, percentage, color, className }: MetricBarProps): React$1.JSX.Element;
475
+
476
+ type BannerTone = "info" | "warning" | "critical" | "success" | "neutral";
477
+ interface BannerProps {
478
+ /** Tone — drives the gradient, border, text and icon color. */
479
+ tone?: BannerTone;
480
+ /** Leading icon; defaults to a tone-appropriate glyph (pass `null` to omit). */
481
+ icon?: ReactNode;
482
+ /** The banner headline. */
483
+ title: ReactNode;
484
+ /** Secondary text shown inline after the title (hidden on mobile). */
485
+ description?: ReactNode;
486
+ /** Small right-aligned meta (e.g. a relative timestamp). */
487
+ meta?: ReactNode;
488
+ /** Trailing actions — links or buttons. */
489
+ actions?: ReactNode;
490
+ /** Show a dismiss (✕) button. */
491
+ dismissible?: boolean;
492
+ onDismiss?: () => void;
493
+ dismissLabel?: string;
494
+ className?: string;
495
+ }
496
+ declare function Banner({ tone, icon, title, description, meta, actions, dismissible, onDismiss, dismissLabel, className, }: BannerProps): React$1.JSX.Element;
497
+
498
+ /** An icon trigger (the bell) carrying an unread-count badge. */
499
+ interface NotificationBellProps {
500
+ /** Unread count; the badge is hidden when 0 / undefined. */
501
+ count?: number;
502
+ /** Cap the displayed number — above it shows `{max}+`. */
503
+ max?: number;
504
+ /** Accessible label for the trigger. */
505
+ label?: string;
506
+ /** Override the bell glyph. */
507
+ icon?: ReactNode;
508
+ onClick?: () => void;
509
+ className?: string;
510
+ }
511
+ declare function NotificationBell({ count, max, label, icon, onClick, className }: NotificationBellProps): React$1.JSX.Element;
512
+ /** A single notification row: type glyph · title + body · time, optionally a
513
+ * link (adapter Link) and a hover dismiss button. */
514
+ interface NotificationItemProps {
515
+ /** Type glyph — the host renders it (e.g. an icon for the notification type). */
516
+ icon?: ReactNode;
517
+ /** Tint classes for the icon square (bg + text color). */
518
+ iconClassName?: string;
519
+ title: ReactNode;
520
+ body?: ReactNode;
521
+ /** Host-formatted relative time (e.g. "2h"). */
522
+ time?: ReactNode;
523
+ /** Unread rows read bolder; read rows are muted. */
524
+ unread?: boolean;
525
+ /** Optional target — when set the row is an adapter `<Link>`. */
526
+ href?: string;
527
+ /** Fires on row activation (also use to close the panel). */
528
+ onSelect?: () => void;
529
+ /** Show a hover dismiss (trash) button. */
530
+ dismissible?: boolean;
531
+ onDismiss?: () => void;
532
+ dismissLabel?: string;
533
+ className?: string;
534
+ }
535
+ declare function NotificationItem({ icon, iconClassName, title, body, time, unread, href, onSelect, dismissible, onDismiss, dismissLabel, className, }: NotificationItemProps): React$1.JSX.Element;
536
+ /** The dropdown panel chrome: header (title + unread count), a scrollable list
537
+ * with loading / empty states, and a footer slot (e.g. a "view all" link).
538
+ * Render `<NotificationItem>`s as children. */
539
+ interface NotificationPanelProps {
540
+ title: ReactNode;
541
+ /** Unread count shown in the header; hidden when 0. */
542
+ unreadCount?: number;
543
+ /** Word rendered after the count (e.g. "unread"). */
544
+ unreadLabel?: ReactNode;
545
+ loading?: boolean;
546
+ loadingLabel?: ReactNode;
547
+ /** When true (and not loading) the empty state replaces the children. */
548
+ empty?: boolean;
549
+ emptyLabel?: ReactNode;
550
+ /** Footer slot — typically a centered "view all" adapter Link. */
551
+ footer?: ReactNode;
552
+ /** The notification rows. */
553
+ children?: ReactNode;
554
+ className?: string;
555
+ }
556
+ declare function NotificationPanel({ title, unreadCount, unreadLabel, loading, loadingLabel, empty, emptyLabel, footer, children, className, }: NotificationPanelProps): React$1.JSX.Element;
557
+
558
+ interface SettingRowProps {
559
+ title: ReactNode;
560
+ description?: ReactNode;
561
+ /** The trailing control (e.g. a `<Switch>`). */
562
+ control?: ReactNode;
563
+ className?: string;
564
+ }
565
+ declare function SettingRow({ title, description, control, className }: SettingRowProps): React$1.JSX.Element;
566
+
567
+ interface LinkRowProps {
568
+ icon?: ReactNode;
569
+ title: ReactNode;
570
+ description?: ReactNode;
571
+ /** Destination. */
572
+ href: string;
573
+ /** Open in a new tab via a plain anchor (default false → adapter Link). */
574
+ external?: boolean;
575
+ className?: string;
576
+ }
577
+ declare function LinkRow({ icon, title, description, href, external, className }: LinkRowProps): React$1.JSX.Element;
578
+
579
+ interface ConnectedAccountRowProps {
580
+ /** Provider glyph, shown in a ring when there's no avatar image. */
581
+ icon?: ReactNode;
582
+ /** Small provider badge overlaid bottom-right. */
583
+ badge?: ReactNode;
584
+ /** Avatar image URL; falls back to `icon` in a ring. */
585
+ avatarUrl?: string;
586
+ name: ReactNode;
587
+ /** A faint "· extra" after the name. */
588
+ subname?: ReactNode;
589
+ /** Detail line — e.g. @username or an email. */
590
+ detail?: ReactNode;
591
+ /** Host-formatted connected time (rendered after a clock glyph). */
592
+ time?: ReactNode;
593
+ onUnlink?: () => void;
594
+ unlinking?: boolean;
595
+ unlinkLabel?: string;
596
+ className?: string;
597
+ }
598
+ declare function ConnectedAccountRow({ icon, badge, avatarUrl, name, subname, detail, time, onUnlink, unlinking, unlinkLabel, className, }: ConnectedAccountRowProps): React$1.JSX.Element;
599
+
600
+ interface AvatarUploaderProps {
601
+ /** Current avatar image URL; when absent, `fallback` is shown. */
602
+ src?: string;
603
+ /** Fallback content (e.g. the user's initials). */
604
+ fallback?: ReactNode;
605
+ /** Diameter in px. */
606
+ size?: number;
607
+ /** True while an upload is in flight — shows a spinner. */
608
+ uploading?: boolean;
609
+ /** Called with the picked file. */
610
+ onSelectFile?: (file: File) => void;
611
+ /** Accessible label for the control. */
612
+ label?: string;
613
+ className?: string;
614
+ }
615
+ declare function AvatarUploader({ src, fallback, size, uploading, onSelectFile, label, className, }: AvatarUploaderProps): React$1.JSX.Element;
616
+
617
+ export { AccountLockedCard, type AccountLockedCardProps, ActiveBadge, AvatarUploader, type AvatarUploaderProps, BackgroundEffects, Banner, type BannerProps, type BannerTone, BlogCard, BlogPagination, BlogPostHeader, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, ConnectedAccountRow, type ConnectedAccountRowProps, DeprecatedBadge, ErrorBoundary, type ErrorBoundaryLabels, FAQ, type FAQItem, type FAQProps, FeatureLockedState, type FeatureLockedStateProps, FellowBadge, FellowsBanner, type FellowsBannerProps, LLMCopyButton, LinkRow, type LinkRowProps, MediaEmptyState, MediaErrorState, MediaLoadingState, MediaPageHeader, MetricBar, type MetricBarProps, NotificationBell, type NotificationBellProps, NotificationItem, type NotificationItemProps, NotificationPanel, type NotificationPanelProps, PageEmptyState, PageErrorState, PageHeader, PageLayout, type PageLayoutProps, PageLoadingState, SessionItem, type SessionItemProps, SettingRow, type SettingRowProps, Sidebar, type SidebarNavItem, type SidebarProps, type SidebarSection, SimplePagination, SourceBadge, StatCard, StatusBadge, ViewOptions };