@aleph-alpha/ui-library 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/mcp/cli.js +21588 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/scripts/generate-component-meta.js +236 -0
- package/dist/mcp/server.js +21456 -0
- package/dist/system/index-CkH7HQaa.js +7 -0
- package/dist/system/index-CuHwEAQ_.js +7 -0
- package/dist/system/index.d.ts +1269 -540
- package/dist/system/lib.js +9001 -7237
- package/mcp/components-meta.json +1172 -0
- package/package.json +15 -5
- package/src/@types/shims-vue.d.ts +5 -0
- package/src/__tests__/placeholder.test.ts +7 -0
- package/src/compositions/UiCompositionPlaceholder/UiCompositionPlaceholder.vue +9 -0
- package/src/compositions/UiCompositionPlaceholder/index.ts +1 -0
- package/src/compositions/UiCompositionPlaceholder/types.ts +8 -0
- package/src/compositions/UiDataTable/UiDataTable.mock.ts +104 -0
- package/src/compositions/UiDataTable/UiDataTable.stories.ts +1575 -0
- package/src/compositions/UiDataTable/UiDataTable.vue +129 -0
- package/src/compositions/UiDataTable/UiDataTableColumnHeader.vue +97 -0
- package/src/compositions/UiDataTable/UiDataTablePagination.vue +147 -0
- package/src/compositions/UiDataTable/UiDataTableToolbar.vue +85 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTable.test.ts +372 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTableColumnHeader.test.ts +217 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTablePagination.test.ts +274 -0
- package/src/compositions/UiDataTable/__tests__/UiDataTableToolbar.test.ts +198 -0
- package/src/compositions/UiDataTable/constants.ts +77 -0
- package/src/compositions/UiDataTable/index.ts +6 -0
- package/src/compositions/UiDataTable/types.ts +39 -0
- package/src/compositions/UiDatePicker/UiDatePicker.stories.ts +976 -0
- package/src/compositions/UiDatePicker/UiDatePicker.vue +193 -0
- package/src/compositions/UiDatePicker/__tests__/UiDatePicker.test.ts +325 -0
- package/src/compositions/UiDatePicker/index.ts +14 -0
- package/src/compositions/UiDatePicker/types.ts +220 -0
- package/src/compositions/index.ts +8 -0
- package/src/foundations/UiPlaceholder/UiPlaceholder.vue +9 -0
- package/src/foundations/UiPlaceholder/index.ts +1 -0
- package/src/foundations/UiPlaceholder/types.ts +8 -0
- package/src/foundations/index.ts +6 -0
- package/src/index.ts +27 -0
- package/src/lib/utils.ts +6 -0
- package/src/primitives/UiAccordion/UiAccordion.stories.ts +476 -0
- package/src/primitives/UiAccordion/UiAccordion.vue +31 -0
- package/src/primitives/UiAccordion/UiAccordionContent.vue +16 -0
- package/src/primitives/UiAccordion/UiAccordionItem.vue +16 -0
- package/src/primitives/UiAccordion/UiAccordionTrigger.vue +23 -0
- package/src/primitives/UiAccordion/__tests__/UiAccordion.test.ts +198 -0
- package/src/primitives/UiAccordion/index.ts +6 -0
- package/src/primitives/UiAccordion/types.ts +95 -0
- package/src/primitives/UiAlert/UiAlert.stories.ts +199 -0
- package/src/primitives/UiAlert/UiAlert.vue +27 -0
- package/src/primitives/UiAlert/UiAlertDescription.vue +13 -0
- package/src/primitives/UiAlert/UiAlertTitle.vue +13 -0
- package/src/primitives/UiAlert/__tests__/UiAlert.test.ts +20 -0
- package/src/primitives/UiAlert/constants.ts +3 -0
- package/src/primitives/UiAlert/index.ts +5 -0
- package/src/primitives/UiAlert/types.ts +14 -0
- package/src/primitives/UiAlertDialog/UiAlertDialog.stories.ts +186 -0
- package/src/primitives/UiAlertDialog/UiAlertDialog.vue +18 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogAction.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogCancel.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogContent.vue +26 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogDescription.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogFooter.vue +13 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogHeader.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogTitle.vue +16 -0
- package/src/primitives/UiAlertDialog/UiAlertDialogTrigger.vue +17 -0
- package/src/primitives/UiAlertDialog/__tests__/UiAlertDialog.test.ts +184 -0
- package/src/primitives/UiAlertDialog/index.ts +9 -0
- package/src/primitives/UiAlertDialog/types.ts +83 -0
- package/src/primitives/UiAvatar/UiAvatar.stories.ts +194 -0
- package/src/primitives/UiAvatar/UiAvatar.vue +13 -0
- package/src/primitives/UiAvatar/UiAvatarFallback.vue +13 -0
- package/src/primitives/UiAvatar/UiAvatarImage.vue +14 -0
- package/src/primitives/UiAvatar/__tests__/UiAvatar.test.ts +36 -0
- package/src/primitives/UiAvatar/index.ts +3 -0
- package/src/primitives/UiAvatar/types.ts +17 -0
- package/src/primitives/UiBadge/UiBadge.stories.ts +373 -0
- package/src/primitives/UiBadge/UiBadge.vue +21 -0
- package/src/primitives/UiBadge/__tests__/UiBadge.test.ts +44 -0
- package/src/primitives/UiBadge/constants.ts +3 -0
- package/src/primitives/UiBadge/index.ts +2 -0
- package/src/primitives/UiBadge/types.ts +48 -0
- package/src/primitives/UiButton/UiButton.stories.ts +537 -0
- package/src/primitives/UiButton/UiButton.vue +72 -0
- package/src/primitives/UiButton/__tests__/UiButton.test.ts +133 -0
- package/src/primitives/UiButton/index.ts +2 -0
- package/src/primitives/UiButton/types.ts +87 -0
- package/src/primitives/UiCalendar/UiCalendar.stories.ts +797 -0
- package/src/primitives/UiCalendar/UiCalendar.vue +67 -0
- package/src/primitives/UiCalendar/__tests__/UiCalendar.test.ts +45 -0
- package/src/primitives/UiCalendar/index.ts +15 -0
- package/src/primitives/UiCalendar/types.ts +236 -0
- package/src/primitives/UiCard/UiCard.stories.ts +197 -0
- package/src/primitives/UiCard/UiCard.vue +13 -0
- package/src/primitives/UiCard/UiCardAction.vue +13 -0
- package/src/primitives/UiCard/UiCardContent.vue +13 -0
- package/src/primitives/UiCard/UiCardDescription.vue +13 -0
- package/src/primitives/UiCard/UiCardFooter.vue +13 -0
- package/src/primitives/UiCard/UiCardHeader.vue +13 -0
- package/src/primitives/UiCard/UiCardTitle.vue +13 -0
- package/src/primitives/UiCard/__tests__/UiCard.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardAction.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardContent.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardDescription.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardFooter.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardHeader.test.ts +19 -0
- package/src/primitives/UiCard/__tests__/UiCardTitle.test.ts +19 -0
- package/src/primitives/UiCard/index.ts +7 -0
- package/src/primitives/UiCard/types.ts +10 -0
- package/src/primitives/UiCheckbox/UiCheckbox.stories.ts +231 -0
- package/src/primitives/UiCheckbox/UiCheckbox.vue +19 -0
- package/src/primitives/UiCheckbox/__tests__/UiCheckbox.test.ts +29 -0
- package/src/primitives/UiCheckbox/index.ts +2 -0
- package/src/primitives/UiCheckbox/types.ts +30 -0
- package/src/primitives/UiDrawer/UiDrawer.stories.ts +602 -0
- package/src/primitives/UiDrawer/UiDrawer.vue +19 -0
- package/src/primitives/UiDrawer/UiDrawerClose.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerContent.vue +29 -0
- package/src/primitives/UiDrawer/UiDrawerDescription.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerFooter.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerHeader.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerTitle.vue +16 -0
- package/src/primitives/UiDrawer/UiDrawerTrigger.vue +16 -0
- package/src/primitives/UiDrawer/__tests__/UiDrawer.test.ts +229 -0
- package/src/primitives/UiDrawer/index.ts +8 -0
- package/src/primitives/UiDrawer/types.ts +96 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenu.stories.ts +760 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenu.vue +25 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuCheckboxItem.vue +29 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuContent.vue +27 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuGroup.vue +13 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuItem.vue +26 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuLabel.vue +18 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuRadioGroup.vue +20 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuRadioItem.vue +26 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSeparator.vue +11 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuShortcut.vue +13 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSub.vue +26 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSubContent.vue +23 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuSubTrigger.vue +24 -0
- package/src/primitives/UiDropdownMenu/UiDropdownMenuTrigger.vue +24 -0
- package/src/primitives/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +557 -0
- package/src/primitives/UiDropdownMenu/index.ts +16 -0
- package/src/primitives/UiDropdownMenu/types.ts +219 -0
- package/src/primitives/UiField/UiField.stories.ts +1496 -0
- package/src/primitives/UiField/UiField.vue +18 -0
- package/src/primitives/UiField/UiFieldContent.vue +13 -0
- package/src/primitives/UiField/UiFieldDescription.vue +13 -0
- package/src/primitives/UiField/UiFieldError.vue +20 -0
- package/src/primitives/UiField/UiFieldGroup.vue +13 -0
- package/src/primitives/UiField/UiFieldLabel.vue +16 -0
- package/src/primitives/UiField/UiFieldLegend.vue +13 -0
- package/src/primitives/UiField/UiFieldSeparator.vue +13 -0
- package/src/primitives/UiField/UiFieldSet.vue +13 -0
- package/src/primitives/UiField/UiFieldTitle.vue +13 -0
- package/src/primitives/UiField/__tests__/UiFieldError.test.ts +35 -0
- package/src/primitives/UiField/index.ts +10 -0
- package/src/primitives/UiField/types.ts +47 -0
- package/src/primitives/UiIcon/UiIcon.stories.ts +95 -0
- package/src/primitives/UiIcon/UiIcon.vue +14 -0
- package/src/primitives/UiIcon/__tests__/UiIcon.test.ts +24 -0
- package/src/primitives/UiIcon/index.ts +1 -0
- package/src/primitives/UiIcon/types.ts +23 -0
- package/src/primitives/UiIconButton/UiIconButton.stories.ts +446 -0
- package/src/primitives/UiIconButton/UiIconButton.vue +63 -0
- package/src/primitives/UiIconButton/__tests__/UiIconButton.test.ts +102 -0
- package/src/primitives/UiIconButton/index.ts +2 -0
- package/src/primitives/UiIconButton/types.ts +67 -0
- package/src/primitives/UiInput/UiInput.stories.ts +193 -0
- package/src/primitives/UiInput/UiInput.vue +19 -0
- package/src/primitives/UiInput/__tests__/UiInput.test.ts +38 -0
- package/src/primitives/UiInput/index.ts +2 -0
- package/src/primitives/UiInput/types.ts +31 -0
- package/src/primitives/UiPopover/UiPopover.stories.ts +394 -0
- package/src/primitives/UiPopover/UiPopover.vue +17 -0
- package/src/primitives/UiPopover/UiPopoverContent.vue +27 -0
- package/src/primitives/UiPopover/UiPopoverTrigger.vue +16 -0
- package/src/primitives/UiPopover/__tests__/UiPopover.test.ts +87 -0
- package/src/primitives/UiPopover/index.ts +5 -0
- package/src/primitives/UiPopover/types.ts +86 -0
- package/src/primitives/UiProgress/UiProgress.stories.ts +92 -0
- package/src/primitives/UiProgress/UiProgress.vue +25 -0
- package/src/primitives/UiProgress/__tests__/UiProgress.test.ts +46 -0
- package/src/primitives/UiProgress/index.ts +2 -0
- package/src/primitives/UiProgress/types.ts +16 -0
- package/src/primitives/UiRadioGroup/UiRadioGroup.stories.ts +291 -0
- package/src/primitives/UiRadioGroup/UiRadioGroup.vue +43 -0
- package/src/primitives/UiRadioGroup/UiRadioGroupItem.vue +18 -0
- package/src/primitives/UiRadioGroup/__tests__/UiRadioGroup.test.ts +404 -0
- package/src/primitives/UiRadioGroup/index.ts +4 -0
- package/src/primitives/UiRadioGroup/types.ts +66 -0
- package/src/primitives/UiRangeCalendar/UiRangeCalendar.stories.ts +609 -0
- package/src/primitives/UiRangeCalendar/UiRangeCalendar.vue +50 -0
- package/src/primitives/UiRangeCalendar/__tests__/UiRangeCalendar.test.ts +35 -0
- package/src/primitives/UiRangeCalendar/index.ts +13 -0
- package/src/primitives/UiRangeCalendar/types.ts +184 -0
- package/src/primitives/UiSelect/UiSelect.stories.ts +425 -0
- package/src/primitives/UiSelect/UiSelect.vue +47 -0
- package/src/primitives/UiSelect/UiSelectContent.vue +30 -0
- package/src/primitives/UiSelect/UiSelectGroup.vue +13 -0
- package/src/primitives/UiSelect/UiSelectItem.vue +19 -0
- package/src/primitives/UiSelect/UiSelectLabel.vue +13 -0
- package/src/primitives/UiSelect/UiSelectSeparator.vue +11 -0
- package/src/primitives/UiSelect/UiSelectTrigger.vue +30 -0
- package/src/primitives/UiSelect/UiSelectValue.vue +18 -0
- package/src/primitives/UiSelect/__tests__/UiSelect.test.ts +211 -0
- package/src/primitives/UiSelect/__tests__/UiSelectContent.test.ts +30 -0
- package/src/primitives/UiSelect/__tests__/UiSelectGroup.test.ts +85 -0
- package/src/primitives/UiSelect/__tests__/UiSelectItem.test.ts +79 -0
- package/src/primitives/UiSelect/__tests__/UiSelectLabel.test.ts +83 -0
- package/src/primitives/UiSelect/__tests__/UiSelectSeparator.test.ts +82 -0
- package/src/primitives/UiSelect/__tests__/UiSelectTrigger.test.ts +54 -0
- package/src/primitives/UiSelect/__tests__/UiSelectValue.test.ts +39 -0
- package/src/primitives/UiSelect/index.ts +10 -0
- package/src/primitives/UiSelect/types.ts +93 -0
- package/src/primitives/UiSlider/UiSlider.stories.ts +226 -0
- package/src/primitives/UiSlider/UiSlider.vue +44 -0
- package/src/primitives/UiSlider/__tests__/UiSlider.test.ts +76 -0
- package/src/primitives/UiSlider/index.ts +1 -0
- package/src/primitives/UiSlider/types.ts +101 -0
- package/src/primitives/UiSpinner/UiSpinner.stories.ts +143 -0
- package/src/primitives/UiSpinner/UiSpinner.vue +16 -0
- package/src/primitives/UiSpinner/__tests__/UiSpinner.test.ts +19 -0
- package/src/primitives/UiSpinner/index.ts +2 -0
- package/src/primitives/UiSpinner/types.ts +16 -0
- package/src/primitives/UiSwitch/UiSwitch.stories.ts +120 -0
- package/src/primitives/UiSwitch/UiSwitch.vue +21 -0
- package/src/primitives/UiSwitch/__tests__/UiSwitch.test.ts +47 -0
- package/src/primitives/UiSwitch/index.ts +2 -0
- package/src/primitives/UiSwitch/types.ts +25 -0
- package/src/primitives/UiTable/UiTable.stories.ts +505 -0
- package/src/primitives/UiTable/UiTable.vue +13 -0
- package/src/primitives/UiTable/UiTableBody.vue +13 -0
- package/src/primitives/UiTable/UiTableCaption.vue +13 -0
- package/src/primitives/UiTable/UiTableCell.vue +16 -0
- package/src/primitives/UiTable/UiTableEmpty.vue +18 -0
- package/src/primitives/UiTable/UiTableFooter.vue +13 -0
- package/src/primitives/UiTable/UiTableHead.vue +18 -0
- package/src/primitives/UiTable/UiTableHeader.vue +13 -0
- package/src/primitives/UiTable/UiTableRow.vue +18 -0
- package/src/primitives/UiTable/__tests__/UiTable.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableBody.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableCaption.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableCell.test.ts +26 -0
- package/src/primitives/UiTable/__tests__/UiTableEmpty.test.ts +32 -0
- package/src/primitives/UiTable/__tests__/UiTableFooter.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableHead.test.ts +43 -0
- package/src/primitives/UiTable/__tests__/UiTableHeader.test.ts +19 -0
- package/src/primitives/UiTable/__tests__/UiTableRow.test.ts +32 -0
- package/src/primitives/UiTable/index.ts +16 -0
- package/src/primitives/UiTable/types.ts +68 -0
- package/src/primitives/UiTabs/UiTabs.stories.ts +456 -0
- package/src/primitives/UiTabs/UiTabs.vue +31 -0
- package/src/primitives/UiTabs/UiTabsContent.vue +16 -0
- package/src/primitives/UiTabs/UiTabsList.vue +16 -0
- package/src/primitives/UiTabs/UiTabsTrigger.vue +16 -0
- package/src/primitives/UiTabs/__tests__/UiTabs.test.ts +122 -0
- package/src/primitives/UiTabs/index.ts +6 -0
- package/src/primitives/UiTabs/types.ts +68 -0
- package/src/primitives/UiTextarea/UiTextarea.stories.ts +107 -0
- package/src/primitives/UiTextarea/UiTextarea.vue +19 -0
- package/src/primitives/UiTextarea/__tests__/UiTextarea.test.ts +40 -0
- package/src/primitives/UiTextarea/index.ts +2 -0
- package/src/primitives/UiTextarea/types.ts +30 -0
- package/src/primitives/UiTooltip/UiTooltip.stories.ts +550 -0
- package/src/primitives/UiTooltip/UiTooltip.vue +42 -0
- package/src/primitives/UiTooltip/__tests__/UiTooltip.test.ts +78 -0
- package/src/primitives/UiTooltip/index.ts +2 -0
- package/src/primitives/UiTooltip/types.ts +53 -0
- package/src/primitives/index.ts +33 -0
- package/src/primitives/shadcn/accordion/Accordion.vue +15 -0
- package/src/primitives/shadcn/accordion/AccordionContent.vue +23 -0
- package/src/primitives/shadcn/accordion/AccordionItem.vue +24 -0
- package/src/primitives/shadcn/accordion/AccordionTrigger.vue +35 -0
- package/src/primitives/shadcn/accordion/index.ts +4 -0
- package/src/primitives/shadcn/alert/Alert.vue +17 -0
- package/src/primitives/shadcn/alert/AlertDescription.vue +22 -0
- package/src/primitives/shadcn/alert/AlertTitle.vue +17 -0
- package/src/primitives/shadcn/alert/index.ts +24 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialog.vue +15 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogAction.vue +18 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogCancel.vue +21 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogContent.vue +44 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogDescription.vue +21 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogFooter.vue +17 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogHeader.vue +17 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogTitle.vue +21 -0
- package/src/primitives/shadcn/alert-dialog/AlertDialogTrigger.vue +12 -0
- package/src/primitives/shadcn/alert-dialog/index.ts +9 -0
- package/src/primitives/shadcn/avatar/Avatar.vue +18 -0
- package/src/primitives/shadcn/avatar/AvatarFallback.vue +21 -0
- package/src/primitives/shadcn/avatar/AvatarImage.vue +12 -0
- package/src/primitives/shadcn/avatar/index.ts +3 -0
- package/src/primitives/shadcn/badge/Badge.vue +28 -0
- package/src/primitives/shadcn/badge/index.ts +24 -0
- package/src/primitives/shadcn/button/Button.vue +29 -0
- package/src/primitives/shadcn/button/index.ts +36 -0
- package/src/primitives/shadcn/calendar/Calendar.vue +206 -0
- package/src/primitives/shadcn/calendar/CalendarCell.vue +28 -0
- package/src/primitives/shadcn/calendar/CalendarCellTrigger.vue +44 -0
- package/src/primitives/shadcn/calendar/CalendarGrid.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarGridBody.vue +12 -0
- package/src/primitives/shadcn/calendar/CalendarGridHead.vue +13 -0
- package/src/primitives/shadcn/calendar/CalendarGridRow.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarHeadCell.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarHeader.vue +23 -0
- package/src/primitives/shadcn/calendar/CalendarHeading.vue +30 -0
- package/src/primitives/shadcn/calendar/CalendarNextButton.vue +33 -0
- package/src/primitives/shadcn/calendar/CalendarPrevButton.vue +33 -0
- package/src/primitives/shadcn/calendar/index.ts +14 -0
- package/src/primitives/shadcn/card/Card.vue +22 -0
- package/src/primitives/shadcn/card/CardAction.vue +17 -0
- package/src/primitives/shadcn/card/CardContent.vue +14 -0
- package/src/primitives/shadcn/card/CardDescription.vue +14 -0
- package/src/primitives/shadcn/card/CardFooter.vue +14 -0
- package/src/primitives/shadcn/card/CardHeader.vue +22 -0
- package/src/primitives/shadcn/card/CardTitle.vue +14 -0
- package/src/primitives/shadcn/card/index.ts +7 -0
- package/src/primitives/shadcn/checkbox/Checkbox.vue +38 -0
- package/src/primitives/shadcn/checkbox/index.ts +1 -0
- package/src/primitives/shadcn/drawer/Drawer.vue +15 -0
- package/src/primitives/shadcn/drawer/DrawerClose.vue +12 -0
- package/src/primitives/shadcn/drawer/DrawerContent.vue +52 -0
- package/src/primitives/shadcn/drawer/DrawerDescription.vue +20 -0
- package/src/primitives/shadcn/drawer/DrawerFooter.vue +17 -0
- package/src/primitives/shadcn/drawer/DrawerHeader.vue +17 -0
- package/src/primitives/shadcn/drawer/DrawerTitle.vue +20 -0
- package/src/primitives/shadcn/drawer/DrawerTrigger.vue +12 -0
- package/src/primitives/shadcn/drawer/index.ts +8 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenu.vue +15 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuCheckboxItem.vue +41 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuContent.vue +40 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuItem.vue +41 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuLabel.vue +25 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuRadioGroup.vue +15 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuRadioItem.vue +38 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSub.vue +15 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSubContent.vue +29 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/src/primitives/shadcn/dropdown-menu/DropdownMenuTrigger.vue +14 -0
- package/src/primitives/shadcn/dropdown-menu/index.ts +16 -0
- package/src/primitives/shadcn/field/Field.vue +22 -0
- package/src/primitives/shadcn/field/FieldContent.vue +17 -0
- package/src/primitives/shadcn/field/FieldDescription.vue +24 -0
- package/src/primitives/shadcn/field/FieldError.vue +69 -0
- package/src/primitives/shadcn/field/FieldGroup.vue +22 -0
- package/src/primitives/shadcn/field/FieldLabel.vue +28 -0
- package/src/primitives/shadcn/field/FieldLegend.vue +26 -0
- package/src/primitives/shadcn/field/FieldSeparator.vue +28 -0
- package/src/primitives/shadcn/field/FieldSet.vue +23 -0
- package/src/primitives/shadcn/field/FieldTitle.vue +22 -0
- package/src/primitives/shadcn/field/index.ts +39 -0
- package/src/primitives/shadcn/icon/Icon.vue +38 -0
- package/src/primitives/shadcn/icon/index.ts +1 -0
- package/src/primitives/shadcn/index.ts +3 -0
- package/src/primitives/shadcn/input/Input.vue +35 -0
- package/src/primitives/shadcn/input/index.ts +1 -0
- package/src/primitives/shadcn/label/Label.vue +28 -0
- package/src/primitives/shadcn/label/index.ts +1 -0
- package/src/primitives/shadcn/native-select/NativeSelect.vue +56 -0
- package/src/primitives/shadcn/native-select/NativeSelectOptGroup.vue +18 -0
- package/src/primitives/shadcn/native-select/NativeSelectOption.vue +18 -0
- package/src/primitives/shadcn/native-select/index.ts +3 -0
- package/src/primitives/shadcn/popover/Popover.vue +19 -0
- package/src/primitives/shadcn/popover/PopoverContent.vue +41 -0
- package/src/primitives/shadcn/popover/PopoverTrigger.vue +11 -0
- package/src/primitives/shadcn/popover/index.ts +4 -0
- package/src/primitives/shadcn/progress/Progress.vue +30 -0
- package/src/primitives/shadcn/progress/index.ts +1 -0
- package/src/primitives/shadcn/radio-group/RadioGroup.vue +25 -0
- package/src/primitives/shadcn/radio-group/RadioGroupItem.vue +38 -0
- package/src/primitives/shadcn/radio-group/index.ts +2 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendar.vue +73 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarCell.vue +28 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarCellTrigger.vue +46 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGrid.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGridBody.vue +12 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGridHead.vue +12 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarGridRow.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarHeadCell.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarHeader.vue +23 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarHeading.vue +30 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarNextButton.vue +34 -0
- package/src/primitives/shadcn/range-calendar/RangeCalendarPrevButton.vue +34 -0
- package/src/primitives/shadcn/range-calendar/index.ts +12 -0
- package/src/primitives/shadcn/select/Select.vue +15 -0
- package/src/primitives/shadcn/select/SelectContent.vue +55 -0
- package/src/primitives/shadcn/select/SelectGroup.vue +12 -0
- package/src/primitives/shadcn/select/SelectItem.vue +39 -0
- package/src/primitives/shadcn/select/SelectItemText.vue +12 -0
- package/src/primitives/shadcn/select/SelectLabel.vue +17 -0
- package/src/primitives/shadcn/select/SelectScrollDownButton.vue +26 -0
- package/src/primitives/shadcn/select/SelectScrollUpButton.vue +26 -0
- package/src/primitives/shadcn/select/SelectSeparator.vue +19 -0
- package/src/primitives/shadcn/select/SelectTrigger.vue +37 -0
- package/src/primitives/shadcn/select/SelectValue.vue +12 -0
- package/src/primitives/shadcn/select/index.ts +11 -0
- package/src/primitives/shadcn/separator/Separator.vue +27 -0
- package/src/primitives/shadcn/separator/index.ts +1 -0
- package/src/primitives/shadcn/slider/Slider.vue +45 -0
- package/src/primitives/shadcn/slider/index.ts +1 -0
- package/src/primitives/shadcn/spinner/Spinner.vue +18 -0
- package/src/primitives/shadcn/spinner/index.ts +1 -0
- package/src/primitives/shadcn/switch/Switch.vue +40 -0
- package/src/primitives/shadcn/switch/index.ts +1 -0
- package/src/primitives/shadcn/table/Table.vue +16 -0
- package/src/primitives/shadcn/table/TableBody.vue +14 -0
- package/src/primitives/shadcn/table/TableCaption.vue +14 -0
- package/src/primitives/shadcn/table/TableCell.vue +26 -0
- package/src/primitives/shadcn/table/TableEmpty.vue +29 -0
- package/src/primitives/shadcn/table/TableFooter.vue +17 -0
- package/src/primitives/shadcn/table/TableHead.vue +28 -0
- package/src/primitives/shadcn/table/TableHeader.vue +14 -0
- package/src/primitives/shadcn/table/TableRow.vue +21 -0
- package/src/primitives/shadcn/table/index.ts +9 -0
- package/src/primitives/shadcn/table/utils.ts +8 -0
- package/src/primitives/shadcn/tabs/Tabs.vue +24 -0
- package/src/primitives/shadcn/tabs/TabsContent.vue +21 -0
- package/src/primitives/shadcn/tabs/TabsList.vue +26 -0
- package/src/primitives/shadcn/tabs/TabsTrigger.vue +28 -0
- package/src/primitives/shadcn/tabs/index.ts +4 -0
- package/src/primitives/shadcn/textarea/Textarea.vue +33 -0
- package/src/primitives/shadcn/textarea/index.ts +1 -0
- package/src/primitives/shadcn/tooltip/Tooltip.vue +15 -0
- package/src/primitives/shadcn/tooltip/TooltipContent.vue +40 -0
- package/src/primitives/shadcn/tooltip/TooltipProvider.vue +12 -0
- package/src/primitives/shadcn/tooltip/TooltipTrigger.vue +12 -0
- package/src/primitives/shadcn/tooltip/index.ts +4 -0
- package/src/styles/global.css +1 -0
- package/src/templates/UiTemplatePlaceholder/UiTemplatePlaceholder.vue +9 -0
- package/src/templates/UiTemplatePlaceholder/index.ts +1 -0
- package/src/templates/UiTemplatePlaceholder/types.ts +8 -0
- package/src/templates/index.ts +6 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import { CalendarDate, getLocalTimeZone, today } from '@internationalized/date';
|
|
3
|
+
import type { DateRange, DateValue } from 'reka-ui';
|
|
4
|
+
import { ref } from 'vue';
|
|
5
|
+
import UiRangeCalendar from './UiRangeCalendar.vue';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof UiRangeCalendar> = {
|
|
8
|
+
title: 'Primitives/UiRangeCalendar',
|
|
9
|
+
component: UiRangeCalendar,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
decorators: [
|
|
12
|
+
() => ({
|
|
13
|
+
template: '<div class="inline-block"><story /></div>',
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
disabled: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
description: 'Whether the calendar is disabled.',
|
|
20
|
+
},
|
|
21
|
+
readonly: {
|
|
22
|
+
control: 'boolean',
|
|
23
|
+
description: 'Whether the calendar is read-only. Users can navigate but not select dates.',
|
|
24
|
+
},
|
|
25
|
+
locale: {
|
|
26
|
+
control: 'select',
|
|
27
|
+
options: ['en', 'de', 'fr', 'es', 'pl'],
|
|
28
|
+
description: 'The locale to use for formatting dates and weekday names.',
|
|
29
|
+
},
|
|
30
|
+
weekStartsOn: {
|
|
31
|
+
control: 'select',
|
|
32
|
+
options: [0, 1, 2, 3, 4, 5, 6],
|
|
33
|
+
description: 'The day of the week to start on. 0 = Sunday, 1 = Monday, etc.',
|
|
34
|
+
},
|
|
35
|
+
numberOfMonths: {
|
|
36
|
+
control: { type: 'number', min: 1, max: 3 },
|
|
37
|
+
description: 'The number of months to display at once.',
|
|
38
|
+
},
|
|
39
|
+
pagedNavigation: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Whether to navigate by page (all visible months) or by single month.',
|
|
42
|
+
},
|
|
43
|
+
weekdayFormat: {
|
|
44
|
+
control: 'select',
|
|
45
|
+
options: ['narrow', 'short', 'long'],
|
|
46
|
+
description:
|
|
47
|
+
'The format to use for weekday labels. Note: "long" is not recommended as full weekday names do not fit well.',
|
|
48
|
+
},
|
|
49
|
+
fixedWeeks: {
|
|
50
|
+
control: 'boolean',
|
|
51
|
+
description: 'Whether to always show 6 weeks in the calendar.',
|
|
52
|
+
},
|
|
53
|
+
preventDeselect: {
|
|
54
|
+
control: 'boolean',
|
|
55
|
+
description: 'Whether to prevent deselecting a date.',
|
|
56
|
+
},
|
|
57
|
+
calendarLabel: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
description: 'The accessible label for the calendar.',
|
|
60
|
+
},
|
|
61
|
+
initialFocus: {
|
|
62
|
+
control: 'boolean',
|
|
63
|
+
description: 'If true, focuses the calendar on mount.',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
args: {
|
|
67
|
+
disabled: false,
|
|
68
|
+
readonly: false,
|
|
69
|
+
locale: 'en',
|
|
70
|
+
weekStartsOn: 0,
|
|
71
|
+
numberOfMonths: 1,
|
|
72
|
+
pagedNavigation: false,
|
|
73
|
+
weekdayFormat: 'narrow',
|
|
74
|
+
fixedWeeks: false,
|
|
75
|
+
preventDeselect: false,
|
|
76
|
+
initialFocus: false,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default meta;
|
|
81
|
+
|
|
82
|
+
type Story = StoryObj<typeof UiRangeCalendar>;
|
|
83
|
+
|
|
84
|
+
const defaultTemplateSource = `<script setup lang="ts">
|
|
85
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
86
|
+
import { ref } from 'vue'
|
|
87
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
88
|
+
|
|
89
|
+
const dateRange = ref<DateRange>()
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<UiRangeCalendar v-model="dateRange" class="rounded-md border shadow-sm" />
|
|
94
|
+
</template>`;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Basic range calendar for selecting a date range.
|
|
98
|
+
* Click on a start date, then click on an end date to select a range.
|
|
99
|
+
* Use the Controls panel to explore all available props.
|
|
100
|
+
*/
|
|
101
|
+
export const Default: Story = {
|
|
102
|
+
render: (args) => ({
|
|
103
|
+
components: { UiRangeCalendar },
|
|
104
|
+
setup() {
|
|
105
|
+
const dateRange = ref<DateRange>();
|
|
106
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
107
|
+
return { dateRange, placeholder, args };
|
|
108
|
+
},
|
|
109
|
+
template: `<UiRangeCalendar
|
|
110
|
+
v-model="dateRange"
|
|
111
|
+
:default-placeholder="placeholder"
|
|
112
|
+
:disabled="args.disabled"
|
|
113
|
+
:readonly="args.readonly"
|
|
114
|
+
:locale="args.locale"
|
|
115
|
+
:week-starts-on="args.weekStartsOn"
|
|
116
|
+
:number-of-months="args.numberOfMonths"
|
|
117
|
+
:paged-navigation="args.pagedNavigation"
|
|
118
|
+
:weekday-format="args.weekdayFormat"
|
|
119
|
+
:fixed-weeks="args.fixedWeeks"
|
|
120
|
+
:prevent-deselect="args.preventDeselect"
|
|
121
|
+
:calendar-label="args.calendarLabel"
|
|
122
|
+
:initial-focus="args.initialFocus"
|
|
123
|
+
class="rounded-md border shadow-sm"
|
|
124
|
+
/>`,
|
|
125
|
+
}),
|
|
126
|
+
parameters: {
|
|
127
|
+
docs: {
|
|
128
|
+
source: {
|
|
129
|
+
code: defaultTemplateSource,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const multipleMonthsTemplateSource = `<script setup lang="ts">
|
|
136
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
137
|
+
import { ref } from 'vue'
|
|
138
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
139
|
+
|
|
140
|
+
const dateRange = ref<DateRange>()
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<template>
|
|
144
|
+
<UiRangeCalendar v-model="dateRange" :number-of-months="2" class="rounded-md border shadow-sm" />
|
|
145
|
+
</template>`;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Range calendar displaying two months side by side.
|
|
149
|
+
* This is the recommended layout for date range selection as it provides
|
|
150
|
+
* better context when selecting ranges that span multiple months.
|
|
151
|
+
*/
|
|
152
|
+
export const TwoMonths: Story = {
|
|
153
|
+
args: {
|
|
154
|
+
numberOfMonths: 2,
|
|
155
|
+
},
|
|
156
|
+
render: (args) => ({
|
|
157
|
+
components: { UiRangeCalendar },
|
|
158
|
+
setup() {
|
|
159
|
+
const dateRange = ref<DateRange>();
|
|
160
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
161
|
+
return { dateRange, placeholder, args };
|
|
162
|
+
},
|
|
163
|
+
template: `<UiRangeCalendar
|
|
164
|
+
v-model="dateRange"
|
|
165
|
+
:default-placeholder="placeholder"
|
|
166
|
+
:number-of-months="args.numberOfMonths"
|
|
167
|
+
:paged-navigation="args.pagedNavigation"
|
|
168
|
+
:disabled="args.disabled"
|
|
169
|
+
:locale="args.locale"
|
|
170
|
+
class="rounded-md border shadow-sm"
|
|
171
|
+
/>`,
|
|
172
|
+
}),
|
|
173
|
+
parameters: {
|
|
174
|
+
docs: {
|
|
175
|
+
source: {
|
|
176
|
+
code: multipleMonthsTemplateSource,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const withPreselectedRangeTemplateSource = `<script setup lang="ts">
|
|
183
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
184
|
+
import { CalendarDate, UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
185
|
+
import { ref } from 'vue'
|
|
186
|
+
|
|
187
|
+
const dateRange = ref<DateRange>({
|
|
188
|
+
start: new CalendarDate(2025, 1, 10),
|
|
189
|
+
end: new CalendarDate(2025, 1, 20),
|
|
190
|
+
})
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<template>
|
|
194
|
+
<UiRangeCalendar v-model="dateRange" class="rounded-md border shadow-sm" />
|
|
195
|
+
</template>`;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Range calendar with a pre-selected date range.
|
|
199
|
+
* Useful for editing existing date ranges or showing defaults.
|
|
200
|
+
*/
|
|
201
|
+
export const WithPreselectedRange: Story = {
|
|
202
|
+
render: (args) => ({
|
|
203
|
+
components: { UiRangeCalendar },
|
|
204
|
+
setup() {
|
|
205
|
+
const dateRange = ref<DateRange>({
|
|
206
|
+
start: new CalendarDate(2025, 1, 10),
|
|
207
|
+
end: new CalendarDate(2025, 1, 20),
|
|
208
|
+
});
|
|
209
|
+
const placeholder = ref(new CalendarDate(2025, 1, 1));
|
|
210
|
+
return { dateRange, placeholder, args };
|
|
211
|
+
},
|
|
212
|
+
template: `<UiRangeCalendar
|
|
213
|
+
v-model="dateRange"
|
|
214
|
+
:default-placeholder="placeholder"
|
|
215
|
+
:disabled="args.disabled"
|
|
216
|
+
:locale="args.locale"
|
|
217
|
+
class="rounded-md border shadow-sm"
|
|
218
|
+
/>`,
|
|
219
|
+
}),
|
|
220
|
+
parameters: {
|
|
221
|
+
docs: {
|
|
222
|
+
source: {
|
|
223
|
+
code: withPreselectedRangeTemplateSource,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const disabledDatesTemplateSource = `<script setup lang="ts">
|
|
230
|
+
import type { DateRange, DateValue } from '@aleph-alpha/ui-library'
|
|
231
|
+
import { getLocalTimeZone, UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
232
|
+
import { ref } from 'vue'
|
|
233
|
+
|
|
234
|
+
const dateRange = ref<DateRange>()
|
|
235
|
+
|
|
236
|
+
// Disable weekends (Sunday = 0, Saturday = 6)
|
|
237
|
+
const isDateDisabled = (date: DateValue) => {
|
|
238
|
+
const dayOfWeek = date.toDate(getLocalTimeZone()).getDay()
|
|
239
|
+
return dayOfWeek === 0 || dayOfWeek === 6
|
|
240
|
+
}
|
|
241
|
+
</script>
|
|
242
|
+
|
|
243
|
+
<template>
|
|
244
|
+
<UiRangeCalendar v-model="dateRange" :is-date-disabled="isDateDisabled" class="rounded-md border shadow-sm" />
|
|
245
|
+
</template>`;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Range calendar with weekends disabled.
|
|
249
|
+
* Use the `isDateDisabled` function to disable specific dates.
|
|
250
|
+
* Useful for business date selection.
|
|
251
|
+
*/
|
|
252
|
+
export const DisabledWeekends: Story = {
|
|
253
|
+
render: (args) => ({
|
|
254
|
+
components: { UiRangeCalendar },
|
|
255
|
+
setup() {
|
|
256
|
+
const dateRange = ref<DateRange>();
|
|
257
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
258
|
+
|
|
259
|
+
const isDateDisabled = (d: DateValue) => {
|
|
260
|
+
const dayOfWeek = d.toDate(getLocalTimeZone()).getDay();
|
|
261
|
+
return dayOfWeek === 0 || dayOfWeek === 6;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
return { dateRange, placeholder, isDateDisabled, args };
|
|
265
|
+
},
|
|
266
|
+
template: `<UiRangeCalendar
|
|
267
|
+
v-model="dateRange"
|
|
268
|
+
:default-placeholder="placeholder"
|
|
269
|
+
:is-date-disabled="isDateDisabled"
|
|
270
|
+
:disabled="args.disabled"
|
|
271
|
+
:locale="args.locale"
|
|
272
|
+
class="rounded-md border shadow-sm"
|
|
273
|
+
/>`,
|
|
274
|
+
}),
|
|
275
|
+
parameters: {
|
|
276
|
+
docs: {
|
|
277
|
+
source: {
|
|
278
|
+
code: disabledDatesTemplateSource,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const dateRangeConstraintsTemplateSource = `<script setup lang="ts">
|
|
285
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
286
|
+
import { getLocalTimeZone, today, UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
287
|
+
import { ref } from 'vue'
|
|
288
|
+
|
|
289
|
+
const dateRange = ref<DateRange>()
|
|
290
|
+
const minValue = today(getLocalTimeZone())
|
|
291
|
+
const maxValue = today(getLocalTimeZone()).add({ months: 3 })
|
|
292
|
+
</script>
|
|
293
|
+
|
|
294
|
+
<template>
|
|
295
|
+
<UiRangeCalendar v-model="dateRange" :min-value="minValue" :max-value="maxValue" class="rounded-md border shadow-sm" />
|
|
296
|
+
</template>`;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Range calendar with min and max date constraints.
|
|
300
|
+
* Only dates within the next 3 months are selectable.
|
|
301
|
+
*/
|
|
302
|
+
export const WithDateConstraints: Story = {
|
|
303
|
+
render: (args) => ({
|
|
304
|
+
components: { UiRangeCalendar },
|
|
305
|
+
setup() {
|
|
306
|
+
const dateRange = ref<DateRange>();
|
|
307
|
+
const todayDate = today(getLocalTimeZone());
|
|
308
|
+
const minValue = todayDate;
|
|
309
|
+
const maxValue = todayDate.add({ months: 3 });
|
|
310
|
+
|
|
311
|
+
return { dateRange, minValue, maxValue, args };
|
|
312
|
+
},
|
|
313
|
+
template: `<UiRangeCalendar
|
|
314
|
+
v-model="dateRange"
|
|
315
|
+
:min-value="minValue"
|
|
316
|
+
:max-value="maxValue"
|
|
317
|
+
:disabled="args.disabled"
|
|
318
|
+
:locale="args.locale"
|
|
319
|
+
class="rounded-md border shadow-sm"
|
|
320
|
+
/>`,
|
|
321
|
+
}),
|
|
322
|
+
parameters: {
|
|
323
|
+
docs: {
|
|
324
|
+
source: {
|
|
325
|
+
code: dateRangeConstraintsTemplateSource,
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const germanLocaleTemplateSource = `<script setup lang="ts">
|
|
332
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
333
|
+
import { ref } from 'vue'
|
|
334
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
335
|
+
|
|
336
|
+
const dateRange = ref<DateRange>()
|
|
337
|
+
</script>
|
|
338
|
+
|
|
339
|
+
<template>
|
|
340
|
+
<UiRangeCalendar v-model="dateRange" locale="de" :week-starts-on="1" weekday-format="short" class="rounded-md border shadow-sm" />
|
|
341
|
+
</template>`;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Range calendar with German locale and week starting on Monday.
|
|
345
|
+
* Demonstrates i18n capabilities.
|
|
346
|
+
*/
|
|
347
|
+
export const GermanLocale: Story = {
|
|
348
|
+
args: {
|
|
349
|
+
locale: 'de',
|
|
350
|
+
weekStartsOn: 1,
|
|
351
|
+
weekdayFormat: 'short',
|
|
352
|
+
},
|
|
353
|
+
render: (args) => ({
|
|
354
|
+
components: { UiRangeCalendar },
|
|
355
|
+
setup() {
|
|
356
|
+
const dateRange = ref<DateRange>();
|
|
357
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
358
|
+
return { dateRange, placeholder, args };
|
|
359
|
+
},
|
|
360
|
+
template: `<UiRangeCalendar
|
|
361
|
+
v-model="dateRange"
|
|
362
|
+
:default-placeholder="placeholder"
|
|
363
|
+
:locale="args.locale"
|
|
364
|
+
:week-starts-on="args.weekStartsOn"
|
|
365
|
+
:weekday-format="args.weekdayFormat"
|
|
366
|
+
:disabled="args.disabled"
|
|
367
|
+
class="rounded-md border shadow-sm"
|
|
368
|
+
/>`,
|
|
369
|
+
}),
|
|
370
|
+
parameters: {
|
|
371
|
+
docs: {
|
|
372
|
+
source: {
|
|
373
|
+
code: germanLocaleTemplateSource,
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const disabledTemplateSource = `<script setup lang="ts">
|
|
380
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
381
|
+
</script>
|
|
382
|
+
|
|
383
|
+
<template>
|
|
384
|
+
<UiRangeCalendar disabled class="rounded-md border shadow-sm" />
|
|
385
|
+
</template>`;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Disabled range calendar state.
|
|
389
|
+
* Users cannot interact with the calendar.
|
|
390
|
+
*/
|
|
391
|
+
export const Disabled: Story = {
|
|
392
|
+
args: {
|
|
393
|
+
disabled: true,
|
|
394
|
+
},
|
|
395
|
+
render: (args) => ({
|
|
396
|
+
components: { UiRangeCalendar },
|
|
397
|
+
setup() {
|
|
398
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
399
|
+
return { placeholder, args };
|
|
400
|
+
},
|
|
401
|
+
template: `<UiRangeCalendar
|
|
402
|
+
:default-placeholder="placeholder"
|
|
403
|
+
:disabled="args.disabled"
|
|
404
|
+
class="rounded-md border shadow-sm"
|
|
405
|
+
/>`,
|
|
406
|
+
}),
|
|
407
|
+
parameters: {
|
|
408
|
+
docs: {
|
|
409
|
+
source: {
|
|
410
|
+
code: disabledTemplateSource,
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
const readonlyTemplateSource = `<script setup lang="ts">
|
|
417
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
418
|
+
import { CalendarDate, UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
419
|
+
import { ref } from 'vue'
|
|
420
|
+
|
|
421
|
+
const dateRange = ref<DateRange>({
|
|
422
|
+
start: new CalendarDate(2025, 1, 10),
|
|
423
|
+
end: new CalendarDate(2025, 1, 20),
|
|
424
|
+
})
|
|
425
|
+
</script>
|
|
426
|
+
|
|
427
|
+
<template>
|
|
428
|
+
<UiRangeCalendar v-model="dateRange" readonly class="rounded-md border shadow-sm" />
|
|
429
|
+
</template>`;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Read-only range calendar state.
|
|
433
|
+
* Users can navigate between months but cannot select dates.
|
|
434
|
+
*/
|
|
435
|
+
export const Readonly: Story = {
|
|
436
|
+
args: {
|
|
437
|
+
readonly: true,
|
|
438
|
+
},
|
|
439
|
+
render: (args) => ({
|
|
440
|
+
components: { UiRangeCalendar },
|
|
441
|
+
setup() {
|
|
442
|
+
const dateRange = ref<DateRange>({
|
|
443
|
+
start: new CalendarDate(2025, 1, 10),
|
|
444
|
+
end: new CalendarDate(2025, 1, 20),
|
|
445
|
+
});
|
|
446
|
+
const placeholder = ref(new CalendarDate(2025, 1, 1));
|
|
447
|
+
return { dateRange, placeholder, args };
|
|
448
|
+
},
|
|
449
|
+
template: `<UiRangeCalendar
|
|
450
|
+
v-model="dateRange"
|
|
451
|
+
:default-placeholder="placeholder"
|
|
452
|
+
:readonly="args.readonly"
|
|
453
|
+
class="rounded-md border shadow-sm"
|
|
454
|
+
/>`,
|
|
455
|
+
}),
|
|
456
|
+
parameters: {
|
|
457
|
+
docs: {
|
|
458
|
+
source: {
|
|
459
|
+
code: readonlyTemplateSource,
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
const unavailableDatesTemplateSource = `<script setup lang="ts">
|
|
466
|
+
import type { DateRange, DateValue } from '@aleph-alpha/ui-library'
|
|
467
|
+
import { ref } from 'vue'
|
|
468
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
469
|
+
|
|
470
|
+
const dateRange = ref<DateRange>()
|
|
471
|
+
|
|
472
|
+
// Mark certain dates as unavailable (e.g., holidays)
|
|
473
|
+
const isDateUnavailable = (date: DateValue) => {
|
|
474
|
+
return date.day === 15 || date.day === 25
|
|
475
|
+
}
|
|
476
|
+
</script>
|
|
477
|
+
|
|
478
|
+
<template>
|
|
479
|
+
<UiRangeCalendar v-model="dateRange" :is-date-unavailable="isDateUnavailable" class="rounded-md border shadow-sm" />
|
|
480
|
+
</template>`;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Range calendar with unavailable dates marked.
|
|
484
|
+
* Unavailable dates are styled differently (strikethrough) but may still be selectable.
|
|
485
|
+
* Use this for holidays or dates with limited availability.
|
|
486
|
+
*/
|
|
487
|
+
export const UnavailableDates: Story = {
|
|
488
|
+
render: (args) => ({
|
|
489
|
+
components: { UiRangeCalendar },
|
|
490
|
+
setup() {
|
|
491
|
+
const dateRange = ref<DateRange>();
|
|
492
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
493
|
+
|
|
494
|
+
const isDateUnavailable = (d: DateValue) => {
|
|
495
|
+
return d.day === 15 || d.day === 25;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
return { dateRange, placeholder, isDateUnavailable, args };
|
|
499
|
+
},
|
|
500
|
+
template: `<UiRangeCalendar
|
|
501
|
+
v-model="dateRange"
|
|
502
|
+
:default-placeholder="placeholder"
|
|
503
|
+
:is-date-unavailable="isDateUnavailable"
|
|
504
|
+
:disabled="args.disabled"
|
|
505
|
+
:locale="args.locale"
|
|
506
|
+
class="rounded-md border shadow-sm"
|
|
507
|
+
/>`,
|
|
508
|
+
}),
|
|
509
|
+
parameters: {
|
|
510
|
+
docs: {
|
|
511
|
+
source: {
|
|
512
|
+
code: unavailableDatesTemplateSource,
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
},
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
const fixedWeeksTemplateSource = `<script setup lang="ts">
|
|
519
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
520
|
+
import { ref } from 'vue'
|
|
521
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
522
|
+
|
|
523
|
+
const dateRange = ref<DateRange>()
|
|
524
|
+
</script>
|
|
525
|
+
|
|
526
|
+
<template>
|
|
527
|
+
<UiRangeCalendar v-model="dateRange" fixed-weeks class="rounded-md border shadow-sm" />
|
|
528
|
+
</template>`;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Range calendar that always shows 6 weeks.
|
|
532
|
+
* Useful for maintaining consistent height regardless of the month.
|
|
533
|
+
*/
|
|
534
|
+
export const FixedWeeks: Story = {
|
|
535
|
+
args: {
|
|
536
|
+
fixedWeeks: true,
|
|
537
|
+
},
|
|
538
|
+
render: (args) => ({
|
|
539
|
+
components: { UiRangeCalendar },
|
|
540
|
+
setup() {
|
|
541
|
+
const dateRange = ref<DateRange>();
|
|
542
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
543
|
+
return { dateRange, placeholder, args };
|
|
544
|
+
},
|
|
545
|
+
template: `<UiRangeCalendar
|
|
546
|
+
v-model="dateRange"
|
|
547
|
+
:default-placeholder="placeholder"
|
|
548
|
+
:fixed-weeks="args.fixedWeeks"
|
|
549
|
+
:disabled="args.disabled"
|
|
550
|
+
:locale="args.locale"
|
|
551
|
+
class="rounded-md border shadow-sm"
|
|
552
|
+
/>`,
|
|
553
|
+
}),
|
|
554
|
+
parameters: {
|
|
555
|
+
docs: {
|
|
556
|
+
source: {
|
|
557
|
+
code: fixedWeeksTemplateSource,
|
|
558
|
+
},
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
const pagedNavigationTemplateSource = `<script setup lang="ts">
|
|
564
|
+
import type { DateRange } from '@aleph-alpha/ui-library'
|
|
565
|
+
import { ref } from 'vue'
|
|
566
|
+
import { UiRangeCalendar } from '@aleph-alpha/ui-library'
|
|
567
|
+
|
|
568
|
+
const dateRange = ref<DateRange>()
|
|
569
|
+
</script>
|
|
570
|
+
|
|
571
|
+
<template>
|
|
572
|
+
<UiRangeCalendar v-model="dateRange" :number-of-months="2" paged-navigation class="rounded-md border shadow-sm" />
|
|
573
|
+
</template>`;
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Range calendar with paged navigation.
|
|
577
|
+
* When enabled with multiple months, the prev/next buttons navigate
|
|
578
|
+
* by the full number of visible months instead of one month at a time.
|
|
579
|
+
*/
|
|
580
|
+
export const PagedNavigation: Story = {
|
|
581
|
+
args: {
|
|
582
|
+
numberOfMonths: 2,
|
|
583
|
+
pagedNavigation: true,
|
|
584
|
+
},
|
|
585
|
+
render: (args) => ({
|
|
586
|
+
components: { UiRangeCalendar },
|
|
587
|
+
setup() {
|
|
588
|
+
const dateRange = ref<DateRange>();
|
|
589
|
+
const placeholder = ref(today(getLocalTimeZone()));
|
|
590
|
+
return { dateRange, placeholder, args };
|
|
591
|
+
},
|
|
592
|
+
template: `<UiRangeCalendar
|
|
593
|
+
v-model="dateRange"
|
|
594
|
+
:default-placeholder="placeholder"
|
|
595
|
+
:number-of-months="args.numberOfMonths"
|
|
596
|
+
:paged-navigation="args.pagedNavigation"
|
|
597
|
+
:disabled="args.disabled"
|
|
598
|
+
:locale="args.locale"
|
|
599
|
+
class="rounded-md border shadow-sm"
|
|
600
|
+
/>`,
|
|
601
|
+
}),
|
|
602
|
+
parameters: {
|
|
603
|
+
docs: {
|
|
604
|
+
source: {
|
|
605
|
+
code: pagedNavigationTemplateSource,
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { RangeCalendar as ShadcnRangeCalendar } from '@/primitives/shadcn/range-calendar';
|
|
3
|
+
import type { UiRangeCalendarProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiRangeCalendar',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<UiRangeCalendarProps>(), {
|
|
10
|
+
disabled: false,
|
|
11
|
+
readonly: false,
|
|
12
|
+
locale: 'en',
|
|
13
|
+
weekStartsOn: 0,
|
|
14
|
+
numberOfMonths: 1,
|
|
15
|
+
pagedNavigation: false,
|
|
16
|
+
weekdayFormat: 'narrow',
|
|
17
|
+
fixedWeeks: false,
|
|
18
|
+
preventDeselect: false,
|
|
19
|
+
initialFocus: false,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const model = defineModel<UiRangeCalendarProps['modelValue']>();
|
|
23
|
+
const placeholder = defineModel<UiRangeCalendarProps['placeholder']>('placeholder');
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<ShadcnRangeCalendar
|
|
28
|
+
v-model="model"
|
|
29
|
+
v-model:placeholder="placeholder"
|
|
30
|
+
:default-value="props.defaultValue"
|
|
31
|
+
:default-placeholder="props.defaultPlaceholder"
|
|
32
|
+
:min-value="props.minValue"
|
|
33
|
+
:max-value="props.maxValue"
|
|
34
|
+
:disabled="props.disabled"
|
|
35
|
+
:readonly="props.readonly"
|
|
36
|
+
:locale="props.locale"
|
|
37
|
+
:week-starts-on="props.weekStartsOn"
|
|
38
|
+
:number-of-months="props.numberOfMonths"
|
|
39
|
+
:paged-navigation="props.pagedNavigation"
|
|
40
|
+
:weekday-format="props.weekdayFormat"
|
|
41
|
+
:fixed-weeks="props.fixedWeeks"
|
|
42
|
+
:prevent-deselect="props.preventDeselect"
|
|
43
|
+
:calendar-label="props.calendarLabel"
|
|
44
|
+
:initial-focus="props.initialFocus"
|
|
45
|
+
:is-date-disabled="props.isDateDisabled"
|
|
46
|
+
:is-date-unavailable="props.isDateUnavailable"
|
|
47
|
+
:next-page="props.nextPage"
|
|
48
|
+
:prev-page="props.prevPage"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { render } from '@testing-library/vue';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
import UiRangeCalendar from '../UiRangeCalendar.vue';
|
|
6
|
+
|
|
7
|
+
describe('UiRangeCalendar', () => {
|
|
8
|
+
const testDate = new CalendarDate(2025, 1, 15);
|
|
9
|
+
|
|
10
|
+
test('emits update:modelValue with DateRange when dates are selected', async () => {
|
|
11
|
+
const { getAllByRole, emitted } = render(UiRangeCalendar, {
|
|
12
|
+
props: { defaultPlaceholder: testDate },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const cells = getAllByRole('gridcell');
|
|
16
|
+
const clickableCells = cells.filter(
|
|
17
|
+
(cell) => !cell.querySelector('button')?.hasAttribute('data-disabled'),
|
|
18
|
+
);
|
|
19
|
+
const firstButton = clickableCells[0]?.querySelector('button');
|
|
20
|
+
const secondButton = clickableCells[5]?.querySelector('button');
|
|
21
|
+
|
|
22
|
+
expect(firstButton).toBeInTheDocument();
|
|
23
|
+
expect(secondButton).toBeInTheDocument();
|
|
24
|
+
|
|
25
|
+
await userEvent.click(firstButton!);
|
|
26
|
+
await userEvent.click(secondButton!);
|
|
27
|
+
|
|
28
|
+
const emissions = emitted('update:modelValue');
|
|
29
|
+
expect(emissions).toBeDefined();
|
|
30
|
+
|
|
31
|
+
const lastEmission = emissions![emissions!.length - 1][0];
|
|
32
|
+
expect(lastEmission).toHaveProperty('start');
|
|
33
|
+
expect(lastEmission).toHaveProperty('end');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as UiRangeCalendar } from './UiRangeCalendar.vue';
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
UiRangeCalendarProps,
|
|
5
|
+
UiRangeCalendarEmits,
|
|
6
|
+
UiRangeCalendarWeekdayFormat,
|
|
7
|
+
UiRangeCalendarWeekStartsOn,
|
|
8
|
+
DateRange,
|
|
9
|
+
DateValue,
|
|
10
|
+
Matcher,
|
|
11
|
+
} from './types';
|
|
12
|
+
|
|
13
|
+
export { CalendarDate, getLocalTimeZone, today } from '@internationalized/date';
|