@ektyra/layout 0.0.0-stage → 0.3.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.
Files changed (97) hide show
  1. package/LICENSE +21 -0
  2. package/dist/appearance/appearance.d.ts +39 -0
  3. package/dist/appearance/appearance.js +102 -0
  4. package/dist/appearance/index.d.ts +3 -0
  5. package/dist/appearance/index.js +2 -0
  6. package/dist/appearance/preloader.d.ts +11 -0
  7. package/dist/appearance/preloader.js +28 -0
  8. package/dist/navigation/context.d.ts +25 -0
  9. package/dist/navigation/context.js +31 -0
  10. package/dist/navigation/index.d.ts +5 -0
  11. package/dist/navigation/index.js +3 -0
  12. package/dist/navigation/trail.d.ts +10 -0
  13. package/dist/navigation/trail.js +37 -0
  14. package/dist/navigation/types.d.ts +46 -0
  15. package/dist/navigation/types.js +1 -0
  16. package/dist/notifications/context.d.ts +16 -0
  17. package/dist/notifications/context.js +11 -0
  18. package/dist/notifications/index.d.ts +5 -0
  19. package/dist/notifications/index.js +3 -0
  20. package/dist/notifications/notification-item.d.ts +6 -0
  21. package/dist/notifications/notification-item.js +13 -0
  22. package/dist/notifications/notification-types.d.ts +27 -0
  23. package/dist/notifications/notification-types.js +10 -0
  24. package/dist/notifications/notifications-panel.d.ts +10 -0
  25. package/dist/notifications/notifications-panel.js +9 -0
  26. package/dist/shell/auth/auth-heading.d.ts +7 -0
  27. package/dist/shell/auth/auth-heading.js +5 -0
  28. package/dist/shell/auth/auth-layout.d.ts +10 -0
  29. package/dist/shell/auth/auth-layout.js +14 -0
  30. package/dist/shell/auth/auth-theme-toggle.d.ts +5 -0
  31. package/dist/shell/auth/auth-theme-toggle.js +12 -0
  32. package/dist/shell/auth/auth-usps.d.ts +2 -0
  33. package/dist/shell/auth/auth-usps.js +15 -0
  34. package/dist/shell/auth/index.d.ts +2 -0
  35. package/dist/shell/auth/index.js +2 -0
  36. package/dist/shell/customizer/color-scheme-choice.d.ts +2 -0
  37. package/dist/shell/customizer/color-scheme-choice.js +25 -0
  38. package/dist/shell/customizer/layout-wireframe.d.ts +11 -0
  39. package/dist/shell/customizer/layout-wireframe.js +12 -0
  40. package/dist/shell/customizer/option-picker.d.ts +17 -0
  41. package/dist/shell/customizer/option-picker.js +8 -0
  42. package/dist/shell/customizer/palette-data.d.ts +18 -0
  43. package/dist/shell/customizer/palette-data.js +64 -0
  44. package/dist/shell/customizer/theme-customizer.d.ts +5 -0
  45. package/dist/shell/customizer/theme-customizer.js +96 -0
  46. package/dist/shell/horizontal-menu/horizontal-menu-leaf.d.ts +5 -0
  47. package/dist/shell/horizontal-menu/horizontal-menu-leaf.js +11 -0
  48. package/dist/shell/horizontal-menu/horizontal-menu.d.ts +2 -0
  49. package/dist/shell/horizontal-menu/horizontal-menu.js +39 -0
  50. package/dist/shell/horizontal-menu/index.d.ts +1 -0
  51. package/dist/shell/horizontal-menu/index.js +1 -0
  52. package/dist/shell/logo.d.ts +7 -0
  53. package/dist/shell/logo.js +9 -0
  54. package/dist/shell/navbar/command-menu.d.ts +19 -0
  55. package/dist/shell/navbar/command-menu.js +32 -0
  56. package/dist/shell/navbar/index.d.ts +1 -0
  57. package/dist/shell/navbar/index.js +1 -0
  58. package/dist/shell/navbar/navbar-help.d.ts +1 -0
  59. package/dist/shell/navbar/navbar-help.js +6 -0
  60. package/dist/shell/navbar/navbar-notifications.d.ts +6 -0
  61. package/dist/shell/navbar/navbar-notifications.js +20 -0
  62. package/dist/shell/navbar/navbar-search.d.ts +1 -0
  63. package/dist/shell/navbar/navbar-search.js +19 -0
  64. package/dist/shell/navbar/navbar-sidebar-toggle.d.ts +1 -0
  65. package/dist/shell/navbar/navbar-sidebar-toggle.js +20 -0
  66. package/dist/shell/navbar/navbar-user-menu.d.ts +12 -0
  67. package/dist/shell/navbar/navbar-user-menu.js +14 -0
  68. package/dist/shell/navbar/navbar.d.ts +6 -0
  69. package/dist/shell/navbar/navbar.js +12 -0
  70. package/dist/shell/page-breadcrumbs.d.ts +11 -0
  71. package/dist/shell/page-breadcrumbs.js +23 -0
  72. package/dist/shell/page-header.d.ts +26 -0
  73. package/dist/shell/page-header.js +16 -0
  74. package/dist/shell/sidebar/index.d.ts +1 -0
  75. package/dist/shell/sidebar/index.js +1 -0
  76. package/dist/shell/sidebar/sidebar-group-label.d.ts +7 -0
  77. package/dist/shell/sidebar/sidebar-group-label.js +8 -0
  78. package/dist/shell/sidebar/sidebar-nav-item.d.ts +4 -0
  79. package/dist/shell/sidebar/sidebar-nav-item.js +12 -0
  80. package/dist/shell/sidebar/sidebar-nav-parent.d.ts +12 -0
  81. package/dist/shell/sidebar/sidebar-nav-parent.js +43 -0
  82. package/dist/shell/sidebar/sidebar-nav-styles.d.ts +7 -0
  83. package/dist/shell/sidebar/sidebar-nav-styles.js +7 -0
  84. package/dist/shell/sidebar/sidebar-nav.d.ts +6 -0
  85. package/dist/shell/sidebar/sidebar-nav.js +9 -0
  86. package/dist/shell/sidebar/sidebar-project-switcher.d.ts +11 -0
  87. package/dist/shell/sidebar/sidebar-project-switcher.js +19 -0
  88. package/dist/shell/sidebar/sidebar-tooltip.d.ts +19 -0
  89. package/dist/shell/sidebar/sidebar-tooltip.js +23 -0
  90. package/dist/shell/sidebar/sidebar.d.ts +8 -0
  91. package/dist/shell/sidebar/sidebar.js +18 -0
  92. package/dist/sidebar-state/index.d.ts +1 -0
  93. package/dist/sidebar-state/index.js +1 -0
  94. package/dist/sidebar-state/sidebar-state.d.ts +19 -0
  95. package/dist/sidebar-state/sidebar-state.js +75 -0
  96. package/package.json +67 -3
  97. package/README.md +0 -3
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Monitor, Moon, Sun } from "lucide-react";
3
+ import { isTheme, useTheme } from "@ektyra/ui/theme";
4
+ import { OptionPicker } from "./option-picker.js";
5
+ const Swatch = ({ mode }) => {
6
+ const Icon = mode === "light" ? Sun : mode === "dark" ? Moon : Monitor;
7
+ return (_jsx("span", { "aria-hidden": "true", className: mode === "dark"
8
+ ? "grid aspect-[16/10] place-items-center rounded-md border border-neutral-700 bg-neutral-900 text-neutral-200"
9
+ : mode === "light"
10
+ ? "grid aspect-[16/10] place-items-center rounded-md border border-neutral-200 bg-white text-neutral-700"
11
+ : "grid aspect-[16/10] place-items-center rounded-md border border-neutral-300 bg-gradient-to-r from-white to-neutral-900 text-neutral-500", children: _jsx(Icon, { className: "size-5" }) }));
12
+ };
13
+ const options = [
14
+ { value: "light", label: "Light", preview: _jsx(Swatch, { mode: "light" }) },
15
+ { value: "dark", label: "Dark", preview: _jsx(Swatch, { mode: "dark" }) },
16
+ { value: "system", label: "System", preview: _jsx(Swatch, { mode: "system" }) },
17
+ ];
18
+ /** Light, dark or follow the device. Used by the theme customizer and the preferences page. */
19
+ export function ColorSchemeChoice() {
20
+ const { theme, setTheme } = useTheme();
21
+ return (_jsx(OptionPicker, { label: "Color scheme", value: theme, columns: 3, options: options, onValueChange: (value) => {
22
+ if (isTheme(value))
23
+ setTheme(value);
24
+ } }));
25
+ }
@@ -0,0 +1,11 @@
1
+ import type { Layout } from "../../appearance/index.ts";
2
+ /**
3
+ * A little drawing of the app shell: sidebar or menu bar, and content blocks. Decorative.
4
+ * `boxed` keeps the content in a column; `iconOnly` narrows the sidebar to icons.
5
+ */
6
+ export declare function LayoutWireframe({ layout, boxed, iconOnly, className, }: Readonly<{
7
+ layout?: Layout;
8
+ boxed?: boolean;
9
+ iconOnly?: boolean;
10
+ className?: string;
11
+ }>): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "@ektyra/ui/lib/cn";
3
+ const bar = "rounded-sm bg-foreground/15";
4
+ /**
5
+ * A little drawing of the app shell: sidebar or menu bar, and content blocks. Decorative.
6
+ * `boxed` keeps the content in a column; `iconOnly` narrows the sidebar to icons.
7
+ */
8
+ export function LayoutWireframe({ layout = "vertical", boxed = false, iconOnly = false, className, }) {
9
+ const horizontal = layout === "horizontal";
10
+ const detached = layout === "detached";
11
+ return (_jsxs("div", { "aria-hidden": "true", className: cn("flex aspect-[16/10] w-full overflow-hidden rounded-md border border-border bg-background", detached && "gap-1 bg-muted p-1", className), children: [!horizontal && (_jsxs("div", { className: cn("flex shrink-0 flex-col gap-1.5 border-r border-border bg-sidebar p-1.5", detached && "rounded-md border", iconOnly ? "w-[12%] items-center" : "w-[24%]"), children: [_jsx("div", { className: cn("h-1.5 rounded-sm bg-primary", iconOnly ? "w-2" : "w-2/3") }), [0, 1, 2, 3].map((row) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: cn("size-1.5 shrink-0 rounded-sm", row === 1 ? "bg-primary" : "bg-foreground/25") }), !iconOnly && (_jsx("div", { className: cn("h-1 flex-1 rounded-sm", row === 1 ? "bg-primary/40" : bar) }))] }, row)))] })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("div", { className: "flex h-[14%] shrink-0 items-center gap-1.5 border-b border-border px-1.5", children: [horizontal && _jsx("div", { className: "h-1.5 w-4 rounded-sm bg-primary" }), _jsx("div", { className: "h-1.5 w-1/4 rounded-sm bg-foreground/10" }), _jsx("div", { className: "ml-auto size-1.5 rounded-full bg-primary/60" })] }), horizontal && (_jsx("div", { className: "flex h-[12%] shrink-0 items-center gap-2 border-b border-border px-1.5", children: [0, 1, 2, 3].map((item) => (_jsx("div", { className: cn("h-1 w-5 rounded-sm", item === 1 ? "bg-primary/50" : bar) }, item))) })), _jsx("div", { className: "min-h-0 flex-1 bg-muted/40 p-1.5", children: _jsxs("div", { className: cn("grid h-full grid-cols-3 content-start gap-1", boxed && "mx-auto w-[66%]"), children: [_jsx("div", { className: "col-span-3 h-1.5 w-1/3 rounded-sm bg-foreground/20" }), _jsx("div", { className: "h-6 rounded-sm border border-border bg-card" }), _jsx("div", { className: "h-6 rounded-sm border border-border bg-card" }), _jsx("div", { className: "h-6 rounded-sm border border-border bg-card" })] }) })] })] }));
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from "react";
2
+ export type PickerOption<T extends string> = {
3
+ value: T;
4
+ label: string;
5
+ /** A picture of the choice, shown above the label. */
6
+ preview: ReactNode;
7
+ };
8
+ /** A titled group of picture cards where exactly one is chosen. */
9
+ export declare function OptionPicker<T extends string>({ label, description, value, onValueChange, options, columns, disabled, }: Readonly<{
10
+ label: string;
11
+ description?: string;
12
+ value: T;
13
+ onValueChange: (value: T) => void;
14
+ options: readonly PickerOption<T>[];
15
+ columns?: 2 | 3;
16
+ disabled?: boolean;
17
+ }>): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
3
+ import { Check } from "lucide-react";
4
+ import { cn } from "@ektyra/ui/lib/cn";
5
+ /** A titled group of picture cards where exactly one is chosen. */
6
+ export function OptionPicker({ label, description, value, onValueChange, options, columns = 2, disabled, }) {
7
+ return (_jsxs("fieldset", { className: "grid gap-2.5", children: [_jsx("legend", { className: "mb-2.5 text-sm font-medium", children: label }), description && _jsx("p", { className: "-mt-1.5 text-xs text-muted-foreground", children: description }), _jsx(RadioGroupPrimitive.Root, { "aria-label": label, value: value, disabled: disabled, onValueChange: (next) => onValueChange(next), className: cn("grid gap-2.5", columns === 3 ? "grid-cols-3" : "grid-cols-2"), children: options.map((option) => (_jsxs(RadioGroupPrimitive.Item, { value: option.value, className: "group grid cursor-pointer content-start gap-2 rounded-lg border border-input bg-card p-2 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary/5 data-[state=checked]:ring-1 data-[state=checked]:ring-primary", children: [option.preview, _jsxs("span", { className: "flex items-center justify-between gap-1 px-0.5 text-xs", children: [option.label, _jsx(Check, { "aria-hidden": "true", strokeWidth: 3, className: "size-3 text-primary opacity-0 group-data-[state=checked]:opacity-100" })] })] }, option.value))) })] }));
8
+ }
@@ -0,0 +1,18 @@
1
+ import type { Palette } from "../../appearance/index.ts";
2
+ /**
3
+ * What each palette looks like in its swatch: the brand color and the page background, in
4
+ * light and dark. These repeat a few values from `core/styles/palettes.css`, only to draw
5
+ * the previews; the palette itself is applied through CSS.
6
+ */
7
+ export declare const paletteOptions: readonly {
8
+ value: Palette;
9
+ label: string;
10
+ light: {
11
+ primary: string;
12
+ background: string;
13
+ };
14
+ dark: {
15
+ primary: string;
16
+ background: string;
17
+ };
18
+ }[];
@@ -0,0 +1,64 @@
1
+ /**
2
+ * What each palette looks like in its swatch: the brand color and the page background, in
3
+ * light and dark. These repeat a few values from `core/styles/palettes.css`, only to draw
4
+ * the previews; the palette itself is applied through CSS.
5
+ */
6
+ export const paletteOptions = [
7
+ {
8
+ value: "default",
9
+ label: "Default",
10
+ light: { primary: "oklch(0.5229 0.2403 282.5)", background: "oklch(0.9921 0.0017 325.6)" },
11
+ dark: { primary: "oklch(0.6 0.22 282.5)", background: "oklch(0.16 0.012 285)" },
12
+ },
13
+ {
14
+ value: "clay",
15
+ label: "Clay",
16
+ light: { primary: "oklch(0.6171 0.1375 39.0427)", background: "oklch(0.9818 0.0054 95.0986)" },
17
+ dark: { primary: "oklch(0.6724 0.1308 38.7559)", background: "oklch(0.2679 0.0036 106.6427)" },
18
+ },
19
+ {
20
+ value: "amber",
21
+ label: "Amber",
22
+ light: { primary: "oklch(0.7686 0.1647 70.0804)", background: "oklch(1 0 0)" },
23
+ dark: { primary: "oklch(0.7686 0.1647 70.0804)", background: "oklch(0.2046 0 0)" },
24
+ },
25
+ {
26
+ value: "ocean",
27
+ label: "Ocean breeze",
28
+ light: { primary: "oklch(0.7227 0.192 149.5793)", background: "oklch(0.9751 0.0127 244.2507)" },
29
+ dark: { primary: "oklch(0.7729 0.1535 163.2231)", background: "oklch(0.2077 0.0398 265.7549)" },
30
+ },
31
+ {
32
+ value: "violet",
33
+ label: "Violet bloom",
34
+ light: { primary: "oklch(0.5393 0.2713 286.7462)", background: "oklch(0.994 0 0)" },
35
+ dark: { primary: "oklch(0.6132 0.2294 291.7437)", background: "oklch(0.2223 0.006 271.1393)" },
36
+ },
37
+ {
38
+ value: "nature",
39
+ label: "Nature",
40
+ light: { primary: "oklch(0.5234 0.1347 144.1672)", background: "oklch(0.9711 0.0074 80.7211)" },
41
+ dark: { primary: "oklch(0.6731 0.1624 144.2083)", background: "oklch(0.2683 0.0279 150.7681)" },
42
+ },
43
+ {
44
+ value: "catppuccin",
45
+ label: "Catppuccin",
46
+ light: {
47
+ primary: "oklch(0.5547 0.2503 297.0156)",
48
+ background: "oklch(0.9578 0.0058 264.5321)",
49
+ },
50
+ dark: { primary: "oklch(0.7871 0.1187 304.7693)", background: "oklch(0.2155 0.0254 284.0647)" },
51
+ },
52
+ {
53
+ value: "supabase",
54
+ label: "Supabase",
55
+ light: { primary: "oklch(0.8348 0.1302 160.908)", background: "oklch(0.9911 0 0)" },
56
+ dark: { primary: "oklch(0.4365 0.1044 156.7556)", background: "oklch(0.1822 0 0)" },
57
+ },
58
+ {
59
+ value: "customer",
60
+ label: "Customer",
61
+ light: { primary: "oklch(0.566 0.066 209.9)", background: "oklch(0.9818 0.0054 95.0986)" },
62
+ dark: { primary: "oklch(0.662 0.077 209.9)", background: "oklch(0.2679 0.0036 106.6427)" },
63
+ },
64
+ ];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A floating button that opens a drawer to change the look of the app: layout, color scheme,
3
+ * width, palette, sidebar width and preloader. Every choice applies at once and is remembered.
4
+ */
5
+ export declare function ThemeCustomizer(): import("react").JSX.Element;
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Ban, LoaderCircle, RotateCcw, RotateCw, Settings, Sparkles } from "lucide-react";
4
+ import { motion, useReducedMotion } from "motion/react";
5
+ import { Button } from "@ektyra/ui/components/button";
6
+ import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, } from "@ektyra/ui/components/sheet";
7
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@ektyra/ui/components/tooltip";
8
+ import { PreloaderPreview, resetAppearance, setAppearance, useAppearance, } from "../../appearance/index.js";
9
+ import { setSidebarCollapsed, useSidebarCollapsed } from "../../sidebar-state/index.js";
10
+ import { useTheme } from "@ektyra/ui/theme";
11
+ import { ColorSchemeChoice } from "./color-scheme-choice.js";
12
+ import { LayoutWireframe } from "./layout-wireframe.js";
13
+ import { OptionPicker } from "./option-picker.js";
14
+ import { paletteOptions } from "./palette-data.js";
15
+ function Section({ children }) {
16
+ return _jsx("div", { className: "border-b border-border pb-5 last:border-b-0 last:pb-0", children: children });
17
+ }
18
+ const Tile = ({ children }) => (_jsx("span", { "aria-hidden": "true", className: "grid aspect-[16/10] place-items-center rounded-md bg-muted text-muted-foreground [&_svg]:size-5", children: children }));
19
+ const preloaderOptions = [
20
+ { value: "none", label: "None", icon: _jsx(Ban, {}) },
21
+ { value: "rotating", label: "Rotating", icon: _jsx(RotateCw, {}) },
22
+ { value: "spinning", label: "Spinning", icon: _jsx(LoaderCircle, {}) },
23
+ { value: "loading", label: "Loading", icon: _jsx(Sparkles, {}) },
24
+ ];
25
+ /**
26
+ * A floating button that opens a drawer to change the look of the app: layout, color scheme,
27
+ * width, palette, sidebar width and preloader. Every choice applies at once and is remembered.
28
+ */
29
+ export function ThemeCustomizer() {
30
+ const appearance = useAppearance();
31
+ const collapsed = useSidebarCollapsed();
32
+ const reduceMotion = useReducedMotion();
33
+ const { setTheme } = useTheme();
34
+ const [preview, setPreview] = useState(null);
35
+ const horizontal = appearance.layout === "horizontal";
36
+ function reset() {
37
+ resetAppearance();
38
+ setSidebarCollapsed(false);
39
+ setTheme("system");
40
+ }
41
+ return (_jsxs(Sheet, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(SheetTrigger, { asChild: true, children: _jsx(motion.button, { type: "button", "aria-label": "Customize theme", whileHover: reduceMotion ? undefined : { scale: 1.08 }, whileTap: reduceMotion ? undefined : { scale: 0.92 }, className: "fixed right-5 bottom-5 z-40 grid size-12 cursor-pointer place-items-center rounded-full bg-primary text-primary-foreground shadow-lg outline-none transition-shadow hover:shadow-xl focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", children: _jsx(motion.span, { className: "inline-grid", animate: reduceMotion ? undefined : { rotate: 360 }, transition: { duration: 14, ease: "linear", repeat: Infinity }, children: _jsx(Settings, { className: "size-6", "aria-hidden": "true" }) }) }) }) }), _jsx(TooltipContent, { side: "left", children: "Customize theme" })] }), _jsxs(SheetContent, { className: "w-[min(24rem,100vw)] gap-0 p-0", children: [_jsxs(SheetHeader, { className: "border-b border-border p-5", children: [_jsx(SheetTitle, { children: "Theme customizer" }), _jsx(SheetDescription, { children: "Changes apply right away and are remembered." })] }), _jsxs("div", { className: "scrollbar-primary grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-5", children: [_jsx(Section, { children: _jsx(OptionPicker, { label: "Layout", value: appearance.layout, onValueChange: (value) => setAppearance("layout", value), options: [
42
+ {
43
+ value: "vertical",
44
+ label: "Vertical",
45
+ preview: _jsx(LayoutWireframe, { layout: "vertical" }),
46
+ },
47
+ {
48
+ value: "horizontal",
49
+ label: "Horizontal",
50
+ preview: _jsx(LayoutWireframe, { layout: "horizontal" }),
51
+ },
52
+ {
53
+ value: "detached",
54
+ label: "Detached",
55
+ preview: _jsx(LayoutWireframe, { layout: "detached" }),
56
+ },
57
+ ] }) }), _jsx(Section, { children: _jsx(ColorSchemeChoice, {}) }), _jsx(Section, { children: _jsx(OptionPicker, { label: "Layout width", value: appearance.width, onValueChange: (value) => setAppearance("width", value), options: [
58
+ {
59
+ value: "fluid",
60
+ label: "Fluid",
61
+ preview: _jsx(LayoutWireframe, { layout: appearance.layout }),
62
+ },
63
+ {
64
+ value: "boxed",
65
+ label: "Boxed",
66
+ preview: _jsx(LayoutWireframe, { layout: appearance.layout, boxed: true }),
67
+ },
68
+ ] }) }), _jsx(Section, { children: _jsx(OptionPicker, { label: "Color palette", columns: 3, value: appearance.palette, onValueChange: (value) => setAppearance("palette", value), options: paletteOptions.map((palette) => ({
69
+ value: palette.value,
70
+ label: palette.label,
71
+ preview: (_jsx("span", { "aria-hidden": "true", style: {
72
+ "--l-bg": palette.light.background,
73
+ "--l-fg": palette.light.primary,
74
+ "--d-bg": palette.dark.background,
75
+ "--d-fg": palette.dark.primary,
76
+ }, className: "grid aspect-[16/10] place-items-center rounded-md border border-border bg-(--l-bg) dark:bg-(--d-bg)", children: _jsx("span", { className: "size-5 rounded-full bg-(--l-fg) dark:bg-(--d-fg)" }) })),
77
+ })) }) }), _jsx(Section, { children: _jsx(OptionPicker, { label: "Sidebar width", description: horizontal ? "The horizontal layout has no sidebar." : undefined, value: collapsed ? "icons" : "default", disabled: horizontal, onValueChange: (value) => setSidebarCollapsed(value === "icons"), options: [
78
+ {
79
+ value: "default",
80
+ label: "Default",
81
+ preview: _jsx(LayoutWireframe, { layout: "vertical" }),
82
+ },
83
+ {
84
+ value: "icons",
85
+ label: "Icon only",
86
+ preview: _jsx(LayoutWireframe, { layout: "vertical", iconOnly: true }),
87
+ },
88
+ ] }) }), _jsx(Section, { children: _jsx(OptionPicker, { label: "Preloader", description: "Shown while the app loads. Picking one plays a short preview.", value: appearance.preloader, onValueChange: (value) => {
89
+ setAppearance("preloader", value);
90
+ setPreview({ kind: value, key: Date.now() });
91
+ }, options: preloaderOptions.map((option) => ({
92
+ value: option.value,
93
+ label: option.label,
94
+ preview: _jsx(Tile, { children: option.icon }),
95
+ })) }) })] }), _jsx(SheetFooter, { className: "border-t border-border p-4", children: _jsxs(Button, { variant: "outline", onClick: reset, children: [_jsx(RotateCcw, { "aria-hidden": "true" }), "Reset to defaults"] }) })] }), _jsx(PreloaderPreview, { kind: preview?.kind ?? null }, preview?.key)] }));
96
+ }
@@ -0,0 +1,5 @@
1
+ import type { NavLeaf } from "../../navigation/index.ts";
2
+ /** A page in a dropdown, with the same unread count as in the sidebar. */
3
+ export declare function HorizontalMenuLeaf({ item }: Readonly<{
4
+ item: NavLeaf;
5
+ }>): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link } from "@tanstack/react-router";
3
+ import { Badge } from "@ektyra/ui/components/badge";
4
+ import { DropdownMenuItem } from "@ektyra/ui/components/dropdown-menu";
5
+ import { useNavBadgeCount } from "../../navigation/index.js";
6
+ /** A page in a dropdown, with the same unread count as in the sidebar. */
7
+ export function HorizontalMenuLeaf({ item }) {
8
+ const count = useNavBadgeCount(String(item.to));
9
+ const Icon = item.icon;
10
+ return (_jsx(DropdownMenuItem, { asChild: true, children: _jsxs(Link, { to: item.to, children: [_jsx(Icon, { "aria-hidden": "true" }), item.label, count > 0 && (_jsx(Badge, { className: "ml-auto h-5 min-w-5 justify-center px-1.5 text-[0.65rem]", children: count })), item.badge && (_jsx(Badge, { variant: "secondary", className: "ml-auto px-1.5 py-0 text-[0.65rem]", children: item.badge }))] }) }));
11
+ }
@@ -0,0 +1,2 @@
1
+ /** The menu bar used by the horizontal layout. It replaces the sidebar. */
2
+ export declare function HorizontalMenu(): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link, useRouterState } from "@tanstack/react-router";
3
+ import { ChevronDown } from "lucide-react";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@ektyra/ui/components/dropdown-menu";
5
+ import { cn } from "@ektyra/ui/lib/cn";
6
+ import { isNavParent, useNavigation } from "../../navigation/index.js";
7
+ import { HorizontalMenuLeaf } from "./horizontal-menu-leaf.js";
8
+ /** The pages under a top-level entry, for marking it as the current section. */
9
+ const pathsOf = (items) => items.flatMap((item) => isNavParent(item) ? item.children.map((child) => String(child.to)) : [String(item.to)]);
10
+ /**
11
+ * One top-level entry per menu section: the labelled groups ("Apps & pages", "Components")
12
+ * and each unlabelled parent ("Dashboards"). Each opens a dropdown, and parents
13
+ * inside open a sub-menu to the side.
14
+ */
15
+ function sectionsOf(groups) {
16
+ return groups.flatMap((group) => {
17
+ if (group.label)
18
+ return [{ label: group.label, items: group.items }];
19
+ return group.items.map((item) => ({
20
+ label: item.label,
21
+ items: isNavParent(item)
22
+ ? item.children.map((child) => ({ label: child.label, icon: item.icon, to: child.to }))
23
+ : [item],
24
+ icon: item.icon,
25
+ }));
26
+ });
27
+ }
28
+ const triggerClass = "flex h-9 cursor-pointer items-center gap-1.5 rounded-md px-3 text-sm text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-muted data-[state=open]:text-foreground";
29
+ /** The menu bar used by the horizontal layout. It replaces the sidebar. */
30
+ export function HorizontalMenu() {
31
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
32
+ const { main, footer } = useNavigation();
33
+ const sections = sectionsOf([...main, ...footer]);
34
+ return (_jsx("nav", { "aria-label": "Main", className: "border-b border-border bg-background/90 px-4 backdrop-blur", children: _jsx("ul", { className: "flex items-center gap-1 overflow-x-auto py-1.5", children: sections.map((section) => {
35
+ const current = pathsOf(section.items).some((path) => pathname === path || pathname.startsWith(`${path}/`));
36
+ return (_jsx("li", { className: "shrink-0", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-current": current ? "true" : undefined, className: cn(triggerClass, current &&
37
+ "bg-primary/10 text-primary hover:bg-primary/10 hover:text-primary"), children: [section.label, _jsx(ChevronDown, { className: "size-3.5", "aria-hidden": "true" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "w-56", children: section.items.map((item) => isNavParent(item) ? (_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(item.icon, { "aria-hidden": "true" }), item.label] }), _jsx(DropdownMenuSubContent, { children: item.children.map((child) => (_jsx(DropdownMenuItem, { asChild: true, children: _jsx(Link, { to: child.to, children: child.label }) }, String(child.to)))) })] }, item.label)) : (_jsx(HorizontalMenuLeaf, { item: item }, item.label))) })] }) }, section.label));
38
+ }) }) }));
39
+ }
@@ -0,0 +1 @@
1
+ export { HorizontalMenu } from "./horizontal-menu.tsx";
@@ -0,0 +1 @@
1
+ export { HorizontalMenu } from "./horizontal-menu.js";
@@ -0,0 +1,7 @@
1
+ import type { SVGProps } from "react";
2
+ /**
3
+ * Ektyra wordmark. Two configurable colors:
4
+ * - text: `currentColor` (set with Tailwind `text-*`)
5
+ * - dash in the E: `--ektyra-accent` (defaults to the theme's `--primary`)
6
+ */
7
+ export declare function Logo(props: Readonly<SVGProps<SVGSVGElement>>): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Ektyra wordmark. Two configurable colors:
4
+ * - text: `currentColor` (set with Tailwind `text-*`)
5
+ * - dash in the E: `--ektyra-accent` (defaults to the theme's `--primary`)
6
+ */
7
+ export function Logo(props) {
8
+ return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "137 492 979 301", fill: "currentColor", role: "img", "aria-label": "Ektyra", ...props, children: [_jsx("path", { d: "M407.8 495.8L365.5 509.8C364.8 510.2 364.8 713.8 365.2 714.2C366 714.5 409 714.5 409.6 714L409.6 682.2C409.8 638.2 409.8 641.2 410.2 641.2L411.2 642C412.2 643.8 419 651.2 424 656.5L477.8 714.4L507.5 714.4C541 714.2 538.2 714.5 535.8 712.2L458.2 631.8L532.2 558.1L479.2 558.1L415 622.8L411 628.2C411 628.8 410.2 629.5 410 629L409.5 495.8L407.8 495.8ZM192 505.5C191.2 505.8 191.2 506 190.5 508.8L141.5 712.8C141.2 713.8 141.2 713.8 141.8 714.2C142.2 714.5 318.2 714.8 319 714.2L347.8 675.2L347.8 674L196.5 673.5C196 673.2 196.5 671 198.8 662.8L226.5 547C227 546.5 227.2 546.5 276.8 546.4L327 546.4L355 507.5C356.2 505.8 356.2 505.8 352.5 505.5L192 505.5ZM587.8 507.8L545 522L545 557.8L524.8 589.5C524.8 590.2 525.5 590.2 535 590.4L544.9 590.4L544.9 628.2C545.2 668.8 545 667.5 546.5 674.5C549.8 690 556.2 700 567.8 707.8C581.8 716.8 603.8 719 627.8 713.5C635.5 711.8 636.2 711.2 636.2 709.8L639.8 681.2C640.2 677.2 640 675.8 638.8 676.5L631.8 678.2C608 683.2 593.8 678.2 590.8 663.5L590.2 660.8C589.8 659.5 589.5 591 590 590.5L634.8 590C635.2 589.5 635.2 558.8 634.8 558.2L589.9 557.8L589.9 532.8C589.8 504.8 590 506.8 587.8 507.8ZM920.5 554C909.2 555.2 900.2 558.2 892 563.8C885.2 568 878.5 575.2 875 582C873.2 585.2 873.2 585 873 577.2L872.2 558.5C871.8 557.8 838 557.8 837.5 558.5C837 559 836.8 713.2 837.2 714.2L837.5 715L881.1 715L881.1 671.5C881.2 634 881.2 628.8 881.8 626C883.8 609.8 890.8 601 907 595.5C916.5 592.2 931.8 592.2 942.5 595.8L945 596C945.5 595 945.5 557 944.8 556.2C943.2 554.8 928.2 553.2 920.5 554ZM1018.2 554L1002.8 555.8C996.5 556.8 986 559.5 979 562.2L967 567C964.5 568.2 964.2 568.8 964 571L957.2 604.5C957.2 605.2 958 605.5 958.8 605L976.8 596.5L997.5 589.8C1002.8 588.5 1011 587 1016.8 586.8C1032.8 585.5 1045.8 587.5 1055.2 592.8C1062 596.8 1066.5 602.5 1068.2 609.5C1068.8 612 1069.2 619.2 1068.8 619.8L1053.5 618.5C1019.8 615 989.2 616.8 973.2 623L960 628.8C947 636.2 938.8 647.5 936.2 660.8C935.2 667.5 935.8 677.8 937.8 683.8C943.8 702 960.5 714.5 984.5 718.5L997 719.8C1013.2 721 1033.5 717.2 1047.5 710.2C1057.2 705.2 1068 696.8 1072 690.5C1072.8 689 1073 689.2 1073.2 692L1075.5 714.8C1076 715.2 1111.8 715 1112.4 714.8L1112.4 662.8C1112.5 611.2 1112.5 606.2 1111.8 603L1110 595.8C1103.5 573.5 1080.8 558.5 1047.8 554.8C1039.8 553.8 1025.5 553.5 1018.2 554ZM1041 644L1068.8 646.2C1069.2 646.5 1069.2 652.5 1068.5 655.2C1064.8 671.2 1045 685 1022.5 687.2C1002.2 689.2 986 683.5 981.2 673C980.2 670.5 980.2 663.5 981.5 660.8C982.8 657 985.8 653.5 989.2 651.5L994.5 648.8C996.5 647.8 1000.5 646.8 1005.2 645.8L1013.8 644.5L1031.5 643.9L1041 644ZM641.2 558.2L708.2 692.2L709 692.8C709.8 692.8 710.2 692 715.5 682L733.2 648.8L688 558.1L641.2 558.2ZM788.8 558.2C788 558.8 785.5 563.8 779.5 575L733 666.2L669.5 787.2C668.5 788.8 669.2 789.5 670.8 788.8L730.8 764.5L833.2 560C834.2 557.8 836.2 558 811.2 558.1L788.8 558.2Z" }), _jsx("path", { style: { fill: "var(--ektyra-accent, var(--primary))" }, d: "M236.5 593.2L215.5 623.8C215.5 624.8 213.8 624.8 263.5 624.6L310.8 624.6L332.2 595.2C333.8 593 339 593.2 285 593.1L236.5 593.2Z" })] }));
9
+ }
@@ -0,0 +1,19 @@
1
+ /** Every word the dialog shows, so an app can translate it. */
2
+ export type CommandMenuLabels = {
3
+ search: string;
4
+ placeholder: string;
5
+ empty: string;
6
+ pages: string;
7
+ theme: string;
8
+ light: string;
9
+ dark: string;
10
+ system: string;
11
+ };
12
+ export declare const defaultCommandMenuLabels: CommandMenuLabels;
13
+ type CommandMenuProps = Readonly<{
14
+ open: boolean;
15
+ onOpenChange: (open: boolean) => void;
16
+ labels?: Partial<CommandMenuLabels>;
17
+ }>;
18
+ export declare function CommandMenu({ open, onOpenChange, labels }: CommandMenuProps): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useNavigate } from "@tanstack/react-router";
3
+ import { Monitor, Moon, Sun } from "lucide-react";
4
+ import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@ektyra/ui/components/command";
5
+ import { useTheme } from "@ektyra/ui/theme";
6
+ import { useNavigation } from "../../navigation/index.js";
7
+ export const defaultCommandMenuLabels = {
8
+ search: "Search",
9
+ placeholder: "Search pages and actions",
10
+ empty: "No results found.",
11
+ pages: "Pages",
12
+ theme: "Theme",
13
+ light: "Light",
14
+ dark: "Dark",
15
+ system: "System",
16
+ };
17
+ export function CommandMenu({ open, onOpenChange, labels }) {
18
+ const navigate = useNavigate();
19
+ const { setTheme } = useTheme();
20
+ const { pages } = useNavigation();
21
+ const text = { ...defaultCommandMenuLabels, ...labels };
22
+ const themes = [
23
+ { value: "light", label: text.light, icon: Sun },
24
+ { value: "dark", label: text.dark, icon: Moon },
25
+ { value: "system", label: text.system, icon: Monitor },
26
+ ];
27
+ const run = (action) => {
28
+ onOpenChange(false);
29
+ action();
30
+ };
31
+ return (_jsxs(CommandDialog, { open: open, onOpenChange: onOpenChange, label: text.search, children: [_jsx(CommandInput, { placeholder: text.placeholder }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: text.empty }), _jsx(CommandGroup, { heading: text.pages, children: pages.map(({ label, to, icon: Icon, group }) => (_jsxs(CommandItem, { value: `${group ?? ""} ${label}`, onSelect: () => run(() => void navigate({ to })), children: [_jsx(Icon, { "aria-hidden": "true" }), label, group && _jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: group })] }, `${group ?? ""}${to}`))) }), _jsx(CommandGroup, { heading: text.theme, children: themes.map(({ value, label, icon: Icon }) => (_jsxs(CommandItem, { value: label, onSelect: () => run(() => setTheme(value)), children: [_jsx(Icon, { "aria-hidden": "true" }), label] }, value))) })] })] }));
32
+ }
@@ -0,0 +1 @@
1
+ export { Navbar } from "./navbar.tsx";
@@ -0,0 +1 @@
1
+ export { Navbar } from "./navbar.js";
@@ -0,0 +1 @@
1
+ export declare function NavbarHelp(): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CircleHelp } from "lucide-react";
3
+ import { IconButton } from "@ektyra/ui/components/icon-button";
4
+ export function NavbarHelp() {
5
+ return (_jsx(IconButton, { label: "Help", children: _jsx(CircleHelp, { "aria-hidden": "true" }) }));
6
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The bell. A badge shows how many things are unread (emails, chats and more). When
3
+ * the page loads with something unread, the bell rings for two seconds. Clicking it
4
+ * opens the latest notifications.
5
+ */
6
+ export declare function NavbarNotifications(): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Bell } from "lucide-react";
4
+ import { IconButton } from "@ektyra/ui/components/icon-button";
5
+ import { Popover, PopoverContent, PopoverTrigger } from "@ektyra/ui/components/popover";
6
+ import { NotificationsPanel } from "../../notifications/notifications-panel.js";
7
+ import { useNotifications } from "../../notifications/index.js";
8
+ /**
9
+ * The bell. A badge shows how many things are unread (emails, chats and more). When
10
+ * the page loads with something unread, the bell rings for two seconds. Clicking it
11
+ * opens the latest notifications.
12
+ */
13
+ export function NavbarNotifications() {
14
+ const [open, setOpen] = useState(false);
15
+ const { items, unread, open: openNotification, markAllRead } = useNotifications();
16
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconButton, { label: unread > 0 ? `Notifications (${unread} unread)` : "Notifications", children: [_jsx(Bell, { className: unread > 0 ? "animate-bell motion-reduce:animate-none" : undefined, "aria-hidden": "true" }), unread > 0 && (_jsx("span", { "aria-hidden": "true", className: "absolute top-0.5 right-0.5 grid h-4 min-w-4 place-items-center rounded-full bg-destructive px-1 text-[0.6rem] leading-none text-white tabular-nums ring-2 ring-background", children: unread > 99 ? "99+" : unread }))] }) }), _jsx(PopoverContent, { align: "end", className: "w-[min(26rem,calc(100vw-1.5rem))] p-0", children: _jsx(NotificationsPanel, { items: items, unread: unread, onOpen: (notification) => {
17
+ setOpen(false);
18
+ openNotification(notification);
19
+ }, onMarkAllRead: markAllRead }) })] }));
20
+ }
@@ -0,0 +1 @@
1
+ export declare function NavbarSearch(): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { Search } from "lucide-react";
4
+ import { CommandMenu } from "./command-menu.js";
5
+ export function NavbarSearch() {
6
+ const [open, setOpen] = useState(false);
7
+ // Cmd+K on macOS, Ctrl+K elsewhere.
8
+ useEffect(() => {
9
+ const onKeyDown = (event) => {
10
+ if (event.key.toLowerCase() === "k" && (event.metaKey || event.ctrlKey)) {
11
+ event.preventDefault();
12
+ setOpen((current) => !current);
13
+ }
14
+ };
15
+ document.addEventListener("keydown", onKeyDown);
16
+ return () => document.removeEventListener("keydown", onKeyDown);
17
+ }, []);
18
+ return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", onClick: () => setOpen(true), className: "flex h-9 w-full max-w-sm cursor-pointer items-center gap-2 rounded-md border border-input bg-background px-3 text-sm text-muted-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx(Search, { className: "size-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { className: "flex-1 text-left", children: "Search\u2026" }), _jsx("kbd", { className: "hidden rounded border border-border bg-muted px-1.5 py-0.5 text-xs sm:inline", children: "\u2318K" })] }), _jsx(CommandMenu, { open: open, onOpenChange: setOpen })] }));
19
+ }
@@ -0,0 +1 @@
1
+ export declare function NavbarSidebarToggle(): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
4
+ import { IconButton } from "@ektyra/ui/components/icon-button";
5
+ import { toggleSidebar, useSidebarCollapsed } from "../../sidebar-state/index.js";
6
+ export function NavbarSidebarToggle() {
7
+ const collapsed = useSidebarCollapsed();
8
+ // Cmd+B on macOS, Ctrl+B elsewhere.
9
+ useEffect(() => {
10
+ const onKeyDown = (event) => {
11
+ if (event.key.toLowerCase() === "b" && (event.metaKey || event.ctrlKey)) {
12
+ event.preventDefault();
13
+ toggleSidebar();
14
+ }
15
+ };
16
+ document.addEventListener("keydown", onKeyDown);
17
+ return () => document.removeEventListener("keydown", onKeyDown);
18
+ }, []);
19
+ return (_jsxs(IconButton, { label: "Toggle sidebar", shortcut: "\u2318B", "aria-expanded": !collapsed, onClick: toggleSidebar, children: [_jsx(PanelLeftClose, { className: "in-data-[sidebar=collapsed]:hidden", "aria-hidden": "true" }), _jsx(PanelLeftOpen, { className: "hidden in-data-[sidebar=collapsed]:block", "aria-hidden": "true" })] }));
20
+ }
@@ -0,0 +1,12 @@
1
+ export type NavbarUser = {
2
+ name: string;
3
+ email: string;
4
+ imageUrl?: string;
5
+ };
6
+ export declare function NavbarUserMenu({ user, onSignOut, profileHref, }: Readonly<{
7
+ user: NavbarUser;
8
+ /** Called by "Log out". Without it the item is shown disabled. */
9
+ onSignOut?: () => void;
10
+ /** Where "Profile settings" goes. Without it the item is not shown. */
11
+ profileHref?: string;
12
+ }>): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Link } from "@tanstack/react-router";
3
+ import { LogOut, UserRound } from "lucide-react";
4
+ import { Avatar, AvatarFallback, AvatarImage } from "@ektyra/ui/components/avatar";
5
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@ektyra/ui/components/dropdown-menu";
6
+ const initials = (name) => name
7
+ .split(/\s+/)
8
+ .filter(Boolean)
9
+ .slice(0, 2)
10
+ .map((part) => part.charAt(0).toUpperCase())
11
+ .join("");
12
+ export function NavbarUserMenu({ user, onSignOut, profileHref, }) {
13
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { "aria-label": "Account menu", className: "cursor-pointer rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", children: _jsxs(Avatar, { children: [user.imageUrl && _jsx(AvatarImage, { src: user.imageUrl, alt: "" }), _jsx(AvatarFallback, { children: initials(user.name) })] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs("div", { className: "px-2 py-1.5", children: [_jsx("p", { className: "truncate text-sm", children: user.name }), _jsx("p", { className: "truncate text-xs text-muted-foreground", children: user.email })] }), _jsx(DropdownMenuSeparator, {}), profileHref && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuItem, { asChild: true, children: _jsxs(Link, { to: profileHref, children: [_jsx(UserRound, { "aria-hidden": "true" }), "Profile settings"] }) }), _jsx(DropdownMenuSeparator, {})] })), _jsxs(DropdownMenuItem, { disabled: !onSignOut, onSelect: () => onSignOut?.(), children: [_jsx(LogOut, { "aria-hidden": "true" }), "Log out"] })] })] }));
14
+ }
@@ -0,0 +1,6 @@
1
+ import type { NavbarUser } from "./navbar-user-menu.tsx";
2
+ export declare function Navbar({ user, onSignOut, profileHref, }: Readonly<{
3
+ user: NavbarUser;
4
+ onSignOut?: () => void;
5
+ profileHref?: string;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link } from "@tanstack/react-router";
3
+ import { Separator } from "@ektyra/ui/components/separator";
4
+ import { Logo } from "../logo.js";
5
+ import { NavbarHelp } from "./navbar-help.js";
6
+ import { NavbarNotifications } from "./navbar-notifications.js";
7
+ import { NavbarSearch } from "./navbar-search.js";
8
+ import { NavbarSidebarToggle } from "./navbar-sidebar-toggle.js";
9
+ import { NavbarUserMenu } from "./navbar-user-menu.js";
10
+ export function Navbar({ user, onSignOut, profileHref, }) {
11
+ return (_jsxs("header", { className: "flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background/90 px-4 backdrop-blur", children: [_jsx(Link, { to: "/", "aria-label": "Ektyra, go to the app", className: "hidden shrink-0 rounded-md px-1 outline-none focus-visible:ring-2 focus-visible:ring-ring in-data-[layout=horizontal]:block", children: _jsx(Logo, { className: "h-6 w-auto" }) }), _jsx("div", { className: "in-data-[layout=horizontal]:hidden", children: _jsx(NavbarSidebarToggle, {}) }), _jsx(NavbarSearch, {}), _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [_jsx(NavbarNotifications, {}), _jsx(NavbarHelp, {}), _jsx(Separator, { orientation: "vertical", className: "mx-2" }), _jsx(NavbarUserMenu, { user: user, onSignOut: onSignOut, profileHref: profileHref })] })] }));
12
+ }
@@ -0,0 +1,11 @@
1
+ /** The menu entry for the page being shown, if it has one. */
2
+ export declare function useTrailEntry(): import("../navigation/types.ts").TrailEntry | undefined;
3
+ /**
4
+ * Where you are: Home, the menu headings above the page, then the page. Worked out
5
+ * from the menu and the current address, so every page gets it without extra code.
6
+ * Pass `current` on a detail page (a user, an entry): the menu page becomes a link
7
+ * and `current` is the last, unlinked crumb.
8
+ */
9
+ export declare function PageBreadcrumbs({ current }: Readonly<{
10
+ current?: string;
11
+ }>): import("react").JSX.Element | null;