fulldev-ui 0.11.1 → 0.13.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 (166) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +29 -21
  3. package/public/r/accordion.json +2 -2
  4. package/public/r/alert-dialog.json +2 -2
  5. package/public/r/aspect-ratio.json +23 -0
  6. package/public/r/attachment.json +66 -0
  7. package/public/r/banner.json +0 -4
  8. package/public/r/blocks-1.json +1 -1
  9. package/public/r/button-group.json +41 -0
  10. package/public/r/button.json +1 -1
  11. package/public/r/carousel.json +8 -8
  12. package/public/r/collapsible.json +2 -2
  13. package/public/r/combobox.json +6 -5
  14. package/public/r/command.json +5 -4
  15. package/public/r/components.json +8 -0
  16. package/public/r/dialog.json +2 -2
  17. package/public/r/doc-1.json +1 -1
  18. package/public/r/drawer.json +109 -0
  19. package/public/r/dropdown-menu.json +4 -4
  20. package/public/r/hover-card.json +4 -4
  21. package/public/r/init.json +1 -1
  22. package/public/r/input-group.json +0 -1
  23. package/public/r/layout.json +3 -0
  24. package/public/r/navigation-menu.json +3 -3
  25. package/public/r/pagination.json +59 -0
  26. package/public/r/popover.json +3 -3
  27. package/public/r/radio-group.json +2 -2
  28. package/public/r/registry.json +418 -28
  29. package/public/r/resizable.json +36 -0
  30. package/public/r/reviews-3.json +1 -1
  31. package/public/r/select.json +3 -3
  32. package/public/r/sheet.json +2 -2
  33. package/public/r/sidebar-1.json +1 -1
  34. package/public/r/sidebar.json +1 -1
  35. package/public/r/slider.json +2 -2
  36. package/public/r/switch.json +2 -2
  37. package/public/r/tabs.json +4 -4
  38. package/public/r/toast.json +80 -0
  39. package/public/r/toggle-group.json +34 -0
  40. package/public/r/toggle.json +2 -2
  41. package/public/r/tooltip.json +3 -3
  42. package/public/r/typography.json +21 -16
  43. package/registry/init/global.css +2 -0
  44. package/registry.json +384 -23
  45. package/src/components/blocks/blocks-1.astro +23 -23
  46. package/src/components/blocks/doc-1.astro +116 -26
  47. package/src/components/blocks/reviews-3.astro +1 -1
  48. package/src/components/blocks/sidebar-1.astro +46 -44
  49. package/src/components/ui/accordion/accordion.astro +8 -2
  50. package/src/components/ui/alert-dialog/alert-dialog.astro +8 -2
  51. package/src/components/ui/aspect-ratio/aspect-ratio.astro +25 -0
  52. package/src/components/ui/aspect-ratio/index.ts +1 -0
  53. package/src/components/ui/attachment/attachment-action.astro +20 -0
  54. package/src/components/ui/attachment/attachment-actions.astro +20 -0
  55. package/src/components/ui/attachment/attachment-content.astro +20 -0
  56. package/src/components/ui/attachment/attachment-description.astro +20 -0
  57. package/src/components/ui/attachment/attachment-group.astro +20 -0
  58. package/src/components/ui/attachment/attachment-media.astro +36 -0
  59. package/src/components/ui/attachment/attachment-title.astro +20 -0
  60. package/src/components/ui/attachment/attachment-trigger.astro +24 -0
  61. package/src/components/ui/attachment/attachment.astro +52 -0
  62. package/src/components/ui/attachment/index.ts +9 -0
  63. package/src/components/ui/button/button.astro +4 -1
  64. package/src/components/ui/button-group/button-group-separator.astro +29 -0
  65. package/src/components/ui/button-group/button-group-text.astro +20 -0
  66. package/src/components/ui/button-group/button-group-variants.ts +20 -0
  67. package/src/components/ui/button-group/button-group.astro +30 -0
  68. package/src/components/ui/button-group/index.ts +7 -0
  69. package/src/components/ui/carousel/carousel-content.astro +11 -13
  70. package/src/components/ui/carousel/carousel-item.astro +2 -5
  71. package/src/components/ui/carousel/carousel-next.astro +0 -3
  72. package/src/components/ui/carousel/carousel-previous.astro +0 -3
  73. package/src/components/ui/carousel/carousel.astro +19 -219
  74. package/src/components/ui/carousel/index.ts +1 -5
  75. package/src/components/ui/collapsible/collapsible.astro +8 -2
  76. package/src/components/ui/combobox/combobox-content.astro +1 -1
  77. package/src/components/ui/combobox/combobox-input.astro +11 -4
  78. package/src/components/ui/combobox/combobox-trigger.astro +7 -7
  79. package/src/components/ui/combobox/combobox.astro +9 -17
  80. package/src/components/ui/command/command-dialog.astro +1 -0
  81. package/src/components/ui/command/command.astro +40 -25
  82. package/src/components/ui/dialog/dialog.astro +8 -2
  83. package/src/components/ui/drawer/drawer-close.astro +13 -0
  84. package/src/components/ui/drawer/drawer-content.astro +43 -0
  85. package/src/components/ui/drawer/drawer-description.astro +17 -0
  86. package/src/components/ui/drawer/drawer-footer.astro +17 -0
  87. package/src/components/ui/drawer/drawer-header.astro +17 -0
  88. package/src/components/ui/drawer/drawer-indent-background.astro +11 -0
  89. package/src/components/ui/drawer/drawer-indent.astro +11 -0
  90. package/src/components/ui/drawer/drawer-overlay.astro +21 -0
  91. package/src/components/ui/drawer/drawer-popup.astro +36 -0
  92. package/src/components/ui/drawer/drawer-portal.astro +27 -0
  93. package/src/components/ui/drawer/drawer-provider.astro +11 -0
  94. package/src/components/ui/drawer/drawer-swipe-handle.astro +20 -0
  95. package/src/components/ui/drawer/drawer-title.astro +17 -0
  96. package/src/components/ui/drawer/drawer-trigger.astro +21 -0
  97. package/src/components/ui/drawer/drawer-viewport.astro +21 -0
  98. package/src/components/ui/drawer/drawer-virtual-keyboard-provider.astro +11 -0
  99. package/src/components/ui/drawer/drawer.astro +60 -0
  100. package/src/components/ui/drawer/index.ts +28 -0
  101. package/src/components/ui/dropdown-menu/dropdown-menu-content.astro +1 -1
  102. package/src/components/ui/dropdown-menu/dropdown-menu-item.astro +40 -9
  103. package/src/components/ui/dropdown-menu/dropdown-menu.astro +8 -2
  104. package/src/components/ui/hover-card/hover-card-content.astro +1 -1
  105. package/src/components/ui/hover-card/hover-card.astro +15 -4
  106. package/src/components/ui/navigation-menu/navigation-menu-positioner.astro +1 -1
  107. package/src/components/ui/navigation-menu/navigation-menu.astro +13 -4
  108. package/src/components/ui/pagination/index.ts +7 -0
  109. package/src/components/ui/pagination/pagination-content.astro +17 -0
  110. package/src/components/ui/pagination/pagination-ellipsis.astro +22 -0
  111. package/src/components/ui/pagination/pagination-item.astro +11 -0
  112. package/src/components/ui/pagination/pagination-link.astro +41 -0
  113. package/src/components/ui/pagination/pagination-next.astro +27 -0
  114. package/src/components/ui/pagination/pagination-previous.astro +27 -0
  115. package/src/components/ui/pagination/pagination.astro +19 -0
  116. package/src/components/ui/popover/popover-content.astro +2 -1
  117. package/src/components/ui/popover/popover.astro +9 -2
  118. package/src/components/ui/radio-group/radio-group.astro +8 -2
  119. package/src/components/ui/resizable/index.ts +4 -0
  120. package/src/components/ui/resizable/resizable-handle.astro +32 -0
  121. package/src/components/ui/resizable/resizable-panel.astro +36 -0
  122. package/src/components/ui/resizable/resizable.astro +43 -0
  123. package/src/components/ui/select/select-content.astro +2 -2
  124. package/src/components/ui/select/select.astro +11 -7
  125. package/src/components/ui/sheet/sheet.astro +8 -2
  126. package/src/components/ui/slider/slider.astro +9 -3
  127. package/src/components/ui/switch/switch.astro +8 -2
  128. package/src/components/ui/tabs/tabs-content.astro +1 -1
  129. package/src/components/ui/tabs/tabs-trigger.astro +3 -2
  130. package/src/components/ui/tabs/tabs.astro +8 -2
  131. package/src/components/ui/toast/index.ts +26 -0
  132. package/src/components/ui/toast/toast-action.astro +25 -0
  133. package/src/components/ui/toast/toast-close.astro +27 -0
  134. package/src/components/ui/toast/toast-content.astro +20 -0
  135. package/src/components/ui/toast/toast-description.astro +18 -0
  136. package/src/components/ui/toast/toast-icon.astro +37 -0
  137. package/src/components/ui/toast/toast-item.astro +28 -0
  138. package/src/components/ui/toast/toast-template.astro +11 -0
  139. package/src/components/ui/toast/toast-title.astro +17 -0
  140. package/src/components/ui/toast/toast-viewport.astro +20 -0
  141. package/src/components/ui/toast/toast.astro +51 -0
  142. package/src/components/ui/toast/toaster.astro +37 -0
  143. package/src/components/ui/toggle/toggle.astro +8 -2
  144. package/src/components/ui/toggle-group/index.ts +2 -0
  145. package/src/components/ui/toggle-group/toggle-group-item.astro +44 -0
  146. package/src/components/ui/toggle-group/toggle-group.astro +74 -0
  147. package/src/components/ui/tooltip/tooltip-content.astro +1 -1
  148. package/src/components/ui/tooltip/tooltip.astro +11 -2
  149. package/src/components/ui/typography/typeset.css +441 -0
  150. package/src/components/ui/typography/typography-a.astro +13 -22
  151. package/src/components/ui/typography/typography-blockquote.astro +4 -23
  152. package/src/components/ui/typography/typography-h1.astro +13 -26
  153. package/src/components/ui/typography/typography-h2.astro +13 -31
  154. package/src/components/ui/typography/typography-h3.astro +9 -26
  155. package/src/components/ui/typography/typography-h4.astro +9 -26
  156. package/src/components/ui/typography/typography-inline-code.astro +8 -27
  157. package/src/components/ui/typography/typography-lead.astro +4 -26
  158. package/src/components/ui/typography/typography-list-item.astro +4 -24
  159. package/src/components/ui/typography/typography-list.astro +10 -40
  160. package/src/components/ui/typography/typography-p.astro +9 -28
  161. package/src/components/ui/typography/typography-table-cell.astro +9 -40
  162. package/src/components/ui/typography/typography-table-head.astro +9 -35
  163. package/src/components/ui/typography/typography-table-row.astro +4 -23
  164. package/src/components/ui/typography/typography-table.astro +8 -28
  165. package/src/components/ui/typography/typography.astro +10 -283
  166. package/src/styles/global.css +2 -0
