-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: RAC Tree docs #7730
docs: RAC Tree docs #7730
Conversation
|
||
## Examples | ||
|
||
<ExampleList tag="tree" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chevron does not pass contrast in light mode. Maybe the background and text color is what should be changed in light mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you provide a screenshot? I'm not noticing anything and axe dev tools isn't showing me anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the selection highlight color also fails contrast vs the background since there is no checkbox (it's 2.35:1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I believe I've met the contrast requirements now, selection is 3.74:1 and text on selection is now 4.77:1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to add the card to react-aria/components.mdx and react-spectrum/index.mdx as well
|
||
## Examples | ||
|
||
<ExampleList tag="tree" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the selection highlight color also fails contrast vs the background since there is no checkbox (it's 2.35:1).
|
||
### Hooks | ||
|
||
If you need to customize things even further, such as accessing internal state or customizing DOM structure, you can drop down to the lower level Hook-based API. See [useTree](useTree.html) for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like useTree docs don't exist. Should also be useTreeGridList also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is when I messaged you about how we don't have those docs yet, so I'll work on creating them next. For now I'll just comment this section out
@@ -18,11 +18,11 @@ import { | |||
Provider, | |||
TreeItemProps as RACTreeItemProps, | |||
TreeProps as RACTreeProps, | |||
Tree, | |||
TreeItem, | |||
TreeItemContent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noticed a couple things in the stories while testing:
1. the focus ring doesn't sit on top of the selected item very well when isDetached is true (nvm, seems like it's fixed in virtualizer docs so it all just needs to get merged)
Screen.Recording.2025-02-14.at.2.09.55.PM.mov
- the focus ring appears on selection when i use my mouse to click. maybe usePress related and not anything in this PR in particular. also happens in RAC Tree but not in V3 TreeView
Screen.Recording.2025-02-14.at.2.08.16.PM.mov
This reverts commit 2bbff1e.
Starters in verdaccio build, see 0da9de6#comments |
# Conflicts: # packages/@react-spectrum/s2/src/TreeView.tsx # packages/react-aria-components/stories/Tree.stories.tsx # packages/react-aria-components/test/Tree.test.tsx
e6e088e
## API Changes
react-aria-components/react-aria-components:UNSTABLE_TreeLoadingIndicator-UNSTABLE_TreeLoadingIndicator <T extends {}> {
- children?: ReactNode | ((TreeLoadingIndicatorRenderProps & {
- defaultChildren: ReactNode | undefined
-})) => ReactNode
- className?: string | ((TreeLoadingIndicatorRenderProps & {
- defaultClassName: string | undefined
-})) => string
- style?: CSSProperties | ((TreeLoadingIndicatorRenderProps & {
- defaultStyle: CSSProperties
-})) => CSSProperties | undefined
-} /react-aria-components:UNSTABLE_Tree-UNSTABLE_Tree <T extends {}> {
- aria-describedby?: string
- aria-details?: string
- aria-label?: string
- aria-labelledby?: string
- autoFocus?: boolean | FocusStrategy
- children?: ReactNode | ({}) => ReactNode
- className?: string | ((TreeRenderProps & {
- defaultClassName: string | undefined
-})) => string
- defaultExpandedKeys?: Iterable<Key>
- defaultSelectedKeys?: 'all' | Iterable<Key>
- dependencies?: ReadonlyArray<any>
- disabledBehavior?: DisabledBehavior = 'all'
- disabledKeys?: Iterable<Key>
- disallowEmptySelection?: boolean
- expandedKeys?: Iterable<Key>
- id?: string
- items?: Iterable<T>
- onAction?: (Key) => void
- onExpandedChange?: (Set<Key>) => any
- onScroll?: (UIEvent<Element>) => void
- onSelectionChange?: (Selection) => void
- renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
- selectedKeys?: 'all' | Iterable<Key>
- selectionBehavior?: SelectionBehavior
- selectionMode?: SelectionMode
- slot?: string | null
- style?: CSSProperties | ((TreeRenderProps & {
- defaultStyle: CSSProperties
-})) => CSSProperties | undefined
-} /react-aria-components:UNSTABLE_TreeItem-UNSTABLE_TreeItem <T extends {}> {
- aria-label?: string
- children: ReactNode
- className?: string | ((TreeItemRenderProps & {
- defaultClassName: string | undefined
-})) => string
- download?: boolean | string
- hasChildItems?: boolean
- href?: Href
- hrefLang?: string
- id?: Key
- onHoverChange?: (boolean) => void
- onHoverEnd?: (HoverEvent) => void
- onHoverStart?: (HoverEvent) => void
- ping?: string
- referrerPolicy?: HTMLAttributeReferrerPolicy
- rel?: string
- routerOptions?: RouterOptions
- style?: CSSProperties | ((TreeItemRenderProps & {
- defaultStyle: CSSProperties
-})) => CSSProperties | undefined
- target?: HTMLAttributeAnchorTarget
- textValue: string
- value?: {}
-} /react-aria-components:UNSTABLE_TreeContext-UNSTABLE_TreeContext {
- UNTYPED
-} /react-aria-components:UNSTABLE_TreeItemContent-UNSTABLE_TreeItemContent {
- children?: ReactNode | ((T & {
- defaultChildren: ReactNode | undefined
-})) => ReactNode
-} /react-aria-components:UNSTABLE_TreeStateContext-UNSTABLE_TreeStateContext {
- UNTYPED
-} /react-aria-components:TreeItemProps TreeItemProps <T = {}> {
aria-label?: string
children: ReactNode
className?: string | ((TreeItemRenderProps & {
defaultClassName: string | undefined
})) => string
download?: boolean | string
hasChildItems?: boolean
href?: Href
hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
onHoverChange?: (boolean) => void
onHoverEnd?: (HoverEvent) => void
onHoverStart?: (HoverEvent) => void
ping?: string
rel?: string
routerOptions?: RouterOptions
style?: CSSProperties | ((TreeItemRenderProps & {
defaultStyle: CSSProperties
})) => CSSProperties | undefined
target?: HTMLAttributeAnchorTarget
textValue: string
value?: T
} /react-aria-components:TreeItemRenderProps TreeItemRenderProps {
+ hasChildItems: boolean
+ id: Key
isDisabled: boolean
isExpanded: boolean
isFocusVisible: boolean
isFocusVisibleWithin: boolean
isFocused: boolean
isHovered: boolean
isPressed: boolean
isSelected: boolean
+ level: number
selectionBehavior: SelectionBehavior
selectionMode: SelectionMode
+ state: TreeState<unknown>
} /react-aria-components:TreeItemContentRenderProps TreeItemContentRenderProps {
- allowsDragging?: boolean
hasChildItems: boolean
id: Key
isDisabled: boolean
- isDragging?: boolean
- isDropTarget?: boolean
isExpanded: boolean
isFocusVisible: boolean
isFocusVisibleWithin: boolean
isFocused: boolean
isPressed: boolean
isSelected: boolean
level: number
selectionBehavior: SelectionBehavior
selectionMode: SelectionMode
state: TreeState<unknown>
} /react-aria-components:TreeLoadingIndicator+TreeLoadingIndicator <T extends {}> {
+ children?: ReactNode | ((TreeLoadingIndicatorRenderProps & {
+ defaultChildren: ReactNode | undefined
+})) => ReactNode
+ className?: string | ((TreeLoadingIndicatorRenderProps & {
+ defaultClassName: string | undefined
+})) => string
+ style?: CSSProperties | ((TreeLoadingIndicatorRenderProps & {
+ defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+} /react-aria-components:Tree+Tree <T extends {}> {
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean | FocusStrategy
+ children?: ReactNode | ({}) => ReactNode
+ className?: string | ((TreeRenderProps & {
+ defaultClassName: string | undefined
+})) => string
+ defaultExpandedKeys?: Iterable<Key>
+ defaultSelectedKeys?: 'all' | Iterable<Key>
+ dependencies?: ReadonlyArray<any>
+ disabledBehavior?: DisabledBehavior = 'all'
+ disabledKeys?: Iterable<Key>
+ disallowEmptySelection?: boolean
+ expandedKeys?: Iterable<Key>
+ id?: string
+ items?: Iterable<T>
+ onAction?: (Key) => void
+ onExpandedChange?: (Set<Key>) => any
+ onScroll?: (UIEvent<Element>) => void
+ onSelectionChange?: (Selection) => void
+ renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
+ selectedKeys?: 'all' | Iterable<Key>
+ selectionBehavior?: SelectionBehavior
+ selectionMode?: SelectionMode
+ slot?: string | null
+ style?: CSSProperties | ((TreeRenderProps & {
+ defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+} /react-aria-components:TreeItem+TreeItem <T extends {}> {
+ aria-label?: string
+ children: ReactNode
+ className?: string | ((TreeItemRenderProps & {
+ defaultClassName: string | undefined
+})) => string
+ download?: boolean | string
+ hasChildItems?: boolean
+ href?: Href
+ hrefLang?: string
+ id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
+ onHoverChange?: (boolean) => void
+ onHoverEnd?: (HoverEvent) => void
+ onHoverStart?: (HoverEvent) => void
+ ping?: string
+ referrerPolicy?: HTMLAttributeReferrerPolicy
+ rel?: string
+ routerOptions?: RouterOptions
+ style?: CSSProperties | ((TreeItemRenderProps & {
+ defaultStyle: CSSProperties
+})) => CSSProperties | undefined
+ target?: HTMLAttributeAnchorTarget
+ textValue: string
+ value?: {}
+} /react-aria-components:TreeContext+TreeContext {
+ UNTYPED
+} /react-aria-components:TreeItemContent+TreeItemContent {
+ children?: ReactNode | ((T & {
+ defaultChildren: ReactNode | undefined
+})) => ReactNode
+} /react-aria-components:TreeStateContext+TreeStateContext {
+ UNTYPED
+} @react-spectrum/s2/@react-spectrum/s2:TreeViewItem TreeViewItem <T extends {}> {
aria-label?: string
childItems?: Iterable<{}>
children: ReactNode
download?: boolean | string
hasChildItems?: boolean
href?: Href
hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
onHoverChange?: (boolean) => void
onHoverEnd?: (HoverEvent) => void
onHoverStart?: (HoverEvent) => void
ping?: string
rel?: string
routerOptions?: RouterOptions
target?: HTMLAttributeAnchorTarget
textValue: string
value?: T
} /@react-spectrum/s2:TreeItemContent-TreeItemContent {
-
-} /@react-spectrum/s2:TreeViewItemProps TreeViewItemProps <T extends {} = {}> {
aria-label?: string
childItems?: Iterable<{}>
children: ReactNode
download?: boolean | string
hasChildItems?: boolean
href?: Href
hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
onHoverChange?: (boolean) => void
onHoverEnd?: (HoverEvent) => void
onHoverStart?: (HoverEvent) => void
ping?: string
rel?: string
routerOptions?: RouterOptions
target?: HTMLAttributeAnchorTarget
textValue: string
value?: T
} /@react-spectrum/s2:TreeViewItemContent+TreeViewItemContent {
+
+} @react-spectrum/tree/@react-spectrum/tree:TreeViewItem TreeViewItem <T extends {}> {
aria-label?: string
childItems?: Iterable<{}>
children: ReactNode
download?: boolean | string
hasChildItems?: boolean
href?: Href
hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
ping?: string
referrerPolicy?: HTMLAttributeReferrerPolicy
rel?: string
routerOptions?: RouterOptions
textValue: string
} /@react-spectrum/tree:TreeItemContent-TreeItemContent {
-
-} /@react-spectrum/tree:SpectrumTreeViewItemProps SpectrumTreeViewItemProps <T extends {} = {}> {
aria-label?: string
childItems?: Iterable<{}>
children: ReactNode
download?: boolean | string
hasChildItems?: boolean
href?: Href
hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
ping?: string
referrerPolicy?: HTMLAttributeReferrerPolicy
rel?: string
routerOptions?: RouterOptions
textValue: string
} /@react-spectrum/tree:TreeViewItemContent+TreeViewItemContent {
+
+} |
Closes
Modelled on Table docs
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: