Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fix checkbox line height and make checkbox label clickable #4818

Merged
merged 3 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/design-system/src/components/N8nCheckbox/Checkbox.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<el-checkbox
v-bind="$props"
ref="checkbox"
:class="['n8n-checkbox', $style.n8nCheckbox]"
:disabled="disabled"
:indeterminate="indeterminate"
Expand All @@ -12,7 +13,8 @@
:tooltipText="tooltipText"
:bold="false"
:size="labelSize"
></n8n-input-label>
@click.prevent="onLabelClick"
/>
</el-checkbox>
</template>

Expand Down Expand Up @@ -58,6 +60,14 @@ export default Vue.extend({
onChange(event: Event) {
this.$emit('input', event);
},
onLabelClick() {
const checkboxComponent = this.$refs.checkbox as ElCheckbox;
if (!checkboxComponent) {
return;
}

(checkboxComponent.$el as HTMLElement).click();
},
},
});
</script>
Expand All @@ -70,5 +80,9 @@ export default Vue.extend({
span {
white-space: normal;
}

label {
cursor: pointer;
}
}
</style>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="$style.container">
<div :class="$style.container" v-on="$listeners">
<label
v-if="label || $slots.options"
:for="inputName"
Expand All @@ -12,7 +12,7 @@
}"
>
<div :class="$style.title" v-if="label">
<n8n-text :bold="bold" :size="size" :compact="!underline && !$slots.options" :color="color">
<n8n-text :bold="bold" :size="size" :compact="compact" :color="color">
{{ label }}
<n8n-text color="primary" :bold="bold" :size="size" v-if="required">*</n8n-text>
</n8n-text>
Expand Down Expand Up @@ -57,6 +57,10 @@ export default Vue.extend({
N8nTooltip,
},
props: {
compact: {
type: Boolean,
default: false,
},
color: {
type: String,
},
Expand Down