Skip to content

Commit

Permalink
fix(forms): adopt native mask support (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder authored Oct 15, 2024
1 parent 161cc7c commit 31fb12a
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions packages/core/forms/src/components/fields/FieldInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,12 @@
:placeholder="schema.placeholder"
:readonly="schema.readonly"
:required="schema.required"
:show-password-mask-toggle="inputType === 'password'"
:type="inputType"
:width="schema.width"
@blur="onBlur"
@update:model-value="onInput"
>
<template
v-if="schema.inputType === 'password'"
#after
>
<VisibilityIcon
v-if="masked"
role="button"
@click="toggleMasked"
/>
<VisibilityOffIcon
v-else
role="button"
@click="toggleMasked"
/>
</template>
</KInput>
/>

<!-- autofill -->
<component
Expand All @@ -60,7 +45,6 @@ import objGet from 'lodash-es/get'
import isFunction from 'lodash-es/isFunction'
import isNumber from 'lodash-es/isNumber'
import composables from '../../composables'
import { VisibilityIcon, VisibilityOffIcon } from '@kong/icons'
const props = defineProps({
disabled: {
Expand Down Expand Up @@ -102,7 +86,6 @@ const emit = defineEmits<{
}>()
const propsRefs = toRefs(props)
const masked = ref(true)
const autofillSlot = inject<AutofillSlot | undefined>(AUTOFILL_SLOT, undefined)
Expand Down Expand Up @@ -131,10 +114,6 @@ const inputType = computed((): string => {
case 'datetime':
return 'datetime-local'
// 'password' fields are masked by default, but can be toggled by the user
case 'password':
return masked.value ? 'password' : 'text'
default:
return iType || 'text'
}
Expand Down Expand Up @@ -202,10 +181,6 @@ const onBlur = (): void => {
}
}
const toggleMasked = () => {
masked.value = !masked.value
}
onMounted((): void => {
// Set up debounced functions for formatting dates and numbers
switch (inputType.value) {
Expand Down

0 comments on commit 31fb12a

Please sign in to comment.