{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "week-strip",
  "title": "Week Strip",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/week-strip/WeekStrip.tsx",
      "content": "import * as React from 'react'\nimport { Pressable, View, useWindowDimensions, type ViewProps } from 'react-native'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface WeekStripProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  /** A Gregorian date key for any day in the week, in YYYY-MM-DD form. */\n  weekOf: string\n  /** Sunday is 0 and Monday is 1. */\n  weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n  value?: string | null\n  defaultValue?: string | null\n  onValueChange?: (day: string) => void\n  isDateDisabled?: (day: string) => boolean\n  /** Adds a visible dot and an accessible label to a day. */\n  getDateMarker?: (day: string) => string | undefined\n  disabled?: boolean\n  locale?: string\n  emptyLabel?: string\n}\n\nfunction dayKey(date: Date) {\n  return date.toISOString().slice(0, 10)\n}\n\nfunction weekDays(weekOf: string, weekStartsOn: number) {\n  if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(weekOf) || !Number.isInteger(weekStartsOn) || weekStartsOn < 0 || weekStartsOn > 6) {\n    return []\n  }\n  const anchor = new Date(`${weekOf}T12:00:00Z`)\n  if (!Number.isFinite(anchor.getTime()) || dayKey(anchor) !== weekOf) return []\n\n  // UTC arithmetic is only for the date keys, with no time-of-day conversion at DST boundaries.\n  const offset = (anchor.getUTCDay() - weekStartsOn + 7) % 7\n  const days = Array.from({ length: 7 }, (_, index) => {\n    const date = new Date(anchor)\n    date.setUTCDate(anchor.getUTCDate() - offset + index)\n    return date\n  })\n  return days[0].getUTCFullYear() < 1 || days[6].getUTCFullYear() > 9999 ? [] : days\n}\n\nexport function weekDateKeys(weekOf: string, weekStartsOn: WeekStripProps['weekStartsOn'] = 1) {\n  return weekDays(weekOf, weekStartsOn).map(dayKey)\n}\n\nexport function WeekStrip({\n  className,\n  weekOf,\n  weekStartsOn = 1,\n  value,\n  defaultValue,\n  onValueChange,\n  isDateDisabled,\n  getDateMarker,\n  disabled = false,\n  locale,\n  emptyLabel = 'This week is unavailable.',\n  accessibilityLabel = 'Choose a day',\n  onLayout,\n  ...props\n}: WeekStripProps) {\n  const [internal, setInternal] = React.useState(defaultValue)\n  const [measuredWidth, setMeasuredWidth] = React.useState<number>()\n  const { width, fontScale } = useWindowDimensions()\n  const availableWidth = measuredWidth ?? width\n  const stacked = fontScale >= 1.4 || availableWidth < 208\n  const basis = stacked ? '100%' : availableWidth < 364 ? '25%' : '14.2857%'\n  const checkedDay = value === undefined ? internal : value\n  const days = React.useMemo(() => weekDays(weekOf, weekStartsOn), [weekOf, weekStartsOn])\n  const formats = React.useMemo(() => {\n    const dateOptions = { timeZone: 'UTC', calendar: 'gregory' } as const\n    return {\n      weekday: new Intl.DateTimeFormat(locale, { ...dateOptions, weekday: 'short' }),\n      longWeekday: new Intl.DateTimeFormat(locale, { ...dateOptions, weekday: 'long' }),\n      day: new Intl.DateTimeFormat(locale, { ...dateOptions, day: 'numeric' }),\n      monthAndDay: new Intl.DateTimeFormat(locale, { ...dateOptions, month: 'short', day: 'numeric' }),\n      full: new Intl.DateTimeFormat(locale, {\n        ...dateOptions,\n        weekday: 'long',\n        month: 'long',\n        day: 'numeric',\n        year: 'numeric',\n      }),\n    }\n  }, [locale])\n\n  return (\n    <View\n      {...props}\n      accessible={false}\n      accessibilityRole={days.length ? 'radiogroup' : undefined}\n      accessibilityLabel={days.length ? accessibilityLabel : undefined}\n      className={cn('flex-row flex-wrap', className)}\n      onLayout={(event) => {\n        setMeasuredWidth(event.nativeEvent.layout.width)\n        onLayout?.(event)\n      }}\n    >\n      {days.length ? (\n        days.map((date) => {\n          const day = dayKey(date)\n          const checked = checkedDay === day\n          const blocked = disabled || !!isDateDisabled?.(day)\n          const marker = getDateMarker?.(day)\n          const dateLabel = formats.full.format(date)\n          return (\n            <View key={day} style={{ width: basis }} className=\"p-0.5\">\n              <Pressable\n                accessible\n                accessibilityRole=\"radio\"\n                accessibilityLabel={marker ? `${dateLabel}, ${marker}` : dateLabel}\n                accessibilityState={{ checked, disabled: blocked }}\n                disabled={blocked}\n                onPress={() => {\n                  if (blocked || checked) return\n                  if (value === undefined) setInternal(day)\n                  onValueChange?.(day)\n                }}\n                className={cn(\n                  'min-h-[48px] items-center justify-center rounded-lg border border-transparent px-1 py-2 active:bg-muted',\n                  stacked && 'flex-row flex-wrap justify-between gap-2 px-3',\n                  checked && 'border-primary bg-muted',\n                  blocked && 'opacity-50',\n                )}\n              >\n                <Text size=\"sm\" variant=\"muted\" className={stacked ? 'shrink' : 'text-center'}>\n                  {(stacked ? formats.longWeekday : formats.weekday).format(date)}\n                </Text>\n                <Text\n                  size=\"sm\"\n                  className={cn(stacked ? 'shrink' : 'text-center', checked && 'font-semibold')}\n                  style={{ fontVariant: ['tabular-nums'] }}\n                >\n                  {(stacked ? formats.monthAndDay : formats.day).format(date)}\n                </Text>\n                {getDateMarker ? (\n                  <View aria-hidden className={cn('size-1.5 rounded-full', marker && 'bg-primary')} />\n                ) : null}\n              </Pressable>\n            </View>\n          )\n        })\n      ) : (\n        <Text size=\"sm\" variant=\"muted\">\n          {emptyLabel}\n        </Text>\n      )}\n    </View>\n  )\n}\n",
      "type": "registry:ui",
      "target": "~/components/ui/week-strip/WeekStrip.tsx"
    },
    {
      "path": "packages/registry-native/components/week-strip/index.ts",
      "content": "export { WeekStrip, weekDateKeys, type WeekStripProps } from './WeekStrip'\n",
      "type": "registry:ui",
      "target": "~/components/ui/week-strip/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/text.json"
  ],
  "description": "A native seven-day picker with local date keys, checked state, locale formatting, and responsive layout.",
  "categories": [
    "input",
    "date"
  ]
}