22import { type PropType , computed } from ' vue'
33import type { FormKitFrameworkContext } from ' @formkit/core'
44import type { InputTextProps } from ' primevue/inputtext'
5+ import type { IconFieldProps } from ' primevue/iconfield'
56
67export interface FormKitPrimeInputTextProps {
78 pt? : InputTextProps [' pt' ]
89 ptOptions? : InputTextProps [' ptOptions' ]
910 unstyled? : InputTextProps [' unstyled' ]
1011 placeholder? : InputTextProps [' placeholder' ]
1112 icon? : string
13+ iconPosition? : IconFieldProps [' iconPosition' ]
1214}
1315
1416const props = defineProps ({
@@ -24,7 +26,15 @@ const hasIcon = computed(() => {
2426 }
2527
2628 return props .context ?.attrs ?.icon && props .context ?.attrs ?.icon .length > 0
27- }
29+ })
30+
31+ const icon = computed (() => {
32+ return props .context ?.icon ?? props .context ?.attrs ?.icon
33+ })
34+
35+ const iconPosition = computed (() => {
36+ return props .context ?.attrs ?.iconPosition ?? undefined ;
37+ })
2838
2939function handleBlur(e : Event ) {
3040 props .context ?.handlers .blur (e )
@@ -39,8 +49,8 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
3949
4050<template >
4151 <div class =" p-formkit" >
42- < IconField v - if = " hasIcon" :icon - position = " context?.attrs. iconPosition" >
43- < InputIcon :class = " context.attrs. icon" / >
52+ <IconField v-if =" hasIcon" :icon-position =" iconPosition" >
53+ <InputIcon :class =" icon" />
4454 <InputText
4555 :id =" context.id"
4656 v-model =" context._value"
0 commit comments