@spark-ui/components 13.1.4 → 13.2.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/Button-B6rA3-e5.js +2 -0
- package/dist/Button-B6rA3-e5.js.map +1 -0
- package/dist/{chunk-2YM6GKWW.mjs → Button-C3C0aixy.mjs} +130 -173
- package/dist/Button-C3C0aixy.mjs.map +1 -0
- package/dist/DialogContent.styles-B5pR8ECK.js +2 -0
- package/dist/DialogContent.styles-B5pR8ECK.js.map +1 -0
- package/dist/{chunk-XZ47F6TP.mjs → DialogContent.styles-_lRDsl8c.mjs} +6 -8
- package/dist/DialogContent.styles-_lRDsl8c.mjs.map +1 -0
- package/dist/Icon-CF0W0LKr.js +2 -0
- package/dist/Icon-CF0W0LKr.js.map +1 -0
- package/dist/Icon-Ck-dhfLd.mjs +58 -0
- package/dist/Icon-Ck-dhfLd.mjs.map +1 -0
- package/dist/IconButton-C62-axzv.mjs +43 -0
- package/dist/IconButton-C62-axzv.mjs.map +1 -0
- package/dist/IconButton-D3g86WpZ.js +2 -0
- package/dist/IconButton-D3g86WpZ.js.map +1 -0
- package/dist/Slot-D2Bbf8Gw.mjs +14 -0
- package/dist/Slot-D2Bbf8Gw.mjs.map +1 -0
- package/dist/Slot-DQ8z2zsy.js +2 -0
- package/dist/Slot-DQ8z2zsy.js.map +1 -0
- package/dist/Spinner-_Kffli3B.js +2 -0
- package/dist/Spinner-_Kffli3B.js.map +1 -0
- package/dist/{chunk-GAK4SC2F.mjs → Spinner-jF3-zoh_.mjs} +29 -40
- package/dist/Spinner-jF3-zoh_.mjs.map +1 -0
- package/dist/{chunk-RKPP7ZOK.mjs → TextLink-BuzFRWO6.mjs} +27 -36
- package/dist/TextLink-BuzFRWO6.mjs.map +1 -0
- package/dist/TextLink-C3xDLsbC.js +2 -0
- package/dist/TextLink-C3xDLsbC.js.map +1 -0
- package/dist/VisuallyHidden-CB6Nx76j.js +2 -0
- package/dist/VisuallyHidden-CB6Nx76j.js.map +1 -0
- package/dist/VisuallyHidden-KH1biLx-.mjs +28 -0
- package/dist/VisuallyHidden-KH1biLx-.mjs.map +1 -0
- package/dist/accordion/Accordion.d.ts +27 -0
- package/dist/accordion/AccordionItem.d.ts +12 -0
- package/dist/accordion/AccordionItemContent.d.ts +12 -0
- package/dist/accordion/AccordionItemHeader.d.ts +9 -0
- package/dist/accordion/AccordionItemTrigger.d.ts +12 -0
- package/dist/accordion/index.d.mts +10 -68
- package/dist/accordion/index.d.ts +10 -68
- package/dist/accordion/index.js +2 -325
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +114 -154
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/accordion/useRenderSlot.d.ts +3 -0
- package/dist/alert-dialog/AlertDialog.d.ts +29 -0
- package/dist/alert-dialog/AlertDialogAction.d.ts +13 -0
- package/dist/alert-dialog/AlertDialogBody.d.ts +12 -0
- package/dist/alert-dialog/AlertDialogCancel.d.ts +13 -0
- package/dist/alert-dialog/AlertDialogContent.d.ts +9 -0
- package/dist/alert-dialog/AlertDialogContext.d.ts +12 -0
- package/dist/alert-dialog/AlertDialogDescription.d.ts +9 -0
- package/dist/alert-dialog/AlertDialogFooter.d.ts +10 -0
- package/dist/alert-dialog/AlertDialogHeader.d.ts +10 -0
- package/dist/alert-dialog/AlertDialogOverlay.d.ts +9 -0
- package/dist/alert-dialog/AlertDialogPortal.d.ts +7 -0
- package/dist/alert-dialog/AlertDialogTitle.d.ts +9 -0
- package/dist/alert-dialog/AlertDialogTrigger.d.ts +13 -0
- package/dist/alert-dialog/index.d.mts +26 -147
- package/dist/alert-dialog/index.d.ts +26 -147
- package/dist/alert-dialog/index.js +2 -405
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +172 -260
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/alert-dialog/useRenderSlot.d.ts +3 -0
- package/dist/avatar/Avatar.d.ts +3 -0
- package/dist/avatar/AvatarAction.d.ts +9 -0
- package/dist/avatar/AvatarImage.d.ts +7 -0
- package/dist/avatar/AvatarOnlineBadge.d.ts +9 -0
- package/dist/avatar/AvatarPlaceholder.d.ts +8 -0
- package/dist/avatar/AvatarUser.d.ts +7 -0
- package/dist/avatar/context.d.ts +5 -0
- package/dist/avatar/index.d.mts +8 -59
- package/dist/avatar/index.d.ts +8 -59
- package/dist/avatar/index.js +2 -1323
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs +149 -207
- package/dist/avatar/index.mjs.map +1 -1
- package/dist/avatar/types.d.ts +24 -0
- package/dist/badge/Badge.d.ts +9 -0
- package/dist/badge/BadgeItem.d.ts +31 -0
- package/dist/badge/BadgeItem.styles.d.ts +7 -0
- package/dist/badge/index.d.mts +1 -47
- package/dist/badge/index.d.ts +1 -47
- package/dist/badge/index.js +2 -122
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +32 -44
- package/dist/badge/index.mjs.map +1 -1
- package/dist/breadcrumb/Breadcrumb.d.ts +10 -0
- package/dist/breadcrumb/Breadcrumb.styles.d.ts +0 -0
- package/dist/breadcrumb/BreadcrumbCurrentPage.d.ts +11 -0
- package/dist/breadcrumb/BreadcrumbItem.d.ts +9 -0
- package/dist/breadcrumb/BreadcrumbLink.d.ts +12 -0
- package/dist/breadcrumb/BreadcrumbSeparator.d.ts +10 -0
- package/dist/breadcrumb/index.d.mts +7 -59
- package/dist/breadcrumb/index.d.ts +7 -59
- package/dist/breadcrumb/index.js +2 -327
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +106 -146
- package/dist/breadcrumb/index.mjs.map +1 -1
- package/dist/button/Button.d.ts +26 -0
- package/dist/button/Button.styles.d.ts +10 -0
- package/dist/button/index.d.mts +1 -41
- package/dist/button/index.d.ts +1 -41
- package/dist/button/index.js +2 -935
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +3 -8
- package/dist/button/index.mjs.map +1 -1
- package/dist/button/variants/contrast.d.ts +45 -0
- package/dist/button/variants/filled.d.ts +45 -0
- package/dist/button/variants/ghost.d.ts +45 -0
- package/dist/button/variants/index.d.mts +5 -0
- package/dist/button/variants/index.d.ts +5 -0
- package/dist/button/variants/outlined.d.ts +45 -0
- package/dist/button/variants/tinted.d.ts +45 -0
- package/dist/card/Backdrop.d.ts +14 -0
- package/dist/card/Card.d.ts +16 -0
- package/dist/card/Card.styles.d.ts +7 -0
- package/dist/card/Content.d.ts +15 -0
- package/dist/card/Content.styles.d.ts +8 -0
- package/dist/card/context.d.ts +11 -0
- package/dist/card/index.d.mts +5 -58
- package/dist/card/index.d.ts +5 -58
- package/dist/card/index.js +2 -502
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +125 -178
- package/dist/card/index.mjs.map +1 -1
- package/dist/card/utils.d.ts +3 -0
- package/dist/carousel/Carousel.d.ts +12 -0
- package/dist/carousel/CarouselControls.d.ts +9 -0
- package/dist/carousel/CarouselNextButton.d.ts +5 -0
- package/dist/carousel/CarouselPageIndicator.d.ts +14 -0
- package/dist/carousel/CarouselPagePicker.d.ts +14 -0
- package/dist/carousel/CarouselPrevButton.d.ts +5 -0
- package/dist/carousel/CarouselSlide.d.ts +12 -0
- package/dist/carousel/CarouselSlides.d.ts +10 -0
- package/dist/carousel/CarouselViewport.d.ts +9 -0
- package/dist/carousel/index.d.mts +18 -263
- package/dist/carousel/index.d.ts +18 -263
- package/dist/carousel/index.js +2 -1882
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs +428 -650
- package/dist/carousel/index.mjs.map +1 -1
- package/dist/carousel/types.d.ts +165 -0
- package/dist/carousel/useCarousel.d.ts +2 -0
- package/dist/carousel/useCarouselVisibility.d.ts +13 -0
- package/dist/carousel/useEvent.d.ts +7 -0
- package/dist/carousel/useIsMounted.d.ts +1 -0
- package/dist/carousel/useIsVisible.d.ts +6 -0
- package/dist/carousel/useResizeObserver.d.ts +2 -0
- package/dist/carousel/useScrollEnd.d.ts +3 -0
- package/dist/carousel/useSnapPoints.d.ts +10 -0
- package/dist/carousel/utils.d.ts +24 -0
- package/dist/checkbox/Checkbox.d.ts +10 -0
- package/dist/checkbox/CheckboxGroup.d.ts +18 -0
- package/dist/checkbox/CheckboxGroup.styles.d.ts +5 -0
- package/dist/checkbox/CheckboxGroupContext.d.ts +41 -0
- package/dist/checkbox/CheckboxIndicator.d.ts +9 -0
- package/dist/checkbox/CheckboxInput.d.ts +47 -0
- package/dist/checkbox/CheckboxInput.styles.d.ts +5 -0
- package/dist/checkbox/CheckboxLabel.d.ts +12 -0
- package/dist/checkbox/CheckboxLabel.styles.d.ts +5 -0
- package/dist/checkbox/index.d.mts +2 -120
- package/dist/checkbox/index.d.ts +2 -120
- package/dist/checkbox/index.js +2 -511
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +135 -226
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chip/Chip.d.ts +34 -0
- package/dist/chip/Chip.styles.d.ts +8 -0
- package/dist/chip/ChipClearButton.d.ts +10 -0
- package/dist/chip/ChipClearButton.styles.d.ts +10 -0
- package/dist/chip/ChipContent.d.ts +8 -0
- package/dist/chip/ChipIcon.d.ts +8 -0
- package/dist/chip/ChipLeadingIcon.d.ts +9 -0
- package/dist/chip/ChipTrailingIcon.d.ts +9 -0
- package/dist/chip/index.d.mts +10 -92
- package/dist/chip/index.d.ts +10 -92
- package/dist/chip/index.js +2 -908
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs +218 -324
- package/dist/chip/index.mjs.map +1 -1
- package/dist/chip/useChipContext.d.ts +4 -0
- package/dist/chip/useChipElement.d.ts +41 -0
- package/dist/chip/variants/dashed.d.ts +49 -0
- package/dist/chip/variants/index.d.mts +3 -0
- package/dist/chip/variants/index.d.ts +3 -0
- package/dist/chip/variants/outlined.d.ts +49 -0
- package/dist/chip/variants/tinted.d.ts +49 -0
- package/dist/collapsible/Content.d.ts +12 -0
- package/dist/collapsible/Root.d.ts +12 -0
- package/dist/collapsible/Trigger.d.ts +11 -0
- package/dist/collapsible/index.d.mts +4 -40
- package/dist/collapsible/index.d.ts +4 -40
- package/dist/collapsible/index.js +2 -109
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs +39 -58
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/collapsible/useRenderSlot.d.ts +3 -0
- package/dist/combobox/Combobox.d.ts +6 -0
- package/dist/combobox/ComboboxClearButton.d.ts +9 -0
- package/dist/combobox/ComboboxContext.d.ts +108 -0
- package/dist/combobox/ComboboxDisclosure.d.ts +13 -0
- package/dist/combobox/ComboboxEmpty.d.ts +11 -0
- package/dist/combobox/ComboboxGroup.d.ts +11 -0
- package/dist/combobox/ComboboxInput.d.ts +15 -0
- package/dist/combobox/ComboboxItem.d.ts +12 -0
- package/dist/combobox/ComboboxItemContext.d.ts +17 -0
- package/dist/combobox/ComboboxItemIndicator.d.ts +11 -0
- package/dist/combobox/ComboboxItemText.d.ts +10 -0
- package/dist/combobox/ComboboxItems.d.ts +11 -0
- package/dist/combobox/ComboboxItemsGroupContext.d.ts +8 -0
- package/dist/combobox/ComboboxLabel.d.ts +11 -0
- package/dist/combobox/ComboboxLeadingIcon.d.ts +7 -0
- package/dist/combobox/ComboboxPopover.d.ts +10 -0
- package/dist/combobox/ComboboxPortal.d.ts +2 -0
- package/dist/combobox/ComboboxSelectedItems.d.ts +4 -0
- package/dist/combobox/ComboboxTrigger.d.ts +11 -0
- package/dist/combobox/ComboboxTrigger.styles.d.ts +6 -0
- package/dist/combobox/index.d.mts +19 -271
- package/dist/combobox/index.d.ts +19 -271
- package/dist/combobox/index.js +2 -2588
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +623 -1017
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/combobox/tests/test-utils.d.ts +8 -0
- package/dist/combobox/types.d.ts +8 -0
- package/dist/combobox/useCombobox/multipleSelectionReducer.d.ts +13 -0
- package/dist/combobox/useCombobox/singleSelectionReducer.d.ts +8 -0
- package/dist/combobox/utils/index.d.mts +14 -0
- package/dist/combobox/utils/index.d.ts +14 -0
- package/dist/combobox/utils/useWidthIncreaseCallback.d.ts +2 -0
- package/dist/dialog/Dialog.d.ts +32 -0
- package/dist/dialog/DialogBody.d.ts +12 -0
- package/dist/dialog/DialogClose.d.ts +9 -0
- package/dist/dialog/DialogCloseButton.d.ts +9 -0
- package/dist/dialog/DialogContent.d.ts +14 -0
- package/dist/dialog/DialogContent.styles.d.ts +6 -0
- package/dist/dialog/DialogContext.d.ts +11 -0
- package/dist/dialog/DialogDescription.d.ts +9 -0
- package/dist/dialog/DialogFooter.d.ts +10 -0
- package/dist/dialog/DialogHeader.d.ts +10 -0
- package/dist/dialog/DialogOverlay.d.ts +9 -0
- package/dist/dialog/DialogPortal.d.ts +7 -0
- package/dist/dialog/DialogTitle.d.ts +9 -0
- package/dist/dialog/DialogTrigger.d.ts +17 -0
- package/dist/dialog/index.d.mts +25 -154
- package/dist/dialog/index.d.ts +25 -154
- package/dist/dialog/index.js +2 -1389
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +163 -258
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/Divider.d.ts +30 -0
- package/dist/divider/Divider.styles.d.ts +9 -0
- package/dist/divider/DividerContent.d.ts +13 -0
- package/dist/divider/index.d.mts +4 -59
- package/dist/divider/index.d.ts +4 -59
- package/dist/divider/index.js +2 -224
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs +79 -100
- package/dist/divider/index.mjs.map +1 -1
- package/dist/divider/variants/intents.d.ts +17 -0
- package/dist/drawer/Drawer.d.ts +39 -0
- package/dist/drawer/DrawerBody.d.ts +11 -0
- package/dist/drawer/DrawerBody.styles.d.ts +5 -0
- package/dist/drawer/DrawerClose.d.ts +9 -0
- package/dist/drawer/DrawerCloseButton.d.ts +7 -0
- package/dist/drawer/DrawerContent.d.ts +10 -0
- package/dist/drawer/DrawerContent.styles.d.ts +6 -0
- package/dist/drawer/DrawerContext.d.ts +9 -0
- package/dist/drawer/DrawerDescription.d.ts +9 -0
- package/dist/drawer/DrawerFooter.d.ts +8 -0
- package/dist/drawer/DrawerHeader.d.ts +10 -0
- package/dist/drawer/DrawerOverlay.d.ts +9 -0
- package/dist/drawer/DrawerPortal.d.ts +7 -0
- package/dist/drawer/DrawerTitle.d.ts +9 -0
- package/dist/drawer/DrawerTrigger.d.ts +13 -0
- package/dist/drawer/index.d.mts +24 -141
- package/dist/drawer/index.d.ts +24 -141
- package/dist/drawer/index.js +2 -1400
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +141 -230
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown/Dropdown.d.ts +6 -0
- package/dist/dropdown/DropdownContext.d.ts +81 -0
- package/dist/dropdown/DropdownDivider.d.ts +10 -0
- package/dist/dropdown/DropdownGroup.d.ts +11 -0
- package/dist/dropdown/DropdownItem.d.ts +12 -0
- package/dist/dropdown/DropdownItemContext.d.ts +17 -0
- package/dist/dropdown/DropdownItemIndicator.d.ts +11 -0
- package/dist/dropdown/DropdownItemText.d.ts +9 -0
- package/dist/dropdown/DropdownItems.d.ts +21 -0
- package/dist/dropdown/DropdownItemsGroupContext.d.ts +8 -0
- package/dist/dropdown/DropdownLabel.d.ts +11 -0
- package/dist/dropdown/DropdownLeadingIcon.d.ts +7 -0
- package/dist/dropdown/DropdownPopover.d.ts +6 -0
- package/dist/dropdown/DropdownPortal.d.ts +2 -0
- package/dist/dropdown/DropdownTrigger.d.ts +12 -0
- package/dist/dropdown/DropdownTrigger.styles.d.ts +5 -0
- package/dist/dropdown/DropdownValue.d.ts +11 -0
- package/dist/dropdown/index.d.mts +16 -220
- package/dist/dropdown/index.d.ts +16 -220
- package/dist/dropdown/index.js +2 -2051
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +352 -584
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/dropdown/types.d.ts +8 -0
- package/dist/dropdown/useDropdown.d.ts +41 -0
- package/dist/dropdown/utils.d.ts +13 -0
- package/dist/file-upload/FileUpload.d.ts +130 -0
- package/dist/file-upload/FileUploadAcceptedFile.d.ts +25 -0
- package/dist/file-upload/FileUploadContext.d.ts +17 -0
- package/dist/file-upload/FileUploadDropzone.d.ts +10 -0
- package/dist/file-upload/FileUploadItemDeleteTrigger.d.ts +11 -0
- package/dist/file-upload/FileUploadPreviewImage.d.ts +17 -0
- package/dist/file-upload/FileUploadRejectedFile.d.ts +24 -0
- package/dist/file-upload/FileUploadRejectedFileDeleteTrigger.d.ts +12 -0
- package/dist/file-upload/FileUploadTrigger.d.ts +12 -0
- package/dist/file-upload/constants.d.ts +29 -0
- package/dist/file-upload/index.d.mts +14 -262
- package/dist/file-upload/index.d.ts +14 -262
- package/dist/file-upload/index.js +2 -2255
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs +506 -834
- package/dist/file-upload/index.mjs.map +1 -1
- package/dist/file-upload/test-utils.d.ts +9 -0
- package/dist/file-upload/useFileUploadState.d.ts +88 -0
- package/dist/file-upload/utils.d.ts +40 -0
- package/dist/form-field/FormField.d.ts +21 -0
- package/dist/form-field/FormFieldAlertMessage.d.ts +9 -0
- package/dist/form-field/FormFieldCharactersCount.d.ts +26 -0
- package/dist/form-field/FormFieldContext.d.ts +49 -0
- package/dist/form-field/FormFieldControl.d.ts +12 -0
- package/dist/form-field/FormFieldErrorMessage.d.ts +9 -0
- package/dist/form-field/FormFieldHelperMessage.d.ts +9 -0
- package/dist/form-field/FormFieldLabel.d.ts +13 -0
- package/dist/form-field/FormFieldMessage.d.ts +8 -0
- package/dist/form-field/FormFieldProvider.d.ts +9 -0
- package/dist/form-field/FormFieldRequiredIndicator.d.ts +9 -0
- package/dist/form-field/FormFieldStateMessage.d.ts +10 -0
- package/dist/form-field/FormFieldSuccessMessage.d.ts +9 -0
- package/dist/form-field/index.d.mts +21 -176
- package/dist/form-field/index.d.ts +21 -176
- package/dist/form-field/index.js +2 -553
- package/dist/form-field/index.js.map +1 -1
- package/dist/form-field/index.mjs +246 -349
- package/dist/form-field/index.mjs.map +1 -1
- package/dist/icon/Icon.d.ts +17 -0
- package/dist/icon/Icon.styles.d.ts +6 -0
- package/dist/icon/index.d.mts +1 -28
- package/dist/icon/index.d.ts +1 -28
- package/dist/icon/index.js +2 -127
- package/dist/icon/index.js.map +1 -1
- package/dist/icon/index.mjs +3 -7
- package/dist/icon/index.mjs.map +1 -1
- package/dist/icon-button/IconButton.d.ts +10 -0
- package/dist/icon-button/IconButton.styles.d.ts +5 -0
- package/dist/icon-button/index.d.mts +1 -16
- package/dist/icon-button/index.d.ts +1 -16
- package/dist/icon-button/index.js +2 -980
- package/dist/icon-button/index.js.map +1 -1
- package/dist/icon-button/index.mjs +3 -9
- package/dist/icon-button/index.mjs.map +1 -1
- package/dist/input/Input.d.ts +14 -0
- package/dist/input/Input.styles.d.ts +11 -0
- package/dist/input/InputAddon.d.ts +9 -0
- package/dist/input/InputAddon.styles.d.ts +9 -0
- package/dist/input/InputClearButton.d.ts +12 -0
- package/dist/input/InputGroup.d.ts +17 -0
- package/dist/input/InputGroup.styles.d.ts +6 -0
- package/dist/input/InputGroupContext.d.ts +14 -0
- package/dist/input/InputIcon.d.ts +6 -0
- package/dist/input/InputLeadingAddon.d.ts +11 -0
- package/dist/input/InputLeadingIcon.d.ts +7 -0
- package/dist/input/InputTrailingAddon.d.ts +11 -0
- package/dist/input/InputTrailingIcon.d.ts +7 -0
- package/dist/input/index.d.mts +15 -72
- package/dist/input/index.d.ts +15 -72
- package/dist/input/index.js +2 -724
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +453 -12
- package/dist/input/index.mjs.map +1 -1
- package/dist/input-otp/InputOTP.d.ts +85 -0
- package/dist/input-otp/InputOTP.styles.d.ts +10 -0
- package/dist/input-otp/InputOTPContext.d.ts +16 -0
- package/dist/input-otp/InputOTPGroup.d.ts +7 -0
- package/dist/input-otp/InputOTPSeparator.d.ts +7 -0
- package/dist/input-otp/InputOTPSlot.d.ts +12 -0
- package/dist/input-otp/index.d.mts +10 -128
- package/dist/input-otp/index.d.ts +10 -128
- package/dist/input-otp/index.js +2 -668
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs +295 -462
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/input-otp/useInputOTP.d.ts +45 -0
- package/dist/kbd/Kbd.d.ts +5 -0
- package/dist/kbd/index.d.mts +1 -9
- package/dist/kbd/index.d.ts +1 -9
- package/dist/kbd/index.js +2 -47
- package/dist/kbd/index.js.map +1 -1
- package/dist/kbd/index.mjs +15 -18
- package/dist/kbd/index.mjs.map +1 -1
- package/dist/label/Label.d.ts +9 -0
- package/dist/label/LabelRequiredIndicator.d.ts +6 -0
- package/dist/label/index.d.mts +5 -9
- package/dist/label/index.d.ts +5 -9
- package/dist/label/index.js +2 -78
- package/dist/label/index.js.map +1 -1
- package/dist/label/index.mjs +38 -5
- package/dist/label/index.mjs.map +1 -1
- package/dist/link-box/LinkBox.d.ts +8 -0
- package/dist/link-box/LinkBoxLink.d.ts +8 -0
- package/dist/link-box/LinkBoxRaised.d.ts +9 -0
- package/dist/link-box/index.d.mts +6 -31
- package/dist/link-box/index.d.ts +6 -31
- package/dist/link-box/index.js +2 -92
- package/dist/link-box/index.js.map +1 -1
- package/dist/link-box/index.mjs +34 -56
- package/dist/link-box/index.mjs.map +1 -1
- package/dist/pagination/Pagination.d.ts +8 -0
- package/dist/pagination/PaginationContext.d.ts +43 -0
- package/dist/pagination/PaginationEllipsis.d.ts +9 -0
- package/dist/pagination/PaginationFirstPageTrigger.d.ts +16 -0
- package/dist/pagination/PaginationItem.d.ts +17 -0
- package/dist/pagination/PaginationLastPageTrigger.d.ts +16 -0
- package/dist/pagination/PaginationNextTrigger.d.ts +16 -0
- package/dist/pagination/PaginationPages.d.ts +16 -0
- package/dist/pagination/PaginationPrevTrigger.d.ts +16 -0
- package/dist/pagination/index.d.mts +10 -135
- package/dist/pagination/index.d.ts +10 -135
- package/dist/pagination/index.js +2 -1353
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs +176 -269
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/pagination/utils.d.ts +1 -0
- package/dist/popover/Popover.d.ts +9 -0
- package/dist/popover/PopoverAnchor.d.ts +9 -0
- package/dist/popover/PopoverArrow.d.ts +9 -0
- package/dist/popover/PopoverCloseButton.d.ts +10 -0
- package/dist/popover/PopoverContent.d.ts +10 -0
- package/dist/popover/PopoverContent.styles.d.ts +9 -0
- package/dist/popover/PopoverContext.d.ts +15 -0
- package/dist/popover/PopoverHeader.d.ts +10 -0
- package/dist/popover/PopoverPortal.d.ts +7 -0
- package/dist/popover/PopoverTrigger.d.ts +9 -0
- package/dist/popover/index.d.mts +17 -6
- package/dist/popover/index.d.ts +17 -6
- package/dist/popover/index.js +2 -1339
- package/dist/popover/index.js.map +1 -1
- package/dist/popover/index.mjs +239 -11
- package/dist/popover/index.mjs.map +1 -1
- package/dist/portal/Portal.d.ts +10 -0
- package/dist/portal/index.d.mts +1 -13
- package/dist/portal/index.d.ts +1 -13
- package/dist/portal/index.js +2 -37
- package/dist/portal/index.js.map +1 -1
- package/dist/portal/index.mjs +5 -8
- package/dist/portal/index.mjs.map +1 -1
- package/dist/progress/Progress.d.ts +16 -0
- package/dist/progress/ProgressBar.d.ts +6 -0
- package/dist/progress/ProgressBar.styles.d.ts +5 -0
- package/dist/progress/ProgressContext.d.ts +13 -0
- package/dist/progress/ProgressIndicator.d.ts +6 -0
- package/dist/progress/ProgressIndicator.styles.d.ts +7 -0
- package/dist/progress/ProgressLabel.d.ts +6 -0
- package/dist/progress/index.d.mts +9 -48
- package/dist/progress/index.d.ts +9 -48
- package/dist/progress/index.js +2 -240
- package/dist/progress/index.js.map +1 -1
- package/dist/progress/index.mjs +166 -5
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress-tracker/ProgressTracker.d.ts +27 -0
- package/dist/progress-tracker/ProgressTracker.styles.d.ts +1 -0
- package/dist/progress-tracker/ProgressTrackerContext.d.ts +15 -0
- package/dist/progress-tracker/ProgressTrackerStep.d.ts +12 -0
- package/dist/progress-tracker/ProgressTrackerStep.styles.d.ts +10 -0
- package/dist/progress-tracker/ProgressTrackerStepIndicator.d.ts +15 -0
- package/dist/progress-tracker/ProgressTrackerStepIndicator.styles.d.ts +7 -0
- package/dist/progress-tracker/ProgressTrackerStepLabel.d.ts +9 -0
- package/dist/progress-tracker/index.d.mts +10 -80
- package/dist/progress-tracker/index.d.ts +10 -80
- package/dist/progress-tracker/index.js +2 -571
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +115 -183
- package/dist/progress-tracker/index.mjs.map +1 -1
- package/dist/radio-group/Radio.d.ts +9 -0
- package/dist/radio-group/RadioGroup.d.ts +54 -0
- package/dist/radio-group/RadioGroup.styles.d.ts +5 -0
- package/dist/radio-group/RadioGroupContext.d.ts +5 -0
- package/dist/radio-group/RadioGroupProvider.d.ts +7 -0
- package/dist/radio-group/RadioIndicator.d.ts +18 -0
- package/dist/radio-group/RadioIndicator.styles.d.ts +5 -0
- package/dist/radio-group/RadioInput.d.ts +25 -0
- package/dist/radio-group/RadioInput.styles.d.ts +5 -0
- package/dist/radio-group/RadioLabel.d.ts +20 -0
- package/dist/radio-group/RadioLabel.styles.d.ts +5 -0
- package/dist/radio-group/index.d.mts +5 -98
- package/dist/radio-group/index.d.ts +5 -98
- package/dist/radio-group/index.js +2 -318
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +105 -174
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/Rating.d.ts +52 -0
- package/dist/rating/RatingStar.d.ts +10 -0
- package/dist/rating/RatingStar.styles.d.ts +14 -0
- package/dist/rating/index.d.mts +1 -78
- package/dist/rating/index.d.ts +1 -78
- package/dist/rating/index.js +2 -363
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +125 -170
- package/dist/rating/index.mjs.map +1 -1
- package/dist/rating/types.d.ts +1 -0
- package/dist/rating/utils.d.ts +8 -0
- package/dist/scrolling-list/ScrollingList.d.ts +57 -0
- package/dist/scrolling-list/ScrollingListControls.d.ts +18 -0
- package/dist/scrolling-list/ScrollingListItem.d.ts +17 -0
- package/dist/scrolling-list/ScrollingListItems.d.ts +11 -0
- package/dist/scrolling-list/ScrollingListNextButton.d.ts +5 -0
- package/dist/scrolling-list/ScrollingListPrevButton.d.ts +5 -0
- package/dist/scrolling-list/ScrollingListSkipButton.d.ts +9 -0
- package/dist/scrolling-list/index.d.mts +14 -117
- package/dist/scrolling-list/index.d.ts +14 -117
- package/dist/scrolling-list/index.js +2 -1428
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +193 -325
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/scrolling-list/useFocusWithinScroll.d.ts +3 -0
- package/dist/segmented-gauge/SegmentedGauge.d.ts +66 -0
- package/dist/segmented-gauge/SegmentedGaugeContext.d.ts +14 -0
- package/dist/segmented-gauge/SegmentedGaugeLabel.d.ts +9 -0
- package/dist/segmented-gauge/SegmentedGaugeSegment.d.ts +12 -0
- package/dist/segmented-gauge/SegmentedGaugeTrack.d.ts +8 -0
- package/dist/segmented-gauge/index.d.mts +9 -101
- package/dist/segmented-gauge/index.d.ts +9 -101
- package/dist/segmented-gauge/index.js +2 -274
- package/dist/segmented-gauge/index.js.map +1 -1
- package/dist/segmented-gauge/index.mjs +132 -178
- package/dist/segmented-gauge/index.mjs.map +1 -1
- package/dist/select/Select.d.ts +6 -0
- package/dist/select/SelectContext.d.ts +59 -0
- package/dist/select/SelectGroup.d.ts +11 -0
- package/dist/select/SelectItem.d.ts +11 -0
- package/dist/select/SelectItems.d.ts +10 -0
- package/dist/select/SelectItemsGroupContext.d.ts +9 -0
- package/dist/select/SelectLabel.d.ts +8 -0
- package/dist/select/SelectLeadingIcon.d.ts +7 -0
- package/dist/select/SelectPlaceholder.d.ts +10 -0
- package/dist/select/SelectTrigger.d.ts +16 -0
- package/dist/select/SelectTrigger.styles.d.ts +5 -0
- package/dist/select/SelectValue.d.ts +15 -0
- package/dist/select/index.d.mts +12 -158
- package/dist/select/index.d.ts +12 -158
- package/dist/select/index.js +2 -581
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +207 -339
- package/dist/select/index.mjs.map +1 -1
- package/dist/select/types.d.ts +6 -0
- package/dist/select/utils.d.ts +4 -0
- package/dist/skeleton/Skeleton.d.ts +17 -0
- package/dist/skeleton/Skeleton.styles.d.ts +5 -0
- package/dist/skeleton/SkeletonItem.d.ts +31 -0
- package/dist/skeleton/SkeletonItem.styles.d.ts +8 -0
- package/dist/skeleton/index.d.mts +8 -67
- package/dist/skeleton/index.d.ts +8 -67
- package/dist/skeleton/index.js +2 -206
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +64 -96
- package/dist/skeleton/index.mjs.map +1 -1
- package/dist/slider/Slider.d.ts +60 -0
- package/dist/slider/Slider.styles.d.ts +1 -0
- package/dist/slider/SliderContext.d.ts +7 -0
- package/dist/slider/SliderThumb.d.ts +14 -0
- package/dist/slider/SliderThumb.styles.d.ts +5 -0
- package/dist/slider/SliderTrack.d.ts +14 -0
- package/dist/slider/SliderTrack.styles.d.ts +9 -0
- package/dist/slider/index.d.mts +8 -97
- package/dist/slider/index.d.ts +8 -97
- package/dist/slider/index.js +2 -220
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs +94 -111
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slot/Slot.d.ts +12 -0
- package/dist/slot/index.d.mts +1 -16
- package/dist/slot/index.d.ts +1 -16
- package/dist/slot/index.js +2 -51
- package/dist/slot/index.js.map +1 -1
- package/dist/slot/index.mjs +5 -9
- package/dist/slot/index.mjs.map +1 -1
- package/dist/snackbar/Snackbar.d.ts +29 -0
- package/dist/snackbar/SnackbarItem.d.ts +49 -0
- package/dist/snackbar/SnackbarItem.styles.d.ts +10 -0
- package/dist/snackbar/SnackbarItemAction.d.ts +10 -0
- package/dist/snackbar/SnackbarItemClose.d.ts +9 -0
- package/dist/snackbar/SnackbarItemContext.d.ts +8 -0
- package/dist/snackbar/SnackbarItemIcon.d.ts +7 -0
- package/dist/snackbar/SnackbarRegion.d.ts +30 -0
- package/dist/snackbar/SnackbarRegion.styles.d.ts +5 -0
- package/dist/snackbar/index.d.mts +13 -158
- package/dist/snackbar/index.d.ts +13 -158
- package/dist/snackbar/index.js +2 -1756
- package/dist/snackbar/index.js.map +1 -1
- package/dist/snackbar/index.mjs +237 -429
- package/dist/snackbar/index.mjs.map +1 -1
- package/dist/snackbar/snackbarVariants.d.ts +82 -0
- package/dist/snackbar/useSnackbarGlobalStore.d.ts +18 -0
- package/dist/snackbar/useSwipe.d.ts +15 -0
- package/dist/spinner/Spinner.d.ts +9 -0
- package/dist/spinner/Spinner.styles.d.ts +7 -0
- package/dist/spinner/index.d.mts +1 -21
- package/dist/spinner/index.d.ts +1 -21
- package/dist/spinner/index.js +2 -139
- package/dist/spinner/index.js.map +1 -1
- package/dist/spinner/index.mjs +3 -7
- package/dist/spinner/index.mjs.map +1 -1
- package/dist/stepper/Stepper.d.ts +9 -0
- package/dist/stepper/StepperButton.d.ts +14 -0
- package/dist/stepper/StepperInput.d.ts +7 -0
- package/dist/stepper/index.d.mts +9 -81
- package/dist/stepper/index.d.ts +9 -81
- package/dist/stepper/index.js +2 -1847
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +143 -195
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/stepper/types.d.ts +46 -0
- package/dist/stepper/useStepper.d.ts +2 -0
- package/dist/switch/Switch.d.ts +6 -0
- package/dist/switch/SwitchInput.d.ts +51 -0
- package/dist/switch/SwitchInput.styles.d.ts +16 -0
- package/dist/switch/SwitchLabel.d.ts +17 -0
- package/dist/switch/SwitchLabel.styles.d.ts +5 -0
- package/dist/switch/index.d.mts +1 -64
- package/dist/switch/index.d.ts +1 -64
- package/dist/switch/index.js +2 -327
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +90 -130
- package/dist/switch/index.mjs.map +1 -1
- package/dist/tabs/Tabs.d.ts +24 -0
- package/dist/tabs/TabsContent.d.ts +22 -0
- package/dist/tabs/TabsContent.styles.d.ts +3 -0
- package/dist/tabs/TabsContext.d.ts +7 -0
- package/dist/tabs/TabsList.d.ts +20 -0
- package/dist/tabs/TabsList.styles.d.ts +3 -0
- package/dist/tabs/TabsPopover.d.ts +29 -0
- package/dist/tabs/TabsPopoverAbstraction.d.ts +27 -0
- package/dist/tabs/TabsRoot.styles.d.ts +1 -0
- package/dist/tabs/TabsTrigger.d.ts +41 -0
- package/dist/tabs/TabsTrigger.styles.d.ts +8 -0
- package/dist/tabs/index.d.mts +13 -137
- package/dist/tabs/index.d.ts +13 -137
- package/dist/tabs/index.js +2 -1830
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +224 -350
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tabs/useResizeObserver.d.ts +8 -0
- package/dist/tag/Tag.d.ts +17 -0
- package/dist/tag/Tag.styles.d.ts +8 -0
- package/dist/tag/index.d.mts +1 -29
- package/dist/tag/index.d.ts +1 -29
- package/dist/tag/index.js +2 -283
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/index.mjs +66 -90
- package/dist/tag/index.mjs.map +1 -1
- package/dist/tag/variants/filled.d.ts +41 -0
- package/dist/tag/variants/index.d.mts +3 -0
- package/dist/tag/variants/index.d.ts +3 -0
- package/dist/tag/variants/outlined.d.ts +37 -0
- package/dist/tag/variants/tinted.d.ts +37 -0
- package/dist/text-link/TextLink.d.ts +16 -0
- package/dist/text-link/index.d.mts +1 -20
- package/dist/text-link/index.d.ts +1 -20
- package/dist/text-link/index.js +2 -100
- package/dist/text-link/index.js.map +1 -1
- package/dist/text-link/index.mjs +3 -6
- package/dist/text-link/index.mjs.map +1 -1
- package/dist/textarea/Textarea.d.ts +14 -0
- package/dist/textarea/TextareaClearButton.d.ts +10 -0
- package/dist/textarea/TextareaGroup.d.ts +6 -0
- package/dist/textarea/TextareaLeadingIcon.d.ts +7 -0
- package/dist/textarea/TextareaTrailingIcon.d.ts +7 -0
- package/dist/textarea/index.d.mts +10 -53
- package/dist/textarea/index.d.ts +10 -53
- package/dist/textarea/index.js +2 -797
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +50 -83
- package/dist/textarea/index.mjs.map +1 -1
- package/dist/toast/Toast.d.ts +4 -0
- package/dist/toast/Toast.styles.d.ts +10 -0
- package/dist/toast/index.d.mts +10 -53
- package/dist/toast/index.d.ts +10 -53
- package/dist/toast/index.js +2 -1454
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/index.mjs +126 -180
- package/dist/toast/index.mjs.map +1 -1
- package/dist/toast/types.d.ts +41 -0
- package/dist/toast/useRenderSlot.d.ts +3 -0
- package/dist/toast/useToastManager.d.ts +2 -0
- package/dist/visually-hidden/VisuallyHidden.d.ts +12 -0
- package/dist/visually-hidden/index.d.mts +1 -16
- package/dist/visually-hidden/index.d.ts +1 -16
- package/dist/visually-hidden/index.js +2 -67
- package/dist/visually-hidden/index.js.map +1 -1
- package/dist/visually-hidden/index.mjs +3 -6
- package/dist/visually-hidden/index.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/Input-N8AWWSmt.d.mts +0 -41
- package/dist/Input-N8AWWSmt.d.ts +0 -41
- package/dist/InputTrailingIcon-BBp7sE6D.d.mts +0 -20
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +0 -20
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.mts +0 -19
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +0 -19
- package/dist/chunk-2YM6GKWW.mjs.map +0 -1
- package/dist/chunk-6QCEPQ3U.mjs +0 -26
- package/dist/chunk-6QCEPQ3U.mjs.map +0 -1
- package/dist/chunk-7EWSMIZU.mjs +0 -214
- package/dist/chunk-7EWSMIZU.mjs.map +0 -1
- package/dist/chunk-DCXWGQVZ.mjs +0 -53
- package/dist/chunk-DCXWGQVZ.mjs.map +0 -1
- package/dist/chunk-GAK4SC2F.mjs.map +0 -1
- package/dist/chunk-GPJMLIHC.mjs +0 -308
- package/dist/chunk-GPJMLIHC.mjs.map +0 -1
- package/dist/chunk-HLXYG643.mjs +0 -52
- package/dist/chunk-HLXYG643.mjs.map +0 -1
- package/dist/chunk-KEGAAGJW.mjs +0 -36
- package/dist/chunk-KEGAAGJW.mjs.map +0 -1
- package/dist/chunk-RKPP7ZOK.mjs.map +0 -1
- package/dist/chunk-UMUMFMFB.mjs +0 -68
- package/dist/chunk-UMUMFMFB.mjs.map +0 -1
- package/dist/chunk-VBX7BTNU.mjs +0 -614
- package/dist/chunk-VBX7BTNU.mjs.map +0 -1
- package/dist/chunk-XZ47F6TP.mjs.map +0 -1
- package/dist/index-Cno_GFuW.d.mts +0 -93
- package/dist/index-Cno_GFuW.d.ts +0 -93
package/dist/carousel/index.js
CHANGED
|
@@ -1,1882 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/carousel/index.ts
|
|
21
|
-
var carousel_exports = {};
|
|
22
|
-
__export(carousel_exports, {
|
|
23
|
-
Carousel: () => Carousel2
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(carousel_exports);
|
|
26
|
-
|
|
27
|
-
// src/carousel/Carousel.tsx
|
|
28
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
29
|
-
var import_react8 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/carousel/useCarousel.ts
|
|
32
|
-
var import_react7 = require("react");
|
|
33
|
-
|
|
34
|
-
// src/carousel/useCarouselVisibility.ts
|
|
35
|
-
var import_react = require("react");
|
|
36
|
-
function useCarouselVisibility(carouselRef) {
|
|
37
|
-
const slideVisibilityMap = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
38
|
-
const visibilityObserverRef = (0, import_react.useRef)(null);
|
|
39
|
-
const visibilityCallbacksRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
40
|
-
const createObserverCallback = (0, import_react.useCallback)(() => {
|
|
41
|
-
return (entries) => {
|
|
42
|
-
entries.forEach((entry) => {
|
|
43
|
-
const isVisible = entry.isIntersecting;
|
|
44
|
-
const element = entry.target;
|
|
45
|
-
slideVisibilityMap.current.set(element, isVisible);
|
|
46
|
-
const callback = visibilityCallbacksRef.current.get(element);
|
|
47
|
-
if (callback) {
|
|
48
|
-
callback(isVisible);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
53
|
-
const getOrCreateObserver = (0, import_react.useCallback)(() => {
|
|
54
|
-
if (visibilityObserverRef.current) {
|
|
55
|
-
return visibilityObserverRef.current;
|
|
56
|
-
}
|
|
57
|
-
const container = carouselRef.current;
|
|
58
|
-
if (!container) return null;
|
|
59
|
-
const observer = new IntersectionObserver(createObserverCallback(), {
|
|
60
|
-
root: container,
|
|
61
|
-
threshold: 0.2
|
|
62
|
-
});
|
|
63
|
-
visibilityObserverRef.current = observer;
|
|
64
|
-
return observer;
|
|
65
|
-
}, [carouselRef, createObserverCallback]);
|
|
66
|
-
(0, import_react.useEffect)(() => {
|
|
67
|
-
const observer = getOrCreateObserver();
|
|
68
|
-
const visibilityMap = slideVisibilityMap.current;
|
|
69
|
-
const callbacksMap = visibilityCallbacksRef.current;
|
|
70
|
-
return () => {
|
|
71
|
-
if (observer) {
|
|
72
|
-
observer.disconnect();
|
|
73
|
-
visibilityMap.clear();
|
|
74
|
-
callbacksMap.clear();
|
|
75
|
-
visibilityObserverRef.current = null;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}, [getOrCreateObserver]);
|
|
79
|
-
const registerSlide = (0, import_react.useCallback)(
|
|
80
|
-
(element, callback) => {
|
|
81
|
-
if (!element) return;
|
|
82
|
-
const observer = getOrCreateObserver();
|
|
83
|
-
if (!observer) {
|
|
84
|
-
setTimeout(() => registerSlide(element, callback), 0);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const initialVisible = slideVisibilityMap.current.get(element) ?? true;
|
|
88
|
-
slideVisibilityMap.current.set(element, initialVisible);
|
|
89
|
-
visibilityCallbacksRef.current.set(element, callback);
|
|
90
|
-
observer.observe(element);
|
|
91
|
-
callback(initialVisible);
|
|
92
|
-
},
|
|
93
|
-
[getOrCreateObserver]
|
|
94
|
-
);
|
|
95
|
-
const unregisterSlide = (0, import_react.useCallback)((element) => {
|
|
96
|
-
if (!element) return;
|
|
97
|
-
const observer = visibilityObserverRef.current;
|
|
98
|
-
if (observer) {
|
|
99
|
-
observer.unobserve(element);
|
|
100
|
-
}
|
|
101
|
-
slideVisibilityMap.current.delete(element);
|
|
102
|
-
visibilityCallbacksRef.current.delete(element);
|
|
103
|
-
}, []);
|
|
104
|
-
const isSlideVisible = (0, import_react.useCallback)((element) => {
|
|
105
|
-
if (!element) return true;
|
|
106
|
-
return slideVisibilityMap.current.get(element) ?? true;
|
|
107
|
-
}, []);
|
|
108
|
-
return {
|
|
109
|
-
registerSlide,
|
|
110
|
-
unregisterSlide,
|
|
111
|
-
isSlideVisible
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/carousel/useEvent.ts
|
|
116
|
-
var import_react2 = require("react");
|
|
117
|
-
function useEvent(callback) {
|
|
118
|
-
const ref = (0, import_react2.useRef)(() => {
|
|
119
|
-
throw new Error("Cannot call an event handler while rendering.");
|
|
120
|
-
});
|
|
121
|
-
(0, import_react2.useLayoutEffect)(() => {
|
|
122
|
-
ref.current = callback;
|
|
123
|
-
});
|
|
124
|
-
return (0, import_react2.useCallback)((...args) => ref.current?.(...args), []);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// src/carousel/useIsMounted.ts
|
|
128
|
-
var import_react3 = require("react");
|
|
129
|
-
var useIsMounted = () => {
|
|
130
|
-
const isMounted = (0, import_react3.useRef)(false);
|
|
131
|
-
(0, import_react3.useEffect)(() => {
|
|
132
|
-
isMounted.current = true;
|
|
133
|
-
return () => {
|
|
134
|
-
isMounted.current = false;
|
|
135
|
-
};
|
|
136
|
-
}, []);
|
|
137
|
-
return isMounted;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
// src/carousel/useScrollEnd.ts
|
|
141
|
-
var import_react4 = require("react");
|
|
142
|
-
function useScrollEnd(scrollRef, callback) {
|
|
143
|
-
const scrollLeft = (0, import_react4.useRef)(0);
|
|
144
|
-
const safariTimeout = (0, import_react4.useRef)(null);
|
|
145
|
-
(0, import_react4.useEffect)(() => {
|
|
146
|
-
const element = scrollRef.current;
|
|
147
|
-
if (!element) return;
|
|
148
|
-
const supportsScrollend = "onscrollend" in window;
|
|
149
|
-
const handleScrollEnd = () => {
|
|
150
|
-
callback();
|
|
151
|
-
};
|
|
152
|
-
const handleSafariScroll = () => {
|
|
153
|
-
if (safariTimeout.current) {
|
|
154
|
-
clearTimeout(safariTimeout.current);
|
|
155
|
-
}
|
|
156
|
-
if (scrollRef.current) {
|
|
157
|
-
scrollLeft.current = scrollRef.current.scrollLeft;
|
|
158
|
-
safariTimeout.current = setTimeout(() => {
|
|
159
|
-
if (scrollRef.current) {
|
|
160
|
-
handleScrollEnd();
|
|
161
|
-
}
|
|
162
|
-
}, 150);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
if (supportsScrollend) {
|
|
166
|
-
element.addEventListener("scrollend", handleScrollEnd);
|
|
167
|
-
} else {
|
|
168
|
-
element.addEventListener("scroll", handleSafariScroll);
|
|
169
|
-
}
|
|
170
|
-
return () => {
|
|
171
|
-
if (safariTimeout.current) {
|
|
172
|
-
clearTimeout(safariTimeout.current);
|
|
173
|
-
}
|
|
174
|
-
if (supportsScrollend) {
|
|
175
|
-
element.removeEventListener("scrollend", handleScrollEnd);
|
|
176
|
-
} else {
|
|
177
|
-
element.removeEventListener("scroll", handleSafariScroll);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}, [callback, scrollRef]);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// src/carousel/useSnapPoints.ts
|
|
184
|
-
var import_react6 = require("react");
|
|
185
|
-
|
|
186
|
-
// src/carousel/useResizeObserver.ts
|
|
187
|
-
var import_react5 = require("react");
|
|
188
|
-
function useResizeObserver(ref, callback) {
|
|
189
|
-
(0, import_react5.useLayoutEffect)(() => {
|
|
190
|
-
const element = ref.current;
|
|
191
|
-
if (!element) return;
|
|
192
|
-
const observer = new ResizeObserver((entries) => {
|
|
193
|
-
for (const entry of entries) {
|
|
194
|
-
callback(entry.contentRect.width);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
observer.observe(element);
|
|
198
|
-
return () => observer.disconnect();
|
|
199
|
-
}, [ref, callback]);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// src/carousel/utils.ts
|
|
203
|
-
function getSnapIndices({
|
|
204
|
-
totalSlides,
|
|
205
|
-
slidesPerMove,
|
|
206
|
-
slidesPerPage
|
|
207
|
-
}) {
|
|
208
|
-
const slideBy = slidesPerMove === "auto" ? slidesPerPage : slidesPerMove;
|
|
209
|
-
const snapPoints = [];
|
|
210
|
-
const lastSnapIndex = Math.floor((totalSlides - slidesPerPage) / slideBy) * slideBy;
|
|
211
|
-
for (let i = 0; i <= lastSnapIndex; i += slideBy) {
|
|
212
|
-
snapPoints.push(i);
|
|
213
|
-
}
|
|
214
|
-
if (snapPoints[snapPoints.length - 1] !== totalSlides - slidesPerPage) {
|
|
215
|
-
snapPoints.push(totalSlides - slidesPerPage);
|
|
216
|
-
}
|
|
217
|
-
return snapPoints;
|
|
218
|
-
}
|
|
219
|
-
function getSlideElements(container) {
|
|
220
|
-
return container ? Array.from(container.querySelectorAll('[data-part="item"]')) : [];
|
|
221
|
-
}
|
|
222
|
-
function isSnapPoint(slideIndex, {
|
|
223
|
-
container,
|
|
224
|
-
slidesPerMove,
|
|
225
|
-
slidesPerPage
|
|
226
|
-
}) {
|
|
227
|
-
return getSnapIndices({
|
|
228
|
-
totalSlides: getSlideElements(container).length,
|
|
229
|
-
slidesPerPage,
|
|
230
|
-
slidesPerMove
|
|
231
|
-
}).includes(slideIndex);
|
|
232
|
-
}
|
|
233
|
-
function getSnapPositions({
|
|
234
|
-
container,
|
|
235
|
-
slidesPerMove,
|
|
236
|
-
slidesPerPage
|
|
237
|
-
}) {
|
|
238
|
-
if (!container) return [];
|
|
239
|
-
return getSlideElements(container).filter((_, index) => {
|
|
240
|
-
return isSnapPoint(index, {
|
|
241
|
-
slidesPerMove,
|
|
242
|
-
slidesPerPage,
|
|
243
|
-
container
|
|
244
|
-
});
|
|
245
|
-
}).map((slide) => slide.offsetLeft);
|
|
246
|
-
}
|
|
247
|
-
function computeDotState({
|
|
248
|
-
dotIndex,
|
|
249
|
-
pageState,
|
|
250
|
-
totalPages,
|
|
251
|
-
maxDots = 5
|
|
252
|
-
}) {
|
|
253
|
-
if (totalPages <= maxDots) {
|
|
254
|
-
return dotIndex === pageState ? "active" : "idle";
|
|
255
|
-
}
|
|
256
|
-
if (pageState <= Math.floor(maxDots / 2)) {
|
|
257
|
-
if (dotIndex > maxDots - 1) return "hidden";
|
|
258
|
-
if (dotIndex === pageState) return "active";
|
|
259
|
-
if (dotIndex === maxDots - 1) return "edge";
|
|
260
|
-
return "idle";
|
|
261
|
-
}
|
|
262
|
-
if (pageState >= totalPages - Math.ceil(maxDots / 2)) {
|
|
263
|
-
const startIndex2 = totalPages - maxDots;
|
|
264
|
-
if (dotIndex < startIndex2) return "hidden";
|
|
265
|
-
if (dotIndex === pageState) return "active";
|
|
266
|
-
if (dotIndex === startIndex2) return "edge";
|
|
267
|
-
return "idle";
|
|
268
|
-
}
|
|
269
|
-
const startIndex = pageState - Math.floor(maxDots / 2);
|
|
270
|
-
const endIndex = pageState + Math.floor(maxDots / 2);
|
|
271
|
-
if (dotIndex < startIndex || dotIndex > endIndex) return "hidden";
|
|
272
|
-
if (dotIndex === pageState) return "active";
|
|
273
|
-
if (dotIndex === startIndex || dotIndex === endIndex) return "edge";
|
|
274
|
-
return "idle";
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// src/carousel/useSnapPoints.ts
|
|
278
|
-
function useSnapPoints(initialSnapPoints = [], {
|
|
279
|
-
carouselRef,
|
|
280
|
-
slidesPerMove,
|
|
281
|
-
slidesPerPage
|
|
282
|
-
}) {
|
|
283
|
-
const [pageSnapPoints, setPageSnapPoints] = (0, import_react6.useState)(initialSnapPoints);
|
|
284
|
-
const stableSnapPoints = (0, import_react6.useMemo)(() => pageSnapPoints, [pageSnapPoints]);
|
|
285
|
-
useResizeObserver(carouselRef, () => {
|
|
286
|
-
const newSnapPoints = getSnapPositions({
|
|
287
|
-
slidesPerMove,
|
|
288
|
-
slidesPerPage,
|
|
289
|
-
container: carouselRef.current
|
|
290
|
-
});
|
|
291
|
-
if (JSON.stringify(pageSnapPoints) !== JSON.stringify(newSnapPoints)) {
|
|
292
|
-
setPageSnapPoints(newSnapPoints);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
return [stableSnapPoints, setPageSnapPoints];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// src/carousel/useCarousel.ts
|
|
299
|
-
var DATA_SCOPE = "carousel";
|
|
300
|
-
var DIRECTION = "ltr";
|
|
301
|
-
var useCarousel = ({
|
|
302
|
-
defaultPage,
|
|
303
|
-
gap = 16,
|
|
304
|
-
snapType = "mandatory",
|
|
305
|
-
snapStop = "always",
|
|
306
|
-
scrollPadding = 0,
|
|
307
|
-
slidesPerPage = 1,
|
|
308
|
-
slidesPerMove = "auto",
|
|
309
|
-
scrollBehavior = "smooth",
|
|
310
|
-
loop = false,
|
|
311
|
-
pagePickerInset = false,
|
|
312
|
-
maxDots = 5,
|
|
313
|
-
// state control
|
|
314
|
-
page: controlledPage,
|
|
315
|
-
onPageChange: onPageChangeProp
|
|
316
|
-
}) => {
|
|
317
|
-
const carouselId = (0, import_react7.useId)();
|
|
318
|
-
const [pageState, setPageState] = (0, import_react7.useState)(defaultPage || controlledPage || 0);
|
|
319
|
-
const carouselRef = (0, import_react7.useRef)(null);
|
|
320
|
-
const pageIndicatorsRefs = (0, import_react7.useRef)([]);
|
|
321
|
-
const isMountedRef = useIsMounted();
|
|
322
|
-
const isMounted = isMountedRef.current;
|
|
323
|
-
const onPageChange = useEvent(onPageChangeProp);
|
|
324
|
-
const { registerSlide, unregisterSlide, isSlideVisible } = useCarouselVisibility(carouselRef);
|
|
325
|
-
const [pageSnapPoints] = useSnapPoints([], {
|
|
326
|
-
carouselRef,
|
|
327
|
-
slidesPerMove,
|
|
328
|
-
slidesPerPage
|
|
329
|
-
});
|
|
330
|
-
const canScrollPrev = (0, import_react7.useRef)(loop || pageState > 0);
|
|
331
|
-
const canScrollNext = (0, import_react7.useRef)(loop || pageState < pageSnapPoints.length - 1);
|
|
332
|
-
canScrollPrev.current = loop || pageState > 0;
|
|
333
|
-
canScrollNext.current = loop || pageState < pageSnapPoints.length - 1;
|
|
334
|
-
const handlePageChange = (0, import_react7.useCallback)(
|
|
335
|
-
(page) => {
|
|
336
|
-
if (page !== pageState) {
|
|
337
|
-
setPageState(page);
|
|
338
|
-
onPageChange?.(page);
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
[onPageChange, pageState]
|
|
342
|
-
);
|
|
343
|
-
const scrollTo = (0, import_react7.useCallback)(
|
|
344
|
-
(page, behavior) => {
|
|
345
|
-
if (carouselRef.current) {
|
|
346
|
-
carouselRef.current.scrollTo({
|
|
347
|
-
left: pageSnapPoints[page],
|
|
348
|
-
behavior: behavior === "instant" ? "auto" : "smooth"
|
|
349
|
-
});
|
|
350
|
-
handlePageChange(page);
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
[handlePageChange, pageSnapPoints]
|
|
354
|
-
);
|
|
355
|
-
const scrollPrev = (0, import_react7.useCallback)(
|
|
356
|
-
(cb) => {
|
|
357
|
-
if (canScrollPrev) {
|
|
358
|
-
const targetPage = loop && pageState === 0 ? pageSnapPoints.length - 1 : Math.max(pageState - 1, 0);
|
|
359
|
-
scrollTo(targetPage, scrollBehavior);
|
|
360
|
-
cb?.(targetPage);
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
[loop, pageSnapPoints, pageState, scrollBehavior, scrollTo]
|
|
364
|
-
);
|
|
365
|
-
const scrollNext = (0, import_react7.useCallback)(
|
|
366
|
-
(cb) => {
|
|
367
|
-
if (canScrollNext) {
|
|
368
|
-
const targetPage = loop && pageState === pageSnapPoints.length - 1 ? 0 : Math.min(pageState + 1, pageSnapPoints.length - 1);
|
|
369
|
-
scrollTo(targetPage, scrollBehavior);
|
|
370
|
-
cb?.(targetPage);
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
[loop, pageSnapPoints, pageState, scrollBehavior, scrollTo]
|
|
374
|
-
);
|
|
375
|
-
(0, import_react7.useEffect)(() => {
|
|
376
|
-
if (controlledPage != null) {
|
|
377
|
-
scrollTo(controlledPage, scrollBehavior);
|
|
378
|
-
}
|
|
379
|
-
}, [controlledPage, scrollBehavior, scrollTo]);
|
|
380
|
-
(0, import_react7.useLayoutEffect)(() => {
|
|
381
|
-
if (defaultPage != null && !isMounted && carouselRef.current) {
|
|
382
|
-
const snapPositions = getSnapPositions({
|
|
383
|
-
container: carouselRef.current,
|
|
384
|
-
slidesPerMove,
|
|
385
|
-
slidesPerPage
|
|
386
|
-
});
|
|
387
|
-
carouselRef.current.scrollTo({
|
|
388
|
-
left: snapPositions[defaultPage],
|
|
389
|
-
behavior: "instant"
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
}, [defaultPage, isMounted, slidesPerMove, slidesPerPage]);
|
|
393
|
-
const syncPageStateWithScrollPosition = (0, import_react7.useCallback)(() => {
|
|
394
|
-
if (!carouselRef.current || pageSnapPoints.length === 0) return;
|
|
395
|
-
const { scrollLeft } = carouselRef.current;
|
|
396
|
-
const distances = pageSnapPoints.map((pagePosition) => Math.abs(scrollLeft - pagePosition));
|
|
397
|
-
const pageInViewport = distances.indexOf(Math.min(...distances));
|
|
398
|
-
if (pageInViewport !== -1) {
|
|
399
|
-
handlePageChange(pageInViewport);
|
|
400
|
-
}
|
|
401
|
-
}, [pageSnapPoints, handlePageChange]);
|
|
402
|
-
useScrollEnd(carouselRef, syncPageStateWithScrollPosition);
|
|
403
|
-
const contextValue = {
|
|
404
|
-
ref: carouselRef,
|
|
405
|
-
pageIndicatorsRefs,
|
|
406
|
-
// props
|
|
407
|
-
gap,
|
|
408
|
-
snapType,
|
|
409
|
-
snapStop,
|
|
410
|
-
scrollPadding,
|
|
411
|
-
slidesPerPage,
|
|
412
|
-
slidesPerMove,
|
|
413
|
-
scrollBehavior,
|
|
414
|
-
loop,
|
|
415
|
-
pagePickerInset,
|
|
416
|
-
maxDots,
|
|
417
|
-
// computed state
|
|
418
|
-
page: pageState,
|
|
419
|
-
pageSnapPoints,
|
|
420
|
-
canScrollNext: canScrollNext.current,
|
|
421
|
-
canScrollPrev: canScrollPrev.current,
|
|
422
|
-
scrollTo,
|
|
423
|
-
scrollPrev,
|
|
424
|
-
scrollNext,
|
|
425
|
-
// visibility management
|
|
426
|
-
registerSlide,
|
|
427
|
-
unregisterSlide,
|
|
428
|
-
isSlideVisible,
|
|
429
|
-
// anatomy
|
|
430
|
-
getRootProps: () => ({
|
|
431
|
-
id: `carousel::${carouselId}:`,
|
|
432
|
-
role: "region",
|
|
433
|
-
"aria-roledescription": "carousel",
|
|
434
|
-
"data-scope": DATA_SCOPE,
|
|
435
|
-
"data-part": "root",
|
|
436
|
-
"data-orientation": "horizontal",
|
|
437
|
-
dir: DIRECTION,
|
|
438
|
-
style: {
|
|
439
|
-
"--slides-per-page": slidesPerPage,
|
|
440
|
-
"--slide-spacing": `${gap}px`,
|
|
441
|
-
"--slide-item-size": "calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"
|
|
442
|
-
}
|
|
443
|
-
}),
|
|
444
|
-
getControlProps: () => ({
|
|
445
|
-
"data-scope": DATA_SCOPE,
|
|
446
|
-
"data-part": "control",
|
|
447
|
-
"data-orientation": "horizontal"
|
|
448
|
-
}),
|
|
449
|
-
getPrevTriggerProps: () => ({
|
|
450
|
-
id: `carousel::${carouselId}::prev-trigger`,
|
|
451
|
-
"aria-controls": `carousel::${carouselId}::item-group`,
|
|
452
|
-
"data-scope": DATA_SCOPE,
|
|
453
|
-
"data-part": "prev-trigger",
|
|
454
|
-
"data-orientation": "horizontal",
|
|
455
|
-
type: "button",
|
|
456
|
-
dir: DIRECTION,
|
|
457
|
-
disabled: !canScrollPrev.current,
|
|
458
|
-
onClick: () => scrollPrev()
|
|
459
|
-
}),
|
|
460
|
-
getNextTriggerProps: () => ({
|
|
461
|
-
id: `carousel::${carouselId}::next-trigger`,
|
|
462
|
-
"aria-controls": `carousel::${carouselId}::item-group`,
|
|
463
|
-
"data-scope": DATA_SCOPE,
|
|
464
|
-
"data-part": "next-trigger",
|
|
465
|
-
"data-orientation": "horizontal",
|
|
466
|
-
type: "button",
|
|
467
|
-
dir: DIRECTION,
|
|
468
|
-
disabled: !canScrollNext.current,
|
|
469
|
-
onClick: () => scrollNext()
|
|
470
|
-
}),
|
|
471
|
-
getSlidesContainerProps: () => ({
|
|
472
|
-
id: `carousel::${carouselId}::item-group`,
|
|
473
|
-
/**
|
|
474
|
-
* The carousel pattern was originally designed for a single slide.
|
|
475
|
-
* When there is more than one slide, the aria-live region is set to off to avoid announcing the whole list of slides.
|
|
476
|
-
* This is not ideal but we keep it for backwards compatibility.
|
|
477
|
-
*
|
|
478
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/carousel/#wai-aria-attributes
|
|
479
|
-
*/
|
|
480
|
-
"aria-live": slidesPerPage > 1 ? "off" : "polite",
|
|
481
|
-
"data-scope": DATA_SCOPE,
|
|
482
|
-
"data-part": "item-group",
|
|
483
|
-
"data-orientation": "horizontal",
|
|
484
|
-
dir: DIRECTION,
|
|
485
|
-
tabIndex: 0,
|
|
486
|
-
style: {
|
|
487
|
-
display: "grid",
|
|
488
|
-
gap: "var(--slide-spacing)",
|
|
489
|
-
scrollSnapType: `x ${snapType}`,
|
|
490
|
-
gridAutoFlow: "column",
|
|
491
|
-
scrollbarWidth: "none",
|
|
492
|
-
gridAutoColumns: "var(--slide-item-size)",
|
|
493
|
-
overflowX: "auto"
|
|
494
|
-
},
|
|
495
|
-
ref: carouselRef
|
|
496
|
-
}),
|
|
497
|
-
getSlideProps: ({ index }) => {
|
|
498
|
-
const isStopPoint = isSnapPoint(index, {
|
|
499
|
-
container: carouselRef.current,
|
|
500
|
-
slidesPerMove,
|
|
501
|
-
slidesPerPage
|
|
502
|
-
});
|
|
503
|
-
return {
|
|
504
|
-
id: `carousel::${carouselId}::item:${index}`,
|
|
505
|
-
role: "group",
|
|
506
|
-
"aria-roledescription": "slide",
|
|
507
|
-
"data-scope": DATA_SCOPE,
|
|
508
|
-
"data-part": "item",
|
|
509
|
-
"data-index": index,
|
|
510
|
-
"data-orientation": "horizontal",
|
|
511
|
-
dir: DIRECTION,
|
|
512
|
-
style: {
|
|
513
|
-
...isStopPoint && {
|
|
514
|
-
scrollSnapAlign: "start",
|
|
515
|
-
scrollSnapStop: snapStop
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
},
|
|
520
|
-
getIndicatorGroupProps: () => ({
|
|
521
|
-
role: "radiogroup",
|
|
522
|
-
id: `carousel::${carouselId}::indicator-group`,
|
|
523
|
-
"data-scope": DATA_SCOPE,
|
|
524
|
-
"data-part": "indicator-group",
|
|
525
|
-
"data-orientation": "horizontal",
|
|
526
|
-
dir: DIRECTION
|
|
527
|
-
}),
|
|
528
|
-
getIndicatorProps: ({ index }) => {
|
|
529
|
-
const dotState = computeDotState({
|
|
530
|
-
dotIndex: index,
|
|
531
|
-
pageState,
|
|
532
|
-
totalPages: pageSnapPoints.length,
|
|
533
|
-
maxDots
|
|
534
|
-
});
|
|
535
|
-
return {
|
|
536
|
-
role: "radio",
|
|
537
|
-
id: `carousel::${carouselId}::indicator:${index}`,
|
|
538
|
-
"aria-checked": index === pageState,
|
|
539
|
-
"data-scope": DATA_SCOPE,
|
|
540
|
-
"data-part": "indicator",
|
|
541
|
-
"data-orientation": "horizontal",
|
|
542
|
-
"data-index": index,
|
|
543
|
-
"data-state": dotState,
|
|
544
|
-
tabIndex: index === pageState ? 0 : -1,
|
|
545
|
-
onClick: () => {
|
|
546
|
-
scrollTo(index, scrollBehavior);
|
|
547
|
-
},
|
|
548
|
-
onKeyDown: (event) => {
|
|
549
|
-
const focusActiveIndicator = (page) => {
|
|
550
|
-
pageIndicatorsRefs.current[page]?.focus();
|
|
551
|
-
};
|
|
552
|
-
if (event.key === "ArrowRight" && canScrollNext) {
|
|
553
|
-
scrollNext(focusActiveIndicator);
|
|
554
|
-
} else if (event.key === "ArrowLeft" && canScrollPrev) {
|
|
555
|
-
scrollPrev(focusActiveIndicator);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
return contextValue;
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
// src/carousel/Carousel.tsx
|
|
565
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
566
|
-
var CarouselContext = (0, import_react8.createContext)(null);
|
|
567
|
-
var Carousel = ({
|
|
568
|
-
className,
|
|
569
|
-
snapType = "mandatory",
|
|
570
|
-
snapStop = "always",
|
|
571
|
-
scrollBehavior = "smooth",
|
|
572
|
-
slidesPerMove = "auto",
|
|
573
|
-
pagePickerInset = false,
|
|
574
|
-
slidesPerPage = 1,
|
|
575
|
-
loop = false,
|
|
576
|
-
children,
|
|
577
|
-
gap = 16,
|
|
578
|
-
defaultPage,
|
|
579
|
-
page,
|
|
580
|
-
onPageChange,
|
|
581
|
-
maxDots = 5,
|
|
582
|
-
...props
|
|
583
|
-
}) => {
|
|
584
|
-
const carouselApi = useCarousel({
|
|
585
|
-
defaultPage,
|
|
586
|
-
slidesPerPage,
|
|
587
|
-
slidesPerMove,
|
|
588
|
-
loop,
|
|
589
|
-
gap,
|
|
590
|
-
scrollBehavior,
|
|
591
|
-
snapStop,
|
|
592
|
-
snapType,
|
|
593
|
-
page,
|
|
594
|
-
pagePickerInset,
|
|
595
|
-
onPageChange,
|
|
596
|
-
maxDots
|
|
597
|
-
});
|
|
598
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
599
|
-
CarouselContext.Provider,
|
|
600
|
-
{
|
|
601
|
-
value: {
|
|
602
|
-
...carouselApi,
|
|
603
|
-
scrollBehavior
|
|
604
|
-
},
|
|
605
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
606
|
-
"div",
|
|
607
|
-
{
|
|
608
|
-
"data-spark-component": "carousel",
|
|
609
|
-
className: (0, import_class_variance_authority.cx)("gap-lg relative box-border flex flex-col", className),
|
|
610
|
-
...carouselApi.getRootProps(),
|
|
611
|
-
...props,
|
|
612
|
-
children
|
|
613
|
-
}
|
|
614
|
-
)
|
|
615
|
-
}
|
|
616
|
-
);
|
|
617
|
-
};
|
|
618
|
-
Carousel.displayName = "Carousel";
|
|
619
|
-
var useCarouselContext = () => {
|
|
620
|
-
const context = (0, import_react8.useContext)(CarouselContext);
|
|
621
|
-
if (!context) {
|
|
622
|
-
throw Error("useCarouselContext must be used within a Carousel provider");
|
|
623
|
-
}
|
|
624
|
-
return context;
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
// src/carousel/CarouselControls.tsx
|
|
628
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
629
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
630
|
-
var CarouselControls = ({ children, className, ...props }) => {
|
|
631
|
-
const ctx = useCarouselContext();
|
|
632
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
633
|
-
"div",
|
|
634
|
-
{
|
|
635
|
-
"data-spark-component": "carousel-controls",
|
|
636
|
-
className: (0, import_class_variance_authority2.cx)(
|
|
637
|
-
"default:px-lg pointer-events-none absolute inset-0 flex flex-row items-center justify-between",
|
|
638
|
-
className
|
|
639
|
-
),
|
|
640
|
-
...ctx.getControlProps(),
|
|
641
|
-
...props,
|
|
642
|
-
children
|
|
643
|
-
}
|
|
644
|
-
);
|
|
645
|
-
};
|
|
646
|
-
CarouselControls.displayName = "Carousel.Controls";
|
|
647
|
-
|
|
648
|
-
// src/carousel/CarouselNextButton.tsx
|
|
649
|
-
var import_ArrowVerticalRight = require("@spark-ui/icons/ArrowVerticalRight");
|
|
650
|
-
|
|
651
|
-
// src/icon/Icon.tsx
|
|
652
|
-
var import_react10 = require("react");
|
|
653
|
-
|
|
654
|
-
// src/slot/Slot.tsx
|
|
655
|
-
var import_radix_ui = require("radix-ui");
|
|
656
|
-
var import_react9 = require("react");
|
|
657
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
658
|
-
var Slottable = import_radix_ui.Slot.Slottable;
|
|
659
|
-
var Slot = ({ ref, ...props }) => {
|
|
660
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
|
|
661
|
-
};
|
|
662
|
-
var wrapPolymorphicSlot = (asChild, children, callback) => {
|
|
663
|
-
if (!asChild) return callback(children);
|
|
664
|
-
return (0, import_react9.isValidElement)(children) ? (0, import_react9.cloneElement)(
|
|
665
|
-
children,
|
|
666
|
-
void 0,
|
|
667
|
-
callback(children.props.children)
|
|
668
|
-
) : null;
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// src/visually-hidden/VisuallyHidden.tsx
|
|
672
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
673
|
-
var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
|
|
674
|
-
const Component = asChild ? Slot : "span";
|
|
675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
676
|
-
Component,
|
|
677
|
-
{
|
|
678
|
-
...props,
|
|
679
|
-
ref,
|
|
680
|
-
style: {
|
|
681
|
-
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
682
|
-
position: "absolute",
|
|
683
|
-
border: 0,
|
|
684
|
-
width: 1,
|
|
685
|
-
height: 1,
|
|
686
|
-
padding: 0,
|
|
687
|
-
margin: -1,
|
|
688
|
-
overflow: "hidden",
|
|
689
|
-
clip: "rect(0, 0, 0, 0)",
|
|
690
|
-
whiteSpace: "nowrap",
|
|
691
|
-
wordWrap: "normal",
|
|
692
|
-
...props.style
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
};
|
|
697
|
-
VisuallyHidden.displayName = "VisuallyHidden";
|
|
698
|
-
|
|
699
|
-
// src/icon/Icon.styles.tsx
|
|
700
|
-
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
701
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
702
|
-
var iconStyles = (0, import_class_variance_authority3.cva)(["fill-current shrink-0"], {
|
|
703
|
-
variants: {
|
|
704
|
-
/**
|
|
705
|
-
* Color scheme of the icon.
|
|
706
|
-
*/
|
|
707
|
-
intent: (0, import_internal_utils.makeVariants)({
|
|
708
|
-
current: ["text-current"],
|
|
709
|
-
main: ["text-main"],
|
|
710
|
-
support: ["text-support"],
|
|
711
|
-
accent: ["text-accent"],
|
|
712
|
-
basic: ["text-basic"],
|
|
713
|
-
success: ["text-success"],
|
|
714
|
-
alert: ["text-alert"],
|
|
715
|
-
error: ["text-error"],
|
|
716
|
-
info: ["text-info"],
|
|
717
|
-
neutral: ["text-neutral"]
|
|
718
|
-
}),
|
|
719
|
-
/**
|
|
720
|
-
* Sets the size of the icon.
|
|
721
|
-
*/
|
|
722
|
-
size: (0, import_internal_utils.makeVariants)({
|
|
723
|
-
current: ["u-current-font-size"],
|
|
724
|
-
sm: ["w-sz-16", "h-sz-16"],
|
|
725
|
-
md: ["w-sz-24", "h-sz-24"],
|
|
726
|
-
lg: ["w-sz-32", "h-sz-32"],
|
|
727
|
-
xl: ["w-sz-40", "h-sz-40"]
|
|
728
|
-
})
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
|
|
732
|
-
// src/icon/Icon.tsx
|
|
733
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
734
|
-
var Icon = ({
|
|
735
|
-
label,
|
|
736
|
-
className,
|
|
737
|
-
size = "current",
|
|
738
|
-
intent = "current",
|
|
739
|
-
children,
|
|
740
|
-
...others
|
|
741
|
-
}) => {
|
|
742
|
-
const child = import_react10.Children.only(children);
|
|
743
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
744
|
-
(0, import_react10.cloneElement)(child, {
|
|
745
|
-
className: iconStyles({ className, size, intent }),
|
|
746
|
-
"data-spark-component": "icon",
|
|
747
|
-
"aria-hidden": "true",
|
|
748
|
-
focusable: "false",
|
|
749
|
-
...others
|
|
750
|
-
}),
|
|
751
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VisuallyHidden, { children: label })
|
|
752
|
-
] });
|
|
753
|
-
};
|
|
754
|
-
Icon.displayName = "Icon";
|
|
755
|
-
|
|
756
|
-
// src/button/Button.tsx
|
|
757
|
-
var import_class_variance_authority6 = require("class-variance-authority");
|
|
758
|
-
var import_react11 = require("react");
|
|
759
|
-
|
|
760
|
-
// src/spinner/Spinner.styles.tsx
|
|
761
|
-
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
762
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
763
|
-
var defaultVariants = {
|
|
764
|
-
intent: "current",
|
|
765
|
-
size: "current",
|
|
766
|
-
isBackgroundVisible: false
|
|
767
|
-
};
|
|
768
|
-
var spinnerStyles = (0, import_class_variance_authority4.cva)(
|
|
769
|
-
["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
|
|
770
|
-
{
|
|
771
|
-
variants: {
|
|
772
|
-
/**
|
|
773
|
-
* Use `size` prop to set the size of the spinner. If you want to set the full size for the spinner, don't forget to add a wrapping container with its own size.
|
|
774
|
-
*/
|
|
775
|
-
size: {
|
|
776
|
-
current: ["u-current-font-size"],
|
|
777
|
-
sm: ["w-sz-20", "h-sz-20"],
|
|
778
|
-
md: ["w-sz-28", "h-sz-28"],
|
|
779
|
-
full: ["w-full", "h-full"]
|
|
780
|
-
},
|
|
781
|
-
/**
|
|
782
|
-
* Color scheme of the spinner.
|
|
783
|
-
*/
|
|
784
|
-
intent: (0, import_internal_utils2.makeVariants)({
|
|
785
|
-
current: ["border-current"],
|
|
786
|
-
main: ["border-main"],
|
|
787
|
-
support: ["border-support"],
|
|
788
|
-
accent: ["border-accent"],
|
|
789
|
-
basic: ["border-basic"],
|
|
790
|
-
success: ["border-success"],
|
|
791
|
-
alert: ["border-alert"],
|
|
792
|
-
error: ["border-error"],
|
|
793
|
-
info: ["border-info"],
|
|
794
|
-
neutral: ["border-neutral"]
|
|
795
|
-
}),
|
|
796
|
-
/**
|
|
797
|
-
* Size of the button.
|
|
798
|
-
*/
|
|
799
|
-
isBackgroundVisible: {
|
|
800
|
-
true: ["border-b-neutral-container", "border-l-neutral-container"],
|
|
801
|
-
false: ["border-b-transparent", "border-l-transparent"]
|
|
802
|
-
}
|
|
803
|
-
},
|
|
804
|
-
defaultVariants
|
|
805
|
-
}
|
|
806
|
-
);
|
|
807
|
-
|
|
808
|
-
// src/spinner/Spinner.tsx
|
|
809
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
810
|
-
var Spinner = ({
|
|
811
|
-
className,
|
|
812
|
-
size = "current",
|
|
813
|
-
intent = "current",
|
|
814
|
-
label,
|
|
815
|
-
isBackgroundVisible,
|
|
816
|
-
ref,
|
|
817
|
-
...others
|
|
818
|
-
}) => {
|
|
819
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
820
|
-
"span",
|
|
821
|
-
{
|
|
822
|
-
role: "status",
|
|
823
|
-
"data-spark-component": "spinner",
|
|
824
|
-
ref,
|
|
825
|
-
className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
|
|
826
|
-
...others,
|
|
827
|
-
children: label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(VisuallyHidden, { children: label })
|
|
828
|
-
}
|
|
829
|
-
);
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
// src/button/Button.styles.tsx
|
|
833
|
-
var import_internal_utils8 = require("@spark-ui/internal-utils");
|
|
834
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
835
|
-
|
|
836
|
-
// src/button/variants/filled.ts
|
|
837
|
-
var import_internal_utils3 = require("@spark-ui/internal-utils");
|
|
838
|
-
var filledVariants = [
|
|
839
|
-
// Main
|
|
840
|
-
{
|
|
841
|
-
intent: "main",
|
|
842
|
-
design: "filled",
|
|
843
|
-
class: (0, import_internal_utils3.tw)([
|
|
844
|
-
"bg-main",
|
|
845
|
-
"text-on-main",
|
|
846
|
-
"hover:bg-main-hovered",
|
|
847
|
-
"enabled:active:bg-main-hovered",
|
|
848
|
-
"focus-visible:bg-main-hovered"
|
|
849
|
-
])
|
|
850
|
-
},
|
|
851
|
-
// Support
|
|
852
|
-
{
|
|
853
|
-
intent: "support",
|
|
854
|
-
design: "filled",
|
|
855
|
-
class: (0, import_internal_utils3.tw)([
|
|
856
|
-
"bg-support",
|
|
857
|
-
"text-on-support",
|
|
858
|
-
"hover:bg-support-hovered",
|
|
859
|
-
"enabled:active:bg-support-hovered",
|
|
860
|
-
"focus-visible:bg-support-hovered"
|
|
861
|
-
])
|
|
862
|
-
},
|
|
863
|
-
// Accent
|
|
864
|
-
{
|
|
865
|
-
intent: "accent",
|
|
866
|
-
design: "filled",
|
|
867
|
-
class: (0, import_internal_utils3.tw)([
|
|
868
|
-
"bg-accent",
|
|
869
|
-
"text-on-accent",
|
|
870
|
-
"hover:bg-accent-hovered",
|
|
871
|
-
"enabled:active:bg-accent-hovered",
|
|
872
|
-
"focus-visible:bg-accent-hovered"
|
|
873
|
-
])
|
|
874
|
-
},
|
|
875
|
-
// Basic
|
|
876
|
-
{
|
|
877
|
-
intent: "basic",
|
|
878
|
-
design: "filled",
|
|
879
|
-
class: (0, import_internal_utils3.tw)([
|
|
880
|
-
"bg-basic",
|
|
881
|
-
"text-on-basic",
|
|
882
|
-
"hover:bg-basic-hovered",
|
|
883
|
-
"enabled:active:bg-basic-hovered",
|
|
884
|
-
"focus-visible:bg-basic-hovered"
|
|
885
|
-
])
|
|
886
|
-
},
|
|
887
|
-
// Success
|
|
888
|
-
{
|
|
889
|
-
intent: "success",
|
|
890
|
-
design: "filled",
|
|
891
|
-
class: (0, import_internal_utils3.tw)([
|
|
892
|
-
"bg-success",
|
|
893
|
-
"text-on-success",
|
|
894
|
-
"hover:bg-success-hovered",
|
|
895
|
-
"enabled:active:bg-success-hovered",
|
|
896
|
-
"focus-visible:bg-success-hovered"
|
|
897
|
-
])
|
|
898
|
-
},
|
|
899
|
-
// Alert
|
|
900
|
-
{
|
|
901
|
-
intent: "alert",
|
|
902
|
-
design: "filled",
|
|
903
|
-
class: (0, import_internal_utils3.tw)([
|
|
904
|
-
"bg-alert",
|
|
905
|
-
"text-on-alert",
|
|
906
|
-
"hover:bg-alert-hovered",
|
|
907
|
-
"enabled:active:bg-alert-hovered",
|
|
908
|
-
"focus-visible:bg-alert-hovered"
|
|
909
|
-
])
|
|
910
|
-
},
|
|
911
|
-
// Danger
|
|
912
|
-
{
|
|
913
|
-
intent: "danger",
|
|
914
|
-
design: "filled",
|
|
915
|
-
class: (0, import_internal_utils3.tw)([
|
|
916
|
-
"text-on-error bg-error",
|
|
917
|
-
"hover:bg-error-hovered enabled:active:bg-error-hovered",
|
|
918
|
-
"focus-visible:bg-error-hovered"
|
|
919
|
-
])
|
|
920
|
-
},
|
|
921
|
-
// Info
|
|
922
|
-
{
|
|
923
|
-
intent: "info",
|
|
924
|
-
design: "filled",
|
|
925
|
-
class: (0, import_internal_utils3.tw)([
|
|
926
|
-
"text-on-error bg-info",
|
|
927
|
-
"hover:bg-info-hovered enabled:active:bg-info-hovered",
|
|
928
|
-
"focus-visible:bg-info-hovered"
|
|
929
|
-
])
|
|
930
|
-
},
|
|
931
|
-
// Neutral
|
|
932
|
-
{
|
|
933
|
-
intent: "neutral",
|
|
934
|
-
design: "filled",
|
|
935
|
-
class: (0, import_internal_utils3.tw)([
|
|
936
|
-
"bg-neutral",
|
|
937
|
-
"text-on-neutral",
|
|
938
|
-
"hover:bg-neutral-hovered",
|
|
939
|
-
"enabled:active:bg-neutral-hovered",
|
|
940
|
-
"focus-visible:bg-neutral-hovered"
|
|
941
|
-
])
|
|
942
|
-
},
|
|
943
|
-
// Surface
|
|
944
|
-
{
|
|
945
|
-
intent: "surface",
|
|
946
|
-
design: "filled",
|
|
947
|
-
class: (0, import_internal_utils3.tw)([
|
|
948
|
-
"bg-surface",
|
|
949
|
-
"text-on-surface",
|
|
950
|
-
"hover:bg-surface-hovered",
|
|
951
|
-
"enabled:active:bg-surface-hovered",
|
|
952
|
-
"focus-visible:bg-surface-hovered"
|
|
953
|
-
])
|
|
954
|
-
},
|
|
955
|
-
{
|
|
956
|
-
intent: "surfaceInverse",
|
|
957
|
-
design: "filled",
|
|
958
|
-
class: (0, import_internal_utils3.tw)([
|
|
959
|
-
"bg-surface-inverse",
|
|
960
|
-
"text-on-surface-inverse",
|
|
961
|
-
"hover:bg-surface-inverse-hovered",
|
|
962
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
963
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
964
|
-
])
|
|
965
|
-
}
|
|
966
|
-
];
|
|
967
|
-
|
|
968
|
-
// src/button/variants/ghost.ts
|
|
969
|
-
var import_internal_utils4 = require("@spark-ui/internal-utils");
|
|
970
|
-
var ghostVariants = [
|
|
971
|
-
{
|
|
972
|
-
intent: "main",
|
|
973
|
-
design: "ghost",
|
|
974
|
-
class: (0, import_internal_utils4.tw)([
|
|
975
|
-
"text-on-main-container",
|
|
976
|
-
"hover:bg-main/dim-5",
|
|
977
|
-
"enabled:active:bg-main/dim-5",
|
|
978
|
-
"focus-visible:bg-main/dim-5"
|
|
979
|
-
])
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
intent: "support",
|
|
983
|
-
design: "ghost",
|
|
984
|
-
class: (0, import_internal_utils4.tw)([
|
|
985
|
-
"text-on-support-container",
|
|
986
|
-
"hover:bg-support/dim-5",
|
|
987
|
-
"enabled:active:bg-support/dim-5",
|
|
988
|
-
"focus-visible:bg-support/dim-5"
|
|
989
|
-
])
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
intent: "accent",
|
|
993
|
-
design: "ghost",
|
|
994
|
-
class: (0, import_internal_utils4.tw)([
|
|
995
|
-
"text-on-accent-container",
|
|
996
|
-
"hover:bg-accent/dim-5",
|
|
997
|
-
"enabled:active:bg-accent/dim-5",
|
|
998
|
-
"focus-visible:bg-accent/dim-5"
|
|
999
|
-
])
|
|
1000
|
-
},
|
|
1001
|
-
{
|
|
1002
|
-
intent: "basic",
|
|
1003
|
-
design: "ghost",
|
|
1004
|
-
class: (0, import_internal_utils4.tw)([
|
|
1005
|
-
"text-on-basic-container",
|
|
1006
|
-
"hover:bg-basic/dim-5",
|
|
1007
|
-
"enabled:active:bg-basic/dim-5",
|
|
1008
|
-
"focus-visible:bg-basic/dim-5"
|
|
1009
|
-
])
|
|
1010
|
-
},
|
|
1011
|
-
{
|
|
1012
|
-
intent: "success",
|
|
1013
|
-
design: "ghost",
|
|
1014
|
-
class: (0, import_internal_utils4.tw)([
|
|
1015
|
-
"text-on-success-container",
|
|
1016
|
-
"hover:bg-success/dim-5",
|
|
1017
|
-
"enabled:active:bg-success/dim-5",
|
|
1018
|
-
"focus-visible:bg-success/dim-5"
|
|
1019
|
-
])
|
|
1020
|
-
},
|
|
1021
|
-
{
|
|
1022
|
-
intent: "alert",
|
|
1023
|
-
design: "ghost",
|
|
1024
|
-
class: (0, import_internal_utils4.tw)([
|
|
1025
|
-
"text-on-alert-container",
|
|
1026
|
-
"hover:bg-alert/dim-5",
|
|
1027
|
-
"enabled:active:bg-alert/dim-5",
|
|
1028
|
-
"focus-visible:bg-alert/dim-5"
|
|
1029
|
-
])
|
|
1030
|
-
},
|
|
1031
|
-
{
|
|
1032
|
-
intent: "danger",
|
|
1033
|
-
design: "ghost",
|
|
1034
|
-
class: (0, import_internal_utils4.tw)([
|
|
1035
|
-
"text-on-error-container",
|
|
1036
|
-
"hover:bg-error/dim-5",
|
|
1037
|
-
"enabled:active:bg-error/dim-5",
|
|
1038
|
-
"focus-visible:bg-error/dim-5"
|
|
1039
|
-
])
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
intent: "info",
|
|
1043
|
-
design: "ghost",
|
|
1044
|
-
class: (0, import_internal_utils4.tw)([
|
|
1045
|
-
"text-on-info-container",
|
|
1046
|
-
"hover:bg-info/dim-5",
|
|
1047
|
-
"enabled:active:bg-info/dim-5",
|
|
1048
|
-
"focus-visible:bg-info/dim-5"
|
|
1049
|
-
])
|
|
1050
|
-
},
|
|
1051
|
-
{
|
|
1052
|
-
intent: "neutral",
|
|
1053
|
-
design: "ghost",
|
|
1054
|
-
class: (0, import_internal_utils4.tw)([
|
|
1055
|
-
"text-on-neutral-container",
|
|
1056
|
-
"hover:bg-neutral/dim-5",
|
|
1057
|
-
"enabled:active:bg-neutral/dim-5",
|
|
1058
|
-
"focus-visible:bg-neutral/dim-5"
|
|
1059
|
-
])
|
|
1060
|
-
},
|
|
1061
|
-
{
|
|
1062
|
-
intent: "surface",
|
|
1063
|
-
design: "ghost",
|
|
1064
|
-
class: (0, import_internal_utils4.tw)([
|
|
1065
|
-
"text-surface",
|
|
1066
|
-
"hover:bg-surface/dim-5",
|
|
1067
|
-
"enabled:active:bg-surface/dim-5",
|
|
1068
|
-
"focus-visible:bg-surface/dim-5"
|
|
1069
|
-
])
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
intent: "surfaceInverse",
|
|
1073
|
-
design: "ghost",
|
|
1074
|
-
class: (0, import_internal_utils4.tw)([
|
|
1075
|
-
"text-surface-inverse",
|
|
1076
|
-
"hover:bg-surface-inverse/dim-5",
|
|
1077
|
-
"enabled:active:bg-surface-inverse/dim-5",
|
|
1078
|
-
"focus-visible:bg-surface-inverse/dim-5"
|
|
1079
|
-
])
|
|
1080
|
-
}
|
|
1081
|
-
];
|
|
1082
|
-
|
|
1083
|
-
// src/button/variants/outlined.ts
|
|
1084
|
-
var import_internal_utils5 = require("@spark-ui/internal-utils");
|
|
1085
|
-
var outlinedVariants = [
|
|
1086
|
-
{
|
|
1087
|
-
intent: "main",
|
|
1088
|
-
design: "outlined",
|
|
1089
|
-
class: (0, import_internal_utils5.tw)([
|
|
1090
|
-
"hover:bg-main/dim-5",
|
|
1091
|
-
"enabled:active:bg-main/dim-5",
|
|
1092
|
-
"focus-visible:bg-main/dim-5",
|
|
1093
|
-
"text-main"
|
|
1094
|
-
])
|
|
1095
|
-
},
|
|
1096
|
-
{
|
|
1097
|
-
intent: "support",
|
|
1098
|
-
design: "outlined",
|
|
1099
|
-
class: (0, import_internal_utils5.tw)([
|
|
1100
|
-
"hover:bg-support/dim-5",
|
|
1101
|
-
"enabled:active:bg-support/dim-5",
|
|
1102
|
-
"focus-visible:bg-support/dim-5",
|
|
1103
|
-
"text-support"
|
|
1104
|
-
])
|
|
1105
|
-
},
|
|
1106
|
-
{
|
|
1107
|
-
intent: "accent",
|
|
1108
|
-
design: "outlined",
|
|
1109
|
-
class: (0, import_internal_utils5.tw)([
|
|
1110
|
-
"hover:bg-accent/dim-5",
|
|
1111
|
-
"enabled:active:bg-accent/dim-5",
|
|
1112
|
-
"focus-visible:bg-accent/dim-5",
|
|
1113
|
-
"text-accent"
|
|
1114
|
-
])
|
|
1115
|
-
},
|
|
1116
|
-
{
|
|
1117
|
-
intent: "basic",
|
|
1118
|
-
design: "outlined",
|
|
1119
|
-
class: (0, import_internal_utils5.tw)([
|
|
1120
|
-
"hover:bg-basic/dim-5",
|
|
1121
|
-
"enabled:active:bg-basic/dim-5",
|
|
1122
|
-
"focus-visible:bg-basic/dim-5",
|
|
1123
|
-
"text-basic"
|
|
1124
|
-
])
|
|
1125
|
-
},
|
|
1126
|
-
{
|
|
1127
|
-
intent: "success",
|
|
1128
|
-
design: "outlined",
|
|
1129
|
-
class: (0, import_internal_utils5.tw)([
|
|
1130
|
-
"hover:bg-success/dim-5",
|
|
1131
|
-
"enabled:active:bg-success/dim-5",
|
|
1132
|
-
"focus-visible:bg-success/dim-5",
|
|
1133
|
-
"text-success"
|
|
1134
|
-
])
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
intent: "alert",
|
|
1138
|
-
design: "outlined",
|
|
1139
|
-
class: (0, import_internal_utils5.tw)([
|
|
1140
|
-
"hover:bg-alert/dim-5",
|
|
1141
|
-
"enabled:active:bg-alert/dim-5",
|
|
1142
|
-
"focus-visible:bg-alert/dim-5",
|
|
1143
|
-
"text-alert"
|
|
1144
|
-
])
|
|
1145
|
-
},
|
|
1146
|
-
{
|
|
1147
|
-
intent: "danger",
|
|
1148
|
-
design: "outlined",
|
|
1149
|
-
class: (0, import_internal_utils5.tw)([
|
|
1150
|
-
"hover:bg-error/dim-5",
|
|
1151
|
-
"enabled:active:bg-error/dim-5",
|
|
1152
|
-
"focus-visible:bg-error/dim-5",
|
|
1153
|
-
"text-error"
|
|
1154
|
-
])
|
|
1155
|
-
},
|
|
1156
|
-
{
|
|
1157
|
-
intent: "info",
|
|
1158
|
-
design: "outlined",
|
|
1159
|
-
class: (0, import_internal_utils5.tw)([
|
|
1160
|
-
"hover:bg-info/dim-5",
|
|
1161
|
-
"enabled:active:bg-info/dim-5",
|
|
1162
|
-
"focus-visible:bg-info/dim-5",
|
|
1163
|
-
"text-info"
|
|
1164
|
-
])
|
|
1165
|
-
},
|
|
1166
|
-
{
|
|
1167
|
-
intent: "neutral",
|
|
1168
|
-
design: "outlined",
|
|
1169
|
-
class: (0, import_internal_utils5.tw)([
|
|
1170
|
-
"hover:bg-neutral/dim-5",
|
|
1171
|
-
"enabled:active:bg-neutral/dim-5",
|
|
1172
|
-
"focus-visible:bg-neutral/dim-5",
|
|
1173
|
-
"text-neutral"
|
|
1174
|
-
])
|
|
1175
|
-
},
|
|
1176
|
-
{
|
|
1177
|
-
intent: "surface",
|
|
1178
|
-
design: "outlined",
|
|
1179
|
-
class: (0, import_internal_utils5.tw)([
|
|
1180
|
-
"hover:bg-surface/dim-5",
|
|
1181
|
-
"enabled:active:bg-surface/dim-5",
|
|
1182
|
-
"focus-visible:bg-surface/dim-5",
|
|
1183
|
-
"text-surface"
|
|
1184
|
-
])
|
|
1185
|
-
},
|
|
1186
|
-
{
|
|
1187
|
-
intent: "surfaceInverse",
|
|
1188
|
-
design: "outlined",
|
|
1189
|
-
class: (0, import_internal_utils5.tw)([
|
|
1190
|
-
"hover:bg-surface-inverse/dim-5",
|
|
1191
|
-
"enabled:active:bg-surface-inverse/dim-5",
|
|
1192
|
-
"focus-visible:bg-surface-inverse/dim-5",
|
|
1193
|
-
"text-surface-inverse"
|
|
1194
|
-
])
|
|
1195
|
-
}
|
|
1196
|
-
];
|
|
1197
|
-
|
|
1198
|
-
// src/button/variants/tinted.ts
|
|
1199
|
-
var import_internal_utils6 = require("@spark-ui/internal-utils");
|
|
1200
|
-
var tintedVariants = [
|
|
1201
|
-
{
|
|
1202
|
-
intent: "main",
|
|
1203
|
-
design: "tinted",
|
|
1204
|
-
class: (0, import_internal_utils6.tw)([
|
|
1205
|
-
"bg-main-container",
|
|
1206
|
-
"text-on-main-container",
|
|
1207
|
-
"hover:bg-main-container-hovered",
|
|
1208
|
-
"enabled:active:bg-main-container-hovered",
|
|
1209
|
-
"focus-visible:bg-main-container-hovered"
|
|
1210
|
-
])
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
intent: "support",
|
|
1214
|
-
design: "tinted",
|
|
1215
|
-
class: (0, import_internal_utils6.tw)([
|
|
1216
|
-
"bg-support-container",
|
|
1217
|
-
"text-on-support-container",
|
|
1218
|
-
"hover:bg-support-container-hovered",
|
|
1219
|
-
"enabled:active:bg-support-container-hovered",
|
|
1220
|
-
"focus-visible:bg-support-container-hovered"
|
|
1221
|
-
])
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
intent: "accent",
|
|
1225
|
-
design: "tinted",
|
|
1226
|
-
class: (0, import_internal_utils6.tw)([
|
|
1227
|
-
"bg-accent-container",
|
|
1228
|
-
"text-on-accent-container",
|
|
1229
|
-
"hover:bg-accent-container-hovered",
|
|
1230
|
-
"enabled:active:bg-accent-container-hovered",
|
|
1231
|
-
"focus-visible:bg-accent-container-hovered"
|
|
1232
|
-
])
|
|
1233
|
-
},
|
|
1234
|
-
{
|
|
1235
|
-
intent: "basic",
|
|
1236
|
-
design: "tinted",
|
|
1237
|
-
class: (0, import_internal_utils6.tw)([
|
|
1238
|
-
"bg-basic-container",
|
|
1239
|
-
"text-on-basic-container",
|
|
1240
|
-
"hover:bg-basic-container-hovered",
|
|
1241
|
-
"enabled:active:bg-basic-container-hovered",
|
|
1242
|
-
"focus-visible:bg-basic-container-hovered"
|
|
1243
|
-
])
|
|
1244
|
-
},
|
|
1245
|
-
{
|
|
1246
|
-
intent: "success",
|
|
1247
|
-
design: "tinted",
|
|
1248
|
-
class: (0, import_internal_utils6.tw)([
|
|
1249
|
-
"bg-success-container",
|
|
1250
|
-
"text-on-success-container",
|
|
1251
|
-
"hover:bg-success-container-hovered",
|
|
1252
|
-
"enabled:active:bg-success-container-hovered",
|
|
1253
|
-
"focus-visible:bg-success-container-hovered"
|
|
1254
|
-
])
|
|
1255
|
-
},
|
|
1256
|
-
{
|
|
1257
|
-
intent: "alert",
|
|
1258
|
-
design: "tinted",
|
|
1259
|
-
class: (0, import_internal_utils6.tw)([
|
|
1260
|
-
"bg-alert-container",
|
|
1261
|
-
"text-on-alert-container",
|
|
1262
|
-
"hover:bg-alert-container-hovered",
|
|
1263
|
-
"enabled:active:bg-alert-container-hovered",
|
|
1264
|
-
"focus-visible:bg-alert-container-hovered"
|
|
1265
|
-
])
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1268
|
-
intent: "danger",
|
|
1269
|
-
design: "tinted",
|
|
1270
|
-
class: (0, import_internal_utils6.tw)([
|
|
1271
|
-
"bg-error-container",
|
|
1272
|
-
"text-on-error-container",
|
|
1273
|
-
"hover:bg-error-container-hovered",
|
|
1274
|
-
"enabled:active:bg-error-container-hovered",
|
|
1275
|
-
"focus-visible:bg-error-container-hovered"
|
|
1276
|
-
])
|
|
1277
|
-
},
|
|
1278
|
-
{
|
|
1279
|
-
intent: "info",
|
|
1280
|
-
design: "tinted",
|
|
1281
|
-
class: (0, import_internal_utils6.tw)([
|
|
1282
|
-
"bg-info-container",
|
|
1283
|
-
"text-on-info-container",
|
|
1284
|
-
"hover:bg-info-container-hovered",
|
|
1285
|
-
"enabled:active:bg-info-container-hovered",
|
|
1286
|
-
"focus-visible:bg-info-container-hovered"
|
|
1287
|
-
])
|
|
1288
|
-
},
|
|
1289
|
-
{
|
|
1290
|
-
intent: "neutral",
|
|
1291
|
-
design: "tinted",
|
|
1292
|
-
class: (0, import_internal_utils6.tw)([
|
|
1293
|
-
"bg-neutral-container",
|
|
1294
|
-
"text-on-neutral-container",
|
|
1295
|
-
"hover:bg-neutral-container-hovered",
|
|
1296
|
-
"enabled:active:bg-neutral-container-hovered",
|
|
1297
|
-
"focus-visible:bg-neutral-container-hovered"
|
|
1298
|
-
])
|
|
1299
|
-
},
|
|
1300
|
-
{
|
|
1301
|
-
intent: "surface",
|
|
1302
|
-
design: "tinted",
|
|
1303
|
-
class: (0, import_internal_utils6.tw)([
|
|
1304
|
-
"bg-surface",
|
|
1305
|
-
"text-on-surface",
|
|
1306
|
-
"hover:bg-surface-hovered",
|
|
1307
|
-
"enabled:active:bg-surface-hovered",
|
|
1308
|
-
"focus-visible:bg-surface-hovered"
|
|
1309
|
-
])
|
|
1310
|
-
},
|
|
1311
|
-
{
|
|
1312
|
-
intent: "surfaceInverse",
|
|
1313
|
-
design: "tinted",
|
|
1314
|
-
class: (0, import_internal_utils6.tw)([
|
|
1315
|
-
"bg-surface-inverse",
|
|
1316
|
-
"text-on-surface-inverse",
|
|
1317
|
-
"hover:bg-surface-inverse-hovered",
|
|
1318
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1319
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1320
|
-
])
|
|
1321
|
-
}
|
|
1322
|
-
];
|
|
1323
|
-
|
|
1324
|
-
// src/button/variants/contrast.ts
|
|
1325
|
-
var import_internal_utils7 = require("@spark-ui/internal-utils");
|
|
1326
|
-
var contrastVariants = [
|
|
1327
|
-
{
|
|
1328
|
-
intent: "main",
|
|
1329
|
-
design: "contrast",
|
|
1330
|
-
class: (0, import_internal_utils7.tw)([
|
|
1331
|
-
"text-on-main-contaier bg-surface",
|
|
1332
|
-
"hover:bg-main-container-hovered",
|
|
1333
|
-
"enabled:active:bg-main-container-hovered",
|
|
1334
|
-
"focus-visible:bg-main-container-hovered"
|
|
1335
|
-
])
|
|
1336
|
-
},
|
|
1337
|
-
{
|
|
1338
|
-
intent: "support",
|
|
1339
|
-
design: "contrast",
|
|
1340
|
-
class: (0, import_internal_utils7.tw)([
|
|
1341
|
-
"text-on-support-container bg-surface",
|
|
1342
|
-
"hover:bg-support-container-hovered",
|
|
1343
|
-
"enabled:active:bg-support-container-hovered",
|
|
1344
|
-
"focus-visible:bg-support-container-hovered"
|
|
1345
|
-
])
|
|
1346
|
-
},
|
|
1347
|
-
{
|
|
1348
|
-
intent: "accent",
|
|
1349
|
-
design: "contrast",
|
|
1350
|
-
class: (0, import_internal_utils7.tw)([
|
|
1351
|
-
"text-on-accent-container bg-surface",
|
|
1352
|
-
"hover:bg-accent-container-hovered",
|
|
1353
|
-
"enabled:active:bg-accent-container-hovered",
|
|
1354
|
-
"focus-visible:bg-accent-container-hovered"
|
|
1355
|
-
])
|
|
1356
|
-
},
|
|
1357
|
-
{
|
|
1358
|
-
intent: "basic",
|
|
1359
|
-
design: "contrast",
|
|
1360
|
-
class: (0, import_internal_utils7.tw)([
|
|
1361
|
-
"text-on-basic-container bg-surface",
|
|
1362
|
-
"hover:bg-basic-container-hovered",
|
|
1363
|
-
"enabled:active:bg-basic-container-hovered",
|
|
1364
|
-
"focus-visible:bg-basic-container-hovered"
|
|
1365
|
-
])
|
|
1366
|
-
},
|
|
1367
|
-
{
|
|
1368
|
-
intent: "success",
|
|
1369
|
-
design: "contrast",
|
|
1370
|
-
class: (0, import_internal_utils7.tw)([
|
|
1371
|
-
"text-on-success-container bg-surface",
|
|
1372
|
-
"hover:bg-success-container-hovered",
|
|
1373
|
-
"enabled:active:bg-success-container-hovered",
|
|
1374
|
-
"focus-visible:bg-success-container-hovered"
|
|
1375
|
-
])
|
|
1376
|
-
},
|
|
1377
|
-
{
|
|
1378
|
-
intent: "alert",
|
|
1379
|
-
design: "contrast",
|
|
1380
|
-
class: (0, import_internal_utils7.tw)([
|
|
1381
|
-
"text-on-alert-container bg-surface",
|
|
1382
|
-
"hover:bg-alert-container-hovered",
|
|
1383
|
-
"enabled:active:bg-alert-container-hovered",
|
|
1384
|
-
"focus-visible:bg-alert-container-hovered"
|
|
1385
|
-
])
|
|
1386
|
-
},
|
|
1387
|
-
{
|
|
1388
|
-
intent: "danger",
|
|
1389
|
-
design: "contrast",
|
|
1390
|
-
class: (0, import_internal_utils7.tw)([
|
|
1391
|
-
"text-on-error-container bg-surface",
|
|
1392
|
-
"hover:bg-error-container-hovered",
|
|
1393
|
-
"enabled:active:bg-error-container-hovered",
|
|
1394
|
-
"focus-visible:bg-error-container-hovered"
|
|
1395
|
-
])
|
|
1396
|
-
},
|
|
1397
|
-
{
|
|
1398
|
-
intent: "info",
|
|
1399
|
-
design: "contrast",
|
|
1400
|
-
class: (0, import_internal_utils7.tw)([
|
|
1401
|
-
"text-on-info-container bg-surface",
|
|
1402
|
-
"hover:bg-info-container-hovered",
|
|
1403
|
-
"enabled:active:bg-info-container-hovered",
|
|
1404
|
-
"focus-visible:bg-info-container-hovered"
|
|
1405
|
-
])
|
|
1406
|
-
},
|
|
1407
|
-
{
|
|
1408
|
-
intent: "neutral",
|
|
1409
|
-
design: "contrast",
|
|
1410
|
-
class: (0, import_internal_utils7.tw)([
|
|
1411
|
-
"text-on-neutral-container bg-surface",
|
|
1412
|
-
"hover:bg-neutral-container-hovered",
|
|
1413
|
-
"enabled:active:bg-neutral-container-hovered",
|
|
1414
|
-
"focus-visible:bg-neutral-container-hovered"
|
|
1415
|
-
])
|
|
1416
|
-
},
|
|
1417
|
-
{
|
|
1418
|
-
intent: "surface",
|
|
1419
|
-
design: "contrast",
|
|
1420
|
-
class: (0, import_internal_utils7.tw)([
|
|
1421
|
-
"text-on-surface bg-surface",
|
|
1422
|
-
"hover:bg-surface-hovered",
|
|
1423
|
-
"enabled:active:bg-surface-hovered",
|
|
1424
|
-
"focus-visible:bg-surface-hovered"
|
|
1425
|
-
])
|
|
1426
|
-
},
|
|
1427
|
-
{
|
|
1428
|
-
intent: "surfaceInverse",
|
|
1429
|
-
design: "contrast",
|
|
1430
|
-
class: (0, import_internal_utils7.tw)([
|
|
1431
|
-
"text-on-surface-inverse bg-surface-inverse",
|
|
1432
|
-
"hover:bg-surface-inverse-hovered",
|
|
1433
|
-
"enabled:active:bg-surface-inverse-hovered",
|
|
1434
|
-
"focus-visible:bg-surface-inverse-hovered"
|
|
1435
|
-
])
|
|
1436
|
-
}
|
|
1437
|
-
];
|
|
1438
|
-
|
|
1439
|
-
// src/button/Button.styles.tsx
|
|
1440
|
-
var buttonStyles = (0, import_class_variance_authority5.cva)(
|
|
1441
|
-
[
|
|
1442
|
-
"u-shadow-border-transition",
|
|
1443
|
-
"box-border inline-flex items-center justify-center gap-md whitespace-nowrap",
|
|
1444
|
-
"default:px-lg",
|
|
1445
|
-
"text-body-1 font-bold",
|
|
1446
|
-
"focus-visible:u-outline"
|
|
1447
|
-
],
|
|
1448
|
-
{
|
|
1449
|
-
variants: {
|
|
1450
|
-
/**
|
|
1451
|
-
* Main style of the button.
|
|
1452
|
-
*
|
|
1453
|
-
* - `filled`: Button will be plain.
|
|
1454
|
-
*
|
|
1455
|
-
* - `outlined`: Button will be transparent with an outline.
|
|
1456
|
-
*
|
|
1457
|
-
* - `tinted`: Button will be filled but using a lighter color scheme.
|
|
1458
|
-
*
|
|
1459
|
-
* - `ghost`: Button will look like a link. No borders, plain text.
|
|
1460
|
-
*
|
|
1461
|
-
* - `contrast`: Button will be surface filled. No borders, plain text.
|
|
1462
|
-
*
|
|
1463
|
-
*/
|
|
1464
|
-
design: (0, import_internal_utils8.makeVariants)({
|
|
1465
|
-
filled: [],
|
|
1466
|
-
outlined: ["bg-transparent", "border-sm", "border-current"],
|
|
1467
|
-
tinted: [],
|
|
1468
|
-
ghost: ["default:-mx-md px-md hover:bg-main/dim-5"],
|
|
1469
|
-
contrast: []
|
|
1470
|
-
}),
|
|
1471
|
-
underline: {
|
|
1472
|
-
true: ["underline"]
|
|
1473
|
-
},
|
|
1474
|
-
/**
|
|
1475
|
-
* Color scheme of the button.
|
|
1476
|
-
*/
|
|
1477
|
-
intent: (0, import_internal_utils8.makeVariants)({
|
|
1478
|
-
main: [],
|
|
1479
|
-
support: [],
|
|
1480
|
-
accent: [],
|
|
1481
|
-
basic: [],
|
|
1482
|
-
success: [],
|
|
1483
|
-
alert: [],
|
|
1484
|
-
danger: [],
|
|
1485
|
-
info: [],
|
|
1486
|
-
neutral: [],
|
|
1487
|
-
surface: [],
|
|
1488
|
-
surfaceInverse: []
|
|
1489
|
-
}),
|
|
1490
|
-
/**
|
|
1491
|
-
* Size of the button.
|
|
1492
|
-
*/
|
|
1493
|
-
size: (0, import_internal_utils8.makeVariants)({
|
|
1494
|
-
sm: ["min-w-sz-32", "h-sz-32"],
|
|
1495
|
-
md: ["min-w-sz-44", "h-sz-44"],
|
|
1496
|
-
lg: ["min-w-sz-56", "h-sz-56"]
|
|
1497
|
-
}),
|
|
1498
|
-
/**
|
|
1499
|
-
* Shape of the button.
|
|
1500
|
-
*/
|
|
1501
|
-
shape: (0, import_internal_utils8.makeVariants)({
|
|
1502
|
-
rounded: ["rounded-lg"],
|
|
1503
|
-
square: ["rounded-0"],
|
|
1504
|
-
pill: ["rounded-full"]
|
|
1505
|
-
}),
|
|
1506
|
-
/**
|
|
1507
|
-
* Disable the button, preventing user interaction and adding opacity.
|
|
1508
|
-
*/
|
|
1509
|
-
disabled: {
|
|
1510
|
-
true: ["cursor-not-allowed", "opacity-dim-3"],
|
|
1511
|
-
false: ["cursor-pointer"]
|
|
1512
|
-
}
|
|
1513
|
-
},
|
|
1514
|
-
compoundVariants: [
|
|
1515
|
-
...filledVariants,
|
|
1516
|
-
...outlinedVariants,
|
|
1517
|
-
...tintedVariants,
|
|
1518
|
-
...ghostVariants,
|
|
1519
|
-
...contrastVariants
|
|
1520
|
-
],
|
|
1521
|
-
defaultVariants: {
|
|
1522
|
-
design: "filled",
|
|
1523
|
-
intent: "main",
|
|
1524
|
-
size: "md",
|
|
1525
|
-
shape: "rounded"
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
);
|
|
1529
|
-
|
|
1530
|
-
// src/button/Button.tsx
|
|
1531
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1532
|
-
var blockedEventHandlers = [
|
|
1533
|
-
"onClick",
|
|
1534
|
-
"onMouseDown",
|
|
1535
|
-
"onMouseUp",
|
|
1536
|
-
"onMouseEnter",
|
|
1537
|
-
"onMouseLeave",
|
|
1538
|
-
"onMouseOver",
|
|
1539
|
-
"onMouseOut",
|
|
1540
|
-
"onKeyDown",
|
|
1541
|
-
"onKeyPress",
|
|
1542
|
-
"onKeyUp",
|
|
1543
|
-
"onSubmit"
|
|
1544
|
-
];
|
|
1545
|
-
var Button = ({
|
|
1546
|
-
children,
|
|
1547
|
-
design = "filled",
|
|
1548
|
-
disabled = false,
|
|
1549
|
-
intent = "main",
|
|
1550
|
-
isLoading = false,
|
|
1551
|
-
loadingLabel,
|
|
1552
|
-
loadingText,
|
|
1553
|
-
shape = "rounded",
|
|
1554
|
-
size = "md",
|
|
1555
|
-
asChild,
|
|
1556
|
-
className,
|
|
1557
|
-
underline = false,
|
|
1558
|
-
ref,
|
|
1559
|
-
...others
|
|
1560
|
-
}) => {
|
|
1561
|
-
const Component = asChild ? Slot : "button";
|
|
1562
|
-
const shouldNotInteract = !!disabled || isLoading;
|
|
1563
|
-
const disabledEventHandlers = (0, import_react11.useMemo)(() => {
|
|
1564
|
-
const result = {};
|
|
1565
|
-
if (shouldNotInteract) {
|
|
1566
|
-
blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
|
|
1567
|
-
}
|
|
1568
|
-
return result;
|
|
1569
|
-
}, [shouldNotInteract]);
|
|
1570
|
-
const spinnerProps = {
|
|
1571
|
-
size: "current",
|
|
1572
|
-
className: loadingText ? "inline-block" : "absolute",
|
|
1573
|
-
...loadingLabel && { "aria-label": loadingLabel }
|
|
1574
|
-
};
|
|
1575
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1576
|
-
Component,
|
|
1577
|
-
{
|
|
1578
|
-
"data-spark-component": "button",
|
|
1579
|
-
...Component === "button" && { type: "button" },
|
|
1580
|
-
ref,
|
|
1581
|
-
className: buttonStyles({
|
|
1582
|
-
className,
|
|
1583
|
-
design,
|
|
1584
|
-
disabled: shouldNotInteract,
|
|
1585
|
-
intent,
|
|
1586
|
-
shape,
|
|
1587
|
-
size,
|
|
1588
|
-
underline
|
|
1589
|
-
}),
|
|
1590
|
-
disabled: !!disabled,
|
|
1591
|
-
"aria-busy": isLoading,
|
|
1592
|
-
"aria-live": isLoading ? "assertive" : "off",
|
|
1593
|
-
...others,
|
|
1594
|
-
...disabledEventHandlers,
|
|
1595
|
-
children: wrapPolymorphicSlot(
|
|
1596
|
-
asChild,
|
|
1597
|
-
children,
|
|
1598
|
-
(slotted) => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1599
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { ...spinnerProps }),
|
|
1600
|
-
loadingText && loadingText,
|
|
1601
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1602
|
-
"div",
|
|
1603
|
-
{
|
|
1604
|
-
"aria-hidden": true,
|
|
1605
|
-
className: (0, import_class_variance_authority6.cx)("gap-md", loadingText ? "hidden" : "inline-flex opacity-0"),
|
|
1606
|
-
children: slotted
|
|
1607
|
-
}
|
|
1608
|
-
)
|
|
1609
|
-
] }) : slotted
|
|
1610
|
-
)
|
|
1611
|
-
}
|
|
1612
|
-
);
|
|
1613
|
-
};
|
|
1614
|
-
Button.displayName = "Button";
|
|
1615
|
-
|
|
1616
|
-
// src/icon-button/IconButton.styles.tsx
|
|
1617
|
-
var import_internal_utils9 = require("@spark-ui/internal-utils");
|
|
1618
|
-
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1619
|
-
var iconButtonStyles = (0, import_class_variance_authority7.cva)(["pl-0 pr-0"], {
|
|
1620
|
-
variants: {
|
|
1621
|
-
/**
|
|
1622
|
-
* Sets the size of the icon.
|
|
1623
|
-
*/
|
|
1624
|
-
size: (0, import_internal_utils9.makeVariants)({
|
|
1625
|
-
sm: ["text-body-1"],
|
|
1626
|
-
md: ["text-body-1"],
|
|
1627
|
-
lg: ["text-display-3"]
|
|
1628
|
-
})
|
|
1629
|
-
}
|
|
1630
|
-
});
|
|
1631
|
-
|
|
1632
|
-
// src/icon-button/IconButton.tsx
|
|
1633
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1634
|
-
var IconButton = ({
|
|
1635
|
-
design = "filled",
|
|
1636
|
-
disabled = false,
|
|
1637
|
-
intent = "main",
|
|
1638
|
-
shape = "rounded",
|
|
1639
|
-
size = "md",
|
|
1640
|
-
className,
|
|
1641
|
-
ref,
|
|
1642
|
-
...others
|
|
1643
|
-
}) => {
|
|
1644
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1645
|
-
Button,
|
|
1646
|
-
{
|
|
1647
|
-
"data-spark-component": "icon-button",
|
|
1648
|
-
ref,
|
|
1649
|
-
className: iconButtonStyles({ size, className }),
|
|
1650
|
-
design,
|
|
1651
|
-
disabled,
|
|
1652
|
-
intent,
|
|
1653
|
-
shape,
|
|
1654
|
-
size,
|
|
1655
|
-
...others
|
|
1656
|
-
}
|
|
1657
|
-
);
|
|
1658
|
-
};
|
|
1659
|
-
IconButton.displayName = "IconButton";
|
|
1660
|
-
|
|
1661
|
-
// src/carousel/CarouselNextButton.tsx
|
|
1662
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1663
|
-
var CarouselNextButton = ({
|
|
1664
|
-
"aria-label": ariaLabel,
|
|
1665
|
-
...buttonProps
|
|
1666
|
-
}) => {
|
|
1667
|
-
const ctx = useCarouselContext();
|
|
1668
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1669
|
-
IconButton,
|
|
1670
|
-
{
|
|
1671
|
-
"data-spark-component": "carousel-next-button",
|
|
1672
|
-
...ctx.getNextTriggerProps(),
|
|
1673
|
-
intent: "surface",
|
|
1674
|
-
design: "filled",
|
|
1675
|
-
className: "pointer-events-auto cursor-pointer shadow-sm disabled:invisible",
|
|
1676
|
-
"aria-label": ariaLabel,
|
|
1677
|
-
...buttonProps,
|
|
1678
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ArrowVerticalRight.ArrowVerticalRight, {}) })
|
|
1679
|
-
}
|
|
1680
|
-
);
|
|
1681
|
-
};
|
|
1682
|
-
CarouselNextButton.displayName = "Carousel.NextButton";
|
|
1683
|
-
|
|
1684
|
-
// src/carousel/CarouselPageIndicator.tsx
|
|
1685
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
1686
|
-
var import_react12 = require("react");
|
|
1687
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1688
|
-
var CarouselPageIndicator = ({
|
|
1689
|
-
children,
|
|
1690
|
-
unstyled = false,
|
|
1691
|
-
index,
|
|
1692
|
-
"aria-label": ariaLabel,
|
|
1693
|
-
className,
|
|
1694
|
-
intent = "basic"
|
|
1695
|
-
}) => {
|
|
1696
|
-
const ctx = useCarouselContext();
|
|
1697
|
-
const ref = (0, import_react12.useRef)(null);
|
|
1698
|
-
(0, import_react12.useEffect)(() => {
|
|
1699
|
-
if (ctx.pageIndicatorsRefs.current) {
|
|
1700
|
-
ctx.pageIndicatorsRefs.current[index] = ref.current;
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
const indicatorProps = ctx.getIndicatorProps({ index });
|
|
1704
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1705
|
-
"button",
|
|
1706
|
-
{
|
|
1707
|
-
"data-spark-component": "carousel-page-indicator",
|
|
1708
|
-
ref,
|
|
1709
|
-
...indicatorProps,
|
|
1710
|
-
"aria-label": ariaLabel,
|
|
1711
|
-
className: (0, import_class_variance_authority8.cx)(
|
|
1712
|
-
{
|
|
1713
|
-
[(0, import_class_variance_authority8.cx)(
|
|
1714
|
-
"border-outline group relative flex justify-center border-0 hover:cursor-pointer",
|
|
1715
|
-
"m-sm rounded-sm transition-all duration-[200ms] ease-linear",
|
|
1716
|
-
"w-sz-8 h-sz-8",
|
|
1717
|
-
"data-[state=active]:w-sz-32 data-[state=active]:h-sz-8",
|
|
1718
|
-
"data-[state=edge]:w-sz-4 data-[state=edge]:h-sz-4",
|
|
1719
|
-
"data-[state=hidden]:m-0 data-[state=hidden]:size-0",
|
|
1720
|
-
intent === "surface" ? "data-[state=active]:bg-surface bg-surface/dim-2" : "data-[state=active]:bg-basic bg-on-surface/dim-2"
|
|
1721
|
-
)]: !unstyled
|
|
1722
|
-
// [dotsStyles]: !unstyled,
|
|
1723
|
-
},
|
|
1724
|
-
className
|
|
1725
|
-
),
|
|
1726
|
-
children
|
|
1727
|
-
},
|
|
1728
|
-
index
|
|
1729
|
-
);
|
|
1730
|
-
};
|
|
1731
|
-
CarouselPageIndicator.displayName = "Carousel.PageIndicator";
|
|
1732
|
-
|
|
1733
|
-
// src/carousel/CarouselPagePicker.tsx
|
|
1734
|
-
var import_class_variance_authority9 = require("class-variance-authority");
|
|
1735
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1736
|
-
var CarouselPagePicker = ({ children, className }) => {
|
|
1737
|
-
const ctx = useCarouselContext();
|
|
1738
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1739
|
-
"div",
|
|
1740
|
-
{
|
|
1741
|
-
"data-spark-component": "carousel-page-picker",
|
|
1742
|
-
...ctx.getIndicatorGroupProps(),
|
|
1743
|
-
className: (0, import_class_variance_authority9.cx)(
|
|
1744
|
-
"flex-wrap items-center justify-center",
|
|
1745
|
-
"default:min-h-sz-16 flex",
|
|
1746
|
-
ctx.pagePickerInset && "bottom-sz-12 absolute inset-x-0",
|
|
1747
|
-
className
|
|
1748
|
-
),
|
|
1749
|
-
children: ctx.pageSnapPoints.length <= 1 ? null : children({
|
|
1750
|
-
...ctx,
|
|
1751
|
-
pages: Array.from({ length: ctx.pageSnapPoints.length }, (_, i) => i)
|
|
1752
|
-
})
|
|
1753
|
-
}
|
|
1754
|
-
) });
|
|
1755
|
-
};
|
|
1756
|
-
CarouselPagePicker.displayName = "Carousel.PagePicker";
|
|
1757
|
-
|
|
1758
|
-
// src/carousel/CarouselPrevButton.tsx
|
|
1759
|
-
var import_ArrowVerticalLeft = require("@spark-ui/icons/ArrowVerticalLeft");
|
|
1760
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1761
|
-
var CarouselPrevButton = ({
|
|
1762
|
-
"aria-label": ariaLabel,
|
|
1763
|
-
...buttonProps
|
|
1764
|
-
}) => {
|
|
1765
|
-
const ctx = useCarouselContext();
|
|
1766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1767
|
-
IconButton,
|
|
1768
|
-
{
|
|
1769
|
-
"data-spark-component": "carousel-prev-button",
|
|
1770
|
-
...ctx.getPrevTriggerProps(),
|
|
1771
|
-
intent: "surface",
|
|
1772
|
-
design: "filled",
|
|
1773
|
-
className: "pointer-events-auto cursor-pointer shadow-sm disabled:invisible",
|
|
1774
|
-
"aria-label": ariaLabel,
|
|
1775
|
-
...buttonProps,
|
|
1776
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_ArrowVerticalLeft.ArrowVerticalLeft, {}) })
|
|
1777
|
-
}
|
|
1778
|
-
);
|
|
1779
|
-
};
|
|
1780
|
-
CarouselPrevButton.displayName = "Carousel.PrevButton";
|
|
1781
|
-
|
|
1782
|
-
// src/carousel/CarouselSlide.tsx
|
|
1783
|
-
var import_class_variance_authority10 = require("class-variance-authority");
|
|
1784
|
-
var import_react14 = require("react");
|
|
1785
|
-
|
|
1786
|
-
// src/carousel/useIsVisible.ts
|
|
1787
|
-
var import_react13 = require("react");
|
|
1788
|
-
function useIsVisible(elementRef, _parentRef) {
|
|
1789
|
-
const [isVisible, setIsVisible] = (0, import_react13.useState)(true);
|
|
1790
|
-
const ctx = useCarouselContext();
|
|
1791
|
-
(0, import_react13.useEffect)(() => {
|
|
1792
|
-
const el = elementRef.current;
|
|
1793
|
-
if (!el) return;
|
|
1794
|
-
const { registerSlide, unregisterSlide } = ctx;
|
|
1795
|
-
registerSlide(el, setIsVisible);
|
|
1796
|
-
return () => {
|
|
1797
|
-
unregisterSlide(el);
|
|
1798
|
-
};
|
|
1799
|
-
}, [elementRef]);
|
|
1800
|
-
return isVisible;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
// src/carousel/CarouselSlide.tsx
|
|
1804
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1805
|
-
var CarouselSlide = ({
|
|
1806
|
-
children,
|
|
1807
|
-
index = 0,
|
|
1808
|
-
totalSlides,
|
|
1809
|
-
className = "",
|
|
1810
|
-
...props
|
|
1811
|
-
}) => {
|
|
1812
|
-
const itemRef = (0, import_react14.useRef)(null);
|
|
1813
|
-
const ctx = useCarouselContext();
|
|
1814
|
-
const isVisible = useIsVisible(itemRef, ctx.ref);
|
|
1815
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1816
|
-
"div",
|
|
1817
|
-
{
|
|
1818
|
-
"data-spark-component": "carousel-slide",
|
|
1819
|
-
ref: itemRef,
|
|
1820
|
-
...ctx.getSlideProps({ index, totalSlides }),
|
|
1821
|
-
className: (0, import_class_variance_authority10.cx)("default:bg-surface relative overflow-hidden", className),
|
|
1822
|
-
"aria-hidden": !isVisible,
|
|
1823
|
-
inert: !isVisible,
|
|
1824
|
-
...props,
|
|
1825
|
-
children
|
|
1826
|
-
}
|
|
1827
|
-
);
|
|
1828
|
-
};
|
|
1829
|
-
CarouselSlide.displayName = "Carousel.Slide";
|
|
1830
|
-
|
|
1831
|
-
// src/carousel/CarouselSlides.tsx
|
|
1832
|
-
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1833
|
-
var import_react15 = require("react");
|
|
1834
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1835
|
-
var CarouselSlides = ({ children, className = "" }) => {
|
|
1836
|
-
const ctx = useCarouselContext();
|
|
1837
|
-
const childrenElements = import_react15.Children.toArray(children);
|
|
1838
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1839
|
-
"div",
|
|
1840
|
-
{
|
|
1841
|
-
"data-spark-component": "carousel-slides",
|
|
1842
|
-
...ctx.getSlidesContainerProps(),
|
|
1843
|
-
className: (0, import_class_variance_authority11.cx)(
|
|
1844
|
-
"focus-visible:u-outline relative w-full",
|
|
1845
|
-
"[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1846
|
-
className
|
|
1847
|
-
),
|
|
1848
|
-
children: childrenElements.map(
|
|
1849
|
-
(child, index) => (0, import_react15.isValidElement)(child) ? (0, import_react15.cloneElement)(child, {
|
|
1850
|
-
index,
|
|
1851
|
-
totalSlides: childrenElements.length
|
|
1852
|
-
}) : child
|
|
1853
|
-
)
|
|
1854
|
-
}
|
|
1855
|
-
);
|
|
1856
|
-
};
|
|
1857
|
-
CarouselSlides.displayName = "Carousel.Slides";
|
|
1858
|
-
|
|
1859
|
-
// src/carousel/CarouselViewport.tsx
|
|
1860
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1861
|
-
var CarouselViewport = ({ children }) => {
|
|
1862
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "relative flex items-center justify-around p-0", children });
|
|
1863
|
-
};
|
|
1864
|
-
CarouselViewport.displayName = "Carousel.Viewport";
|
|
1865
|
-
|
|
1866
|
-
// src/carousel/index.ts
|
|
1867
|
-
var Carousel2 = Object.assign(Carousel, {
|
|
1868
|
-
Controls: CarouselControls,
|
|
1869
|
-
NextButton: CarouselNextButton,
|
|
1870
|
-
PrevButton: CarouselPrevButton,
|
|
1871
|
-
Slide: CarouselSlide,
|
|
1872
|
-
Slides: CarouselSlides,
|
|
1873
|
-
Viewport: CarouselViewport,
|
|
1874
|
-
PagePicker: CarouselPagePicker,
|
|
1875
|
-
PageIndicator: CarouselPageIndicator
|
|
1876
|
-
});
|
|
1877
|
-
Carousel2.displayName = "Carousel";
|
|
1878
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1879
|
-
0 && (module.exports = {
|
|
1880
|
-
Carousel
|
|
1881
|
-
});
|
|
1882
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),k=require("class-variance-authority"),s=require("react"),se=require("@spark-ui/icons/ArrowVerticalRight"),O=require("../Icon-CF0W0LKr.js"),$=require("../IconButton-D3g86WpZ.js"),oe=require("@spark-ui/icons/ArrowVerticalLeft");function ae(e){const t=s.useRef(new Map),r=s.useRef(null),n=s.useRef(new Map),o=s.useCallback(()=>u=>{u.forEach(d=>{const b=d.isIntersecting,S=d.target;t.current.set(S,b);const h=n.current.get(S);h&&h(b)})},[]),a=s.useCallback(()=>{if(r.current)return r.current;const u=e.current;if(!u)return null;const d=new IntersectionObserver(o(),{root:u,threshold:.2});return r.current=d,d},[e,o]);s.useEffect(()=>{const u=a(),d=t.current,b=n.current;return()=>{u&&(u.disconnect(),d.clear(),b.clear(),r.current=null)}},[a]);const i=s.useCallback((u,d)=>{if(!u)return;const b=a();if(!b){setTimeout(()=>i(u,d),0);return}const S=t.current.get(u)??!0;t.current.set(u,S),n.current.set(u,d),b.observe(u),d(S)},[a]),c=s.useCallback(u=>{if(!u)return;const d=r.current;d&&d.unobserve(u),t.current.delete(u),n.current.delete(u)},[]),g=s.useCallback(u=>u?t.current.get(u)??!0:!0,[]);return{registerSlide:i,unregisterSlide:c,isSlideVisible:g}}function ie(e){const t=s.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return s.useLayoutEffect(()=>{t.current=e}),s.useCallback((...r)=>t.current?.(...r),[])}const ce=()=>{const e=s.useRef(!1);return s.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function ue(e,t){const r=s.useRef(0),n=s.useRef(null);s.useEffect(()=>{const o=e.current;if(!o)return;const a="onscrollend"in window,i=()=>{t()},c=()=>{n.current&&clearTimeout(n.current),e.current&&(r.current=e.current.scrollLeft,n.current=setTimeout(()=>{e.current&&i()},150))};return a?o.addEventListener("scrollend",i):o.addEventListener("scroll",c),()=>{n.current&&clearTimeout(n.current),a?o.removeEventListener("scrollend",i):o.removeEventListener("scroll",c)}},[t,e])}function le(e,t){s.useLayoutEffect(()=>{const r=e.current;if(!r)return;const n=new ResizeObserver(o=>{for(const a of o)t(a.contentRect.width)});return n.observe(r),()=>n.disconnect()},[e,t])}function de({totalSlides:e,slidesPerMove:t,slidesPerPage:r}){const n=t==="auto"?r:t,o=[],a=Math.floor((e-r)/n)*n;for(let i=0;i<=a;i+=n)o.push(i);return o[o.length-1]!==e-r&&o.push(e-r),o}function q(e){return e?Array.from(e.querySelectorAll('[data-part="item"]')):[]}function _(e,{container:t,slidesPerMove:r,slidesPerPage:n}){return de({totalSlides:q(t).length,slidesPerPage:n,slidesPerMove:r}).includes(e)}function B({container:e,slidesPerMove:t,slidesPerPage:r}){return e?q(e).filter((n,o)=>_(o,{slidesPerMove:t,slidesPerPage:r,container:e})).map(n=>n.offsetLeft):[]}function fe({dotIndex:e,pageState:t,totalPages:r,maxDots:n=5}){if(r<=n)return e===t?"active":"idle";if(t<=Math.floor(n/2))return e>n-1?"hidden":e===t?"active":e===n-1?"edge":"idle";if(t>=r-Math.ceil(n/2)){const i=r-n;return e<i?"hidden":e===t?"active":e===i?"edge":"idle"}const o=t-Math.floor(n/2),a=t+Math.floor(n/2);return e<o||e>a?"hidden":e===t?"active":e===o||e===a?"edge":"idle"}function pe(e=[],{carouselRef:t,slidesPerMove:r,slidesPerPage:n}){const[o,a]=s.useState(e),i=s.useMemo(()=>o,[o]);return le(t,()=>{const c=B({slidesPerMove:r,slidesPerPage:n,container:t.current});JSON.stringify(o)!==JSON.stringify(c)&&a(c)}),[i,a]}const x="carousel",N="ltr",ge=({defaultPage:e,gap:t=16,snapType:r="mandatory",snapStop:n="always",scrollPadding:o=0,slidesPerPage:a=1,slidesPerMove:i="auto",scrollBehavior:c="smooth",loop:g=!1,pagePickerInset:u=!1,maxDots:d=5,page:b,onPageChange:S})=>{const h=s.useId(),[f,I]=s.useState(e||b||0),C=s.useRef(null),M=s.useRef([]),T=ce().current,L=ie(S),{registerSlide:D,unregisterSlide:ee,isSlideVisible:te}=ae(C),[m]=pe([],{carouselRef:C,slidesPerMove:i,slidesPerPage:a}),P=s.useRef(g||f>0),R=s.useRef(g||f<m.length-1);P.current=g||f>0,R.current=g||f<m.length-1;const j=s.useCallback(l=>{l!==f&&(I(l),L?.(l))},[L,f]),y=s.useCallback((l,v)=>{C.current&&(C.current.scrollTo({left:m[l],behavior:v==="instant"?"auto":"smooth"}),j(l))},[j,m]),z=s.useCallback(l=>{if(P){const v=g&&f===0?m.length-1:Math.max(f-1,0);y(v,c),l?.(v)}},[g,m,f,c,y]),A=s.useCallback(l=>{if(R){const v=g&&f===m.length-1?0:Math.min(f+1,m.length-1);y(v,c),l?.(v)}},[g,m,f,c,y]);s.useEffect(()=>{b!=null&&y(b,c)},[b,c,y]),s.useLayoutEffect(()=>{if(e!=null&&!T&&C.current){const l=B({container:C.current,slidesPerMove:i,slidesPerPage:a});C.current.scrollTo({left:l[e],behavior:"instant"})}},[e,T,i,a]);const re=s.useCallback(()=>{if(!C.current||m.length===0)return;const{scrollLeft:l}=C.current,v=m.map(V=>Math.abs(l-V)),E=v.indexOf(Math.min(...v));E!==-1&&j(E)},[m,j]);return ue(C,re),{ref:C,pageIndicatorsRefs:M,gap:t,snapType:r,snapStop:n,scrollPadding:o,slidesPerPage:a,slidesPerMove:i,scrollBehavior:c,loop:g,pagePickerInset:u,maxDots:d,page:f,pageSnapPoints:m,canScrollNext:R.current,canScrollPrev:P.current,scrollTo:y,scrollPrev:z,scrollNext:A,registerSlide:D,unregisterSlide:ee,isSlideVisible:te,getRootProps:()=>({id:`carousel::${h}:`,role:"region","aria-roledescription":"carousel","data-scope":x,"data-part":"root","data-orientation":"horizontal",dir:N,style:{"--slides-per-page":a,"--slide-spacing":`${t}px`,"--slide-item-size":"calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"}}),getControlProps:()=>({"data-scope":x,"data-part":"control","data-orientation":"horizontal"}),getPrevTriggerProps:()=>({id:`carousel::${h}::prev-trigger`,"aria-controls":`carousel::${h}::item-group`,"data-scope":x,"data-part":"prev-trigger","data-orientation":"horizontal",type:"button",dir:N,disabled:!P.current,onClick:()=>z()}),getNextTriggerProps:()=>({id:`carousel::${h}::next-trigger`,"aria-controls":`carousel::${h}::item-group`,"data-scope":x,"data-part":"next-trigger","data-orientation":"horizontal",type:"button",dir:N,disabled:!R.current,onClick:()=>A()}),getSlidesContainerProps:()=>({id:`carousel::${h}::item-group`,"aria-live":a>1?"off":"polite","data-scope":x,"data-part":"item-group","data-orientation":"horizontal",dir:N,tabIndex:0,style:{display:"grid",gap:"var(--slide-spacing)",scrollSnapType:`x ${r}`,gridAutoFlow:"column",scrollbarWidth:"none",gridAutoColumns:"var(--slide-item-size)",overflowX:"auto"},ref:C}),getSlideProps:({index:l})=>{const v=_(l,{container:C.current,slidesPerMove:i,slidesPerPage:a});return{id:`carousel::${h}::item:${l}`,role:"group","aria-roledescription":"slide","data-scope":x,"data-part":"item","data-index":l,"data-orientation":"horizontal",dir:N,style:{...v&&{scrollSnapAlign:"start",scrollSnapStop:n}}}},getIndicatorGroupProps:()=>({role:"radiogroup",id:`carousel::${h}::indicator-group`,"data-scope":x,"data-part":"indicator-group","data-orientation":"horizontal",dir:N}),getIndicatorProps:({index:l})=>{const v=fe({dotIndex:l,pageState:f,totalPages:m.length,maxDots:d});return{role:"radio",id:`carousel::${h}::indicator:${l}`,"aria-checked":l===f,"data-scope":x,"data-part":"indicator","data-orientation":"horizontal","data-index":l,"data-state":v,tabIndex:l===f?0:-1,onClick:()=>{y(l,c)},onKeyDown:E=>{const V=ne=>{M.current[ne]?.focus()};E.key==="ArrowRight"&&R?A(V):E.key==="ArrowLeft"&&P&&z(V)}}}}},F=s.createContext(null),G=({className:e,snapType:t="mandatory",snapStop:r="always",scrollBehavior:n="smooth",slidesPerMove:o="auto",pagePickerInset:a=!1,slidesPerPage:i=1,loop:c=!1,children:g,gap:u=16,defaultPage:d,page:b,onPageChange:S,maxDots:h=5,...f})=>{const I=ge({defaultPage:d,slidesPerPage:i,slidesPerMove:o,loop:c,gap:u,scrollBehavior:n,snapStop:r,snapType:t,page:b,pagePickerInset:a,onPageChange:S,maxDots:h});return p.jsx(F.Provider,{value:{...I,scrollBehavior:n},children:p.jsx("div",{"data-spark-component":"carousel",className:k.cx("gap-lg relative box-border flex flex-col",e),...I.getRootProps(),...f,children:g})})};G.displayName="Carousel";const w=()=>{const e=s.useContext(F);if(!e)throw Error("useCarouselContext must be used within a Carousel provider");return e},J=({children:e,className:t,...r})=>{const n=w();return p.jsx("div",{"data-spark-component":"carousel-controls",className:k.cx("default:px-lg pointer-events-none absolute inset-0 flex flex-row items-center justify-between",t),...n.getControlProps(),...r,children:e})};J.displayName="Carousel.Controls";const W=({"aria-label":e,...t})=>{const r=w();return p.jsx($.IconButton,{"data-spark-component":"carousel-next-button",...r.getNextTriggerProps(),intent:"surface",design:"filled",className:"pointer-events-auto cursor-pointer shadow-sm disabled:invisible","aria-label":e,...t,children:p.jsx(O.Icon,{children:p.jsx(se.ArrowVerticalRight,{})})})};W.displayName="Carousel.NextButton";const K=({children:e,unstyled:t=!1,index:r,"aria-label":n,className:o,intent:a="basic"})=>{const i=w(),c=s.useRef(null);s.useEffect(()=>{i.pageIndicatorsRefs.current&&(i.pageIndicatorsRefs.current[r]=c.current)});const g=i.getIndicatorProps({index:r});return p.jsx("button",{"data-spark-component":"carousel-page-indicator",ref:c,...g,"aria-label":n,className:k.cx({[k.cx("border-outline group relative flex justify-center border-0 hover:cursor-pointer","m-sm rounded-sm transition-all duration-[200ms] ease-linear","w-sz-8 h-sz-8","data-[state=active]:w-sz-32 data-[state=active]:h-sz-8","data-[state=edge]:w-sz-4 data-[state=edge]:h-sz-4","data-[state=hidden]:m-0 data-[state=hidden]:size-0",a==="surface"?"data-[state=active]:bg-surface bg-surface/dim-2":"data-[state=active]:bg-basic bg-on-surface/dim-2")]:!t},o),children:e},r)};K.displayName="Carousel.PageIndicator";const X=({children:e,className:t})=>{const r=w();return p.jsx(p.Fragment,{children:p.jsx("div",{"data-spark-component":"carousel-page-picker",...r.getIndicatorGroupProps(),className:k.cx("flex-wrap items-center justify-center","default:min-h-sz-16 flex",r.pagePickerInset&&"bottom-sz-12 absolute inset-x-0",t),children:r.pageSnapPoints.length<=1?null:e({...r,pages:Array.from({length:r.pageSnapPoints.length},(n,o)=>o)})})})};X.displayName="Carousel.PagePicker";const H=({"aria-label":e,...t})=>{const r=w();return p.jsx($.IconButton,{"data-spark-component":"carousel-prev-button",...r.getPrevTriggerProps(),intent:"surface",design:"filled",className:"pointer-events-auto cursor-pointer shadow-sm disabled:invisible","aria-label":e,...t,children:p.jsx(O.Icon,{children:p.jsx(oe.ArrowVerticalLeft,{})})})};H.displayName="Carousel.PrevButton";function be(e,t){const[r,n]=s.useState(!0),o=w();return s.useEffect(()=>{const a=e.current;if(!a)return;const{registerSlide:i,unregisterSlide:c}=o;return i(a,n),()=>{c(a)}},[e]),r}const Q=({children:e,index:t=0,totalSlides:r,className:n="",...o})=>{const a=s.useRef(null),i=w(),c=be(a,i.ref);return p.jsx("div",{"data-spark-component":"carousel-slide",ref:a,...i.getSlideProps({index:t,totalSlides:r}),className:k.cx("default:bg-surface relative overflow-hidden",n),"aria-hidden":!c,inert:!c,...o,children:e})};Q.displayName="Carousel.Slide";const U=({children:e,className:t=""})=>{const r=w(),n=s.Children.toArray(e);return p.jsx("div",{"data-spark-component":"carousel-slides",...r.getSlidesContainerProps(),className:k.cx("focus-visible:u-outline relative w-full","[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",t),children:n.map((o,a)=>s.isValidElement(o)?s.cloneElement(o,{index:a,totalSlides:n.length}):o)})};U.displayName="Carousel.Slides";const Y=({children:e})=>p.jsx("div",{className:"relative flex items-center justify-around p-0",children:e});Y.displayName="Carousel.Viewport";const Z=Object.assign(G,{Controls:J,NextButton:W,PrevButton:H,Slide:Q,Slides:U,Viewport:Y,PagePicker:X,PageIndicator:K});Z.displayName="Carousel";exports.Carousel=Z;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|