@dogsbay/ui 0.2.0-beta.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 (322) hide show
  1. package/package.json +38 -0
  2. package/src/accordion/Accordion.astro +38 -0
  3. package/src/accordion/AccordionContent.astro +25 -0
  4. package/src/accordion/AccordionItem.astro +26 -0
  5. package/src/accordion/AccordionTrigger.astro +38 -0
  6. package/src/accordion/accordion.ts +189 -0
  7. package/src/accordion/index.ts +4 -0
  8. package/src/alert/Alert.astro +69 -0
  9. package/src/alert/AlertDescription.astro +17 -0
  10. package/src/alert/AlertTitle.astro +21 -0
  11. package/src/alert/CollapsibleAlert.astro +103 -0
  12. package/src/alert/icon.ts +32 -0
  13. package/src/alert/index.ts +4 -0
  14. package/src/alert/variants.ts +29 -0
  15. package/src/alert-dialog/AlertDialog.astro +16 -0
  16. package/src/alert-dialog/AlertDialogAction.astro +23 -0
  17. package/src/alert-dialog/AlertDialogCancel.astro +23 -0
  18. package/src/alert-dialog/AlertDialogContent.astro +37 -0
  19. package/src/alert-dialog/AlertDialogDescription.astro +18 -0
  20. package/src/alert-dialog/AlertDialogFooter.astro +18 -0
  21. package/src/alert-dialog/AlertDialogHeader.astro +18 -0
  22. package/src/alert-dialog/AlertDialogTitle.astro +18 -0
  23. package/src/alert-dialog/AlertDialogTrigger.astro +24 -0
  24. package/src/alert-dialog/alert-dialog.ts +154 -0
  25. package/src/alert-dialog/index.ts +9 -0
  26. package/src/api-doc/ApiDoc.astro +52 -0
  27. package/src/api-doc/index.ts +1 -0
  28. package/src/api-layout/ApiCodePanel.astro +21 -0
  29. package/src/api-layout/ApiLayout.astro +29 -0
  30. package/src/api-layout/ExampleBlock.astro +63 -0
  31. package/src/api-params/ApiParams.astro +96 -0
  32. package/src/api-params/index.ts +1 -0
  33. package/src/api-source/ApiSource.astro +20 -0
  34. package/src/api-source/api-source.css +32 -0
  35. package/src/api-source/index.ts +1 -0
  36. package/src/api-symbol/ApiSymbol.astro +48 -0
  37. package/src/api-symbol/api-symbol.css +89 -0
  38. package/src/api-symbol/index.ts +1 -0
  39. package/src/api-url-bar/ApiUrlBar.astro +63 -0
  40. package/src/avatar/Avatar.astro +57 -0
  41. package/src/avatar/index.ts +1 -0
  42. package/src/badge/Badge.astro +37 -0
  43. package/src/badge/index.ts +1 -0
  44. package/src/breadcrumb/Breadcrumb.astro +32 -0
  45. package/src/breadcrumb/BreadcrumbEllipsis.astro +32 -0
  46. package/src/breadcrumb/BreadcrumbItem.astro +41 -0
  47. package/src/breadcrumb/BreadcrumbSeparator.astro +33 -0
  48. package/src/breadcrumb/index.ts +4 -0
  49. package/src/button/Button.astro +70 -0
  50. package/src/button/index.ts +1 -0
  51. package/src/card/Card.astro +17 -0
  52. package/src/card/CardContent.astro +17 -0
  53. package/src/card/CardDescription.astro +17 -0
  54. package/src/card/CardFooter.astro +17 -0
  55. package/src/card/CardHeader.astro +17 -0
  56. package/src/card/CardTitle.astro +17 -0
  57. package/src/card/index.ts +6 -0
  58. package/src/checkbox/Checkbox.astro +70 -0
  59. package/src/checkbox/index.ts +1 -0
  60. package/src/checkbox-group/CheckboxGroup.astro +38 -0
  61. package/src/checkbox-group/checkbox-group.ts +53 -0
  62. package/src/checkbox-group/index.ts +1 -0
  63. package/src/code-block/CodeBlock.astro +160 -0
  64. package/src/code-rich/CodeRich.astro +267 -0
  65. package/src/code-rich/code-rich.css +68 -0
  66. package/src/code-rich/index.ts +1 -0
  67. package/src/code-samples/CodeSamples.astro +59 -0
  68. package/src/collapsible/Collapsible.astro +35 -0
  69. package/src/collapsible/CollapsibleContent.astro +24 -0
  70. package/src/collapsible/CollapsibleTrigger.astro +23 -0
  71. package/src/collapsible/collapsible.ts +42 -0
  72. package/src/collapsible/index.ts +3 -0
  73. package/src/combobox/Combobox.astro +53 -0
  74. package/src/combobox/ComboboxEmpty.astro +18 -0
  75. package/src/combobox/ComboboxItem.astro +28 -0
  76. package/src/combobox/combobox.ts +179 -0
  77. package/src/combobox/index.ts +3 -0
  78. package/src/command/Command.astro +22 -0
  79. package/src/command/CommandEmpty.astro +18 -0
  80. package/src/command/CommandGroup.astro +24 -0
  81. package/src/command/CommandInput.astro +49 -0
  82. package/src/command/CommandItem.astro +26 -0
  83. package/src/command/CommandList.astro +19 -0
  84. package/src/command/CommandSeparator.astro +16 -0
  85. package/src/command/CommandShortcut.astro +18 -0
  86. package/src/command/command.ts +212 -0
  87. package/src/command/index.ts +8 -0
  88. package/src/content-renderer/ContentRenderer.astro +410 -0
  89. package/src/content-renderer/InlineRenderer.astro +149 -0
  90. package/src/context-menu/ContextMenu.astro +22 -0
  91. package/src/context-menu/ContextMenuContent.astro +24 -0
  92. package/src/context-menu/ContextMenuItem.astro +49 -0
  93. package/src/context-menu/ContextMenuSeparator.astro +14 -0
  94. package/src/context-menu/ContextMenuShortcut.astro +14 -0
  95. package/src/context-menu/ContextMenuTrigger.astro +22 -0
  96. package/src/context-menu/context-menu.ts +238 -0
  97. package/src/context-menu/index.ts +6 -0
  98. package/src/copy-button/CopyButton.astro +88 -0
  99. package/src/copy-button/index.ts +1 -0
  100. package/src/diagram/Diagram.astro +15 -0
  101. package/src/diagram/index.ts +1 -0
  102. package/src/dialog/Dialog.astro +22 -0
  103. package/src/dialog/DialogClose.astro +32 -0
  104. package/src/dialog/DialogContent.astro +37 -0
  105. package/src/dialog/DialogDescription.astro +22 -0
  106. package/src/dialog/DialogFooter.astro +18 -0
  107. package/src/dialog/DialogHeader.astro +18 -0
  108. package/src/dialog/DialogTitle.astro +18 -0
  109. package/src/dialog/DialogTrigger.astro +33 -0
  110. package/src/dialog/dialog.ts +291 -0
  111. package/src/dialog/index.ts +8 -0
  112. package/src/docs-footer/DocsFooter.astro +50 -0
  113. package/src/docs-header/DocsHeader.astro +32 -0
  114. package/src/docs-layout/DocsLayout.astro +187 -0
  115. package/src/docs-layout/index.ts +1 -0
  116. package/src/drawer/Drawer.astro +12 -0
  117. package/src/drawer/DrawerClose.astro +12 -0
  118. package/src/drawer/DrawerContent.astro +46 -0
  119. package/src/drawer/DrawerDescription.astro +10 -0
  120. package/src/drawer/DrawerFooter.astro +10 -0
  121. package/src/drawer/DrawerHandle.astro +16 -0
  122. package/src/drawer/DrawerHeader.astro +10 -0
  123. package/src/drawer/DrawerTitle.astro +10 -0
  124. package/src/drawer/DrawerTrigger.astro +25 -0
  125. package/src/drawer/drawer.ts +262 -0
  126. package/src/drawer/index.ts +9 -0
  127. package/src/dropdown-menu/DropdownMenu.astro +22 -0
  128. package/src/dropdown-menu/DropdownMenuContent.astro +33 -0
  129. package/src/dropdown-menu/DropdownMenuGroup.astro +17 -0
  130. package/src/dropdown-menu/DropdownMenuItem.astro +48 -0
  131. package/src/dropdown-menu/DropdownMenuLabel.astro +28 -0
  132. package/src/dropdown-menu/DropdownMenuSeparator.astro +21 -0
  133. package/src/dropdown-menu/DropdownMenuShortcut.astro +18 -0
  134. package/src/dropdown-menu/DropdownMenuTrigger.astro +34 -0
  135. package/src/dropdown-menu/dropdown-menu.ts +348 -0
  136. package/src/dropdown-menu/index.ts +8 -0
  137. package/src/endpoint-card/EndpointCard.astro +60 -0
  138. package/src/endpoint-card/EndpointCardSection.astro +22 -0
  139. package/src/endpoint-card/EndpointSection.astro +35 -0
  140. package/src/field/Field.astro +31 -0
  141. package/src/field/FieldDescription.astro +22 -0
  142. package/src/field/FieldLabel.astro +24 -0
  143. package/src/field/field.ts +61 -0
  144. package/src/field/index.ts +3 -0
  145. package/src/fieldset/Fieldset.astro +24 -0
  146. package/src/fieldset/FieldsetLegend.astro +18 -0
  147. package/src/fieldset/index.ts +2 -0
  148. package/src/footnote/Footnote.astro +37 -0
  149. package/src/footnote/footnote.ts +79 -0
  150. package/src/footnote/index.ts +1 -0
  151. package/src/form/Form.astro +27 -0
  152. package/src/form/form.ts +160 -0
  153. package/src/form/index.ts +1 -0
  154. package/src/grid/Grid.astro +117 -0
  155. package/src/grid/GridItem.astro +95 -0
  156. package/src/grid/index.ts +2 -0
  157. package/src/image/Image.astro +115 -0
  158. package/src/image/index.ts +1 -0
  159. package/src/input/Input.astro +34 -0
  160. package/src/input/index.ts +1 -0
  161. package/src/kbd/Kbd.astro +17 -0
  162. package/src/kbd/index.ts +1 -0
  163. package/src/label/Label.astro +17 -0
  164. package/src/label/index.ts +1 -0
  165. package/src/link-card/LinkCard.astro +47 -0
  166. package/src/link-card/index.ts +1 -0
  167. package/src/map-view/MapView.astro +88 -0
  168. package/src/map-view/index.ts +1 -0
  169. package/src/map-view/map-view.ts +194 -0
  170. package/src/markdown-example/MarkdownExample.astro +138 -0
  171. package/src/markdown-example/index.ts +1 -0
  172. package/src/math/MathKatex.astro +35 -0
  173. package/src/math/index.ts +1 -0
  174. package/src/menubar/Menubar.astro +25 -0
  175. package/src/menubar/MenubarContent.astro +24 -0
  176. package/src/menubar/MenubarItem.astro +26 -0
  177. package/src/menubar/MenubarMenu.astro +12 -0
  178. package/src/menubar/MenubarSeparator.astro +11 -0
  179. package/src/menubar/MenubarShortcut.astro +11 -0
  180. package/src/menubar/MenubarTrigger.astro +27 -0
  181. package/src/menubar/index.ts +7 -0
  182. package/src/menubar/menubar.ts +258 -0
  183. package/src/meter/Meter.astro +75 -0
  184. package/src/meter/index.ts +1 -0
  185. package/src/method-badge/MethodBadge.astro +32 -0
  186. package/src/navigation-menu/NavigationMenu.astro +24 -0
  187. package/src/navigation-menu/NavigationMenuContent.astro +24 -0
  188. package/src/navigation-menu/NavigationMenuItem.astro +22 -0
  189. package/src/navigation-menu/NavigationMenuLink.astro +26 -0
  190. package/src/navigation-menu/NavigationMenuList.astro +22 -0
  191. package/src/navigation-menu/NavigationMenuTrigger.astro +40 -0
  192. package/src/navigation-menu/index.ts +6 -0
  193. package/src/navigation-menu/navigation-menu.ts +192 -0
  194. package/src/number-field/NumberField.astro +84 -0
  195. package/src/number-field/index.ts +1 -0
  196. package/src/number-field/number-field.ts +68 -0
  197. package/src/pagination/Pagination.astro +59 -0
  198. package/src/pagination/index.ts +1 -0
  199. package/src/parameter-table/ParameterTable.astro +75 -0
  200. package/src/popover/Popover.astro +21 -0
  201. package/src/popover/PopoverContent.astro +31 -0
  202. package/src/popover/PopoverTrigger.astro +31 -0
  203. package/src/popover/index.ts +3 -0
  204. package/src/popover/popover.ts +144 -0
  205. package/src/preview-card/PreviewCard.astro +24 -0
  206. package/src/preview-card/PreviewCardContent.astro +24 -0
  207. package/src/preview-card/PreviewCardTrigger.astro +23 -0
  208. package/src/preview-card/index.ts +3 -0
  209. package/src/preview-card/preview-card.ts +91 -0
  210. package/src/progress/Progress.astro +61 -0
  211. package/src/progress/index.ts +1 -0
  212. package/src/property-item/PropertyItem.astro +183 -0
  213. package/src/property-list/PropertyList.astro +68 -0
  214. package/src/radio-group/RadioGroup.astro +41 -0
  215. package/src/radio-group/RadioGroupItem.astro +36 -0
  216. package/src/radio-group/index.ts +2 -0
  217. package/src/radio-group/radio-group.ts +126 -0
  218. package/src/response-tabs/ResponseTabs.astro +60 -0
  219. package/src/schema-viewer/SchemaViewer.astro +42 -0
  220. package/src/scroll-area/ScrollArea.astro +44 -0
  221. package/src/scroll-area/index.ts +1 -0
  222. package/src/scroll-area/scroll-area.ts +176 -0
  223. package/src/select/Select.astro +34 -0
  224. package/src/select/SelectContent.astro +24 -0
  225. package/src/select/SelectGroup.astro +23 -0
  226. package/src/select/SelectItem.astro +28 -0
  227. package/src/select/SelectLabel.astro +18 -0
  228. package/src/select/SelectSeparator.astro +22 -0
  229. package/src/select/SelectTrigger.astro +28 -0
  230. package/src/select/SelectValue.astro +18 -0
  231. package/src/select/index.ts +8 -0
  232. package/src/select/select.ts +381 -0
  233. package/src/separator/Separator.astro +35 -0
  234. package/src/separator/index.ts +1 -0
  235. package/src/sheet/Sheet.astro +12 -0
  236. package/src/sheet/SheetClose.astro +35 -0
  237. package/src/sheet/SheetContent.astro +52 -0
  238. package/src/sheet/SheetDescription.astro +18 -0
  239. package/src/sheet/SheetFooter.astro +18 -0
  240. package/src/sheet/SheetHeader.astro +18 -0
  241. package/src/sheet/SheetTitle.astro +18 -0
  242. package/src/sheet/SheetTrigger.astro +32 -0
  243. package/src/sheet/index.ts +8 -0
  244. package/src/sheet/sheet.ts +173 -0
  245. package/src/sidebar/Sidebar.astro +113 -0
  246. package/src/sidebar/SidebarContent.astro +18 -0
  247. package/src/sidebar/SidebarFooter.astro +18 -0
  248. package/src/sidebar/SidebarGroup.astro +18 -0
  249. package/src/sidebar/SidebarGroupContent.astro +18 -0
  250. package/src/sidebar/SidebarGroupLabel.astro +18 -0
  251. package/src/sidebar/SidebarHeader.astro +18 -0
  252. package/src/sidebar/SidebarInset.astro +18 -0
  253. package/src/sidebar/SidebarMenu.astro +18 -0
  254. package/src/sidebar/SidebarMenuBadge.astro +18 -0
  255. package/src/sidebar/SidebarMenuButton.astro +71 -0
  256. package/src/sidebar/SidebarMenuItem.astro +18 -0
  257. package/src/sidebar/SidebarMenuSub.astro +18 -0
  258. package/src/sidebar/SidebarMenuSubButton.astro +45 -0
  259. package/src/sidebar/SidebarMenuSubItem.astro +12 -0
  260. package/src/sidebar/SidebarNavTree.astro +106 -0
  261. package/src/sidebar/SidebarProvider.astro +23 -0
  262. package/src/sidebar/SidebarRail.astro +25 -0
  263. package/src/sidebar/SidebarSeparator.astro +21 -0
  264. package/src/sidebar/SidebarTrigger.astro +40 -0
  265. package/src/sidebar/index.ts +19 -0
  266. package/src/sidebar/sidebar.ts +265 -0
  267. package/src/skeleton/Skeleton.astro +16 -0
  268. package/src/skeleton/index.ts +1 -0
  269. package/src/skip-link/SkipLink.astro +24 -0
  270. package/src/slider/Slider.astro +61 -0
  271. package/src/slider/index.ts +1 -0
  272. package/src/slider/slider.ts +111 -0
  273. package/src/spinner/Spinner.astro +54 -0
  274. package/src/spinner/index.ts +1 -0
  275. package/src/steps/Step.astro +16 -0
  276. package/src/steps/Steps.astro +122 -0
  277. package/src/steps/SubSteps.astro +73 -0
  278. package/src/switch/Switch.astro +52 -0
  279. package/src/switch/index.ts +1 -0
  280. package/src/switch/switch.ts +109 -0
  281. package/src/table/Table.astro +24 -0
  282. package/src/table/TableBody.astro +18 -0
  283. package/src/table/TableCaption.astro +18 -0
  284. package/src/table/TableCell.astro +18 -0
  285. package/src/table/TableFooter.astro +18 -0
  286. package/src/table/TableHead.astro +18 -0
  287. package/src/table/TableHeader.astro +18 -0
  288. package/src/table/TableRow.astro +18 -0
  289. package/src/table/index.ts +8 -0
  290. package/src/tabs/Tabs.astro +37 -0
  291. package/src/tabs/TabsContent.astro +32 -0
  292. package/src/tabs/TabsList.astro +23 -0
  293. package/src/tabs/TabsTrigger.astro +29 -0
  294. package/src/tabs/index.ts +4 -0
  295. package/src/tabs/tabs.ts +220 -0
  296. package/src/textarea/Textarea.astro +25 -0
  297. package/src/textarea/index.ts +1 -0
  298. package/src/theme-toggle/ThemeToggle.astro +67 -0
  299. package/src/theme-toggle/index.ts +1 -0
  300. package/src/toast/Toaster.astro +39 -0
  301. package/src/toast/index.ts +3 -0
  302. package/src/toast/toast.ts +104 -0
  303. package/src/toc/TableOfContents.astro +225 -0
  304. package/src/toggle/Toggle.astro +56 -0
  305. package/src/toggle/index.ts +1 -0
  306. package/src/toggle/toggle.ts +38 -0
  307. package/src/toggle-group/ToggleGroup.astro +39 -0
  308. package/src/toggle-group/ToggleGroupItem.astro +56 -0
  309. package/src/toggle-group/index.ts +2 -0
  310. package/src/toggle-group/toggle-group.ts +121 -0
  311. package/src/toolbar/Toolbar.astro +26 -0
  312. package/src/toolbar/ToolbarButton.astro +29 -0
  313. package/src/toolbar/ToolbarSeparator.astro +14 -0
  314. package/src/toolbar/index.ts +3 -0
  315. package/src/toolbar/toolbar.ts +65 -0
  316. package/src/tooltip/Tooltip.astro +21 -0
  317. package/src/tooltip/TooltipContent.astro +25 -0
  318. package/src/tooltip/TooltipTrigger.astro +31 -0
  319. package/src/tooltip/index.ts +3 -0
  320. package/src/tooltip/tooltip.ts +156 -0
  321. package/src/youtube/YouTube.astro +119 -0
  322. package/src/youtube/index.ts +1 -0
