@spark-ui/components 17.9.0-beta.1 → 17.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FormFieldRequiredIndicator-CEB8Ez-q.js.map +1 -1
- package/dist/FormFieldRequiredIndicator-CzdpinIz.mjs.map +1 -1
- package/dist/accordion/AccordionItem.d.ts +3 -0
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/AlertDialogAction.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogBody.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogCancel.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogContent.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogDescription.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogFooter.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogHeader.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogOverlay.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogPortal.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogTitle.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogTrigger.d.ts +3 -0
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/avatar/AvatarAction.d.ts +3 -0
- package/dist/avatar/AvatarImage.d.ts +3 -0
- package/dist/avatar/AvatarOnlineBadge.d.ts +3 -0
- package/dist/avatar/AvatarPlaceholder.d.ts +3 -0
- package/dist/avatar/AvatarUser.d.ts +3 -0
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs.map +1 -1
- package/dist/badge/index.js +1 -1
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +3 -3
- package/dist/badge/index.mjs.map +1 -1
- package/dist/breadcrumb/BreadcrumbCurrentPage.d.ts +3 -0
- package/dist/breadcrumb/BreadcrumbItem.d.ts +3 -0
- package/dist/breadcrumb/BreadcrumbLink.d.ts +3 -0
- package/dist/breadcrumb/BreadcrumbSeparator.d.ts +3 -0
- package/dist/breadcrumb/index.js +1 -1
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/breadcrumb/index.mjs.map +1 -1
- package/dist/card/Backdrop.d.ts +17 -0
- package/dist/card/Content.d.ts +3 -0
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs.map +1 -1
- package/dist/carousel/CarouselControls.d.ts +3 -0
- package/dist/carousel/CarouselNextButton.d.ts +3 -0
- package/dist/carousel/CarouselPageIndicator.d.ts +3 -0
- package/dist/carousel/CarouselPagePicker.d.ts +3 -0
- package/dist/carousel/CarouselPrevButton.d.ts +3 -0
- package/dist/carousel/CarouselSlide.d.ts +3 -0
- package/dist/carousel/CarouselSlides.d.ts +3 -0
- package/dist/carousel/CarouselViewport.d.ts +3 -0
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs.map +1 -1
- package/dist/chip/ChipClearButton.d.ts +3 -0
- package/dist/chip/ChipContent.d.ts +3 -0
- package/dist/chip/ChipLeadingIcon.d.ts +3 -0
- package/dist/chip/ChipTrailingIcon.d.ts +3 -0
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs.map +1 -1
- package/dist/circular-meter/CircularMeterContent.d.ts +3 -0
- package/dist/circular-meter/CircularMeterLabel.d.ts +3 -0
- package/dist/circular-meter/CircularMeterTrack.d.ts +3 -0
- package/dist/circular-meter/CircularMeterValue.d.ts +3 -0
- package/dist/circular-meter/index.js.map +1 -1
- package/dist/circular-meter/index.mjs.map +1 -1
- package/dist/collapsible/Content.d.ts +3 -0
- package/dist/collapsible/Trigger.d.ts +3 -0
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/combobox/ComboboxClearButton.d.ts +3 -0
- package/dist/combobox/ComboboxDisclosure.d.ts +3 -0
- package/dist/combobox/ComboboxEmpty.d.ts +3 -0
- package/dist/combobox/ComboboxGroup.d.ts +3 -0
- package/dist/combobox/ComboboxInput.d.ts +3 -0
- package/dist/combobox/ComboboxItem.d.ts +3 -0
- package/dist/combobox/ComboboxItemIndicator.d.ts +3 -0
- package/dist/combobox/ComboboxItemText.d.ts +3 -0
- package/dist/combobox/ComboboxItems.d.ts +3 -0
- package/dist/combobox/ComboboxLabel.d.ts +3 -0
- package/dist/combobox/ComboboxLeadingIcon.d.ts +3 -0
- package/dist/combobox/ComboboxPopover.d.ts +3 -0
- package/dist/combobox/ComboboxPortal.d.ts +3 -0
- package/dist/combobox/ComboboxSelectedItems.d.ts +3 -0
- package/dist/combobox/ComboboxTrigger.d.ts +3 -0
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/dialog/DialogBody.d.ts +3 -0
- package/dist/dialog/DialogClose.d.ts +3 -0
- package/dist/dialog/DialogContent.d.ts +3 -0
- package/dist/dialog/DialogDescription.d.ts +3 -0
- package/dist/dialog/DialogFooter.d.ts +3 -0
- package/dist/dialog/DialogHeader.d.ts +3 -0
- package/dist/dialog/DialogOverlay.d.ts +3 -0
- package/dist/dialog/DialogPortal.d.ts +3 -0
- package/dist/dialog/DialogTitle.d.ts +3 -0
- package/dist/dialog/DialogTrigger.d.ts +3 -0
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/DividerContent.d.ts +3 -0
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs.map +1 -1
- package/dist/drawer/DrawerBody.d.ts +3 -0
- package/dist/drawer/DrawerClose.d.ts +3 -0
- package/dist/drawer/DrawerCloseButton.d.ts +3 -0
- package/dist/drawer/DrawerContent.d.ts +3 -0
- package/dist/drawer/DrawerDescription.d.ts +3 -0
- package/dist/drawer/DrawerFooter.d.ts +3 -0
- package/dist/drawer/DrawerHeader.d.ts +3 -0
- package/dist/drawer/DrawerOverlay.d.ts +3 -0
- package/dist/drawer/DrawerPortal.d.ts +3 -0
- package/dist/drawer/DrawerTitle.d.ts +3 -0
- package/dist/drawer/DrawerTrigger.d.ts +3 -0
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown/DropdownDivider.d.ts +3 -0
- package/dist/dropdown/DropdownGroup.d.ts +3 -0
- package/dist/dropdown/DropdownItem.d.ts +3 -0
- package/dist/dropdown/DropdownItemIndicator.d.ts +3 -0
- package/dist/dropdown/DropdownItemText.d.ts +3 -0
- package/dist/dropdown/DropdownItems.d.ts +3 -0
- package/dist/dropdown/DropdownLabel.d.ts +3 -0
- package/dist/dropdown/DropdownLeadingIcon.d.ts +3 -0
- package/dist/dropdown/DropdownPopover.d.ts +3 -0
- package/dist/dropdown/DropdownPortal.d.ts +3 -0
- package/dist/dropdown/DropdownTrigger.d.ts +3 -0
- package/dist/dropdown/DropdownValue.d.ts +3 -0
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/file-upload/FileUploadAcceptedFile.d.ts +1 -0
- package/dist/file-upload/FileUploadContext.d.ts +1 -0
- package/dist/file-upload/FileUploadDropzone.d.ts +3 -0
- package/dist/file-upload/FileUploadItemDeleteTrigger.d.ts +3 -0
- package/dist/file-upload/FileUploadPreviewImage.d.ts +1 -0
- package/dist/file-upload/FileUploadRejectedFile.d.ts +1 -0
- package/dist/file-upload/FileUploadRejectedFileDeleteTrigger.d.ts +1 -0
- package/dist/file-upload/FileUploadTrigger.d.ts +3 -0
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs.map +1 -1
- package/dist/form-field/FormFieldAlertMessage.d.ts +1 -0
- package/dist/form-field/FormFieldCharactersCount.d.ts +1 -0
- package/dist/form-field/FormFieldControl.d.ts +1 -0
- package/dist/form-field/FormFieldErrorMessage.d.ts +1 -0
- package/dist/form-field/FormFieldHelperMessage.d.ts +1 -0
- package/dist/form-field/FormFieldLabel.d.ts +1 -0
- package/dist/form-field/FormFieldRequiredIndicator.d.ts +1 -0
- package/dist/form-field/FormFieldStateMessage.d.ts +3 -0
- package/dist/form-field/FormFieldSuccessMessage.d.ts +1 -0
- package/dist/form-field/index.js +1 -1
- package/dist/form-field/index.mjs +1 -1
- package/dist/{form-field-CYGgse45.js → form-field-1sKqNg7F.js} +2 -2
- package/dist/form-field-1sKqNg7F.js.map +1 -0
- package/dist/{form-field-CV5dzt-I.mjs → form-field-OhKW7u5I.mjs} +2 -2
- package/dist/form-field-OhKW7u5I.mjs.map +1 -0
- package/dist/input/InputLeadingIcon.d.ts +1 -0
- package/dist/input/InputTrailingIcon.d.ts +1 -0
- package/dist/input-BIuBpTEq.mjs.map +1 -1
- package/dist/input-Cx5cfgE8.js.map +1 -1
- package/dist/input-otp/InputOTPGroup.d.ts +3 -0
- package/dist/input-otp/InputOTPSeparator.d.ts +3 -0
- package/dist/input-otp/InputOTPSlot.d.ts +3 -0
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/kbd/index.js +1 -1
- package/dist/kbd/index.js.map +1 -1
- package/dist/kbd/index.mjs +1 -1
- package/dist/kbd/index.mjs.map +1 -1
- package/dist/label/LabelRequiredIndicator.d.ts +3 -0
- package/dist/label-BCSEss4U.js.map +1 -1
- package/dist/label-DDBRKLUX.mjs.map +1 -1
- package/dist/link-box/LinkBoxLink.d.ts +3 -0
- package/dist/link-box/LinkBoxRaised.d.ts +24 -0
- package/dist/link-box/index.js.map +1 -1
- package/dist/link-box/index.mjs.map +1 -1
- package/dist/menu/Menu.d.ts +15 -0
- package/dist/menu/MenuCheckboxItem.d.ts +20 -0
- package/dist/menu/MenuCheckboxItemIndicator.d.ts +25 -0
- package/dist/menu/MenuGroup.d.ts +12 -0
- package/dist/menu/MenuGroupLabel.d.ts +19 -0
- package/dist/menu/MenuItem.d.ts +19 -0
- package/dist/menu/MenuItemStyles.d.ts +5 -0
- package/dist/menu/MenuLinkItem.d.ts +27 -0
- package/dist/menu/MenuPopup.d.ts +19 -0
- package/dist/menu/MenuPortal.d.ts +12 -0
- package/dist/menu/MenuPositioner.d.ts +12 -0
- package/dist/menu/MenuRadioGroup.d.ts +12 -0
- package/dist/menu/MenuRadioItem.d.ts +20 -0
- package/dist/menu/MenuRadioItemIndicator.d.ts +25 -0
- package/dist/menu/MenuSeparator.d.ts +12 -0
- package/dist/menu/MenuSubmenu.d.ts +16 -0
- package/dist/menu/MenuSubmenuContext.d.ts +8 -0
- package/dist/menu/MenuSubmenuTrigger.d.ts +19 -0
- package/dist/menu/MenuTrigger.d.ts +21 -0
- package/dist/menu/index.d.mts +49 -0
- package/dist/menu/index.d.ts +49 -0
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.js.map +1 -0
- package/dist/menu/index.mjs +289 -0
- package/dist/menu/index.mjs.map +1 -0
- package/dist/menu/useRenderSlot.d.ts +1 -0
- package/dist/meter/MeterLabel.d.ts +3 -0
- package/dist/meter/MeterTrack.d.ts +3 -0
- package/dist/meter/MeterValue.d.ts +3 -0
- package/dist/meter/index.js.map +1 -1
- package/dist/meter/index.mjs.map +1 -1
- package/dist/pagination/PaginationEllipsis.d.ts +3 -0
- package/dist/pagination/PaginationFirstPageTrigger.d.ts +3 -0
- package/dist/pagination/PaginationLastPageTrigger.d.ts +3 -0
- package/dist/pagination/PaginationNextTrigger.d.ts +3 -0
- package/dist/pagination/PaginationPages.d.ts +3 -0
- package/dist/pagination/PaginationPrevTrigger.d.ts +3 -0
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/popover/PopoverAnchor.d.ts +3 -0
- package/dist/popover/PopoverArrow.d.ts +3 -0
- package/dist/popover/PopoverCloseButton.d.ts +3 -0
- package/dist/popover/PopoverContent.d.ts +3 -0
- package/dist/popover/PopoverHeader.d.ts +3 -0
- package/dist/popover/PopoverPortal.d.ts +3 -0
- package/dist/popover/PopoverTrigger.d.ts +3 -0
- package/dist/popover-DKa4WOQV.mjs.map +1 -1
- package/dist/popover-ayPbAw59.js.map +1 -1
- package/dist/progress/ProgressLabel.d.ts +3 -0
- package/dist/progress/ProgressTrack.d.ts +1 -0
- package/dist/progress/ProgressValue.d.ts +1 -0
- package/dist/progress-C-Zs94G2.mjs.map +1 -1
- package/dist/progress-DaQt4olK.js.map +1 -1
- package/dist/progress-tracker/ProgressTrackerStep.d.ts +1 -0
- package/dist/progress-tracker/ProgressTrackerStepIndicator.d.ts +1 -0
- package/dist/progress-tracker/ProgressTrackerStepLabel.d.ts +1 -0
- package/dist/progress-tracker/index.js +1 -1
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +2 -2
- package/dist/progress-tracker/index.mjs.map +1 -1
- package/dist/radio-group/Radio.d.ts +3 -0
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.js +1 -1
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +2 -2
- package/dist/rating/index.mjs.map +1 -1
- package/dist/rating-display/RatingDisplayCount.d.ts +1 -0
- package/dist/rating-display/RatingDisplayStars.d.ts +1 -0
- package/dist/rating-display/RatingDisplayValue.d.ts +1 -0
- package/dist/rating-display/index.js +1 -1
- package/dist/rating-display/index.js.map +1 -1
- package/dist/rating-display/index.mjs +4 -4
- package/dist/rating-display/index.mjs.map +1 -1
- package/dist/scrolling-list/ScrollingListControls.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListItem.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListItems.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListNextButton.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListPrevButton.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListSkipButton.d.ts +1 -0
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/segmented-control/SegmentedControlIndicator.d.ts +1 -0
- package/dist/segmented-control/SegmentedControlItem.d.ts +1 -0
- package/dist/segmented-control/index.js.map +1 -1
- package/dist/segmented-control/index.mjs.map +1 -1
- package/dist/segmented-gauge/SegmentedGaugeLabel.d.ts +1 -0
- package/dist/segmented-gauge/SegmentedGaugeSegment.d.ts +3 -0
- package/dist/segmented-gauge/SegmentedGaugeTrack.d.ts +1 -0
- package/dist/segmented-gauge/index.js.map +1 -1
- package/dist/segmented-gauge/index.mjs.map +1 -1
- package/dist/select/SelectGroup.d.ts +3 -0
- package/dist/select/SelectItem.d.ts +3 -0
- package/dist/select/SelectItems.d.ts +3 -0
- package/dist/select/SelectLabel.d.ts +3 -0
- package/dist/select/SelectLeadingIcon.d.ts +3 -0
- package/dist/select/SelectPlaceholder.d.ts +3 -0
- package/dist/select/SelectTrigger.d.ts +3 -0
- package/dist/select/SelectValue.d.ts +3 -0
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs.map +1 -1
- package/dist/skeleton/SkeletonItem.d.ts +3 -0
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs.map +1 -1
- package/dist/slider/SliderControl.d.ts +1 -0
- package/dist/slider/SliderIndicator.d.ts +1 -0
- package/dist/slider/SliderLabel.d.ts +1 -0
- package/dist/slider/SliderMaxValue.d.ts +1 -0
- package/dist/slider/SliderMinValue.d.ts +1 -0
- package/dist/slider/SliderThumb.d.ts +1 -0
- package/dist/slider/SliderTrack.d.ts +1 -0
- package/dist/slider/SliderValue.d.ts +1 -3
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs.map +1 -1
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/table/TableBody.d.ts +1 -0
- package/dist/table/TableBulkBar.d.ts +15 -0
- package/dist/table/TableCell.d.ts +1 -0
- package/dist/table/TableColumn.d.ts +1 -0
- package/dist/table/TableHeader.d.ts +1 -0
- package/dist/table/TableRow.d.ts +1 -0
- package/dist/table/index.js.map +1 -1
- package/dist/table/index.mjs.map +1 -1
- package/dist/tabs/TabsContent.d.ts +1 -0
- package/dist/tabs/TabsList.d.ts +1 -0
- package/dist/tabs/TabsTrigger.d.ts +1 -0
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/text-link/index.js +1 -1
- package/dist/text-link/index.js.map +1 -1
- package/dist/text-link/index.mjs +1 -1
- package/dist/text-link/index.mjs.map +1 -1
- package/dist/textarea/TextareaClearButton.d.ts +1 -0
- package/dist/textarea/TextareaLeadingIcon.d.ts +1 -0
- package/dist/textarea/TextareaTrailingIcon.d.ts +1 -0
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/form-field-CV5dzt-I.mjs.map +0 -1
- package/dist/form-field-CYGgse45.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/input-otp/InputOTPContext.tsx","../../src/input-otp/InputOTP.styles.ts","../../src/input-otp/InputOTPSlot.tsx","../../src/input-otp/useInputOTP.ts","../../src/input-otp/InputOTP.tsx","../../src/input-otp/InputOTPGroup.tsx","../../src/input-otp/InputOTPSeparator.tsx","../../src/input-otp/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface InputOTPContextValue {\n value: string\n maxLength: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n activeIndex: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n disabled: boolean\n readOnly: boolean\n placeholder?: string\n type: 'text' | 'number' | 'password' | 'tel'\n}\n\nexport const InputOTPContext = createContext<InputOTPContextValue | null>(null)\n\nexport const useInputOTPContext = () => {\n const context = useContext(InputOTPContext)\n if (!context) {\n throw new Error('InputOTP components must be used within InputOTP')\n }\n\n return context\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputOTPContainerStyles = cva(['relative', 'inline-flex', 'items-center', 'gap-sm'])\n\nexport const inputOTPSlotStyles = cva(\n [\n // Base slot styles\n 'relative h-[50px] w-sz-40',\n 'border-sm rounded-md',\n 'text-center text-display-3 text-on-surface',\n 'outline-hidden',\n 'transition-colors',\n 'flex items-center justify-center',\n // Slot that receives focus when clicking the group (first empty or last slot)\n // Use data-[focus-target=true]:... for distinct styles\n // Active state (when focused)\n 'data-[active=true]:ring-1',\n 'data-[active=true]:ring-inset',\n 'data-[active=true]:ring-l-2',\n 'data-[active=true]:border-focus',\n 'data-[active=true]:z-raised ring-focus',\n // Disabled state\n 'data-[disabled=true]:cursor-not-allowed',\n 'data-[disabled=true]:border-outline',\n 'data-[disabled=true]:bg-on-surface/dim-5',\n 'data-[disabled=true]:text-on-surface/dim-3',\n // Read-only state (same as disabled but text stays normal)\n 'data-[readonly=true]:cursor-default',\n 'data-[readonly=true]:data-[active=false]:border-outline',\n 'data-[readonly=true]:bg-on-surface/dim-5',\n 'group-hover:data-[focus-target=true]:data-[disabled=false]:border-outline-high',\n ],\n {\n variants: {\n /**\n * Color scheme of the slot\n */\n intent: {\n neutral: ['data-[filled=true]:bg-neutral-container bg-surface border-outline'],\n success: ['border-success bg-success-container text-on-success-container'],\n alert: ['border-alert bg-alert-container text-on-alert-container'],\n error: ['border-error bg-error-container text-on-error-container'],\n },\n },\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputOTPSlotStylesProps = VariantProps<typeof inputOTPSlotStyles>\n\n// Keep for backward compatibility\nexport const inputOTPStyles = inputOTPSlotStyles\nexport type InputOTPStylesProps = InputOTPSlotStylesProps\n","import { ComponentPropsWithoutRef } from 'react'\n\nimport { inputOTPSlotStyles } from './InputOTP.styles'\nimport { useInputOTPContext } from './InputOTPContext'\n\nexport interface InputOTPSlotProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * Index of the slot (0-based).\n * If not provided, will be automatically assigned based on position in children.\n */\n index?: number\n}\n\nexport const InputOTPSlot = ({ index: indexProp, className, ...props }: InputOTPSlotProps) => {\n const context = useInputOTPContext()\n\n // Use provided index or fallback to 0 (should not happen if auto-assignment works)\n const index = indexProp ?? 0\n const slot = context.slots[index]\n\n if (!slot) {\n return null\n }\n\n const { char, isActive, hasFakeCaret } = slot\n const isEmpty = !char\n const isPlaceholder = isEmpty && !hasFakeCaret && context.placeholder\n\n const isFocusTarget = index === context.activeIndex\n\n return (\n <div\n className={inputOTPSlotStyles({\n intent: context.intent,\n className,\n })}\n data-active={isActive}\n data-disabled={context.disabled}\n data-readonly={context.readOnly}\n data-filled={!isEmpty}\n data-focus-target={isFocusTarget}\n data-valid={context.intent !== 'error'}\n {...props}\n >\n <span className={isPlaceholder ? 'text-on-surface/dim-3' : ''}>\n {context.type === 'password' && char\n ? '•'\n : char || (!hasFakeCaret && context.placeholder ? context.placeholder : '')}\n </span>\n {hasFakeCaret && (\n <span\n className=\"pointer-events-none absolute inset-0 flex items-center justify-center\"\n aria-hidden=\"true\"\n >\n <span className=\"bg-on-surface animate-standalone-caret-blink h-sz-24 w-sz-2\" />\n </span>\n )}\n </div>\n )\n}\n\nInputOTPSlot.displayName = 'InputOTP.Slot'\n","/* eslint-disable max-lines-per-function */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport {\n ChangeEventHandler,\n ClipboardEventHandler,\n KeyboardEventHandler,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport type { InputOTPContextValue } from './InputOTPContext'\n\nconst BACKSPACE_KEY = 'Backspace'\nconst LEFT_ARROW_KEY = 'ArrowLeft'\nconst UP_ARROW_KEY = 'ArrowUp'\nconst RIGHT_ARROW_KEY = 'ArrowRight'\nconst DOWN_ARROW_KEY = 'ArrowDown'\nconst E_KEY = 'e'\n\nexport interface UseInputOTPProps {\n maxLength: number\n type: 'text' | 'number' | 'password' | 'tel'\n value?: string\n defaultValue: string\n onValueChange?: (value: string) => void\n isValid: boolean\n disabledProp: boolean\n readOnlyProp: boolean\n autoFocus: boolean\n forceUppercase: boolean\n filterKeys: string[]\n pattern?: string\n placeholder: string\n nameProp?: string\n}\n\nexport interface UseInputOTPReturn {\n uuid: string\n inputRef: React.RefObject<HTMLInputElement | null>\n containerRef: React.RefObject<HTMLDivElement | null>\n name: string | undefined\n disabled: boolean\n readOnly: boolean\n isInvalid: boolean\n isRequired: boolean\n description: string | undefined\n maxLength: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n currentValue: string\n activeIndex: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n contextValue: InputOTPContextValue\n handleChange: ChangeEventHandler<HTMLInputElement>\n handleKeyDown: KeyboardEventHandler<HTMLInputElement>\n handleCopy: ClipboardEventHandler<HTMLInputElement>\n handlePaste: ClipboardEventHandler<HTMLInputElement>\n handleFocus: () => void\n handleBlur: () => void\n handleClick: () => void\n labelId: string | undefined\n}\n\nexport const useInputOTP = ({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n}: UseInputOTPProps): UseInputOTPReturn => {\n const uuid = useId()\n const inputRef = useRef<HTMLInputElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n\n // Get FormField context (optional, falls back gracefully if not present)\n const field = useFormFieldControl()\n\n // Use FormField values if available, otherwise fall back to props\n // Use FormField id when available so label htmlFor works correctly\n const id = field.id ?? uuid\n const name = nameProp ?? field.name\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n const isInvalid = field.isInvalid ?? !isValid\n const isRequired = field.isRequired ?? false\n const labelId = field.labelId\n const description = field.description\n const fieldState = field.state\n\n // Determine intent based on FormField state or isValid prop\n const getIntent = (): 'neutral' | 'success' | 'alert' | 'error' => {\n // FormField state takes priority\n if (['success', 'alert', 'error'].includes(fieldState ?? '')) {\n return fieldState as 'success' | 'alert' | 'error'\n }\n\n // Fallback to isValid prop for backward compatibility\n if (isInvalid) {\n return 'error'\n }\n\n return 'neutral'\n }\n\n const intent = getIntent()\n\n // Initialize value\n const initialValue = controlledValue !== undefined ? controlledValue : defaultValue\n const processedValue = forceUppercase ? initialValue.toUpperCase() : initialValue\n\n const [internalValue, setInternalValue] = useState<string>(processedValue)\n const [isFocused, setIsFocused] = useState<boolean>(false)\n\n // Use controlled value if provided, otherwise use internal state\n const currentValue = controlledValue !== undefined ? controlledValue : internalValue\n\n // Calculate active index: last empty slot, or last slot if all are filled\n const activeIndex = Math.min(currentValue.length, maxLength - 1)\n\n // Sync cursor position with active index\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.setSelectionRange(activeIndex, activeIndex)\n }\n }, [activeIndex, currentValue.length, maxLength])\n\n // Create slots array\n const slots = useMemo(\n () =>\n Array.from({ length: maxLength }, (_, i) => ({\n char: currentValue[i] || '',\n isActive: i === activeIndex && isFocused,\n hasFakeCaret: i === activeIndex && !currentValue[i] && !disabled && !readOnly && isFocused,\n })),\n [maxLength, currentValue, activeIndex, isFocused, disabled, readOnly]\n )\n\n // Sync controlled value with input ref\n useEffect(() => {\n if (inputRef.current && controlledValue !== undefined) {\n inputRef.current.value = controlledValue\n }\n }, [controlledValue])\n\n // Focus management\n useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus()\n }\n }, [autoFocus])\n\n const processInputValue = (inputValue: string): string => {\n let processed = inputValue\n\n if (forceUppercase) {\n processed = processed.toUpperCase()\n }\n\n if (type === 'number') {\n processed = processed.replace(/[^\\d]/g, '')\n }\n\n // Filter characters using pattern if provided\n if (pattern) {\n try {\n // Convert HTML pattern (string) to RegExp\n // HTML patterns validate the entire string, but we need to test each character\n // We create a regex that tests if a single character matches the pattern\n // For example: [0-9]* becomes ^[0-9]$ to test a single digit\n // We wrap the pattern in ^...$ to ensure it matches a single character\n let regexPattern = pattern\n // If pattern doesn't start with ^, wrap it to test single character\n if (!pattern.startsWith('^')) {\n regexPattern = `^${pattern}$`\n }\n const regex = new RegExp(regexPattern)\n processed = processed\n .split('')\n .filter(currChar => {\n // Test if the character matches the pattern\n return regex.test(currChar)\n })\n .join('')\n } catch (error) {\n // If pattern is invalid, ignore it and continue with other filters\n console.error('Invalid pattern provided to InputOTP:', pattern, error)\n }\n }\n\n return processed\n }\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n const inputValue = e.target.value\n const processedValue = processInputValue(inputValue)\n\n // Limit to maxLength\n const newValue = processedValue.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n // Allow copy/cut/paste/selectAll shortcuts even when key is in filterKeys\n const isShortcut =\n (e.ctrlKey || e.metaKey) && ['a', 'c', 'v', 'x'].includes(e.key.toLowerCase())\n\n // Filter keys\n if (filterKeys.length > 0 && filterKeys.includes(e.key) && !isShortcut) {\n e.preventDefault()\n\n return\n }\n\n switch (e.key) {\n case BACKSPACE_KEY:\n e.preventDefault()\n const currentLength = currentValue.length\n if (currentLength > 0) {\n const newValue = currentValue.slice(0, currentLength - 1)\n\n // Call onValueChange first\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.max(0, newValue.length)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n break\n\n case LEFT_ARROW_KEY:\n case RIGHT_ARROW_KEY:\n // Prevent navigation with arrow keys - focus stays on last empty slot\n e.preventDefault()\n break\n\n case UP_ARROW_KEY:\n case DOWN_ARROW_KEY:\n e.preventDefault()\n break\n\n case E_KEY:\n case 'E':\n // Prevent 'e' or 'E' in number inputs\n if (type === 'number') {\n e.preventDefault()\n }\n break\n\n default:\n break\n }\n }\n\n const handleCopy: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled) return\n\n e.preventDefault()\n if (currentValue.length > 0) {\n e.clipboardData.setData('text/plain', currentValue)\n }\n }\n\n const handlePaste: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n e.preventDefault()\n\n const pastedText = e.clipboardData.getData('text')\n\n if (!pastedText) return\n\n const processedText = processInputValue(pastedText)\n const newValue = processedText.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Move cursor to end\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleFocus = () => {\n setIsFocused(true)\n if (inputRef.current) {\n // Focus on last empty slot, or last slot if all are filled\n const cursorPosition = Math.min(currentValue.length, maxLength - 1)\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition)\n }\n }\n\n const handleBlur = () => {\n setIsFocused(false)\n }\n\n const handleClick = () => {\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n const contextValue: InputOTPContextValue = {\n value: currentValue,\n maxLength,\n slots,\n activeIndex,\n intent,\n disabled,\n readOnly,\n placeholder,\n type,\n }\n\n const returnValue: UseInputOTPReturn = {\n uuid: id,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n maxLength,\n intent,\n currentValue,\n activeIndex,\n slots,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n }\n\n return returnValue\n}\n","/* eslint-disable max-lines-per-function */\nimport { cx } from 'class-variance-authority'\nimport {\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n useMemo,\n} from 'react'\n\nimport { InputOTPContext } from './InputOTPContext'\nimport { InputOTPSlot } from './InputOTPSlot'\nimport { useInputOTP } from './useInputOTP'\n\n/**\n * Counts the number of InputOTPSlot components in the children tree\n */\nconst countSlots = (children: ReactNode): number => {\n let count = 0\n\n Children.forEach(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { children?: ReactNode }\n // Check if it's an InputOTPSlot by checking displayName\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n count++\n } else if (props.children) {\n // Recursively count slots in nested children (e.g., inside InputOTPGroup)\n count += countSlots(props.children)\n }\n }\n })\n\n return count\n}\n\n/**\n * Recursively assigns index to InputOTPSlot components\n * Returns a tuple of [processedChildren, nextIndex]\n */\nconst assignSlotIndexes = (children: ReactNode, startIndex: number = 0): [ReactNode, number] => {\n let currentIndex = startIndex\n\n const processed = Children.map(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { index?: number; children?: ReactNode }\n // Check if it's an InputOTPSlot\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n // Only assign index if not already provided\n const slotIndex = typeof props.index === 'number' ? props.index : currentIndex++\n\n return cloneElement(child as ReactElement<{ index?: number }>, {\n ...props,\n index: slotIndex,\n })\n } else if (props.children) {\n // Recursively process nested children\n const [processedChildren, nextIndex] = assignSlotIndexes(props.children, currentIndex)\n currentIndex = nextIndex\n\n return cloneElement(child, {\n ...(child.props as Record<string, unknown>),\n children: processedChildren,\n } as Parameters<typeof cloneElement>[1])\n }\n }\n\n return child\n })\n\n return [processed, currentIndex]\n}\n\nexport interface InputOTPProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'inputMode'\n> {\n /**\n * Maximum length of the input value.\n * If not provided, will be automatically detected from the number of InputOTP.Slot children.\n */\n maxLength?: number\n /**\n * Type of input\n * @default 'text'\n */\n type?: 'text' | 'number' | 'password' | 'tel'\n /**\n * Current value (controlled mode)\n */\n value?: string\n /**\n * Default value (uncontrolled mode)\n */\n defaultValue?: string\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void\n /**\n * Whether the input is valid\n * @default true\n */\n isValid?: boolean\n /**\n * Whether the input is disabled\n * @default false\n */\n disabled?: boolean\n /**\n * Whether the input is read-only (value visible but not editable)\n * @default false\n */\n readOnly?: boolean\n /**\n * Whether to auto-focus the input\n * @default false\n */\n autoFocus?: boolean\n /**\n * Auto-complete attribute\n * @default 'off'\n */\n autoComplete?: string\n /**\n * Whether to force uppercase\n * @default false\n */\n forceUppercase?: boolean\n /**\n * Array of keys to filter out (using KeyboardEvent.key values)\n * @default ['-', '.']\n */\n filterKeys?: string[]\n /**\n * Pattern attribute for input validation and character filtering.\n * Uses a regular expression to filter allowed characters in real-time.\n * For example: \"[0-9]\" for digits only, \"[a-c]\" for letters a, b, c only.\n */\n pattern?: string\n /**\n * Input mode attribute\n */\n inputMode?: string\n /**\n * Placeholder text\n */\n placeholder?: string\n /**\n * Name attribute for form integration\n */\n name?: string\n /**\n * Children components (InputOTPGroup, InputOTPSlot, InputOTPSeparator)\n */\n children: ReactNode\n /**\n * Ref callback for the container\n */\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputOTP = ({\n maxLength: maxLengthProp,\n type = 'text',\n value: controlledValue,\n defaultValue = '',\n onValueChange,\n isValid = true,\n disabled: disabledProp = false,\n readOnly: readOnlyProp = false,\n autoFocus = false,\n autoComplete = 'off',\n forceUppercase = false,\n filterKeys = ['-', '.'],\n pattern,\n inputMode,\n placeholder = '-',\n name: nameProp,\n className,\n children,\n ...others\n}: InputOTPProps) => {\n // Auto-detect maxLength from children if not provided\n const maxLength = useMemo(() => {\n if (maxLengthProp !== undefined) {\n return maxLengthProp\n }\n\n const detectedLength = countSlots(children)\n const DEFAULT_MAX_LENGTH = 4\n\n return detectedLength > 0 ? detectedLength : DEFAULT_MAX_LENGTH // fallback to 4 if no slots found\n }, [maxLengthProp, children])\n\n // Assign indexes to slots automatically\n const processedChildren = useMemo(() => {\n const [processed] = assignSlotIndexes(children)\n\n return processed\n }, [children])\n\n // Use the hook for all business logic\n const {\n uuid,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n currentValue,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n } = useInputOTP({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n })\n\n // Extract aria-label from others if provided (for cases without FormField)\n const ariaLabel =\n 'aria-label' in others ? (others['aria-label'] as string | undefined) : undefined\n const { 'aria-label': _, ...restOthers } = others\n\n const getAccessibleNameProps = (): Record<string, string | undefined> => {\n if (labelId) {\n return { 'aria-labelledby': labelId }\n }\n\n if (ariaLabel) {\n return { 'aria-label': ariaLabel }\n }\n\n return {}\n }\n\n const accessibleNameProps = getAccessibleNameProps()\n\n return (\n <InputOTPContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n data-spark-component=\"input-otp\"\n role=\"group\"\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n className={cx(\n 'group gap-md relative inline-flex w-fit items-center default:cursor-text',\n {\n 'cursor-not-allowed': disabled,\n 'cursor-default': readOnly,\n },\n className\n )}\n onClick={handleClick}\n {...restOthers}\n >\n {/* Hidden input for form submission with complete value */}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={currentValue}\n required={isRequired}\n aria-required={isRequired}\n aria-invalid={isInvalid}\n {...accessibleNameProps}\n />\n )}\n {/* Actual input that handles all interactions */}\n <input\n ref={inputRef}\n id={uuid}\n type={type === 'password' ? 'password' : 'text'}\n value={currentValue}\n maxLength={maxLength}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n disabled={disabled}\n readOnly={readOnly}\n pattern={pattern}\n inputMode={inputMode as React.InputHTMLAttributes<HTMLInputElement>['inputMode']}\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onCopy={handleCopy}\n onPaste={handlePaste}\n onFocus={handleFocus}\n onBlur={handleBlur}\n className=\"bg-success z-raised absolute inset-0 m-0 p-0 opacity-0 read-only:cursor-default disabled:cursor-not-allowed\"\n tabIndex={0}\n />\n {/* Children render slots with auto-assigned indexes */}\n {processedChildren}\n </div>\n </InputOTPContext.Provider>\n )\n}\n\nInputOTP.displayName = 'InputOTP'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPGroupProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport const InputOTPGroup = ({ children, className, ...props }: InputOTPGroupProps) => {\n return (\n <div className={`gap-md flex ${className}`} {...props}>\n {children}\n </div>\n )\n}\n\nInputOTPGroup.displayName = 'InputOTP.Group'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPSeparatorProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport const InputOTPSeparator = ({ className, ...props }: InputOTPSeparatorProps) => {\n return (\n <div\n className={`text-on-surface/dim-3 flex items-center justify-center ${className || ''}`}\n {...props}\n >\n <div className=\"h-sz-4 w-sz-8 bg-outline rounded-full\" />\n </div>\n )\n}\n\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n","import { InputOTP as Root } from './InputOTP'\nimport { InputOTPGroup } from './InputOTPGroup'\nimport { InputOTPSeparator } from './InputOTPSeparator'\nimport { InputOTPSlot } from './InputOTPSlot'\n\n/**\n * An input component for entering one-time passwords or verification codes with individual character slots.\n */\nexport const InputOTP: typeof Root & {\n Group: typeof InputOTPGroup\n Slot: typeof InputOTPSlot\n Separator: typeof InputOTPSeparator\n} = Object.assign(Root, {\n Group: InputOTPGroup,\n Slot: InputOTPSlot,\n Separator: InputOTPSeparator,\n})\n\nInputOTP.displayName = 'InputOTP'\nInputOTPGroup.displayName = 'InputOTP.Group'\nInputOTPSlot.displayName = 'InputOTP.Slot'\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n\nexport { type InputOTPProps } from './InputOTP'\nexport { type InputOTPGroupProps } from './InputOTPGroup'\nexport { type InputOTPSlotProps } from './InputOTPSlot'\nexport { type InputOTPSeparatorProps } from './InputOTPSeparator'\nexport {\n inputOTPSlotStyles,\n inputOTPStyles,\n type InputOTPSlotStylesProps,\n type InputOTPStylesProps,\n} from './InputOTP.styles'\n"],"mappings":";;;;;AAkBA,IAAa,IAAkB,EAA2C,KAAK,EAElE,UAA2B;CACtC,IAAM,IAAU,EAAW,EAAgB;AAC3C,KAAI,CAAC,EACH,OAAU,MAAM,mDAAmD;AAGrE,QAAO;;ACxB8B,EAAI;CAAC;CAAY;CAAe;CAAgB;CAAS,CAAC;AAEjG,IAAa,IAAqB,EAChC;CAEE;CACA;CACA;CACA;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACD,EACD;CACE,UAAU,EAIR,QAAQ;EACN,SAAS,CAAC,oEAAoE;EAC9E,SAAS,CAAC,gEAAgE;EAC1E,OAAO,CAAC,0DAA0D;EAClE,OAAO,CAAC,0DAA0D;EACnE,EACF;CACD,iBAAiB,EACf,QAAQ,WACT;CACF,CACF,EAKY,IAAiB,GCxCjB,KAAgB,EAAE,OAAO,GAAW,cAAW,GAAG,QAA+B;CAC5F,IAAM,IAAU,GAAoB,EAG9B,IAAQ,KAAa,GACrB,IAAO,EAAQ,MAAM;AAE3B,KAAI,CAAC,EACH,QAAO;CAGT,IAAM,EAAE,SAAM,aAAU,oBAAiB,GACnC,IAAU,CAAC,GACX,IAAgB,KAAW,CAAC,KAA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IACtB,kBAAkB;IACnB,EACD,EACD;GACD,SAAS;GACT,GAAI;aAfN;IAkBG,KACC,kBAAC,SAAD;KACE,MAAK;KACC;KACN,OAAO;KACP,UAAU;KACV,iBAAe;KACf,gBAAc;KACd,GAAI;KACJ,CAAA;IAGJ,kBAAC,SAAD;KACE,KAAK;KACL,IAAI;KACJ,MAAM,MAAS,aAAa,aAAa;KACzC,OAAO;KACI;KACA;KACG;KACJ;KACA;KACD;KACE;KACX,GAAI;KACJ,GAAK,IAAc,EAAE,oBAAoB,GAAa,GAAG,EAAE;KAC3D,gBAAc;KACd,UAAU;KACV,WAAW;KACX,QAAQ;KACR,SAAS;KACT,SAAS;KACT,QAAQ;KACR,WAAU;KACV,UAAU;KACV,CAAA;IAED;IACG;;EACmB,CAAA;;AAI/B,EAAS,cAAc;;;ACvUvB,IAAa,KAAiB,EAAE,aAAU,cAAW,GAAG,QAEpD,kBAAC,OAAD;CAAK,WAAW,eAAe;CAAa,GAAI;CAC7C;CACG,CAAA;AAIV,EAAc,cAAc;;;ACR5B,IAAa,KAAqB,EAAE,cAAW,GAAG,QAE9C,kBAAC,OAAD;CACE,WAAW,0DAA0D,KAAa;CAClF,GAAI;WAEJ,kBAAC,OAAD,EAAK,WAAU,yCAA0C,CAAA;CACrD,CAAA;AAIV,EAAkB,cAAc;;;ACPhC,IAAa,IAIT,OAAO,OAAO,GAAM;CACtB,OAAO;CACP,MAAM;CACN,WAAW;CACZ,CAAC;AAEF,EAAS,cAAc,YACvB,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAkB,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/input-otp/InputOTPContext.tsx","../../src/input-otp/InputOTP.styles.ts","../../src/input-otp/InputOTPSlot.tsx","../../src/input-otp/useInputOTP.ts","../../src/input-otp/InputOTP.tsx","../../src/input-otp/InputOTPGroup.tsx","../../src/input-otp/InputOTPSeparator.tsx","../../src/input-otp/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface InputOTPContextValue {\n value: string\n maxLength: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n activeIndex: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n disabled: boolean\n readOnly: boolean\n placeholder?: string\n type: 'text' | 'number' | 'password' | 'tel'\n}\n\nexport const InputOTPContext = createContext<InputOTPContextValue | null>(null)\n\nexport const useInputOTPContext = () => {\n const context = useContext(InputOTPContext)\n if (!context) {\n throw new Error('InputOTP components must be used within InputOTP')\n }\n\n return context\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputOTPContainerStyles = cva(['relative', 'inline-flex', 'items-center', 'gap-sm'])\n\nexport const inputOTPSlotStyles = cva(\n [\n // Base slot styles\n 'relative h-[50px] w-sz-40',\n 'border-sm rounded-md',\n 'text-center text-display-3 text-on-surface',\n 'outline-hidden',\n 'transition-colors',\n 'flex items-center justify-center',\n // Slot that receives focus when clicking the group (first empty or last slot)\n // Use data-[focus-target=true]:... for distinct styles\n // Active state (when focused)\n 'data-[active=true]:ring-1',\n 'data-[active=true]:ring-inset',\n 'data-[active=true]:ring-l-2',\n 'data-[active=true]:border-focus',\n 'data-[active=true]:z-raised ring-focus',\n // Disabled state\n 'data-[disabled=true]:cursor-not-allowed',\n 'data-[disabled=true]:border-outline',\n 'data-[disabled=true]:bg-on-surface/dim-5',\n 'data-[disabled=true]:text-on-surface/dim-3',\n // Read-only state (same as disabled but text stays normal)\n 'data-[readonly=true]:cursor-default',\n 'data-[readonly=true]:data-[active=false]:border-outline',\n 'data-[readonly=true]:bg-on-surface/dim-5',\n 'group-hover:data-[focus-target=true]:data-[disabled=false]:border-outline-high',\n ],\n {\n variants: {\n /**\n * Color scheme of the slot\n */\n intent: {\n neutral: ['data-[filled=true]:bg-neutral-container bg-surface border-outline'],\n success: ['border-success bg-success-container text-on-success-container'],\n alert: ['border-alert bg-alert-container text-on-alert-container'],\n error: ['border-error bg-error-container text-on-error-container'],\n },\n },\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputOTPSlotStylesProps = VariantProps<typeof inputOTPSlotStyles>\n\n// Keep for backward compatibility\nexport const inputOTPStyles = inputOTPSlotStyles\nexport type InputOTPStylesProps = InputOTPSlotStylesProps\n","import { ComponentPropsWithoutRef } from 'react'\n\nimport { inputOTPSlotStyles } from './InputOTP.styles'\nimport { useInputOTPContext } from './InputOTPContext'\n\nexport interface InputOTPSlotProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * Index of the slot (0-based).\n * If not provided, will be automatically assigned based on position in children.\n */\n index?: number\n}\n\n/**\n * An individual slot for a single OTP character. Renders a <div> element.\n */\nexport const InputOTPSlot = ({ index: indexProp, className, ...props }: InputOTPSlotProps) => {\n const context = useInputOTPContext()\n\n // Use provided index or fallback to 0 (should not happen if auto-assignment works)\n const index = indexProp ?? 0\n const slot = context.slots[index]\n\n if (!slot) {\n return null\n }\n\n const { char, isActive, hasFakeCaret } = slot\n const isEmpty = !char\n const isPlaceholder = isEmpty && !hasFakeCaret && context.placeholder\n\n const isFocusTarget = index === context.activeIndex\n\n return (\n <div\n className={inputOTPSlotStyles({\n intent: context.intent,\n className,\n })}\n data-active={isActive}\n data-disabled={context.disabled}\n data-readonly={context.readOnly}\n data-filled={!isEmpty}\n data-focus-target={isFocusTarget}\n data-valid={context.intent !== 'error'}\n {...props}\n >\n <span className={isPlaceholder ? 'text-on-surface/dim-3' : ''}>\n {context.type === 'password' && char\n ? '•'\n : char || (!hasFakeCaret && context.placeholder ? context.placeholder : '')}\n </span>\n {hasFakeCaret && (\n <span\n className=\"pointer-events-none absolute inset-0 flex items-center justify-center\"\n aria-hidden=\"true\"\n >\n <span className=\"bg-on-surface animate-standalone-caret-blink h-sz-24 w-sz-2\" />\n </span>\n )}\n </div>\n )\n}\n\nInputOTPSlot.displayName = 'InputOTP.Slot'\n","/* eslint-disable max-lines-per-function */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport {\n ChangeEventHandler,\n ClipboardEventHandler,\n KeyboardEventHandler,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport type { InputOTPContextValue } from './InputOTPContext'\n\nconst BACKSPACE_KEY = 'Backspace'\nconst LEFT_ARROW_KEY = 'ArrowLeft'\nconst UP_ARROW_KEY = 'ArrowUp'\nconst RIGHT_ARROW_KEY = 'ArrowRight'\nconst DOWN_ARROW_KEY = 'ArrowDown'\nconst E_KEY = 'e'\n\nexport interface UseInputOTPProps {\n maxLength: number\n type: 'text' | 'number' | 'password' | 'tel'\n value?: string\n defaultValue: string\n onValueChange?: (value: string) => void\n isValid: boolean\n disabledProp: boolean\n readOnlyProp: boolean\n autoFocus: boolean\n forceUppercase: boolean\n filterKeys: string[]\n pattern?: string\n placeholder: string\n nameProp?: string\n}\n\nexport interface UseInputOTPReturn {\n uuid: string\n inputRef: React.RefObject<HTMLInputElement | null>\n containerRef: React.RefObject<HTMLDivElement | null>\n name: string | undefined\n disabled: boolean\n readOnly: boolean\n isInvalid: boolean\n isRequired: boolean\n description: string | undefined\n maxLength: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n currentValue: string\n activeIndex: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n contextValue: InputOTPContextValue\n handleChange: ChangeEventHandler<HTMLInputElement>\n handleKeyDown: KeyboardEventHandler<HTMLInputElement>\n handleCopy: ClipboardEventHandler<HTMLInputElement>\n handlePaste: ClipboardEventHandler<HTMLInputElement>\n handleFocus: () => void\n handleBlur: () => void\n handleClick: () => void\n labelId: string | undefined\n}\n\nexport const useInputOTP = ({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n}: UseInputOTPProps): UseInputOTPReturn => {\n const uuid = useId()\n const inputRef = useRef<HTMLInputElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n\n // Get FormField context (optional, falls back gracefully if not present)\n const field = useFormFieldControl()\n\n // Use FormField values if available, otherwise fall back to props\n // Use FormField id when available so label htmlFor works correctly\n const id = field.id ?? uuid\n const name = nameProp ?? field.name\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n const isInvalid = field.isInvalid ?? !isValid\n const isRequired = field.isRequired ?? false\n const labelId = field.labelId\n const description = field.description\n const fieldState = field.state\n\n // Determine intent based on FormField state or isValid prop\n const getIntent = (): 'neutral' | 'success' | 'alert' | 'error' => {\n // FormField state takes priority\n if (['success', 'alert', 'error'].includes(fieldState ?? '')) {\n return fieldState as 'success' | 'alert' | 'error'\n }\n\n // Fallback to isValid prop for backward compatibility\n if (isInvalid) {\n return 'error'\n }\n\n return 'neutral'\n }\n\n const intent = getIntent()\n\n // Initialize value\n const initialValue = controlledValue !== undefined ? controlledValue : defaultValue\n const processedValue = forceUppercase ? initialValue.toUpperCase() : initialValue\n\n const [internalValue, setInternalValue] = useState<string>(processedValue)\n const [isFocused, setIsFocused] = useState<boolean>(false)\n\n // Use controlled value if provided, otherwise use internal state\n const currentValue = controlledValue !== undefined ? controlledValue : internalValue\n\n // Calculate active index: last empty slot, or last slot if all are filled\n const activeIndex = Math.min(currentValue.length, maxLength - 1)\n\n // Sync cursor position with active index\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.setSelectionRange(activeIndex, activeIndex)\n }\n }, [activeIndex, currentValue.length, maxLength])\n\n // Create slots array\n const slots = useMemo(\n () =>\n Array.from({ length: maxLength }, (_, i) => ({\n char: currentValue[i] || '',\n isActive: i === activeIndex && isFocused,\n hasFakeCaret: i === activeIndex && !currentValue[i] && !disabled && !readOnly && isFocused,\n })),\n [maxLength, currentValue, activeIndex, isFocused, disabled, readOnly]\n )\n\n // Sync controlled value with input ref\n useEffect(() => {\n if (inputRef.current && controlledValue !== undefined) {\n inputRef.current.value = controlledValue\n }\n }, [controlledValue])\n\n // Focus management\n useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus()\n }\n }, [autoFocus])\n\n const processInputValue = (inputValue: string): string => {\n let processed = inputValue\n\n if (forceUppercase) {\n processed = processed.toUpperCase()\n }\n\n if (type === 'number') {\n processed = processed.replace(/[^\\d]/g, '')\n }\n\n // Filter characters using pattern if provided\n if (pattern) {\n try {\n // Convert HTML pattern (string) to RegExp\n // HTML patterns validate the entire string, but we need to test each character\n // We create a regex that tests if a single character matches the pattern\n // For example: [0-9]* becomes ^[0-9]$ to test a single digit\n // We wrap the pattern in ^...$ to ensure it matches a single character\n let regexPattern = pattern\n // If pattern doesn't start with ^, wrap it to test single character\n if (!pattern.startsWith('^')) {\n regexPattern = `^${pattern}$`\n }\n const regex = new RegExp(regexPattern)\n processed = processed\n .split('')\n .filter(currChar => {\n // Test if the character matches the pattern\n return regex.test(currChar)\n })\n .join('')\n } catch (error) {\n // If pattern is invalid, ignore it and continue with other filters\n console.error('Invalid pattern provided to InputOTP:', pattern, error)\n }\n }\n\n return processed\n }\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n const inputValue = e.target.value\n const processedValue = processInputValue(inputValue)\n\n // Limit to maxLength\n const newValue = processedValue.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n // Allow copy/cut/paste/selectAll shortcuts even when key is in filterKeys\n const isShortcut =\n (e.ctrlKey || e.metaKey) && ['a', 'c', 'v', 'x'].includes(e.key.toLowerCase())\n\n // Filter keys\n if (filterKeys.length > 0 && filterKeys.includes(e.key) && !isShortcut) {\n e.preventDefault()\n\n return\n }\n\n switch (e.key) {\n case BACKSPACE_KEY:\n e.preventDefault()\n const currentLength = currentValue.length\n if (currentLength > 0) {\n const newValue = currentValue.slice(0, currentLength - 1)\n\n // Call onValueChange first\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.max(0, newValue.length)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n break\n\n case LEFT_ARROW_KEY:\n case RIGHT_ARROW_KEY:\n // Prevent navigation with arrow keys - focus stays on last empty slot\n e.preventDefault()\n break\n\n case UP_ARROW_KEY:\n case DOWN_ARROW_KEY:\n e.preventDefault()\n break\n\n case E_KEY:\n case 'E':\n // Prevent 'e' or 'E' in number inputs\n if (type === 'number') {\n e.preventDefault()\n }\n break\n\n default:\n break\n }\n }\n\n const handleCopy: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled) return\n\n e.preventDefault()\n if (currentValue.length > 0) {\n e.clipboardData.setData('text/plain', currentValue)\n }\n }\n\n const handlePaste: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n e.preventDefault()\n\n const pastedText = e.clipboardData.getData('text')\n\n if (!pastedText) return\n\n const processedText = processInputValue(pastedText)\n const newValue = processedText.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Move cursor to end\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleFocus = () => {\n setIsFocused(true)\n if (inputRef.current) {\n // Focus on last empty slot, or last slot if all are filled\n const cursorPosition = Math.min(currentValue.length, maxLength - 1)\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition)\n }\n }\n\n const handleBlur = () => {\n setIsFocused(false)\n }\n\n const handleClick = () => {\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n const contextValue: InputOTPContextValue = {\n value: currentValue,\n maxLength,\n slots,\n activeIndex,\n intent,\n disabled,\n readOnly,\n placeholder,\n type,\n }\n\n const returnValue: UseInputOTPReturn = {\n uuid: id,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n maxLength,\n intent,\n currentValue,\n activeIndex,\n slots,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n }\n\n return returnValue\n}\n","/* eslint-disable max-lines-per-function */\nimport { cx } from 'class-variance-authority'\nimport {\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n useMemo,\n} from 'react'\n\nimport { InputOTPContext } from './InputOTPContext'\nimport { InputOTPSlot } from './InputOTPSlot'\nimport { useInputOTP } from './useInputOTP'\n\n/**\n * Counts the number of InputOTPSlot components in the children tree\n */\nconst countSlots = (children: ReactNode): number => {\n let count = 0\n\n Children.forEach(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { children?: ReactNode }\n // Check if it's an InputOTPSlot by checking displayName\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n count++\n } else if (props.children) {\n // Recursively count slots in nested children (e.g., inside InputOTPGroup)\n count += countSlots(props.children)\n }\n }\n })\n\n return count\n}\n\n/**\n * Recursively assigns index to InputOTPSlot components\n * Returns a tuple of [processedChildren, nextIndex]\n */\nconst assignSlotIndexes = (children: ReactNode, startIndex: number = 0): [ReactNode, number] => {\n let currentIndex = startIndex\n\n const processed = Children.map(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { index?: number; children?: ReactNode }\n // Check if it's an InputOTPSlot\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n // Only assign index if not already provided\n const slotIndex = typeof props.index === 'number' ? props.index : currentIndex++\n\n return cloneElement(child as ReactElement<{ index?: number }>, {\n ...props,\n index: slotIndex,\n })\n } else if (props.children) {\n // Recursively process nested children\n const [processedChildren, nextIndex] = assignSlotIndexes(props.children, currentIndex)\n currentIndex = nextIndex\n\n return cloneElement(child, {\n ...(child.props as Record<string, unknown>),\n children: processedChildren,\n } as Parameters<typeof cloneElement>[1])\n }\n }\n\n return child\n })\n\n return [processed, currentIndex]\n}\n\nexport interface InputOTPProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'inputMode'\n> {\n /**\n * Maximum length of the input value.\n * If not provided, will be automatically detected from the number of InputOTP.Slot children.\n */\n maxLength?: number\n /**\n * Type of input\n * @default 'text'\n */\n type?: 'text' | 'number' | 'password' | 'tel'\n /**\n * Current value (controlled mode)\n */\n value?: string\n /**\n * Default value (uncontrolled mode)\n */\n defaultValue?: string\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void\n /**\n * Whether the input is valid\n * @default true\n */\n isValid?: boolean\n /**\n * Whether the input is disabled\n * @default false\n */\n disabled?: boolean\n /**\n * Whether the input is read-only (value visible but not editable)\n * @default false\n */\n readOnly?: boolean\n /**\n * Whether to auto-focus the input\n * @default false\n */\n autoFocus?: boolean\n /**\n * Auto-complete attribute\n * @default 'off'\n */\n autoComplete?: string\n /**\n * Whether to force uppercase\n * @default false\n */\n forceUppercase?: boolean\n /**\n * Array of keys to filter out (using KeyboardEvent.key values)\n * @default ['-', '.']\n */\n filterKeys?: string[]\n /**\n * Pattern attribute for input validation and character filtering.\n * Uses a regular expression to filter allowed characters in real-time.\n * For example: \"[0-9]\" for digits only, \"[a-c]\" for letters a, b, c only.\n */\n pattern?: string\n /**\n * Input mode attribute\n */\n inputMode?: string\n /**\n * Placeholder text\n */\n placeholder?: string\n /**\n * Name attribute for form integration\n */\n name?: string\n /**\n * Children components (InputOTPGroup, InputOTPSlot, InputOTPSeparator)\n */\n children: ReactNode\n /**\n * Ref callback for the container\n */\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputOTP = ({\n maxLength: maxLengthProp,\n type = 'text',\n value: controlledValue,\n defaultValue = '',\n onValueChange,\n isValid = true,\n disabled: disabledProp = false,\n readOnly: readOnlyProp = false,\n autoFocus = false,\n autoComplete = 'off',\n forceUppercase = false,\n filterKeys = ['-', '.'],\n pattern,\n inputMode,\n placeholder = '-',\n name: nameProp,\n className,\n children,\n ...others\n}: InputOTPProps) => {\n // Auto-detect maxLength from children if not provided\n const maxLength = useMemo(() => {\n if (maxLengthProp !== undefined) {\n return maxLengthProp\n }\n\n const detectedLength = countSlots(children)\n const DEFAULT_MAX_LENGTH = 4\n\n return detectedLength > 0 ? detectedLength : DEFAULT_MAX_LENGTH // fallback to 4 if no slots found\n }, [maxLengthProp, children])\n\n // Assign indexes to slots automatically\n const processedChildren = useMemo(() => {\n const [processed] = assignSlotIndexes(children)\n\n return processed\n }, [children])\n\n // Use the hook for all business logic\n const {\n uuid,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n currentValue,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n } = useInputOTP({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n })\n\n // Extract aria-label from others if provided (for cases without FormField)\n const ariaLabel =\n 'aria-label' in others ? (others['aria-label'] as string | undefined) : undefined\n const { 'aria-label': _, ...restOthers } = others\n\n const getAccessibleNameProps = (): Record<string, string | undefined> => {\n if (labelId) {\n return { 'aria-labelledby': labelId }\n }\n\n if (ariaLabel) {\n return { 'aria-label': ariaLabel }\n }\n\n return {}\n }\n\n const accessibleNameProps = getAccessibleNameProps()\n\n return (\n <InputOTPContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n data-spark-component=\"input-otp\"\n role=\"group\"\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n className={cx(\n 'group gap-md relative inline-flex w-fit items-center default:cursor-text',\n {\n 'cursor-not-allowed': disabled,\n 'cursor-default': readOnly,\n },\n className\n )}\n onClick={handleClick}\n {...restOthers}\n >\n {/* Hidden input for form submission with complete value */}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={currentValue}\n required={isRequired}\n aria-required={isRequired}\n aria-invalid={isInvalid}\n {...accessibleNameProps}\n />\n )}\n {/* Actual input that handles all interactions */}\n <input\n ref={inputRef}\n id={uuid}\n type={type === 'password' ? 'password' : 'text'}\n value={currentValue}\n maxLength={maxLength}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n disabled={disabled}\n readOnly={readOnly}\n pattern={pattern}\n inputMode={inputMode as React.InputHTMLAttributes<HTMLInputElement>['inputMode']}\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onCopy={handleCopy}\n onPaste={handlePaste}\n onFocus={handleFocus}\n onBlur={handleBlur}\n className=\"bg-success z-raised absolute inset-0 m-0 p-0 opacity-0 read-only:cursor-default disabled:cursor-not-allowed\"\n tabIndex={0}\n />\n {/* Children render slots with auto-assigned indexes */}\n {processedChildren}\n </div>\n </InputOTPContext.Provider>\n )\n}\n\nInputOTP.displayName = 'InputOTP'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPGroupProps extends ComponentPropsWithoutRef<'div'> {}\n\n/**\n * Container for a group of OTP input slots. Renders a <div> element.\n */\nexport const InputOTPGroup = ({ children, className, ...props }: InputOTPGroupProps) => {\n return (\n <div className={`gap-md flex ${className}`} {...props}>\n {children}\n </div>\n )\n}\n\nInputOTPGroup.displayName = 'InputOTP.Group'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPSeparatorProps extends ComponentPropsWithoutRef<'div'> {}\n\n/**\n * A visual separator between OTP input groups. Renders a <div> element.\n */\nexport const InputOTPSeparator = ({ className, ...props }: InputOTPSeparatorProps) => {\n return (\n <div\n className={`text-on-surface/dim-3 flex items-center justify-center ${className || ''}`}\n {...props}\n >\n <div className=\"h-sz-4 w-sz-8 bg-outline rounded-full\" />\n </div>\n )\n}\n\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n","import { InputOTP as Root } from './InputOTP'\nimport { InputOTPGroup } from './InputOTPGroup'\nimport { InputOTPSeparator } from './InputOTPSeparator'\nimport { InputOTPSlot } from './InputOTPSlot'\n\n/**\n * An input component for entering one-time passwords or verification codes with individual character slots.\n */\nexport const InputOTP: typeof Root & {\n Group: typeof InputOTPGroup\n Slot: typeof InputOTPSlot\n Separator: typeof InputOTPSeparator\n} = Object.assign(Root, {\n Group: InputOTPGroup,\n Slot: InputOTPSlot,\n Separator: InputOTPSeparator,\n})\n\nInputOTP.displayName = 'InputOTP'\nInputOTPGroup.displayName = 'InputOTP.Group'\nInputOTPSlot.displayName = 'InputOTP.Slot'\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n\nexport { type InputOTPProps } from './InputOTP'\nexport { type InputOTPGroupProps } from './InputOTPGroup'\nexport { type InputOTPSlotProps } from './InputOTPSlot'\nexport { type InputOTPSeparatorProps } from './InputOTPSeparator'\nexport {\n inputOTPSlotStyles,\n inputOTPStyles,\n type InputOTPSlotStylesProps,\n type InputOTPStylesProps,\n} from './InputOTP.styles'\n"],"mappings":";;;;;AAkBA,IAAa,IAAkB,EAA2C,KAAK,EAElE,UAA2B;CACtC,IAAM,IAAU,EAAW,EAAgB;AAC3C,KAAI,CAAC,EACH,OAAU,MAAM,mDAAmD;AAGrE,QAAO;;ACxB8B,EAAI;CAAC;CAAY;CAA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ACR5B,IAAa,KAAqB,EAAE,cAAW,GAAG,QAE9C,kBAAC,OAAD;CACE,WAAW,0DAA0D,KAAa;CAClF,GAAI;WAEJ,kBAAC,OAAD,EAAK,WAAU,yCAA0C,CAAA;CACrD,CAAA;AAIV,EAAkB,cAAc;;;ACVhC,IAAa,IAIT,OAAO,OAAO,GAAM;CACtB,OAAO;CACP,MAAM;CACN,WAAW;CACZ,CAAC;AAEF,EAAS,cAAc,YACvB,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAkB,cAAc"}
|
package/dist/kbd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);let e=require(`react/jsx-runtime`);var t=({className:t,ref:n,...r})=>(0,e.jsx)(`kbd`,{"data-spark-component":`kbd`,ref:n,className:[`border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);let e=require(`react/jsx-runtime`);var t=({className:t,ref:n,...r})=>(0,e.jsx)(`kbd`,{"data-spark-component":`kbd`,ref:n,className:[`border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption-highlight rounded-sm font-mono leading-4 whitespace-nowrap`,t].join(` `),...r});exports.Kbd=t;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/kbd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\n/**\n * A component that displays keyboard keys or shortcuts in a styled format.\n */\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\n/**\n * A component that displays keyboard keys or shortcuts in a styled format.\n */\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption-highlight rounded-sm font-mono leading-4 whitespace-nowrap',\n className,\n ].join(' ')}\n {...props}\n />\n )\n}\n"],"mappings":"sIASA,IAAa,GAAO,CAAE,YAAW,MAAK,GAAG,MAErC,EAAA,EAAA,KAAC,MAAD,CACE,uBAAqB,MAChB,MACL,UAAW,CACT,gJACA,EACD,CAAC,KAAK,IAAI,CACX,GAAI,EACJ,CAAA"}
|
package/dist/kbd/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
3
3
|
var t = ({ className: t, ref: n, ...r }) => /* @__PURE__ */ e("kbd", {
|
|
4
4
|
"data-spark-component": "kbd",
|
|
5
5
|
ref: n,
|
|
6
|
-
className: ["border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4
|
|
6
|
+
className: ["border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption-highlight rounded-sm font-mono leading-4 whitespace-nowrap", t].join(" "),
|
|
7
7
|
...r
|
|
8
8
|
});
|
|
9
9
|
//#endregion
|
package/dist/kbd/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\n/**\n * A component that displays keyboard keys or shortcuts in a styled format.\n */\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\n/**\n * A component that displays keyboard keys or shortcuts in a styled format.\n */\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption-highlight rounded-sm font-mono leading-4 whitespace-nowrap',\n className,\n ].join(' ')}\n {...props}\n />\n )\n}\n"],"mappings":";;AASA,IAAa,KAAO,EAAE,cAAW,QAAK,GAAG,QAErC,kBAAC,OAAD;CACE,wBAAqB;CAChB;CACL,WAAW,CACT,iJACA,EACD,CAAC,KAAK,IAAI;CACX,GAAI;CACJ,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
2
|
export type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>;
|
|
3
|
+
/**
|
|
4
|
+
* An indicator showing that a field is required. Renders a <span> element.
|
|
5
|
+
*/
|
|
3
6
|
export declare const LabelRequiredIndicator: {
|
|
4
7
|
({ className, children, ref, ...others }: LabelRequiredIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
5
8
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-BCSEss4U.js","names":[],"sources":["../src/label/Label.tsx","../src/label/LabelRequiredIndicator.tsx","../src/label/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\n/**\n * A text label component that describes a form control and provides accessible name for inputs.\n */\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n"],"mappings":"8HAQA,IAAa,GAAS,CAAE,YAAW,MAAK,GAAG,MAEvC,EAAA,EAAA,KAAC,EAAA,MAAW,MAAZ,CACO,MACL,uBAAqB,QACrB,WAAA,EAAA,EAAA,IAAc,cAAe,EAAU,CACvC,GAAI,EACJ,CAAA,CAIN,EAAM,YAAc,
|
|
1
|
+
{"version":3,"file":"label-BCSEss4U.js","names":[],"sources":["../src/label/Label.tsx","../src/label/LabelRequiredIndicator.tsx","../src/label/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\n/**\n * An indicator showing that a field is required. Renders a <span> element.\n */\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\n/**\n * A text label component that describes a form control and provides accessible name for inputs.\n */\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n"],"mappings":"8HAQA,IAAa,GAAS,CAAE,YAAW,MAAK,GAAG,MAEvC,EAAA,EAAA,KAAC,EAAA,MAAW,MAAZ,CACO,MACL,uBAAqB,QACrB,WAAA,EAAA,EAAA,IAAc,cAAe,EAAU,CACvC,GAAI,EACJ,CAAA,CAIN,EAAM,YAAc,QCXpB,IAAa,GAA0B,CACrC,YACA,WAAW,IACX,MACA,GAAG,MAGD,EAAA,EAAA,KAAC,OAAD,CACO,MACL,uBAAqB,2BACrB,KAAK,eACL,cAAY,OACZ,WAAA,EAAA,EAAA,IAAc,EAAW,qCAAqC,CAC9D,GAAI,EAEH,WACI,CAAA,CAIX,EAAuB,YAAc,0BCtBrC,IAAa,EAET,OAAO,OAAO,EAAM,CACtB,kBAAmB,EACpB,CAAC,CAEF,EAAM,YAAc,QACpB,EAAuB,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-DDBRKLUX.mjs","names":[],"sources":["../src/label/Label.tsx","../src/label/LabelRequiredIndicator.tsx","../src/label/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\n/**\n * A text label component that describes a form control and provides accessible name for inputs.\n */\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n"],"mappings":";;;;AAQA,IAAa,KAAS,EAAE,cAAW,QAAK,GAAG,QAEvC,kBAAC,EAAW,OAAZ;CACO;CACL,wBAAqB;CACrB,WAAW,EAAG,eAAe,EAAU;CACvC,GAAI;CACJ,CAAA;AAIN,EAAM,cAAc;;;
|
|
1
|
+
{"version":3,"file":"label-DDBRKLUX.mjs","names":[],"sources":["../src/label/Label.tsx","../src/label/LabelRequiredIndicator.tsx","../src/label/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\n/**\n * An indicator showing that a field is required. Renders a <span> element.\n */\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\n/**\n * A text label component that describes a form control and provides accessible name for inputs.\n */\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n"],"mappings":";;;;AAQA,IAAa,KAAS,EAAE,cAAW,QAAK,GAAG,QAEvC,kBAAC,EAAW,OAAZ;CACO;CACL,wBAAqB;CACrB,WAAW,EAAG,eAAe,EAAU;CACvC,GAAI;CACJ,CAAA;AAIN,EAAM,cAAc;;;ACXpB,IAAa,KAA0B,EACrC,cACA,cAAW,KACX,QACA,GAAG,QAGD,kBAAC,QAAD;CACO;CACL,wBAAqB;CACrB,MAAK;CACL,eAAY;CACZ,WAAW,EAAG,GAAW,qCAAqC;CAC9D,GAAI;CAEH;CACI,CAAA;AAIX,EAAuB,cAAc;;;ACtBrC,IAAa,IAET,OAAO,OAAO,GAAM,EACtB,mBAAmB,GACpB,CAAC;AAEF,EAAM,cAAc,SACpB,EAAuB,cAAc"}
|
|
@@ -2,6 +2,9 @@ import { ComponentPropsWithRef } from 'react';
|
|
|
2
2
|
export interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {
|
|
3
3
|
asChild?: boolean;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* The main navigable link within the link box. Renders an <a> element.
|
|
7
|
+
*/
|
|
5
8
|
export declare const LinkBoxLink: {
|
|
6
9
|
({ className, asChild, ref, ...props }: LinkBoxLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
displayName: string;
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
7
|
+
*/
|
|
2
8
|
export interface LinkBoxRaisedProps {
|
|
9
|
+
/**
|
|
10
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
11
|
+
*/
|
|
3
12
|
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
15
|
+
*/
|
|
4
16
|
children: ReactNode;
|
|
5
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
23
|
+
*/
|
|
6
24
|
export declare const LinkBoxRaised: {
|
|
7
25
|
({ className, ...props }: LinkBoxRaisedProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* A raised link that appears above other content. Renders an <a> element.
|
|
31
|
+
*/
|
|
8
32
|
displayName: string;
|
|
9
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\n/**\n * The main navigable link within the link box. Renders an <a> element.\n */\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nimport { cx } from 'class-variance-authority'\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\nimport { ReactNode } from 'react'\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nimport { Slot } from '../slot'\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nexport interface LinkBoxRaisedProps {\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n className?: string\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n children: ReactNode\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n}\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nexport const LinkBoxRaised = ({ className, ...props }: LinkBoxRaisedProps) => {\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n return <Slot className={cx('default:z-raised default:relative', className)} {...props} />\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n}\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nLinkBoxRaised.displayName = 'LinkBox.Raised'\n","import { LinkBox as Root } from './LinkBox'\nimport { LinkBoxLink } from './LinkBoxLink'\nimport { LinkBoxRaised } from './LinkBoxRaised'\n\n/**\n * A container component that makes an entire area clickable while keeping nested links semantically correct.\n */\nexport const LinkBox: typeof Root & {\n Link: typeof LinkBoxLink\n Raised: typeof LinkBoxRaised\n} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })\n\nLinkBox.displayName = 'LinkBox'\nLinkBox.Link.displayName = 'LinkBox.Link'\nLinkBox.Raised.displayName = 'LinkBox.Raised'\n\nexport { type LinkBoxProps } from './LinkBox'\nexport { type LinkBoxLinkProps } from './LinkBoxLink'\n"],"mappings":"gNASA,IAAa,GAAW,CAAE,YAAW,UAAS,MAAK,GAAG,MAIlD,EAAA,EAAA,KAHgB,EAAU,EAAA,KAAO,MAGjC,CACO,MACL,uBAAqB,WACrB,WAAA,EAAA,EAAA,IAAc,mBAAoB,EAAU,CAC5C,GAAI,EACJ,CAAA,CAIN,EAAQ,YAAc,UCTtB,IAAa,GAAe,CAAE,YAAW,UAAS,MAAK,GAAG,MAItD,EAAA,EAAA,KAHgB,EAAU,EAAA,KAAO,IAGjC,CACO,MACL,uBAAqB,gBACrB,WAAA,EAAA,EAAA,IACE,oHACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,EAAY,YAAc,eCmB1B,IAAa,GAAiB,CAAE,YAAW,GAAG,MAKrC,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,WAAA,EAAA,EAAA,IAAc,oCAAqC,EAAU,CAAE,GAAI,EAAS,CAAA,CAa3F,EAAc,YAAc,iBC3D5B,IAAa,EAGT,OAAO,OAAO,EAAM,CAAE,KAAM,EAAa,OAAQ,EAAe,CAAC,CAErE,EAAQ,YAAc,UACtB,EAAQ,KAAK,YAAc,eAC3B,EAAQ,OAAO,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\n/**\n * The main navigable link within the link box. Renders an <a> element.\n */\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nimport { cx } from 'class-variance-authority'\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\nimport { ReactNode } from 'react'\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nimport { Slot } from '../slot'\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nexport interface LinkBoxRaisedProps {\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n className?: string\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n children: ReactNode\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n}\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nexport const LinkBoxRaised = ({ className, ...props }: LinkBoxRaisedProps) => {\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n return <Slot className={cx('default:z-raised default:relative', className)} {...props} />\n /**\n * A raised link that appears above other content. Renders an <a> element.\n */\n}\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\n/**\n * A raised link that appears above other content. Renders an <a> element.\n */\n\nLinkBoxRaised.displayName = 'LinkBox.Raised'\n","import { LinkBox as Root } from './LinkBox'\nimport { LinkBoxLink } from './LinkBoxLink'\nimport { LinkBoxRaised } from './LinkBoxRaised'\n\n/**\n * A container component that makes an entire area clickable while keeping nested links semantically correct.\n */\nexport const LinkBox: typeof Root & {\n Link: typeof LinkBoxLink\n Raised: typeof LinkBoxRaised\n} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })\n\nLinkBox.displayName = 'LinkBox'\nLinkBox.Link.displayName = 'LinkBox.Link'\nLinkBox.Raised.displayName = 'LinkBox.Raised'\n\nexport { type LinkBoxProps } from './LinkBox'\nexport { type LinkBoxLinkProps } from './LinkBoxLink'\n"],"mappings":";;;;AASA,IAAa,KAAW,EAAE,cAAW,YAAS,QAAK,GAAG,QAIlD,kBAHgB,IAAU,IAAO,OAGjC;CACO;CACL,wBAAqB;CACrB,WAAW,EAAG,oBAAoB,EAAU;CAC5C,GAAI;CACJ,CAAA;AAIN,EAAQ,cAAc;;;ACTtB,IAAa,KAAe,EAAE,cAAW,YAAS,QAAK,GAAG,QAItD,kBAHgB,IAAU,IAAO,KAGjC;CACO;CACL,wBAAqB;CACrB,WAAW,EACT,qHACA,EACD;CACD,GAAI;CACJ,CAAA;AAIN,EAAY,cAAc;;;ACmB1B,IAAa,KAAiB,EAAE,cAAW,GAAG,QAKrC,kBAAC,GAAD;CAAM,WAAW,EAAG,qCAAqC,EAAU;CAAE,GAAI;CAAS,CAAA;AAa3F,EAAc,cAAc;;;AC3D5B,IAAa,IAGT,OAAO,OAAO,GAAM;CAAE,MAAM;CAAa,QAAQ;CAAe,CAAC;AAErE,EAAQ,cAAc,WACtB,EAAQ,KAAK,cAAc,gBAC3B,EAAQ,OAAO,cAAc"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
export interface MenuProps extends Omit<ComponentProps<typeof BaseMenu.Root>, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the menu (trigger, portal, etc.)
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Root container for menu state and styling context.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Menu: {
|
|
13
|
+
({ children, ...rest }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuCheckboxItemProps extends Omit<ComponentProps<typeof BaseMenu.CheckboxItem>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A menu item with checkbox functionality.
|
|
14
|
+
* Can be toggled on and off, allowing multiple selections.
|
|
15
|
+
* The checkbox indicator is automatically rendered on the left side.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MenuCheckboxItem: {
|
|
18
|
+
({ asChild, children, className, ref, ...rest }: MenuCheckboxItemProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuCheckboxItemIndicatorProps extends Omit<ComponentProps<typeof BaseMenu.CheckboxItemIndicator>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* If true, renders a custom keepMounted container instead of default check icon.
|
|
12
|
+
* When false (default), renders a check icon that appears when checked.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
keepMounted?: boolean;
|
|
16
|
+
ref?: Ref<HTMLSpanElement>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Displays a checkmark icon when the checkbox item is checked.
|
|
20
|
+
* Automatically shows/hides based on the checked state.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MenuCheckboxItemIndicator: {
|
|
23
|
+
({ asChild, keepMounted, className, ref, children, ...rest }: MenuCheckboxItemIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface MenuGroupProps extends ComponentProps<typeof BaseMenu.Group> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A container for grouping related menu items together.
|
|
7
|
+
* Works with Menu.GroupLabel for semantic grouping.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MenuGroup: {
|
|
10
|
+
({ children, className, ...rest }: MenuGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuGroupLabelProps extends Omit<ComponentProps<typeof BaseMenu.GroupLabel>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A label for a group of menu items.
|
|
14
|
+
* Provides semantic context and visual separation for grouped items.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MenuGroupLabel: {
|
|
17
|
+
({ asChild, children, className, ref, ...rest }: MenuGroupLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuItemProps extends Omit<ComponentProps<typeof BaseMenu.Item>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A menu item that triggers an action when activated.
|
|
14
|
+
* Renders a clickable menu option with keyboard support.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MenuItem: {
|
|
17
|
+
({ asChild, children, className, ref, ...rest }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const menuItemStyles: (props?: ({
|
|
3
|
+
intent?: "main" | "alert" | "support" | "accent" | "success" | "info" | "neutral" | "danger" | "surface" | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
+
export type MenuItemStylesProps = VariantProps<typeof menuItemStyles>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { MenuItem } from './MenuItem';
|
|
3
|
+
export interface MenuLinkItemProps extends Omit<ComponentPropsWithoutRef<typeof MenuItem>, 'asChild'> {
|
|
4
|
+
/**
|
|
5
|
+
* The URL to navigate to.
|
|
6
|
+
*/
|
|
7
|
+
href: string;
|
|
8
|
+
/**
|
|
9
|
+
* Where to display the linked URL.
|
|
10
|
+
* @default undefined
|
|
11
|
+
*/
|
|
12
|
+
target?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The relationship between the current document and the linked document.
|
|
15
|
+
* @default undefined
|
|
16
|
+
*/
|
|
17
|
+
rel?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A menu item that acts as a link.
|
|
21
|
+
* Navigates to a URL when activated, useful for navigation menus.
|
|
22
|
+
* Use with Next.js Link or React Router Link via the children prop.
|
|
23
|
+
*/
|
|
24
|
+
export declare const MenuLinkItem: {
|
|
25
|
+
({ children, href, target, rel, ...rest }: MenuLinkItemProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuPopupProps extends Omit<ComponentProps<typeof BaseMenu.Popup>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The scrollable menu container that holds menu items.
|
|
14
|
+
* Serves as the viewport for menu content with overflow handling.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MenuPopup: {
|
|
17
|
+
({ asChild, children, className, ref, ...rest }: MenuPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface MenuPortalProps extends ComponentProps<typeof BaseMenu.Portal> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Portal wrapper that renders the menu in a different part of the DOM tree.
|
|
7
|
+
* Useful for avoiding z-index and overflow issues.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MenuPortal: {
|
|
10
|
+
({ children, ...rest }: MenuPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface MenuPositionerProps extends ComponentProps<typeof BaseMenu.Positioner> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Positioning wrapper for the menu with collision detection.
|
|
7
|
+
* Handles menu placement relative to the trigger and viewport boundaries.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MenuPositioner: {
|
|
10
|
+
({ children, sideOffset, ...rest }: MenuPositionerProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface MenuRadioGroupProps extends ComponentProps<typeof BaseMenu.RadioGroup> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A container for radio menu items where only one item can be selected at a time.
|
|
7
|
+
* Manages the selection state for its radio items.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MenuRadioGroup: {
|
|
10
|
+
({ children, className, ...rest }: MenuRadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuRadioItemProps extends Omit<ComponentProps<typeof BaseMenu.RadioItem>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A menu item with radio button functionality.
|
|
14
|
+
* Only one radio item can be selected within its RadioGroup.
|
|
15
|
+
* The radio indicator is automatically rendered on the left side.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MenuRadioItem: {
|
|
18
|
+
({ asChild, children, className, ref, ...rest }: MenuRadioItemProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface MenuRadioItemIndicatorProps extends Omit<ComponentProps<typeof BaseMenu.RadioItemIndicator>, 'render'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* If true, renders a custom keepMounted container instead of default radio dot.
|
|
12
|
+
* When false (default), renders a radio dot that appears when selected.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
keepMounted?: boolean;
|
|
16
|
+
ref?: Ref<HTMLSpanElement>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Displays a radio dot when the radio item is selected.
|
|
20
|
+
* Automatically shows/hides based on the selected state.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MenuRadioItemIndicator: {
|
|
23
|
+
({ asChild, keepMounted, className, ref, children, ...rest }: MenuRadioItemIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|