'use strict';

var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var index = require('../../node_modules/.pnpm/@radix-ui_react-collapsible@1.1.2_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18._hjslo7xm5vmo3b4sx344jkbtcq/node_modules/@radix-ui/react-collapsible/dist/index.cjs');
var index$1 = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
var React = require('react');
var tooltip = require('../tooltip/tooltip.cjs');
var sidebar_module = require('./sidebar.module.css.cjs');
var clsx = require('../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.cjs');

const root = index$1.cva(sidebar_module.default.root);
const SidebarRoot = React.forwardRef(({ className, position = "left", open, onOpenChange, children, ...props }, ref) => (jsxRuntime.jsxRuntimeExports.jsx(tooltip.TooltipProvider, { children: jsxRuntime.jsxRuntimeExports.jsx(index.Root, { ref: ref, className: root({ className }), "data-position": position, "data-state": open ? "expanded" : "collapsed", open: open, onOpenChange: onOpenChange, "aria-label": "Navigation Sidebar", "aria-expanded": open, role: "navigation", ...props, asChild: true, children: jsxRuntime.jsxRuntimeExports.jsxs("aside", { children: [jsxRuntime.jsxRuntimeExports.jsx(tooltip.Tooltip, { message: open ? "Click to collapse" : "Click to expand", side: position === "left" ? "right" : "left", asChild: true, children: jsxRuntime.jsxRuntimeExports.jsx("div", { className: sidebar_module.default.resizeHandle, onClick: () => onOpenChange?.(!open), role: "button", tabIndex: 0, "aria-label": open ? "Collapse sidebar" : "Expand sidebar", onKeyDown: (e) => {
                            if (e.key === "Enter" || e.key === " ") {
                                e.preventDefault();
                                onOpenChange?.(!open);
                            }
                        } }) }), children] }) }) })));
const SidebarHeader = React.forwardRef(({ className, logo, title, onLogoClick, ...props }, ref) => (jsxRuntime.jsxRuntimeExports.jsxs("div", { ref: ref, className: sidebar_module.default.header, role: "banner", ...props, children: [jsxRuntime.jsxRuntimeExports.jsx("div", { className: sidebar_module.default.logo, onClick: onLogoClick, role: onLogoClick ? "button" : undefined, tabIndex: onLogoClick ? 0 : undefined, onKeyDown: (e) => {
                if (onLogoClick && (e.key === "Enter" || e.key === " ")) {
                    e.preventDefault();
                    onLogoClick();
                }
            }, style: { cursor: onLogoClick ? "pointer" : undefined }, children: logo }), jsxRuntime.jsxRuntimeExports.jsx("div", { className: sidebar_module.default.title, role: "heading", "aria-level": 1, children: title })] })));
const SidebarMain = React.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxRuntimeExports.jsx("div", { ref: ref, className: sidebar_module.default.main, role: "group", "aria-label": "Main navigation", ...props, children: children })));
const SidebarFooter = React.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxRuntimeExports.jsx("div", { ref: ref, className: sidebar_module.default.footer, role: "group", "aria-label": "Footer navigation", ...props, children: children })));
const SidebarItem = React.forwardRef(({ classNames, icon, children, active, disabled, ...props }, ref) => (jsxRuntime.jsxRuntimeExports.jsxs("a", { ref: ref, className: clsx.clsx(sidebar_module.default["nav-item"], classNames?.root), "data-active": active, "data-disabled": disabled, role: "menuitem", "aria-current": active ? "page" : undefined, "aria-disabled": disabled, ...props, children: [jsxRuntime.jsxRuntimeExports.jsx("span", { className: clsx.clsx(sidebar_module.default["nav-icon"], classNames?.icon), "aria-hidden": "true", children: icon }), jsxRuntime.jsxRuntimeExports.jsx("span", { className: sidebar_module.default["nav-text"], children: children })] })));
const SidebarNavigationGroup = React.forwardRef(({ className, name, icon, children, ...props }, ref) => (jsxRuntime.jsxRuntimeExports.jsxs("section", { ref: ref, className: className, "aria-label": name, ...props, children: [jsxRuntime.jsxRuntimeExports.jsxs("div", { className: sidebar_module.default["nav-group-header"], children: [icon && jsxRuntime.jsxRuntimeExports.jsx("span", { className: sidebar_module.default["nav-icon"], children: icon }), jsxRuntime.jsxRuntimeExports.jsx("span", { className: sidebar_module.default["nav-group-name"], children: name })] }), jsxRuntime.jsxRuntimeExports.jsx("div", { className: sidebar_module.default["nav-group-items"], role: "list", children: children })] })));
SidebarRoot.displayName = "Sidebar.Root";
SidebarHeader.displayName = "Sidebar.Header";
SidebarMain.displayName = "Sidebar.Main";
SidebarFooter.displayName = "Sidebar.Footer";
SidebarItem.displayName = "Sidebar.Item";
SidebarNavigationGroup.displayName = "Sidebar.Group";
const Sidebar = Object.assign(SidebarRoot, {
    Header: SidebarHeader,
    Main: SidebarMain,
    Footer: SidebarFooter,
    Item: SidebarItem,
    Group: SidebarNavigationGroup,
});

exports.Sidebar = Sidebar;
//# sourceMappingURL=sidebar.cjs.map
