@accelint/design-toolkit
Version:
An open-source component library to serve as part of the entire ecosystem of UX for Accelint.
42 lines (39 loc) • 1.8 kB
TypeScript
import { Key } from '@react-types/shared';
import { TreeProps as TreeProps$1, RenderProps, TreeItemContentRenderProps as TreeItemContentRenderProps$1, TreeItemProps as TreeItemProps$1 } from 'react-aria-components';
import { VariantProps } from 'tailwind-variants';
import { TreeNode, DragAndDropConfig } from '../../hooks/use-tree/types.js';
import { TreeStyles } from './styles.js';
import 'react';
type TreeProps<T> = Omit<TreeProps$1<TreeNode<T>>, 'defaultExpandedKeys' | 'defaultSelectedKeys' | 'disabledKeys' | 'expandedKeys' | 'selectedKeys' | 'onSelectionChange'> & VariantProps<typeof TreeStyles> & {
disabledKeys?: Set<Key>;
dragAndDropConfig?: DragAndDropConfig;
expandedKeys?: Set<Key>;
selectedKeys?: Set<Key>;
visibleKeys?: Set<Key>;
showRuleLines?: boolean;
showVisibility?: boolean;
onVisibilityChange?: (keys: Set<Key>) => void;
onSelectionChange?: (keys: Set<Key>) => void;
};
type TreeItemProps = Omit<TreeItemProps$1, 'id'> & {
id: Key;
};
type TreeItemContentProps = Pick<RenderProps<TreeItemContentRenderProps>, 'children'>;
type TreeItemContentRenderProps = TreeItemContentRenderProps$1 & VariantProps<typeof TreeStyles> & {
isViewable?: boolean;
isVisible?: boolean;
};
type TreeContextValue = Required<Pick<TreeProps<unknown>, 'showRuleLines' | 'showVisibility' | 'variant' | 'onVisibilityChange'>> & {
disabledKeys?: Set<Key>;
expandedKeys?: Set<Key>;
selectedKeys?: Set<Key>;
visibleKeys?: Set<Key>;
visibilityComputedKeys?: Set<Key>;
isStatic: boolean;
};
type TreeItemContextValue = {
isVisible?: boolean;
isViewable?: boolean;
ancestors: Key[];
};
export type { TreeContextValue, TreeItemContentProps, TreeItemContentRenderProps, TreeItemContextValue, TreeItemProps, TreeProps };