Skip to content

Commit

Permalink
fix lint and rename Tree file
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDanLu committed Mar 7, 2024
1 parent a29483f commit e1805c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/@react-spectrum/tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@react-aria/utils": "^3.23.2",
"@react-aria/virtualizer": "^3.1.0",
"@react-spectrum/checkbox": "^3.9.4",
"@react-spectrum/style-macro-s1": "^3.5.3",
"@react-spectrum/text": "^3.5.3",
"@react-spectrum/utils": "^3.1.0",
"@react-stately/collections": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@


import {AriaTreeGridListProps} from '@react-aria/tree';
import React, {createContext, isValidElement, ReactElement, ReactNode, useContext, useRef} from 'react';
import {ButtonContext, Collection, Tree, TreeItem, TreeItemContent, TreeItemContentRenderProps, TreeItemProps, TreeItemRenderProps, useContextProps} from 'react-aria-components';
import React, {createContext, isValidElement, ReactElement, ReactNode, useContext, useRef} from 'react';
import {Checkbox} from '@react-spectrum/checkbox';
import ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';
import ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';
import {isAndroid} from '@react-aria/utils';
import {DOMRef, Expandable, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
import {isAndroid} from '@react-aria/utils';
import {Text} from '@react-spectrum/text';
import {useButton} from '@react-aria/button';
import {useLocale} from '@react-aria/i18n';
import {SlotProvider, useDOMRef, useStyleProps} from '@react-spectrum/utils';
import {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};
import {useButton} from '@react-aria/button';
import {useLocale} from '@react-aria/i18n';


export interface SpectrumTreeViewProps<T> extends Omit<AriaTreeGridListProps<T>, 'children'>, StyleProps, SpectrumSelectionProps, Expandable {
/** Provides content to display when there are no items in the tree. */
renderEmptyState?: () => JSX.Element,
/**
/**
* Handler that is called when a user performs an action on an item. The exact user event depends on
* the collection's `selectionStyle` prop and the interaction modality.
*/
onAction?: (key: Key) => void,
/**
* The contents of the tree.
*/
children?: ReactNode | ((item: T) => ReactNode),
children?: ReactNode | ((item: T) => ReactNode)
}

export interface SpectrumTreeViewItemProps extends TreeItemProps {
Expand Down Expand Up @@ -152,7 +152,7 @@ const treeRowOutline = style({
isFocusVisible: '[-2px]',
isSelected: {
default: '[-1px]',
isFocusVisible: '[-2px]',
isFocusVisible: '[-2px]'
}
},
bottom: 0,
Expand All @@ -166,7 +166,7 @@ const treeRowOutline = style({
isFocusVisible: '[inset 2px 0 0 0 var(--spectrum-alias-focus-color), inset -2px 0 0 0 var(--spectrum-alias-focus-color), inset 0 -2px 0 0 var(--spectrum-alias-focus-color), inset 0 2px 0 0 var(--spectrum-alias-focus-color)]'
}
}
})
});

export const TreeViewItem = (props: SpectrumTreeViewItemProps) => {
let {
Expand Down Expand Up @@ -199,7 +199,7 @@ export const TreeViewItem = (props: SpectrumTreeViewItemProps) => {
<Collection items={childItems}>
{renderer}
</Collection>
)
);
}

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-spectrum/tree/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

/// <reference types="css-module-types" />

export {TreeViewItem, TreeView} from './Tree';
export type {SpectrumTreeViewProps, SpectrumTreeViewItemProps} from './Tree';
export {TreeViewItem, TreeView} from './TreeView';
export type {SpectrumTreeViewProps, SpectrumTreeViewItemProps} from './TreeView';

0 comments on commit e1805c4

Please sign in to comment.