@m3ui-vue/m3ui-vue 1.3.7 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +1097 -26
- package/dist/{MButton-D5eJiDza.js → MButton-DQMTIlaV.js} +2 -2
- package/dist/{MButton-D5eJiDza.js.map → MButton-DQMTIlaV.js.map} +1 -1
- package/dist/{MDialog-WqB0jewp.js → MDialog-cdgapGfZ.js} +2 -2
- package/dist/{MDialog-WqB0jewp.js.map → MDialog-cdgapGfZ.js.map} +1 -1
- package/dist/{MListItem-Cf-C2Ru-.js → MListItem-ZkSGIIrb.js} +2 -2
- package/dist/{MListItem-Cf-C2Ru-.js.map → MListItem-ZkSGIIrb.js.map} +1 -1
- package/dist/{MLoadingIndicator-D4GzEZoH.js → MLoadingIndicator-U6_oGx8z.js} +2 -2
- package/dist/{MLoadingIndicator-D4GzEZoH.js.map → MLoadingIndicator-U6_oGx8z.js.map} +1 -1
- package/dist/{MSeekBar-B19xoWE3.js → MSeekBar-DTZVizZg.js} +2 -2
- package/dist/{MSeekBar-B19xoWE3.js.map → MSeekBar-DTZVizZg.js.map} +1 -1
- package/dist/{MSlider-9RoiuebS.js → MSlider-CqJkEYRZ.js} +2 -2
- package/dist/{MSlider-9RoiuebS.js.map → MSlider-CqJkEYRZ.js.map} +1 -1
- package/dist/{MSpinner-BNF8MN-L.js → MSpinner-Btgc-0nb.js} +2 -2
- package/dist/{MSpinner-BNF8MN-L.js.map → MSpinner-Btgc-0nb.js.map} +1 -1
- package/dist/{MTextField-CuG0T3qh.js → MTextField-B6M0gJEO.js} +2 -2
- package/dist/{MTextField-CuG0T3qh.js.map → MTextField-B6M0gJEO.js.map} +1 -1
- package/dist/{MTooltip-Bv7yxngk.js → MTooltip-Dspji4XG.js} +4 -4
- package/dist/{MTooltip-Bv7yxngk.js.map → MTooltip-Dspji4XG.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +2 -2
- package/dist/components/MAvailabilityCalendar.vue.d.ts +83 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBeforeAfter.vue.d.ts +61 -0
- package/dist/components/MBodyMap.vue.d.ts +70 -0
- package/dist/components/MCandlestickChart.vue.d.ts +82 -0
- package/dist/components/MCertificate.vue.d.ts +76 -0
- package/dist/components/MCreditCardInput.vue.d.ts +75 -0
- package/dist/components/MFlow.vue.d.ts +13 -0
- package/dist/components/MMortgageCalculator.vue.d.ts +83 -0
- package/dist/components/MOdontogram.vue.d.ts +86 -0
- package/dist/components/MOrderBook.vue.d.ts +89 -0
- package/dist/components/MOrderTicket.vue.d.ts +91 -0
- package/dist/components/MPosKeypad.vue.d.ts +84 -0
- package/dist/components/MProductConfigurator.vue.d.ts +136 -0
- package/dist/components/MQuiz.vue.d.ts +102 -0
- package/dist/components/MReceipt.vue.d.ts +93 -0
- package/dist/components/MSeatMap.vue.d.ts +131 -0
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MTicket.vue.d.ts +83 -0
- package/dist/components/MTour.vue.d.ts +52 -2
- package/dist/components/MVideoPlayer.vue.d.ts +1 -1
- package/dist/components/MVitalsChart.vue.d.ts +73 -0
- package/dist/composables/_printElement.d.ts +9 -0
- package/dist/composables/cardBrand.d.ts +25 -0
- package/dist/composables/flowPaths.d.ts +11 -3
- package/dist/composables/mortgage.d.ts +37 -0
- package/dist/composables/useFlow.d.ts +4 -0
- package/dist/composables/useLocale.d.ts +131 -0
- package/dist/draw.js +2 -2
- package/dist/flow.d.ts +1 -1
- package/dist/flow.js +526 -434
- package/dist/flow.js.map +1 -1
- package/dist/{flowPaths-DzW-aiET.js → flowPaths-CcWOKY4Z.js} +5 -5
- package/dist/flowPaths-CcWOKY4Z.js.map +1 -0
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +35 -0
- package/dist/locales/index.js +924 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +8393 -3613
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +5 -5
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/{useLocale-D2ucaY-l.js → useLocale-DLKJIRFi.js} +133 -2
- package/dist/useLocale-DLKJIRFi.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MAvailabilityCalendar.test.ts +85 -0
- package/src/__tests__/MBeforeAfter.test.ts +79 -0
- package/src/__tests__/MBodyMap.test.ts +60 -0
- package/src/__tests__/MCandlestickChart.test.ts +66 -0
- package/src/__tests__/MCertificate.test.ts +32 -0
- package/src/__tests__/MCreditCardInput.test.ts +122 -0
- package/src/__tests__/MFlow.test.ts +69 -0
- package/src/__tests__/MMortgageCalculator.test.ts +49 -0
- package/src/__tests__/MOdontogram.test.ts +93 -0
- package/src/__tests__/MOrderBook.test.ts +66 -0
- package/src/__tests__/MOrderTicket.test.ts +68 -0
- package/src/__tests__/MPosKeypad.test.ts +116 -0
- package/src/__tests__/MProductConfigurator.test.ts +73 -0
- package/src/__tests__/MQuiz.test.ts +104 -0
- package/src/__tests__/MReceipt.test.ts +52 -0
- package/src/__tests__/MSeatMap.test.ts +76 -0
- package/src/__tests__/MTicket.test.ts +38 -0
- package/src/__tests__/MTour.test.ts +102 -0
- package/src/__tests__/MVitalsChart.test.ts +49 -0
- package/src/__tests__/mortgage.test.ts +25 -0
- package/src/__tests__/ssr.test.ts +11 -0
- package/src/components/MAvailabilityCalendar.vue +460 -0
- package/src/components/MBeforeAfter.vue +248 -0
- package/src/components/MBodyMap.vue +266 -0
- package/src/components/MCandlestickChart.vue +479 -0
- package/src/components/MCertificate.vue +351 -0
- package/src/components/MCreditCardInput.vue +351 -0
- package/src/components/MFlow.vue +117 -17
- package/src/components/MMortgageCalculator.vue +258 -0
- package/src/components/MOdontogram.vue +462 -0
- package/src/components/MOrderBook.vue +287 -0
- package/src/components/MOrderTicket.vue +217 -0
- package/src/components/MPosKeypad.vue +406 -0
- package/src/components/MProductConfigurator.vue +412 -0
- package/src/components/MQuiz.vue +531 -0
- package/src/components/MReceipt.vue +249 -0
- package/src/components/MSeatMap.vue +431 -0
- package/src/components/MTicket.vue +209 -0
- package/src/components/MTour.vue +145 -27
- package/src/components/MVitalsChart.vue +303 -0
- package/src/composables/_printElement.ts +36 -0
- package/src/composables/cardBrand.ts +104 -0
- package/src/composables/flowPaths.ts +16 -7
- package/src/composables/mortgage.ts +70 -0
- package/src/composables/useFlow.ts +4 -0
- package/src/composables/useLocale.ts +277 -0
- package/src/flow.ts +1 -1
- package/src/index.ts +35 -0
- package/src/locales/de.ts +131 -0
- package/src/locales/es.ts +131 -0
- package/src/locales/fr.ts +131 -0
- package/src/locales/ja.ts +131 -0
- package/src/locales/ko.ts +131 -0
- package/src/locales/pt.ts +131 -0
- package/src/locales/zh.ts +131 -0
- package/dist/flowPaths-DzW-aiET.js.map +0 -1
- package/dist/useLocale-D2ucaY-l.js.map +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/** A line of an `MReceipt`. `price` is the unit price; the line amount is `price × quantity`. */
|
|
3
|
+
export interface ReceiptItem {
|
|
4
|
+
name: string
|
|
5
|
+
quantity?: number
|
|
6
|
+
price: number
|
|
7
|
+
/** Extra text under the name, e.g. "No onion" or a SKU */
|
|
8
|
+
note?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A line after the subtotal: a discount, a tax, a tip, a service fee. Give `amount` (negative for a discount) or
|
|
13
|
+
* `percent` of the subtotal (negative for a discount). `included` marks a tax already inside the prices: it's
|
|
14
|
+
* shown but not added again. Percentages apply to the running total, in the order given (put discounts first).
|
|
15
|
+
*/
|
|
16
|
+
export interface ReceiptAdjustment {
|
|
17
|
+
label: string
|
|
18
|
+
amount?: number
|
|
19
|
+
percent?: number
|
|
20
|
+
included?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A payment toward the total, e.g. `{ method: 'Cash', amount: 50 }`. Paying more than the total shows the change. */
|
|
24
|
+
export interface ReceiptPayment {
|
|
25
|
+
method: string
|
|
26
|
+
amount: number
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
/**
|
|
32
|
+
* A sales receipt in the look of a thermal printer ticket (58 or 80 mm): header, lines with quantity and amount,
|
|
33
|
+
* subtotal, discounts and taxes, total, payments and change. All the math is done in cents, so totals never drift.
|
|
34
|
+
* `print()` prints only the receipt, sized to the paper.
|
|
35
|
+
*
|
|
36
|
+
* @slot header Top of the receipt: the store's logo, name, address, tax id
|
|
37
|
+
* @slot footer Bottom of the receipt: a thank-you line, a QR, return policy
|
|
38
|
+
* @slot item Replaces a line. Slot props: `{ item, amount }`
|
|
39
|
+
*/
|
|
40
|
+
import { computed, ref } from 'vue'
|
|
41
|
+
import { useLocale } from '../composables/useLocale'
|
|
42
|
+
import { printElement } from '../composables/_printElement'
|
|
43
|
+
|
|
44
|
+
const locale = useLocale()
|
|
45
|
+
|
|
46
|
+
const props = withDefaults(
|
|
47
|
+
defineProps<{
|
|
48
|
+
/** The lines sold */
|
|
49
|
+
items: ReceiptItem[]
|
|
50
|
+
/** Discounts, taxes, tips, fees, applied after the subtotal in this order */
|
|
51
|
+
adjustments?: ReceiptAdjustment[]
|
|
52
|
+
/** Payments made; more than the total shows the change */
|
|
53
|
+
payments?: ReceiptPayment[]
|
|
54
|
+
/** ISO 4217 code, e.g. "USD". Without one, amounts are plain numbers */
|
|
55
|
+
currency?: string
|
|
56
|
+
/** Receipt / invoice number, shown under the header */
|
|
57
|
+
number?: string | number
|
|
58
|
+
/** Date of the sale (Date, ISO string or epoch ms) */
|
|
59
|
+
date?: Date | string | number
|
|
60
|
+
/** Paper width: 58 mm, 80 mm, or the width of the container */
|
|
61
|
+
paper?: '58mm' | '80mm' | 'auto'
|
|
62
|
+
/** Torn zigzag edges at the top and bottom, or straight */
|
|
63
|
+
edge?: 'zigzag' | 'straight'
|
|
64
|
+
/** Text at the bottom when the `footer` slot isn't used */
|
|
65
|
+
footer?: string
|
|
66
|
+
}>(),
|
|
67
|
+
{
|
|
68
|
+
adjustments: () => [],
|
|
69
|
+
payments: () => [],
|
|
70
|
+
paper: '80mm',
|
|
71
|
+
edge: 'zigzag',
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const cents = (n: number) => Math.round(n * 100)
|
|
76
|
+
|
|
77
|
+
const lines = computed(() =>
|
|
78
|
+
props.items.map((item) => ({ item, amount: cents(item.price * (item.quantity ?? 1)) })),
|
|
79
|
+
)
|
|
80
|
+
const subtotal = computed(() => lines.value.reduce((s, l) => s + l.amount, 0))
|
|
81
|
+
|
|
82
|
+
/** Rounds half away from zero, so a 10% discount of 30.05 is −3.01 like its +3.01 counterpart */
|
|
83
|
+
const roundAway = (n: number) => Math.sign(n) * Math.round(Math.abs(n))
|
|
84
|
+
|
|
85
|
+
// Percentages apply to the running total, in order: a discount first, then a tax on the discounted amount.
|
|
86
|
+
// An included tax is the part of the running total that is already tax: base − base / (1 + rate)
|
|
87
|
+
const adjustmentLines = computed(() => {
|
|
88
|
+
let running = subtotal.value
|
|
89
|
+
return props.adjustments.map((a) => {
|
|
90
|
+
let value: number
|
|
91
|
+
if (a.amount !== undefined) value = cents(a.amount)
|
|
92
|
+
else if (a.included) value = roundAway(running - running / (1 + (a.percent ?? 0) / 100))
|
|
93
|
+
else value = roundAway((running * (a.percent ?? 0)) / 100)
|
|
94
|
+
if (!a.included) running += value
|
|
95
|
+
return { ...a, value }
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
const total = computed(() =>
|
|
99
|
+
adjustmentLines.value.reduce((s, a) => (a.included ? s : s + a.value), subtotal.value),
|
|
100
|
+
)
|
|
101
|
+
const paid = computed(() => props.payments.reduce((s, p) => s + cents(p.amount), 0))
|
|
102
|
+
const change = computed(() => (props.payments.length ? paid.value - total.value : 0))
|
|
103
|
+
|
|
104
|
+
function money(c: number) {
|
|
105
|
+
const n = c / 100
|
|
106
|
+
return new Intl.NumberFormat(
|
|
107
|
+
locale.lang,
|
|
108
|
+
props.currency ? { style: 'currency', currency: props.currency } : { minimumFractionDigits: 2, maximumFractionDigits: 2 },
|
|
109
|
+
).format(n)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function qty(n: number) {
|
|
113
|
+
return new Intl.NumberFormat(locale.lang, { maximumFractionDigits: 3 }).format(n)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const dateText = computed(() => {
|
|
117
|
+
if (props.date === undefined) return ''
|
|
118
|
+
const d = props.date instanceof Date ? props.date : new Date(props.date)
|
|
119
|
+
return new Intl.DateTimeFormat(locale.lang, { dateStyle: 'short', timeStyle: 'short' }).format(d)
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const rootEl = ref<HTMLElement | null>(null)
|
|
123
|
+
|
|
124
|
+
/** Prints only the receipt, in a hidden frame sized to the paper */
|
|
125
|
+
function print() {
|
|
126
|
+
if (!rootEl.value) return
|
|
127
|
+
printElement(rootEl.value, {
|
|
128
|
+
page: `${props.paper === 'auto' ? 'auto' : props.paper} auto`,
|
|
129
|
+
css: '.m3-receipt{box-shadow:none!important;width:100%!important;max-width:none!important}',
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
defineExpose({
|
|
134
|
+
print,
|
|
135
|
+
/** Totals in the receipt's units (not cents) */
|
|
136
|
+
totals: computed(() => ({
|
|
137
|
+
subtotal: subtotal.value / 100,
|
|
138
|
+
total: total.value / 100,
|
|
139
|
+
paid: paid.value / 100,
|
|
140
|
+
change: change.value / 100,
|
|
141
|
+
})),
|
|
142
|
+
})
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<template>
|
|
146
|
+
<div
|
|
147
|
+
ref="rootEl"
|
|
148
|
+
class="m3-receipt font-mono text-body-medium"
|
|
149
|
+
:class="[`m3-receipt--${edge}`]"
|
|
150
|
+
:style="paper === 'auto' ? undefined : { width: paper === '58mm' ? '58mm' : '80mm' }"
|
|
151
|
+
>
|
|
152
|
+
<div class="px-4 py-5">
|
|
153
|
+
<div v-if="$slots.header" class="mb-3 text-center">
|
|
154
|
+
<slot name="header" />
|
|
155
|
+
</div>
|
|
156
|
+
<div v-if="number !== undefined || dateText" class="flex justify-between gap-2 text-body-small">
|
|
157
|
+
<span v-if="number !== undefined">#{{ number }}</span>
|
|
158
|
+
<span v-if="dateText" class="ms-auto">{{ dateText }}</span>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<hr class="m3-receipt__rule" />
|
|
162
|
+
|
|
163
|
+
<ul role="list" class="flex flex-col gap-1.5">
|
|
164
|
+
<li v-for="(l, i) in lines" :key="i">
|
|
165
|
+
<slot name="item" :item="l.item" :amount="l.amount / 100">
|
|
166
|
+
<div class="flex items-baseline gap-2">
|
|
167
|
+
<span class="min-w-0 flex-1 break-words">{{ l.item.name }}</span>
|
|
168
|
+
<span class="tabular-nums">{{ money(l.amount) }}</span>
|
|
169
|
+
</div>
|
|
170
|
+
<div v-if="(l.item.quantity ?? 1) !== 1" class="text-body-small opacity-70 tabular-nums">
|
|
171
|
+
{{ qty(l.item.quantity ?? 1) }} × {{ money(cents(l.item.price)) }}
|
|
172
|
+
</div>
|
|
173
|
+
<div v-if="l.item.note" class="text-body-small opacity-70">{{ l.item.note }}</div>
|
|
174
|
+
</slot>
|
|
175
|
+
</li>
|
|
176
|
+
</ul>
|
|
177
|
+
|
|
178
|
+
<hr class="m3-receipt__rule" />
|
|
179
|
+
|
|
180
|
+
<div class="flex flex-col gap-1">
|
|
181
|
+
<div v-if="adjustmentLines.length" class="flex justify-between gap-2" data-receipt="subtotal">
|
|
182
|
+
<span>{{ locale.receiptSubtotal }}</span>
|
|
183
|
+
<span class="tabular-nums">{{ money(subtotal) }}</span>
|
|
184
|
+
</div>
|
|
185
|
+
<div
|
|
186
|
+
v-for="(a, i) in adjustmentLines"
|
|
187
|
+
:key="i"
|
|
188
|
+
class="flex justify-between gap-2"
|
|
189
|
+
:class="a.included ? 'text-body-small opacity-70' : ''"
|
|
190
|
+
>
|
|
191
|
+
<span>{{ a.label }}<template v-if="a.percent !== undefined && a.amount === undefined"> ({{ Math.abs(a.percent) }}%)</template></span>
|
|
192
|
+
<span class="tabular-nums">{{ money(a.value) }}</span>
|
|
193
|
+
</div>
|
|
194
|
+
<div class="mt-1 flex justify-between gap-2 text-title-medium font-bold" data-receipt="total">
|
|
195
|
+
<span>{{ locale.receiptTotal }}</span>
|
|
196
|
+
<span class="tabular-nums">{{ money(total) }}</span>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<template v-if="payments.length">
|
|
201
|
+
<hr class="m3-receipt__rule" />
|
|
202
|
+
<div class="flex flex-col gap-1">
|
|
203
|
+
<div v-for="(p, i) in payments" :key="i" class="flex justify-between gap-2">
|
|
204
|
+
<span>{{ p.method }}</span>
|
|
205
|
+
<span class="tabular-nums">{{ money(cents(p.amount)) }}</span>
|
|
206
|
+
</div>
|
|
207
|
+
<div v-if="change > 0" class="flex justify-between gap-2 font-bold" data-receipt="change">
|
|
208
|
+
<span>{{ locale.receiptChange }}</span>
|
|
209
|
+
<span class="tabular-nums">{{ money(change) }}</span>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
</template>
|
|
213
|
+
|
|
214
|
+
<div v-if="$slots.footer || footer" class="mt-4 text-center text-body-small">
|
|
215
|
+
<slot name="footer">{{ footer }}</slot>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</template>
|
|
220
|
+
|
|
221
|
+
<style>
|
|
222
|
+
@layer base {
|
|
223
|
+
.m3-receipt {
|
|
224
|
+
max-width: 100%;
|
|
225
|
+
background: var(--color-surface-container-lowest);
|
|
226
|
+
color: var(--color-on-surface);
|
|
227
|
+
box-shadow: var(--shadow-elevation-1);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
.m3-receipt--zigzag {
|
|
231
|
+
--m3-receipt-tooth: 6px;
|
|
232
|
+
-webkit-mask:
|
|
233
|
+
conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--m3-receipt-tooth)) 51% repeat-x,
|
|
234
|
+
conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--m3-receipt-tooth)) 51% repeat-x;
|
|
235
|
+
mask:
|
|
236
|
+
conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--m3-receipt-tooth)) 51% repeat-x,
|
|
237
|
+
conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--m3-receipt-tooth)) 51% repeat-x;
|
|
238
|
+
box-shadow: none;
|
|
239
|
+
}
|
|
240
|
+
.m3-receipt--straight {
|
|
241
|
+
border-radius: var(--radius-xs, 4px);
|
|
242
|
+
}
|
|
243
|
+
.m3-receipt__rule {
|
|
244
|
+
margin: 0.75rem 0;
|
|
245
|
+
border: 0;
|
|
246
|
+
border-top: 1px dashed currentColor;
|
|
247
|
+
opacity: 0.4;
|
|
248
|
+
}
|
|
249
|
+
</style>
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/** A seat type: its key is the character that marks it in `layout`. */
|
|
3
|
+
export interface SeatCategory {
|
|
4
|
+
/** Single character used for this category in `layout` rows */
|
|
5
|
+
key: string
|
|
6
|
+
/** Name shown in the legend and the seat's label, e.g. "Premium" */
|
|
7
|
+
label: string
|
|
8
|
+
/** A color role (`primary`, `secondary`, `tertiary`, `error`, `success`) or any CSS color. Default `primary` */
|
|
9
|
+
color?: string
|
|
10
|
+
/** Price, shown in the legend and the seat's label */
|
|
11
|
+
price?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A seat as laid out by `MSeatMap`, given to the `seat` slot and the `select` event. */
|
|
15
|
+
export interface SeatInfo {
|
|
16
|
+
/** Id used in v-model, `occupied` and `blocked`: "F12" (theater naming) or "12C" (plane naming) */
|
|
17
|
+
id: string
|
|
18
|
+
/** Row label, e.g. "F" or "12" */
|
|
19
|
+
row: string
|
|
20
|
+
/** Seat label within the row, e.g. "12" or "C" */
|
|
21
|
+
number: string
|
|
22
|
+
/** Category key (the layout character) */
|
|
23
|
+
category: string
|
|
24
|
+
/** Grid row and column (0-based, gaps included) */
|
|
25
|
+
r: number
|
|
26
|
+
c: number
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type SeatState = 'available' | 'selected' | 'occupied' | 'blocked'
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
/**
|
|
34
|
+
* Seat picker for a cinema, theater, stadium, bus or plane. The hall is drawn from rows of characters: each
|
|
35
|
+
* character is a seat of the category with that `key`, and `_` or a space leaves a gap (an aisle, or an empty
|
|
36
|
+
* row when the whole line is blank). Seats are named theater style (row letters, seat numbers: "F12") or plane
|
|
37
|
+
* style (row numbers, seat letters: "12C"), and those names are the ids used in v-model.
|
|
38
|
+
*
|
|
39
|
+
* Arrow keys move between seats, Enter/Space picks one. With `max: 1` picking another seat moves the selection.
|
|
40
|
+
*
|
|
41
|
+
* @slot seat Replaces a seat's content (the button stays). Slot props: `{ seat, state, category }`
|
|
42
|
+
* @slot legend Replaces the legend under the map. Slot props: `{ categories }`
|
|
43
|
+
* @event update:modelValue Emitted with the ids of the selected seats — powers v-model
|
|
44
|
+
* @event select Emitted when a seat is picked or released, with `(seat, selected)`
|
|
45
|
+
* @event limit Emitted when a seat is picked while `max` seats are already selected
|
|
46
|
+
*/
|
|
47
|
+
import { computed, nextTick, ref } from 'vue'
|
|
48
|
+
import MIcon from './MIcon.vue'
|
|
49
|
+
import { useLocale } from '../composables/useLocale'
|
|
50
|
+
|
|
51
|
+
const locale = useLocale()
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(
|
|
54
|
+
defineProps<{
|
|
55
|
+
/** Ids of the selected seats (v-model) */
|
|
56
|
+
modelValue?: string[]
|
|
57
|
+
/** Rows of the hall, top to bottom. Each character is a seat of that category; `_` or a space is a gap */
|
|
58
|
+
layout: string[]
|
|
59
|
+
/** Seat categories by layout character. Characters without one use a default "Standard" look */
|
|
60
|
+
categories?: SeatCategory[]
|
|
61
|
+
/** Ids of seats already taken */
|
|
62
|
+
occupied?: string[]
|
|
63
|
+
/** Ids of seats that can't be picked (out of service, kept free) */
|
|
64
|
+
blocked?: string[]
|
|
65
|
+
/** Seat naming: row letters + seat numbers ("F12"), or row numbers + seat letters ("12C") */
|
|
66
|
+
naming?: 'theater' | 'plane'
|
|
67
|
+
/** Custom row labels, one per seat row (blank rows don't count) */
|
|
68
|
+
rowLabels?: string[]
|
|
69
|
+
/** Seats are numbered from the left (`ltr`) or from the right (`rtl`) of each row */
|
|
70
|
+
numbering?: 'ltr' | 'rtl'
|
|
71
|
+
/** Most seats that can be selected */
|
|
72
|
+
max?: number
|
|
73
|
+
/** Label of the screen/stage. Defaults to the locale's "Screen"; `false` hides it */
|
|
74
|
+
stage?: string | false
|
|
75
|
+
/** Side the screen/stage is drawn on */
|
|
76
|
+
stagePosition?: 'top' | 'bottom'
|
|
77
|
+
/** Seat size in px */
|
|
78
|
+
seatSize?: number
|
|
79
|
+
/** Shows row labels at both ends of each row */
|
|
80
|
+
showRowLabels?: boolean
|
|
81
|
+
/** Shows the legend */
|
|
82
|
+
legend?: boolean
|
|
83
|
+
/** ISO 4217 code to format prices (e.g. "USD"). Unset shows plain numbers */
|
|
84
|
+
currency?: string
|
|
85
|
+
/** Disables picking */
|
|
86
|
+
disabled?: boolean
|
|
87
|
+
}>(),
|
|
88
|
+
{
|
|
89
|
+
modelValue: () => [],
|
|
90
|
+
categories: () => [],
|
|
91
|
+
occupied: () => [],
|
|
92
|
+
blocked: () => [],
|
|
93
|
+
stage: undefined, // without a default Vue casts an absent `string | false` prop to false
|
|
94
|
+
naming: 'theater',
|
|
95
|
+
numbering: 'ltr',
|
|
96
|
+
stagePosition: 'top',
|
|
97
|
+
seatSize: 32,
|
|
98
|
+
showRowLabels: true,
|
|
99
|
+
legend: true,
|
|
100
|
+
disabled: false,
|
|
101
|
+
},
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const emit = defineEmits<{
|
|
105
|
+
'update:modelValue': [string[]]
|
|
106
|
+
select: [SeatInfo, boolean]
|
|
107
|
+
limit: []
|
|
108
|
+
}>()
|
|
109
|
+
|
|
110
|
+
const ROLES = ['primary', 'secondary', 'tertiary', 'error', 'success']
|
|
111
|
+
const PLANE_LETTERS = 'ABCDEFGHJKLMNOPQRSTUVWXYZ' // no I, as airlines do
|
|
112
|
+
|
|
113
|
+
function rowLetter(i: number): string {
|
|
114
|
+
let s = ''
|
|
115
|
+
i += 1
|
|
116
|
+
while (i > 0) {
|
|
117
|
+
const m = (i - 1) % 26
|
|
118
|
+
s = String.fromCharCode(65 + m) + s
|
|
119
|
+
i = Math.floor((i - 1) / 26)
|
|
120
|
+
}
|
|
121
|
+
return s
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const categoryMap = computed(() => new Map(props.categories.map((c) => [c.key, c])))
|
|
125
|
+
|
|
126
|
+
function colorsOf(key: string): { color: string; on: string } {
|
|
127
|
+
const color = categoryMap.value.get(key)?.color ?? 'primary'
|
|
128
|
+
if (ROLES.includes(color)) return { color: `var(--color-${color})`, on: `var(--color-on-${color})` }
|
|
129
|
+
return { color, on: '#fff' }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface Row { label: string; r: number; cells: (SeatInfo | null)[] }
|
|
133
|
+
|
|
134
|
+
const rows = computed<Row[]>(() => {
|
|
135
|
+
const out: Row[] = []
|
|
136
|
+
let seatRow = 0
|
|
137
|
+
props.layout.forEach((line, r) => {
|
|
138
|
+
const chars = [...line]
|
|
139
|
+
const seatCols = chars.map((ch, c) => (ch === '_' || ch === ' ' ? -1 : c)).filter((c) => c >= 0)
|
|
140
|
+
if (!seatCols.length) {
|
|
141
|
+
out.push({ label: '', r, cells: chars.map(() => null) })
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
const label = props.rowLabels?.[seatRow] ?? (props.naming === 'plane' ? String(seatRow + 1) : rowLetter(seatRow))
|
|
145
|
+
seatRow++
|
|
146
|
+
const order = props.numbering === 'rtl' ? [...seatCols].reverse() : seatCols
|
|
147
|
+
const indexOf = new Map(order.map((c, i) => [c, i]))
|
|
148
|
+
out.push({
|
|
149
|
+
label,
|
|
150
|
+
r,
|
|
151
|
+
cells: chars.map((ch, c) => {
|
|
152
|
+
if (ch === '_' || ch === ' ') return null
|
|
153
|
+
const i = indexOf.get(c)!
|
|
154
|
+
const number = props.naming === 'plane' ? (PLANE_LETTERS[i] ?? String(i + 1)) : String(i + 1)
|
|
155
|
+
const id = `${label}${number}`
|
|
156
|
+
return { id, row: label, number, category: ch, r, c }
|
|
157
|
+
}),
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
return out
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
const columns = computed(() => Math.max(1, ...props.layout.map((l) => [...l].length)))
|
|
164
|
+
|
|
165
|
+
const seats = computed(() => rows.value.flatMap((row) => row.cells.filter((s): s is SeatInfo => !!s)))
|
|
166
|
+
const seatById = computed(() => new Map(seats.value.map((s) => [s.id, s])))
|
|
167
|
+
|
|
168
|
+
const selectedSet = computed(() => new Set(props.modelValue))
|
|
169
|
+
const occupiedSet = computed(() => new Set(props.occupied))
|
|
170
|
+
const blockedSet = computed(() => new Set(props.blocked))
|
|
171
|
+
|
|
172
|
+
function stateOf(seat: SeatInfo): SeatState {
|
|
173
|
+
if (occupiedSet.value.has(seat.id)) return 'occupied'
|
|
174
|
+
if (blockedSet.value.has(seat.id)) return 'blocked'
|
|
175
|
+
if (selectedSet.value.has(seat.id)) return 'selected'
|
|
176
|
+
return 'available'
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function pickable(seat: SeatInfo) {
|
|
180
|
+
const s = stateOf(seat)
|
|
181
|
+
return s === 'available' || s === 'selected'
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function toggle(seat: SeatInfo) {
|
|
185
|
+
if (props.disabled || !pickable(seat)) return
|
|
186
|
+
focusedId.value = seat.id
|
|
187
|
+
if (selectedSet.value.has(seat.id)) {
|
|
188
|
+
emit('update:modelValue', props.modelValue.filter((id) => id !== seat.id))
|
|
189
|
+
emit('select', seat, false)
|
|
190
|
+
return
|
|
191
|
+
}
|
|
192
|
+
if (props.max !== undefined && props.modelValue.length >= props.max) {
|
|
193
|
+
if (props.max === 1) {
|
|
194
|
+
const prev = seatById.value.get(props.modelValue[0]!)
|
|
195
|
+
emit('update:modelValue', [seat.id])
|
|
196
|
+
if (prev) emit('select', prev, false)
|
|
197
|
+
emit('select', seat, true)
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
emit('limit')
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
emit('update:modelValue', [...props.modelValue, seat.id])
|
|
204
|
+
emit('select', seat, true)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ── Labels ──────────────────────────────────────────────────────────────
|
|
208
|
+
|
|
209
|
+
function formatPrice(n: number) {
|
|
210
|
+
try {
|
|
211
|
+
return new Intl.NumberFormat(locale.lang, props.currency ? { style: 'currency', currency: props.currency } : {}).format(n)
|
|
212
|
+
} catch {
|
|
213
|
+
return String(n)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function seatLabel(seat: SeatInfo) {
|
|
218
|
+
const cat = categoryMap.value.get(seat.category)
|
|
219
|
+
const parts = [locale.seatLabel.replace('{seat}', seat.id)]
|
|
220
|
+
if (cat) parts.push(cat.label)
|
|
221
|
+
if (cat?.price !== undefined) parts.push(formatPrice(cat.price))
|
|
222
|
+
const state = stateOf(seat)
|
|
223
|
+
if (state === 'occupied') parts.push(locale.seatOccupied)
|
|
224
|
+
return parts.join(', ')
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const stageText = computed(() => (props.stage === false ? '' : props.stage ?? locale.seatStage))
|
|
228
|
+
|
|
229
|
+
const legendCategories = computed(() => {
|
|
230
|
+
const used = new Set(seats.value.map((s) => s.category))
|
|
231
|
+
return props.categories.filter((c) => used.has(c.key))
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
// ── Keyboard: roving tabindex ───────────────────────────────────────────
|
|
235
|
+
|
|
236
|
+
const focusedId = ref<string | null>(null)
|
|
237
|
+
const seatEls = new Map<string, HTMLElement>()
|
|
238
|
+
|
|
239
|
+
function setSeatEl(id: string, el: unknown) {
|
|
240
|
+
if (el) seatEls.set(id, el as HTMLElement)
|
|
241
|
+
else seatEls.delete(id)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const tabStop = computed(() => {
|
|
245
|
+
const focusable = seats.value.filter(pickable)
|
|
246
|
+
if (focusedId.value && focusable.some((s) => s.id === focusedId.value)) return focusedId.value
|
|
247
|
+
return focusable.find((s) => selectedSet.value.has(s.id))?.id ?? focusable[0]?.id ?? null
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
function moveFocus(from: SeatInfo, dr: number, dc: number) {
|
|
251
|
+
const candidates = seats.value.filter((s) => pickable(s) && s.id !== from.id)
|
|
252
|
+
let best: SeatInfo | null = null
|
|
253
|
+
let bestScore = Infinity
|
|
254
|
+
for (const s of candidates) {
|
|
255
|
+
const rr = s.r - from.r
|
|
256
|
+
const cc = s.c - from.c
|
|
257
|
+
if (dr !== 0) {
|
|
258
|
+
if (Math.sign(rr) !== dr) continue
|
|
259
|
+
const score = Math.abs(rr) * 1000 + Math.abs(cc)
|
|
260
|
+
if (score < bestScore) { best = s; bestScore = score }
|
|
261
|
+
} else {
|
|
262
|
+
if (rr !== 0 || Math.sign(cc) !== dc) continue
|
|
263
|
+
const score = Math.abs(cc)
|
|
264
|
+
if (score < bestScore) { best = s; bestScore = score }
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (!best) return
|
|
268
|
+
focusedId.value = best.id
|
|
269
|
+
nextTick(() => seatEls.get(best!.id)?.focus())
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function onKeydown(seat: SeatInfo, e: KeyboardEvent) {
|
|
273
|
+
const dirs: Record<string, [number, number]> = {
|
|
274
|
+
ArrowUp: [-1, 0],
|
|
275
|
+
ArrowDown: [1, 0],
|
|
276
|
+
ArrowLeft: [0, -1],
|
|
277
|
+
ArrowRight: [0, 1],
|
|
278
|
+
}
|
|
279
|
+
const d = dirs[e.key]
|
|
280
|
+
if (!d) return
|
|
281
|
+
e.preventDefault()
|
|
282
|
+
moveFocus(seat, d[0], d[1])
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const gap = computed(() => Math.max(3, Math.round(props.seatSize / 8)))
|
|
286
|
+
</script>
|
|
287
|
+
|
|
288
|
+
<template>
|
|
289
|
+
<div class="flex flex-col gap-4">
|
|
290
|
+
<div class="overflow-auto">
|
|
291
|
+
<div class="mx-auto flex w-max flex-col items-center gap-4 p-2" :class="stagePosition === 'bottom' ? 'flex-col-reverse' : ''">
|
|
292
|
+
<!-- Screen / stage -->
|
|
293
|
+
<div v-if="stageText" class="flex w-full flex-col items-center gap-1" :class="stagePosition === 'bottom' ? 'flex-col-reverse' : ''" aria-hidden="true">
|
|
294
|
+
<svg viewBox="0 0 200 16" preserveAspectRatio="none" class="h-4 w-[85%] text-primary" :class="stagePosition === 'bottom' ? 'rotate-180' : ''">
|
|
295
|
+
<path d="M2 14 Q100 -6 198 14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" vector-effect="non-scaling-stroke" />
|
|
296
|
+
</svg>
|
|
297
|
+
<span class="text-label-medium uppercase tracking-[0.2em] text-on-surface-variant">{{ stageText }}</span>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<!-- Seats -->
|
|
301
|
+
<div
|
|
302
|
+
role="group"
|
|
303
|
+
:aria-label="stageText || undefined"
|
|
304
|
+
class="grid"
|
|
305
|
+
:style="{
|
|
306
|
+
gridTemplateColumns: `${showRowLabels ? `${seatSize}px ` : ''}repeat(${columns}, ${seatSize}px)${showRowLabels ? ` ${seatSize}px` : ''}`,
|
|
307
|
+
gap: `${gap}px`,
|
|
308
|
+
}"
|
|
309
|
+
>
|
|
310
|
+
<template v-for="row in rows" :key="row.r">
|
|
311
|
+
<span
|
|
312
|
+
v-if="showRowLabels"
|
|
313
|
+
aria-hidden="true"
|
|
314
|
+
class="flex items-center justify-center text-label-medium text-on-surface-variant"
|
|
315
|
+
:style="{ height: `${seatSize}px` }"
|
|
316
|
+
>{{ row.label }}</span>
|
|
317
|
+
<template v-for="(seat, c) in row.cells" :key="c">
|
|
318
|
+
<span v-if="!seat" :style="{ height: `${seatSize}px` }" />
|
|
319
|
+
<button
|
|
320
|
+
v-else
|
|
321
|
+
:ref="(el) => setSeatEl(seat.id, el)"
|
|
322
|
+
type="button"
|
|
323
|
+
class="m3-seat relative flex items-center justify-center outline-none transition-[background-color,border-color,transform] duration-150"
|
|
324
|
+
:class="[`is-${stateOf(seat)}`, disabled ? 'cursor-default' : '']"
|
|
325
|
+
:style="{
|
|
326
|
+
width: `${seatSize}px`,
|
|
327
|
+
height: `${seatSize}px`,
|
|
328
|
+
'--seat-color': colorsOf(seat.category).color,
|
|
329
|
+
'--seat-on-color': colorsOf(seat.category).on,
|
|
330
|
+
}"
|
|
331
|
+
:tabindex="tabStop === seat.id ? 0 : -1"
|
|
332
|
+
:disabled="!pickable(seat)"
|
|
333
|
+
:aria-pressed="stateOf(seat) === 'selected'"
|
|
334
|
+
:aria-label="seatLabel(seat)"
|
|
335
|
+
:title="seatLabel(seat)"
|
|
336
|
+
:data-seat="seat.id"
|
|
337
|
+
@click="toggle(seat)"
|
|
338
|
+
@keydown="onKeydown(seat, $event)"
|
|
339
|
+
@focus="focusedId = seat.id"
|
|
340
|
+
>
|
|
341
|
+
<slot name="seat" :seat="seat" :state="stateOf(seat)" :category="categoryMap.get(seat.category)">
|
|
342
|
+
<MIcon v-if="stateOf(seat) === 'selected'" name="check" :size="Math.round(seatSize * 0.6)" />
|
|
343
|
+
<MIcon v-else-if="stateOf(seat) === 'blocked'" name="block" :size="Math.round(seatSize * 0.5)" />
|
|
344
|
+
</slot>
|
|
345
|
+
</button>
|
|
346
|
+
</template>
|
|
347
|
+
<template v-if="row.cells.length < columns">
|
|
348
|
+
<span v-for="n in columns - row.cells.length" :key="`pad-${n}`" />
|
|
349
|
+
</template>
|
|
350
|
+
<span
|
|
351
|
+
v-if="showRowLabels"
|
|
352
|
+
aria-hidden="true"
|
|
353
|
+
class="flex items-center justify-center text-label-medium text-on-surface-variant"
|
|
354
|
+
:style="{ height: `${seatSize}px` }"
|
|
355
|
+
>{{ row.label }}</span>
|
|
356
|
+
</template>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<div v-if="legend" class="flex flex-wrap items-center justify-center gap-x-5 gap-y-2 text-body-medium text-on-surface-variant">
|
|
362
|
+
<slot name="legend" :categories="legendCategories">
|
|
363
|
+
<template v-if="legendCategories.length">
|
|
364
|
+
<span v-for="cat in legendCategories" :key="cat.key" class="flex items-center gap-2">
|
|
365
|
+
<span
|
|
366
|
+
class="m3-seat is-available h-4 w-4"
|
|
367
|
+
:style="{ '--seat-color': colorsOf(cat.key).color, '--seat-on-color': colorsOf(cat.key).on }"
|
|
368
|
+
/>
|
|
369
|
+
{{ cat.label }}<template v-if="cat.price !== undefined"> · {{ formatPrice(cat.price) }}</template>
|
|
370
|
+
</span>
|
|
371
|
+
</template>
|
|
372
|
+
<span v-else class="flex items-center gap-2">
|
|
373
|
+
<span class="m3-seat is-available h-4 w-4" :style="{ '--seat-color': 'var(--color-primary)' }" />
|
|
374
|
+
{{ locale.seatAvailable }}
|
|
375
|
+
</span>
|
|
376
|
+
<span class="flex items-center gap-2">
|
|
377
|
+
<span class="m3-seat is-selected h-4 w-4" :style="{ '--seat-color': 'var(--color-primary)' }" />
|
|
378
|
+
{{ locale.seatSelected }}
|
|
379
|
+
</span>
|
|
380
|
+
<span v-if="occupied.length" class="flex items-center gap-2">
|
|
381
|
+
<span class="m3-seat is-occupied h-4 w-4" />
|
|
382
|
+
{{ locale.seatOccupied }}
|
|
383
|
+
</span>
|
|
384
|
+
</slot>
|
|
385
|
+
</div>
|
|
386
|
+
</div>
|
|
387
|
+
</template>
|
|
388
|
+
|
|
389
|
+
<style>
|
|
390
|
+
/* A seat: rounder at the back (top), like a chair seen from above */
|
|
391
|
+
.m3-seat {
|
|
392
|
+
border-radius: 40% 40% 18% 18%;
|
|
393
|
+
border: 2px solid transparent;
|
|
394
|
+
}
|
|
395
|
+
.m3-seat.is-available {
|
|
396
|
+
background-color: color-mix(in srgb, var(--seat-color) 16%, var(--color-surface));
|
|
397
|
+
border-color: color-mix(in srgb, var(--seat-color) 70%, transparent);
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
}
|
|
400
|
+
button.m3-seat.is-available:hover {
|
|
401
|
+
background-color: color-mix(in srgb, var(--seat-color) 30%, var(--color-surface));
|
|
402
|
+
}
|
|
403
|
+
.m3-seat.is-selected {
|
|
404
|
+
background-color: var(--seat-color);
|
|
405
|
+
border-color: var(--seat-color);
|
|
406
|
+
color: var(--seat-on-color, var(--color-on-primary));
|
|
407
|
+
cursor: pointer;
|
|
408
|
+
}
|
|
409
|
+
button.m3-seat.is-selected:active,
|
|
410
|
+
button.m3-seat.is-available:active {
|
|
411
|
+
transform: scale(0.9);
|
|
412
|
+
}
|
|
413
|
+
.m3-seat.is-occupied {
|
|
414
|
+
background-color: color-mix(in srgb, var(--color-on-surface) 14%, transparent);
|
|
415
|
+
cursor: not-allowed;
|
|
416
|
+
}
|
|
417
|
+
.m3-seat.is-blocked {
|
|
418
|
+
border: 2px dashed var(--color-outline-variant);
|
|
419
|
+
color: var(--color-outline);
|
|
420
|
+
cursor: not-allowed;
|
|
421
|
+
}
|
|
422
|
+
.m3-seat:focus-visible {
|
|
423
|
+
outline: 3px solid var(--color-secondary);
|
|
424
|
+
outline-offset: 2px;
|
|
425
|
+
}
|
|
426
|
+
@media (prefers-reduced-motion: reduce) {
|
|
427
|
+
.m3-seat {
|
|
428
|
+
transition: none;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
</style>
|