{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "book-appointment",
  "title": "Book Appointment",
  "author": "AlgorizeTech",
  "description": "Ask the user to pick one of 2 book appointment variants: https://avaraui.com/view/book-appointment. This item holds 2 of them as looks of one component (glass, solid). Skip the question if the user already named one. A practitioner's page that ends in an appointment: portrait and contact, scores as stars, two small charts, and a booking panel — glass or solid. Use it for clinics, salons, consultations.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/booking-card.json",
    "https://avaraui.com/r/chart.json",
    "https://avaraui.com/r/glass-panel.json",
    "https://avaraui.com/r/half-stars.json"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/BookAppointmentBlock.tsx",
      "content": "\"use client\";\n\nimport { BookingCard, type Booking, type BookingSlot } from \"@/components/custom/blocks/BookingCardBlock\";\nimport { ChartBlock } from \"@/components/custom/blocks/ChartBlock\";\nimport { GlassBackdrop, GlassPanel, type SurfaceVariant } from \"@/components/custom/blocks/GlassPanelBlock\";\nimport { HalfStars } from \"@/components/custom/blocks/HalfStarsBlock\";\nimport { Languages, Mail, MapPin, Phone } from \"lucide-react\";\nimport React from \"react\";\n\n// ==========================================\n// BOOK APPOINTMENT — a practitioner's page that ends in a booking\n// ==========================================\n// Composed entirely from library pieces: `GlassBackdrop` + `GlassPanel` for\n// the surface, `HalfStars` for the scores, `ChartBlock` for the donut and the\n// stacked bar, and `BookingCard` for the booking itself.\n\nexport interface Practitioner {\n  /** Full name as shown in the heading, e.g. \"Dr. Priya Nair, MD\". */\n  name: string;\n  /** How the confirmation refers to them, e.g. \"Dr. Nair\". Falls back to `name`. */\n  shortName?: string;\n  /** One line under the name, e.g. \"Cardiology and general internal medicine\". */\n  specialties: string;\n  practice: string;\n  photo: string;\n  photoAlt?: string;\n  /** Overall score out of 5 — the one loud number on the page. */\n  rating: number;\n  reviews: number;\n  /** A short read of what patients say. */\n  summary: string;\n  location?: string;\n  phone?: string;\n  email?: string;\n  languages?: string;\n}\n\n/** A named score out of 5, e.g. \"Punctuality\". */\nexport interface PractitionerScore {\n  label: string;\n  value: number;\n}\n\n/** A labelled share of a whole, in percent. */\nexport interface Share {\n  label: string;\n  value: number;\n}\n\n/** A group of times, e.g. \"Morning\". */\nexport interface SlotGroup {\n  label: string;\n  slots: BookingSlot[];\n}\n\nexport interface BookAppointmentProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSubmit\"> {\n  practitioner: Practitioner;\n  /** Named scores shown as stars under the summary. */\n  scores?: PractitionerScore[];\n  /** Fills the donut. Omit to leave that panel out. */\n  visitReasons?: Share[];\n  /** Fills the stacked bar. Omit to leave that panel out. */\n  activities?: Share[];\n  /** Time slots on offer, grouped. */\n  slotGroups: SlotGroup[];\n  /** Days with nothing free — struck through in the day strip. */\n  unavailable?: (day: Date) => boolean;\n  /**\n   * Called when the person confirms. Return a promise to keep the button busy\n   * until the booking is really made; a rejection returns to the form.\n   */\n  onBook?: (booking: Booking) => void | Promise<void>;\n  /** Heading over the booking panel. */\n  bookingHeading?: string;\n  /** Frosted glass over an aurora, or solid cards with a shadow. */\n  variant?: SurfaceVariant;\n  /** The three aurora colours behind the glass. Ignored by `solid`. */\n  aurora?: [string, string, string];\n}\n\nexport function BookAppointment({\n  practitioner,\n  scores = [],\n  visitReasons,\n  activities,\n  slotGroups,\n  unavailable,\n  onBook,\n  bookingHeading = \"Schedule a visit\",\n  variant = \"glass\",\n  aurora = [\"#c4b5fd\", \"#99f6e4\", \"#fde68a\"],\n  className,\n  ...props\n}: BookAppointmentProps) {\n  const contact = [\n    { Icon: MapPin, value: practitioner.location, href: undefined },\n    { Icon: Phone, value: practitioner.phone, href: practitioner.phone ? `tel:${practitioner.phone.replace(/[^\\d+]/g, \"\")}` : undefined },\n    { Icon: Mail, value: practitioner.email, href: practitioner.email ? `mailto:${practitioner.email}` : undefined },\n    { Icon: Languages, value: practitioner.languages, href: undefined },\n  ].filter((row) => row.value);\n\n  return (\n    <GlassBackdrop variant={variant} aurora={aurora} className={className} {...props}>\n      {/* Portrait and contact */}\n      <div className=\"flex flex-col gap-4 md:col-span-2 lg:col-span-3\">\n        <GlassPanel shape=\"slab\" className=\"overflow-hidden\">\n          <img\n            src={practitioner.photo}\n            alt={practitioner.photoAlt ?? practitioner.name}\n            loading=\"lazy\"\n            className=\"aspect-[3/4] w-full object-cover object-top\"\n          />\n        </GlassPanel>\n\n        {contact.length > 0 && (\n          <GlassPanel className=\"p-5\">\n            <ul className=\"space-y-2.5 text-sm\">\n              {contact.map(({ Icon, value, href }) => (\n                <li key={value} className=\"flex items-center gap-2.5\">\n                  <Icon className=\"size-4 shrink-0 text-foreground/50\" aria-hidden />\n                  {href ? (\n                    <a href={href} className=\"hover:underline\">{value}</a>\n                  ) : (\n                    <span>{value}</span>\n                  )}\n                </li>\n              ))}\n            </ul>\n          </GlassPanel>\n        )}\n      </div>\n\n      {/* Name, scores, charts */}\n      <div className=\"flex flex-col gap-4 md:col-span-4 lg:col-span-5\">\n        <GlassPanel shape=\"slab\" className=\"flex flex-col gap-5 p-6\">\n          <div>\n            <h1 className=\"text-2xl font-semibold tracking-tight sm:text-3xl\">{practitioner.name}</h1>\n            <p className=\"mt-1 text-sm text-foreground/60\">{practitioner.specialties}</p>\n          </div>\n\n          <div className=\"flex gap-4\">\n            {/* The score is the one loud element on the page */}\n            <div className=\"grid size-24 shrink-0 place-items-center rounded-[30%] bg-primary text-primary-foreground\">\n              <div className=\"text-center\">\n                <p className=\"text-3xl font-semibold leading-none tabular-nums\">{practitioner.rating}</p>\n                <p className=\"mt-1 text-[11px] opacity-80\">{practitioner.reviews} reviews</p>\n              </div>\n            </div>\n            <div className=\"min-w-0\">\n              <p className=\"text-xs font-medium text-foreground/50\">What patients report</p>\n              <p className=\"mt-1 text-sm leading-relaxed text-foreground/70\">{practitioner.summary}</p>\n            </div>\n          </div>\n\n          {scores.length > 0 && (\n            <div className=\"flex flex-wrap gap-x-6 gap-y-3\">\n              {scores.map((s) => (\n                <div key={s.label} className=\"shrink-0\">\n                  <p className=\"text-xs text-foreground/50\">{s.label}</p>\n                  <div className=\"mt-1 flex items-center gap-2\">\n                    <HalfStars\n                      rating={s.value}\n                      size={14}\n                      showText={false}\n                      activeColor=\"text-amber-500\"\n                      inactiveColor=\"text-foreground/20\"\n                      role=\"img\"\n                      aria-label={`${s.label}: ${s.value.toFixed(2)} out of 5`}\n                    />\n                    <span className=\"text-sm font-semibold tabular-nums\">{s.value.toFixed(2)}</span>\n                  </div>\n                </div>\n              ))}\n            </div>\n          )}\n        </GlassPanel>\n\n        {visitReasons && visitReasons.length > 0 && (\n          <GlassPanel className=\"p-6\">\n            <h2 className=\"text-sm font-semibold\">Why patients come in</h2>\n            <ChartBlock\n              type=\"donut-legend\"\n              data={visitReasons}\n              valueSuffix=\"%\"\n              centerLabel=\"most common\"\n              hoverLabel=\"of visits\"\n              className=\"mt-4\"\n            />\n          </GlassPanel>\n        )}\n\n        {activities && activities.length > 0 && (\n          <GlassPanel className=\"p-6\">\n            <h2 className=\"text-sm font-semibold\">How her week splits</h2>\n            <ChartBlock type=\"stacked-bar\" data={activities} valueSuffix=\"%\" className=\"mt-4\" />\n          </GlassPanel>\n        )}\n      </div>\n\n      {/* Booking */}\n      {/* The BookingCard is the panel's whole inside, so its confirmation covers\n          the panel edge to edge instead of stopping at the padding. */}\n      <GlassPanel shape=\"slab\" className=\"self-start md:col-span-6 lg:col-span-4\">\n        <BookingCard className=\"flex h-full flex-col gap-5 p-6\" {...(onBook ? { onBook } : {})}>\n          <h2 className=\"text-lg font-semibold tracking-tight\">{bookingHeading}</h2>\n          <BookingCard.Days {...(unavailable ? { unavailable } : {})} />\n          <div className=\"space-y-4\">\n            <p className=\"text-sm font-semibold\">Time</p>\n            {slotGroups.map((group) => (\n              <BookingCard.Slots key={group.label} label={group.label} slots={group.slots} />\n            ))}\n          </div>\n          <BookingCard.Submit className=\"mt-auto\" />\n          <BookingCard.Confirmation\n            withName={practitioner.shortName ?? practitioner.name}\n            place={practitioner.practice}\n          />\n        </BookingCard>\n      </GlassPanel>\n    </GlassBackdrop>\n  );\n}\n\nexport default BookAppointment;\n",
      "type": "registry:component",
      "target": "components/custom/blocks/BookAppointmentBlock.tsx"
    }
  ],
  "docs": "Named export: BookAppointment. Composed from the booking-card, glass-panel, half-stars and chart items, which install alongside it. Pass `practitioner`, `slotGroups` and `onBook`; `scores`, `visitReasons` and `activities` fill the stars, donut and bar; `variant` switches glass to solid.",
  "categories": [
    "forms",
    "marketing"
  ],
  "type": "registry:component"
}
