{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "order-cart-bar",
  "type": "registry:component",
  "title": "Order Cart Bar",
  "description": "A floating View order bar that slides up once the cart has items, bumps the count when it changes and shows progress toward a free delivery threshold.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "ordering",
    "cart",
    "order",
    "checkout",
    "floating bar",
    "delivery",
    "menu"
  ],
  "docs": "https://hyperblur.dev/effects/order-cart-bar",
  "files": [
    {
      "path": "registry/hyperblur/order-cart-bar.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/order-cart-bar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface OrderCartBarLabels {\n  view: string;\n  itemsOne: string;\n  itemsMany: string;\n  freeDeliveryLeft: string;\n  freeDeliveryUnlocked: string;\n}\n\nexport interface OrderCartBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onClick\"> {\n  count?: number;\n  total?: number;\n  currency?: string;\n  locale?: string;\n  freeDeliveryThreshold?: number;\n  position?: \"fixed\" | \"sticky\" | \"static\";\n  offset?: number;\n  hideWhenEmpty?: boolean;\n  theme?: \"dark\" | \"light\";\n  accent?: string;\n  labels?: Partial<OrderCartBarLabels>;\n  onOpen?: () => void;\n}\n\nconst defaultLabels: OrderCartBarLabels = {\n  view: \"View order\",\n  itemsOne: \"{count} item\",\n  itemsMany: \"{count} items\",\n  freeDeliveryLeft: \"Add {amount} for free delivery\",\n  freeDeliveryUnlocked: \"Free delivery unlocked\",\n};\n\nconst css = `\n.hb-ob1 {\n  --hb-ob1-bg: #111111;\n  --hb-ob1-line: #262626;\n  --hb-ob1-text: #ededed;\n  --hb-ob1-muted: #a1a1a1;\n  --hb-ob1-track: #262626;\n  box-sizing: border-box;\n  z-index: 40;\n  font-family: inherit;\n  pointer-events: none;\n}\n.hb-ob1 *, .hb-ob1 *::before, .hb-ob1 *::after { box-sizing: border-box; }\n.hb-ob1[data-theme=\"light\"] {\n  --hb-ob1-bg: #ffffff;\n  --hb-ob1-line: #e6e3dc;\n  --hb-ob1-text: #141414;\n  --hb-ob1-muted: #6b6b6b;\n  --hb-ob1-track: #ece9e2;\n}\n.hb-ob1[data-position=\"fixed\"] {\n  position: fixed;\n  left: 0;\n  right: 0;\n  bottom: calc(var(--hb-ob1-offset) + env(safe-area-inset-bottom, 0px));\n  display: flex;\n  justify-content: center;\n  padding: 0 12px;\n}\n.hb-ob1[data-position=\"sticky\"] {\n  position: sticky;\n  bottom: var(--hb-ob1-offset);\n  width: 100%;\n}\n.hb-ob1[data-position=\"static\"] { position: relative; width: 100%; }\n.hb-ob1-btn {\n  pointer-events: auto;\n  position: relative;\n  display: grid;\n  grid-template-columns: auto minmax(0, 1fr) auto;\n  align-items: center;\n  gap: 12px;\n  width: 100%;\n  max-width: 560px;\n  margin: 0 auto;\n  padding: 9px 9px 9px 10px;\n  border: 1px solid var(--hb-ob1-line);\n  border-radius: 18px;\n  background: var(--hb-ob1-bg);\n  color: var(--hb-ob1-text);\n  font: inherit;\n  text-align: left;\n  cursor: pointer;\n  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.18);\n  transform: translateY(0);\n  opacity: 1;\n  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.1), opacity 0.3s ease, border-color 0.2s ease;\n  animation: hb-ob1-rise 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-ob1-btn:hover { border-color: color-mix(in srgb, var(--hb-ob1-accent) 45%, var(--hb-ob1-line)); }\n.hb-ob1-btn:active { transform: scale(0.985); }\n.hb-ob1-btn:focus-visible { outline: 2px solid var(--hb-ob1-accent); outline-offset: 3px; }\n.hb-ob1[data-visible=\"false\"] .hb-ob1-btn {\n  transform: translateY(calc(100% + 32px));\n  opacity: 0;\n  pointer-events: none;\n  animation: none;\n}\n.hb-ob1-bag {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 40px;\n  height: 40px;\n  border-radius: 12px;\n  background: color-mix(in srgb, var(--hb-ob1-accent) 16%, transparent);\n  color: var(--hb-ob1-accent);\n}\n.hb-ob1-bag svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }\n.hb-ob1-count {\n  position: absolute;\n  top: -6px;\n  right: -6px;\n  min-width: 20px;\n  height: 20px;\n  padding: 0 5px;\n  border: 2px solid var(--hb-ob1-bg);\n  border-radius: 999px;\n  background: var(--hb-ob1-accent);\n  color: #fff;\n  font-size: 11px;\n  font-weight: 700;\n  line-height: 16px;\n  text-align: center;\n  font-variant-numeric: tabular-nums;\n  animation: hb-ob1-bump 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both;\n}\n.hb-ob1-mid { display: flex; min-width: 0; flex-direction: column; gap: 5px; }\n.hb-ob1-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; }\n.hb-ob1-items { color: var(--hb-ob1-muted); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }\n.hb-ob1-goal { display: flex; align-items: center; gap: 8px; min-width: 0; }\n.hb-ob1-track { position: relative; flex: 0 0 56px; height: 4px; overflow: hidden; border-radius: 999px; background: var(--hb-ob1-track); }\n.hb-ob1-fill {\n  position: absolute;\n  inset: 0;\n  border-radius: inherit;\n  background: var(--hb-ob1-accent);\n  transform-origin: left center;\n  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);\n}\n.hb-ob1-goaltext { min-width: 0; overflow: hidden; color: var(--hb-ob1-muted); font-size: 11.5px; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }\n.hb-ob1-goal[data-done=\"true\"] .hb-ob1-goaltext { color: color-mix(in srgb, var(--hb-ob1-accent) 80%, var(--hb-ob1-text)); }\n.hb-ob1-total {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  height: 40px;\n  padding: 0 14px;\n  border-radius: 12px;\n  background: var(--hb-ob1-accent);\n  color: #fff;\n  font-size: 14px;\n  font-weight: 700;\n  font-variant-numeric: tabular-nums;\n  white-space: nowrap;\n}\n.hb-ob1-total span { display: inline-block; animation: hb-ob1-tick 0.4s ease both; }\n.hb-ob1-total svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }\n.hb-ob1-btn:hover .hb-ob1-total svg { transform: translateX(2px); }\n@container (max-width: 340px) {\n  .hb-ob1-track { flex-basis: 36px; }\n  .hb-ob1-total { padding: 0 11px; }\n}\n@keyframes hb-ob1-rise { from { transform: translateY(calc(100% + 32px)); opacity: 0; } to { transform: translateY(0); opacity: 1; } }\n@keyframes hb-ob1-bump { 0% { transform: scale(0.6); } 55% { transform: scale(1.25); } 100% { transform: scale(1); } }\n@keyframes hb-ob1-tick { from { transform: translateY(40%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-ob1-btn, .hb-ob1-count, .hb-ob1-total span, .hb-ob1-fill, .hb-ob1-total svg { animation: none; transition: none; }\n}\n`;\n\nfunction fill(template: string, values: Record<string, string>) {\n  return template.replace(/\\{(\\w+)\\}/g, (m, k: string) => (k in values ? values[k] : m));\n}\n\nexport function OrderCartBar({\n  count = 3,\n  total = 54,\n  currency = \"USD\",\n  locale = \"en-US\",\n  freeDeliveryThreshold = 60,\n  position = \"fixed\",\n  offset = 16,\n  hideWhenEmpty = true,\n  theme = \"dark\",\n  accent = \"#2f7bff\",\n  labels,\n  onOpen,\n  className,\n  style,\n  ...rest\n}: OrderCartBarProps) {\n  const l = { ...defaultLabels, ...labels };\n  const money = React.useMemo(() => new Intl.NumberFormat(locale, { style: \"currency\", currency }), [locale, currency]);\n  const visible = !hideWhenEmpty || count > 0;\n  const goal = freeDeliveryThreshold > 0;\n  const ratio = goal ? Math.min(1, Math.max(0, total / freeDeliveryThreshold)) : 0;\n  const done = goal && total >= freeDeliveryThreshold;\n  const itemsText = fill(count === 1 ? l.itemsOne : l.itemsMany, { count: String(count) });\n  const goalText = done ? l.freeDeliveryUnlocked : fill(l.freeDeliveryLeft, { amount: money.format(freeDeliveryThreshold - total) });\n\n  return (\n    <div\n      className={[\"hb-ob1\", className].filter(Boolean).join(\" \")}\n      data-position={position}\n      data-theme={theme}\n      data-visible={visible ? \"true\" : \"false\"}\n      style={{ \"--hb-ob1-accent\": accent, \"--hb-ob1-offset\": `${offset}px`, containerType: \"inline-size\", ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-order-cart-bar\" precedence=\"default\">{css}</style>\n      <button\n        type=\"button\"\n        className=\"hb-ob1-btn\"\n        onClick={onOpen}\n        tabIndex={visible ? 0 : -1}\n        aria-hidden={visible ? undefined : true}\n        aria-label={`${l.view}, ${itemsText}, ${money.format(total)}`}\n      >\n        <span className=\"hb-ob1-bag\" aria-hidden=\"true\">\n          <svg viewBox=\"0 0 24 24\">\n            <path d=\"M5 8h14l-1.2 11.1a2 2 0 0 1-2 1.9H8.2a2 2 0 0 1-2-1.9L5 8Z\" />\n            <path d=\"M9 10V6.5a3 3 0 0 1 6 0V10\" />\n          </svg>\n          {count > 0 ? (\n            <span key={count} className=\"hb-ob1-count\">\n              {count}\n            </span>\n          ) : null}\n        </span>\n        <span className=\"hb-ob1-mid\" aria-hidden=\"true\">\n          <span className=\"hb-ob1-title\">\n            {l.view}\n            <span className=\"hb-ob1-items\">{itemsText}</span>\n          </span>\n          {goal ? (\n            <span className=\"hb-ob1-goal\" data-done={done ? \"true\" : \"false\"}>\n              <span className=\"hb-ob1-track\">\n                <span className=\"hb-ob1-fill\" style={{ transform: `scaleX(${ratio.toFixed(4)})` }} />\n              </span>\n              <span className=\"hb-ob1-goaltext\">{goalText}</span>\n            </span>\n          ) : null}\n        </span>\n        <span className=\"hb-ob1-total\" aria-hidden=\"true\">\n          <span key={total.toFixed(2)}>{money.format(total)}</span>\n          <svg viewBox=\"0 0 24 24\">\n            <path d=\"m9 6 6 6-6 6\" />\n          </svg>\n        </span>\n      </button>\n    </div>\n  );\n}\n"
    }
  ]
}