{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "jsonforms-number-format-cell",
  "description": "JSONForms formatted number cell for fields inside array table layouts. Displays the current value formatted; on focus switches to a raw number input.",
  "dependencies": [
    "@jsonforms/core",
    "@jsonforms/react"
  ],
  "registryDependencies": [
    "input"
  ],
  "files": [
    {
      "path": "registry/forms/renderers/cells/number-format-cell.tsx",
      "content": "'use client';\n\nimport { CellProps, isNumberControl, rankWith } from '@jsonforms/core';\nimport { withJsonFormsCellProps } from '@jsonforms/react';\nimport { useState } from 'react';\n\nimport { Input } from '~/components/ui/input';\n\nconst NumberFormatCell = ({ data, handleChange, path, enabled }: CellProps) => {\n    const [focused, setFocused] = useState(false);\n\n    const formatted =\n        !focused && data !== undefined && data !== null && !isNaN(data)\n            ? new Intl.NumberFormat().format(data)\n            : (data ?? '');\n\n    return (\n        <Input\n            type={focused ? 'number' : 'text'}\n            value={focused ? (data ?? '') : formatted}\n            onChange={e => handleChange(path, e.target.valueAsNumber)}\n            onFocus={() => setFocused(true)}\n            onBlur={() => setFocused(false)}\n            disabled={!enabled}\n            className=\"h-8 text-xs\"\n        />\n    );\n};\n\nexport const numberFormatCellTester = rankWith(4, isNumberControl);\nexport default withJsonFormsCellProps(NumberFormatCell);",
      "type": "registry:component",
      "target": "components/forms/renderers/cells/number-format-cell.tsx"
    }
  ],
  "type": "registry:component"
}