Skip to content

Commit a7d64e7

Browse files
committed
ui(sass): add class to indent checkboxes if using horizontal data edit styling
1 parent 1cb2a0a commit a7d64e7

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

dev/pages/data/Edit.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useMessages } from '../../composables/messages'
55
const { addElement } = useFormKitSchema()
66
const { t } = useI18n()
77
const horizontal = ref(false)
8+
const indentCheckboxes = ref(false)
89
910
const options = [
1011
{ label: 'Every page load', value: 'refresh' },
@@ -99,13 +100,18 @@ async function submitHandler() {
99100
<template>
100101
<PrimeData header="FormKitDataEdit Demo">
101102
<div class="flex gap-2 mb-4">
102-
Horizontal <ToggleSwitch v-model="horizontal" />
103+
<div>Horizontal</div>
104+
<ToggleSwitch v-model="horizontal" />
105+
<div v-if="horizontal">
106+
Indent Checkboxes
107+
</div>
108+
<ToggleSwitch v-if="horizontal" v-model="indentCheckboxes" />
103109
</div>
104110
<FormKitDataEdit
105111
:data="data"
106112
:schema="schema"
107113
:submit-label="t('save')"
108-
:form-class="horizontal ? 'form-horizontal' : ''"
114+
:form-class="(horizontal ? ' form-horizontal' : '') + (indentCheckboxes ? ' form-horizontal-checkbox-indent ' : '')"
109115
:debug-data="true"
110116
:debug-schema="true"
111117
@data-saved="submitHandler"

src/sass/formkit-primevue.scss

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,15 @@ $grid-breakpoints: (
326326
}
327327
}
328328
}
329+
330+
&.form-horizontal-checkbox-indent {
331+
.formkit-outer[data-type="primeCheckbox"] {
332+
@include media-breakpoint-up(md) {
333+
padding-left: calc((4 / 12) * 100%);
334+
}
335+
}
336+
}
337+
329338
}
330339

331340
.p-formkit-data-view & {
@@ -344,13 +353,13 @@ $grid-breakpoints: (
344353
width: 100%;
345354

346355
label {
347-
width: 33.3333333333%;
356+
width: calc((4 / 12) * 100%);
348357
padding-top: 0.25rem;
349358
line-height: normal;
350359
}
351360

352361
.formkit-inner {
353-
width: 66.6666666667%;
362+
width: calc((8 / 12) * 100%);
354363
}
355364
}
356365

@@ -370,7 +379,7 @@ $grid-breakpoints: (
370379
}
371380

372381
.formkit-help, .formkit-messages {
373-
width: 66.6666666667%;
382+
width: calc((8 / 12) * 100%);
374383
margin-left: auto;
375384
}
376385
}

0 commit comments

Comments
 (0)