Skip to content

Commit

Permalink
refactor: unify styles for form input components
Browse files Browse the repository at this point in the history
  • Loading branch information
KabinKhandThakuri committed Dec 20, 2024
1 parent 9e41dbd commit 06a20c0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/demo/src/assets/css/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
--switch-field-direction: column;
--textarea-resize: vertical;
--textarea-width: 100%;
--textarea-height: 5rem;
--textarea-height: 10rem;
}
6 changes: 4 additions & 2 deletions packages/vue-form/src/assets/css/input.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
--_input-field-border-radius: var(--form-input-border-radius, 0.25em);
--_input-field-padding-h: var(--form-input-padding-h, 0.75em);
--_input-field-padding-v: var(--form-input-padding-v, 0.65em);
--_input-field-height: var(--form-input-height, 2.8em);

border-radius: var(--_input-field-border-radius);
border: 1px solid var(--_input-field-border-color);
border-radius: var(--_input-field-border-radius);
font-size: 1rem;
padding: var(--_input-field-padding-v) var(--_input-field-padding-v);
height: var(--_input-field-height);
padding: var(--_input-field-padding-v) var(--_input-field-padding-h);
width: 100%;
}

Expand Down
19 changes: 15 additions & 4 deletions packages/vue-form/src/components/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
>
<VueDatePicker
v-bind="{ ...filteredAttributes, ...field }"
:class="{
invalid: meta.touched && !meta.valid,
valid: meta.dirty && meta.valid && Object.keys(props.schema).length,
}"
:class="[
'field',
{
invalid: meta.touched && !meta.valid,
valid: meta.dirty && meta.valid && Object.keys(props.schema).length,
},
]"
:disabled="disabled"
:enable-time-picker="enableTimePicker"
:format="format"
Expand Down Expand Up @@ -136,6 +139,10 @@ const onUpdate = (
color: var(--_label-color);
}
.date-picker .dp__main > div {
width: 100%;
}
.dp--clear-btn {
--dp-icon-color: var(--icon-color, #555);
}
Expand All @@ -161,6 +168,10 @@ const onUpdate = (
--dp-icon-color: var(--icon-color, #555);
}
.date-picker .field input {
--_input-field-padding-h: 2.2rem;
}
.invalid .dp__input {
--dp-border-color: var(--danger-color, #dc3545);
Expand Down
9 changes: 7 additions & 2 deletions packages/vue-form/src/components/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,18 @@ onMounted(() => {
}
.multiselect-input {
--_border-radius: var(--form-input-border-radius, 0.25em);
--_multiselect-border-color: var(--form-input-border-color, #555);
--_padding-h: var(--padding-h, 0.75em);
--_padding-v: var(--form-input-padding-v, 0.65em);
--_height: var(--form-input-height, 2.8em);
align-content: center;
border: 1px solid var(--_multiselect-border-color);
border-radius: var(--_border-radius);
cursor: pointer;
min-height: 3rem;
padding: 10px;
height: var(--_height);
padding: var(--_padding-v) var(--_padding-h);
user-select: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`DatePicker > matches snapshot 1`] = `
autocomplete="off"
autoposition="true"
canceltext="Cancel"
class=""
class="field"
clearable="true"
dark="false"
disabled="false"
Expand Down

0 comments on commit 06a20c0

Please sign in to comment.