Files
app/src/lib/pages/print/FormatPicker.svelte

80 lines
2.0 KiB
Svelte
Raw Normal View History

2026-09-14 08:59:58 +03:00
<!--
Плавающий минималистичный виджет выбора формата листа.
Открывается поверх окна; клик по фону или выбор — закрывает.
-->
<script>
let {
open = $bindable(false),
options = [],
selected = '',
onselect = null,
} = $props();
function pick(v) {
onselect?.(v);
open = false;
}
</script>
{#if open}
<div class="overlay" role="dialog" aria-modal="true" onclick={() => (open = false)}>
<div class="picker" onclick={(e) => e.stopPropagation()}>
<p class="picker-title">Формат листа</p>
<div class="picker-grid">
{#each options as f (f)}
<button type="button" class="pick-btn" class:active={f === selected} onclick={() => pick(f)}>
{f}
</button>
{/each}
</div>
</div>
</div>
{/if}
<style>
.overlay {
position: fixed;
inset: 0;
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.45);
}
.picker {
min-width: 260px;
padding: 16px;
border-radius: 16px;
background: #16171d;
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.picker-title {
margin: 0 0 12px;
font-size: 13px;
font-weight: 600;
color: #8b93a1;
text-transform: uppercase;
letter-spacing: 0.05em;
text-align: center;
}
.picker-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
.pick-btn {
padding: 12px 8px;
border-radius: 14px;
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(255, 255, 255, 0.05);
color: #f5f7fa;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.18s ease;
}
.pick-btn.active { background: rgba(99, 102, 241, 0.25); border-color: #6366f1; color: #fff; }
.pick-btn:not(.active):hover { background: rgba(255, 255, 255, 0.09); }
</style>