{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "support-request",
  "title": "Support Request",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/support-request/SupportRequest.tsx",
      "content": "import * as React from 'react'\nimport { TextInput, View, type ViewProps } from 'react-native'\nimport { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'\nimport { Button } from '@/components/ui/button'\nimport { FormField } from '@/components/ui/form-field'\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'\nimport { Text } from '@/components/ui/text'\nimport { Textarea } from '@/components/ui/textarea'\nimport { renderTextChildren } from '@/lib/label-children'\nimport { cn } from '@/lib/utils'\n\nexport interface SupportTopic {\n  id: string\n  label: string\n  description?: string\n  disabled?: boolean\n}\n\nexport interface SupportRequestValue {\n  topicId: string\n  details: string\n}\n\nexport interface SupportRequestProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  title?: string\n  context?: React.ReactNode\n  topics?: readonly SupportTopic[]\n  detailsLabel?: string\n  detailsRequired?: boolean\n  detailsRequiredMessage?: string\n  maxLength?: number\n  submitLabel?: string\n  emptyMessage?: string\n  errorTitle?: string\n  errorMessage?: string\n  onSubmit?: (request: SupportRequestValue) => void | boolean | Promise<void | boolean>\n}\n\nconst sampleTopics: SupportTopic[] = [\n  { id: 'order', label: 'Order issue' },\n  { id: 'account', label: 'Account access' },\n]\n\nexport function SupportRequest({\n  className,\n  title = 'Get support',\n  context,\n  topics = sampleTopics,\n  detailsLabel = 'Details',\n  detailsRequired = false,\n  detailsRequiredMessage = 'Describe what happened.',\n  maxLength,\n  submitLabel = 'Send request',\n  emptyMessage = 'No support topics are available yet.',\n  errorTitle = 'Request wasn’t sent',\n  errorMessage = 'Your information is still here. Try again when you’re ready.',\n  onSubmit,\n  ...props\n}: SupportRequestProps) {\n  const [topicId, setTopicId] = React.useState('')\n  const [details, setDetails] = React.useState('')\n  const [busy, setBusy] = React.useState(false)\n  const [failed, setFailed] = React.useState(false)\n  const [detailsError, setDetailsError] = React.useState(false)\n  const detailsField = React.useRef<React.ComponentRef<typeof TextInput>>(null)\n  const request = React.useRef(false)\n  const selected = topics.find((topic) => topic.id === topicId && !topic.disabled)\n\n  async function submit() {\n    if (request.current || !selected || !onSubmit) return\n    const message = details.trim()\n    if (detailsRequired && !message) {\n      setDetailsError(true)\n      detailsField.current?.focus()\n      return\n    }\n    request.current = true\n    setBusy(true)\n    setFailed(false)\n    try {\n      if ((await onSubmit({ topicId: selected.id, details: message })) === false) setFailed(true)\n    } catch {\n      setFailed(true)\n    } finally {\n      request.current = false\n      setBusy(false)\n    }\n  }\n\n  return (\n    <View {...props} className={cn('gap-4', className)}>\n      <Text size=\"title\" accessibilityRole=\"header\">\n        {title}\n      </Text>\n      {renderTextChildren(context)}\n      {topics.length ? (\n        <RadioGroup\n          accessibilityLabel=\"Topic\"\n          value={selected?.id ?? ''}\n          disabled={busy}\n          onValueChange={(id) => {\n            if (request.current || !topics.some((topic) => topic.id === id && !topic.disabled)) return\n            setTopicId(id)\n            setFailed(false)\n          }}\n        >\n          {topics.map((topic) => (\n            <RadioGroupItem\n              key={topic.id}\n              value={topic.id}\n              label={topic.label}\n              accessibilityLabel={topic.label}\n              accessibilityHint={topic.description}\n              disabled={topic.disabled}\n              className=\"items-start rounded-lg border border-border bg-card p-3\"\n            >\n              {topic.description ? (\n                <Text size=\"sm\" variant=\"muted\">\n                  {topic.description}\n                </Text>\n              ) : null}\n            </RadioGroupItem>\n          ))}\n        </RadioGroup>\n      ) : (\n        <Text variant=\"muted\">{emptyMessage}</Text>\n      )}\n      {topics.length ? (\n        <FormField\n          label={detailsLabel}\n          required={detailsRequired}\n          error={detailsError ? detailsRequiredMessage : undefined}\n        >\n          {(field) => (\n            <Textarea\n              {...field}\n              ref={detailsField}\n              value={details}\n              maxLength={maxLength}\n              editable={!busy}\n              onChangeText={(message) => {\n                if (request.current) return\n                setDetails(message)\n                setDetailsError(false)\n                setFailed(false)\n              }}\n            />\n          )}\n        </FormField>\n      ) : null}\n      {failed ? (\n        <Alert variant=\"destructive\">\n          <AlertTitle>{errorTitle}</AlertTitle>\n          <AlertDescription>{errorMessage}</AlertDescription>\n        </Alert>\n      ) : null}\n      {onSubmit ? (\n        <Button\n          accessibilityLabel={submitLabel}\n          disabled={!selected}\n          loading={busy}\n          onPress={() => {\n            void submit()\n          }}\n        >\n          {submitLabel}\n        </Button>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/support-request/SupportRequest.tsx"
    },
    {
      "path": "packages/registry-native/blocks/support-request/index.ts",
      "content": "export { SupportRequest, type SupportRequestProps, type SupportRequestValue, type SupportTopic } from './SupportRequest'\n",
      "type": "registry:block",
      "target": "~/components/blocks/support-request/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/alert.json",
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/form-field.json",
    "https://native.uipkge.dev/r/native/label-children.json",
    "https://native.uipkge.dev/r/native/radio-group.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/textarea.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Contextual support intake with topic selection, a message, and draft-preserving retries.",
  "categories": [
    "workflow"
  ]
}