@@ -0,0 +1,36 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const radioItem = tv({
5
+ base: "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
6
+ });
7
+
8
+ interface Props {
9
+ value: string;
10
+ disabled?: boolean;
11
+ class?: string;
12
+ [key: string]: unknown;
13
+ }
14
+
15
+ const { value, disabled = false, class: className, ...rest } = Astro.props;
16
+ ---
17
+
18
+ <button
19
+ class={radioItem({ class: className })}
20
+ data-part="item"
21
+ data-value={value}
22
+ type="button"
23
+ role="radio"
24
+ aria-checked="false"
25
+ disabled={disabled || undefined}
26
+ aria-disabled={disabled ? "true" : undefined}
27
+ tabindex="-1"
28
+ {...rest}
29
+ >
30
+ <span class="flex items-center justify-center">
31
+ <span
32
+ class="hidden h-2.5 w-2.5 rounded-full bg-current"
33
+ data-part="indicator"
34
+ ></span>
35
+ </span>
36
+ </button>
@@ -0,0 +1,2 @@
1
+ export { default as RadioGroup } from "./RadioGroup.astro";
2
+ export { default as RadioGroupItem } from "./RadioGroupItem.astro";
@@ -0,0 +1,126 @@
1
+ function init(root: HTMLElement) {
2
+ if (root.hasAttribute("data-initialized")) return;
3
+ root.setAttribute("data-initialized", "");
4
+
5
+ const name = root.getAttribute("data-name") || "";
6
+ const orientation = root.getAttribute("data-orientation") || "vertical";
7
+ const items = () =>
8
+ Array.from(
9
+ root.querySelectorAll<HTMLElement>(
10
+ "[data-part='item']:not([disabled])",
11
+ ),
12
+ );
13
+
14
+ // Hidden input for form submission
15
+ const hiddenInput = document.createElement("input");
16
+ hiddenInput.type = "hidden";
17
+ hiddenInput.name = name;
18
+ root.appendChild(hiddenInput);
19
+
20
+ function select(item: HTMLElement) {
21
+ const value = item.getAttribute("data-value") || "";
22
+
23
+ // Deselect all
24
+ root
25
+ .querySelectorAll<HTMLElement>("[data-part='item']")
26
+ .forEach((el) => {
27
+ el.setAttribute("aria-checked", "false");
28
+ el.setAttribute("tabindex", "-1");
29
+ const indicator = el.querySelector<HTMLElement>(
30
+ "[data-part='indicator']",
31
+ );
32
+ if (indicator) indicator.classList.add("hidden");
33
+ });
34
+
35
+ // Select this one
36
+ item.setAttribute("aria-checked", "true");
37
+ item.setAttribute("tabindex", "0");
38
+ const indicator = item.querySelector<HTMLElement>(
39
+ "[data-part='indicator']",
40
+ );
41
+ if (indicator) indicator.classList.remove("hidden");
42
+
43
+ hiddenInput.value = value;
44
+
45
+ root.dispatchEvent(
46
+ new CustomEvent("change", { detail: { value }, bubbles: true }),
47
+ );
48
+ }
49
+
50
+ // Click handler
51
+ root.addEventListener("click", (e) => {
52
+ const item = (e.target as HTMLElement).closest<HTMLElement>(
53
+ "[data-part='item']:not([disabled])",
54
+ );
55
+ if (!item) return;
56
+ select(item);
57
+ item.focus();
58
+ });
59
+
60
+ // Keyboard navigation
61
+ root.addEventListener("keydown", (e) => {
62
+ const item = (e.target as HTMLElement).closest<HTMLElement>(
63
+ "[data-part='item']",
64
+ );
65
+ if (!item) return;
66
+
67
+ const enabledItems = items();
68
+ const currentIndex = enabledItems.indexOf(item);
69
+ if (currentIndex === -1) return;
70
+
71
+ const isVertical = orientation === "vertical";
72
+ const nextKey = isVertical ? "ArrowDown" : "ArrowRight";
73
+ const prevKey = isVertical ? "ArrowUp" : "ArrowLeft";
74
+
75
+ let nextIndex: number | null = null;
76
+
77
+ switch (e.key) {
78
+ case nextKey:
79
+ nextIndex = (currentIndex + 1) % enabledItems.length;
80
+ break;
81
+ case prevKey:
82
+ nextIndex =
83
+ (currentIndex - 1 + enabledItems.length) % enabledItems.length;
84
+ break;
85
+ case "Home":
86
+ nextIndex = 0;
87
+ break;
88
+ case "End":
89
+ nextIndex = enabledItems.length - 1;
90
+ break;
91
+ default:
92
+ return;
93
+ }
94
+
95
+ e.preventDefault();
96
+ const next = enabledItems[nextIndex];
97
+ select(next);
98
+ next.focus();
99
+ });
100
+
101
+ // Initialize default value
102
+ const defaultValue = root.getAttribute("data-default-value");
103
+ if (defaultValue) {
104
+ const defaultItem = root.querySelector<HTMLElement>(
105
+ `[data-part='item'][data-value='${defaultValue}']`,
106
+ );
107
+ if (defaultItem) select(defaultItem);
108
+ } else {
109
+ // First enabled item gets tabindex 0
110
+ const first = items()[0];
111
+ if (first) first.setAttribute("tabindex", "0");
112
+ }
113
+ }
114
+
115
+ function initAll() {
116
+ document
117
+ .querySelectorAll<HTMLElement>("[data-component='radio-group']")
118
+ .forEach(init);
119
+ }
120
+
121
+ if (document.readyState === "loading") {
122
+ document.addEventListener("DOMContentLoaded", initAll);
123
+ } else {
124
+ initAll();
125
+ }
126
+ document.addEventListener("astro:page-load", initAll);
@@ -0,0 +1,60 @@
1
+ ---
2
+ import Tabs from "../tabs/Tabs.astro";
3
+ import TabsList from "../tabs/TabsList.astro";
4
+ import TabsTrigger from "../tabs/TabsTrigger.astro";
5
+ import TabsContent from "../tabs/TabsContent.astro";
6
+ import SchemaViewer from "../schema-viewer/SchemaViewer.astro";
7
+
8
+ interface SchemaProperty {
9
+ name: string;
10
+ type: string;
11
+ description?: string;
12
+ required?: boolean;
13
+ nullable?: boolean;
14
+ format?: string;
15
+ enum?: string[];
16
+ default?: unknown;
17
+ example?: unknown;
18
+ }
19
+
20
+ interface ResponseDef {
21
+ status: string;
22
+ description?: string;
23
+ schema?: SchemaProperty[];
24
+ example?: unknown;
25
+ }
26
+
27
+ interface Props {
28
+ responses: ResponseDef[];
29
+ class?: string;
30
+ }
31
+
32
+ const { responses, class: className } = Astro.props;
33
+
34
+ function statusColor(status: string): string {
35
+ if (status.startsWith("2")) return "bg-api-status-2xx/20 text-api-status-2xx";
36
+ if (status.startsWith("3")) return "bg-api-status-3xx/20 text-api-status-3xx";
37
+ if (status.startsWith("4")) return "bg-api-status-4xx/20 text-api-status-4xx";
38
+ if (status.startsWith("5")) return "bg-api-status-5xx/20 text-api-status-5xx";
39
+ return "bg-muted/20 text-muted-foreground";
40
+ }
41
+ ---
42
+
43
+ <Tabs defaultValue={responses[0]?.status} class={className}>
44
+ <TabsList>
45
+ {responses.map((r) => (
46
+ <TabsTrigger value={r.status}>
47
+ <span class:list={["rounded px-1.5 py-0.5 text-xs font-mono font-bold", statusColor(r.status)]}>
48
+ {r.status}
49
+ </span>
50
+ </TabsTrigger>
51
+ ))}
52
+ </TabsList>
53
+
54
+ {responses.map((r, i) => (
55
+ <TabsContent value={r.status} default={i === 0}>
56
+ {r.description && <p class="mb-3 text-sm text-muted-foreground">{r.description}</p>}
57
+ {r.schema && <SchemaViewer properties={r.schema} />}
58
+ </TabsContent>
59
+ ))}
60
+ </Tabs>
@@ -0,0 +1,42 @@
1
+ ---
2
+ /**
3
+ * JSON Schema property list with nested expand/collapse.
4
+ * Uses PropertyItem for consistent rendering with PropertyList.
5
+ */
6
+ import PropertyItem from "../property-item/PropertyItem.astro";
7
+
8
+ interface SchemaProperty {
9
+ name: string;
10
+ type: string;
11
+ description?: string;
12
+ required?: boolean;
13
+ nullable?: boolean;
14
+ format?: string;
15
+ enum?: string[];
16
+ default?: unknown;
17
+ example?: unknown;
18
+ properties?: SchemaProperty[];
19
+ items?: SchemaProperty[];
20
+ }
21
+
22
+ interface Props {
23
+ properties: SchemaProperty[];
24
+ title?: string;
25
+ class?: string;
26
+ }
27
+
28
+ const { properties, title, class: className } = Astro.props;
29
+ ---
30
+
31
+ <div class:list={["rounded-lg border bg-card", className]}>
32
+ {title && (
33
+ <div class="border-b px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">
34
+ {title}
35
+ </div>
36
+ )}
37
+ <div>
38
+ {properties.map((prop) => (
39
+ <PropertyItem {...prop} />
40
+ ))}
41
+ </div>
42
+ </div>
@@ -0,0 +1,44 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const scrollArea = tv({
5
+ base: "relative overflow-hidden",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <div
17
+ class={scrollArea({ class: className })}
18
+ data-component="scroll-area"
19
+ {...rest}
20
+ >
21
+ <div class="h-full w-full overflow-auto scrollbar-none" data-part="viewport" tabindex="0">
22
+ <slot />
23
+ </div>
24
+ <div
25
+ class="absolute right-0 top-0 h-full w-2.5 touch-none select-none border-l border-l-transparent p-[1px] transition-opacity"
26
+ data-part="scrollbar"
27
+ data-orientation="vertical"
28
+ >
29
+ <div
30
+ class="relative w-full rounded-full bg-border"
31
+ data-part="thumb"
32
+ ></div>
33
+ </div>
34
+ <div
35
+ class="absolute bottom-0 left-0 h-2.5 w-full touch-none select-none border-t border-t-transparent p-[1px] transition-opacity"
36
+ data-part="scrollbar"
37
+ data-orientation="horizontal"
38
+ >
39
+ <div
40
+ class="relative h-full rounded-full bg-border"
41
+ data-part="thumb"
42
+ ></div>
43
+ </div>
44
+ </div>
@@ -0,0 +1 @@
1
+ export { default as ScrollArea } from "./ScrollArea.astro";
@@ -0,0 +1,176 @@
1
+ function init(root: HTMLElement) {
2
+ if (root.hasAttribute("data-initialized")) return;
3
+ root.setAttribute("data-initialized", "");
4
+
5
+ const viewport = root.querySelector<HTMLElement>("[data-part='viewport']");
6
+ if (!viewport) return;
7
+
8
+ const vBar = root.querySelector<HTMLElement>(
9
+ "[data-part='scrollbar'][data-orientation='vertical']",
10
+ );
11
+ const hBar = root.querySelector<HTMLElement>(
12
+ "[data-part='scrollbar'][data-orientation='horizontal']",
13
+ );
14
+ const vThumb = vBar?.querySelector<HTMLElement>("[data-part='thumb']");
15
+ const hThumb = hBar?.querySelector<HTMLElement>("[data-part='thumb']");
16
+
17
+ let hideTimeout: ReturnType<typeof setTimeout>;
18
+
19
+ function updateScrollbars() {
20
+ const {
21
+ scrollTop,
22
+ scrollLeft,
23
+ scrollHeight,
24
+ scrollWidth,
25
+ clientHeight,
26
+ clientWidth,
27
+ } = viewport!;
28
+
29
+ // Vertical
30
+ if (vBar && vThumb) {
31
+ const hasOverflow = scrollHeight > clientHeight;
32
+ vBar.style.opacity = hasOverflow ? "1" : "0";
33
+ if (hasOverflow) {
34
+ const ratio = clientHeight / scrollHeight;
35
+ const thumbHeight = Math.max(ratio * clientHeight, 20);
36
+ const thumbTop =
37
+ (scrollTop / (scrollHeight - clientHeight)) *
38
+ (clientHeight - thumbHeight);
39
+ vThumb.style.height = `${thumbHeight}px`;
40
+ vThumb.style.transform = `translateY(${thumbTop}px)`;
41
+ }
42
+ }
43
+
44
+ // Horizontal
45
+ if (hBar && hThumb) {
46
+ const hasOverflow = scrollWidth > clientWidth;
47
+ hBar.style.opacity = hasOverflow ? "1" : "0";
48
+ if (hasOverflow) {
49
+ const ratio = clientWidth / scrollWidth;
50
+ const thumbWidth = Math.max(ratio * clientWidth, 20);
51
+ const thumbLeft =
52
+ (scrollLeft / (scrollWidth - clientWidth)) *
53
+ (clientWidth - thumbWidth);
54
+ hThumb.style.width = `${thumbWidth}px`;
55
+ hThumb.style.transform = `translateX(${thumbLeft}px)`;
56
+ }
57
+ }
58
+
59
+ // Auto-hide after 1s of inactivity
60
+ clearTimeout(hideTimeout);
61
+ if (vBar) vBar.setAttribute("data-state", "visible");
62
+ if (hBar) hBar.setAttribute("data-state", "visible");
63
+ hideTimeout = setTimeout(() => {
64
+ if (vBar) vBar.setAttribute("data-state", "hidden");
65
+ if (hBar) hBar.setAttribute("data-state", "hidden");
66
+ }, 1000);
67
+ }
68
+
69
+ // Drag support for vertical thumb
70
+ if (vBar && vThumb) {
71
+ setupDrag(vBar, vThumb, viewport, "vertical");
72
+ }
73
+
74
+ // Drag support for horizontal thumb
75
+ if (hBar && hThumb) {
76
+ setupDrag(hBar, hThumb, viewport, "horizontal");
77
+ }
78
+
79
+ viewport.addEventListener("scroll", updateScrollbars, { passive: true });
80
+
81
+ // Convert vertical wheel to horizontal scroll when only horizontal overflow
82
+ viewport.addEventListener("wheel", (e) => {
83
+ const hasHOverflow = viewport.scrollWidth > viewport.clientWidth;
84
+ const hasVOverflow = viewport.scrollHeight > viewport.clientHeight;
85
+ if (hasHOverflow && !hasVOverflow && e.deltaY !== 0) {
86
+ e.preventDefault();
87
+ viewport.scrollLeft += e.deltaY;
88
+ }
89
+ }, { passive: false });
90
+
91
+ // Initial update
92
+ updateScrollbars();
93
+
94
+ // Watch for content changes
95
+ const observer = new ResizeObserver(updateScrollbars);
96
+ observer.observe(viewport);
97
+ if (viewport.firstElementChild) {
98
+ observer.observe(viewport.firstElementChild);
99
+ }
100
+ }
101
+
102
+ function setupDrag(
103
+ bar: HTMLElement,
104
+ thumb: HTMLElement,
105
+ viewport: HTMLElement,
106
+ orientation: "vertical" | "horizontal",
107
+ ) {
108
+ let isDragging = false;
109
+ let startPos = 0;
110
+ let startScroll = 0;
111
+
112
+ thumb.addEventListener("pointerdown", (e) => {
113
+ isDragging = true;
114
+ startPos = orientation === "vertical" ? e.clientY : e.clientX;
115
+ startScroll =
116
+ orientation === "vertical" ? viewport.scrollTop : viewport.scrollLeft;
117
+ thumb.setPointerCapture(e.pointerId);
118
+ e.preventDefault();
119
+ });
120
+
121
+ thumb.addEventListener("pointermove", (e) => {
122
+ if (!isDragging) return;
123
+
124
+ const pos = orientation === "vertical" ? e.clientY : e.clientX;
125
+ const delta = pos - startPos;
126
+
127
+ const barSize =
128
+ orientation === "vertical"
129
+ ? bar.clientHeight
130
+ : bar.clientWidth;
131
+ const scrollSize =
132
+ orientation === "vertical"
133
+ ? viewport.scrollHeight - viewport.clientHeight
134
+ : viewport.scrollWidth - viewport.clientWidth;
135
+
136
+ const scrollDelta = (delta / barSize) * (scrollSize + barSize);
137
+
138
+ if (orientation === "vertical") {
139
+ viewport.scrollTop = startScroll + scrollDelta;
140
+ } else {
141
+ viewport.scrollLeft = startScroll + scrollDelta;
142
+ }
143
+ });
144
+
145
+ thumb.addEventListener("pointerup", () => {
146
+ isDragging = false;
147
+ });
148
+
149
+ // Click on track scrolls to position
150
+ bar.addEventListener("pointerdown", (e) => {
151
+ if (e.target === thumb) return;
152
+
153
+ const rect = bar.getBoundingClientRect();
154
+ const pos = orientation === "vertical" ? e.clientY - rect.top : e.clientX - rect.left;
155
+ const ratio = pos / (orientation === "vertical" ? rect.height : rect.width);
156
+
157
+ if (orientation === "vertical") {
158
+ viewport.scrollTop = ratio * (viewport.scrollHeight - viewport.clientHeight);
159
+ } else {
160
+ viewport.scrollLeft = ratio * (viewport.scrollWidth - viewport.clientWidth);
161
+ }
162
+ });
163
+ }
164
+
165
+ function initAll() {
166
+ document
167
+ .querySelectorAll<HTMLElement>("[data-component='scroll-area']")
168
+ .forEach(init);
169
+ }
170
+
171
+ if (document.readyState === "loading") {
172
+ document.addEventListener("DOMContentLoaded", initAll);
173
+ } else {
174
+ initAll();
175
+ }
176
+ document.addEventListener("astro:page-load", initAll);
@@ -0,0 +1,34 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const select = tv({
5
+ base: "relative",
6
+ });
7
+
8
+ interface Props {
9
+ name?: string;
10
+ defaultValue?: string;
11
+ required?: boolean;
12
+ class?: string;
13
+ [key: string]: unknown;
14
+ }
15
+
16
+ const {
17
+ name,
18
+ defaultValue,
19
+ required = false,
20
+ class: className,
21
+ ...rest
22
+ } = Astro.props;
23
+ ---
24
+
25
+ <div
26
+ class={select({ class: className })}
27
+ data-component="select"
28
+ data-name={name}
29
+ data-default-value={defaultValue}
30
+ data-required={required || undefined}
31
+ {...rest}
32
+ >
33
+ <slot />
34
+ </div>
@@ -0,0 +1,24 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const selectContent = tv({
5
+ base: "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <div
17
+ class={selectContent({ class: className })}
18
+ data-part="content"
19
+ role="listbox"
20
+ hidden
21
+ {...rest}
22
+ >
23
+ <slot />
24
+ </div>
@@ -0,0 +1,23 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const selectGroup = tv({
5
+ base: "p-1",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <div
17
+ class={selectGroup({ class: className })}
18
+ data-part="group"
19
+ role="group"
20
+ {...rest}
21
+ >
22
+ <slot />
23
+ </div>
@@ -0,0 +1,28 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const selectItem = tv({
5
+ base: "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground aria-selected:font-medium aria-disabled:pointer-events-none aria-disabled:opacity-50",
6
+ });
7
+
8
+ interface Props {
9
+ value: string;
10
+ disabled?: boolean;
11
+ class?: string;
12
+ [key: string]: unknown;
13
+ }
14
+
15
+ const { value, disabled = false, class: className, ...rest } = Astro.props;
16
+ ---
17
+
18
+ <div
19
+ class={selectItem({ class: className })}
20
+ data-part="item"
21
+ data-value={value}
22
+ role="option"
23
+ aria-selected="false"
24
+ aria-disabled={disabled ? "true" : undefined}
25
+ {...rest}
26
+ >
27
+ <slot />
28
+ </div>
@@ -0,0 +1,18 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const selectLabel = tv({
5
+ base: "py-1.5 pl-8 pr-2 text-sm font-semibold",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <div class={selectLabel({ class: className })} data-part="label" {...rest}>
17
+ <slot />
18
+ </div>
@@ -0,0 +1,22 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const selectSeparator = tv({
5
+ base: "-mx-1 my-1 h-px bg-muted",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <div
17
+ class={selectSeparator({ class: className })}
18
+ data-part="separator"
19
+ role="separator"
20
+ {...rest}
21
+ >
22
+ </div>
@@ -0,0 +1,28 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const selectTrigger = tv({
5
+ base: "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <!-- aria-controls is set by the select controller at runtime -->
17
+ <button
18
+ class={selectTrigger({ class: className })}
19
+ data-part="trigger"
20
+ type="button"
21
+ role="combobox"
22
+ aria-haspopup="listbox"
23
+ aria-expanded="false"
24
+ aria-controls=""
25
+ {...rest}
26
+ >
27
+ <slot />
28
+ </button>
@@ -0,0 +1,18 @@
1
+ ---
2
+ interface Props {
3
+ placeholder?: string;
4
+ class?: string;
5
+ [key: string]: unknown;
6
+ }
7
+
8
+ const { placeholder = "Select...", class: className, ...rest } = Astro.props;
9
+ ---
10
+
11
+ <span
12
+ class:list={["base-select-value", className]}
13
+ data-part="value"
14
+ data-placeholder={placeholder}
15
+ {...rest}
16
+ >
17
+ {placeholder}
18
+ </span>