{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/collapsible-09","type":"registry:component","title":"Collapsible 9","description":"Multi-step form with delivery address, shipping options and payment details","dependencies":["lucide-react","react-payment-inputs"],"devDependencies":["@types/react-payment-inputs"],"registryDependencies":["button","collapsible","input","label","radio-group","textarea"],"files":[{"path":"src/registry/new-york/components/collapsible/collapsible-09.tsx","content":"'use client'\n\nimport { useId } from 'react'\n\nimport { ChevronDownIcon, CreditCardIcon } from 'lucide-react'\n\nimport { usePaymentInputs } from 'react-payment-inputs'\nimport images, { type CardImages } from 'react-payment-inputs/images'\n\nimport { Button } from '@/registry/new-york/ui/button'\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/registry/new-york/ui/collapsible'\nimport { Input } from '@/registry/new-york/ui/input'\nimport { Label } from '@/registry/new-york/ui/label'\nimport { RadioGroup, RadioGroupItem } from '@/registry/new-york/ui/radio-group'\nimport { Textarea } from '@/registry/new-york/ui/textarea'\n\nconst CollapsibleFormDemo = () => {\n  const id = useId()\n  const { meta, getCardNumberProps, getExpiryDateProps, getCVCProps, getCardImageProps } = usePaymentInputs()\n\n  const items = [\n    { value: '1', label: 'Standard 3-5 Days', description: 'Friday, 15 June - Tuesday, 19 June', price: 'Free' },\n    { value: '2', label: 'Express', description: 'Friday, 15 June - Sunday, 17 June', price: '$5.00' },\n    { value: '3', label: 'Overnight', description: 'Tomorrow', price: '$10.00' }\n  ]\n\n  return (\n    <div className='w-full space-y-3'>\n      <div className='divide-input w-full divide-y rounded-md border py-1 *:py-2'>\n        <Collapsible className='flex flex-col gap-2'>\n          <div className='flex items-center justify-between gap-4 px-4'>\n            <div className='text-sm font-semibold'>Delivery Address</div>\n            <CollapsibleTrigger asChild className='group'>\n              <Button variant='ghost' size='icon-sm'>\n                <ChevronDownIcon className='text-muted-foreground transition-transform group-data-[state=open]:rotate-180' />\n                <span className='sr-only'>Toggle</span>\n              </Button>\n            </CollapsibleTrigger>\n          </div>\n          <CollapsibleContent className='flex flex-col gap-3 px-4 pt-3'>\n            <div className='group relative w-full'>\n              <label\n                htmlFor='full-name'\n                className='origin-start text-muted-foreground group-focus-within:text-foreground has-[+input:not(:placeholder-shown)]:text-foreground absolute top-1/2 block -translate-y-1/2 cursor-text px-2 text-sm transition-all group-focus-within:pointer-events-none group-focus-within:top-0 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium has-[+input:not(:placeholder-shown)]:pointer-events-none has-[+input:not(:placeholder-shown)]:top-0 has-[+input:not(:placeholder-shown)]:cursor-default has-[+input:not(:placeholder-shown)]:text-xs has-[+input:not(:placeholder-shown)]:font-medium'\n              >\n                <span className='bg-background inline-flex px-1'>Full Name</span>\n              </label>\n              <Input id='full-name' type='text' placeholder=' ' className='dark:bg-background' />\n            </div>\n            <div className='group relative w-full space-y-2'>\n              <label\n                htmlFor='address'\n                className='origin-start text-muted-foreground group-focus-within:text-foreground has-[+textarea:not(:placeholder-shown)]:text-foreground has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive absolute top-0 block translate-y-2 cursor-text px-2 text-sm transition-all group-focus-within:pointer-events-none group-focus-within:-translate-y-1/2 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium has-[+textarea:not(:placeholder-shown)]:pointer-events-none has-[+textarea:not(:placeholder-shown)]:-translate-y-1/2 has-[+textarea:not(:placeholder-shown)]:cursor-default has-[+textarea:not(:placeholder-shown)]:text-xs has-[+textarea:not(:placeholder-shown)]:font-medium'\n              >\n                <span className='bg-background inline-flex px-1'>Address</span>\n              </label>\n              <Textarea id='address' placeholder=' ' className='!bg-background' />\n            </div>\n            <div className='group relative w-full'>\n              <label\n                htmlFor='pin-code'\n                className='origin-start text-muted-foreground group-focus-within:text-foreground has-[+input:not(:placeholder-shown)]:text-foreground absolute top-1/2 block -translate-y-1/2 cursor-text px-2 text-sm transition-all group-focus-within:pointer-events-none group-focus-within:top-0 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium has-[+input:not(:placeholder-shown)]:pointer-events-none has-[+input:not(:placeholder-shown)]:top-0 has-[+input:not(:placeholder-shown)]:cursor-default has-[+input:not(:placeholder-shown)]:text-xs has-[+input:not(:placeholder-shown)]:font-medium'\n              >\n                <span className='bg-background inline-flex px-1'>Pin Code</span>\n              </label>\n              <Input id='pin-code' type='number' placeholder=' ' className='dark:bg-background' />\n            </div>\n            <div className='group relative w-full'>\n              <label\n                htmlFor='city-name'\n                className='origin-start text-muted-foreground group-focus-within:text-foreground has-[+input:not(:placeholder-shown)]:text-foreground absolute top-1/2 block -translate-y-1/2 cursor-text px-2 text-sm transition-all group-focus-within:pointer-events-none group-focus-within:top-0 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium has-[+input:not(:placeholder-shown)]:pointer-events-none has-[+input:not(:placeholder-shown)]:top-0 has-[+input:not(:placeholder-shown)]:cursor-default has-[+input:not(:placeholder-shown)]:text-xs has-[+input:not(:placeholder-shown)]:font-medium'\n              >\n                <span className='bg-background inline-flex px-1'>City</span>\n              </label>\n              <Input id='city-name' type='text' placeholder=' ' className='dark:bg-background' />\n            </div>\n            <div className='group relative w-full'>\n              <label\n                htmlFor='landmark'\n                className='origin-start text-muted-foreground group-focus-within:text-foreground has-[+input:not(:placeholder-shown)]:text-foreground absolute top-1/2 block -translate-y-1/2 cursor-text px-2 text-sm transition-all group-focus-within:pointer-events-none group-focus-within:top-0 group-focus-within:cursor-default group-focus-within:text-xs group-focus-within:font-medium has-[+input:not(:placeholder-shown)]:pointer-events-none has-[+input:not(:placeholder-shown)]:top-0 has-[+input:not(:placeholder-shown)]:cursor-default has-[+input:not(:placeholder-shown)]:text-xs has-[+input:not(:placeholder-shown)]:font-medium'\n              >\n                <span className='bg-background inline-flex px-1'>Landmark</span>\n              </label>\n              <Input id='landmark' type='text' placeholder=' ' className='dark:bg-background' />\n            </div>\n          </CollapsibleContent>\n        </Collapsible>\n\n        <Collapsible className='flex flex-col gap-2'>\n          <div className='flex items-center justify-between gap-4 px-4'>\n            <div className='text-sm font-semibold'>Delivery Options</div>\n            <CollapsibleTrigger asChild className='group'>\n              <Button variant='ghost' size='icon-sm'>\n                <ChevronDownIcon className='text-muted-foreground transition-transform group-data-[state=open]:rotate-180' />\n                <span className='sr-only'>Toggle</span>\n              </Button>\n            </CollapsibleTrigger>\n          </div>\n          <CollapsibleContent className='flex flex-col gap-2 px-4'>\n            <RadioGroup className='w-full gap-0 -space-y-px rounded-md pt-3 shadow-xs' defaultValue='2'>\n              {items.map(item => (\n                <div\n                  key={`${id}-${item.value}`}\n                  className='border-input has-data-[state=checked]:border-primary/50 has-data-[state=checked]:bg-accent relative flex flex-col gap-4 border p-4 outline-none first:rounded-t-md last:rounded-b-md has-data-[state=checked]:z-10'\n                >\n                  <div className='flex items-center justify-between gap-1.5'>\n                    <div className='flex items-center gap-2'>\n                      <RadioGroupItem\n                        id={`${id}-${item.value}`}\n                        value={item.value}\n                        className='after:absolute after:inset-0'\n                        aria-label={`plan-radio-${item.value}`}\n                        aria-describedby={`${`${id}-${item.value}`}-price`}\n                      />\n                      <div className='space-y-1'>\n                        <Label className='inline-flex items-center' htmlFor={`${id}-${item.value}`}>\n                          {item.label}\n                        </Label>\n                        <p className='text-muted-foreground text-sm'>{item.description}</p>\n                      </div>\n                    </div>\n                    <div\n                      id={`${`${id}-${item.value}`}-price`}\n                      className='text-muted-foreground text-xs leading-[inherit]'\n                    >\n                      {item.price}\n                    </div>\n                  </div>\n                </div>\n              ))}\n            </RadioGroup>\n          </CollapsibleContent>\n        </Collapsible>\n\n        <Collapsible className='flex flex-col gap-2'>\n          <div className='flex items-center justify-between gap-4 px-4'>\n            <div className='text-sm font-semibold'>Payment</div>\n            <CollapsibleTrigger asChild className='group'>\n              <Button variant='ghost' size='icon-sm'>\n                <ChevronDownIcon className='text-muted-foreground transition-transform group-data-[state=open]:rotate-180' />\n                <span className='sr-only'>Toggle</span>\n              </Button>\n            </CollapsibleTrigger>\n          </div>\n          <CollapsibleContent className='flex flex-col gap-2'>\n            <div className='w-full space-y-2 px-4 pt-2'>\n              <Label>Card details</Label>\n              <div>\n                <div className='relative focus-within:z-1'>\n                  <Input\n                    {...getCardNumberProps()}\n                    id={`number-${id}`}\n                    className='peer rounded-b-none pr-9 shadow-none'\n                  />\n                  <div className='text-muted-foreground pointer-events-none absolute inset-y-0 right-0 flex items-center justify-center pr-3 peer-disabled:opacity-50'>\n                    {meta.cardType ? (\n                      <svg\n                        className='w-6 overflow-hidden'\n                        {...getCardImageProps({\n                          images: images as unknown as CardImages\n                        })}\n                      />\n                    ) : (\n                      <CreditCardIcon className='size-4' />\n                    )}\n                    <span className='sr-only'>Card Provider</span>\n                  </div>\n                </div>\n                <div className='-mt-px flex'>\n                  <div className='min-w-0 flex-1 focus-within:z-1'>\n                    <Input\n                      {...getExpiryDateProps()}\n                      id={`expiry-${id}`}\n                      className='rounded-t-none rounded-r-none shadow-none'\n                    />\n                  </div>\n                  <div className='-ms-px min-w-0 flex-1 focus-within:z-1'>\n                    <Input {...getCVCProps()} id={`cvc-${id}`} className='rounded-t-none rounded-l-none shadow-none' />\n                  </div>\n                </div>\n              </div>\n            </div>\n          </CollapsibleContent>\n        </Collapsible>\n      </div>\n      <p className='text-muted-foreground text-xs'>\n        Built with{' '}\n        <a\n          className='hover:text-foreground underline'\n          href='https://github.com/medipass/react-payment-inputs'\n          target='_blank'\n          rel='noopener noreferrer'\n        >\n          React Payment Inputs\n        </a>\n      </p>\n    </div>\n  )\n}\n\nexport default CollapsibleFormDemo\n","type":"registry:component","target":"components/shadcn-studio/collapsible/collapsible-09.tsx"}]}