{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "inventory-count",
  "title": "Inventory Count",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/inventory-count/InventoryCount.tsx",
      "content": "import { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { FormField } from '@/components/ui/form-field'\nimport { Input } from '@/components/ui/input'\nimport { Text } from '@/components/ui/text'\nimport { useAnnouncement } from '@/lib/accessibility'\nimport { cn } from '@/lib/utils'\n\ninterface InventoryCountLabels {\n  recorded: string\n  counted: string\n  invalid: string\n  submit: string\n  difference: (units: number) => string\n}\n\nexport interface InventoryCountProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  item: string\n  sku?: string\n  location?: string\n  /** Recorded non-negative whole units. Omit when the count is blind. */\n  expected?: number\n  /** The current input draft. Empty means the item has not been counted. */\n  value: string\n  onValueChange: (value: string) => void\n  /** Sends a valid physical count to the caller. */\n  onSubmit: (counted: number) => void\n  busy?: boolean\n  error?: string\n  labels?: Partial<InventoryCountLabels>\n}\n\nconst amount = new Intl.NumberFormat()\n\nexport function InventoryCount({\n  className,\n  item,\n  sku,\n  location,\n  expected,\n  value,\n  onValueChange,\n  onSubmit,\n  busy = false,\n  error,\n  labels,\n  ...props\n}: InventoryCountProps) {\n  const draft = value.trim()\n  const parsed = /^[0-9]+$/.test(draft) ? Number(draft) : undefined\n  const counted = parsed !== undefined && Number.isSafeInteger(parsed) ? parsed : undefined\n  const invalidCount = draft.length > 0 && counted === undefined\n  const recorded = expected !== undefined && Number.isSafeInteger(expected) && expected >= 0 ? expected : undefined\n  const difference = counted !== undefined && recorded !== undefined ? counted - recorded : undefined\n  const variance =\n    difference === undefined\n      ? undefined\n      : (labels?.difference?.(difference) ??\n        (difference === 0\n          ? 'Matches recorded stock'\n          : `${amount.format(Math.abs(difference))} ${difference < 0 ? 'fewer' : 'more'} than recorded`))\n  const metadata = [sku, location].filter(Boolean).join(' · ')\n  const submit = labels?.submit ?? 'Submit for review'\n  const visibleError = busy ? undefined : error\n  useAnnouncement(visibleError)\n\n  return (\n    <View {...props} className={cn('gap-[16px]', className)}>\n      <View className=\"gap-[4px]\">\n        <Text size=\"title\" accessibilityRole=\"header\">\n          {item}\n        </Text>\n        {metadata ? <Text variant=\"muted\">{metadata}</Text> : null}\n      </View>\n      <View className=\"gap-[16px] rounded-lg border border-border bg-card p-[16px]\">\n        {recorded !== undefined ? (\n          <View className=\"gap-[4px]\">\n            <Text size=\"sm\" variant=\"muted\">\n              {labels?.recorded ?? 'Recorded stock'}\n            </Text>\n            <Text size=\"xl\" style={{ fontVariant: ['tabular-nums'] }}>\n              {amount.format(recorded)}\n            </Text>\n          </View>\n        ) : null}\n        <FormField\n          label={labels?.counted ?? 'Counted units'}\n          error={invalidCount ? (labels?.invalid ?? 'Enter a whole number of units, 0 or greater.') : undefined}\n        >\n          {(control) => (\n            <Input\n              {...control}\n              inputMode=\"numeric\"\n              autoCorrect={false}\n              editable={!busy}\n              value={value}\n              onChangeText={(next) => {\n                if (!busy) onValueChange(next)\n              }}\n              shakeOnInvalid={false}\n            />\n          )}\n        </FormField>\n        {variance ? (\n          <Text size=\"sm\" className=\"font-medium\">\n            {variance}\n          </Text>\n        ) : null}\n      </View>\n      {visibleError ? (\n        <Text className=\"text-destructive\" accessibilityRole=\"alert\">\n          {visibleError}\n        </Text>\n      ) : null}\n      <Button\n        accessibilityLabel={submit}\n        loading={busy}\n        disabled={counted === undefined}\n        onPress={() => {\n          if (!busy && counted !== undefined) onSubmit(counted)\n        }}\n      >\n        {submit}\n      </Button>\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/inventory-count/InventoryCount.tsx"
    },
    {
      "path": "packages/registry-native/blocks/inventory-count/index.ts",
      "content": "export { InventoryCount, type InventoryCountProps } from './InventoryCount'\n",
      "type": "registry:block",
      "target": "~/components/blocks/inventory-count/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/accessibility.json",
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/form-field.json",
    "https://native.uipkge.dev/r/native/input.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Record a physical stock count, compare with recorded stock and submit it for caller-managed review.",
  "categories": [
    "commerce",
    "operations"
  ]
}