@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,505 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import {
|
|
3
|
+
UiTable,
|
|
4
|
+
UiTableHeader,
|
|
5
|
+
UiTableBody,
|
|
6
|
+
UiTableFooter,
|
|
7
|
+
UiTableRow,
|
|
8
|
+
UiTableHead,
|
|
9
|
+
UiTableCell,
|
|
10
|
+
UiTableCaption,
|
|
11
|
+
UiTableEmpty,
|
|
12
|
+
} from './index';
|
|
13
|
+
import {
|
|
14
|
+
UiDropdownMenu,
|
|
15
|
+
UiDropdownMenuTrigger,
|
|
16
|
+
UiDropdownMenuContent,
|
|
17
|
+
UiDropdownMenuItem,
|
|
18
|
+
UiDropdownMenuLabel,
|
|
19
|
+
UiDropdownMenuSeparator,
|
|
20
|
+
} from '../UiDropdownMenu';
|
|
21
|
+
import { UiButton } from '../UiButton';
|
|
22
|
+
import { UiIcon } from '../UiIcon';
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'Primitives/UiTable',
|
|
26
|
+
component: UiTable,
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component:
|
|
32
|
+
'The `UiTable` primitives are low-level components used to build accessible and styled tables. They correspond directly to standard HTML table elements (`table`, `thead`, `tbody`, `tr`, `td`, `th`, `caption`) but come with pre-configured styles. Use these when you need full control over the table layout or for static content. For complex data-driven tables with sorting and pagination, use `UiDataTable`.',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
argTypes: {},
|
|
37
|
+
} satisfies Meta<typeof UiTable>;
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
|
|
42
|
+
const invoices = [
|
|
43
|
+
{
|
|
44
|
+
invoice: 'INV001',
|
|
45
|
+
paymentStatus: 'Paid',
|
|
46
|
+
totalAmount: '€250.00',
|
|
47
|
+
paymentMethod: 'Credit Card',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
invoice: 'INV002',
|
|
51
|
+
paymentStatus: 'Pending',
|
|
52
|
+
totalAmount: '€150.00',
|
|
53
|
+
paymentMethod: 'PayPal',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
invoice: 'INV003',
|
|
57
|
+
paymentStatus: 'Unpaid',
|
|
58
|
+
totalAmount: '€350.00',
|
|
59
|
+
paymentMethod: 'Bank Transfer',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
invoice: 'INV004',
|
|
63
|
+
paymentStatus: 'Paid',
|
|
64
|
+
totalAmount: '€450.00',
|
|
65
|
+
paymentMethod: 'Credit Card',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
invoice: 'INV005',
|
|
69
|
+
paymentStatus: 'Paid',
|
|
70
|
+
totalAmount: '€550.00',
|
|
71
|
+
paymentMethod: 'PayPal',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
invoice: 'INV006',
|
|
75
|
+
paymentStatus: 'Pending',
|
|
76
|
+
totalAmount: '€200.00',
|
|
77
|
+
paymentMethod: 'Bank Transfer',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
invoice: 'INV007',
|
|
81
|
+
paymentStatus: 'Unpaid',
|
|
82
|
+
totalAmount: '€300.00',
|
|
83
|
+
paymentMethod: 'Credit Card',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const basicTemplateSource = `<script setup lang="ts">
|
|
88
|
+
import {
|
|
89
|
+
UiTable,
|
|
90
|
+
UiTableHeader,
|
|
91
|
+
UiTableBody,
|
|
92
|
+
UiTableFooter,
|
|
93
|
+
UiTableRow,
|
|
94
|
+
UiTableHead,
|
|
95
|
+
UiTableCell,
|
|
96
|
+
UiTableCaption,
|
|
97
|
+
} from '@aleph-alpha/ui-library'
|
|
98
|
+
|
|
99
|
+
const invoices = [
|
|
100
|
+
{ invoice: 'INV001', paymentStatus: 'Paid', totalAmount: '€250.00', paymentMethod: 'Credit Card' },
|
|
101
|
+
{ invoice: 'INV002', paymentStatus: 'Pending', totalAmount: '€150.00', paymentMethod: 'PayPal' },
|
|
102
|
+
{ invoice: 'INV003', paymentStatus: 'Unpaid', totalAmount: '€350.00', paymentMethod: 'Bank Transfer' },
|
|
103
|
+
]
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<UiTable>
|
|
108
|
+
<UiTableCaption>A list of your recent invoices.</UiTableCaption>
|
|
109
|
+
<UiTableHeader>
|
|
110
|
+
<UiTableRow>
|
|
111
|
+
<UiTableHead class="w-[100px]">Invoice</UiTableHead>
|
|
112
|
+
<UiTableHead>Status</UiTableHead>
|
|
113
|
+
<UiTableHead>Method</UiTableHead>
|
|
114
|
+
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
115
|
+
</UiTableRow>
|
|
116
|
+
</UiTableHeader>
|
|
117
|
+
<UiTableBody>
|
|
118
|
+
<UiTableRow v-for="invoice in invoices" :key="invoice.invoice">
|
|
119
|
+
<UiTableCell class="font-medium">{{ invoice.invoice }}</UiTableCell>
|
|
120
|
+
<UiTableCell>{{ invoice.paymentStatus }}</UiTableCell>
|
|
121
|
+
<UiTableCell>{{ invoice.paymentMethod }}</UiTableCell>
|
|
122
|
+
<UiTableCell class="text-right">{{ invoice.totalAmount }}</UiTableCell>
|
|
123
|
+
</UiTableRow>
|
|
124
|
+
</UiTableBody>
|
|
125
|
+
<UiTableFooter>
|
|
126
|
+
<UiTableRow>
|
|
127
|
+
<UiTableCell colspan="3">Total</UiTableCell>
|
|
128
|
+
<UiTableCell class="text-right">€2,500.00</UiTableCell>
|
|
129
|
+
</UiTableRow>
|
|
130
|
+
</UiTableFooter>
|
|
131
|
+
</UiTable>
|
|
132
|
+
</template>`;
|
|
133
|
+
|
|
134
|
+
const basicTemplate = `
|
|
135
|
+
<UiTable>
|
|
136
|
+
<UiTableCaption>A list of your recent invoices.</UiTableCaption>
|
|
137
|
+
<UiTableHeader>
|
|
138
|
+
<UiTableRow>
|
|
139
|
+
<UiTableHead class="w-[100px]">Invoice</UiTableHead>
|
|
140
|
+
<UiTableHead>Status</UiTableHead>
|
|
141
|
+
<UiTableHead>Method</UiTableHead>
|
|
142
|
+
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
143
|
+
</UiTableRow>
|
|
144
|
+
</UiTableHeader>
|
|
145
|
+
<UiTableBody>
|
|
146
|
+
<UiTableRow v-for="invoice in invoices" :key="invoice.invoice">
|
|
147
|
+
<UiTableCell class="font-medium">{{ invoice.invoice }}</UiTableCell>
|
|
148
|
+
<UiTableCell>{{ invoice.paymentStatus }}</UiTableCell>
|
|
149
|
+
<UiTableCell>{{ invoice.paymentMethod }}</UiTableCell>
|
|
150
|
+
<UiTableCell class="text-right">{{ invoice.totalAmount }}</UiTableCell>
|
|
151
|
+
</UiTableRow>
|
|
152
|
+
</UiTableBody>
|
|
153
|
+
<UiTableFooter>
|
|
154
|
+
<UiTableRow>
|
|
155
|
+
<UiTableCell colspan="3">Total</UiTableCell>
|
|
156
|
+
<UiTableCell class="text-right">€2,500.00</UiTableCell>
|
|
157
|
+
</UiTableRow>
|
|
158
|
+
</UiTableFooter>
|
|
159
|
+
</UiTable>
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* A standard table example showing how to compose UiTable components.
|
|
164
|
+
*/
|
|
165
|
+
export const Basic: Story = {
|
|
166
|
+
parameters: {
|
|
167
|
+
docs: {
|
|
168
|
+
description: {
|
|
169
|
+
story:
|
|
170
|
+
'A standard table example showing how to compose `UiTable`, `UiTableHeader`, `UiTableBody`, `UiTableRow`, `UiTableCell`, and `UiTableFooter`.',
|
|
171
|
+
},
|
|
172
|
+
source: {
|
|
173
|
+
code: basicTemplateSource,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
render: () => ({
|
|
178
|
+
components: {
|
|
179
|
+
UiTable,
|
|
180
|
+
UiTableHeader,
|
|
181
|
+
UiTableBody,
|
|
182
|
+
UiTableFooter,
|
|
183
|
+
UiTableRow,
|
|
184
|
+
UiTableHead,
|
|
185
|
+
UiTableCell,
|
|
186
|
+
UiTableCaption,
|
|
187
|
+
},
|
|
188
|
+
setup() {
|
|
189
|
+
return { invoices };
|
|
190
|
+
},
|
|
191
|
+
template: basicTemplate,
|
|
192
|
+
}),
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const withRowActionsTemplateSource = `<script setup lang="ts">
|
|
196
|
+
import {
|
|
197
|
+
UiTable,
|
|
198
|
+
UiTableHeader,
|
|
199
|
+
UiTableBody,
|
|
200
|
+
UiTableRow,
|
|
201
|
+
UiTableHead,
|
|
202
|
+
UiTableCell,
|
|
203
|
+
UiDropdownMenu,
|
|
204
|
+
UiDropdownMenuTrigger,
|
|
205
|
+
UiDropdownMenuContent,
|
|
206
|
+
UiDropdownMenuItem,
|
|
207
|
+
UiDropdownMenuLabel,
|
|
208
|
+
UiDropdownMenuSeparator,
|
|
209
|
+
UiButton,
|
|
210
|
+
UiIcon,
|
|
211
|
+
} from '@aleph-alpha/ui-library'
|
|
212
|
+
|
|
213
|
+
const invoices = [
|
|
214
|
+
{ invoice: 'INV001', paymentStatus: 'Paid', totalAmount: '€250.00', paymentMethod: 'Credit Card' },
|
|
215
|
+
{ invoice: 'INV002', paymentStatus: 'Pending', totalAmount: '€150.00', paymentMethod: 'PayPal' },
|
|
216
|
+
]
|
|
217
|
+
</script>
|
|
218
|
+
|
|
219
|
+
<template>
|
|
220
|
+
<UiTable>
|
|
221
|
+
<UiTableHeader>
|
|
222
|
+
<UiTableRow>
|
|
223
|
+
<UiTableHead>Invoice</UiTableHead>
|
|
224
|
+
<UiTableHead>Status</UiTableHead>
|
|
225
|
+
<UiTableHead>Method</UiTableHead>
|
|
226
|
+
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
227
|
+
<UiTableHead class="w-[50px]"></UiTableHead>
|
|
228
|
+
</UiTableRow>
|
|
229
|
+
</UiTableHeader>
|
|
230
|
+
<UiTableBody>
|
|
231
|
+
<UiTableRow v-for="invoice in invoices" :key="invoice.invoice">
|
|
232
|
+
<UiTableCell class="font-medium">{{ invoice.invoice }}</UiTableCell>
|
|
233
|
+
<UiTableCell>{{ invoice.paymentStatus }}</UiTableCell>
|
|
234
|
+
<UiTableCell>{{ invoice.paymentMethod }}</UiTableCell>
|
|
235
|
+
<UiTableCell class="text-right">{{ invoice.totalAmount }}</UiTableCell>
|
|
236
|
+
<UiTableCell>
|
|
237
|
+
<UiDropdownMenu>
|
|
238
|
+
<UiDropdownMenuTrigger as-child>
|
|
239
|
+
<UiButton variant="ghost" size="icon" class="h-8 w-8 p-0">
|
|
240
|
+
<span class="sr-only">Open menu</span>
|
|
241
|
+
<UiIcon icon="i-material-symbols-more-horiz" class="h-4 w-4" />
|
|
242
|
+
</UiButton>
|
|
243
|
+
</UiDropdownMenuTrigger>
|
|
244
|
+
<UiDropdownMenuContent align="end">
|
|
245
|
+
<UiDropdownMenuLabel>Actions</UiDropdownMenuLabel>
|
|
246
|
+
<UiDropdownMenuItem>Copy payment ID</UiDropdownMenuItem>
|
|
247
|
+
<UiDropdownMenuSeparator />
|
|
248
|
+
<UiDropdownMenuItem>View customer</UiDropdownMenuItem>
|
|
249
|
+
<UiDropdownMenuItem>View payment details</UiDropdownMenuItem>
|
|
250
|
+
</UiDropdownMenuContent>
|
|
251
|
+
</UiDropdownMenu>
|
|
252
|
+
</UiTableCell>
|
|
253
|
+
</UiTableRow>
|
|
254
|
+
</UiTableBody>
|
|
255
|
+
</UiTable>
|
|
256
|
+
</template>`;
|
|
257
|
+
|
|
258
|
+
const withRowActionsTemplate = `
|
|
259
|
+
<UiTable>
|
|
260
|
+
<UiTableHeader>
|
|
261
|
+
<UiTableRow>
|
|
262
|
+
<UiTableHead>Invoice</UiTableHead>
|
|
263
|
+
<UiTableHead>Status</UiTableHead>
|
|
264
|
+
<UiTableHead>Method</UiTableHead>
|
|
265
|
+
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
266
|
+
<UiTableHead class="w-[50px]"></UiTableHead>
|
|
267
|
+
</UiTableRow>
|
|
268
|
+
</UiTableHeader>
|
|
269
|
+
<UiTableBody>
|
|
270
|
+
<UiTableRow v-for="invoice in invoices" :key="invoice.invoice">
|
|
271
|
+
<UiTableCell class="font-medium">{{ invoice.invoice }}</UiTableCell>
|
|
272
|
+
<UiTableCell>{{ invoice.paymentStatus }}</UiTableCell>
|
|
273
|
+
<UiTableCell>{{ invoice.paymentMethod }}</UiTableCell>
|
|
274
|
+
<UiTableCell class="text-right">{{ invoice.totalAmount }}</UiTableCell>
|
|
275
|
+
<UiTableCell>
|
|
276
|
+
<UiDropdownMenu>
|
|
277
|
+
<UiDropdownMenuTrigger as-child>
|
|
278
|
+
<UiButton variant="ghost" size="icon" class="h-8 w-8 p-0">
|
|
279
|
+
<span class="sr-only">Open menu</span>
|
|
280
|
+
<UiIcon icon="i-material-symbols-more-horiz" class="h-4 w-4" />
|
|
281
|
+
</UiButton>
|
|
282
|
+
</UiDropdownMenuTrigger>
|
|
283
|
+
<UiDropdownMenuContent align="end">
|
|
284
|
+
<UiDropdownMenuLabel>Actions</UiDropdownMenuLabel>
|
|
285
|
+
<UiDropdownMenuItem @click="() => {}">Copy payment ID</UiDropdownMenuItem>
|
|
286
|
+
<UiDropdownMenuSeparator />
|
|
287
|
+
<UiDropdownMenuItem>View customer</UiDropdownMenuItem>
|
|
288
|
+
<UiDropdownMenuItem>View payment details</UiDropdownMenuItem>
|
|
289
|
+
</UiDropdownMenuContent>
|
|
290
|
+
</UiDropdownMenu>
|
|
291
|
+
</UiTableCell>
|
|
292
|
+
</UiTableRow>
|
|
293
|
+
</UiTableBody>
|
|
294
|
+
</UiTable>
|
|
295
|
+
`;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Shows how to add action menus to each row using UiDropdownMenu.
|
|
299
|
+
*/
|
|
300
|
+
export const WithRowActions: Story = {
|
|
301
|
+
parameters: {
|
|
302
|
+
docs: {
|
|
303
|
+
description: {
|
|
304
|
+
story:
|
|
305
|
+
'Shows how to add action menus to each row using UiDropdownMenu. This is a common pattern for admin tables with edit/delete actions. The actions column is typically placed at the end with a fixed width.',
|
|
306
|
+
},
|
|
307
|
+
source: {
|
|
308
|
+
code: withRowActionsTemplateSource,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
render: () => ({
|
|
313
|
+
components: {
|
|
314
|
+
UiTable,
|
|
315
|
+
UiTableHeader,
|
|
316
|
+
UiTableBody,
|
|
317
|
+
UiTableRow,
|
|
318
|
+
UiTableHead,
|
|
319
|
+
UiTableCell,
|
|
320
|
+
UiDropdownMenu,
|
|
321
|
+
UiDropdownMenuTrigger,
|
|
322
|
+
UiDropdownMenuContent,
|
|
323
|
+
UiDropdownMenuItem,
|
|
324
|
+
UiDropdownMenuLabel,
|
|
325
|
+
UiDropdownMenuSeparator,
|
|
326
|
+
UiButton,
|
|
327
|
+
UiIcon,
|
|
328
|
+
},
|
|
329
|
+
setup() {
|
|
330
|
+
return { invoices };
|
|
331
|
+
},
|
|
332
|
+
template: withRowActionsTemplate,
|
|
333
|
+
}),
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const emptyStateTemplateSource = `<script setup lang="ts">
|
|
337
|
+
import {
|
|
338
|
+
UiTable,
|
|
339
|
+
UiTableHeader,
|
|
340
|
+
UiTableBody,
|
|
341
|
+
UiTableRow,
|
|
342
|
+
UiTableHead,
|
|
343
|
+
UiTableEmpty,
|
|
344
|
+
} from '@aleph-alpha/ui-library'
|
|
345
|
+
</script>
|
|
346
|
+
|
|
347
|
+
<template>
|
|
348
|
+
<UiTable>
|
|
349
|
+
<UiTableHeader>
|
|
350
|
+
<UiTableRow>
|
|
351
|
+
<UiTableHead>Invoice</UiTableHead>
|
|
352
|
+
<UiTableHead>Status</UiTableHead>
|
|
353
|
+
<UiTableHead>Method</UiTableHead>
|
|
354
|
+
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
355
|
+
</UiTableRow>
|
|
356
|
+
</UiTableHeader>
|
|
357
|
+
<UiTableBody>
|
|
358
|
+
<UiTableEmpty :colspan="4">No invoices found.</UiTableEmpty>
|
|
359
|
+
</UiTableBody>
|
|
360
|
+
</UiTable>
|
|
361
|
+
</template>`;
|
|
362
|
+
|
|
363
|
+
const emptyStateTemplate = `
|
|
364
|
+
<UiTable>
|
|
365
|
+
<UiTableHeader>
|
|
366
|
+
<UiTableRow>
|
|
367
|
+
<UiTableHead>Invoice</UiTableHead>
|
|
368
|
+
<UiTableHead>Status</UiTableHead>
|
|
369
|
+
<UiTableHead>Method</UiTableHead>
|
|
370
|
+
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
371
|
+
</UiTableRow>
|
|
372
|
+
</UiTableHeader>
|
|
373
|
+
<UiTableBody>
|
|
374
|
+
<UiTableEmpty :colspan="4">No invoices found.</UiTableEmpty>
|
|
375
|
+
</UiTableBody>
|
|
376
|
+
</UiTable>
|
|
377
|
+
`;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Use UiTableEmpty to display a message when there is no data to show.
|
|
381
|
+
*/
|
|
382
|
+
export const EmptyState: Story = {
|
|
383
|
+
parameters: {
|
|
384
|
+
docs: {
|
|
385
|
+
description: {
|
|
386
|
+
story: 'Use `UiTableEmpty` to display a message when there is no data to show.',
|
|
387
|
+
},
|
|
388
|
+
source: {
|
|
389
|
+
code: emptyStateTemplateSource,
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
render: () => ({
|
|
394
|
+
components: {
|
|
395
|
+
UiTable,
|
|
396
|
+
UiTableHeader,
|
|
397
|
+
UiTableBody,
|
|
398
|
+
UiTableRow,
|
|
399
|
+
UiTableHead,
|
|
400
|
+
UiTableEmpty,
|
|
401
|
+
},
|
|
402
|
+
template: emptyStateTemplate,
|
|
403
|
+
}),
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
const colSpanTemplateSource = `<script setup lang="ts">
|
|
407
|
+
import {
|
|
408
|
+
UiTable,
|
|
409
|
+
UiTableHeader,
|
|
410
|
+
UiTableBody,
|
|
411
|
+
UiTableRow,
|
|
412
|
+
UiTableHead,
|
|
413
|
+
UiTableCell,
|
|
414
|
+
} from '@aleph-alpha/ui-library'
|
|
415
|
+
</script>
|
|
416
|
+
|
|
417
|
+
<template>
|
|
418
|
+
<UiTable>
|
|
419
|
+
<UiTableHeader>
|
|
420
|
+
<UiTableRow>
|
|
421
|
+
<UiTableHead colspan="2">Product Info</UiTableHead>
|
|
422
|
+
<UiTableHead colspan="2">Pricing</UiTableHead>
|
|
423
|
+
</UiTableRow>
|
|
424
|
+
<UiTableRow>
|
|
425
|
+
<UiTableHead>Name</UiTableHead>
|
|
426
|
+
<UiTableHead>Category</UiTableHead>
|
|
427
|
+
<UiTableHead>Price</UiTableHead>
|
|
428
|
+
<UiTableHead>Discount</UiTableHead>
|
|
429
|
+
</UiTableRow>
|
|
430
|
+
</UiTableHeader>
|
|
431
|
+
<UiTableBody>
|
|
432
|
+
<UiTableRow>
|
|
433
|
+
<UiTableCell>Widget Pro</UiTableCell>
|
|
434
|
+
<UiTableCell>Electronics</UiTableCell>
|
|
435
|
+
<UiTableCell>€99.00</UiTableCell>
|
|
436
|
+
<UiTableCell>10%</UiTableCell>
|
|
437
|
+
</UiTableRow>
|
|
438
|
+
<UiTableRow>
|
|
439
|
+
<UiTableCell>Gadget Plus</UiTableCell>
|
|
440
|
+
<UiTableCell>Accessories</UiTableCell>
|
|
441
|
+
<UiTableCell>€49.00</UiTableCell>
|
|
442
|
+
<UiTableCell>5%</UiTableCell>
|
|
443
|
+
</UiTableRow>
|
|
444
|
+
</UiTableBody>
|
|
445
|
+
</UiTable>
|
|
446
|
+
</template>`;
|
|
447
|
+
|
|
448
|
+
const colSpanTemplate = `
|
|
449
|
+
<UiTable>
|
|
450
|
+
<UiTableHeader>
|
|
451
|
+
<UiTableRow>
|
|
452
|
+
<UiTableHead colspan="2">Product Info</UiTableHead>
|
|
453
|
+
<UiTableHead colspan="2">Pricing</UiTableHead>
|
|
454
|
+
</UiTableRow>
|
|
455
|
+
<UiTableRow>
|
|
456
|
+
<UiTableHead>Name</UiTableHead>
|
|
457
|
+
<UiTableHead>Category</UiTableHead>
|
|
458
|
+
<UiTableHead>Price</UiTableHead>
|
|
459
|
+
<UiTableHead>Discount</UiTableHead>
|
|
460
|
+
</UiTableRow>
|
|
461
|
+
</UiTableHeader>
|
|
462
|
+
<UiTableBody>
|
|
463
|
+
<UiTableRow>
|
|
464
|
+
<UiTableCell>Widget Pro</UiTableCell>
|
|
465
|
+
<UiTableCell>Electronics</UiTableCell>
|
|
466
|
+
<UiTableCell>€99.00</UiTableCell>
|
|
467
|
+
<UiTableCell>10%</UiTableCell>
|
|
468
|
+
</UiTableRow>
|
|
469
|
+
<UiTableRow>
|
|
470
|
+
<UiTableCell>Gadget Plus</UiTableCell>
|
|
471
|
+
<UiTableCell>Accessories</UiTableCell>
|
|
472
|
+
<UiTableCell>€49.00</UiTableCell>
|
|
473
|
+
<UiTableCell>5%</UiTableCell>
|
|
474
|
+
</UiTableRow>
|
|
475
|
+
</UiTableBody>
|
|
476
|
+
</UiTable>
|
|
477
|
+
`;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Use the colspan attribute on UiTableHead or UiTableCell to create grouped headers.
|
|
481
|
+
*/
|
|
482
|
+
export const WithColSpan: Story = {
|
|
483
|
+
parameters: {
|
|
484
|
+
docs: {
|
|
485
|
+
description: {
|
|
486
|
+
story:
|
|
487
|
+
'Use the `colspan` attribute on `UiTableHead` or `UiTableCell` to create grouped headers or cells that span multiple columns.',
|
|
488
|
+
},
|
|
489
|
+
source: {
|
|
490
|
+
code: colSpanTemplateSource,
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
render: () => ({
|
|
495
|
+
components: {
|
|
496
|
+
UiTable,
|
|
497
|
+
UiTableHeader,
|
|
498
|
+
UiTableBody,
|
|
499
|
+
UiTableRow,
|
|
500
|
+
UiTableHead,
|
|
501
|
+
UiTableCell,
|
|
502
|
+
},
|
|
503
|
+
template: colSpanTemplate,
|
|
504
|
+
}),
|
|
505
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableCaption as ShadcnTableCaption } from '@/primitives/shadcn/table';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'UiTableCaption',
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ShadcnTableCaption>
|
|
11
|
+
<slot />
|
|
12
|
+
</ShadcnTableCaption>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableCell as ShadcnTableCell } from '@/primitives/shadcn/table';
|
|
3
|
+
import type { UiTableCellProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiTableCell',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiTableCellProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnTableCell :colspan="props.colspan" :rowspan="props.rowspan">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnTableCell>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableEmpty as ShadcnTableEmpty } from '@/primitives/shadcn/table';
|
|
3
|
+
import type { UiTableEmptyProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiTableEmpty',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<UiTableEmptyProps>(), {
|
|
10
|
+
colspan: 1,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ShadcnTableEmpty :colspan="props.colspan">
|
|
16
|
+
<slot />
|
|
17
|
+
</ShadcnTableEmpty>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableFooter as ShadcnTableFooter } from '@/primitives/shadcn/table';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'UiTableFooter',
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ShadcnTableFooter>
|
|
11
|
+
<slot />
|
|
12
|
+
</ShadcnTableFooter>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableHead as ShadcnTableHead } from '@/primitives/shadcn/table';
|
|
3
|
+
import type { UiTableHeadProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiTableHead',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<UiTableHeadProps>(), {
|
|
10
|
+
scope: 'col',
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ShadcnTableHead :colspan="props.colspan" :rowspan="props.rowspan" :scope="props.scope">
|
|
16
|
+
<slot />
|
|
17
|
+
</ShadcnTableHead>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableHeader as ShadcnTableHeader } from '@/primitives/shadcn/table';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'UiTableHeader',
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ShadcnTableHeader>
|
|
11
|
+
<slot />
|
|
12
|
+
</ShadcnTableHeader>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { TableRow as ShadcnTableRow } from '@/primitives/shadcn/table';
|
|
3
|
+
import type { UiTableRowProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiTableRow',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<UiTableRowProps>(), {
|
|
10
|
+
selected: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ShadcnTableRow :data-state="props.selected ? 'selected' : undefined">
|
|
16
|
+
<slot />
|
|
17
|
+
</ShadcnTableRow>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
|
+
import { render } from '@testing-library/vue';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
import UiTable from '../UiTable.vue';
|
|
5
|
+
|
|
6
|
+
describe('UiTable', () => {
|
|
7
|
+
test('renders table with custom class', () => {
|
|
8
|
+
const { getByRole } = render(UiTable, {
|
|
9
|
+
props: { class: 'custom-table' },
|
|
10
|
+
slots: {
|
|
11
|
+
default: '<tbody><tr><td>Cell</td></tr></tbody>',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const table = getByRole('table');
|
|
16
|
+
expect(table).toBeInTheDocument();
|
|
17
|
+
expect(table).toHaveClass('custom-table');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
|
+
import { render } from '@testing-library/vue';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
import UiTableBody from '../UiTableBody.vue';
|
|
5
|
+
|
|
6
|
+
describe('UiTableBody', () => {
|
|
7
|
+
test('renders tbody with custom class', () => {
|
|
8
|
+
const { container } = render(UiTableBody, {
|
|
9
|
+
props: { class: 'custom-tbody' },
|
|
10
|
+
slots: {
|
|
11
|
+
default: '<tr><td>Cell</td></tr>',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const tbody = container.querySelector('tbody');
|
|
16
|
+
expect(tbody).toBeInTheDocument();
|
|
17
|
+
expect(tbody).toHaveClass('custom-tbody');
|
|
18
|
+
});
|
|
19
|
+
});
|