-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
feat/tree-view-select #1779
feat/tree-view-select #1779
Conversation
🦋 Changeset detectedLatest commit: 02a58b2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Mahmoud-zino just saw this popup - no rush but can you address this in this PR as well? Either change the icons or change the text to something like We definitely don't want Skeleton to be associated with dead children heh |
@endigo9740 Can you please test the default arrow on Safari, I am testing on a WebKit-based browser from Cypress, but I can't run Safari on Linux or Windows -_- |
@endigo9740 As mentioned in Discord: |
@Mahmoud-zino unrelated to any other issue - I've noted that even on production you can tap a non-expanding row and the dash icon flips. Let's put that on the list to resolve as well please. |
@Mahmoud-zino from what I'm seeing the tree view item selection state is not following our standard pattern for embedded form elements. The closest frame of reference is the ListBox/ListBox item. It works like this:
One difference between listboxs and tree views - the input should be VISIBLE, not hidden. But ONLY when users want selection to be present. So we should set a Here's how I'd imagine that would work in execution: <!-- Single Selection - Flat List -->
<script lang="ts">
const groupTopLevel = 'item-1';
</script>
<TreeView selection>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-1">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-2">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-3">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
</TreeView> <!-- Multi Selection - Flat List -->
<script lang="ts">
const groupTopLevel = ['item-1'];
</script>
<TreeView selection multiple>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-1">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-2">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-3">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
</TreeView> <!-- Single Selection - Sub List -->
<script lang="ts">
const groupTopLevel = 'item-1';
const groupSubLevel = 'subitem-1';
</script>
<TreeView selection>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-1">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
<svelte:fragment slot="children">
<TreeViewItem bind:group={groupSubLevel} name="sub-level" value="subitem-1">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupSubLevel} name="sub-level" value="subitem-2">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupSubLevel} name="sub-level" value="subitem-3">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
</svelte:fragment>
</TreeViewItem>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-2">...</TreeViewItem>
<!-- ... -->
</TreeView> <!-- Multi Selection - Sub List -->
<script lang="ts">
const groupTopLevel = ['item-1'];
const groupdItemOneSubLevel = ['subitem-1'];
</script>
<TreeView selection multiple>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-1" multiple>
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
<svelte:fragment slot="children">
<TreeViewItem bind:group={groupSubLevel} name="sub-level" value="subitem-1">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupSubLevel} name="sub-level" value="subitem-2">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
<TreeViewItem bind:group={groupSubLevel} name="sub-level" value="subitem-3">
<svelte:fragment slot="lead">(icon)</svelte:fragment>
(item 1)
</TreeViewItem>
</svelte:fragment>
</TreeViewItem>
<TreeViewItem bind:group={groupTopLevel} name="top-level" value="item-2">...</TreeViewItem>
<!-- ... -->
</TreeView> |
Summary
This is now changed to a folder-file structure example with appropriate icons.
done.
this is done like you suggested (using HTML inputs), it is very similar to the
Since in a tree, most of the users would want the check-boxes - check state to depend on its children, I've gone ahead and implemented it. this is only possible when the user includes all the children's references on an item.
Done.
Done.
Done
This was the real challenge between all the tasks...
This is not needed anymore, since we are providing an easier solution for data-driven.
I added only keyboard support for keys that don't interfere with our inputs. the A11y suggests a lot more since they consider baking the selection in the element instead of using HTML inputs but this doesn't apply to us. Please let me know what you think in general about the changes, this is somewhat a new approach in Skeleton so I expect you or other contributors to not agree with some of the implemented stuff, but I am happy to discuss and change them when needed. |
@Mahmoud-zino just took a peek at this and holy cow, what an update! So many features! Given the complexity of this feature I'm going to encourage reviews by other contributors. I'd love to have this by the v2 release, but I cannot promise I'll personally have a chance before the v2 release. That said, the feature is indicated to be in a |
I'm using the 'Tree View' component as a sidebar menu, similar to what Flowbite is offering. One feature it lacks is having a "selected" state, similar to what 'TabAnchor' provides. Will this PR add the feature? |
@PrivOci Yes this was the target of this PR, you can test what is being added from https://skeleton-docs-git-fork-mahmoud-zino-feat-t-50ee43-skeleton-labs.vercel.app/components/tree-views |
@PrivOci This is also possible using styling, we are using native input so we decided to show them, but you can also hide them and change the highlight of the active element through props. |
@Mahmoud-zino I've done a pass through the PR and submitted a few updates to the page documentation. I've adjusted, regrouped, and renamed a few sections to be more semantic and provide more instruction. I've also tried to boil down the examples to the minimum information required. Per the logic for the feature itself - there's too much for me to be able to dive into that right now. However, from the user-end everything seems to be operating as expected. The properties and APIs you've implemented for implementing and enable features all work as expected. The only constructive criticism I might give here is to evaluate if we need to provide so many features in a single PR. I know folks will ask for the world, but it's ok to limit scope if it means complexity stays low. The more complex something is, the more room there is for things to go wrong. Right now, you might be the only personal qualified to understand what's happening under the hood for this feature. Rather than trying to prune out features, what I might recommend in the future is we revisit and do the following:
For now, everything appears to be operating as I would expect as an end user, so we'll merge this with the condition that the feature will still be designated as a |
@endigo9740 I totally get it. actually, when I was implementing it, I was constantly worried about how other contributors will have so much time and effort to review. in the future, I will make sure to break things down to make it easier for others 👍 as for your 3 suggestions, I will be happy to apply them whenever we have time for that 😄 |
This reverts commit fa91c64.
Linked Issue
Closes #1773,
Closes #1784,
Closes #1785
Description
reference the summary bellow.
Tasks
Changsets
feat: Added
tree-view
single/multi selection mode, Enableddata-driven
for tree-view.Checklist
Please read and apply all contribution requirements.
dev
branch (NEVERmaster
)docs/
,feat/
,chore/
,bugfix/
pnpm check
pnpm format
pnpm test