"use client"; import React from "react"; import { FeatherCircleDashed } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; import { useSidebarHoverSweep } from "../../sidebar-hover-sweep"; export interface NavItemProps extends React.HTMLAttributes { icon?: React.ReactNode; children?: React.ReactNode; selected?: boolean; variant?: "icon-and-text" | "icon-only"; className?: string; } const NavItem = React.forwardRef(function NavItem( { icon = , children, selected = false, variant = "icon-and-text", className, ...otherProps }: NavItemProps, ref ) { return (
{/* @subframe/sync-disable -- local fix: no items-center flip on collapse; the icon column stays put. */}
{icon ? ( {icon} ) : null} {children ? ( {children} ) : null}
); }); export interface NavSectionProps extends React.HTMLAttributes { children?: React.ReactNode; label?: React.ReactNode; variant?: "default" | "subsection"; showLabel?: boolean; showDivider?: boolean; className?: string; } const NavSection = React.forwardRef(function NavSection( { children, label, variant = "default", showLabel = false, showDivider = false, className, ...otherProps }: NavSectionProps, ref ) { return (
{children ? (
{children}
) : null}
); }); export interface NavLabelProps extends React.HTMLAttributes { label?: React.ReactNode; className?: string; } const NavLabel = React.forwardRef(function NavLabel({ label, className, ...otherProps }: NavLabelProps, ref) { return (
{label ? {label} : null}
); }); export interface NavDividerProps extends React.HTMLAttributes { className?: string; } const NavDivider = React.forwardRef(function NavDivider({ className, ...otherProps }: NavDividerProps, ref) { return (
); }); export interface SidebarInsideRootProps extends React.HTMLAttributes { variant?: "open" | "closed"; footer?: React.ReactNode; children?: React.ReactNode; visible?: boolean; className?: string; } const SidebarInsideRoot = React.forwardRef(function SidebarInsideRoot( { variant = "open", footer, children, visible = false, className, onPointerMove, onPointerLeave, ...otherProps }: SidebarInsideRootProps, ref ) { const { handlePointerMove, handlePointerLeave } = useSidebarHoverSweep({ onPointerMove, onPointerLeave }); return ( ); }); export const SidebarInside = Object.assign(SidebarInsideRoot, { NavItem, NavSection, NavLabel, NavDivider, });