feat(ui): 계좌/분류 선택을 바텀시트로 (정기결제 폼)
Deploy / deploy (push) Failing after 13m8s

- BottomSheet.vue: 아래에서 올라오는 콘텐츠 높이 시트(재사용)
- SheetSelect.vue: 필드형 트리거 → 바텀시트 단일 선택(계좌/카드)
- 정기결제 폼: 계좌는 SheetSelect, 분류는 트리거 → 시트 안 CategoryPicker
  (선택 전에는 목록 미노출, 선택 시 값 채움)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
sb
2026-07-09 22:53:23 +09:00
parent ed607e1cda
commit d20d3c3027
3 changed files with 260 additions and 6 deletions
+93
View File
@@ -0,0 +1,93 @@
<script setup>
// 아래에서 올라오는 바텀시트(콘텐츠 높이). 선택 항목(계좌·분류 등)에 사용.
defineProps({
modelValue: { type: Boolean, required: true },
title: { type: String, default: '' },
})
defineEmits(['update:modelValue'])
</script>
<template>
<Teleport to="body">
<Transition name="bs">
<div v-if="modelValue" class="bs-wrap" @click.self="$emit('update:modelValue', false)">
<div class="bs-panel" role="dialog" aria-modal="true">
<div class="bs-grip" @click="$emit('update:modelValue', false)"></div>
<div class="bs-head">
<span class="bs-title">{{ title }}</span>
<button type="button" class="bs-close" aria-label="닫기" @click="$emit('update:modelValue', false)">×</button>
</div>
<div class="bs-body"><slot /></div>
</div>
</div>
</Transition>
</Teleport>
</template>
<style scoped>
.bs-wrap {
position: fixed;
inset: 0;
z-index: 1100;
background: rgba(0, 0, 0, 0.4);
display: flex;
align-items: flex-end;
}
.bs-panel {
width: 100%;
max-width: 560px;
margin: 0 auto;
background: var(--color-background);
border-radius: 16px 16px 0 0;
max-height: 85vh;
overflow-y: auto;
padding: 0.4rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0));
box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}
.bs-grip {
width: 40px;
height: 4px;
border-radius: 2px;
background: var(--color-border);
margin: 0.4rem auto 0.2rem;
cursor: pointer;
}
.bs-head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.3rem 0 0.6rem;
}
.bs-title {
font-weight: 700;
font-size: 1rem;
}
.bs-close {
border: 0;
background: transparent;
font-size: 1.4rem;
line-height: 1;
color: var(--color-text);
cursor: pointer;
}
.bs-enter-active {
transition: background 0.2s ease;
}
.bs-leave-active {
transition: background 0.18s ease;
}
.bs-enter-from,
.bs-leave-to {
background: rgba(0, 0, 0, 0);
}
.bs-enter-active .bs-panel {
transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.bs-leave-active .bs-panel {
transition: transform 0.2s cubic-bezier(0.4, 0, 1, 1);
}
.bs-enter-from .bs-panel,
.bs-leave-to .bs-panel {
transform: translateY(100%);
}
</style>
+113
View File
@@ -0,0 +1,113 @@
<script setup>
// 필드형 트리거를 누르면 바텀시트로 옵션을 보여주고 단일 선택. (계좌·카드 선택 등)
import { computed, ref } from 'vue'
import BottomSheet from './BottomSheet.vue'
const props = defineProps({
modelValue: { type: [String, Number], default: '' },
options: { type: Array, default: () => [] }, // [{ value, label }]
placeholder: { type: String, default: '선택하세요' },
title: { type: String, default: '선택' },
disabled: { type: Boolean, default: false },
emptyText: { type: String, default: '선택할 항목이 없습니다' },
})
const emit = defineEmits(['update:modelValue'])
const open = ref(false)
const selected = computed(() => props.options.find((o) => o.value === props.modelValue) || null)
function pick(o) {
emit('update:modelValue', o.value)
open.value = false
}
</script>
<template>
<button
type="button" class="ss-trigger" :class="{ empty: !selected }"
:disabled="disabled" @click="open = true"
>
<span class="ss-label">{{ selected ? selected.label : placeholder }}</span>
<span class="ss-caret"></span>
</button>
<BottomSheet v-model="open" :title="title">
<ul v-if="options.length" class="ss-list">
<li v-for="o in options" :key="o.value">
<button
type="button" class="ss-opt" :class="{ active: o.value === modelValue }"
@click="pick(o)"
>
<span>{{ o.label }}</span>
<span v-if="o.value === modelValue" class="ss-check"></span>
</button>
</li>
</ul>
<p v-else class="ss-empty">{{ emptyText }}</p>
</BottomSheet>
</template>
<style scoped>
.ss-trigger {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
width: 100%;
padding: 0.55rem 0.75rem;
border: 1px solid var(--color-border);
border-radius: 6px;
background: var(--color-background-soft);
color: var(--color-text);
font-size: 0.9rem;
cursor: pointer;
text-align: left;
}
.ss-trigger:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.ss-trigger.empty .ss-label {
opacity: 0.5;
}
.ss-label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ss-caret {
opacity: 0.5;
font-size: 0.8rem;
flex-shrink: 0;
}
.ss-list {
list-style: none;
margin: 0;
padding: 0;
}
.ss-opt {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 0.85rem 0.4rem;
border: 0;
border-bottom: 1px solid var(--color-border);
background: transparent;
color: var(--color-text);
font-size: 0.95rem;
cursor: pointer;
text-align: left;
}
.ss-opt.active {
color: hsla(160, 100%, 37%, 1);
font-weight: 700;
}
.ss-check {
color: hsla(160, 100%, 37%, 1);
}
.ss-empty {
padding: 1.2rem 0.4rem;
opacity: 0.6;
text-align: center;
}
</style>