11<script setup lang='ts'>
22import type { FormKitFrameworkContext } from ' @formkit/core'
33import type { PropType } from ' vue'
4+ import type { FormKitIconProps } from ' ./FormKitIcon.vue'
45import { computed } from ' vue'
56import { useFormKitSection } from ' ../composables'
7+ import FormKitIcon from ' ./FormKitIcon.vue'
8+ import FormKitPrefix from ' ./FormKitPrefix.vue'
9+ import FormKitSuffix from ' ./FormKitSuffix.vue'
610
711export interface FormKitOutputListProps {
812 listStyle? : ' div' | ' ul' | ' ol' | ' span'
913}
1014
1115const props = defineProps ({
1216 context: {
13- type: Object as PropType <FormKitFrameworkContext & FormKitOutputListProps > ,
17+ type: Object as PropType <FormKitFrameworkContext > & FormKitIconProps ,
1418 required: true ,
1519 },
1620})
@@ -24,10 +28,8 @@ const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection
2428
2529<template >
2630 <div class =" p-formkit p-output-list" >
27- <i v-if =" hasPrefixIcon" class =" formkit-prefix-icon" :class =" context?.iconPrefix" />
28- <span v-if =" hasPrefix && listStyle === 'span'" class =" formkit-prefix" >
29- {{ context?.prefix }}
30- </span >
31+ <FormKitIcon v-if =" hasPrefixIcon" :icon-class =" context?.iconPrefix" :on-click =" context?.onIconPrefixClicked" position =" prefix" />
32+ <FormKitPrefix v-if =" hasPrefix && listStyle === 'span'" :prefix =" context?.prefix" />
3133 <span v-if =" listStyle === 'span'" :id =" context?.id" :style =" context?.attrs?.style" class =" p-output-list-items" :class =" context?.attrs?.class" >
3234 <template v-for =" (value , index ) of context ?._value " :key =" index " >
3335 <span v-if =" index !== 0" class =" p-output-list-divider" :class =" context?.dividerClass" >{{ context?.divider ?? ', ' }}</span >
@@ -55,9 +57,7 @@ const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection
5557 </span >
5658 </li >
5759 </ol >
58- <span v-if =" hasSuffix && listStyle === 'span'" class =" formkit-suffix" >
59- {{ context?.suffix }}
60- </span >
61- <i v-if =" hasSuffixIcon" class =" formkit-suffix-icon" :class =" context?.iconSuffix" />
60+ <FormKitSuffix v-if =" hasSuffix && listStyle === 'span'" :suffix =" context?.suffix" />
61+ <FormKitIcon v-if =" hasSuffixIcon" :icon-class =" context?.iconSuffix" :on-click =" context?.onIconSuffixClicked" position =" suffix" />
6262 </div >
6363</template >
0 commit comments