@@ -5,6 +5,8 @@ import { defineComponent, PropType, computed, h } from 'vue';
55import TextInput from ' ../text-input/TextInput.vue' ;
66import SelectInput from ' ../select-input/SelectInput.vue' ;
77import TextAreaInput from ' ../text-area-input/TextAreaInput.vue' ;
8+ import CheckboxInput from ' ../checkbox-input/CheckboxInput.vue' ;
9+ import RadioInput from ' ../radio-input/RadioInput.vue' ;
810
911import { FormControl } from ' ../../core/models' ;
1012import { isEmpty , entries , values , keys } from ' ../../core/utils/helpers' ;
@@ -13,6 +15,8 @@ const components = {
1315 TextInput ,
1416 SelectInput ,
1517 TextAreaInput ,
18+ CheckboxInput ,
19+ RadioInput ,
1620};
1721
1822const props = {
@@ -32,6 +36,9 @@ export default defineComponent({
3236 return [
3337 ' dynamic-input' ,
3438 ' form-group' ,
39+ {
40+ ' form-group--inline' : props ?.control ?.type === ' checkbox' ,
41+ },
3542 {
3643 ' form-group--error' : showErrors .value ,
3744 },
@@ -103,6 +110,9 @@ export default defineComponent({
103110 };
104111 });
105112
113+ const hasLabel = computed (() => props ?.control ?.type !== ' checkbox' );
114+ const isFieldSet = computed (() => props ?.control ?.type === ' radio' );
115+
106116 return () => {
107117 switch (props ?.control ?.type ) {
108118 case ' text' :
@@ -117,24 +127,32 @@ export default defineComponent({
117127 case ' textarea' :
118128 component = h (TextAreaInput , attributes .value );
119129 break ;
120-
130+ case ' checkbox' :
131+ component = h (CheckboxInput , attributes .value );
132+ break ;
133+ case ' radio' :
134+ component = h (RadioInput , attributes .value );
135+ break ;
121136 default :
122137 break ;
123138 }
124139 return h (
125- ' div' ,
140+ isFieldSet . value ? ' fieldset ' : ' div' ,
126141 {
127142 class: getClasses .value ,
143+ role: isFieldSet .value ? undefined : ' group' ,
128144 },
129145 [
130- h (
131- ' label' ,
132- {
133- class: ' form-label' ,
134- for: props ?.control ?.label ,
135- },
136- props ?.control ?.label ,
137- ),
146+ hasLabel .value
147+ ? h (
148+ isFieldSet .value ? ' legend' : ' label' ,
149+ {
150+ class: ' form-label' ,
151+ for: props ?.control ?.label ,
152+ },
153+ props ?.control ?.label ,
154+ )
155+ : null ,
138156 component ,
139157 h (
140158 ' div' ,
0 commit comments