@invopop/popui 0.1.96 → 0.1.98
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/CounterWidget.svelte +65 -30
- package/dist/GlobalSearch.svelte +1 -1
- package/dist/MenuItem.svelte +106 -29
- package/dist/ProgressBarCircle.svelte +9 -6
- package/dist/index.d.ts +36 -1
- package/dist/index.js +74 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +4 -0
- package/dist/separator/separator.svelte +21 -0
- package/dist/separator/separator.svelte.d.ts +4 -0
- package/dist/sheet/index.d.ts +11 -0
- package/dist/sheet/index.js +13 -0
- package/dist/sheet/sheet-close.svelte +7 -0
- package/dist/sheet/sheet-close.svelte.d.ts +4 -0
- package/dist/sheet/sheet-content.svelte +65 -0
- package/dist/sheet/sheet-content.svelte.d.ts +15 -0
- package/dist/sheet/sheet-description.svelte +17 -0
- package/dist/sheet/sheet-description.svelte.d.ts +4 -0
- package/dist/sheet/sheet-footer.svelte +20 -0
- package/dist/sheet/sheet-footer.svelte.d.ts +5 -0
- package/dist/sheet/sheet-header.svelte +20 -0
- package/dist/sheet/sheet-header.svelte.d.ts +5 -0
- package/dist/sheet/sheet-overlay.svelte +20 -0
- package/dist/sheet/sheet-overlay.svelte.d.ts +4 -0
- package/dist/sheet/sheet-portal.svelte +7 -0
- package/dist/sheet/sheet-portal.svelte.d.ts +3 -0
- package/dist/sheet/sheet-title.svelte +17 -0
- package/dist/sheet/sheet-title.svelte.d.ts +4 -0
- package/dist/sheet/sheet-trigger.svelte +7 -0
- package/dist/sheet/sheet-trigger.svelte.d.ts +4 -0
- package/dist/sheet/sheet.svelte +7 -0
- package/dist/sheet/sheet.svelte.d.ts +3 -0
- package/dist/sidebar/constants.d.ts +10 -0
- package/dist/sidebar/constants.js +10 -0
- package/dist/sidebar/context.svelte.d.ts +23 -0
- package/dist/sidebar/context.svelte.js +58 -0
- package/dist/sidebar/index.d.ts +25 -0
- package/dist/sidebar/index.js +27 -0
- package/dist/sidebar/is-mobile.svelte.d.ts +4 -0
- package/dist/sidebar/is-mobile.svelte.js +7 -0
- package/dist/sidebar/sidebar-content.svelte +25 -0
- package/dist/sidebar/sidebar-content.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-footer.svelte +21 -0
- package/dist/sidebar/sidebar-footer.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-group-action.svelte +33 -0
- package/dist/sidebar/sidebar-group-action.svelte.d.ts +11 -0
- package/dist/sidebar/sidebar-group-content.svelte +21 -0
- package/dist/sidebar/sidebar-group-content.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-group-label.svelte +33 -0
- package/dist/sidebar/sidebar-group-label.svelte.d.ts +11 -0
- package/dist/sidebar/sidebar-group.svelte +21 -0
- package/dist/sidebar/sidebar-group.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-header.svelte +21 -0
- package/dist/sidebar/sidebar-header.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-input.svelte +23 -0
- package/dist/sidebar/sidebar-input.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-inset.svelte +23 -0
- package/dist/sidebar/sidebar-inset.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-action.svelte +37 -0
- package/dist/sidebar/sidebar-menu-action.svelte.d.ts +12 -0
- package/dist/sidebar/sidebar-menu-badge.svelte +24 -0
- package/dist/sidebar/sidebar-menu-badge.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-button.svelte +102 -0
- package/dist/sidebar/sidebar-menu-button.svelte.d.ts +51 -0
- package/dist/sidebar/sidebar-menu-item.svelte +21 -0
- package/dist/sidebar/sidebar-menu-item.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-skeleton.svelte +35 -0
- package/dist/sidebar/sidebar-menu-skeleton.svelte.d.ts +8 -0
- package/dist/sidebar/sidebar-menu-sub-button.svelte +39 -0
- package/dist/sidebar/sidebar-menu-sub-button.svelte.d.ts +13 -0
- package/dist/sidebar/sidebar-menu-sub-item.svelte +21 -0
- package/dist/sidebar/sidebar-menu-sub-item.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-sub.svelte +24 -0
- package/dist/sidebar/sidebar-menu-sub.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu.svelte +21 -0
- package/dist/sidebar/sidebar-menu.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-provider.svelte +47 -0
- package/dist/sidebar/sidebar-provider.svelte.d.ts +9 -0
- package/dist/sidebar/sidebar-rail.svelte +165 -0
- package/dist/sidebar/sidebar-rail.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-separator.svelte +19 -0
- package/dist/sidebar/sidebar-separator.svelte.d.ts +13 -0
- package/dist/sidebar/sidebar-trigger.svelte +35 -0
- package/dist/sidebar/sidebar-trigger.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar.svelte +106 -0
- package/dist/sidebar/sidebar.svelte.d.ts +10 -0
- package/dist/tailwind.theme.css +20 -0
- package/dist/types.d.ts +3 -1
- package/package.json +2 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Side = 'top' | 'right' | 'bottom' | 'left';
|
|
2
|
+
import { Dialog as SheetPrimitive } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import SheetPortal from './sheet-portal.svelte';
|
|
5
|
+
import { type WithoutChildrenOrChild } from '../utils.js';
|
|
6
|
+
import type { ComponentProps } from 'svelte';
|
|
7
|
+
type $$ComponentProps = WithoutChildrenOrChild<SheetPrimitive.ContentProps> & {
|
|
8
|
+
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof SheetPortal>>;
|
|
9
|
+
side?: Side;
|
|
10
|
+
showCloseButton?: boolean;
|
|
11
|
+
children: Snippet;
|
|
12
|
+
};
|
|
13
|
+
declare const SheetContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
14
|
+
type SheetContent = ReturnType<typeof SheetContent>;
|
|
15
|
+
export default SheetContent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as SheetPrimitive } from 'bits-ui'
|
|
3
|
+
import { cn } from '../utils.js'
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: SheetPrimitive.DescriptionProps = $props()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<SheetPrimitive.Description
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="sheet-description"
|
|
15
|
+
class={cn('text-foreground-secondary text-sm', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../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="sheet-footer"
|
|
16
|
+
class={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../utils.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const SheetFooter: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type SheetFooter = ReturnType<typeof SheetFooter>;
|
|
5
|
+
export default SheetFooter;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
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="sheet-header"
|
|
16
|
+
class={cn('flex flex-col gap-1.5 p-4', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SheetHeader: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type SheetHeader = ReturnType<typeof SheetHeader>;
|
|
5
|
+
export default SheetHeader;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as SheetPrimitive } from 'bits-ui'
|
|
3
|
+
import { cn } from '../utils.js'
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: SheetPrimitive.OverlayProps = $props()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<SheetPrimitive.Overlay
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="sheet-overlay"
|
|
15
|
+
class={cn(
|
|
16
|
+
'fixed inset-0 z-50 bg-black/10 supports-[backdrop-filter]:backdrop-blur-xs',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
/>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as SheetPrimitive } from 'bits-ui'
|
|
3
|
+
import { cn } from '../utils.js'
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: SheetPrimitive.TitleProps = $props()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<SheetPrimitive.Title
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="sheet-title"
|
|
15
|
+
class={cn('text-foreground font-medium', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
2
|
+
export declare const SIDEBAR_WIDTH_STORAGE_KEY = "sidebar_width";
|
|
3
|
+
export declare const SIDEBAR_COOKIE_MAX_AGE: number;
|
|
4
|
+
export declare const SIDEBAR_WIDTH = "16rem";
|
|
5
|
+
export declare const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
6
|
+
export declare const SIDEBAR_WIDTH_ICON = "3rem";
|
|
7
|
+
export declare const SIDEBAR_KEYBOARD_SHORTCUT = ".";
|
|
8
|
+
export declare const SIDEBAR_MIN_WIDTH_PX = 240;
|
|
9
|
+
export declare const SIDEBAR_MAX_WIDTH_PX = 384;
|
|
10
|
+
export declare const SIDEBAR_DRAG_THRESHOLD_PX = 4;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
2
|
+
export const SIDEBAR_WIDTH_STORAGE_KEY = 'sidebar_width';
|
|
3
|
+
export const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
4
|
+
export const SIDEBAR_WIDTH = '16rem';
|
|
5
|
+
export const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
6
|
+
export const SIDEBAR_WIDTH_ICON = '3rem';
|
|
7
|
+
export const SIDEBAR_KEYBOARD_SHORTCUT = '.';
|
|
8
|
+
export const SIDEBAR_MIN_WIDTH_PX = 240;
|
|
9
|
+
export const SIDEBAR_MAX_WIDTH_PX = 384;
|
|
10
|
+
export const SIDEBAR_DRAG_THRESHOLD_PX = 4;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type Getter<T> = () => T;
|
|
2
|
+
export type SidebarStateProps = {
|
|
3
|
+
open: Getter<boolean>;
|
|
4
|
+
setOpen: (open: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
declare class SidebarState {
|
|
7
|
+
#private;
|
|
8
|
+
readonly props: SidebarStateProps;
|
|
9
|
+
open: boolean;
|
|
10
|
+
openMobile: boolean;
|
|
11
|
+
width: string;
|
|
12
|
+
setOpen: SidebarStateProps['setOpen'];
|
|
13
|
+
state: string;
|
|
14
|
+
constructor(props: SidebarStateProps);
|
|
15
|
+
get isMobile(): boolean;
|
|
16
|
+
setWidth: (px: number) => void;
|
|
17
|
+
handleShortcutKeydown: (e: KeyboardEvent) => void;
|
|
18
|
+
setOpenMobile: (value: boolean) => void;
|
|
19
|
+
toggle: () => boolean | void;
|
|
20
|
+
}
|
|
21
|
+
export declare function setSidebar(props: SidebarStateProps): SidebarState;
|
|
22
|
+
export declare function useSidebar(): SidebarState;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
import { SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_MAX_WIDTH_PX, SIDEBAR_MIN_WIDTH_PX, SIDEBAR_WIDTH, SIDEBAR_WIDTH_STORAGE_KEY } from './constants.js';
|
|
3
|
+
import { IsMobile } from './is-mobile.svelte.js';
|
|
4
|
+
class SidebarState {
|
|
5
|
+
props;
|
|
6
|
+
open = $derived.by(() => this.props.open());
|
|
7
|
+
openMobile = $state(false);
|
|
8
|
+
width = $state(SIDEBAR_WIDTH);
|
|
9
|
+
setOpen;
|
|
10
|
+
#isMobile;
|
|
11
|
+
state = $derived.by(() => (this.open ? 'expanded' : 'collapsed'));
|
|
12
|
+
constructor(props) {
|
|
13
|
+
this.setOpen = props.setOpen;
|
|
14
|
+
this.#isMobile = new IsMobile();
|
|
15
|
+
this.props = props;
|
|
16
|
+
if (typeof localStorage !== 'undefined') {
|
|
17
|
+
const stored = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY);
|
|
18
|
+
if (stored)
|
|
19
|
+
this.width = stored;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
get isMobile() {
|
|
23
|
+
return this.#isMobile.current;
|
|
24
|
+
}
|
|
25
|
+
setWidth = (px) => {
|
|
26
|
+
const clamped = Math.max(SIDEBAR_MIN_WIDTH_PX, Math.min(SIDEBAR_MAX_WIDTH_PX, px));
|
|
27
|
+
this.width = `${clamped}px`;
|
|
28
|
+
if (typeof localStorage !== 'undefined') {
|
|
29
|
+
try {
|
|
30
|
+
localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, this.width);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// ignore quota / private-mode errors
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
handleShortcutKeydown = (e) => {
|
|
38
|
+
if (e.key === SIDEBAR_KEYBOARD_SHORTCUT && (e.metaKey || e.ctrlKey)) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
this.toggle();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
setOpenMobile = (value) => {
|
|
44
|
+
this.openMobile = value;
|
|
45
|
+
};
|
|
46
|
+
toggle = () => {
|
|
47
|
+
return this.#isMobile.current
|
|
48
|
+
? (this.openMobile = !this.openMobile)
|
|
49
|
+
: this.setOpen(!this.open);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const SYMBOL_KEY = 'scn-sidebar';
|
|
53
|
+
export function setSidebar(props) {
|
|
54
|
+
return setContext(Symbol.for(SYMBOL_KEY), new SidebarState(props));
|
|
55
|
+
}
|
|
56
|
+
export function useSidebar() {
|
|
57
|
+
return getContext(Symbol.for(SYMBOL_KEY));
|
|
58
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export { Content, Footer, Group, GroupAction, GroupContent, GroupLabel, Header, Input, Inset, Menu, MenuAction, MenuBadge, MenuButton, MenuItem, MenuSkeleton, MenuSub, MenuSubButton, MenuSubItem, Provider, Rail, Root, Separator, Trigger, Root as Sidebar, Content as SidebarContent, Footer as SidebarFooter, Group as SidebarGroup, GroupAction as SidebarGroupAction, GroupContent as SidebarGroupContent, GroupLabel as SidebarGroupLabel, Header as SidebarHeader, Input as SidebarInput, Inset as SidebarInset, Menu as SidebarMenu, MenuAction as SidebarMenuAction, MenuBadge as SidebarMenuBadge, MenuButton as SidebarMenuButton, MenuItem as SidebarMenuItem, MenuSkeleton as SidebarMenuSkeleton, MenuSub as SidebarMenuSub, MenuSubButton as SidebarMenuSubButton, MenuSubItem as SidebarMenuSubItem, Provider as SidebarProvider, Rail as SidebarRail, Separator as SidebarSeparator, Trigger as SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
export { Content, Footer, Group, GroupAction, GroupContent, GroupLabel, Header, Input, Inset, Menu, MenuAction, MenuBadge, MenuButton, MenuItem, MenuSkeleton, MenuSub, MenuSubButton, MenuSubItem, Provider, Rail, Root, Separator, Trigger,
|
|
26
|
+
//
|
|
27
|
+
Root as Sidebar, Content as SidebarContent, Footer as SidebarFooter, Group as SidebarGroup, GroupAction as SidebarGroupAction, GroupContent as SidebarGroupContent, GroupLabel as SidebarGroupLabel, Header as SidebarHeader, Input as SidebarInput, Inset as SidebarInset, Menu as SidebarMenu, MenuAction as SidebarMenuAction, MenuBadge as SidebarMenuBadge, MenuButton as SidebarMenuButton, MenuItem as SidebarMenuItem, MenuSkeleton as SidebarMenuSkeleton, MenuSub as SidebarMenuSub, MenuSubButton as SidebarMenuSubButton, MenuSubItem as SidebarMenuSubItem, Provider as SidebarProvider, Rail as SidebarRail, Separator as SidebarSeparator, Trigger as SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../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
|
+
'[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarContent: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type SidebarContent = ReturnType<typeof SidebarContent>;
|
|
5
|
+
export default SidebarContent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../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,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarFooter: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type SidebarFooter = ReturnType<typeof SidebarFooter>;
|
|
5
|
+
export default SidebarFooter;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLButtonAttributes } from 'svelte/elements'
|
|
4
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
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 absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden',
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
'data-slot': 'sidebar-group-action',
|
|
22
|
+
'data-sidebar': 'group-action',
|
|
23
|
+
...restProps
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if child}
|
|
28
|
+
{@render child({ props: mergedProps })}
|
|
29
|
+
{:else}
|
|
30
|
+
<button bind:this={ref} {...mergedProps}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</button>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import { type WithElementRef } from '../utils.js';
|
|
4
|
+
type $$ComponentProps = WithElementRef<HTMLButtonAttributes> & {
|
|
5
|
+
child?: Snippet<[{
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
}]>;
|
|
8
|
+
};
|
|
9
|
+
declare const SidebarGroupAction: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
10
|
+
type SidebarGroupAction = ReturnType<typeof SidebarGroupAction>;
|
|
11
|
+
export default SidebarGroupAction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
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,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarGroupContent: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type SidebarGroupContent = ReturnType<typeof SidebarGroupContent>;
|
|
5
|
+
export default SidebarGroupContent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
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 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
'data-slot': 'sidebar-group-label',
|
|
22
|
+
'data-sidebar': 'group-label',
|
|
23
|
+
...restProps
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if child}
|
|
28
|
+
{@render child({ props: mergedProps })}
|
|
29
|
+
{:else}
|
|
30
|
+
<div bind:this={ref} {...mergedProps}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type WithElementRef } from '../utils.js';
|
|
4
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
5
|
+
child?: Snippet<[{
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
}]>;
|
|
8
|
+
};
|
|
9
|
+
declare const SidebarGroupLabel: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
10
|
+
type SidebarGroupLabel = ReturnType<typeof SidebarGroupLabel>;
|
|
11
|
+
export default SidebarGroupLabel;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../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,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarGroup: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type SidebarGroup = ReturnType<typeof SidebarGroup>;
|
|
5
|
+
export default SidebarGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../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,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarHeader: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type SidebarHeader = ReturnType<typeof SidebarHeader>;
|
|
5
|
+
export default SidebarHeader;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(''),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLInputAttributes, HTMLInputElement> = $props()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<input
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
bind:value
|
|
16
|
+
data-slot="sidebar-input"
|
|
17
|
+
data-sidebar="input"
|
|
18
|
+
class={cn(
|
|
19
|
+
'bg-background border-input flex h-8 w-full rounded-md border px-3 py-1 text-sm shadow-none transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarInput: import("svelte").Component<WithElementRef<HTMLInputAttributes, HTMLInputElement>, {}, "value" | "ref">;
|
|
4
|
+
type SidebarInput = ReturnType<typeof SidebarInput>;
|
|
5
|
+
export default SidebarInput;
|