{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input-date-range",
  "type": "registry:component",
  "title": "Date Range Picker",
  "description": "A range picker where you drag across days or click a start and an end, with a live preview band that wraps across weeks and a preset column. A running total of days or nights sits above the Apply button.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "forms",
    "date-range",
    "calendar",
    "presets",
    "drag",
    "booking",
    "analytics"
  ],
  "docs": "https://hyperblur.dev/effects/input-date-range",
  "files": [
    {
      "path": "registry/hyperblur/input-date-range.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/input-date-range.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface InputDateRangeValue {\n  start: string | null;\n  end: string | null;\n}\n\nexport interface InputDateRangePreset {\n  label: string;\n  start: string;\n  end: string;\n}\n\nexport interface InputDateRangeProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n  value?: InputDateRangeValue;\n  defaultValue?: InputDateRangeValue;\n  onChange?: (value: InputDateRangeValue) => void;\n  onApply?: (value: InputDateRangeValue) => void;\n  presets?: InputDateRangePreset[];\n  months?: 1 | 2;\n  today?: string;\n  unit?: \"days\" | \"nights\";\n  inline?: boolean;\n  cellSize?: number;\n  accent?: string;\n  label?: string;\n}\n\nconst MONTHS = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\nconst WK = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"];\n\nfunction toDays(y: number, m: number, d: number) {\n  const yy = m <= 2 ? y - 1 : y;\n  const era = Math.floor(yy / 400);\n  const yoe = yy - era * 400;\n  const mp = (m + 9) % 12;\n  const doy = Math.floor((153 * mp + 2) / 5) + d - 1;\n  return era * 146097 + yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy - 719468;\n}\n\nfunction fromDays(n: number) {\n  const z = n + 719468;\n  const era = Math.floor(z / 146097);\n  const doe = z - era * 146097;\n  const yoe = Math.floor((doe - Math.floor(doe / 1460) + Math.floor(doe / 36524) - Math.floor(doe / 146096)) / 365);\n  const doy = doe - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));\n  const mp = Math.floor((5 * doy + 2) / 153);\n  const d = doy - Math.floor((153 * mp + 2) / 5) + 1;\n  const m = mp < 10 ? mp + 3 : mp - 9;\n  return { y: yoe + era * 400 + (m <= 2 ? 1 : 0), m, d };\n}\n\nfunction weekday(n: number) {\n  return (((n + 4) % 7) + 7) % 7;\n}\n\nfunction dim(y: number, m: number) {\n  return toDays(m === 12 ? y + 1 : y, m === 12 ? 1 : m + 1, 1) - toDays(y, m, 1);\n}\n\nfunction toIso(n: number) {\n  const { y, m, d } = fromDays(n);\n  return `${y}-${String(m).padStart(2, \"0\")}-${String(d).padStart(2, \"0\")}`;\n}\n\nfunction fromIso(s?: string | null) {\n  if (!s) return null;\n  const r = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(s);\n  return r ? toDays(Number(r[1]), Number(r[2]), Number(r[3])) : null;\n}\n\nfunction short(n: number, withYear = false) {\n  const { y, m, d } = fromDays(n);\n  return `${MONTHS[m - 1].slice(0, 3)} ${d}${withYear ? `, ${y}` : \"\"}`;\n}\n\nfunction subscribeNone() {\n  return () => {};\n}\n\nfunction readToday() {\n  return new Intl.DateTimeFormat(\"en-CA\").format();\n}\n\nfunction readNull() {\n  return null;\n}\n\nconst css = `\n.hb-xg4 {\n  --hb-xg4-c: #2f7bff;\n  --hb-xg4-cell: 34px;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  font-family: inherit;\n  color: #ededed;\n  container-type: inline-size;\n}\n.hb-xg4 *, .hb-xg4 *::before, .hb-xg4 *::after { box-sizing: border-box; }\n.hb-xg4-label { display: block; margin: 0 0 7px; font-size: 12.5px; font-weight: 500; color: #a1a1a1; }\n.hb-xg4-trigger {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  width: 100%;\n  height: 44px;\n  margin: 0;\n  padding: 0 12px;\n  border: 1px solid #262626;\n  border-radius: 12px;\n  background: linear-gradient(180deg, #161616, #0f0f0f);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 1px 2px rgba(0, 0, 0, 0.5);\n  color: #ededed;\n  font: inherit;\n  font-size: 14px;\n  text-align: left;\n  cursor: pointer;\n  transition: border-color 0.2s ease, box-shadow 0.25s ease;\n}\n.hb-xg4-trigger:hover { border-color: #333; }\n.hb-xg4-trigger:focus-visible, .hb-xg4[data-open=\"true\"] .hb-xg4-trigger {\n  outline: 0;\n  border-color: var(--hb-xg4-c);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 0 0 4px color-mix(in srgb, var(--hb-xg4-c) 16%, transparent);\n}\n.hb-xg4-trigger svg { width: 16px; height: 16px; color: #8f8f8f; flex: none; }\n.hb-xg4-trigger span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hb-xg4-trigger em { font-style: normal; color: #6f6f6f; }\n.hb-xg4-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; animation: hb-xg4-pop 0.26s cubic-bezier(0.22, 1, 0.36, 1); transform-origin: top left; }\n.hb-xg4-panel {\n  display: flex;\n  gap: 12px;\n  width: max-content;\n  max-width: 100%;\n  padding: 10px;\n  border: 1px solid #262626;\n  border-radius: 16px;\n  background: linear-gradient(180deg, #151515, #0f0f0f);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 24px 48px -24px rgba(0, 0, 0, 0.85);\n}\n.hb-xg4-side { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-width: 112px; padding-right: 10px; border-right: 1px solid #1f1f1f; }\n.hb-xg4-presets { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0; list-style: none; }\n.hb-xg4-preset {\n  position: relative;\n  width: 100%;\n  height: calc(var(--hb-xg4-cell) * 0.5 + 9px);\n  margin: 0;\n  padding: 0 8px;\n  border: 0;\n  border-radius: 7px;\n  background: transparent;\n  color: #a1a1a1;\n  font: inherit;\n  font-size: 12px;\n  text-align: left;\n  white-space: nowrap;\n  cursor: pointer;\n  transition: background 0.18s ease, color 0.18s ease;\n}\n.hb-xg4-preset:hover { background: rgba(255, 255, 255, 0.05); color: #ededed; }\n.hb-xg4-preset:focus-visible { outline: 2px solid var(--hb-xg4-c); outline-offset: -2px; }\n.hb-xg4-preset[aria-pressed=\"true\"] { color: #fff; background: color-mix(in srgb, var(--hb-xg4-c) 18%, transparent); }\n.hb-xg4-preset[aria-pressed=\"true\"]::before { content: \"\"; position: absolute; left: 0; top: 25%; bottom: 25%; width: 2px; border-radius: 2px; background: var(--hb-xg4-c); }\n.hb-xg4-sum { display: flex; flex-direction: column; gap: 6px; }\n.hb-xg4-count { font-size: 11px; color: #8f8f8f; }\n.hb-xg4-count b { display: block; font-size: 17px; font-weight: 600; line-height: 1.15; color: #ededed; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }\n.hb-xg4-apply {\n  height: 28px;\n  margin: 0;\n  padding: 0 10px;\n  border: 0;\n  border-radius: 8px;\n  background: linear-gradient(180deg, color-mix(in srgb, var(--hb-xg4-c) 82%, #fff), var(--hb-xg4-c));\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 14px -8px var(--hb-xg4-c);\n  color: #fff;\n  font: inherit;\n  font-size: 12px;\n  font-weight: 600;\n  cursor: pointer;\n  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;\n}\n.hb-xg4-apply:active { transform: scale(0.96); }\n.hb-xg4-apply:disabled { opacity: 0.35; cursor: not-allowed; }\n.hb-xg4-apply:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }\n.hb-xg4-months { position: relative; display: flex; gap: 14px; }\n.hb-xg4-month { width: calc(var(--hb-xg4-cell) * 7); }\n@container (max-width: 520px) { .hb-xg4-month + .hb-xg4-month { display: none; } }\n.hb-xg4-head { position: relative; display: flex; align-items: center; justify-content: center; height: calc(var(--hb-xg4-cell) * 0.6 + 8px); }\n.hb-xg4-title { font-size: 12.5px; font-weight: 600; }\n.hb-xg4-nav {\n  position: absolute;\n  top: calc(var(--hb-xg4-cell) * 0.3 + 4px);\n  z-index: 1;\n  display: grid;\n  place-items: center;\n  width: 24px;\n  height: 24px;\n  margin: -12px 0 0;\n  padding: 0;\n  border: 0;\n  border-radius: 7px;\n  background: transparent;\n  color: #a1a1a1;\n  cursor: pointer;\n}\n.hb-xg4-nav:hover { background: rgba(255, 255, 255, 0.06); color: #ededed; }\n.hb-xg4-nav:focus-visible { outline: 2px solid var(--hb-xg4-c); outline-offset: -1px; }\n.hb-xg4-nav svg { width: 12px; height: 12px; }\n.hb-xg4-nav[data-side=\"prev\"] { left: 0; }\n.hb-xg4-nav[data-side=\"next\"] { right: 0; }\n.hb-xg4-wk, .hb-xg4-grid { display: grid; grid-template-columns: repeat(7, var(--hb-xg4-cell)); }\n.hb-xg4-wk span { font-size: 10px; font-weight: 500; color: #666; text-align: center; line-height: calc(var(--hb-xg4-cell) * 0.5 + 4px); }\n.hb-xg4-grid { row-gap: 2px; touch-action: none; user-select: none; -webkit-user-select: none; }\n.hb-xg4-cell { position: relative; height: var(--hb-xg4-cell); }\n.hb-xg4-cell::before {\n  content: \"\";\n  position: absolute;\n  inset: 3px 0;\n  background: transparent;\n  transition: background 0.16s ease;\n}\n.hb-xg4-cell[data-in=\"true\"]::before { background: color-mix(in srgb, var(--hb-xg4-c) 16%, transparent); }\n.hb-xg4-cell[data-in=\"true\"][data-preview=\"true\"]::before { background: color-mix(in srgb, var(--hb-xg4-c) 9%, transparent); }\n.hb-xg4-cell[data-s=\"true\"]::before { left: 50%; }\n.hb-xg4-cell[data-e=\"true\"]::before { right: 50%; }\n.hb-xg4-cell[data-s=\"true\"][data-e=\"true\"]::before { display: none; }\n.hb-xg4-cell[data-rs=\"true\"]::before { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }\n.hb-xg4-cell[data-re=\"true\"]::before { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }\n.hb-xg4-day {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 100%;\n  height: 100%;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 50%;\n  background: transparent;\n  color: #d4d4d4;\n  font: inherit;\n  font-size: calc(var(--hb-xg4-cell) * 0.36);\n  font-variant-numeric: tabular-nums;\n  cursor: pointer;\n  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.2s ease;\n}\n.hb-xg4-day:hover { background: rgba(255, 255, 255, 0.08); }\n.hb-xg4-day:focus-visible { outline: 2px solid var(--hb-xg4-c); outline-offset: -2px; }\n.hb-xg4-day[data-today=\"true\"] { box-shadow: inset 0 0 0 1px #3a3a3a; }\n.hb-xg4-cell[data-in=\"true\"] .hb-xg4-day { color: #fff; }\n.hb-xg4-cell[data-s=\"true\"] .hb-xg4-day, .hb-xg4-cell[data-e=\"true\"] .hb-xg4-day {\n  color: #fff;\n  font-weight: 600;\n  background: var(--hb-xg4-c);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 12px -4px var(--hb-xg4-c);\n  animation: hb-xg4-pick 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-xg4-cell[data-preview=\"true\"][data-e=\"true\"] .hb-xg4-day { background: transparent; box-shadow: inset 0 0 0 1.5px var(--hb-xg4-c); animation: none; }\n@keyframes hb-xg4-pick { from { transform: scale(0.65); } }\n@keyframes hb-xg4-pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xg4 *, .hb-xg4 *::before, .hb-xg4-pop { transition: none !important; animation: none !important; }\n}\n`;\n\nexport function InputDateRange({\n  value,\n  defaultValue = { start: null, end: null },\n  onChange,\n  onApply,\n  presets,\n  months = 2,\n  today,\n  unit = \"days\",\n  inline = false,\n  cellSize = 34,\n  accent = \"#2f7bff\",\n  label = \"Date range\",\n  className = \"\",\n  style,\n  ...rest\n}: InputDateRangeProps) {\n  const id = React.useId();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const panelRef = React.useRef<HTMLDivElement>(null);\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const focusTarget = React.useRef<number | null>(null);\n  const clock = React.useSyncExternalStore(subscribeNone, readToday, readNull);\n  const now = fromIso(today) ?? fromIso(clock);\n  const controlled = value !== undefined;\n  const [inner, setInner] = React.useState<InputDateRangeValue>(defaultValue);\n  const range = controlled ? value : inner;\n  const s = fromIso(range.start);\n  const e = fromIso(range.end);\n  const [hover, setHover] = React.useState<number | null>(null);\n  const [drag, setDrag] = React.useState<number | null>(null);\n  const [open, setOpen] = React.useState(false);\n  const anchor = s ?? now;\n  const [viewState, setView] = React.useState<number | null>(s !== null ? fromDays(s).y * 12 + fromDays(s).m - 1 : null);\n  const view = viewState ?? (anchor !== null ? fromDays(anchor).y * 12 + fromDays(anchor).m - 1 : null);\n\n  function set(next: InputDateRangeValue) {\n    if (!controlled) setInner(next);\n    onChange?.(next);\n  }\n\n  React.useEffect(() => {\n    if (drag === null) return;\n    function up() {\n      setDrag(null);\n    }\n    window.addEventListener(\"pointerup\", up);\n    window.addEventListener(\"pointercancel\", up);\n    return () => {\n      window.removeEventListener(\"pointerup\", up);\n      window.removeEventListener(\"pointercancel\", up);\n    };\n  }, [drag]);\n\n  React.useEffect(() => {\n    if (!open || inline) return;\n    function down(ev: PointerEvent) {\n      if (!rootRef.current?.contains(ev.target as Node)) setOpen(false);\n    }\n    document.addEventListener(\"pointerdown\", down);\n    return () => document.removeEventListener(\"pointerdown\", down);\n  }, [open, inline]);\n\n  React.useEffect(() => {\n    if (focusTarget.current === null) return;\n    const n = focusTarget.current;\n    focusTarget.current = null;\n    panelRef.current?.querySelector<HTMLButtonElement>(`[data-n=\"${n}\"]`)?.focus();\n  });\n\n  const builtIn: InputDateRangePreset[] =\n    now === null\n      ? []\n      : (() => {\n          const t = fromDays(now);\n          const lmY = t.m === 1 ? t.y - 1 : t.y;\n          const lmM = t.m === 1 ? 12 : t.m - 1;\n          const q = Math.floor((t.m - 1) / 3) * 3 + 1;\n          return [\n            { label: \"Last 7 days\", start: toIso(now - 6), end: toIso(now) },\n            { label: \"Last 30 days\", start: toIso(now - 29), end: toIso(now) },\n            { label: \"This month\", start: toIso(toDays(t.y, t.m, 1)), end: toIso(now) },\n            { label: \"Last month\", start: toIso(toDays(lmY, lmM, 1)), end: toIso(toDays(lmY, lmM, dim(lmY, lmM))) },\n            { label: \"Quarter to date\", start: toIso(toDays(t.y, q, 1)), end: toIso(now) },\n          ];\n        })();\n  const list = presets ?? builtIn;\n\n  function down(n: number, ev: React.PointerEvent<HTMLButtonElement>) {\n    if (ev.button !== 0) return;\n    if (ev.currentTarget.hasPointerCapture(ev.pointerId)) ev.currentTarget.releasePointerCapture(ev.pointerId);\n    if (s !== null && e === null && n !== s) {\n      set({ start: toIso(Math.min(s, n)), end: toIso(Math.max(s, n)) });\n      return;\n    }\n    set({ start: toIso(n), end: null });\n    setDrag(n);\n    setHover(n);\n  }\n\n  function enter(n: number) {\n    setHover(n);\n    if (drag !== null && n !== drag) set({ start: toIso(Math.min(drag, n)), end: toIso(Math.max(drag, n)) });\n  }\n\n  function keyPick(n: number) {\n    if (s !== null && e === null) set({ start: toIso(Math.min(s, n)), end: toIso(Math.max(s, n)) });\n    else set({ start: toIso(n), end: null });\n  }\n\n  function onKey(ev: React.KeyboardEvent<HTMLButtonElement>, n: number) {\n    const map: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 };\n    if (map[ev.key] !== undefined) {\n      ev.preventDefault();\n      const next = n + map[ev.key];\n      const nd = fromDays(next);\n      const idx = nd.y * 12 + nd.m - 1;\n      if (view !== null && (idx < view || idx > view + months - 1)) setView(idx < view ? idx : idx - months + 1);\n      setHover(next);\n      focusTarget.current = next;\n    } else if (ev.key === \"Enter\" || ev.key === \" \") {\n      ev.preventDefault();\n      keyPick(n);\n    } else if (ev.key === \"Escape\" && !inline) {\n      ev.preventDefault();\n      setOpen(false);\n      triggerRef.current?.focus();\n    }\n  }\n\n  let lo = s;\n  let hi = e;\n  const previewing = s !== null && e === null && hover !== null && drag === null;\n  if (previewing && hover !== null && s !== null) {\n    lo = Math.min(s, hover);\n    hi = Math.max(s, hover);\n  }\n\n  const count = s !== null && e !== null ? e - s + (unit === \"days\" ? 1 : 0) : null;\n  const activePreset = list.find((p) => p.start === range.start && p.end === range.end)?.label;\n\n  function monthGrid(idx: number) {\n    const y = Math.floor(idx / 12);\n    const m = (idx % 12) + 1;\n    const first = toDays(y, m, 1);\n    const offset = weekday(first);\n    const total = dim(y, m);\n    const cells = Math.ceil((offset + total) / 7) * 7;\n    const focusDay = s !== null && s >= first && s < first + total ? s : now !== null && now >= first && now < first + total ? now : first;\n    return (\n      <div className=\"hb-xg4-month\" key={idx}>\n        <div className=\"hb-xg4-head\">\n          <span className=\"hb-xg4-title\" aria-live=\"polite\">\n            {MONTHS[m - 1]} {y}\n          </span>\n        </div>\n        <div className=\"hb-xg4-wk\" aria-hidden=\"true\">\n          {WK.map((w) => (\n            <span key={w}>{w}</span>\n          ))}\n        </div>\n        <div className=\"hb-xg4-grid\" role=\"grid\" aria-label={`${MONTHS[m - 1]} ${y}`} onPointerLeave={() => setHover(null)}>\n          {Array.from({ length: cells }, (_, i) => {\n            const d = i - offset + 1;\n            if (d < 1 || d > total) return <div key={i} className=\"hb-xg4-cell\" aria-hidden=\"true\" />;\n            const n = first + d - 1;\n            const col = i % 7;\n            const inside = lo !== null && hi !== null && n >= lo && n <= hi;\n            const isStart = n === lo;\n            const isEnd = n === (hi ?? lo);\n            return (\n              <div\n                key={i}\n                className=\"hb-xg4-cell\"\n                role=\"gridcell\"\n                aria-selected={inside}\n                data-in={inside}\n                data-s={inside && isStart}\n                data-e={inside && isEnd}\n                data-preview={previewing && inside}\n                data-rs={col === 0 || d === 1}\n                data-re={col === 6 || d === total}\n              >\n                <button\n                  type=\"button\"\n                  className=\"hb-xg4-day\"\n                  data-n={n}\n                  data-today={n === now}\n                  tabIndex={n === focusDay ? 0 : -1}\n                  aria-label={`${short(n, true)}${n === s ? \", start\" : \"\"}${n === e ? \", end\" : \"\"}`}\n                  onPointerDown={(ev) => down(n, ev)}\n                  onPointerEnter={() => enter(n)}\n                  onFocus={() => setHover(n)}\n                  onKeyDown={(ev) => onKey(ev, n)}\n                >\n                  {d}\n                </button>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    );\n  }\n\n  const panel = (\n    <div className=\"hb-xg4-panel\" ref={panelRef} role={inline ? \"group\" : \"dialog\"} aria-label=\"Choose a date range\">\n      {list.length > 0 && (\n        <div className=\"hb-xg4-side\">\n          <ul className=\"hb-xg4-presets\">\n            {list.map((p) => (\n              <li key={p.label}>\n                <button\n                  type=\"button\"\n                  className=\"hb-xg4-preset\"\n                  aria-pressed={activePreset === p.label}\n                  onClick={() => {\n                    set({ start: p.start, end: p.end });\n                    const st = fromIso(p.start);\n                    if (st !== null) setView(fromDays(st).y * 12 + fromDays(st).m - 1);\n                  }}\n                >\n                  {p.label}\n                </button>\n              </li>\n            ))}\n          </ul>\n          <div className=\"hb-xg4-sum\">\n            <div className=\"hb-xg4-count\" aria-live=\"polite\">\n              <b>{count !== null ? `${count} ${unit === \"days\" ? (count === 1 ? \"day\" : \"days\") : count === 1 ? \"night\" : \"nights\"}` : \"—\"}</b>\n              {s !== null && e !== null ? `${short(s)} – ${short(e)}` : s !== null ? \"Pick an end date\" : \"Drag across days\"}\n            </div>\n            <button\n              type=\"button\"\n              className=\"hb-xg4-apply\"\n              disabled={s === null || e === null}\n              onClick={() => {\n                onApply?.(range);\n                if (!inline) {\n                  setOpen(false);\n                  triggerRef.current?.focus();\n                }\n              }}\n            >\n              Apply\n            </button>\n          </div>\n        </div>\n      )}\n      <div className=\"hb-xg4-months\">\n        {view !== null && (\n          <>\n            <button type=\"button\" className=\"hb-xg4-nav\" data-side=\"prev\" aria-label=\"Previous month\" onClick={() => setView(view - 1)}>\n              <svg viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" aria-hidden=\"true\">\n                <path d=\"M7.5 2.5L4 6l3.5 3.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n              </svg>\n            </button>\n            <button type=\"button\" className=\"hb-xg4-nav\" data-side=\"next\" aria-label=\"Next month\" onClick={() => setView(view + 1)}>\n              <svg viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" aria-hidden=\"true\">\n                <path d=\"M4.5 2.5L8 6 4.5 9.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n              </svg>\n            </button>\n            {Array.from({ length: months }, (_, k) => monthGrid(view + k))}\n          </>\n        )}\n      </div>\n    </div>\n  );\n\n  const vars = { \"--hb-xg4-c\": accent, \"--hb-xg4-cell\": `${cellSize}px`, ...style } as React.CSSProperties;\n\n  return (\n    <div ref={rootRef} className={`hb-xg4 ${className}`} style={vars} data-open={open} {...rest}>\n      <style href=\"hb-input-date-range\" precedence=\"default\">{css}</style>\n      {inline ? (\n        panel\n      ) : (\n        <>\n          <label className=\"hb-xg4-label\" htmlFor={`${id}-t`}>\n            {label}\n          </label>\n          <button\n            ref={triggerRef}\n            id={`${id}-t`}\n            type=\"button\"\n            className=\"hb-xg4-trigger\"\n            aria-haspopup=\"dialog\"\n            aria-expanded={open}\n            onClick={() => setOpen((o) => !o)}\n            onKeyDown={(ev) => {\n              if (ev.key === \"Escape\") setOpen(false);\n            }}\n          >\n            <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" aria-hidden=\"true\">\n              <rect x=\"2.3\" y=\"3.2\" width=\"11.4\" height=\"10.5\" rx=\"2.2\" />\n              <path d=\"M2.3 6.6h11.4M5.4 1.8v2.6M10.6 1.8v2.6\" strokeLinecap=\"round\" />\n            </svg>\n            <span>\n              {s !== null && e !== null ? (\n                <>\n                  {short(s)} <em>–</em> {short(e, true)}\n                </>\n              ) : (\n                <em>Select dates</em>\n              )}\n            </span>\n          </button>\n          {open && <div className=\"hb-xg4-pop\">{panel}</div>}\n        </>\n      )}\n    </div>\n  );\n}\n"
    }
  ]
}