This commit is contained in:
Gerard Burns 2023-11-21 13:02:06 +00:00
parent aed2328523
commit 217ac49628
1 changed files with 12 additions and 6 deletions

View File

@ -21,7 +21,7 @@
let focus = false
const updateValue = newValue => {
if (readonly) {
if (readonly || disabled) {
return
}
if (type === "number") {
@ -32,14 +32,14 @@
}
const onFocus = () => {
if (readonly) {
if (readonly || disabled) {
return
}
focus = true
}
const onBlur = event => {
if (readonly) {
if (readonly || disabled) {
return
}
focus = false
@ -47,14 +47,14 @@
}
const onInput = event => {
if (readonly || !updateOnChange) {
if (readonly || !updateOnChange || disabled) {
return
}
updateValue(event.target.value)
}
const updateValueOnEnter = event => {
if (readonly) {
if (readonly || disabled) {
return
}
if (event.key === "Enter") {
@ -66,10 +66,12 @@
if (type === "bigint") {
return "numeric"
}
return type === "number" ? "decimal" : "text"
return type === "number" ?
"decimal" : "text"
}
onMount(() => {
if (disabled) return;
focus = autofocus
if (focus) field.focus()
})
@ -119,4 +121,8 @@
.spectrum-Textfield {
width: 100%;
}
input:focus:hover::placeholder {
color: var(--grey-8) !important;
}
</style>