@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.
- package/dist/astro/accordion/Accordion.astro +34 -34
- package/dist/astro/accordion/AccordionItem.astro +19 -16
- package/dist/astro/accordion/AccordionTrigger.astro +33 -33
- package/dist/astro/accordion/AcordionContent.astro +23 -26
- package/dist/astro/accordion/accordion.ts +151 -125
- package/dist/astro/accordion/index.ts +6 -6
- package/dist/astro/collapsible/Collapsible.astro +34 -34
- package/dist/astro/collapsible/CollapsibleContent.astro +20 -20
- package/dist/astro/collapsible/collapsible.ts +81 -81
- package/dist/astro/collapsible/index.ts +4 -4
- package/dist/astro/drawer/DrawerContent.astro +74 -74
- package/dist/astro/drawer/drawer.ts +104 -104
- package/dist/astro/drawer/index.ts +2 -0
- package/dist/astro/dropdown/DropdownMenu.astro +19 -19
- package/dist/astro/dropdown/DropdownMenuContent.astro +42 -42
- package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -3
- package/dist/astro/dropdown/DropdownMenuItem.astro +27 -27
- package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -3
- package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -6
- package/dist/astro/dropdown/dropdown.ts +157 -157
- package/dist/astro/dropdown/dropdownVariants.ts +134 -134
- package/dist/astro/dropdown/index.ts +23 -15
- package/dist/astro/marquee/Marquee.astro +53 -0
- package/dist/astro/marquee/index.ts +3 -0
- package/dist/astro/modal/Modal.astro +19 -19
- package/dist/astro/modal/ModalContent.astro +2 -2
- package/dist/astro/modal/ModalDescription.astro +12 -12
- package/dist/astro/modal/ModalFooter.astro +15 -15
- package/dist/astro/modal/ModalHeader.astro +12 -12
- package/dist/astro/modal/ModalTitle.astro +18 -18
- package/dist/astro/modal/index.ts +15 -15
- package/dist/astro/modal/modal.ts +101 -101
- package/dist/astro/pagination/index.ts +2 -0
- package/dist/astro/popover/Popover.astro +17 -17
- package/dist/astro/popover/PopoverContent.astro +39 -39
- package/dist/astro/popover/index.ts +5 -4
- package/dist/astro/popover/popover.ts +113 -113
- package/dist/astro/popover/popoverVariants.ts +115 -115
- package/dist/astro/scroll-progress/ScrollProgress.astro +41 -0
- package/dist/astro/scroll-progress/ScrollProgressBar.astro +19 -0
- package/dist/astro/scroll-progress/index.ts +4 -0
- package/dist/astro/stat/Stat.astro +12 -12
- package/dist/astro/stat/StatDescription.astro +12 -12
- package/dist/astro/stat/StatTitle.astro +18 -18
- package/dist/astro/stat/StatValue.astro +12 -12
- package/dist/astro/stat/index.ts +6 -6
- package/dist/astro/tab/TabList.astro +19 -19
- package/dist/astro/toast/Toast.astro +36 -0
- package/dist/astro/toast/ToastDescription.astro +10 -0
- package/dist/astro/toast/ToastTitle.astro +18 -0
- package/dist/astro/toast/Toaster.astro +78 -0
- package/dist/astro/toast/assets.ts +6 -0
- package/dist/astro/toast/index.ts +30 -0
- package/dist/astro/toast/toast.ts +277 -0
- package/dist/astro/tooltip/Tooltip.astro +40 -40
- package/dist/astro/tooltip/TooltipContent.astro +39 -39
- package/dist/astro/tooltip/index.ts +5 -6
- package/dist/astro/tooltip/tooltip.ts +137 -137
- package/dist/astro/tooltip/tooltipVariants.ts +115 -115
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
-
multiple?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const { class: className, multiple = false, ...attrs } = Astro.props;
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
<div
|
|
13
|
-
{...attrs}
|
|
14
|
-
data-accordion
|
|
15
|
-
data-multiple={multiple}
|
|
16
|
-
class={cn("w-full", className)}
|
|
17
|
-
>
|
|
18
|
-
<slot />
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
import { Accordion } from "./accordion";
|
|
23
|
-
|
|
24
|
-
function init() {
|
|
25
|
-
const accordions =
|
|
26
|
-
document.querySelectorAll<HTMLElement>("[data-accordion]");
|
|
27
|
-
accordions.forEach((accordion) => {
|
|
28
|
-
new Accordion(accordion);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
init();
|
|
33
|
-
document.addEventListener("astro:page-load", () => init());
|
|
34
|
-
</script>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, multiple = false, ...attrs } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...attrs}
|
|
14
|
+
data-accordion
|
|
15
|
+
data-multiple={multiple}
|
|
16
|
+
class={cn("w-full", className)}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { Accordion } from "./accordion";
|
|
23
|
+
|
|
24
|
+
function init() {
|
|
25
|
+
const accordions =
|
|
26
|
+
document.querySelectorAll<HTMLElement>("[data-accordion]");
|
|
27
|
+
accordions.forEach((accordion) => {
|
|
28
|
+
new Accordion(accordion);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
init();
|
|
33
|
+
document.addEventListener("astro:page-load", () => init());
|
|
34
|
+
</script>
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, isOpen = false, ...attrs } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...attrs}
|
|
14
|
+
data-accordion-item
|
|
15
|
+
data-default-open={isOpen}
|
|
16
|
+
class={cn("border-b border-border last:border-b-0", className)}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"button"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<h3>
|
|
11
|
-
<button
|
|
12
|
-
{...attrs}
|
|
13
|
-
aria-expanded="false"
|
|
14
|
-
data-accordion-trigger
|
|
15
|
-
class={cn(
|
|
16
|
-
"flex items-center justify-between py-4 border-b border-border last:border-b-0 w-full text-start text-base font-medium cursor-pointer [&[data-state=open]>svg]:rotate-180",
|
|
17
|
-
className,
|
|
18
|
-
)}
|
|
19
|
-
>
|
|
20
|
-
<slot />
|
|
21
|
-
<svg
|
|
22
|
-
viewBox="0 0 24 24"
|
|
23
|
-
fill="none"
|
|
24
|
-
stroke="currentColor"
|
|
25
|
-
stroke-width="2"
|
|
26
|
-
stroke-linecap="round"
|
|
27
|
-
stroke-linejoin="round"
|
|
28
|
-
class="size-4 transform transition-transform duration-200"
|
|
29
|
-
><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path
|
|
30
|
-
d="M6 9l6 6l6 -6"></path></svg
|
|
31
|
-
>
|
|
32
|
-
</button>
|
|
33
|
-
</h3>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"button"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<h3>
|
|
11
|
+
<button
|
|
12
|
+
{...attrs}
|
|
13
|
+
aria-expanded="false"
|
|
14
|
+
data-accordion-trigger
|
|
15
|
+
class={cn(
|
|
16
|
+
"flex items-center justify-between py-4 border-b border-border last:border-b-0 w-full text-start text-base font-medium cursor-pointer [&[data-state=open]>svg]:rotate-180",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
<svg
|
|
22
|
+
viewBox="0 0 24 24"
|
|
23
|
+
fill="none"
|
|
24
|
+
stroke="currentColor"
|
|
25
|
+
stroke-width="2"
|
|
26
|
+
stroke-linecap="round"
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
class="size-4 transform transition-transform duration-200"
|
|
29
|
+
><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path
|
|
30
|
+
d="M6 9l6 6l6 -6"></path></svg
|
|
31
|
+
>
|
|
32
|
+
</button>
|
|
33
|
+
</h3>
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
26
|
-
</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
|
+
role="region"
|
|
13
|
+
data-accordion-content
|
|
14
|
+
data-state="closed"
|
|
15
|
+
class={cn(
|
|
16
|
+
"overflow-hidden transition-all duration-300 ease-in-out data-[state=closed]:max-h-0",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<div class="pb-4">
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
@@ -1,125 +1,151 @@
|
|
|
1
|
-
interface AccordionItem extends HTMLElement {
|
|
2
|
-
trigger?: HTMLElement;
|
|
3
|
-
content?: HTMLElement;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class Accordion {
|
|
7
|
-
private wrapper: HTMLElement;
|
|
8
|
-
private items: NodeListOf<HTMLElement> | null;
|
|
9
|
-
|
|
10
|
-
constructor(accordionWrapper: HTMLElement) {
|
|
11
|
-
this.wrapper = accordionWrapper;
|
|
12
|
-
this.items = this.wrapper.querySelectorAll("[data-accordion-item]");
|
|
13
|
-
|
|
14
|
-
this.init();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
private init() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
1
|
+
interface AccordionItem extends HTMLElement {
|
|
2
|
+
trigger?: HTMLElement;
|
|
3
|
+
content?: HTMLElement;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export class Accordion {
|
|
7
|
+
private wrapper: HTMLElement;
|
|
8
|
+
private items: NodeListOf<HTMLElement> | null;
|
|
9
|
+
|
|
10
|
+
constructor(accordionWrapper: HTMLElement) {
|
|
11
|
+
this.wrapper = accordionWrapper;
|
|
12
|
+
this.items = this.wrapper.querySelectorAll("[data-accordion-item]");
|
|
13
|
+
|
|
14
|
+
this.init();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private init() {
|
|
18
|
+
const defaultOpenItems = [];
|
|
19
|
+
|
|
20
|
+
this.items?.forEach((item: AccordionItem) => {
|
|
21
|
+
const trigger = item.querySelector<HTMLElement>(
|
|
22
|
+
"[data-accordion-trigger]",
|
|
23
|
+
);
|
|
24
|
+
const content = item.querySelector<HTMLElement>(
|
|
25
|
+
"[data-accordion-content]",
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (trigger && content) {
|
|
29
|
+
item.trigger = trigger;
|
|
30
|
+
item.content = content;
|
|
31
|
+
|
|
32
|
+
this.setupAccessibility(item);
|
|
33
|
+
this.setupEventListeners(item);
|
|
34
|
+
|
|
35
|
+
if (item.dataset.defaultOpen === "true") {
|
|
36
|
+
if (
|
|
37
|
+
defaultOpenItems.length > 0 &&
|
|
38
|
+
this.wrapper.dataset.multiple !== "true"
|
|
39
|
+
) {
|
|
40
|
+
console.warn(
|
|
41
|
+
"Warning! This accordion is not configured to open multiple items by default. " +
|
|
42
|
+
"Only the first item will be opened." +
|
|
43
|
+
"Consider adding the multiple prop to the accordion if you want to allow multiple items to be open by default.",
|
|
44
|
+
);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.setContentHeight(content);
|
|
49
|
+
this.setState(item, "open");
|
|
50
|
+
defaultOpenItems.push(item);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private setupAccessibility(item: AccordionItem) {
|
|
57
|
+
if (item.trigger && item.content) {
|
|
58
|
+
const triggerId =
|
|
59
|
+
item.trigger.id ||
|
|
60
|
+
`accordion-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
61
|
+
const contentId =
|
|
62
|
+
item.content.id ||
|
|
63
|
+
`accordion-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
64
|
+
|
|
65
|
+
item.trigger.id = triggerId;
|
|
66
|
+
item.trigger.setAttribute("aria-controls", contentId);
|
|
67
|
+
|
|
68
|
+
item.content.id = contentId;
|
|
69
|
+
item.content.setAttribute("aria-labelledby", triggerId);
|
|
70
|
+
item.content.setAttribute("role", "region");
|
|
71
|
+
|
|
72
|
+
this.setState(item, "closed");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private setupEventListeners(item: AccordionItem) {
|
|
77
|
+
if (!item.trigger && !item.content) return;
|
|
78
|
+
|
|
79
|
+
item.trigger?.addEventListener("click", () =>
|
|
80
|
+
this.toggleAccordionItem(item),
|
|
81
|
+
);
|
|
82
|
+
item.trigger?.addEventListener("keydown", (e) =>
|
|
83
|
+
this.handleKeydown(e, item),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private toggleAccordionItem(item: AccordionItem) {
|
|
88
|
+
if (item.trigger?.getAttribute("aria-expanded") === "true") {
|
|
89
|
+
this.closeAccordionItem(item);
|
|
90
|
+
} else {
|
|
91
|
+
if (this.wrapper.dataset.multiple !== "true") {
|
|
92
|
+
this.closeAllContents();
|
|
93
|
+
}
|
|
94
|
+
this.openAccordionItem(item);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private openAccordionItem(item: AccordionItem) {
|
|
99
|
+
this.setState(item, "open");
|
|
100
|
+
if (item.content) {
|
|
101
|
+
this.setContentHeight(item.content);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private closeAccordionItem(item: AccordionItem) {
|
|
106
|
+
this.setState(item, "closed");
|
|
107
|
+
item.content!.style.maxHeight = "0px";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private closeAllContents() {
|
|
111
|
+
this.items?.forEach((item) => {
|
|
112
|
+
this.closeAccordionItem(item);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private handleKeydown(event: KeyboardEvent, item: AccordionItem) {
|
|
117
|
+
const items = Array.from(this.items || []);
|
|
118
|
+
const currentItemIndex = items.indexOf(item);
|
|
119
|
+
|
|
120
|
+
const keyActions: Record<string, () => void> = {
|
|
121
|
+
ArrowDown: () => this.setFocusItem(items, currentItemIndex + 1),
|
|
122
|
+
ArrowUp: () => this.setFocusItem(items, currentItemIndex - 1),
|
|
123
|
+
Home: () => this.setFocusItem(items, 0),
|
|
124
|
+
End: () => this.setFocusItem(items, items.length - 1),
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const action = keyActions[event.key];
|
|
128
|
+
if (action) {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
action();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private setFocusItem(items: AccordionItem[], index: number) {
|
|
135
|
+
const newIndex = (index + items.length) % items.length;
|
|
136
|
+
if (items[newIndex].trigger) {
|
|
137
|
+
items[newIndex].trigger.focus();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private setContentHeight(content: HTMLElement) {
|
|
142
|
+
const height = content.scrollHeight + "px";
|
|
143
|
+
content.style.maxHeight = height;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private setState(item: AccordionItem, state: "closed" | "open") {
|
|
147
|
+
item.trigger?.setAttribute("data-state", state);
|
|
148
|
+
item.trigger?.setAttribute("aria-expanded", `${state === "open"}`);
|
|
149
|
+
item.content?.setAttribute("data-state", state);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Accordion from "./Accordion.astro";
|
|
2
|
-
import AccordionItem from "./AccordionItem.astro";
|
|
3
|
-
import AccordionTrigger from "./AccordionTrigger.astro";
|
|
4
|
-
import AccordionContent from "./AcordionContent.astro";
|
|
5
|
-
|
|
6
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
1
|
+
import Accordion from "./Accordion.astro";
|
|
2
|
+
import AccordionItem from "./AccordionItem.astro";
|
|
3
|
+
import AccordionTrigger from "./AccordionTrigger.astro";
|
|
4
|
+
import AccordionContent from "./AcordionContent.astro";
|
|
5
|
+
|
|
6
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
-
isOpen?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const { class: className, isOpen = false, ...attrs } = Astro.props;
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
<div
|
|
13
|
-
{...attrs}
|
|
14
|
-
data-collapsible
|
|
15
|
-
data-open={isOpen}
|
|
16
|
-
class={cn("w-full", className)}
|
|
17
|
-
>
|
|
18
|
-
<slot />
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
import { Collapsible } from "./collapsible";
|
|
23
|
-
|
|
24
|
-
function init() {
|
|
25
|
-
const collapsibles =
|
|
26
|
-
document.querySelectorAll<HTMLElement>("[data-collapsible]");
|
|
27
|
-
collapsibles.forEach((collapsible) => {
|
|
28
|
-
new Collapsible(collapsible);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
init();
|
|
33
|
-
document.addEventListener("astro:page-load", () => init());
|
|
34
|
-
</script>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, isOpen = false, ...attrs } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...attrs}
|
|
14
|
+
data-collapsible
|
|
15
|
+
data-open={isOpen}
|
|
16
|
+
class={cn("w-full", className)}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { Collapsible } from "./collapsible";
|
|
23
|
+
|
|
24
|
+
function init() {
|
|
25
|
+
const collapsibles =
|
|
26
|
+
document.querySelectorAll<HTMLElement>("[data-collapsible]");
|
|
27
|
+
collapsibles.forEach((collapsible) => {
|
|
28
|
+
new Collapsible(collapsible);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
init();
|
|
33
|
+
document.addEventListener("astro:page-load", () => init());
|
|
34
|
+
</script>
|
|
@@ -1,20 +1,20 @@
|
|
|
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
|
-
data-collapsible-content
|
|
12
|
-
class={cn(
|
|
13
|
-
"overflow-hidden transition-all duration-300 ease-in-out",
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
hidden
|
|
17
|
-
{...attrs}
|
|
18
|
-
>
|
|
19
|
-
<slot />
|
|
20
|
-
</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
|
+
data-collapsible-content
|
|
12
|
+
class={cn(
|
|
13
|
+
"overflow-hidden transition-all duration-300 ease-in-out",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
hidden
|
|
17
|
+
{...attrs}
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|