Cart Drawer 1
Keeps the order, optional add-on and checkout action together in an accessible cart drawer.
Use it in a prompt
Use checkout/cart-drawer from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/checkout/cart-drawer.tsx. - Import it and pass your copy and images (Props tab):
import { CartDrawer } from "@/components/funneldna/checkout/cart-drawer"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/cart-drawer/component.tsx 733 lines
// Keeps the order, optional add-on and checkout action together in an accessible cart drawer.
'use client'
import * as React from 'react'
import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
import { AlertCircle, Check, Loader2, Lock, Minus, Plus, RotateCcw, ShieldCheck, ShoppingBag, Trash2, Truck, X } from 'lucide-react'
export type CartDrawerProps = {
/** Templates use {count}, {items}, {name}, {price}, {amount} and {subtotal}; rich labels keep their emphasis. */
copy?: Partial<CartDrawerCopy>
/** Checkout action; takes precedence over onCheckout. A returned promise shows loadingLabel; a rejection shows errorMessage. */
onAction?: (lines: CartDrawerCheckoutLine[]) => void | Promise<void>
items?: CartDrawerItem[]
addOn?: CartDrawerAddOn | null
title?: string
checkoutLabel?: string
loadingLabel?: string
/** @deprecated No longer rendered: the builder wires what happens after checkout. */
successLabel?: string
secureNote?: string
subtotalNote?: string
guarantee?: string
guaranteeDetail?: string
sealGuaranteeImage?: string
freeShipping?: { threshold: string; unlockedNote?: string }
emptyTitle?: string
emptyBody?: string
emptyActionLabel?: string
errorMessage?: string
/** @deprecated No longer rendered: the builder wires what happens after checkout. */
successMessage?: string
triggerLabel?: string
mode?: 'overlay' | 'inline'
defaultOpen?: boolean
onCheckout?: (lines: CartDrawerCheckoutLine[]) => void | Promise<void>
/** "success" is accepted for older callers and renders as default. */
state?: CartDrawerState
className?: string
}
export function CartDrawer({
copy: copyOverrides,
onAction,
items = [],
addOn = null,
title = 'Your Cart',
checkoutLabel = 'Yes! Check Out Now',
loadingLabel = 'Opening Checkout…',
secureNote = '',
subtotalNote,
guarantee,
guaranteeDetail,
sealGuaranteeImage,
freeShipping,
emptyTitle = 'Your cart is empty',
emptyBody = 'Add an item and it lands right here, ready for checkout.',
emptyActionLabel = 'Keep Shopping',
errorMessage = 'We couldn’t open checkout. Please try again.',
triggerLabel = 'Cart',
mode = 'overlay',
defaultOpen = false,
onCheckout,
state = 'default',
className = '',
}: CartDrawerProps) {
const copy = { ...CART_COPY, ...Object.fromEntries(Object.entries(copyOverrides ?? {}).filter(([, value]) => value !== undefined)) }
const action = onAction !== undefined ? onAction : onCheckout
const alive = React.useRef(true)
const reduce = useReducedMotion()
const uid = React.useId().replace(/:/g, '')
const panelId = 'cfcd-panel-' + uid
const titleId = 'cfcd-title-' + uid
const addonId = 'cfcd-addon-' + uid
const statusId = 'cfcd-status-' + uid
const triggerRef = React.useRef<HTMLButtonElement>(null)
const panelRef = React.useRef<HTMLDivElement>(null)
const closeRef = React.useRef<HTMLButtonElement>(null)
const userOpened = React.useRef(false)
const timers = React.useRef<number[]>([])
const [ready, setReady] = React.useState(false)
const [open, setOpen] = React.useState(defaultOpen)
const [lines, setLines] = React.useState<Line[]>(() => items.map((item) => ({ ...item, quantity: Math.max(1, item.quantity ?? 1) })))
const [addOnStatus, setAddOnStatus] = React.useState<'idle' | 'adding' | 'added'>('idle')
const [removed, setRemoved] = React.useState<{ line: Line; index: number } | null>(null)
const [checkout, setCheckout] = React.useState<'idle' | 'loading' | 'error'>(() => (state === 'error' ? 'error' : 'idle'))
React.useEffect(() => {
alive.current = true
setReady(true)
const pending = timers.current
return () => {
alive.current = false
pending.forEach((t) => window.clearTimeout(t))
}
}, [])
React.useEffect(() => {
setCheckout(state === 'error' ? 'error' : 'idle')
}, [state])
React.useEffect(() => {
if (mode !== 'overlay' || !open) return
const previous = document.body.style.overflow
document.body.style.overflow = 'hidden'
const t = userOpened.current ? window.setTimeout(() => closeRef.current?.focus(), 40) : 0
return () => {
document.body.style.overflow = previous
window.clearTimeout(t)
}
}, [mode, open])
const later = (fn: () => void, ms: number) => {
timers.current.push(window.setTimeout(fn, ms))
}
const visible = state === 'disabled' ? [] : lines
const isEmpty = visible.length === 0
const symbol = currencyOf(items[0]?.price ?? addOn?.price ?? '$')
const count = visible.reduce((n, l) => n + l.quantity, 0)
const subtotal = visible.reduce((n, l) => n + parseMoney(l.price) * l.quantity, 0)
const subtotalText = money(subtotal, symbol)
const countText = formatCopy(copy.count, { count: String(count), items: count === 1 ? copy.item : copy.items })
const addOnInCart = !!addOn && visible.some((l) => l.id === addOn.id)
const offer = !addOn || isEmpty ? null : addOnInCart ? (addOnStatus === 'added' ? 'added' : null) : 'offer'
const animateIn = ready && !reduce
const openDrawer = () => {
userOpened.current = true
setOpen(true)
}
const close = () => {
setOpen(false)
later(() => triggerRef.current?.focus(), 0)
}
const setQty = (id: string, delta: number) => {
setLines((current) => current.map((l) => (l.id === id ? { ...l, quantity: Math.min(l.maxQuantity ?? 10, Math.max(1, l.quantity + delta)) } : l)))
}
const remove = (id: string) => {
const index = lines.findIndex((l) => l.id === id)
if (index < 0) return
setRemoved({ line: lines[index], index })
setLines(lines.filter((l) => l.id !== id))
if (addOn && id === addOn.id) setAddOnStatus('idle')
}
const undo = () => {
if (!removed) return
const { line, index } = removed
setLines((current) => {
const next = current.filter((l) => l.id !== line.id)
next.splice(Math.min(index, next.length), 0, line)
return next
})
if (addOn && line.id === addOn.id) setAddOnStatus('added')
setRemoved(null)
}
const addAddOn = () => {
if (!addOn || addOnStatus === 'adding') return
setLines((current) =>
current.some((l) => l.id === addOn.id)
? current
: [...current, { id: addOn.id, name: addOn.name, detail: addOn.detail, price: addOn.price, itemImage: addOn.itemImage, itemImageAlt: addOn.itemImageAlt, maxQuantity: addOn.maxQuantity, quantity: 1, isAddOn: true }]
)
setAddOnStatus('added')
setRemoved(null)
}
const undoAddOn = () => {
if (!addOn) return
setLines((current) => current.filter((l) => l.id !== addOn.id))
setAddOnStatus('idle')
}
const runCheckout = async () => {
if (isEmpty || checkout === 'loading' || !action) return
const payload = visible.map((l) => ({ id: l.id, name: l.name, price: l.price, quantity: l.quantity }))
try {
const result = action(payload)
if (!result) return
setCheckout('loading')
await result
if (alive.current) setCheckout('idle')
} catch {
if (alive.current) setCheckout('error')
}
}
const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.key === 'Escape') {
event.stopPropagation()
close()
return
}
if (event.key !== 'Tab' || mode !== 'overlay' || !panelRef.current) return
const focusable = Array.from(panelRef.current.querySelectorAll<HTMLElement>(`button:not([disabled]),a[href],input:not([disabled]),[tabindex]:not([tabindex='-1'])`))
if (!focusable.length) return
const first = focusable[0]
const last = focusable[focusable.length - 1]
if (event.shiftKey && document.activeElement === first) {
event.preventDefault()
last.focus()
} else if (!event.shiftKey && document.activeElement === last) {
event.preventDefault()
first.focus()
}
}
const panelMotion =
mode === 'overlay'
? {
initial: reduce ? { opacity: 0 } : { x: '100%' },
animate: reduce ? { opacity: 1 } : { x: 0 },
exit: reduce ? { opacity: 0 } : { x: '100%' },
transition: reduce ? { duration: 0 } : { type: 'spring' as const, stiffness: 360, damping: 38 },
}
: {
initial: reduce ? { opacity: 0 } : { opacity: 0, y: -10, scale: 0.98 },
animate: { opacity: 1, y: 0, scale: 1 },
exit: reduce ? { opacity: 0 } : { opacity: 0, y: -10, scale: 0.98 },
transition: { duration: reduce ? 0 : 0.26, ease: EASE },
}
const fade = {
initial: reduce ? { opacity: 0 } : { opacity: 0, y: 8 },
animate: { opacity: 1, y: 0 },
exit: reduce ? { opacity: 0 } : { opacity: 0, y: -6 },
transition: { duration: reduce ? 0 : 0.22, ease: EASE },
}
const checkoutClass = ['cfcd-checkout', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '', checkout === 'loading' ? 'is-loading' : ''].filter(Boolean).join(' ')
let shipping: React.ReactNode = null
if (freeShipping && !isEmpty) {
const goal = parseMoney(freeShipping.threshold)
const left = Math.max(0, goal - subtotal)
const pct = goal > 0 ? Math.min(100, (subtotal / goal) * 100) : 100
shipping = (
<div className='cfcd-ship'>
<p>
<Truck aria-hidden='true' />
{left > 0 ? (
<span>
{richCopy(copy.shippingRemaining, { amount: <strong>{money(left, symbol)}</strong> })}
</span>
) : (
<span>{freeShipping.unlockedNote ?? copy.shippingUnlocked}</span>
)}
</p>
<div className='cfcd-track' role='progressbar' aria-label={copy.shippingProgress} aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(pct)}>
<span style={{ width: pct + '%' }} />
</div>
</div>
)
}
const panel = (
<motion.div
key='cfcd-panel'
ref={panelRef}
id={panelId}
className={'cfcd-panel cfcd-panel--' + mode}
role={mode === 'overlay' ? 'dialog' : 'region'}
aria-modal={mode === 'overlay' ? true : undefined}
aria-labelledby={titleId}
onKeyDown={onKeyDown}
style={{ transformOrigin: 'top right' }}
{...panelMotion}
>
<header className='cfcd-head'>
<ShoppingBag className='cfcd-head-ghost' aria-hidden='true' strokeWidth={1.5} />
<div className='cfcd-head-copy'>
<h2 id={titleId} className='cfcd-title'>
{title}
</h2>
<p className='cfcd-head-sub'>{isEmpty ? copy.emptySummary : formatCopy(copy.readySummary, { count: countText })}</p>
</div>
<button ref={closeRef} type='button' className='cfcd-close' onClick={close} aria-label={copy.close}>
<X aria-hidden='true' />
</button>
</header>
<div className='cfcd-body'>
<AnimatePresence initial={false}>
{checkout === 'error' ? (
<motion.div key='error' className='cfcd-error' role='alert' {...fade}>
<AlertCircle aria-hidden='true' />
<p>{errorMessage}</p>
<button type='button' className='cfcd-link' onClick={runCheckout}>
<RotateCcw aria-hidden='true' />
{copy.retry}
</button>
</motion.div>
) : null}
</AnimatePresence>
{shipping}
{isEmpty ? (
<div className='cfcd-empty'>
<div className='cfcd-empty-icon' aria-hidden='true'>
<ShoppingBag />
</div>
<h3>{emptyTitle}</h3>
<p>{emptyBody}</p>
<button type='button' className='cfcd-secondary' onClick={close}>
{emptyActionLabel}
</button>
</div>
) : (
<ul className='cfcd-lines' aria-label={copy.cartItems}>
<AnimatePresence initial={false}>
{visible.map((l) => {
const max = l.maxQuantity ?? 10
return (
<motion.li
key={l.id}
className='cfcd-li'
layout={!reduce}
initial={reduce ? { opacity: 0 } : { opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0, x: 0 }}
exit={reduce ? { opacity: 0 } : { opacity: 0, x: 48, height: 0, paddingBottom: 0 }}
transition={{ duration: reduce ? 0 : 0.28, ease: EASE }}
>
<article className='cfcd-line'>
<div className='cfcd-thumb'>
<img src={l.itemImage} alt={l.itemImageAlt ?? l.name} width={84} height={84} loading='lazy' decoding='async' />
</div>
<div className='cfcd-line-main'>
<div className='cfcd-line-top'>
<div className='cfcd-line-copy'>
{l.isAddOn ? <span className='cfcd-tag'>{copy.addOnTag}</span> : null}
<h3 className='cfcd-line-name'>{l.name}</h3>
{l.detail ? <p className='cfcd-line-detail'>{l.detail}</p> : null}
</div>
<div className='cfcd-line-price'>
<strong>{money(parseMoney(l.price) * l.quantity, symbol)}</strong>
{l.quantity > 1 ? <span>{formatCopy(copy.each, { price: l.price })}</span> : null}
</div>
</div>
<div className='cfcd-controls'>
<div className='cfcd-qty' role='group' aria-label={formatCopy(copy.quantity, { name: l.name })}>
<button type='button' className='cfcd-qty-btn' onClick={() => setQty(l.id, -1)} disabled={l.quantity <= 1} aria-label={formatCopy(copy.decrease, { name: l.name })}>
<Minus aria-hidden='true' />
</button>
<output className='cfcd-qty-val' aria-live='polite'>
{l.quantity}
</output>
<button type='button' className='cfcd-qty-btn' onClick={() => setQty(l.id, 1)} disabled={l.quantity >= max} aria-label={formatCopy(copy.increase, { name: l.name })}>
<Plus aria-hidden='true' />
</button>
</div>
<button type='button' className='cfcd-remove' onClick={() => remove(l.id)} aria-label={formatCopy(copy.removeAction, { name: l.name })}>
<Trash2 aria-hidden='true' />
<span aria-hidden='true'>{copy.remove}</span>
</button>
</div>
</div>
</article>
</motion.li>
)
})}
</AnimatePresence>
</ul>
)}
<AnimatePresence initial={false}>
{removed ? (
<motion.div key={'undo-' + removed.line.id} className='cfcd-undo' role='status' {...fade}>
<p>
{richCopy(copy.removed, { name: <strong>{removed.line.name}</strong> })}
</p>
<button type='button' className='cfcd-link' onClick={undo}>
<RotateCcw aria-hidden='true' />
{copy.undo}
</button>
</motion.div>
) : null}
</AnimatePresence>
<AnimatePresence initial={false} mode='wait'>
{addOn && offer === 'offer' ? (
<motion.section key='offer' className='cfcd-addon' aria-labelledby={addonId} {...fade}>
<div className='cfcd-addon-thumb'>
<img src={addOn.itemImage} alt={addOn.itemImageAlt ?? addOn.name} width={72} height={72} loading='lazy' decoding='async' />
</div>
<div className='cfcd-addon-copy'>
<h3 id={addonId}>
{addOn.headline ?? (
<>
{formatCopy(copy.addOnHeading, { name: addOn.name })}<span className='cfcd-addon-price'>{formatCopy(copy.addOnPrice, { price: addOn.price })}</span>
</>
)}
</h3>
{addOn.detail ? <p>{addOn.detail}</p> : null}
</div>
<button type='button' className='cfcd-add' onClick={addAddOn} disabled={addOnStatus === 'adding'} aria-busy={addOnStatus === 'adding'}>
{addOnStatus === 'adding' ? <Loader2 className='cfcd-spin' aria-hidden='true' /> : <Plus aria-hidden='true' />}
<span>{addOnStatus === 'adding' ? copy.adding : addOn.addLabel ?? copy.add}</span>
</button>
</motion.section>
) : addOn && offer === 'added' ? (
<motion.div key='added' className='cfcd-added' role='status' {...fade}>
<span className='cfcd-added-icon' aria-hidden='true'>
<Check />
</span>
<p>
{richCopy(copy.added, { name: <strong>{addOn.name}</strong> })}
</p>
<button type='button' className='cfcd-link' onClick={undoAddOn}>
{copy.undo}
</button>
</motion.div>
) : null}
</AnimatePresence>
</div>
<footer className='cfcd-foot'>
<div className='cfcd-sub'>
<span className='cfcd-sub-label'>
{copy.subtotal}<span>{formatCopy(copy.subtotalCount, { count: countText })}</span>
</span>
<span className='cfcd-sub-amount' aria-live='polite'>
<motion.span key={subtotalText} initial={animateIn ? { opacity: 0.25, y: -10 } : false} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.28, ease: EASE }}>
{subtotalText}
</motion.span>
</span>
</div>
{subtotalNote && !isEmpty ? <p className='cfcd-sub-note'>{subtotalNote}</p> : null}
<button type='button' className={checkoutClass} onClick={runCheckout} disabled={isEmpty} aria-busy={checkout === 'loading'} aria-describedby={secureNote ? statusId : undefined}>
{checkout === 'loading' ? (
<>
<Loader2 className='cfcd-spin' aria-hidden='true' />
<span className='cfcd-checkout-label'>{loadingLabel}</span>
</>
) : isEmpty ? (
<>
<Lock aria-hidden='true' />
<span className='cfcd-checkout-label'>{checkoutLabel}</span>
</>
) : (
<>
<span className='cfcd-checkout-label'>{checkoutLabel}</span>
<span className='cfcd-pill'>
{subtotalText}
</span>
</>
)}
</button>
{secureNote ? (
<p id={statusId} className='cfcd-status'>
<Lock aria-hidden='true' />
<span>{secureNote}</span>
</p>
) : null}
{guarantee ? (
<div className='cfcd-guar'>
{sealGuaranteeImage ? (
<img className='cfcd-seal' src={sealGuaranteeImage} alt='' width={64} height={64} loading='lazy' decoding='async' />
) : (
<span className='cfcd-seal-fallback' aria-hidden='true'>
<ShieldCheck />
</span>
)}
<div className='cfcd-guar-copy'>
<strong>{guarantee}</strong>
{guaranteeDetail ? <span>{guaranteeDetail}</span> : null}
</div>
</div>
) : null}
</footer>
</motion.div>
)
return (
<div className={('cf-cart-drawer cfcd--' + mode + ' ' + className).trim()}>
<style>{CSS}</style>
<button
ref={triggerRef}
type='button'
className='cfcd-trigger'
aria-expanded={open}
aria-controls={panelId}
aria-label={formatCopy(open ? copy.closeSummary : copy.openSummary, { count: countText, subtotal: subtotalText })}
onClick={() => (open ? close() : openDrawer())}
>
<span className='cfcd-trigger-icon' aria-hidden='true'>
<ShoppingBag />
</span>
<span className='cfcd-trigger-label' aria-hidden='true'>{triggerLabel}</span>
{count > 0 ? (
<motion.span key={count} className='cfcd-badge' aria-hidden='true' initial={animateIn ? { scale: 0.4 } : false} animate={{ scale: 1 }} transition={{ type: 'spring', stiffness: 500, damping: 18 }}>
{count}
</motion.span>
) : null}
<span className='cfcd-trigger-sep' aria-hidden='true' />
<span className='cfcd-trigger-total' aria-hidden='true'>
{subtotalText}
</span>
</button>
<AnimatePresence initial={false}>
{open && mode === 'overlay' ? (
<motion.div key='cfcd-scrim' className='cfcd-scrim' aria-hidden='true' onClick={close} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: reduce ? 0 : 0.2 }} />
) : null}
{open ? panel : null}
</AnimatePresence>
</div>
)
}
/** "success" is accepted for older callers and renders as default. */
export type CartDrawerState = 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success'
export type CartDrawerItem = {
id: string
name: string
detail?: string
price: string
itemImage: string
itemImageAlt?: string
quantity?: number
maxQuantity?: number
}
export type CartDrawerAddOn = CartDrawerItem & {
headline?: string
addLabel?: string
}
export type CartDrawerCheckoutLine = { id: string; name: string; price: string; quantity: number }
type Line = CartDrawerItem & { quantity: number; isAddOn?: boolean }
const EASE: [number, number, number, number] = [0.2, 0.7, 0.2, 1]
function parseMoney(value: string) {
const n = Number(String(value).replace(/[^0-9.]/g, ''))
return Number.isFinite(n) ? n : 0
}
function currencyOf(value: string) {
const match = String(value).trim().match(/^[^0-9 .,]+/)
return match ? match[0] : '$'
}
function money(n: number, symbol: string) {
const cents = Math.round(n * 100) % 100 !== 0
return symbol + n.toLocaleString('en-US', { minimumFractionDigits: cents ? 2 : 0, maximumFractionDigits: 2 })
}
const CSS = `
.cf-cart-drawer{--cfcd-cta:var(--cta,#d92d20);--cfcd-cta2:var(--cta-2,#b42318);--cfcd-cta-ink:var(--cta-ink,#ffffff);--cfcd-ink:var(--ink,#101828);--cfcd-muted:var(--muted,#4a5565);--cfcd-band:var(--band,#0f2747);--cfcd-band-ink:var(--band-ink,#ffffff);--cfcd-accent:var(--accent,#0f5fc2);--cfcd-card:var(--card,#ffffff);--cfcd-display:var(--font-display,Arial,sans-serif);--cfcd-body:var(--font-body,Arial,sans-serif);--cfcd-tint:color-mix(in oklch,var(--ink) 3%,var(--card));--cfcd-line:var(--card-border,oklch(from var(--ink) l c h / 0.16));--cfcd-gold:color-mix(in oklch,var(--accent-fill,var(--accent)) 8%,var(--card));--cfcd-gold-line:oklch(from var(--ink) l c h / 0.22);--cfcd-gold-ink:var(--ink);--cfcd-step-radius:var(--field-radius,var(--radius,12px));font-family:var(--font-body,Arial,sans-serif);color:var(--cfcd-ink);-webkit-font-smoothing:antialiased}
.cf-cart-drawer *,.cf-cart-drawer *::before,.cf-cart-drawer *::after{box-sizing:border-box}
.cf-cart-drawer :where(h2,h3,p,ul){margin:0}
.cf-cart-drawer :where(button){font:inherit;-webkit-tap-highlight-color:transparent}
.cf-cart-drawer :where(button):focus-visible{outline:3px solid var(--cfcd-accent);outline-offset:2px}
:where(.cf-cart-drawer).cfcd--inline{display:grid;gap:14px;width:min(100%,440px);justify-items:end}
:where(.cf-cart-drawer).cfcd--overlay{display:inline-block}
:where(.cf-cart-drawer) .cfcd-trigger{position:relative;display:inline-flex;align-items:center;gap:10px;min-height:54px;padding:0 20px 0 16px;border-radius:var(--button-radius,var(--radius,999px));border:1px solid oklch(from var(--ink) l c h / 0.65);background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);font-size:16px;line-height:1;cursor:pointer;box-shadow:0 2px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24);transition:transform .16s ease,box-shadow .16s ease;border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));text-transform:var(--button-case,none);white-space:nowrap}
:where(.cf-cart-drawer) .cfcd-trigger:hover{transform:translateY(-2px);box-shadow:0 3px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24)}
:where(.cf-cart-drawer) .cfcd-trigger:active{transform:translateY(1px);box-shadow:inset 0 2px 5px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.18)}
:where(.cf-cart-drawer) .cfcd-trigger:focus-visible{outline-offset:3px}
:where(.cf-cart-drawer) .cfcd-trigger-icon{flex:none;display:grid;place-items:center;width:22px;height:22px}
:where(.cf-cart-drawer) .cfcd-trigger-icon svg{width:20px;height:20px}
:where(.cf-cart-drawer) .cfcd-trigger-label{line-height:1}
:where(.cf-cart-drawer) .cfcd-badge{flex:none;display:inline-grid;place-items:center;min-width:24px;height:24px;padding:0 7px;margin-left:-2px;border-radius:999px;background:linear-gradient(180deg in oklch,oklch(from var(--button-bg,var(--cfcd-cta)) calc(l + 0.03) c h),oklch(from var(--button-bg,var(--cfcd-cta)) calc(l - 0.04) c h));color:var(--button-ink,var(--cfcd-cta-ink));font-family:var(--font-body,Arial,sans-serif);font-size:13px;font-weight:800;line-height:1;letter-spacing:0;font-variant-numeric:tabular-nums;text-shadow:var(--button-text-shadow,none);box-shadow:inset 0 -1px 0 oklch(from var(--button-bg,var(--cfcd-cta)) calc(l - 0.14) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22)}
:where(.cf-cart-drawer) .cfcd-trigger-sep{flex:none;width:1px;height:20px;background:oklch(from var(--button-2-ink,var(--ink)) l c h / 0.3)}
:where(.cf-cart-drawer) .cfcd-trigger-total{font-weight:800;font-variant-numeric:tabular-nums}
:where(.cf-cart-drawer) .cfcd-panel{position:relative;display:flex;flex-direction:column;width:100%;overflow:hidden;background:var(--cfcd-tint);container:cf-cart-drawer / inline-size;box-shadow:var(--card-shadow,0 0 0 1px oklch(from var(--cfcd-band) l c h / 0.16),0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24),0 3px 6px -1px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24));border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16));border-radius:var(--card-radius,var(--radius,16px))}
:where(.cf-cart-drawer) .cfcd-panel--inline{border-radius:var(--card-radius,var(--radius,22px))}
:where(.cf-cart-drawer) .cfcd-panel--overlay{position:fixed;top:0;right:0;bottom:0;z-index:1001;width:min(100vw,460px);height:100dvh;border-radius:var(--card-radius,var(--radius,22px)) 0 0 var(--card-radius,var(--radius,22px))}
:where(.cf-cart-drawer) .cfcd-scrim{position:fixed;inset:0;z-index:1000;background:oklch(from var(--cfcd-band) l c h / 0.62);backdrop-filter:blur(3px)}
:where(.cf-cart-drawer) .cfcd-head{position:relative;z-index:1;display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:24px 20px 24px 24px;background:var(--cfcd-band);color:var(--cfcd-band-ink);overflow:hidden;box-shadow:inset 0 -1px 0 oklch(from var(--band) calc(l - 0.12) c h / 0.35),inset 0 1px 0 oklch(from var(--band) calc(l - 0.12) c h / 0.35),0 3px 6px -1px oklch(from var(--band) calc(l - 0.12) c h / 0.35)}
:where(.cf-cart-drawer) .cfcd-head-ghost{position:absolute;right:62px;bottom:-44px;width:140px;height:140px;opacity:.09;transform:rotate(-14deg);pointer-events:none}
:where(.cf-cart-drawer) .cfcd-head-copy{position:relative;min-width:0}
:where(.cf-cart-drawer) .cfcd-title{font-family:var(--font-display);font-weight:var(--display-weight,900);font-size:33px;line-height:1.02;letter-spacing:var(--display-tracking,-.03em);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-cart-drawer) .cfcd-head-sub{margin-top:10px;font-size:15px;font-weight:600;line-height:1.35;color:var(--cfcd-band-ink)}
:where(.cf-cart-drawer) .cfcd-close{position:relative;flex:none;display:grid;place-items:center;width:44px;height:44px;border-radius:var(--button-radius,var(--radius,999px));border:1px solid oklch(from var(--ink) l c h / 0.2);background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));cursor:pointer;transition:background .16s ease,transform .2s ease;border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,700);text-transform:var(--button-case,none)}
:where(.cf-cart-drawer) .cfcd-close:hover{background:oklch(from var(--ink) l c h / 0.2);transform:rotate(90deg)}
:where(.cf-cart-drawer) .cfcd-close:active{transform:scale(.92)}
:where(.cf-cart-drawer) .cfcd-close:focus-visible{outline-color:var(--cfcd-band-ink)}
:where(.cf-cart-drawer) .cfcd-close svg{width:20px;height:20px}
:where(.cf-cart-drawer) .cfcd-body{display:flex;flex-direction:column;gap:14px;padding:18px}
:where(.cf-cart-drawer) .cfcd-panel--overlay .cfcd-body{flex:1;overflow-y:auto;overscroll-behavior:contain}
:where(.cf-cart-drawer) .cfcd-lines{list-style:none;padding:0;display:flex;flex-direction:column}
:where(.cf-cart-drawer) .cfcd-li{padding-bottom:12px}
:where(.cf-cart-drawer) .cfcd-li:last-child{padding-bottom:0}
:where(.cf-cart-drawer) .cfcd-line{display:grid;grid-template-columns:84px minmax(0,1fr);gap:14px;align-items:start;padding:14px;border-radius:var(--card-radius,var(--radius,16px));background:var(--cfcd-card);border:1px solid oklch(from var(--ink) l c h / 0.10);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-thumb{width:84px;height:84px;border-radius:12px;overflow:visible;background:transparent;border:1px solid var(--cfcd-line);box-shadow:none;border-color:transparent}
:where(.cf-cart-drawer) .cfcd-thumb img,:where(.cf-cart-drawer) .cfcd-addon-thumb img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24))}
:where(.cf-cart-drawer) .cfcd-line-main{min-width:0;display:flex;flex-direction:column;gap:12px}
:where(.cf-cart-drawer) .cfcd-line-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
:where(.cf-cart-drawer) .cfcd-line-copy{min-width:0}
:where(.cf-cart-drawer) .cfcd-tag{display:inline-flex;align-items:center;margin-bottom:6px;padding:3px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 5%,var(--card));color:var(--ink);font-size:12px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;line-height:1.3}
:where(.cf-cart-drawer) .cfcd-line-name{font-family:var(--font-display);font-size:17px;font-weight:var(--display-weight,800);line-height:1.25;letter-spacing:var(--display-tracking,-.01em);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-cart-drawer) .cfcd-line-detail{margin-top:5px;font-size:15px;line-height:1.45;color:var(--cfcd-muted);text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-line-price{flex:none;text-align:right}
:where(.cf-cart-drawer) .cfcd-line-price strong{display:block;font-family:var(--font-display,Arial,sans-serif);font-size:20px;font-weight:900;line-height:1.1;font-variant-numeric:tabular-nums}
:where(.cf-cart-drawer) .cfcd-line-price span{display:block;margin-top:4px;font-size:14px;color:var(--cfcd-muted);white-space:nowrap}
:where(.cf-cart-drawer) .cfcd-controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;min-width:0}
:where(.cf-cart-drawer) .cfcd-qty{flex:none;display:inline-flex;align-items:center;gap:2px;max-width:100%;padding:3px;border-radius:var(--cfcd-step-radius);background:color-mix(in oklch,var(--ink) 5%,var(--card));border:1px solid oklch(from var(--ink) l c h / 0.14);box-shadow:inset 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.12)}
:where(.cf-cart-drawer) .cfcd-qty-btn{flex:none;display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--button-2-border,oklch(from var(--ink) l c h / 0.12));border-radius:max(4px,calc(var(--cfcd-step-radius) - 3px));background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);cursor:pointer;box-shadow:var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / 0.18),0 1px 3px oklch(0.22 0.03 260 / 0.14));transition:background .14s ease,transform .14s ease,box-shadow .14s ease}
:where(.cf-cart-drawer) .cfcd-qty-btn:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--card)) calc(l - 0.04) c h);color:var(--button-2-ink,var(--ink))}
:where(.cf-cart-drawer) .cfcd-qty-btn:active:not(:disabled){transform:scale(.92);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-qty-btn:focus-visible{outline-offset:1px}
:where(.cf-cart-drawer) .cfcd-qty-btn:disabled{background:transparent;border-color:transparent;box-shadow:none;color:var(--muted);cursor:not-allowed}
:where(.cf-cart-drawer) .cfcd-qty-btn svg{display:block;width:16px;height:16px;stroke-width:2.75}
:where(.cf-cart-drawer) .cfcd-qty-val{flex:none;min-width:34px;padding:0 2px;text-align:center;font-family:var(--font-display,Arial,sans-serif);font-weight:900;font-size:17px;line-height:1;color:var(--ink);font-variant-numeric:tabular-nums}
:where(.cf-cart-drawer) .cfcd-remove{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:44px;padding:0 12px;border:0;border-radius:var(--button-radius,var(--radius,10px));background:var(--button-2-bg,var(--card));color:var(--danger);font-size:15px;font-weight:var(--button-weight,700);cursor:pointer;transition:color .14s ease,background .14s ease;border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));font-family:var(--button-font,var(--font-display));text-transform:var(--button-case,none)}
:where(.cf-cart-drawer) .cfcd-remove:hover{color:var(--danger);background:var(--danger-soft)}
:where(.cf-cart-drawer) .cfcd-remove:active{transform:scale(.95)}
:where(.cf-cart-drawer) .cfcd-remove svg{flex:none;width:17px;height:17px}
:where(.cf-cart-drawer) .cfcd-addon{display:grid;grid-template-columns:72px minmax(0,1fr);gap:14px;align-items:start;padding:16px;border-radius:var(--card-radius,var(--radius,16px));background:var(--cfcd-gold);border:1px solid oklch(from var(--ink) l c h / 0.10);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-addon-thumb{width:72px;height:72px;border-radius:12px;overflow:visible;background:transparent;border:1px solid oklch(from var(--ink) l c h / 0.22);box-shadow:none;transform:rotate(-3deg);border-color:transparent}
:where(.cf-cart-drawer) .cfcd-addon-copy{min-width:0}
:where(.cf-cart-drawer) .cfcd-addon h3{font-family:var(--font-display);font-size:19px;font-weight:var(--display-weight,900);line-height:1.2;letter-spacing:var(--display-tracking,-.015em);color:var(--cfcd-ink);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-cart-drawer) .cfcd-addon-price{white-space:nowrap;color:var(--ink)}
:where(.cf-cart-drawer) .cfcd-addon p{margin-top:6px;font-size:15px;line-height:1.45;color:var(--cfcd-gold-ink);text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-add{text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:9px;width:100%;min-height:50px;padding:0 18px;border-radius:var(--button-radius,var(--radius,12px));border:1px solid oklch(from var(--ink) l c h / 0.65);background:linear-gradient(180deg in oklch,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-size:17px;font-weight:var(--button-weight,800);line-height:1;cursor:pointer;box-shadow:var(--button-shadow,inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24),0 4px 10px -3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));transition:transform .14s ease,box-shadow .14s ease;border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));text-transform:var(--button-case,none)}
:where(.cf-cart-drawer) .cfcd-add:hover:not(:disabled){transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24),0 4px 10px -3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22))}
:where(.cf-cart-drawer) .cfcd-add:active:not(:disabled){transform:translateY(1px);box-shadow:inset 0 2px 6px oklch(from var(--card) calc(l - 0.12) c h / 0.35)}
:where(.cf-cart-drawer) .cfcd-add:disabled{cursor:progress;opacity:.92}
:where(.cf-cart-drawer) .cfcd-add svg{flex:none;width:19px;height:19px;stroke-width:2.75}
:where(.cf-cart-drawer) .cfcd-added{display:flex;align-items:center;gap:12px;padding:8px 8px 8px 14px;border-radius:var(--card-radius,var(--radius,14px));background:var(--success-soft);border:1.5px solid oklch(from var(--ink) l c h / 0.22);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16));box-shadow:none}
:where(.cf-cart-drawer) .cfcd-added-icon{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:999px;background:var(--card);color:var(--success);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-added-icon svg{width:17px;height:17px;stroke-width:3}
:where(.cf-cart-drawer) .cfcd-added p{flex:1;min-width:0;font-size:15px;font-weight:600;line-height:1.4;color:var(--success);text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-link{flex:none;display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border:0;border-radius:var(--button-radius,var(--radius,10px));background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));font-size:15px;font-weight:var(--button-weight,800);cursor:pointer;border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));font-family:var(--button-font,var(--font-display));text-transform:var(--button-case,none)}
:where(.cf-cart-drawer) .cfcd-link:hover{background:color-mix(in oklch,var(--ink) 5%,var(--card));text-decoration:underline;text-underline-offset:3px}
:where(.cf-cart-drawer) .cfcd-link svg{width:16px;height:16px}
:where(.cf-cart-drawer) .cfcd-undo{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 6px 4px 14px;border-radius:var(--card-radius,var(--radius,12px));background:var(--danger-soft);border:1px solid var(--cfcd-line);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16));box-shadow:none}
:where(.cf-cart-drawer) .cfcd-undo p{min-width:0;font-size:15px;line-height:1.4;text-wrap:pretty;color:var(--danger)}
:where(.cf-cart-drawer) .cfcd-error{display:flex;align-items:center;gap:10px;padding:6px 6px 6px 14px;border-radius:var(--card-radius,var(--radius,12px));background:var(--danger-soft);border:1.5px solid oklch(from var(--ink) l c h / 0.22);color:var(--danger);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16));box-shadow:none}
:where(.cf-cart-drawer) .cfcd-error > svg{flex:none;width:20px;height:20px}
:where(.cf-cart-drawer) .cfcd-error p{flex:1;min-width:0;font-size:15px;font-weight:700;line-height:1.4;text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-error .cfcd-link{color:var(--danger)}
:where(.cf-cart-drawer) .cfcd-error .cfcd-link:hover{background:var(--danger-soft)}
:where(.cf-cart-drawer) .cfcd-ship{padding:12px 14px;border-radius:var(--card-radius,var(--radius,14px));background:var(--cfcd-card);border:1px solid var(--cfcd-line);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16));box-shadow:none}
:where(.cf-cart-drawer) .cfcd-ship p{display:flex;align-items:center;gap:8px;font-size:15px;font-weight:700;line-height:1.35}
:where(.cf-cart-drawer) .cfcd-ship svg{flex:none;width:18px;height:18px;color:var(--success)}
:where(.cf-cart-drawer) .cfcd-track{margin-top:10px;height:8px;border-radius:999px;background:color-mix(in oklch,var(--cfcd-band) 9%,var(--card));overflow:hidden}
:where(.cf-cart-drawer) .cfcd-track span{display:block;height:100%;border-radius:inherit;background:var(--success);transition:width .4s ease}
:where(.cf-cart-drawer) .cfcd-empty{display:flex;flex-direction:column;align-items:center;text-align:center;padding:34px 20px 26px;border-radius:var(--card-radius,var(--radius,16px));background:var(--cfcd-card);border:1px solid oklch(from var(--ink) l c h / 0.10);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-empty-icon{display:grid;place-items:center;width:88px;height:88px;border-radius:999px;background:transparent;color:var(--ink);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-empty-icon svg{width:38px;height:38px}
:where(.cf-cart-drawer) .cfcd-empty h3{margin-top:26px;font-family:var(--font-display);font-size:25px;font-weight:var(--display-weight,900);line-height:1.1;letter-spacing:var(--display-tracking,-.02em);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-cart-drawer) .cfcd-empty p{margin-top:9px;max-width:32ch;font-size:16px;line-height:1.5;color:var(--cfcd-muted);text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-secondary{margin-top:20px;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 22px;border-radius:var(--button-radius,var(--radius,12px));border:1.5px solid var(--button-2-border, transparent);background:var(--button-2-bg, var(--secondary, oklch(0.93 0.01 260)));color:var(--button-2-ink, var(--secondary-ink, var(--ink)));font-family:var(--button-font,var(--font-display));font-size:16px;font-weight:var(--button-weight,800);cursor:pointer;box-shadow:var(--button-2-shadow, var(--shadow-sm));transition:background .14s ease,transform .14s ease;text-transform:var(--button-case,none)}
:where(.cf-cart-drawer) .cfcd-secondary:hover{background:oklch(from var(--button-2-bg, var(--secondary, oklch(0.93 0.01 260))) calc(l - 0.04) c h);transform:translateY(-1px)}
:where(.cf-cart-drawer) .cfcd-secondary:active{transform:translateY(1px)}
:where(.cf-cart-drawer) .cfcd-foot{position:relative;z-index:1;display:flex;flex-direction:column;gap:14px;padding:20px 20px 22px;background:var(--cfcd-card);border-top:1px solid var(--cfcd-line);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-sub{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
:where(.cf-cart-drawer) .cfcd-sub-label{font-size:17px;font-weight:800}
:where(.cf-cart-drawer) .cfcd-sub-label span{font-size:15px;font-weight:500;color:var(--cfcd-muted)}
:where(.cf-cart-drawer) .cfcd-sub-amount{display:inline-block;font-family:var(--font-display,Arial,sans-serif);font-size:36px;font-weight:900;line-height:1.1;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
:where(.cf-cart-drawer) .cfcd-sub-amount span{display:inline-block}
:where(.cf-cart-drawer) .cfcd-sub-note{margin-top:-2px;font-size:15px;line-height:1.4;color:var(--cfcd-muted);text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-checkout{text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:66px;padding:10px 12px 10px 20px;border-radius:var(--button-radius,var(--radius,14px));border:1px solid oklch(from var(--ink) l c h / 0.65);background:linear-gradient(180deg in oklch,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-size:21px;font-weight:var(--button-weight,900);line-height:1.1;letter-spacing:-.01em;cursor:pointer;box-shadow:var(--button-shadow,inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24),0 4px 10px -3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));transition:transform .16s ease,box-shadow .16s ease;border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));text-transform:var(--button-case,none)}
:where(.cf-cart-drawer) .cfcd-checkout::after{content:'';position:absolute;inset:0;background:linear-gradient(105deg in oklch,transparent 30%,var(--button-bg,var(--cta)) 50%,transparent 70%);transform:translateX(-130%);transition:transform .75s ease;pointer-events:none}
:where(.cf-cart-drawer) .cfcd-checkout:hover:not(:disabled),:where(.cf-cart-drawer) .cfcd-checkout.is-hover{transform:translateY(-2px);box-shadow:var(--button-shadow,inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24),0 4px 10px -3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22))}
:where(.cf-cart-drawer) .cfcd-checkout:hover:not(:disabled)::after,:where(.cf-cart-drawer) .cfcd-checkout.is-hover::after{transform:translateX(130%)}
:where(.cf-cart-drawer) .cfcd-checkout:active:not(:disabled),:where(.cf-cart-drawer) .cfcd-checkout.is-active{transform:translateY(2px);background:linear-gradient(180deg in oklch,var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)),var(--button-bg,var(--cta)));box-shadow:inset 0 3px 8px oklch(from var(--card) calc(l - 0.12) c h / 0.35),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24)}
:where(.cf-cart-drawer) .cfcd-checkout:focus-visible{outline:3px solid var(--cfcd-accent);outline-offset:3px}
:where(.cf-cart-drawer) .cfcd-checkout:disabled{text-shadow:none;cursor:not-allowed;border-color:var(--card-border,oklch(from var(--ink) l c h / 0.22));background:var(--card);color:var(--muted);box-shadow:inset 0 1px 0 oklch(from var(--card) calc(l - 0.12) c h / 0.35)}
:where(.cf-cart-drawer) .cfcd-checkout:disabled::after{display:none}
:where(.cf-cart-drawer) .cfcd-checkout.is-loading{cursor:progress}
:where(.cf-cart-drawer) .cfcd-checkout-label{min-width:0;text-wrap:balance}
:where(.cf-cart-drawer) .cfcd-checkout > svg{flex:none;width:22px;height:22px;stroke-width:2.75}
:where(.cf-cart-drawer) .cfcd-pill{flex:none;display:inline-flex;align-items:center;gap:6px;padding:7px 13px;border-radius:999px;background:color-mix(in oklch,var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)) 85%,var(--button-bg,var(--cta)));box-shadow:inset 0 1px 3px oklch(from var(--card) calc(l - 0.12) c h / 0.35),0 1px 0px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24);font-size:18px;font-variant-numeric:tabular-nums}
:where(.cf-cart-drawer) .cfcd-status{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:-4px;font-size:15px;font-weight:600;line-height:1.4;color:var(--cfcd-muted);text-align:center}
:where(.cf-cart-drawer) .cfcd-status span{text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-status svg{flex:none;width:16px;height:16px}
:where(.cf-cart-drawer) .cfcd-guar{display:flex;align-items:center;gap:14px;padding-top:14px;border-top:1px solid var(--cfcd-line)}
:where(.cf-cart-drawer) .cfcd-seal{flex:none;width:64px;height:64px;object-fit:contain;mix-blend-mode:normal;filter:drop-shadow(0 2px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24))}
:where(.cf-cart-drawer) .cfcd-seal-fallback{flex:none;display:grid;place-items:center;width:52px;height:52px;border-radius:999px;background:transparent;color:var(--success);box-shadow:none}
:where(.cf-cart-drawer) .cfcd-seal-fallback svg{width:26px;height:26px}
:where(.cf-cart-drawer) .cfcd-guar-copy{min-width:0;display:flex;flex-direction:column;gap:3px}
:where(.cf-cart-drawer) .cfcd-guar-copy strong{font-family:var(--font-display,Arial,sans-serif);font-size:16px;font-weight:800;line-height:1.3}
:where(.cf-cart-drawer) .cfcd-guar-copy span{font-size:15px;line-height:1.4;color:var(--cfcd-muted);text-wrap:pretty}
:where(.cf-cart-drawer) .cfcd-spin{animation:cfcd-spin .9s linear infinite}
@keyframes cfcd-spin{to{transform:rotate(360deg)}}
@container cf-cart-drawer (max-width: 400px){
:where(.cf-cart-drawer) .cfcd-head{padding:20px 16px 20px 20px}
:where(.cf-cart-drawer) .cfcd-title{font-size:29px}
:where(.cf-cart-drawer) .cfcd-body{padding:14px}
:where(.cf-cart-drawer) .cfcd-line{grid-template-columns:68px minmax(0,1fr);gap:12px;padding:12px}
:where(.cf-cart-drawer) .cfcd-thumb{width:68px;height:68px}
:where(.cf-cart-drawer) .cfcd-qty-btn{width:34px;height:34px}
:where(.cf-cart-drawer) .cfcd-qty-val{min-width:30px}
:where(.cf-cart-drawer) .cfcd-remove{padding:0;width:44px}
:where(.cf-cart-drawer) .cfcd-remove span{display:none}
:where(.cf-cart-drawer) .cfcd-addon{grid-template-columns:60px minmax(0,1fr);gap:12px;padding:14px}
:where(.cf-cart-drawer) .cfcd-addon-thumb{width:60px;height:60px}
:where(.cf-cart-drawer) .cfcd-foot{padding:18px 16px 20px}
:where(.cf-cart-drawer) .cfcd-sub-amount{font-size:31px}
:where(.cf-cart-drawer) .cfcd-checkout{font-size:18px;gap:10px;padding:10px 10px 10px 16px}
:where(.cf-cart-drawer) .cfcd-pill{font-size:17px;padding:6px 11px}
}
@media (max-width:480px){:where(.cf-cart-drawer) .cfcd-panel--overlay{width:100vw;border-radius:0}}
@media (prefers-reduced-motion:reduce){.cf-cart-drawer *,.cf-cart-drawer *::before,.cf-cart-drawer *::after{transition:none!important;animation:none!important}:where(.cf-cart-drawer) .cfcd-checkout::after{display:none}}
`
export default CartDrawer
const CART_COPY = {
item: 'item', items: 'items', count: '{count} {items}',
shippingRemaining: 'Add {amount} more for free shipping', shippingUnlocked: 'Free shipping unlocked', shippingProgress: 'Progress to free shipping',
emptySummary: 'Nothing in here yet', readySummary: '{count} ready for checkout', close: 'Close cart', retry: 'Try again', cartItems: 'Items in your cart',
addOnTag: 'Add-on', each: '{price} each', quantity: 'Quantity for {name}', decrease: 'Decrease quantity of {name}', increase: 'Increase quantity of {name}',
removeAction: 'Remove {name}', remove: 'Remove', removed: '{name} removed.', undo: 'Undo',
addOnHeading: 'Add the {name} ', addOnPrice: 'for {price}', adding: 'Adding…', add: 'Add to My Order', added: '{name} added to your order.',
subtotal: 'Subtotal ', subtotalCount: '({count})', closeSummary: 'Close cart: {count}, {subtotal}', openSummary: 'Open cart: {count}, {subtotal}',
}
type CartDrawerCopy = typeof CART_COPY
function formatCopy(template: string, values: Record<string, string>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => values[key] ?? match)
}
function richCopy(template: string, values: Record<string, React.ReactNode>) {
return template.split(/(\{\w+\})/g).map((part, i) => <React.Fragment key={i}>{/^\{\w+\}$/.test(part) ? values[part.slice(1, -1)] ?? part : part}</React.Fragment>)
}
pieces/checkout/cart-drawer/specimen.tsx 45 lines
import __studioImage16bba71b from "../assets/55b18158c6739a9a.webp";
import * as React from 'react'
import { CartDrawer, type CartDrawerState } from '../cart-drawer'
import { slot } from '../../slots'
import defaults from '../../studio-defaults.json'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
type SampleItem = (typeof defaults.sample.items)[number]
const slug = (value: string) => value.toLowerCase().replace(/[^a-z0-9]+/g, '-')
const toItem = (item: SampleItem, index: number) => ({
id: slug(item.name),
name: item.name,
detail: item.detail,
price: item.value,
itemImage: slot(`item-${index}`, item.image),
itemImageAlt: item.imageAlt,
})
export default function CartDrawerSpecimen({ state = 'default' }: { state?: CartDrawerState }) {
const sample = defaults.sample
const [guide, workbook, checklist] = sample.items
return (
<div>
<CartDrawer
key={state}
mode='inline'
defaultOpen
state={state}
items={[toItem(guide, 1), toItem(workbook, 2)]}
addOn={toItem(checklist, 3)}
checkoutLabel='Yes! Check Out Now'
secureNote={sample.sublabel}
subtotalNote={sample.note}
guarantee={sample.guarantee}
guaranteeDetail='Not a fit? Ask within 30 days for a full refund.'
sealGuaranteeImage={slot('seal-guarantee', __studioImage16bba71b)}
emptyBody='Add the guide, workbook or checklist and it lands right here, ready for checkout.'
emptyActionLabel='Back to the Kit'
/>
</div>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalCartDrawer |
Partial<CartDrawerCopy> |
|
onAction OptionalCartDrawer |
(lines: CartDrawerCheckoutLine[]) => void | Promise<void> |
|
items OptionalCartDrawer |
CartDrawerItem[] |
Default []
|
addOn OptionalCartDrawer |
CartDrawerAddOn | null |
Default null
|
title OptionalCartDrawer |
string |
Default 'Your Cart'
|
checkoutLabel OptionalCartDrawer |
string |
Default 'Yes! Check Out Now'
|
loadingLabel OptionalCartDrawer |
string |
Default 'Opening Checkout…'
|
successLabel OptionalCartDrawer |
string |
|
secureNote OptionalCartDrawer |
string |
Default ''
|
subtotalNote OptionalCartDrawer |
string |
|
guarantee OptionalCartDrawer |
string |
|
guaranteeDetail OptionalCartDrawer |
string |
|
sealGuaranteeImage OptionalCartDrawer |
string |
|
freeShipping OptionalCartDrawer |
{ threshold: string; unlockedNote?: string } |
|
emptyTitle OptionalCartDrawer |
string |
Default 'Your cart is empty'
|
emptyBody OptionalCartDrawer |
string |
Default 'Add an item and it lands right here, ready for checkout.'
|
emptyActionLabel OptionalCartDrawer |
string |
Default 'Keep Shopping'
|
errorMessage OptionalCartDrawer |
string |
Default 'We couldn’t open checkout. Please try again.'
|
successMessage OptionalCartDrawer |
string |
|
triggerLabel OptionalCartDrawer |
string |
Default 'Cart'
|
mode OptionalCartDrawer |
'overlay' | 'inline' |
Default 'overlay'
|
defaultOpen OptionalCartDrawer |
boolean |
Default false
|
onCheckout OptionalCartDrawer |
(lines: CartDrawerCheckoutLine[]) => void | Promise<void> |
|
state OptionalCartDrawer |
CartDrawerState |
Default 'default'
|
className OptionalCartDrawer |
string |
Default ''
|
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
seal-guarantee- The money-back guarantee seal, on a transparent background.
-
55b18158c6739a9a.webp
image/webp · 228 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB