@aleph-alpha/ui-library 1.9.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.
Files changed (437) hide show
  1. package/README.md +14 -0
  2. package/dist/mcp/cli.js +21588 -0
  3. package/dist/mcp/index.js +7 -0
  4. package/dist/mcp/scripts/generate-component-meta.js +236 -0
  5. package/dist/mcp/server.js +21456 -0
  6. package/dist/system/index-CkH7HQaa.js +7 -0
  7. package/dist/system/index-CuHwEAQ_.js +7 -0
  8. package/dist/system/index.d.ts +1322 -318
  9. package/dist/system/lib.js +8839 -6993
  10. package/mcp/components-meta.json +1172 -0
  11. package/package.json +12 -2
  12. package/src/@types/shims-vue.d.ts +5 -0
  13. package/src/__tests__/placeholder.test.ts +7 -0
  14. package/src/compositions/UiCompositionPlaceholder/UiCompositionPlaceholder.vue +9 -0
  15. package/src/compositions/UiCompositionPlaceholder/index.ts +1 -0
  16. package/src/compositions/UiCompositionPlaceholder/types.ts +8 -0
  17. package/src/compositions/UiDataTable/UiDataTable.mock.ts +104 -0
  18. package/src/compositions/UiDataTable/UiDataTable.stories.ts +1575 -0
  19. package/src/compositions/UiDataTable/UiDataTable.vue +129 -0
  20. package/src/compositions/UiDataTable/UiDataTableColumnHeader.vue +97 -0
  21. package/src/compositions/UiDataTable/UiDataTablePagination.vue +147 -0
  22. package/src/compositions/UiDataTable/UiDataTableToolbar.vue +85 -0
  23. package/src/compositions/UiDataTable/__tests__/UiDataTable.test.ts +372 -0
  24. package/src/compositions/UiDataTable/__tests__/UiDataTableColumnHeader.test.ts +217 -0
  25. package/src/compositions/UiDataTable/__tests__/UiDataTablePagination.test.ts +274 -0
  26. package/src/compositions/UiDataTable/__tests__/UiDataTableToolbar.test.ts +198 -0
  27. package/src/compositions/UiDataTable/constants.ts +77 -0
  28. package/src/compositions/UiDataTable/index.ts +6 -0
  29. package/src/compositions/UiDataTable/types.ts +39 -0
  30. package/src/compositions/UiDatePicker/UiDatePicker.stories.ts +976 -0
  31. package/src/compositions/UiDatePicker/UiDatePicker.vue +193 -0
  32. package/src/compositions/UiDatePicker/__tests__/UiDatePicker.test.ts +325 -0
  33. package/src/compositions/UiDatePicker/index.ts +14 -0
  34. package/src/compositions/UiDatePicker/types.ts +220 -0
  35. package/src/compositions/index.ts +8 -0
  36. package/src/foundations/UiPlaceholder/UiPlaceholder.vue +9 -0
  37. package/src/foundations/UiPlaceholder/index.ts +1 -0
  38. package/src/foundations/UiPlaceholder/types.ts +8 -0
  39. package/src/foundations/index.ts +6 -0
  40. package/src/index.ts +27 -0
  41. package/src/lib/utils.ts +6 -0
  42. package/src/primitives/UiAccordion/UiAccordion.stories.ts +476 -0
  43. package/src/primitives/UiAccordion/UiAccordion.vue +31 -0
  44. package/src/primitives/UiAccordion/UiAccordionContent.vue +16 -0
  45. package/src/primitives/UiAccordion/UiAccordionItem.vue +16 -0
  46. package/src/primitives/UiAccordion/UiAccordionTrigger.vue +23 -0
  47. package/src/primitives/UiAccordion/__tests__/UiAccordion.test.ts +198 -0
  48. package/src/primitives/UiAccordion/index.ts +6 -0
  49. package/src/primitives/UiAccordion/types.ts +95 -0
  50. package/src/primitives/UiAlert/UiAlert.stories.ts +199 -0
  51. package/src/primitives/UiAlert/UiAlert.vue +27 -0
  52. package/src/primitives/UiAlert/UiAlertDescription.vue +13 -0
  53. package/src/primitives/UiAlert/UiAlertTitle.vue +13 -0
  54. package/src/primitives/UiAlert/__tests__/UiAlert.test.ts +20 -0
  55. package/src/primitives/UiAlert/constants.ts +3 -0
  56. package/src/primitives/UiAlert/index.ts +5 -0
  57. package/src/primitives/UiAlert/types.ts +14 -0
  58. package/src/primitives/UiAlertDialog/UiAlertDialog.stories.ts +186 -0
  59. package/src/primitives/UiAlertDialog/UiAlertDialog.vue +18 -0
  60. package/src/primitives/UiAlertDialog/UiAlertDialogAction.vue +16 -0
  61. package/src/primitives/UiAlertDialog/UiAlertDialogCancel.vue +16 -0
  62. package/src/primitives/UiAlertDialog/UiAlertDialogContent.vue +26 -0
  63. package/src/primitives/UiAlertDialog/UiAlertDialogDescription.vue +16 -0
  64. package/src/primitives/UiAlertDialog/UiAlertDialogFooter.vue +13 -0
  65. package/src/primitives/UiAlertDialog/UiAlertDialogHeader.vue +16 -0
  66. package/src/primitives/UiAlertDialog/UiAlertDialogTitle.vue +16 -0
  67. package/src/primitives/UiAlertDialog/UiAlertDialogTrigger.vue +17 -0
  68. package/src/primitives/UiAlertDialog/__tests__/UiAlertDialog.test.ts +184 -0
  69. package/src/primitives/UiAlertDialog/index.ts +9 -0
  70. package/src/primitives/UiAlertDialog/types.ts +83 -0
  71. package/src/primitives/UiAvatar/UiAvatar.stories.ts +194 -0
  72. package/src/primitives/UiAvatar/UiAvatar.vue +13 -0
  73. package/src/primitives/UiAvatar/UiAvatarFallback.vue +13 -0
  74. package/src/primitives/UiAvatar/UiAvatarImage.vue +14 -0
  75. package/src/primitives/UiAvatar/__tests__/UiAvatar.test.ts +36 -0
  76. package/src/primitives/UiAvatar/index.ts +3 -0
  77. package/src/primitives/UiAvatar/types.ts +17 -0
  78. package/src/primitives/UiBadge/UiBadge.stories.ts +373 -0
  79. package/src/primitives/UiBadge/UiBadge.vue +21 -0
  80. package/src/primitives/UiBadge/__tests__/UiBadge.test.ts +44 -0
  81. package/src/primitives/UiBadge/constants.ts +3 -0
  82. package/src/primitives/UiBadge/index.ts +2 -0
  83. package/src/primitives/UiBadge/types.ts +48 -0
  84. package/src/primitives/UiButton/UiButton.stories.ts +537 -0
  85. package/src/primitives/UiButton/UiButton.vue +72 -0
  86. package/src/primitives/UiButton/__tests__/UiButton.test.ts +133 -0
  87. package/src/primitives/UiButton/index.ts +2 -0
  88. package/src/primitives/UiButton/types.ts +87 -0
  89. package/src/primitives/UiCalendar/UiCalendar.stories.ts +797 -0
  90. package/src/primitives/UiCalendar/UiCalendar.vue +67 -0
  91. package/src/primitives/UiCalendar/__tests__/UiCalendar.test.ts +45 -0
  92. package/src/primitives/UiCalendar/index.ts +15 -0
  93. package/src/primitives/UiCalendar/types.ts +236 -0
  94. package/src/primitives/UiCard/UiCard.stories.ts +197 -0
  95. package/src/primitives/UiCard/UiCard.vue +13 -0
  96. package/src/primitives/UiCard/UiCardAction.vue +13 -0
  97. package/src/primitives/UiCard/UiCardContent.vue +13 -0
  98. package/src/primitives/UiCard/UiCardDescription.vue +13 -0
  99. package/src/primitives/UiCard/UiCardFooter.vue +13 -0
  100. package/src/primitives/UiCard/UiCardHeader.vue +13 -0
  101. package/src/primitives/UiCard/UiCardTitle.vue +13 -0
  102. package/src/primitives/UiCard/__tests__/UiCard.test.ts +19 -0
  103. package/src/primitives/UiCard/__tests__/UiCardAction.test.ts +19 -0
  104. package/src/primitives/UiCard/__tests__/UiCardContent.test.ts +19 -0
  105. package/src/primitives/UiCard/__tests__/UiCardDescription.test.ts +19 -0
  106. package/src/primitives/UiCard/__tests__/UiCardFooter.test.ts +19 -0
  107. package/src/primitives/UiCard/__tests__/UiCardHeader.test.ts +19 -0
  108. package/src/primitives/UiCard/__tests__/UiCardTitle.test.ts +19 -0
  109. package/src/primitives/UiCard/index.ts +7 -0
  110. package/src/primitives/UiCard/types.ts +10 -0
  111. package/src/primitives/UiCheckbox/UiCheckbox.stories.ts +231 -0
  112. package/src/primitives/UiCheckbox/UiCheckbox.vue +19 -0
  113. package/src/primitives/UiCheckbox/__tests__/UiCheckbox.test.ts +29 -0
  114. package/src/primitives/UiCheckbox/index.ts +2 -0
  115. package/src/primitives/UiCheckbox/types.ts +30 -0
  116. package/src/primitives/UiDrawer/UiDrawer.stories.ts +602 -0
  117. package/src/primitives/UiDrawer/UiDrawer.vue +19 -0
  118. package/src/primitives/UiDrawer/UiDrawerClose.vue +16 -0
  119. package/src/primitives/UiDrawer/UiDrawerContent.vue +29 -0
  120. package/src/primitives/UiDrawer/UiDrawerDescription.vue +16 -0
  121. package/src/primitives/UiDrawer/UiDrawerFooter.vue +16 -0
  122. package/src/primitives/UiDrawer/UiDrawerHeader.vue +16 -0
  123. package/src/primitives/UiDrawer/UiDrawerTitle.vue +16 -0
  124. package/src/primitives/UiDrawer/UiDrawerTrigger.vue +16 -0
  125. package/src/primitives/UiDrawer/__tests__/UiDrawer.test.ts +229 -0
  126. package/src/primitives/UiDrawer/index.ts +8 -0
  127. package/src/primitives/UiDrawer/types.ts +96 -0
  128. package/src/primitives/UiDropdownMenu/UiDropdownMenu.stories.ts +760 -0
  129. package/src/primitives/UiDropdownMenu/UiDropdownMenu.vue +25 -0
  130. package/src/primitives/UiDropdownMenu/UiDropdownMenuCheckboxItem.vue +29 -0
  131. package/src/primitives/UiDropdownMenu/UiDropdownMenuContent.vue +27 -0
  132. package/src/primitives/UiDropdownMenu/UiDropdownMenuGroup.vue +13 -0
  133. package/src/primitives/UiDropdownMenu/UiDropdownMenuItem.vue +26 -0
  134. package/src/primitives/UiDropdownMenu/UiDropdownMenuLabel.vue +18 -0
  135. package/src/primitives/UiDropdownMenu/UiDropdownMenuRadioGroup.vue +20 -0
  136. package/src/primitives/UiDropdownMenu/UiDropdownMenuRadioItem.vue +26 -0
  137. package/src/primitives/UiDropdownMenu/UiDropdownMenuSeparator.vue +11 -0
  138. package/src/primitives/UiDropdownMenu/UiDropdownMenuShortcut.vue +13 -0
  139. package/src/primitives/UiDropdownMenu/UiDropdownMenuSub.vue +26 -0
  140. package/src/primitives/UiDropdownMenu/UiDropdownMenuSubContent.vue +23 -0
  141. package/src/primitives/UiDropdownMenu/UiDropdownMenuSubTrigger.vue +24 -0
  142. package/src/primitives/UiDropdownMenu/UiDropdownMenuTrigger.vue +24 -0
  143. package/src/primitives/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +557 -0
  144. package/src/primitives/UiDropdownMenu/index.ts +16 -0
  145. package/src/primitives/UiDropdownMenu/types.ts +219 -0
  146. package/src/primitives/UiField/UiField.stories.ts +1496 -0
  147. package/src/primitives/UiField/UiField.vue +18 -0
  148. package/src/primitives/UiField/UiFieldContent.vue +13 -0
  149. package/src/primitives/UiField/UiFieldDescription.vue +13 -0
  150. package/src/primitives/UiField/UiFieldError.vue +20 -0
  151. package/src/primitives/UiField/UiFieldGroup.vue +13 -0
  152. package/src/primitives/UiField/UiFieldLabel.vue +16 -0
  153. package/src/primitives/UiField/UiFieldLegend.vue +13 -0
  154. package/src/primitives/UiField/UiFieldSeparator.vue +13 -0
  155. package/src/primitives/UiField/UiFieldSet.vue +13 -0
  156. package/src/primitives/UiField/UiFieldTitle.vue +13 -0
  157. package/src/primitives/UiField/__tests__/UiFieldError.test.ts +35 -0
  158. package/src/primitives/UiField/index.ts +10 -0
  159. package/src/primitives/UiField/types.ts +47 -0
  160. package/src/primitives/UiIcon/UiIcon.stories.ts +95 -0
  161. package/src/primitives/UiIcon/UiIcon.vue +14 -0
  162. package/src/primitives/UiIcon/__tests__/UiIcon.test.ts +24 -0
  163. package/src/primitives/UiIcon/index.ts +1 -0
  164. package/src/primitives/UiIcon/types.ts +23 -0
  165. package/src/primitives/UiIconButton/UiIconButton.stories.ts +446 -0
  166. package/src/primitives/UiIconButton/UiIconButton.vue +63 -0
  167. package/src/primitives/UiIconButton/__tests__/UiIconButton.test.ts +102 -0
  168. package/src/primitives/UiIconButton/index.ts +2 -0
  169. package/src/primitives/UiIconButton/types.ts +67 -0
  170. package/src/primitives/UiInput/UiInput.stories.ts +193 -0
  171. package/src/primitives/UiInput/UiInput.vue +19 -0
  172. package/src/primitives/UiInput/__tests__/UiInput.test.ts +38 -0
  173. package/src/primitives/UiInput/index.ts +2 -0
  174. package/src/primitives/UiInput/types.ts +31 -0
  175. package/src/primitives/UiPopover/UiPopover.stories.ts +394 -0
  176. package/src/primitives/UiPopover/UiPopover.vue +17 -0
  177. package/src/primitives/UiPopover/UiPopoverContent.vue +27 -0
  178. package/src/primitives/UiPopover/UiPopoverTrigger.vue +16 -0
  179. package/src/primitives/UiPopover/__tests__/UiPopover.test.ts +87 -0
  180. package/src/primitives/UiPopover/index.ts +5 -0
  181. package/src/primitives/UiPopover/types.ts +86 -0
  182. package/src/primitives/UiProgress/UiProgress.stories.ts +92 -0
  183. package/src/primitives/UiProgress/UiProgress.vue +25 -0
  184. package/src/primitives/UiProgress/__tests__/UiProgress.test.ts +46 -0
  185. package/src/primitives/UiProgress/index.ts +2 -0
  186. package/src/primitives/UiProgress/types.ts +16 -0
  187. package/src/primitives/UiRadioGroup/UiRadioGroup.stories.ts +291 -0
  188. package/src/primitives/UiRadioGroup/UiRadioGroup.vue +43 -0
  189. package/src/primitives/UiRadioGroup/UiRadioGroupItem.vue +18 -0
  190. package/src/primitives/UiRadioGroup/__tests__/UiRadioGroup.test.ts +404 -0
  191. package/src/primitives/UiRadioGroup/index.ts +4 -0
  192. package/src/primitives/UiRadioGroup/types.ts +66 -0
  193. package/src/primitives/UiRangeCalendar/UiRangeCalendar.stories.ts +609 -0
  194. package/src/primitives/UiRangeCalendar/UiRangeCalendar.vue +50 -0
  195. package/src/primitives/UiRangeCalendar/__tests__/UiRangeCalendar.test.ts +35 -0
  196. package/src/primitives/UiRangeCalendar/index.ts +13 -0
  197. package/src/primitives/UiRangeCalendar/types.ts +184 -0
  198. package/src/primitives/UiSelect/UiSelect.stories.ts +425 -0
  199. package/src/primitives/UiSelect/UiSelect.vue +47 -0
  200. package/src/primitives/UiSelect/UiSelectContent.vue +30 -0
  201. package/src/primitives/UiSelect/UiSelectGroup.vue +13 -0
  202. package/src/primitives/UiSelect/UiSelectItem.vue +19 -0
  203. package/src/primitives/UiSelect/UiSelectLabel.vue +13 -0
  204. package/src/primitives/UiSelect/UiSelectSeparator.vue +11 -0
  205. package/src/primitives/UiSelect/UiSelectTrigger.vue +30 -0
  206. package/src/primitives/UiSelect/UiSelectValue.vue +18 -0
  207. package/src/primitives/UiSelect/__tests__/UiSelect.test.ts +211 -0
  208. package/src/primitives/UiSelect/__tests__/UiSelectContent.test.ts +30 -0
  209. package/src/primitives/UiSelect/__tests__/UiSelectGroup.test.ts +85 -0
  210. package/src/primitives/UiSelect/__tests__/UiSelectItem.test.ts +79 -0
  211. package/src/primitives/UiSelect/__tests__/UiSelectLabel.test.ts +83 -0
  212. package/src/primitives/UiSelect/__tests__/UiSelectSeparator.test.ts +82 -0
  213. package/src/primitives/UiSelect/__tests__/UiSelectTrigger.test.ts +54 -0
  214. package/src/primitives/UiSelect/__tests__/UiSelectValue.test.ts +39 -0
  215. package/src/primitives/UiSelect/index.ts +10 -0
  216. package/src/primitives/UiSelect/types.ts +93 -0
  217. package/src/primitives/UiSlider/UiSlider.stories.ts +226 -0
  218. package/src/primitives/UiSlider/UiSlider.vue +44 -0
  219. package/src/primitives/UiSlider/__tests__/UiSlider.test.ts +76 -0
  220. package/src/primitives/UiSlider/index.ts +1 -0
  221. package/src/primitives/UiSlider/types.ts +101 -0
  222. package/src/primitives/UiSpinner/UiSpinner.stories.ts +143 -0
  223. package/src/primitives/UiSpinner/UiSpinner.vue +16 -0
  224. package/src/primitives/UiSpinner/__tests__/UiSpinner.test.ts +19 -0
  225. package/src/primitives/UiSpinner/index.ts +2 -0
  226. package/src/primitives/UiSpinner/types.ts +16 -0
  227. package/src/primitives/UiSwitch/UiSwitch.stories.ts +120 -0
  228. package/src/primitives/UiSwitch/UiSwitch.vue +21 -0
  229. package/src/primitives/UiSwitch/__tests__/UiSwitch.test.ts +47 -0
  230. package/src/primitives/UiSwitch/index.ts +2 -0
  231. package/src/primitives/UiSwitch/types.ts +25 -0
  232. package/src/primitives/UiTable/UiTable.stories.ts +505 -0
  233. package/src/primitives/UiTable/UiTable.vue +13 -0
  234. package/src/primitives/UiTable/UiTableBody.vue +13 -0
  235. package/src/primitives/UiTable/UiTableCaption.vue +13 -0
  236. package/src/primitives/UiTable/UiTableCell.vue +16 -0
  237. package/src/primitives/UiTable/UiTableEmpty.vue +18 -0
  238. package/src/primitives/UiTable/UiTableFooter.vue +13 -0
  239. package/src/primitives/UiTable/UiTableHead.vue +18 -0
  240. package/src/primitives/UiTable/UiTableHeader.vue +13 -0
  241. package/src/primitives/UiTable/UiTableRow.vue +18 -0
  242. package/src/primitives/UiTable/__tests__/UiTable.test.ts +19 -0
  243. package/src/primitives/UiTable/__tests__/UiTableBody.test.ts +19 -0
  244. package/src/primitives/UiTable/__tests__/UiTableCaption.test.ts +19 -0
  245. package/src/primitives/UiTable/__tests__/UiTableCell.test.ts +26 -0
  246. package/src/primitives/UiTable/__tests__/UiTableEmpty.test.ts +32 -0
  247. package/src/primitives/UiTable/__tests__/UiTableFooter.test.ts +19 -0
  248. package/src/primitives/UiTable/__tests__/UiTableHead.test.ts +43 -0
  249. package/src/primitives/UiTable/__tests__/UiTableHeader.test.ts +19 -0
  250. package/src/primitives/UiTable/__tests__/UiTableRow.test.ts +32 -0
  251. package/src/primitives/UiTable/index.ts +16 -0
  252. package/src/primitives/UiTable/types.ts +68 -0
  253. package/src/primitives/UiTabs/UiTabs.stories.ts +456 -0
  254. package/src/primitives/UiTabs/UiTabs.vue +31 -0
  255. package/src/primitives/UiTabs/UiTabsContent.vue +16 -0
  256. package/src/primitives/UiTabs/UiTabsList.vue +16 -0
  257. package/src/primitives/UiTabs/UiTabsTrigger.vue +16 -0
  258. package/src/primitives/UiTabs/__tests__/UiTabs.test.ts +122 -0
  259. package/src/primitives/UiTabs/index.ts +6 -0
  260. package/src/primitives/UiTabs/types.ts +68 -0
  261. package/src/primitives/UiTextarea/UiTextarea.stories.ts +107 -0
  262. package/src/primitives/UiTextarea/UiTextarea.vue +19 -0
  263. package/src/primitives/UiTextarea/__tests__/UiTextarea.test.ts +40 -0
  264. package/src/primitives/UiTextarea/index.ts +2 -0
  265. package/src/primitives/UiTextarea/types.ts +30 -0
  266. package/src/primitives/UiTooltip/UiTooltip.stories.ts +550 -0
  267. package/src/primitives/UiTooltip/UiTooltip.vue +42 -0
  268. package/src/primitives/UiTooltip/__tests__/UiTooltip.test.ts +78 -0
  269. package/src/primitives/UiTooltip/index.ts +2 -0
  270. package/src/primitives/UiTooltip/types.ts +53 -0
  271. package/src/primitives/index.ts +33 -0
  272. package/src/primitives/shadcn/accordion/Accordion.vue +15 -0
  273. package/src/primitives/shadcn/accordion/AccordionContent.vue +23 -0
  274. package/src/primitives/shadcn/accordion/AccordionItem.vue +24 -0
  275. package/src/primitives/shadcn/accordion/AccordionTrigger.vue +35 -0
  276. package/src/primitives/shadcn/accordion/index.ts +4 -0
  277. package/src/primitives/shadcn/alert/Alert.vue +17 -0
  278. package/src/primitives/shadcn/alert/AlertDescription.vue +22 -0
  279. package/src/primitives/shadcn/alert/AlertTitle.vue +17 -0
  280. package/src/primitives/shadcn/alert/index.ts +24 -0
  281. package/src/primitives/shadcn/alert-dialog/AlertDialog.vue +15 -0
  282. package/src/primitives/shadcn/alert-dialog/AlertDialogAction.vue +18 -0
  283. package/src/primitives/shadcn/alert-dialog/AlertDialogCancel.vue +21 -0
  284. package/src/primitives/shadcn/alert-dialog/AlertDialogContent.vue +44 -0
  285. package/src/primitives/shadcn/alert-dialog/AlertDialogDescription.vue +21 -0
  286. package/src/primitives/shadcn/alert-dialog/AlertDialogFooter.vue +17 -0
  287. package/src/primitives/shadcn/alert-dialog/AlertDialogHeader.vue +17 -0
  288. package/src/primitives/shadcn/alert-dialog/AlertDialogTitle.vue +21 -0
  289. package/src/primitives/shadcn/alert-dialog/AlertDialogTrigger.vue +12 -0
  290. package/src/primitives/shadcn/alert-dialog/index.ts +9 -0
  291. package/src/primitives/shadcn/avatar/Avatar.vue +18 -0
  292. package/src/primitives/shadcn/avatar/AvatarFallback.vue +21 -0
  293. package/src/primitives/shadcn/avatar/AvatarImage.vue +12 -0
  294. package/src/primitives/shadcn/avatar/index.ts +3 -0
  295. package/src/primitives/shadcn/badge/Badge.vue +28 -0
  296. package/src/primitives/shadcn/badge/index.ts +24 -0
  297. package/src/primitives/shadcn/button/Button.vue +29 -0
  298. package/src/primitives/shadcn/button/index.ts +36 -0
  299. package/src/primitives/shadcn/calendar/Calendar.vue +206 -0
  300. package/src/primitives/shadcn/calendar/CalendarCell.vue +28 -0
  301. package/src/primitives/shadcn/calendar/CalendarCellTrigger.vue +44 -0
  302. package/src/primitives/shadcn/calendar/CalendarGrid.vue +23 -0
  303. package/src/primitives/shadcn/calendar/CalendarGridBody.vue +12 -0
  304. package/src/primitives/shadcn/calendar/CalendarGridHead.vue +13 -0
  305. package/src/primitives/shadcn/calendar/CalendarGridRow.vue +23 -0
  306. package/src/primitives/shadcn/calendar/CalendarHeadCell.vue +23 -0
  307. package/src/primitives/shadcn/calendar/CalendarHeader.vue +23 -0
  308. package/src/primitives/shadcn/calendar/CalendarHeading.vue +30 -0
  309. package/src/primitives/shadcn/calendar/CalendarNextButton.vue +33 -0
  310. package/src/primitives/shadcn/calendar/CalendarPrevButton.vue +33 -0
  311. package/src/primitives/shadcn/calendar/index.ts +14 -0
  312. package/src/primitives/shadcn/card/Card.vue +22 -0
  313. package/src/primitives/shadcn/card/CardAction.vue +17 -0
  314. package/src/primitives/shadcn/card/CardContent.vue +14 -0
  315. package/src/primitives/shadcn/card/CardDescription.vue +14 -0
  316. package/src/primitives/shadcn/card/CardFooter.vue +14 -0
  317. package/src/primitives/shadcn/card/CardHeader.vue +22 -0
  318. package/src/primitives/shadcn/card/CardTitle.vue +14 -0
  319. package/src/primitives/shadcn/card/index.ts +7 -0
  320. package/src/primitives/shadcn/checkbox/Checkbox.vue +38 -0
  321. package/src/primitives/shadcn/checkbox/index.ts +1 -0
  322. package/src/primitives/shadcn/drawer/Drawer.vue +15 -0
  323. package/src/primitives/shadcn/drawer/DrawerClose.vue +12 -0
  324. package/src/primitives/shadcn/drawer/DrawerContent.vue +52 -0
  325. package/src/primitives/shadcn/drawer/DrawerDescription.vue +20 -0
  326. package/src/primitives/shadcn/drawer/DrawerFooter.vue +17 -0
  327. package/src/primitives/shadcn/drawer/DrawerHeader.vue +17 -0
  328. package/src/primitives/shadcn/drawer/DrawerTitle.vue +20 -0
  329. package/src/primitives/shadcn/drawer/DrawerTrigger.vue +12 -0
  330. package/src/primitives/shadcn/drawer/index.ts +8 -0
  331. package/src/primitives/shadcn/dropdown-menu/DropdownMenu.vue +15 -0
  332. package/src/primitives/shadcn/dropdown-menu/DropdownMenuCheckboxItem.vue +41 -0
  333. package/src/primitives/shadcn/dropdown-menu/DropdownMenuContent.vue +40 -0
  334. package/src/primitives/shadcn/dropdown-menu/DropdownMenuGroup.vue +12 -0
  335. package/src/primitives/shadcn/dropdown-menu/DropdownMenuItem.vue +41 -0
  336. package/src/primitives/shadcn/dropdown-menu/DropdownMenuLabel.vue +25 -0
  337. package/src/primitives/shadcn/dropdown-menu/DropdownMenuRadioGroup.vue +15 -0
  338. package/src/primitives/shadcn/dropdown-menu/DropdownMenuRadioItem.vue +38 -0
  339. package/src/primitives/shadcn/dropdown-menu/DropdownMenuSeparator.vue +23 -0
  340. package/src/primitives/shadcn/dropdown-menu/DropdownMenuShortcut.vue +17 -0
  341. package/src/primitives/shadcn/dropdown-menu/DropdownMenuSub.vue +15 -0
  342. package/src/primitives/shadcn/dropdown-menu/DropdownMenuSubContent.vue +29 -0
  343. package/src/primitives/shadcn/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
  344. package/src/primitives/shadcn/dropdown-menu/DropdownMenuTrigger.vue +14 -0
  345. package/src/primitives/shadcn/dropdown-menu/index.ts +16 -0
  346. package/src/primitives/shadcn/field/Field.vue +22 -0
  347. package/src/primitives/shadcn/field/FieldContent.vue +17 -0
  348. package/src/primitives/shadcn/field/FieldDescription.vue +24 -0
  349. package/src/primitives/shadcn/field/FieldError.vue +69 -0
  350. package/src/primitives/shadcn/field/FieldGroup.vue +22 -0
  351. package/src/primitives/shadcn/field/FieldLabel.vue +28 -0
  352. package/src/primitives/shadcn/field/FieldLegend.vue +26 -0
  353. package/src/primitives/shadcn/field/FieldSeparator.vue +28 -0
  354. package/src/primitives/shadcn/field/FieldSet.vue +23 -0
  355. package/src/primitives/shadcn/field/FieldTitle.vue +22 -0
  356. package/src/primitives/shadcn/field/index.ts +39 -0
  357. package/src/primitives/shadcn/icon/Icon.vue +38 -0
  358. package/src/primitives/shadcn/icon/index.ts +1 -0
  359. package/src/primitives/shadcn/index.ts +3 -0
  360. package/src/primitives/shadcn/input/Input.vue +35 -0
  361. package/src/primitives/shadcn/input/index.ts +1 -0
  362. package/src/primitives/shadcn/label/Label.vue +28 -0
  363. package/src/primitives/shadcn/label/index.ts +1 -0
  364. package/src/primitives/shadcn/native-select/NativeSelect.vue +56 -0
  365. package/src/primitives/shadcn/native-select/NativeSelectOptGroup.vue +18 -0
  366. package/src/primitives/shadcn/native-select/NativeSelectOption.vue +18 -0
  367. package/src/primitives/shadcn/native-select/index.ts +3 -0
  368. package/src/primitives/shadcn/popover/Popover.vue +19 -0
  369. package/src/primitives/shadcn/popover/PopoverContent.vue +41 -0
  370. package/src/primitives/shadcn/popover/PopoverTrigger.vue +11 -0
  371. package/src/primitives/shadcn/popover/index.ts +4 -0
  372. package/src/primitives/shadcn/progress/Progress.vue +30 -0
  373. package/src/primitives/shadcn/progress/index.ts +1 -0
  374. package/src/primitives/shadcn/radio-group/RadioGroup.vue +25 -0
  375. package/src/primitives/shadcn/radio-group/RadioGroupItem.vue +38 -0
  376. package/src/primitives/shadcn/radio-group/index.ts +2 -0
  377. package/src/primitives/shadcn/range-calendar/RangeCalendar.vue +73 -0
  378. package/src/primitives/shadcn/range-calendar/RangeCalendarCell.vue +28 -0
  379. package/src/primitives/shadcn/range-calendar/RangeCalendarCellTrigger.vue +46 -0
  380. package/src/primitives/shadcn/range-calendar/RangeCalendarGrid.vue +23 -0
  381. package/src/primitives/shadcn/range-calendar/RangeCalendarGridBody.vue +12 -0
  382. package/src/primitives/shadcn/range-calendar/RangeCalendarGridHead.vue +12 -0
  383. package/src/primitives/shadcn/range-calendar/RangeCalendarGridRow.vue +23 -0
  384. package/src/primitives/shadcn/range-calendar/RangeCalendarHeadCell.vue +23 -0
  385. package/src/primitives/shadcn/range-calendar/RangeCalendarHeader.vue +23 -0
  386. package/src/primitives/shadcn/range-calendar/RangeCalendarHeading.vue +30 -0
  387. package/src/primitives/shadcn/range-calendar/RangeCalendarNextButton.vue +34 -0
  388. package/src/primitives/shadcn/range-calendar/RangeCalendarPrevButton.vue +34 -0
  389. package/src/primitives/shadcn/range-calendar/index.ts +12 -0
  390. package/src/primitives/shadcn/select/Select.vue +15 -0
  391. package/src/primitives/shadcn/select/SelectContent.vue +55 -0
  392. package/src/primitives/shadcn/select/SelectGroup.vue +12 -0
  393. package/src/primitives/shadcn/select/SelectItem.vue +39 -0
  394. package/src/primitives/shadcn/select/SelectItemText.vue +12 -0
  395. package/src/primitives/shadcn/select/SelectLabel.vue +17 -0
  396. package/src/primitives/shadcn/select/SelectScrollDownButton.vue +26 -0
  397. package/src/primitives/shadcn/select/SelectScrollUpButton.vue +26 -0
  398. package/src/primitives/shadcn/select/SelectSeparator.vue +19 -0
  399. package/src/primitives/shadcn/select/SelectTrigger.vue +37 -0
  400. package/src/primitives/shadcn/select/SelectValue.vue +12 -0
  401. package/src/primitives/shadcn/select/index.ts +11 -0
  402. package/src/primitives/shadcn/separator/Separator.vue +27 -0
  403. package/src/primitives/shadcn/separator/index.ts +1 -0
  404. package/src/primitives/shadcn/slider/Slider.vue +45 -0
  405. package/src/primitives/shadcn/slider/index.ts +1 -0
  406. package/src/primitives/shadcn/spinner/Spinner.vue +18 -0
  407. package/src/primitives/shadcn/spinner/index.ts +1 -0
  408. package/src/primitives/shadcn/switch/Switch.vue +40 -0
  409. package/src/primitives/shadcn/switch/index.ts +1 -0
  410. package/src/primitives/shadcn/table/Table.vue +16 -0
  411. package/src/primitives/shadcn/table/TableBody.vue +14 -0
  412. package/src/primitives/shadcn/table/TableCaption.vue +14 -0
  413. package/src/primitives/shadcn/table/TableCell.vue +26 -0
  414. package/src/primitives/shadcn/table/TableEmpty.vue +29 -0
  415. package/src/primitives/shadcn/table/TableFooter.vue +17 -0
  416. package/src/primitives/shadcn/table/TableHead.vue +28 -0
  417. package/src/primitives/shadcn/table/TableHeader.vue +14 -0
  418. package/src/primitives/shadcn/table/TableRow.vue +21 -0
  419. package/src/primitives/shadcn/table/index.ts +9 -0
  420. package/src/primitives/shadcn/table/utils.ts +8 -0
  421. package/src/primitives/shadcn/tabs/Tabs.vue +24 -0
  422. package/src/primitives/shadcn/tabs/TabsContent.vue +21 -0
  423. package/src/primitives/shadcn/tabs/TabsList.vue +26 -0
  424. package/src/primitives/shadcn/tabs/TabsTrigger.vue +28 -0
  425. package/src/primitives/shadcn/tabs/index.ts +4 -0
  426. package/src/primitives/shadcn/textarea/Textarea.vue +33 -0
  427. package/src/primitives/shadcn/textarea/index.ts +1 -0
  428. package/src/primitives/shadcn/tooltip/Tooltip.vue +15 -0
  429. package/src/primitives/shadcn/tooltip/TooltipContent.vue +40 -0
  430. package/src/primitives/shadcn/tooltip/TooltipProvider.vue +12 -0
  431. package/src/primitives/shadcn/tooltip/TooltipTrigger.vue +12 -0
  432. package/src/primitives/shadcn/tooltip/index.ts +4 -0
  433. package/src/styles/global.css +1 -0
  434. package/src/templates/UiTemplatePlaceholder/UiTemplatePlaceholder.vue +9 -0
  435. package/src/templates/UiTemplatePlaceholder/index.ts +1 -0
  436. package/src/templates/UiTemplatePlaceholder/types.ts +8 -0
  437. package/src/templates/index.ts +6 -0
@@ -0,0 +1,797 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import { CalendarDate, getLocalTimeZone, today } from '@internationalized/date';
3
+ import type { DateValue } from '@internationalized/date';
4
+ import { ref } from 'vue';
5
+ import UiCalendar from './UiCalendar.vue';
6
+ import { UiIcon } from '../UiIcon';
7
+
8
+ const meta: Meta<typeof UiCalendar> = {
9
+ title: 'Primitives/UiCalendar',
10
+ component: UiCalendar,
11
+ tags: ['autodocs'],
12
+ decorators: [
13
+ () => ({
14
+ template: '<div class="inline-block"><story /></div>',
15
+ }),
16
+ ],
17
+ argTypes: {
18
+ disabled: {
19
+ control: 'boolean',
20
+ description: 'Whether the calendar is disabled.',
21
+ },
22
+ readonly: {
23
+ control: 'boolean',
24
+ description: 'Whether the calendar is read-only. Users can navigate but not select dates.',
25
+ },
26
+ locale: {
27
+ control: 'select',
28
+ options: ['en', 'de', 'fr', 'es', 'pl'],
29
+ description: 'The locale to use for formatting dates and weekday names.',
30
+ },
31
+ weekStartsOn: {
32
+ control: 'select',
33
+ options: [0, 1, 2, 3, 4, 5, 6],
34
+ description: 'The day of the week to start on. 0 = Sunday, 1 = Monday, etc.',
35
+ },
36
+ numberOfMonths: {
37
+ control: { type: 'number', min: 1, max: 3 },
38
+ description: 'The number of months to display at once.',
39
+ },
40
+ pagedNavigation: {
41
+ control: 'boolean',
42
+ description: 'Whether to navigate by page (all visible months) or by single month.',
43
+ },
44
+ weekdayFormat: {
45
+ control: 'select',
46
+ options: ['narrow', 'short', 'long'],
47
+ description:
48
+ 'The format to use for weekday labels. Note: "long" is not recommended as full weekday names do not fit well.',
49
+ },
50
+ fixedWeeks: {
51
+ control: 'boolean',
52
+ description: 'Whether to always show 6 weeks in the calendar.',
53
+ },
54
+ layout: {
55
+ control: 'select',
56
+ options: [undefined, 'month-and-year', 'month-only', 'year-only'],
57
+ description: 'Layout mode for the calendar header dropdowns.',
58
+ },
59
+ preventDeselect: {
60
+ control: 'boolean',
61
+ description: 'Whether to prevent deselecting a date.',
62
+ },
63
+ multiple: {
64
+ control: 'boolean',
65
+ description: 'Whether multiple dates can be selected.',
66
+ },
67
+ calendarLabel: {
68
+ control: 'text',
69
+ description: 'The accessible label for the calendar.',
70
+ },
71
+ initialFocus: {
72
+ control: 'boolean',
73
+ description: 'If true, focuses the calendar on mount.',
74
+ },
75
+ dir: {
76
+ control: 'select',
77
+ options: ['ltr', 'rtl'],
78
+ description: 'The reading direction of the calendar.',
79
+ },
80
+ disableDaysOutsideCurrentView: {
81
+ control: 'boolean',
82
+ description: 'Whether to disable days outside the current view.',
83
+ },
84
+ },
85
+ args: {
86
+ disabled: false,
87
+ readonly: false,
88
+ locale: 'en',
89
+ weekStartsOn: 0,
90
+ numberOfMonths: 1,
91
+ pagedNavigation: false,
92
+ weekdayFormat: 'narrow',
93
+ fixedWeeks: false,
94
+ layout: undefined,
95
+ preventDeselect: false,
96
+ multiple: false,
97
+ initialFocus: false,
98
+ dir: 'ltr',
99
+ disableDaysOutsideCurrentView: false,
100
+ },
101
+ };
102
+
103
+ export default meta;
104
+
105
+ type Story = StoryObj<typeof UiCalendar>;
106
+
107
+ const defaultTemplateSource = `<script setup lang="ts">
108
+ import type { DateValue } from '@aleph-alpha/ui-library'
109
+ import { ref } from 'vue'
110
+ import { UiCalendar } from '@aleph-alpha/ui-library'
111
+
112
+ const date = ref<DateValue>()
113
+ </script>
114
+
115
+ <template>
116
+ <UiCalendar
117
+ v-model="date"
118
+ class="rounded-md border shadow-sm"
119
+ />
120
+ </template>`;
121
+
122
+ /**
123
+ * Basic calendar with date selection.
124
+ * Use the Controls panel to explore all available props.
125
+ */
126
+ export const Default: Story = {
127
+ render: (args) => ({
128
+ components: { UiCalendar },
129
+ setup() {
130
+ const date = ref<DateValue>();
131
+ const placeholder = ref(today(getLocalTimeZone()));
132
+ return { date, placeholder, args };
133
+ },
134
+ template: `<UiCalendar
135
+ v-model="date"
136
+ :default-placeholder="placeholder"
137
+ :disabled="args.disabled"
138
+ :readonly="args.readonly"
139
+ :locale="args.locale"
140
+ :week-starts-on="args.weekStartsOn"
141
+ :number-of-months="args.numberOfMonths"
142
+ :paged-navigation="args.pagedNavigation"
143
+ :weekday-format="args.weekdayFormat"
144
+ :fixed-weeks="args.fixedWeeks"
145
+ :layout="args.layout"
146
+ :prevent-deselect="args.preventDeselect"
147
+ :multiple="args.multiple"
148
+ :calendar-label="args.calendarLabel"
149
+ :initial-focus="args.initialFocus"
150
+ :dir="args.dir"
151
+ :disable-days-outside-current-view="args.disableDaysOutsideCurrentView"
152
+ class="rounded-md border shadow-sm"
153
+ />`,
154
+ }),
155
+ parameters: {
156
+ docs: {
157
+ source: {
158
+ code: defaultTemplateSource,
159
+ },
160
+ },
161
+ },
162
+ };
163
+
164
+ const withLayoutTemplateSource = `<script setup lang="ts">
165
+ import type { DateValue } from '@aleph-alpha/ui-library'
166
+ import { CalendarDate, UiCalendar } from '@aleph-alpha/ui-library'
167
+ import { ref } from 'vue'
168
+
169
+ const date = ref<DateValue>()
170
+ const minValue = new CalendarDate(1925, 1, 1)
171
+ const maxValue = new CalendarDate(2035, 1, 1)
172
+ </script>
173
+
174
+ <template>
175
+ <UiCalendar
176
+ v-model="date"
177
+ layout="month-and-year"
178
+ :min-value="minValue"
179
+ :max-value="maxValue"
180
+ class="rounded-md border shadow-sm"
181
+ />
182
+ </template>`;
183
+
184
+ /**
185
+ * Calendar with month and year dropdown selectors for quick navigation.
186
+ * Useful for date-of-birth pickers or when users need to navigate far from the current date.
187
+ */
188
+ export const WithMonthYearDropdowns: Story = {
189
+ args: {
190
+ layout: 'month-and-year',
191
+ },
192
+ render: (args) => ({
193
+ components: { UiCalendar },
194
+ setup() {
195
+ const date = ref<DateValue>();
196
+ const minValue = new CalendarDate(1925, 1, 1);
197
+ const maxValue = new CalendarDate(2035, 1, 1);
198
+ return { date, minValue, maxValue, args };
199
+ },
200
+ template: `<UiCalendar
201
+ v-model="date"
202
+ :layout="args.layout"
203
+ :min-value="minValue"
204
+ :max-value="maxValue"
205
+ :disabled="args.disabled"
206
+ :readonly="args.readonly"
207
+ :locale="args.locale"
208
+ :week-starts-on="args.weekStartsOn"
209
+ :weekday-format="args.weekdayFormat"
210
+ class="rounded-md border shadow-sm"
211
+ />`,
212
+ }),
213
+ parameters: {
214
+ docs: {
215
+ source: {
216
+ code: withLayoutTemplateSource,
217
+ },
218
+ },
219
+ },
220
+ };
221
+
222
+ const multipleMonthsTemplateSource = `<script setup lang="ts">
223
+ import type { DateValue } from '@aleph-alpha/ui-library'
224
+ import { ref } from 'vue'
225
+ import { UiCalendar } from '@aleph-alpha/ui-library'
226
+
227
+ const date = ref<DateValue>()
228
+ </script>
229
+
230
+ <template>
231
+ <UiCalendar
232
+ v-model="date"
233
+ :number-of-months="2"
234
+ class="rounded-md border shadow-sm"
235
+ />
236
+ </template>`;
237
+
238
+ /**
239
+ * Calendar displaying multiple months side by side.
240
+ * Useful for date range selection or when context of adjacent months is helpful.
241
+ */
242
+ export const MultipleMonths: Story = {
243
+ args: {
244
+ numberOfMonths: 2,
245
+ },
246
+ render: (args) => ({
247
+ components: { UiCalendar },
248
+ setup() {
249
+ const date = ref<DateValue>();
250
+ const placeholder = ref(today(getLocalTimeZone()));
251
+ return { date, placeholder, args };
252
+ },
253
+ template: `<UiCalendar
254
+ v-model="date"
255
+ :default-placeholder="placeholder"
256
+ :number-of-months="args.numberOfMonths"
257
+ :paged-navigation="args.pagedNavigation"
258
+ :disabled="args.disabled"
259
+ :locale="args.locale"
260
+ class="rounded-md border shadow-sm"
261
+ />`,
262
+ }),
263
+ parameters: {
264
+ docs: {
265
+ source: {
266
+ code: multipleMonthsTemplateSource,
267
+ },
268
+ },
269
+ },
270
+ };
271
+
272
+ const disabledDatesTemplateSource = `<script setup lang="ts">
273
+ import type { DateValue } from '@aleph-alpha/ui-library'
274
+ import { getLocalTimeZone, UiCalendar } from '@aleph-alpha/ui-library'
275
+ import { ref } from 'vue'
276
+
277
+ const date = ref<DateValue>()
278
+
279
+ // Disable weekends (Sunday = 0, Saturday = 6)
280
+ const isDateDisabled = (date: DateValue) => {
281
+ const dayOfWeek = date.toDate(getLocalTimeZone()).getDay()
282
+ return dayOfWeek === 0 || dayOfWeek === 6
283
+ }
284
+ </script>
285
+
286
+ <template>
287
+ <UiCalendar
288
+ v-model="date"
289
+ :is-date-disabled="isDateDisabled"
290
+ class="rounded-md border shadow-sm"
291
+ />
292
+ </template>`;
293
+
294
+ /**
295
+ * Calendar with weekends disabled using the `isDateDisabled` function.
296
+ * Use this pattern to disable specific dates based on custom logic.
297
+ */
298
+ export const DisabledWeekends: Story = {
299
+ render: (args) => ({
300
+ components: { UiCalendar },
301
+ setup() {
302
+ const date = ref<DateValue>();
303
+ const placeholder = ref(today(getLocalTimeZone()));
304
+
305
+ // Disable weekends (Sunday = 0, Saturday = 6 in JavaScript's getDay())
306
+ const isDateDisabled = (d: DateValue) => {
307
+ const dayOfWeek = d.toDate(getLocalTimeZone()).getDay();
308
+ return dayOfWeek === 0 || dayOfWeek === 6;
309
+ };
310
+
311
+ return { date, placeholder, isDateDisabled, args };
312
+ },
313
+ template: `<UiCalendar
314
+ v-model="date"
315
+ :default-placeholder="placeholder"
316
+ :is-date-disabled="isDateDisabled"
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: disabledDatesTemplateSource,
326
+ },
327
+ },
328
+ },
329
+ };
330
+
331
+ const dateRangeTemplateSource = `<script setup lang="ts">
332
+ import type { DateValue } from '@aleph-alpha/ui-library'
333
+ import { getLocalTimeZone, today, UiCalendar } from '@aleph-alpha/ui-library'
334
+ import { ref } from 'vue'
335
+
336
+ const date = ref<DateValue>()
337
+ const minValue = today(getLocalTimeZone())
338
+ const maxValue = today(getLocalTimeZone()).add({ months: 3 })
339
+ </script>
340
+
341
+ <template>
342
+ <UiCalendar
343
+ v-model="date"
344
+ :min-value="minValue"
345
+ :max-value="maxValue"
346
+ class="rounded-md border shadow-sm"
347
+ />
348
+ </template>`;
349
+
350
+ /**
351
+ * Calendar with min and max date constraints.
352
+ * Only dates within the next 3 months are selectable.
353
+ */
354
+ export const WithDateRange: Story = {
355
+ render: (args) => ({
356
+ components: { UiCalendar },
357
+ setup() {
358
+ const date = ref<DateValue>();
359
+ const todayDate = today(getLocalTimeZone());
360
+ const minValue = todayDate;
361
+ const maxValue = todayDate.add({ months: 3 });
362
+
363
+ return { date, minValue, maxValue, args };
364
+ },
365
+ template: `<UiCalendar
366
+ v-model="date"
367
+ :min-value="minValue"
368
+ :max-value="maxValue"
369
+ :disabled="args.disabled"
370
+ :locale="args.locale"
371
+ class="rounded-md border shadow-sm"
372
+ />`,
373
+ }),
374
+ parameters: {
375
+ docs: {
376
+ source: {
377
+ code: dateRangeTemplateSource,
378
+ },
379
+ },
380
+ },
381
+ };
382
+
383
+ const germanLocaleTemplateSource = `<script setup lang="ts">
384
+ import type { DateValue } from '@aleph-alpha/ui-library'
385
+ import { ref } from 'vue'
386
+ import { UiCalendar } from '@aleph-alpha/ui-library'
387
+
388
+ const date = ref<DateValue>()
389
+ </script>
390
+
391
+ <template>
392
+ <UiCalendar
393
+ v-model="date"
394
+ locale="de"
395
+ :week-starts-on="1"
396
+ weekday-format="short"
397
+ class="rounded-md border shadow-sm"
398
+ />
399
+ </template>`;
400
+
401
+ /**
402
+ * Calendar with German locale and week starting on Monday.
403
+ * Demonstrates i18n capabilities.
404
+ */
405
+ export const GermanLocale: Story = {
406
+ args: {
407
+ locale: 'de',
408
+ weekStartsOn: 1,
409
+ weekdayFormat: 'short',
410
+ },
411
+ render: (args) => ({
412
+ components: { UiCalendar },
413
+ setup() {
414
+ const date = ref<DateValue>();
415
+ const placeholder = ref(today(getLocalTimeZone()));
416
+ return { date, placeholder, args };
417
+ },
418
+ template: `<UiCalendar
419
+ v-model="date"
420
+ :default-placeholder="placeholder"
421
+ :locale="args.locale"
422
+ :week-starts-on="args.weekStartsOn"
423
+ :weekday-format="args.weekdayFormat"
424
+ :disabled="args.disabled"
425
+ class="rounded-md border shadow-sm"
426
+ />`,
427
+ }),
428
+ parameters: {
429
+ docs: {
430
+ source: {
431
+ code: germanLocaleTemplateSource,
432
+ },
433
+ },
434
+ },
435
+ };
436
+
437
+ const disabledTemplateSource = `<script setup lang="ts">
438
+ import { UiCalendar } from '@aleph-alpha/ui-library'
439
+ </script>
440
+
441
+ <template>
442
+ <UiCalendar disabled class="rounded-md border shadow-sm" />
443
+ </template>`;
444
+
445
+ /**
446
+ * Disabled calendar state.
447
+ * Users cannot interact with the calendar.
448
+ */
449
+ export const Disabled: Story = {
450
+ args: {
451
+ disabled: true,
452
+ },
453
+ render: (args) => ({
454
+ components: { UiCalendar },
455
+ setup() {
456
+ const placeholder = ref(today(getLocalTimeZone()));
457
+ return { placeholder, args };
458
+ },
459
+ template: `<UiCalendar
460
+ :default-placeholder="placeholder"
461
+ :disabled="args.disabled"
462
+ class="rounded-md border shadow-sm"
463
+ />`,
464
+ }),
465
+ parameters: {
466
+ docs: {
467
+ source: {
468
+ code: disabledTemplateSource,
469
+ },
470
+ },
471
+ },
472
+ };
473
+
474
+ const readonlyTemplateSource = `<script setup lang="ts">
475
+ import type { DateValue } from '@aleph-alpha/ui-library'
476
+ import { getLocalTimeZone, today, UiCalendar } from '@aleph-alpha/ui-library'
477
+ import { ref } from 'vue'
478
+
479
+ const date = ref<DateValue>(today(getLocalTimeZone()))
480
+ </script>
481
+
482
+ <template>
483
+ <UiCalendar
484
+ v-model="date"
485
+ readonly
486
+ class="rounded-md border shadow-sm"
487
+ />
488
+ </template>`;
489
+
490
+ /**
491
+ * Read-only calendar state.
492
+ * Users can navigate between months but cannot select dates.
493
+ */
494
+ export const Readonly: Story = {
495
+ args: {
496
+ readonly: true,
497
+ },
498
+ render: (args) => ({
499
+ components: { UiCalendar },
500
+ setup() {
501
+ const date = ref<DateValue>(today(getLocalTimeZone()));
502
+ return { date, args };
503
+ },
504
+ template: `<UiCalendar
505
+ v-model="date"
506
+ :readonly="args.readonly"
507
+ class="rounded-md border shadow-sm"
508
+ />`,
509
+ }),
510
+ parameters: {
511
+ docs: {
512
+ source: {
513
+ code: readonlyTemplateSource,
514
+ },
515
+ },
516
+ },
517
+ };
518
+
519
+ const multipleSelectionTemplateSource = `<script setup lang="ts">
520
+ import type { DateValue } from '@aleph-alpha/ui-library'
521
+ import { ref } from 'vue'
522
+ import { UiCalendar } from '@aleph-alpha/ui-library'
523
+
524
+ const dates = ref<DateValue[]>([])
525
+ </script>
526
+
527
+ <template>
528
+ <UiCalendar
529
+ v-model="dates"
530
+ multiple
531
+ class="rounded-md border shadow-sm"
532
+ />
533
+ </template>`;
534
+
535
+ /**
536
+ * Calendar with multiple date selection enabled.
537
+ * Users can select multiple dates by clicking on them.
538
+ */
539
+ export const MultipleSelection: Story = {
540
+ args: {
541
+ multiple: true,
542
+ },
543
+ render: (args) => ({
544
+ components: { UiCalendar },
545
+ setup() {
546
+ const dates = ref<DateValue[]>([]);
547
+ const placeholder = ref(today(getLocalTimeZone()));
548
+ return { dates, placeholder, args };
549
+ },
550
+ template: `<UiCalendar
551
+ v-model="dates"
552
+ :default-placeholder="placeholder"
553
+ :multiple="args.multiple"
554
+ :disabled="args.disabled"
555
+ :locale="args.locale"
556
+ class="rounded-md border shadow-sm"
557
+ />`,
558
+ }),
559
+ parameters: {
560
+ docs: {
561
+ source: {
562
+ code: multipleSelectionTemplateSource,
563
+ },
564
+ },
565
+ },
566
+ };
567
+
568
+ const unavailableDatesTemplateSource = `<script setup lang="ts">
569
+ import type { DateValue } from '@aleph-alpha/ui-library'
570
+ import { ref } from 'vue'
571
+ import { UiCalendar } from '@aleph-alpha/ui-library'
572
+
573
+ const date = ref<DateValue>()
574
+
575
+ // Mark certain dates as unavailable (e.g., holidays)
576
+ const isDateUnavailable = (date: DateValue) => {
577
+ return date.day === 15 || date.day === 25
578
+ }
579
+ </script>
580
+
581
+ <template>
582
+ <UiCalendar
583
+ v-model="date"
584
+ :is-date-unavailable="isDateUnavailable"
585
+ class="rounded-md border shadow-sm"
586
+ />
587
+ </template>`;
588
+
589
+ /**
590
+ * Calendar with unavailable dates marked.
591
+ * Unavailable dates are styled differently (strikethrough) but may still be selectable.
592
+ * Use this for holidays or dates with limited availability.
593
+ */
594
+ export const UnavailableDates: Story = {
595
+ render: (args) => ({
596
+ components: { UiCalendar },
597
+ setup() {
598
+ const date = ref<DateValue>();
599
+ const placeholder = ref(today(getLocalTimeZone()));
600
+
601
+ // Mark 15th and 25th of each month as unavailable
602
+ const isDateUnavailable = (d: DateValue) => {
603
+ return d.day === 15 || d.day === 25;
604
+ };
605
+
606
+ return { date, placeholder, isDateUnavailable, args };
607
+ },
608
+ template: `<UiCalendar
609
+ v-model="date"
610
+ :default-placeholder="placeholder"
611
+ :is-date-unavailable="isDateUnavailable"
612
+ :disabled="args.disabled"
613
+ :locale="args.locale"
614
+ class="rounded-md border shadow-sm"
615
+ />`,
616
+ }),
617
+ parameters: {
618
+ docs: {
619
+ source: {
620
+ code: unavailableDatesTemplateSource,
621
+ },
622
+ },
623
+ },
624
+ };
625
+
626
+ const fixedWeeksTemplateSource = `<script setup lang="ts">
627
+ import type { DateValue } from '@aleph-alpha/ui-library'
628
+ import { ref } from 'vue'
629
+ import { UiCalendar } from '@aleph-alpha/ui-library'
630
+
631
+ const date = ref<DateValue>()
632
+ </script>
633
+
634
+ <template>
635
+ <UiCalendar
636
+ v-model="date"
637
+ fixed-weeks
638
+ class="rounded-md border shadow-sm"
639
+ />
640
+ </template>`;
641
+
642
+ /**
643
+ * Calendar that always shows 6 weeks.
644
+ * Useful for maintaining consistent height regardless of the month.
645
+ */
646
+ export const FixedWeeks: Story = {
647
+ args: {
648
+ fixedWeeks: true,
649
+ },
650
+ render: (args) => ({
651
+ components: { UiCalendar },
652
+ setup() {
653
+ const date = ref<DateValue>();
654
+ const placeholder = ref(today(getLocalTimeZone()));
655
+ return { date, placeholder, args };
656
+ },
657
+ template: `<UiCalendar
658
+ v-model="date"
659
+ :default-placeholder="placeholder"
660
+ :fixed-weeks="args.fixedWeeks"
661
+ :disabled="args.disabled"
662
+ :locale="args.locale"
663
+ class="rounded-md border shadow-sm"
664
+ />`,
665
+ }),
666
+ parameters: {
667
+ docs: {
668
+ source: {
669
+ code: fixedWeeksTemplateSource,
670
+ },
671
+ },
672
+ },
673
+ };
674
+
675
+ const preventDeselectTemplateSource = `<script setup lang="ts">
676
+ import type { DateValue } from '@aleph-alpha/ui-library'
677
+ import { getLocalTimeZone, today, UiCalendar } from '@aleph-alpha/ui-library'
678
+ import { ref } from 'vue'
679
+
680
+ const date = ref<DateValue>(today(getLocalTimeZone()))
681
+ </script>
682
+
683
+ <template>
684
+ <UiCalendar
685
+ v-model="date"
686
+ prevent-deselect
687
+ class="rounded-md border shadow-sm"
688
+ />
689
+ </template>`;
690
+
691
+ /**
692
+ * Calendar that prevents deselecting a date.
693
+ * Once a date is selected, clicking it again won't deselect it.
694
+ * The user must select a different date instead.
695
+ */
696
+ export const PreventDeselect: Story = {
697
+ args: {
698
+ preventDeselect: true,
699
+ },
700
+ render: (args) => ({
701
+ components: { UiCalendar },
702
+ setup() {
703
+ const date = ref<DateValue>(today(getLocalTimeZone()));
704
+ return { date, args };
705
+ },
706
+ template: `<UiCalendar
707
+ v-model="date"
708
+ :prevent-deselect="args.preventDeselect"
709
+ :disabled="args.disabled"
710
+ :locale="args.locale"
711
+ class="rounded-md border shadow-sm"
712
+ />`,
713
+ }),
714
+ parameters: {
715
+ docs: {
716
+ source: {
717
+ code: preventDeselectTemplateSource,
718
+ },
719
+ },
720
+ },
721
+ };
722
+
723
+ const customHeadingTemplateSource = `<script setup lang="ts">
724
+ import type { DateValue } from '@aleph-alpha/ui-library'
725
+ import { getLocalTimeZone, today, UiCalendar, UiIcon } from '@aleph-alpha/ui-library'
726
+ import { ref } from 'vue'
727
+
728
+ const date = ref<DateValue>()
729
+ const defaultPlaceholder = today(getLocalTimeZone())
730
+ </script>
731
+
732
+ <template>
733
+ <UiCalendar
734
+ v-model="date"
735
+ :default-placeholder="defaultPlaceholder"
736
+ weekday-format="short"
737
+ class="rounded-md border shadow-sm **:data-[slot=calendar-cell-trigger]:size-12!"
738
+ >
739
+ <template #calendar-heading="{ date, month }">
740
+ <div class="flex gap-2 items-center">
741
+ <div>Custom heading</div>
742
+ <component :is="month" :date="date" />
743
+ </div>
744
+ </template>
745
+ <template #prev-icon>
746
+ <UiIcon icon="i-material-symbols-chevrons-left" class="size-5 text-red-500" />
747
+ </template>
748
+ <template #next-icon>
749
+ <UiIcon icon="i-material-symbols-chevrons-right" class="size-5 text-red-500" />
750
+ </template>
751
+ </UiCalendar>
752
+ </template>`;
753
+
754
+ /**
755
+ * Calendar with custom heading, larger cells, and custom navigation icons.
756
+ */
757
+ export const CustomHeadingAndCellSize: Story = {
758
+ args: {
759
+ weekdayFormat: 'short',
760
+ },
761
+ render: (args) => ({
762
+ components: { UiCalendar, UiIcon },
763
+ setup() {
764
+ const date = ref<DateValue>();
765
+ const placeholder = ref(today(getLocalTimeZone()));
766
+ return { date, placeholder, args };
767
+ },
768
+ template: `<UiCalendar
769
+ v-model="date"
770
+ :default-placeholder="placeholder"
771
+ :weekday-format="args.weekdayFormat"
772
+ :disabled="args.disabled"
773
+ :locale="args.locale"
774
+ class="rounded-md border shadow-sm **:data-[slot=calendar-cell-trigger]:size-12!"
775
+ >
776
+ <template #calendar-heading="{ date, month }">
777
+ <div class="flex gap-2 items-center">
778
+ <div>Custom heading</div>
779
+ <component :is="month" :date="date" />
780
+ </div>
781
+ </template>
782
+ <template #prev-icon>
783
+ <UiIcon icon="i-material-symbols-chevrons-left" class="size-5 text-red-500" />
784
+ </template>
785
+ <template #next-icon>
786
+ <UiIcon icon="i-material-symbols-chevrons-right" class="size-5 text-red-500" />
787
+ </template>
788
+ </UiCalendar>`,
789
+ }),
790
+ parameters: {
791
+ docs: {
792
+ source: {
793
+ code: customHeadingTemplateSource,
794
+ },
795
+ },
796
+ },
797
+ };