{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "accordion",
  "title": "Accordion",
  "description": "Questions you open. Ruled off, with a plus that winds into a cross as the question swells into a heading; or run in with their answers like a book's paragraphs; glossed in the outer column; or stood side by side as columns that widen.",
  "registryDependencies": [
    "https://thedirectors.agency/ui/r/0nlytype.json"
  ],
  "files": [
    {
      "path": "registry/0nlytype/ui/accordion.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst AccordionContext = React.createContext<string | undefined>(undefined)\n\ntype AccordionProps = React.ComponentProps<\"div\"> & {\n  /** single: opening one closes the others (native details name grouping). */\n  type?: \"single\" | \"multiple\"\n  /**\n   * cross: questions ruled off; the + winds into × and the open question swells into a heading.\n   * run-in: the book's run-in head; the answer continues the question's own line as one paragraph.\n   * gloss: the answer is hung beside its question in the outer column, as a sidenote glosses a line.\n   */\n  variant?: \"cross\" | \"run-in\" | \"gloss\"\n  /**\n   * vertical (the default): questions stacked down the page. horizontal: the questions stand side by side as\n   * narrow columns, each name stacked a word to a line, and the open one widens until its name steps up onto\n   * one line over its answer. The variant is set aside; below 40rem the columns stack again.\n   */\n  orientation?: \"vertical\" | \"horizontal\"\n}\n\n/** A group of questions. Built on native <details>. */\nfunction Accordion({ type = \"multiple\", variant = \"cross\", orientation = \"vertical\", className, onKeyDown, ...props }: AccordionProps) {\n  const name = React.useId()\n  const across = orientation === \"horizontal\"\n  return (\n    <AccordionContext.Provider value={type === \"single\" ? name : undefined}>\n      <div\n        data-slot=\"accordion\"\n        data-variant={across ? undefined : variant /* side by side has its own form */}\n        data-orientation={across ? orientation : undefined}\n        className={cn(\"ot-accordion\", className)}\n        onKeyDown={(e) => {\n          onKeyDown?.(e)\n          // Side by side, the arrows walk the columns (mirrored right to left); Enter and Space still open, natively.\n          const at = e.target as HTMLElement\n          if (!across || e.defaultPrevented || at.tagName !== \"SUMMARY\" || at.parentElement?.parentElement !== e.currentTarget) return\n          const names = [...e.currentTarget.querySelectorAll<HTMLElement>(\":scope > details > summary\")]\n          const i = names.indexOf(at)\n          const back = getComputedStyle(e.currentTarget).direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\"\n          const next = { Home: 0, End: names.length - 1 }[e.key] ?? (e.key === back ? i - 1 : e.key === (back === \"ArrowLeft\" ? \"ArrowRight\" : \"ArrowLeft\") ? i + 1 : NaN)\n          if (Number.isNaN(next)) return\n          e.preventDefault()\n          names[(next + names.length) % names.length]?.focus()\n        }}\n        {...props}\n      />\n    </AccordionContext.Provider>\n  )\n}\n\ntype AccordionItemProps = Omit<React.ComponentProps<\"details\">, \"open\"> & {\n  /** Start open. The browser owns the state afterwards; listen with onToggle. */\n  defaultOpen?: boolean\n}\n\nfunction AccordionItem({ defaultOpen, className, ...props }: AccordionItemProps) {\n  const name = React.useContext(AccordionContext)\n  return (\n    <details\n      data-slot=\"accordion-item\"\n      name={name}\n      open={defaultOpen}\n      className={cn(\"ot-disclose\", className)}\n      {...props}\n    />\n  )\n}\n\n/** The question. Native, so Enter and Space open it. */\nfunction AccordionTrigger({ className, ...props }: React.ComponentProps<\"summary\">) {\n  return <summary data-slot=\"accordion-trigger\" className={className} {...props} />\n}\n\nfunction AccordionContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return <div data-slot=\"accordion-content\" className={cn(\"ot-disclose-body\", className)} {...props} />\n}\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent, type AccordionProps, type AccordionItemProps }\n",
      "type": "registry:ui"
    },
    {
      "path": "registry/0nlytype/styles/accordion.css",
      "content": "@layer components {\n  /* ── ot-disclose ── a plus that turns into a cross; the open question becomes the heading of its answer */\n  .ot-disclose { border-block-start: var(--ot-hairline) solid var(--ot-rule); }\n  .ot-disclose:not(:has(+ .ot-disclose)) { border-block-end: var(--ot-hairline) solid var(--ot-rule); }\n  .ot-disclose > summary {\n    list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: var(--ot-space-5);\n    padding-block: var(--ot-space-4); cursor: pointer;\n    font-size: var(--ot-mp); line-height: var(--ot-mp-lh); letter-spacing: var(--ot-mp-tr); color: var(--ot-ink);\n    transition: font-size var(--ot-andante) var(--ot-exhale), line-height var(--ot-andante) var(--ot-exhale), letter-spacing var(--ot-andante) var(--ot-exhale),\n      font-stretch var(--ot-andante) var(--ot-exhale), font-weight var(--ot-andante) var(--ot-exhale);\n  }\n  /* The question breathes out as it opens and swells a fifth, into the heading of its answer (\"Less is more.\"). */\n  .ot-disclose[open] > summary { font-size: var(--ot-mf); line-height: var(--ot-mf-lh); letter-spacing: var(--ot-mf-tr); font-stretch: 112%; font-weight: 300; }\n  .ot-disclose > summary::-webkit-details-marker { display: none; }\n  .ot-disclose > summary::after {\n    content: \"+\" / \"\"; font-weight: 200; font-stretch: 100%; /* the mark keeps its size and width while the question grows */\n    font-size: calc(var(--ot-mp) * 1.5); line-height: 0.6; letter-spacing: 0; color: var(--ot-graphite);\n    transition: rotate var(--ot-andante) var(--ot-spiccato);\n  }\n  .ot-disclose[open] > summary::after { rotate: 45deg; }\n  .ot-disclose[open] .ot-disclose-body { animation: ot-arrive var(--ot-andante) var(--ot-exhale) 90ms backwards; }\n  .ot-disclose::details-content {\n    block-size: 0; overflow: clip;\n    transition: block-size var(--ot-andante) var(--ot-exhale), content-visibility var(--ot-andante) allow-discrete;\n  }\n  .ot-disclose[open]::details-content { block-size: auto; }\n  .ot-disclose-body { max-inline-size: var(--ot-measure); padding-block-end: var(--ot-space-5); color: var(--ot-graphite); }\n  .ot-disclose-body > :first-child { margin-block-start: 0; }\n  .ot-disclose-body > :last-child { margin-block-end: 0; }\n\n  /* run-in: the book's run-in head. No rules, only space, as between paragraphs. The question is set heavy and\n     floats at the start of its own line; closed, an ellipsis trails after it; open, the answer runs on from it,\n     written along the line from the question outward. */\n  .ot-accordion[data-variant=\"run-in\"] > .ot-disclose { display: flow-root; max-inline-size: var(--ot-measure); border: 0; padding-block: var(--ot-space-2); font-size: var(--ot-mp); line-height: var(--ot-mp-lh); }\n  .ot-accordion[data-variant=\"run-in\"] > .ot-disclose > summary {\n    float: inline-start; display: block; padding: 0; margin-inline-end: 0.3em;\n    font-size: inherit; line-height: inherit; letter-spacing: var(--ot-mp-tr); font-weight: 600; font-stretch: 100%;\n  }\n  .ot-accordion[data-variant=\"run-in\"] > .ot-disclose > summary::after {\n    content: \"\\2009\\2026\" / \"\"; font-size: 1em; line-height: inherit; font-weight: 300; color: var(--ot-pencil); rotate: none;\n    transition: color var(--ot-allegro);\n  }\n  .ot-accordion[data-variant=\"run-in\"] > .ot-disclose > summary:is(:hover, [data-force~=\"hover\"])::after { color: var(--ot-ink); }\n  .ot-accordion[data-variant=\"run-in\"] > .ot-disclose[open] > summary::after { content: none; }\n  .ot-accordion[data-variant=\"run-in\"] .ot-disclose-body { max-inline-size: none; padding: 0; font-weight: 300; }\n  /* The wipe is steep: it steps down a line while it crosses one, so each line writes from its start in turn. */\n  .ot-accordion[data-variant=\"run-in\"] > .ot-disclose[open] .ot-disclose-body {\n    mask-image: linear-gradient(var(--ot-disclose-pen, 177.5deg), #000 40%, transparent 60%); mask-size: 100% 300%; mask-repeat: no-repeat; mask-position: 0 0;\n    animation: ot-disclose-write var(--ot-andante) linear backwards;\n  }\n  .ot-accordion[data-variant=\"run-in\"]:is([dir=\"rtl\"], [dir=\"rtl\"] *) { --ot-disclose-pen: 182.5deg; }\n  @keyframes ot-disclose-write { from { mask-position: 0 100%; } }\n\n  /* gloss: the answer is hung beside its question in the outer column, flush to the outer edge and ragged\n     toward the question, as a sidenote glosses the line it stands by (\"Less is more.\", \"the silence that heals\").\n     Space holds the two columns apart; no rule stands between them. */\n  .ot-accordion[data-variant=\"gloss\"] > .ot-disclose { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: var(--ot-space-7); align-items: baseline; }\n  .ot-accordion[data-variant=\"gloss\"] > .ot-disclose > summary { grid-column: 1; }\n  .ot-accordion[data-variant=\"gloss\"] > .ot-disclose[open] > summary { font-size: var(--ot-mp); line-height: var(--ot-mp-lh); letter-spacing: var(--ot-mp-tr); }\n  .ot-accordion[data-variant=\"gloss\"] > .ot-disclose::details-content { grid-column: 2; grid-row: 1; }\n  .ot-accordion[data-variant=\"gloss\"] .ot-disclose-body { max-inline-size: none; padding-block: var(--ot-space-4); text-align: end; text-wrap: pretty; }\n  .ot-accordion[data-variant=\"gloss\"] > .ot-disclose[open] .ot-disclose-body { animation: ot-disclose-gloss var(--ot-andante) var(--ot-exhale) 90ms backwards; }\n  @keyframes ot-disclose-gloss { from { opacity: 0; translate: calc(-0.8em * var(--ot-disclose-lr, 1)) 0; } }\n  .ot-accordion[data-variant=\"gloss\"]:is([dir=\"rtl\"], [dir=\"rtl\"] *) { --ot-disclose-lr: -1; }\n  @media (max-width: 40rem) {\n    .ot-accordion[data-variant=\"gloss\"] > .ot-disclose { grid-template-columns: minmax(0, 1fr); }\n    .ot-accordion[data-variant=\"gloss\"] > .ot-disclose::details-content { grid-column: 1; grid-row: 2; }\n    .ot-accordion[data-variant=\"gloss\"] .ot-disclose-body { padding-block-start: 0; padding-inline-start: 25%; }\n  }\n  @media (max-width: 40rem) {\n    .ot-accordion[data-variant=\"run-in\"] > .ot-disclose { font-size: var(--ot-p); line-height: var(--ot-p-lh); }\n  }\n  /* horizontal: the questions stand side by side as narrow columns between hairlines, the way \"Healthy habits\"\n     stacks its notes a word to a line and \"Less is more.\" rules its grid. Opened, a column widens and its name\n     steps up from the stack onto one line, exhaling into the heading of its answer, which arrives once the\n     column has made room. Closed columns keep their width, so the row ends in silence, not in stretched boxes. */\n  .ot-accordion[data-orientation=\"horizontal\"] { display: flex; align-items: stretch; min-block-size: var(--ot-space-10); }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose {\n    flex: 0 0 var(--ot-space-9); min-inline-size: 0; padding-inline: var(--ot-space-4) var(--ot-space-5);\n    border-block: var(--ot-hairline) solid var(--ot-rule);\n    transition: flex-grow var(--ot-andante) var(--ot-exhale);\n  }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose:first-child { padding-inline-start: 0; }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose + .ot-disclose { border-inline-start: var(--ot-hairline) solid var(--ot-rule); }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose[open] { flex-grow: 1; }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose > summary { display: block; font-weight: 500; color: var(--ot-graphite); overflow-wrap: break-word; hyphens: manual; \n    transition: font-size var(--ot-andante) var(--ot-exhale), line-height var(--ot-andante) var(--ot-exhale), letter-spacing var(--ot-andante) var(--ot-exhale),\n      font-stretch var(--ot-andante) var(--ot-exhale), font-weight var(--ot-andante) var(--ot-exhale), color var(--ot-allegro);\n  }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose > summary:is(:hover, [data-force~=\"hover\"]) { color: var(--ot-ink); }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose[open] > summary { color: var(--ot-ink); }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose > summary::after { content: none; } /* the column itself says it opens */\n  .ot-accordion[data-orientation=\"horizontal\"] .ot-disclose-body { max-inline-size: 40ch; }\n  .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose[open] .ot-disclose-body { animation-delay: var(--ot-moderato); }\n  @media (max-width: 40rem) {\n    .ot-accordion[data-orientation=\"horizontal\"] { flex-direction: column; min-block-size: 0; }\n    .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose { flex: none; padding-inline: 0; border-block-end: 0; }\n    .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose:last-child { border-block-end: var(--ot-hairline) solid var(--ot-rule); }\n    .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose + .ot-disclose { border-inline-start: 0; }\n    /* Stacked again, a row no longer looks like it opens: the cross comes back. */\n    .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose > summary { display: flex; }\n    .ot-accordion[data-orientation=\"horizontal\"] > .ot-disclose > summary::after { content: \"+\" / \"\"; }\n  }\n  @media (forced-colors: active) {\n    .ot-accordion[data-variant=\"run-in\"] > .ot-disclose[open] .ot-disclose-body { mask-image: none; }\n  }\n}\n",
      "type": "registry:file",
      "target": "styles/0nlytype/accordion.css"
    }
  ],
  "css": {
    "@import \"../styles/0nlytype/accordion.css\"": {}
  },
  "meta": {
    "movement": "VIII",
    "underneath": "native",
    "contract": "ot-disclose"
  },
  "type": "registry:ui"
}
