{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "plan-picker",
  "type": "registry:item",
  "title": "Plan Picker",
  "description": "Plan cards in a tray: the pick lifts with a popping check, over a button with streaming chevrons.",
  "categories": [
    "input"
  ],
  "dependencies": [
    "react-native-reanimated",
    "react-native-worklets"
  ],
  "registryDependencies": [
    "https://kinetik-ui.dev/r/kinetik-tokens.json",
    "https://kinetik-ui.dev/r/kinetik-motion.json",
    "https://kinetik-ui.dev/r/kinetik-haptics.json"
  ],
  "files": [
    {
      "path": "src/components/kinetik/plan-picker.tsx",
      "type": "registry:file",
      "target": "~/components/kinetik/plan-picker.tsx",
      "content": "import { useEffect } from 'react';\nimport {\n  Platform,\n  Pressable,\n  StyleSheet,\n  Text,\n  View,\n  type StyleProp,\n  type ViewStyle,\n} from 'react-native';\nimport Animated, {\n  interpolate,\n  useAnimatedStyle,\n  useSharedValue,\n  withRepeat,\n  withSequence,\n  withSpring,\n  withTiming,\n  type SharedValue,\n} from 'react-native-reanimated';\n\nimport { useHaptic } from '../../lib/kinetik/hooks/use-haptic';\nimport { useReduceMotion } from '../../lib/kinetik/hooks/use-reduce-motion';\nimport { spring, timing } from '../../lib/kinetik/motion/motion';\nimport { useKinetikTheme } from '../../lib/kinetik/tokens/theme';\nimport { minTouchTarget } from '../../lib/kinetik/tokens/tokens';\n\nexport type PickerPlan = {\n  id: string;\n  title: string;\n  /** Line under the title, e.g. \"14-day free trial\". */\n  note?: string;\n  /** Price per month, shown large. */\n  monthly: string;\n  /** What is billed, shown small under the monthly price, e.g. \"89.98/yr\". */\n  billed?: string;\n};\n\nexport type PlanPickerProps = {\n  plans: readonly PickerPlan[];\n  value: string;\n  onChange: (id: string) => void;\n  /** A reassurance line under the plans. */\n  footnote?: string;\n  /** The button under the tray. */\n  cta?: { label: string; onPress: () => void };\n  /** A tick when the plan changes. Defaults to true. */\n  haptics?: boolean;\n  style?: StyleProp<ViewStyle>;\n};\n\n/** An italic serif for plan names; each platform's own. */\nconst SERIF = Platform.select({ ios: 'Georgia', android: 'serif', default: 'Georgia, serif' });\n\n/**\n * Plan cards resting in a tray: the picked one lifts towards you, its check\n * pops in and the others settle back. Under it, a button whose chevrons\n * stream in towards the label.\n */\nexport function PlanPicker({\n  plans,\n  value,\n  onChange,\n  footnote,\n  cta,\n  haptics = true,\n  style,\n}: PlanPickerProps) {\n  const { colors, radius, space, font } = useKinetikTheme();\n  const haptic = useHaptic(haptics);\n  return (\n    <View style={[{ gap: space[5] }, style]}>\n      <View\n        accessibilityRole=\"radiogroup\"\n        style={[\n          styles.tray,\n          { backgroundColor: colors.surfaceSunken, borderRadius: radius.xl, gap: 6 },\n        ]}\n      >\n        {plans.map((plan) => (\n          <PlanCard\n            key={plan.id}\n            plan={plan}\n            on={plan.id === value}\n            onPress={() => {\n              if (plan.id === value) return;\n              haptic('tick');\n              onChange(plan.id);\n            }}\n          />\n        ))}\n        {footnote ? (\n          <Text\n            style={{\n              color: colors.textMuted,\n              fontSize: font.size.sm,\n              textAlign: 'center',\n              paddingVertical: space[3],\n            }}\n          >\n            {footnote}\n          </Text>\n        ) : null}\n      </View>\n      {cta ? <StreamButton label={cta.label} onPress={cta.onPress} /> : null}\n    </View>\n  );\n}\n\nfunction PlanCard({ plan, on, onPress }: { plan: PickerPlan; on: boolean; onPress: () => void }) {\n  const { colors, radius, space, font, shadow } = useKinetikTheme();\n  const reduced = useReduceMotion();\n  const lift = useSharedValue(on ? 1 : 0);\n\n  useEffect(() => {\n    lift.set(reduced ? (on ? 1 : 0) : withSpring(on ? 1 : 0, spring('bouncy')));\n  }, [on, reduced, lift]);\n\n  const card = useAnimatedStyle(() => ({\n    opacity: 0.82 + lift.get() * 0.18,\n    transform: [{ scale: 0.985 + lift.get() * 0.015 }, { translateY: -lift.get() * 1.5 }],\n  }));\n\n  return (\n    <Pressable\n      accessibilityRole=\"radio\"\n      accessibilityLabel={[plan.title, plan.note, `${plan.monthly} per month`, plan.billed]\n        .filter(Boolean)\n        .join(', ')}\n      accessibilityState={{ checked: on }}\n      onPress={onPress}\n    >\n      <Animated.View\n        style={[\n          styles.card,\n          {\n            backgroundColor: colors.surfaceRaised,\n            borderColor: colors.border,\n            borderRadius: radius.lg,\n            padding: space[5],\n            gap: space[4],\n            boxShadow: on ? shadow.md : shadow.sm,\n          },\n          card,\n        ]}\n      >\n        <Check on={on} />\n        <View style={styles.grow}>\n          <Text\n            style={{\n              color: colors.text,\n              fontFamily: SERIF,\n              fontStyle: 'italic',\n              fontSize: font.size.xl + 2,\n            }}\n          >\n            {plan.title}\n          </Text>\n          {plan.note ? (\n            <Text style={{ color: colors.textMuted, fontSize: font.size.md, marginTop: 2 }}>\n              {plan.note}\n            </Text>\n          ) : null}\n        </View>\n        <View style={styles.price}>\n          <Text\n            style={{\n              color: colors.text,\n              fontSize: font.size.lg,\n              fontWeight: font.weight.semibold,\n              fontVariant: ['tabular-nums'],\n            }}\n          >\n            {plan.monthly}/mo\n          </Text>\n          {plan.billed ? (\n            <Text style={{ color: colors.textSubtle, fontSize: font.size.md, marginTop: 2 }}>\n              {plan.billed}\n            </Text>\n          ) : null}\n        </View>\n      </Animated.View>\n    </Pressable>\n  );\n}\n\n/** A filled circle with a tick that draws in, or an empty dimple. */\nfunction Check({ on }: { on: boolean }) {\n  const { colors } = useKinetikTheme();\n  const reduced = useReduceMotion();\n  const fill = useSharedValue(on ? 1 : 0);\n\n  useEffect(() => {\n    if (reduced) {\n      fill.set(on ? 1 : 0);\n      return;\n    }\n    fill.set(\n      on\n        ? withSequence(withTiming(0, { duration: 0 }), withSpring(1, spring('bouncy')))\n        : withTiming(0, timing('quick')),\n    );\n  }, [on, reduced, fill]);\n\n  const dot = useAnimatedStyle(() => ({\n    opacity: Math.min(1, fill.get() * 2),\n    transform: [{ scale: interpolate(fill.get(), [0, 1], [0.4, 1]) }],\n  }));\n  const tick = useAnimatedStyle(() => ({\n    opacity: interpolate(fill.get(), [0.5, 1], [0, 1], 'clamp'),\n    transform: [\n      { rotate: '-45deg' },\n      { scale: interpolate(fill.get(), [0.5, 1], [0.4, 1], 'clamp') },\n    ],\n  }));\n\n  return (\n    <View style={[styles.radio, { backgroundColor: colors.track }]}>\n      <Animated.View style={[styles.radioFill, { backgroundColor: colors.ember }, dot]}>\n        <Animated.View style={[styles.tick, { borderColor: colors.onEmber }, tick]} />\n      </Animated.View>\n    </View>\n  );\n}\n\n/** A dark pill whose chevrons stream in from both sides towards the label. */\nfunction StreamButton({ label, onPress }: { label: string; onPress: () => void }) {\n  const { colors, radius, font } = useKinetikTheme();\n  const reduced = useReduceMotion();\n  const wave = useSharedValue(0);\n  const press = useSharedValue(0);\n\n  useEffect(() => {\n    wave.set(reduced ? 0 : withRepeat(withTiming(1, { duration: 1400 }), -1));\n  }, [reduced, wave]);\n\n  const body = useAnimatedStyle(() => ({ transform: [{ scale: 1 - press.get() * 0.02 }] }));\n\n  return (\n    <Pressable\n      accessibilityRole=\"button\"\n      onPress={onPress}\n      onPressIn={() => press.set(withSpring(1, spring('snappy', reduced)))}\n      onPressOut={() => press.set(withSpring(0, spring('bouncy', reduced)))}\n    >\n      <Animated.View\n        style={[styles.cta, { backgroundColor: colors.ember, borderRadius: radius.xl }, body]}\n      >\n        <Chevrons wave={wave} press={press} side=\"left\" still={reduced} />\n        <Text\n          style={{\n            color: colors.onEmber,\n            fontSize: font.size.lg,\n            fontWeight: font.weight.semibold,\n          }}\n        >\n          {label}\n        </Text>\n        <Chevrons wave={wave} press={press} side=\"right\" still={reduced} />\n      </Animated.View>\n    </Pressable>\n  );\n}\n\nfunction Chevrons({\n  wave,\n  press,\n  side,\n  still,\n}: {\n  wave: SharedValue<number>;\n  press: SharedValue<number>;\n  side: 'left' | 'right';\n  still: boolean;\n}) {\n  return (\n    <View aria-hidden style={[styles.chevrons, side === 'right' && styles.flip]}>\n      {[0, 1, 2].map((i) => (\n        <Chevron key={i} index={i} wave={wave} press={press} still={still} />\n      ))}\n    </View>\n  );\n}\n\n/** One \">\" that brightens as the wave passes, outer to inner. */\nfunction Chevron({\n  index,\n  wave,\n  press,\n  still,\n}: {\n  index: number;\n  wave: SharedValue<number>;\n  press: SharedValue<number>;\n  still: boolean;\n}) {\n  const { colors } = useKinetikTheme();\n  const style = useAnimatedStyle(() => {\n    if (still) return { opacity: 0.3 + index * 0.25 };\n    // Each chevron peaks a third of a cycle after the one outside it.\n    const phase = (wave.get() - index / 3 + 1) % 1;\n    const glow = Math.max(0, 1 - Math.abs(phase - 0.5) * 3);\n    return {\n      opacity: 0.25 + glow * 0.75,\n      transform: [{ translateX: press.get() * 4 + glow * 2 }],\n    };\n  });\n  // The animated wrapper moves it; the inner view keeps its own 45° turn.\n  return (\n    <Animated.View style={style}>\n      <View style={[styles.chevron, { borderColor: colors.onEmber }]} />\n    </Animated.View>\n  );\n}\n\nconst styles = StyleSheet.create({\n  tray: { padding: 6 },\n  card: { flexDirection: 'row', alignItems: 'center', borderWidth: StyleSheet.hairlineWidth },\n  grow: { flex: 1 },\n  price: { alignItems: 'flex-end' },\n  radio: {\n    width: 28,\n    height: 28,\n    borderRadius: 14,\n    alignItems: 'center',\n    justifyContent: 'center',\n  },\n  radioFill: {\n    width: 28,\n    height: 28,\n    borderRadius: 14,\n    alignItems: 'center',\n    justifyContent: 'center',\n  },\n  tick: { width: 12, height: 7, marginTop: -3, borderLeftWidth: 2.5, borderBottomWidth: 2.5 },\n  cta: {\n    minHeight: 64,\n    flexDirection: 'row',\n    alignItems: 'center',\n    justifyContent: 'center',\n    gap: 24,\n    minWidth: minTouchTarget,\n  },\n  chevrons: { flexDirection: 'row', gap: 1 },\n  flip: { transform: [{ scaleX: -1 }] },\n  chevron: {\n    width: 8,\n    height: 8,\n    borderTopWidth: 2,\n    borderRightWidth: 2,\n    transform: [{ rotate: '45deg' }],\n  },\n});\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "kind": "component",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "category": "input",
    "web": "live",
    "perf": {
      "budget": "Card lifts and checks are UI-thread springs on change; the button chevrons loop on the UI thread while it is on screen.",
      "measurements": [
        {
          "device": "Pixel 9 emulator, API 35",
          "kind": "emulator",
          "date": "2026-10-14",
          "build": "release",
          "frameMs": 22,
          "p90Ms": 25,
          "baselineMs": 17,
          "jankyPercent": 0.3,
          "atRest": "animating",
          "memoryMb": 158,
          "notes": "Animating at rest: the button chevrons stream in a loop while it is on screen."
        }
      ]
    },
    "a11y": {
      "reducedMotion": "Cards and checks change without springing and the chevrons hold still at fixed brightness.",
      "screenReader": "A radio group; each plan is a radio reading its name, trial, monthly price and billing. The button is named by its label.",
      "touchTarget": "Plan cards are over 80 pt tall; the button is 64 pt."
    },
    "requires": "React Native New Architecture (Reanimated 4)",
    "guide": "## Usage\n\n```tsx\nimport { PlanPicker } from '@/components/kinetik/plan-picker';\n\n<PlanPicker\n  value={plan}\n  onChange={setPlan}\n  plans={[\n    {\n      id: 'yearly',\n      title: 'Yearly',\n      note: '14-day free trial',\n      monthly: '7.49$',\n      billed: '89.98/yr',\n    },\n    { id: 'monthly', title: 'Monthly', note: '7-day free trial', monthly: '9.98$' },\n  ]}\n  footnote=\"If you don’t like it, we’ll give your money back.\"\n  cta={{ label: 'Start free trial', onPress: () => purchases.buy(plan) }}\n/>;\n```\n\n## When to use\n\n- Choosing between two or three subscription plans on a paywall or upgrade sheet.\n\n## When not to use\n\n- More than three plans: compare them in a table instead.\n- Plans that differ in features, not price: list the features, not just the trials.\n\n## Notes\n\n- Prices are strings so you can pass the store's localised prices as they are.\n- Plan names use the platform's italic serif (Georgia on iOS and the web, the system serif on Android).\n- The button's chevrons stream towards the label in a loop; with reduced motion they hold still.\n"
  },
  "docs": "Prefer `npx kinetik-ui add plan-picker`: it installs dependencies with expo install, so versions match your Expo SDK."
}
