@@ -13,7 +13,7 @@ import type { FormErrorEvent, FormSubmitEvent } from "#ui/types";
1313
1414const toast = useToast ();
1515const { t } = useI18n ();
16- const debug = true ;
16+ const debug = useRuntimeConfig (). public . debug ;
1717
1818const props = defineProps ({
1919 fields: Object as PropType <CollectivoFormField []>,
@@ -22,6 +22,7 @@ const props = defineProps({
2222 submitLabel: String ,
2323});
2424
25+ console .log (" data" , props .data );
2526const form = { fields: props .fields ?? [] };
2627const loading = ref (false );
2728
@@ -178,6 +179,7 @@ for (const input of form.fields) {
178179 addInputToSchema (input .key , input , boolean ());
179180 }
180181
182+ // Add passed data or default value to field
181183 if (props .data ?.[input .key ]) {
182184 state [input .key ] = props .data [input .key ];
183185 } else if (" default" in input && input .default ) {
@@ -423,15 +425,16 @@ async function fillOutAll() {
423425 class =" mx-2 my-10 p-6 rounded-lg bg-slate-100 flex flex-col gap-2"
424426 >
425427 <div >
426- DEBUG Tools. < br / >
427- You are seeing this because NUXT_DEBUG =True
428+ < h3 >Debug Tools</ h3 >
429+ < p > You are seeing this because NUXT_PUBLIC_DEBUG =True</ p >
428430 </div >
429431 <div >
430432 <UButton class="btn" @click =" fillOutAll " >
431433 {{ t("Fill out all") }}
432434 </UButton >
433435 </div >
434- <div class =" text-sm" >Form state: {{ state }}</div >
436+ <h4 >Form state</h4 >
437+ <div class =" text-sm" >{{ state }}</div >
435438 </div >
436439</template >
437440
@@ -448,6 +451,10 @@ async function fillOutAll() {
448451 @apply form-field basis-full ;
449452}
450453
454+ .form-field-half {
455+ @apply form-field basis-full md :basis- 1/ 2 ;
456+ }
457+
451458.form-field-xl {
452459 @apply form-field basis-full xl :basis- 1/ 2 ;
453460}
0 commit comments