@aleph-alpha/ui-library 1.9.0 → 1.11.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/system/index-CkH7HQaa.js +7 -0
- package/dist/system/index-CuHwEAQ_.js +7 -0
- package/dist/system/index.d.ts +1322 -318
- package/dist/system/lib.js +8839 -6993
- package/package.json +2 -1
- 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,198 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
|
+
import { render, waitFor } from '@testing-library/vue';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
5
|
+
import { ref } from 'vue';
|
|
6
|
+
import { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent } from '../index';
|
|
7
|
+
|
|
8
|
+
describe('UiAccordion', () => {
|
|
9
|
+
test('emits update:modelValue with string when item is expanded (single mode)', async () => {
|
|
10
|
+
const user = userEvent.setup();
|
|
11
|
+
const onUpdateModelValue = vi.fn();
|
|
12
|
+
|
|
13
|
+
const { getByRole } = render({
|
|
14
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
15
|
+
template: `
|
|
16
|
+
<UiAccordion type="single" collapsible @update:modelValue="onUpdateModelValue">
|
|
17
|
+
<UiAccordionItem value="item-1">
|
|
18
|
+
<UiAccordionTrigger>Item 1</UiAccordionTrigger>
|
|
19
|
+
<UiAccordionContent>Content 1</UiAccordionContent>
|
|
20
|
+
</UiAccordionItem>
|
|
21
|
+
<UiAccordionItem value="item-2">
|
|
22
|
+
<UiAccordionTrigger>Item 2</UiAccordionTrigger>
|
|
23
|
+
<UiAccordionContent>Content 2</UiAccordionContent>
|
|
24
|
+
</UiAccordionItem>
|
|
25
|
+
</UiAccordion>
|
|
26
|
+
`,
|
|
27
|
+
setup() {
|
|
28
|
+
return { onUpdateModelValue };
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
await user.click(getByRole('button', { name: 'Item 1' }));
|
|
33
|
+
|
|
34
|
+
expect(onUpdateModelValue).toHaveBeenCalledWith('item-1');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('emits update:modelValue with array when item is toggled (multiple mode)', async () => {
|
|
38
|
+
const user = userEvent.setup();
|
|
39
|
+
const onUpdateModelValue = vi.fn();
|
|
40
|
+
|
|
41
|
+
const { getByRole } = render({
|
|
42
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
43
|
+
template: `
|
|
44
|
+
<UiAccordion type="multiple" @update:modelValue="onUpdateModelValue">
|
|
45
|
+
<UiAccordionItem value="item-1">
|
|
46
|
+
<UiAccordionTrigger>Item 1</UiAccordionTrigger>
|
|
47
|
+
<UiAccordionContent>Content 1</UiAccordionContent>
|
|
48
|
+
</UiAccordionItem>
|
|
49
|
+
<UiAccordionItem value="item-2">
|
|
50
|
+
<UiAccordionTrigger>Item 2</UiAccordionTrigger>
|
|
51
|
+
<UiAccordionContent>Content 2</UiAccordionContent>
|
|
52
|
+
</UiAccordionItem>
|
|
53
|
+
</UiAccordion>
|
|
54
|
+
`,
|
|
55
|
+
setup() {
|
|
56
|
+
return { onUpdateModelValue };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
await user.click(getByRole('button', { name: 'Item 1' }));
|
|
61
|
+
|
|
62
|
+
expect(onUpdateModelValue).toHaveBeenCalledWith(['item-1']);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('reflects controlled modelValue', async () => {
|
|
66
|
+
const { getByRole, getByText } = render({
|
|
67
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
68
|
+
template: `
|
|
69
|
+
<UiAccordion type="single" collapsible :model-value="value">
|
|
70
|
+
<UiAccordionItem value="item-1">
|
|
71
|
+
<UiAccordionTrigger>Item 1</UiAccordionTrigger>
|
|
72
|
+
<UiAccordionContent>Content 1</UiAccordionContent>
|
|
73
|
+
</UiAccordionItem>
|
|
74
|
+
<UiAccordionItem value="item-2">
|
|
75
|
+
<UiAccordionTrigger>Item 2</UiAccordionTrigger>
|
|
76
|
+
<UiAccordionContent>Content 2</UiAccordionContent>
|
|
77
|
+
</UiAccordionItem>
|
|
78
|
+
</UiAccordion>
|
|
79
|
+
`,
|
|
80
|
+
setup() {
|
|
81
|
+
const value = ref('item-2');
|
|
82
|
+
return { value };
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
await waitFor(() => {
|
|
87
|
+
expect(getByRole('button', { name: 'Item 2' })).toHaveAttribute('data-state', 'open');
|
|
88
|
+
expect(getByText('Content 2')).toBeVisible();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('disabled items do not respond to clicks', async () => {
|
|
93
|
+
const user = userEvent.setup();
|
|
94
|
+
const { getByRole } = render({
|
|
95
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
96
|
+
template: `
|
|
97
|
+
<UiAccordion type="single" collapsible>
|
|
98
|
+
<UiAccordionItem value="item-1" :disabled="true">
|
|
99
|
+
<UiAccordionTrigger>Disabled Item</UiAccordionTrigger>
|
|
100
|
+
<UiAccordionContent>Content</UiAccordionContent>
|
|
101
|
+
</UiAccordionItem>
|
|
102
|
+
</UiAccordion>
|
|
103
|
+
`,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const trigger = getByRole('button', { name: 'Disabled Item' });
|
|
107
|
+
expect(trigger).toBeDisabled();
|
|
108
|
+
|
|
109
|
+
await user.click(trigger);
|
|
110
|
+
|
|
111
|
+
await waitFor(() => {
|
|
112
|
+
expect(trigger).toHaveAttribute('data-state', 'closed');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('collapses open item when collapsible is true (single mode)', async () => {
|
|
117
|
+
const user = userEvent.setup();
|
|
118
|
+
const { getByRole } = render({
|
|
119
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
120
|
+
template: `
|
|
121
|
+
<UiAccordion type="single" collapsible>
|
|
122
|
+
<UiAccordionItem value="item-1">
|
|
123
|
+
<UiAccordionTrigger>Item 1</UiAccordionTrigger>
|
|
124
|
+
<UiAccordionContent>Content 1</UiAccordionContent>
|
|
125
|
+
</UiAccordionItem>
|
|
126
|
+
</UiAccordion>
|
|
127
|
+
`,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const trigger = getByRole('button', { name: 'Item 1' });
|
|
131
|
+
|
|
132
|
+
// Open the item
|
|
133
|
+
await user.click(trigger);
|
|
134
|
+
await waitFor(() => {
|
|
135
|
+
expect(trigger).toHaveAttribute('data-state', 'open');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Click again to collapse
|
|
139
|
+
await user.click(trigger);
|
|
140
|
+
await waitFor(() => {
|
|
141
|
+
expect(trigger).toHaveAttribute('data-state', 'closed');
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('expands items specified in defaultValue on initial render', async () => {
|
|
146
|
+
const { getByRole, getByText } = render({
|
|
147
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
148
|
+
template: `
|
|
149
|
+
<UiAccordion type="single" default-value="item-2">
|
|
150
|
+
<UiAccordionItem value="item-1">
|
|
151
|
+
<UiAccordionTrigger>Item 1</UiAccordionTrigger>
|
|
152
|
+
<UiAccordionContent>Content 1</UiAccordionContent>
|
|
153
|
+
</UiAccordionItem>
|
|
154
|
+
<UiAccordionItem value="item-2">
|
|
155
|
+
<UiAccordionTrigger>Item 2</UiAccordionTrigger>
|
|
156
|
+
<UiAccordionContent>Content 2</UiAccordionContent>
|
|
157
|
+
</UiAccordionItem>
|
|
158
|
+
</UiAccordion>
|
|
159
|
+
`,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
await waitFor(() => {
|
|
163
|
+
expect(getByRole('button', { name: 'Item 1' })).toHaveAttribute('data-state', 'closed');
|
|
164
|
+
expect(getByRole('button', { name: 'Item 2' })).toHaveAttribute('data-state', 'open');
|
|
165
|
+
expect(getByText('Content 2')).toBeVisible();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('expands multiple items specified in defaultValue (multiple mode)', async () => {
|
|
170
|
+
const { getByRole, getByText } = render({
|
|
171
|
+
components: { UiAccordion, UiAccordionItem, UiAccordionTrigger, UiAccordionContent },
|
|
172
|
+
template: `
|
|
173
|
+
<UiAccordion type="multiple" :default-value="['item-1', 'item-3']">
|
|
174
|
+
<UiAccordionItem value="item-1">
|
|
175
|
+
<UiAccordionTrigger>Item 1</UiAccordionTrigger>
|
|
176
|
+
<UiAccordionContent>Content 1</UiAccordionContent>
|
|
177
|
+
</UiAccordionItem>
|
|
178
|
+
<UiAccordionItem value="item-2">
|
|
179
|
+
<UiAccordionTrigger>Item 2</UiAccordionTrigger>
|
|
180
|
+
<UiAccordionContent>Content 2</UiAccordionContent>
|
|
181
|
+
</UiAccordionItem>
|
|
182
|
+
<UiAccordionItem value="item-3">
|
|
183
|
+
<UiAccordionTrigger>Item 3</UiAccordionTrigger>
|
|
184
|
+
<UiAccordionContent>Content 3</UiAccordionContent>
|
|
185
|
+
</UiAccordionItem>
|
|
186
|
+
</UiAccordion>
|
|
187
|
+
`,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
await waitFor(() => {
|
|
191
|
+
expect(getByRole('button', { name: 'Item 1' })).toHaveAttribute('data-state', 'open');
|
|
192
|
+
expect(getByRole('button', { name: 'Item 2' })).toHaveAttribute('data-state', 'closed');
|
|
193
|
+
expect(getByRole('button', { name: 'Item 3' })).toHaveAttribute('data-state', 'open');
|
|
194
|
+
expect(getByText('Content 1')).toBeVisible();
|
|
195
|
+
expect(getByText('Content 3')).toBeVisible();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as UiAccordion } from './UiAccordion.vue';
|
|
2
|
+
export { default as UiAccordionItem } from './UiAccordionItem.vue';
|
|
3
|
+
export { default as UiAccordionTrigger } from './UiAccordionTrigger.vue';
|
|
4
|
+
export { default as UiAccordionContent } from './UiAccordionContent.vue';
|
|
5
|
+
|
|
6
|
+
export * from './types';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** The type of accordion - single or multiple open items allowed. */
|
|
2
|
+
export type UiAccordionType = 'single' | 'multiple';
|
|
3
|
+
|
|
4
|
+
/** Reading direction for the accordion. */
|
|
5
|
+
export type UiAccordionDir = 'ltr' | 'rtl';
|
|
6
|
+
|
|
7
|
+
/** Orientation of the accordion. */
|
|
8
|
+
export type UiAccordionOrientation = 'horizontal' | 'vertical';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props for the UiAccordion root component (single mode).
|
|
12
|
+
*/
|
|
13
|
+
export type UiAccordionSingleProps = {
|
|
14
|
+
/** Accordion type - 'single' allows only one item open at a time. */
|
|
15
|
+
type: 'single';
|
|
16
|
+
/** The controlled value of the expanded item when using `v-model` for two-way binding. */
|
|
17
|
+
modelValue?: string;
|
|
18
|
+
/** The value of the item that should be expanded when initially rendered (uncontrolled). */
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
/** Whether the accordion can be collapsed (all items closed). Only applicable when type is 'single'. */
|
|
21
|
+
collapsible?: boolean;
|
|
22
|
+
/** Whether the accordion is disabled. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** The reading direction. */
|
|
25
|
+
dir?: UiAccordionDir;
|
|
26
|
+
/** The orientation of the accordion. */
|
|
27
|
+
orientation?: UiAccordionOrientation;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Props for the UiAccordion root component (multiple mode).
|
|
32
|
+
*/
|
|
33
|
+
export type UiAccordionMultipleProps = {
|
|
34
|
+
/** Accordion type - 'multiple' allows multiple items open at once. */
|
|
35
|
+
type: 'multiple';
|
|
36
|
+
/** The controlled value of the expanded items when using `v-model` for two-way binding. */
|
|
37
|
+
modelValue?: string[];
|
|
38
|
+
/** The values of the items that should be expanded when initially rendered (uncontrolled). */
|
|
39
|
+
defaultValue?: string[];
|
|
40
|
+
/** Whether the accordion is disabled. */
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/** The reading direction. */
|
|
43
|
+
dir?: UiAccordionDir;
|
|
44
|
+
/** The orientation of the accordion. */
|
|
45
|
+
orientation?: UiAccordionOrientation;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Collapsible sections for organizing content. Use for FAQs,
|
|
50
|
+
* settings panels, or any content that benefits from show/hide.
|
|
51
|
+
*
|
|
52
|
+
* @category Navigation
|
|
53
|
+
* @useCases FAQ section, settings panel, collapsible content, expandable list
|
|
54
|
+
* @keywords accordion, collapse, expand, faq, panel, section, toggle
|
|
55
|
+
* @related UiTabs
|
|
56
|
+
*/
|
|
57
|
+
export type UiAccordionProps = UiAccordionSingleProps | UiAccordionMultipleProps;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Emits for the UiAccordion root component.
|
|
61
|
+
*/
|
|
62
|
+
export type UiAccordionEmits = {
|
|
63
|
+
/**
|
|
64
|
+
* Emitted when the expanded item(s) change.
|
|
65
|
+
* - Single mode: `string` (item value) or `undefined` (when collapsed)
|
|
66
|
+
* - Multiple mode: `string[]` (array of item values)
|
|
67
|
+
*/
|
|
68
|
+
'update:modelValue': [value: string | string[] | undefined];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Props for the UiAccordionItem component.
|
|
73
|
+
*/
|
|
74
|
+
export type UiAccordionItemProps = {
|
|
75
|
+
/** Unique value that identifies the accordion item (required). */
|
|
76
|
+
value: string;
|
|
77
|
+
/** Whether the accordion item is disabled. */
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Props for the UiAccordionTrigger component.
|
|
83
|
+
*/
|
|
84
|
+
export type UiAccordionTriggerProps = {
|
|
85
|
+
/** Whether the trigger element is an `asChild` element. */
|
|
86
|
+
asChild?: boolean;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Props for the UiAccordionContent component.
|
|
91
|
+
*/
|
|
92
|
+
export type UiAccordionContentProps = {
|
|
93
|
+
/** Force mounting when more control is needed (useful for animations). */
|
|
94
|
+
forceMount?: boolean;
|
|
95
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import { UiAlert, UiAlertDescription, UiAlertTitle } from './index';
|
|
3
|
+
import { AlertVariants } from './constants';
|
|
4
|
+
import { UiIcon } from '../UiIcon';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof UiAlert> = {
|
|
7
|
+
title: 'Primitives/UiAlert',
|
|
8
|
+
component: UiAlert,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: AlertVariants,
|
|
14
|
+
description: 'The visual style of the alert',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
variant: 'default',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof UiAlert>;
|
|
25
|
+
|
|
26
|
+
const defaultTemplateSource = `<script setup lang="ts">
|
|
27
|
+
import { UiAlert, UiAlertDescription, UiAlertTitle, UiIcon } from '@aleph-alpha/ui-library'
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<UiAlert>
|
|
32
|
+
<UiIcon icon="i-material-symbols-check-circle" class="size-4" />
|
|
33
|
+
<UiAlertTitle>Success! Your changes have been saved</UiAlertTitle>
|
|
34
|
+
<UiAlertDescription>
|
|
35
|
+
This is an alert with icon, title and description.
|
|
36
|
+
</UiAlertDescription>
|
|
37
|
+
</UiAlert>
|
|
38
|
+
</template>`;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Default alert with icon, title and description.
|
|
42
|
+
*/
|
|
43
|
+
export const Default: Story = {
|
|
44
|
+
render: (args) => ({
|
|
45
|
+
components: {
|
|
46
|
+
UiAlert,
|
|
47
|
+
UiAlertDescription,
|
|
48
|
+
UiAlertTitle,
|
|
49
|
+
UiIcon,
|
|
50
|
+
},
|
|
51
|
+
setup() {
|
|
52
|
+
return { args };
|
|
53
|
+
},
|
|
54
|
+
template: `
|
|
55
|
+
<UiAlert :variant="args.variant">
|
|
56
|
+
<UiIcon icon="i-material-symbols-check-circle" class="size-4" />
|
|
57
|
+
<UiAlertTitle>Success! Your changes have been saved</UiAlertTitle>
|
|
58
|
+
<UiAlertDescription>
|
|
59
|
+
This is an alert with icon, title and description.
|
|
60
|
+
</UiAlertDescription>
|
|
61
|
+
</UiAlert>
|
|
62
|
+
`,
|
|
63
|
+
}),
|
|
64
|
+
parameters: {
|
|
65
|
+
docs: {
|
|
66
|
+
source: {
|
|
67
|
+
code: defaultTemplateSource,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const destructiveTemplateSource = `<script setup lang="ts">
|
|
74
|
+
import { UiAlert, UiAlertDescription, UiAlertTitle, UiIcon } from '@aleph-alpha/ui-library'
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<UiAlert variant="destructive">
|
|
79
|
+
<UiIcon icon="i-material-symbols-error" class="size-4" />
|
|
80
|
+
<UiAlertTitle>Unable to process your payment.</UiAlertTitle>
|
|
81
|
+
<UiAlertDescription>
|
|
82
|
+
<p>Please verify your billing information and try again.</p>
|
|
83
|
+
<ul class="mt-2 list-inside list-disc space-y-1">
|
|
84
|
+
<li>Check your card details</li>
|
|
85
|
+
<li>Ensure sufficient funds</li>
|
|
86
|
+
<li>Verify billing address</li>
|
|
87
|
+
</ul>
|
|
88
|
+
</UiAlertDescription>
|
|
89
|
+
</UiAlert>
|
|
90
|
+
</template>`;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Destructive alert variant for errors or critical warnings.
|
|
94
|
+
*/
|
|
95
|
+
export const Destructive: Story = {
|
|
96
|
+
render: () => ({
|
|
97
|
+
components: {
|
|
98
|
+
UiAlert,
|
|
99
|
+
UiAlertDescription,
|
|
100
|
+
UiAlertTitle,
|
|
101
|
+
UiIcon,
|
|
102
|
+
},
|
|
103
|
+
template: `
|
|
104
|
+
<UiAlert variant="destructive">
|
|
105
|
+
<UiIcon icon="i-material-symbols-error" class="size-4" />
|
|
106
|
+
<UiAlertTitle>Unable to process your payment.</UiAlertTitle>
|
|
107
|
+
<UiAlertDescription>
|
|
108
|
+
<p>Please verify your billing information and try again.</p>
|
|
109
|
+
<ul class="mt-2 list-inside list-disc space-y-1">
|
|
110
|
+
<li>Check your card details</li>
|
|
111
|
+
<li>Ensure sufficient funds</li>
|
|
112
|
+
<li>Verify billing address</li>
|
|
113
|
+
</ul>
|
|
114
|
+
</UiAlertDescription>
|
|
115
|
+
</UiAlert>
|
|
116
|
+
`,
|
|
117
|
+
}),
|
|
118
|
+
parameters: {
|
|
119
|
+
docs: {
|
|
120
|
+
source: {
|
|
121
|
+
code: destructiveTemplateSource,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const allVariantsTemplateSource = `<script setup lang="ts">
|
|
128
|
+
import { UiAlert, UiAlertDescription, UiAlertTitle, UiIcon } from '@aleph-alpha/ui-library'
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<template>
|
|
132
|
+
<div class="flex flex-col gap-4">
|
|
133
|
+
<UiAlert>
|
|
134
|
+
<UiIcon icon="i-material-symbols-check-circle" class="size-4" />
|
|
135
|
+
<UiAlertTitle>Success! Your changes have been saved</UiAlertTitle>
|
|
136
|
+
<UiAlertDescription>
|
|
137
|
+
This is an alert with icon, title and description.
|
|
138
|
+
</UiAlertDescription>
|
|
139
|
+
</UiAlert>
|
|
140
|
+
|
|
141
|
+
<UiAlert variant="destructive">
|
|
142
|
+
<UiIcon icon="i-material-symbols-error" class="size-4" />
|
|
143
|
+
<UiAlertTitle>Unable to process your payment.</UiAlertTitle>
|
|
144
|
+
<UiAlertDescription>
|
|
145
|
+
<p>Please verify your billing information and try again.</p>
|
|
146
|
+
<ul class="mt-2 list-inside list-disc space-y-1">
|
|
147
|
+
<li>Check your card details</li>
|
|
148
|
+
<li>Ensure sufficient funds</li>
|
|
149
|
+
<li>Verify billing address</li>
|
|
150
|
+
</ul>
|
|
151
|
+
</UiAlertDescription>
|
|
152
|
+
</UiAlert>
|
|
153
|
+
</div>
|
|
154
|
+
</template>`;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* All available alert variants side by side.
|
|
158
|
+
*/
|
|
159
|
+
export const AllVariants: Story = {
|
|
160
|
+
render: () => ({
|
|
161
|
+
components: {
|
|
162
|
+
UiAlert,
|
|
163
|
+
UiAlertDescription,
|
|
164
|
+
UiAlertTitle,
|
|
165
|
+
UiIcon,
|
|
166
|
+
},
|
|
167
|
+
template: `
|
|
168
|
+
<div class="flex flex-col gap-4">
|
|
169
|
+
<UiAlert>
|
|
170
|
+
<UiIcon icon="i-material-symbols-check-circle" class="size-4" />
|
|
171
|
+
<UiAlertTitle>Success! Your changes have been saved</UiAlertTitle>
|
|
172
|
+
<UiAlertDescription>
|
|
173
|
+
This is an alert with icon, title and description.
|
|
174
|
+
</UiAlertDescription>
|
|
175
|
+
</UiAlert>
|
|
176
|
+
|
|
177
|
+
<UiAlert variant="destructive">
|
|
178
|
+
<UiIcon icon="i-material-symbols-error" class="size-4" />
|
|
179
|
+
<UiAlertTitle>Unable to process your payment.</UiAlertTitle>
|
|
180
|
+
<UiAlertDescription>
|
|
181
|
+
<p>Please verify your billing information and try again.</p>
|
|
182
|
+
<ul class="mt-2 list-inside list-disc space-y-1">
|
|
183
|
+
<li>Check your card details</li>
|
|
184
|
+
<li>Ensure sufficient funds</li>
|
|
185
|
+
<li>Verify billing address</li>
|
|
186
|
+
</ul>
|
|
187
|
+
</UiAlertDescription>
|
|
188
|
+
</UiAlert>
|
|
189
|
+
</div>
|
|
190
|
+
`,
|
|
191
|
+
}),
|
|
192
|
+
parameters: {
|
|
193
|
+
docs: {
|
|
194
|
+
source: {
|
|
195
|
+
code: allVariantsTemplateSource,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Alert as ShadcnAlert } from '@/primitives/shadcn/alert';
|
|
3
|
+
|
|
4
|
+
import { UiAlertProps } from './types';
|
|
5
|
+
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: 'UiAlert',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
withDefaults(defineProps<UiAlertProps>(), {
|
|
11
|
+
variant: 'default',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* shadcn-vue `Alert` styles are optimized for SVG icons (`has-[>svg]...`).
|
|
16
|
+
* Our `UiIcon` renders as `<span data-slot="icon" ... />`, so we mirror the same
|
|
17
|
+
* layout rules for `[data-slot=icon]` to keep alignment consistent.
|
|
18
|
+
*/
|
|
19
|
+
const uiIconLayoutClasses =
|
|
20
|
+
'has-[>[data-slot=icon]]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>[data-slot=icon]]:gap-x-3 [&>[data-slot=icon]]:size-4 [&>[data-slot=icon]]:translate-y-0.5 [&>[data-slot=icon]]:text-current';
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<ShadcnAlert :variant :class="uiIconLayoutClasses">
|
|
25
|
+
<slot />
|
|
26
|
+
</ShadcnAlert>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AlertDescription as ShadcnAlertDescription } from '@/primitives/shadcn/alert';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'UiAlertDescription',
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ShadcnAlertDescription>
|
|
11
|
+
<slot />
|
|
12
|
+
</ShadcnAlertDescription>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render } from '@testing-library/vue';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import UiAlert from '../UiAlert.vue';
|
|
4
|
+
|
|
5
|
+
describe('UiAlert', () => {
|
|
6
|
+
test('has alert role for screen readers', () => {
|
|
7
|
+
const { getByRole } = render(UiAlert, {
|
|
8
|
+
slots: { default: 'Message' },
|
|
9
|
+
});
|
|
10
|
+
expect(getByRole('alert')).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('accepts destructive variant', () => {
|
|
14
|
+
const { getByRole } = render(UiAlert, {
|
|
15
|
+
props: { variant: 'destructive' },
|
|
16
|
+
slots: { default: 'Message' },
|
|
17
|
+
});
|
|
18
|
+
expect(getByRole('alert')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type UiAlertVariants = 'default' | 'destructive';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A highlighted message box for important information. Use for
|
|
5
|
+
* success messages, warnings, errors, or informational notices.
|
|
6
|
+
*
|
|
7
|
+
* @category Feedback
|
|
8
|
+
* @useCases success message, error notice, warning, info banner, notification
|
|
9
|
+
* @keywords alert, message, notice, warning, error, success, info, banner
|
|
10
|
+
* @related UiAlertDialog
|
|
11
|
+
*/
|
|
12
|
+
export type UiAlertProps = {
|
|
13
|
+
variant?: UiAlertVariants;
|
|
14
|
+
};
|