{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"chips","type":"registry:component","title":"Chips","description":"A selection list of 3D chips that press into the surface.","dependencies":["motion"],"files":[{"path":"components/pinui/Chips.tsx","target":"components/pinui/Chips.tsx","type":"registry:component","content":"\"use client\";\n\nimport type React from \"react\";\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { animate } from \"motion/react\";\nimport \"./chips.css\";\n\n/* ------------------------------------------------------------------ props -- */\n\nexport type ChipsProps = {\n  /** Chip radius, clamped to 0–40px. */\n  corner?: number;\n  /** How far the cast shadow is thrown, 0–100. */\n  shadow?: number;\n  /** Rows of four chips: 2, 3 or 4. */\n  rows?: 2 | 3 | 4 | \"2\" | \"3\" | \"4\";\n  /** \"light\" chips on paper, or \"dark\" chips on graphite. */\n  theme?: \"light\" | \"dark\";\n  /** Synthesised press, release, select and hover cues. */\n  sound?: boolean;\n  /** The chip selected on first render; `null` for none. */\n  defaultValue?: string | null;\n  /** Fired with the selected chip's id, or `null` once it is deselected. */\n  onChange?: (value: string | null) => void;\n};\n\n/* ---------------------------------------------------------------- springs -- */\n\nconst SOFT = { type: \"spring\", stiffness: 420, damping: 30, mass: 0.7 } as const;\nconst SNAP = { type: \"spring\", stiffness: 900, damping: 26, mass: 0.5 } as const;\nconst POP = { type: \"spring\", stiffness: 700, damping: 18, mass: 0.6 } as const;\nconst ENTRY = { type: \"spring\", stiffness: 260, damping: 22, mass: 0.9 } as const;\n\n/** How far a chip is still lifted while held down, in px. */\nconst DOWN = 1;\nconst PER_ROW = 4;\n\n/* ------------------------------------------------------------------ sound -- */\n\n/**\n * Synthesised, so nothing has to be downloaded. A click is a noise transient\n * through a bandpass (the plastic) plus a pitched body that drops fast (the\n * travel); that is what reads as tactile rather than as a beep. Kept quiet —\n * it should sit under the interaction.\n */\nfunction useChipSound(enabled: boolean) {\n  const engine = useRef<{ ctx: AudioContext; master: GainNode; noise: AudioBuffer } | null>(null);\n  const on = useRef(enabled);\n  on.current = enabled;\n  const lastHover = useRef(0);\n\n  const ensure = useCallback(() => {\n    if (typeof window === \"undefined\") return null;\n    if (!engine.current) {\n      const AC =\n        window.AudioContext ??\n        (window as { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n      if (!AC) return null;\n      const ctx = new AC();\n      const master = ctx.createGain();\n      master.gain.value = 0.34;\n      master.connect(ctx.destination);\n      const len = Math.floor(ctx.sampleRate * 0.4);\n      const noise = ctx.createBuffer(1, len, ctx.sampleRate);\n      const data = noise.getChannelData(0);\n      for (let i = 0; i < len; i += 1) data[i] = (Math.random() * 2 - 1) * (1 - i / len);\n      engine.current = { ctx, master, noise };\n    }\n    if (engine.current.ctx.state === \"suspended\") void engine.current.ctx.resume();\n    return engine.current;\n  }, []);\n\n  useEffect(() => () => void engine.current?.ctx.close().catch(() => {}), []);\n\n  const voice = useCallback(\n    ({\n      f = 200,\n      f2 = 100,\n      dur = 0.06,\n      type = \"triangle\" as OscillatorType,\n      g = 0.3,\n      noise = 0.7,\n      nf = 3000,\n      q = 1.2,\n      delay = 0,\n    } = {}) => {\n      if (!on.current) return;\n      const e = ensure();\n      if (!e) return;\n      const { ctx, master } = e;\n      const t0 = ctx.currentTime + delay;\n\n      if (noise > 0) {\n        const src = ctx.createBufferSource();\n        src.buffer = e.noise;\n        /* never twice the same */\n        src.playbackRate.value = 0.8 + Math.random() * 0.5;\n        const bp = ctx.createBiquadFilter();\n        bp.type = \"bandpass\";\n        bp.frequency.value = nf;\n        bp.Q.value = q;\n        const ng = ctx.createGain();\n        ng.gain.setValueAtTime(0.0001, t0);\n        ng.gain.exponentialRampToValueAtTime(Math.max(0.001, noise * g), t0 + 0.003);\n        ng.gain.exponentialRampToValueAtTime(0.0001, t0 + dur * 0.8);\n        src.connect(bp).connect(ng).connect(master);\n        src.start(t0);\n        src.stop(t0 + dur + 0.08);\n      }\n\n      const o = ctx.createOscillator();\n      o.type = type;\n      o.frequency.setValueAtTime(f, t0);\n      o.frequency.exponentialRampToValueAtTime(Math.max(30, f2), t0 + dur);\n      const og = ctx.createGain();\n      og.gain.setValueAtTime(0.0001, t0);\n      og.gain.exponentialRampToValueAtTime(Math.max(0.001, g), t0 + 0.004);\n      og.gain.exponentialRampToValueAtTime(0.0001, t0 + dur);\n      o.connect(og).connect(master);\n      o.start(t0);\n      o.stop(t0 + dur + 0.08);\n    },\n    [ensure],\n  );\n\n  return useRef({\n    unlock: () => {\n      if (on.current) ensure();\n    },\n    /* a chip going down onto its edge */\n    press: () => voice({ f: 240, f2: 110, dur: 0.055, g: 0.26, noise: 0.8, nf: 3100, q: 1.1 }),\n    /* it coming back up — lighter, brighter */\n    release: () => voice({ f: 330, f2: 220, dur: 0.034, g: 0.11, noise: 0.55, nf: 5400, q: 1.5 }),\n    /* the chip that just became the selected one */\n    select: () => {\n      voice({ f: 250, f2: 105, dur: 0.06, g: 0.27, noise: 0.78, nf: 2900, q: 1.1 });\n      voice({ f: 560, f2: 300, dur: 0.13, g: 0.08, noise: 0.12, nf: 2200, type: \"sine\", delay: 0.014 });\n    },\n    hover: () => {\n      const now = performance.now();\n      if (now - lastHover.current < 110) return;\n      lastHover.current = now;\n      voice({ f: 1500, f2: 1250, dur: 0.015, g: 0.018, noise: 0.35, nf: 7200, q: 3 });\n    },\n  }).current;\n}\n\n/* ------------------------------------------------------------------ icons -- */\n\nconst ICONS: Record<string, React.ReactNode> = {\n  start: (\n    <>\n      <circle cx=\"5.5\" cy=\"12\" r=\"3\" fill=\"#22c55e\" />\n      <path d=\"M10.5 7.6a1 1 0 0 1 1.5-.87l6.5 3.75a1.2 1.2 0 0 1 0 2.08l-6.5 3.75a1 1 0 0 1-1.5-.87V7.6Z\" fill=\"#22c55e\" />\n    </>\n  ),\n  type: (\n    <>\n      <rect x=\"2\" y=\"4.5\" width=\"20\" height=\"4\" rx=\"2\" fill=\"#f5d64e\" />\n      <rect x=\"2\" y=\"10\" width=\"12\" height=\"4\" rx=\"2\" fill=\"#fbe795\" />\n      <rect x=\"2\" y=\"15.5\" width=\"17\" height=\"4\" rx=\"2\" fill=\"#f5d64e\" />\n    </>\n  ),\n  layout: (\n    <>\n      <rect x=\"2\" y=\"3\" width=\"9\" height=\"8\" rx=\"2.4\" fill=\"#f97316\" />\n      <rect x=\"13\" y=\"3\" width=\"9\" height=\"8\" rx=\"2.4\" fill=\"#fdba74\" />\n      <rect x=\"2\" y=\"13\" width=\"20\" height=\"8\" rx=\"2.4\" fill=\"#f97316\" />\n    </>\n  ),\n  color: (\n    <>\n      <path d=\"M12 2.4c4.3 4.2 7 7.3 7 10.7a7 7 0 1 1-14 0c0-3.4 2.7-6.5 7-10.7Z\" fill=\"#fda4af\" />\n      <path d=\"M12 2.4c4.3 4.2 7 7.3 7 10.7a7 7 0 0 1-7 7V2.4Z\" fill=\"#f43f5e\" />\n      <circle cx=\"12\" cy=\"13.6\" r=\"2\" fill=\"#ffffff\" fillOpacity=\".7\" />\n    </>\n  ),\n  style: (\n    <>\n      <rect x=\"2.5\" y=\"2.5\" width=\"9\" height=\"9\" rx=\"3\" fill=\"#e879f9\" />\n      <rect x=\"12.5\" y=\"12.5\" width=\"9\" height=\"9\" rx=\"3\" fill=\"#d946ef\" />\n      <path d=\"M15.6 3.4a6.2 6.2 0 0 1 5 5M8.4 20.6a6.2 6.2 0 0 1-5-5\" stroke=\"#f0abfc\" strokeWidth=\"2.4\" strokeLinecap=\"round\" />\n    </>\n  ),\n  imagery: (\n    <>\n      <path d=\"M8.6 8.8 15.8 20H1.4L8.6 8.8Z\" fill=\"#a78bfa\" />\n      <path d=\"M15.2 5.2 22.6 20H8.8l6.4-14.8Z\" fill=\"#7c3aed\" />\n      <circle cx=\"5.2\" cy=\"5.4\" r=\"2.4\" fill=\"#c4b5fd\" />\n    </>\n  ),\n  elements: (\n    <>\n      <rect x=\"2.4\" y=\"2.4\" width=\"8.6\" height=\"8.6\" rx=\"2.4\" fill=\"#3b9dfb\" />\n      <rect x=\"13\" y=\"2.4\" width=\"8.6\" height=\"8.6\" rx=\"2.4\" fill=\"#9fcdfd\" />\n      <rect x=\"2.4\" y=\"13\" width=\"8.6\" height=\"8.6\" rx=\"2.4\" fill=\"#9fcdfd\" />\n      <rect x=\"13\" y=\"13\" width=\"8.6\" height=\"8.6\" rx=\"2.4\" fill=\"#3b9dfb\" />\n    </>\n  ),\n  tactics: (\n    <>\n      <path d=\"M6.4 1.8v15.8h15.8\" stroke=\"#a5b4fc\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n      <path d=\"M1.8 6.4h15.8v15.8\" stroke=\"#818cf8\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </>\n  ),\n  motion: (\n    <>\n      <path d=\"M3 6h18\" stroke=\"#2dd4bf\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n      <path d=\"M3 12h12\" stroke=\"#5eead4\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n      <path d=\"M3 18h7\" stroke=\"#2dd4bf\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n    </>\n  ),\n  grid: (\n    <>\n      <rect x=\"2.6\" y=\"2.6\" width=\"18.8\" height=\"18.8\" rx=\"4\" stroke=\"#fb7185\" strokeWidth=\"2.6\" />\n      <path d=\"M2.6 9.2h18.8M9.2 2.6v18.8\" stroke=\"#fda4af\" strokeWidth=\"2.6\" />\n    </>\n  ),\n  spacing: (\n    <>\n      <rect x=\"2.5\" y=\"4\" width=\"19\" height=\"6\" rx=\"2.4\" fill=\"#34d399\" />\n      <rect x=\"2.5\" y=\"14\" width=\"19\" height=\"6\" rx=\"2.4\" fill=\"#a7f3d0\" />\n    </>\n  ),\n  depth: (\n    <>\n      <rect x=\"2.4\" y=\"2.4\" width=\"13\" height=\"13\" rx=\"3.4\" fill=\"#fcd34d\" />\n      <rect x=\"8.6\" y=\"8.6\" width=\"13\" height=\"13\" rx=\"3.4\" fill=\"#f59e0b\" />\n    </>\n  ),\n  voice: (\n    <>\n      <rect x=\"2\" y=\"9\" width=\"3\" height=\"6\" rx=\"1.5\" fill=\"#93c5fd\" />\n      <rect x=\"7\" y=\"5\" width=\"3\" height=\"14\" rx=\"1.5\" fill=\"#2563eb\" />\n      <rect x=\"12\" y=\"2.5\" width=\"3\" height=\"19\" rx=\"1.5\" fill=\"#93c5fd\" />\n      <rect x=\"17\" y=\"7\" width=\"3\" height=\"10\" rx=\"1.5\" fill=\"#2563eb\" />\n    </>\n  ),\n  craft: (\n    <path d=\"M12 2.4 14.9 9l7.1.6-5.4 4.7 1.6 6.9L12 17.5 5.8 21.2l1.6-6.9L2 9.6 9.1 9 12 2.4Z\" fill=\"#f472b6\" />\n  ),\n  flow: (\n    <>\n      <path d=\"M5 9v6a4 4 0 0 0 4 4h6\" stroke=\"#7dd3fc\" strokeWidth=\"2.8\" strokeLinecap=\"round\" />\n      <circle cx=\"5\" cy=\"5\" r=\"3.2\" fill=\"#38bdf8\" />\n      <circle cx=\"19\" cy=\"19\" r=\"3.2\" fill=\"#0284c7\" />\n    </>\n  ),\n  ship: (\n    <>\n      <path d=\"M12 2c3.6 2.7 5.4 6.1 5.4 10.1L15.2 17.4H8.8L6.6 12.1C6.6 8.1 8.4 4.7 12 2Z\" fill=\"#94a3b8\" />\n      <circle cx=\"12\" cy=\"9.4\" r=\"2.2\" fill=\"#fff\" />\n      <path d=\"M9.4 18.6c1.1 1.9 1.8 2.9 2.6 3.4.8-.5 1.5-1.5 2.6-3.4H9.4Z\" fill=\"#f97316\" />\n    </>\n  ),\n};\n\nconst ITEMS = [\n  \"Start\", \"Type\", \"Layout\", \"Color\", \"Style\", \"Imagery\", \"Elements\", \"Tactics\",\n  \"Motion\", \"Grid\", \"Spacing\", \"Depth\", \"Voice\", \"Craft\", \"Flow\", \"Ship\",\n].map((label) => ({ id: label.toLowerCase(), label }));\n\n/* -------------------------------------------------------------- component -- */\n\n/**\n * A list of 3D chips with a real press.\n *\n * Each chip is extruded: its lip is a hard box-shadow `--lift` px deep, and\n * pressing it drives the chip down by exactly that much while the lip shrinks\n * to match — so it travels onto its own edge rather than just shrinking. The\n * soft ground shadow squashes as it goes down. The selected chip stays pressed\n * in, inverted, one pixel proud of the surface.\n *\n * Every transform is Motion's; React only owns which chip is selected.\n */\nexport default function Chips({\n  corner = 20,\n  shadow = 50,\n  rows = 2,\n  theme = \"light\",\n  sound = true,\n  defaultValue = \"start\",\n  onChange,\n}: ChipsProps) {\n  const sfx = useChipSound(sound);\n  const rootRef = useRef<HTMLDivElement>(null);\n  const chipRefs = useRef(new Map<string, HTMLButtonElement>());\n  const [selected, setSelected] = useState<string | null>(defaultValue);\n  const selectedRef = useRef(selected);\n  selectedRef.current = selected;\n\n  const rowCount = Math.min(4, Math.max(2, Number(rows) || 2));\n  const visible = ITEMS.slice(0, rowCount * PER_ROW);\n\n  /* the press travel, from the stylesheet — it is smaller at phone width */\n  const edge = useCallback(() => {\n    /* declared on the list, which is inside the container its size is queried from */\n    const list = rootRef.current?.querySelector(\".pchips__list\");\n    if (!list) return 7;\n    return parseFloat(getComputedStyle(list).getPropertyValue(\"--pchips-edge\")) || 7;\n  }, []);\n\n  const isOn = (el: HTMLElement) => el.dataset.selected === \"true\";\n  const restY = useCallback((el: HTMLElement) => (isOn(el) ? edge() - DOWN : 0), [edge]);\n\n  const depth = useCallback(\n    (el: HTMLElement, px: number, transition: object = SNAP) => {\n      const full = edge();\n      animate(el, { y: full - px }, transition);\n      el.style.setProperty(\"--lift\", `${px}px`);\n      const ground = el.querySelector<HTMLElement>(\".pchips__ground\");\n      if (ground) {\n        animate(\n          ground,\n          { opacity: 0.25 + (px / full) * 0.75, scaleX: 0.84 + (px / full) * 0.16 },\n          { duration: 0.18 },\n        );\n      }\n    },\n    [edge],\n  );\n\n  /* every chip straight to its resting state, no animation */\n  const settle = useCallback(() => {\n    const full = edge();\n    chipRefs.current.forEach((el) => {\n      const on = isOn(el);\n      animate(el, { y: on ? full - DOWN : 0, scale: 1, opacity: 1 }, { duration: 0 });\n      el.style.setProperty(\"--lift\", `${on ? DOWN : full}px`);\n      const ground = el.querySelector<HTMLElement>(\".pchips__ground\");\n      if (ground) animate(ground, { opacity: on ? 0.36 : 1, scaleX: on ? 0.86 : 1 }, { duration: 0 });\n    });\n  }, [edge]);\n\n  /* entrance: the rows drop in, chip by chip — and again whenever the row count changes */\n  useLayoutEffect(() => {\n    settle();\n    const chips = visible.map((item) => chipRefs.current.get(item.id)).filter(Boolean) as HTMLButtonElement[];\n    chips.forEach((el, i) => {\n      el.style.opacity = \"0\";\n      animate(el, { opacity: [0, 1] }, { duration: 0.22, delay: i * 0.055, ease: \"easeOut\" });\n      animate(el, { y: [restY(el) - 28, restY(el)], scale: [0.9, 1] }, { ...ENTRY, delay: i * 0.055 });\n    });\n    /* a hidden tab never runs those frames — never leave a chip stranded */\n    const rescue = window.setTimeout(() => {\n      chips.forEach((el) => {\n        if (el.style.opacity === \"0\") el.style.opacity = \"\";\n      });\n    }, 1400);\n    return () => window.clearTimeout(rescue);\n    /* the entrance belongs to the row count, not to every render */\n  }, [rowCount]);\n\n  /* keep the press depth right when the chips change size */\n  useEffect(() => {\n    const root = rootRef.current;\n    if (!root || typeof ResizeObserver === \"undefined\") return;\n    let last = edge();\n    const observer = new ResizeObserver(() => {\n      const next = edge();\n      if (next !== last) {\n        last = next;\n        settle();\n      }\n    });\n    observer.observe(root);\n    return () => observer.disconnect();\n  }, [edge, settle]);\n\n  function select(id: string) {\n    const prev = selectedRef.current;\n    const next = prev === id ? null : id;\n    selectedRef.current = next;\n    setSelected(next);\n    if (next) sfx.select();\n    else sfx.release();\n\n    chipRefs.current.forEach((el, chipId) => {\n      const icon = el.querySelector<SVGElement>(\".pchips__icon\");\n      /* written now rather than on the next render, so `depth` reads the new state */\n      el.dataset.selected = String(chipId === next);\n      if (chipId === next) {\n        depth(el, DOWN);\n        animate(el, { scale: [0.97, 1.02, 1] }, { duration: 0.34, ease: [0.2, 0.8, 0.2, 1] });\n        if (icon) animate(icon, { rotate: [-14, 0], scale: [1.25, 1] }, SNAP);\n      } else if (chipId === prev) {\n        depth(el, edge(), POP);\n        animate(el, { scale: 1 }, SOFT);\n        if (icon) animate(icon, { rotate: 0, scale: 1 }, SOFT);\n      }\n    });\n\n    onChange?.(next);\n  }\n\n  function wire(item: { id: string }) {\n    const held = { current: false };\n    const el = () => chipRefs.current.get(item.id);\n    const icon = () => el()?.querySelector<SVGElement>(\".pchips__icon\") ?? null;\n    const canHover = () => typeof window !== \"undefined\" && window.matchMedia(\"(hover: hover)\").matches;\n\n    return {\n      onPointerEnter: () => {\n        const chip = el();\n        if (!chip || !canHover() || held.current || isOn(chip)) return;\n        sfx.hover();\n        animate(chip, { y: -3, scale: 1.015 }, SOFT);\n        const i = icon();\n        if (i) animate(i, { rotate: -7, scale: 1.14 }, SOFT);\n      },\n      onPointerLeave: () => {\n        const chip = el();\n        if (!chip || !canHover() || held.current || isOn(chip)) return;\n        animate(chip, { y: 0, scale: 1 }, SOFT);\n        const i = icon();\n        if (i) animate(i, { rotate: 0, scale: 1 }, SOFT);\n      },\n      onPointerDown: (event: React.PointerEvent<HTMLButtonElement>) => {\n        if (event.button !== 0) return;\n        const chip = el();\n        if (!chip) return;\n        sfx.unlock();\n        held.current = true;\n        try {\n          chip.setPointerCapture(event.pointerId);\n        } catch {\n          /* capture is a nicety */\n        }\n        sfx.press();\n        depth(chip, DOWN);\n        animate(chip, { scale: 0.975 }, SNAP);\n        const i = icon();\n        if (i) animate(i, { rotate: 0, scale: 0.94 }, SNAP);\n      },\n      release: () => {\n        const chip = el();\n        if (!chip || !held.current) return;\n        held.current = false;\n        if (isOn(chip)) return;\n        sfx.release();\n        depth(chip, edge(), POP);\n        animate(chip, { scale: 1 }, SOFT);\n        const i = icon();\n        if (i) animate(i, { scale: 1 }, SOFT);\n      },\n    };\n  }\n\n  /* the handlers hold a little per-chip state, so they are made once per chip */\n  const handlers = useRef(new Map<string, ReturnType<typeof wire>>());\n  const handlersFor = (item: { id: string }) => {\n    let h = handlers.current.get(item.id);\n    if (!h) {\n      h = wire(item);\n      handlers.current.set(item.id, h);\n    }\n    return h;\n  };\n\n  function onKeyDown(event: React.KeyboardEvent<HTMLButtonElement>, index: number) {\n    const step =\n      event.key === \"ArrowRight\" || event.key === \"ArrowDown\"\n        ? 1\n        : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\"\n          ? -1\n          : 0;\n    if (!step) return;\n    event.preventDefault();\n    const next = visible[(index + step + visible.length) % visible.length];\n    if (next) chipRefs.current.get(next.id)?.focus();\n  }\n\n  const v = Math.min(100, Math.max(0, shadow)) / 100;\n  const style = {\n    \"--corner\": `${Math.min(40, Math.max(0, corner))}px`,\n    \"--shade\": (v * 2).toFixed(3),\n    \"--cast\": (0.04 + v * 0.58).toFixed(3),\n  } as React.CSSProperties;\n\n  const lines: (typeof ITEMS)[] = [];\n  for (let r = 0; r < rowCount; r += 1) lines.push(visible.slice(r * PER_ROW, r * PER_ROW + PER_ROW));\n\n  return (\n    <div ref={rootRef} className=\"pchips\" data-theme={theme} style={style}>\n      <div className=\"pchips__list\" role=\"listbox\" aria-label=\"Selection list\">\n        {lines.map((line, r) => (\n          <div className=\"pchips__row\" key={r}>\n            {line.map((item) => {\n              const index = visible.indexOf(item);\n              const h = handlersFor(item);\n              const on = selected === item.id;\n              return (\n                <button\n                  key={item.id}\n                  ref={(node) => {\n                    if (node) chipRefs.current.set(item.id, node);\n                    else chipRefs.current.delete(item.id);\n                  }}\n                  className=\"pchips__chip\"\n                  type=\"button\"\n                  role=\"option\"\n                  aria-selected={on}\n                  data-selected={on}\n                  onPointerEnter={h.onPointerEnter}\n                  onPointerLeave={h.onPointerLeave}\n                  onPointerDown={h.onPointerDown}\n                  onPointerUp={h.release}\n                  onPointerCancel={h.release}\n                  onClick={() => select(item.id)}\n                  onKeyDown={(event) => onKeyDown(event, index)}\n                >\n                  <span className=\"pchips__ground\" aria-hidden=\"true\" />\n                  <svg className=\"pchips__icon\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n                    {ICONS[item.id]}\n                  </svg>\n                  <span className=\"pchips__label\">{item.label}</span>\n                </button>\n              );\n            })}\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n}\n"},{"path":"components/pinui/chips.css","target":"components/pinui/chips.css","type":"registry:file","content":"/* ===========================================================================\n   Chips — a selection list of 3D chips with a real press.\n\n   Each chip is extruded: the lip is a hard shadow `--lift` px deep, and the\n   press drives the chip down by exactly that much while the lip shrinks to\n   match. The component sizes itself off its own width (a container query), so\n   it is the same component in a sidebar, a stage or a phone.\n\n   Two themes: light chips on paper, and graphite chips on near-black. The\n   selected chip is the inverse of the rest in both.\n=========================================================================== */\n\n.pchips {\n  --corner: 20px;\n  --cast: 0.33;\n  --shade: 1;\n\n  --pchips-face-top: #ffffff;\n  --pchips-face-bottom: #f4f2ee;\n  --pchips-ink: #111111;\n  --pchips-lip: #d8d4cc;\n  --pchips-sheen: rgb(255 255 255 / 0.9);\n  --pchips-edge-line: rgb(0 0 0 / 0.04);\n  --pchips-cast-rgb: 40 36 28;\n  --pchips-on-top: #35332f;\n  --pchips-on-bottom: #191817;\n  --pchips-on-ink: #ffffff;\n  --pchips-on-lip: #0c0c0b;\n  --pchips-focus: #1b1b1b;\n\n  container-type: inline-size;\n  width: min(100%, 60rem);\n  font-family: Poppins, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n  -webkit-font-smoothing: antialiased;\n}\n\n.pchips[data-theme=\"dark\"] {\n  --pchips-face-top: #34332f;\n  --pchips-face-bottom: #242320;\n  --pchips-ink: #f4f2ee;\n  --pchips-lip: #0d0d0c;\n  --pchips-sheen: rgb(255 255 255 / 0.09);\n  --pchips-edge-line: rgb(0 0 0 / 0.35);\n  --pchips-cast-rgb: 0 0 0;\n  --pchips-on-top: #ffffff;\n  --pchips-on-bottom: #e9e6e0;\n  --pchips-on-ink: #111111;\n  --pchips-on-lip: #a9a49a;\n  --pchips-focus: #f4f2ee;\n}\n\n.pchips__list {\n  /* the press travel; the component reads it back, so the two cannot disagree */\n  --pchips-edge: 7px;\n\n  /* the block sits centred in whatever holds it; the rows stay left-aligned */\n  width: fit-content;\n  max-width: 100%;\n  margin-inline: auto;\n  display: flex;\n  flex-direction: column;\n  align-items: flex-start;\n  gap: 26px;\n}\n\n.pchips__row {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  gap: 26px;\n}\n\n/* ---- the 3D chip -------------------------------------------------------- */\n\n.pchips__chip {\n  --lift: 7px;\n  --lip-color: var(--pchips-lip);\n\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 13px;\n  margin: 0;\n  padding: 15px 26px 15px 20px;\n  border: 0;\n  border-radius: var(--corner);\n  background: linear-gradient(180deg, var(--pchips-face-top) 0%, var(--pchips-face-bottom) 100%);\n  color: var(--pchips-ink);\n  font-family: inherit;\n  font-size: 27px;\n  font-weight: 700;\n  letter-spacing: -0.02em;\n  line-height: 1;\n  white-space: nowrap;\n  cursor: pointer;\n  user-select: none;\n  -webkit-user-select: none;\n  touch-action: manipulation;\n  -webkit-tap-highlight-color: transparent;\n  will-change: transform;\n  box-shadow:\n    inset 0 1px 0 var(--pchips-sheen),\n    0 var(--lift) 0 0 var(--lip-color),\n    0 calc(var(--lift) + 2px) 0 0 var(--pchips-edge-line),\n    0 calc(var(--lift) + 9px * var(--shade)) calc(18px * var(--shade)) -7px\n      rgb(var(--pchips-cast-rgb) / var(--cast));\n  transition:\n    box-shadow 0.16s ease,\n    background 0.28s ease,\n    color 0.28s ease;\n}\n\n/* pixel pointing-hand cursor */\n@media (hover: hover) {\n  .pchips__chip {\n    cursor: url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 16 16' shape-rendering='crispEdges'><path fill='%23fff' d='M5 2h2v5H5zM8 6h4v7H8zM7 6h1v7H7zM4 8h1v3H4zM5 7h2v6H5z'/><path fill='%23000' d='M5 1h2v1H5zM4 2h1v5H4zM7 2h1v4H7zM8 5h2v1H8zM10 6h2v1h-2zM3 7h1v4H3zM12 7h1v6h-1zM4 11h1v2H4zM5 13h7v1H5z'/></svg>\") 6 2, pointer;\n  }\n}\n\n.pchips__chip:focus-visible {\n  outline: 3px solid var(--pchips-focus);\n  outline-offset: 5px;\n}\n\n.pchips__chip[data-selected=\"true\"] {\n  --lip-color: var(--pchips-on-lip);\n  background: linear-gradient(180deg, var(--pchips-on-top) 0%, var(--pchips-on-bottom) 100%);\n  color: var(--pchips-on-ink);\n}\n\n.pchips__icon {\n  display: block;\n  flex: none;\n  width: 30px;\n  height: 30px;\n}\n\n/* soft ground shadow, squashed while the chip is held down */\n.pchips__ground {\n  position: absolute;\n  left: 5%;\n  right: 5%;\n  bottom: -13px;\n  z-index: -1;\n  height: 16px;\n  border-radius: 50%;\n  background: rgb(var(--pchips-cast-rgb) / calc(0.2 * var(--shade)));\n  filter: blur(9px);\n  pointer-events: none;\n}\n\n.pchips__label {\n  display: block;\n}\n\n/* ---- narrow: the same chips, a size down -------------------------------- */\n\n@container (max-width: 760px) {\n  .pchips__list {\n    --pchips-edge: 5px;\n    gap: 18px;\n  }\n\n  .pchips__row {\n    gap: 14px;\n  }\n\n  .pchips__chip {\n    --lift: 5px;\n    gap: 9px;\n    padding: 11px 17px 11px 13px;\n    font-size: 19px;\n  }\n\n  .pchips__icon {\n    width: 22px;\n    height: 22px;\n  }\n\n  .pchips__ground {\n    bottom: -9px;\n    height: 12px;\n    filter: blur(7px);\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .pchips__chip {\n    transition: none;\n  }\n}\n"}],"docs":"Chips — A selection list of 3D chips that press into the surface.\n\nThe stylesheet sits next to the component and is imported by it, so keep the two together in components/pinui/.\n\nIt is drawn in Poppins (600, 700 and 800). If your project does not already load that face it will fall back to your system sans and look noticeably different.\n\nIt comes in two themes: pass theme=\"dark\" for the dark one, or wire the prop to your own theme switch."}