@@ -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>
@@ -25,6 +25,7 @@ const {
25
25
  ---
26
26
 
27
27
  <Dialog {...props}>
28
+ <slot name="trigger" />
28
29
  <DialogContent
29
30
  class:list={[
30
31
  "top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
@@ -46,31 +46,46 @@ const {
46
46
 
47
47
  <script>
48
48
  import { create } from "@data-slot/command"
49
+ import { getParts } from "@data-slot/core"
49
50
 
50
- const initCommand = () => {
51
- 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
+ })
52
59
 
53
- document.querySelectorAll("[data-slot=command]").forEach((command) => {
54
- if (!(command instanceof HTMLElement)) return
55
- if (command.dataset.linkNavigation === "true") return
56
-
57
- command.dataset.linkNavigation = "true"
58
- command.addEventListener("command:select", (event) => {
59
- const { detail } = event as CustomEvent<{ value?: unknown }>
60
- const value = detail?.value
61
- if (typeof value !== "string") return
62
-
63
- const item = Array.from(
64
- command.querySelectorAll("[data-slot=command-item][href]")
65
- ).find((item) => item.getAttribute("data-value") === value)
66
- const href = item?.getAttribute("href")
67
-
68
- if (href) window.location.href = href
69
- })
70
- })
71
- }
72
-
73
- initCommand()
74
-
75
- document.addEventListener("astro:page-load", initCommand)
60
+ // Data Slot selection does not activate links. Preserve native navigation.
61
+ document.addEventListener(
62
+ "keydown",
63
+ (event) => {
64
+ if (
65
+ event.key !== "Enter" ||
66
+ event.defaultPrevented ||
67
+ event.isComposing ||
68
+ event.keyCode === 229
69
+ )
70
+ return
71
+ const input = event.target
72
+ if (
73
+ !(input instanceof HTMLInputElement) ||
74
+ input.dataset.slot !== "command-input"
75
+ )
76
+ return
77
+ const root = input.closest('[data-slot="command"]')
78
+ if (!root) return
79
+ const item = getParts<HTMLAnchorElement>(root, "command-item").find(
80
+ (item) =>
81
+ item.hasAttribute("data-selected") &&
82
+ item.hasAttribute("href") &&
83
+ item.getAttribute("aria-disabled") !== "true"
84
+ )
85
+ if (!item) return
86
+ event.preventDefault()
87
+ item.click()
88
+ },
89
+ true
90
+ )
76
91
  </script>
@@ -36,6 +36,12 @@ const {
36
36
  <script>
37
37
  import { create } from "@data-slot/dialog"
38
38
 
39
- create()
40
- document.addEventListener("astro:page-load", () => create())
39
+ const controllers: ReturnType<typeof create> = []
40
+ const initialize = () => controllers.push(...create())
41
+ initialize()
42
+ document.addEventListener("astro:page-load", initialize)
43
+ document.addEventListener("astro:before-swap", () => {
44
+ for (const controller of controllers) controller.destroy()
45
+ controllers.length = 0
46
+ })
41
47
  </script>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import type { ComponentProps } from "astro/types"
3
+
4
+ import { Button } from "@/components/ui/button"
5
+
6
+ type Props = ComponentProps<typeof Button>
7
+
8
+ const { ...props } = Astro.props
9
+ ---
10
+
11
+ <Button data-slot="drawer-close" {...props}>
12
+ <slot />
13
+ </Button>
@@ -0,0 +1,43 @@
1
+ ---
2
+ import type { ComponentProps } from "astro/types"
3
+
4
+ import DrawerOverlay from "./drawer-overlay.astro"
5
+ import DrawerPopup from "./drawer-popup.astro"
6
+ import DrawerPortal from "./drawer-portal.astro"
7
+ import DrawerSwipeHandle from "./drawer-swipe-handle.astro"
8
+ import DrawerViewport from "./drawer-viewport.astro"
9
+
10
+ type Props = ComponentProps<typeof DrawerPopup> & {
11
+ showOverlay?: boolean
12
+ showSwipeHandle?: boolean
13
+ container?: string
14
+ keepMounted?: boolean
15
+ overlayClass?: string
16
+ viewportClass?: string
17
+ }
18
+
19
+ const {
20
+ showOverlay = true,
21
+ showSwipeHandle = false,
22
+ container,
23
+ keepMounted,
24
+ overlayClass,
25
+ viewportClass,
26
+ ...props
27
+ } = Astro.props
28
+ ---
29
+
30
+ <DrawerPortal container={container} keepMounted={keepMounted}>
31
+ {showOverlay && <DrawerOverlay class={overlayClass} />}
32
+ <DrawerViewport class={viewportClass}>
33
+ <DrawerPopup {...props}>
34
+ {showSwipeHandle && <DrawerSwipeHandle />}
35
+ <div
36
+ data-slot="drawer-content"
37
+ class="flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain rounded-[inherit] transition-opacity duration-300 select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none"
38
+ >
39
+ <slot />
40
+ </div>
41
+ </DrawerPopup>
42
+ </DrawerViewport>
43
+ </DrawerPortal>
@@ -0,0 +1,17 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"p">
7
+
8
+ const { class: className, ...props } = Astro.props
9
+ ---
10
+
11
+ <p
12
+ data-slot="drawer-description"
13
+ class={cn("text-muted-foreground text-sm text-balance", className)}
14
+ {...props}
15
+ >
16
+ <slot />
17
+ </p>
@@ -0,0 +1,17 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"div">
7
+
8
+ const { class: className, ...props } = Astro.props
9
+ ---
10
+
11
+ <div
12
+ data-slot="drawer-footer"
13
+ class={cn("mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0", className)}
14
+ {...props}
15
+ >
16
+ <slot />
17
+ </div>
@@ -0,0 +1,17 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"div">
7
+
8
+ const { class: className, ...props } = Astro.props
9
+ ---
10
+
11
+ <div
12
+ data-slot="drawer-header"
13
+ class={cn("flex shrink-0 flex-col gap-1.5 p-4 pb-0", className)}
14
+ {...props}
15
+ >
16
+ <slot />
17
+ </div>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ type Props = HTMLAttributes<"div">
5
+
6
+ const { class: className, ...props } = Astro.props
7
+ ---
8
+
9
+ <div data-slot="drawer-indent-background" class={className} {...props}>
10
+ <slot />
11
+ </div>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ type Props = HTMLAttributes<"div">
5
+
6
+ const { class: className, ...props } = Astro.props
7
+ ---
8
+
9
+ <div data-slot="drawer-indent" class={className} {...props}>
10
+ <slot />
11
+ </div>
@@ -0,0 +1,21 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"div">
7
+
8
+ const { class: className, hidden = true, ...props } = Astro.props
9
+ ---
10
+
11
+ <div
12
+ data-slot="drawer-backdrop"
13
+ hidden={hidden}
14
+ class={cn(
15
+ "fixed inset-0 z-50 min-h-dvh bg-black/10 opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <slot />
21
+ </div>
@@ -0,0 +1,36 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"div"> & {
7
+ initialFocus?: boolean | string
8
+ finalFocus?: boolean | string
9
+ }
10
+
11
+ const {
12
+ class: className,
13
+ initialFocus,
14
+ finalFocus,
15
+ hidden = true,
16
+ ...props
17
+ } = Astro.props
18
+ ---
19
+
20
+ <div
21
+ data-slot="drawer-popup"
22
+ data-initial-focus={initialFocus}
23
+ data-final-focus={finalFocus}
24
+ hidden={hidden}
25
+ class={cn(
26
+ "group/drawer-popup bg-popover text-popover-foreground pointer-events-auto fixed z-50 flex min-h-0 transform-gpu flex-col text-sm shadow-lg transition-[transform,height,opacity,filter] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*400ms)] data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95 data-swiping:duration-0",
27
+ "data-[swipe-direction=down]:inset-x-0 data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:max-h-[calc(100dvh-3rem)] data-[swipe-direction=down]:[transform:translate3d(0,calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-amount-y,0px)),0)] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=down]:data-ending-style:[transform:translate3d(0,calc(100%+2px),0)] data-[swipe-direction=down]:data-starting-style:[transform:translate3d(0,calc(100%+2px),0)]",
28
+ "data-[swipe-direction=up]:inset-x-0 data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:max-h-[calc(100dvh-3rem)] data-[swipe-direction=up]:[transform:translate3d(0,calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-amount-y,0px)),0)] data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b data-[swipe-direction=up]:data-ending-style:[transform:translate3d(0,calc(-100%-2px),0)] data-[swipe-direction=up]:data-starting-style:[transform:translate3d(0,calc(-100%-2px),0)]",
29
+ "data-[swipe-direction=left]:inset-y-0 data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:h-full data-[swipe-direction=left]:w-3/4 data-[swipe-direction=left]:max-w-sm data-[swipe-direction=left]:[transform:translate3d(calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-amount-x,0px)),0,0)] data-[swipe-direction=left]:flex-row data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=left]:data-ending-style:[transform:translate3d(calc(-100%-2px),0,0)] data-[swipe-direction=left]:data-starting-style:[transform:translate3d(calc(-100%-2px),0,0)]",
30
+ "data-[swipe-direction=right]:inset-y-0 data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:h-full data-[swipe-direction=right]:w-3/4 data-[swipe-direction=right]:max-w-sm data-[swipe-direction=right]:[transform:translate3d(calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-amount-x,0px)),0,0)] data-[swipe-direction=right]:flex-row data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=right]:data-ending-style:[transform:translate3d(calc(100%+2px),0,0)] data-[swipe-direction=right]:data-starting-style:[transform:translate3d(calc(100%+2px),0,0)]",
31
+ className
32
+ )}
33
+ {...props}
34
+ >
35
+ <slot />
36
+ </div>
@@ -0,0 +1,27 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ type Props = HTMLAttributes<"div"> & {
5
+ container?: string
6
+ keepMounted?: boolean
7
+ }
8
+
9
+ const {
10
+ class: className,
11
+ container,
12
+ keepMounted,
13
+ hidden = true,
14
+ ...props
15
+ } = Astro.props
16
+ ---
17
+
18
+ <div
19
+ data-slot="drawer-portal"
20
+ data-container={container}
21
+ data-keep-mounted={keepMounted}
22
+ class={className}
23
+ hidden={hidden}
24
+ {...props}
25
+ >
26
+ <slot />
27
+ </div>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ type Props = HTMLAttributes<"div">
5
+
6
+ const { class: className, ...props } = Astro.props
7
+ ---
8
+
9
+ <div data-slot="drawer-provider" class={className} {...props}>
10
+ <slot />
11
+ </div>
@@ -0,0 +1,20 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"div">
7
+
8
+ const { class: className, ...props } = Astro.props
9
+ ---
10
+
11
+ <div
12
+ data-slot="drawer-handle"
13
+ aria-hidden="true"
14
+ class={cn(
15
+ "after:bg-muted relative z-10 flex shrink-0 cursor-grab transition-opacity duration-200 group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-swiping/drawer-popup:opacity-100 group-data-[swipe-direction=down]/drawer-popup:h-3 group-data-[swipe-direction=down]/drawer-popup:w-full group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=down]/drawer-popup:justify-center group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:h-full group-data-[swipe-direction=left]/drawer-popup:w-3 group-data-[swipe-direction=left]/drawer-popup:items-center group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:h-full group-data-[swipe-direction=right]/drawer-popup:w-3 group-data-[swipe-direction=right]/drawer-popup:items-center group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:h-3 group-data-[swipe-direction=up]/drawer-popup:w-full group-data-[swipe-direction=up]/drawer-popup:items-start group-data-[swipe-direction=up]/drawer-popup:justify-center after:block after:shrink-0 after:rounded-full group-data-[swipe-direction=down]/drawer-popup:after:h-1.5 group-data-[swipe-direction=down]/drawer-popup:after:w-24 group-data-[swipe-direction=left]/drawer-popup:after:h-24 group-data-[swipe-direction=left]/drawer-popup:after:w-1.5 group-data-[swipe-direction=right]/drawer-popup:after:h-24 group-data-[swipe-direction=right]/drawer-popup:after:w-1.5 group-data-[swipe-direction=up]/drawer-popup:after:h-1.5 group-data-[swipe-direction=up]/drawer-popup:after:w-24 active:cursor-grabbing",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ </div>
@@ -0,0 +1,17 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"h2">
7
+
8
+ const { class: className, ...props } = Astro.props
9
+ ---
10
+
11
+ <h2
12
+ data-slot="drawer-title"
13
+ class={cn("text-foreground font-medium", className)}
14
+ {...props}
15
+ >
16
+ <slot />
17
+ </h2>
@@ -0,0 +1,21 @@
1
+ ---
2
+ import type { ComponentProps } from "astro/types"
3
+
4
+ import { Button } from "@/components/ui/button"
5
+
6
+ type Props = ComponentProps<typeof Button> & {
7
+ drawerTarget?: string
8
+ payload?: string
9
+ }
10
+
11
+ const { drawerTarget, payload, ...props } = Astro.props
12
+ ---
13
+
14
+ <Button
15
+ data-slot="drawer-trigger"
16
+ data-drawer-target={drawerTarget}
17
+ data-payload={payload}
18
+ {...props}
19
+ >
20
+ <slot />
21
+ </Button>
@@ -0,0 +1,21 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ type Props = HTMLAttributes<"div">
7
+
8
+ const { class: className, hidden = true, ...props } = Astro.props
9
+ ---
10
+
11
+ <div
12
+ data-slot="drawer-viewport"
13
+ hidden={hidden}
14
+ class={cn(
15
+ "pointer-events-none fixed inset-0 z-50 min-h-dvh select-none",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <slot />
21
+ </div>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+
4
+ type Props = HTMLAttributes<"div">
5
+
6
+ const { class: className, ...props } = Astro.props
7
+ ---
8
+
9
+ <div data-slot="drawer-virtual-keyboard-provider" class={className} {...props}>
10
+ <slot />
11
+ </div>
@@ -0,0 +1,60 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types"
3
+ import type { DrawerSnapPoint, DrawerSwipeDirection } from "@data-slot/drawer"
4
+
5
+ type Props = HTMLAttributes<"div"> & {
6
+ defaultOpen?: boolean
7
+ modal?: boolean | "trap-focus"
8
+ disablePointerDismissal?: boolean
9
+ closeOnEscape?: boolean
10
+ swipeDirection?: DrawerSwipeDirection
11
+ snapPoint?: DrawerSnapPoint | null
12
+ defaultSnapPoint?: DrawerSnapPoint | null
13
+ triggerId?: string | null
14
+ defaultTriggerId?: string | null
15
+ }
16
+
17
+ const {
18
+ class: className,
19
+ defaultOpen,
20
+ modal,
21
+ disablePointerDismissal,
22
+ closeOnEscape,
23
+ swipeDirection,
24
+ snapPoint,
25
+ defaultSnapPoint,
26
+ triggerId,
27
+ defaultTriggerId,
28
+ ...props
29
+ } = Astro.props
30
+ ---
31
+
32
+ <div
33
+ data-slot="drawer"
34
+ data-default-open={defaultOpen}
35
+ data-modal={modal}
36
+ data-disable-pointer-dismissal={disablePointerDismissal}
37
+ data-close-on-escape={closeOnEscape}
38
+ data-swipe-direction={swipeDirection}
39
+ data-snap-point={snapPoint}
40
+ data-default-snap-point={defaultSnapPoint}
41
+ data-trigger-id={triggerId}
42
+ data-default-trigger-id={defaultTriggerId}
43
+ class={className}
44
+ {...props}
45
+ >
46
+ <slot />
47
+ </div>
48
+
49
+ <script>
50
+ import { create } from "@data-slot/drawer"
51
+
52
+ const controllers: ReturnType<typeof create> = []
53
+ const initialize = () => controllers.push(...create())
54
+ initialize()
55
+ document.addEventListener("astro:page-load", initialize)
56
+ document.addEventListener("astro:before-swap", () => {
57
+ for (const controller of controllers) controller.destroy()
58
+ controllers.length = 0
59
+ })
60
+ </script>
@@ -0,0 +1,28 @@
1
+ export { default as Drawer } from "./drawer.astro"
2
+ export { default as DrawerTrigger } from "./drawer-trigger.astro"
3
+ export { default as DrawerClose } from "./drawer-close.astro"
4
+ export { default as DrawerPortal } from "./drawer-portal.astro"
5
+ export { default as DrawerOverlay } from "./drawer-overlay.astro"
6
+ export { default as DrawerBackdrop } from "./drawer-overlay.astro"
7
+ export { default as DrawerViewport } from "./drawer-viewport.astro"
8
+ export { default as DrawerPopup } from "./drawer-popup.astro"
9
+ export { default as DrawerContent } from "./drawer-content.astro"
10
+ export { default as DrawerSwipeHandle } from "./drawer-swipe-handle.astro"
11
+ export { default as DrawerHeader } from "./drawer-header.astro"
12
+ export { default as DrawerFooter } from "./drawer-footer.astro"
13
+ export { default as DrawerTitle } from "./drawer-title.astro"
14
+ export { default as DrawerDescription } from "./drawer-description.astro"
15
+ export { default as DrawerProvider } from "./drawer-provider.astro"
16
+ export { default as DrawerIndent } from "./drawer-indent.astro"
17
+ export { default as DrawerIndentBackground } from "./drawer-indent-background.astro"
18
+ export { default as DrawerVirtualKeyboardProvider } from "./drawer-virtual-keyboard-provider.astro"
19
+
20
+ export type {
21
+ DrawerChangeDetails,
22
+ DrawerChangeReason,
23
+ DrawerController,
24
+ DrawerOptions,
25
+ DrawerSnapChangeDetails,
26
+ DrawerSnapPoint,
27
+ DrawerSwipeDirection,
28
+ } from "@data-slot/drawer"
@@ -35,7 +35,7 @@ const {
35
35
  data-align-offset={alignOffset}
36
36
  data-avoid-collisions={avoidCollisions}
37
37
  data-collision-padding={collisionPadding}
38
- class="isolate z-50 outline-none"
38
+ class="isolate z-[1000] outline-none"
39
39
  >
40
40
  <div
41
41
  data-slot="dropdown-menu-content"
@@ -3,13 +3,16 @@ import type { HTMLAttributes } from "astro/types"
3
3
 
4
4
  import { cn } from "@/lib/utils"
5
5
 
6
- type Props = HTMLAttributes<"button"> & {
7
- disabled?: boolean
8
- variant?: "default" | "destructive"
9
- inset?: boolean
10
- }
6
+ type Props = HTMLAttributes<"button"> &
7
+ HTMLAttributes<"a"> & {
8
+ as?: "button" | "a"
9
+ disabled?: boolean
10
+ variant?: "default" | "destructive"
11
+ inset?: boolean
12
+ }
11
13
 
12
14
  const {
15
+ as: Tag = "href" in Astro.props ? "a" : "button",
13
16
  class: className,
14
17
  type = "button",
15
18
  disabled,
@@ -19,13 +22,13 @@ const {
19
22
  } = Astro.props
20
23
  ---
21
24
 
22
- <button
25
+ <Tag
23
26
  data-slot="dropdown-menu-item"
24
27
  data-disabled={disabled}
25
28
  data-variant={variant}
26
29
  data-inset={inset}
27
- disabled={disabled ? true : undefined}
28
- type={type}
30
+ disabled={Tag === "button" && disabled ? true : undefined}
31
+ type={Tag === "button" ? type : undefined}
29
32
  class={cn(
30
33
  "group/dropdown-menu-item data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex w-full cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
31
34
  className
@@ -33,4 +36,32 @@ const {
33
36
  {...props}
34
37
  >
35
38
  <slot />
36
- </button>
39
+ </Tag>
40
+
41
+ <script>
42
+ // Data Slot owns selection; links also need native keyboard activation.
43
+ document.addEventListener(
44
+ "keydown",
45
+ (event) => {
46
+ if (
47
+ event.defaultPrevented ||
48
+ event.isComposing ||
49
+ !["Enter", " "].includes(event.key)
50
+ )
51
+ return
52
+ const item =
53
+ event.target instanceof Element
54
+ ? event.target.closest('[data-slot="dropdown-menu-item"][href]')
55
+ : null
56
+ if (
57
+ !(item instanceof HTMLAnchorElement) ||
58
+ item.getAttribute("aria-disabled") === "true"
59
+ )
60
+ return
61
+ event.preventDefault()
62
+ event.stopPropagation()
63
+ item.click()
64
+ },
65
+ true
66
+ )
67
+ </script>
@@ -67,6 +67,12 @@ const defaultValuesAttr =
67
67
  <script>
68
68
  import { create } from "@data-slot/dropdown-menu"
69
69
 
70
- create()
71
- document.addEventListener("astro:page-load", () => create())
70
+ const controllers: ReturnType<typeof create> = []
71
+ const initialize = () => controllers.push(...create())
72
+ initialize()
73
+ document.addEventListener("astro:page-load", initialize)
74
+ document.addEventListener("astro:before-swap", () => {
75
+ for (const controller of controllers) controller.destroy()
76
+ controllers.length = 0
77
+ })
72
78
  </script>