@spark-ui/components 17.9.0-beta.2 → 17.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FormFieldRequiredIndicator-CEB8Ez-q.js.map +1 -1
- package/dist/FormFieldRequiredIndicator-CzdpinIz.mjs.map +1 -1
- package/dist/accordion/AccordionItem.d.ts +3 -0
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/AlertDialogAction.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogBody.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogCancel.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogContent.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogDescription.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogFooter.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogHeader.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogOverlay.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogPortal.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogTitle.d.ts +3 -0
- package/dist/alert-dialog/AlertDialogTrigger.d.ts +3 -0
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/avatar/AvatarAction.d.ts +3 -0
- package/dist/avatar/AvatarImage.d.ts +3 -0
- package/dist/avatar/AvatarOnlineBadge.d.ts +3 -0
- package/dist/avatar/AvatarPlaceholder.d.ts +3 -0
- package/dist/avatar/AvatarUser.d.ts +3 -0
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs.map +1 -1
- package/dist/badge/index.js +1 -1
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +3 -3
- package/dist/badge/index.mjs.map +1 -1
- package/dist/breadcrumb/BreadcrumbCurrentPage.d.ts +3 -0
- package/dist/breadcrumb/BreadcrumbItem.d.ts +3 -0
- package/dist/breadcrumb/BreadcrumbLink.d.ts +3 -0
- package/dist/breadcrumb/BreadcrumbSeparator.d.ts +3 -0
- package/dist/breadcrumb/index.js +1 -1
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/breadcrumb/index.mjs.map +1 -1
- package/dist/card/Backdrop.d.ts +17 -0
- package/dist/card/Content.d.ts +3 -0
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs.map +1 -1
- package/dist/carousel/CarouselControls.d.ts +3 -0
- package/dist/carousel/CarouselNextButton.d.ts +3 -0
- package/dist/carousel/CarouselPageIndicator.d.ts +3 -0
- package/dist/carousel/CarouselPagePicker.d.ts +3 -0
- package/dist/carousel/CarouselPrevButton.d.ts +3 -0
- package/dist/carousel/CarouselSlide.d.ts +3 -0
- package/dist/carousel/CarouselSlides.d.ts +3 -0
- package/dist/carousel/CarouselViewport.d.ts +3 -0
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs.map +1 -1
- package/dist/chip/ChipClearButton.d.ts +3 -0
- package/dist/chip/ChipContent.d.ts +3 -0
- package/dist/chip/ChipLeadingIcon.d.ts +3 -0
- package/dist/chip/ChipTrailingIcon.d.ts +3 -0
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs.map +1 -1
- package/dist/circular-meter/CircularMeterContent.d.ts +3 -0
- package/dist/circular-meter/CircularMeterLabel.d.ts +3 -0
- package/dist/circular-meter/CircularMeterTrack.d.ts +3 -0
- package/dist/circular-meter/CircularMeterValue.d.ts +3 -0
- package/dist/circular-meter/index.js.map +1 -1
- package/dist/circular-meter/index.mjs.map +1 -1
- package/dist/collapsible/Content.d.ts +3 -0
- package/dist/collapsible/Trigger.d.ts +3 -0
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/combobox/ComboboxClearButton.d.ts +3 -0
- package/dist/combobox/ComboboxDisclosure.d.ts +3 -0
- package/dist/combobox/ComboboxEmpty.d.ts +3 -0
- package/dist/combobox/ComboboxGroup.d.ts +3 -0
- package/dist/combobox/ComboboxInput.d.ts +3 -0
- package/dist/combobox/ComboboxItem.d.ts +3 -0
- package/dist/combobox/ComboboxItemIndicator.d.ts +3 -0
- package/dist/combobox/ComboboxItemText.d.ts +3 -0
- package/dist/combobox/ComboboxItems.d.ts +3 -0
- package/dist/combobox/ComboboxLabel.d.ts +3 -0
- package/dist/combobox/ComboboxLeadingIcon.d.ts +3 -0
- package/dist/combobox/ComboboxPopover.d.ts +3 -0
- package/dist/combobox/ComboboxPortal.d.ts +3 -0
- package/dist/combobox/ComboboxSelectedItems.d.ts +3 -0
- package/dist/combobox/ComboboxTrigger.d.ts +3 -0
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/dialog/DialogBody.d.ts +3 -0
- package/dist/dialog/DialogClose.d.ts +3 -0
- package/dist/dialog/DialogContent.d.ts +3 -0
- package/dist/dialog/DialogDescription.d.ts +3 -0
- package/dist/dialog/DialogFooter.d.ts +3 -0
- package/dist/dialog/DialogHeader.d.ts +3 -0
- package/dist/dialog/DialogOverlay.d.ts +3 -0
- package/dist/dialog/DialogPortal.d.ts +3 -0
- package/dist/dialog/DialogTitle.d.ts +3 -0
- package/dist/dialog/DialogTrigger.d.ts +3 -0
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/DividerContent.d.ts +3 -0
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs.map +1 -1
- package/dist/drawer/DrawerBody.d.ts +3 -0
- package/dist/drawer/DrawerClose.d.ts +3 -0
- package/dist/drawer/DrawerCloseButton.d.ts +3 -0
- package/dist/drawer/DrawerContent.d.ts +3 -0
- package/dist/drawer/DrawerDescription.d.ts +3 -0
- package/dist/drawer/DrawerFooter.d.ts +3 -0
- package/dist/drawer/DrawerHeader.d.ts +3 -0
- package/dist/drawer/DrawerOverlay.d.ts +3 -0
- package/dist/drawer/DrawerPortal.d.ts +3 -0
- package/dist/drawer/DrawerTitle.d.ts +3 -0
- package/dist/drawer/DrawerTrigger.d.ts +3 -0
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown/DropdownDivider.d.ts +3 -0
- package/dist/dropdown/DropdownGroup.d.ts +3 -0
- package/dist/dropdown/DropdownItem.d.ts +3 -0
- package/dist/dropdown/DropdownItemIndicator.d.ts +3 -0
- package/dist/dropdown/DropdownItemText.d.ts +3 -0
- package/dist/dropdown/DropdownItems.d.ts +3 -0
- package/dist/dropdown/DropdownLabel.d.ts +3 -0
- package/dist/dropdown/DropdownLeadingIcon.d.ts +3 -0
- package/dist/dropdown/DropdownPopover.d.ts +3 -0
- package/dist/dropdown/DropdownPortal.d.ts +3 -0
- package/dist/dropdown/DropdownTrigger.d.ts +3 -0
- package/dist/dropdown/DropdownValue.d.ts +3 -0
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/file-upload/FileUploadAcceptedFile.d.ts +1 -0
- package/dist/file-upload/FileUploadContext.d.ts +1 -0
- package/dist/file-upload/FileUploadDropzone.d.ts +3 -0
- package/dist/file-upload/FileUploadItemDeleteTrigger.d.ts +3 -0
- package/dist/file-upload/FileUploadPreviewImage.d.ts +1 -0
- package/dist/file-upload/FileUploadRejectedFile.d.ts +1 -0
- package/dist/file-upload/FileUploadRejectedFileDeleteTrigger.d.ts +1 -0
- package/dist/file-upload/FileUploadTrigger.d.ts +3 -0
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs.map +1 -1
- package/dist/form-field/FormFieldAlertMessage.d.ts +1 -0
- package/dist/form-field/FormFieldCharactersCount.d.ts +1 -0
- package/dist/form-field/FormFieldControl.d.ts +1 -0
- package/dist/form-field/FormFieldErrorMessage.d.ts +1 -0
- package/dist/form-field/FormFieldHelperMessage.d.ts +1 -0
- package/dist/form-field/FormFieldLabel.d.ts +1 -0
- package/dist/form-field/FormFieldRequiredIndicator.d.ts +1 -0
- package/dist/form-field/FormFieldStateMessage.d.ts +3 -0
- package/dist/form-field/FormFieldSuccessMessage.d.ts +1 -0
- package/dist/form-field/index.js +1 -1
- package/dist/form-field/index.mjs +1 -1
- package/dist/{form-field-CYGgse45.js → form-field-1sKqNg7F.js} +2 -2
- package/dist/form-field-1sKqNg7F.js.map +1 -0
- package/dist/{form-field-CV5dzt-I.mjs → form-field-OhKW7u5I.mjs} +2 -2
- package/dist/form-field-OhKW7u5I.mjs.map +1 -0
- package/dist/input/InputLeadingIcon.d.ts +1 -0
- package/dist/input/InputTrailingIcon.d.ts +1 -0
- package/dist/input-BIuBpTEq.mjs.map +1 -1
- package/dist/input-Cx5cfgE8.js.map +1 -1
- package/dist/input-otp/InputOTPGroup.d.ts +3 -0
- package/dist/input-otp/InputOTPSeparator.d.ts +3 -0
- package/dist/input-otp/InputOTPSlot.d.ts +3 -0
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/kbd/index.js +1 -1
- package/dist/kbd/index.js.map +1 -1
- package/dist/kbd/index.mjs +1 -1
- package/dist/kbd/index.mjs.map +1 -1
- package/dist/label/LabelRequiredIndicator.d.ts +3 -0
- package/dist/label-BCSEss4U.js.map +1 -1
- package/dist/label-DDBRKLUX.mjs.map +1 -1
- package/dist/link-box/LinkBoxLink.d.ts +3 -0
- package/dist/link-box/LinkBoxRaised.d.ts +24 -0
- package/dist/link-box/index.js.map +1 -1
- package/dist/link-box/index.mjs.map +1 -1
- package/dist/menu/Menu.d.ts +15 -0
- package/dist/menu/MenuCheckboxItem.d.ts +20 -0
- package/dist/menu/MenuCheckboxItemIndicator.d.ts +25 -0
- package/dist/menu/MenuGroup.d.ts +12 -0
- package/dist/menu/MenuGroupLabel.d.ts +19 -0
- package/dist/menu/MenuItem.d.ts +19 -0
- package/dist/menu/MenuItemStyles.d.ts +5 -0
- package/dist/menu/MenuLinkItem.d.ts +27 -0
- package/dist/menu/MenuPopup.d.ts +19 -0
- package/dist/menu/MenuPortal.d.ts +12 -0
- package/dist/menu/MenuPositioner.d.ts +12 -0
- package/dist/menu/MenuRadioGroup.d.ts +12 -0
- package/dist/menu/MenuRadioItem.d.ts +20 -0
- package/dist/menu/MenuRadioItemIndicator.d.ts +25 -0
- package/dist/menu/MenuSeparator.d.ts +12 -0
- package/dist/menu/MenuSubmenu.d.ts +16 -0
- package/dist/menu/MenuSubmenuContext.d.ts +8 -0
- package/dist/menu/MenuSubmenuTrigger.d.ts +19 -0
- package/dist/menu/MenuTrigger.d.ts +21 -0
- package/dist/menu/index.d.mts +49 -0
- package/dist/menu/index.d.ts +49 -0
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.js.map +1 -0
- package/dist/menu/index.mjs +289 -0
- package/dist/menu/index.mjs.map +1 -0
- package/dist/menu/useRenderSlot.d.ts +1 -0
- package/dist/meter/MeterLabel.d.ts +3 -0
- package/dist/meter/MeterTrack.d.ts +3 -0
- package/dist/meter/MeterValue.d.ts +3 -0
- package/dist/meter/index.js.map +1 -1
- package/dist/meter/index.mjs.map +1 -1
- package/dist/pagination/PaginationEllipsis.d.ts +3 -0
- package/dist/pagination/PaginationFirstPageTrigger.d.ts +3 -0
- package/dist/pagination/PaginationLastPageTrigger.d.ts +3 -0
- package/dist/pagination/PaginationNextTrigger.d.ts +3 -0
- package/dist/pagination/PaginationPages.d.ts +3 -0
- package/dist/pagination/PaginationPrevTrigger.d.ts +3 -0
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/popover/PopoverAnchor.d.ts +3 -0
- package/dist/popover/PopoverArrow.d.ts +3 -0
- package/dist/popover/PopoverCloseButton.d.ts +3 -0
- package/dist/popover/PopoverContent.d.ts +3 -0
- package/dist/popover/PopoverHeader.d.ts +3 -0
- package/dist/popover/PopoverPortal.d.ts +3 -0
- package/dist/popover/PopoverTrigger.d.ts +3 -0
- package/dist/popover-DKa4WOQV.mjs.map +1 -1
- package/dist/popover-ayPbAw59.js.map +1 -1
- package/dist/progress/ProgressLabel.d.ts +3 -0
- package/dist/progress/ProgressTrack.d.ts +1 -0
- package/dist/progress/ProgressValue.d.ts +1 -0
- package/dist/progress-C-Zs94G2.mjs.map +1 -1
- package/dist/progress-DaQt4olK.js.map +1 -1
- package/dist/progress-tracker/ProgressTrackerStep.d.ts +1 -0
- package/dist/progress-tracker/ProgressTrackerStepIndicator.d.ts +1 -0
- package/dist/progress-tracker/ProgressTrackerStepLabel.d.ts +1 -0
- package/dist/progress-tracker/index.js +1 -1
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +2 -2
- package/dist/progress-tracker/index.mjs.map +1 -1
- package/dist/radio-group/Radio.d.ts +3 -0
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.js +1 -1
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +2 -2
- package/dist/rating/index.mjs.map +1 -1
- package/dist/rating-display/RatingDisplayCount.d.ts +1 -0
- package/dist/rating-display/RatingDisplayStars.d.ts +1 -0
- package/dist/rating-display/RatingDisplayValue.d.ts +1 -0
- package/dist/rating-display/index.js +1 -1
- package/dist/rating-display/index.js.map +1 -1
- package/dist/rating-display/index.mjs +4 -4
- package/dist/rating-display/index.mjs.map +1 -1
- package/dist/scrolling-list/ScrollingListControls.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListItem.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListItems.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListNextButton.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListPrevButton.d.ts +1 -0
- package/dist/scrolling-list/ScrollingListSkipButton.d.ts +1 -0
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/segmented-control/SegmentedControlIndicator.d.ts +1 -0
- package/dist/segmented-control/SegmentedControlItem.d.ts +1 -0
- package/dist/segmented-control/index.js.map +1 -1
- package/dist/segmented-control/index.mjs.map +1 -1
- package/dist/segmented-gauge/SegmentedGaugeLabel.d.ts +1 -0
- package/dist/segmented-gauge/SegmentedGaugeSegment.d.ts +3 -0
- package/dist/segmented-gauge/SegmentedGaugeTrack.d.ts +1 -0
- package/dist/segmented-gauge/index.js.map +1 -1
- package/dist/segmented-gauge/index.mjs.map +1 -1
- package/dist/select/SelectGroup.d.ts +3 -0
- package/dist/select/SelectItem.d.ts +3 -0
- package/dist/select/SelectItems.d.ts +3 -0
- package/dist/select/SelectLabel.d.ts +3 -0
- package/dist/select/SelectLeadingIcon.d.ts +3 -0
- package/dist/select/SelectPlaceholder.d.ts +3 -0
- package/dist/select/SelectTrigger.d.ts +3 -0
- package/dist/select/SelectValue.d.ts +3 -0
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs.map +1 -1
- package/dist/skeleton/SkeletonItem.d.ts +3 -0
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs.map +1 -1
- package/dist/slider/SliderControl.d.ts +1 -0
- package/dist/slider/SliderIndicator.d.ts +1 -0
- package/dist/slider/SliderLabel.d.ts +1 -0
- package/dist/slider/SliderMaxValue.d.ts +1 -0
- package/dist/slider/SliderMinValue.d.ts +1 -0
- package/dist/slider/SliderThumb.d.ts +1 -0
- package/dist/slider/SliderTrack.d.ts +1 -0
- package/dist/slider/SliderValue.d.ts +1 -3
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs.map +1 -1
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/table/TableBody.d.ts +1 -0
- package/dist/table/TableBulkBar.d.ts +15 -0
- package/dist/table/TableCell.d.ts +1 -0
- package/dist/table/TableColumn.d.ts +1 -0
- package/dist/table/TableHeader.d.ts +1 -0
- package/dist/table/TableRow.d.ts +1 -0
- package/dist/table/index.js.map +1 -1
- package/dist/table/index.mjs.map +1 -1
- package/dist/tabs/TabsContent.d.ts +1 -0
- package/dist/tabs/TabsList.d.ts +1 -0
- package/dist/tabs/TabsTrigger.d.ts +1 -0
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/text-link/index.js +1 -1
- package/dist/text-link/index.js.map +1 -1
- package/dist/text-link/index.mjs +1 -1
- package/dist/text-link/index.mjs.map +1 -1
- package/dist/textarea/TextareaClearButton.d.ts +1 -0
- package/dist/textarea/TextareaLeadingIcon.d.ts +1 -0
- package/dist/textarea/TextareaTrailingIcon.d.ts +1 -0
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/form-field-CV5dzt-I.mjs.map +0 -1
- package/dist/form-field-CYGgse45.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/dialog/DialogContext.tsx","../../src/dialog/Dialog.tsx","../../src/dialog/DialogBody.tsx","../../src/dialog/DialogClose.tsx","../../src/dialog/DialogCloseButton.tsx","../../src/dialog/DialogContent.tsx","../../src/dialog/DialogDescription.tsx","../../src/dialog/DialogFooter.tsx","../../src/dialog/DialogHeader.tsx","../../src/dialog/DialogOverlay.tsx","../../src/dialog/DialogPortal.tsx","../../src/dialog/DialogTitle.tsx","../../src/dialog/DialogTrigger.tsx","../../src/dialog/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from 'react'\n\nexport interface DialogContextState {\n isFullScreen: boolean\n setIsFullScreen: (value: boolean) => void\n withFade: boolean\n}\n\nconst DialogContext = createContext<DialogContextState | null>(null)\n\nexport const DialogProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n const [isFullScreen, setIsFullScreen] = useState(false)\n\n return (\n <DialogContext.Provider\n value={{\n isFullScreen,\n setIsFullScreen,\n withFade,\n }}\n >\n {childrenProp}\n </DialogContext.Provider>\n )\n}\n\nexport const useDialog = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw Error('useDialog must be used within a Dialog provider')\n }\n\n return context\n}\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, type ReactElement } from 'react'\n\nimport { DialogProvider } from './DialogContext'\n\nexport interface DialogProps extends Omit<\n ComponentProps<typeof BaseDialog.Root>,\n 'onOpenChange' | 'render'\n> {\n /**\n * Specifies if the dialog is open or not.\n */\n open?: boolean\n /**\n * Default open state.\n */\n defaultOpen?: boolean\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: boolean\n /**\n * Specifies if the dialog should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Dialog = ({ withFade = false, onOpenChange, ...props }: DialogProps): ReactElement => {\n const handleOpenChange = onOpenChange\n ? (open: boolean, _eventDetails: unknown) => {\n onOpenChange(open)\n }\n : undefined\n\n return (\n <DialogProvider withFade={withFade}>\n <BaseDialog.Root data-spark-component=\"dialog\" onOpenChange={handleOpenChange} {...props} />\n </DialogProvider>\n )\n}\n\nDialog.createHandle = BaseDialog.createHandle\nDialog.displayName = 'Dialog.Root'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref, useRef } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport interface BodyProps {\n children: ReactNode\n className?: string\n tabIndex?: number\n ref?: Ref<HTMLDivElement>\n inset?: boolean\n}\n\nexport const Body = ({\n children,\n className,\n inset = false,\n ref: forwardedRef,\n ...rest\n}: BodyProps): ReactElement => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDialog()\n\n const { overflow } = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"dialog-body\"\n ref={ref}\n className={cx(\n 'focus-visible:u-outline relative grow overflow-y-auto outline-hidden',\n 'transition-all duration-300',\n {\n ['px-xl py-lg']: !inset,\n },\n className\n )}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dialog.Body'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from '../drawer/useRenderSlot'\n\nexport interface CloseProps extends Omit<ComponentProps<typeof BaseDialog.Close>, 'render'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Close = ({ asChild = false, ...props }: CloseProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Close data-spark-component=\"dialog-close\" render={renderSlot} {...props} />\n}\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { Close, CloseProps } from './DialogClose'\n\nexport type CloseButtonProps = CloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nconst Root = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <Close\n data-spark-component=\"dialog-close-button\"\n data-part=\"close\"\n ref={ref}\n className={cx(['absolute', 'top-md', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </Close>\n )\n}\n\nexport const CloseButton = Object.assign(Root, {\n id: 'CloseButton',\n})\n\nRoot.displayName = 'Dialog.CloseButton'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref, useEffect } from 'react'\n\nimport { dialogContentStyles, type DialogContentStylesProps } from './DialogContent.styles'\nimport { useDialog } from './DialogContext'\n\nexport interface ContentProps\n extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DialogContentStylesProps {\n /**\n * When set to true, the content will adjust its width to fit the content rather than taking up the full available width.\n */\n isNarrow?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Content = ({\n className,\n isNarrow = false,\n size = 'md',\n ref,\n ...rest\n}: ContentProps) => {\n const { setIsFullScreen } = useDialog()\n\n useEffect(() => {\n if (size === 'fullscreen') setIsFullScreen(true)\n\n return () => setIsFullScreen(false)\n }, [setIsFullScreen, size])\n\n return (\n <BaseDialog.Popup\n ref={ref}\n data-spark-component=\"dialog-content\"\n role=\"dialog\"\n className={state =>\n cx(\n dialogContentStyles({\n isNarrow,\n size,\n className: typeof className === 'function' ? className(state) : className,\n })\n )\n }\n {...rest}\n />\n )\n}\n\nContent.displayName = 'Dialog.Content'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nexport type DescriptionProps = ComponentProps<typeof BaseDialog.Description> & {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const Description = (props: DescriptionProps) => (\n <BaseDialog.Description data-spark-component=\"dialog-description\" {...props} />\n)\n\nDescription.displayName = 'Dialog.Description'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface FooterProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Footer = ({ children, className, ref, ...rest }: FooterProps): ReactElement => (\n <footer\n data-spark-component=\"dialog-footer\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </footer>\n)\n\nFooter.displayName = 'Dialog.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps): ReactElement => (\n <header\n data-spark-component=\"dialog-header\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </header>\n)\n\nHeader.displayName = 'Dialog.Header'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface OverlayProps extends Omit<ComponentProps<typeof BaseDialog.Backdrop>, 'render'> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Overlay = ({ className, ...props }: OverlayProps) => {\n return (\n <BaseDialog.Backdrop\n data-spark-component=\"dialog-overlay\"\n className={state =>\n cx(\n 'z-overlay size-screen fixed inset-0',\n 'bg-overlay/dim-1',\n 'data-starting-style:animate-fade-in',\n 'data-ending-style:animate-fade-out',\n typeof className === 'function' ? className(state) : className\n )\n }\n {...props}\n />\n )\n}\n\nOverlay.displayName = 'Dialog.Overlay'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nexport type PortalProps = ComponentProps<typeof BaseDialog.Portal>\n\nexport const Portal = ({ className, ...props }: PortalProps) => {\n return (\n <BaseDialog.Portal\n data-spark-component=\"dialog-portal\"\n className={cx(className, 'z-modal absolute')}\n {...props}\n />\n )\n}\n\nPortal.displayName = 'Dialog.Portal'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport type TitleProps = ComponentProps<typeof BaseDialog.Title> & {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const Title = ({ className, ref, ...others }: TitleProps) => {\n return (\n <BaseDialog.Title\n data-spark-component=\"dialog-title\"\n ref={ref}\n className={cx(\n 'text-headline-1 text-on-surface',\n 'group-has-data-[part=close]:pr-3xl',\n className\n )}\n {...others}\n />\n )\n}\n\nTitle.displayName = 'Dialog.Title'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from '../drawer/useRenderSlot'\n\nexport interface TriggerProps extends Omit<ComponentProps<typeof BaseDialog.Trigger>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = ({ asChild = false, ...props }: TriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Trigger data-spark-component=\"dialog-trigger\" render={renderSlot} {...props} />\n}\n\nTrigger.displayName = 'Dialog.Trigger'\n","import { Dialog as Root } from './Dialog'\nimport { Body } from './DialogBody'\nimport { Close } from './DialogClose'\nimport { CloseButton } from './DialogCloseButton'\nimport { Content } from './DialogContent'\nimport { Description } from './DialogDescription' // aria-describedby\nimport { Footer } from './DialogFooter'\nimport { Header } from './DialogHeader'\nimport { Overlay } from './DialogOverlay'\nimport { Portal } from './DialogPortal'\nimport { Title } from './DialogTitle' // aria-labelledby\nimport { Trigger } from './DialogTrigger'\n\n/**\n * A modal window that displays content on top of the main page, requiring user interaction before returning to the main flow.\n */\nexport const Dialog: typeof Root & {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Overlay: typeof Overlay\n Content: typeof Content\n Header: typeof Header\n Body: typeof Body\n Footer: typeof Footer\n Close: typeof Close\n CloseButton: typeof CloseButton\n Title: typeof Title\n Description: typeof Description\n} = Object.assign(Root, {\n Trigger,\n Portal,\n Overlay,\n Content,\n Header,\n Body,\n Footer,\n Close,\n CloseButton,\n Title,\n Description,\n})\n\nDialog.displayName = 'Dialog'\n\nexport { type DialogProps } from './Dialog'\nexport { type ContentProps as DialogContentProps } from './DialogContent'\nexport { type HeaderProps as DialogHeaderProps } from './DialogHeader'\nexport { type BodyProps as DialogBodyProps } from './DialogBody'\nexport { type FooterProps as DialogFooterProps } from './DialogFooter'\nexport { type TriggerProps as DialogTriggerProps } from './DialogTrigger'\nexport { type OverlayProps as DialogOverlayProps } from './DialogOverlay'\nexport { type PortalProps as DialogPortalProps } from './DialogPortal'\nexport { type TitleProps as DialogTitleProps } from './DialogTitle'\nexport { type DescriptionProps as DialogDescriptionProps } from './DialogDescription'\nexport { type CloseProps as DialogCloseProps } from './DialogClose'\nexport { type CloseButtonProps as DialogCloseButtonProps } from './DialogCloseButton'\n"],"mappings":";;;;;;;;;;;;AAQA,IAAM,IAAgB,EAAyC,KAAK,EAEvD,KAAkB,EAC7B,UAAU,GACV,cAAW,SAIP;CACJ,IAAM,CAAC,GAAc,KAAmB,EAAS,GAAM;AAEvD,QACE,kBAAC,EAAc,UAAf;EACE,OAAO;GACL;GACA;GACA;GACD;YAEA;EACsB,CAAA;GAIhB,UAAkB;CAC7B,IAAM,IAAU,EAAW,EAAc;AAEzC,KAAI,CAAC,EACH,OAAM,MAAM,kDAAkD;AAGhE,QAAO;GCJI,KAAU,EAAE,cAAW,IAAO,iBAAc,GAAG,QAAuC;CACjG,IAAM,IAAmB,KACpB,GAAe,MAA2B;AACzC,IAAa,EAAK;KAEpB,KAAA;AAEJ,QACE,kBAAC,GAAD;EAA0B;YACxB,kBAAC,EAAW,MAAZ;GAAiB,wBAAqB;GAAS,cAAc;GAAkB,GAAI;GAAS,CAAA;EAC7E,CAAA;;AAIrB,EAAO,eAAe,EAAW,cACjC,EAAO,cAAc;;;ACnCrB,IAAa,KAAQ,EACnB,aACA,cACA,WAAQ,IACR,KAAK,GACL,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AIN,EAAM,cAAc;;;ACVpB,IAAa,KAAW,EAAE,aAAU,IAAO,GAAG,QAA0B;CACtE,IAAM,IAAa,EAAc,GAAS,SAAS;AAEnD,QAAO,kBAAC,EAAW,SAAZ;EAAoB,wBAAqB;EAAiB,QAAQ;EAAY,GAAI;EAAS,CAAA;;AAGpG,EAAQ,cAAc;;;ACHtB,IAAa,IAYT,OAAO,OAAO,GAAM;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAA;CACA;CACA;CACA;CACD,CAAC;AAEF,EAAO,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/dialog/DialogContext.tsx","../../src/dialog/Dialog.tsx","../../src/dialog/DialogBody.tsx","../../src/dialog/DialogClose.tsx","../../src/dialog/DialogCloseButton.tsx","../../src/dialog/DialogContent.tsx","../../src/dialog/DialogDescription.tsx","../../src/dialog/DialogFooter.tsx","../../src/dialog/DialogHeader.tsx","../../src/dialog/DialogOverlay.tsx","../../src/dialog/DialogPortal.tsx","../../src/dialog/DialogTitle.tsx","../../src/dialog/DialogTrigger.tsx","../../src/dialog/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from 'react'\n\nexport interface DialogContextState {\n isFullScreen: boolean\n setIsFullScreen: (value: boolean) => void\n withFade: boolean\n}\n\nconst DialogContext = createContext<DialogContextState | null>(null)\n\nexport const DialogProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n const [isFullScreen, setIsFullScreen] = useState(false)\n\n return (\n <DialogContext.Provider\n value={{\n isFullScreen,\n setIsFullScreen,\n withFade,\n }}\n >\n {childrenProp}\n </DialogContext.Provider>\n )\n}\n\nexport const useDialog = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw Error('useDialog must be used within a Dialog provider')\n }\n\n return context\n}\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, type ReactElement } from 'react'\n\nimport { DialogProvider } from './DialogContext'\n\nexport interface DialogProps extends Omit<\n ComponentProps<typeof BaseDialog.Root>,\n 'onOpenChange' | 'render'\n> {\n /**\n * Specifies if the dialog is open or not.\n */\n open?: boolean\n /**\n * Default open state.\n */\n defaultOpen?: boolean\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: boolean\n /**\n * Specifies if the dialog should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Dialog = ({ withFade = false, onOpenChange, ...props }: DialogProps): ReactElement => {\n const handleOpenChange = onOpenChange\n ? (open: boolean, _eventDetails: unknown) => {\n onOpenChange(open)\n }\n : undefined\n\n return (\n <DialogProvider withFade={withFade}>\n <BaseDialog.Root data-spark-component=\"dialog\" onOpenChange={handleOpenChange} {...props} />\n </DialogProvider>\n )\n}\n\nDialog.createHandle = BaseDialog.createHandle\nDialog.displayName = 'Dialog.Root'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref, useRef } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport interface BodyProps {\n children: ReactNode\n className?: string\n tabIndex?: number\n ref?: Ref<HTMLDivElement>\n inset?: boolean\n}\n\n/**\n * The scrollable body section of the dialog. Renders a <div> element.\n */\nexport const Body = ({\n children,\n className,\n inset = false,\n ref: forwardedRef,\n ...rest\n}: BodyProps): ReactElement => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDialog()\n\n const { overflow } = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"dialog-body\"\n ref={ref}\n className={cx(\n 'focus-visible:u-outline relative grow overflow-y-auto outline-hidden',\n 'transition-all duration-300',\n {\n ['px-xl py-lg']: !inset,\n },\n className\n )}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dialog.Body'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from '../drawer/useRenderSlot'\n\nexport interface CloseProps extends Omit<ComponentProps<typeof BaseDialog.Close>, 'render'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the dialog. Renders a <button> element.\n */\nexport const Close = ({ asChild = false, ...props }: CloseProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Close data-spark-component=\"dialog-close\" render={renderSlot} {...props} />\n}\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { Close, CloseProps } from './DialogClose'\n\nexport type CloseButtonProps = CloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\n/**\n * A styled close button positioned in the dialog header. Renders a <button> element.\n */\nconst Root = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <Close\n data-spark-component=\"dialog-close-button\"\n data-part=\"close\"\n ref={ref}\n className={cx(['absolute', 'top-md', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </Close>\n )\n}\n\nexport const CloseButton = Object.assign(Root, {\n id: 'CloseButton',\n})\n\nRoot.displayName = 'Dialog.CloseButton'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref, useEffect } from 'react'\n\nimport { dialogContentStyles, type DialogContentStylesProps } from './DialogContent.styles'\nimport { useDialog } from './DialogContext'\n\nexport interface ContentProps\n extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DialogContentStylesProps {\n /**\n * When set to true, the content will adjust its width to fit the content rather than taking up the full available width.\n */\n isNarrow?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The popup element that contains the dialog content. Renders a <div> element.\n */\nexport const Content = ({\n className,\n isNarrow = false,\n size = 'md',\n ref,\n ...rest\n}: ContentProps) => {\n const { setIsFullScreen } = useDialog()\n\n useEffect(() => {\n if (size === 'fullscreen') setIsFullScreen(true)\n\n return () => setIsFullScreen(false)\n }, [setIsFullScreen, size])\n\n return (\n <BaseDialog.Popup\n ref={ref}\n data-spark-component=\"dialog-content\"\n role=\"dialog\"\n className={state =>\n cx(\n dialogContentStyles({\n isNarrow,\n size,\n className: typeof className === 'function' ? className(state) : className,\n })\n )\n }\n {...rest}\n />\n )\n}\n\nContent.displayName = 'Dialog.Content'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nexport type DescriptionProps = ComponentProps<typeof BaseDialog.Description> & {\n ref?: Ref<HTMLParagraphElement>\n}\n\n/**\n * A paragraph with additional information about the dialog. Renders a <p> element.\n */\nexport const Description = (props: DescriptionProps) => (\n <BaseDialog.Description data-spark-component=\"dialog-description\" {...props} />\n)\n\nDescription.displayName = 'Dialog.Description'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface FooterProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The footer section of the dialog, typically containing action buttons. Renders a <footer> element.\n */\nexport const Footer = ({ children, className, ref, ...rest }: FooterProps): ReactElement => (\n <footer\n data-spark-component=\"dialog-footer\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </footer>\n)\n\nFooter.displayName = 'Dialog.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the dialog. Renders a <header> element.\n */\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps): ReactElement => (\n <header\n data-spark-component=\"dialog-header\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </header>\n)\n\nHeader.displayName = 'Dialog.Header'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface OverlayProps extends Omit<ComponentProps<typeof BaseDialog.Backdrop>, 'render'> {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The backdrop element that dims the rest of the page. Renders a <div> element.\n */\nexport const Overlay = ({ className, ...props }: OverlayProps) => {\n return (\n <BaseDialog.Backdrop\n data-spark-component=\"dialog-overlay\"\n className={state =>\n cx(\n 'z-overlay size-screen fixed inset-0',\n 'bg-overlay/dim-1',\n 'data-starting-style:animate-fade-in',\n 'data-ending-style:animate-fade-out',\n typeof className === 'function' ? className(state) : className\n )\n }\n {...props}\n />\n )\n}\n\nOverlay.displayName = 'Dialog.Overlay'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nexport type PortalProps = ComponentProps<typeof BaseDialog.Portal>\n\n/**\n * A portal that renders the dialog in a different part of the DOM. Renders a <div> element.\n */\nexport const Portal = ({ className, ...props }: PortalProps) => {\n return (\n <BaseDialog.Portal\n data-spark-component=\"dialog-portal\"\n className={cx(className, 'z-modal absolute')}\n {...props}\n />\n )\n}\n\nPortal.displayName = 'Dialog.Portal'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport type TitleProps = ComponentProps<typeof BaseDialog.Title> & {\n ref?: Ref<HTMLHeadingElement>\n}\n\n/**\n * The title of the dialog, announced to assistive technology. Renders an <h2> element.\n */\nexport const Title = ({ className, ref, ...others }: TitleProps) => {\n return (\n <BaseDialog.Title\n data-spark-component=\"dialog-title\"\n ref={ref}\n className={cx(\n 'text-headline-1 text-on-surface',\n 'group-has-data-[part=close]:pr-3xl',\n className\n )}\n {...others}\n />\n )\n}\n\nTitle.displayName = 'Dialog.Title'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from '../drawer/useRenderSlot'\n\nexport interface TriggerProps extends Omit<ComponentProps<typeof BaseDialog.Trigger>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the dialog. Renders a <button> element.\n */\nexport const Trigger = ({ asChild = false, ...props }: TriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Trigger data-spark-component=\"dialog-trigger\" render={renderSlot} {...props} />\n}\n\nTrigger.displayName = 'Dialog.Trigger'\n","import { Dialog as Root } from './Dialog'\nimport { Body } from './DialogBody'\nimport { Close } from './DialogClose'\nimport { CloseButton } from './DialogCloseButton'\nimport { Content } from './DialogContent'\nimport { Description } from './DialogDescription' // aria-describedby\nimport { Footer } from './DialogFooter'\nimport { Header } from './DialogHeader'\nimport { Overlay } from './DialogOverlay'\nimport { Portal } from './DialogPortal'\nimport { Title } from './DialogTitle' // aria-labelledby\nimport { Trigger } from './DialogTrigger'\n\n/**\n * A modal window that displays content on top of the main page, requiring user interaction before returning to the main flow.\n */\nexport const Dialog: typeof Root & {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Overlay: typeof Overlay\n Content: typeof Content\n Header: typeof Header\n Body: typeof Body\n Footer: typeof Footer\n Close: typeof Close\n CloseButton: typeof CloseButton\n Title: typeof Title\n Description: typeof Description\n} = Object.assign(Root, {\n Trigger,\n Portal,\n Overlay,\n Content,\n Header,\n Body,\n Footer,\n Close,\n CloseButton,\n Title,\n Description,\n})\n\nDialog.displayName = 'Dialog'\n\nexport { type DialogProps } from './Dialog'\nexport { type ContentProps as DialogContentProps } from './DialogContent'\nexport { type HeaderProps as DialogHeaderProps } from './DialogHeader'\nexport { type BodyProps as DialogBodyProps } from './DialogBody'\nexport { type FooterProps as DialogFooterProps } from './DialogFooter'\nexport { type TriggerProps as DialogTriggerProps } from './DialogTrigger'\nexport { type OverlayProps as DialogOverlayProps } from './DialogOverlay'\nexport { type PortalProps as DialogPortalProps } from './DialogPortal'\nexport { type TitleProps as DialogTitleProps } from './DialogTitle'\nexport { type DescriptionProps as DialogDescriptionProps } from './DialogDescription'\nexport { type CloseProps as DialogCloseProps } from './DialogClose'\nexport { type CloseButtonProps as DialogCloseButtonProps } from './DialogCloseButton'\n"],"mappings":";;;;;;;;;;;;AAQA,IAAM,IAAgB,EAAyC,KAAK,EAEvD,KAAkB,EAC7B,UAAU,GACV,cAAW,SAIP;CACJ,IAAM,CAAC,GAAc,KAAmB,EAAS,GAAM;AAEvD,QACE,kBAAC,EAAc,UAAf;EACE,OAAO;GACL;GACA;GACA;GACD;YAEA;EACsB,CAAA;GAIhB,UAAkB;CAC7B,IAAM,IAAU,EAAW,EAAc;AAEzC,KAAI,CAAC,EACH,OAAM,MAAM,kDAAkD;AAGhE,QAAO;GCJI,KAAU,EAAE,cAAW,IAAO,iBAAc,GAAG,QAAuC;CACjG,IAAM,IAAmB,KACp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cAAW,GAAG,QAEnC,kBAAC,EAAW,QAAZ;CACE,wBAAqB;CACrB,WAAW,EAAG,GAAW,mBAAmB;CAC5C,GAAI;CACJ,CAAA;AAIN,EAAO,cAAc;;;ACRrB,IAAa,KAAS,EAAE,cAAW,QAAK,GAAG,QAEvC,kBAAC,EAAW,OAAZ;CACE,wBAAqB;CAChB;CACL,WAAW,EACT,mCACA,sCACA,EACD;CACD,GAAI;CACJ,CAAA;AAIN,EAAM,cAAc;;;ACVpB,IAAa,KAAW,EAAE,aAAU,IAAO,GAAG,QAA0B;CACtE,IAAM,IAAa,EAAc,GAAS,SAAS;AAEnD,QAAO,kBAAC,EAAW,SAAZ;EAAoB,wBAAqB;EAAiB,QAAQ;EAAY,GAAI;EAAS,CAAA;;AAGpG,EAAQ,cAAc;;;ACNtB,IAAa,IAYT,OAAO,OAAO,GAAM;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAA;CACA;CACA;CACA;CACD,CAAC;AAEF,EAAO,cAAc"}
|
|
@@ -7,6 +7,9 @@ export interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
ref?: Ref<HTMLSpanElement>;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Content to display within the divider line. Renders a <span> element.
|
|
12
|
+
*/
|
|
10
13
|
export declare const DividerContent: {
|
|
11
14
|
({ children, ref, className, ...props }: DividerContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
12
15
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { Separator as BaseSeparator } from '@base-ui/react/separator'\nimport { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>, Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n role: roleProp,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n let roleProps: { role: string } | undefined\n if (isDecorative) {\n roleProps = { role: 'none' }\n } else if (roleProp !== undefined) {\n roleProps = { role: roleProp }\n }\n\n const renderSlot = asChild\n ? // Base UI uses its `render` prop to swap the underlying element.\n // We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.\n (slotProps: any) => <Slot {...slotProps} />\n : undefined\n\n return (\n <BaseSeparator\n data-spark-component=\"divider\"\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n {...props}\n render={renderSlot}\n {...roleProps}\n data-writing-mode={writingMode}\n >\n {children}\n </BaseSeparator>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\n/**\n * A visual separator that divides content into distinct sections or groups.\n */\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"mappings":"4RAEA,IAAa,EAAiB,CAE5B,CACE,OAAQ,UACR,QAAS,GACT,OAAA,EAAA,EAAA,IAAU,CAAC,iBAAiB,CAAC,CAC9B,CACD,CACE,OAAQ,UACR,QAAS,GACT,OAAA,EAAA,EAAA,IAAU,CAAC,6CAA6C,CAAC,CAC1D,CAED,CACE,OAAQ,UACR,QAAS,GACT,OAAA,EAAA,EAAA,IAAU,CAAC,iBAAiB,CAAC,CAC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CAAC,0CAA0C,CAAC,CACvD,CACD,CACE,QAAS,GACT,YAAa,aACb,UAAW,SACX,OAAA,EAAA,EAAA,IAAU,CAAC,wCAAwC,CAAC,CACrD,CACD,CACE,QAAS,GACT,YAAa,WACb,UAAW,MACX,OAAA,EAAA,EAAA,IAAU,CAAC,4DAA4D,CAAC,CACzE,CACD,CACE,QAAS,GACT,YAAa,WACb,UAAW,QACX,OAAA,EAAA,EAAA,IAAU,CAAC,4DAA4D,CAAC,CACzE,CACD,CACE,QAAS,GACT,YAAa,WACb,UAAW,SACX,OAAA,EAAA,EAAA,IAAU,CAAC,6EAA6E,CAAC,CAC1F,CACD,GAAG,EACJ,CACF,CAAC,CCrEW,GAAW,CACtB,UACA,YACA,eAAe,GACf,WACA,cAAc,aACd,cAAc,gBACd,YAAY,SACZ,SAAS,UACT,MACA,KAAM,EACN,GAAG,KACe,CAClB,IAAM,EAAU,EAAU,CAAE,GAAU,OAAmC,SAAW,CAAC,EAEjF,EACA,EACF,EAAY,CAAE,KAAM,OAAQ,CACnB,IAAa,IAAA,KACtB,EAAY,CAAE,KAAM,EAAU,EAGhC,IAAM,EAAa,EAGd,IAAmB,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,GAAI,EAAa,CAAA,CAC3C,IAAA,GAEJ,OACE,EAAA,EAAA,KAAC,EAAA,UAAD,CACE,uBAAqB,UACrB,WAAA,EAAA,EAAA,IACE,EAAc,CAAE,UAAS,cAAa,YAAW,SAAQ,cAAa,CAAC,CACvE,EACD,CACY,cACR,MACL,GAAI,EACJ,OAAQ,EACR,GAAI,EACJ,oBAAmB,EAElB,WACa,CAAA,EAIpB,EAAQ,YAAc,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { Separator as BaseSeparator } from '@base-ui/react/separator'\nimport { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>, Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n role: roleProp,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n let roleProps: { role: string } | undefined\n if (isDecorative) {\n roleProps = { role: 'none' }\n } else if (roleProp !== undefined) {\n roleProps = { role: roleProp }\n }\n\n const renderSlot = asChild\n ? // Base UI uses its `render` prop to swap the underlying element.\n // We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.\n (slotProps: any) => <Slot {...slotProps} />\n : undefined\n\n return (\n <BaseSeparator\n data-spark-component=\"divider\"\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n {...props}\n render={renderSlot}\n {...roleProps}\n data-writing-mode={writingMode}\n >\n {children}\n </BaseSeparator>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\n/**\n * Content to display within the divider line. Renders a <span> element.\n */\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\n/**\n * A visual separator that divides content into distinct sections or groups.\n */\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"mappings":"4RAEA,IAAa,EAAiB,CAE5B,CACE,OAAQ,UACR,QAAS,GACT,OAAA,EAAA,EAAA,IAAU,CAAC,iBAAiB,CAAC,CAC9B,CACD,CACE,OAAQ,UACR,QAAS,GACT,OAAA,EAAA,EAAA,IAAU,CAAC,6CAA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,MACL,GAAI,EACJ,WAAA,EAAA,EAAA,IAAc,mEAAoE,EAAU,CAE3F,WACI,CAAA,CACL,KAGN,EAAe,YAAc,kBCpB7B,IAAa,EAET,OAAO,OAAO,EAAM,CACtB,QAAS,EACV,CAAC,CAEF,EAAQ,YAAc,UACtB,EAAQ,QAAQ,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { Separator as BaseSeparator } from '@base-ui/react/separator'\nimport { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>, Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n role: roleProp,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n let roleProps: { role: string } | undefined\n if (isDecorative) {\n roleProps = { role: 'none' }\n } else if (roleProp !== undefined) {\n roleProps = { role: roleProp }\n }\n\n const renderSlot = asChild\n ? // Base UI uses its `render` prop to swap the underlying element.\n // We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.\n (slotProps: any) => <Slot {...slotProps} />\n : undefined\n\n return (\n <BaseSeparator\n data-spark-component=\"divider\"\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n {...props}\n render={renderSlot}\n {...roleProps}\n data-writing-mode={writingMode}\n >\n {children}\n </BaseSeparator>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\n/**\n * A visual separator that divides content into distinct sections or groups.\n */\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"mappings":";;;;;;AAEA,IAAa,IAAiB;CAE5B;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,iBAAiB,CAAC;EAC9B;CACD;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,6CAA6C,CAAC;EAC1D;CAED;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,iBAAiB,CAAC;EAC9B;CACD;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,6CAA6C,CAAC;EAC1D;CACF,ECpBY,IAAgB,EAAI,CAAC,wBAAwB,EAAE;CAC1D,UAAU;EACR,SAAS;GACP,MAAM,CAAC,eAAe;GACtB,OAAO,CAAC,4BAA4B,yCAAyC;GAC9E;EACD,aAAa;GACX,UAAU,CAAC,oBAAoB;GAC/B,YAAY,CAAC,SAAS;GACvB;EACD,aAAa;GACX,iBAAiB,EAAE;GACnB,eAAe,EAAE;GAClB;EACD,WAAW;GACT,OAAO,EAAE;GACT,KAAK,EAAE;GACP,QAAQ,EAAE;GACX;EACD,QAAQ;GACN,SAAS,EAAE;GACX,SAAS,EAAE;GACZ;EACF;CACD,iBAAiB;EACf,aAAa;EACb,aAAa;EACb,WAAW;EACX,QAAQ;EACT;CACD,kBAAkB;EAChB;GACE,SAAS;GACT,aAAa;GACb,OAAO,EAAG,CAAC,oBAAoB,CAAC;GACjC;EACD;GACE,SAAS;GACT,aAAa;GACb,OAAO,EAAG,CAAC,gCAAgC,CAAC;GAC7C;EACD;GACE,SAAS;GACT,aAAa;GACb,aAAa;GACb,OAAO,EAAG;IAAC;IAAyB;IAAsB;IAAqB;IAAU,CAAC;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AI;EACJ,qBAAmB;EAElB;EACa,CAAA;;AAIpB,EAAQ,cAAc;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { Separator as BaseSeparator } from '@base-ui/react/separator'\nimport { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>, Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n role: roleProp,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n let roleProps: { role: string } | undefined\n if (isDecorative) {\n roleProps = { role: 'none' }\n } else if (roleProp !== undefined) {\n roleProps = { role: roleProp }\n }\n\n const renderSlot = asChild\n ? // Base UI uses its `render` prop to swap the underlying element.\n // We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.\n (slotProps: any) => <Slot {...slotProps} />\n : undefined\n\n return (\n <BaseSeparator\n data-spark-component=\"divider\"\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n {...props}\n render={renderSlot}\n {...roleProps}\n data-writing-mode={writingMode}\n >\n {children}\n </BaseSeparator>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\n/**\n * Content to display within the divider line. Renders a <span> element.\n */\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\n/**\n * A visual separator that divides content into distinct sections or groups.\n */\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"mappings":";;;;;;AAEA,IAAa,IAAiB;CAE5B;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,iBAAiB,CAAC;EAC9B;CACD;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,6CAA6C,CAAC;EAC1D;CAED;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,iBAAiB,CAAC;EAC9B;CACD;EACE,QAAQ;EACR,SAAS;EACT,OAAO,EAAG,CAAC,6CAA6C,CAAC;EAC1D;CACF,ECpBY,IAAgB,EAAI,CAAC,wBAAwB,EAAE;CAC1D,UAAU;EACR,SAAS;GACP,MAAM,CAAC,eAAe;GACtB,OAAO,CAAC,4BAA4B,yCAAyC;GAC9E;EACD,aAAa;GACX,UAAU,CAAC,oBAAoB;GAC/B,YAAY,CAAC,SAAS;GACvB;EACD,aAAa;GACX,iBAAiB,EAAE;GACnB,eAAe,EAAE;GAClB;EACD,WAAW;GACT,OAAO,EAAE;GACT,KAAK,EAAE;GACP,QAAQ,EAAE;GACX;EACD,QAAQ;GACN,SAAS,EAAE;GACX,SAAS,EAAE;GACZ;EACF;CACD,iBAAiB;EACf,aAAa;EACb,aAAa;EACb,WAAW;EACX,QAAQ;EACT;CACD,kBAAkB;EAChB;GACE,SAAS;GACT,aAAa;GACb,OAAO,EAAG,CAAC,oBAAoB,CAAC;GACjC;EACD;GACE,SAAS;GACT,aAAa;GACb,OAAO,EAAG,CAAC,gCAAgC,CAAC;GAC7C;EACD;GACE,SAAS;GACT,aAAa;GACb,aAAa;GACb,OAAO,EAAG;IAAC;IAAyB;IAAsB;IAAqB;IAAU,CAAC;GAC3F;EACD;GACE,SAAS;GACT,aAAa;GACb,aAAa;GACb,OAAO,EAAG;IAAC;IAAkB;IAAsB;IAAqB;IAAU,CAAC;GACpF;EACD;GACE,SAAS;GACT,aAAa;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;CACE,wBAAqB;CAChB;CACL,GAAI;CACJ,WAAW,EAAG,oEAAoE,EAAU;CAE3F;CACI,CAAA,GACL;AAGN,EAAe,cAAc;;;ACpB7B,IAAa,IAET,OAAO,OAAO,GAAM,EACtB,SAAS,GACV,CAAC;AAEF,EAAQ,cAAc,WACtB,EAAQ,QAAQ,cAAc"}
|
|
@@ -5,6 +5,9 @@ export interface DrawerBodyProps extends DrawerBodyStylesProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
ref?: Ref<HTMLDivElement>;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* The scrollable body section of the drawer. Renders a <div> element.
|
|
10
|
+
*/
|
|
8
11
|
export declare const DrawerBody: {
|
|
9
12
|
({ children, inset, className, ref: forwardedRef, ...rest }: DrawerBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
10
13
|
displayName: string;
|
|
@@ -7,6 +7,9 @@ export interface DrawerCloseProps extends Omit<ComponentProps<typeof BaseDialog.
|
|
|
7
7
|
asChild?: boolean;
|
|
8
8
|
ref?: Ref<HTMLButtonElement>;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A button that closes the drawer. Renders a <button> element.
|
|
12
|
+
*/
|
|
10
13
|
export declare const DrawerClose: {
|
|
11
14
|
({ asChild, ...props }: DrawerCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
displayName: string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { IconButtonProps } from '../icon-button';
|
|
2
2
|
import { DrawerCloseProps } from './DrawerClose';
|
|
3
3
|
export type DrawerCloseButtonProps = DrawerCloseProps & Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>;
|
|
4
|
+
/**
|
|
5
|
+
* A styled close button positioned in the drawer header. Renders a <button> element.
|
|
6
|
+
*/
|
|
4
7
|
export declare const DrawerCloseButton: {
|
|
5
8
|
({ "aria-label": ariaLabel, className, size, intent, design, children, ref, ...rest }: DrawerCloseButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
9
|
displayName: string;
|
|
@@ -4,6 +4,9 @@ import { DrawerContentStylesProps } from './DrawerContent.styles';
|
|
|
4
4
|
export interface DrawerContentProps extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DrawerContentStylesProps {
|
|
5
5
|
ref?: Ref<HTMLDivElement>;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* The popup element that contains the drawer content. Renders a <div> element.
|
|
9
|
+
*/
|
|
7
10
|
export declare const DrawerContent: {
|
|
8
11
|
({ className, size, side, ref, ...rest }: DrawerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
displayName: string;
|
|
@@ -3,6 +3,9 @@ import { ComponentProps, Ref } from 'react';
|
|
|
3
3
|
export interface DrawerDescriptionProps extends Omit<ComponentProps<typeof BaseDialog.Description>, 'render'> {
|
|
4
4
|
ref?: Ref<HTMLParagraphElement>;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* A paragraph with additional information about the drawer. Renders a <p> element.
|
|
8
|
+
*/
|
|
6
9
|
export declare const DrawerDescription: {
|
|
7
10
|
(props: DrawerDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
displayName: string;
|
|
@@ -2,6 +2,9 @@ import { ComponentPropsWithoutRef, ReactElement, Ref } from 'react';
|
|
|
2
2
|
export type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {
|
|
3
3
|
ref?: Ref<HTMLDivElement>;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* The footer section of the drawer, typically containing action buttons. Renders a <footer> element.
|
|
7
|
+
*/
|
|
5
8
|
export declare const DrawerFooter: {
|
|
6
9
|
({ className, ref, ...rest }: DrawerFooterProps): ReactElement;
|
|
7
10
|
displayName: string;
|
|
@@ -4,6 +4,9 @@ export interface DrawerHeaderProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
ref?: Ref<HTMLDivElement>;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* The header section of the drawer. Renders a <header> element.
|
|
9
|
+
*/
|
|
7
10
|
export declare const DrawerHeader: {
|
|
8
11
|
({ children, className, ref, ...rest }: DrawerHeaderProps): ReactElement;
|
|
9
12
|
displayName: string;
|
|
@@ -3,6 +3,9 @@ import { ComponentProps, Ref } from 'react';
|
|
|
3
3
|
export interface DrawerOverlayProps extends Omit<ComponentProps<typeof BaseDialog.Backdrop>, 'render'> {
|
|
4
4
|
ref?: Ref<HTMLDivElement>;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* The backdrop element that dims the rest of the page. Renders a <div> element.
|
|
8
|
+
*/
|
|
6
9
|
export declare const DrawerOverlay: {
|
|
7
10
|
({ className, ...props }: DrawerOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
displayName: string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
export type DrawerPortalProps = ComponentProps<typeof BaseDialog.Portal>;
|
|
4
|
+
/**
|
|
5
|
+
* A portal that renders the drawer in a different part of the DOM. Renders a <div> element.
|
|
6
|
+
*/
|
|
4
7
|
export declare const DrawerPortal: {
|
|
5
8
|
({ className, ...props }: DrawerPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
6
9
|
displayName: string;
|
|
@@ -3,6 +3,9 @@ import { ComponentProps, Ref } from 'react';
|
|
|
3
3
|
export interface DrawerTitleProps extends Omit<ComponentProps<typeof BaseDialog.Title>, 'render'> {
|
|
4
4
|
ref?: Ref<HTMLHeadingElement>;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* The title of the drawer, announced to assistive technology. Renders an <h2> element.
|
|
8
|
+
*/
|
|
6
9
|
export declare const DrawerTitle: {
|
|
7
10
|
({ className, ...props }: DrawerTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
displayName: string;
|
|
@@ -7,6 +7,9 @@ export interface DrawerTriggerProps extends Omit<ComponentProps<typeof BaseDialo
|
|
|
7
7
|
asChild?: boolean;
|
|
8
8
|
ref?: Ref<HTMLButtonElement>;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A button that opens the drawer. Renders a <button> element.
|
|
12
|
+
*/
|
|
10
13
|
export declare const DrawerTrigger: {
|
|
11
14
|
({ asChild, ...props }: DrawerTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
displayName: string;
|
package/dist/drawer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/drawer/DrawerContext.tsx","../../src/drawer/Drawer.tsx","../../src/drawer/DrawerBody.styles.ts","../../src/drawer/DrawerBody.tsx","../../src/drawer/DrawerClose.tsx","../../src/drawer/DrawerCloseButton.tsx","../../src/drawer/DrawerContent.styles.tsx","../../src/drawer/DrawerContent.tsx","../../src/drawer/DrawerDescription.tsx","../../src/drawer/DrawerFooter.tsx","../../src/drawer/DrawerHeader.tsx","../../src/drawer/DrawerOverlay.tsx","../../src/drawer/DrawerPortal.tsx","../../src/drawer/DrawerTitle.tsx","../../src/drawer/DrawerTrigger.tsx","../../src/drawer/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react'\n\nexport interface DrawerContextState {\n withFade: boolean\n}\n\nconst DrawerContext = createContext<DrawerContextState | null>(null)\n\nexport const DrawerProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n return (\n <DrawerContext.Provider\n value={{\n withFade,\n }}\n >\n {childrenProp}\n </DrawerContext.Provider>\n )\n}\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext)\n\n if (!context) {\n throw Error('useDrawer must be used within a Drawer provider')\n }\n\n return context\n}\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, type ReactElement } from 'react'\n\nimport { DrawerProvider } from './DrawerContext'\n\nexport interface DrawerProps extends Omit<\n ComponentProps<typeof BaseDialog.Root>,\n 'onOpenChange' | 'render'\n> {\n /**\n * Specifies if the dialog is open or not.\n */\n open?: boolean\n /**\n * Default open state.\n */\n defaultOpen?: boolean\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: boolean\n /**\n * Specifies if the drawer should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Drawer = ({ onOpenChange, withFade = false, ...props }: DrawerProps): ReactElement => {\n const handleOpenChange = onOpenChange\n ? (open: boolean, _eventDetails: unknown) => {\n onOpenChange(open)\n }\n : undefined\n\n return (\n <DrawerProvider withFade={withFade}>\n <BaseDialog.Root data-spark-component=\"drawer\" onOpenChange={handleOpenChange} {...props} />\n </DrawerProvider>\n )\n}\n\nDrawer.displayName = 'Drawer.Root'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n defaultVariants: {\n inset: false,\n },\n }\n)\n\nexport type DrawerBodyStylesProps = VariantProps<typeof drawerBodyStyles>\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { type ReactNode, Ref, useRef } from 'react'\n\nimport { drawerBodyStyles, type DrawerBodyStylesProps } from './DrawerBody.styles'\nimport { useDrawer } from './DrawerContext'\n\nexport interface DrawerBodyProps extends DrawerBodyStylesProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerBody = ({\n children,\n inset = false,\n className,\n ref: forwardedRef,\n ...rest\n}: DrawerBodyProps) => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDrawer()\n\n const { overflow } = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"drawer-body\"\n ref={ref}\n className={drawerBodyStyles({ inset, className })}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nDrawerBody.displayName = 'Drawer.Body'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerCloseProps extends Omit<ComponentProps<typeof BaseDialog.Close>, 'render'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerClose = ({ asChild = false, ...props }: DrawerCloseProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Close data-spark-component=\"drawer-close\" render={renderSlot} {...props} />\n}\n\nDrawerClose.displayName = 'Drawer.Close'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { DrawerClose, type DrawerCloseProps } from './DrawerClose'\n\nexport type DrawerCloseButtonProps = DrawerCloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nexport const DrawerCloseButton = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: DrawerCloseButtonProps) => (\n <DrawerClose\n data-spark-component=\"drawer-close-button\"\n ref={ref}\n className={cx(['absolute', 'top-sm', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </DrawerClose>\n)\n\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerContentStyles = cva(\n [\n 'fixed z-modal flex flex-col bg-surface shadow-md',\n // Base UI uses data-open and data-closed for transitions\n 'data-open:animation-duration-400 data-closed:animation-duration-200',\n // Nested dialog effect\n 'data-nested-dialog-open:after:pointer-events-none',\n 'after:bg-transparent',\n 'after:transition-all',\n 'after:duration-200',\n 'data-nested-dialog-open:after:inset-0',\n 'data-nested-dialog-open:after:absolute',\n 'data-nested-dialog-open:after:rounded-[inherit]',\n 'data-nested-dialog-open:after:bg-overlay/dim-3',\n ],\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n fluid: '',\n fullscreen: 'h-screen w-screen',\n },\n side: {\n right: [\n 'inset-y-0 right-0',\n 'data-open:animate-slide-in-right ',\n 'data-closed:animate-slide-out-right',\n ],\n left: [\n 'inset-y-0 left-0',\n 'data-open:animate-slide-in-left',\n 'data-closed:animate-slide-out-left',\n ],\n top: [\n 'top-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-top',\n 'data-closed:animate-slide-out-top',\n ],\n bottom: [\n 'bottom-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-bottom',\n 'data-closed:animate-slide-out-bottom',\n ],\n },\n },\n compoundVariants: [\n {\n side: ['right', 'left'],\n size: 'sm',\n class: ['w-sz-480', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'md',\n class: ['w-sz-672', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'lg',\n class: ['w-sz-864', 'max-w-full'],\n },\n {\n side: ['left', 'right'],\n size: 'fluid',\n class: ['w-auto', 'max-w-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'sm',\n class: ['h-sz-480', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'md',\n class: ['h-sz-672', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'lg',\n class: ['h-sz-864', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'fluid',\n class: ['h-auto', 'max-h-full'],\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n }\n)\n\nexport type DrawerContentStylesProps = VariantProps<typeof drawerContentStyles>\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nimport { drawerContentStyles, type DrawerContentStylesProps } from './DrawerContent.styles'\n\nexport interface DrawerContentProps\n extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DrawerContentStylesProps {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerContent = ({\n className,\n size = 'md',\n side = 'right',\n ref,\n ...rest\n}: DrawerContentProps) => {\n return (\n <BaseDialog.Popup\n ref={ref}\n data-spark-component=\"drawer-content\"\n role=\"dialog\"\n className={state =>\n cx(\n drawerContentStyles({\n size,\n side,\n className: typeof className === 'function' ? className(state) : className,\n })\n )\n }\n {...rest}\n />\n )\n}\n\nDrawerContent.displayName = 'Drawer.Content'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerDescriptionProps extends Omit<\n ComponentProps<typeof BaseDialog.Description>,\n 'render'\n> {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const DrawerDescription = (props: DrawerDescriptionProps) => {\n return <BaseDialog.Description data-spark-component=\"drawer-description\" {...props} />\n}\n\nDrawerDescription.displayName = 'Drawer.Description'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, type ReactElement, Ref } from 'react'\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerFooter = ({ className, ref, ...rest }: DrawerFooterProps): ReactElement => (\n <footer\n data-spark-component=\"drawer-footer\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n />\n)\n\nDrawerFooter.displayName = 'Drawer.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface DrawerHeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerHeader = ({\n children,\n className,\n ref,\n ...rest\n}: DrawerHeaderProps): ReactElement => (\n <header\n data-spark-component=\"drawer-header\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n >\n {children}\n </header>\n)\n\nDrawerHeader.displayName = 'Dialog.Header'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerOverlayProps extends Omit<\n ComponentProps<typeof BaseDialog.Backdrop>,\n 'render'\n> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerOverlay = ({ className, ...props }: DrawerOverlayProps) => {\n return (\n <BaseDialog.Backdrop\n data-spark-component=\"drawer-overlay\"\n className={state =>\n cx(\n 'z-overlay fixed top-0 left-0 h-screen w-screen',\n 'bg-overlay/dim-1',\n // Base UI automatically adds data-[starting-style] and data-[ending-style] attributes\n 'data-starting-style:animate-fade-in',\n 'data-ending-style:animate-fade-out',\n typeof className === 'function' ? className(state) : className\n )\n }\n {...props}\n />\n )\n}\n\nDrawerOverlay.displayName = 'Drawer.Overlay'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nexport type DrawerPortalProps = ComponentProps<typeof BaseDialog.Portal>\n\nexport const DrawerPortal = ({ className, ...props }: DrawerPortalProps) => {\n return (\n <BaseDialog.Portal\n data-spark-component=\"drawer-portal\"\n className={cx(className, 'z-modal absolute')}\n {...props}\n />\n )\n}\n\nDrawerPortal.displayName = 'Drawer.Portal'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerTitleProps extends Omit<ComponentProps<typeof BaseDialog.Title>, 'render'> {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const DrawerTitle = ({ className, ...props }: DrawerTitleProps) => {\n return (\n <BaseDialog.Title\n data-spark-component=\"drawer-title\"\n className={cx('text-headline-2 text-on-surface', className)}\n {...props}\n />\n )\n}\n\nDrawerTitle.displayName = 'Drawer.Title'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerTriggerProps extends Omit<\n ComponentProps<typeof BaseDialog.Trigger>,\n 'render'\n> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerTrigger = ({ asChild = false, ...props }: DrawerTriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Trigger data-spark-component=\"drawer-trigger\" render={renderSlot} {...props} />\n}\n\nDrawerTrigger.displayName = 'Drawer.Trigger'\n","import { Drawer as Root } from './Drawer'\nimport { DrawerBody } from './DrawerBody'\nimport { DrawerClose } from './DrawerClose'\nimport { DrawerCloseButton } from './DrawerCloseButton'\nimport { DrawerContent } from './DrawerContent'\nimport { DrawerDescription } from './DrawerDescription' // aria-describedby\nimport { DrawerFooter } from './DrawerFooter'\nimport { DrawerHeader } from './DrawerHeader'\nimport { DrawerOverlay } from './DrawerOverlay'\nimport { DrawerPortal } from './DrawerPortal'\nimport { DrawerTitle } from './DrawerTitle'\nimport { DrawerTrigger } from './DrawerTrigger'\n\n/**\n * A panel that slides in from the edge of the screen, typically used for navigation or displaying additional content.\n */\nexport const Drawer: typeof Root & {\n Trigger: typeof DrawerTrigger\n Portal: typeof DrawerPortal\n Overlay: typeof DrawerOverlay\n Content: typeof DrawerContent\n Header: typeof DrawerHeader\n Body: typeof DrawerBody\n Footer: typeof DrawerFooter\n Close: typeof DrawerClose\n CloseButton: typeof DrawerCloseButton\n Title: typeof DrawerTitle\n Description: typeof DrawerDescription\n} = Object.assign(Root, {\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Overlay: DrawerOverlay,\n Content: DrawerContent,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n CloseButton: DrawerCloseButton,\n Title: DrawerTitle,\n Description: DrawerDescription,\n})\n\nDrawer.displayName = 'Drawer'\nDrawerTrigger.displayName = 'Drawer.Trigger'\nDrawerPortal.displayName = 'Drawer.Portal'\nDrawerOverlay.displayName = 'Drawer.Overlay'\nDrawerContent.displayName = 'Drawer.Content'\nDrawerHeader.displayName = 'Drawer.Header'\nDrawerBody.displayName = 'Drawer.Body'\nDrawerFooter.displayName = 'Drawer.Footer'\nDrawerClose.displayName = 'Drawer.Close'\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\nDrawerTitle.displayName = 'Drawer.Title'\nDrawerDescription.displayName = 'Drawer.Description'\n\nexport { type DrawerProps } from './Drawer'\nexport { type DrawerContentProps } from './DrawerContent'\nexport { type DrawerHeaderProps } from './DrawerHeader'\nexport { type DrawerBodyProps } from './DrawerBody'\nexport { type DrawerFooterProps } from './DrawerFooter'\nexport { type DrawerTriggerProps } from './DrawerTrigger'\nexport { type DrawerOverlayProps } from './DrawerOverlay'\nexport { type DrawerPortalProps } from './DrawerPortal'\nexport { type DrawerTitleProps } from './DrawerTitle'\nexport { type DrawerDescriptionProps } from './DrawerDescription'\nexport { type DrawerCloseProps } from './DrawerClose'\nexport { type DrawerCloseButtonProps } from './DrawerCloseButton'\n"],"mappings":"2dAMA,IAAM,GAAA,EAA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C5B,EAAa,YAAc,gBAC3B,EAAW,YAAc,cACzB,EAAa,YAAc,gBAC3B,EAAY,YAAc,eAC1B,EAAkB,YAAc,qBAChC,EAAY,YAAc,eAC1B,EAAkB,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/drawer/DrawerContext.tsx","../../src/drawer/Drawer.tsx","../../src/drawer/DrawerBody.styles.ts","../../src/drawer/DrawerBody.tsx","../../src/drawer/DrawerClose.tsx","../../src/drawer/DrawerCloseButton.tsx","../../src/drawer/DrawerContent.styles.tsx","../../src/drawer/DrawerContent.tsx","../../src/drawer/DrawerDescription.tsx","../../src/drawer/DrawerFooter.tsx","../../src/drawer/DrawerHeader.tsx","../../src/drawer/DrawerOverlay.tsx","../../src/drawer/DrawerPortal.tsx","../../src/drawer/DrawerTitle.tsx","../../src/drawer/DrawerTrigger.tsx","../../src/drawer/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react'\n\nexport interface DrawerContextState {\n withFade: boolean\n}\n\nconst DrawerContext = createContext<DrawerContextState | null>(null)\n\nexport const DrawerProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n return (\n <DrawerContext.Provider\n value={{\n withFade,\n }}\n >\n {childrenProp}\n </DrawerContext.Provider>\n )\n}\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext)\n\n if (!context) {\n throw Error('useDrawer must be used within a Drawer provider')\n }\n\n return context\n}\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, type ReactElement } from 'react'\n\nimport { DrawerProvider } from './DrawerContext'\n\nexport interface DrawerProps extends Omit<\n ComponentProps<typeof BaseDialog.Root>,\n 'onOpenChange' | 'render'\n> {\n /**\n * Specifies if the dialog is open or not.\n */\n open?: boolean\n /**\n * Default open state.\n */\n defaultOpen?: boolean\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: boolean\n /**\n * Specifies if the drawer should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Drawer = ({ onOpenChange, withFade = false, ...props }: DrawerProps): ReactElement => {\n const handleOpenChange = onOpenChange\n ? (open: boolean, _eventDetails: unknown) => {\n onOpenChange(open)\n }\n : undefined\n\n return (\n <DrawerProvider withFade={withFade}>\n <BaseDialog.Root data-spark-component=\"drawer\" onOpenChange={handleOpenChange} {...props} />\n </DrawerProvider>\n )\n}\n\nDrawer.displayName = 'Drawer.Root'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n defaultVariants: {\n inset: false,\n },\n }\n)\n\nexport type DrawerBodyStylesProps = VariantProps<typeof drawerBodyStyles>\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { type ReactNode, Ref, useRef } from 'react'\n\nimport { drawerBodyStyles, type DrawerBodyStylesProps } from './DrawerBody.styles'\nimport { useDrawer } from './DrawerContext'\n\nexport interface DrawerBodyProps extends DrawerBodyStylesProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The scrollable body section of the drawer. Renders a <div> element.\n */\nexport const DrawerBody = ({\n children,\n inset = false,\n className,\n ref: forwardedRef,\n ...rest\n}: DrawerBodyProps) => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDrawer()\n\n const { overflow } = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"drawer-body\"\n ref={ref}\n className={drawerBodyStyles({ inset, className })}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nDrawerBody.displayName = 'Drawer.Body'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerCloseProps extends Omit<ComponentProps<typeof BaseDialog.Close>, 'render'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the drawer. Renders a <button> element.\n */\nexport const DrawerClose = ({ asChild = false, ...props }: DrawerCloseProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Close data-spark-component=\"drawer-close\" render={renderSlot} {...props} />\n}\n\nDrawerClose.displayName = 'Drawer.Close'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { DrawerClose, type DrawerCloseProps } from './DrawerClose'\n\nexport type DrawerCloseButtonProps = DrawerCloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\n/**\n * A styled close button positioned in the drawer header. Renders a <button> element.\n */\nexport const DrawerCloseButton = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: DrawerCloseButtonProps) => (\n <DrawerClose\n data-spark-component=\"drawer-close-button\"\n ref={ref}\n className={cx(['absolute', 'top-sm', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </DrawerClose>\n)\n\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerContentStyles = cva(\n [\n 'fixed z-modal flex flex-col bg-surface shadow-md',\n // Base UI uses data-open and data-closed for transitions\n 'data-open:animation-duration-400 data-closed:animation-duration-200',\n // Nested dialog effect\n 'data-nested-dialog-open:after:pointer-events-none',\n 'after:bg-transparent',\n 'after:transition-all',\n 'after:duration-200',\n 'data-nested-dialog-open:after:inset-0',\n 'data-nested-dialog-open:after:absolute',\n 'data-nested-dialog-open:after:rounded-[inherit]',\n 'data-nested-dialog-open:after:bg-overlay/dim-3',\n ],\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n fluid: '',\n fullscreen: 'h-screen w-screen',\n },\n side: {\n right: [\n 'inset-y-0 right-0',\n 'data-open:animate-slide-in-right ',\n 'data-closed:animate-slide-out-right',\n ],\n left: [\n 'inset-y-0 left-0',\n 'data-open:animate-slide-in-left',\n 'data-closed:animate-slide-out-left',\n ],\n top: [\n 'top-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-top',\n 'data-closed:animate-slide-out-top',\n ],\n bottom: [\n 'bottom-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-bottom',\n 'data-closed:animate-slide-out-bottom',\n ],\n },\n },\n compoundVariants: [\n {\n side: ['right', 'left'],\n size: 'sm',\n class: ['w-sz-480', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'md',\n class: ['w-sz-672', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'lg',\n class: ['w-sz-864', 'max-w-full'],\n },\n {\n side: ['left', 'right'],\n size: 'fluid',\n class: ['w-auto', 'max-w-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'sm',\n class: ['h-sz-480', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'md',\n class: ['h-sz-672', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'lg',\n class: ['h-sz-864', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'fluid',\n class: ['h-auto', 'max-h-full'],\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n }\n)\n\nexport type DrawerContentStylesProps = VariantProps<typeof drawerContentStyles>\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nimport { drawerContentStyles, type DrawerContentStylesProps } from './DrawerContent.styles'\n\nexport interface DrawerContentProps\n extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DrawerContentStylesProps {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The popup element that contains the drawer content. Renders a <div> element.\n */\nexport const DrawerContent = ({\n className,\n size = 'md',\n side = 'right',\n ref,\n ...rest\n}: DrawerContentProps) => {\n return (\n <BaseDialog.Popup\n ref={ref}\n data-spark-component=\"drawer-content\"\n role=\"dialog\"\n className={state =>\n cx(\n drawerContentStyles({\n size,\n side,\n className: typeof className === 'function' ? className(state) : className,\n })\n )\n }\n {...rest}\n />\n )\n}\n\nDrawerContent.displayName = 'Drawer.Content'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerDescriptionProps extends Omit<\n ComponentProps<typeof BaseDialog.Description>,\n 'render'\n> {\n ref?: Ref<HTMLParagraphElement>\n}\n\n/**\n * A paragraph with additional information about the drawer. Renders a <p> element.\n */\nexport const DrawerDescription = (props: DrawerDescriptionProps) => {\n return <BaseDialog.Description data-spark-component=\"drawer-description\" {...props} />\n}\n\nDrawerDescription.displayName = 'Drawer.Description'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, type ReactElement, Ref } from 'react'\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The footer section of the drawer, typically containing action buttons. Renders a <footer> element.\n */\nexport const DrawerFooter = ({ className, ref, ...rest }: DrawerFooterProps): ReactElement => (\n <footer\n data-spark-component=\"drawer-footer\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n />\n)\n\nDrawerFooter.displayName = 'Drawer.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface DrawerHeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the drawer. Renders a <header> element.\n */\nexport const DrawerHeader = ({\n children,\n className,\n ref,\n ...rest\n}: DrawerHeaderProps): ReactElement => (\n <header\n data-spark-component=\"drawer-header\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n >\n {children}\n </header>\n)\n\nDrawerHeader.displayName = 'Dialog.Header'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerOverlayProps extends Omit<\n ComponentProps<typeof BaseDialog.Backdrop>,\n 'render'\n> {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The backdrop element that dims the rest of the page. Renders a <div> element.\n */\nexport const DrawerOverlay = ({ className, ...props }: DrawerOverlayProps) => {\n return (\n <BaseDialog.Backdrop\n data-spark-component=\"drawer-overlay\"\n className={state =>\n cx(\n 'z-overlay fixed top-0 left-0 h-screen w-screen',\n 'bg-overlay/dim-1',\n // Base UI automatically adds data-[starting-style] and data-[ending-style] attributes\n 'data-starting-style:animate-fade-in',\n 'data-ending-style:animate-fade-out',\n typeof className === 'function' ? className(state) : className\n )\n }\n {...props}\n />\n )\n}\n\nDrawerOverlay.displayName = 'Drawer.Overlay'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nexport type DrawerPortalProps = ComponentProps<typeof BaseDialog.Portal>\n\n/**\n * A portal that renders the drawer in a different part of the DOM. Renders a <div> element.\n */\nexport const DrawerPortal = ({ className, ...props }: DrawerPortalProps) => {\n return (\n <BaseDialog.Portal\n data-spark-component=\"drawer-portal\"\n className={cx(className, 'z-modal absolute')}\n {...props}\n />\n )\n}\n\nDrawerPortal.displayName = 'Drawer.Portal'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerTitleProps extends Omit<ComponentProps<typeof BaseDialog.Title>, 'render'> {\n ref?: Ref<HTMLHeadingElement>\n}\n\n/**\n * The title of the drawer, announced to assistive technology. Renders an <h2> element.\n */\nexport const DrawerTitle = ({ className, ...props }: DrawerTitleProps) => {\n return (\n <BaseDialog.Title\n data-spark-component=\"drawer-title\"\n className={cx('text-headline-2 text-on-surface', className)}\n {...props}\n />\n )\n}\n\nDrawerTitle.displayName = 'Drawer.Title'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerTriggerProps extends Omit<\n ComponentProps<typeof BaseDialog.Trigger>,\n 'render'\n> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the drawer. Renders a <button> element.\n */\nexport const DrawerTrigger = ({ asChild = false, ...props }: DrawerTriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Trigger data-spark-component=\"drawer-trigger\" render={renderSlot} {...props} />\n}\n\nDrawerTrigger.displayName = 'Drawer.Trigger'\n","import { Drawer as Root } from './Drawer'\nimport { DrawerBody } from './DrawerBody'\nimport { DrawerClose } from './DrawerClose'\nimport { DrawerCloseButton } from './DrawerCloseButton'\nimport { DrawerContent } from './DrawerContent'\nimport { DrawerDescription } from './DrawerDescription' // aria-describedby\nimport { DrawerFooter } from './DrawerFooter'\nimport { DrawerHeader } from './DrawerHeader'\nimport { DrawerOverlay } from './DrawerOverlay'\nimport { DrawerPortal } from './DrawerPortal'\nimport { DrawerTitle } from './DrawerTitle'\nimport { DrawerTrigger } from './DrawerTrigger'\n\n/**\n * A panel that slides in from the edge of the screen, typically used for navigation or displaying additional content.\n */\nexport const Drawer: typeof Root & {\n Trigger: typeof DrawerTrigger\n Portal: typeof DrawerPortal\n Overlay: typeof DrawerOverlay\n Content: typeof DrawerContent\n Header: typeof DrawerHeader\n Body: typeof DrawerBody\n Footer: typeof DrawerFooter\n Close: typeof DrawerClose\n CloseButton: typeof DrawerCloseButton\n Title: typeof DrawerTitle\n Description: typeof DrawerDescription\n} = Object.assign(Root, {\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Overlay: DrawerOverlay,\n Content: DrawerContent,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n CloseButton: DrawerCloseButton,\n Title: DrawerTitle,\n Description: DrawerDescription,\n})\n\nDrawer.displayName = 'Drawer'\nDrawerTrigger.displayName = 'Drawer.Trigger'\nDrawerPortal.displayName = 'Drawer.Portal'\nDrawerOverlay.displayName = 'Drawer.Overlay'\nDrawerContent.displayName = 'Drawer.Content'\nDrawerHeader.displayName = 'Drawer.Header'\nDrawerBody.displayName = 'Drawer.Body'\nDrawerFooter.displayName = 'Drawer.Footer'\nDrawerClose.displayName = 'Drawer.Close'\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\nDrawerTitle.displayName = 'Drawer.Title'\nDrawerDescription.displayName = 'Drawer.Description'\n\nexport { type DrawerProps } from './Drawer'\nexport { type DrawerContentProps } from './DrawerContent'\nexport { type DrawerHeaderProps } from './DrawerHeader'\nexport { type DrawerBodyProps } from './DrawerBody'\nexport { type DrawerFooterProps } from './DrawerFooter'\nexport { type DrawerTriggerProps } from './DrawerTrigger'\nexport { type DrawerOverlayProps } from './DrawerOverlay'\nexport { type DrawerPortalProps } from './DrawerPortal'\nexport { type DrawerTitleProps } from './DrawerTitle'\nexport { type DrawerDescriptionProps } from './DrawerDescription'\nexport { type DrawerCloseProps } from './DrawerClose'\nexport { type DrawerCloseButtonProps } from './DrawerCloseButton'\n"],"mappings":"2dAMA,IAAM,GAAA,EAAA,EAAA,eAAyD,KAAK,CAEvD,GAAkB,CAC7B,SAAU,EACV,WAAW,OAMT,EAAA,EAAA,KAAC,EAAc,SAAf,CACE,MAAO,CACL,WACD,UAEA,EACsB,CAAA,CAIhB,MAAkB,CAC7B,IAAM,GAAA,EAAA,EAAA,YAAqB,EAAc,CAEzC,GAAI,CAAC,EACH,MAAM,MAAM,kDAAkD,CAGhE,OAAO,GCEI,GAAU,CAAE,eAAc,WAAW,GAAO,GAAG,KAAuC,CACjG,IAAM,EAAmB,GACpB,EAAe,IAA2B,CACzC,EAAa,EAAK,EAEpB,IAAA,GAEJ,OACE,EAAA,EAAA,KAAC,EAAD,CAA0B,qBACxB,EAAA,EAAA,KAAC,EAAA,OAAW,KAAZ,CAAiB,uBAAqB,SAAS,aAAc,EAAkB,GAAI,EAAS,CAAA,CAC7E,CAAA,EAIrB,EAAO,YAAc,cC/CrB,IAAa,GAAA,EAAA,EAAA,KACX,CAAC,OAAQ,kBAAmB,iBAAkB,0BAA0B,CACxE,CACE,SAAU,CACR,MAAO,CACL,KAAM,GACN,MAAO,cACR,CACF,CACD,gBAAiB,CACf,MAAO,GACR,CACF,CACF,CCCY,GAAc,CACzB,WACA,QAAQ,GACR,YACA,IAAK,EACL,GAAG,KACkB,CACrB,IAAM,GAAA,EAAA,EAAA,QAAuC,KAAK,CAC5C,GAAA,EAAA,EAAA,cAAmB,EAAc,EAAc,CAE/C,CAAE,YAAa,GAAW,CAE1B,CAAE,aAAA,EAAA,EAAA,mBAA+B,EAAc,CAErD,OACE,EAAA,EAAA,KAAC,MAAD,CACE,uBAAqB,cAChB,MACL,UAAW,EAAiB,CA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AQ,EACR,QAAS,EACT,QAAS,EACT,OAAQ,EACR,KAAM,EACN,OAAQ,EACR,MAAO,EACP,YAAa,EACb,MAAO,EACP,YAAa,EACd,CAAC,CAEF,EAAO,YAAc,SACrB,EAAc,YAAc,iBAC5B,EAAa,YAAc,gBAC3B,EAAc,YAAc,iBAC5B,EAAc,YAAc,iBAC5B,EAAa,YAAc,gBAC3B,EAAW,YAAc,cACzB,EAAa,YAAc,gBAC3B,EAAY,YAAc,eAC1B,EAAkB,YAAc,qBAChC,EAAY,YAAc,eAC1B,EAAkB,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/drawer/DrawerContext.tsx","../../src/drawer/Drawer.tsx","../../src/drawer/DrawerBody.styles.ts","../../src/drawer/DrawerBody.tsx","../../src/drawer/DrawerClose.tsx","../../src/drawer/DrawerCloseButton.tsx","../../src/drawer/DrawerContent.styles.tsx","../../src/drawer/DrawerContent.tsx","../../src/drawer/DrawerDescription.tsx","../../src/drawer/DrawerFooter.tsx","../../src/drawer/DrawerHeader.tsx","../../src/drawer/DrawerOverlay.tsx","../../src/drawer/DrawerPortal.tsx","../../src/drawer/DrawerTitle.tsx","../../src/drawer/DrawerTrigger.tsx","../../src/drawer/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react'\n\nexport interface DrawerContextState {\n withFade: boolean\n}\n\nconst DrawerContext = createContext<DrawerContextState | null>(null)\n\nexport const DrawerProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n return (\n <DrawerContext.Provider\n value={{\n withFade,\n }}\n >\n {childrenProp}\n </DrawerContext.Provider>\n )\n}\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext)\n\n if (!context) {\n throw Error('useDrawer must be used within a Drawer provider')\n }\n\n return context\n}\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, type ReactElement } from 'react'\n\nimport { DrawerProvider } from './DrawerContext'\n\nexport interface DrawerProps extends Omit<\n ComponentProps<typeof BaseDialog.Root>,\n 'onOpenChange' | 'render'\n> {\n /**\n * Specifies if the dialog is open or not.\n */\n open?: boolean\n /**\n * Default open state.\n */\n defaultOpen?: boolean\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: boolean\n /**\n * Specifies if the drawer should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Drawer = ({ onOpenChange, withFade = false, ...props }: DrawerProps): ReactElement => {\n const handleOpenChange = onOpenChange\n ? (open: boolean, _eventDetails: unknown) => {\n onOpenChange(open)\n }\n : undefined\n\n return (\n <DrawerProvider withFade={withFade}>\n <BaseDialog.Root data-spark-component=\"drawer\" onOpenChange={handleOpenChange} {...props} />\n </DrawerProvider>\n )\n}\n\nDrawer.displayName = 'Drawer.Root'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n defaultVariants: {\n inset: false,\n },\n }\n)\n\nexport type DrawerBodyStylesProps = VariantProps<typeof drawerBodyStyles>\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { type ReactNode, Ref, useRef } from 'react'\n\nimport { drawerBodyStyles, type DrawerBodyStylesProps } from './DrawerBody.styles'\nimport { useDrawer } from './DrawerContext'\n\nexport interface DrawerBodyProps extends DrawerBodyStylesProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerBody = ({\n children,\n inset = false,\n className,\n ref: forwardedRef,\n ...rest\n}: DrawerBodyProps) => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDrawer()\n\n const { overflow } = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"drawer-body\"\n ref={ref}\n className={drawerBodyStyles({ inset, className })}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nDrawerBody.displayName = 'Drawer.Body'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerCloseProps extends Omit<ComponentProps<typeof BaseDialog.Close>, 'render'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerClose = ({ asChild = false, ...props }: DrawerCloseProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Close data-spark-component=\"drawer-close\" render={renderSlot} {...props} />\n}\n\nDrawerClose.displayName = 'Drawer.Close'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { DrawerClose, type DrawerCloseProps } from './DrawerClose'\n\nexport type DrawerCloseButtonProps = DrawerCloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nexport const DrawerCloseButton = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: DrawerCloseButtonProps) => (\n <DrawerClose\n data-spark-component=\"drawer-close-button\"\n ref={ref}\n className={cx(['absolute', 'top-sm', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </DrawerClose>\n)\n\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerContentStyles = cva(\n [\n 'fixed z-modal flex flex-col bg-surface shadow-md',\n // Base UI uses data-open and data-closed for transitions\n 'data-open:animation-duration-400 data-closed:animation-duration-200',\n // Nested dialog effect\n 'data-nested-dialog-open:after:pointer-events-none',\n 'after:bg-transparent',\n 'after:transition-all',\n 'after:duration-200',\n 'data-nested-dialog-open:after:inset-0',\n 'data-nested-dialog-open:after:absolute',\n 'data-nested-dialog-open:after:rounded-[inherit]',\n 'data-nested-dialog-open:after:bg-overlay/dim-3',\n ],\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n fluid: '',\n fullscreen: 'h-screen w-screen',\n },\n side: {\n right: [\n 'inset-y-0 right-0',\n 'data-open:animate-slide-in-right ',\n 'data-closed:animate-slide-out-right',\n ],\n left: [\n 'inset-y-0 left-0',\n 'data-open:animate-slide-in-left',\n 'data-closed:animate-slide-out-left',\n ],\n top: [\n 'top-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-top',\n 'data-closed:animate-slide-out-top',\n ],\n bottom: [\n 'bottom-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-bottom',\n 'data-closed:animate-slide-out-bottom',\n ],\n },\n },\n compoundVariants: [\n {\n side: ['right', 'left'],\n size: 'sm',\n class: ['w-sz-480', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'md',\n class: ['w-sz-672', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'lg',\n class: ['w-sz-864', 'max-w-full'],\n },\n {\n side: ['left', 'right'],\n size: 'fluid',\n class: ['w-auto', 'max-w-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'sm',\n class: ['h-sz-480', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'md',\n class: ['h-sz-672', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'lg',\n class: ['h-sz-864', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'fluid',\n class: ['h-auto', 'max-h-full'],\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n }\n)\n\nexport type DrawerContentStylesProps = VariantProps<typeof drawerContentStyles>\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nimport { drawerContentStyles, type DrawerContentStylesProps } from './DrawerContent.styles'\n\nexport interface DrawerContentProps\n extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DrawerContentStylesProps {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerContent = ({\n className,\n size = 'md',\n side = 'right',\n ref,\n ...rest\n}: DrawerContentProps) => {\n return (\n <BaseDialog.Popup\n ref={ref}\n data-spark-component=\"drawer-content\"\n role=\"dialog\"\n className={state =>\n cx(\n drawerContentStyles({\n size,\n side,\n className: typeof className === 'function' ? className(state) : className,\n })\n )\n }\n {...rest}\n />\n )\n}\n\nDrawerContent.displayName = 'Drawer.Content'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerDescriptionProps extends Omit<\n ComponentProps<typeof BaseDialog.Description>,\n 'render'\n> {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const DrawerDescription = (props: DrawerDescriptionProps) => {\n return <BaseDialog.Description data-spark-component=\"drawer-description\" {...props} />\n}\n\nDrawerDescription.displayName = 'Drawer.Description'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, type ReactElement, Ref } from 'react'\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerFooter = ({ className, ref, ...rest }: DrawerFooterProps): ReactElement => (\n <footer\n data-spark-component=\"drawer-footer\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n />\n)\n\nDrawerFooter.displayName = 'Drawer.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface DrawerHeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerHeader = ({\n children,\n className,\n ref,\n ...rest\n}: DrawerHeaderProps): ReactElement => (\n <header\n data-spark-component=\"drawer-header\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n >\n {children}\n </header>\n)\n\nDrawerHeader.displayName = 'Dialog.Header'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerOverlayProps extends Omit<\n ComponentProps<typeof BaseDialog.Backdrop>,\n 'render'\n> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerOverlay = ({ className, ...props }: DrawerOverlayProps) => {\n return (\n <BaseDialog.Backdrop\n data-spark-component=\"drawer-overlay\"\n className={state =>\n cx(\n 'z-overlay fixed top-0 left-0 h-screen w-screen',\n 'bg-overlay/dim-1',\n // Base UI automatically adds data-[starting-style] and data-[ending-style] attributes\n 'data-starting-style:animate-fade-in',\n 'data-ending-style:animate-fade-out',\n typeof className === 'function' ? className(state) : className\n )\n }\n {...props}\n />\n )\n}\n\nDrawerOverlay.displayName = 'Drawer.Overlay'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nexport type DrawerPortalProps = ComponentProps<typeof BaseDialog.Portal>\n\nexport const DrawerPortal = ({ className, ...props }: DrawerPortalProps) => {\n return (\n <BaseDialog.Portal\n data-spark-component=\"drawer-portal\"\n className={cx(className, 'z-modal absolute')}\n {...props}\n />\n )\n}\n\nDrawerPortal.displayName = 'Drawer.Portal'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerTitleProps extends Omit<ComponentProps<typeof BaseDialog.Title>, 'render'> {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const DrawerTitle = ({ className, ...props }: DrawerTitleProps) => {\n return (\n <BaseDialog.Title\n data-spark-component=\"drawer-title\"\n className={cx('text-headline-2 text-on-surface', className)}\n {...props}\n />\n )\n}\n\nDrawerTitle.displayName = 'Drawer.Title'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerTriggerProps extends Omit<\n ComponentProps<typeof BaseDialog.Trigger>,\n 'render'\n> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerTrigger = ({ asChild = false, ...props }: DrawerTriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Trigger data-spark-component=\"drawer-trigger\" render={renderSlot} {...props} />\n}\n\nDrawerTrigger.displayName = 'Drawer.Trigger'\n","import { Drawer as Root } from './Drawer'\nimport { DrawerBody } from './DrawerBody'\nimport { DrawerClose } from './DrawerClose'\nimport { DrawerCloseButton } from './DrawerCloseButton'\nimport { DrawerContent } from './DrawerContent'\nimport { DrawerDescription } from './DrawerDescription' // aria-describedby\nimport { DrawerFooter } from './DrawerFooter'\nimport { DrawerHeader } from './DrawerHeader'\nimport { DrawerOverlay } from './DrawerOverlay'\nimport { DrawerPortal } from './DrawerPortal'\nimport { DrawerTitle } from './DrawerTitle'\nimport { DrawerTrigger } from './DrawerTrigger'\n\n/**\n * A panel that slides in from the edge of the screen, typically used for navigation or displaying additional content.\n */\nexport const Drawer: typeof Root & {\n Trigger: typeof DrawerTrigger\n Portal: typeof DrawerPortal\n Overlay: typeof DrawerOverlay\n Content: typeof DrawerContent\n Header: typeof DrawerHeader\n Body: typeof DrawerBody\n Footer: typeof DrawerFooter\n Close: typeof DrawerClose\n CloseButton: typeof DrawerCloseButton\n Title: typeof DrawerTitle\n Description: typeof DrawerDescription\n} = Object.assign(Root, {\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Overlay: DrawerOverlay,\n Content: DrawerContent,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n CloseButton: DrawerCloseButton,\n Title: DrawerTitle,\n Description: DrawerDescription,\n})\n\nDrawer.displayName = 'Drawer'\nDrawerTrigger.displayName = 'Drawer.Trigger'\nDrawerPortal.displayName = 'Drawer.Portal'\nDrawerOverlay.displayName = 'Drawer.Overlay'\nDrawerContent.displayName = 'Drawer.Content'\nDrawerHeader.displayName = 'Drawer.Header'\nDrawerBody.displayName = 'Drawer.Body'\nDrawerFooter.displayName = 'Drawer.Footer'\nDrawerClose.displayName = 'Drawer.Close'\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\nDrawerTitle.displayName = 'Drawer.Title'\nDrawerDescription.displayName = 'Drawer.Description'\n\nexport { type DrawerProps } from './Drawer'\nexport { type DrawerContentProps } from './DrawerContent'\nexport { type DrawerHeaderProps } from './DrawerHeader'\nexport { type DrawerBodyProps } from './DrawerBody'\nexport { type DrawerFooterProps } from './DrawerFooter'\nexport { type DrawerTriggerProps } from './DrawerTrigger'\nexport { type DrawerOverlayProps } from './DrawerOverlay'\nexport { type DrawerPortalProps } from './DrawerPortal'\nexport { type DrawerTitleProps } from './DrawerTitle'\nexport { type DrawerDescriptionProps } from './DrawerDescription'\nexport { type DrawerCloseProps } from './DrawerClose'\nexport { type DrawerCloseButtonProps } from './DrawerCloseButton'\n"],"mappings":";;;;;;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,CAAA;AAIN,EAAc,cAAc;;;ACxB5B,IAAa,KAAgB,EAAE,cAAW,GAAG,QAEzC,kBAAC,EAAW,QAAZ;CACE,wBAAqB;CACrB,WAAW,EAAG,GAAW,mBAAmB;CAC5C,GAAI;CACJ,CAAA;AAIN,EAAa,cAAc;;;ACR3B,IAAa,KAAe,EAAE,cAAW,GAAG,QAExC,kBAAC,EAAW,OAAZ;CACE,wBAAqB;CACrB,WAAW,EAAG,mCAAmC,EAAU;CAC3D,GAAI;CACJ,CAAA;AAIN,EAAY,cAAc;;;ACF1B,IAAa,KAAiB,EAAE,aAAU,IAAO,GAAG,QAAgC;CAClF,IAAM,IAAa,EAAc,GAAS,SAAS;AAEnD,QAAO,kBAAC,EAAW,SAAZ;EAAoB,wBAAqB;EAAiB,QAAQ;EAAY,GAAI;EAAS,CAAA;;AAGpG,EAAc,cAAc;;;ACN5B,IAAa,IAYT,OAAO,OAAO,GAAM;CACtB,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,OAAO;CACP,aAAa;CACb,OAAO;CACP,aAAa;CACd,CAAC;AAEF,EAAO,cAAc,UACrB,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAc,cAAc,kBAC5B,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAW,cAAc,eACzB,EAAa,cAAc,iBAC3B,EAAY,cAAc,gBAC1B,EAAkB,cAAc,sBAChC,EAAY,cAAc,gBAC1B,EAAkB,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/drawer/DrawerContext.tsx","../../src/drawer/Drawer.tsx","../../src/drawer/DrawerBody.styles.ts","../../src/drawer/DrawerBody.tsx","../../src/drawer/DrawerClose.tsx","../../src/drawer/DrawerCloseButton.tsx","../../src/drawer/DrawerContent.styles.tsx","../../src/drawer/DrawerContent.tsx","../../src/drawer/DrawerDescription.tsx","../../src/drawer/DrawerFooter.tsx","../../src/drawer/DrawerHeader.tsx","../../src/drawer/DrawerOverlay.tsx","../../src/drawer/DrawerPortal.tsx","../../src/drawer/DrawerTitle.tsx","../../src/drawer/DrawerTrigger.tsx","../../src/drawer/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react'\n\nexport interface DrawerContextState {\n withFade: boolean\n}\n\nconst DrawerContext = createContext<DrawerContextState | null>(null)\n\nexport const DrawerProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n return (\n <DrawerContext.Provider\n value={{\n withFade,\n }}\n >\n {childrenProp}\n </DrawerContext.Provider>\n )\n}\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext)\n\n if (!context) {\n throw Error('useDrawer must be used within a Drawer provider')\n }\n\n return context\n}\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, type ReactElement } from 'react'\n\nimport { DrawerProvider } from './DrawerContext'\n\nexport interface DrawerProps extends Omit<\n ComponentProps<typeof BaseDialog.Root>,\n 'onOpenChange' | 'render'\n> {\n /**\n * Specifies if the dialog is open or not.\n */\n open?: boolean\n /**\n * Default open state.\n */\n defaultOpen?: boolean\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: boolean\n /**\n * Specifies if the drawer should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Drawer = ({ onOpenChange, withFade = false, ...props }: DrawerProps): ReactElement => {\n const handleOpenChange = onOpenChange\n ? (open: boolean, _eventDetails: unknown) => {\n onOpenChange(open)\n }\n : undefined\n\n return (\n <DrawerProvider withFade={withFade}>\n <BaseDialog.Root data-spark-component=\"drawer\" onOpenChange={handleOpenChange} {...props} />\n </DrawerProvider>\n )\n}\n\nDrawer.displayName = 'Drawer.Root'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n defaultVariants: {\n inset: false,\n },\n }\n)\n\nexport type DrawerBodyStylesProps = VariantProps<typeof drawerBodyStyles>\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { type ReactNode, Ref, useRef } from 'react'\n\nimport { drawerBodyStyles, type DrawerBodyStylesProps } from './DrawerBody.styles'\nimport { useDrawer } from './DrawerContext'\n\nexport interface DrawerBodyProps extends DrawerBodyStylesProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The scrollable body section of the drawer. Renders a <div> element.\n */\nexport const DrawerBody = ({\n children,\n inset = false,\n className,\n ref: forwardedRef,\n ...rest\n}: DrawerBodyProps) => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDrawer()\n\n const { overflow } = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"drawer-body\"\n ref={ref}\n className={drawerBodyStyles({ inset, className })}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nDrawerBody.displayName = 'Drawer.Body'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerCloseProps extends Omit<ComponentProps<typeof BaseDialog.Close>, 'render'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the drawer. Renders a <button> element.\n */\nexport const DrawerClose = ({ asChild = false, ...props }: DrawerCloseProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Close data-spark-component=\"drawer-close\" render={renderSlot} {...props} />\n}\n\nDrawerClose.displayName = 'Drawer.Close'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { DrawerClose, type DrawerCloseProps } from './DrawerClose'\n\nexport type DrawerCloseButtonProps = DrawerCloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\n/**\n * A styled close button positioned in the drawer header. Renders a <button> element.\n */\nexport const DrawerCloseButton = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: DrawerCloseButtonProps) => (\n <DrawerClose\n data-spark-component=\"drawer-close-button\"\n ref={ref}\n className={cx(['absolute', 'top-sm', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </DrawerClose>\n)\n\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerContentStyles = cva(\n [\n 'fixed z-modal flex flex-col bg-surface shadow-md',\n // Base UI uses data-open and data-closed for transitions\n 'data-open:animation-duration-400 data-closed:animation-duration-200',\n // Nested dialog effect\n 'data-nested-dialog-open:after:pointer-events-none',\n 'after:bg-transparent',\n 'after:transition-all',\n 'after:duration-200',\n 'data-nested-dialog-open:after:inset-0',\n 'data-nested-dialog-open:after:absolute',\n 'data-nested-dialog-open:after:rounded-[inherit]',\n 'data-nested-dialog-open:after:bg-overlay/dim-3',\n ],\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n fluid: '',\n fullscreen: 'h-screen w-screen',\n },\n side: {\n right: [\n 'inset-y-0 right-0',\n 'data-open:animate-slide-in-right ',\n 'data-closed:animate-slide-out-right',\n ],\n left: [\n 'inset-y-0 left-0',\n 'data-open:animate-slide-in-left',\n 'data-closed:animate-slide-out-left',\n ],\n top: [\n 'top-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-top',\n 'data-closed:animate-slide-out-top',\n ],\n bottom: [\n 'bottom-0 left-0',\n 'w-screen',\n 'data-open:animate-slide-in-bottom',\n 'data-closed:animate-slide-out-bottom',\n ],\n },\n },\n compoundVariants: [\n {\n side: ['right', 'left'],\n size: 'sm',\n class: ['w-sz-480', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'md',\n class: ['w-sz-672', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'lg',\n class: ['w-sz-864', 'max-w-full'],\n },\n {\n side: ['left', 'right'],\n size: 'fluid',\n class: ['w-auto', 'max-w-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'sm',\n class: ['h-sz-480', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'md',\n class: ['h-sz-672', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'lg',\n class: ['h-sz-864', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'fluid',\n class: ['h-auto', 'max-h-full'],\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n }\n)\n\nexport type DrawerContentStylesProps = VariantProps<typeof drawerContentStyles>\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nimport { drawerContentStyles, type DrawerContentStylesProps } from './DrawerContent.styles'\n\nexport interface DrawerContentProps\n extends Omit<ComponentProps<typeof BaseDialog.Popup>, 'render'>, DrawerContentStylesProps {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The popup element that contains the drawer content. Renders a <div> element.\n */\nexport const DrawerContent = ({\n className,\n size = 'md',\n side = 'right',\n ref,\n ...rest\n}: DrawerContentProps) => {\n return (\n <BaseDialog.Popup\n ref={ref}\n data-spark-component=\"drawer-content\"\n role=\"dialog\"\n className={state =>\n cx(\n drawerContentStyles({\n size,\n side,\n className: typeof className === 'function' ? className(state) : className,\n })\n )\n }\n {...rest}\n />\n )\n}\n\nDrawerContent.displayName = 'Drawer.Content'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerDescriptionProps extends Omit<\n ComponentProps<typeof BaseDialog.Description>,\n 'render'\n> {\n ref?: Ref<HTMLParagraphElement>\n}\n\n/**\n * A paragraph with additional information about the drawer. Renders a <p> element.\n */\nexport const DrawerDescription = (props: DrawerDescriptionProps) => {\n return <BaseDialog.Description data-spark-component=\"drawer-description\" {...props} />\n}\n\nDrawerDescription.displayName = 'Drawer.Description'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, type ReactElement, Ref } from 'react'\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The footer section of the drawer, typically containing action buttons. Renders a <footer> element.\n */\nexport const DrawerFooter = ({ className, ref, ...rest }: DrawerFooterProps): ReactElement => (\n <footer\n data-spark-component=\"drawer-footer\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n />\n)\n\nDrawerFooter.displayName = 'Drawer.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface DrawerHeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the drawer. Renders a <header> element.\n */\nexport const DrawerHeader = ({\n children,\n className,\n ref,\n ...rest\n}: DrawerHeaderProps): ReactElement => (\n <header\n data-spark-component=\"drawer-header\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n >\n {children}\n </header>\n)\n\nDrawerHeader.displayName = 'Dialog.Header'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerOverlayProps extends Omit<\n ComponentProps<typeof BaseDialog.Backdrop>,\n 'render'\n> {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The backdrop element that dims the rest of the page. Renders a <div> element.\n */\nexport const DrawerOverlay = ({ className, ...props }: DrawerOverlayProps) => {\n return (\n <BaseDialog.Backdrop\n data-spark-component=\"drawer-overlay\"\n className={state =>\n cx(\n 'z-overlay fixed top-0 left-0 h-screen w-screen',\n 'bg-overlay/dim-1',\n // Base UI automatically adds data-[starting-style] and data-[ending-style] attributes\n 'data-starting-style:animate-fade-in',\n 'data-ending-style:animate-fade-out',\n typeof className === 'function' ? className(state) : className\n )\n }\n {...props}\n />\n )\n}\n\nDrawerOverlay.displayName = 'Drawer.Overlay'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nexport type DrawerPortalProps = ComponentProps<typeof BaseDialog.Portal>\n\n/**\n * A portal that renders the drawer in a different part of the DOM. Renders a <div> element.\n */\nexport const DrawerPortal = ({ className, ...props }: DrawerPortalProps) => {\n return (\n <BaseDialog.Portal\n data-spark-component=\"drawer-portal\"\n className={cx(className, 'z-modal absolute')}\n {...props}\n />\n )\n}\n\nDrawerPortal.displayName = 'Drawer.Portal'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nexport interface DrawerTitleProps extends Omit<ComponentProps<typeof BaseDialog.Title>, 'render'> {\n ref?: Ref<HTMLHeadingElement>\n}\n\n/**\n * The title of the drawer, announced to assistive technology. Renders an <h2> element.\n */\nexport const DrawerTitle = ({ className, ...props }: DrawerTitleProps) => {\n return (\n <BaseDialog.Title\n data-spark-component=\"drawer-title\"\n className={cx('text-headline-2 text-on-surface', className)}\n {...props}\n />\n )\n}\n\nDrawerTitle.displayName = 'Drawer.Title'\n","import { Dialog as BaseDialog } from '@base-ui/react/dialog'\nimport { ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface DrawerTriggerProps extends Omit<\n ComponentProps<typeof BaseDialog.Trigger>,\n 'render'\n> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the drawer. Renders a <button> element.\n */\nexport const DrawerTrigger = ({ asChild = false, ...props }: DrawerTriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return <BaseDialog.Trigger data-spark-component=\"drawer-trigger\" render={renderSlot} {...props} />\n}\n\nDrawerTrigger.displayName = 'Drawer.Trigger'\n","import { Drawer as Root } from './Drawer'\nimport { DrawerBody } from './DrawerBody'\nimport { DrawerClose } from './DrawerClose'\nimport { DrawerCloseButton } from './DrawerCloseButton'\nimport { DrawerContent } from './DrawerContent'\nimport { DrawerDescription } from './DrawerDescription' // aria-describedby\nimport { DrawerFooter } from './DrawerFooter'\nimport { DrawerHeader } from './DrawerHeader'\nimport { DrawerOverlay } from './DrawerOverlay'\nimport { DrawerPortal } from './DrawerPortal'\nimport { DrawerTitle } from './DrawerTitle'\nimport { DrawerTrigger } from './DrawerTrigger'\n\n/**\n * A panel that slides in from the edge of the screen, typically used for navigation or displaying additional content.\n */\nexport const Drawer: typeof Root & {\n Trigger: typeof DrawerTrigger\n Portal: typeof DrawerPortal\n Overlay: typeof DrawerOverlay\n Content: typeof DrawerContent\n Header: typeof DrawerHeader\n Body: typeof DrawerBody\n Footer: typeof DrawerFooter\n Close: typeof DrawerClose\n CloseButton: typeof DrawerCloseButton\n Title: typeof DrawerTitle\n Description: typeof DrawerDescription\n} = Object.assign(Root, {\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Overlay: DrawerOverlay,\n Content: DrawerContent,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n Close: DrawerClose,\n CloseButton: DrawerCloseButton,\n Title: DrawerTitle,\n Description: DrawerDescription,\n})\n\nDrawer.displayName = 'Drawer'\nDrawerTrigger.displayName = 'Drawer.Trigger'\nDrawerPortal.displayName = 'Drawer.Portal'\nDrawerOverlay.displayName = 'Drawer.Overlay'\nDrawerContent.displayName = 'Drawer.Content'\nDrawerHeader.displayName = 'Drawer.Header'\nDrawerBody.displayName = 'Drawer.Body'\nDrawerFooter.displayName = 'Drawer.Footer'\nDrawerClose.displayName = 'Drawer.Close'\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\nDrawerTitle.displayName = 'Drawer.Title'\nDrawerDescription.displayName = 'Drawer.Description'\n\nexport { type DrawerProps } from './Drawer'\nexport { type DrawerContentProps } from './DrawerContent'\nexport { type DrawerHeaderProps } from './DrawerHeader'\nexport { type DrawerBodyProps } from './DrawerBody'\nexport { type DrawerFooterProps } from './DrawerFooter'\nexport { type DrawerTriggerProps } from './DrawerTrigger'\nexport { type DrawerOverlayProps } from './DrawerOverlay'\nexport { type DrawerPortalProps } from './DrawerPortal'\nexport { type DrawerTitleProps } from './DrawerTitle'\nexport { type DrawerDescriptionProps } from './DrawerDescription'\nexport { type DrawerCloseProps } from './DrawerClose'\nexport { type DrawerCloseButtonProps } from './DrawerCloseButton'\n"],"mappings":";;;;;;;;;;;AAMA,IAAM,IAAgB,EAAyC,KAAK,EAEvD,KAAkB,EAC7B,UAAU,GACV,cAAW,SAMT,kBAAC,EAAc,UAAf;CACE,OAAO,EACL,aACD;WAEA;CACsB,CAAA,EAIhB,UAAkB;CAC7B,IAAM,IAAU,EAAW,EAAc;AAEzC,KAAI,CAAC,EACH,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cAAW,GAAG,QAExC,kBAAC,EAAW,OAAZ;CACE,wBAAqB;CACrB,WAAW,EAAG,mCAAmC,EAAU;CAC3D,GAAI;CACJ,CAAA;AAIN,EAAY,cAAc;;;ACF1B,IAAa,KAAiB,EAAE,aAAU,IAAO,GAAG,QAAgC;CAClF,IAAM,IAAa,EAAc,GAAS,SAAS;AAEnD,QAAO,kBAAC,EAAW,SAAZ;EAAoB,wBAAqB;EAAiB,QAAQ;EAAY,GAAI;EAAS,CAAA;;AAGpG,EAAc,cAAc;;;ACT5B,IAAa,IAYT,OAAO,OAAO,GAAM;CACtB,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,OAAO;CACP,aAAa;CACb,OAAO;CACP,aAAa;CACd,CAAC;AAEF,EAAO,cAAc,UACrB,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAc,cAAc,kBAC5B,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAW,cAAc,eACzB,EAAa,cAAc,iBAC3B,EAAY,cAAc,gBAC1B,EAAkB,cAAc,sBAChC,EAAY,cAAc,gBAC1B,EAAkB,cAAc"}
|
|
@@ -3,6 +3,9 @@ interface DividerProps {
|
|
|
3
3
|
className?: string;
|
|
4
4
|
ref?: Ref<HTMLDivElement>;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* A visual divider between dropdown items. Renders a <div> element.
|
|
8
|
+
*/
|
|
6
9
|
export declare const Divider: {
|
|
7
10
|
({ className, ref: forwardedRef }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
displayName: string;
|