fix(dashboard): support more decimals for tx rates (#13407)

* Percentage formatter set maximum digits to 4

* Modify Tax Region Forms to allow 4 digits tax rates

* Add changeset

* Revert placeholder value to use only 2 decimals

* fix(dashboard): support more decimals for tx rates

* changeset

* bypass scale

* refactor

* fix removal of deprecated input

* cleanup deprecated percentage input

* small mistake in onchange

* add deprecated percentage input back

* import

* remove file extension

* frane comment

---------

Co-authored-by: AmbroziuBaban <ambroziubaban@gmail.com>
This commit is contained in:
William Bouchard
2025-09-05 07:02:44 -04:00
committed by GitHub
parent 0000ed6998
commit 9b3831d258
10 changed files with 102 additions and 41 deletions
@@ -3,7 +3,7 @@ import { useForm } from "react-hook-form"
import { z } from "zod"
import { InformationCircleSolid } from "@medusajs/icons"
import { Button, Heading, Input, Text, Tooltip, toast } from "@medusajs/ui"
import { Button, Heading, Input, Text, toast, Tooltip } from "@medusajs/ui"
import { useTranslation } from "react-i18next"
import { Form } from "../../../../../components/common/form"
import { CountrySelect } from "../../../../../components/inputs/country-select"
@@ -221,6 +221,7 @@ export const TaxRegionCreateForm = ({ parentId }: TaxRegionCreateFormProps) => {
<PercentageInput
{...field}
value={value?.value}
decimalsLimit={4}
onValueChange={(value, _name, values) =>
onChange({
value: value,
@@ -1,7 +1,7 @@
import { zodResolver } from "@hookform/resolvers/zod"
import { InformationCircleSolid } from "@medusajs/icons"
import { HttpTypes } from "@medusajs/types"
import { Button, Heading, Input, Text, Tooltip, toast } from "@medusajs/ui"
import { Button, Heading, Input, Text, toast, Tooltip } from "@medusajs/ui"
import { useForm } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { z } from "zod"
@@ -189,6 +189,7 @@ export const TaxRegionProvinceCreateForm = ({
<PercentageInput
{...field}
value={value?.value}
decimalsLimit={4}
onValueChange={(value, _name, values) =>
onChange({
value: value,
@@ -1,6 +1,7 @@
import { zodResolver } from "@hookform/resolvers/zod"
import {
Button,
clx,
Divider,
Heading,
Hint,
@@ -8,7 +9,6 @@ import {
Label,
Select,
Text,
clx,
toast,
} from "@medusajs/ui"
import { useFieldArray, useForm, useWatch } from "react-hook-form"
@@ -414,6 +414,7 @@ export const TaxRegionCreateTaxOverrideForm = ({
<PercentageInput
{...field}
placeholder="0.00"
decimalsLimit={4}
value={value?.value}
onValueChange={(value, _name, values) =>
onChange({
@@ -3,6 +3,7 @@ import { MagnifyingGlass } from "@medusajs/icons"
import { HttpTypes } from "@medusajs/types"
import {
Button,
clx,
Divider,
Heading,
Hint,
@@ -10,7 +11,6 @@ import {
Label,
Select,
Text,
clx,
toast,
} from "@medusajs/ui"
import { useFieldArray, useForm, useWatch } from "react-hook-form"
@@ -414,6 +414,7 @@ export const TaxRegionTaxOverrideEditForm = ({
<PercentageInput
{...field}
value={value?.value}
decimalsLimit={4}
onValueChange={(value, _name, values) =>
onChange({
value: value,
@@ -119,6 +119,7 @@ export const TaxRegionTaxRateCreateForm = ({
<PercentageInput
{...field}
value={value?.value}
decimalsLimit={4}
onValueChange={(value, _name, values) =>
onChange({
value: value,
@@ -117,6 +117,7 @@ export const TaxRegionTaxRateEditForm = ({
<PercentageInput
{...field}
value={value?.value}
decimalsLimit={4}
onValueChange={(value, _name, values) =>
onChange({
value: value,