-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathformkit.config.ts
84 lines (81 loc) · 1.92 KB
/
formkit.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { defineFormKitConfig } from '@formkit/vue';
import GovFormButton from './components/GovFormButton.vue';
import GovRadios from './components/GovRadios.vue';
import type { FormKitInputs, FormKitOptionsProp } from '@formkit/inputs';
import GovDropdown from './components/GovDropdown.vue';
import GovInputInt from './components/GovInputInt.vue';
import GovInputWithSuffix from './components/GovInputWithSuffix.vue';
import GovCheckboxes from './components/GovCheckboxes.vue';
import type { GovDetailsProps } from './components/GovDetails.vue';
import GovInputText from './components/GovInputText.vue';
type GovRadioOption = {
label: string;
hint?: string;
};
// Enable TypeScript support for custom inputs
declare module '@formkit/inputs' {
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
'govRadios': {
type: 'govRadios',
options: Record<string, string | GovRadioOption>
details?: GovDetailsProps
},
'govButton': {
type: 'govButton'
},
'govDropdown': {
type: 'govDropdown',
options: FormKitOptionsProp
},
'govInputInt': {
type: 'govInputInt'
},
'govInputWithSuffix': {
type: 'govInputWithSuffix',
suffixText: string
},
'govCheckboxes': {
type: 'govCheckboxes',
options: FormKitOptionsProp,
help?: string
},
'govInputText': {
type: 'govInputText'
}
}
}
// Register custom inputs with FormKit
export default defineFormKitConfig(() => {
return {
inputs: {
govRadios: {
type: 'input',
component: GovRadios
},
govButton: {
type: 'input',
component: GovFormButton
},
govDropdown: {
type: 'input',
component: GovDropdown
},
govInputInt: {
type: 'input',
component: GovInputInt
},
govInputWithSuffix: {
type: "input",
component: GovInputWithSuffix
},
govCheckboxes: {
type: "input",
component: GovCheckboxes
},
govInputText: {
type: "input",
component: GovInputText
}
}
};
});