@sfxcode/formkit-primevue 2.0.6 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +14 -13
  2. package/dist/components/PrimeAutoComplete.vue +7 -13
  3. package/dist/components/PrimeCascadeSelect.vue +5 -11
  4. package/dist/components/PrimeCheckbox.vue +9 -11
  5. package/dist/components/PrimeColorPicker.vue +4 -4
  6. package/dist/components/PrimeDatePicker.vue +5 -11
  7. package/dist/components/PrimeEditor.vue +5 -7
  8. package/dist/components/PrimeInputMask.vue +6 -4
  9. package/dist/components/PrimeInputNumber.vue +6 -7
  10. package/dist/components/PrimeInputOtp.vue +5 -11
  11. package/dist/components/PrimeInputText.vue +5 -11
  12. package/dist/components/PrimeKnob.vue +6 -4
  13. package/dist/components/PrimeListbox.vue +5 -11
  14. package/dist/components/PrimeMultiSelect.vue +5 -11
  15. package/dist/components/PrimePassword.vue +5 -11
  16. package/dist/components/PrimeRadioButton.vue +9 -14
  17. package/dist/components/PrimeRating.vue +5 -11
  18. package/dist/components/PrimeSelect.vue +5 -9
  19. package/dist/components/PrimeSelectButton.vue +5 -11
  20. package/dist/components/PrimeSlider.vue +6 -8
  21. package/dist/components/PrimeTextarea.vue +5 -10
  22. package/dist/components/PrimeToggleButton.vue +5 -11
  23. package/dist/components/PrimeToggleSwitch.vue +7 -13
  24. package/dist/components/PrimeTreeSelect.vue +5 -11
  25. package/dist/composables/index.d.ts +2 -1
  26. package/dist/composables/index.js +7 -0
  27. package/dist/composables/index.mjs +2 -0
  28. package/dist/composables/useFormKitInput.d.ts +8 -0
  29. package/dist/composables/useFormKitInput.js +35 -0
  30. package/dist/composables/useFormKitInput.mjs +22 -0
  31. package/dist/definitions/index.js +23 -23
  32. package/dist/definitions/index.mjs +56 -25
  33. package/dist/sass/formkit-primevue.scss +2 -2
  34. package/dist/style.css +1 -1
  35. package/package.json +21 -21
package/README.md CHANGED
@@ -86,6 +86,8 @@ You can use it or take it as base for your own styling.
86
86
  ### Extended Styling
87
87
 
88
88
  - All inputs are wrapped in a div with a **p-formkit** class
89
+ - Use *wrapperClass* to add additional styleclasses to wrapper div
90
+ - Most Prime Components have access to class / styles attributes
89
91
  - Most Prime Components have access to class / styles attributes
