@functionalcms/svelte-components 4.35.2 → 4.35.4
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.
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
{/if}
|
|
121
121
|
<section>
|
|
122
122
|
{#each menuItems as section}
|
|
123
|
-
<Accordion title={section.title}>
|
|
123
|
+
<Accordion title={section.title} css="section">
|
|
124
124
|
<div class="menu-section">
|
|
125
125
|
{#each section.items as item}
|
|
126
126
|
<a href={item.href} class="{buttonCss} button">
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
isOpenByDefault: boolean;
|
|
8
8
|
animationDurationMs: number;
|
|
9
9
|
title: string;
|
|
10
|
+
cheveronPosition: "left" | "right";
|
|
11
|
+
css: string
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
let {
|
|
@@ -14,6 +16,8 @@
|
|
|
14
16
|
title = "",
|
|
15
17
|
isOpenByDefault = true,
|
|
16
18
|
animationDurationMs = 300,
|
|
19
|
+
cheveronPosition = "right",
|
|
20
|
+
css = "",
|
|
17
21
|
}: Partial<AccordionProps> = $props();
|
|
18
22
|
|
|
19
23
|
let isOpen = $state(isOpenByDefault);
|
|
@@ -24,13 +28,22 @@
|
|
|
24
28
|
};
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
{#snippet cheveron()}
|
|
32
|
+
{#if isOpen}
|
|
33
|
+
<Icon icon="mdi:chevron-up" width="1rem" />
|
|
34
|
+
{:else}
|
|
35
|
+
<Icon icon="mdi:chevron-down" width="1rem" />
|
|
36
|
+
{/if}
|
|
37
|
+
{/snippet}
|
|
38
|
+
|
|
39
|
+
<article class={css}>
|
|
28
40
|
<header onclick={toggleAccordion} role="button" tabindex="0" onkeydown={(e) => e.key === 'Enter' && toggleAccordion()}>
|
|
41
|
+
{#if cheveronPosition === 'left'}
|
|
42
|
+
{@render cheveron?.()}
|
|
43
|
+
{/if}
|
|
29
44
|
{title}
|
|
30
|
-
{#if
|
|
31
|
-
|
|
32
|
-
{:else}
|
|
33
|
-
<Icon icon="mdi:chevron-down" width="1rem" />
|
|
45
|
+
{#if cheveronPosition === 'right'}
|
|
46
|
+
{@render cheveron?.()}
|
|
34
47
|
{/if}
|
|
35
48
|
</header>
|
|
36
49
|
<div
|
|
@@ -4,6 +4,8 @@ declare const Accordion: import("svelte").Component<Partial<{
|
|
|
4
4
|
isOpenByDefault: boolean;
|
|
5
5
|
animationDurationMs: number;
|
|
6
6
|
title: string;
|
|
7
|
+
cheveronPosition: "left" | "right";
|
|
8
|
+
css: string;
|
|
7
9
|
}>, {}, "">;
|
|
8
10
|
type Accordion = ReturnType<typeof Accordion>;
|
|
9
11
|
export default Accordion;
|