@spark-ui/components 17.2.2 → 17.2.3-beta.1
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/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs.map +1 -1
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/src/accordion/Accordion.d.ts +27 -0
- package/dist/src/accordion/AccordionItem.d.ts +12 -0
- package/dist/src/accordion/AccordionItemContent.d.ts +12 -0
- package/dist/src/accordion/AccordionItemHeader.d.ts +9 -0
- package/dist/src/accordion/AccordionItemTrigger.d.ts +12 -0
- package/dist/src/accordion/index.d.mts +15 -0
- package/dist/src/accordion/index.d.ts +15 -0
- package/dist/src/accordion/useRenderSlot.d.ts +3 -0
- package/dist/src/alert-dialog/AlertDialog.d.ts +29 -0
- package/dist/src/alert-dialog/AlertDialogAction.d.ts +13 -0
- package/dist/src/alert-dialog/AlertDialogBody.d.ts +12 -0
- package/dist/src/alert-dialog/AlertDialogCancel.d.ts +13 -0
- package/dist/src/alert-dialog/AlertDialogContent.d.ts +9 -0
- package/dist/src/alert-dialog/AlertDialogContext.d.ts +12 -0
- package/dist/src/alert-dialog/AlertDialogDescription.d.ts +9 -0
- package/dist/src/alert-dialog/AlertDialogFooter.d.ts +10 -0
- package/dist/src/alert-dialog/AlertDialogHeader.d.ts +10 -0
- package/dist/src/alert-dialog/AlertDialogOverlay.d.ts +9 -0
- package/dist/src/alert-dialog/AlertDialogPortal.d.ts +7 -0
- package/dist/src/alert-dialog/AlertDialogTitle.d.ts +9 -0
- package/dist/src/alert-dialog/AlertDialogTrigger.d.ts +13 -0
- package/dist/src/alert-dialog/index.d.mts +38 -0
- package/dist/src/alert-dialog/index.d.ts +38 -0
- package/dist/src/alert-dialog/useRenderSlot.d.ts +3 -0
- package/dist/src/avatar/Avatar.d.ts +3 -0
- package/dist/src/avatar/AvatarAction.d.ts +9 -0
- package/dist/src/avatar/AvatarImage.d.ts +7 -0
- package/dist/src/avatar/AvatarOnlineBadge.d.ts +9 -0
- package/dist/src/avatar/AvatarPlaceholder.d.ts +8 -0
- package/dist/src/avatar/AvatarUser.d.ts +7 -0
- package/dist/src/avatar/context.d.ts +5 -0
- package/dist/src/avatar/index.d.mts +15 -0
- package/dist/src/avatar/index.d.ts +15 -0
- package/dist/src/avatar/types.d.ts +24 -0
- package/dist/src/badge/Badge.d.ts +9 -0
- package/dist/src/badge/BadgeItem.d.ts +31 -0
- package/dist/src/badge/BadgeItem.styles.d.ts +7 -0
- package/dist/src/badge/index.d.mts +1 -0
- package/dist/src/badge/index.d.ts +1 -0
- package/dist/src/breadcrumb/Breadcrumb.d.ts +10 -0
- package/dist/src/breadcrumb/Breadcrumb.styles.d.ts +0 -0
- package/dist/src/breadcrumb/BreadcrumbCurrentPage.d.ts +11 -0
- package/dist/src/breadcrumb/BreadcrumbItem.d.ts +9 -0
- package/dist/src/breadcrumb/BreadcrumbLink.d.ts +12 -0
- package/dist/src/breadcrumb/BreadcrumbSeparator.d.ts +10 -0
- package/dist/src/breadcrumb/index.d.mts +12 -0
- package/dist/src/breadcrumb/index.d.ts +12 -0
- package/dist/src/button/Button.d.ts +26 -0
- package/dist/src/button/Button.styles.d.ts +10 -0
- package/dist/src/button/index.d.mts +1 -0
- package/dist/src/button/index.d.ts +1 -0
- package/dist/src/button/variants/contrast.d.ts +41 -0
- package/dist/src/button/variants/filled.d.ts +41 -0
- package/dist/src/button/variants/ghost.d.ts +41 -0
- package/dist/src/button/variants/index.d.mts +5 -0
- package/dist/src/button/variants/index.d.ts +5 -0
- package/dist/src/button/variants/outlined.d.ts +41 -0
- package/dist/src/button/variants/tinted.d.ts +41 -0
- package/dist/src/card/Backdrop.d.ts +14 -0
- package/dist/src/card/Card.d.ts +16 -0
- package/dist/src/card/Card.styles.d.ts +7 -0
- package/dist/src/card/Content.d.ts +15 -0
- package/dist/src/card/Content.styles.d.ts +8 -0
- package/dist/src/card/context.d.ts +11 -0
- package/dist/src/card/index.d.mts +8 -0
- package/dist/src/card/index.d.ts +8 -0
- package/dist/src/card/utils.d.ts +3 -0
- package/dist/src/carousel/Carousel.d.ts +12 -0
- package/dist/src/carousel/CarouselControls.d.ts +9 -0
- package/dist/src/carousel/CarouselNextButton.d.ts +5 -0
- package/dist/src/carousel/CarouselPageIndicator.d.ts +14 -0
- package/dist/src/carousel/CarouselPagePicker.d.ts +14 -0
- package/dist/src/carousel/CarouselPrevButton.d.ts +5 -0
- package/dist/src/carousel/CarouselSlide.d.ts +12 -0
- package/dist/src/carousel/CarouselSlides.d.ts +10 -0
- package/dist/src/carousel/CarouselViewport.d.ts +9 -0
- package/dist/src/carousel/index.d.mts +19 -0
- package/dist/src/carousel/index.d.ts +19 -0
- package/dist/src/carousel/types.d.ts +165 -0
- package/dist/src/carousel/useCarousel.d.ts +2 -0
- package/dist/src/carousel/useCarouselVisibility.d.ts +13 -0
- package/dist/src/carousel/useEvent.d.ts +7 -0
- package/dist/src/carousel/useIsMounted.d.ts +1 -0
- package/dist/src/carousel/useIsVisible.d.ts +6 -0
- package/dist/src/carousel/useResizeObserver.d.ts +2 -0
- package/dist/src/carousel/useScrollEnd.d.ts +3 -0
- package/dist/src/carousel/useSnapPoints.d.ts +10 -0
- package/dist/src/carousel/utils.d.ts +24 -0
- package/dist/src/checkbox/Checkbox.d.ts +10 -0
- package/dist/src/checkbox/CheckboxGroup.d.ts +18 -0
- package/dist/src/checkbox/CheckboxGroup.styles.d.ts +5 -0
- package/dist/src/checkbox/CheckboxGroupContext.d.ts +41 -0
- package/dist/src/checkbox/CheckboxIndicator.d.ts +9 -0
- package/dist/src/checkbox/CheckboxInput.d.ts +47 -0
- package/dist/src/checkbox/CheckboxInput.styles.d.ts +5 -0
- package/dist/src/checkbox/CheckboxLabel.d.ts +12 -0
- package/dist/src/checkbox/CheckboxLabel.styles.d.ts +5 -0
- package/dist/src/checkbox/index.d.mts +2 -0
- package/dist/src/checkbox/index.d.ts +2 -0
- package/dist/src/chip/Chip.d.ts +34 -0
- package/dist/src/chip/Chip.styles.d.ts +8 -0
- package/dist/src/chip/ChipClearButton.d.ts +10 -0
- package/dist/src/chip/ChipClearButton.styles.d.ts +10 -0
- package/dist/src/chip/ChipContent.d.ts +8 -0
- package/dist/src/chip/ChipIcon.d.ts +8 -0
- package/dist/src/chip/ChipLeadingIcon.d.ts +9 -0
- package/dist/src/chip/ChipTrailingIcon.d.ts +9 -0
- package/dist/src/chip/index.d.mts +15 -0
- package/dist/src/chip/index.d.ts +15 -0
- package/dist/src/chip/useChipContext.d.ts +4 -0
- package/dist/src/chip/useChipElement.d.ts +41 -0
- package/dist/src/chip/variants/dashed.d.ts +45 -0
- package/dist/src/chip/variants/index.d.mts +3 -0
- package/dist/src/chip/variants/index.d.ts +3 -0
- package/dist/src/chip/variants/outlined.d.ts +45 -0
- package/dist/src/chip/variants/tinted.d.ts +45 -0
- package/dist/src/circular-meter/CircularMeter.d.ts +34 -0
- package/dist/src/circular-meter/CircularMeter.styles.d.ts +5 -0
- package/dist/src/circular-meter/CircularMeterContent.d.ts +6 -0
- package/dist/src/circular-meter/CircularMeterContext.d.ts +36 -0
- package/dist/src/circular-meter/CircularMeterLabel.d.ts +7 -0
- package/dist/src/circular-meter/CircularMeterTrack.d.ts +8 -0
- package/dist/src/circular-meter/CircularMeterValue.d.ts +7 -0
- package/dist/src/circular-meter/index.d.mts +16 -0
- package/dist/src/circular-meter/index.d.ts +16 -0
- package/dist/src/circular-meter/useIntersectionAnimation.d.ts +26 -0
- package/dist/src/collapsible/Content.d.ts +12 -0
- package/dist/src/collapsible/Root.d.ts +12 -0
- package/dist/src/collapsible/Trigger.d.ts +11 -0
- package/dist/src/collapsible/index.d.mts +7 -0
- package/dist/src/collapsible/index.d.ts +7 -0
- package/dist/src/collapsible/useRenderSlot.d.ts +3 -0
- package/dist/src/combobox/Combobox.d.ts +6 -0
- package/dist/src/combobox/ComboboxClearButton.d.ts +9 -0
- package/dist/src/combobox/ComboboxContext.d.ts +108 -0
- package/dist/src/combobox/ComboboxDisclosure.d.ts +13 -0
- package/dist/src/combobox/ComboboxEmpty.d.ts +11 -0
- package/dist/src/combobox/ComboboxGroup.d.ts +11 -0
- package/dist/src/combobox/ComboboxInput.d.ts +15 -0
- package/dist/src/combobox/ComboboxItem.d.ts +12 -0
- package/dist/src/combobox/ComboboxItemContext.d.ts +17 -0
- package/dist/src/combobox/ComboboxItemIndicator.d.ts +11 -0
- package/dist/src/combobox/ComboboxItemText.d.ts +10 -0
- package/dist/src/combobox/ComboboxItems.d.ts +11 -0
- package/dist/src/combobox/ComboboxItemsGroupContext.d.ts +8 -0
- package/dist/src/combobox/ComboboxLabel.d.ts +11 -0
- package/dist/src/combobox/ComboboxLeadingIcon.d.ts +7 -0
- package/dist/src/combobox/ComboboxPopover.d.ts +10 -0
- package/dist/src/combobox/ComboboxPortal.d.ts +2 -0
- package/dist/src/combobox/ComboboxSelectedItems.d.ts +4 -0
- package/dist/src/combobox/ComboboxTrigger.d.ts +11 -0
- package/dist/src/combobox/ComboboxTrigger.styles.d.ts +6 -0
- package/dist/src/combobox/index.d.mts +35 -0
- package/dist/src/combobox/index.d.ts +35 -0
- package/dist/src/combobox/tests/test-utils.d.ts +8 -0
- package/dist/src/combobox/types.d.ts +8 -0
- package/dist/src/combobox/useCombobox/multipleSelectionReducer.d.ts +13 -0
- package/dist/src/combobox/useCombobox/singleSelectionReducer.d.ts +8 -0
- package/dist/src/combobox/utils/index.d.mts +14 -0
- package/dist/src/combobox/utils/index.d.ts +14 -0
- package/dist/src/combobox/utils/useWidthIncreaseCallback.d.ts +2 -0
- package/dist/src/dialog/Dialog.d.ts +33 -0
- package/dist/src/dialog/DialogBody.d.ts +12 -0
- package/dist/src/dialog/DialogClose.d.ts +10 -0
- package/dist/src/dialog/DialogCloseButton.d.ts +9 -0
- package/dist/src/dialog/DialogContent.d.ts +14 -0
- package/dist/src/dialog/DialogContent.styles.d.ts +6 -0
- package/dist/src/dialog/DialogContext.d.ts +11 -0
- package/dist/src/dialog/DialogDescription.d.ts +9 -0
- package/dist/src/dialog/DialogFooter.d.ts +10 -0
- package/dist/src/dialog/DialogHeader.d.ts +10 -0
- package/dist/src/dialog/DialogOverlay.d.ts +9 -0
- package/dist/src/dialog/DialogPortal.d.ts +7 -0
- package/dist/src/dialog/DialogTitle.d.ts +9 -0
- package/dist/src/dialog/DialogTrigger.d.ts +13 -0
- package/dist/src/dialog/index.d.mts +37 -0
- package/dist/src/dialog/index.d.ts +37 -0
- package/dist/src/divider/Divider.d.ts +30 -0
- package/dist/src/divider/Divider.styles.d.ts +9 -0
- package/dist/src/divider/DividerContent.d.ts +13 -0
- package/dist/src/divider/index.d.mts +6 -0
- package/dist/src/divider/index.d.ts +6 -0
- package/dist/src/divider/variants/intents.d.ts +17 -0
- package/dist/src/drawer/Drawer.d.ts +32 -0
- package/dist/src/drawer/DrawerBody.d.ts +11 -0
- package/dist/src/drawer/DrawerBody.styles.d.ts +5 -0
- package/dist/src/drawer/DrawerClose.d.ts +13 -0
- package/dist/src/drawer/DrawerCloseButton.d.ts +7 -0
- package/dist/src/drawer/DrawerContent.d.ts +10 -0
- package/dist/src/drawer/DrawerContent.styles.d.ts +6 -0
- package/dist/src/drawer/DrawerContext.d.ts +9 -0
- package/dist/src/drawer/DrawerDescription.d.ts +9 -0
- package/dist/src/drawer/DrawerFooter.d.ts +8 -0
- package/dist/src/drawer/DrawerHeader.d.ts +10 -0
- package/dist/src/drawer/DrawerOverlay.d.ts +9 -0
- package/dist/src/drawer/DrawerPortal.d.ts +7 -0
- package/dist/src/drawer/DrawerTitle.d.ts +9 -0
- package/dist/src/drawer/DrawerTrigger.d.ts +13 -0
- package/dist/src/drawer/index.d.mts +37 -0
- package/dist/src/drawer/index.d.ts +37 -0
- package/dist/src/drawer/useRenderSlot.d.ts +3 -0
- package/dist/src/dropdown/Dropdown.d.ts +6 -0
- package/dist/src/dropdown/DropdownContext.d.ts +81 -0
- package/dist/src/dropdown/DropdownDivider.d.ts +10 -0
- package/dist/src/dropdown/DropdownGroup.d.ts +11 -0
- package/dist/src/dropdown/DropdownItem.d.ts +12 -0
- package/dist/src/dropdown/DropdownItemContext.d.ts +17 -0
- package/dist/src/dropdown/DropdownItemIndicator.d.ts +11 -0
- package/dist/src/dropdown/DropdownItemText.d.ts +9 -0
- package/dist/src/dropdown/DropdownItems.d.ts +21 -0
- package/dist/src/dropdown/DropdownItemsGroupContext.d.ts +8 -0
- package/dist/src/dropdown/DropdownLabel.d.ts +11 -0
- package/dist/src/dropdown/DropdownLeadingIcon.d.ts +7 -0
- package/dist/src/dropdown/DropdownPopover.d.ts +6 -0
- package/dist/src/dropdown/DropdownPortal.d.ts +2 -0
- package/dist/src/dropdown/DropdownTrigger.d.ts +12 -0
- package/dist/src/dropdown/DropdownTrigger.styles.d.ts +5 -0
- package/dist/src/dropdown/DropdownValue.d.ts +11 -0
- package/dist/src/dropdown/index.d.mts +29 -0
- package/dist/src/dropdown/index.d.ts +29 -0
- package/dist/src/dropdown/types.d.ts +8 -0
- package/dist/src/dropdown/useDropdown.d.ts +41 -0
- package/dist/src/dropdown/utils.d.ts +13 -0
- package/dist/src/file-upload/FileUpload.d.ts +130 -0
- package/dist/src/file-upload/FileUploadAcceptedFile.d.ts +25 -0
- package/dist/src/file-upload/FileUploadContext.d.ts +17 -0
- package/dist/src/file-upload/FileUploadDropzone.d.ts +10 -0
- package/dist/src/file-upload/FileUploadItemDeleteTrigger.d.ts +11 -0
- package/dist/src/file-upload/FileUploadPreviewImage.d.ts +17 -0
- package/dist/src/file-upload/FileUploadRejectedFile.d.ts +24 -0
- package/dist/src/file-upload/FileUploadRejectedFileDeleteTrigger.d.ts +12 -0
- package/dist/src/file-upload/FileUploadTrigger.d.ts +12 -0
- package/dist/src/file-upload/constants.d.ts +29 -0
- package/dist/src/file-upload/index.d.mts +22 -0
- package/dist/src/file-upload/index.d.ts +22 -0
- package/dist/src/file-upload/test-utils.d.ts +9 -0
- package/dist/src/file-upload/useFileUploadState.d.ts +88 -0
- package/dist/src/file-upload/utils.d.ts +40 -0
- package/dist/src/form-field/FormField.d.ts +21 -0
- package/dist/src/form-field/FormFieldAlertMessage.d.ts +9 -0
- package/dist/src/form-field/FormFieldCharactersCount.d.ts +26 -0
- package/dist/src/form-field/FormFieldContext.d.ts +49 -0
- package/dist/src/form-field/FormFieldControl.d.ts +12 -0
- package/dist/src/form-field/FormFieldErrorMessage.d.ts +9 -0
- package/dist/src/form-field/FormFieldHelperMessage.d.ts +9 -0
- package/dist/src/form-field/FormFieldLabel.d.ts +13 -0
- package/dist/src/form-field/FormFieldMessage.d.ts +8 -0
- package/dist/src/form-field/FormFieldProvider.d.ts +9 -0
- package/dist/src/form-field/FormFieldRequiredIndicator.d.ts +9 -0
- package/dist/src/form-field/FormFieldStateMessage.d.ts +10 -0
- package/dist/src/form-field/FormFieldSuccessMessage.d.ts +9 -0
- package/dist/src/form-field/index.d.mts +31 -0
- package/dist/src/form-field/index.d.ts +31 -0
- package/dist/src/icon/Icon.d.ts +17 -0
- package/dist/src/icon/Icon.styles.d.ts +6 -0
- package/dist/src/icon/index.d.mts +1 -0
- package/dist/src/icon/index.d.ts +1 -0
- package/dist/src/icon-button/IconButton.d.ts +10 -0
- package/dist/src/icon-button/IconButton.styles.d.ts +5 -0
- package/dist/src/icon-button/index.d.mts +1 -0
- package/dist/src/icon-button/index.d.ts +1 -0
- package/dist/src/input/Input.d.ts +14 -0
- package/dist/src/input/Input.styles.d.ts +11 -0
- package/dist/src/input/InputAddon.d.ts +9 -0
- package/dist/src/input/InputAddon.styles.d.ts +9 -0
- package/dist/src/input/InputClearButton.d.ts +12 -0
- package/dist/src/input/InputGroup.d.ts +17 -0
- package/dist/src/input/InputGroup.styles.d.ts +6 -0
- package/dist/src/input/InputGroupContext.d.ts +14 -0
- package/dist/src/input/InputIcon.d.ts +6 -0
- package/dist/src/input/InputLeadingAddon.d.ts +11 -0
- package/dist/src/input/InputLeadingIcon.d.ts +7 -0
- package/dist/src/input/InputTrailingAddon.d.ts +11 -0
- package/dist/src/input/InputTrailingIcon.d.ts +7 -0
- package/dist/src/input/index.d.mts +21 -0
- package/dist/src/input/index.d.ts +21 -0
- package/dist/src/input-otp/InputOTP.d.ts +90 -0
- package/dist/src/input-otp/InputOTP.styles.d.ts +10 -0
- package/dist/src/input-otp/InputOTPContext.d.ts +17 -0
- package/dist/src/input-otp/InputOTPGroup.d.ts +7 -0
- package/dist/src/input-otp/InputOTPSeparator.d.ts +7 -0
- package/dist/src/input-otp/InputOTPSlot.d.ts +12 -0
- package/dist/src/input-otp/index.d.mts +14 -0
- package/dist/src/input-otp/index.d.ts +14 -0
- package/dist/src/input-otp/useInputOTP.d.ts +48 -0
- package/dist/src/kbd/Kbd.d.ts +5 -0
- package/dist/src/kbd/index.d.mts +1 -0
- package/dist/src/kbd/index.d.ts +1 -0
- package/dist/src/label/Label.d.ts +9 -0
- package/dist/src/label/LabelRequiredIndicator.d.ts +6 -0
- package/dist/src/label/index.d.mts +7 -0
- package/dist/src/label/index.d.ts +7 -0
- package/dist/src/link-box/LinkBox.d.ts +8 -0
- package/dist/src/link-box/LinkBoxLink.d.ts +8 -0
- package/dist/src/link-box/LinkBoxRaised.d.ts +9 -0
- package/dist/src/link-box/index.d.mts +9 -0
- package/dist/src/link-box/index.d.ts +9 -0
- package/dist/src/meter/Meter.d.ts +18 -0
- package/dist/src/meter/MeterContext.d.ts +12 -0
- package/dist/src/meter/MeterLabel.d.ts +7 -0
- package/dist/src/meter/MeterTrack.d.ts +7 -0
- package/dist/src/meter/MeterTrack.styles.d.ts +8 -0
- package/dist/src/meter/MeterValue.d.ts +9 -0
- package/dist/src/meter/index.d.mts +13 -0
- package/dist/src/meter/index.d.ts +13 -0
- package/dist/src/meter/useIntersectionAnimation.d.ts +26 -0
- package/dist/src/pagination/Pagination.d.ts +8 -0
- package/dist/src/pagination/PaginationContext.d.ts +43 -0
- package/dist/src/pagination/PaginationEllipsis.d.ts +9 -0
- package/dist/src/pagination/PaginationFirstPageTrigger.d.ts +22 -0
- package/dist/src/pagination/PaginationItem.d.ts +31 -0
- package/dist/src/pagination/PaginationLastPageTrigger.d.ts +22 -0
- package/dist/src/pagination/PaginationNextTrigger.d.ts +22 -0
- package/dist/src/pagination/PaginationPages.d.ts +16 -0
- package/dist/src/pagination/PaginationPrevTrigger.d.ts +22 -0
- package/dist/src/pagination/index.d.mts +18 -0
- package/dist/src/pagination/index.d.ts +18 -0
- package/dist/src/pagination/utils.d.ts +1 -0
- package/dist/src/popover/Popover.d.ts +9 -0
- package/dist/src/popover/PopoverAnchor.d.ts +9 -0
- package/dist/src/popover/PopoverArrow.d.ts +9 -0
- package/dist/src/popover/PopoverCloseButton.d.ts +10 -0
- package/dist/src/popover/PopoverContent.d.ts +10 -0
- package/dist/src/popover/PopoverContent.styles.d.ts +9 -0
- package/dist/src/popover/PopoverContext.d.ts +15 -0
- package/dist/src/popover/PopoverHeader.d.ts +10 -0
- package/dist/src/popover/PopoverPortal.d.ts +7 -0
- package/dist/src/popover/PopoverTrigger.d.ts +9 -0
- package/dist/src/popover/index.d.mts +17 -0
- package/dist/src/popover/index.d.ts +17 -0
- package/dist/src/portal/Portal.d.ts +10 -0
- package/dist/src/portal/index.d.mts +1 -0
- package/dist/src/portal/index.d.ts +1 -0
- package/dist/src/progress/Progress.d.ts +24 -0
- package/dist/src/progress/ProgressContext.d.ts +13 -0
- package/dist/src/progress/ProgressIndicator.d.ts +13 -0
- package/dist/src/progress/ProgressLabel.d.ts +7 -0
- package/dist/src/progress/ProgressTrack.d.ts +7 -0
- package/dist/src/progress/ProgressValue.d.ts +7 -0
- package/dist/src/progress/index.d.mts +13 -0
- package/dist/src/progress/index.d.ts +13 -0
- package/dist/src/progress-tracker/ProgressTracker.d.ts +27 -0
- package/dist/src/progress-tracker/ProgressTracker.styles.d.ts +1 -0
- package/dist/src/progress-tracker/ProgressTrackerContext.d.ts +15 -0
- package/dist/src/progress-tracker/ProgressTrackerStep.d.ts +12 -0
- package/dist/src/progress-tracker/ProgressTrackerStep.styles.d.ts +10 -0
- package/dist/src/progress-tracker/ProgressTrackerStepIndicator.d.ts +15 -0
- package/dist/src/progress-tracker/ProgressTrackerStepIndicator.styles.d.ts +7 -0
- package/dist/src/progress-tracker/ProgressTrackerStepLabel.d.ts +9 -0
- package/dist/src/progress-tracker/index.d.mts +10 -0
- package/dist/src/progress-tracker/index.d.ts +10 -0
- package/dist/src/radio-group/Radio.d.ts +9 -0
- package/dist/src/radio-group/RadioGroup.d.ts +54 -0
- package/dist/src/radio-group/RadioGroup.styles.d.ts +5 -0
- package/dist/src/radio-group/RadioGroupContext.d.ts +5 -0
- package/dist/src/radio-group/RadioGroupProvider.d.ts +7 -0
- package/dist/src/radio-group/RadioIndicator.d.ts +18 -0
- package/dist/src/radio-group/RadioIndicator.styles.d.ts +5 -0
- package/dist/src/radio-group/RadioInput.d.ts +25 -0
- package/dist/src/radio-group/RadioInput.styles.d.ts +5 -0
- package/dist/src/radio-group/RadioLabel.d.ts +20 -0
- package/dist/src/radio-group/RadioLabel.styles.d.ts +5 -0
- package/dist/src/radio-group/index.d.mts +7 -0
- package/dist/src/radio-group/index.d.ts +7 -0
- package/dist/src/rating/Rating.d.ts +57 -0
- package/dist/src/rating/RatingStar.d.ts +19 -0
- package/dist/src/rating/RatingStar.styles.d.ts +14 -0
- package/dist/src/rating/index.d.mts +1 -0
- package/dist/src/rating/index.d.ts +1 -0
- package/dist/src/rating/types.d.ts +2 -0
- package/dist/src/rating/utils.d.ts +7 -0
- package/dist/src/rating-display/RatingDisplay.d.ts +31 -0
- package/dist/src/rating-display/RatingDisplayContext.d.ts +12 -0
- package/dist/src/rating-display/RatingDisplayCount.d.ts +12 -0
- package/dist/src/rating-display/RatingDisplayStar.d.ts +16 -0
- package/dist/src/rating-display/RatingDisplayStars.d.ts +22 -0
- package/dist/src/rating-display/RatingDisplayValue.d.ts +13 -0
- package/dist/src/rating-display/index.d.mts +14 -0
- package/dist/src/rating-display/index.d.ts +14 -0
- package/dist/src/rating-display/types.d.ts +1 -0
- package/dist/src/rating-display/utils.d.ts +10 -0
- package/dist/src/scrolling-list/ScrollingList.d.ts +57 -0
- package/dist/src/scrolling-list/ScrollingListControls.d.ts +18 -0
- package/dist/src/scrolling-list/ScrollingListItem.d.ts +17 -0
- package/dist/src/scrolling-list/ScrollingListItems.d.ts +11 -0
- package/dist/src/scrolling-list/ScrollingListNextButton.d.ts +5 -0
- package/dist/src/scrolling-list/ScrollingListPrevButton.d.ts +5 -0
- package/dist/src/scrolling-list/ScrollingListSkipButton.d.ts +9 -0
- package/dist/src/scrolling-list/index.d.mts +15 -0
- package/dist/src/scrolling-list/index.d.ts +15 -0
- package/dist/src/scrolling-list/useFocusWithinScroll.d.ts +3 -0
- package/dist/src/segmented-control/SegmentedControl.d.ts +22 -0
- package/dist/src/segmented-control/SegmentedControl.styles.d.ts +5 -0
- package/dist/src/segmented-control/SegmentedControlContext.d.ts +7 -0
- package/dist/src/segmented-control/SegmentedControlIndicator.d.ts +8 -0
- package/dist/src/segmented-control/SegmentedControlItem.d.ts +18 -0
- package/dist/src/segmented-control/index.d.mts +10 -0
- package/dist/src/segmented-control/index.d.ts +10 -0
- package/dist/src/segmented-gauge/SegmentedGauge.d.ts +66 -0
- package/dist/src/segmented-gauge/SegmentedGaugeContext.d.ts +14 -0
- package/dist/src/segmented-gauge/SegmentedGaugeLabel.d.ts +9 -0
- package/dist/src/segmented-gauge/SegmentedGaugeSegment.d.ts +12 -0
- package/dist/src/segmented-gauge/SegmentedGaugeTrack.d.ts +8 -0
- package/dist/src/segmented-gauge/index.d.mts +13 -0
- package/dist/src/segmented-gauge/index.d.ts +13 -0
- package/dist/src/select/Select.d.ts +6 -0
- package/dist/src/select/SelectContext.d.ts +59 -0
- package/dist/src/select/SelectGroup.d.ts +11 -0
- package/dist/src/select/SelectItem.d.ts +11 -0
- package/dist/src/select/SelectItems.d.ts +10 -0
- package/dist/src/select/SelectItemsGroupContext.d.ts +9 -0
- package/dist/src/select/SelectLabel.d.ts +8 -0
- package/dist/src/select/SelectLeadingIcon.d.ts +7 -0
- package/dist/src/select/SelectPlaceholder.d.ts +10 -0
- package/dist/src/select/SelectTrigger.d.ts +16 -0
- package/dist/src/select/SelectTrigger.styles.d.ts +5 -0
- package/dist/src/select/SelectValue.d.ts +15 -0
- package/dist/src/select/index.d.mts +21 -0
- package/dist/src/select/index.d.ts +21 -0
- package/dist/src/select/types.d.ts +6 -0
- package/dist/src/select/utils.d.ts +4 -0
- package/dist/src/skeleton/Skeleton.d.ts +17 -0
- package/dist/src/skeleton/Skeleton.styles.d.ts +5 -0
- package/dist/src/skeleton/SkeletonItem.d.ts +31 -0
- package/dist/src/skeleton/SkeletonItem.styles.d.ts +8 -0
- package/dist/src/skeleton/index.d.mts +8 -0
- package/dist/src/skeleton/index.d.ts +8 -0
- package/dist/src/slider/Slider.d.ts +55 -0
- package/dist/src/slider/Slider.styles.d.ts +1 -0
- package/dist/src/slider/SliderContext.d.ts +13 -0
- package/dist/src/slider/SliderControl.d.ts +7 -0
- package/dist/src/slider/SliderIndicator.d.ts +7 -0
- package/dist/src/slider/SliderLabel.d.ts +13 -0
- package/dist/src/slider/SliderMaxValue.d.ts +6 -0
- package/dist/src/slider/SliderMinValue.d.ts +6 -0
- package/dist/src/slider/SliderThumb.d.ts +7 -0
- package/dist/src/slider/SliderThumb.styles.d.ts +5 -0
- package/dist/src/slider/SliderThumbContext.d.ts +5 -0
- package/dist/src/slider/SliderTrack.d.ts +7 -0
- package/dist/src/slider/SliderTrack.styles.d.ts +6 -0
- package/dist/src/slider/SliderValue.d.ts +12 -0
- package/dist/src/slider/index.d.mts +20 -0
- package/dist/src/slider/index.d.ts +20 -0
- package/dist/src/slider/useSliderValueBoundaries.d.ts +12 -0
- package/dist/src/slot/Slot.d.ts +12 -0
- package/dist/src/slot/index.d.mts +1 -0
- package/dist/src/slot/index.d.ts +1 -0
- package/dist/src/snackbar/Snackbar.d.ts +29 -0
- package/dist/src/snackbar/SnackbarItem.d.ts +49 -0
- package/dist/src/snackbar/SnackbarItem.styles.d.ts +10 -0
- package/dist/src/snackbar/SnackbarItemAction.d.ts +10 -0
- package/dist/src/snackbar/SnackbarItemClose.d.ts +9 -0
- package/dist/src/snackbar/SnackbarItemContext.d.ts +8 -0
- package/dist/src/snackbar/SnackbarItemIcon.d.ts +7 -0
- package/dist/src/snackbar/SnackbarRegion.d.ts +30 -0
- package/dist/src/snackbar/SnackbarRegion.styles.d.ts +5 -0
- package/dist/src/snackbar/index.d.mts +13 -0
- package/dist/src/snackbar/index.d.ts +13 -0
- package/dist/src/snackbar/snackbarVariants.d.ts +74 -0
- package/dist/src/snackbar/useSnackbarGlobalStore.d.ts +18 -0
- package/dist/src/snackbar/useSwipe.d.ts +15 -0
- package/dist/src/spinner/Spinner.d.ts +9 -0
- package/dist/src/spinner/Spinner.styles.d.ts +7 -0
- package/dist/src/spinner/index.d.mts +1 -0
- package/dist/src/spinner/index.d.ts +1 -0
- package/dist/src/stepper/Stepper.d.ts +9 -0
- package/dist/src/stepper/StepperButton.d.ts +14 -0
- package/dist/src/stepper/StepperInput.d.ts +7 -0
- package/dist/src/stepper/index.d.mts +9 -0
- package/dist/src/stepper/index.d.ts +9 -0
- package/dist/src/stepper/types.d.ts +46 -0
- package/dist/src/stepper/useStepper.d.ts +2 -0
- package/dist/src/switch/Switch.d.ts +6 -0
- package/dist/src/switch/SwitchInput.d.ts +53 -0
- package/dist/src/switch/SwitchInput.styles.d.ts +16 -0
- package/dist/src/switch/SwitchLabel.d.ts +17 -0
- package/dist/src/switch/SwitchLabel.styles.d.ts +5 -0
- package/dist/src/switch/index.d.mts +1 -0
- package/dist/src/switch/index.d.ts +1 -0
- package/dist/src/tabs/Tabs.d.ts +24 -0
- package/dist/src/tabs/TabsContent.d.ts +22 -0
- package/dist/src/tabs/TabsContent.styles.d.ts +3 -0
- package/dist/src/tabs/TabsContext.d.ts +7 -0
- package/dist/src/tabs/TabsList.d.ts +20 -0
- package/dist/src/tabs/TabsList.styles.d.ts +3 -0
- package/dist/src/tabs/TabsPopover.d.ts +29 -0
- package/dist/src/tabs/TabsPopoverAbstraction.d.ts +27 -0
- package/dist/src/tabs/TabsRoot.styles.d.ts +1 -0
- package/dist/src/tabs/TabsTrigger.d.ts +41 -0
- package/dist/src/tabs/TabsTrigger.styles.d.ts +8 -0
- package/dist/src/tabs/index.d.mts +13 -0
- package/dist/src/tabs/index.d.ts +13 -0
- package/dist/src/tabs/useRenderSlot.d.ts +1 -0
- package/dist/src/tabs/useResizeObserver.d.ts +8 -0
- package/dist/src/tag/Tag.d.ts +17 -0
- package/dist/src/tag/Tag.styles.d.ts +8 -0
- package/dist/src/tag/index.d.mts +1 -0
- package/dist/src/tag/index.d.ts +1 -0
- package/dist/src/tag/variants/filled.d.ts +37 -0
- package/dist/src/tag/variants/index.d.mts +3 -0
- package/dist/src/tag/variants/index.d.ts +3 -0
- package/dist/src/tag/variants/outlined.d.ts +33 -0
- package/dist/src/tag/variants/tinted.d.ts +33 -0
- package/dist/src/text-link/TextLink.d.ts +16 -0
- package/dist/src/text-link/index.d.mts +1 -0
- package/dist/src/text-link/index.d.ts +1 -0
- package/dist/src/textarea/Textarea.d.ts +14 -0
- package/dist/src/textarea/TextareaClearButton.d.ts +10 -0
- package/dist/src/textarea/TextareaGroup.d.ts +6 -0
- package/dist/src/textarea/TextareaLeadingIcon.d.ts +7 -0
- package/dist/src/textarea/TextareaTrailingIcon.d.ts +7 -0
- package/dist/src/textarea/index.d.mts +14 -0
- package/dist/src/textarea/index.d.ts +14 -0
- package/dist/src/toast/Toast.d.ts +4 -0
- package/dist/src/toast/Toast.styles.d.ts +10 -0
- package/dist/src/toast/index.d.mts +20 -0
- package/dist/src/toast/index.d.ts +20 -0
- package/dist/src/toast/types.d.ts +44 -0
- package/dist/src/toast/useRenderSlot.d.ts +3 -0
- package/dist/src/toast/useToastManager.d.ts +2 -0
- package/dist/src/visually-hidden/VisuallyHidden.d.ts +12 -0
- package/dist/src/visually-hidden/index.d.mts +1 -0
- package/dist/src/visually-hidden/index.d.ts +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseMultipleSelectionReturnValue, UseSelectReturnValue } from 'downshift';
|
|
2
|
+
export interface DropdownItem {
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
value: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
export type ItemsMap = Map<string, DropdownItem>;
|
|
8
|
+
export type DownshiftState = UseSelectReturnValue<DropdownItem> & UseMultipleSelectionReturnValue<DropdownItem>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DropdownItem, ItemsMap } from './types';
|
|
2
|
+
export interface DownshiftProps {
|
|
3
|
+
itemsMap: ItemsMap;
|
|
4
|
+
value: string | string[] | undefined;
|
|
5
|
+
defaultValue: string | string[] | undefined;
|
|
6
|
+
onValueChange: ((value: string) => void) | ((value: string[]) => void) | undefined;
|
|
7
|
+
open: boolean | undefined;
|
|
8
|
+
onOpenChange: ((isOpen: boolean) => void) | undefined;
|
|
9
|
+
defaultOpen: boolean | undefined;
|
|
10
|
+
multiple: boolean | undefined;
|
|
11
|
+
id: string;
|
|
12
|
+
labelId: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This hook abstract the complexity of using downshift with both single and multiple selection.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useDropdown: ({ itemsMap, defaultValue, value, onValueChange, open, onOpenChange, defaultOpen, multiple, id, labelId, }: DownshiftProps) => {
|
|
18
|
+
/** There is a Downshift bug in React 19, it duplicates some selectedItems */
|
|
19
|
+
selectedItems: DropdownItem[];
|
|
20
|
+
activeIndex: number;
|
|
21
|
+
getDropdownProps: <Options>(options?: import('downshift').UseMultipleSelectionGetDropdownPropsOptions & Options, extraOptions?: import('downshift').GetPropsCommonOptions) => Omit<import('downshift').Overwrite<import('downshift').UseMultipleSelectionGetDropdownReturnValue, Options>, "preventKeyAction">;
|
|
22
|
+
getSelectedItemProps: <Options>(options: import('downshift').UseMultipleSelectionGetSelectedItemPropsOptions<DropdownItem> & Options) => Omit<import('downshift').Overwrite<import('downshift').UseMultipleSelectionGetSelectedItemReturnValue, Options>, "index" | "selectedItem">;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
addSelectedItem: (item: DropdownItem) => void;
|
|
25
|
+
removeSelectedItem: (item: DropdownItem) => void;
|
|
26
|
+
setSelectedItems: (items: DropdownItem[]) => void;
|
|
27
|
+
setActiveIndex: (index: number) => void;
|
|
28
|
+
highlightedIndex: number;
|
|
29
|
+
selectedItem: DropdownItem | null;
|
|
30
|
+
isOpen: boolean;
|
|
31
|
+
inputValue: string;
|
|
32
|
+
getToggleButtonProps: <Options>(options?: import('downshift').UseSelectGetToggleButtonPropsOptions & Options, otherOptions?: import('downshift').GetPropsCommonOptions) => import('downshift').Overwrite<import('downshift').UseSelectGetToggleButtonReturnValue, Options>;
|
|
33
|
+
getLabelProps: <Options>(options?: import('downshift').UseSelectGetLabelPropsOptions & Options) => import('downshift').Overwrite<import('downshift').UseSelectGetLabelPropsReturnValue, Options>;
|
|
34
|
+
getMenuProps: <Options>(options?: import('downshift').UseSelectGetMenuPropsOptions & Options, otherOptions?: import('downshift').GetPropsCommonOptions) => import('downshift').Overwrite<import('downshift').UseSelectGetMenuReturnValue, Options>;
|
|
35
|
+
getItemProps: <Options>(options: import('downshift').UseSelectGetItemPropsOptions<DropdownItem> & Options) => Omit<import('downshift').Overwrite<import('downshift').UseSelectGetItemPropsReturnValue, Options>, "item" | "index">;
|
|
36
|
+
openMenu: () => void;
|
|
37
|
+
closeMenu: () => void;
|
|
38
|
+
toggleMenu: () => void;
|
|
39
|
+
selectItem: (item: DropdownItem | null) => void;
|
|
40
|
+
setHighlightedIndex: (index: number) => void;
|
|
41
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DropdownItem, ItemsMap } from './types';
|
|
3
|
+
export declare function getIndexByKey(map: ItemsMap, targetKey: string): number;
|
|
4
|
+
export declare const getElementByIndex: (map: ItemsMap, index: number) => DropdownItem | undefined;
|
|
5
|
+
export declare const getOrderedItems: (children: ReactNode, result?: DropdownItem[]) => DropdownItem[];
|
|
6
|
+
/**
|
|
7
|
+
* If Dropdown.Item children:
|
|
8
|
+
* - is a string, then the string is used.
|
|
9
|
+
* - is JSX markup, then we look for Dropdown.ItemText to get its string value.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getItemText: (children: ReactNode, itemText?: string) => string;
|
|
12
|
+
export declare const getItemsFromChildren: (children: ReactNode) => ItemsMap;
|
|
13
|
+
export declare const hasChildComponent: (children: ReactNode, displayName: string) => boolean;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileUploadFileError, RejectedFile } from './useFileUploadState';
|
|
3
|
+
export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileUploadFileError, RejectedFile, };
|
|
4
|
+
export interface FileUploadProps {
|
|
5
|
+
/**
|
|
6
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
7
|
+
*/
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Initial files to display when the component mounts (uncontrolled mode)
|
|
14
|
+
*/
|
|
15
|
+
defaultValue?: File[];
|
|
16
|
+
/**
|
|
17
|
+
* Controlled files value (controlled mode)
|
|
18
|
+
* When provided, the component becomes controlled
|
|
19
|
+
*/
|
|
20
|
+
value?: File[];
|
|
21
|
+
/**
|
|
22
|
+
* Callback when files are accepted
|
|
23
|
+
* @param details - Details about the accepted files
|
|
24
|
+
*/
|
|
25
|
+
onFileAccept?: (details: FileAcceptDetails) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback when files are rejected
|
|
28
|
+
* @param details - Details about the rejected files and their errors
|
|
29
|
+
*/
|
|
30
|
+
onFileReject?: (details: FileRejectDetails) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when files change (both accepted and rejected)
|
|
33
|
+
* For controlled mode, use this to update the value prop by extracting details.acceptedFiles
|
|
34
|
+
* @param details - Details about both accepted and rejected files
|
|
35
|
+
*/
|
|
36
|
+
onFileChange?: (details: FileChangeDetails) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Whether multiple files can be selected
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
multiple?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Comma-separated list of accepted file types
|
|
44
|
+
* Supports MIME types (e.g., "image/*", "image/png", "application/pdf")
|
|
45
|
+
* and file extensions (e.g., ".pdf", ".doc", ".jpg")
|
|
46
|
+
* @example "image/*"
|
|
47
|
+
* @example ".pdf,.doc"
|
|
48
|
+
* @example "image/png,image/jpeg,.pdf"
|
|
49
|
+
*/
|
|
50
|
+
accept?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Maximum number of files that can be uploaded
|
|
53
|
+
* Files beyond this limit will be rejected
|
|
54
|
+
*/
|
|
55
|
+
maxFiles?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Maximum file size in bytes
|
|
58
|
+
* Files larger than this will be rejected
|
|
59
|
+
*/
|
|
60
|
+
maxFileSize?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Minimum file size in bytes
|
|
63
|
+
* Files smaller than this will be rejected
|
|
64
|
+
*/
|
|
65
|
+
minFileSize?: number;
|
|
66
|
+
/**
|
|
67
|
+
* When `true`, prevents the user from interacting with the file upload
|
|
68
|
+
*/
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* When `true`, sets the file upload to read-only mode
|
|
72
|
+
*/
|
|
73
|
+
readOnly?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale.
|
|
76
|
+
* Used for formatting file sizes and error messages.
|
|
77
|
+
* @default Browser locale or 'en' if not available
|
|
78
|
+
*/
|
|
79
|
+
locale?: string;
|
|
80
|
+
}
|
|
81
|
+
export declare const FileUploadContext: import('react').Context<{
|
|
82
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
83
|
+
files: File[];
|
|
84
|
+
rejectedFiles: RejectedFile[];
|
|
85
|
+
addFiles: (files: File[]) => void;
|
|
86
|
+
removeFile: (index: number) => void;
|
|
87
|
+
removeRejectedFile: (index: number) => void;
|
|
88
|
+
clearFiles: () => void;
|
|
89
|
+
clearRejectedFiles: () => void;
|
|
90
|
+
triggerRef: React.RefObject<HTMLElement | null>;
|
|
91
|
+
dropzoneRef: React.RefObject<HTMLElement | null>;
|
|
92
|
+
deleteButtonRefs: React.MutableRefObject<HTMLButtonElement[]>;
|
|
93
|
+
rejectedFileDeleteButtonRefs: React.MutableRefObject<HTMLButtonElement[]>;
|
|
94
|
+
multiple: boolean;
|
|
95
|
+
maxFiles?: number;
|
|
96
|
+
maxFilesReached: boolean;
|
|
97
|
+
disabled: boolean;
|
|
98
|
+
readOnly: boolean;
|
|
99
|
+
locale: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
isInvalid?: boolean;
|
|
102
|
+
isRequired?: boolean;
|
|
103
|
+
} | null>;
|
|
104
|
+
export declare const FileUpload: {
|
|
105
|
+
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled: disabledProp, readOnly: readOnlyProp, locale, }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
displayName: string;
|
|
107
|
+
};
|
|
108
|
+
export declare const useFileUploadContext: () => {
|
|
109
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
110
|
+
files: File[];
|
|
111
|
+
rejectedFiles: RejectedFile[];
|
|
112
|
+
addFiles: (files: File[]) => void;
|
|
113
|
+
removeFile: (index: number) => void;
|
|
114
|
+
removeRejectedFile: (index: number) => void;
|
|
115
|
+
clearFiles: () => void;
|
|
116
|
+
clearRejectedFiles: () => void;
|
|
117
|
+
triggerRef: React.RefObject<HTMLElement | null>;
|
|
118
|
+
dropzoneRef: React.RefObject<HTMLElement | null>;
|
|
119
|
+
deleteButtonRefs: React.MutableRefObject<HTMLButtonElement[]>;
|
|
120
|
+
rejectedFileDeleteButtonRefs: React.MutableRefObject<HTMLButtonElement[]>;
|
|
121
|
+
multiple: boolean;
|
|
122
|
+
maxFiles?: number;
|
|
123
|
+
maxFilesReached: boolean;
|
|
124
|
+
disabled: boolean;
|
|
125
|
+
readOnly: boolean;
|
|
126
|
+
locale: string;
|
|
127
|
+
description?: string;
|
|
128
|
+
isInvalid?: boolean;
|
|
129
|
+
isRequired?: boolean;
|
|
130
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
export interface FileUploadAcceptedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
3
|
+
ref?: Ref<HTMLLIElement>;
|
|
4
|
+
/**
|
|
5
|
+
* The file to display
|
|
6
|
+
*/
|
|
7
|
+
file: File;
|
|
8
|
+
/**
|
|
9
|
+
* Upload progress value (0-100). When provided, displays a progress bar at the bottom of the file item.
|
|
10
|
+
*/
|
|
11
|
+
uploadProgress?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Accessible label for the delete button
|
|
14
|
+
*/
|
|
15
|
+
deleteButtonAriaLabel: string;
|
|
16
|
+
/**
|
|
17
|
+
* Accessible label for the progress bar. Required when uploadProgress is provided.
|
|
18
|
+
*/
|
|
19
|
+
progressAriaLabel?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const AcceptedFile: {
|
|
23
|
+
({ className, file, uploadProgress, deleteButtonAriaLabel, progressAriaLabel, ...props }: FileUploadAcceptedFileProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RejectedFile } from './FileUpload';
|
|
3
|
+
export interface FileUploadContextProps {
|
|
4
|
+
/**
|
|
5
|
+
* Render prop that receives acceptedFiles, rejectedFiles, formatFileSize, and locale
|
|
6
|
+
*/
|
|
7
|
+
children: (props: {
|
|
8
|
+
acceptedFiles: File[];
|
|
9
|
+
rejectedFiles: RejectedFile[];
|
|
10
|
+
formatFileSize: (bytes: number, locale?: string) => string;
|
|
11
|
+
locale?: string;
|
|
12
|
+
}) => ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const Context: {
|
|
15
|
+
({ children }: FileUploadContextProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const DropzoneContext: import('react').Context<boolean>;
|
|
2
|
+
export declare const useDropzoneContext: () => boolean;
|
|
3
|
+
export declare function Dropzone({ children, className, unstyled, }: {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
unstyled?: boolean;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare namespace Dropzone {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconButton } from '../icon-button';
|
|
2
|
+
export interface FileUploadItemDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
3
|
+
/**
|
|
4
|
+
* The file to delete
|
|
5
|
+
*/
|
|
6
|
+
file: File;
|
|
7
|
+
}
|
|
8
|
+
export declare const ItemDeleteTrigger: {
|
|
9
|
+
({ className, file, onClick, ...props }: FileUploadItemDeleteTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
export interface FileUploadPreviewImageProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
ref?: Ref<HTMLDivElement>;
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* The file to preview
|
|
7
|
+
*/
|
|
8
|
+
file: File;
|
|
9
|
+
/**
|
|
10
|
+
* Fallback content when file is not an image or preview fails
|
|
11
|
+
*/
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const PreviewImage: {
|
|
15
|
+
({ className, file, fallback, ...props }: FileUploadPreviewImageProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
import { FileUploadFileError, RejectedFile as RejectedFileType } from './FileUpload';
|
|
3
|
+
export interface FileUploadRejectedFileProps extends ComponentPropsWithoutRef<'li'> {
|
|
4
|
+
ref?: Ref<HTMLLIElement>;
|
|
5
|
+
/**
|
|
6
|
+
* The rejected file to display
|
|
7
|
+
*/
|
|
8
|
+
rejectedFile: RejectedFileType;
|
|
9
|
+
/**
|
|
10
|
+
* Function to render the error message for each error code
|
|
11
|
+
* @param error - The error code
|
|
12
|
+
* @returns The error message to display
|
|
13
|
+
*/
|
|
14
|
+
renderError: (error: FileUploadFileError) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Accessible label for the delete button
|
|
17
|
+
*/
|
|
18
|
+
deleteButtonAriaLabel: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const RejectedFile: {
|
|
22
|
+
({ className, rejectedFile, renderError, deleteButtonAriaLabel, ...props }: FileUploadRejectedFileProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconButton } from '../icon-button';
|
|
2
|
+
import { RejectedFile as RejectedFileType } from './FileUpload';
|
|
3
|
+
export interface FileUploadRejectedFileDeleteTriggerProps extends React.ComponentProps<typeof IconButton> {
|
|
4
|
+
/**
|
|
5
|
+
* The rejected file to remove
|
|
6
|
+
*/
|
|
7
|
+
rejectedFile: RejectedFileType;
|
|
8
|
+
}
|
|
9
|
+
export declare const RejectedFileDeleteTrigger: {
|
|
10
|
+
({ className, rejectedFile, onClick, ...props }: FileUploadRejectedFileDeleteTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { ButtonProps } from '../button';
|
|
3
|
+
export interface FileUploadTriggerProps extends Omit<ButtonProps, 'children' | 'disabled'> {
|
|
4
|
+
ref?: Ref<HTMLButtonElement>;
|
|
5
|
+
className?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
unstyled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Trigger: {
|
|
10
|
+
({ className, children, asChild, unstyled, design, intent, size, shape, ref, ...props }: FileUploadTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File upload error codes
|
|
3
|
+
*/
|
|
4
|
+
export declare const FILE_UPLOAD_ERRORS: {
|
|
5
|
+
/**
|
|
6
|
+
* Exceeds the maxFiles limit
|
|
7
|
+
*/
|
|
8
|
+
readonly TOO_MANY_FILES: "TOO_MANY_FILES";
|
|
9
|
+
/**
|
|
10
|
+
* File type not in the accept list
|
|
11
|
+
*/
|
|
12
|
+
readonly FILE_INVALID_TYPE: "FILE_INVALID_TYPE";
|
|
13
|
+
/**
|
|
14
|
+
* File size exceeds maxFileSize
|
|
15
|
+
*/
|
|
16
|
+
readonly FILE_TOO_LARGE: "FILE_TOO_LARGE";
|
|
17
|
+
/**
|
|
18
|
+
* File size below minFileSize
|
|
19
|
+
*/
|
|
20
|
+
readonly FILE_TOO_SMALL: "FILE_TOO_SMALL";
|
|
21
|
+
/**
|
|
22
|
+
* Generic validation failure
|
|
23
|
+
*/
|
|
24
|
+
readonly FILE_INVALID: "FILE_INVALID";
|
|
25
|
+
/**
|
|
26
|
+
* Duplicate file detected
|
|
27
|
+
*/
|
|
28
|
+
readonly FILE_EXISTS: "FILE_EXISTS";
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileUpload as Root, FileUploadFileError, RejectedFile } from './FileUpload';
|
|
2
|
+
import { AcceptedFile } from './FileUploadAcceptedFile';
|
|
3
|
+
import { Context } from './FileUploadContext';
|
|
4
|
+
import { FILE_UPLOAD_ERRORS } from './constants';
|
|
5
|
+
import { Dropzone } from './FileUploadDropzone';
|
|
6
|
+
import { ItemDeleteTrigger } from './FileUploadItemDeleteTrigger';
|
|
7
|
+
import { PreviewImage } from './FileUploadPreviewImage';
|
|
8
|
+
import { RejectedFile as RejectedFileComponent } from './FileUploadRejectedFile';
|
|
9
|
+
import { RejectedFileDeleteTrigger } from './FileUploadRejectedFileDeleteTrigger';
|
|
10
|
+
import { Trigger } from './FileUploadTrigger';
|
|
11
|
+
export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, RejectedFile, FileUploadFileError, };
|
|
12
|
+
export { FILE_UPLOAD_ERRORS };
|
|
13
|
+
export declare const FileUpload: typeof Root & {
|
|
14
|
+
Trigger: typeof Trigger;
|
|
15
|
+
Dropzone: typeof Dropzone;
|
|
16
|
+
Context: typeof Context;
|
|
17
|
+
ItemDeleteTrigger: typeof ItemDeleteTrigger;
|
|
18
|
+
PreviewImage: typeof PreviewImage;
|
|
19
|
+
AcceptedFile: typeof AcceptedFile;
|
|
20
|
+
RejectedFile: typeof RejectedFileComponent;
|
|
21
|
+
RejectedFileDeleteTrigger: typeof RejectedFileDeleteTrigger;
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileUpload as Root, FileUploadFileError, RejectedFile } from './FileUpload';
|
|
2
|
+
import { AcceptedFile } from './FileUploadAcceptedFile';
|
|
3
|
+
import { Context } from './FileUploadContext';
|
|
4
|
+
import { FILE_UPLOAD_ERRORS } from './constants';
|
|
5
|
+
import { Dropzone } from './FileUploadDropzone';
|
|
6
|
+
import { ItemDeleteTrigger } from './FileUploadItemDeleteTrigger';
|
|
7
|
+
import { PreviewImage } from './FileUploadPreviewImage';
|
|
8
|
+
import { RejectedFile as RejectedFileComponent } from './FileUploadRejectedFile';
|
|
9
|
+
import { RejectedFileDeleteTrigger } from './FileUploadRejectedFileDeleteTrigger';
|
|
10
|
+
import { Trigger } from './FileUploadTrigger';
|
|
11
|
+
export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, RejectedFile, FileUploadFileError, };
|
|
12
|
+
export { FILE_UPLOAD_ERRORS };
|
|
13
|
+
export declare const FileUpload: typeof Root & {
|
|
14
|
+
Trigger: typeof Trigger;
|
|
15
|
+
Dropzone: typeof Dropzone;
|
|
16
|
+
Context: typeof Context;
|
|
17
|
+
ItemDeleteTrigger: typeof ItemDeleteTrigger;
|
|
18
|
+
PreviewImage: typeof PreviewImage;
|
|
19
|
+
AcceptedFile: typeof AcceptedFile;
|
|
20
|
+
RejectedFile: typeof RejectedFileComponent;
|
|
21
|
+
RejectedFileDeleteTrigger: typeof RejectedFileDeleteTrigger;
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to simulate file upload in tests.
|
|
3
|
+
* Use this instead of userEvent.upload for file inputs, as userEvent.upload
|
|
4
|
+
* doesn't work correctly in this test environment.
|
|
5
|
+
*
|
|
6
|
+
* @param input - The file input element
|
|
7
|
+
* @param files - Single file or array of files to upload
|
|
8
|
+
*/
|
|
9
|
+
export declare const uploadFiles: (input: HTMLInputElement, files: File | File[]) => void;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { FILE_UPLOAD_ERRORS } from './constants';
|
|
2
|
+
export type FileUploadFileError = typeof FILE_UPLOAD_ERRORS.TOO_MANY_FILES | typeof FILE_UPLOAD_ERRORS.FILE_INVALID_TYPE | typeof FILE_UPLOAD_ERRORS.FILE_TOO_LARGE | typeof FILE_UPLOAD_ERRORS.FILE_TOO_SMALL | typeof FILE_UPLOAD_ERRORS.FILE_INVALID | typeof FILE_UPLOAD_ERRORS.FILE_EXISTS;
|
|
3
|
+
export interface RejectedFile {
|
|
4
|
+
file: File;
|
|
5
|
+
errors: FileUploadFileError[];
|
|
6
|
+
}
|
|
7
|
+
export interface FileAcceptDetails {
|
|
8
|
+
files: File[];
|
|
9
|
+
}
|
|
10
|
+
export interface FileRejectDetails {
|
|
11
|
+
files: RejectedFile[];
|
|
12
|
+
}
|
|
13
|
+
export interface FileChangeDetails {
|
|
14
|
+
acceptedFiles: File[];
|
|
15
|
+
rejectedFiles: RejectedFile[];
|
|
16
|
+
}
|
|
17
|
+
export interface UseFileUploadStateProps {
|
|
18
|
+
/**
|
|
19
|
+
* Initial files to display when the component mounts (uncontrolled mode)
|
|
20
|
+
*/
|
|
21
|
+
defaultValue?: File[];
|
|
22
|
+
/**
|
|
23
|
+
* Controlled files value (controlled mode)
|
|
24
|
+
* When provided, the component becomes controlled
|
|
25
|
+
*/
|
|
26
|
+
value?: File[];
|
|
27
|
+
/**
|
|
28
|
+
* Callback when files are accepted
|
|
29
|
+
*/
|
|
30
|
+
onFileAccept?: (details: FileAcceptDetails) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when files are rejected
|
|
33
|
+
*/
|
|
34
|
+
onFileReject?: (details: FileRejectDetails) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Callback when files change (both accepted and rejected)
|
|
37
|
+
* For controlled mode, use this to update the value prop by extracting details.acceptedFiles
|
|
38
|
+
*/
|
|
39
|
+
onFileChange?: (details: FileChangeDetails) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Whether multiple files can be selected
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
multiple?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Comma-separated list of accepted file types
|
|
47
|
+
*/
|
|
48
|
+
accept?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of files that can be uploaded
|
|
51
|
+
*/
|
|
52
|
+
maxFiles?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Maximum file size in bytes
|
|
55
|
+
*/
|
|
56
|
+
maxFileSize?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Minimum file size in bytes
|
|
59
|
+
*/
|
|
60
|
+
minFileSize?: number;
|
|
61
|
+
/**
|
|
62
|
+
* When `true`, prevents the user from interacting with the file upload
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* When `true`, sets the file upload to read-only mode
|
|
67
|
+
*/
|
|
68
|
+
readOnly?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale.
|
|
71
|
+
* Used for formatting file sizes and error messages.
|
|
72
|
+
*/
|
|
73
|
+
locale?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface UseFileUploadStateReturn {
|
|
76
|
+
files: File[];
|
|
77
|
+
rejectedFiles: RejectedFile[];
|
|
78
|
+
addFiles: (files: File[]) => void;
|
|
79
|
+
removeFile: (index: number) => void;
|
|
80
|
+
removeRejectedFile: (index: number) => void;
|
|
81
|
+
clearFiles: () => void;
|
|
82
|
+
clearRejectedFiles: () => void;
|
|
83
|
+
maxFilesReached: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Hook that manages file upload state, validation, and file operations
|
|
87
|
+
*/
|
|
88
|
+
export declare function useFileUploadState({ defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled, readOnly, locale, }: UseFileUploadStateProps): UseFileUploadStateReturn;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactElement, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Validates if a file matches the accept patterns
|
|
4
|
+
* Supports MIME types (e.g., "image/*", "image/png", "application/pdf")
|
|
5
|
+
* and file extensions (e.g., ".pdf", ".doc", ".jpg")
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateFileAccept(file: File, accept: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Validates if a file size is within the allowed range
|
|
10
|
+
* @param file - The file to validate
|
|
11
|
+
* @param minFileSize - Minimum file size in bytes
|
|
12
|
+
* @param maxFileSize - Maximum file size in bytes
|
|
13
|
+
* @param locale - Locale code for error messages. Defaults to browser locale or 'en'
|
|
14
|
+
* @returns Object with validation result and error message if invalid
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateFileSize(file: File, minFileSize?: number, maxFileSize?: number, locale?: string): {
|
|
17
|
+
valid: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Formats file size in bytes to human-readable format
|
|
22
|
+
* @param bytes - File size in bytes
|
|
23
|
+
* @param locale - Locale code (e.g., 'en', 'fr'). Defaults to browser locale or 'en'
|
|
24
|
+
* @returns Formatted file size string with appropriate unit
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatFileSize(bytes: number, locale?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the appropriate icon component based on the file type
|
|
29
|
+
* @param file - The file to get the icon for
|
|
30
|
+
* @returns React element representing the icon component
|
|
31
|
+
*/
|
|
32
|
+
export declare function getFileIcon(file: File): ReactElement;
|
|
33
|
+
/**
|
|
34
|
+
* Finds the first focusable element from a list of candidates
|
|
35
|
+
* Falls back to inputRef if no other element is focusable
|
|
36
|
+
* @param candidates - Array of candidate elements to check
|
|
37
|
+
* @param inputRef - Input element to use as last resort
|
|
38
|
+
* @returns The first focusable element, or null if none found
|
|
39
|
+
*/
|
|
40
|
+
export declare function findFocusableElement(candidates: (HTMLElement | null)[], inputRef: RefObject<HTMLInputElement | null>): HTMLElement | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
import { FormFieldContextState } from './FormFieldContext';
|
|
3
|
+
export interface FormFieldProps extends ComponentPropsWithoutRef<'div'>, Pick<FormFieldContextState, 'name' | 'state' | 'isRequired'> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
|
|
6
|
+
*/
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* When `true`, prevents the user from interacting.
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Sets the component as interactive or not.
|
|
14
|
+
*/
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
ref?: Ref<HTMLDivElement>;
|
|
17
|
+
}
|
|
18
|
+
export declare const FormField: {
|
|
19
|
+
({ className, disabled, readOnly, name, state, isRequired, asChild, ref, ...others }: FormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { FormFieldStateMessageProps } from './FormFieldStateMessage';
|
|
3
|
+
export type FormFieldAlertMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {
|
|
4
|
+
ref?: Ref<HTMLSpanElement>;
|
|
5
|
+
};
|
|
6
|
+
export declare const FormFieldAlertMessage: {
|
|
7
|
+
({ ref, ...props }: FormFieldAlertMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
|
+
export type FormFieldCharactersCountProps = ComponentPropsWithoutRef<'span'> & {
|
|
3
|
+
/**
|
|
4
|
+
* This description is for the screen reader, read when the input is focused.
|
|
5
|
+
*/
|
|
6
|
+
description?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The live announcement is for the screen read after a delay once the input value changes.
|
|
9
|
+
*/
|
|
10
|
+
liveAnnouncement?: ({ remainingChars }: {
|
|
11
|
+
remainingChars: number;
|
|
12
|
+
}) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Current value for the input this component belongs to.
|
|
15
|
+
*/
|
|
16
|
+
value?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum numeric value to be displayed.
|
|
19
|
+
*/
|
|
20
|
+
maxLength: number;
|
|
21
|
+
ref?: Ref<HTMLSpanElement>;
|
|
22
|
+
};
|
|
23
|
+
export declare const FormFieldCharactersCount: {
|
|
24
|
+
({ className, value, maxLength, description, liveAnnouncement, ref, ...others }: FormFieldCharactersCountProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface FormFieldContextState {
|
|
2
|
+
/**
|
|
3
|
+
* Generated id for the input component.
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* Generated id for the label component.
|
|
8
|
+
*/
|
|
9
|
+
labelId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the input. Submitted with its owning form as part of a name/value pair.
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* A set of ids separated by a space used to describe the input component given by a set of messages.
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Disables the field and its associated input
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Marks the field and its associated input as read only
|
|
24
|
+
*/
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The validation state of the input.
|
|
28
|
+
*/
|
|
29
|
+
state?: 'error' | 'success' | 'alert';
|
|
30
|
+
/**
|
|
31
|
+
* If true, the form field will be invalid.
|
|
32
|
+
*/
|
|
33
|
+
isInvalid?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If true, the form field will be required.
|
|
36
|
+
*/
|
|
37
|
+
isRequired?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Callback used to store a descriptive message.
|
|
40
|
+
*/
|
|
41
|
+
onMessageIdAdd: (id: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Callback used to remove a descriptive message.
|
|
44
|
+
*/
|
|
45
|
+
onMessageIdRemove: (id: string) => void;
|
|
46
|
+
}
|
|
47
|
+
export declare const FormFieldContext: import('react').Context<FormFieldContextState | null>;
|
|
48
|
+
export declare const ID_PREFIX = ":form-field";
|
|
49
|
+
export declare const useFormField: () => FormFieldContextState;
|