mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-03 09:17:28 +00:00
385969e9f5
* fix(frontend): 直前のパターンを記録するように * fix(frontend): フォーカス/タブ移動に関する挙動を調整 (#226) Cherry-pick commit e8c030673326871edf3623cf2b8675d68f9e1b13 Co-authored-by: taiyme <53635909+taiyme@users.noreply.github.com> * focusのデザイン修正 * move scripts * Modalにfocus trapを追加 * 記録するホットキーはレートリミット式にする * escキーのハンドリングをMkModalに統一 * fix * enterで子メニューを開けるように * lint * fix focus trap * improve switch accessibility * 一部のmodalのフォーカストラップが外れない問題を修正 * fix * fix * Revert "記録するホットキーはレートリミット式にする" This reverts commit 40a7509286a87911ad4cc06d9482e8a2e5d0e7e8. * Revert "fix(frontend): 直前のパターンを記録するように" This reverts commit 5372b2594023952cff34aa62253ed4efef15b5dd. * Revert "Revert "fix(frontend): 直前のパターンを記録するように"" This reverts commit a9bb52e799e110927ad92cd8f26af980819334e1. * Revert "Revert "記録するホットキーはレートリミット式にする"" This reverts commit bdac34273e0bc5f13604c7e2f9fa6b1321a0df3d. * 試験的にCypressでのFocustrapを無効化 * fix * fix focus-trap * Update Changelog * ✌️ * fix focustrap invocation logic * スクロールがsticky headerを考慮するように * 🎨 * スタイルの微調整 * 🎨 * remove deprecated key aliases * focusElementが足りなかったので修正 * preview系にfocus時スタイルが足りなかったので修正 * `returnFocusElement` -> `returnFocusTo` * lint * Update packages/frontend/src/components/MkModalWindow.vue * Apply suggestions from code review Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com> * keydownイベントをまとめる * use correct pesudo-element selector * fix * rename --------- Co-authored-by: taiyme <53635909+taiyme@users.noreply.github.com> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
134 lines
2.3 KiB
Vue
134 lines
2.3 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div
|
|
v-adaptive-border
|
|
:class="[$style.root, { [$style.disabled]: disabled, [$style.checked]: checked }]"
|
|
:aria-checked="checked"
|
|
:aria-disabled="disabled"
|
|
role="checkbox"
|
|
@click="toggle"
|
|
>
|
|
<input
|
|
type="radio"
|
|
:disabled="disabled"
|
|
:class="$style.input"
|
|
>
|
|
<span :class="$style.button">
|
|
<span></span>
|
|
</span>
|
|
<span :class="$style.label"><slot></slot></span>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from 'vue';
|
|
|
|
const props = defineProps<{
|
|
modelValue: any;
|
|
value: any;
|
|
disabled?: boolean;
|
|
}>();
|
|
|
|
const emit = defineEmits<{
|
|
(ev: 'update:modelValue', value: any): void;
|
|
}>();
|
|
|
|
const checked = computed(() => props.modelValue === props.value);
|
|
|
|
function toggle(): void {
|
|
if (props.disabled) return;
|
|
emit('update:modelValue', props.value);
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
position: relative;
|
|
display: inline-block;
|
|
text-align: left;
|
|
cursor: pointer;
|
|
padding: 7px 10px;
|
|
min-width: 60px;
|
|
background-color: var(--panel);
|
|
background-clip: padding-box !important;
|
|
border: solid 1px var(--panel);
|
|
border-radius: 6px;
|
|
font-size: 90%;
|
|
transition: all 0.2s;
|
|
user-select: none;
|
|
|
|
&.disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed !important;
|
|
}
|
|
|
|
&:hover {
|
|
border-color: var(--inputBorderHover) !important;
|
|
}
|
|
|
|
&:focus-within {
|
|
outline: none;
|
|
box-shadow: 0 0 0 2px var(--focus);
|
|
}
|
|
|
|
&.checked {
|
|
background-color: var(--accentedBg) !important;
|
|
border-color: var(--accentedBg) !important;
|
|
color: var(--accent);
|
|
cursor: default !important;
|
|
|
|
> .button {
|
|
border-color: var(--accent);
|
|
|
|
&::after {
|
|
background-color: var(--accent);
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.input {
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0;
|
|
opacity: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.button {
|
|
position: absolute;
|
|
width: 14px;
|
|
height: 14px;
|
|
background: none;
|
|
border: solid 2px var(--inputBorder);
|
|
border-radius: 100%;
|
|
transition: inherit;
|
|
|
|
&::after {
|
|
content: '';
|
|
display: block;
|
|
position: absolute;
|
|
top: 3px;
|
|
right: 3px;
|
|
bottom: 3px;
|
|
left: 3px;
|
|
border-radius: 100%;
|
|
opacity: 0;
|
|
transform: scale(0);
|
|
transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
|
}
|
|
}
|
|
|
|
.label {
|
|
margin-left: 28px;
|
|
display: block;
|
|
line-height: 20px;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|