@orbitkit/components 0.2.0 → 0.4.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 (120) hide show
  1. package/dist/astro/accordion/Accordion.astro +34 -34
  2. package/dist/astro/accordion/AccordionItem.astro +19 -19
  3. package/dist/astro/accordion/AccordionTrigger.astro +33 -33
  4. package/dist/astro/accordion/AcordionContent.astro +23 -23
  5. package/dist/astro/accordion/accordion.ts +151 -151
  6. package/dist/astro/accordion/index.ts +6 -6
  7. package/dist/astro/ambient-image/AmbientFigcaption.astro +15 -0
  8. package/dist/astro/ambient-image/AmbientImage.astro +70 -0
  9. package/dist/astro/ambient-image/index.ts +4 -0
  10. package/dist/astro/button-group/ButtonGroup.astro +21 -0
  11. package/dist/astro/button-group/buttonGroupVariants.ts +34 -0
  12. package/dist/astro/button-group/index.ts +3 -0
  13. package/dist/astro/collapsible/Collapsible.astro +34 -34
  14. package/dist/astro/collapsible/CollapsibleContent.astro +20 -20
  15. package/dist/astro/collapsible/collapsible.ts +81 -81
  16. package/dist/astro/collapsible/index.ts +4 -4
  17. package/dist/astro/diff/Diff.astro +55 -0
  18. package/dist/astro/diff/DiffItem.astro +21 -0
  19. package/dist/astro/diff/index.ts +4 -0
  20. package/dist/astro/drawer/DrawerContent.astro +74 -74
  21. package/dist/astro/drawer/drawer.ts +104 -104
  22. package/dist/astro/drawer/index.ts +17 -17
  23. package/dist/astro/dropdown/DropdownMenu.astro +19 -19
  24. package/dist/astro/dropdown/DropdownMenuContent.astro +42 -42
  25. package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -3
  26. package/dist/astro/dropdown/DropdownMenuItem.astro +27 -27
  27. package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -3
  28. package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -6
  29. package/dist/astro/dropdown/dropdown.ts +157 -157
  30. package/dist/astro/dropdown/dropdownVariants.ts +134 -134
  31. package/dist/astro/dropdown/index.ts +23 -23
  32. package/dist/astro/loader/Loader.astro +16 -0
  33. package/dist/astro/loader/index.ts +6 -0
  34. package/dist/astro/loader/loaders/12-dots-scale-rotate.svg +1 -0
  35. package/dist/astro/loader/loaders/180-ring-with-bg.svg +1 -0
  36. package/dist/astro/loader/loaders/180-ring.svg +1 -0
  37. package/dist/astro/loader/loaders/270-ring-with-bg.svg +1 -0
  38. package/dist/astro/loader/loaders/270-ring.svg +1 -0
  39. package/dist/astro/loader/loaders/3-dots-bounce.svg +1 -0
  40. package/dist/astro/loader/loaders/3-dots-fade.svg +1 -0
  41. package/dist/astro/loader/loaders/3-dots-move.svg +1 -0
  42. package/dist/astro/loader/loaders/3-dots-rotate.svg +1 -0
  43. package/dist/astro/loader/loaders/3-dots-scale-middle.svg +1 -0
  44. package/dist/astro/loader/loaders/3-dots-scale.svg +1 -0
  45. package/dist/astro/loader/loaders/6-dots-rotate.svg +1 -0
  46. package/dist/astro/loader/loaders/6-dots-scale-middle.svg +1 -0
  47. package/dist/astro/loader/loaders/6-dots-scale.svg +1 -0
  48. package/dist/astro/loader/loaders/8-dots-rotate.svg +1 -0
  49. package/dist/astro/loader/loaders/90-ring-with-bg.svg +1 -0
  50. package/dist/astro/loader/loaders/90-ring.svg +1 -0
  51. package/dist/astro/loader/loaders/bars-fade.svg +1 -0
  52. package/dist/astro/loader/loaders/bars-rotate-fade.svg +1 -0
  53. package/dist/astro/loader/loaders/bars-scale-fade.svg +1 -0
  54. package/dist/astro/loader/loaders/bars-scale-middle.svg +1 -0
  55. package/dist/astro/loader/loaders/bars-scale.svg +1 -0
  56. package/dist/astro/loader/loaders/blocks-scale.svg +1 -0
  57. package/dist/astro/loader/loaders/blocks-shuffle-2.svg +1 -0
  58. package/dist/astro/loader/loaders/blocks-shuffle-3.svg +1 -0
  59. package/dist/astro/loader/loaders/blocks-wave.svg +1 -0
  60. package/dist/astro/loader/loaders/bouncing-ball.svg +1 -0
  61. package/dist/astro/loader/loaders/clock.svg +1 -0
  62. package/dist/astro/loader/loaders/dot-revolve.svg +1 -0
  63. package/dist/astro/loader/loaders/eclipse-half.svg +1 -0
  64. package/dist/astro/loader/loaders/eclipse.svg +1 -0
  65. package/dist/astro/loader/loaders/gooey-balls-1.svg +1 -0
  66. package/dist/astro/loader/loaders/gooey-balls-2.svg +1 -0
  67. package/dist/astro/loader/loaders/index.ts +99 -0
  68. package/dist/astro/loader/loaders/pulse-2.svg +1 -0
  69. package/dist/astro/loader/loaders/pulse-3.svg +1 -0
  70. package/dist/astro/loader/loaders/pulse-multiple.svg +1 -0
  71. package/dist/astro/loader/loaders/pulse-ring.svg +1 -0
  72. package/dist/astro/loader/loaders/pulse-rings-2.svg +1 -0
  73. package/dist/astro/loader/loaders/pulse-rings-3.svg +1 -0
  74. package/dist/astro/loader/loaders/pulse-rings-multiple.svg +1 -0
  75. package/dist/astro/loader/loaders/pulse.svg +1 -0
  76. package/dist/astro/loader/loaders/ring-resize.svg +1 -0
  77. package/dist/astro/loader/loaders/tadpole.svg +1 -0
  78. package/dist/astro/loader/loaders/wifi-fade.svg +1 -0
  79. package/dist/astro/loader/loaders/wifi.svg +1 -0
  80. package/dist/astro/loader/loaders/wind-toy.svg +1 -0
  81. package/dist/astro/marquee/Marquee.astro +53 -0
  82. package/dist/astro/marquee/index.ts +3 -0
  83. package/dist/astro/modal/Modal.astro +19 -19
  84. package/dist/astro/modal/ModalContent.astro +71 -71
  85. package/dist/astro/modal/ModalDescription.astro +12 -12
  86. package/dist/astro/modal/ModalFooter.astro +15 -15
  87. package/dist/astro/modal/ModalHeader.astro +12 -12
  88. package/dist/astro/modal/ModalTitle.astro +18 -18
  89. package/dist/astro/modal/index.ts +15 -15
  90. package/dist/astro/modal/modal.ts +101 -101
  91. package/dist/astro/pagination/index.ts +15 -15
  92. package/dist/astro/popover/Popover.astro +17 -17
  93. package/dist/astro/popover/PopoverContent.astro +39 -39
  94. package/dist/astro/popover/index.ts +5 -5
  95. package/dist/astro/popover/popover.ts +113 -113
  96. package/dist/astro/popover/popoverVariants.ts +115 -115
  97. package/dist/astro/scroll-progress/ScrollProgress.astro +41 -0
  98. package/dist/astro/scroll-progress/ScrollProgressBar.astro +19 -0
  99. package/dist/astro/scroll-progress/index.ts +4 -0
  100. package/dist/astro/stat/Stat.astro +12 -12
  101. package/dist/astro/stat/StatDescription.astro +12 -12
  102. package/dist/astro/stat/StatTitle.astro +18 -18
  103. package/dist/astro/stat/StatValue.astro +12 -12
  104. package/dist/astro/stat/index.ts +6 -6
  105. package/dist/astro/tab/TabList.astro +19 -19
  106. package/dist/astro/toast/Toast.astro +36 -0
  107. package/dist/astro/toast/ToastDescription.astro +10 -0
  108. package/dist/astro/toast/ToastTitle.astro +18 -0
  109. package/dist/astro/toast/Toaster.astro +78 -0
  110. package/dist/astro/toast/assets.ts +6 -0
  111. package/dist/astro/toast/index.ts +30 -0
  112. package/dist/astro/toast/toast.ts +277 -0
  113. package/dist/astro/tooltip/Tooltip.astro +40 -40
  114. package/dist/astro/tooltip/TooltipContent.astro +39 -39
  115. package/dist/astro/tooltip/index.ts +5 -5
  116. package/dist/astro/tooltip/tooltip.ts +137 -137
  117. package/dist/astro/tooltip/tooltipVariants.ts +115 -115
  118. package/dist/index.js +30 -2
  119. package/dist/index.js.map +1 -1
  120. package/package.json +9 -8
@@ -1,104 +1,104 @@
1
- export class Drawer {
2
- private wrapper: HTMLElement;
3
- private drawer: HTMLElement | null;
4
- private trigger: HTMLElement | null;
5
- private backdrop: HTMLElement | null;
6
- private closeButtons: NodeListOf<HTMLElement> | null;
7
-
8
- constructor(drawerWrraper: HTMLElement) {
9
- this.wrapper = drawerWrraper;
10
- this.drawer = this.wrapper.querySelector("[data-drawer-content]");
11
- this.backdrop = this.wrapper.querySelector("[data-drawer-backdrop]");
12
- this.trigger = this.wrapper.querySelector("[data-trigger]");
13
- this.closeButtons =
14
- this.wrapper.querySelectorAll<HTMLElement>("[data-close]");
15
-
16
- if (!this.drawer || !this.trigger) {
17
- console.error("Drawer not initialized properly", {
18
- drawer: this.drawer,
19
- trigger: this.trigger,
20
- });
21
- return;
22
- }
23
-
24
- this.init();
25
- }
26
-
27
- private init() {
28
- this.setupAccessibility();
29
- this.setupEventListeners();
30
- }
31
-
32
- private setupAccessibility() {
33
- const title = this.drawer?.querySelector<HTMLElement>(
34
- "h1, h2, h3, h4, h5, h6",
35
- );
36
-
37
- if (title) {
38
- const id =
39
- title.id || `drawer-id-${Math.random().toString(36).substring(2, 9)}`;
40
- title.id = id;
41
- this.drawer?.setAttribute("aria-describedby", id);
42
- }
43
-
44
- this.setState("closed");
45
- }
46
-
47
- private setupEventListeners() {
48
- this.trigger!.addEventListener("click", () => this.openDrawer());
49
-
50
- if (this.drawer?.dataset.allowOutsideClick === "true") {
51
- this.backdrop?.addEventListener("click", () => this.closeDrawer());
52
- document.addEventListener("click", (e) => {
53
- const target = e.target as HTMLElement;
54
- if (
55
- this.drawer &&
56
- !this.drawer.contains(target) &&
57
- target !== this.trigger
58
- ) {
59
- this.closeDrawer();
60
- }
61
- });
62
- }
63
-
64
- this.closeButtons?.forEach((trigger) => {
65
- trigger.addEventListener("click", () => this.closeDrawer());
66
- });
67
-
68
- document.addEventListener("keydown", (e) => this.handleKeyDown(e));
69
- }
70
-
71
- private openDrawer() {
72
- this.backdrop?.classList.remove("hidden");
73
- this.drawer?.classList.replace("hidden", "flex");
74
-
75
- document.body.classList.add("overflow-hidden");
76
- setTimeout(() => {
77
- this.setState("open");
78
- }, 0);
79
- }
80
-
81
- private closeDrawer() {
82
- this.setState("closed");
83
- setTimeout(() => {
84
- this.backdrop?.classList.add("hidden");
85
- this.drawer?.classList.replace("flex", "hidden");
86
- document.body.classList.remove("overflow-hidden");
87
- }, 200);
88
- }
89
-
90
- private setState(state: "open" | "closed") {
91
- this.trigger?.focus();
92
- this.drawer?.setAttribute("aria-hidden", `${state === "closed"}`);
93
- this.drawer?.setAttribute("data-state", state);
94
- this.backdrop?.setAttribute("aria-hidden", `${state === "closed"}`);
95
- this.backdrop?.setAttribute("data-state", state);
96
- }
97
-
98
- private handleKeyDown = (event: KeyboardEvent) => {
99
- if (event.key === "Escape" && this.drawer!.dataset.status === "open") {
100
- this.closeDrawer();
101
- event.preventDefault();
102
- }
103
- };
104
- }
1
+ export class Drawer {
2
+ private wrapper: HTMLElement;
3
+ private drawer: HTMLElement | null;
4
+ private trigger: HTMLElement | null;
5
+ private backdrop: HTMLElement | null;
6
+ private closeButtons: NodeListOf<HTMLElement> | null;
7
+
8
+ constructor(drawerWrraper: HTMLElement) {
9
+ this.wrapper = drawerWrraper;
10
+ this.drawer = this.wrapper.querySelector("[data-drawer-content]");
11
+ this.backdrop = this.wrapper.querySelector("[data-drawer-backdrop]");
12
+ this.trigger = this.wrapper.querySelector("[data-trigger]");
13
+ this.closeButtons =
14
+ this.wrapper.querySelectorAll<HTMLElement>("[data-close]");
15
+
16
+ if (!this.drawer || !this.trigger) {
17
+ console.error("Drawer not initialized properly", {
18
+ drawer: this.drawer,
19
+ trigger: this.trigger,
20
+ });
21
+ return;
22
+ }
23
+
24
+ this.init();
25
+ }
26
+
27
+ private init() {
28
+ this.setupAccessibility();
29
+ this.setupEventListeners();
30
+ }
31
+
32
+ private setupAccessibility() {
33
+ const title = this.drawer?.querySelector<HTMLElement>(
34
+ "h1, h2, h3, h4, h5, h6",
35
+ );
36
+
37
+ if (title) {
38
+ const id =
39
+ title.id || `drawer-id-${Math.random().toString(36).substring(2, 9)}`;
40
+ title.id = id;
41
+ this.drawer?.setAttribute("aria-describedby", id);
42
+ }
43
+
44
+ this.setState("closed");
45
+ }
46
+
47
+ private setupEventListeners() {
48
+ this.trigger!.addEventListener("click", () => this.openDrawer());
49
+
50
+ if (this.drawer?.dataset.allowOutsideClick === "true") {
51
+ this.backdrop?.addEventListener("click", () => this.closeDrawer());
52
+ document.addEventListener("click", (e) => {
53
+ const target = e.target as HTMLElement;
54
+ if (
55
+ this.drawer &&
56
+ !this.drawer.contains(target) &&
57
+ target !== this.trigger
58
+ ) {
59
+ this.closeDrawer();
60
+ }
61
+ });
62
+ }
63
+
64
+ this.closeButtons?.forEach((trigger) => {
65
+ trigger.addEventListener("click", () => this.closeDrawer());
66
+ });
67
+
68
+ document.addEventListener("keydown", (e) => this.handleKeyDown(e));
69
+ }
70
+
71
+ private openDrawer() {
72
+ this.backdrop?.classList.remove("hidden");
73
+ this.drawer?.classList.replace("hidden", "flex");
74
+
75
+ document.body.classList.add("overflow-hidden");
76
+ setTimeout(() => {
77
+ this.setState("open");
78
+ }, 0);
79
+ }
80
+
81
+ private closeDrawer() {
82
+ this.setState("closed");
83
+ setTimeout(() => {
84
+ this.backdrop?.classList.add("hidden");
85
+ this.drawer?.classList.replace("flex", "hidden");
86
+ document.body.classList.remove("overflow-hidden");
87
+ }, 200);
88
+ }
89
+
90
+ private setState(state: "open" | "closed") {
91
+ this.trigger?.focus();
92
+ this.drawer?.setAttribute("aria-hidden", `${state === "closed"}`);
93
+ this.drawer?.setAttribute("data-state", state);
94
+ this.backdrop?.setAttribute("aria-hidden", `${state === "closed"}`);
95
+ this.backdrop?.setAttribute("data-state", state);
96
+ }
97
+
98
+ private handleKeyDown = (event: KeyboardEvent) => {
99
+ if (event.key === "Escape" && this.drawer!.dataset.status === "open") {
100
+ this.closeDrawer();
101
+ event.preventDefault();
102
+ }
103
+ };
104
+ }
@@ -1,17 +1,17 @@
1
- import Drawer from "./Drawer.astro";
2
- import DrawerContent from "./DrawerContent.astro";
3
- import DrawerDescription from "./DrawerDescription.astro";
4
- import DrawerFooter from "./DrawerFooter.astro";
5
- import DrawerHeader from "./DrawerHeader.astro";
6
- import DrawerTitle from "./DrawerTitle.astro";
7
- import { drawerVariants } from "./drawerVariants";
8
-
9
- export {
10
- Drawer,
11
- DrawerContent,
12
- DrawerDescription,
13
- DrawerFooter,
14
- DrawerHeader,
15
- DrawerTitle,
16
- drawerVariants,
17
- };
1
+ import Drawer from "./Drawer.astro";
2
+ import DrawerContent from "./DrawerContent.astro";
3
+ import DrawerDescription from "./DrawerDescription.astro";
4
+ import DrawerFooter from "./DrawerFooter.astro";
5
+ import DrawerHeader from "./DrawerHeader.astro";
6
+ import DrawerTitle from "./DrawerTitle.astro";
7
+ import { drawerVariants } from "./drawerVariants";
8
+
9
+ export {
10
+ Drawer,
11
+ DrawerContent,
12
+ DrawerDescription,
13
+ DrawerFooter,
14
+ DrawerHeader,
15
+ DrawerTitle,
16
+ drawerVariants,
17
+ };
@@ -1,19 +1,19 @@
1
- <div class="relative" data-dropdown-menu>
2
- <slot />
3
- </div>
4
-
5
- <script>
6
- import { DowndownMenu } from "./dropdown";
7
-
8
- function init() {
9
- const dropdowns = document.querySelectorAll<HTMLElement>(
10
- "[data-dropdown-menu]",
11
- );
12
- dropdowns.forEach((dropdown) => {
13
- new DowndownMenu(dropdown);
14
- });
15
- }
16
-
17
- init();
18
- document.addEventListener("astro:page-load", () => init());
19
- </script>
1
+ <div class="relative" data-dropdown-menu>
2
+ <slot />
3
+ </div>
4
+
5
+ <script>
6
+ import { DowndownMenu } from "./dropdown";
7
+
8
+ function init() {
9
+ const dropdowns = document.querySelectorAll<HTMLElement>(
10
+ "[data-dropdown-menu]",
11
+ );
12
+ dropdowns.forEach((dropdown) => {
13
+ new DowndownMenu(dropdown);
14
+ });
15
+ }
16
+
17
+ init();
18
+ document.addEventListener("astro:page-load", () => init());
19
+ </script>
@@ -1,42 +1,42 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import type { HTMLAttributes } from "astro/types";
4
- import type { VariantProps } from "class-variance-authority";
5
- import {
6
- dropdownArrowVariants,
7
- dropdownMenuVariants,
8
- } from "./dropdownVariants";
9
-
10
- interface Props
11
- extends HTMLAttributes<"div">,
12
- VariantProps<typeof dropdownMenuVariants> {
13
- sideOffset?: number;
14
- arrow?: boolean;
15
- }
16
-
17
- const {
18
- class: className,
19
- side,
20
- alignment,
21
- sideOffset = 2,
22
- arrow = false,
23
- ...attrs
24
- } = Astro.props;
25
- ---
26
-
27
- <div
28
- {...attrs}
29
- role="menu"
30
- data-dropdown-content
31
- aria-hidden="true"
32
- data-state="closed"
33
- data-side={sideOffset}
34
- data-alignment={alignment}
35
- class={cn(dropdownMenuVariants({ side, alignment, className }))}
36
- style={{
37
- "--tooltip-offset": `calc(var(--spacing) * ${sideOffset})`,
38
- }}
39
- >
40
- <slot />
41
- {arrow && <span class={cn(dropdownArrowVariants({ side, alignment }))} />}
42
- </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 {
6
+ dropdownArrowVariants,
7
+ dropdownMenuVariants,
8
+ } from "./dropdownVariants";
9
+
10
+ interface Props
11
+ extends HTMLAttributes<"div">,
12
+ VariantProps<typeof dropdownMenuVariants> {
13
+ sideOffset?: number;
14
+ arrow?: boolean;
15
+ }
16
+
17
+ const {
18
+ class: className,
19
+ side,
20
+ alignment,
21
+ sideOffset = 2,
22
+ arrow = false,
23
+ ...attrs
24
+ } = Astro.props;
25
+ ---
26
+
27
+ <div
28
+ {...attrs}
29
+ role="menu"
30
+ data-dropdown-content
31
+ aria-hidden="true"
32
+ data-state="closed"
33
+ data-side={sideOffset}
34
+ data-alignment={alignment}
35
+ class={cn(dropdownMenuVariants({ side, alignment, className }))}
36
+ style={{
37
+ "--tooltip-offset": `calc(var(--spacing) * ${sideOffset})`,
38
+ }}
39
+ >
40
+ <slot />
41
+ {arrow && <span class={cn(dropdownArrowVariants({ side, alignment }))} />}
42
+ </div>
@@ -1,3 +1,3 @@
1
- <div role="group">
2
- <slot />
3
- </div>
1
+ <div role="group">
2
+ <slot />
3
+ </div>
@@ -1,27 +1,27 @@
1
- ---
2
- import { cn } from "@/utils/cn";
3
- import type { VariantProps } from "class-variance-authority";
4
- import { dropdownMenuItemVariants } from "./dropdownVariants";
5
-
6
- import type { HTMLTag, Polymorphic } from "astro/types";
7
-
8
- type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> &
9
- VariantProps<typeof dropdownMenuItemVariants>;
10
-
11
- const {
12
- class: className,
13
- as: Tag = "div",
14
- disabled = false,
15
- ...attrs
16
- } = Astro.props;
17
- ---
18
-
19
- <Tag
20
- role="menuitem"
21
- tabindex={disabled ? "-1" : "0"}
22
- data-disabled={disabled}
23
- class={cn(dropdownMenuItemVariants({ disabled, className }))}
24
- {...attrs}
25
- >
26
- <slot />
27
- </Tag>
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import type { VariantProps } from "class-variance-authority";
4
+ import { dropdownMenuItemVariants } from "./dropdownVariants";
5
+
6
+ import type { HTMLTag, Polymorphic } from "astro/types";
7
+
8
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> &
9
+ VariantProps<typeof dropdownMenuItemVariants>;
10
+
11
+ const {
12
+ class: className,
13
+ as: Tag = "div",
14
+ disabled = false,
15
+ ...attrs
16
+ } = Astro.props;
17
+ ---
18
+
19
+ <Tag
20
+ role="menuitem"
21
+ tabindex={disabled ? "-1" : "0"}
22
+ data-disabled={disabled}
23
+ class={cn(dropdownMenuItemVariants({ disabled, className }))}
24
+ {...attrs}
25
+ >
26
+ <slot />
27
+ </Tag>
@@ -1,3 +1,3 @@
1
- <div class="px-2 py-1.5 text-sm font-medium">
2
- <slot />
3
- </div>
1
+ <div class="px-2 py-1.5 text-sm font-medium">
2
+ <slot />
3
+ </div>
@@ -1,6 +1,6 @@
1
- <div
2
- role="separator"
3
- aria-orientation="horizontal"
4
- class="bg-border -mx-1 my-1 h-px"
5
- >
6
- </div>
1
+ <div
2
+ role="separator"
3
+ aria-orientation="horizontal"
4
+ class="bg-border -mx-1 my-1 h-px"
5
+ >
6
+ </div>