primevue-mirror/components/lib/radiobutton/BaseRadioButton.vue

110 lines
2.3 KiB
Vue
Raw Normal View History

2023-05-24 12:29:06 +00:00
<script>
import BaseComponent from 'primevue/basecomponent';
import { useStyle } from 'primevue/usestyle';
const styles = `
.p-radiobutton {
position: relative;
display: inline-flex;
cursor: pointer;
user-select: none;
vertical-align: bottom;
}
.p-radiobutton.p-radiobutton-disabled {
cursor: default;
}
.p-radiobutton-box {
display: flex;
justify-content: center;
align-items: center;
}
.p-radiobutton-icon {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transform: translateZ(0) scale(.1);
border-radius: 50%;
visibility: hidden;
}
.p-radiobutton-box.p-highlight .p-radiobutton-icon {
transform: translateZ(0) scale(1.0, 1.0);
visibility: visible;
}
`;
const classes = {
root: ({ instance, props }) => [
'p-radiobutton p-component',
{
'p-radiobutton-checked': instance.checked,
'p-radiobutton-disabled': props.disabled,
'p-radiobutton-focused': instance.focused
}
],
input: ({ instance, props }) => [
'p-radiobutton-box',
{
'p-highlight': instance.checked,
'p-disabled': props.disabled,
'p-focus': instance.focused
}
],
icon: 'p-radiobutton-icon'
};
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { name: 'radiobutton', manual: true });
2023-05-24 12:29:06 +00:00
export default {
name: 'BaseRadioButton',
extends: BaseComponent,
props: {
value: null,
modelValue: null,
name: {
type: String,
default: null
},
disabled: {
type: Boolean,
default: false
},
inputId: {
type: String,
default: null
},
inputClass: {
type: [String, Object],
default: null
},
inputStyle: {
type: Object,
default: null
},
inputProps: {
type: null,
default: null
},
'aria-labelledby': {
type: String,
default: null
},
'aria-label': {
type: String,
default: null
}
},
css: {
classes,
loadStyle
2023-05-24 12:29:06 +00:00
},
provide() {
return {
$parentInstance: this
};
2023-05-24 12:29:06 +00:00
}
};
</script>