Skip to content

Commit

Permalink
Merge pull request #4679 from nextcloud-libraries/fix/restore-checkbo…
Browse files Browse the repository at this point in the history
…x-wrapper

fix(NcCheckboxRadioSwitch): Restore wrapper element prop
  • Loading branch information
Pytal authored Oct 20, 2023
2 parents c0ae531 + ecbca63 commit 89048aa
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default {
</docs>

<template>
<component :is="wrapperElement"
<component :is="computedWrapperElement"
:id="wrapperId"
:class="{
['checkbox-radio-switch-' + type]: type,
Expand Down Expand Up @@ -431,6 +431,18 @@ export default {
type: Boolean,
default: false,
},
/**
* Wrapping element tag
*
* When `type` is set to `button` this will be ignored
*
* Defaults to `span`
*/
wrapperElement: {
type: String,
default: null,
},
},
emits: ['update:checked'],
Expand All @@ -440,10 +452,13 @@ export default {
return this.type === TYPE_BUTTON
},
wrapperElement() {
computedWrapperElement() {
if (this.isButtonType) {
return 'button'
}
if (this.wrapperElement !== null) {
return this.wrapperElement
}
return 'span'
},
Expand Down

0 comments on commit 89048aa

Please sign in to comment.