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

Feat: add autoSort option for sliders #1124

Merged
merged 7 commits into from
Apr 15, 2024

Conversation

bennymi
Copy link
Contributor

@bennymi bennymi commented Mar 25, 2024

Closes #1122.

I added a disableSwap option to sliders which disables the automatic ordering of the value array. Therefore it's now possible to have arrays like these: [25, 20, 30], whereas before the value arrays were always automatically sorted. This is important because in some instances users might want indexes to hold specific meaning, so if the values get swapped around there's no way of keeping track of the individual values.

I also added an example for it, which demonstrates the different behaviors:
image

Copy link

changeset-bot bot commented Mar 25, 2024

🦋 Changeset detected

Latest commit: e95e946

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@melt-ui/svelte Patch

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

@bennymi bennymi changed the title Add enableSwap option for sliders Feat: add disableSwap option for sliders Mar 26, 2024
@abdel-17
Copy link
Contributor

I suggest we name the prop disableAutoSort. It makes it clear which functionality is being disabled. swap isn’t very clear imo.

@huntabyte
Copy link
Member

I suggest we name the prop disableAutoSort. It makes it clear which functionality is being disabled. swap isn’t very clear imo.

Agreed on the clarity of "swap".

Even simplifying it to autoSort with a default of true would suffice and be self-explanatory.

@bennymi bennymi changed the title Feat: add disableSwap option for sliders Feat: add autoSort option for sliders Mar 27, 2024
Copy link
Contributor

github-actions bot commented Mar 27, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
melt-ui ✅ Ready (View Log) Visit Preview e95e946

Copy link
Member

@TGlide TGlide left a comment

Choose a reason for hiding this comment

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

Thank you, great PR! 🎉

@TGlide TGlide merged commit b44c332 into melt-ui:develop Apr 15, 2024
6 checks passed
lolcabanon pushed a commit to lolcabanon/melt-ui that referenced this pull request Apr 20, 2024
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.

🌟Feature request: Add option to keep order of Slider values
4 participants