mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
fix(number-input): decimal input
This commit is contained in:
parent
1559d0f9d6
commit
8b18d16a6d
1 changed files with 5 additions and 3 deletions
|
@ -118,9 +118,11 @@
|
||||||
dispatch("change", value);
|
dispatch("change", value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let inputValue = value;
|
||||||
|
|
||||||
$: incrementLabel = translateWithId("increment");
|
$: incrementLabel = translateWithId("increment");
|
||||||
$: decrementLabel = translateWithId("decrement");
|
$: decrementLabel = translateWithId("decrement");
|
||||||
$: value = Number(value);
|
$: value = Number(inputValue);
|
||||||
$: error =
|
$: error =
|
||||||
invalid || (!allowEmpty && value === "") || value > max || value < min;
|
invalid || (!allowEmpty && value === "") || value > max || value < min;
|
||||||
$: errorId = `error-${id}`;
|
$: errorId = `error-${id}`;
|
||||||
|
@ -181,7 +183,7 @@
|
||||||
aria-label="{label ? undefined : ariaLabel}"
|
aria-label="{label ? undefined : ariaLabel}"
|
||||||
on:input
|
on:input
|
||||||
on:input="{({ target }) => {
|
on:input="{({ target }) => {
|
||||||
value = target.value;
|
inputValue = target.value;
|
||||||
}}"
|
}}"
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
|
@ -189,7 +191,7 @@
|
||||||
max="{max}"
|
max="{max}"
|
||||||
min="{min}"
|
min="{min}"
|
||||||
step="{step}"
|
step="{step}"
|
||||||
value="{value}"
|
value="{inputValue}"
|
||||||
readonly="{readonly}"
|
readonly="{readonly}"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue