@orbitkit/components 0.2.0-beta.1 → 0.3.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 (62) hide show
  1. package/dist/astro/accordion/Accordion.astro +34 -34
  2. package/dist/astro/accordion/AccordionItem.astro +19 -16
  3. package/dist/astro/accordion/AccordionTrigger.astro +33 -33
  4. package/dist/astro/accordion/AcordionContent.astro +23 -26
  5. package/dist/astro/accordion/accordion.ts +151 -125
  6. package/dist/astro/accordion/index.ts +6 -6
  7. package/dist/astro/collapsible/Collapsible.astro +34 -34
  8. package/dist/astro/collapsible/CollapsibleContent.astro +20 -20
  9. package/dist/astro/collapsible/collapsible.ts +81 -81
  10. package/dist/astro/collapsible/index.ts +4 -4
  11. package/dist/astro/drawer/DrawerContent.astro +74 -74
  12. package/dist/astro/drawer/drawer.ts +104 -104
  13. package/dist/astro/drawer/index.ts +2 -0
  14. package/dist/astro/dropdown/DropdownMenu.astro +19 -19
  15. package/dist/astro/dropdown/DropdownMenuContent.astro +42 -42
  16. package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -3
  17. package/dist/astro/dropdown/DropdownMenuItem.astro +27 -27
  18. package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -3
  19. package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -6
  20. package/dist/astro/dropdown/dropdown.ts +157 -157
  21. package/dist/astro/dropdown/dropdownVariants.ts +134 -134
  22. package/dist/astro/dropdown/index.ts +23 -15
  23. package/dist/astro/marquee/Marquee.astro +53 -0
  24. package/dist/astro/marquee/index.ts +3 -0
  25. package/dist/astro/modal/Modal.astro +19 -19
  26. package/dist/astro/modal/ModalContent.astro +2 -2
  27. package/dist/astro/modal/ModalDescription.astro +12 -12
  28. package/dist/astro/modal/ModalFooter.astro +15 -15
  29. package/dist/astro/modal/ModalHeader.astro +12 -12
  30. package/dist/astro/modal/ModalTitle.astro +18 -18
  31. package/dist/astro/modal/index.ts +15 -15
  32. package/dist/astro/modal/modal.ts +101 -101
  33. package/dist/astro/pagination/index.ts +2 -0
  34. package/dist/astro/popover/Popover.astro +17 -17
  35. package/dist/astro/popover/PopoverContent.astro +39 -39
  36. package/dist/astro/popover/index.ts +5 -4
  37. package/dist/astro/popover/popover.ts +113 -113
  38. package/dist/astro/popover/popoverVariants.ts +115 -115
  39. package/dist/astro/scroll-progress/ScrollProgress.astro +41 -0
  40. package/dist/astro/scroll-progress/ScrollProgressBar.astro +19 -0
  41. package/dist/astro/scroll-progress/index.ts +4 -0
  42. package/dist/astro/stat/Stat.astro +12 -12
  43. package/dist/astro/stat/StatDescription.astro +12 -12
  44. package/dist/astro/stat/StatTitle.astro +18 -18
  45. package/dist/astro/stat/StatValue.astro +12 -12
  46. package/dist/astro/stat/index.ts +6 -6
  47. package/dist/astro/tab/TabList.astro +19 -19
  48. package/dist/astro/toast/Toast.astro +36 -0
  49. package/dist/astro/toast/ToastDescription.astro +10 -0
  50. package/dist/astro/toast/ToastTitle.astro +18 -0
  51. package/dist/astro/toast/Toaster.astro +78 -0
  52. package/dist/astro/toast/assets.ts +6 -0
  53. package/dist/astro/toast/index.ts +30 -0
  54. package/dist/astro/toast/toast.ts +277 -0
  55. package/dist/astro/tooltip/Tooltip.astro +40 -40
  56. package/dist/astro/tooltip/TooltipContent.astro +39 -39
  57. package/dist/astro/tooltip/index.ts +5 -6
  58. package/dist/astro/tooltip/tooltip.ts +137 -137
  59. package/dist/astro/tooltip/tooltipVariants.ts +115 -115
  60. package/dist/index.js +18 -5
  61. package/dist/index.js.map +1 -1
  62. package/package.json +1 -1
