n8n/packages/design-system/src/components/N8nRadioButtons/RadioButtons.vue
Mutasem Aldmour 60da5bb7ec
refactor(design-system): replace functional components (#3802)
* update creator item

* update warning tooltip

* update badge and trigger icon

* update action box

* update avatar component

* update badge

* update heading component

* update icon component

* update link component

* update menu

* update route component

* fix avatar bug

* fix avatar bug

* update input component

* update select

* update input

* update tags component

* update spinner

* update square button

* update tag component

* update text component

* add danger color

* add vue.extend

* add human readable names

* add human readable name

* revert button changes

* update name

* revert name

* update classes

* delete unused component

* redo name change

* rename

* rename back

* rename back

* update snapshots
2022-08-05 15:03:24 +02:00

67 lines
1.1 KiB
Vue

<template>
<div role="radiogroup" :class="{'n8n-radio-buttons': true, [$style.radioGroup]: true, [$style.disabled]: disabled}">
<RadioButton
v-for="option in options"
:key="option.value"
v-bind="option"
:active="value === option.value"
:size="size"
:disabled="disabled"
@click="(e) => onClick(option.value, e)"
/>
</div>
</template>
<script lang="ts">
import RadioButton from './RadioButton.vue';
import Vue from 'vue';
export default Vue.extend({
name: 'n8n-radio-buttons',
props: {
value: {
type: String,
},
options: {
},
size: {
type: String,
},
disabled: {
type: Boolean,
},
},
components: {
RadioButton,
},
methods: {
onClick(value) {
if (this.disabled) {
return;
}
this.$emit('input', value);
},
},
});
</script>
<style lang="scss" module>
.radioGroup {
display: inline-flex;
line-height: 1;
vertical-align: middle;
font-size: 0;
background-color: var(--color-foreground-base);
padding: var(--spacing-5xs);
border-radius: var(--border-radius-base);
}
.disabled {
cursor: not-allowed;
}
</style>