primevue-mirror/components/lib/themes/primeone/base/inputswitch/index.js

91 lines
2.7 KiB
JavaScript
Raw Normal View History

export default {
css: ({ dt }) => `
2024-04-07 10:21:03 +00:00
.p-toggleswitch {
display: inline-block;
width: 2.5rem;
height: 1.5rem;
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch-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;
2024-03-13 18:50:24 +00:00
border-radius: ${dt('inputswitch.border.radius')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 0 none;
2024-04-07 10:21:03 +00:00
background: ${dt('inputswitch.background')};
2024-03-13 18:50:24 +00:00
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
border-radius: ${dt('inputswitch.border.radius')};
outline-color: transparent;
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch-slider:before {
position: absolute;
content: "";
top: 50%;
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.handle.background')};
width: 1rem;
height: 1rem;
left: 0.25rem;
margin-top: -0.5rem;
2024-04-01 12:55:29 +00:00
border-radius: ${dt('inputswitch.handle.border.radius')};
transition: all ${dt('transition.duration')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch.p-toggleswitch-checked .p-toggleswitch-slider {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.checked.background')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch.p-toggleswitch-checked .p-toggleswitch-slider:before {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.handle.checked.background')};
left: 1.25rem;
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) .p-toggleswitch-slider {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.hover.background')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) .p-toggleswitch-slider:before {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.handle.hover.background')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked .p-toggleswitch-slider {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.checked.hover.background')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked .p-toggleswitch-slider:before {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.handle.checked.hover.background')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:focus-visible) .p-toggleswitch-slider {
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')};
outline-offset: ${dt('focus.ring.offset')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch.p-invalid > .p-toggleswitch-slider {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.invalid.background')};
}
2024-04-07 10:21:03 +00:00
.p-toggleswitch.p-invalid > .p-toggleswitch-slider:before {
2024-03-13 18:50:24 +00:00
background: ${dt('inputswitch.handle.invalid.background')};
}
`
};