{ | |
"type": "composition", | |
"npmDependencies": [], | |
"fileDependencies": [], | |
"id": "pin-input", | |
"file": { | |
"name": "pin-input.tsx", | |
"content": "import { PinInput as ChakraPinInput, Group } from \"@chakra-ui/react\"\nimport * as React from \"react\"\n\nexport interface PinInputProps extends ChakraPinInput.RootProps {\n rootRef?: React.RefObject<HTMLDivElement | null>\n count?: number\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>\n attached?: boolean\n}\n\nexport const PinInput = React.forwardRef<HTMLInputElement, PinInputProps>(\n function PinInput(props, ref) {\n const { count = 4, inputProps, rootRef, attached, ...rest } = props\n return (\n <ChakraPinInput.Root ref={rootRef} {...rest}>\n <ChakraPinInput.HiddenInput ref={ref} {...inputProps} />\n <ChakraPinInput.Control>\n <Group attached={attached}>\n {Array.from({ length: count }).map((_, index) => (\n <ChakraPinInput.Input key={index} index={index} />\n ))}\n </Group>\n </ChakraPinInput.Control>\n </ChakraPinInput.Root>\n )\n },\n)\n" | |
}, | |
"component": "PinInput" | |
} |