@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,186 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import {
|
|
3
|
+
UiAlertDialog,
|
|
4
|
+
UiAlertDialogAction,
|
|
5
|
+
UiAlertDialogCancel,
|
|
6
|
+
UiAlertDialogContent,
|
|
7
|
+
UiAlertDialogDescription,
|
|
8
|
+
UiAlertDialogFooter,
|
|
9
|
+
UiAlertDialogHeader,
|
|
10
|
+
UiAlertDialogTitle,
|
|
11
|
+
UiAlertDialogTrigger,
|
|
12
|
+
} from './index';
|
|
13
|
+
import { UiButton } from '../UiButton';
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof UiAlertDialog> = {
|
|
16
|
+
title: 'Primitives/UiAlertDialog',
|
|
17
|
+
component: UiAlertDialog,
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
argTypes: {},
|
|
20
|
+
args: {},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof UiAlertDialog>;
|
|
26
|
+
|
|
27
|
+
const defaultTemplateSource = `<script setup lang="ts">
|
|
28
|
+
import {
|
|
29
|
+
UiAlertDialog,
|
|
30
|
+
UiAlertDialogAction,
|
|
31
|
+
UiAlertDialogCancel,
|
|
32
|
+
UiAlertDialogContent,
|
|
33
|
+
UiAlertDialogDescription,
|
|
34
|
+
UiAlertDialogFooter,
|
|
35
|
+
UiAlertDialogHeader,
|
|
36
|
+
UiAlertDialogTitle,
|
|
37
|
+
UiAlertDialogTrigger,
|
|
38
|
+
UiButton,
|
|
39
|
+
} from '@aleph-alpha/ui-library'
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<UiAlertDialog>
|
|
44
|
+
<UiAlertDialogTrigger as-child>
|
|
45
|
+
<UiButton variant="outline">Show Dialog</UiButton>
|
|
46
|
+
</UiAlertDialogTrigger>
|
|
47
|
+
<UiAlertDialogContent>
|
|
48
|
+
<UiAlertDialogHeader>
|
|
49
|
+
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
|
50
|
+
<UiAlertDialogDescription>
|
|
51
|
+
This action cannot be undone. This will permanently delete your
|
|
52
|
+
account and remove your data from our servers.
|
|
53
|
+
</UiAlertDialogDescription>
|
|
54
|
+
</UiAlertDialogHeader>
|
|
55
|
+
<UiAlertDialogFooter>
|
|
56
|
+
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
|
57
|
+
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
|
58
|
+
</UiAlertDialogFooter>
|
|
59
|
+
</UiAlertDialogContent>
|
|
60
|
+
</UiAlertDialog>
|
|
61
|
+
</template>`;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Alert dialog with Button trigger using `as-child`.
|
|
65
|
+
* This is the recommended pattern from shadcn-vue docs.
|
|
66
|
+
*/
|
|
67
|
+
export const Default: Story = {
|
|
68
|
+
render: () => ({
|
|
69
|
+
components: {
|
|
70
|
+
UiAlertDialog,
|
|
71
|
+
UiAlertDialogAction,
|
|
72
|
+
UiAlertDialogCancel,
|
|
73
|
+
UiAlertDialogContent,
|
|
74
|
+
UiAlertDialogDescription,
|
|
75
|
+
UiAlertDialogFooter,
|
|
76
|
+
UiAlertDialogHeader,
|
|
77
|
+
UiAlertDialogTitle,
|
|
78
|
+
UiAlertDialogTrigger,
|
|
79
|
+
UiButton,
|
|
80
|
+
},
|
|
81
|
+
template: `
|
|
82
|
+
<UiAlertDialog>
|
|
83
|
+
<UiAlertDialogTrigger as-child>
|
|
84
|
+
<UiButton variant="outline">Show Dialog</UiButton>
|
|
85
|
+
</UiAlertDialogTrigger>
|
|
86
|
+
<UiAlertDialogContent>
|
|
87
|
+
<UiAlertDialogHeader>
|
|
88
|
+
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
|
89
|
+
<UiAlertDialogDescription>
|
|
90
|
+
This action cannot be undone. This will permanently delete your
|
|
91
|
+
account and remove your data from our servers.
|
|
92
|
+
</UiAlertDialogDescription>
|
|
93
|
+
</UiAlertDialogHeader>
|
|
94
|
+
<UiAlertDialogFooter>
|
|
95
|
+
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
|
96
|
+
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
|
97
|
+
</UiAlertDialogFooter>
|
|
98
|
+
</UiAlertDialogContent>
|
|
99
|
+
</UiAlertDialog>
|
|
100
|
+
`,
|
|
101
|
+
}),
|
|
102
|
+
parameters: {
|
|
103
|
+
docs: {
|
|
104
|
+
source: {
|
|
105
|
+
code: defaultTemplateSource,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const simpleTemplateSource = `<script setup lang="ts">
|
|
112
|
+
import {
|
|
113
|
+
UiAlertDialog,
|
|
114
|
+
UiAlertDialogAction,
|
|
115
|
+
UiAlertDialogCancel,
|
|
116
|
+
UiAlertDialogContent,
|
|
117
|
+
UiAlertDialogDescription,
|
|
118
|
+
UiAlertDialogFooter,
|
|
119
|
+
UiAlertDialogHeader,
|
|
120
|
+
UiAlertDialogTitle,
|
|
121
|
+
UiAlertDialogTrigger,
|
|
122
|
+
} from '@aleph-alpha/ui-library'
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<template>
|
|
126
|
+
<UiAlertDialog>
|
|
127
|
+
<UiAlertDialogTrigger>Open</UiAlertDialogTrigger>
|
|
128
|
+
<UiAlertDialogContent>
|
|
129
|
+
<UiAlertDialogHeader>
|
|
130
|
+
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
|
131
|
+
<UiAlertDialogDescription>
|
|
132
|
+
This action cannot be undone. This will permanently delete your account
|
|
133
|
+
and remove your data from our servers.
|
|
134
|
+
</UiAlertDialogDescription>
|
|
135
|
+
</UiAlertDialogHeader>
|
|
136
|
+
<UiAlertDialogFooter>
|
|
137
|
+
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
|
138
|
+
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
|
139
|
+
</UiAlertDialogFooter>
|
|
140
|
+
</UiAlertDialogContent>
|
|
141
|
+
</UiAlertDialog>
|
|
142
|
+
</template>`;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Simple alert dialog with plain text trigger.
|
|
146
|
+
*/
|
|
147
|
+
export const Simple: Story = {
|
|
148
|
+
render: () => ({
|
|
149
|
+
components: {
|
|
150
|
+
UiAlertDialog,
|
|
151
|
+
UiAlertDialogAction,
|
|
152
|
+
UiAlertDialogCancel,
|
|
153
|
+
UiAlertDialogContent,
|
|
154
|
+
UiAlertDialogDescription,
|
|
155
|
+
UiAlertDialogFooter,
|
|
156
|
+
UiAlertDialogHeader,
|
|
157
|
+
UiAlertDialogTitle,
|
|
158
|
+
UiAlertDialogTrigger,
|
|
159
|
+
},
|
|
160
|
+
template: `
|
|
161
|
+
<UiAlertDialog>
|
|
162
|
+
<UiAlertDialogTrigger>Open</UiAlertDialogTrigger>
|
|
163
|
+
<UiAlertDialogContent>
|
|
164
|
+
<UiAlertDialogHeader>
|
|
165
|
+
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
|
166
|
+
<UiAlertDialogDescription>
|
|
167
|
+
This action cannot be undone. This will permanently delete your account
|
|
168
|
+
and remove your data from our servers.
|
|
169
|
+
</UiAlertDialogDescription>
|
|
170
|
+
</UiAlertDialogHeader>
|
|
171
|
+
<UiAlertDialogFooter>
|
|
172
|
+
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
|
173
|
+
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
|
174
|
+
</UiAlertDialogFooter>
|
|
175
|
+
</UiAlertDialogContent>
|
|
176
|
+
</UiAlertDialog>
|
|
177
|
+
`,
|
|
178
|
+
}),
|
|
179
|
+
parameters: {
|
|
180
|
+
docs: {
|
|
181
|
+
source: {
|
|
182
|
+
code: simpleTemplateSource,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialog as ShadcnAlertDialog } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { ModelRef } from 'vue';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialog',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const model: ModelRef<boolean> = defineModel<boolean>({
|
|
10
|
+
default: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ShadcnAlertDialog v-model:open="model">
|
|
16
|
+
<slot />
|
|
17
|
+
</ShadcnAlertDialog>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogAction as ShadcnAlertDialogAction } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { UiAlertDialogActionProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialogAction',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAlertDialogActionProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnAlertDialogAction v-bind="props">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnAlertDialogAction>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogCancel as ShadcnAlertDialogCancel } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { UiAlertDialogCancelProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialogCancel',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAlertDialogCancelProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnAlertDialogCancel v-bind="props">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnAlertDialogCancel>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogContent as ShadcnAlertDialogContent } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { UiAlertDialogContentProps, UiAlertDialogContentEmits } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialogContent',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAlertDialogContentProps>();
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits<UiAlertDialogContentEmits>();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ShadcnAlertDialogContent
|
|
16
|
+
v-bind="props"
|
|
17
|
+
@close-auto-focus="emit('closeAutoFocus', $event)"
|
|
18
|
+
@open-auto-focus="emit('openAutoFocus', $event)"
|
|
19
|
+
@focus-outside="emit('focusOutside', $event)"
|
|
20
|
+
@interact-outside="emit('interactOutside', $event)"
|
|
21
|
+
@pointer-down-outside="emit('pointerDownOutside', $event)"
|
|
22
|
+
@escape-key-down="emit('escapeKeydown', $event)"
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</ShadcnAlertDialogContent>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogDescription as ShadcnAlertDialogDescription } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { UiAlertDialogDescriptionProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialogDescription',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAlertDialogDescriptionProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnAlertDialogDescription v-bind="props">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnAlertDialogDescription>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogFooter as ShadcnAlertDialogFooter } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'UiAlertDialogFooter',
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ShadcnAlertDialogFooter>
|
|
11
|
+
<slot />
|
|
12
|
+
</ShadcnAlertDialogFooter>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogHeader as ShadcnAlertDialogHeader } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { UiAlertDialogHeaderProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialogHeader',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAlertDialogHeaderProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnAlertDialogHeader v-bind="props">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnAlertDialogHeader>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogTitle as ShadcnAlertDialogTitle } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
import { UiAlertDialogTitleProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAlertDialogTitle',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAlertDialogTitleProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnAlertDialogTitle v-bind="props">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnAlertDialogTitle>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDialogTrigger as ShadcnAlertDialogTrigger } from '@/primitives/shadcn/alert-dialog';
|
|
3
|
+
|
|
4
|
+
import { UiAlertDialogTriggerProps } from './types';
|
|
5
|
+
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: 'UiAlertDialogTrigger',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const props = defineProps<UiAlertDialogTriggerProps>();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<ShadcnAlertDialogTrigger v-bind="props">
|
|
15
|
+
<slot />
|
|
16
|
+
</ShadcnAlertDialogTrigger>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { render, waitFor } from '@testing-library/vue';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
4
|
+
import {
|
|
5
|
+
UiAlertDialog,
|
|
6
|
+
UiAlertDialogAction,
|
|
7
|
+
UiAlertDialogCancel,
|
|
8
|
+
UiAlertDialogContent,
|
|
9
|
+
UiAlertDialogDescription,
|
|
10
|
+
UiAlertDialogFooter,
|
|
11
|
+
UiAlertDialogHeader,
|
|
12
|
+
UiAlertDialogTitle,
|
|
13
|
+
UiAlertDialogTrigger,
|
|
14
|
+
} from '../index';
|
|
15
|
+
|
|
16
|
+
function renderAlertDialog(options: { open?: boolean } = {}) {
|
|
17
|
+
const { open } = options;
|
|
18
|
+
|
|
19
|
+
return render({
|
|
20
|
+
components: {
|
|
21
|
+
UiAlertDialog,
|
|
22
|
+
UiAlertDialogAction,
|
|
23
|
+
UiAlertDialogCancel,
|
|
24
|
+
UiAlertDialogContent,
|
|
25
|
+
UiAlertDialogDescription,
|
|
26
|
+
UiAlertDialogFooter,
|
|
27
|
+
UiAlertDialogHeader,
|
|
28
|
+
UiAlertDialogTitle,
|
|
29
|
+
UiAlertDialogTrigger,
|
|
30
|
+
},
|
|
31
|
+
template: `
|
|
32
|
+
<UiAlertDialog ${open !== undefined ? ':modelValue="open"' : ''}>
|
|
33
|
+
<UiAlertDialogTrigger>Open</UiAlertDialogTrigger>
|
|
34
|
+
<UiAlertDialogContent>
|
|
35
|
+
<UiAlertDialogHeader>
|
|
36
|
+
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
|
37
|
+
<UiAlertDialogDescription>
|
|
38
|
+
This action cannot be undone.
|
|
39
|
+
</UiAlertDialogDescription>
|
|
40
|
+
</UiAlertDialogHeader>
|
|
41
|
+
<UiAlertDialogFooter>
|
|
42
|
+
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
|
43
|
+
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
|
44
|
+
</UiAlertDialogFooter>
|
|
45
|
+
</UiAlertDialogContent>
|
|
46
|
+
</UiAlertDialog>
|
|
47
|
+
`,
|
|
48
|
+
setup() {
|
|
49
|
+
return { open };
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function renderAlertDialogWithSpy() {
|
|
55
|
+
const onUpdateModelValue = vi.fn();
|
|
56
|
+
|
|
57
|
+
const result = render({
|
|
58
|
+
components: {
|
|
59
|
+
UiAlertDialog,
|
|
60
|
+
UiAlertDialogAction,
|
|
61
|
+
UiAlertDialogCancel,
|
|
62
|
+
UiAlertDialogContent,
|
|
63
|
+
UiAlertDialogDescription,
|
|
64
|
+
UiAlertDialogFooter,
|
|
65
|
+
UiAlertDialogHeader,
|
|
66
|
+
UiAlertDialogTitle,
|
|
67
|
+
UiAlertDialogTrigger,
|
|
68
|
+
},
|
|
69
|
+
template: `
|
|
70
|
+
<UiAlertDialog @update:modelValue="onUpdateModelValue">
|
|
71
|
+
<UiAlertDialogTrigger>Open</UiAlertDialogTrigger>
|
|
72
|
+
<UiAlertDialogContent>
|
|
73
|
+
<UiAlertDialogHeader>
|
|
74
|
+
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
|
75
|
+
<UiAlertDialogDescription>
|
|
76
|
+
This action cannot be undone.
|
|
77
|
+
</UiAlertDialogDescription>
|
|
78
|
+
</UiAlertDialogHeader>
|
|
79
|
+
<UiAlertDialogFooter>
|
|
80
|
+
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
|
81
|
+
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
|
82
|
+
</UiAlertDialogFooter>
|
|
83
|
+
</UiAlertDialogContent>
|
|
84
|
+
</UiAlertDialog>
|
|
85
|
+
`,
|
|
86
|
+
setup() {
|
|
87
|
+
return { onUpdateModelValue };
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return { ...result, onUpdateModelValue };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
describe('UiAlertDialog', () => {
|
|
95
|
+
test('opens when trigger is clicked', async () => {
|
|
96
|
+
const user = userEvent.setup();
|
|
97
|
+
const { getByRole, getByText } = renderAlertDialog();
|
|
98
|
+
|
|
99
|
+
await user.click(getByRole('button', { name: 'Open' }));
|
|
100
|
+
|
|
101
|
+
await waitFor(() => {
|
|
102
|
+
expect(getByText('Are you absolutely sure?')).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('is visible when modelValue is true', async () => {
|
|
107
|
+
const { getByText } = renderAlertDialog({ open: true });
|
|
108
|
+
|
|
109
|
+
await waitFor(() => {
|
|
110
|
+
expect(getByText('Are you absolutely sure?')).toBeInTheDocument();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('closes when Cancel button is clicked', async () => {
|
|
115
|
+
const user = userEvent.setup();
|
|
116
|
+
const { getByRole, queryByText } = renderAlertDialog();
|
|
117
|
+
|
|
118
|
+
await user.click(getByRole('button', { name: 'Open' }));
|
|
119
|
+
await waitFor(() => {
|
|
120
|
+
expect(getByRole('alertdialog')).toBeInTheDocument();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
await user.click(getByRole('button', { name: 'Cancel' }));
|
|
124
|
+
|
|
125
|
+
await waitFor(() => {
|
|
126
|
+
expect(queryByText('Are you absolutely sure?')).not.toBeInTheDocument();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('closes when Action button is clicked', async () => {
|
|
131
|
+
const user = userEvent.setup();
|
|
132
|
+
const { getByRole, queryByText } = renderAlertDialog();
|
|
133
|
+
|
|
134
|
+
await user.click(getByRole('button', { name: 'Open' }));
|
|
135
|
+
await waitFor(() => {
|
|
136
|
+
expect(getByRole('alertdialog')).toBeInTheDocument();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
await user.click(getByRole('button', { name: 'Continue' }));
|
|
140
|
+
|
|
141
|
+
await waitFor(() => {
|
|
142
|
+
expect(queryByText('Are you absolutely sure?')).not.toBeInTheDocument();
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('closes on Escape key press', async () => {
|
|
147
|
+
const user = userEvent.setup();
|
|
148
|
+
const { getByRole, queryByText } = renderAlertDialog();
|
|
149
|
+
|
|
150
|
+
await user.click(getByRole('button', { name: 'Open' }));
|
|
151
|
+
await waitFor(() => {
|
|
152
|
+
expect(getByRole('alertdialog')).toBeInTheDocument();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
await user.keyboard('{Escape}');
|
|
156
|
+
|
|
157
|
+
await waitFor(() => {
|
|
158
|
+
expect(queryByText('Are you absolutely sure?')).not.toBeInTheDocument();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('emits update:modelValue when opened', async () => {
|
|
163
|
+
const user = userEvent.setup();
|
|
164
|
+
const { getByRole, onUpdateModelValue } = renderAlertDialogWithSpy();
|
|
165
|
+
|
|
166
|
+
await user.click(getByRole('button', { name: 'Open' }));
|
|
167
|
+
|
|
168
|
+
expect(onUpdateModelValue).toHaveBeenCalledWith(true);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('emits update:modelValue when closed via Cancel', async () => {
|
|
172
|
+
const user = userEvent.setup();
|
|
173
|
+
const { getByRole, onUpdateModelValue } = renderAlertDialogWithSpy();
|
|
174
|
+
|
|
175
|
+
await user.click(getByRole('button', { name: 'Open' }));
|
|
176
|
+
await waitFor(() => {
|
|
177
|
+
expect(getByRole('alertdialog')).toBeInTheDocument();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
await user.click(getByRole('button', { name: 'Cancel' }));
|
|
181
|
+
|
|
182
|
+
expect(onUpdateModelValue).toHaveBeenCalledWith(false);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as UiAlertDialog } from './UiAlertDialog.vue';
|
|
2
|
+
export { default as UiAlertDialogAction } from './UiAlertDialogAction.vue';
|
|
3
|
+
export { default as UiAlertDialogCancel } from './UiAlertDialogCancel.vue';
|
|
4
|
+
export { default as UiAlertDialogContent } from './UiAlertDialogContent.vue';
|
|
5
|
+
export { default as UiAlertDialogDescription } from './UiAlertDialogDescription.vue';
|
|
6
|
+
export { default as UiAlertDialogFooter } from './UiAlertDialogFooter.vue';
|
|
7
|
+
export { default as UiAlertDialogHeader } from './UiAlertDialogHeader.vue';
|
|
8
|
+
export { default as UiAlertDialogTitle } from './UiAlertDialogTitle.vue';
|
|
9
|
+
export { default as UiAlertDialogTrigger } from './UiAlertDialogTrigger.vue';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common prop inside the sub-components.
|
|
3
|
+
*/
|
|
4
|
+
export type UiAlertSubComponentCommonProps = {
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A modal dialog for confirmations that interrupt the user. Use for
|
|
10
|
+
* destructive actions, important decisions, or critical confirmations.
|
|
11
|
+
*
|
|
12
|
+
* @category Overlays
|
|
13
|
+
* @useCases confirm delete, destructive action, important confirmation, warning
|
|
14
|
+
* @keywords alert, dialog, modal, confirm, warning, destructive, popup
|
|
15
|
+
* @related UiPopover
|
|
16
|
+
*/
|
|
17
|
+
export type UiAlertDialogContentProps = UiAlertSubComponentCommonProps & {
|
|
18
|
+
/**
|
|
19
|
+
* Prop to disable pointer events outside the dialog
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disableOutsidePointerEvents?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Emit options inside the UiAlertDialogContent
|
|
27
|
+
*/
|
|
28
|
+
export type UiAlertDialogContentEmits = {
|
|
29
|
+
/**
|
|
30
|
+
* Event handler called when focus moves to the destructive action after opening.
|
|
31
|
+
*/
|
|
32
|
+
(e: 'openAutoFocus', event: Event): void;
|
|
33
|
+
/**
|
|
34
|
+
* Event handler called when focus moves to the trigger after closing.
|
|
35
|
+
*/
|
|
36
|
+
(e: 'closeAutoFocus', event: Event): void;
|
|
37
|
+
/**
|
|
38
|
+
* Event handler called when interacted outside the component.
|
|
39
|
+
*/
|
|
40
|
+
(e: 'interactOutside', event: Event): void;
|
|
41
|
+
/**
|
|
42
|
+
* Event handler called when focus goes outside the component.
|
|
43
|
+
*/
|
|
44
|
+
(e: 'focusOutside', event: Event): void;
|
|
45
|
+
/**
|
|
46
|
+
* Event handler called when pointer down the component.
|
|
47
|
+
*/
|
|
48
|
+
(e: 'pointerDownOutside', event: Event): void;
|
|
49
|
+
/**
|
|
50
|
+
* Event handler called when the escape key is down.
|
|
51
|
+
*/
|
|
52
|
+
(e: 'escapeKeydown', event: KeyboardEvent): void;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Props for UiAlertDialogTrigger component.
|
|
57
|
+
*/
|
|
58
|
+
export type UiAlertDialogTriggerProps = UiAlertSubComponentCommonProps & {};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Props for UiAlertDialogCancel component.
|
|
62
|
+
*/
|
|
63
|
+
export type UiAlertDialogCancelProps = UiAlertSubComponentCommonProps & {};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Props for UiAlertDialogAction component.
|
|
67
|
+
*/
|
|
68
|
+
export type UiAlertDialogActionProps = UiAlertSubComponentCommonProps & {};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Props for UiAlertDialogHeader component.
|
|
72
|
+
*/
|
|
73
|
+
export type UiAlertDialogHeaderProps = UiAlertSubComponentCommonProps & {};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Props for UiAlertDialogTitle component.
|
|
77
|
+
*/
|
|
78
|
+
export type UiAlertDialogTitleProps = UiAlertSubComponentCommonProps & {};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Props for UiAlertDialogDescription component.
|
|
82
|
+
*/
|
|
83
|
+
export type UiAlertDialogDescriptionProps = UiAlertSubComponentCommonProps & {};
|