fulldev-ui 0.11.1 → 0.12.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 (63) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/package.json +24 -20
  3. package/public/r/accordion.json +2 -2
  4. package/public/r/alert-dialog.json +2 -2
  5. package/public/r/banner.json +0 -4
  6. package/public/r/blocks-1.json +1 -1
  7. package/public/r/button.json +1 -1
  8. package/public/r/collapsible.json +2 -2
  9. package/public/r/combobox.json +4 -3
  10. package/public/r/command.json +5 -4
  11. package/public/r/dialog.json +2 -2
  12. package/public/r/doc-1.json +1 -1
  13. package/public/r/dropdown-menu.json +4 -4
  14. package/public/r/hover-card.json +4 -4
  15. package/public/r/input-group.json +0 -1
  16. package/public/r/layout.json +3 -0
  17. package/public/r/navigation-menu.json +3 -3
  18. package/public/r/popover.json +3 -3
  19. package/public/r/radio-group.json +2 -2
  20. package/public/r/registry.json +26 -26
  21. package/public/r/select.json +3 -3
  22. package/public/r/sheet.json +2 -2
  23. package/public/r/sidebar-1.json +1 -1
  24. package/public/r/sidebar.json +1 -1
  25. package/public/r/slider.json +2 -2
  26. package/public/r/switch.json +2 -2
  27. package/public/r/tabs.json +4 -4
  28. package/public/r/toggle.json +2 -2
  29. package/public/r/tooltip.json +3 -3
  30. package/registry.json +31 -21
  31. package/src/components/blocks/blocks-1.astro +23 -23
  32. package/src/components/blocks/doc-1.astro +40 -26
  33. package/src/components/blocks/sidebar-1.astro +46 -44
  34. package/src/components/ui/accordion/accordion.astro +8 -2
  35. package/src/components/ui/alert-dialog/alert-dialog.astro +8 -2
  36. package/src/components/ui/button/button.astro +4 -1
  37. package/src/components/ui/collapsible/collapsible.astro +8 -2
  38. package/src/components/ui/combobox/combobox-content.astro +1 -1
  39. package/src/components/ui/combobox/combobox.astro +9 -17
  40. package/src/components/ui/command/command-dialog.astro +1 -0
  41. package/src/components/ui/command/command.astro +40 -25
  42. package/src/components/ui/dialog/dialog.astro +8 -2
  43. package/src/components/ui/dropdown-menu/dropdown-menu-content.astro +1 -1
  44. package/src/components/ui/dropdown-menu/dropdown-menu-item.astro +40 -9
  45. package/src/components/ui/dropdown-menu/dropdown-menu.astro +8 -2
  46. package/src/components/ui/hover-card/hover-card-content.astro +1 -1
  47. package/src/components/ui/hover-card/hover-card.astro +15 -4
  48. package/src/components/ui/navigation-menu/navigation-menu-positioner.astro +1 -1
  49. package/src/components/ui/navigation-menu/navigation-menu.astro +11 -2
  50. package/src/components/ui/popover/popover-content.astro +2 -1
  51. package/src/components/ui/popover/popover.astro +9 -2
  52. package/src/components/ui/radio-group/radio-group.astro +8 -2
  53. package/src/components/ui/select/select-content.astro +2 -2
  54. package/src/components/ui/select/select.astro +11 -7
  55. package/src/components/ui/sheet/sheet.astro +8 -2
  56. package/src/components/ui/slider/slider.astro +10 -4
  57. package/src/components/ui/switch/switch.astro +8 -2
  58. package/src/components/ui/tabs/tabs-content.astro +1 -1
  59. package/src/components/ui/tabs/tabs-trigger.astro +3 -2
  60. package/src/components/ui/tabs/tabs.astro +8 -2
  61. package/src/components/ui/toggle/toggle.astro +8 -2
  62. package/src/components/ui/tooltip/tooltip-content.astro +1 -1
  63. package/src/components/ui/tooltip/tooltip.astro +11 -2
package/registry.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "description": "A vertically stacked set of interactive headings that each reveal a section of content.",
11
11
  "categories": ["ui"],
12
12
  "docs": "https://ui.full.dev/components/accordion/",
