@functionalcms/svelte-components 5.18.1 → 5.20.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.
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { SolidIcons } from '../icons';
3
+ import { default as Icon } from '../Icon.svelte';
4
+ import type { Snippet } from 'svelte';
5
+
6
+ interface Props {
7
+ items: Array<any>;
8
+ icon: string;
9
+ label: string;
10
+ children: Snippet;
11
+ }
12
+
13
+ let { items = [], icon = SolidIcons.Folder, label = '', children }: Partial<Props> = $props();
14
+ </script>
15
+
16
+ {#if items.length === 0}
17
+ <div class="flex min-h-64 flex-col items-center justify-center gap-2 text-gray-400">
18
+ <Icon {icon} class="h-12 w-12" />
19
+ <p>{label}</p>
20
+ </div>
21
+ {:else}
22
+ {@render children?.()}
23
+ {/if}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type EmptyStateProps = typeof __propDef.props;
10
+ export type EmptyStateEvents = typeof __propDef.events;
11
+ export type EmptyStateSlots = typeof __propDef.slots;
12
+ export default class EmptyState extends SvelteComponentTyped<EmptyStateProps, EmptyStateEvents, EmptyStateSlots> {
13
+ }
14
+ export {};
@@ -71,9 +71,13 @@
71
71
  {#each menuItems as item}
72
72
  {#if !isCollapsed}
73
73
  {#if 'items' in item}
74
- <SidebarDropdownWrapper label={item.label}>
74
+ <SidebarDropdownWrapper label={item.label} isOpen={item.isOpen}>
75
75
  {#each item.items as subItem}
76
- <SidebarDropdownItem label={subItem.label} href={subItem.href} />
76
+ <SidebarItem label={subItem.label} href={subItem.href}>
77
+ {#snippet icon()}
78
+ <Icon icon={subItem.icon} />
79
+ {/snippet}
80
+ </SidebarItem>
77
81
  {/each}
78
82
  </SidebarDropdownWrapper>
79
83
  {:else}
@@ -89,6 +93,15 @@
89
93
  <Icon icon={item.icon} />
90
94
  {/snippet}
91
95
  </SidebarItem>
96
+ {#if item.items && item.isOpen}
97
+ {#each item.items as subItem}
98
+ <SidebarItem label="" href={subItem.href}>
99
+ {#snippet icon()}
100
+ <Icon icon={subItem.icon} />
101
+ {/snippet}
102
+ </SidebarItem>
103
+ {/each}
104
+ {/if}
92
105
  {/if}
93
106
  {/each}
94
107
  </SidebarGroup>
@@ -16,6 +16,7 @@ export type MenuSection = {
16
16
  href?: string;
17
17
  icon?: string;
18
18
  visibility?: Visibility;
19
+ isOpen?: boolean;
19
20
  };
20
21
  export type MenuDivider = {};
21
22
  export type MenuOption = MenuItem | MenuSection;
package/dist/index.d.ts CHANGED
@@ -24,3 +24,4 @@ export { type BlogPost } from './components/blog/Post.js';
24
24
  export { type getTags } from './components/blog/blogService.js';
25
25
  export { getPosts } from './components/blog/blogService.js';
26
26
  export { Tree } from '@keenmate/svelte-treeview';
27
+ export { default as EmptyState } from './components/content/EmptyState.svelte';
package/dist/index.js CHANGED
@@ -23,3 +23,4 @@ export {} from './components/blog/Post.js';
23
23
  export {} from './components/blog/blogService.js';
24
24
  export { getPosts } from './components/blog/blogService.js';
25
25
  export { Tree } from '@keenmate/svelte-treeview';
26
+ export { default as EmptyState } from './components/content/EmptyState.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "5.18.1",
3
+ "version": "5.20.0",
4
4
  "license": "MIT",
5
5
  "watch": {
6
6
  "build": {