@particle-academy/react-fancy 1.7.4 → 1.8.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/README.md +1 -0
- package/dist/index.cjs +169 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.js +168 -69
- package/dist/index.js.map +1 -1
- package/docs/TreeNav.md +178 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2060,6 +2060,73 @@ declare const Diagram: typeof DiagramRoot & {
|
|
|
2060
2060
|
|
|
2061
2061
|
declare function useDiagram(): DiagramContextValue;
|
|
2062
2062
|
|
|
2063
|
+
interface TreeNodeData {
|
|
2064
|
+
/** Unique identifier */
|
|
2065
|
+
id: string;
|
|
2066
|
+
/** Display label */
|
|
2067
|
+
label: string;
|
|
2068
|
+
/** Node type for icon rendering */
|
|
2069
|
+
type?: "file" | "folder";
|
|
2070
|
+
/** File extension hint (e.g., "ts", "php", "html") for icon coloring */
|
|
2071
|
+
ext?: string;
|
|
2072
|
+
/** Nested children */
|
|
2073
|
+
children?: TreeNodeData[];
|
|
2074
|
+
/** Custom icon override */
|
|
2075
|
+
icon?: ReactNode;
|
|
2076
|
+
/** Whether the node is disabled */
|
|
2077
|
+
disabled?: boolean;
|
|
2078
|
+
}
|
|
2079
|
+
interface TreeNavProps {
|
|
2080
|
+
/** Tree data */
|
|
2081
|
+
nodes: TreeNodeData[];
|
|
2082
|
+
/** Currently selected node ID */
|
|
2083
|
+
selectedId?: string;
|
|
2084
|
+
/** Callback when a node is selected */
|
|
2085
|
+
onSelect?: (id: string, node: TreeNodeData) => void;
|
|
2086
|
+
/** Controlled expanded node IDs */
|
|
2087
|
+
expandedIds?: string[];
|
|
2088
|
+
/** Default expanded node IDs (uncontrolled) */
|
|
2089
|
+
defaultExpandedIds?: string[];
|
|
2090
|
+
/** Callback when expanded state changes */
|
|
2091
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
2092
|
+
/** Expand all folders by default */
|
|
2093
|
+
defaultExpandAll?: boolean;
|
|
2094
|
+
/** Indent size per nesting level in px (default: 16) */
|
|
2095
|
+
indentSize?: number;
|
|
2096
|
+
/** Show file/folder icons (default: true) */
|
|
2097
|
+
showIcons?: boolean;
|
|
2098
|
+
/** Custom className */
|
|
2099
|
+
className?: string;
|
|
2100
|
+
}
|
|
2101
|
+
interface TreeNavContextValue {
|
|
2102
|
+
selectedId?: string;
|
|
2103
|
+
onSelect?: (id: string, node: TreeNodeData) => void;
|
|
2104
|
+
expandedIds: string[];
|
|
2105
|
+
toggle: (id: string) => void;
|
|
2106
|
+
indentSize: number;
|
|
2107
|
+
showIcons: boolean;
|
|
2108
|
+
}
|
|
2109
|
+
interface TreeNodeProps {
|
|
2110
|
+
node: TreeNodeData;
|
|
2111
|
+
depth: number;
|
|
2112
|
+
className?: string;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
declare function TreeNode({ node, depth }: TreeNodeProps): react_jsx_runtime.JSX.Element;
|
|
2116
|
+
declare namespace TreeNode {
|
|
2117
|
+
var displayName: string;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
declare function TreeNavRoot({ nodes, selectedId, onSelect, expandedIds: controlledExpanded, defaultExpandedIds, onExpandedChange, defaultExpandAll, indentSize, showIcons, className, }: TreeNavProps): react_jsx_runtime.JSX.Element;
|
|
2121
|
+
declare namespace TreeNavRoot {
|
|
2122
|
+
var displayName: string;
|
|
2123
|
+
}
|
|
2124
|
+
declare const TreeNav: typeof TreeNavRoot & {
|
|
2125
|
+
Node: typeof TreeNode;
|
|
2126
|
+
};
|
|
2127
|
+
|
|
2128
|
+
declare function useTreeNav(): TreeNavContextValue;
|
|
2129
|
+
|
|
2063
2130
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2064
2131
|
|
|
2065
2132
|
declare function useControllableState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (value: T | ((prev: T) => T)) => void];
|
|
@@ -2126,4 +2193,4 @@ declare function find(char: string): {
|
|
|
2126
2193
|
category: string;
|
|
2127
2194
|
} | undefined;
|
|
2128
2195
|
|
|
2129
|
-
export { Accordion, type AccordionContentProps, type AccordionContextValue, type AccordionItemProps, type AccordionProps, type AccordionTriggerProps, Action, type ActionColor, type ActionProps, type AffixPosition, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, type AvatarProps, Badge, type BadgeProps, Brand, type BrandProps, Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, Calendar, type CalendarMode, type CalendarProps, Callout, type CalloutProps, Canvas, type CanvasContextValue, type CanvasControlsProps, type CanvasEdgeProps, type CanvasMinimapProps, type CanvasNodeProps, type CanvasProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, Carousel, type CarouselContextValue, type CarouselControlsProps, type CarouselPanelsProps, type CarouselProps, type CarouselSlideProps, type CarouselStepsProps, type CarouselVariant, Chart, type ChartAreaProps, type ChartBarData, type ChartBarProps, type ChartCommonProps, type ChartDonutData, type ChartDonutProps, type ChartHorizontalBarProps, type ChartLineProps, type ChartPieData, type ChartPieProps, type ChartSeries, type ChartSparklineProps, type ChartStackedBarProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type Color, ColorPicker, type ColorPickerProps, Command, type CommandContextValue, type CommandEmptyProps, type CommandGroupProps, type CommandInputProps, type CommandItemProps, type CommandListProps, type CommandProps, Composer, type ComposerProps, ContentRenderer, type ContentRendererProps, ContextMenu, type ContextMenuContentProps, type ContextMenuContextValue, type ContextMenuItemProps, type ContextMenuProps, type ContextMenuSeparatorProps, type ContextMenuTriggerProps, DatePicker, type DatePickerProps, type DateRange, Diagram, type DiagramContextValue, type DiagramEntityData, type DiagramEntityProps, type DiagramFieldData, type DiagramFieldProps, type DiagramProps, type DiagramRelationData, type DiagramRelationProps, type DiagramSchema, type DiagramToolbarProps, type DiagramType, Dropdown, type DropdownContextValue, type DropdownItemProps, type DropdownItemsProps, type DropdownProps, type DropdownSeparatorProps, type DropdownTriggerProps, EMOJI_DATA, EMOJI_ENTRIES, type EdgeAnchor, Editor, type EditorAction, type EditorContentProps, type EditorContextValue, type EditorProps, type EditorToolbarProps, Emoji, type EmojiProps, EmojiSelect, type EmojiSelectProps, type ExportFormat, Field, type FieldProps, FileUpload, type FileUploadContextValue, type FileUploadDropzoneProps, type FileUploadListProps, type FileUploadProps, Heading, type HeadingProps, Icon, type IconProps, type IconSet, Input, type InputAffixProps, type InputBaseProps, type InputOption, type InputOptionGroup, type InputProps, Kanban, type KanbanCardProps, type KanbanColumnProps, type KanbanContextValue, type KanbanProps, Menu, type MenuContextValue, type MenuGroupProps, type MenuItemProps, type MenuOrientation, type MenuProps, type MenuSubmenuProps, MobileMenu, type MobileMenuBottomBarProps, type MobileMenuContextValue, type MobileMenuFlyoutProps, type MobileMenuItemProps, type MobileMenuSide, type MobileMenuVariant, Modal, type ModalBodyProps, type ModalContextValue, type ModalFooterProps, type ModalHeaderProps, type ModalProps, MultiSwitch, type MultiSwitchProps, Navbar, type NavbarBrandProps, type NavbarContextValue, type NavbarItemProps, type NavbarItemsProps, type NavbarProps, type NavbarToggleProps, type NodeRect, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Pillbox, type PillboxProps, type Placement, Popover, type PopoverContentProps, type PopoverContextValue, type PopoverProps, type PopoverTriggerProps, Portal, type PortalProps, Profile, type ProfileProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RelationType, type RenderExtension, type RenderExtensionProps, Select, type SelectProps, Separator, type SeparatorProps, Sidebar, type SidebarCollapseMode, type SidebarContextValue, type SidebarGroupProps, type SidebarItemProps, type SidebarProps, type SidebarSubmenuProps, type SidebarToggleProps, type Size, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableHeadProps, type TablePaginationProps, type TableProps, type TableRowProps, type TableRowTrayProps, type TableSearchProps, type TableTrayProps, Tabs, type TabsContextValue, type TabsListProps, type TabsPanelProps, type TabsPanelsProps, type TabsProps, type TabsTabProps, type TabsVariant, Text, type TextProps, Textarea, type TextareaProps, TimePicker, type TimePickerProps, Timeline, type TimelineBlockProps, type TimelineEvent, type TimelineItemProps, type TimelineOrientation, type TimelineProps, type TimelineVariant, Toast, type ToastContextValue, type ToastData, type ToastPosition, type ToastProviderProps, type ToastVariant, Tooltip, type TooltipProps, type Variant, type ViewportState, cn, configureIcons, find, registerExtension, registerExtensions, registerIconSet, resolve, search, useAccordion, useAnimation, useCanvas, useCarousel, useCommand, useContextMenu, useControllableState, useDiagram, useDropdown, useEditor, useEscapeKey, useFileUpload, useFloatingPosition, useFocusTrap, useId, useKanban, useMenu, useMobileMenu, useModal, useNavbar, useNodeRegistry, useOutsideClick, usePanZoom, usePopover, useSidebar, useTabs, useToast };
|
|
2196
|
+
export { Accordion, type AccordionContentProps, type AccordionContextValue, type AccordionItemProps, type AccordionProps, type AccordionTriggerProps, Action, type ActionColor, type ActionProps, type AffixPosition, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, type AvatarProps, Badge, type BadgeProps, Brand, type BrandProps, Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, Calendar, type CalendarMode, type CalendarProps, Callout, type CalloutProps, Canvas, type CanvasContextValue, type CanvasControlsProps, type CanvasEdgeProps, type CanvasMinimapProps, type CanvasNodeProps, type CanvasProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, Carousel, type CarouselContextValue, type CarouselControlsProps, type CarouselPanelsProps, type CarouselProps, type CarouselSlideProps, type CarouselStepsProps, type CarouselVariant, Chart, type ChartAreaProps, type ChartBarData, type ChartBarProps, type ChartCommonProps, type ChartDonutData, type ChartDonutProps, type ChartHorizontalBarProps, type ChartLineProps, type ChartPieData, type ChartPieProps, type ChartSeries, type ChartSparklineProps, type ChartStackedBarProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type Color, ColorPicker, type ColorPickerProps, Command, type CommandContextValue, type CommandEmptyProps, type CommandGroupProps, type CommandInputProps, type CommandItemProps, type CommandListProps, type CommandProps, Composer, type ComposerProps, ContentRenderer, type ContentRendererProps, ContextMenu, type ContextMenuContentProps, type ContextMenuContextValue, type ContextMenuItemProps, type ContextMenuProps, type ContextMenuSeparatorProps, type ContextMenuTriggerProps, DatePicker, type DatePickerProps, type DateRange, Diagram, type DiagramContextValue, type DiagramEntityData, type DiagramEntityProps, type DiagramFieldData, type DiagramFieldProps, type DiagramProps, type DiagramRelationData, type DiagramRelationProps, type DiagramSchema, type DiagramToolbarProps, type DiagramType, Dropdown, type DropdownContextValue, type DropdownItemProps, type DropdownItemsProps, type DropdownProps, type DropdownSeparatorProps, type DropdownTriggerProps, EMOJI_DATA, EMOJI_ENTRIES, type EdgeAnchor, Editor, type EditorAction, type EditorContentProps, type EditorContextValue, type EditorProps, type EditorToolbarProps, Emoji, type EmojiProps, EmojiSelect, type EmojiSelectProps, type ExportFormat, Field, type FieldProps, FileUpload, type FileUploadContextValue, type FileUploadDropzoneProps, type FileUploadListProps, type FileUploadProps, Heading, type HeadingProps, Icon, type IconProps, type IconSet, Input, type InputAffixProps, type InputBaseProps, type InputOption, type InputOptionGroup, type InputProps, Kanban, type KanbanCardProps, type KanbanColumnProps, type KanbanContextValue, type KanbanProps, Menu, type MenuContextValue, type MenuGroupProps, type MenuItemProps, type MenuOrientation, type MenuProps, type MenuSubmenuProps, MobileMenu, type MobileMenuBottomBarProps, type MobileMenuContextValue, type MobileMenuFlyoutProps, type MobileMenuItemProps, type MobileMenuSide, type MobileMenuVariant, Modal, type ModalBodyProps, type ModalContextValue, type ModalFooterProps, type ModalHeaderProps, type ModalProps, MultiSwitch, type MultiSwitchProps, Navbar, type NavbarBrandProps, type NavbarContextValue, type NavbarItemProps, type NavbarItemsProps, type NavbarProps, type NavbarToggleProps, type NodeRect, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Pillbox, type PillboxProps, type Placement, Popover, type PopoverContentProps, type PopoverContextValue, type PopoverProps, type PopoverTriggerProps, Portal, type PortalProps, Profile, type ProfileProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RelationType, type RenderExtension, type RenderExtensionProps, Select, type SelectProps, Separator, type SeparatorProps, Sidebar, type SidebarCollapseMode, type SidebarContextValue, type SidebarGroupProps, type SidebarItemProps, type SidebarProps, type SidebarSubmenuProps, type SidebarToggleProps, type Size, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableHeadProps, type TablePaginationProps, type TableProps, type TableRowProps, type TableRowTrayProps, type TableSearchProps, type TableTrayProps, Tabs, type TabsContextValue, type TabsListProps, type TabsPanelProps, type TabsPanelsProps, type TabsProps, type TabsTabProps, type TabsVariant, Text, type TextProps, Textarea, type TextareaProps, TimePicker, type TimePickerProps, Timeline, type TimelineBlockProps, type TimelineEvent, type TimelineItemProps, type TimelineOrientation, type TimelineProps, type TimelineVariant, Toast, type ToastContextValue, type ToastData, type ToastPosition, type ToastProviderProps, type ToastVariant, Tooltip, type TooltipProps, TreeNav, type TreeNavContextValue, type TreeNavProps, type TreeNodeData, type TreeNodeProps, type Variant, type ViewportState, cn, configureIcons, find, registerExtension, registerExtensions, registerIconSet, resolve, search, useAccordion, useAnimation, useCanvas, useCarousel, useCommand, useContextMenu, useControllableState, useDiagram, useDropdown, useEditor, useEscapeKey, useFileUpload, useFloatingPosition, useFocusTrap, useId, useKanban, useMenu, useMobileMenu, useModal, useNavbar, useNodeRegistry, useOutsideClick, usePanZoom, usePopover, useSidebar, useTabs, useToast, useTreeNav };
|
package/dist/index.d.ts
CHANGED
|
@@ -2060,6 +2060,73 @@ declare const Diagram: typeof DiagramRoot & {
|
|
|
2060
2060
|
|
|
2061
2061
|
declare function useDiagram(): DiagramContextValue;
|
|
2062
2062
|
|
|
2063
|
+
interface TreeNodeData {
|
|
2064
|
+
/** Unique identifier */
|
|
2065
|
+
id: string;
|
|
2066
|
+
/** Display label */
|
|
2067
|
+
label: string;
|
|
2068
|
+
/** Node type for icon rendering */
|
|
2069
|
+
type?: "file" | "folder";
|
|
2070
|
+
/** File extension hint (e.g., "ts", "php", "html") for icon coloring */
|
|
2071
|
+
ext?: string;
|
|
2072
|
+
/** Nested children */
|
|
2073
|
+
children?: TreeNodeData[];
|
|
2074
|
+
/** Custom icon override */
|
|
2075
|
+
icon?: ReactNode;
|
|
2076
|
+
/** Whether the node is disabled */
|
|
2077
|
+
disabled?: boolean;
|
|
2078
|
+
}
|
|
2079
|
+
interface TreeNavProps {
|
|
2080
|
+
/** Tree data */
|
|
2081
|
+
nodes: TreeNodeData[];
|
|
2082
|
+
/** Currently selected node ID */
|
|
2083
|
+
selectedId?: string;
|
|
2084
|
+
/** Callback when a node is selected */
|
|
2085
|
+
onSelect?: (id: string, node: TreeNodeData) => void;
|
|
2086
|
+
/** Controlled expanded node IDs */
|
|
2087
|
+
expandedIds?: string[];
|
|
2088
|
+
/** Default expanded node IDs (uncontrolled) */
|
|
2089
|
+
defaultExpandedIds?: string[];
|
|
2090
|
+
/** Callback when expanded state changes */
|
|
2091
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
2092
|
+
/** Expand all folders by default */
|
|
2093
|
+
defaultExpandAll?: boolean;
|
|
2094
|
+
/** Indent size per nesting level in px (default: 16) */
|
|
2095
|
+
indentSize?: number;
|
|
2096
|
+
/** Show file/folder icons (default: true) */
|
|
2097
|
+
showIcons?: boolean;
|
|
2098
|
+
/** Custom className */
|
|
2099
|
+
className?: string;
|
|
2100
|
+
}
|
|
2101
|
+
interface TreeNavContextValue {
|
|
2102
|
+
selectedId?: string;
|
|
2103
|
+
onSelect?: (id: string, node: TreeNodeData) => void;
|
|
2104
|
+
expandedIds: string[];
|
|
2105
|
+
toggle: (id: string) => void;
|
|
2106
|
+
indentSize: number;
|
|
2107
|
+
showIcons: boolean;
|
|
2108
|
+
}
|
|
2109
|
+
interface TreeNodeProps {
|
|
2110
|
+
node: TreeNodeData;
|
|
2111
|
+
depth: number;
|
|
2112
|
+
className?: string;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
declare function TreeNode({ node, depth }: TreeNodeProps): react_jsx_runtime.JSX.Element;
|
|
2116
|
+
declare namespace TreeNode {
|
|
2117
|
+
var displayName: string;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
declare function TreeNavRoot({ nodes, selectedId, onSelect, expandedIds: controlledExpanded, defaultExpandedIds, onExpandedChange, defaultExpandAll, indentSize, showIcons, className, }: TreeNavProps): react_jsx_runtime.JSX.Element;
|
|
2121
|
+
declare namespace TreeNavRoot {
|
|
2122
|
+
var displayName: string;
|
|
2123
|
+
}
|
|
2124
|
+
declare const TreeNav: typeof TreeNavRoot & {
|
|
2125
|
+
Node: typeof TreeNode;
|
|
2126
|
+
};
|
|
2127
|
+
|
|
2128
|
+
declare function useTreeNav(): TreeNavContextValue;
|
|
2129
|
+
|
|
2063
2130
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2064
2131
|
|
|
2065
2132
|
declare function useControllableState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (value: T | ((prev: T) => T)) => void];
|
|
@@ -2126,4 +2193,4 @@ declare function find(char: string): {
|
|
|
2126
2193
|
category: string;
|
|
2127
2194
|
} | undefined;
|
|
2128
2195
|
|
|
2129
|
-
export { Accordion, type AccordionContentProps, type AccordionContextValue, type AccordionItemProps, type AccordionProps, type AccordionTriggerProps, Action, type ActionColor, type ActionProps, type AffixPosition, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, type AvatarProps, Badge, type BadgeProps, Brand, type BrandProps, Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, Calendar, type CalendarMode, type CalendarProps, Callout, type CalloutProps, Canvas, type CanvasContextValue, type CanvasControlsProps, type CanvasEdgeProps, type CanvasMinimapProps, type CanvasNodeProps, type CanvasProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, Carousel, type CarouselContextValue, type CarouselControlsProps, type CarouselPanelsProps, type CarouselProps, type CarouselSlideProps, type CarouselStepsProps, type CarouselVariant, Chart, type ChartAreaProps, type ChartBarData, type ChartBarProps, type ChartCommonProps, type ChartDonutData, type ChartDonutProps, type ChartHorizontalBarProps, type ChartLineProps, type ChartPieData, type ChartPieProps, type ChartSeries, type ChartSparklineProps, type ChartStackedBarProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type Color, ColorPicker, type ColorPickerProps, Command, type CommandContextValue, type CommandEmptyProps, type CommandGroupProps, type CommandInputProps, type CommandItemProps, type CommandListProps, type CommandProps, Composer, type ComposerProps, ContentRenderer, type ContentRendererProps, ContextMenu, type ContextMenuContentProps, type ContextMenuContextValue, type ContextMenuItemProps, type ContextMenuProps, type ContextMenuSeparatorProps, type ContextMenuTriggerProps, DatePicker, type DatePickerProps, type DateRange, Diagram, type DiagramContextValue, type DiagramEntityData, type DiagramEntityProps, type DiagramFieldData, type DiagramFieldProps, type DiagramProps, type DiagramRelationData, type DiagramRelationProps, type DiagramSchema, type DiagramToolbarProps, type DiagramType, Dropdown, type DropdownContextValue, type DropdownItemProps, type DropdownItemsProps, type DropdownProps, type DropdownSeparatorProps, type DropdownTriggerProps, EMOJI_DATA, EMOJI_ENTRIES, type EdgeAnchor, Editor, type EditorAction, type EditorContentProps, type EditorContextValue, type EditorProps, type EditorToolbarProps, Emoji, type EmojiProps, EmojiSelect, type EmojiSelectProps, type ExportFormat, Field, type FieldProps, FileUpload, type FileUploadContextValue, type FileUploadDropzoneProps, type FileUploadListProps, type FileUploadProps, Heading, type HeadingProps, Icon, type IconProps, type IconSet, Input, type InputAffixProps, type InputBaseProps, type InputOption, type InputOptionGroup, type InputProps, Kanban, type KanbanCardProps, type KanbanColumnProps, type KanbanContextValue, type KanbanProps, Menu, type MenuContextValue, type MenuGroupProps, type MenuItemProps, type MenuOrientation, type MenuProps, type MenuSubmenuProps, MobileMenu, type MobileMenuBottomBarProps, type MobileMenuContextValue, type MobileMenuFlyoutProps, type MobileMenuItemProps, type MobileMenuSide, type MobileMenuVariant, Modal, type ModalBodyProps, type ModalContextValue, type ModalFooterProps, type ModalHeaderProps, type ModalProps, MultiSwitch, type MultiSwitchProps, Navbar, type NavbarBrandProps, type NavbarContextValue, type NavbarItemProps, type NavbarItemsProps, type NavbarProps, type NavbarToggleProps, type NodeRect, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Pillbox, type PillboxProps, type Placement, Popover, type PopoverContentProps, type PopoverContextValue, type PopoverProps, type PopoverTriggerProps, Portal, type PortalProps, Profile, type ProfileProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RelationType, type RenderExtension, type RenderExtensionProps, Select, type SelectProps, Separator, type SeparatorProps, Sidebar, type SidebarCollapseMode, type SidebarContextValue, type SidebarGroupProps, type SidebarItemProps, type SidebarProps, type SidebarSubmenuProps, type SidebarToggleProps, type Size, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableHeadProps, type TablePaginationProps, type TableProps, type TableRowProps, type TableRowTrayProps, type TableSearchProps, type TableTrayProps, Tabs, type TabsContextValue, type TabsListProps, type TabsPanelProps, type TabsPanelsProps, type TabsProps, type TabsTabProps, type TabsVariant, Text, type TextProps, Textarea, type TextareaProps, TimePicker, type TimePickerProps, Timeline, type TimelineBlockProps, type TimelineEvent, type TimelineItemProps, type TimelineOrientation, type TimelineProps, type TimelineVariant, Toast, type ToastContextValue, type ToastData, type ToastPosition, type ToastProviderProps, type ToastVariant, Tooltip, type TooltipProps, type Variant, type ViewportState, cn, configureIcons, find, registerExtension, registerExtensions, registerIconSet, resolve, search, useAccordion, useAnimation, useCanvas, useCarousel, useCommand, useContextMenu, useControllableState, useDiagram, useDropdown, useEditor, useEscapeKey, useFileUpload, useFloatingPosition, useFocusTrap, useId, useKanban, useMenu, useMobileMenu, useModal, useNavbar, useNodeRegistry, useOutsideClick, usePanZoom, usePopover, useSidebar, useTabs, useToast };
|
|
2196
|
+
export { Accordion, type AccordionContentProps, type AccordionContextValue, type AccordionItemProps, type AccordionProps, type AccordionTriggerProps, Action, type ActionColor, type ActionProps, type AffixPosition, Autocomplete, type AutocompleteOption, type AutocompleteProps, Avatar, type AvatarProps, Badge, type BadgeProps, Brand, type BrandProps, Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, Calendar, type CalendarMode, type CalendarProps, Callout, type CalloutProps, Canvas, type CanvasContextValue, type CanvasControlsProps, type CanvasEdgeProps, type CanvasMinimapProps, type CanvasNodeProps, type CanvasProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, Carousel, type CarouselContextValue, type CarouselControlsProps, type CarouselPanelsProps, type CarouselProps, type CarouselSlideProps, type CarouselStepsProps, type CarouselVariant, Chart, type ChartAreaProps, type ChartBarData, type ChartBarProps, type ChartCommonProps, type ChartDonutData, type ChartDonutProps, type ChartHorizontalBarProps, type ChartLineProps, type ChartPieData, type ChartPieProps, type ChartSeries, type ChartSparklineProps, type ChartStackedBarProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type Color, ColorPicker, type ColorPickerProps, Command, type CommandContextValue, type CommandEmptyProps, type CommandGroupProps, type CommandInputProps, type CommandItemProps, type CommandListProps, type CommandProps, Composer, type ComposerProps, ContentRenderer, type ContentRendererProps, ContextMenu, type ContextMenuContentProps, type ContextMenuContextValue, type ContextMenuItemProps, type ContextMenuProps, type ContextMenuSeparatorProps, type ContextMenuTriggerProps, DatePicker, type DatePickerProps, type DateRange, Diagram, type DiagramContextValue, type DiagramEntityData, type DiagramEntityProps, type DiagramFieldData, type DiagramFieldProps, type DiagramProps, type DiagramRelationData, type DiagramRelationProps, type DiagramSchema, type DiagramToolbarProps, type DiagramType, Dropdown, type DropdownContextValue, type DropdownItemProps, type DropdownItemsProps, type DropdownProps, type DropdownSeparatorProps, type DropdownTriggerProps, EMOJI_DATA, EMOJI_ENTRIES, type EdgeAnchor, Editor, type EditorAction, type EditorContentProps, type EditorContextValue, type EditorProps, type EditorToolbarProps, Emoji, type EmojiProps, EmojiSelect, type EmojiSelectProps, type ExportFormat, Field, type FieldProps, FileUpload, type FileUploadContextValue, type FileUploadDropzoneProps, type FileUploadListProps, type FileUploadProps, Heading, type HeadingProps, Icon, type IconProps, type IconSet, Input, type InputAffixProps, type InputBaseProps, type InputOption, type InputOptionGroup, type InputProps, Kanban, type KanbanCardProps, type KanbanColumnProps, type KanbanContextValue, type KanbanProps, Menu, type MenuContextValue, type MenuGroupProps, type MenuItemProps, type MenuOrientation, type MenuProps, type MenuSubmenuProps, MobileMenu, type MobileMenuBottomBarProps, type MobileMenuContextValue, type MobileMenuFlyoutProps, type MobileMenuItemProps, type MobileMenuSide, type MobileMenuVariant, Modal, type ModalBodyProps, type ModalContextValue, type ModalFooterProps, type ModalHeaderProps, type ModalProps, MultiSwitch, type MultiSwitchProps, Navbar, type NavbarBrandProps, type NavbarContextValue, type NavbarItemProps, type NavbarItemsProps, type NavbarProps, type NavbarToggleProps, type NodeRect, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Pillbox, type PillboxProps, type Placement, Popover, type PopoverContentProps, type PopoverContextValue, type PopoverProps, type PopoverTriggerProps, Portal, type PortalProps, Profile, type ProfileProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RelationType, type RenderExtension, type RenderExtensionProps, Select, type SelectProps, Separator, type SeparatorProps, Sidebar, type SidebarCollapseMode, type SidebarContextValue, type SidebarGroupProps, type SidebarItemProps, type SidebarProps, type SidebarSubmenuProps, type SidebarToggleProps, type Size, Skeleton, type SkeletonProps, Slider, type SliderProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableHeadProps, type TablePaginationProps, type TableProps, type TableRowProps, type TableRowTrayProps, type TableSearchProps, type TableTrayProps, Tabs, type TabsContextValue, type TabsListProps, type TabsPanelProps, type TabsPanelsProps, type TabsProps, type TabsTabProps, type TabsVariant, Text, type TextProps, Textarea, type TextareaProps, TimePicker, type TimePickerProps, Timeline, type TimelineBlockProps, type TimelineEvent, type TimelineItemProps, type TimelineOrientation, type TimelineProps, type TimelineVariant, Toast, type ToastContextValue, type ToastData, type ToastPosition, type ToastProviderProps, type ToastVariant, Tooltip, type TooltipProps, TreeNav, type TreeNavContextValue, type TreeNavProps, type TreeNodeData, type TreeNodeProps, type Variant, type ViewportState, cn, configureIcons, find, registerExtension, registerExtensions, registerIconSet, resolve, search, useAccordion, useAnimation, useCanvas, useCarousel, useCommand, useContextMenu, useControllableState, useDiagram, useDropdown, useEditor, useEscapeKey, useFileUpload, useFloatingPosition, useFocusTrap, useId, useKanban, useMenu, useMobileMenu, useModal, useNavbar, useNodeRegistry, useOutsideClick, usePanZoom, usePopover, useSidebar, useTabs, useToast, useTreeNav };
|
package/dist/index.js
CHANGED
|
@@ -9718,7 +9718,7 @@ function DiagramEntity({
|
|
|
9718
9718
|
}
|
|
9719
9719
|
DiagramEntity.displayName = "DiagramEntity";
|
|
9720
9720
|
var HEADER_HEIGHT = 36;
|
|
9721
|
-
var FIELD_HEIGHT =
|
|
9721
|
+
var FIELD_HEIGHT = 29;
|
|
9722
9722
|
var SYMBOL_SIZE = 12;
|
|
9723
9723
|
function oneSymbol(pt, direction) {
|
|
9724
9724
|
const s = SYMBOL_SIZE * 0.6;
|
|
@@ -9815,82 +9815,32 @@ function DiagramRelation({
|
|
|
9815
9815
|
const toFieldY = toFieldIdx >= 0 ? HEADER_HEIGHT + toFieldIdx * FIELD_HEIGHT + FIELD_HEIGHT / 2 : toRect.height / 2;
|
|
9816
9816
|
const fromCx = fromRect.x + fromRect.width / 2;
|
|
9817
9817
|
const toCx = toRect.x + toRect.width / 2;
|
|
9818
|
-
const fromCy = fromRect.y + fromRect.height / 2;
|
|
9819
|
-
const toCy = toRect.y + toRect.height / 2;
|
|
9820
|
-
const dx = Math.abs(fromCx - toCx);
|
|
9821
|
-
const dy = Math.abs(fromCy - toCy);
|
|
9822
9818
|
let fromPt, toPt;
|
|
9823
9819
|
let fromDir;
|
|
9824
9820
|
let toDir;
|
|
9825
|
-
if (
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
toDir = "left";
|
|
9831
|
-
} else {
|
|
9832
|
-
fromPt = { x: fromRect.x, y: fromRect.y + fromFieldY };
|
|
9833
|
-
toPt = { x: toRect.x + toRect.width, y: toRect.y + toFieldY };
|
|
9834
|
-
fromDir = "left";
|
|
9835
|
-
toDir = "right";
|
|
9836
|
-
}
|
|
9821
|
+
if (fromCx <= toCx) {
|
|
9822
|
+
fromPt = { x: fromRect.x + fromRect.width, y: fromRect.y + fromFieldY };
|
|
9823
|
+
toPt = { x: toRect.x, y: toRect.y + toFieldY };
|
|
9824
|
+
fromDir = "right";
|
|
9825
|
+
toDir = "left";
|
|
9837
9826
|
} else {
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
toDir = "up";
|
|
9843
|
-
} else {
|
|
9844
|
-
fromPt = { x: fromRect.x + fromRect.width / 2, y: fromRect.y };
|
|
9845
|
-
toPt = { x: toRect.x + toRect.width / 2, y: toRect.y + toRect.height };
|
|
9846
|
-
fromDir = "up";
|
|
9847
|
-
toDir = "down";
|
|
9848
|
-
}
|
|
9827
|
+
fromPt = { x: fromRect.x, y: fromRect.y + fromFieldY };
|
|
9828
|
+
toPt = { x: toRect.x + toRect.width, y: toRect.y + toFieldY };
|
|
9829
|
+
fromDir = "left";
|
|
9830
|
+
toDir = "right";
|
|
9849
9831
|
}
|
|
9850
9832
|
const offsetFrom = { ...fromPt };
|
|
9851
9833
|
const offsetTo = { ...toPt };
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
case "left":
|
|
9857
|
-
offsetFrom.x -= SYMBOL_SIZE;
|
|
9858
|
-
break;
|
|
9859
|
-
case "down":
|
|
9860
|
-
offsetFrom.y += SYMBOL_SIZE;
|
|
9861
|
-
break;
|
|
9862
|
-
case "up":
|
|
9863
|
-
offsetFrom.y -= SYMBOL_SIZE;
|
|
9864
|
-
break;
|
|
9865
|
-
}
|
|
9866
|
-
switch (toDir) {
|
|
9867
|
-
case "right":
|
|
9868
|
-
offsetTo.x += SYMBOL_SIZE;
|
|
9869
|
-
break;
|
|
9870
|
-
case "left":
|
|
9871
|
-
offsetTo.x -= SYMBOL_SIZE;
|
|
9872
|
-
break;
|
|
9873
|
-
case "down":
|
|
9874
|
-
offsetTo.y += SYMBOL_SIZE;
|
|
9875
|
-
break;
|
|
9876
|
-
case "up":
|
|
9877
|
-
offsetTo.y -= SYMBOL_SIZE;
|
|
9878
|
-
break;
|
|
9879
|
-
}
|
|
9834
|
+
if (fromDir === "right") offsetFrom.x += SYMBOL_SIZE;
|
|
9835
|
+
else offsetFrom.x -= SYMBOL_SIZE;
|
|
9836
|
+
if (toDir === "left") offsetTo.x -= SYMBOL_SIZE;
|
|
9837
|
+
else offsetTo.x += SYMBOL_SIZE;
|
|
9880
9838
|
const adx = Math.abs(offsetTo.x - offsetFrom.x);
|
|
9881
9839
|
const ady = Math.abs(offsetTo.y - offsetFrom.y);
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
const cp2x = offsetTo.x + (offsetTo.x > offsetFrom.x ? -off : off);
|
|
9887
|
-
linePath = `M${offsetFrom.x},${offsetFrom.y} C${cp1x},${offsetFrom.y} ${cp2x},${offsetTo.y} ${offsetTo.x},${offsetTo.y}`;
|
|
9888
|
-
} else {
|
|
9889
|
-
const off = Math.max(ady * 0.4, 20);
|
|
9890
|
-
const cp1y = offsetFrom.y + (offsetTo.y > offsetFrom.y ? off : -off);
|
|
9891
|
-
const cp2y = offsetTo.y + (offsetTo.y > offsetFrom.y ? -off : off);
|
|
9892
|
-
linePath = `M${offsetFrom.x},${offsetFrom.y} C${offsetFrom.x},${cp1y} ${offsetTo.x},${cp2y} ${offsetTo.x},${offsetTo.y}`;
|
|
9893
|
-
}
|
|
9840
|
+
const off = Math.max(adx * 0.4, ady * 0.25, 40);
|
|
9841
|
+
const cp1x = offsetFrom.x + (fromDir === "right" ? off : -off);
|
|
9842
|
+
const cp2x = offsetTo.x + (toDir === "left" ? -off : off);
|
|
9843
|
+
const linePath = `M${offsetFrom.x},${offsetFrom.y} C${cp1x},${offsetFrom.y} ${cp2x},${offsetTo.y} ${offsetTo.x},${offsetTo.y}`;
|
|
9894
9844
|
const startSymbol = getSymbolPath(type, "start", fromPt, fromDir);
|
|
9895
9845
|
const endSymbol = getSymbolPath(type, "end", toPt, toDir);
|
|
9896
9846
|
return { linePath, startSymbol, endSymbol, midX: (offsetFrom.x + offsetTo.x) / 2, midY: (offsetFrom.y + offsetTo.y) / 2 };
|
|
@@ -10243,7 +10193,156 @@ var Diagram = Object.assign(DiagramRoot, {
|
|
|
10243
10193
|
Relation: DiagramRelation,
|
|
10244
10194
|
Toolbar: DiagramToolbar
|
|
10245
10195
|
});
|
|
10196
|
+
var TreeNavContext = createContext(null);
|
|
10197
|
+
function useTreeNav() {
|
|
10198
|
+
const ctx = useContext(TreeNavContext);
|
|
10199
|
+
if (!ctx) {
|
|
10200
|
+
throw new Error("useTreeNav must be used within a <TreeNav> component");
|
|
10201
|
+
}
|
|
10202
|
+
return ctx;
|
|
10203
|
+
}
|
|
10204
|
+
var EXT_COLORS = {
|
|
10205
|
+
ts: "#3178c6",
|
|
10206
|
+
tsx: "#3178c6",
|
|
10207
|
+
js: "#f7df1e",
|
|
10208
|
+
jsx: "#f7df1e",
|
|
10209
|
+
php: "#777bb4",
|
|
10210
|
+
html: "#e34c26",
|
|
10211
|
+
htm: "#e34c26",
|
|
10212
|
+
css: "#264de4",
|
|
10213
|
+
json: "#a1a1aa",
|
|
10214
|
+
md: "#71717a",
|
|
10215
|
+
yaml: "#cb171e",
|
|
10216
|
+
yml: "#cb171e"
|
|
10217
|
+
};
|
|
10218
|
+
function FileIcon({ ext }) {
|
|
10219
|
+
const color = ext && EXT_COLORS[ext.toLowerCase()] || "#71717a";
|
|
10220
|
+
return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: [
|
|
10221
|
+
/* @__PURE__ */ jsx("path", { d: "M4 1h5.5L13 4.5V14a1 1 0 01-1 1H4a1 1 0 01-1-1V2a1 1 0 011-1z", stroke: color, strokeWidth: "1.2" }),
|
|
10222
|
+
/* @__PURE__ */ jsx("path", { d: "M9 1v4h4", stroke: color, strokeWidth: "1.2" })
|
|
10223
|
+
] });
|
|
10224
|
+
}
|
|
10225
|
+
function FolderIcon({ open }) {
|
|
10226
|
+
if (open) {
|
|
10227
|
+
return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: [
|
|
10228
|
+
/* @__PURE__ */ jsx("path", { d: "M1.5 3.5a1 1 0 011-1h3l1.5 1.5H13a1 1 0 011 1V5H2.5V3.5z", fill: "#fbbf24" }),
|
|
10229
|
+
/* @__PURE__ */ jsx("path", { d: "M1 6h13l-1.5 7.5H2.5L1 6z", fill: "#fbbf24", opacity: "0.7" })
|
|
10230
|
+
] });
|
|
10231
|
+
}
|
|
10232
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: /* @__PURE__ */ jsx("path", { d: "M1.5 3a1 1 0 011-1h3l1.5 1.5H13a1 1 0 011 1v8a1 1 0 01-1 1H2.5a1 1 0 01-1-1V3z", fill: "#fbbf24" }) });
|
|
10233
|
+
}
|
|
10234
|
+
function ChevronIcon({ open }) {
|
|
10235
|
+
return /* @__PURE__ */ jsx(
|
|
10236
|
+
"svg",
|
|
10237
|
+
{
|
|
10238
|
+
width: "14",
|
|
10239
|
+
height: "14",
|
|
10240
|
+
viewBox: "0 0 24 24",
|
|
10241
|
+
fill: "none",
|
|
10242
|
+
stroke: "currentColor",
|
|
10243
|
+
strokeWidth: "2",
|
|
10244
|
+
strokeLinecap: "round",
|
|
10245
|
+
strokeLinejoin: "round",
|
|
10246
|
+
className: cn("shrink-0 transition-transform duration-150", open && "rotate-90"),
|
|
10247
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" })
|
|
10248
|
+
}
|
|
10249
|
+
);
|
|
10250
|
+
}
|
|
10251
|
+
function TreeNode({ node, depth }) {
|
|
10252
|
+
const { selectedId, onSelect, expandedIds, toggle, indentSize, showIcons } = useTreeNav();
|
|
10253
|
+
const isFolder = node.type === "folder" || node.children && node.children.length > 0;
|
|
10254
|
+
const isExpanded = expandedIds.includes(node.id);
|
|
10255
|
+
const isSelected = selectedId === node.id;
|
|
10256
|
+
const paddingLeft = depth * indentSize + 4;
|
|
10257
|
+
const handleClick = () => {
|
|
10258
|
+
if (node.disabled) return;
|
|
10259
|
+
if (isFolder) {
|
|
10260
|
+
toggle(node.id);
|
|
10261
|
+
}
|
|
10262
|
+
onSelect?.(node.id, node);
|
|
10263
|
+
};
|
|
10264
|
+
return /* @__PURE__ */ jsxs("div", { "data-react-fancy-tree-node": "", children: [
|
|
10265
|
+
/* @__PURE__ */ jsxs(
|
|
10266
|
+
"button",
|
|
10267
|
+
{
|
|
10268
|
+
type: "button",
|
|
10269
|
+
onClick: handleClick,
|
|
10270
|
+
disabled: node.disabled,
|
|
10271
|
+
className: cn(
|
|
10272
|
+
"flex w-full items-center gap-1 rounded-md py-0.5 text-left text-[13px] transition-colors",
|
|
10273
|
+
isSelected ? "bg-blue-500/15 text-blue-600 dark:text-blue-400" : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800",
|
|
10274
|
+
node.disabled && "pointer-events-none opacity-40"
|
|
10275
|
+
),
|
|
10276
|
+
style: { paddingLeft },
|
|
10277
|
+
children: [
|
|
10278
|
+
isFolder && /* @__PURE__ */ jsx(ChevronIcon, { open: isExpanded }),
|
|
10279
|
+
!isFolder && /* @__PURE__ */ jsx("span", { className: "w-3.5 shrink-0" }),
|
|
10280
|
+
showIcons && (node.icon ?? (isFolder ? /* @__PURE__ */ jsx(FolderIcon, { open: isExpanded }) : /* @__PURE__ */ jsx(FileIcon, { ext: node.ext ?? node.label.split(".").pop() }))),
|
|
10281
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: node.label })
|
|
10282
|
+
]
|
|
10283
|
+
}
|
|
10284
|
+
),
|
|
10285
|
+
isFolder && isExpanded && node.children && /* @__PURE__ */ jsx("div", { "data-react-fancy-tree-node-children": "", children: node.children.map((child) => /* @__PURE__ */ jsx(TreeNode, { node: child, depth: depth + 1 }, child.id)) })
|
|
10286
|
+
] });
|
|
10287
|
+
}
|
|
10288
|
+
TreeNode.displayName = "TreeNode";
|
|
10289
|
+
function collectFolderIds(nodes) {
|
|
10290
|
+
const ids = [];
|
|
10291
|
+
for (const node of nodes) {
|
|
10292
|
+
if (node.children && node.children.length > 0) {
|
|
10293
|
+
ids.push(node.id);
|
|
10294
|
+
ids.push(...collectFolderIds(node.children));
|
|
10295
|
+
}
|
|
10296
|
+
}
|
|
10297
|
+
return ids;
|
|
10298
|
+
}
|
|
10299
|
+
function TreeNavRoot({
|
|
10300
|
+
nodes,
|
|
10301
|
+
selectedId,
|
|
10302
|
+
onSelect,
|
|
10303
|
+
expandedIds: controlledExpanded,
|
|
10304
|
+
defaultExpandedIds,
|
|
10305
|
+
onExpandedChange,
|
|
10306
|
+
defaultExpandAll = false,
|
|
10307
|
+
indentSize = 16,
|
|
10308
|
+
showIcons = true,
|
|
10309
|
+
className
|
|
10310
|
+
}) {
|
|
10311
|
+
const [internalExpanded, setInternalExpanded] = useState(() => {
|
|
10312
|
+
if (defaultExpandedIds) return defaultExpandedIds;
|
|
10313
|
+
if (defaultExpandAll) return collectFolderIds(nodes);
|
|
10314
|
+
return [];
|
|
10315
|
+
});
|
|
10316
|
+
const isControlled = controlledExpanded !== void 0;
|
|
10317
|
+
const expandedIds = isControlled ? controlledExpanded : internalExpanded;
|
|
10318
|
+
const toggle = useCallback(
|
|
10319
|
+
(id) => {
|
|
10320
|
+
const next = expandedIds.includes(id) ? expandedIds.filter((v) => v !== id) : [...expandedIds, id];
|
|
10321
|
+
if (!isControlled) {
|
|
10322
|
+
setInternalExpanded(next);
|
|
10323
|
+
}
|
|
10324
|
+
onExpandedChange?.(next);
|
|
10325
|
+
},
|
|
10326
|
+
[expandedIds, isControlled, onExpandedChange]
|
|
10327
|
+
);
|
|
10328
|
+
const ctx = useMemo(
|
|
10329
|
+
() => ({ selectedId, onSelect, expandedIds, toggle, indentSize, showIcons }),
|
|
10330
|
+
[selectedId, onSelect, expandedIds, toggle, indentSize, showIcons]
|
|
10331
|
+
);
|
|
10332
|
+
return /* @__PURE__ */ jsx(TreeNavContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
10333
|
+
"nav",
|
|
10334
|
+
{
|
|
10335
|
+
"data-react-fancy-tree-nav": "",
|
|
10336
|
+
className: cn("flex flex-col gap-0.5 py-1 text-sm", className),
|
|
10337
|
+
children: nodes.map((node) => /* @__PURE__ */ jsx(TreeNode, { node, depth: 0 }, node.id))
|
|
10338
|
+
}
|
|
10339
|
+
) });
|
|
10340
|
+
}
|
|
10341
|
+
TreeNavRoot.displayName = "TreeNav";
|
|
10342
|
+
var TreeNav = Object.assign(TreeNavRoot, {
|
|
10343
|
+
Node: TreeNode
|
|
10344
|
+
});
|
|
10246
10345
|
|
|
10247
|
-
export { Accordion, Action, Autocomplete, Avatar, Badge, Brand, Breadcrumbs, Calendar, Callout, Canvas, Card, Carousel, Chart, Checkbox, CheckboxGroup, ColorPicker, Command, Composer, ContentRenderer, ContextMenu, DatePicker, Diagram, Dropdown, EMOJI_DATA, EMOJI_ENTRIES, Editor, Emoji, EmojiSelect, Field, FileUpload, Heading, Icon, Input, Kanban, Menu2 as Menu, MobileMenu, Modal, MultiSwitch, Navbar, OtpInput, Pagination, Pillbox, Popover, Portal, Profile, Progress, RadioGroup, Select, Separator, Sidebar, Skeleton, Slider, Switch, Table, Tabs, Text, Textarea, TimePicker, Timeline, Toast, Tooltip, cn, configureIcons, find, registerExtension, registerExtensions, registerIconSet, resolve, search, useAccordion, useAnimation, useCanvas, useCarousel, useCommand, useContextMenu, useControllableState, useDiagram, useDropdown, useEditor, useEscapeKey, useFileUpload, useFloatingPosition, useFocusTrap, useId11 as useId, useKanban, useMenu, useMobileMenu, useModal, useNavbar, useNodeRegistry, useOutsideClick, usePanZoom, usePopover, useSidebar, useTabs, useToast };
|
|
10346
|
+
export { Accordion, Action, Autocomplete, Avatar, Badge, Brand, Breadcrumbs, Calendar, Callout, Canvas, Card, Carousel, Chart, Checkbox, CheckboxGroup, ColorPicker, Command, Composer, ContentRenderer, ContextMenu, DatePicker, Diagram, Dropdown, EMOJI_DATA, EMOJI_ENTRIES, Editor, Emoji, EmojiSelect, Field, FileUpload, Heading, Icon, Input, Kanban, Menu2 as Menu, MobileMenu, Modal, MultiSwitch, Navbar, OtpInput, Pagination, Pillbox, Popover, Portal, Profile, Progress, RadioGroup, Select, Separator, Sidebar, Skeleton, Slider, Switch, Table, Tabs, Text, Textarea, TimePicker, Timeline, Toast, Tooltip, TreeNav, cn, configureIcons, find, registerExtension, registerExtensions, registerIconSet, resolve, search, useAccordion, useAnimation, useCanvas, useCarousel, useCommand, useContextMenu, useControllableState, useDiagram, useDropdown, useEditor, useEscapeKey, useFileUpload, useFloatingPosition, useFocusTrap, useId11 as useId, useKanban, useMenu, useMobileMenu, useModal, useNavbar, useNodeRegistry, useOutsideClick, usePanZoom, usePopover, useSidebar, useTabs, useToast, useTreeNav };
|
|
10248
10347
|
//# sourceMappingURL=index.js.map
|
|
10249
10348
|
//# sourceMappingURL=index.js.map
|