2026-10-04 13:57:25 +03:30
|
|
|
|
<!--
|
2026-10-04 16:18:56 +03:30
|
|
|
|
The app's confirm/notice action sheet (logout, place order, sign in, update,
|
|
|
|
|
|
done).
|
2026-10-04 13:57:25 +03:30
|
|
|
|
|
|
|
|
|
|
Replaces DialogVant / DialogVantOneButton (centered Vant dialogs whose
|
2026-10-04 16:18:56 +03:30
|
|
|
|
content was poured into img/title/button slots).
|
2026-10-04 13:57:25 +03:30
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
RESTYLED into user-app-v2's own design language. It used to be a floating
|
|
|
|
|
|
island inset from the screen edges, with a tinted dot-grid header, dashed
|
|
|
|
|
|
rings, twinkling sparks, gradient buttons with a sheen and a per-sheet
|
|
|
|
|
|
colour (navy / gold / green) — none of which appears anywhere else in this
|
|
|
|
|
|
app. It now uses the same parts as the rest of v2:
|
|
|
|
|
|
- a white sheet attached to the bottom edge, with the 32px top radius and
|
|
|
|
|
|
grip of the product detail sheet and the search filter sheet;
|
|
|
|
|
|
- the illustration centred on a borderless @hairlineSoft panel — the
|
|
|
|
|
|
ProductPanel / catalogue-card treatment of a piece of jewellery;
|
|
|
|
|
|
- a centred title and description under it, as on those cards;
|
|
|
|
|
|
- the detail page's action bar: an outlined pill beside a filled pill.
|
|
|
|
|
|
The filled pill is @ink, or @wine for the destructive tone (logout).
|
|
|
|
|
|
The component name, props, events and illustrations are unchanged, so no
|
|
|
|
|
|
call site had to change.
|
|
|
|
|
|
|
|
|
|
|
|
Usage:
|
2026-10-04 13:57:25 +03:30
|
|
|
|
|
|
|
|
|
|
<IslandSheet
|
|
|
|
|
|
v-model:show="open"
|
|
|
|
|
|
art="logout"
|
|
|
|
|
|
title="..."
|
|
|
|
|
|
description="..."
|
|
|
|
|
|
confirm-text="بله"
|
|
|
|
|
|
cancel-text="بی خیال"
|
|
|
|
|
|
@confirm="doIt"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
- `art` picks an illustration from SheetArt, and with it the sheet's tone
|
2026-10-04 16:18:56 +03:30
|
|
|
|
(the filled button's colour); `tone` overrides it. An `#art` slot can
|
2026-10-04 13:57:25 +03:30
|
|
|
|
replace the illustration entirely.
|
2026-10-04 16:18:56 +03:30
|
|
|
|
- No `cancel-text` → a single, full-width button.
|
2026-10-04 13:57:25 +03:30
|
|
|
|
- `closeOnClickOverlay` (default true) also governs swipe-down-to-dismiss;
|
|
|
|
|
|
with it off the sheet can only be left through its own buttons, and a
|
|
|
|
|
|
swipe just rubber-bands. No close (×) button: cancel, the backdrop and
|
|
|
|
|
|
the swipe already cover it.
|
2026-10-04 16:18:56 +03:30
|
|
|
|
- Performance: the illustration's own animations are held paused until the
|
|
|
|
|
|
slide-in has finished (`is-ready`, set on Vant's `opened`), so the slide has
|
|
|
|
|
|
the frame budget to itself; nothing uses backdrop-filter (blurring the page
|
|
|
|
|
|
behind a fading overlay recomputes every frame and was the main source of
|
|
|
|
|
|
jank on phones).
|
2026-10-04 13:57:25 +03:30
|
|
|
|
- Cancel closes the sheet itself and emits `cancel`; confirm only emits
|
|
|
|
|
|
`confirm` — the caller decides whether it closes (e.g. a redirect).
|
|
|
|
|
|
-->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<Popup
|
|
|
|
|
|
:show="show"
|
|
|
|
|
|
position="bottom"
|
|
|
|
|
|
teleport="body"
|
|
|
|
|
|
transition="iSheet-slide"
|
|
|
|
|
|
transition-appear
|
|
|
|
|
|
class="iSheet"
|
|
|
|
|
|
overlay-class="iSheet__overlay"
|
|
|
|
|
|
:close-on-click-overlay="closeOnClickOverlay"
|
|
|
|
|
|
close-on-popstate
|
|
|
|
|
|
@update:show="emit('update:show', $event)"
|
|
|
|
|
|
@opened="ready = true"
|
|
|
|
|
|
@closed="onClosed"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="iSheet__card"
|
2026-10-04 16:18:56 +03:30
|
|
|
|
:class="[`iSheet--${resolvedTone}`, { 'is-dragging': dragging, 'is-ready': ready, 'is-single': !cancelText }]"
|
2026-10-04 13:57:25 +03:30
|
|
|
|
:style="cardStyle"
|
|
|
|
|
|
dir="rtl"
|
|
|
|
|
|
role="dialog"
|
|
|
|
|
|
aria-modal="true"
|
|
|
|
|
|
@touchstart.passive="onTouchStart"
|
|
|
|
|
|
@touchmove.passive="onTouchMove"
|
|
|
|
|
|
@touchend="onTouchEnd"
|
|
|
|
|
|
@touchcancel="onTouchEnd"
|
|
|
|
|
|
>
|
2026-10-04 16:18:56 +03:30
|
|
|
|
<span class="iSheet__grip" aria-hidden="true"></span>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="iSheet__panel">
|
2026-10-04 13:57:25 +03:30
|
|
|
|
<div class="iSheet__art">
|
|
|
|
|
|
<slot name="art">
|
|
|
|
|
|
<SheetArt v-if="art" :name="art" />
|
|
|
|
|
|
</slot>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="iSheet__title">{{ title }}</h3>
|
|
|
|
|
|
<p v-if="description" class="iSheet__desc">{{ description }}</p>
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
<!-- The detail page's bar order: the secondary pill first in markup, so
|
|
|
|
|
|
RTL lays it on the right, and the filled pill fills the rest. -->
|
2026-10-04 13:57:25 +03:30
|
|
|
|
<div class="iSheet__actions">
|
|
|
|
|
|
<button v-if="cancelText" type="button" class="iSheet__btn iSheet__btn--ghost" @click="cancel">
|
|
|
|
|
|
{{ cancelText }}
|
|
|
|
|
|
</button>
|
2026-10-04 16:18:56 +03:30
|
|
|
|
<button type="button" class="iSheet__btn iSheet__btn--primary" @click="emit('confirm')">
|
|
|
|
|
|
{{ confirmText }}
|
|
|
|
|
|
</button>
|
2026-10-04 13:57:25 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Popup>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
|
import { Popup } from 'vant'
|
|
|
|
|
|
import SheetArt, { type SheetArtName } from './SheetArt.vue'
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// Kept as the original five for API compatibility; v2 renders them as two
|
|
|
|
|
|
// looks — destructive (wine) and everything else (ink). See the styles.
|
2026-10-04 13:57:25 +03:30
|
|
|
|
type Tone = 'ink' | 'wine' | 'navy' | 'gold' | 'green'
|
|
|
|
|
|
|
|
|
|
|
|
const props = withDefaults(
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
|
show: boolean
|
|
|
|
|
|
title: string
|
|
|
|
|
|
description?: string
|
|
|
|
|
|
confirmText: string
|
|
|
|
|
|
cancelText?: string
|
|
|
|
|
|
art?: SheetArtName
|
|
|
|
|
|
tone?: Tone
|
|
|
|
|
|
closeOnClickOverlay?: boolean
|
|
|
|
|
|
}>(),
|
|
|
|
|
|
{ closeOnClickOverlay: true },
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
|
(e: 'update:show', value: boolean): void
|
|
|
|
|
|
(e: 'confirm'): void
|
|
|
|
|
|
(e: 'cancel'): void
|
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
const artTone: Record<SheetArtName, Tone> = {
|
|
|
|
|
|
logout: 'wine',
|
|
|
|
|
|
login: 'navy',
|
|
|
|
|
|
order: 'gold',
|
|
|
|
|
|
update: 'navy',
|
|
|
|
|
|
success: 'green',
|
|
|
|
|
|
}
|
|
|
|
|
|
const resolvedTone = computed<Tone>(() => props.tone ?? (props.art ? artTone[props.art] : 'ink'))
|
|
|
|
|
|
|
|
|
|
|
|
const ready = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
function close() {
|
|
|
|
|
|
emit('update:show', false)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onClosed() {
|
|
|
|
|
|
ready.value = false
|
|
|
|
|
|
dragY.value = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function cancel() {
|
|
|
|
|
|
emit('cancel')
|
|
|
|
|
|
close()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Swipe down to dismiss. Only the card moves while dragging; on release it
|
|
|
|
|
|
// either springs back or the popup's own leave transition carries it off
|
|
|
|
|
|
// from wherever the finger left it (reset once fully closed).
|
|
|
|
|
|
const DISMISS_DISTANCE = 90
|
|
|
|
|
|
const DISMISS_VELOCITY = 0.5 // px per ms
|
|
|
|
|
|
|
|
|
|
|
|
const dragY = ref(0)
|
|
|
|
|
|
const dragging = ref(false)
|
|
|
|
|
|
let startY = 0
|
|
|
|
|
|
let startTime = 0
|
|
|
|
|
|
|
|
|
|
|
|
const cardStyle = computed(() =>
|
|
|
|
|
|
dragY.value ? { transform: `translate3d(0, ${dragY.value}px, 0)` } : undefined,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
function onTouchStart(e: TouchEvent) {
|
|
|
|
|
|
if ((e.target as HTMLElement).closest('button')) return
|
|
|
|
|
|
startY = e.touches[0].clientY
|
|
|
|
|
|
startTime = Date.now()
|
|
|
|
|
|
dragging.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onTouchMove(e: TouchEvent) {
|
|
|
|
|
|
if (!dragging.value) return
|
|
|
|
|
|
const dy = e.touches[0].clientY - startY
|
|
|
|
|
|
// Downward follows the finger when dismissable, otherwise rubber-bands;
|
|
|
|
|
|
// upward always rubber-bands.
|
|
|
|
|
|
dragY.value = dy > 0 ? (props.closeOnClickOverlay ? dy : dy * 0.2) : dy * 0.12
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onTouchEnd() {
|
|
|
|
|
|
if (!dragging.value) return
|
|
|
|
|
|
dragging.value = false
|
|
|
|
|
|
const velocity = dragY.value / Math.max(1, Date.now() - startTime)
|
|
|
|
|
|
if (props.closeOnClickOverlay && (dragY.value > DISMISS_DISTANCE || (dragY.value > 30 && velocity > DISMISS_VELOCITY))) {
|
|
|
|
|
|
close()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
dragY.value = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
|
// Global, not scoped: the popup is teleported to <body>.
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// See-through dim, no blur — the same backdrop as the filter sheet.
|
2026-10-04 13:57:25 +03:30
|
|
|
|
.iSheet__overlay {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
background: rgba(20, 22, 26, 0.42);
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.iSheet.van-popup {
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
overflow: visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The iOS sheet curve: fast out of the gate, long soft landing. Transform
|
|
|
|
|
|
// only, on its own compositor layer, so it never waits on paint.
|
|
|
|
|
|
.iSheet-slide-enter-active,
|
|
|
|
|
|
.iSheet-slide-leave-active {
|
|
|
|
|
|
will-change: transform;
|
|
|
|
|
|
}
|
|
|
|
|
|
.iSheet-slide-enter-active {
|
|
|
|
|
|
transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
.iSheet-slide-leave-active {
|
|
|
|
|
|
transition: transform 0.24s cubic-bezier(0.4, 0, 1, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
.iSheet-slide-enter-from,
|
|
|
|
|
|
.iSheet-slide-leave-to {
|
|
|
|
|
|
transform: translate3d(0, 100%, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// Hold the illustration's animations until the sheet has landed.
|
|
|
|
|
|
.iSheet__card:not(.is-ready) *,
|
|
|
|
|
|
.iSheet__card:not(.is-ready) *::after {
|
|
|
|
|
|
animation-play-state: paused !important;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// Two looks, one per job: the filled button is @wine for the destructive
|
|
|
|
|
|
// action (logout) and @ink — the app's primary surface — for everything else.
|
|
|
|
|
|
.iSheet__card {
|
|
|
|
|
|
--t: @ink;
|
|
|
|
|
|
--t-on: @onInk;
|
|
|
|
|
|
--t-rgb: 20, 22, 26;
|
|
|
|
|
|
}
|
2026-10-04 13:57:25 +03:30
|
|
|
|
.iSheet--wine {
|
|
|
|
|
|
--t: @wine;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
--t-on: #fff;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
--t-rgb: 122, 27, 51;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// The detail page's / filter sheet's shell: white, attached to the bottom
|
|
|
|
|
|
// edge, 32px top radius, a centred column on wide screens.
|
2026-10-04 13:57:25 +03:30
|
|
|
|
.iSheet__card {
|
|
|
|
|
|
position: relative;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
max-width: 768px;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
margin: 0 auto;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px));
|
|
|
|
|
|
border-radius: 32px 32px 0 0;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
background: @canvas;
|
|
|
|
|
|
text-align: center;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
box-shadow: 0 -18px 40px -30px rgba(20, 22, 26, 0.55);
|
2026-10-04 13:57:25 +03:30
|
|
|
|
transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
|
|
|
|
|
|
touch-action: none;
|
|
|
|
|
|
|
|
|
|
|
|
&.is-dragging {
|
|
|
|
|
|
transition: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
.iSheet__grip {
|
|
|
|
|
|
display: block;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
width: 38px;
|
|
|
|
|
|
height: 4px;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
margin: 0 auto 12px;
|
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
|
background: @hairline;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// The ProductPanel treatment: the subject centred on a borderless soft-grey
|
|
|
|
|
|
// panel at the catalogue cards' 32px radius (one step in, 26px, since it sits
|
|
|
|
|
|
// inside the sheet's own 32px corner).
|
|
|
|
|
|
.iSheet__panel {
|
|
|
|
|
|
height: 150px;
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
place-items: center;
|
|
|
|
|
|
border-radius: 26px;
|
|
|
|
|
|
background: @hairlineSoft;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.iSheet__art {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
width: 112px;
|
|
|
|
|
|
height: 112px;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
|
|
|
|
|
|
> img,
|
|
|
|
|
|
> svg,
|
|
|
|
|
|
> canvas {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Every element sets its own font-size: style.less's `*` rule pins each one
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// to 14px, so nothing inherits. Sizes are the detail page's: 16px for the
|
|
|
|
|
|
// heading (its section titles), 12.5px / line-height 2 for body copy.
|
2026-10-04 13:57:25 +03:30
|
|
|
|
.iSheet__title {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
margin: 18px 8px 0;
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: 700;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
line-height: 1.75;
|
|
|
|
|
|
color: @ink;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.iSheet__desc {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
margin: 6px 12px 0;
|
|
|
|
|
|
font-size: 12.5px;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
line-height: 2;
|
|
|
|
|
|
color: @inkMuted;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.iSheet__actions {
|
|
|
|
|
|
display: flex;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
margin-top: 20px;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Scoped under the card on purpose: Tailwind's preflight resets
|
|
|
|
|
|
// `[type='button']` to a transparent, image-less background with the same
|
|
|
|
|
|
// specificity as a single class, and App.vue (which uses this sheet) is
|
|
|
|
|
|
// imported before main.ts loads tailwind.css — so a bare `.iSheet__btn--primary`
|
|
|
|
|
|
// loses on source order and the button renders white-on-white.
|
|
|
|
|
|
.iSheet__card .iSheet__btn {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
height: 48px;
|
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
|
font-family: inherit;
|
|
|
|
|
|
font-size: 13.5px;
|
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
|
white-space: nowrap;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
-webkit-tap-highlight-color: transparent;
|
2026-10-04 16:18:56 +03:30
|
|
|
|
transition: transform 0.18s ease, background-color 0.18s ease;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
|
|
|
|
|
|
&:active {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
transform: scale(0.98);
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// The detail page's outlined pill.
|
2026-10-04 13:57:25 +03:30
|
|
|
|
&--ghost {
|
2026-10-04 16:18:56 +03:30
|
|
|
|
flex: 0 0 auto;
|
|
|
|
|
|
min-width: 108px;
|
|
|
|
|
|
padding: 0 22px;
|
|
|
|
|
|
color: @ink;
|
|
|
|
|
|
background: @canvas;
|
|
|
|
|
|
border: 1px solid @hairline;
|
2026-10-04 13:57:25 +03:30
|
|
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
|
|
background: @hairlineSoft;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 16:18:56 +03:30
|
|
|
|
// The detail page's primary pill.
|
|
|
|
|
|
&--primary {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
padding: 0 18px;
|
|
|
|
|
|
border: 0;
|
|
|
|
|
|
color: var(--t-on);
|
|
|
|
|
|
background: var(--t);
|
|
|
|
|
|
box-shadow: 0 14px 30px -18px rgba(var(--t-rgb), 0.9);
|
|
|
|
|
|
}
|
2026-10-04 13:57:25 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
|
|
|
|
.iSheet-slide-enter-active,
|
|
|
|
|
|
.iSheet-slide-leave-active {
|
|
|
|
|
|
transition-duration: 0.01s;
|
|
|
|
|
|
}
|
|
|
|
|
|
.iSheet__card *,
|
|
|
|
|
|
.iSheet__card *::after {
|
|
|
|
|
|
animation: none !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|