Skip to content
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

chore: Update TreeView API #7613

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

chore: Update TreeView API #7613

wants to merge 11 commits into from

Conversation

snowystinger
Copy link
Member

Closes

I think this is what https://github.com/orgs/adobe/projects/19/views/32?visibleFields=%5B%22Title%22%2C%22Assignees%22%2C%22Status%22%2C4406231%2C25365423%2C3244152%2C5195578%2C17851188%2C30557450%2C3404283%2C%22Labels%22%5D&filterQuery=&pane=issue&itemId=59197979
was asking for

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@snowystinger snowystinger marked this pull request as ready for review January 16, 2025 01:43
Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly more to write but I think the composition benefits are probably worth it

children
} = props;
let {isDetached, isEmphasized} = useContext(InternalTreeContext);
let {hasChildItems} = useContext(TreeItemContext);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasChildRows in the render props doesn't give you what you need?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently i do need this right now, I'll look into it more tomorrow

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it is for the case where you want to mark a TreeRow as expandable despite not having any child rows (aka async case/permissions case where the user doesn't have access to said TreeRow's content but needs to know that it is expanded)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, was just looking into it and was scratching my head why this was needed and clearly intentional because there are tests for it as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be done in RAC then. This won't result in the right aria attributes being added, only the visual chevron appearing. There is a hasChildNodes property internally, maybe that should be used instead?

packages/@react-spectrum/tree/docs/TreeView.mdx Outdated Show resolved Hide resolved
@rspbot
Copy link

rspbot commented Jan 22, 2025

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API update looks good to me, just some things I noticed when looking at the docs page

devongovett
devongovett previously approved these changes Jan 28, 2025
@rspbot
Copy link

rspbot commented Jan 29, 2025

@rspbot
Copy link

rspbot commented Jan 29, 2025

@rspbot
Copy link

rspbot commented Jan 29, 2025

LFDanLu
LFDanLu previously approved these changes Jan 29, 2025
Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy for the missing props in the TreeItemContent props table to be handled in the main PR

@@ -414,6 +471,10 @@ The `<TreeViewItem>` component works with frameworks and client side routers lik

<PropTable component={docs.exports.TreeView} links={docs.links} style={{marginBottom: '40px'}} />

### TreeItemContent props

<PropTable component={docs.exports.TreeItemContent} links={docs.links} style={{marginBottom: '40px'}} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure why, but this section doesn't seem to render anything

Base automatically changed from s2-treeview to main January 29, 2025 23:54
@snowystinger snowystinger dismissed stale reviews from LFDanLu and devongovett January 29, 2025 23:54

The base branch was changed.

@snowystinger snowystinger force-pushed the s2-treeview-api-update branch from 23a6b1a to 04adce4 Compare January 30, 2025 00:24
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@adobe adobe deleted a comment from rspbot Jan 30, 2025
@rspbot
Copy link

rspbot commented Jan 30, 2025

@rspbot
Copy link

rspbot commented Jan 30, 2025

## API Changes

@react-spectrum/s2

/@react-spectrum/s2:TreeItemContent

+TreeItemContent {
+
+}

@react-spectrum/tree

/@react-spectrum/tree:TreeItemContent

+TreeItemContent {
+
+}

/@react-spectrum/tree:Collection

+Collection <T extends {}> {
+  addIdAndValue?: boolean
+  children?: ReactNode | ({}) => ReactNode
+  dependencies?: Array<any>
+  idScope?: Key
+  items?: Iterable<{}>
+}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants