/* * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ import { DragAndDropConfig, TreeNode } from "../../hooks/use-tree/types.js"; import { TreeItemContentRenderProps as TreeItemContentRenderProps$1, TreeItemProps as TreeItemProps$1, TreeProps as TreeProps$1 } from "react-aria-components/Tree"; import { Key } from "@react-types/shared"; import { RenderProps } from "react-aria-components/useRenderProps"; //#region src/components/tree/types.d.ts /** Visual density variant for Tree components. */ type TreeStyleVariant = 'cozy' | 'compact' | 'crammed'; /** * Props for the Tree component. * * @template T - The type of custom values stored in tree nodes (accessed via `node.values`). */ type TreeProps = Omit>, 'defaultExpandedKeys' | 'defaultSelectedKeys' | 'disabledKeys' | 'expandedKeys' | 'selectedKeys' | 'onSelectionChange'> & { disabledKeys?: Set; dragAndDropConfig?: DragAndDropConfig; expandedKeys?: Set; selectedKeys?: Set; visibleKeys?: Set; showRuleLines?: boolean; showVisibility?: boolean; onVisibilityChange?: (keys: Set) => void; onSelectionChange?: (keys: Set) => void; variant?: TreeStyleVariant; }; /** * Props for the TreeItem component. */ type TreeItemProps = Omit & { /** Unique identifier for the tree item. */ id: Key; }; /** * Props for the TreeItemContent component. * * The `children` prop accepts either a ReactNode or a render function * receiving {@link TreeItemContentRenderProps} — use the render function form * to access `isVisible`, `isViewable`, and `variant` from context. */ type TreeItemContentProps = Pick, 'children'>; /** * Render props passed to TreeItemContent children. */ type TreeItemContentRenderProps = TreeItemContentRenderProps$1 & { /** Whether the item is viewable based on ancestor visibility. */ isViewable?: boolean; /** Whether the item is currently visible. */ isVisible?: boolean; /** Visual density variant. */ variant?: TreeStyleVariant; }; /** * Context value for the Tree component. */ type TreeContextValue = Required, 'showRuleLines' | 'showVisibility' | 'variant' | 'onVisibilityChange'>> & { /** Keys of items explicitly disabled. */ disabledKeys?: Set; /** Keys of items currently expanded. */ expandedKeys?: Set; /** Keys of items currently selected. */ selectedKeys?: Set; /** Keys of items whose own `isVisible` flag is true. */ visibleKeys?: Set; /** Keys of items that are visible after accounting for ancestor visibility. */ visibilityComputedKeys?: Set; /** Keys of items in an indeterminate selection state (cascade mode only). */ indeterminateKeys?: Set; /** Whether the tree uses a static (hard-coded) rather than dynamic (data-driven) collection. */ isStatic: boolean; }; /** * Context value for a TreeItem component. */ type TreeItemContextValue = { /** Whether the item is currently visible. */ isVisible?: boolean; /** Whether the item is viewable based on ancestor visibility. */ isViewable?: boolean; /** Array of ancestor item keys. */ ancestors: Key[]; }; //#endregion export { TreeContextValue, TreeItemContentProps, TreeItemContentRenderProps, TreeItemContextValue, TreeItemProps, TreeProps, TreeStyleVariant }; //# sourceMappingURL=types.d.ts.map