We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
[email protected]
I have some value in the format x% that I want to keep as string, but leva was parsing them as numbers without any suffix.
Here is the diff that solved my problem:
diff --git a/node_modules/leva/src/components/Number/number-plugin.ts b/node_modules/leva/src/components/Number/number-plugin.ts index ce107ad..415d611 100644 --- a/node_modules/leva/src/components/Number/number-plugin.ts +++ b/node_modules/leva/src/components/Number/number-plugin.ts @@ -21,7 +21,7 @@ export const normalize = ({ value, ...settings }: NumberInput) => { const _value = clamp(parseFloat(value as string), min, max) let suffix if (!Number.isFinite(value)) { - const match = String(value).match(/[A-Z]+/i) + const match = String(value).match(/[A-Z%]+/i) if (match) suffix = match[0] }
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
@Corei13 thanks for spotting this. Should be fixed in latest leva release (supporting all kinds of units).
let _value = parseFloat(value as string) const suffix = typeof value === 'string' ? value.substring(('' + _value).length) : undefined _value = clamp(_value, min, max)
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.I have some value in the format x% that I want to keep as string, but leva was parsing them as numbers without any suffix.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: