@aphexcms/ui 0.1.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/package.json +49 -0
- package/src/app.css +156 -0
- package/src/lib/components/app-sidebar.svelte +171 -0
- package/src/lib/components/nav-main.svelte +64 -0
- package/src/lib/components/nav-projects.svelte +76 -0
- package/src/lib/components/nav-user.svelte +87 -0
- package/src/lib/components/sidebar-07/+page.svelte +39 -0
- package/src/lib/components/team-switcher.svelte +67 -0
- package/src/lib/components/ui/alert/alert-description.svelte +23 -0
- package/src/lib/components/ui/alert/alert-title.svelte +20 -0
- package/src/lib/components/ui/alert/alert.svelte +44 -0
- package/src/lib/components/ui/alert/index.ts +14 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +18 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +18 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +27 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +17 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +17 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
- package/src/lib/components/ui/alert-dialog/index.ts +39 -0
- package/src/lib/components/ui/avatar/avatar-fallback.svelte +17 -0
- package/src/lib/components/ui/avatar/avatar-image.svelte +17 -0
- package/src/lib/components/ui/avatar/avatar.svelte +19 -0
- package/src/lib/components/ui/avatar/index.ts +13 -0
- package/src/lib/components/ui/badge/badge.svelte +49 -0
- package/src/lib/components/ui/badge/index.ts +2 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte +20 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte +31 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte +27 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb.svelte +21 -0
- package/src/lib/components/ui/breadcrumb/index.ts +25 -0
- package/src/lib/components/ui/button/button.svelte +82 -0
- package/src/lib/components/ui/button/index.ts +17 -0
- package/src/lib/components/ui/card/card-action.svelte +20 -0
- package/src/lib/components/ui/card/card-content.svelte +15 -0
- package/src/lib/components/ui/card/card-description.svelte +20 -0
- package/src/lib/components/ui/card/card-footer.svelte +20 -0
- package/src/lib/components/ui/card/card-header.svelte +23 -0
- package/src/lib/components/ui/card/card-title.svelte +20 -0
- package/src/lib/components/ui/card/card.svelte +23 -0
- package/src/lib/components/ui/card/index.ts +25 -0
- package/src/lib/components/ui/collapsible/collapsible-content.svelte +7 -0
- package/src/lib/components/ui/collapsible/collapsible-trigger.svelte +7 -0
- package/src/lib/components/ui/collapsible/collapsible.svelte +11 -0
- package/src/lib/components/ui/collapsible/index.ts +13 -0
- package/src/lib/components/ui/command/command-dialog.svelte +40 -0
- package/src/lib/components/ui/command/command-empty.svelte +17 -0
- package/src/lib/components/ui/command/command-group.svelte +30 -0
- package/src/lib/components/ui/command/command-input.svelte +26 -0
- package/src/lib/components/ui/command/command-item.svelte +20 -0
- package/src/lib/components/ui/command/command-link-item.svelte +20 -0
- package/src/lib/components/ui/command/command-list.svelte +17 -0
- package/src/lib/components/ui/command/command-separator.svelte +17 -0
- package/src/lib/components/ui/command/command-shortcut.svelte +20 -0
- package/src/lib/components/ui/command/command.svelte +22 -0
- package/src/lib/components/ui/command/index.ts +40 -0
- package/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
- package/src/lib/components/ui/dialog/dialog-content.svelte +43 -0
- package/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
- package/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
- package/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
- package/src/lib/components/ui/dialog/index.ts +37 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +41 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +27 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +31 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +20 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
- package/src/lib/components/ui/dropdown-menu/index.ts +49 -0
- package/src/lib/components/ui/input/index.ts +7 -0
- package/src/lib/components/ui/input/input.svelte +52 -0
- package/src/lib/components/ui/label/index.ts +7 -0
- package/src/lib/components/ui/label/label.svelte +20 -0
- package/src/lib/components/ui/popover/index.ts +17 -0
- package/src/lib/components/ui/popover/popover-content.svelte +29 -0
- package/src/lib/components/ui/popover/popover-trigger.svelte +17 -0
- package/src/lib/components/ui/select/index.ts +37 -0
- package/src/lib/components/ui/select/select-content.svelte +40 -0
- package/src/lib/components/ui/select/select-group-heading.svelte +21 -0
- package/src/lib/components/ui/select/select-group.svelte +7 -0
- package/src/lib/components/ui/select/select-item.svelte +38 -0
- package/src/lib/components/ui/select/select-label.svelte +20 -0
- package/src/lib/components/ui/select/select-scroll-down-button.svelte +20 -0
- package/src/lib/components/ui/select/select-scroll-up-button.svelte +20 -0
- package/src/lib/components/ui/select/select-separator.svelte +18 -0
- package/src/lib/components/ui/select/select-trigger.svelte +29 -0
- package/src/lib/components/ui/separator/index.ts +7 -0
- package/src/lib/components/ui/separator/separator.svelte +21 -0
- package/src/lib/components/ui/sheet/index.ts +36 -0
- package/src/lib/components/ui/sheet/sheet-close.svelte +7 -0
- package/src/lib/components/ui/sheet/sheet-content.svelte +60 -0
- package/src/lib/components/ui/sheet/sheet-description.svelte +17 -0
- package/src/lib/components/ui/sheet/sheet-footer.svelte +20 -0
- package/src/lib/components/ui/sheet/sheet-header.svelte +20 -0
- package/src/lib/components/ui/sheet/sheet-overlay.svelte +20 -0
- package/src/lib/components/ui/sheet/sheet-title.svelte +17 -0
- package/src/lib/components/ui/sheet/sheet-trigger.svelte +7 -0
- package/src/lib/components/ui/sidebar/constants.ts +6 -0
- package/src/lib/components/ui/sidebar/context.svelte.ts +79 -0
- package/src/lib/components/ui/sidebar/index.ts +75 -0
- package/src/lib/components/ui/sidebar/sidebar-content.svelte +24 -0
- package/src/lib/components/ui/sidebar/sidebar-footer.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-group-action.svelte +36 -0
- package/src/lib/components/ui/sidebar/sidebar-group-content.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-group-label.svelte +34 -0
- package/src/lib/components/ui/sidebar/sidebar-group.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-header.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-input.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-inset.svelte +24 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-action.svelte +43 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte +29 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-button.svelte +101 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-item.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte +36 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-sub-button.svelte +43 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte +25 -0
- package/src/lib/components/ui/sidebar/sidebar-menu.svelte +21 -0
- package/src/lib/components/ui/sidebar/sidebar-provider.svelte +53 -0
- package/src/lib/components/ui/sidebar/sidebar-rail.svelte +36 -0
- package/src/lib/components/ui/sidebar/sidebar-separator.svelte +19 -0
- package/src/lib/components/ui/sidebar/sidebar-trigger.svelte +35 -0
- package/src/lib/components/ui/sidebar/sidebar.svelte +101 -0
- package/src/lib/components/ui/skeleton/index.ts +7 -0
- package/src/lib/components/ui/skeleton/skeleton.svelte +17 -0
- package/src/lib/components/ui/tabs/index.ts +16 -0
- package/src/lib/components/ui/tabs/tabs-content.svelte +17 -0
- package/src/lib/components/ui/tabs/tabs-list.svelte +16 -0
- package/src/lib/components/ui/tabs/tabs-trigger.svelte +20 -0
- package/src/lib/components/ui/tabs/tabs.svelte +19 -0
- package/src/lib/components/ui/textarea/index.ts +7 -0
- package/src/lib/components/ui/textarea/textarea.svelte +22 -0
- package/src/lib/components/ui/tooltip/index.ts +21 -0
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +47 -0
- package/src/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/src/lib/hooks/is-mobile.svelte.ts +9 -0
- package/src/lib/utils.ts +13 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useSidebar } from './context.svelte.js';
|
|
2
|
+
import Content from './sidebar-content.svelte';
|
|
3
|
+
import Footer from './sidebar-footer.svelte';
|
|
4
|
+
import GroupAction from './sidebar-group-action.svelte';
|
|
5
|
+
import GroupContent from './sidebar-group-content.svelte';
|
|
6
|
+
import GroupLabel from './sidebar-group-label.svelte';
|
|
7
|
+
import Group from './sidebar-group.svelte';
|
|
8
|
+
import Header from './sidebar-header.svelte';
|
|
9
|
+
import Input from './sidebar-input.svelte';
|
|
10
|
+
import Inset from './sidebar-inset.svelte';
|
|
11
|
+
import MenuAction from './sidebar-menu-action.svelte';
|
|
12
|
+
import MenuBadge from './sidebar-menu-badge.svelte';
|
|
13
|
+
import MenuButton from './sidebar-menu-button.svelte';
|
|
14
|
+
import MenuItem from './sidebar-menu-item.svelte';
|
|
15
|
+
import MenuSkeleton from './sidebar-menu-skeleton.svelte';
|
|
16
|
+
import MenuSubButton from './sidebar-menu-sub-button.svelte';
|
|
17
|
+
import MenuSubItem from './sidebar-menu-sub-item.svelte';
|
|
18
|
+
import MenuSub from './sidebar-menu-sub.svelte';
|
|
19
|
+
import Menu from './sidebar-menu.svelte';
|
|
20
|
+
import Provider from './sidebar-provider.svelte';
|
|
21
|
+
import Rail from './sidebar-rail.svelte';
|
|
22
|
+
import Separator from './sidebar-separator.svelte';
|
|
23
|
+
import Trigger from './sidebar-trigger.svelte';
|
|
24
|
+
import Root from './sidebar.svelte';
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
Content,
|
|
28
|
+
Footer,
|
|
29
|
+
Group,
|
|
30
|
+
GroupAction,
|
|
31
|
+
GroupContent,
|
|
32
|
+
GroupLabel,
|
|
33
|
+
Header,
|
|
34
|
+
Input,
|
|
35
|
+
Inset,
|
|
36
|
+
Menu,
|
|
37
|
+
MenuAction,
|
|
38
|
+
MenuBadge,
|
|
39
|
+
MenuButton,
|
|
40
|
+
MenuItem,
|
|
41
|
+
MenuSkeleton,
|
|
42
|
+
MenuSub,
|
|
43
|
+
MenuSubButton,
|
|
44
|
+
MenuSubItem,
|
|
45
|
+
Provider,
|
|
46
|
+
Rail,
|
|
47
|
+
Root,
|
|
48
|
+
Separator,
|
|
49
|
+
//
|
|
50
|
+
Root as Sidebar,
|
|
51
|
+
Content as SidebarContent,
|
|
52
|
+
Footer as SidebarFooter,
|
|
53
|
+
Group as SidebarGroup,
|
|
54
|
+
GroupAction as SidebarGroupAction,
|
|
55
|
+
GroupContent as SidebarGroupContent,
|
|
56
|
+
GroupLabel as SidebarGroupLabel,
|
|
57
|
+
Header as SidebarHeader,
|
|
58
|
+
Input as SidebarInput,
|
|
59
|
+
Inset as SidebarInset,
|
|
60
|
+
Menu as SidebarMenu,
|
|
61
|
+
MenuAction as SidebarMenuAction,
|
|
62
|
+
MenuBadge as SidebarMenuBadge,
|
|
63
|
+
MenuButton as SidebarMenuButton,
|
|
64
|
+
MenuItem as SidebarMenuItem,
|
|
65
|
+
MenuSkeleton as SidebarMenuSkeleton,
|
|
66
|
+
MenuSub as SidebarMenuSub,
|
|
67
|
+
MenuSubButton as SidebarMenuSubButton,
|
|
68
|
+
MenuSubItem as SidebarMenuSubItem,
|
|
69
|
+
Provider as SidebarProvider,
|
|
70
|
+
Rail as SidebarRail,
|
|
71
|
+
Separator as SidebarSeparator,
|
|
72
|
+
Trigger as SidebarTrigger,
|
|
73
|
+
Trigger,
|
|
74
|
+
useSidebar
|
|
75
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-content"
|
|
16
|
+
data-sidebar="content"
|
|
17
|
+
class={cn(
|
|
18
|
+
'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...restProps}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-footer"
|
|
16
|
+
data-sidebar="footer"
|
|
17
|
+
class={cn('flex flex-col gap-2 p-2', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
child,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLButtonAttributes> & {
|
|
13
|
+
child?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
14
|
+
} = $props();
|
|
15
|
+
|
|
16
|
+
const mergedProps = $derived({
|
|
17
|
+
class: cn(
|
|
18
|
+
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground outline-hidden absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
19
|
+
// Increases the hit area of the button on mobile.
|
|
20
|
+
'after:absolute after:-inset-2 md:after:hidden',
|
|
21
|
+
'group-data-[collapsible=icon]:hidden',
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
'data-slot': 'sidebar-group-action',
|
|
25
|
+
'data-sidebar': 'group-action',
|
|
26
|
+
...restProps
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
{#if child}
|
|
31
|
+
{@render child({ props: mergedProps })}
|
|
32
|
+
{:else}
|
|
33
|
+
<button bind:this={ref} {...mergedProps}>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</button>
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-group-content"
|
|
16
|
+
data-sidebar="group-content"
|
|
17
|
+
class={cn('w-full text-sm', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
children,
|
|
9
|
+
child,
|
|
10
|
+
class: className,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
13
|
+
child?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
14
|
+
} = $props();
|
|
15
|
+
|
|
16
|
+
const mergedProps = $derived({
|
|
17
|
+
class: cn(
|
|
18
|
+
'text-sidebar-foreground/70 ring-sidebar-ring outline-hidden flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
19
|
+
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
'data-slot': 'sidebar-group-label',
|
|
23
|
+
'data-sidebar': 'group-label',
|
|
24
|
+
...restProps
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
{#if child}
|
|
29
|
+
{@render child({ props: mergedProps })}
|
|
30
|
+
{:else}
|
|
31
|
+
<div bind:this={ref} {...mergedProps}>
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</div>
|
|
34
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-group"
|
|
16
|
+
data-sidebar="group"
|
|
17
|
+
class={cn('relative flex w-full min-w-0 flex-col p-2', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-header"
|
|
16
|
+
data-sidebar="header"
|
|
17
|
+
class={cn('flex flex-col gap-2 p-2', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from 'svelte';
|
|
3
|
+
import { Input } from '@lib/components/ui/input/index.js';
|
|
4
|
+
import { cn } from '@lib/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(''),
|
|
9
|
+
class: className,
|
|
10
|
+
...restProps
|
|
11
|
+
}: ComponentProps<typeof Input> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Input
|
|
15
|
+
bind:ref
|
|
16
|
+
bind:value
|
|
17
|
+
data-slot="sidebar-input"
|
|
18
|
+
data-sidebar="input"
|
|
19
|
+
class={cn('bg-background h-8 w-full shadow-none', className)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
/>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<main
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-inset"
|
|
16
|
+
class={cn(
|
|
17
|
+
'bg-background relative flex w-full flex-1 flex-col',
|
|
18
|
+
'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...restProps}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</main>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
showOnHover = false,
|
|
10
|
+
children,
|
|
11
|
+
child,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithElementRef<HTMLButtonAttributes> & {
|
|
14
|
+
child?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
15
|
+
showOnHover?: boolean;
|
|
16
|
+
} = $props();
|
|
17
|
+
|
|
18
|
+
const mergedProps = $derived({
|
|
19
|
+
class: cn(
|
|
20
|
+
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground outline-hidden absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
21
|
+
// Increases the hit area of the button on mobile.
|
|
22
|
+
'after:absolute after:-inset-2 md:after:hidden',
|
|
23
|
+
'peer-data-[size=sm]/menu-button:top-1',
|
|
24
|
+
'peer-data-[size=default]/menu-button:top-1.5',
|
|
25
|
+
'peer-data-[size=lg]/menu-button:top-2.5',
|
|
26
|
+
'group-data-[collapsible=icon]:hidden',
|
|
27
|
+
showOnHover &&
|
|
28
|
+
'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
'data-slot': 'sidebar-menu-action',
|
|
32
|
+
'data-sidebar': 'menu-action',
|
|
33
|
+
...restProps
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
{#if child}
|
|
38
|
+
{@render child({ props: mergedProps })}
|
|
39
|
+
{:else}
|
|
40
|
+
<button bind:this={ref} {...mergedProps}>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</button>
|
|
43
|
+
{/if}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-menu-badge"
|
|
16
|
+
data-sidebar="menu-badge"
|
|
17
|
+
class={cn(
|
|
18
|
+
'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums',
|
|
19
|
+
'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
|
|
20
|
+
'peer-data-[size=sm]/menu-button:top-1',
|
|
21
|
+
'peer-data-[size=default]/menu-button:top-1.5',
|
|
22
|
+
'peer-data-[size=lg]/menu-button:top-2.5',
|
|
23
|
+
'group-data-[collapsible=icon]:hidden',
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...restProps}
|
|
27
|
+
>
|
|
28
|
+
{@render children?.()}
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const sidebarMenuButtonVariants = tv({
|
|
5
|
+
base: 'peer/menu-button outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground group-has-data-[sidebar=menu-action]/menu-item:pr-8 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm transition-[width,height,padding] focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
9
|
+
outline:
|
|
10
|
+
'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:shadow-[0_0_0_1px_var(--sidebar-accent)]'
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
default: 'h-8 text-sm',
|
|
14
|
+
sm: 'h-7 text-xs',
|
|
15
|
+
lg: 'group-data-[collapsible=icon]:p-0! h-12 text-sm'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
size: 'default'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type SidebarMenuButtonVariant = VariantProps<typeof sidebarMenuButtonVariants>['variant'];
|
|
25
|
+
export type SidebarMenuButtonSize = VariantProps<typeof sidebarMenuButtonVariants>['size'];
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
import * as Tooltip from '@lib/components/ui/tooltip/index.js';
|
|
30
|
+
import { cn, type WithElementRef, type WithoutChildrenOrChild } from '@lib/utils.js';
|
|
31
|
+
import { mergeProps } from 'bits-ui';
|
|
32
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
33
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
34
|
+
import { useSidebar } from './context.svelte.js';
|
|
35
|
+
|
|
36
|
+
let {
|
|
37
|
+
ref = $bindable(null),
|
|
38
|
+
class: className,
|
|
39
|
+
children,
|
|
40
|
+
child,
|
|
41
|
+
variant = 'default',
|
|
42
|
+
size = 'default',
|
|
43
|
+
isActive = false,
|
|
44
|
+
tooltipContent,
|
|
45
|
+
tooltipContentProps,
|
|
46
|
+
...restProps
|
|
47
|
+
}: WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> & {
|
|
48
|
+
isActive?: boolean;
|
|
49
|
+
variant?: SidebarMenuButtonVariant;
|
|
50
|
+
size?: SidebarMenuButtonSize;
|
|
51
|
+
tooltipContent?: Snippet | string;
|
|
52
|
+
tooltipContentProps?: WithoutChildrenOrChild<ComponentProps<typeof Tooltip.Content>>;
|
|
53
|
+
child?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
54
|
+
} = $props();
|
|
55
|
+
|
|
56
|
+
const sidebar = useSidebar();
|
|
57
|
+
|
|
58
|
+
const buttonProps = $derived({
|
|
59
|
+
class: cn(sidebarMenuButtonVariants({ variant, size }), className),
|
|
60
|
+
'data-slot': 'sidebar-menu-button',
|
|
61
|
+
'data-sidebar': 'menu-button',
|
|
62
|
+
'data-size': size,
|
|
63
|
+
'data-active': isActive,
|
|
64
|
+
...restProps
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
{#snippet Button({ props }: { props?: Record<string, unknown> })}
|
|
69
|
+
{@const mergedProps = mergeProps(buttonProps, props)}
|
|
70
|
+
{#if child}
|
|
71
|
+
{@render child({ props: mergedProps })}
|
|
72
|
+
{:else}
|
|
73
|
+
<button bind:this={ref} {...mergedProps}>
|
|
74
|
+
{@render children?.()}
|
|
75
|
+
</button>
|
|
76
|
+
{/if}
|
|
77
|
+
{/snippet}
|
|
78
|
+
|
|
79
|
+
{#if !tooltipContent}
|
|
80
|
+
{@render Button({})}
|
|
81
|
+
{:else}
|
|
82
|
+
<Tooltip.Root>
|
|
83
|
+
<Tooltip.Trigger>
|
|
84
|
+
{#snippet child({ props })}
|
|
85
|
+
{@render Button({ props })}
|
|
86
|
+
{/snippet}
|
|
87
|
+
</Tooltip.Trigger>
|
|
88
|
+
<Tooltip.Content
|
|
89
|
+
side="right"
|
|
90
|
+
align="center"
|
|
91
|
+
hidden={sidebar.state !== 'collapsed' || sidebar.isMobile}
|
|
92
|
+
{...tooltipContentProps}
|
|
93
|
+
>
|
|
94
|
+
{#if typeof tooltipContent === 'string'}
|
|
95
|
+
{tooltipContent}
|
|
96
|
+
{:else if tooltipContent}
|
|
97
|
+
{@render tooltipContent()}
|
|
98
|
+
{/if}
|
|
99
|
+
</Tooltip.Content>
|
|
100
|
+
</Tooltip.Root>
|
|
101
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLLIElement>, HTMLLIElement> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<li
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-menu-item"
|
|
16
|
+
data-sidebar="menu-item"
|
|
17
|
+
class={cn('group/menu-item relative', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</li>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import { Skeleton } from '@lib/components/ui/skeleton/index.js';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
showIcon = false,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
13
|
+
showIcon?: boolean;
|
|
14
|
+
} = $props();
|
|
15
|
+
|
|
16
|
+
// Random width between 50% and 90%
|
|
17
|
+
const width = `${Math.floor(Math.random() * 40) + 50}%`;
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
bind:this={ref}
|
|
22
|
+
data-slot="sidebar-menu-skeleton"
|
|
23
|
+
data-sidebar="menu-skeleton"
|
|
24
|
+
class={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
|
|
25
|
+
{...restProps}
|
|
26
|
+
>
|
|
27
|
+
{#if showIcon}
|
|
28
|
+
<Skeleton class="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />
|
|
29
|
+
{/if}
|
|
30
|
+
<Skeleton
|
|
31
|
+
class="max-w-(--skeleton-width) h-4 flex-1"
|
|
32
|
+
data-sidebar="menu-skeleton-text"
|
|
33
|
+
style="--skeleton-width: {width};"
|
|
34
|
+
/>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
children,
|
|
9
|
+
child,
|
|
10
|
+
class: className,
|
|
11
|
+
size = 'md',
|
|
12
|
+
isActive = false,
|
|
13
|
+
...restProps
|
|
14
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
15
|
+
child?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
16
|
+
size?: 'sm' | 'md';
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
} = $props();
|
|
19
|
+
|
|
20
|
+
const mergedProps = $derived({
|
|
21
|
+
class: cn(
|
|
22
|
+
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground outline-hidden flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
|
|
23
|
+
'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
|
|
24
|
+
size === 'sm' && 'text-xs',
|
|
25
|
+
size === 'md' && 'text-sm',
|
|
26
|
+
'group-data-[collapsible=icon]:hidden',
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
'data-slot': 'sidebar-menu-sub-button',
|
|
30
|
+
'data-sidebar': 'menu-sub-button',
|
|
31
|
+
'data-size': size,
|
|
32
|
+
'data-active': isActive,
|
|
33
|
+
...restProps
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
{#if child}
|
|
38
|
+
{@render child({ props: mergedProps })}
|
|
39
|
+
{:else}
|
|
40
|
+
<a bind:this={ref} {...mergedProps}>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</a>
|
|
43
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
children,
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLLIElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<li
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-menu-sub-item"
|
|
16
|
+
data-sidebar="menu-sub-item"
|
|
17
|
+
class={cn('group/menu-sub-item relative', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</li>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLUListElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<ul
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-menu-sub"
|
|
16
|
+
data-sidebar="menu-sub"
|
|
17
|
+
class={cn(
|
|
18
|
+
'border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5',
|
|
19
|
+
'group-data-[collapsible=icon]:hidden',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</ul>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLUListElement>, HTMLUListElement> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<ul
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="sidebar-menu"
|
|
16
|
+
data-sidebar="menu"
|
|
17
|
+
class={cn('flex w-full min-w-0 flex-col gap-1', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</ul>
|