{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "quantity-stepper",
  "title": "Quantity Stepper",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/quantity-stepper/QuantityStepper.tsx",
      "content": "import * as React from 'react'\nimport { Platform, View, type ViewProps } from 'react-native'\nimport { Minus, Plus } from 'lucide-react-native'\nimport { IconButton } from '@/components/ui/icon-button'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nconst numberFormatter = new Intl.NumberFormat()\n\nexport interface QuantityStepperProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  value?: number\n  defaultValue?: number\n  /** Inclusive, non-negative integer bounds. */\n  min?: number\n  max?: number\n  disabled?: boolean\n  onValueChange?: (value: number) => void\n  decrementLabel?: string\n  incrementLabel?: string\n  formatValue?: (value: number) => string\n}\n\n/** Bounded, whole-number adjustment for touch and assistive technology. */\nexport const QuantityStepper = React.forwardRef<React.ComponentRef<typeof View>, QuantityStepperProps>(\n  (\n    {\n      className,\n      value,\n      defaultValue,\n      min = 0,\n      max = 99,\n      disabled = false,\n      onValueChange,\n      decrementLabel = 'Decrease quantity',\n      incrementLabel = 'Increase quantity',\n      formatValue,\n      accessibilityLabel = 'Quantity',\n      accessibilityState,\n      onAccessibilityAction,\n      ...props\n    },\n    ref,\n  ) => {\n    const minimum = Number.isSafeInteger(min) ? Math.max(0, min) : 0\n    const maximum = Math.max(minimum, Number.isSafeInteger(max) ? max : 99)\n    const [internal, setInternal] = React.useState(defaultValue ?? minimum)\n    const internalRef = React.useRef(internal)\n    const clamp = (candidate: number) =>\n      Number.isFinite(candidate) ? Math.min(maximum, Math.max(minimum, Math.round(candidate))) : minimum\n    const count = clamp(value ?? internal)\n    const countText = formatValue ? formatValue(count) : numberFormatter.format(count)\n    const canDecrease = !disabled && count > minimum\n    const canIncrease = !disabled && count < maximum\n    const nativeAdjustable = Platform.OS !== 'web'\n\n    function adjust(direction: -1 | 1) {\n      if (disabled) return\n      const current = clamp(value ?? internalRef.current)\n      const next = clamp(current + direction)\n      if (next === current) return\n      if (value === undefined) {\n        internalRef.current = next\n        setInternal(next)\n      }\n      onValueChange?.(next)\n    }\n\n    return (\n      <View\n        ref={ref}\n        {...props}\n        className={cn('flex-row items-center gap-[8px]', className)}\n        accessible={nativeAdjustable || undefined}\n        accessibilityRole={nativeAdjustable ? 'adjustable' : undefined}\n        accessibilityLabel={nativeAdjustable ? accessibilityLabel : undefined}\n        accessibilityState={{ ...accessibilityState, disabled: disabled || minimum === maximum }}\n        accessibilityValue={\n          nativeAdjustable\n            ? {\n                min: minimum,\n                max: maximum,\n                now: count,\n                // VoiceOver otherwise speaks a percentage. TalkBack uses the numeric range to announce changes.\n                ...(Platform.OS === 'ios' ? { text: countText } : {}),\n              }\n            : undefined\n        }\n        accessibilityActions={\n          nativeAdjustable\n            ? [\n                ...(canDecrease ? [{ name: 'decrement', label: decrementLabel }] : []),\n                ...(canIncrease ? [{ name: 'increment', label: incrementLabel }] : []),\n              ]\n            : undefined\n        }\n        onAccessibilityAction={(event) => {\n          if (event.nativeEvent.actionName === 'decrement') adjust(-1)\n          if (event.nativeEvent.actionName === 'increment') adjust(1)\n          onAccessibilityAction?.(event)\n        }}\n      >\n        <IconButton\n          icon={Minus}\n          variant=\"outline\"\n          accessibilityLabel={decrementLabel}\n          aria-hidden={nativeAdjustable || undefined}\n          disabled={!canDecrease}\n          onPress={() => adjust(-1)}\n        />\n        <Text\n          aria-hidden={nativeAdjustable || undefined}\n          accessibilityLiveRegion={nativeAdjustable ? undefined : 'polite'}\n          className=\"min-w-[40px] shrink text-center font-semibold\"\n          style={{ fontVariant: ['tabular-nums'] }}\n        >\n          {countText}\n        </Text>\n        <IconButton\n          icon={Plus}\n          variant=\"outline\"\n          accessibilityLabel={incrementLabel}\n          aria-hidden={nativeAdjustable || undefined}\n          disabled={!canIncrease}\n          onPress={() => adjust(1)}\n        />\n      </View>\n    )\n  },\n)\nQuantityStepper.displayName = 'QuantityStepper'\n",
      "type": "registry:ui",
      "target": "~/components/ui/quantity-stepper/QuantityStepper.tsx"
    },
    {
      "path": "packages/registry-native/components/quantity-stepper/index.ts",
      "content": "export { QuantityStepper, type QuantityStepperProps } from './QuantityStepper'\n",
      "type": "registry:ui",
      "target": "~/components/ui/quantity-stepper/index.ts"
    }
  ],
  "dependencies": [
    "lucide-react-native"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/icon-button.json",
    "https://native.uipkge.dev/r/native/text.json"
  ],
  "description": "Keyboard-free numeric stepper with bounded whole-number values and native adjustable actions.",
  "categories": [
    "control"
  ]
}