{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "field-carton",
  "title": "Field: carton size",
  "description": "An example of Field: carton size.",
  "dependencies": [],
  "registryDependencies": [
    "@keyline-ui/field",
    "@keyline-ui/keyline"
  ],
  "files": [
    {
      "path": "src/registry/keyline/examples/field-carton.tsx",
      "content": "\"use client\";\n\nimport { useState, type ChangeEvent } from \"react\";\nimport { FieldGroup, FieldGroupError, FieldGroupJoin, FieldGroupPart } from \"../ui/field\";\n\nconst SHELF = 30; // inches under the truck's top shelf\n\nexport function CartonSize() {\n  const [size, setSize] = useState({ l: \"24\", w: \"18\", h: \"34\" });\n  const tall = Number(size.h) > SHELF;\n  const part = (k: keyof typeof size) => ({\n    inputMode: \"numeric\" as const,\n    value: size[k],\n    onChange: (e: ChangeEvent<HTMLInputElement>) => setSize({ ...size, [k]: e.target.value }),\n  });\n\n  return (\n    <div className=\"grid max-w-[360px] gap-2\">\n      <FieldGroup legend=\"Carton size, inches\" invalid={tall}>\n        <FieldGroupPart label=\"L\" inputProps={part(\"l\")} />\n        <FieldGroupJoin />\n        <FieldGroupPart label=\"W\" inputProps={part(\"w\")} />\n        <FieldGroupJoin />\n        <FieldGroupPart label=\"H\" invalid={tall} inputProps={part(\"h\")} />\n      </FieldGroup>\n      <FieldGroupError>\n        {tall ? `At ${size.h} in, it won't fit under the truck's top shelf. Keep it to ${SHELF} in.` : null}\n      </FieldGroupError>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/keyline/examples/field-carton.tsx"
    }
  ],
  "categories": [
    "field"
  ],
  "type": "registry:block"
}