@@ -1,15 +1,23 @@
1
- import DropdownMenu from "./DropdownMenu.astro";
2
- import DropdownMenuContent from "./DropdownMenuContent.astro";
3
- import DropdownMenuGroup from "./DropdownMenuGroup.astro";
4
- import DropdownMenuItem from "./DropdownMenuItem.astro";
5
- import DropdownMenuLabel from "./DropdownMenuLabel.astro";
6
- import DropdownMenuSeparator from "./DropdownMenuSeparator.astro";
7
-
8
- export {
9
- DropdownMenu,
10
- DropdownMenuContent,
11
- DropdownMenuGroup,
12
- DropdownMenuItem,
13
- DropdownMenuLabel,
14
- DropdownMenuSeparator,
15
- };
1
+ import DropdownMenu from "./DropdownMenu.astro";
2
+ import DropdownMenuContent from "./DropdownMenuContent.astro";
3
+ import DropdownMenuGroup from "./DropdownMenuGroup.astro";
4
+ import DropdownMenuItem from "./DropdownMenuItem.astro";
5
+ import DropdownMenuLabel from "./DropdownMenuLabel.astro";
6
+ import DropdownMenuSeparator from "./DropdownMenuSeparator.astro";
7
+ import {
8
+ dropdownArrowVariants,
9
+ dropdownMenuItemVariants,
10
+ dropdownMenuVariants,
11
+ } from "./dropdownVariants";
12
+
13
+ export {
14
+ dropdownArrowVariants,
15
+ DropdownMenu,
16
+ DropdownMenuContent,
17
+ DropdownMenuGroup,
18
+ DropdownMenuItem,
19
+ dropdownMenuItemVariants,
20
+ DropdownMenuLabel,
21
+ DropdownMenuSeparator,
22
+ dropdownMenuVariants,
23
+ };
@@ -0,0 +1,53 @@
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+
4
+ interface Props {
5
+ duration?: number;
6
+ gap?: number;
7
+ repeat?: number;
8
+ pauseOnHover?: boolean;
9
+ vertical?: boolean;
10
+ reverse?: boolean;
11
+ }
12
+
13
+ const {
14
+ duration = 10,
15
+ gap = 1,
16
+ repeat = 4,
17
+ pauseOnHover = true,
18
+ vertical = false,
19
+ reverse = false,
20
+ } = Astro.props;
21
+ ---
22
+
23
+ <div
24
+ class={cn(
25
+ "group flex overflow-hidden max-w-max p-2 gap-(--gap)",
26
+ vertical ? "flex-col" : "flex-row",
27
+ )}
28
+ style={{
29
+ "--gap": `${gap}rem`,
30
+ "--duration": `${duration}s`,
31
+ }}
32
+ >
33
+ {
34
+ Array(repeat)
35
+ .fill(0)
36
+ .map(() => (
37
+ <div
38
+ class={cn(
39
+ "gap-(--gap) flex shrink-0 justify-around",
40
+ {
41
+ "group-hover:[animation-play-state:paused]": pauseOnHover,
42
+ "[animation-direction:reverse]": reverse,
43
+ },
44
+ vertical
45
+ ? "animate-marquee-vertical flex-col"
46
+ : "animate-marquee-horizontal flex-row",
47
+ )}
48
+ >
49
+ <slot />
50
+ </div>
51
+ ))
52
+ }
53
+ </div>
@@ -0,0 +1,3 @@
1
+ import Marquee from "./Marquee.astro";
2
+
3
+ export { Marquee };
@@ -1,19 +1,19 @@
1
- <div data-modal-wrapper>
2
- <slot />
3
- </div>
4
-
5
- <script>
6
- import { Modal } from "./modal";
7
-
8
- function init() {
9
- const modals = document.querySelectorAll<HTMLElement>(
10
- "[data-modal-wrapper]",
11
- );
12
- modals.forEach((modal) => {
13
- new Modal(modal);
14
- });
15
- }
16
-
17
- init();
18
- document.addEventListener("astro:page-load", () => init());
19
- </script>
1
+ <div data-modal-wrapper>
2
+ <slot />
3
+ </div>
4
+
5
+ <script>
6
+ import { Modal } from "./modal";
7
+
8
+ function init() {
9
+ const modals = document.querySelectorAll<HTMLElement>(
10
+ "[data-modal-wrapper]",
11
+ );
12
+ modals.forEach((modal) => {
13
+ new Modal(modal);
14
+ });
15
+ }
16
+
17
+ init();
18
+ document.addEventListener("astro:page-load", () => init());
19
+ </script>
@@ -20,7 +20,7 @@ const {
20
20
  {
21
21
  backdrop && (
22
22
  <div
23
- class="bg-background/10 fixed inset-0 left-0 top-0 z-50 hidden h-dvh w-full backdrop-blur-md transition-opacity duration-200"
23
+ class="bg-background fixed inset-0 left-0 top-0 z-50 hidden h-dvh w-full transition-opacity duration-100 data-[state=closed]:opacity-0 data-[state=open]:opacity-80"
24
24
  aria-hidden="true"
25
25
  data-state="closed"
26
26
  data-backdrop
@@ -36,7 +36,7 @@ const {
36
36
  data-show-close-button={showCloseButton}
37
37
  data-allow-outside-click={allowOutsideClick}
38
38
  class={cn(
39
- "hidden fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-surface text-foreground border-border border rounded-lg shadow-sm p-6 w-full max-w-[calc(100%-2rem)] sm:max-w-md transform transition-all ease-in data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data[state=open]:opacity-100 data[state=open]:scale-100",
39
+ "hidden fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-surface text-foreground border-border border rounded-lg shadow-sm p-6 w-full max-w-[calc(100%-2rem)] sm:max-w-md transform transition-all ease-in data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data-[state=open]:opacity-100 data-[state=open]:scale-100",
40
40
  className,
41
41
  )}
42
42
  {...attrs}
@@ -1,12 +1,12 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import { type HTMLAttributes } from "astro/types";
4
-
5
- interface Props extends HTMLAttributes<"p"> {}
6
-
7
- const { class: className, ...attrs } = Astro.props;
8
- ---
9
-
10
- <p {...attrs} class={cn("font-normal text-muted-foreground", className)}>
11
- <slot />
12
- </p>
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import { type HTMLAttributes } from "astro/types";
4
+
5
+ interface Props extends HTMLAttributes<"p"> {}
6
+
7
+ const { class: className, ...attrs } = Astro.props;
8
+ ---
9
+
10
+ <p {...attrs} class={cn("font-normal text-muted-foreground", className)}>
11
+ <slot />
12
+ </p>
@@ -1,15 +1,15 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import { type HTMLAttributes } from "astro/types";
4
-
5
- interface Props extends HTMLAttributes<"div"> {}
6
-
7
- const { class: className, ...attrs } = Astro.props;
8
- ---
9
-
10
- <div
11
- {...attrs}
12
- class={cn("pt-4 flex items-center justify-end gap-2", className)}
13
- >
14
- <slot />
15
- </div>
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import { type HTMLAttributes } from "astro/types";
4
+
5
+ interface Props extends HTMLAttributes<"div"> {}
6
+
7
+ const { class: className, ...attrs } = Astro.props;
8
+ ---
9
+
10
+ <div
11
+ {...attrs}
12
+ class={cn("pt-4 flex items-center justify-end gap-2", className)}
13
+ >
14
+ <slot />
15
+ </div>
@@ -1,12 +1,12 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import { type HTMLAttributes } from "astro/types";
4
-
5
- interface Props extends HTMLAttributes<"div"> {}
6
-
7
- const { class: className, ...attrs } = Astro.props;
8
- ---
9
-
10
- <div {...attrs} class={cn("flex flex-col gap-1 pb-4", className)}>
11
- <slot />
12
- </div>
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import { type HTMLAttributes } from "astro/types";
4
+
5
+ interface Props extends HTMLAttributes<"div"> {}
6
+
7
+ const { class: className, ...attrs } = Astro.props;
8
+ ---
9
+
10
+ <div {...attrs} class={cn("flex flex-col gap-1 pb-4", className)}>
11
+ <slot />
12
+ </div>
@@ -1,18 +1,18 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import { type HTMLAttributes } from "astro/types";
4
-
5
- interface Props extends HTMLAttributes<"h2"> {}
6
-
7
- const { class: className, ...attrs } = Astro.props;
8
- ---
9
-
10
- <h2
11
- {...attrs}
12
- class={cn(
13
- "flex items-center justify-start gap-2 text-2xl font-semibold tracking-tight",
14
- className,
15
- )}
16
- >
17
- <slot />
18
- </h2>
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import { type HTMLAttributes } from "astro/types";
4
+
5
+ interface Props extends HTMLAttributes<"h2"> {}
6
+
7
+ const { class: className, ...attrs } = Astro.props;
8
+ ---
9
+
10
+ <h2
11
+ {...attrs}
12
+ class={cn(
13
+ "flex items-center justify-start gap-2 text-2xl font-semibold tracking-tight",
14
+ className,
15
+ )}
16
+ >
17
+ <slot />
18
+ </h2>
@@ -1,15 +1,15 @@
1
- import Modal from "./Modal.astro";
2
- import ModalContent from "./ModalContent.astro";
3
- import ModalDescription from "./ModalDescription.astro";
4
- import ModalFooter from "./ModalFooter.astro";
5
- import ModalHeader from "./ModalHeader.astro";
6
- import ModalTitle from "./ModalTitle.astro";
7
-
8
- export {
9
- Modal,
10
- ModalContent,
11
- ModalDescription,
12
- ModalFooter,
13
- ModalHeader,
14
- ModalTitle,
15
- };
1
+ import Modal from "./Modal.astro";
2
+ import ModalContent from "./ModalContent.astro";
3
+ import ModalDescription from "./ModalDescription.astro";
4
+ import ModalFooter from "./ModalFooter.astro";
5
+ import ModalHeader from "./ModalHeader.astro";
6
+ import ModalTitle from "./ModalTitle.astro";
7
+
8
+ export {
9
+ Modal,
10
+ ModalContent,
11
+ ModalDescription,
12
+ ModalFooter,
13
+ ModalHeader,
14
+ ModalTitle,
15
+ };
@@ -1,101 +1,101 @@
1
- export class Modal {
2
- private wrapper: HTMLElement;
3
- private modal: HTMLElement | null;
4
- private trigger: HTMLElement | null;
5
- private backdrop: HTMLElement | null;
6
- private closeButtons: NodeListOf<HTMLElement> | null;
7
-
8
- constructor(wrapper: HTMLElement) {
9
- this.wrapper = wrapper;
10
- this.modal = this.wrapper.querySelector("[data-modal]");
11
- this.backdrop = this.wrapper.querySelector("[data-backdrop]");
12
- this.trigger = this.wrapper.querySelector("[data-trigger]");
13
- this.closeButtons = this.wrapper.querySelectorAll("[data-close]");
14
-
15
- if (!this.modal || !this.trigger) {
16
- console.error("Modal not initialized properly", {
17
- modal: this.modal,
18
- });
19
- return;
20
- }
21
-
22
- this.init();
23
- }
24
-
25
- private init() {
26
- this.setupAccessibility();
27
- this.setupEventListeners();
28
- }
29
-
30
- private setupAccessibility() {
31
- const title = this.modal?.querySelector<HTMLElement>(
32
- "h1, h2, h3, h4, h5, h6",
33
- );
34
-
35
- if (title) {
36
- const id =
37
- title.id || `modal-id-${Math.random().toString(36).substring(2, 9)}`;
38
- title.id = id;
39
- this.modal?.setAttribute("aria-describedby", id);
40
- }
41
-
42
- this.setState("closed");
43
- }
44
-
45
- private setupEventListeners() {
46
- this.trigger!.addEventListener("click", () => this.open());
47
-
48
- if (this.modal?.dataset.allowOutsideClick === "true") {
49
- this.backdrop?.addEventListener("click", () => this.closeModal());
50
- document.addEventListener("click", (e) => {
51
- const target = e.target as HTMLElement;
52
- if (
53
- this.modal &&
54
- !this.modal.contains(target) &&
55
- target !== this.trigger
56
- ) {
57
- this.closeModal();
58
- }
59
- });
60
- }
61
-
62
- this.closeButtons?.forEach((trigger) => {
63
- trigger.addEventListener("click", () => this.closeModal());
64
- });
65
-
66
- document.addEventListener("keydown", (e) => this.handleKeyDown(e));
67
- }
68
-
69
- private open() {
70
- this.backdrop?.classList.remove("hidden");
71
- this.modal?.classList.remove("hidden");
72
- document.body.classList.add("overflow-hidden");
73
- setTimeout(() => {
74
- this.setState("open");
75
- }, 0);
76
- }
77
-
78
- private closeModal() {
79
- this.setState("closed");
80
- setTimeout(() => {
81
- this.backdrop?.classList.add("hidden");
82
- this.modal?.classList.add("hidden");
83
- document.body.classList.remove("overflow-hidden");
84
- }, 200);
85
- }
86
-
87
- private setState(state: "open" | "closed") {
88
- this.trigger?.focus();
89
- this.modal?.setAttribute("aria-hidden", `${state === "closed"}`);
90
- this.modal?.setAttribute("data-state", state);
91
- this.backdrop?.setAttribute("aria-hidden", `${state === "closed"}`);
92
- this.backdrop?.setAttribute("data-state", state);
93
- }
94
-
95
- private handleKeyDown = (event: KeyboardEvent) => {
96
- if (event.key === "Escape" && this.modal!.dataset.status === "open") {
97
- this.closeModal();
98
- event.preventDefault();
99
- }
100
- };
101
- }
1
+ export class Modal {
2
+ private wrapper: HTMLElement;
3
+ private modal: HTMLElement | null;
4
+ private trigger: HTMLElement | null;
5
+ private backdrop: HTMLElement | null;
6
+ private closeButtons: NodeListOf<HTMLElement> | null;
7
+
8
+ constructor(wrapper: HTMLElement) {
9
+ this.wrapper = wrapper;
10
+ this.modal = this.wrapper.querySelector("[data-modal]");
11
+ this.backdrop = this.wrapper.querySelector("[data-backdrop]");
12
+ this.trigger = this.wrapper.querySelector("[data-trigger]");
13
+ this.closeButtons = this.wrapper.querySelectorAll("[data-close]");
14
+
15
+ if (!this.modal || !this.trigger) {
16
+ console.error("Modal not initialized properly", {
17
+ modal: this.modal,
18
+ });
19
+ return;
20
+ }
21
+
22
+ this.init();
23
+ }
24
+
25
+ private init() {
26
+ this.setupAccessibility();
27
+ this.setupEventListeners();
28
+ }
29
+
30
+ private setupAccessibility() {
31
+ const title = this.modal?.querySelector<HTMLElement>(
32
+ "h1, h2, h3, h4, h5, h6",
33
+ );
34
+
35
+ if (title) {
36
+ const id =
37
+ title.id || `modal-id-${Math.random().toString(36).substring(2, 9)}`;
38
+ title.id = id;
39
+ this.modal?.setAttribute("aria-describedby", id);
40
+ }
41
+
42
+ this.setState("closed");
43
+ }
44
+
45
+ private setupEventListeners() {
46
+ this.trigger!.addEventListener("click", () => this.open());
47
+
48
+ if (this.modal?.dataset.allowOutsideClick === "true") {
49
+ this.backdrop?.addEventListener("click", () => this.closeModal());
50
+ document.addEventListener("click", (e) => {
51
+ const target = e.target as HTMLElement;
52
+ if (
53
+ this.modal &&
54
+ !this.modal.contains(target) &&
55
+ target !== this.trigger
56
+ ) {
57
+ this.closeModal();
58
+ }
59
+ });
60
+ }
61
+
62
+ this.closeButtons?.forEach((trigger) => {
63
+ trigger.addEventListener("click", () => this.closeModal());
64
+ });
65
+
66
+ document.addEventListener("keydown", (e) => this.handleKeyDown(e));
67
+ }
68
+
69
+ private open() {
70
+ this.backdrop?.classList.remove("hidden");
71
+ this.modal?.classList.remove("hidden");
72
+ document.body.classList.add("overflow-hidden");
73
+ setTimeout(() => {
74
+ this.setState("open");
75
+ }, 0);
76
+ }
77
+
78
+ private closeModal() {
79
+ this.setState("closed");
80
+ setTimeout(() => {
81
+ this.backdrop?.classList.add("hidden");
82
+ this.modal?.classList.add("hidden");
83
+ document.body.classList.remove("overflow-hidden");
84
+ }, 200);
85
+ }
86
+
87
+ private setState(state: "open" | "closed") {
88
+ this.trigger?.focus();
89
+ this.modal?.setAttribute("aria-hidden", `${state === "closed"}`);
90
+ this.modal?.setAttribute("data-state", state);
91
+ this.backdrop?.setAttribute("aria-hidden", `${state === "closed"}`);
92
+ this.backdrop?.setAttribute("data-state", state);
93
+ }
94
+
95
+ private handleKeyDown = (event: KeyboardEvent) => {
96
+ if (event.key === "Escape" && this.modal!.dataset.status === "open") {
97
+ this.closeModal();
98
+ event.preventDefault();
99
+ }
100
+ };
101
+ }
@@ -3,6 +3,7 @@ import PaginationContent from "./PaginationContent.astro";
3
3
  import PaginationEllipsis from "./PaginationEllipsis.astro";
4
4
  import PaginationItem from "./PaginationItem.astro";
5
5
  import PaginationLink from "./PaginationLink.astro";
6
+ import { paginationLinkVariants } from "./paginationVariants";
6
7
 
7
8
  export {
8
9
  Pagination,
@@ -10,4 +11,5 @@ export {
10
11
  PaginationEllipsis,
11
12
  PaginationItem,
12
13
  PaginationLink,
14
+ paginationLinkVariants,
13
15
  };
@@ -1,17 +1,17 @@
1
- <div class="relative" data-popover>
2
- <slot />
3
- </div>
4
-
5
- <script>
6
- import { Popover } from "./popover";
7
-
8
- function init() {
9
- const popovers = document.querySelectorAll<HTMLElement>("[data-popover]");
10
- popovers.forEach((dropdown) => {
11
- new Popover(dropdown);
12
- });
13
- }
14
-
15
- init();
16
- document.addEventListener("astro:page-load", () => init());
17
- </script>
1
+ <div class="relative" data-popover>
2
+ <slot />
3
+ </div>
4
+
5
+ <script>
6
+ import { Popover } from "./popover";
7
+
8
+ function init() {
9
+ const popovers = document.querySelectorAll<HTMLElement>("[data-popover]");
10
+ popovers.forEach((dropdown) => {
11
+ new Popover(dropdown);
12
+ });
13
+ }
14
+
15
+ init();
16
+ document.addEventListener("astro:page-load", () => init());
17
+ </script>
@@ -1,39 +1,39 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import type { HTMLAttributes } from "astro/types";
4
- import type { VariantProps } from "class-variance-authority";
5
- import { popoverArrowVariants, popoverVariants } from "./popoverVariants";
6
-
7
- interface Props
8
- extends HTMLAttributes<"div">,
9
- VariantProps<typeof popoverVariants> {
10
- sideOffset?: number;
11
- arrow?: boolean;
12
- }
13
-
14
- const {
15
- class: className,
16
- side,
17
- alignment,
18
- sideOffset = 2,
19
- arrow = false,
20
- ...attrs
21
- } = Astro.props;
22
- ---
23
-
24
- <div
25
- {...attrs}
26
- role="dialog"
27
- data-popover-content
28
- aria-hidden="true"
29
- data-state="closed"
30
- data-side={sideOffset}
31
- data-alignment={alignment}
32
- class={cn(popoverVariants({ side, alignment, className }))}
33
- style={{
34
- "--tooltip-offset": `calc(var(--spacing) * ${sideOffset})`,
35
- }}
36
- >
37
- <slot />
38
- {arrow && <span class={cn(popoverArrowVariants({ side, alignment }))} />}
39
- </div>
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import type { HTMLAttributes } from "astro/types";
4
+ import type { VariantProps } from "class-variance-authority";
5
+ import { popoverArrowVariants, popoverVariants } from "./popoverVariants";
6
+
7
+ interface Props
8
+ extends HTMLAttributes<"div">,
9
+ VariantProps<typeof popoverVariants> {
10
+ sideOffset?: number;
11
+ arrow?: boolean;
12
+ }
13
+
14
+ const {
15
+ class: className,
16
+ side,
17
+ alignment,
18
+ sideOffset = 2,
19
+ arrow = false,
20
+ ...attrs
21
+ } = Astro.props;
22
+ ---
23
+
24
+ <div
25
+ {...attrs}
26
+ role="dialog"
27
+ data-popover-content
28
+ aria-hidden="true"
29
+ data-state="closed"
30
+ data-side={sideOffset}
31
+ data-alignment={alignment}
32
+ class={cn(popoverVariants({ side, alignment, className }))}
33
+ style={{
34
+ "--tooltip-offset": `calc(var(--spacing) * ${sideOffset})`,
35
+ }}
36
+ >
37
+ <slot />
38
+ {arrow && <span class={cn(popoverArrowVariants({ side, alignment }))} />}
39
+ </div>
@@ -1,4 +1,5 @@
1
- import Popover from "./Popover.astro";
2
- import PopoverContent from "./PopoverContent.astro";
3
-
4
- export { Popover, PopoverContent };
1
+ import Popover from "./Popover.astro";
2
+ import PopoverContent from "./PopoverContent.astro";
3
+ import { popoverArrowVariants, popoverVariants } from "./popoverVariants";
4
+
5
+ export { Popover, popoverArrowVariants, PopoverContent, popoverVariants };