13
- "dependencies": ["@data-slot/accordion", "@lucide/astro"],
13
+ "dependencies": ["@data-slot/accordion@^1.0.1", "@lucide/astro"],
14
14
  "files": [
15
15
  {
16
16
  "path": "src/components/ui/accordion/accordion.astro",
@@ -67,7 +67,7 @@
67
67
  "description": "A modal dialog for important confirmations that expects a response.",
68
68
  "categories": ["ui"],
69
69
  "docs": "https://ui.full.dev/components/alert-dialog/",
70
- "dependencies": ["@data-slot/alert-dialog"],
70
+ "dependencies": ["@data-slot/alert-dialog@^1.0.1"],
71
71
  "registryDependencies": ["@fulldev/button"],
72
72
  "files": [
73
73
  {
@@ -180,7 +180,6 @@
180
180
  "categories": ["ui"],
181
181
  "docs": "https://ui.full.dev/components/banner/",
182
182
  "dependencies": ["@lucide/astro"],
183
- "registryDependencies": ["@fulldev/button", "@fulldev/dropdown-menu"],
184
183
  "files": [
185
184
  {
186
185
  "path": "src/components/ui/banner/banner.astro",
@@ -328,7 +327,7 @@
328
327
  "description": "An interactive component which expands/collapses a panel.",
329
328
  "categories": ["ui"],
330
329
  "docs": "https://ui.full.dev/components/collapsible/",
331
- "dependencies": ["@data-slot/collapsible"],
330
+ "dependencies": ["@data-slot/collapsible@^1.0.1"],
332
331
  "files": [
333
332
  {
334
333
  "path": "src/components/ui/collapsible/collapsible.astro",
@@ -355,7 +354,11 @@
355
354
  "description": "Autocomplete input with a list of suggestions.",
356
355
  "categories": ["ui"],
357
356
  "docs": "https://ui.full.dev/components/combobox/",
358
- "dependencies": ["@data-slot/combobox", "@lucide/astro"],
357
+ "dependencies": [
358
+ "@data-slot/combobox@^1.0.1",
359
+ "@data-slot/core@^1.0.1",
360
+ "@lucide/astro"
361
+ ],
359
362
  "registryDependencies": ["@fulldev/input-group"],
360
363
  "files": [
361
364
  {
@@ -415,7 +418,11 @@
415
418
  "description": "Command menu for search and quick actions.",
416
419
  "categories": ["ui"],
417
420
  "docs": "https://ui.full.dev/components/command/",
418
- "dependencies": ["@data-slot/command", "@lucide/astro"],
421
+ "dependencies": [
422
+ "@data-slot/command@^1.0.1",
423
+ "@lucide/astro",
424
+ "@data-slot/core@^1.0.1"
425
+ ],
419
426
  "registryDependencies": ["@fulldev/dialog"],
420
427
  "files": [
421
428
  {
@@ -467,7 +474,7 @@
467
474
  "description": "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.",
468
475
  "categories": ["ui"],
469
476
  "docs": "https://ui.full.dev/components/dialog/",
470
- "dependencies": ["@data-slot/dialog", "@lucide/astro"],
477
+ "dependencies": ["@data-slot/dialog@^1.0.1", "@lucide/astro"],
471
478
  "registryDependencies": ["@fulldev/button"],
472
479
  "files": [
473
480
  {
@@ -523,7 +530,7 @@
523
530
  "description": "Displays a menu to the user, such as a set of actions or functions, triggered by a button.",
524
531
  "categories": ["ui"],
525
532
  "docs": "https://ui.full.dev/components/dropdown-menu/",
526
- "dependencies": ["@data-slot/dropdown-menu", "@lucide/astro"],
533
+ "dependencies": ["@data-slot/dropdown-menu@^1.0.1", "@lucide/astro"],
527
534
  "files": [
528
535
  {
529
536
  "path": "src/components/ui/dropdown-menu/dropdown-menu.astro",
@@ -717,7 +724,10 @@
717
724
  "description": "For sighted users to preview content available behind a link.",
718
725
  "categories": ["ui"],
719
726
  "docs": "https://ui.full.dev/components/hover-card/",
720
- "dependencies": ["@data-slot/hover-card", "@data-slot/core"],
727
+ "dependencies": [
728
+ "@data-slot/hover-card@^1.0.1",
729
+ "@data-slot/core@^1.0.1"
730
+ ],
721
731
  "files": [
722
732
  {
723
733
  "path": "src/components/ui/hover-card/hover-card.astro",
@@ -783,7 +793,6 @@
783
793
  "docs": "https://ui.full.dev/components/input-group/",
784
794
  "registryDependencies": [
785
795
  "@fulldev/button",
786
- "@fulldev/dropdown-menu",
787
796
  "@fulldev/input",
788
797
  "@fulldev/textarea"
789
798
  ],
@@ -1011,7 +1020,7 @@
1011
1020
  "description": "A collection of links for navigating websites.",
1012
1021
  "categories": ["ui"],
1013
1022
  "docs": "https://ui.full.dev/components/navigation-menu/",
1014
- "dependencies": ["@data-slot/navigation-menu", "@lucide/astro"],
1023
+ "dependencies": ["@data-slot/navigation-menu@^1.0.1", "@lucide/astro"],
1015
1024
  "files": [
1016
1025
  {
1017
1026
  "path": "src/components/ui/navigation-menu/navigation-menu.astro",
@@ -1089,7 +1098,7 @@
1089
1098
  "description": "Displays rich content in a floating layer, triggered by a button.",
1090
1099
  "categories": ["ui"],
1091
1100
  "docs": "https://ui.full.dev/components/popover/",
1092
- "dependencies": ["@data-slot/popover"],
1101
+ "dependencies": ["@data-slot/popover@^1.0.1"],
1093
1102
  "files": [
1094
1103
  {
1095
1104
  "path": "src/components/ui/popover/popover.astro",
@@ -1158,7 +1167,7 @@
1158
1167
  "description": "A set of checkable buttons, known as radio buttons, where no more than one of the buttons can be checked at a time.",
1159
1168
  "categories": ["ui"],
1160
1169
  "docs": "https://ui.full.dev/components/radio-group/",
1161
- "dependencies": ["@data-slot/radio-group"],
1170
+ "dependencies": ["@data-slot/radio-group@^1.0.1"],
1162
1171
  "files": [
1163
1172
  {
1164
1173
  "path": "src/components/ui/radio-group/radio-group.astro",
@@ -1200,7 +1209,7 @@
1200
1209
  "description": "Displays a list of options for the user to pick from, triggered by a button.",
1201
1210
  "categories": ["ui"],
1202
1211
  "docs": "https://ui.full.dev/components/select/",
1203
- "dependencies": ["@data-slot/select", "@lucide/astro"],
1212
+ "dependencies": ["@data-slot/select@^1.0.1", "@lucide/astro"],
1204
1213
  "files": [
1205
1214
  {
1206
1215
  "path": "src/components/ui/select/select.astro",
@@ -1295,7 +1304,7 @@
1295
1304
  "description": "A sliding panel component that appears from the edge of the screen.",
1296
1305
  "categories": ["ui"],
1297
1306
  "docs": "https://ui.full.dev/components/sheet/",
1298
- "dependencies": ["@data-slot/dialog", "@lucide/astro"],
1307
+ "dependencies": ["@data-slot/dialog@^1.0.1", "@lucide/astro"],
1299
1308
  "registryDependencies": ["@fulldev/button", "@fulldev/dialog"],
1300
1309
  "files": [
1301
1310
  {
@@ -1343,7 +1352,7 @@
1343
1352
  "description": "A composable, themeable, and customizable Astro sidebar component.",
1344
1353
  "categories": ["ui"],
1345
1354
  "docs": "https://ui.full.dev/components/sidebar/",
1346
- "dependencies": ["@data-slot/tooltip", "@lucide/astro"],
1355
+ "dependencies": ["@data-slot/tooltip@^1.0.1", "@lucide/astro"],
1347
1356
  "registryDependencies": [
1348
1357
  "@fulldev/layout",
1349
1358
  "@fulldev/button",
@@ -1459,7 +1468,7 @@
1459
1468
  "description": "An input where the user selects a value from within a given range.",
1460
1469
  "categories": ["ui"],
1461
1470
  "docs": "https://ui.full.dev/components/slider/",
1462
- "dependencies": ["@data-slot/slider"],
1471
+ "dependencies": ["@data-slot/slider@^1.0.1"],
1463
1472
  "files": [
1464
1473
  {
1465
1474
  "path": "src/components/ui/slider/slider.astro",
@@ -1515,7 +1524,7 @@
1515
1524
  "description": "A control that allows the user to toggle between checked and not checked.",
1516
1525
  "categories": ["ui"],
1517
1526
  "docs": "https://ui.full.dev/components/switch/",
1518
- "dependencies": ["@data-slot/switch"],
1527
+ "dependencies": ["@data-slot/switch@^1.0.1"],
1519
1528
  "files": [
1520
1529
  {
1521
1530
  "path": "src/components/ui/switch/switch.astro",
@@ -1580,7 +1589,7 @@
1580
1589
  "description": "A set of layered sections of content, known as tabs, that display one panel of content at a time.",
1581
1590
  "categories": ["ui"],
1582
1591
  "docs": "https://ui.full.dev/components/tabs/",
1583
- "dependencies": ["@data-slot/tabs"],
1592
+ "dependencies": ["@data-slot/tabs@^1.0.1"],
1584
1593
  "files": [
1585
1594
  {
1586
1595
  "path": "src/components/ui/tabs/tabs.astro",
@@ -1649,7 +1658,7 @@
1649
1658
  "description": "A two-state button that can be either on or off.",
1650
1659
  "categories": ["ui"],
1651
1660
  "docs": "https://ui.full.dev/components/toggle/",
1652
- "dependencies": ["@data-slot/toggle"],
1661
+ "dependencies": ["@data-slot/toggle@^1.0.1"],
1653
1662
  "files": [
1654
1663
  {
1655
1664
  "path": "src/components/ui/toggle/toggle.astro",
@@ -1690,7 +1699,7 @@
1690
1699
  "description": "Displays contextual information when a user hovers or focuses a trigger.",
1691
1700
  "categories": ["ui"],
1692
1701
  "docs": "https://ui.full.dev/components/tooltip/",
1693
- "dependencies": ["@data-slot/tooltip"],
1702
+ "dependencies": ["@data-slot/tooltip@^1.0.1"],
1694
1703
  "files": [
1695
1704
  {
1696
1705
  "path": "src/components/ui/tooltip/tooltip.astro",
@@ -1876,6 +1885,7 @@
1876
1885
  "description": "Page-shell primitives for the root html, head, body, and main structure.",
1877
1886
  "categories": ["ui"],
1878
1887
  "docs": "https://ui.full.dev/components/layout/",
1888
+ "dependencies": ["@lexingtonthemes/seo@^0.2.0"],
1879
1889
  "files": [
1880
1890
  {
1881
1891
  "path": "src/components/ui/layout/layout.astro",
@@ -15,6 +15,7 @@ import { buttonVariants } from "@/components/ui/button/button-variants"
15
15
  import {
16
16
  DropdownMenu,
17
17
  DropdownMenuContent,
18
+ DropdownMenuItem,
18
19
  DropdownMenuTrigger,
19
20
  } from "@/components/ui/dropdown-menu"
20
21
  import { SectionContainer } from "@/components/ui/section"
@@ -129,6 +130,7 @@ const openLinks = markdownUrl
129
130
  variant="outline"
130
131
  size="xs"
131
132
  data-source={copyButton?.source}
133
+ data-blocks-copy
132
134
  aria-label={labels.copyMarkdown}
133
135
  >
134
136
  <Copy class="blocks-copy-icon size-3.5" />
@@ -148,11 +150,10 @@ const openLinks = markdownUrl
148
150
  </DropdownMenuTrigger>
149
151
  <DropdownMenuContent align="end" sideOffset={6} class="w-56">
150
152
  {openLinks.map((link) => (
151
- <a
153
+ <DropdownMenuItem
152
154
  href={link.href}
153
155
  target="_blank"
154
156
  rel="noreferrer noopener"
155
- class="hover:bg-accent hover:text-accent-foreground flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none"
156
157
  >
157
158
  {link.icon === "markdown" && <Markdown class="size-4" />}
158
159
  {link.icon === "chatgpt" && (
@@ -170,7 +171,7 @@ const openLinks = markdownUrl
170
171
  {link.icon === "cursor" && <Cursor class="size-4" />}
171
172
  <span>{link.label}</span>
172
173
  <ExternalLink class="text-muted-foreground ml-auto size-3.5" />
173
- </a>
174
+ </DropdownMenuItem>
174
175
  ))}
175
176
  </DropdownMenuContent>
176
177
  </DropdownMenu>
@@ -224,27 +225,26 @@ const openLinks = markdownUrl
224
225
  </div>
225
226
  </SectionContainer>
226
227
 
227
- <script is:inline define:vars={{ copyButtonId: copyButton?.id }}>
228
- const button = copyButtonId ? document.getElementById(copyButtonId) : null
228
+ <script>
229
+ document.addEventListener("click", async (event) => {
230
+ if (!(event.target instanceof Element)) return
231
+ const button = event.target.closest("[data-blocks-copy]")
232
+ if (!(button instanceof HTMLButtonElement)) return
229
233
 
230
- if (button instanceof HTMLButtonElement) {
231
- button.addEventListener("click", async () => {
232
- const source = button.dataset.source
234
+ const source = button.dataset.source
235
+ if (!source) return
233
236
 
234
- if (!source) return
237
+ try {
238
+ await navigator.clipboard.writeText(source)
239
+ button.querySelector(".blocks-copy-icon")?.classList.add("hidden")
240
+ button.querySelector(".blocks-check-icon")?.classList.remove("hidden")
235
241
 
236
- try {
237
- await navigator.clipboard.writeText(source)
238
- button.querySelector(".blocks-copy-icon")?.classList.add("hidden")
239
- button.querySelector(".blocks-check-icon")?.classList.remove("hidden")
240
-
241
- window.setTimeout(() => {
242
- button.querySelector(".blocks-copy-icon")?.classList.remove("hidden")
243
- button.querySelector(".blocks-check-icon")?.classList.add("hidden")
244
- }, 1200)
245
- } catch {
246
- // Ignore clipboard failures; the button remains available for retry.
247
- }
248
- })
249
- }
242
+ window.setTimeout(() => {
243
+ button.querySelector(".blocks-copy-icon")?.classList.remove("hidden")
244
+ button.querySelector(".blocks-check-icon")?.classList.add("hidden")
245
+ }, 1200)
246
+ } catch {
247
+ // Keep the copy state unchanged so the action can be retried.
248
+ }
249
+ })
250
250
  </script>
@@ -21,6 +21,7 @@ import {
21
21
  import {
22
22
  DropdownMenu,
23
23
  DropdownMenuContent,
24
+ DropdownMenuItem,
24
25
  DropdownMenuTrigger,
25
26
  } from "@/components/ui/dropdown-menu"
26
27
  import { SectionContainer } from "@/components/ui/section"
@@ -180,11 +181,10 @@ const openLinks = markdownUrl
180
181
  </DropdownMenuTrigger>
181
182
  <DropdownMenuContent align="end" sideOffset={6} class="w-56">
182
183
  {openLinks.map((link) => (
183
- <a
184
+ <DropdownMenuItem
184
185
  href={link.href}
185
186
  target="_blank"
186
187
  rel="noreferrer noopener"
187
- class="hover:bg-accent hover:text-accent-foreground flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none"
188
188
  >
189
189
  {link.icon === "markdown" && <Markdown class="size-4" />}
190
190
  {link.icon === "chatgpt" && (
@@ -202,7 +202,7 @@ const openLinks = markdownUrl
202
202
  {link.icon === "cursor" && <Cursor class="size-4" />}
203
203
  <span>{link.label}</span>
204
204
  <ExternalLink class="text-muted-foreground ml-auto size-3.5" />
205
- </a>
205
+ </DropdownMenuItem>
206
206
  ))}
207
207
  </DropdownMenuContent>
208
208
  </DropdownMenu>
@@ -299,38 +299,52 @@ const openLinks = markdownUrl
299
299
  }
300
300
  </SectionContainer>
301
301
 
302
- <script is:inline>
302
+ <script>
303
303
  const copyIcon = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>`
304
304
  const checkIcon = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"></path></svg>`
305
- document.querySelectorAll("[data-slot='typography'] > pre").forEach((pre) => {
306
- if (pre.closest(".docs-code-block")) return
307
- const wrapper = document.createElement("div")
308
- const button = document.createElement("button")
309
- wrapper.className = "docs-code-block"
310
- button.type = "button"
311
- button.className = "docs-code-copy"
312
- button.ariaLabel = "Copy code"
313
- button.innerHTML = `<span data-copy-icon>${copyIcon}</span><span data-check-icon class="hidden">${checkIcon}</span>`
314
- pre.before(wrapper)
315
- wrapper.append(pre, button)
316
- })
317
- document.addEventListener("click", (event) => {
318
- const button = event.target?.closest?.(
305
+ const initializeCodeBlocks = () => {
306
+ document
307
+ .querySelectorAll("[data-slot='typography'] > pre")
308
+ .forEach((pre) => {
309
+ if (pre.closest(".docs-code-block")) return
310
+ const wrapper = document.createElement("div")
311
+ const button = document.createElement("button")
312
+ wrapper.className = "docs-code-block"
313
+ button.type = "button"
314
+ button.className = "docs-code-copy"
315
+ button.ariaLabel = "Copy code"
316
+ button.innerHTML = `<span data-copy-icon>${copyIcon}</span><span data-check-icon class="hidden">${checkIcon}</span>`
317
+ pre.before(wrapper)
318
+ wrapper.append(pre, button)
319
+ })
320
+ }
321
+
322
+ initializeCodeBlocks()
323
+ document.addEventListener("astro:page-load", initializeCodeBlocks)
324
+
325
+ document.addEventListener("click", async (event) => {
326
+ if (!(event.target instanceof Element)) return
327
+ const button = event.target.closest(
319
328
  "[id^='docs-copy-page-'], .docs-code-copy"
320
329
  )
321
- if (!button) return
330
+ if (!(button instanceof HTMLButtonElement)) return
322
331
  const source =
323
332
  button.dataset.source ??
324
333
  button
325
334
  .closest(".docs-code-block")
326
335
  ?.querySelector("pre")
327
336
  ?.textContent?.replace(/\n$/, "")
328
- button.querySelector("[data-copy-icon]")?.classList.add("hidden")
329
- button.querySelector("[data-check-icon]")?.classList.remove("hidden")
330
- navigator.clipboard?.writeText(source ?? "")
331
- setTimeout(() => {
332
- button.querySelector("[data-copy-icon]")?.classList.remove("hidden")
333
- button.querySelector("[data-check-icon]")?.classList.add("hidden")
334
- }, 1200)
337
+
338
+ try {
339
+ await navigator.clipboard.writeText(source ?? "")
340
+ button.querySelector("[data-copy-icon]")?.classList.add("hidden")
341
+ button.querySelector("[data-check-icon]")?.classList.remove("hidden")
342
+ setTimeout(() => {
343
+ button.querySelector("[data-copy-icon]")?.classList.remove("hidden")
344
+ button.querySelector("[data-check-icon]")?.classList.add("hidden")
345
+ }, 1200)
346
+ } catch {
347
+ // Keep the copy state unchanged so the action can be retried.
348
+ }
335
349
  })
336
350
  </script>
@@ -23,11 +23,12 @@ import {
23
23
  CommandList,
24
24
  CommandShortcut,
25
25
  } from "@/components/ui/command"
26
- import { Dialog, DialogTrigger } from "@/components/ui/dialog"
26
+ import { DialogTrigger } from "@/components/ui/dialog"
27
27
  import {
28
28
  DropdownMenu,
29
29
  DropdownMenuContent,
30
30
  DropdownMenuGroup,
31
+ DropdownMenuItem,
31
32
  DropdownMenuTrigger,
32
33
  } from "@/components/ui/dropdown-menu"
33
34
  import { Header, HeaderContainer, HeaderGroup } from "@/components/ui/header"
@@ -139,7 +140,7 @@ try {
139
140
  <SidebarProvider>
140
141
  <Sidebar class={cn("", className)} collapsible="offcanvas" variant="inset">
141
142
  <SidebarHeader class="flex-col">
142
- <SidebarMenuButton size="lg" variant="ghost" href={logo.href}>
143
+ <SidebarMenuButton size="lg" href={logo.href}>
143
144
  <LogoImage
144
145
  src={logo.src}
145
146
  srcLight={logo.srcLight}
@@ -148,8 +149,14 @@ try {
148
149
  />
149
150
  <LogoText class="font-semibold">{logo.label}</LogoText>
150
151
  </SidebarMenuButton>
151
- <Dialog class="w-full" data-search-dialog>
152
+ <CommandDialog
153
+ class="w-full"
154
+ data-search-dialog
155
+ title={search.label}
156
+ description={search.label}
157
+ >
152
158
  <DialogTrigger
159
+ slot="trigger"
153
160
  variant="outline"
154
161
  size="sm"
155
162
  class="w-full justify-start shadow-none"
@@ -165,40 +172,38 @@ try {
165
172
  </Kbd>
166
173
  </DialogTrigger>
167
174
 
168
- <CommandDialog title={search.label} description={search.label}>
169
- <Command
170
- class="[&_[data-slot=command-item][data-selected]]:bg-accent [&_[data-slot=command-item][data-selected]]:text-accent-foreground"
171
- >
172
- <CommandInput placeholder={search.label} />
173
- <CommandList>
174
- <CommandEmpty>{search.empty}</CommandEmpty>
175
+ <Command
176
+ class="[&_[data-slot=command-item][data-selected]]:bg-accent [&_[data-slot=command-item][data-selected]]:text-accent-foreground"
177
+ >
178
+ <CommandInput autofocus placeholder={search.label} />
179
+ <CommandList>
180
+ <CommandEmpty>{search.empty}</CommandEmpty>
175
181
 
176
- {
177
- searchGroups.map((group) => (
178
- <CommandGroup heading={group.label}>
179
- {group.items.map((item) => (
180
- <CommandItem
181
- href={item.href}
182
- value={`${item.group} ${item.label}`}
183
- label={item.label}
184
- keywords={[
185
- item.group,
186
- item.title,
187
- item.path,
188
- item.description,
189
- ]}
190
- >
191
- {item.label}
192
- <CommandShortcut>{item.href}</CommandShortcut>
193
- </CommandItem>
194
- ))}
195
- </CommandGroup>
196
- ))
197
- }
198
- </CommandList>
199
- </Command>
200
- </CommandDialog>
201
- </Dialog>
182
+ {
183
+ searchGroups.map((group) => (
184
+ <CommandGroup heading={group.label}>
185
+ {group.items.map((item) => (
186
+ <CommandItem
187
+ href={item.href}
188
+ value={`${item.group} ${item.label}`}
189
+ label={item.label}
190
+ keywords={[
191
+ item.group,
192
+ item.title,
193
+ item.path,
194
+ item.description,
195
+ ]}
196
+ >
197
+ {item.label}
198
+ <CommandShortcut>{item.href}</CommandShortcut>
199
+ </CommandItem>
200
+ ))}
201
+ </CommandGroup>
202
+ ))
203
+ }
204
+ </CommandList>
205
+ </Command>
206
+ </CommandDialog>
202
207
  </SidebarHeader>
203
208
  <SidebarContent
204
209
  class="[mask-image:linear-gradient(to_bottom,transparent,black_1rem,black_calc(100%_-_1rem),transparent)] [-webkit-mask-image:linear-gradient(to_bottom,transparent,black_1rem,black_calc(100%_-_1rem),transparent)] group-data-[collapsible=icon]:[mask-image:none] group-data-[collapsible=icon]:[-webkit-mask-image:none]"
@@ -268,7 +273,7 @@ try {
268
273
  <DropdownMenuContent align="start">
269
274
  <DropdownMenuGroup>
270
275
  {breadcrumb.menu.map((menuItem) => (
271
- <a
276
+ <DropdownMenuItem
272
277
  href={menuItem.href}
273
278
  aria-current={
274
279
  normalizePath(menuItem.href) ===
@@ -276,10 +281,10 @@ try {
276
281
  ? "page"
277
282
  : undefined
278
283
  }
279
- class="hover:bg-accent hover:text-accent-foreground aria-[current=page]:text-foreground flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none"
284
+ class="aria-[current=page]:text-foreground"
280
285
  >
281
286
  {menuItem.label}
282
- </a>
287
+ </DropdownMenuItem>
283
288
  ))}
284
289
  </DropdownMenuGroup>
285
290
  </DropdownMenuContent>
@@ -308,12 +313,9 @@ try {
308
313
  <DropdownMenuContent align="start">
309
314
  <DropdownMenuGroup>
310
315
  {breadcrumb.menu.map((item) => (
311
- <a
312
- href={item.href}
313
- class="hover:bg-accent hover:text-accent-foreground flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none"
314
- >
316
+ <DropdownMenuItem href={item.href}>
315
317
  {item.label}
316
- </a>
318
+ </DropdownMenuItem>
317
319
  ))}
318
320
  </DropdownMenuGroup>
319
321
  </DropdownMenuContent>
@@ -48,6 +48,12 @@ const serializedDefaultValue = Array.isArray(defaultValue)
48
48
  <script>
49
49
  import { create } from "@data-slot/accordion"
50
50
 
51
- create()
52
- document.addEventListener("astro:page-load", () => create())
51
+ const controllers: ReturnType<typeof create> = []
52
+ const initialize = () => controllers.push(...create())
53
+ initialize()
54
+ document.addEventListener("astro:page-load", initialize)
55
+ document.addEventListener("astro:before-swap", () => {
56
+ for (const controller of controllers) controller.destroy()
57
+ controllers.length = 0
58
+ })
53
59
  </script>
@@ -33,6 +33,12 @@ const {
33
33
  <script>
34
34
  import { create } from "@data-slot/alert-dialog"
35
35
 
36
- create()
37
- document.addEventListener("astro:page-load", () => create())
36
+ const controllers: ReturnType<typeof create> = []
37
+ const initialize = () => controllers.push(...create())
38
+ initialize()
39
+ document.addEventListener("astro:page-load", initialize)
40
+ document.addEventListener("astro:before-swap", () => {
41
+ for (const controller of controllers) controller.destroy()
42
+ controllers.length = 0
43
+ })
38
44
  </script>
@@ -15,12 +15,15 @@ const {
15
15
  size,
16
16
  ...props
17
17
  } = Astro.props
18
+
19
+ const attributes: Record<string, unknown> = { ...props }
20
+ if (Tag === "button") attributes.type ??= "button"
18
21
  ---
19
22
 
20
23
  <Tag
21
24
  data-slot="button"
22
25
  class={cn(buttonVariants({ variant, size }), className)}
23
- {...props}
26
+ {...attributes}
24
27
  >
25
28
  <slot />
26
29
  </Tag>
@@ -29,6 +29,12 @@ const {
29
29
  <script>
30
30
  import { create } from "@data-slot/collapsible"
31
31
 
32
- create()
33
- document.addEventListener("astro:page-load", () => create())
32
+ const controllers: ReturnType<typeof create> = []
33
+ const initialize = () => controllers.push(...create())
34
+ initialize()
35
+ document.addEventListener("astro:page-load", initialize)
36
+ document.addEventListener("astro:before-swap", () => {
37
+ for (const controller of controllers) controller.destroy()
38
+ controllers.length = 0
39
+ })
34
40
  </script>
@@ -38,7 +38,7 @@ const {
38
38
  data-align-offset={alignOffset}
39
39
  data-avoid-collisions={avoidCollisions}
40
40
  data-collision-padding={collisionPadding}
41
- class="isolate z-50"
41
+ class="isolate z-[1000]"
42
42
  >
43
43
  <div
44
44
  data-slot="combobox-content"
@@ -67,22 +67,14 @@ const {
67
67
  </div>
68
68
 
69
69
  <script>
70
- import { createCombobox } from "@data-slot/combobox"
70
+ import { create } from "@data-slot/combobox"
71
71
 
72
- const initCombobox = () => {
73
- document.querySelectorAll('[data-slot="combobox"]').forEach((root) => {
74
- if (
75
- !root.querySelector('[data-slot="combobox-input"]') ||
76
- !root.querySelector('[data-slot="combobox-content"]')
77
- ) {
78
- return
79
- }
80
-
81
- createCombobox(root as HTMLElement)
82
- })
83
- }
84
-
85
- initCombobox()
86
-
87
- document.addEventListener("astro:page-load", initCombobox)
72
+ const controllers: ReturnType<typeof create> = []
73
+ const initialize = () => controllers.push(...create())
74
+ initialize()
75
+ document.addEventListener("astro:page-load", initialize)
76
+ document.addEventListener("astro:before-swap", () => {
77
+ for (const controller of controllers) controller.destroy()
78
+ controllers.length = 0
79
+ })
88
80
  </script>