@aleph-alpha/ui-library 1.8.0 → 1.10.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/README.md +14 -0
- package/dist/mcp/cli.js +21588 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/scripts/generate-component-meta.js +236 -0
- package/dist/mcp/server.js +21456 -0
- package/dist/system/index-CkH7HQaa.js +7 -0
- package/dist/system/index-CuHwEAQ_.js +7 -0
- package/dist/system/index.d.ts +1269 -540
- package/dist/system/lib.js +9001 -7237
- package/mcp/components-meta.json +1172 -0
- package/package.json +15 -5
- package/src/@types/shims-vue.d.ts +5 -0
- package/src/__tests__/placeholder.test.ts +7 -0
- package/src/compositions/UiCompositionPlaceholder/UiCompositionPlaceholder.vue +9 -0
- package/src/compositions/UiCompositionPlaceholder/index.ts +1 -0
- package/src/compositions/UiCompositionPlaceholder/types.ts +8 -0
- package/src/compositions/UiDataTable/UiDataTable.mock.ts +104 -0
- package/src/compositions/UiDataTable/UiDataTable.stories.ts +1575 -0
- package/src/compositions/UiDataTable/UiDataTable.vue +129 -0
- package/src/compositions/UiDataTable/UiDataTableColumnHeader.vue +97 -0
- package/src/compositions/UiDataTable/UiDataTablePagination.vue +147 -0
- package/src/compositions/UiDataTable/UiDataTableToolbar.vue +85 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTable.test.ts +372 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTableColumnHeader.test.ts +217 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTablePagination.test.ts +274 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTableToolbar.test.ts +198 -0
- package/src/compositions/UiDataTable/constants.ts +77 -0
- package/src/compositions/UiDataTable/index.ts +6 -0
- package/src/compositions/UiDataTable/types.ts +39 -0
- package/src/compositions/UiDatePicker/UiDatePicker.stories.ts +976 -0
- package/src/compositions/UiDatePicker/UiDatePicker.vue +193 -0
- package/src/compositions/UiDatePicker/__tests__/UiDatePicker.test.ts +325 -0
- package/src/compositions/UiDatePicker/index.ts +14 -0
- package/src/compositions/UiDatePicker/types.ts +220 -0
- package/src/compositions/index.ts +8 -0
- package/src/foundations/UiPlaceholder/UiPlaceholder.vue +9 -0
- package/src/foundations/UiPlaceholder/index.ts +1 -0
- package/src/foundations/UiPlaceholder/types.ts +8 -0
- package/src/foundations/index.ts +6 -0
- package/src/index.ts +27 -0
- package/src/lib/utils.ts +6 -0
- package/src/primitives/UiAccordion/UiAccordion.stories.ts +476 -0
- package/src/primitives/UiAccordion/UiAccordion.vue +31 -0
- package/src/primitives/UiAccordion/UiAccordionContent.vue +16 -0
- package/src/primitives/UiAccordion/UiAccordionItem.vue +16 -0
- package/src/primitives/UiAccordion/UiAccordionTrigger.vue +23 -0
- package/src/primitives/UiAccordion/__tests__/UiAccordion.test.ts +198 -0
- package/src/primitives/UiAccordion/index.ts +6 -0
- package/src/primitives/UiAccordion/types.ts +95 -0
- package/src/primitives/UiAlert/UiAlert.stories.ts +199 -0
- package/src/primitives/UiAlert/UiAlert.vue +27 -0
- package/src/primitives/UiAlert/UiAlertDescription.vue +13 -0
- package/src/primitives/UiAlert/UiAlertTitle.vue +13 -0
- package/src/primitives/UiAlert/__tests__/UiAlert.test.ts +20 -0
- package/src/primitives/UiAlert/constants.ts +3 -0
- package/src/primitives/UiAlert/index.ts +5 -0
- package/src/primitives/UiAlert/types.ts +14 -0
- package/src/primitives/UiAlertDialog/UiAlertDialog.stories.ts +186 -0
- package/src/primitives/UiAlertDialog/UiAlertDialog.vue +18 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogAction.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogCancel.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogContent.vue +26 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogDescription.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogFooter.vue +13 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogHeader.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogTitle.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogTrigger.vue +17 -0
- package/src/primitives/UiAlertDialog/__tests__/UiAlertDialog.test.ts +184 -0
- package/src/primitives/UiAlertDialog/index.ts +9 -0
- package/src/primitives/UiAlertDialog/types.ts +83 -0
- package/src/primitives/UiAvatar/UiAvatar.stories.ts +194 -0
- package/src/primitives/UiAvatar/UiAvatar.vue +13 -0
- package/src/primitives/UiAvatar/UiAvatarFallback.vue +13 -0
- package/src/primitives/UiAvatar/UiAvatarImage.vue +14 -0
- package/src/primitives/UiAvatar/__tests__/UiAvatar.test.ts +36 -0
- package/src/primitives/UiAvatar/index.ts +3 -0
- package/src/primitives/UiAvatar/types.ts +17 -0
- package/src/primitives/UiBadge/UiBadge.stories.ts +373 -0
- package/src/primitives/UiBadge/UiBadge.vue +21 -0
- package/src/primitives/UiBadge/__tests__/UiBadge.test.ts +44 -0
- package/src/primitives/UiBadge/constants.ts +3 -0
- package/src/primitives/UiBadge/index.ts +2 -0
- package/src/primitives/UiBadge/types.ts +48 -0
- package/src/primitives/UiButton/UiButton.stories.ts +537 -0
- package/src/primitives/UiButton/UiButton.vue +72 -0
- package/src/primitives/UiButton/__tests__/UiButton.test.ts +133 -0
- package/src/primitives/UiButton/index.ts +2 -0
- package/src/primitives/UiButton/types.ts +87 -0
- package/src/primitives/UiCalendar/UiCalendar.stories.ts +797 -0
- package/src/primitives/UiCalendar/UiCalendar.vue +67 -0
- package/src/primitives/UiCalendar/__tests__/UiCalendar.test.ts +45 -0
- package/src/primitives/UiCalendar/index.ts +15 -0
- package/src/primitives/UiCalendar/types.ts +236 -0
- package/src/primitives/UiCard/UiCard.stories.ts +197 -0
- package/src/primitives/UiCard/UiCard.vue +13 -0
- package/src/primitives/UiCard/UiCardAction.vue +13 -0
- package/src/primitives/UiCard/UiCardContent.vue +13 -0
- package/src/primitives/UiCard/UiCardDescription.vue +13 -0
- package/src/primitives/UiCard/UiCardFooter.vue +13 -0
- package/src/primitives/UiCard/UiCardHeader.vue +13 -0
- package/src/primitives/UiCard/UiCardTitle.vue +13 -0
- package/src/primitives/UiCard/__tests__/UiCard.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardAction.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardContent.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardDescription.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardFooter.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardHeader.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardTitle.test.ts +19 -0
- package/src/primitives/UiCard/index.ts +7 -0
- package/src/primitives/UiCard/types.ts +10 -0
- package/src/primitives/UiCheckbox/UiCheckbox.stories.ts +231 -0
- package/src/primitives/UiCheckbox/UiCheckbox.vue +19 -0
- package/src/primitives/UiCheckbox/__tests__/UiCheckbox.test.ts +29 -0
- package/src/primitives/UiCheckbox/index.ts +2 -0
- package/src/primitives/UiCheckbox/types.ts +30 -0
- package/src/primitives/UiDrawer/UiDrawer.stories.ts +602 -0
- package/src/primitives/UiDrawer/UiDrawer.vue +19 -0
- package/src/primitives/UiDrawer/UiDrawerClose.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerContent.vue +29 -0
- package/src/primitives/UiDrawer/UiDrawerDescription.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerFooter.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerHeader.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerTitle.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerTrigger.vue +16 -0
- package/src/primitives/UiDrawer/__tests__/UiDrawer.test.ts +229 -0
- package/src/primitives/UiDrawer/index.ts +8 -0
- package/src/primitives/UiDrawer/types.ts +96 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenu.stories.ts +760 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenu.vue +25 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuCheckboxItem.vue +29 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuContent.vue +27 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuGroup.vue +13 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuItem.vue +26 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuLabel.vue +18 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuRadioGroup.vue +20 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuRadioItem.vue +26 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSeparator.vue +11 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuShortcut.vue +13 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSub.vue +26 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSubContent.vue +23 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSubTrigger.vue +24 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuTrigger.vue +24 -0
- package/src/primitives/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +557 -0
- package/src/primitives/UiDropdownMenu/index.ts +16 -0
- package/src/primitives/UiDropdownMenu/types.ts +219 -0
- package/src/primitives/UiField/UiField.stories.ts +1496 -0
- package/src/primitives/UiField/UiField.vue +18 -0
- package/src/primitives/UiField/UiFieldContent.vue +13 -0
- package/src/primitives/UiField/UiFieldDescription.vue +13 -0
- package/src/primitives/UiField/UiFieldError.vue +20 -0
- package/src/primitives/UiField/UiFieldGroup.vue +13 -0
- package/src/primitives/UiField/UiFieldLabel.vue +16 -0
- package/src/primitives/UiField/UiFieldLegend.vue +13 -0
- package/src/primitives/UiField/UiFieldSeparator.vue +13 -0
- package/src/primitives/UiField/UiFieldSet.vue +13 -0
- package/src/primitives/UiField/UiFieldTitle.vue +13 -0
- package/src/primitives/UiField/__tests__/UiFieldError.test.ts +35 -0
- package/src/primitives/UiField/index.ts +10 -0
- package/src/primitives/UiField/types.ts +47 -0
- package/src/primitives/UiIcon/UiIcon.stories.ts +95 -0
- package/src/primitives/UiIcon/UiIcon.vue +14 -0
- package/src/primitives/UiIcon/__tests__/UiIcon.test.ts +24 -0
- package/src/primitives/UiIcon/index.ts +1 -0
- package/src/primitives/UiIcon/types.ts +23 -0
- package/src/primitives/UiIconButton/UiIconButton.stories.ts +446 -0
- package/src/primitives/UiIconButton/UiIconButton.vue +63 -0
- package/src/primitives/UiIconButton/__tests__/UiIconButton.test.ts +102 -0
- package/src/primitives/UiIconButton/index.ts +2 -0
- package/src/primitives/UiIconButton/types.ts +67 -0
- package/src/primitives/UiInput/UiInput.stories.ts +193 -0
- package/src/primitives/UiInput/UiInput.vue +19 -0
- package/src/primitives/UiInput/__tests__/UiInput.test.ts +38 -0
- package/src/primitives/UiInput/index.ts +2 -0
- package/src/primitives/UiInput/types.ts +31 -0
- package/src/primitives/UiPopover/UiPopover.stories.ts +394 -0
- package/src/primitives/UiPopover/UiPopover.vue +17 -0
- package/src/primitives/UiPopover/UiPopoverContent.vue +27 -0
- package/src/primitives/UiPopover/UiPopoverTrigger.vue +16 -0
- package/src/primitives/UiPopover/__tests__/UiPopover.test.ts +87 -0
- package/src/primitives/UiPopover/index.ts +5 -0
- package/src/primitives/UiPopover/types.ts +86 -0
- package/src/primitives/UiProgress/UiProgress.stories.ts +92 -0
- package/src/primitives/UiProgress/UiProgress.vue +25 -0
- package/src/primitives/UiProgress/__tests__/UiProgress.test.ts +46 -0
- package/src/primitives/UiProgress/index.ts +2 -0
- package/src/primitives/UiProgress/types.ts +16 -0
- package/src/primitives/UiRadioGroup/UiRadioGroup.stories.ts +291 -0
- package/src/primitives/UiRadioGroup/UiRadioGroup.vue +43 -0
- package/src/primitives/UiRadioGroup/UiRadioGroupItem.vue +18 -0
- package/src/primitives/UiRadioGroup/__tests__/UiRadioGroup.test.ts +404 -0
- package/src/primitives/UiRadioGroup/index.ts +4 -0
- package/src/primitives/UiRadioGroup/types.ts +66 -0
- package/src/primitives/UiRangeCalendar/UiRangeCalendar.stories.ts +609 -0
- package/src/primitives/UiRangeCalendar/UiRangeCalendar.vue +50 -0
- package/src/primitives/UiRangeCalendar/__tests__/UiRangeCalendar.test.ts +35 -0
- package/src/primitives/UiRangeCalendar/index.ts +13 -0
- package/src/primitives/UiRangeCalendar/types.ts +184 -0
- package/src/primitives/UiSelect/UiSelect.stories.ts +425 -0
- package/src/primitives/UiSelect/UiSelect.vue +47 -0
- package/src/primitives/UiSelect/UiSelectContent.vue +30 -0
- package/src/primitives/UiSelect/UiSelectGroup.vue +13 -0
- package/src/primitives/UiSelect/UiSelectItem.vue +19 -0
- package/src/primitives/UiSelect/UiSelectLabel.vue +13 -0
- package/src/primitives/UiSelect/UiSelectSeparator.vue +11 -0
- package/src/primitives/UiSelect/UiSelectTrigger.vue +30 -0
- package/src/primitives/UiSelect/UiSelectValue.vue +18 -0
- package/src/primitives/UiSelect/__tests__/UiSelect.test.ts +211 -0
- package/src/primitives/UiSelect/__tests__/UiSelectContent.test.ts +30 -0
- package/src/primitives/UiSelect/__tests__/UiSelectGroup.test.ts +85 -0
- package/src/primitives/UiSelect/__tests__/UiSelectItem.test.ts +79 -0
- package/src/primitives/UiSelect/__tests__/UiSelectLabel.test.ts +83 -0
- package/src/primitives/UiSelect/__tests__/UiSelectSeparator.test.ts +82 -0
- package/src/primitives/UiSelect/__tests__/UiSelectTrigger.test.ts +54 -0
- package/src/primitives/UiSelect/__tests__/UiSelectValue.test.ts +39 -0
- package/src/primitives/UiSelect/index.ts +10 -0
- package/src/primitives/UiSelect/types.ts +93 -0
- package/src/primitives/UiSlider/UiSlider.stories.ts +226 -0
- package/src/primitives/UiSlider/UiSlider.vue +44 -0
- package/src/primitives/UiSlider/__tests__/UiSlider.test.ts +76 -0
- package/src/primitives/UiSlider/index.ts +1 -0
- package/src/primitives/UiSlider/types.ts +101 -0
- package/src/primitives/UiSpinner/UiSpinner.stories.ts +143 -0
- package/src/primitives/UiSpinner/UiSpinner.vue +16 -0
- package/src/primitives/UiSpinner/__tests__/UiSpinner.test.ts +19 -0
- package/src/primitives/UiSpinner/index.ts +2 -0
- package/src/primitives/UiSpinner/types.ts +16 -0
- package/src/primitives/UiSwitch/UiSwitch.stories.ts +120 -0
- package/src/primitives/UiSwitch/UiSwitch.vue +21 -0
- package/src/primitives/UiSwitch/__tests__/UiSwitch.test.ts +47 -0
- package/src/primitives/UiSwitch/index.ts +2 -0
- package/src/primitives/UiSwitch/types.ts +25 -0
- package/src/primitives/UiTable/UiTable.stories.ts +505 -0
- package/src/primitives/UiTable/UiTable.vue +13 -0
- package/src/primitives/UiTable/UiTableBody.vue +13 -0
- package/src/primitives/UiTable/UiTableCaption.vue +13 -0
- package/src/primitives/UiTable/UiTableCell.vue +16 -0
- package/src/primitives/UiTable/UiTableEmpty.vue +18 -0
- package/src/primitives/UiTable/UiTableFooter.vue +13 -0
- package/src/primitives/UiTable/UiTableHead.vue +18 -0
- package/src/primitives/UiTable/UiTableHeader.vue +13 -0
- package/src/primitives/UiTable/UiTableRow.vue +18 -0
- package/src/primitives/UiTable/__tests__/UiTable.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableBody.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableCaption.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableCell.test.ts +26 -0
- package/src/primitives/UiTable/__tests__/UiTableEmpty.test.ts +32 -0
- package/src/primitives/UiTable/__tests__/UiTableFooter.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableHead.test.ts +43 -0
- package/src/primitives/UiTable/__tests__/UiTableHeader.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableRow.test.ts +32 -0
- package/src/primitives/UiTable/index.ts +16 -0
- package/src/primitives/UiTable/types.ts +68 -0
- package/src/primitives/UiTabs/UiTabs.stories.ts +456 -0
- package/src/primitives/UiTabs/UiTabs.vue +31 -0
- package/src/primitives/UiTabs/UiTabsContent.vue +16 -0
- package/src/primitives/UiTabs/UiTabsList.vue +16 -0
- package/src/primitives/UiTabs/UiTabsTrigger.vue +16 -0
- package/src/primitives/UiTabs/__tests__/UiTabs.test.ts +122 -0
- package/src/primitives/UiTabs/index.ts +6 -0
- package/src/primitives/UiTabs/types.ts +68 -0
- package/src/primitives/UiTextarea/UiTextarea.stories.ts +107 -0
- package/src/primitives/UiTextarea/UiTextarea.vue +19 -0
- package/src/primitives/UiTextarea/__tests__/UiTextarea.test.ts +40 -0
- package/src/primitives/UiTextarea/index.ts +2 -0
- package/src/primitives/UiTextarea/types.ts +30 -0
- package/src/primitives/UiTooltip/UiTooltip.stories.ts +550 -0
- package/src/primitives/UiTooltip/UiTooltip.vue +42 -0
- package/src/primitives/UiTooltip/__tests__/UiTooltip.test.ts +78 -0
- package/src/primitives/UiTooltip/index.ts +2 -0
- package/src/primitives/UiTooltip/types.ts +53 -0
- package/src/primitives/index.ts +33 -0
- package/src/primitives/shadcn/accordion/Accordion.vue +15 -0
- package/src/primitives/shadcn/accordion/AccordionContent.vue +23 -0
- package/src/primitives/shadcn/accordion/AccordionItem.vue +24 -0
- package/src/primitives/shadcn/accordion/AccordionTrigger.vue +35 -0
- package/src/primitives/shadcn/accordion/index.ts +4 -0
- package/src/primitives/shadcn/alert/Alert.vue +17 -0
- package/src/primitives/shadcn/alert/AlertDescription.vue +22 -0
- package/src/primitives/shadcn/alert/AlertTitle.vue +17 -0
- package/src/primitives/shadcn/alert/index.ts +24 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialog.vue +15 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogAction.vue +18 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogCancel.vue +21 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogContent.vue +44 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogDescription.vue +21 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogFooter.vue +17 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogHeader.vue +17 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogTitle.vue +21 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogTrigger.vue +12 -0
- package/src/primitives/shadcn/alert-dialog/index.ts +9 -0
- package/src/primitives/shadcn/avatar/Avatar.vue +18 -0
- package/src/primitives/shadcn/avatar/AvatarFallback.vue +21 -0
- package/src/primitives/shadcn/avatar/AvatarImage.vue +12 -0
- package/src/primitives/shadcn/avatar/index.ts +3 -0
- package/src/primitives/shadcn/badge/Badge.vue +28 -0
- package/src/primitives/shadcn/badge/index.ts +24 -0
- package/src/primitives/shadcn/button/Button.vue +29 -0
- package/src/primitives/shadcn/button/index.ts +36 -0
- package/src/primitives/shadcn/calendar/Calendar.vue +206 -0
- package/src/primitives/shadcn/calendar/CalendarCell.vue +28 -0
- package/src/primitives/shadcn/calendar/CalendarCellTrigger.vue +44 -0
- package/src/primitives/shadcn/calendar/CalendarGrid.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarGridBody.vue +12 -0
- package/src/primitives/shadcn/calendar/CalendarGridHead.vue +13 -0
- package/src/primitives/shadcn/calendar/CalendarGridRow.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarHeadCell.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarHeader.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarHeading.vue +30 -0
- package/src/primitives/shadcn/calendar/CalendarNextButton.vue +33 -0
- package/src/primitives/shadcn/calendar/CalendarPrevButton.vue +33 -0
- package/src/primitives/shadcn/calendar/index.ts +14 -0
- package/src/primitives/shadcn/card/Card.vue +22 -0
- package/src/primitives/shadcn/card/CardAction.vue +17 -0
- package/src/primitives/shadcn/card/CardContent.vue +14 -0
- package/src/primitives/shadcn/card/CardDescription.vue +14 -0
- package/src/primitives/shadcn/card/CardFooter.vue +14 -0
- package/src/primitives/shadcn/card/CardHeader.vue +22 -0
- package/src/primitives/shadcn/card/CardTitle.vue +14 -0
- package/src/primitives/shadcn/card/index.ts +7 -0
- package/src/primitives/shadcn/checkbox/Checkbox.vue +38 -0
- package/src/primitives/shadcn/checkbox/index.ts +1 -0
- package/src/primitives/shadcn/drawer/Drawer.vue +15 -0
- package/src/primitives/shadcn/drawer/DrawerClose.vue +12 -0
- package/src/primitives/shadcn/drawer/DrawerContent.vue +52 -0
- package/src/primitives/shadcn/drawer/DrawerDescription.vue +20 -0
- package/src/primitives/shadcn/drawer/DrawerFooter.vue +17 -0
- package/src/primitives/shadcn/drawer/DrawerHeader.vue +17 -0
- package/src/primitives/shadcn/drawer/DrawerTitle.vue +20 -0
- package/src/primitives/shadcn/drawer/DrawerTrigger.vue +12 -0
- package/src/primitives/shadcn/drawer/index.ts +8 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenu.vue +15 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuCheckboxItem.vue +41 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuContent.vue +40 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuItem.vue +41 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuLabel.vue +25 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuRadioGroup.vue +15 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuRadioItem.vue +38 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSub.vue +15 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSubContent.vue +29 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuTrigger.vue +14 -0
- package/src/primitives/shadcn/dropdown-menu/index.ts +16 -0
- package/src/primitives/shadcn/field/Field.vue +22 -0
- package/src/primitives/shadcn/field/FieldContent.vue +17 -0
- package/src/primitives/shadcn/field/FieldDescription.vue +24 -0
- package/src/primitives/shadcn/field/FieldError.vue +69 -0
- package/src/primitives/shadcn/field/FieldGroup.vue +22 -0
- package/src/primitives/shadcn/field/FieldLabel.vue +28 -0
- package/src/primitives/shadcn/field/FieldLegend.vue +26 -0
- package/src/primitives/shadcn/field/FieldSeparator.vue +28 -0
- package/src/primitives/shadcn/field/FieldSet.vue +23 -0
- package/src/primitives/shadcn/field/FieldTitle.vue +22 -0
- package/src/primitives/shadcn/field/index.ts +39 -0
- package/src/primitives/shadcn/icon/Icon.vue +38 -0
- package/src/primitives/shadcn/icon/index.ts +1 -0
- package/src/primitives/shadcn/index.ts +3 -0
- package/src/primitives/shadcn/input/Input.vue +35 -0
- package/src/primitives/shadcn/input/index.ts +1 -0
- package/src/primitives/shadcn/label/Label.vue +28 -0
- package/src/primitives/shadcn/label/index.ts +1 -0
- package/src/primitives/shadcn/native-select/NativeSelect.vue +56 -0
- package/src/primitives/shadcn/native-select/NativeSelectOptGroup.vue +18 -0
- package/src/primitives/shadcn/native-select/NativeSelectOption.vue +18 -0
- package/src/primitives/shadcn/native-select/index.ts +3 -0
- package/src/primitives/shadcn/popover/Popover.vue +19 -0
- package/src/primitives/shadcn/popover/PopoverContent.vue +41 -0
- package/src/primitives/shadcn/popover/PopoverTrigger.vue +11 -0
- package/src/primitives/shadcn/popover/index.ts +4 -0
- package/src/primitives/shadcn/progress/Progress.vue +30 -0
- package/src/primitives/shadcn/progress/index.ts +1 -0
- package/src/primitives/shadcn/radio-group/RadioGroup.vue +25 -0
- package/src/primitives/shadcn/radio-group/RadioGroupItem.vue +38 -0
- package/src/primitives/shadcn/radio-group/index.ts +2 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendar.vue +73 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarCell.vue +28 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarCellTrigger.vue +46 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGrid.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGridBody.vue +12 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGridHead.vue +12 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGridRow.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarHeadCell.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarHeader.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarHeading.vue +30 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarNextButton.vue +34 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarPrevButton.vue +34 -0
- package/src/primitives/shadcn/range-calendar/index.ts +12 -0
- package/src/primitives/shadcn/select/Select.vue +15 -0
- package/src/primitives/shadcn/select/SelectContent.vue +55 -0
- package/src/primitives/shadcn/select/SelectGroup.vue +12 -0
- package/src/primitives/shadcn/select/SelectItem.vue +39 -0
- package/src/primitives/shadcn/select/SelectItemText.vue +12 -0
- package/src/primitives/shadcn/select/SelectLabel.vue +17 -0
- package/src/primitives/shadcn/select/SelectScrollDownButton.vue +26 -0
- package/src/primitives/shadcn/select/SelectScrollUpButton.vue +26 -0
- package/src/primitives/shadcn/select/SelectSeparator.vue +19 -0
- package/src/primitives/shadcn/select/SelectTrigger.vue +37 -0
- package/src/primitives/shadcn/select/SelectValue.vue +12 -0
- package/src/primitives/shadcn/select/index.ts +11 -0
- package/src/primitives/shadcn/separator/Separator.vue +27 -0
- package/src/primitives/shadcn/separator/index.ts +1 -0
- package/src/primitives/shadcn/slider/Slider.vue +45 -0
- package/src/primitives/shadcn/slider/index.ts +1 -0
- package/src/primitives/shadcn/spinner/Spinner.vue +18 -0
- package/src/primitives/shadcn/spinner/index.ts +1 -0
- package/src/primitives/shadcn/switch/Switch.vue +40 -0
- package/src/primitives/shadcn/switch/index.ts +1 -0
- package/src/primitives/shadcn/table/Table.vue +16 -0
- package/src/primitives/shadcn/table/TableBody.vue +14 -0
- package/src/primitives/shadcn/table/TableCaption.vue +14 -0
- package/src/primitives/shadcn/table/TableCell.vue +26 -0
- package/src/primitives/shadcn/table/TableEmpty.vue +29 -0
- package/src/primitives/shadcn/table/TableFooter.vue +17 -0
- package/src/primitives/shadcn/table/TableHead.vue +28 -0
- package/src/primitives/shadcn/table/TableHeader.vue +14 -0
- package/src/primitives/shadcn/table/TableRow.vue +21 -0
- package/src/primitives/shadcn/table/index.ts +9 -0
- package/src/primitives/shadcn/table/utils.ts +8 -0
- package/src/primitives/shadcn/tabs/Tabs.vue +24 -0
- package/src/primitives/shadcn/tabs/TabsContent.vue +21 -0
- package/src/primitives/shadcn/tabs/TabsList.vue +26 -0
- package/src/primitives/shadcn/tabs/TabsTrigger.vue +28 -0
- package/src/primitives/shadcn/tabs/index.ts +4 -0
- package/src/primitives/shadcn/textarea/Textarea.vue +33 -0
- package/src/primitives/shadcn/textarea/index.ts +1 -0
- package/src/primitives/shadcn/tooltip/Tooltip.vue +15 -0
- package/src/primitives/shadcn/tooltip/TooltipContent.vue +40 -0
- package/src/primitives/shadcn/tooltip/TooltipProvider.vue +12 -0
- package/src/primitives/shadcn/tooltip/TooltipTrigger.vue +12 -0
- package/src/primitives/shadcn/tooltip/index.ts +4 -0
- package/src/styles/global.css +1 -0
- package/src/templates/UiTemplatePlaceholder/UiTemplatePlaceholder.vue +9 -0
- package/src/templates/UiTemplatePlaceholder/index.ts +1 -0
- package/src/templates/UiTemplatePlaceholder/types.ts +8 -0
- package/src/templates/index.ts +6 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import UiTooltip from './UiTooltip.vue';
|
|
3
|
+
import { UiButton } from '@/primitives/UiButton';
|
|
4
|
+
import { UiIcon } from '@/primitives/UiIcon';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof UiTooltip> = {
|
|
7
|
+
title: 'Primitives/UiTooltip',
|
|
8
|
+
component: UiTooltip,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
content: {
|
|
12
|
+
control: 'text',
|
|
13
|
+
description: 'The text content to display in the tooltip',
|
|
14
|
+
},
|
|
15
|
+
side: {
|
|
16
|
+
control: 'select',
|
|
17
|
+
options: ['top', 'right', 'bottom', 'left'],
|
|
18
|
+
description: 'The side of the trigger where the tooltip should appear',
|
|
19
|
+
},
|
|
20
|
+
align: {
|
|
21
|
+
control: 'select',
|
|
22
|
+
options: ['start', 'center', 'end'],
|
|
23
|
+
description: 'The preferred alignment against the trigger',
|
|
24
|
+
},
|
|
25
|
+
sideOffset: {
|
|
26
|
+
control: 'number',
|
|
27
|
+
description: 'The distance in pixels from the trigger',
|
|
28
|
+
},
|
|
29
|
+
delayDuration: {
|
|
30
|
+
control: 'number',
|
|
31
|
+
description: 'The duration from when the pointer enters until the tooltip opens',
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Prevents the tooltip from opening',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
args: {
|
|
39
|
+
content: 'This is a helpful tooltip',
|
|
40
|
+
side: 'top',
|
|
41
|
+
align: 'center',
|
|
42
|
+
sideOffset: 4,
|
|
43
|
+
delayDuration: 500,
|
|
44
|
+
disabled: false,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default meta;
|
|
49
|
+
|
|
50
|
+
type Story = StoryObj<typeof UiTooltip>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The default tooltip story. Hover over the button to see the tooltip.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
const defaultTemplateSource = `<script setup lang="ts">
|
|
57
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
58
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<UiTooltip content="This is a helpful tooltip" side="top" align="center" :delay-duration="500" :disabled="false">
|
|
63
|
+
<UiButton>Hover me</UiButton>
|
|
64
|
+
</UiTooltip>
|
|
65
|
+
</template>`;
|
|
66
|
+
|
|
67
|
+
const defaultTemplate = `
|
|
68
|
+
<div class="flex justify-center p-8">
|
|
69
|
+
<UiTooltip content="This is a helpful tooltip" side="top" align="center" :delay-duration="500" :disabled="false">
|
|
70
|
+
<UiButton>Hover me</UiButton>
|
|
71
|
+
</UiTooltip>
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
export const Default: Story = {
|
|
76
|
+
parameters: {
|
|
77
|
+
docs: {
|
|
78
|
+
source: {
|
|
79
|
+
code: defaultTemplateSource,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
render: (args) => ({
|
|
84
|
+
components: { UiTooltip, UiButton },
|
|
85
|
+
setup() {
|
|
86
|
+
return { args };
|
|
87
|
+
},
|
|
88
|
+
template: `
|
|
89
|
+
<div class="flex justify-center p-8">
|
|
90
|
+
<UiTooltip
|
|
91
|
+
:content="args.content"
|
|
92
|
+
:side="args.side"
|
|
93
|
+
:align="args.align"
|
|
94
|
+
:side-offset="args.sideOffset"
|
|
95
|
+
:delay-duration="args.delayDuration"
|
|
96
|
+
:disabled="args.disabled"
|
|
97
|
+
>
|
|
98
|
+
<UiButton>Hover me</UiButton>
|
|
99
|
+
</UiTooltip>
|
|
100
|
+
</div>
|
|
101
|
+
`,
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Tooltip with an icon button.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
const withIconButtonTemplateSource = `<script setup lang="ts">
|
|
110
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
111
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
112
|
+
import { UiIcon } from '@aleph-alpha/ui-library'
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<UiTooltip content="More information" side="top" align="center" :delay-duration="500">
|
|
117
|
+
<UiButton size="icon" variant="ghost" aria-label="Information">
|
|
118
|
+
<UiIcon icon="i-material-symbols-info" class="w-4 h-4" />
|
|
119
|
+
</UiButton>
|
|
120
|
+
</UiTooltip>
|
|
121
|
+
</template>`;
|
|
122
|
+
|
|
123
|
+
const withIconButtonTemplate = `
|
|
124
|
+
<div class="flex justify-center p-8">
|
|
125
|
+
<UiTooltip content="More information" side="top" align="center" :delay-duration="500">
|
|
126
|
+
<UiButton size="icon" variant="ghost" aria-label="Information">
|
|
127
|
+
<UiIcon icon="i-material-symbols-info" class="w-4 h-4" />
|
|
128
|
+
</UiButton>
|
|
129
|
+
</UiTooltip>
|
|
130
|
+
</div>
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
export const WithIconButton: Story = {
|
|
134
|
+
parameters: {
|
|
135
|
+
docs: {
|
|
136
|
+
source: {
|
|
137
|
+
type: 'code',
|
|
138
|
+
code: withIconButtonTemplateSource,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
render: () => ({
|
|
143
|
+
components: { UiTooltip, UiButton, UiIcon },
|
|
144
|
+
template: withIconButtonTemplate,
|
|
145
|
+
}),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Tooltip with custom delay duration (instant).
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
const instantDelayTemplateSource = `<script setup lang="ts">
|
|
153
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
154
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
<template>
|
|
158
|
+
<UiTooltip content="Appears instantly" side="top" align="center" :delay-duration="0">
|
|
159
|
+
<UiButton>Instant tooltip</UiButton>
|
|
160
|
+
</UiTooltip>
|
|
161
|
+
</template>`;
|
|
162
|
+
|
|
163
|
+
const instantDelayTemplate = `
|
|
164
|
+
<div class="flex justify-center p-8">
|
|
165
|
+
<UiTooltip content="Appears instantly" side="top" align="center" :delay-duration="0">
|
|
166
|
+
<UiButton>Instant tooltip</UiButton>
|
|
167
|
+
</UiTooltip>
|
|
168
|
+
</div>
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
export const InstantDelay: Story = {
|
|
172
|
+
parameters: {
|
|
173
|
+
docs: {
|
|
174
|
+
source: {
|
|
175
|
+
type: 'code',
|
|
176
|
+
code: instantDelayTemplateSource,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
render: () => ({
|
|
181
|
+
components: { UiTooltip, UiButton },
|
|
182
|
+
template: instantDelayTemplate,
|
|
183
|
+
}),
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Tooltip with longer delay duration.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
const longDelayTemplateSource = `<script setup lang="ts">
|
|
191
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
192
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
193
|
+
</script>
|
|
194
|
+
|
|
195
|
+
<template>
|
|
196
|
+
<UiTooltip content="Takes a moment to appear" side="top" align="center" :delay-duration="1500">
|
|
197
|
+
<UiButton>Slow tooltip</UiButton>
|
|
198
|
+
</UiTooltip>
|
|
199
|
+
</template>`;
|
|
200
|
+
|
|
201
|
+
const longDelayTemplate = `
|
|
202
|
+
<div class="flex justify-center p-8">
|
|
203
|
+
<UiTooltip content="Takes a moment to appear" side="top" align="center" :delay-duration="1500">
|
|
204
|
+
<UiButton>Slow tooltip</UiButton>
|
|
205
|
+
</UiTooltip>
|
|
206
|
+
</div>
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
export const LongDelay: Story = {
|
|
210
|
+
parameters: {
|
|
211
|
+
docs: {
|
|
212
|
+
source: {
|
|
213
|
+
type: 'code',
|
|
214
|
+
code: longDelayTemplateSource,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
render: () => ({
|
|
219
|
+
components: { UiTooltip, UiButton },
|
|
220
|
+
template: longDelayTemplate,
|
|
221
|
+
}),
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Disabled tooltip - will not show on hover.
|
|
226
|
+
*/
|
|
227
|
+
const disabledTemplateSource = `<script setup lang="ts">
|
|
228
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
229
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
230
|
+
</script>
|
|
231
|
+
|
|
232
|
+
<template>
|
|
233
|
+
<UiTooltip content="You should not see this" :disabled="true">
|
|
234
|
+
<UiButton>Hover me (disabled tooltip)</UiButton>
|
|
235
|
+
</UiTooltip>
|
|
236
|
+
</template>`;
|
|
237
|
+
|
|
238
|
+
const disabledTemplate = `
|
|
239
|
+
<div class="flex justify-center p-8">
|
|
240
|
+
<UiTooltip content="You should not see this" :disabled="true">
|
|
241
|
+
<UiButton>Hover me (disabled tooltip)</UiButton>
|
|
242
|
+
</UiTooltip>
|
|
243
|
+
</div>
|
|
244
|
+
`;
|
|
245
|
+
|
|
246
|
+
export const Disabled: Story = {
|
|
247
|
+
parameters: {
|
|
248
|
+
docs: {
|
|
249
|
+
source: {
|
|
250
|
+
type: 'code',
|
|
251
|
+
code: disabledTemplateSource,
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
render: () => ({
|
|
256
|
+
components: { UiTooltip, UiButton },
|
|
257
|
+
template: disabledTemplate,
|
|
258
|
+
}),
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Tooltip with different alignment options.
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
const alignmentOptionsTemplateSource = `<script setup lang="ts">
|
|
266
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
267
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
268
|
+
</script>
|
|
269
|
+
|
|
270
|
+
<template>
|
|
271
|
+
<UiTooltip content="Aligned to the start" side="bottom" align="start">
|
|
272
|
+
<UiButton>Hover me</UiButton>
|
|
273
|
+
</UiTooltip>
|
|
274
|
+
|
|
275
|
+
<UiTooltip content="Aligned to the center" side="bottom" align="center">
|
|
276
|
+
<UiButton>Hover me</UiButton>
|
|
277
|
+
</UiTooltip>
|
|
278
|
+
|
|
279
|
+
<UiTooltip content="Aligned to the end" side="bottom" align="end">
|
|
280
|
+
<UiButton>Hover me</UiButton>
|
|
281
|
+
</UiTooltip>
|
|
282
|
+
</template>`;
|
|
283
|
+
|
|
284
|
+
const alignmentOptionsTemplate = `
|
|
285
|
+
<div class="flex flex-col gap-8 items-center p-8">
|
|
286
|
+
<div class="flex flex-col items-center gap-2">
|
|
287
|
+
<span class="text-xs text-muted-foreground">Align Start</span>
|
|
288
|
+
<UiTooltip content="Aligned to the start" side="bottom" align="start">
|
|
289
|
+
<UiButton>Hover me</UiButton>
|
|
290
|
+
</UiTooltip>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<div class="flex flex-col items-center gap-2">
|
|
294
|
+
<span class="text-xs text-muted-foreground">Align Center</span>
|
|
295
|
+
<UiTooltip content="Aligned to the center" side="bottom" align="center">
|
|
296
|
+
<UiButton>Hover me</UiButton>
|
|
297
|
+
</UiTooltip>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<div class="flex flex-col items-center gap-2">
|
|
301
|
+
<span class="text-xs text-muted-foreground">Align End</span>
|
|
302
|
+
<UiTooltip content="Aligned to the end" side="bottom" align="end">
|
|
303
|
+
<UiButton>Hover me</UiButton>
|
|
304
|
+
</UiTooltip>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
`;
|
|
308
|
+
|
|
309
|
+
export const AlignmentOptions: Story = {
|
|
310
|
+
parameters: {
|
|
311
|
+
docs: {
|
|
312
|
+
source: {
|
|
313
|
+
type: 'code',
|
|
314
|
+
code: alignmentOptionsTemplateSource,
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
render: () => ({
|
|
319
|
+
components: { UiTooltip, UiButton },
|
|
320
|
+
template: alignmentOptionsTemplate,
|
|
321
|
+
}),
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* All available positions for the tooltip.
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
const allSidesTemplateSource = `<script setup lang="ts">
|
|
329
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
330
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
331
|
+
</script>
|
|
332
|
+
|
|
333
|
+
<template>
|
|
334
|
+
<UiTooltip content="Top tooltip" side="top" align="center">
|
|
335
|
+
<UiButton>Top</UiButton>
|
|
336
|
+
</UiTooltip>
|
|
337
|
+
|
|
338
|
+
<UiTooltip content="Right tooltip" side="right" align="center">
|
|
339
|
+
<UiButton>Right</UiButton>
|
|
340
|
+
</UiTooltip>
|
|
341
|
+
|
|
342
|
+
<UiTooltip content="Bottom tooltip" side="bottom" align="center">
|
|
343
|
+
<UiButton>Bottom</UiButton>
|
|
344
|
+
</UiTooltip>
|
|
345
|
+
|
|
346
|
+
<UiTooltip content="Left tooltip" side="left" align="center">
|
|
347
|
+
<UiButton>Left</UiButton>
|
|
348
|
+
</UiTooltip>
|
|
349
|
+
</template>`;
|
|
350
|
+
|
|
351
|
+
const allSidesTemplate = `
|
|
352
|
+
<div class="flex items-center justify-center gap-8 p-16">
|
|
353
|
+
<UiTooltip content="Top tooltip" side="top" align="center">
|
|
354
|
+
<UiButton>Top</UiButton>
|
|
355
|
+
</UiTooltip>
|
|
356
|
+
|
|
357
|
+
<UiTooltip content="Right tooltip" side="right" align="center">
|
|
358
|
+
<UiButton>Right</UiButton>
|
|
359
|
+
</UiTooltip>
|
|
360
|
+
|
|
361
|
+
<UiTooltip content="Bottom tooltip" side="bottom" align="center">
|
|
362
|
+
<UiButton>Bottom</UiButton>
|
|
363
|
+
</UiTooltip>
|
|
364
|
+
|
|
365
|
+
<UiTooltip content="Left tooltip" side="left" align="center">
|
|
366
|
+
<UiButton>Left</UiButton>
|
|
367
|
+
</UiTooltip>
|
|
368
|
+
</div>
|
|
369
|
+
`;
|
|
370
|
+
|
|
371
|
+
export const AllSides: Story = {
|
|
372
|
+
parameters: {
|
|
373
|
+
docs: {
|
|
374
|
+
source: {
|
|
375
|
+
type: 'code',
|
|
376
|
+
code: allSidesTemplateSource,
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
render: () => ({
|
|
381
|
+
components: { UiTooltip, UiButton },
|
|
382
|
+
template: allSidesTemplate,
|
|
383
|
+
}),
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Various tooltip use cases with different trigger elements.
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
const useCasesTemplateSource = `<script setup lang="ts">
|
|
391
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
392
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
393
|
+
import { UiIcon } from '@aleph-alpha/ui-library'
|
|
394
|
+
</script>
|
|
395
|
+
|
|
396
|
+
<template>
|
|
397
|
+
<UiTooltip content="Click to submit the form" side="top" align="center">
|
|
398
|
+
<UiButton>Submit</UiButton>
|
|
399
|
+
</UiTooltip>
|
|
400
|
+
|
|
401
|
+
<UiTooltip content="This action is permanent and cannot be undone" side="top" align="center">
|
|
402
|
+
<UiButton variant="destructive">Delete</UiButton>
|
|
403
|
+
</UiTooltip>
|
|
404
|
+
|
|
405
|
+
<UiTooltip content="Need help? Click for documentation" side="top" align="center">
|
|
406
|
+
<UiButton size="icon" variant="ghost" aria-label="Help">
|
|
407
|
+
<UiIcon icon="i-material-symbols-help" class="w-4 h-4" />
|
|
408
|
+
</UiButton>
|
|
409
|
+
</UiTooltip>
|
|
410
|
+
|
|
411
|
+
<UiTooltip content="Important information about this feature" side="top" align="center">
|
|
412
|
+
<UiButton size="icon" variant="outline" aria-label="Information">
|
|
413
|
+
<UiIcon icon="i-material-symbols-info" class="w-4 h-4" />
|
|
414
|
+
</UiButton>
|
|
415
|
+
</UiTooltip>
|
|
416
|
+
|
|
417
|
+
<UiTooltip content="Warning: This may affect other settings" side="top" align="center">
|
|
418
|
+
<UiButton size="icon" variant="secondary" aria-label="Warning">
|
|
419
|
+
<UiIcon icon="i-material-symbols-warning" class="w-4 h-4" />
|
|
420
|
+
</UiButton>
|
|
421
|
+
</UiTooltip>
|
|
422
|
+
|
|
423
|
+
<UiTooltip content="Disabled buttons can also have tooltips" side="top" align="center">
|
|
424
|
+
<UiButton :disabled="true">Disabled</UiButton>
|
|
425
|
+
</UiTooltip>
|
|
426
|
+
</template>`;
|
|
427
|
+
|
|
428
|
+
const useCasesTemplate = `
|
|
429
|
+
<div class="flex flex-wrap gap-4 items-center justify-center p-8">
|
|
430
|
+
<UiTooltip content="Click to submit the form" side="top" align="center">
|
|
431
|
+
<UiButton>Submit</UiButton>
|
|
432
|
+
</UiTooltip>
|
|
433
|
+
|
|
434
|
+
<UiTooltip content="This action is permanent and cannot be undone" side="top" align="center">
|
|
435
|
+
<UiButton variant="destructive">Delete</UiButton>
|
|
436
|
+
</UiTooltip>
|
|
437
|
+
|
|
438
|
+
<UiTooltip content="Need help? Click for documentation" side="top" align="center">
|
|
439
|
+
<UiButton size="icon" variant="ghost" aria-label="Help">
|
|
440
|
+
<UiIcon icon="i-material-symbols-help" class="w-4 h-4" />
|
|
441
|
+
</UiButton>
|
|
442
|
+
</UiTooltip>
|
|
443
|
+
|
|
444
|
+
<UiTooltip content="Important information about this feature" side="top" align="center">
|
|
445
|
+
<UiButton size="icon" variant="outline" aria-label="Information">
|
|
446
|
+
<UiIcon icon="i-material-symbols-info" class="w-4 h-4" />
|
|
447
|
+
</UiButton>
|
|
448
|
+
</UiTooltip>
|
|
449
|
+
|
|
450
|
+
<UiTooltip content="Warning: This may affect other settings" side="top" align="center">
|
|
451
|
+
<UiButton size="icon" variant="secondary" aria-label="Warning">
|
|
452
|
+
<UiIcon icon="i-material-symbols-warning" class="w-4 h-4" />
|
|
453
|
+
</UiButton>
|
|
454
|
+
</UiTooltip>
|
|
455
|
+
|
|
456
|
+
<UiTooltip content="Disabled buttons can also have tooltips" side="top" align="center">
|
|
457
|
+
<UiButton :disabled="true">Disabled</UiButton>
|
|
458
|
+
</UiTooltip>
|
|
459
|
+
</div>
|
|
460
|
+
`;
|
|
461
|
+
|
|
462
|
+
export const UseCases: Story = {
|
|
463
|
+
parameters: {
|
|
464
|
+
docs: {
|
|
465
|
+
source: {
|
|
466
|
+
type: 'code',
|
|
467
|
+
code: useCasesTemplateSource,
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
render: () => ({
|
|
472
|
+
components: { UiTooltip, UiButton, UiIcon },
|
|
473
|
+
template: useCasesTemplate,
|
|
474
|
+
}),
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Tooltip wrapping text instead of a button.
|
|
479
|
+
*/
|
|
480
|
+
|
|
481
|
+
const withTextTemplateSource = `<script setup lang="ts">
|
|
482
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
483
|
+
</script>
|
|
484
|
+
|
|
485
|
+
<template>
|
|
486
|
+
<UiTooltip content="Additional context for this text" side="top" align="center">
|
|
487
|
+
<span class="underline decoration-dashed cursor-help">Hover over this text</span>
|
|
488
|
+
</UiTooltip>
|
|
489
|
+
</template>`;
|
|
490
|
+
|
|
491
|
+
const withTextTemplate = `
|
|
492
|
+
<div class="flex justify-center p-8">
|
|
493
|
+
<UiTooltip content="Additional context for this text" side="top" align="center">
|
|
494
|
+
<span class="underline decoration-dashed cursor-help">Hover over this text</span>
|
|
495
|
+
</UiTooltip>
|
|
496
|
+
</div>
|
|
497
|
+
`;
|
|
498
|
+
|
|
499
|
+
export const WithText: Story = {
|
|
500
|
+
parameters: {
|
|
501
|
+
docs: {
|
|
502
|
+
source: {
|
|
503
|
+
type: 'code',
|
|
504
|
+
code: withTextTemplateSource,
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
render: () => ({
|
|
509
|
+
components: { UiTooltip },
|
|
510
|
+
template: withTextTemplate,
|
|
511
|
+
}),
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Tooltip with a larger offset from the trigger.
|
|
516
|
+
*/
|
|
517
|
+
|
|
518
|
+
const customOffsetTemplateSource = `<script setup lang="ts">
|
|
519
|
+
import { UiTooltip } from '@aleph-alpha/ui-library'
|
|
520
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
521
|
+
</script>
|
|
522
|
+
|
|
523
|
+
<template>
|
|
524
|
+
<UiTooltip content="Tooltip with 16px offset" side="top" align="center" :side-offset="16">
|
|
525
|
+
<UiButton>Hover me</UiButton>
|
|
526
|
+
</UiTooltip>
|
|
527
|
+
</template>`;
|
|
528
|
+
|
|
529
|
+
const customOffsetTemplate = `
|
|
530
|
+
<div class="flex justify-center p-8">
|
|
531
|
+
<UiTooltip content="Tooltip with 16px offset" side="top" align="center" :side-offset="16">
|
|
532
|
+
<UiButton>Hover me</UiButton>
|
|
533
|
+
</UiTooltip>
|
|
534
|
+
</div>
|
|
535
|
+
`;
|
|
536
|
+
|
|
537
|
+
export const CustomOffset: Story = {
|
|
538
|
+
parameters: {
|
|
539
|
+
docs: {
|
|
540
|
+
source: {
|
|
541
|
+
type: 'code',
|
|
542
|
+
code: customOffsetTemplateSource,
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
render: () => ({
|
|
547
|
+
components: { UiTooltip, UiButton },
|
|
548
|
+
template: customOffsetTemplate,
|
|
549
|
+
}),
|
|
550
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Tooltip as ShadcnTooltip,
|
|
4
|
+
TooltipContent as ShadcnTooltipContent,
|
|
5
|
+
TooltipProvider as ShadcnTooltipProvider,
|
|
6
|
+
TooltipTrigger as ShadcnTooltipTrigger,
|
|
7
|
+
} from '@/primitives/shadcn/tooltip';
|
|
8
|
+
import type { UiTooltipProps } from './types';
|
|
9
|
+
|
|
10
|
+
defineOptions({
|
|
11
|
+
name: 'UiTooltip',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const open = defineModel<boolean>('open');
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<UiTooltipProps>(), {
|
|
17
|
+
side: 'top',
|
|
18
|
+
sideOffset: 4,
|
|
19
|
+
align: 'center',
|
|
20
|
+
class: '',
|
|
21
|
+
delayDuration: 500,
|
|
22
|
+
disabled: false,
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<ShadcnTooltipProvider :delay-duration="props.delayDuration">
|
|
28
|
+
<ShadcnTooltip v-model:open="open" :disabled="props.disabled">
|
|
29
|
+
<ShadcnTooltipTrigger as-child>
|
|
30
|
+
<slot />
|
|
31
|
+
</ShadcnTooltipTrigger>
|
|
32
|
+
<ShadcnTooltipContent
|
|
33
|
+
:side="props.side"
|
|
34
|
+
:side-offset="props.sideOffset"
|
|
35
|
+
:align="props.align"
|
|
36
|
+
:class="props.class"
|
|
37
|
+
>
|
|
38
|
+
{{ props.content }}
|
|
39
|
+
</ShadcnTooltipContent>
|
|
40
|
+
</ShadcnTooltip>
|
|
41
|
+
</ShadcnTooltipProvider>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/vue';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import UiTooltip from '../UiTooltip.vue';
|
|
4
|
+
|
|
5
|
+
describe('UiTooltip', () => {
|
|
6
|
+
test('renders with content when open is true', async () => {
|
|
7
|
+
render(UiTooltip, {
|
|
8
|
+
props: {
|
|
9
|
+
content: 'Tooltip text',
|
|
10
|
+
open: true,
|
|
11
|
+
delayDuration: 0,
|
|
12
|
+
},
|
|
13
|
+
slots: {
|
|
14
|
+
default: '<button>Hover me</button>',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const tooltip = await screen.findByRole('tooltip', { hidden: true });
|
|
18
|
+
expect(tooltip).toBeInTheDocument();
|
|
19
|
+
expect(tooltip).toHaveTextContent('Tooltip text');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('applies custom classes to content', async () => {
|
|
23
|
+
const customClass = 'bg-red-500';
|
|
24
|
+
render(UiTooltip, {
|
|
25
|
+
props: {
|
|
26
|
+
content: 'Tooltip text',
|
|
27
|
+
open: true,
|
|
28
|
+
class: customClass,
|
|
29
|
+
delayDuration: 0,
|
|
30
|
+
},
|
|
31
|
+
slots: {
|
|
32
|
+
default: '<button>Hover me</button>',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const tooltipSpan = await screen.findByRole('tooltip', { hidden: true });
|
|
37
|
+
expect(tooltipSpan).toHaveTextContent('Tooltip text');
|
|
38
|
+
// Custom classes are applied to the visible wrapper div, not the hidden role span
|
|
39
|
+
// The span is a direct child of the wrapper div
|
|
40
|
+
expect(tooltipSpan.parentElement).toHaveClass(customClass);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('renders with specific side configuration', async () => {
|
|
44
|
+
render(UiTooltip, {
|
|
45
|
+
props: {
|
|
46
|
+
content: 'Tooltip text',
|
|
47
|
+
open: true,
|
|
48
|
+
side: 'right',
|
|
49
|
+
delayDuration: 0,
|
|
50
|
+
},
|
|
51
|
+
slots: {
|
|
52
|
+
default: '<button>Hover me</button>',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const tooltipSpan = await screen.findByRole('tooltip', { hidden: true });
|
|
57
|
+
// Data attributes are on the visible wrapper div
|
|
58
|
+
expect(tooltipSpan.parentElement).toHaveAttribute('data-side', 'right');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('renders with specific align configuration', async () => {
|
|
62
|
+
render(UiTooltip, {
|
|
63
|
+
props: {
|
|
64
|
+
content: 'Tooltip text',
|
|
65
|
+
open: true,
|
|
66
|
+
align: 'start',
|
|
67
|
+
delayDuration: 0,
|
|
68
|
+
},
|
|
69
|
+
slots: {
|
|
70
|
+
default: '<button>Hover me</button>',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const tooltipSpan = await screen.findByRole('tooltip', { hidden: true });
|
|
75
|
+
// Data attributes are on the visible wrapper div
|
|
76
|
+
expect(tooltipSpan.parentElement).toHaveAttribute('data-align', 'start');
|
|
77
|
+
});
|
|
78
|
+
});
|