90
92
  - PT and PTOptions are available ([https://primevue.org/passthrough/](https://primevue.org/passthrough/))
91
93
  - [Styling](https://formkit-primevue.netlify.app/styling/base) and [PT](https://formkit-primevue.netlify.app/styling/passThrough) demo available
@@ -104,31 +106,30 @@ Some samples for common tasks are available
104
106
 
105
107
  [Nuxt 3 PrimeVue Starter](https://github.com/sfxcode/nuxt3-primevue-starter) and [Vite PrimeVue Starter](https://github.com/sfxcode/vite-primevue-starter) with Formkit support available.
106
108
 
107
- ## Supported Inputs
109
+ ## Supported Inputs for PrimeVue 4
108
110
 
109
111
  - AutoComplete
110
- - Calendar
111
112
  - CascadeSelect
112
113
  - Checkbox
113
- - Chips
114
- - Dropdown
114
+ - ColorPicker
115
+ - DatePicker
115
116
  - Editor (HTML Editor)
116
117
  - InputMask
117
118
  - InputNumber
118
119
  - InputOtp
119
- - InputSwitch
120
120
  - InputText
121
- - InputTextarea
122
- - MultiSelect
123
- - Password
124
- - Ranking
125
121
  - Knob
126
- - ColorPicker
127
122
  - Listbox
128
- - ToggleButton
129
- - SelectButton
130
- - TriStateCheckbox
123
+ - MultiSelect
124
+ - Password
131
125
  - RadioButton
126
+ - Rating
127
+ - Select
128
+ - SelectButton
129
+ - Slider
130
+ - Textarea
131
+ - ToggleButton
132
+ - ToggleSwitch
132
133
  - TreeSelect
133
134
 
134
135
  ## Demo
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed, ref } from 'vue'
2
+ import { type PropType, ref } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { AutoCompleteCompleteEvent, AutoCompleteProps } from 'primevue/autocomplete'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeAutoCompleteProps {
8
9
  pt?: AutoCompleteProps['pt']
@@ -11,6 +12,7 @@ export interface FormKitPrimeAutoCompleteProps {
11
12
  dropdown?: AutoCompleteProps['dropdown']
12
13
  multiple?: AutoCompleteProps['multiple']
13
14
  typeahead?: AutoCompleteProps['typeahead']
15
+ wrapperClass?: string
14
16
  }
15
17
 
16
18
  const props = defineProps({
@@ -20,25 +22,17 @@ const props = defineProps({
20
22
  },
21
23
  })
22
24
 
25
+ const { styleClass, wrapperClass, handleInput, handleBlur } = useFormKitInput(props.context)
26
+
23
27
  const suggestions = ref([])
24
28
 
25
29
  function search(event: AutoCompleteCompleteEvent) {
26
30
  suggestions.value = props.context?.attrs.complete(event.query)
27
31
  }
28
-
29
- function handleInput(_: any) {
30
- props.context?.node.input(props.context?._value)
31
- }
32
-
33
- function handleBlur(event: Event) {
34
- props.context?.handlers.blur(event)
35
- }
36
-
37
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
38
32
  </script>
39
33
 
40
34
  <template>
41
- <div class="p-formkit">
35
+ <div :class="wrapperClass">
42
36
  <AutoComplete
43
37
  :id="context.id"
44
38
  v-model="context._value"
@@ -51,7 +45,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
51
45
  :suggestions="suggestions"
52
46
  :dropdown="context?.dropdown ?? false"
53
47
  :multiple="context?.multiple ?? false"
54
- :typeahead="context?.attrs.typeahead ?? true"
48
+ :typeahead="context?.typeahead ?? true"
55
49
  :pt="context?.pt"
56
50
  :pt-options="context?.ptOptions"
57
51
  :unstyled="context?.unstyled ?? false"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { CascadeSelectProps } from 'primevue/cascadeselect'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeCascadeSelectProps {
8
9
  options?: CascadeSelectProps['options']
@@ -14,6 +15,7 @@ export interface FormKitPrimeCascadeSelectProps {
14
15
  pt?: CascadeSelectProps['pt']
15
16
  ptOptions?: CascadeSelectProps['ptOptions']
16
17
  unstyled?: CascadeSelectProps['unstyled']
18
+ wrapperClass?: string
17
19
  }
18
20
 
19
21
  const props = defineProps({
@@ -23,19 +25,11 @@ const props = defineProps({
23
25
  },
24
26
  })
25
27
 
26
- function handleInput(_: any) {
27
- props.context?.node.input(props.context?._value)
28
- }
29
-
30
- function handleBlur(e: Event) {
31
- props.context?.handlers.blur(e)
32
- }
33
-
34
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
28
+ const { styleClass, wrapperClass, handleInput, handleBlur } = useFormKitInput(props.context)
35
29
  </script>
36
30
 
37
31
  <template>
38
- <div class="p-formkit">
32
+ <div :class="wrapperClass">
39
33
  <CascadeSelect
40
34
  :id="context.id"
41
35
  v-model="context._value"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { CheckboxProps } from 'primevue/checkbox'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeCheckboxProps {
8
9
  binary?: CheckboxProps['binary']
@@ -11,8 +12,11 @@ export interface FormKitPrimeCheckboxProps {
11
12
  pt?: CheckboxProps['pt']
12
13
  ptOptions?: CheckboxProps['ptOptions']
13
14
  unstyled?: CheckboxProps['unstyled']
15
+ indeterminate?: CheckboxProps['indeterminate']
16
+ variant?: CheckboxProps['variant']
14
17
  labelLeft?: string
15
18
  labelRight?: string
19
+ wrapperClass?: string
16
20
  }
17
21
 
18
22
  const props = defineProps({
@@ -22,19 +26,11 @@ const props = defineProps({
22
26
  },
23
27
  })
24
28
 
25
- function handleInput(_: any) {
26
- props.context?.node.input(props.context?._value)
27
- }
28
-
29
- function handleBlur(e: Event) {
30
- props.context?.handlers.blur(e)
31
- }
32
-
33
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
29
+ const { styleClass, wrapperClass, handleInput, handleBlur } = useFormKitInput(props.context)
34
30
  </script>
35
31
 
36
32
  <template>
37
- <div class="p-formkit">
33
+ <div :class="wrapperClass">
38
34
  <span v-if="context.labelLeft" class="formkit-prime-left">{{ context.labelLeft }}</span>
39
35
  <Checkbox
40
36
  v-model="context._value"
@@ -47,7 +43,9 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
47
43
  :tabindex="context?.attrs.tabindex"
48
44
  :aria-label="context?.attrs.ariaLabel"
49
45
  :aria-labelledby="context?.attrs.ariaLabelledby"
46
+ :indeterminate="context.indeterminate ?? null"
50
47
  :binary="context.binary ?? true"
48
+ :variant="context.variant ?? 'outlined'"
51
49
  :true-value="context.trueValue ?? undefined"
52
50
  :false-value="context.falseValue ?? undefined"
53
51
  :pt="context.pt"
@@ -3,6 +3,7 @@ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { ColorPickerProps } from 'primevue/colorpicker'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeColorPickerProps {
8
9
  defaultColor?: ColorPickerProps['defaultColor']
@@ -11,6 +12,7 @@ export interface FormKitPrimeColorPickerProps {
11
12
  pt?: ColorPickerProps['pt']
12
13
  ptOptions?: ColorPickerProps['ptOptions']
13
14
  unstyled?: ColorPickerProps['unstyled']
15
+ wrapperClass?: string
14
16
  }
15
17
 
16
18
  const props = defineProps({
@@ -20,13 +22,11 @@ const props = defineProps({
20
22
  },
21
23
  })
22
24
 
23
- function handleChange(_: any) {
24
- props.context?.node.input(props.context?._value)
25
- }
25
+ const { wrapperClass, handleChange } = useFormKitInput(props.context)
26
26
  </script>
27
27
 
28
28
  <template>
29
- <div class="p-formkit">
29
+ <div :class="wrapperClass">
30
30
  <ColorPicker
31
31
  v-model="context._value"
32
32
  v-bind="context?.attrs"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { DatePickerBlurEvent, DatePickerProps } from 'primevue/datepicker'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeDatePickerProps {
8
9
  dateFormat?: DatePickerProps['dateFormat']
@@ -48,6 +49,7 @@ export interface FormKitPrimeDatePickerProps {
48
49
  pt?: DatePickerProps['pt']
49
50
  ptOptions?: DatePickerProps['ptOptions']
50
51
  unstyled?: DatePickerProps['unstyled']
52
+ wrapperClass?: string
51
53
  }
52
54
 
53
55
  const props = defineProps({
@@ -57,13 +59,7 @@ const props = defineProps({
57
59
  },
58
60
  })
59
61
 
60
- function handleInput(_: any) {
61
- props.context?.node.input(props.context?._value)
62
- }
63
-
64
- function handleSelect(e: any) {
65
- props.context?.node.input(e)
66
- }
62
+ const { styleClass, wrapperClass, handleInput, handleSelect } = useFormKitInput(props.context)
67
63
 
68
64
  function handleBlur(e: DatePickerBlurEvent) {
69
65
  props.context?.handlers.blur(e.originalEvent)
@@ -72,12 +68,10 @@ function handleBlur(e: DatePickerBlurEvent) {
72
68
  function handleClearClick() {
73
69
  props.context?.node.input(null)
74
70
  }
75
-
76
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
77
71
  </script>
78
72
 
79
73
  <template>
80
- <div class="p-formkit">
74
+ <div :class="wrapperClass">
81
75
  <DatePicker
82
76
  v-model="context._value"
83
77
  v-bind="context?.attrs"
@@ -1,8 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { EditorProps, EditorSelectionChangeEvent } from 'primevue/editor'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeEditorProps {
8
9
  placeholder?: EditorProps['placeholder']
@@ -11,6 +12,7 @@ export interface FormKitPrimeEditorProps {
11
12
  pt?: EditorProps['pt']
12
13
  ptOptions?: EditorProps['ptOptions']
13
14
  unstyled?: EditorProps['unstyled']
15
+ wrapperClass?: string
14
16
  }
15
17
 
16
18
  const props = defineProps({
@@ -20,20 +22,16 @@ const props = defineProps({
20
22
  },
21
23
  })
22
24
 
23
- function handleInput(e: any) {
24
- props.context?.node.input(e.htmlValue)
25
- }
25
+ const { styleClass, wrapperClass, handleInput } = useFormKitInput(props.context)
26
26
 
27
27
  function handleSelection(e: EditorSelectionChangeEvent) {
28
28
  if (e.range === null)
29
29
  props.context?.handlers.blur(e.htmlValue)
30
30
  }
31
-
32
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
33
31
  </script>
34
32
 
35
33
  <template>
36
- <div class="p-formkit">
34
+ <div :class="wrapperClass">
37
35
  <Editor
38
36
  :id="context.id"
39
37
  v-model="context._value"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { InputMaskProps } from 'primevue/inputmask'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeInputMaskProps {
8
9
  mask?: InputMaskProps['mask']
@@ -16,6 +17,7 @@ export interface FormKitPrimeInputMaskProps {
16
17
  variant?: InputMaskProps['variant']
17
18
  iconLeft?: string
18
19
  iconRight?: string
20
+ wrapperClass?: string
19
21
  }
20
22
 
21
23
  const props = defineProps({
@@ -25,6 +27,8 @@ const props = defineProps({
25
27
  },
26
28
  })
27
29
 
30
+ const { styleClass, wrapperClass } = useFormKitInput(props.context)
31
+
28
32
  function handleInput(e: FocusEvent) {
29
33
  props.context?.node.input(props.context?._value)
30
34
  props.context?.handlers.blur(e)
@@ -46,12 +50,10 @@ function spanClass() {
46
50
  result = `${result}p-input-icon-right `
47
51
  return result
48
52
  }
49
-
50
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
51
53
  </script>
52
54
 
53
55
  <template>
54
- <div class="p-formkit">
56
+ <div :class="wrapperClass">
55
57
  <span :class="spanClass()">
56
58
  <i v-if="hasLeftIcon()" :class="context.iconLeft" />
57
59
 
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { InputNumberBlurEvent, InputNumberProps } from 'primevue/inputnumber'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeInputNumberProps {
8
9
  useGrouping?: InputNumberProps['useGrouping']
@@ -22,6 +23,7 @@ export interface FormKitPrimeInputNumberProps {
22
23
  ptOptions?: InputNumberProps['ptOptions']
23
24
  unstyled?: InputNumberProps['unstyled']
24
25
  placeholder?: InputNumberProps['placeholder']
26
+ wrapperClass?: string
25
27
  }
26
28
 
27
29
  const props = defineProps({
@@ -31,18 +33,15 @@ const props = defineProps({
31
33
  },
32
34
  })
33
35
 
36
+ const { styleClass, wrapperClass, handleInput } = useFormKitInput(props.context)
37
+
34
38
  function handleBlur(e: InputNumberBlurEvent) {
35
39
  props.context?.handlers.blur(e.originalEvent)
36
40
  }
37
-
38
- function handleInput(e: any) {
39
- props.context?.node.input(e.value)
40
- }
41
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
42
41
  </script>
43
42
 
44
43
  <template>
45
- <div class="p-formkit">
44
+ <div :class="wrapperClass">
46
45
  <InputNumber
47
46
  v-model="context._value"
48
47
  v-bind="context?.attrs"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { InputOtpProps } from 'primevue/inputotp'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeInputOtpProps {
8
9
  unstyled?: InputOtpProps['unstyled']
@@ -12,6 +13,7 @@ export interface FormKitPrimeInputOtpProps {
12
13
  variant?: InputOtpProps['variant']
13
14
  mask?: InputOtpProps['mask']
14
15
  integerOnly?: InputOtpProps['integerOnly']
16
+ wrapperClass?: string
15
17
  }
16
18
 
17
19
  const props = defineProps({
@@ -21,19 +23,11 @@ const props = defineProps({
21
23
  },
22
24
  })
23
25
 
24
- function handleInput(_: any) {
25
- props.context?.node.input(props.context?._value)
26
- }
27
-
28
- function handleBlur(e: Event) {
29
- props.context?.handlers.blur(e)
30
- }
31
-
32
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
26
+ const { styleClass, wrapperClass, handleBlur, handleInput } = useFormKitInput(props.context)
33
27
  </script>
34
28
 
35
29
  <template>
36
- <div class="p-formkit">
30
+ <div :class="wrapperClass">
37
31
  <InputOtp
38
32
  :id="context.id"
39
33
  v-model="context._value"
@@ -5,6 +5,7 @@ import type { FormKitFrameworkContext } from '@formkit/core'
5
5
  import IconField from 'primevue/iconfield'
6
6
  import InputIcon from 'primevue/inputicon'
7
7
  import type { InputTextProps } from 'primevue/inputtext'
8
+ import { useFormKitInput } from '../composables'
8
9
 
9
10
  export interface FormKitPrimeInputTextProps {
10
11
  pt?: InputTextProps['pt']
@@ -12,6 +13,7 @@ export interface FormKitPrimeInputTextProps {
12
13
  unstyled?: InputTextProps['unstyled']
13
14
  placeholder?: InputTextProps['placeholder']
14
15
  icon?: string
16
+ wrapperClass?: string
15
17
  }
16
18
 
17
19
  const props = defineProps({
@@ -21,6 +23,8 @@ const props = defineProps({
21
23
  },
22
24
  })
23
25
 
26
+ const { styleClass, wrapperClass, handleInput, handleBlur } = useFormKitInput(props.context)
27
+
24
28
  const hasIcon = computed(() => {
25
29
  if (props.context?.icon && props.context?.icon.length > 0)
26
30
  return true
@@ -35,20 +39,10 @@ const icon = computed(() => {
35
39
  const iconPosition = computed(() => {
36
40
  return props.context?.attrs?.iconPosition ?? undefined
37
41
  })
38
-
39
- function handleBlur(e: Event) {
40
- props.context?.handlers.blur(e)
41
- }
42
-
43
- function handleInput(e: any) {
44
- props.context?.node.input(e.target.value)
45
- }
46
-
47
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
48
42
  </script>
49
43
 
50
44
  <template>
51
- <div class="p-formkit">
45
+ <div :class="wrapperClass">
52
46
  <IconField v-if="hasIcon" :icon-position="iconPosition">
53
47
  <InputIcon :class="icon" />
54
48
  <InputText
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { KnobProps } from 'primevue/knob'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeKnobProps {
8
9
  pt?: KnobProps['pt']
@@ -18,6 +19,7 @@ export interface FormKitPrimeKnobProps {
18
19
  rangeColor?: KnobProps['rangeColor']
19
20
  textColor?: KnobProps['textColor']
20
21
  valueTemplate?: KnobProps['valueTemplate']
22
+ wrapperClass?: string
21
23
  }
22
24
 
23
25
  const props = defineProps({
@@ -27,6 +29,8 @@ const props = defineProps({
27
29
  },
28
30
  })
29
31
 
32
+ const { styleClass, wrapperClass } = useFormKitInput(props.context)
33
+
30
34
  function handleInput(e: any) {
31
35
  props.context?.node.input(e)
32
36
  props.context?.handlers.blur(e)
@@ -35,12 +39,10 @@ function handleInput(e: any) {
35
39
  function updateValue(n: number) {
36
40
  props.context?.node.input(n)
37
41
  }
38
-
39
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
40
42
  </script>
41
43
 
42
44
  <template>
43
- <div class="p-formkit">
45
+ <div :class="wrapperClass">
44
46
  <Knob
45
47
  :id="context.id"
46
48
  v-model="context._value"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { ListboxProps } from 'primevue/listbox'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeListboxProps {
8
9
  pt?: ListboxProps['pt']
@@ -19,6 +20,7 @@ export interface FormKitPrimeListboxProps {
19
20
  filterMatchMode?: ListboxProps['filterMatchMode']
20
21
  autoOptionFocus?: ListboxProps['autoOptionFocus']
21
22
  selectOnFocus?: ListboxProps['selectOnFocus']
23
+ wrapperClass?: string
22
24
  }
23
25
 
24
26
  const props = defineProps({
@@ -28,19 +30,11 @@ const props = defineProps({
28
30
  },
29
31
  })
30
32
 
31
- function handleInput(_: any) {
32
- props.context?.node.input(props.context?._value)
33
- }
34
-
35
- function handleBlur(e: Event) {
36
- props.context?.handlers.blur(e)
37
- }
38
-
39
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
33
+ const { styleClass, wrapperClass, handleInput, handleBlur } = useFormKitInput(props.context)
40
34
  </script>
41
35
 
42
36
  <template>
43
- <div class="p-formkit">
37
+ <div :class="wrapperClass">
44
38
  <Listbox
45
39
  :id="context.id"
46
40
  v-model="context._value"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { MultiSelectProps } from 'primevue/multiselect'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimeMultiSelectProps {
8
9
  options?: MultiSelectProps['options']
@@ -40,6 +41,7 @@ export interface FormKitPrimeMultiSelectProps {
40
41
  placeholder?: MultiSelectProps['placeholder']
41
42
  ptOptions?: MultiSelectProps['ptOptions']
42
43
  unstyled?: MultiSelectProps['unstyled']
44
+ wrapperClass?: string
43
45
  }
44
46
 
45
47
  const props = defineProps({
@@ -49,19 +51,11 @@ const props = defineProps({
49
51
  },
50
52
  })
51
53
 
52
- function handleChange(_: any) {
53
- props.context?.node.input(props.context?._value)
54
- }
55
-
56
- function handleBlur(e: Event) {
57
- props.context?.handlers.blur(e)
58
- }
59
-
60
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
54
+ const { styleClass, wrapperClass, handleBlur, handleChange } = useFormKitInput(props.context)
61
55
  </script>
62
56
 
63
57
  <template>
64
- <div class="p-formkit">
58
+ <div :class="wrapperClass">
65
59
  <MultiSelect
66
60
  v-model="context._value"
67
61
  v-bind="context?.attrs"
@@ -1,8 +1,9 @@
1
1
  <script setup lang='ts'>
2
- import { type PropType, computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
3
  import type { FormKitFrameworkContext } from '@formkit/core'
4
4
 
5
5
  import type { PasswordProps } from 'primevue/password'
6
+ import { useFormKitInput } from '../composables'
6
7
 
7
8
  export interface FormKitPrimePasswordProps {
8
9
  mediumRegex?: PasswordProps['mediumRegex']
@@ -19,6 +20,7 @@ export interface FormKitPrimePasswordProps {
19
20
  placeholder?: PasswordProps['placeholder']
20
21
  feedback?: PasswordProps['feedback']
21
22
  toggleMask?: PasswordProps['toggleMask']
23
+ wrapperClass?: string
22
24
  }
23
25
 
24
26
  const props = defineProps({
@@ -28,19 +30,11 @@ const props = defineProps({
28
30
  },
29
31
  })
30
32
 
31
- function handleBlur(e: Event) {
32
- props.context?.handlers.blur(e)
33
- }
34
-
35
- function handleInput(e: any) {
36
- props.context?.node.input(e.target.value)
37
- }
38
-
39
- const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
33
+ const { styleClass, wrapperClass, handleInput, handleBlur } = useFormKitInput(props.context)
40
34
  </script>
41
35
 
42
36
  <template>
43
- <div class="p-formkit">
37
+ <div :class="wrapperClass">
44
38
  <Password
45
39
  v-model="context._value"
46
40
  v-bind="context?.attrs"