You've already forked AstralRinth
forked from didirus/AstralRinth
* fix tauri config * fix package patch * regen pnpm lock * use new workflow * New GH actions * Update lockfile * update scripts * Fix build script * Fix missing deps * Fix assets eslint * Update libraries lint * Fix all lint configs * update lockfile * add fmt + clippy fails * Separate App Tauri portion * fix app features * Fix lints * install tauri cli * update lockfile * corepack, fix lints * add store path * fix unused import * Fix tests * Issue templates + port over tauri release * fix actions * fix before build command * Add X86 target * Update build matrix * finalize actions * make debug build smaller * Use debug build to make cache smaller * dummy commit * change proj name * update file name * Use release builds for less space use * Remove rust cache * Readd for app build * add merge queue trigger
136 lines
2.5 KiB
Vue
136 lines
2.5 KiB
Vue
<template>
|
|
<div
|
|
class="checkbox-outer button-within"
|
|
:class="{ disabled }"
|
|
role="presentation"
|
|
@click="toggle"
|
|
>
|
|
<button
|
|
class="checkbox"
|
|
role="checkbox"
|
|
:disabled="disabled"
|
|
:class="{ checked: modelValue, collapsing: collapsingToggleStyle }"
|
|
:aria-label="description"
|
|
:aria-checked="modelValue"
|
|
>
|
|
<CheckIcon v-if="modelValue && !collapsingToggleStyle" aria-hidden="true" />
|
|
<DropdownIcon v-else-if="collapsingToggleStyle" aria-hidden="true" />
|
|
</button>
|
|
<!-- aria-hidden is set so screenreaders only use the <button>'s aria-label -->
|
|
<p v-if="label" aria-hidden="true">
|
|
{{ label }}
|
|
</p>
|
|
<slot v-else />
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { CheckIcon, DropdownIcon } from '@modrinth/assets'
|
|
|
|
const emit = defineEmits<{
|
|
'update:modelValue': [boolean]
|
|
}>()
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
label: string
|
|
disabled?: boolean
|
|
description: string
|
|
modelValue: boolean
|
|
clickEvent?: () => void
|
|
collapsingToggleStyle?: boolean
|
|
}>(),
|
|
{
|
|
label: '',
|
|
disabled: false,
|
|
description: '',
|
|
modelValue: false,
|
|
clickEvent: () => {},
|
|
collapsingToggleStyle: false,
|
|
},
|
|
)
|
|
|
|
function toggle() {
|
|
if (!props.disabled) {
|
|
emit('update:modelValue', !props.modelValue)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.checkbox-outer {
|
|
display: flex;
|
|
align-items: center;
|
|
cursor: pointer;
|
|
|
|
p {
|
|
user-select: none;
|
|
padding: 0.2rem 0;
|
|
margin: 0;
|
|
}
|
|
|
|
&.disabled {
|
|
cursor: not-allowed;
|
|
}
|
|
}
|
|
|
|
.checkbox {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
outline: none;
|
|
|
|
min-width: 1rem;
|
|
min-height: 1rem;
|
|
|
|
padding: 0;
|
|
margin: 0 0.5rem 0 0;
|
|
|
|
color: var(--color-contrast);
|
|
background-color: var(--color-button-bg);
|
|
border-radius: var(--radius-xs);
|
|
box-shadow:
|
|
var(--shadow-inset-sm),
|
|
0 0 0 0 transparent;
|
|
|
|
&.checked {
|
|
background-color: var(--color-brand);
|
|
}
|
|
|
|
svg {
|
|
color: var(--color-accent-contrast);
|
|
stroke-width: 0.2rem;
|
|
height: 0.8rem;
|
|
width: 0.8rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
&.collapsing {
|
|
background-color: transparent !important;
|
|
box-shadow: none;
|
|
|
|
svg {
|
|
color: inherit;
|
|
height: 1rem;
|
|
width: 1rem;
|
|
transition: transform 0.25s ease-in-out;
|
|
|
|
@media (prefers-reduced-motion) {
|
|
transition: none !important;
|
|
}
|
|
}
|
|
|
|
&.checked {
|
|
svg {
|
|
transform: rotate(180deg);
|
|
}
|
|
}
|
|
}
|
|
|
|
&:disabled {
|
|
box-shadow: none;
|
|
cursor: not-allowed;
|
|
}
|
|
}
|
|
</style>
|