2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-radiobutton {
|
|
|
|
position: relative;
|
|
|
|
display: inline-flex;
|
|
|
|
user-select: none;
|
|
|
|
vertical-align: bottom;
|
|
|
|
width: ${dt('radiobutton.width')};
|
|
|
|
height: ${dt('radiobutton.height')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton-input {
|
|
|
|
cursor: pointer;
|
|
|
|
appearance: none;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
opacity: 0;
|
|
|
|
z-index: 1;
|
|
|
|
outline: 0 none;
|
|
|
|
border: 1px solid transparent;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton-box {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
border-radius: 50%;
|
|
|
|
border: 1px solid ${dt('radiobutton.border.color')};
|
|
|
|
background: ${dt('radiobutton.background')};
|
|
|
|
width: ${dt('radiobutton.width')};
|
|
|
|
height: ${dt('radiobutton.height')};
|
|
|
|
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
|
|
|
|
outline-color: transparent;
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('radiobutton.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton-icon {
|
|
|
|
transition-duration: ${dt('transition.duration')};
|
|
|
|
background: transparent;
|
|
|
|
font-size: ${dt('radiobutton.icon.size')};
|
|
|
|
width: ${dt('radiobutton.icon.size')};
|
|
|
|
height: ${dt('radiobutton.icon.size')};
|
|
|
|
border-radius: 50%;
|
|
|
|
backface-visibility: hidden;
|
|
|
|
transform: translateZ(0) scale(0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:hover) .p-radiobutton-box {
|
|
|
|
border-color: ${dt('radiobutton.hover.border.color')};
|
|
|
|
}
|
|
|
|
|
2024-05-07 08:44:03 +00:00
|
|
|
.p-radiobutton-checked .p-radiobutton-box {
|
2024-05-01 08:26:48 +00:00
|
|
|
border-color: ${dt('radiobutton.checked.border.color')};
|
|
|
|
background: ${dt('radiobutton.checked.background')};
|
|
|
|
}
|
|
|
|
|
2024-05-07 08:44:03 +00:00
|
|
|
.p-radiobutton-checked .p-radiobutton-box .p-radiobutton-icon {
|
2024-05-01 08:26:48 +00:00
|
|
|
background: ${dt('radiobutton.icon.checked.color')};
|
|
|
|
transform: translateZ(0) scale(1, 1);
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
|
2024-05-07 08:44:03 +00:00
|
|
|
.p-radiobutton-checked:not(.p-disabled):has(.p-radiobutton-input:hover) .p-radiobutton-box {
|
2024-05-01 08:26:48 +00:00
|
|
|
border-color: ${dt('radiobutton.checked.hover.border.color')};
|
|
|
|
background: ${dt('radiobutton.checked.hover.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:hover).p-radiobutton-checked .p-radiobutton-box .p-radiobutton-icon {
|
|
|
|
background: ${dt('radiobutton.icon.checked.hover.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:focus-visible) .p-radiobutton-box {
|
2024-05-07 08:44:03 +00:00
|
|
|
border-color: ${dt('radiobutton.focus.border.color')};
|
|
|
|
box-shadow: ${dt('radiobutton.focus.ring.shadow')};
|
|
|
|
outline: ${dt('radiobutton.focus.ring.width')} ${dt('radiobutton.focus.ring.style')} ${dt('radiobutton.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('radiobutton.focus.ring.offset')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton-checked:not(.p-disabled):has(.p-radiobutton-input:focus-visible) .p-radiobutton-box {
|
|
|
|
border-color: ${dt('radiobutton.checked.focus.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-invalid > .p-radiobutton-box {
|
|
|
|
border-color: ${dt('radiobutton.invalid.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-variant-filled .p-radiobutton-box {
|
|
|
|
background: ${dt('radiobutton.filled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-variant-filled.p-radiobutton-checked .p-radiobutton-box {
|
|
|
|
background: ${dt('radiobutton.checked.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-variant-filled:not(.p-disabled):has(.p-radiobutton-input:hover).p-radiobutton-checked .p-radiobutton-box {
|
|
|
|
background: ${dt('radiobutton.checked.hover.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-disabled {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-disabled .p-radiobutton-box {
|
|
|
|
background: ${dt('radiobutton.disabled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-radiobutton.p-disabled .p-radiobutton-box .p-radiobutton-icon {
|
|
|
|
color: ${dt('radiobutton.icon.disabled.color')};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-radiobutton p-component',
|
|
|
|
{
|
2024-04-07 10:52:43 +00:00
|
|
|
'p-radiobutton-checked': instance.checked,
|
2024-01-30 11:27:56 +00:00
|
|
|
'p-disabled': props.disabled,
|
2024-01-31 08:02:53 +00:00
|
|
|
'p-invalid': props.invalid,
|
2024-02-02 11:46:26 +00:00
|
|
|
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled'
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
2024-01-12 07:07:55 +00:00
|
|
|
box: 'p-radiobutton-box',
|
|
|
|
input: 'p-radiobutton-input',
|
2023-10-02 10:46:09 +00:00
|
|
|
icon: 'p-radiobutton-icon'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'radiobutton',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-04 09:20:15 +00:00
|
|
|
classes
|
2023-10-02 10:46:09 +00:00
|
|
|
});
|