@ghostvue/vue 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +40 -2
- package/dist/.registries/component-names.generated.d.ts +3 -0
- package/dist/GhostAccordion.vue.d.ts +38 -0
- package/dist/GhostAccordionContent.vue.d.ts +26 -0
- package/dist/GhostAccordionItem.vue.d.ts +20 -0
- package/dist/GhostAccordionTrigger.vue.d.ts +23 -0
- package/dist/GhostAvatar.vue.d.ts +27 -0
- package/dist/GhostBadge.vue.d.ts +16 -0
- package/dist/GhostBreadcrumb.vue.d.ts +28 -0
- package/dist/GhostBreadcrumbEllipsis.vue.d.ts +20 -0
- package/dist/GhostBreadcrumbItem.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbLink.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbList.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbPage.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbSeparator.vue.d.ts +25 -0
- package/dist/GhostButton.vue.d.ts +25 -0
- package/dist/GhostCalendar.vue.d.ts +57 -0
- package/dist/GhostCalendarCell.vue.d.ts +35 -0
- package/dist/GhostCalendarGrid.vue.d.ts +19 -0
- package/dist/GhostCalendarHeader.vue.d.ts +24 -0
- package/dist/GhostCalendarHeading.vue.d.ts +22 -0
- package/dist/GhostCalendarNextButton.vue.d.ts +24 -0
- package/dist/GhostCalendarPrevButton.vue.d.ts +24 -0
- package/dist/GhostCard.vue.d.ts +18 -0
- package/dist/GhostCheckbox.vue.d.ts +48 -0
- package/dist/GhostCheckboxGroup.vue.d.ts +24 -0
- package/dist/GhostCollapsible.vue.d.ts +31 -0
- package/dist/GhostCollapsibleContent.vue.d.ts +30 -0
- package/dist/GhostCollapsibleTrigger.vue.d.ts +28 -0
- package/dist/GhostCombobox.vue.d.ts +69 -0
- package/dist/GhostComboboxContent.vue.d.ts +41 -0
- package/dist/GhostComboboxEmpty.vue.d.ts +21 -0
- package/dist/GhostComboboxGroup.vue.d.ts +21 -0
- package/dist/GhostComboboxInput.vue.d.ts +11 -0
- package/dist/GhostComboboxLabel.vue.d.ts +21 -0
- package/dist/GhostComboboxOption.vue.d.ts +29 -0
- package/dist/GhostComboboxTrigger.vue.d.ts +26 -0
- package/dist/GhostCommandPalette.vue.d.ts +57 -0
- package/dist/GhostCommandPaletteContent.vue.d.ts +47 -0
- package/dist/GhostCommandPaletteEmpty.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteGroup.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteInput.vue.d.ts +13 -0
- package/dist/GhostCommandPaletteItem.vue.d.ts +33 -0
- package/dist/GhostCommandPaletteLabel.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteList.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteOverlay.vue.d.ts +32 -0
- package/dist/GhostCommandPaletteSeparator.vue.d.ts +10 -0
- package/dist/GhostCommandPaletteTitle.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteTrigger.vue.d.ts +28 -0
- package/dist/GhostContextMenu.vue.d.ts +26 -0
- package/dist/GhostContextMenuCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostContextMenuContent.vue.d.ts +39 -0
- package/dist/GhostContextMenuGroup.vue.d.ts +21 -0
- package/dist/GhostContextMenuItem.vue.d.ts +30 -0
- package/dist/GhostContextMenuLabel.vue.d.ts +21 -0
- package/dist/GhostContextMenuRadioGroup.vue.d.ts +31 -0
- package/dist/GhostContextMenuRadioItem.vue.d.ts +31 -0
- package/dist/GhostContextMenuSeparator.vue.d.ts +11 -0
- package/dist/GhostContextMenuTrigger.vue.d.ts +28 -0
- package/dist/GhostDataTable.vue.d.ts +29 -0
- package/dist/GhostDataTablePreset.vue.d.ts +21 -0
- package/dist/GhostDataTableTable.vue.d.ts +20 -0
- package/dist/GhostDatePicker.vue.d.ts +106 -0
- package/dist/GhostDatePickerCalendar.vue.d.ts +16 -0
- package/dist/GhostDatePickerContent.vue.d.ts +46 -0
- package/dist/GhostDatePickerInput.vue.d.ts +19 -0
- package/dist/GhostDatePickerTrigger.vue.d.ts +14 -0
- package/dist/GhostDialog.vue.d.ts +31 -0
- package/dist/GhostDialogClose.vue.d.ts +28 -0
- package/dist/GhostDialogContent.vue.d.ts +50 -0
- package/dist/GhostDialogDescription.vue.d.ts +25 -0
- package/dist/GhostDialogOverlay.vue.d.ts +32 -0
- package/dist/GhostDialogTitle.vue.d.ts +25 -0
- package/dist/GhostDialogTrigger.vue.d.ts +28 -0
- package/dist/GhostDrawer.vue.d.ts +39 -0
- package/dist/GhostDrawerClose.vue.d.ts +28 -0
- package/dist/GhostDrawerContent.vue.d.ts +47 -0
- package/dist/GhostDrawerDescription.vue.d.ts +25 -0
- package/dist/GhostDrawerOverlay.vue.d.ts +32 -0
- package/dist/GhostDrawerTitle.vue.d.ts +25 -0
- package/dist/GhostDrawerTrigger.vue.d.ts +28 -0
- package/dist/GhostDropdownMenu.vue.d.ts +26 -0
- package/dist/GhostDropdownMenuCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostDropdownMenuContent.vue.d.ts +39 -0
- package/dist/GhostDropdownMenuGroup.vue.d.ts +21 -0
- package/dist/GhostDropdownMenuItem.vue.d.ts +30 -0
- package/dist/GhostDropdownMenuLabel.vue.d.ts +21 -0
- package/dist/GhostDropdownMenuRadioGroup.vue.d.ts +31 -0
- package/dist/GhostDropdownMenuRadioItem.vue.d.ts +31 -0
- package/dist/GhostDropdownMenuSeparator.vue.d.ts +11 -0
- package/dist/GhostDropdownMenuTrigger.vue.d.ts +26 -0
- package/dist/GhostEmptyState.vue.d.ts +19 -0
- package/dist/GhostField.vue.d.ts +31 -0
- package/dist/GhostFieldControl.vue.d.ts +13 -0
- package/dist/GhostFieldDescription.vue.d.ts +21 -0
- package/dist/GhostFieldError.vue.d.ts +18 -0
- package/dist/GhostFieldLabel.vue.d.ts +30 -0
- package/dist/GhostFileUpload.vue.d.ts +64 -0
- package/dist/GhostFileUploadDropzone.vue.d.ts +13 -0
- package/dist/GhostFileUploadItem.vue.d.ts +17 -0
- package/dist/GhostFileUploadItemRemove.vue.d.ts +13 -0
- package/dist/GhostFileUploadList.vue.d.ts +13 -0
- package/dist/GhostFileUploadTrigger.vue.d.ts +19 -0
- package/dist/GhostForm.vue.d.ts +25 -0
- package/dist/GhostHoverCard.vue.d.ts +37 -0
- package/dist/GhostHoverCardContent.vue.d.ts +47 -0
- package/dist/GhostHoverCardTrigger.vue.d.ts +28 -0
- package/dist/GhostInlineAlert.vue.d.ts +19 -0
- package/dist/GhostInput.vue.d.ts +26 -0
- package/dist/GhostInteractiveSurface.vue.d.ts +25 -0
- package/dist/GhostKbd.vue.d.ts +25 -0
- package/dist/GhostLink.vue.d.ts +25 -0
- package/dist/GhostMenubar.vue.d.ts +27 -0
- package/dist/GhostMenubarCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostMenubarContent.vue.d.ts +39 -0
- package/dist/GhostMenubarGroup.vue.d.ts +21 -0
- package/dist/GhostMenubarItem.vue.d.ts +30 -0
- package/dist/GhostMenubarLabel.vue.d.ts +21 -0
- package/dist/GhostMenubarMenu.vue.d.ts +26 -0
- package/dist/GhostMenubarRadioGroup.vue.d.ts +31 -0
- package/dist/GhostMenubarRadioItem.vue.d.ts +31 -0
- package/dist/GhostMenubarSeparator.vue.d.ts +11 -0
- package/dist/GhostMenubarTrigger.vue.d.ts +26 -0
- package/dist/GhostNumberInput.vue.d.ts +37 -0
- package/dist/GhostPagination.vue.d.ts +53 -0
- package/dist/GhostPopover.vue.d.ts +28 -0
- package/dist/GhostPopoverClose.vue.d.ts +28 -0
- package/dist/GhostPopoverContent.vue.d.ts +47 -0
- package/dist/GhostPopoverTrigger.vue.d.ts +28 -0
- package/dist/GhostPortal.vue.d.ts +28 -0
- package/dist/GhostPresence.vue.d.ts +27 -0
- package/dist/GhostProgress.vue.d.ts +14 -0
- package/dist/GhostRadioGroup.vue.d.ts +36 -0
- package/dist/GhostRadioGroupItem.vue.d.ts +10 -0
- package/dist/GhostScrollArea.vue.d.ts +17 -0
- package/dist/GhostScrollSpy.vue.d.ts +57 -0
- package/dist/GhostScrollSpyItem.vue.d.ts +26 -0
- package/dist/GhostScrollSpyLink.vue.d.ts +27 -0
- package/dist/GhostScrollSpyList.vue.d.ts +24 -0
- package/dist/GhostSegmentedControl.vue.d.ts +44 -0
- package/dist/GhostSegmentedControlIndicator.vue.d.ts +3 -0
- package/dist/GhostSegmentedControlItem.vue.d.ts +30 -0
- package/dist/GhostSelect.vue.d.ts +24 -0
- package/dist/GhostSelectContent.vue.d.ts +41 -0
- package/dist/GhostSelectGroup.vue.d.ts +21 -0
- package/dist/GhostSelectLabel.vue.d.ts +21 -0
- package/dist/GhostSelectOption.vue.d.ts +29 -0
- package/dist/GhostSelectTrigger.vue.d.ts +26 -0
- package/dist/GhostSelectValue.vue.d.ts +14 -0
- package/dist/GhostSeparator.vue.d.ts +7 -0
- package/dist/GhostSkeleton.vue.d.ts +18 -0
- package/dist/GhostSlider.vue.d.ts +141 -0
- package/dist/GhostSpinner.vue.d.ts +8 -0
- package/dist/GhostSubmenu.vue.d.ts +23 -0
- package/dist/GhostSubmenuContent.vue.d.ts +20 -0
- package/dist/GhostSubmenuTrigger.vue.d.ts +17 -0
- package/dist/GhostSwitch.vue.d.ts +37 -0
- package/dist/GhostTable.vue.d.ts +15 -0
- package/dist/GhostTableBody.vue.d.ts +13 -0
- package/dist/GhostTableCaption.vue.d.ts +13 -0
- package/dist/GhostTableCell.vue.d.ts +13 -0
- package/dist/GhostTableFoot.vue.d.ts +13 -0
- package/dist/GhostTableHead.vue.d.ts +13 -0
- package/dist/GhostTableHeaderCell.vue.d.ts +13 -0
- package/dist/GhostTableRow.vue.d.ts +13 -0
- package/dist/GhostTabs.vue.d.ts +37 -0
- package/dist/GhostTabsContent.vue.d.ts +27 -0
- package/dist/GhostTabsList.vue.d.ts +25 -0
- package/dist/GhostTabsTrigger.vue.d.ts +30 -0
- package/dist/GhostTagsInput.vue.d.ts +26 -0
- package/dist/GhostTextarea.vue.d.ts +29 -0
- package/dist/GhostToast.vue.d.ts +17 -0
- package/dist/GhostToastAction.vue.d.ts +17 -0
- package/dist/GhostToastClose.vue.d.ts +16 -0
- package/dist/GhostToastDescription.vue.d.ts +12 -0
- package/dist/GhostToastProvider.vue.d.ts +24 -0
- package/dist/GhostToastTitle.vue.d.ts +12 -0
- package/dist/GhostToastViewport.vue.d.ts +25 -0
- package/dist/GhostToggleGroup.vue.d.ts +41 -0
- package/dist/GhostToggleGroupItem.vue.d.ts +30 -0
- package/dist/GhostToolbar.vue.d.ts +29 -0
- package/dist/GhostTooltip.vue.d.ts +36 -0
- package/dist/GhostTooltipContent.vue.d.ts +47 -0
- package/dist/GhostTooltipProvider.vue.d.ts +16 -0
- package/dist/GhostTooltipTrigger.vue.d.ts +28 -0
- package/dist/GhostTree.vue.d.ts +59 -0
- package/dist/GhostTreeGroup.vue.d.ts +22 -0
- package/dist/GhostTreeItem.vue.d.ts +27 -0
- package/dist/GhostTreeTrigger.vue.d.ts +25 -0
- package/dist/GhostVisuallyHidden.vue.d.ts +19 -0
- package/dist/accordion-header-keyboard.d.ts +11 -0
- package/dist/calendar-date-math.d.ts +16 -0
- package/dist/calendar-intl.d.ts +7 -0
- package/dist/calendar-public-date.d.ts +1 -0
- package/dist/command-palette-context.d.ts +6 -0
- package/dist/data-table-interaction.d.ts +57 -0
- package/dist/data-table-processing.d.ts +32 -0
- package/dist/data-table-render.d.ts +40 -0
- package/dist/data-table-slot-bindings.d.ts +21 -0
- package/dist/date-picker-calendar-bridge.d.ts +25 -0
- package/dist/date-picker-value.d.ts +33 -0
- package/dist/define-data-table-columns.d.ts +89 -0
- package/dist/dev-codes.d.ts +179 -0
- package/dist/dialog-shared.d.ts +178 -0
- package/dist/dismissable-layer-stack.d.ts +28 -0
- package/dist/form-reset.d.ts +29 -0
- package/dist/get-pagination-range.d.ts +24 -0
- package/dist/get-tabbable-elements.d.ts +22 -0
- package/dist/ghost-accordion.d.ts +120 -0
- package/dist/ghost-avatar.d.ts +41 -0
- package/dist/ghost-badge.d.ts +11 -0
- package/dist/ghost-breadcrumb.d.ts +114 -0
- package/dist/ghost-button.d.ts +39 -0
- package/dist/ghost-calendar.d.ts +148 -0
- package/dist/ghost-card.d.ts +29 -0
- package/dist/ghost-checkbox-group.d.ts +88 -0
- package/dist/ghost-checkbox.d.ts +51 -0
- package/dist/ghost-collapsible.d.ts +104 -0
- package/dist/ghost-combobox.d.ts +217 -0
- package/dist/ghost-command-palette.d.ts +377 -0
- package/dist/ghost-context-menu.d.ts +226 -0
- package/dist/ghost-data-table-preset.d.ts +107 -0
- package/dist/ghost-data-table-table.d.ts +76 -0
- package/dist/ghost-data-table.d.ts +508 -0
- package/dist/ghost-date-picker.d.ts +301 -0
- package/dist/ghost-dialog.d.ts +256 -0
- package/dist/ghost-drawer.d.ts +268 -0
- package/dist/ghost-dropdown-menu.d.ts +226 -0
- package/dist/ghost-empty-state.d.ts +26 -0
- package/dist/ghost-field.d.ts +172 -0
- package/dist/ghost-file-upload-accept.d.ts +32 -0
- package/dist/ghost-file-upload-messages.d.ts +14 -0
- package/dist/ghost-file-upload.d.ts +325 -0
- package/dist/ghost-form.d.ts +273 -0
- package/dist/ghost-hover-card.d.ts +192 -0
- package/dist/ghost-inline-alert.d.ts +34 -0
- package/dist/ghost-input.d.ts +71 -0
- package/dist/ghost-interactive-surface.d.ts +41 -0
- package/dist/ghost-kbd.d.ts +39 -0
- package/dist/ghost-link.d.ts +58 -0
- package/dist/ghost-menubar.d.ts +260 -0
- package/dist/ghost-number-input.d.ts +88 -0
- package/dist/ghost-pagination.d.ts +92 -0
- package/dist/ghost-popover.d.ts +188 -0
- package/dist/ghost-portal.d.ts +21 -0
- package/dist/ghost-presence.d.ts +78 -0
- package/dist/ghost-progress.d.ts +40 -0
- package/dist/ghost-radio-group.d.ts +100 -0
- package/dist/ghost-scroll-area.d.ts +46 -0
- package/dist/ghost-scroll-spy.d.ts +150 -0
- package/dist/ghost-segmented-control.d.ts +124 -0
- package/dist/ghost-select.d.ts +188 -0
- package/dist/ghost-separator.d.ts +33 -0
- package/dist/ghost-skeleton.d.ts +14 -0
- package/dist/ghost-slider.d.ts +99 -0
- package/dist/ghost-spinner.d.ts +22 -0
- package/dist/ghost-submenu.d.ts +20 -0
- package/dist/ghost-switch.d.ts +77 -0
- package/dist/ghost-table.d.ts +62 -0
- package/dist/ghost-tabs.d.ts +154 -0
- package/dist/ghost-tags-input.d.ts +41 -0
- package/dist/ghost-textarea.d.ts +78 -0
- package/dist/ghost-toast.d.ts +219 -0
- package/dist/ghost-toggle-group.d.ts +123 -0
- package/dist/ghost-toolbar.d.ts +23 -0
- package/dist/ghost-tooltip-provider.d.ts +48 -0
- package/dist/ghost-tooltip.d.ts +190 -0
- package/dist/ghost-tree.d.ts +355 -0
- package/dist/ghost-visually-hidden.d.ts +27 -0
- package/dist/ghostvue.js +19653 -0
- package/dist/has-tabbable-descendants.d.ts +2 -0
- package/dist/index.d.ts +322 -0
- package/dist/invoke-attr-handler.d.ts +15 -0
- package/dist/is-ime-composing.d.ts +28 -0
- package/dist/manifest.json +18406 -0
- package/dist/measure-scroll-overflow.d.ts +6 -0
- package/dist/menu-item-activation.d.ts +39 -0
- package/dist/resolver.d.ts +49 -0
- package/dist/resolver.js +14 -0
- package/dist/scroll-spy-motion.d.ts +26 -0
- package/dist/sort-by-document-order.d.ts +23 -0
- package/dist/sync-calendar-focus-tab-stops.d.ts +2 -0
- package/dist/sync-segmented-control-item-order.d.ts +5 -0
- package/dist/sync-tabs-selection-tab-stops.d.ts +7 -0
- package/dist/sync-toggle-group-selection-tab-stops.d.ts +14 -0
- package/dist/track-reactive-reads.d.ts +13 -0
- package/dist/typeahead-match.d.ts +15 -0
- package/dist/use-collapsible-content-hidden.d.ts +28 -0
- package/dist/use-controllable-state.d.ts +20 -0
- package/dist/use-dismissable-layer.d.ts +48 -0
- package/dist/use-floating.d.ts +38 -0
- package/dist/use-focus-scope.d.ts +41 -0
- package/dist/use-ghost-accordion.d.ts +5 -0
- package/dist/use-ghost-avatar.d.ts +28 -0
- package/dist/use-ghost-badge.d.ts +13 -0
- package/dist/use-ghost-breadcrumb.d.ts +19 -0
- package/dist/use-ghost-button.d.ts +18 -0
- package/dist/use-ghost-calendar.d.ts +3 -0
- package/dist/use-ghost-card.d.ts +15 -0
- package/dist/use-ghost-checkbox-group.d.ts +13 -0
- package/dist/use-ghost-checkbox.d.ts +24 -0
- package/dist/use-ghost-collapsible.d.ts +8 -0
- package/dist/use-ghost-combobox.d.ts +65 -0
- package/dist/use-ghost-command-palette.d.ts +24 -0
- package/dist/use-ghost-context-menu.d.ts +14 -0
- package/dist/use-ghost-data-table.d.ts +55 -0
- package/dist/use-ghost-date-picker.d.ts +11 -0
- package/dist/use-ghost-dialog.d.ts +10 -0
- package/dist/use-ghost-drawer.d.ts +11 -0
- package/dist/use-ghost-dropdown-menu.d.ts +5 -0
- package/dist/use-ghost-empty-state.d.ts +18 -0
- package/dist/use-ghost-field-part-content.d.ts +15 -0
- package/dist/use-ghost-field.d.ts +10 -0
- package/dist/use-ghost-file-upload.d.ts +16 -0
- package/dist/use-ghost-form.d.ts +7 -0
- package/dist/use-ghost-hover-card.d.ts +8 -0
- package/dist/use-ghost-id.d.ts +6 -0
- package/dist/use-ghost-inline-alert.d.ts +20 -0
- package/dist/use-ghost-input.d.ts +29 -0
- package/dist/use-ghost-interactive-surface.d.ts +21 -0
- package/dist/use-ghost-kbd.d.ts +35 -0
- package/dist/use-ghost-link.d.ts +20 -0
- package/dist/use-ghost-menu-branch.d.ts +54 -0
- package/dist/use-ghost-menu-collection.d.ts +30 -0
- package/dist/use-ghost-menu-root.d.ts +13 -0
- package/dist/use-ghost-menubar-menu.d.ts +3 -0
- package/dist/use-ghost-menubar.d.ts +10 -0
- package/dist/use-ghost-number-input.d.ts +63 -0
- package/dist/use-ghost-pagination.d.ts +22 -0
- package/dist/use-ghost-popover.d.ts +8 -0
- package/dist/use-ghost-presence.d.ts +48 -0
- package/dist/use-ghost-progress.d.ts +33 -0
- package/dist/use-ghost-radio-group.d.ts +5 -0
- package/dist/use-ghost-scroll-area.d.ts +23 -0
- package/dist/use-ghost-scroll-spy.d.ts +25 -0
- package/dist/use-ghost-segmented-control.d.ts +6 -0
- package/dist/use-ghost-select.d.ts +62 -0
- package/dist/use-ghost-separator.d.ts +19 -0
- package/dist/use-ghost-skeleton.d.ts +19 -0
- package/dist/use-ghost-slider.d.ts +65 -0
- package/dist/use-ghost-spinner.d.ts +18 -0
- package/dist/use-ghost-switch.d.ts +39 -0
- package/dist/use-ghost-table.d.ts +70 -0
- package/dist/use-ghost-tabs.d.ts +5 -0
- package/dist/use-ghost-textarea.d.ts +44 -0
- package/dist/use-ghost-toast.d.ts +56 -0
- package/dist/use-ghost-toggle-group.d.ts +6 -0
- package/dist/use-ghost-toolbar.d.ts +23 -0
- package/dist/use-ghost-tooltip.d.ts +8 -0
- package/dist/use-ghost-tree.d.ts +14 -0
- package/dist/use-ghost-visually-hidden.d.ts +35 -0
- package/dist/use-inert-others.d.ts +20 -0
- package/dist/use-roving-focus.d.ts +22 -0
- package/dist/use-scroll-lock.d.ts +13 -0
- package/package.json +60 -4
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type { Component, ComputedRef, InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import type { DialogPartsContext } from './dialog-shared.js';
|
|
3
|
+
import type { GhostDialogContext } from './ghost-dialog.js';
|
|
4
|
+
import type { GhostPortalTarget } from './ghost-portal.js';
|
|
5
|
+
/**
|
|
6
|
+
* Viewport edge a drawer is anchored to. `start` / `end` are logical and map
|
|
7
|
+
* to physical left/right edges from the resolved writing direction.
|
|
8
|
+
*/
|
|
9
|
+
export type GhostDrawerSide = 'start' | 'end' | 'top' | 'bottom';
|
|
10
|
+
/** Writing direction used to map logical `start` / `end` sides. */
|
|
11
|
+
export type GhostDrawerDirection = 'ltr' | 'rtl';
|
|
12
|
+
/** Valid `as` targets for {@link GhostDrawerTrigger}. */
|
|
13
|
+
export type GhostDrawerTriggerElement = string | Component;
|
|
14
|
+
/** Valid `as` targets for {@link GhostDrawerOverlay}. */
|
|
15
|
+
export type GhostDrawerOverlayElement = string | Component;
|
|
16
|
+
/** Valid `as` targets for {@link GhostDrawerContent}. */
|
|
17
|
+
export type GhostDrawerContentElement = string | Component;
|
|
18
|
+
/** Valid `as` targets for {@link GhostDrawerTitle}. */
|
|
19
|
+
export type GhostDrawerTitleElement = string | Component;
|
|
20
|
+
/** Valid `as` targets for {@link GhostDrawerDescription}. */
|
|
21
|
+
export type GhostDrawerDescriptionElement = string | Component;
|
|
22
|
+
/** Valid `as` targets for {@link GhostDrawerClose}. */
|
|
23
|
+
export type GhostDrawerCloseElement = string | Component;
|
|
24
|
+
/** Supported semantic roles for {@link GhostDrawerContent}. */
|
|
25
|
+
export type GhostDrawerContentRole = 'dialog' | 'alertdialog';
|
|
26
|
+
/** Props for the {@link GhostDrawer} root provider component. */
|
|
27
|
+
export interface GhostDrawerProps {
|
|
28
|
+
/**
|
|
29
|
+
* Controlled open state. Omit to run uncontrolled from `defaultOpen`.
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
32
|
+
open?: boolean | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Initial open state when `open` is omitted.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
defaultOpen?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Enables modal behavior (trapped focus loop, scroll lock, inert background
|
|
40
|
+
* siblings, `aria-modal`, and overlay rendering).
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
modal?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Viewport edge the drawer is anchored to. `GhostDrawerContent` may override it.
|
|
46
|
+
* @default 'end'
|
|
47
|
+
*/
|
|
48
|
+
side?: GhostDrawerSide;
|
|
49
|
+
/**
|
|
50
|
+
* Explicit writing direction for mapping `start` / `end`. When omitted the
|
|
51
|
+
* direction resolves from the nearest `[dir]` ancestor of the content, then
|
|
52
|
+
* of the trigger, then `<html dir>`, falling back to `'ltr'`.
|
|
53
|
+
* @default undefined
|
|
54
|
+
*/
|
|
55
|
+
dir?: GhostDrawerDirection | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Props passed to the {@link GhostDrawer} default slot. */
|
|
58
|
+
export interface GhostDrawerSlotProps {
|
|
59
|
+
open: boolean;
|
|
60
|
+
close: () => void;
|
|
61
|
+
/** Effective side (the content override when set, otherwise the root `side`). */
|
|
62
|
+
side: GhostDrawerSide;
|
|
63
|
+
}
|
|
64
|
+
/** Props for {@link GhostDrawerTrigger}. */
|
|
65
|
+
export interface GhostDrawerTriggerProps {
|
|
66
|
+
/**
|
|
67
|
+
* Tag name or component rendered for the trigger control.
|
|
68
|
+
* @default 'button'
|
|
69
|
+
*/
|
|
70
|
+
as?: GhostDrawerTriggerElement;
|
|
71
|
+
/**
|
|
72
|
+
* Disables opening or toggling on click or keyboard activation.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** Props for {@link GhostDrawerOverlay}. */
|
|
78
|
+
export interface GhostDrawerOverlayProps {
|
|
79
|
+
/**
|
|
80
|
+
* Tag name or component rendered for the modal backdrop.
|
|
81
|
+
* @default 'div'
|
|
82
|
+
*/
|
|
83
|
+
as?: GhostDrawerOverlayElement;
|
|
84
|
+
/**
|
|
85
|
+
* Teleport overlay through {@link GhostPortal} when `true`, or render inline when `false`.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
portal?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Teleport target passed to {@link GhostPortal} when `portal` is `true`.
|
|
91
|
+
* @default 'body'
|
|
92
|
+
*/
|
|
93
|
+
portalTo?: GhostPortalTarget;
|
|
94
|
+
}
|
|
95
|
+
/** Props for {@link GhostDrawerContent}. */
|
|
96
|
+
export interface GhostDrawerContentProps {
|
|
97
|
+
/**
|
|
98
|
+
* Tag name or component rendered for the drawer surface.
|
|
99
|
+
* @default 'div'
|
|
100
|
+
*/
|
|
101
|
+
as?: GhostDrawerContentElement;
|
|
102
|
+
/**
|
|
103
|
+
* Overrides the root `side` when provided.
|
|
104
|
+
* @default undefined
|
|
105
|
+
*/
|
|
106
|
+
side?: GhostDrawerSide | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Overrides the root `dir` when provided.
|
|
109
|
+
* @default undefined
|
|
110
|
+
*/
|
|
111
|
+
dir?: GhostDrawerDirection | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Semantic ARIA role for the drawer surface. Setting `'alertdialog'` turns off
|
|
114
|
+
* outside-click dismissal by default.
|
|
115
|
+
* @default 'dialog'
|
|
116
|
+
*/
|
|
117
|
+
role?: GhostDrawerContentRole;
|
|
118
|
+
/**
|
|
119
|
+
* Dismisses the topmost open layer when pressing `Escape`.
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
122
|
+
closeOnEscape?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Dismisses the drawer on outside pointerdown (including the backdrop
|
|
125
|
+
* overlay). Defaults to `true` for `'dialog'` and `false` for `'alertdialog'`.
|
|
126
|
+
* @default undefined
|
|
127
|
+
*/
|
|
128
|
+
closeOnOutsideClick?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Teleport content through {@link GhostPortal} when `true`, or render inline when `false`.
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
133
|
+
portal?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Teleport target passed to {@link GhostPortal} when `portal` is `true`.
|
|
136
|
+
* @default 'body'
|
|
137
|
+
*/
|
|
138
|
+
portalTo?: GhostPortalTarget;
|
|
139
|
+
}
|
|
140
|
+
/** Props for {@link GhostDrawerTitle}. */
|
|
141
|
+
export interface GhostDrawerTitleProps {
|
|
142
|
+
/**
|
|
143
|
+
* Tag name or component rendered for the drawer title.
|
|
144
|
+
* @default 'h2'
|
|
145
|
+
*/
|
|
146
|
+
as?: GhostDrawerTitleElement;
|
|
147
|
+
}
|
|
148
|
+
/** Props for {@link GhostDrawerDescription}. */
|
|
149
|
+
export interface GhostDrawerDescriptionProps {
|
|
150
|
+
/**
|
|
151
|
+
* Tag name or component rendered for the drawer description.
|
|
152
|
+
* @default 'p'
|
|
153
|
+
*/
|
|
154
|
+
as?: GhostDrawerDescriptionElement;
|
|
155
|
+
}
|
|
156
|
+
/** Props for {@link GhostDrawerClose}. */
|
|
157
|
+
export interface GhostDrawerCloseProps {
|
|
158
|
+
/**
|
|
159
|
+
* Tag name or component rendered for the close control.
|
|
160
|
+
* @default 'button'
|
|
161
|
+
*/
|
|
162
|
+
as?: GhostDrawerCloseElement;
|
|
163
|
+
/**
|
|
164
|
+
* Disables closing on click or keyboard activation.
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
disabled?: boolean;
|
|
168
|
+
}
|
|
169
|
+
/** Methods and state exposed by a template ref to {@link GhostDrawerTrigger}. */
|
|
170
|
+
export interface GhostDrawerTriggerExposed {
|
|
171
|
+
readonly element: HTMLElement | null;
|
|
172
|
+
focus(options?: FocusOptions): void;
|
|
173
|
+
blur(): void;
|
|
174
|
+
}
|
|
175
|
+
/** Methods and state exposed by a template ref to {@link GhostDrawerOverlay}. */
|
|
176
|
+
export interface GhostDrawerOverlayExposed {
|
|
177
|
+
readonly element: HTMLElement | null;
|
|
178
|
+
focus(options?: FocusOptions): void;
|
|
179
|
+
blur(): void;
|
|
180
|
+
}
|
|
181
|
+
/** Methods and state exposed by a template ref to {@link GhostDrawerContent}. */
|
|
182
|
+
export interface GhostDrawerContentExposed {
|
|
183
|
+
readonly element: HTMLElement | null;
|
|
184
|
+
focus(options?: FocusOptions): void;
|
|
185
|
+
blur(): void;
|
|
186
|
+
}
|
|
187
|
+
/** Methods and state exposed by a template ref to {@link GhostDrawerTitle}. */
|
|
188
|
+
export interface GhostDrawerTitleExposed {
|
|
189
|
+
readonly element: HTMLElement | null;
|
|
190
|
+
focus(options?: FocusOptions): void;
|
|
191
|
+
blur(): void;
|
|
192
|
+
}
|
|
193
|
+
/** Methods and state exposed by a template ref to {@link GhostDrawerDescription}. */
|
|
194
|
+
export interface GhostDrawerDescriptionExposed {
|
|
195
|
+
readonly element: HTMLElement | null;
|
|
196
|
+
focus(options?: FocusOptions): void;
|
|
197
|
+
blur(): void;
|
|
198
|
+
}
|
|
199
|
+
/** Methods and state exposed by a template ref to {@link GhostDrawerClose}. */
|
|
200
|
+
export interface GhostDrawerCloseExposed {
|
|
201
|
+
readonly element: HTMLElement | null;
|
|
202
|
+
focus(options?: FocusOptions): void;
|
|
203
|
+
blur(): void;
|
|
204
|
+
}
|
|
205
|
+
/** Options for {@link useGhostDrawer}. */
|
|
206
|
+
export interface UseGhostDrawerOptions {
|
|
207
|
+
open?: MaybeRefOrGetter<boolean | undefined>;
|
|
208
|
+
defaultOpen?: MaybeRefOrGetter<boolean | undefined>;
|
|
209
|
+
modal?: MaybeRefOrGetter<boolean | undefined>;
|
|
210
|
+
/** Viewport edge; defaults to `'end'`. */
|
|
211
|
+
side?: MaybeRefOrGetter<GhostDrawerSide | undefined>;
|
|
212
|
+
/** Explicit writing direction; `undefined` defers to DOM resolution. */
|
|
213
|
+
dir?: MaybeRefOrGetter<GhostDrawerDirection | undefined>;
|
|
214
|
+
onOpenChange?: (open: boolean) => void;
|
|
215
|
+
}
|
|
216
|
+
/** Reactive state and helpers returned by {@link useGhostDrawer}. */
|
|
217
|
+
export interface UseGhostDrawerReturn {
|
|
218
|
+
isOpen: Ref<boolean>;
|
|
219
|
+
isModal: ComputedRef<boolean>;
|
|
220
|
+
side: ComputedRef<GhostDrawerSide>;
|
|
221
|
+
dir: ComputedRef<GhostDrawerDirection | undefined>;
|
|
222
|
+
open: () => void;
|
|
223
|
+
close: () => void;
|
|
224
|
+
toggle: () => void;
|
|
225
|
+
triggerId: ComputedRef<string>;
|
|
226
|
+
contentId: ComputedRef<string>;
|
|
227
|
+
titleId: ComputedRef<string>;
|
|
228
|
+
descriptionId: ComputedRef<string>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Internal context shared between `GhostDrawer` parts. Extends the dialog part
|
|
232
|
+
* context with placement state.
|
|
233
|
+
*/
|
|
234
|
+
export interface GhostDrawerContext extends GhostDialogContext {
|
|
235
|
+
/** Effective side: the content override when set, otherwise the root `side`. */
|
|
236
|
+
side: ComputedRef<GhostDrawerSide>;
|
|
237
|
+
/** Root explicit direction, if any. */
|
|
238
|
+
dir: ComputedRef<GhostDrawerDirection | undefined>;
|
|
239
|
+
setContentSide: (side: GhostDrawerSide | null) => void;
|
|
240
|
+
}
|
|
241
|
+
export type GhostDrawerInternalContext = GhostDrawerContext & DialogPartsContext;
|
|
242
|
+
export declare const ghostDrawerContextKey: InjectionKey<GhostDrawerInternalContext>;
|
|
243
|
+
/** Inputs for {@link resolveDrawerDir}. */
|
|
244
|
+
export interface ResolveDrawerDirOptions {
|
|
245
|
+
/** Explicit direction from `GhostDrawerContent` or `GhostDrawer`. */
|
|
246
|
+
dir?: GhostDrawerDirection | undefined;
|
|
247
|
+
/** Mounted drawer surface (its own `dir` attribute is ignored). */
|
|
248
|
+
contentElement?: Element | null;
|
|
249
|
+
/** Trigger element, used when the content has no `[dir]` ancestor (portaled). */
|
|
250
|
+
triggerElement?: Element | null;
|
|
251
|
+
/**
|
|
252
|
+
* Document root. Defaults to `document.documentElement` in the browser and
|
|
253
|
+
* `null` during SSR.
|
|
254
|
+
*/
|
|
255
|
+
documentElement?: Element | null;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Resolves the effective writing direction for a drawer, SSR-safe.
|
|
259
|
+
*
|
|
260
|
+
* Priority: explicit `dir` → nearest `[dir]` ancestor of the content → nearest
|
|
261
|
+
* `[dir]` ancestor (or self) of the trigger → `<html dir>` → `'ltr'`.
|
|
262
|
+
*
|
|
263
|
+
* The document root is deliberately skipped in the ancestor walks: a drawer
|
|
264
|
+
* portaled to `<body>` would otherwise always resolve to `<html dir>` and never
|
|
265
|
+
* see a localized `<div dir="rtl">` wrapping its trigger. `dir="auto"` and
|
|
266
|
+
* other values are ignored so resolution falls through to the next source.
|
|
267
|
+
*/
|
|
268
|
+
export declare function resolveDrawerDir(options?: ResolveDrawerDirOptions): GhostDrawerDirection;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { Placement, Strategy } from '@floating-ui/dom';
|
|
2
|
+
import type { Component, ComputedRef, InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
import type { GhostPortalTarget } from './ghost-portal.js';
|
|
4
|
+
/** Valid `as` targets for {@link GhostDropdownMenuTrigger}. */
|
|
5
|
+
export type GhostDropdownMenuTriggerElement = string | Component;
|
|
6
|
+
/** Valid `as` targets for {@link GhostDropdownMenuContent}. */
|
|
7
|
+
export type GhostDropdownMenuContentElement = string | Component;
|
|
8
|
+
/** Valid `as` targets for {@link GhostDropdownMenuItem}. */
|
|
9
|
+
export type GhostDropdownMenuItemElement = string | Component;
|
|
10
|
+
/** Valid `as` targets for {@link GhostDropdownMenuGroup}. */
|
|
11
|
+
export type GhostDropdownMenuGroupElement = string | Component;
|
|
12
|
+
/** Valid `as` targets for {@link GhostDropdownMenuLabel}. */
|
|
13
|
+
export type GhostDropdownMenuLabelElement = string | Component;
|
|
14
|
+
/** Valid `as` targets for {@link GhostDropdownMenuSeparator}. */
|
|
15
|
+
export type GhostDropdownMenuSeparatorElement = string | Component;
|
|
16
|
+
/** Valid `as` targets for {@link GhostDropdownMenuCheckboxItem}. */
|
|
17
|
+
export type GhostDropdownMenuCheckboxItemElement = string | Component;
|
|
18
|
+
/** Valid `as` targets for {@link GhostDropdownMenuRadioGroup}. */
|
|
19
|
+
export type GhostDropdownMenuRadioGroupElement = string | Component;
|
|
20
|
+
/** Valid `as` targets for {@link GhostDropdownMenuRadioItem}. */
|
|
21
|
+
export type GhostDropdownMenuRadioItemElement = string | Component;
|
|
22
|
+
/** Supported floating placements relative to the trigger anchor. */
|
|
23
|
+
export type GhostDropdownMenuPlacement = Placement;
|
|
24
|
+
/** Supported CSS positioning strategies for floating content. */
|
|
25
|
+
export type GhostDropdownMenuStrategy = Strategy;
|
|
26
|
+
/** Viewport/boundary padding accepted by flip and shift options. */
|
|
27
|
+
export type GhostDropdownMenuPadding = number | {
|
|
28
|
+
top?: number;
|
|
29
|
+
right?: number;
|
|
30
|
+
bottom?: number;
|
|
31
|
+
left?: number;
|
|
32
|
+
};
|
|
33
|
+
/** Distance or axis offsets between trigger and menu content. */
|
|
34
|
+
export type GhostDropdownMenuOffsetOptions = number | {
|
|
35
|
+
mainAxis?: number;
|
|
36
|
+
crossAxis?: number;
|
|
37
|
+
alignmentAxis?: number | null;
|
|
38
|
+
};
|
|
39
|
+
/** Collision flip options for {@link GhostDropdownMenuContent}. */
|
|
40
|
+
export interface GhostDropdownMenuFlipOptions {
|
|
41
|
+
mainAxis?: boolean;
|
|
42
|
+
crossAxis?: boolean;
|
|
43
|
+
fallbackPlacements?: GhostDropdownMenuPlacement[];
|
|
44
|
+
padding?: GhostDropdownMenuPadding;
|
|
45
|
+
boundary?: Element | Element[];
|
|
46
|
+
}
|
|
47
|
+
/** Collision shift options for {@link GhostDropdownMenuContent}. */
|
|
48
|
+
export interface GhostDropdownMenuShiftOptions {
|
|
49
|
+
mainAxis?: boolean;
|
|
50
|
+
crossAxis?: boolean;
|
|
51
|
+
padding?: GhostDropdownMenuPadding;
|
|
52
|
+
boundary?: Element | Element[];
|
|
53
|
+
}
|
|
54
|
+
/** Props for the {@link GhostDropdownMenu} root provider component. */
|
|
55
|
+
export interface GhostDropdownMenuProps {
|
|
56
|
+
/**
|
|
57
|
+
* Controlled open state. Omit to run uncontrolled from `defaultOpen`.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
open?: boolean | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Initial open state when `open` is omitted.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
defaultOpen?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Props passed to the {@link GhostDropdownMenu} default slot. */
|
|
68
|
+
export interface GhostDropdownMenuSlotProps {
|
|
69
|
+
open: boolean;
|
|
70
|
+
close: () => void;
|
|
71
|
+
}
|
|
72
|
+
/** Props for {@link GhostDropdownMenuTrigger}. */
|
|
73
|
+
export interface GhostDropdownMenuTriggerProps {
|
|
74
|
+
/**
|
|
75
|
+
* Tag name or component rendered for the trigger control.
|
|
76
|
+
* @default 'button'
|
|
77
|
+
*/
|
|
78
|
+
as?: GhostDropdownMenuTriggerElement;
|
|
79
|
+
/**
|
|
80
|
+
* Disables toggling on click or keyboard activation.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
disabled?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** Props for {@link GhostDropdownMenuContent}. */
|
|
86
|
+
export interface GhostDropdownMenuContentProps {
|
|
87
|
+
/**
|
|
88
|
+
* Tag name or component rendered for the menu surface.
|
|
89
|
+
* @default 'div'
|
|
90
|
+
*/
|
|
91
|
+
as?: GhostDropdownMenuContentElement;
|
|
92
|
+
/** Preferred placement relative to the trigger. */
|
|
93
|
+
placement?: GhostDropdownMenuPlacement;
|
|
94
|
+
offset?: GhostDropdownMenuOffsetOptions | boolean | undefined;
|
|
95
|
+
flip?: boolean | GhostDropdownMenuFlipOptions;
|
|
96
|
+
shift?: boolean | GhostDropdownMenuShiftOptions;
|
|
97
|
+
strategy?: GhostDropdownMenuStrategy;
|
|
98
|
+
portal?: boolean;
|
|
99
|
+
portalTo?: GhostPortalTarget;
|
|
100
|
+
}
|
|
101
|
+
/** Props for {@link GhostDropdownMenuItem}. */
|
|
102
|
+
export interface GhostDropdownMenuItemProps {
|
|
103
|
+
as?: GhostDropdownMenuItemElement;
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/** Props for {@link GhostDropdownMenuGroup}. */
|
|
107
|
+
export interface GhostDropdownMenuGroupProps {
|
|
108
|
+
as?: GhostDropdownMenuGroupElement;
|
|
109
|
+
}
|
|
110
|
+
/** Props for {@link GhostDropdownMenuLabel}. */
|
|
111
|
+
export interface GhostDropdownMenuLabelProps {
|
|
112
|
+
as?: GhostDropdownMenuLabelElement;
|
|
113
|
+
}
|
|
114
|
+
/** Props for {@link GhostDropdownMenuSeparator}. */
|
|
115
|
+
export interface GhostDropdownMenuSeparatorProps {
|
|
116
|
+
as?: GhostDropdownMenuSeparatorElement;
|
|
117
|
+
decorative?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/** Props for {@link GhostDropdownMenuCheckboxItem}. */
|
|
120
|
+
export interface GhostDropdownMenuCheckboxItemProps {
|
|
121
|
+
as?: GhostDropdownMenuCheckboxItemElement;
|
|
122
|
+
checked?: boolean | undefined;
|
|
123
|
+
defaultChecked?: boolean;
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Props for {@link GhostDropdownMenuRadioGroup}. */
|
|
127
|
+
export interface GhostDropdownMenuRadioGroupProps {
|
|
128
|
+
as?: GhostDropdownMenuRadioGroupElement;
|
|
129
|
+
modelValue?: string | undefined;
|
|
130
|
+
defaultValue?: string | undefined;
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/** Props for {@link GhostDropdownMenuRadioItem}. */
|
|
134
|
+
export interface GhostDropdownMenuRadioItemProps {
|
|
135
|
+
as?: GhostDropdownMenuRadioItemElement;
|
|
136
|
+
value: string;
|
|
137
|
+
disabled?: boolean;
|
|
138
|
+
}
|
|
139
|
+
/** Methods and state exposed by a template ref to {@link GhostDropdownMenuTrigger}. */
|
|
140
|
+
export interface GhostDropdownMenuTriggerExposed {
|
|
141
|
+
readonly element: HTMLElement | null;
|
|
142
|
+
focus(options?: FocusOptions): void;
|
|
143
|
+
blur(): void;
|
|
144
|
+
}
|
|
145
|
+
/** Methods and state exposed by a template ref to {@link GhostDropdownMenuContent}. */
|
|
146
|
+
export interface GhostDropdownMenuContentExposed {
|
|
147
|
+
readonly element: HTMLElement | null;
|
|
148
|
+
focus(options?: FocusOptions): void;
|
|
149
|
+
blur(): void;
|
|
150
|
+
}
|
|
151
|
+
/** Methods and state exposed by a template ref to {@link GhostDropdownMenuItem}. */
|
|
152
|
+
export interface GhostDropdownMenuItemExposed {
|
|
153
|
+
readonly element: HTMLElement | null;
|
|
154
|
+
focus(options?: FocusOptions): void;
|
|
155
|
+
blur(): void;
|
|
156
|
+
}
|
|
157
|
+
/** Methods and state exposed by a template ref to {@link GhostDropdownMenuCheckboxItem}. */
|
|
158
|
+
export interface GhostDropdownMenuCheckboxItemExposed {
|
|
159
|
+
readonly element: HTMLElement | null;
|
|
160
|
+
focus(options?: FocusOptions): void;
|
|
161
|
+
blur(): void;
|
|
162
|
+
}
|
|
163
|
+
/** Methods and state exposed by a template ref to {@link GhostDropdownMenuRadioItem}. */
|
|
164
|
+
export interface GhostDropdownMenuRadioItemExposed {
|
|
165
|
+
readonly element: HTMLElement | null;
|
|
166
|
+
focus(options?: FocusOptions): void;
|
|
167
|
+
blur(): void;
|
|
168
|
+
}
|
|
169
|
+
/** Options for {@link useGhostDropdownMenu}. */
|
|
170
|
+
export interface UseGhostDropdownMenuOptions {
|
|
171
|
+
open?: MaybeRefOrGetter<boolean | undefined>;
|
|
172
|
+
defaultOpen?: MaybeRefOrGetter<boolean | undefined>;
|
|
173
|
+
onOpenChange?: (open: boolean) => void;
|
|
174
|
+
/**
|
|
175
|
+
* Prefix for SSR-safe part IDs (`{namespace}-trigger`, `{namespace}-content`).
|
|
176
|
+
* @default 'ghost-dropdown-menu'
|
|
177
|
+
*/
|
|
178
|
+
idNamespace?: string;
|
|
179
|
+
}
|
|
180
|
+
/** Reactive state and helpers returned by {@link useGhostDropdownMenu}. */
|
|
181
|
+
export interface UseGhostDropdownMenuReturn {
|
|
182
|
+
isOpen: Ref<boolean>;
|
|
183
|
+
open: () => void;
|
|
184
|
+
close: () => void;
|
|
185
|
+
toggle: () => void;
|
|
186
|
+
triggerId: ComputedRef<string>;
|
|
187
|
+
contentId: ComputedRef<string>;
|
|
188
|
+
}
|
|
189
|
+
/** Internal context shared between dropdown menu parts. */
|
|
190
|
+
export interface GhostDropdownMenuContext {
|
|
191
|
+
isOpen: Ref<boolean>;
|
|
192
|
+
open: () => void;
|
|
193
|
+
close: () => void;
|
|
194
|
+
toggle: () => void;
|
|
195
|
+
defaultTriggerId: ComputedRef<string>;
|
|
196
|
+
defaultContentId: ComputedRef<string>;
|
|
197
|
+
triggerId: ComputedRef<string>;
|
|
198
|
+
contentId: ComputedRef<string>;
|
|
199
|
+
triggerRegistered: Ref<boolean>;
|
|
200
|
+
triggerElement: Ref<HTMLElement | null>;
|
|
201
|
+
focusLastOnOpen: Ref<boolean>;
|
|
202
|
+
setFocusLastOnOpen: (value: boolean) => void;
|
|
203
|
+
setTriggerElement: (element: HTMLElement | null) => void;
|
|
204
|
+
setTriggerId: (id: string | null) => void;
|
|
205
|
+
setTriggerRegistered: (registered: boolean) => void;
|
|
206
|
+
setContentId: (id: string | null) => void;
|
|
207
|
+
}
|
|
208
|
+
export interface GhostDropdownMenuInternalContext extends GhostDropdownMenuContext {
|
|
209
|
+
openedAtMount: Ref<boolean>;
|
|
210
|
+
}
|
|
211
|
+
export declare const ghostDropdownMenuContextKey: InjectionKey<GhostDropdownMenuInternalContext>;
|
|
212
|
+
/** Radio group context scoped to a menu (items use `menuitemradio`, not native inputs). */
|
|
213
|
+
export interface GhostDropdownMenuRadioGroupContext {
|
|
214
|
+
readonly selectedValue: Ref<string | undefined>;
|
|
215
|
+
disabled: ComputedRef<boolean>;
|
|
216
|
+
select: (value: string) => void;
|
|
217
|
+
isSelected: (value: string) => boolean;
|
|
218
|
+
isItemDisabled: (value: string) => boolean;
|
|
219
|
+
}
|
|
220
|
+
export declare const ghostDropdownMenuRadioGroupContextKey: InjectionKey<GhostDropdownMenuRadioGroupContext>;
|
|
221
|
+
/**
|
|
222
|
+
* Resolves a DOM element from either a raw element or a component ref
|
|
223
|
+
* (preferring exposed `.element` over `.$el` so wrappers with a `display:
|
|
224
|
+
* contents` scope resolve to their inner control).
|
|
225
|
+
*/
|
|
226
|
+
export declare function resolveDropdownMenuHtmlElement(target: unknown): HTMLElement | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/** Root element for GhostEmptyState. */
|
|
3
|
+
export type GhostEmptyStateElement = 'div' | 'section';
|
|
4
|
+
/** Native heading level for the title slot. */
|
|
5
|
+
export type GhostEmptyStateHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
/** Declared props on the unstyled GhostEmptyState SFC. */
|
|
7
|
+
export interface GhostEmptyStateProps {
|
|
8
|
+
/** Root element. Prefer `div` inside table cells. */
|
|
9
|
+
as?: GhostEmptyStateElement;
|
|
10
|
+
/** Heading level wrapping the `title` slot. */
|
|
11
|
+
headingLevel?: GhostEmptyStateHeadingLevel;
|
|
12
|
+
}
|
|
13
|
+
/** Options for {@link useGhostEmptyState}. */
|
|
14
|
+
export interface UseGhostEmptyStateOptions {
|
|
15
|
+
as?: MaybeRefOrGetter<GhostEmptyStateElement | undefined>;
|
|
16
|
+
headingLevel?: MaybeRefOrGetter<GhostEmptyStateHeadingLevel | undefined>;
|
|
17
|
+
/** Whether the title slot is rendered. */
|
|
18
|
+
hasTitle?: MaybeRefOrGetter<boolean>;
|
|
19
|
+
/** Generated or overridden title id for aria-labelledby. */
|
|
20
|
+
titleId?: MaybeRefOrGetter<string>;
|
|
21
|
+
}
|
|
22
|
+
/** Template ref contract for GhostEmptyState. */
|
|
23
|
+
export interface GhostEmptyStateExposed {
|
|
24
|
+
/** Root element after mount; null before mount. */
|
|
25
|
+
readonly element: HTMLElement | null;
|
|
26
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { type Component, type ComputedRef, type InjectionKey, type Ref, type VNode } from 'vue';
|
|
2
|
+
/** Valid `as` targets for {@link GhostFieldLabel}. */
|
|
3
|
+
export type GhostFieldLabelElement = string | Component;
|
|
4
|
+
/** Valid `as` targets for {@link GhostFieldDescription}. */
|
|
5
|
+
export type GhostFieldDescriptionElement = string | Component;
|
|
6
|
+
/** Valid `as` targets for {@link GhostFieldError}. */
|
|
7
|
+
export type GhostFieldErrorElement = string | Component;
|
|
8
|
+
/** How {@link GhostFieldLabel} associates with the control. */
|
|
9
|
+
export type GhostFieldLabelAssociate = 'reference' | 'wrap';
|
|
10
|
+
/** Props for the {@link GhostField} root provider. */
|
|
11
|
+
export interface GhostFieldProps {
|
|
12
|
+
/**
|
|
13
|
+
* Optional control id override. When omitted, {@link useGhostId} generates one.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Canonical dot-path key associating this field with an ancestor `GhostForm`
|
|
18
|
+
* or `useGhostForm` context.
|
|
19
|
+
*/
|
|
20
|
+
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Propagates disabled semantics to the control through {@link GhostFieldControl}.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Propagates invalid semantics to the control and sets root `data-state`.
|
|
28
|
+
* Explicit boolean values override ancestor form state; defaults to form
|
|
29
|
+
* field invalidity when named inside `GhostForm`, else `false`.
|
|
30
|
+
*/
|
|
31
|
+
invalid?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Propagates required semantics to the control.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
required?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Scoped slot props from {@link GhostField}. */
|
|
39
|
+
export interface GhostFieldSlotProps {
|
|
40
|
+
invalid: boolean;
|
|
41
|
+
error: string | undefined;
|
|
42
|
+
errors: readonly string[];
|
|
43
|
+
touched: boolean;
|
|
44
|
+
dirty: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Scoped slot props from {@link GhostFieldError}. */
|
|
47
|
+
export interface GhostFieldErrorSlotProps {
|
|
48
|
+
message: string | undefined;
|
|
49
|
+
errors: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/** Props for {@link GhostFieldLabel}. */
|
|
52
|
+
export interface GhostFieldLabelProps {
|
|
53
|
+
/**
|
|
54
|
+
* Tag name or component rendered for the label.
|
|
55
|
+
* @default 'label'
|
|
56
|
+
*/
|
|
57
|
+
as?: GhostFieldLabelElement;
|
|
58
|
+
/**
|
|
59
|
+
* `reference` uses `for` with the control id. `wrap` omits `for` for nested controls.
|
|
60
|
+
* @default 'reference'
|
|
61
|
+
*/
|
|
62
|
+
associate?: GhostFieldLabelAssociate;
|
|
63
|
+
/**
|
|
64
|
+
* Shows the required marker when the root or this prop marks the field required.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
required?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Renders the visual required marker when required.
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
showRequired?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Props for {@link GhostFieldDescription}. */
|
|
75
|
+
export interface GhostFieldDescriptionProps {
|
|
76
|
+
/**
|
|
77
|
+
* Tag name or component rendered for the hint.
|
|
78
|
+
* @default 'p'
|
|
79
|
+
*/
|
|
80
|
+
as?: GhostFieldDescriptionElement;
|
|
81
|
+
}
|
|
82
|
+
/** Props for {@link GhostFieldError}. */
|
|
83
|
+
export interface GhostFieldErrorProps {
|
|
84
|
+
/**
|
|
85
|
+
* Tag name or component rendered for the error.
|
|
86
|
+
* @default 'span'
|
|
87
|
+
*/
|
|
88
|
+
as?: GhostFieldErrorElement;
|
|
89
|
+
}
|
|
90
|
+
/** Scoped slot props from {@link GhostFieldControl}. */
|
|
91
|
+
export interface GhostFieldControlSlotProps {
|
|
92
|
+
id: string;
|
|
93
|
+
disabled: boolean;
|
|
94
|
+
invalid: boolean;
|
|
95
|
+
required: boolean;
|
|
96
|
+
'aria-describedby'?: string;
|
|
97
|
+
'aria-invalid'?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** Props for {@link GhostFieldControl} (no declared props; slot props carry the contract). */
|
|
100
|
+
export type GhostFieldControlProps = Record<string, never>;
|
|
101
|
+
/** Methods and state exposed by {@link GhostField}. */
|
|
102
|
+
export interface GhostFieldExposed {
|
|
103
|
+
readonly element: HTMLElement | null;
|
|
104
|
+
}
|
|
105
|
+
/** Methods and state exposed by {@link GhostFieldLabel}. */
|
|
106
|
+
export interface GhostFieldLabelExposed {
|
|
107
|
+
readonly element: HTMLElement | null;
|
|
108
|
+
focus(options?: FocusOptions): void;
|
|
109
|
+
blur(): void;
|
|
110
|
+
}
|
|
111
|
+
/** Methods and state exposed by {@link GhostFieldDescription}. */
|
|
112
|
+
export interface GhostFieldDescriptionExposed {
|
|
113
|
+
readonly element: HTMLElement | null;
|
|
114
|
+
focus(options?: FocusOptions): void;
|
|
115
|
+
blur(): void;
|
|
116
|
+
}
|
|
117
|
+
/** Methods and state exposed by {@link GhostFieldError}. */
|
|
118
|
+
export interface GhostFieldErrorExposed {
|
|
119
|
+
readonly element: HTMLElement | null;
|
|
120
|
+
focus(options?: FocusOptions): void;
|
|
121
|
+
blur(): void;
|
|
122
|
+
}
|
|
123
|
+
/** Methods and state exposed by {@link GhostFieldControl}. */
|
|
124
|
+
export interface GhostFieldControlExposed {
|
|
125
|
+
readonly element: HTMLElement | null;
|
|
126
|
+
}
|
|
127
|
+
/** Options for {@link useGhostField}. */
|
|
128
|
+
export interface UseGhostFieldOptions {
|
|
129
|
+
id?: () => string | undefined;
|
|
130
|
+
disabled?: () => boolean | undefined;
|
|
131
|
+
invalid?: () => boolean | undefined;
|
|
132
|
+
required?: () => boolean | undefined;
|
|
133
|
+
}
|
|
134
|
+
/** Reactive ids and state returned by {@link useGhostField}. */
|
|
135
|
+
export interface UseGhostFieldReturn {
|
|
136
|
+
controlId: ComputedRef<string>;
|
|
137
|
+
labelId: ComputedRef<string>;
|
|
138
|
+
descriptionId: ComputedRef<string>;
|
|
139
|
+
errorId: ComputedRef<string>;
|
|
140
|
+
disabled: ComputedRef<boolean>;
|
|
141
|
+
invalid: ComputedRef<boolean>;
|
|
142
|
+
required: ComputedRef<boolean>;
|
|
143
|
+
}
|
|
144
|
+
/** Shared context between `GhostField` parts. */
|
|
145
|
+
export interface GhostFieldContext {
|
|
146
|
+
controlId: ComputedRef<string>;
|
|
147
|
+
labelId: ComputedRef<string>;
|
|
148
|
+
defaultDescriptionId: ComputedRef<string>;
|
|
149
|
+
descriptionId: ComputedRef<string>;
|
|
150
|
+
defaultErrorId: ComputedRef<string>;
|
|
151
|
+
errorId: ComputedRef<string>;
|
|
152
|
+
disabled: ComputedRef<boolean>;
|
|
153
|
+
invalid: ComputedRef<boolean>;
|
|
154
|
+
required: ComputedRef<boolean>;
|
|
155
|
+
descriptionRegistered: Ref<boolean>;
|
|
156
|
+
errorRegistered: Ref<boolean>;
|
|
157
|
+
errorVisible: Ref<boolean>;
|
|
158
|
+
ariaDescribedBy: ComputedRef<string | undefined>;
|
|
159
|
+
errorMessage?: ComputedRef<string | undefined>;
|
|
160
|
+
fieldErrors?: ComputedRef<readonly string[]>;
|
|
161
|
+
setDescriptionId(id: string | null): void;
|
|
162
|
+
setErrorId(id: string | null): void;
|
|
163
|
+
setDescriptionRegistered(registered: boolean): void;
|
|
164
|
+
setErrorRegistered(registered: boolean): void;
|
|
165
|
+
setErrorVisible(visible: boolean): void;
|
|
166
|
+
}
|
|
167
|
+
export type GhostFieldInternalContext = GhostFieldContext;
|
|
168
|
+
export declare const ghostFieldContextKey: InjectionKey<GhostFieldInternalContext>;
|
|
169
|
+
/** Resolve the mounted HTMLElement for template refs on field parts. */
|
|
170
|
+
export declare function resolveFieldHtmlElement(target: unknown): HTMLElement | null;
|
|
171
|
+
/** Whether a default slot renders visible text or element content. */
|
|
172
|
+
export declare function vnodeListHasContent(nodes: VNode[]): boolean;
|