@kopexa/sidebar 17.1.74 → 17.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -21,7 +21,46 @@ import {
21
21
  SidebarTrigger,
22
22
  useSidebar
23
23
  } from "./chunk-FPVGSRAX.mjs";
24
+ import {
25
+ SidebarV2
26
+ } from "./chunk-LCCZNS2E.mjs";
27
+ import {
28
+ AppShell,
29
+ AppShellAside,
30
+ AppShellHeader,
31
+ AppShellMain,
32
+ AppShellPanelContent,
33
+ AppShellRoot
34
+ } from "./chunk-YVQVW5EP.mjs";
35
+ import {
36
+ SidebarV2FromConfig
37
+ } from "./chunk-KLYPP6QE.mjs";
38
+ import {
39
+ SidebarV2Inset,
40
+ SidebarV2Panel,
41
+ SidebarV2PanelGroup,
42
+ SidebarV2PanelItems,
43
+ SidebarV2PanelLabel,
44
+ SidebarV2PanelLeaf,
45
+ SidebarV2Rail,
46
+ SidebarV2RailItem,
47
+ SidebarV2RailLink,
48
+ SidebarV2RailSpacer,
49
+ SidebarV2Trigger,
50
+ SidebarV2Workspace
51
+ } from "./chunk-YW3JMPRU.mjs";
52
+ import "./chunk-SDMGFB6V.mjs";
53
+ import {
54
+ SidebarV2Provider,
55
+ useSidebarV2
56
+ } from "./chunk-AIRHHM7Z.mjs";
24
57
  export {
58
+ AppShell,
59
+ AppShellAside,
60
+ AppShellHeader,
61
+ AppShellMain,
62
+ AppShellPanelContent,
63
+ AppShellRoot,
25
64
  Sidebar,
26
65
  SidebarContent,
27
66
  SidebarFooter,
@@ -41,5 +80,21 @@ export {
41
80
  SidebarRoot,
42
81
  SidebarSeparator,
43
82
  SidebarTrigger,
44
- useSidebar
83
+ SidebarV2,
84
+ SidebarV2FromConfig,
85
+ SidebarV2Inset,
86
+ SidebarV2Panel,
87
+ SidebarV2PanelGroup,
88
+ SidebarV2PanelItems,
89
+ SidebarV2PanelLabel,
90
+ SidebarV2PanelLeaf,
91
+ SidebarV2Provider,
92
+ SidebarV2Rail,
93
+ SidebarV2RailItem,
94
+ SidebarV2RailLink,
95
+ SidebarV2RailSpacer,
96
+ SidebarV2Trigger,
97
+ SidebarV2Workspace,
98
+ useSidebar,
99
+ useSidebarV2
45
100
  };
@@ -0,0 +1,43 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ /**
6
+ * AppShell — the layout owner: a CSS grid with named zones.
7
+ *
8
+ * ┌──────────────────────────────────────┐
9
+ * │ Header │ (full width)
10
+ * ├──────┬────────┬───────────────┬───────┤
11
+ * │ rail │ panel │ main │ aside │
12
+ * └──────┴────────┴───────────────┴───────┘
13
+ *
14
+ * Rail + panel content come from <SidebarV2.FromConfig> (or primitives), which
15
+ * place themselves into the `rail` / `panel` grid areas. Must be used inside
16
+ * <SidebarV2> (the context provider).
17
+ */
18
+ declare function AppShellRoot({ className, style, children, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
19
+ declare function AppShellHeader({ className, style, ...props }: ComponentProps<"header">): react_jsx_runtime.JSX.Element;
20
+ declare function AppShellMain({ className, style, ...props }: ComponentProps<"main">): react_jsx_runtime.JSX.Element;
21
+ declare function AppShellAside({ className, style, ...props }: ComponentProps<"aside">): react_jsx_runtime.JSX.Element;
22
+ type AppShellPanelContentProps = {
23
+ children: ReactNode;
24
+ };
25
+ /**
26
+ * Render arbitrary content into the shell's panel zone from any page/sub-layout
27
+ * (e.g. an LLM "Threats" panel). While mounted it overrides the nav panel.
28
+ *
29
+ * @example
30
+ * // app/(demo)/threats/page.tsx
31
+ * <AppShell.PanelContent>
32
+ * <SidebarV2.Panel title="Threats">{…}</SidebarV2.Panel>
33
+ * </AppShell.PanelContent>
34
+ */
35
+ declare function AppShellPanelContent({ children }: AppShellPanelContentProps): react.ReactPortal | null;
36
+ declare const AppShell: typeof AppShellRoot & {
37
+ Header: typeof AppShellHeader;
38
+ Main: typeof AppShellMain;
39
+ Aside: typeof AppShellAside;
40
+ PanelContent: typeof AppShellPanelContent;
41
+ };
42
+
43
+ export { AppShell, AppShellAside, AppShellHeader, AppShellMain, AppShellPanelContent, type AppShellPanelContentProps, AppShellRoot };
@@ -0,0 +1,43 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ /**
6
+ * AppShell — the layout owner: a CSS grid with named zones.
7
+ *
8
+ * ┌──────────────────────────────────────┐
9
+ * │ Header │ (full width)
10
+ * ├──────┬────────┬───────────────┬───────┤
11
+ * │ rail │ panel │ main │ aside │
12
+ * └──────┴────────┴───────────────┴───────┘
13
+ *
14
+ * Rail + panel content come from <SidebarV2.FromConfig> (or primitives), which
15
+ * place themselves into the `rail` / `panel` grid areas. Must be used inside
16
+ * <SidebarV2> (the context provider).
17
+ */
18
+ declare function AppShellRoot({ className, style, children, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
19
+ declare function AppShellHeader({ className, style, ...props }: ComponentProps<"header">): react_jsx_runtime.JSX.Element;
20
+ declare function AppShellMain({ className, style, ...props }: ComponentProps<"main">): react_jsx_runtime.JSX.Element;
21
+ declare function AppShellAside({ className, style, ...props }: ComponentProps<"aside">): react_jsx_runtime.JSX.Element;
22
+ type AppShellPanelContentProps = {
23
+ children: ReactNode;
24
+ };
25
+ /**
26
+ * Render arbitrary content into the shell's panel zone from any page/sub-layout
27
+ * (e.g. an LLM "Threats" panel). While mounted it overrides the nav panel.
28
+ *
29
+ * @example
30
+ * // app/(demo)/threats/page.tsx
31
+ * <AppShell.PanelContent>
32
+ * <SidebarV2.Panel title="Threats">{…}</SidebarV2.Panel>
33
+ * </AppShell.PanelContent>
34
+ */
35
+ declare function AppShellPanelContent({ children }: AppShellPanelContentProps): react.ReactPortal | null;
36
+ declare const AppShell: typeof AppShellRoot & {
37
+ Header: typeof AppShellHeader;
38
+ Main: typeof AppShellMain;
39
+ Aside: typeof AppShellAside;
40
+ PanelContent: typeof AppShellPanelContent;
41
+ };
42
+
43
+ export { AppShell, AppShellAside, AppShellHeader, AppShellMain, AppShellPanelContent, type AppShellPanelContentProps, AppShellRoot };
@@ -0,0 +1,142 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/v2/app-shell.tsx
23
+ var app_shell_exports = {};
24
+ __export(app_shell_exports, {
25
+ AppShell: () => AppShell,
26
+ AppShellAside: () => AppShellAside,
27
+ AppShellHeader: () => AppShellHeader,
28
+ AppShellMain: () => AppShellMain,
29
+ AppShellPanelContent: () => AppShellPanelContent,
30
+ AppShellRoot: () => AppShellRoot
31
+ });
32
+ module.exports = __toCommonJS(app_shell_exports);
33
+ var import_react2 = require("react");
34
+ var import_react_dom = require("react-dom");
35
+
36
+ // src/v2/context.tsx
37
+ var import_react_utils = require("@kopexa/react-utils");
38
+ var import_theme = require("@kopexa/theme");
39
+ var import_tooltip = require("@kopexa/tooltip");
40
+ var import_use_is_mobile = require("@kopexa/use-is-mobile");
41
+ var import_react = require("react");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var PIN_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
44
+ var [Provider, useSidebarV2] = (0, import_react_utils.createContext)({
45
+ name: "SidebarV2Context",
46
+ errorMessage: "useSidebarV2 must be used within <SidebarV2> (the provider component)."
47
+ });
48
+
49
+ // src/v2/app-shell.tsx
50
+ var import_jsx_runtime2 = require("react/jsx-runtime");
51
+ var RAIL_WIDTH = "4rem";
52
+ var PANEL_WIDTH = "15rem";
53
+ function AppShellRoot({
54
+ className,
55
+ style,
56
+ children,
57
+ ...props
58
+ }) {
59
+ const { tone, styles } = useSidebarV2();
60
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
61
+ "div",
62
+ {
63
+ "data-slot": "app-shell",
64
+ "data-tone": tone,
65
+ className: styles.shell({ className }),
66
+ style: {
67
+ "--kpx-rail-width": RAIL_WIDTH,
68
+ "--kpx-panel-width": PANEL_WIDTH,
69
+ gridTemplateAreas: '"header header header header" "rail panel main aside"',
70
+ gridTemplateRows: "auto 1fr",
71
+ gridTemplateColumns: "auto auto 1fr auto",
72
+ ...style
73
+ },
74
+ ...props,
75
+ children
76
+ }
77
+ );
78
+ }
79
+ function AppShellHeader({
80
+ className,
81
+ style,
82
+ ...props
83
+ }) {
84
+ const { styles } = useSidebarV2();
85
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
86
+ "header",
87
+ {
88
+ "data-slot": "app-shell-header",
89
+ className: styles.header({ className }),
90
+ style: { gridArea: "header", ...style },
91
+ ...props
92
+ }
93
+ );
94
+ }
95
+ function AppShellMain({ className, style, ...props }) {
96
+ const { styles } = useSidebarV2();
97
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
98
+ "main",
99
+ {
100
+ "data-slot": "app-shell-main",
101
+ className: styles.main({ className }),
102
+ style: { gridArea: "main", ...style },
103
+ ...props
104
+ }
105
+ );
106
+ }
107
+ function AppShellAside({
108
+ className,
109
+ style,
110
+ ...props
111
+ }) {
112
+ const { styles } = useSidebarV2();
113
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
114
+ "aside",
115
+ {
116
+ "data-slot": "app-shell-aside",
117
+ className: styles.aside({ className }),
118
+ style: { gridArea: "aside", ...style },
119
+ ...props
120
+ }
121
+ );
122
+ }
123
+ function AppShellPanelContent({ children }) {
124
+ const { panelHost, registerPanelOverride, navPreviewActive } = useSidebarV2();
125
+ (0, import_react2.useEffect)(() => registerPanelOverride(), [registerPanelOverride]);
126
+ if (!panelHost || navPreviewActive) return null;
127
+ return (0, import_react_dom.createPortal)(children, panelHost);
128
+ }
129
+ var AppShell = AppShellRoot;
130
+ AppShell.Header = AppShellHeader;
131
+ AppShell.Main = AppShellMain;
132
+ AppShell.Aside = AppShellAside;
133
+ AppShell.PanelContent = AppShellPanelContent;
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ AppShell,
137
+ AppShellAside,
138
+ AppShellHeader,
139
+ AppShellMain,
140
+ AppShellPanelContent,
141
+ AppShellRoot
142
+ });
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ AppShell,
5
+ AppShellAside,
6
+ AppShellHeader,
7
+ AppShellMain,
8
+ AppShellPanelContent,
9
+ AppShellRoot
10
+ } from "../chunk-YVQVW5EP.mjs";
11
+ import "../chunk-AIRHHM7Z.mjs";
12
+ export {
13
+ AppShell,
14
+ AppShellAside,
15
+ AppShellHeader,
16
+ AppShellMain,
17
+ AppShellPanelContent,
18
+ AppShellRoot
19
+ };
@@ -0,0 +1,78 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { IconButton } from '@kopexa/button';
5
+ import { SidebarV2Icon, SidebarV2PanelItem } from './types.mjs';
6
+
7
+ declare function SidebarV2Inset({ className, ...props }: ComponentProps<"main">): react_jsx_runtime.JSX.Element;
8
+ declare function SidebarV2Rail({ className, ...props }: ComponentProps<"nav">): react_jsx_runtime.JSX.Element;
9
+ declare function SidebarV2RailSpacer(): react_jsx_runtime.JSX.Element;
10
+ type SidebarV2WorkspaceProps = ComponentProps<"button"> & {
11
+ /** Workspace display name, e.g. "Webinar". */
12
+ name: string;
13
+ /** Secondary line, e.g. "Administrator". */
14
+ role?: string;
15
+ /** Custom logo node. Defaults to the workspace initial. */
16
+ logo?: ReactNode;
17
+ /**
18
+ * "rail" = compact icon tile for the dark rail (default).
19
+ * "bar" = horizontal logo + name/role for a light header/topbar.
20
+ */
21
+ appearance?: "rail" | "bar";
22
+ };
23
+ /**
24
+ * Workspace switcher trigger. Compose it with a DropdownMenu (asChild):
25
+ *
26
+ * @example
27
+ * <DropdownMenu.Trigger asChild>
28
+ * <SidebarV2.Workspace appearance="bar" name="Webinar" role="Administrator" />
29
+ * </DropdownMenu.Trigger>
30
+ */
31
+ declare const SidebarV2Workspace: react.ForwardRefExoticComponent<Omit<SidebarV2WorkspaceProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
32
+ declare function SidebarV2RailLink({ icon, label, href, badge, }: {
33
+ icon: SidebarV2Icon;
34
+ label: string;
35
+ href: string;
36
+ badge?: number | string;
37
+ }): react_jsx_runtime.JSX.Element;
38
+ declare function SidebarV2RailItem({ icon, label, active, hasPanel, onClick, onMouseEnter, onMouseLeave, badge, }: {
39
+ icon: SidebarV2Icon;
40
+ label: string;
41
+ active: boolean;
42
+ hasPanel?: boolean;
43
+ onClick?: () => void;
44
+ onMouseEnter?: () => void;
45
+ onMouseLeave?: () => void;
46
+ badge?: number | string;
47
+ }): react_jsx_runtime.JSX.Element;
48
+ declare function SidebarV2Panel({ title, subtitle, floating, hidePin, action, children, className, }: {
49
+ title?: string;
50
+ subtitle?: string;
51
+ floating?: boolean;
52
+ /** Hide the pin toggle — useful for page-supplied panels (no nav semantics). */
53
+ hidePin?: boolean;
54
+ /** Optional header action node, shown in place of the pin toggle. */
55
+ action?: ReactNode;
56
+ children: ReactNode;
57
+ className?: string;
58
+ }): react_jsx_runtime.JSX.Element;
59
+ /** Static section label inside a panel (non-collapsible group heading). */
60
+ declare function SidebarV2PanelLabel({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
61
+ declare function SidebarV2PanelLeaf({ item, active: activeProp, }: {
62
+ item: Extract<SidebarV2PanelItem, {
63
+ href: string;
64
+ }>;
65
+ /** Override the derived active state (e.g. for custom page routing rules). */
66
+ active?: boolean;
67
+ }): react_jsx_runtime.JSX.Element;
68
+ declare function SidebarV2PanelGroup({ item, }: {
69
+ item: Extract<SidebarV2PanelItem, {
70
+ children: unknown;
71
+ }>;
72
+ }): react_jsx_runtime.JSX.Element;
73
+ declare function SidebarV2PanelItems({ items, }: {
74
+ items: SidebarV2PanelItem[];
75
+ }): react_jsx_runtime.JSX.Element;
76
+ declare function SidebarV2Trigger({ className, ...props }: Omit<ComponentProps<typeof IconButton>, "aria-label">): react_jsx_runtime.JSX.Element;
77
+
78
+ export { SidebarV2Inset, SidebarV2Panel, SidebarV2PanelGroup, SidebarV2PanelItems, SidebarV2PanelLabel, SidebarV2PanelLeaf, SidebarV2Rail, SidebarV2RailItem, SidebarV2RailLink, SidebarV2RailSpacer, SidebarV2Trigger, SidebarV2Workspace, type SidebarV2WorkspaceProps };
@@ -0,0 +1,78 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { IconButton } from '@kopexa/button';
5
+ import { SidebarV2Icon, SidebarV2PanelItem } from './types.js';
6
+
7
+ declare function SidebarV2Inset({ className, ...props }: ComponentProps<"main">): react_jsx_runtime.JSX.Element;
8
+ declare function SidebarV2Rail({ className, ...props }: ComponentProps<"nav">): react_jsx_runtime.JSX.Element;
9
+ declare function SidebarV2RailSpacer(): react_jsx_runtime.JSX.Element;
10
+ type SidebarV2WorkspaceProps = ComponentProps<"button"> & {
11
+ /** Workspace display name, e.g. "Webinar". */
12
+ name: string;
13
+ /** Secondary line, e.g. "Administrator". */
14
+ role?: string;
15
+ /** Custom logo node. Defaults to the workspace initial. */
16
+ logo?: ReactNode;
17
+ /**
18
+ * "rail" = compact icon tile for the dark rail (default).
19
+ * "bar" = horizontal logo + name/role for a light header/topbar.
20
+ */
21
+ appearance?: "rail" | "bar";
22
+ };
23
+ /**
24
+ * Workspace switcher trigger. Compose it with a DropdownMenu (asChild):
25
+ *
26
+ * @example
27
+ * <DropdownMenu.Trigger asChild>
28
+ * <SidebarV2.Workspace appearance="bar" name="Webinar" role="Administrator" />
29
+ * </DropdownMenu.Trigger>
30
+ */
31
+ declare const SidebarV2Workspace: react.ForwardRefExoticComponent<Omit<SidebarV2WorkspaceProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
32
+ declare function SidebarV2RailLink({ icon, label, href, badge, }: {
33
+ icon: SidebarV2Icon;
34
+ label: string;
35
+ href: string;
36
+ badge?: number | string;
37
+ }): react_jsx_runtime.JSX.Element;
38
+ declare function SidebarV2RailItem({ icon, label, active, hasPanel, onClick, onMouseEnter, onMouseLeave, badge, }: {
39
+ icon: SidebarV2Icon;
40
+ label: string;
41
+ active: boolean;
42
+ hasPanel?: boolean;
43
+ onClick?: () => void;
44
+ onMouseEnter?: () => void;
45
+ onMouseLeave?: () => void;
46
+ badge?: number | string;
47
+ }): react_jsx_runtime.JSX.Element;
48
+ declare function SidebarV2Panel({ title, subtitle, floating, hidePin, action, children, className, }: {
49
+ title?: string;
50
+ subtitle?: string;
51
+ floating?: boolean;
52
+ /** Hide the pin toggle — useful for page-supplied panels (no nav semantics). */
53
+ hidePin?: boolean;
54
+ /** Optional header action node, shown in place of the pin toggle. */
55
+ action?: ReactNode;
56
+ children: ReactNode;
57
+ className?: string;
58
+ }): react_jsx_runtime.JSX.Element;
59
+ /** Static section label inside a panel (non-collapsible group heading). */
60
+ declare function SidebarV2PanelLabel({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
61
+ declare function SidebarV2PanelLeaf({ item, active: activeProp, }: {
62
+ item: Extract<SidebarV2PanelItem, {
63
+ href: string;
64
+ }>;
65
+ /** Override the derived active state (e.g. for custom page routing rules). */
66
+ active?: boolean;
67
+ }): react_jsx_runtime.JSX.Element;
68
+ declare function SidebarV2PanelGroup({ item, }: {
69
+ item: Extract<SidebarV2PanelItem, {
70
+ children: unknown;
71
+ }>;
72
+ }): react_jsx_runtime.JSX.Element;
73
+ declare function SidebarV2PanelItems({ items, }: {
74
+ items: SidebarV2PanelItem[];
75
+ }): react_jsx_runtime.JSX.Element;
76
+ declare function SidebarV2Trigger({ className, ...props }: Omit<ComponentProps<typeof IconButton>, "aria-label">): react_jsx_runtime.JSX.Element;
77
+
78
+ export { SidebarV2Inset, SidebarV2Panel, SidebarV2PanelGroup, SidebarV2PanelItems, SidebarV2PanelLabel, SidebarV2PanelLeaf, SidebarV2Rail, SidebarV2RailItem, SidebarV2RailLink, SidebarV2RailSpacer, SidebarV2Trigger, SidebarV2Workspace, type SidebarV2WorkspaceProps };