2021-09-30 00:50:45 +09:00
|
|
|
<template>
|
|
|
|
<div class="ijnpvmgr _debobigegoItem">
|
|
|
|
<div class="main _debobigegoPanel _debobigegoClickable"
|
|
|
|
:class="{ disabled, checked }"
|
|
|
|
:aria-checked="checked"
|
|
|
|
:aria-disabled="disabled"
|
|
|
|
@click.prevent="toggle"
|
|
|
|
>
|
|
|
|
<input
|
|
|
|
ref="input"
|
2021-11-19 19:36:12 +09:00
|
|
|
type="checkbox"
|
2021-09-30 00:50:45 +09:00
|
|
|
:disabled="disabled"
|
|
|
|
@keydown.enter="toggle"
|
|
|
|
>
|
2021-11-19 19:36:12 +09:00
|
|
|
<span v-tooltip="checked ? $ts.itsOn : $ts.itsOff" class="button">
|
2021-09-30 01:13:54 +09:00
|
|
|
<span class="handle"></span>
|
2021-09-30 00:50:45 +09:00
|
|
|
</span>
|
|
|
|
<span class="label">
|
|
|
|
<span><slot></slot></span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="_debobigegoCaption"><slot name="desc"></slot></div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import './debobigego.scss';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
props: {
|
|
|
|
modelValue: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
checked(): boolean {
|
|
|
|
return this.modelValue;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggle() {
|
|
|
|
if (this.disabled) return;
|
|
|
|
this.$emit('update:modelValue', !this.checked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ijnpvmgr {
|
|
|
|
> .main {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
padding: 14px 16px;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
> * {
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> input {
|
|
|
|
position: absolute;
|
|
|
|
width: 0;
|
|
|
|
height: 0;
|
|
|
|
opacity: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .button {
|
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
flex-shrink: 0;
|
2021-09-30 01:13:54 +09:00
|
|
|
margin: 0;
|
2021-09-30 00:50:45 +09:00
|
|
|
width: 34px;
|
2021-09-30 01:13:54 +09:00
|
|
|
height: 22px;
|
|
|
|
background: var(--switchBg);
|
2021-09-30 00:50:45 +09:00
|
|
|
outline: none;
|
2021-09-30 01:13:54 +09:00
|
|
|
border-radius: 999px;
|
2021-09-30 00:50:45 +09:00
|
|
|
transition: all 0.3s;
|
|
|
|
cursor: pointer;
|
|
|
|
|
2021-09-30 01:13:54 +09:00
|
|
|
> .handle {
|
2021-09-30 00:50:45 +09:00
|
|
|
position: absolute;
|
2021-09-30 01:13:54 +09:00
|
|
|
top: 0;
|
|
|
|
left: 3px;
|
|
|
|
bottom: 0;
|
|
|
|
margin: auto 0;
|
2021-09-30 00:50:45 +09:00
|
|
|
border-radius: 100%;
|
|
|
|
transition: background-color 0.3s, transform 0.3s;
|
2021-09-30 01:13:54 +09:00
|
|
|
width: 16px;
|
|
|
|
height: 16px;
|
2021-09-30 00:50:45 +09:00
|
|
|
background-color: #fff;
|
2021-10-03 15:39:39 +09:00
|
|
|
pointer-events: none;
|
2021-09-30 00:50:45 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .label {
|
|
|
|
margin-left: 12px;
|
|
|
|
display: block;
|
|
|
|
transition: inherit;
|
|
|
|
color: var(--fg);
|
|
|
|
|
|
|
|
> span {
|
|
|
|
display: block;
|
|
|
|
line-height: 20px;
|
|
|
|
transition: inherit;
|
|
|
|
}
|
|
|
|
}
|
2021-09-30 01:13:54 +09:00
|
|
|
|
|
|
|
&.disabled {
|
|
|
|
opacity: 0.6;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.checked {
|
|
|
|
> .button {
|
|
|
|
background-color: var(--accent);
|
|
|
|
|
|
|
|
> .handle {
|
|
|
|
transform: translateX(12px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-30 00:50:45 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|