{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "date-range-picker",
  "title": "Date Range Picker",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/date-range-picker/DateRangePicker.tsx",
      "content": "import * as React from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { DateTimePicker } from '@/components/ui/date-time-picker'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface DateRangeValue {\n  /** Endpoints are inclusive local calendar dates. Clock times are ignored. */\n  start: Date\n  end: Date\n}\n\nexport interface DateRangePickerProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  value?: DateRangeValue\n  defaultValue?: DateRangeValue\n  onValueChange?: (range: DateRangeValue) => void\n  minimumDate?: Date\n  maximumDate?: Date\n  disabled?: boolean\n  startLabel?: string\n  endLabel?: string\n}\n\nfunction day(value: Date | undefined) {\n  if (!(value instanceof Date) || value.getFullYear() < 1 || value.getFullYear() > 9999) return undefined\n  const timestamp = new Date(value).setHours(12, 0, 0, 0)\n  return Number.isFinite(timestamp) ? timestamp : undefined\n}\n\nexport function DateRangePicker({\n  className,\n  value,\n  defaultValue,\n  onValueChange,\n  minimumDate,\n  maximumDate,\n  disabled = false,\n  startLabel = 'Start date',\n  endLabel = 'End date',\n  ...props\n}: DateRangePickerProps) {\n  const [today] = React.useState(() => day(new Date())!)\n  const [internal, setInternal] = React.useState(defaultValue)\n  const minimum = day(minimumDate)\n  const maximum = day(maximumDate)\n  const reversed = minimum !== undefined && maximum !== undefined && minimum > maximum\n  const range = value ?? internal\n  const clamp = (timestamp: number) => Math.max(minimum ?? -Infinity, Math.min(maximum ?? Infinity, timestamp))\n  const savedStart = day(range?.start)\n  const savedEnd = day(range?.end)\n  const start = clamp(savedStart ?? today)\n  const end = Math.max(start, clamp(savedEnd ?? start))\n  const adjusted = value !== undefined && (savedStart !== start || savedEnd !== end)\n  const dateFormat = React.useMemo(\n    () => new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'long', day: 'numeric' }),\n    [],\n  )\n\n  function emit(start: number, end: number) {\n    if (value === undefined) setInternal({ start: new Date(start), end: new Date(end) })\n    onValueChange?.({ start: new Date(start), end: new Date(end) })\n  }\n\n  function change(endpoint: 'start' | 'end', selected: Date) {\n    const date = day(selected)\n    if (disabled || reversed || date === undefined || date !== clamp(date) || (endpoint === 'end' && date < start))\n      return\n    const nextStart = endpoint === 'start' ? date : start\n    const nextEnd = endpoint === 'start' ? Math.max(date, end) : date\n    if (nextStart === start && nextEnd === end) return\n    emit(nextStart, nextEnd)\n  }\n\n  return (\n    <View {...props} className={cn('gap-3', className)}>\n      <View className=\"gap-1\">\n        <Text size=\"sm\" className=\"font-medium\" aria-hidden>\n          {startLabel}\n        </Text>\n        <DateTimePicker\n          value={new Date(start)}\n          accessibilityLabel={`${startLabel}, ${dateFormat.format(start)}`}\n          minimumDate={minimum === undefined ? undefined : new Date(minimum)}\n          maximumDate={maximum === undefined ? undefined : new Date(maximum)}\n          disabled={disabled || reversed}\n          onValueChange={(date) => change('start', date)}\n        />\n      </View>\n      <View className=\"gap-1\">\n        <Text size=\"sm\" className=\"font-medium\" aria-hidden>\n          {endLabel}\n        </Text>\n        <DateTimePicker\n          value={new Date(end)}\n          accessibilityLabel={`${endLabel}, ${dateFormat.format(end)}`}\n          minimumDate={new Date(start)}\n          maximumDate={maximum === undefined ? undefined : new Date(maximum)}\n          disabled={disabled || reversed}\n          onValueChange={(date) => change('end', date)}\n        />\n      </View>\n      {reversed ? (\n        <Text size=\"sm\" variant=\"muted\">\n          No dates are available.\n        </Text>\n      ) : null}\n      {adjusted && !reversed ? (\n        <View className=\"gap-2\">\n          <Text size=\"sm\">The saved dates are outside the available range.</Text>\n          {onValueChange ? (\n            <Button variant=\"outline\" disabled={disabled} onPress={() => emit(start, end)}>\n              Use displayed dates\n            </Button>\n          ) : null}\n        </View>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:ui",
      "target": "~/components/ui/date-range-picker/DateRangePicker.tsx"
    },
    {
      "path": "packages/registry-native/components/date-range-picker/index.ts",
      "content": "export { DateRangePicker, type DateRangePickerProps, type DateRangeValue } from './DateRangePicker'\n",
      "type": "registry:ui",
      "target": "~/components/ui/date-range-picker/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/date-time-picker.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Two coordinated native date controls for one inclusive range with local calendar days and limits.",
  "categories": [
    "control"
  ]
}