@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,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Tooltip from '@lib/components/ui/tooltip/index.js';
|
|
3
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import {
|
|
6
|
+
SIDEBAR_COOKIE_MAX_AGE,
|
|
7
|
+
SIDEBAR_COOKIE_NAME,
|
|
8
|
+
SIDEBAR_WIDTH,
|
|
9
|
+
SIDEBAR_WIDTH_ICON
|
|
10
|
+
} from './constants.js';
|
|
11
|
+
import { setSidebar } from './context.svelte.js';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
ref = $bindable(null),
|
|
15
|
+
open = $bindable(true),
|
|
16
|
+
onOpenChange = () => {},
|
|
17
|
+
class: className,
|
|
18
|
+
style,
|
|
19
|
+
children,
|
|
20
|
+
...restProps
|
|
21
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
22
|
+
open?: boolean;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
} = $props();
|
|
25
|
+
|
|
26
|
+
const sidebar = setSidebar({
|
|
27
|
+
open: () => open,
|
|
28
|
+
setOpen: (value: boolean) => {
|
|
29
|
+
open = value;
|
|
30
|
+
onOpenChange(value);
|
|
31
|
+
|
|
32
|
+
// This sets the cookie to keep the sidebar state.
|
|
33
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<svelte:window onkeydown={sidebar.handleShortcutKeydown} />
|
|
39
|
+
|
|
40
|
+
<Tooltip.Provider delayDuration={0}>
|
|
41
|
+
<div
|
|
42
|
+
data-slot="sidebar-wrapper"
|
|
43
|
+
style="--sidebar-width: {SIDEBAR_WIDTH}; --sidebar-width-icon: {SIDEBAR_WIDTH_ICON}; {style}"
|
|
44
|
+
class={cn(
|
|
45
|
+
'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
bind:this={ref}
|
|
49
|
+
{...restProps}
|
|
50
|
+
>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</div>
|
|
53
|
+
</Tooltip.Provider>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { useSidebar } from './context.svelte.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> = $props();
|
|
12
|
+
|
|
13
|
+
const sidebar = useSidebar();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<button
|
|
17
|
+
bind:this={ref}
|
|
18
|
+
data-sidebar="rail"
|
|
19
|
+
data-slot="sidebar-rail"
|
|
20
|
+
aria-label="Toggle Sidebar"
|
|
21
|
+
tabIndex={-1}
|
|
22
|
+
onclick={sidebar.toggle}
|
|
23
|
+
title="Toggle Sidebar"
|
|
24
|
+
class={cn(
|
|
25
|
+
'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-[calc(1/2*100%-1px)] after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',
|
|
26
|
+
'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
|
|
27
|
+
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
28
|
+
'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
|
|
29
|
+
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
|
|
30
|
+
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...restProps}
|
|
34
|
+
>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</button>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Separator } from '@lib/components/ui/separator/index.js';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: ComponentProps<typeof Separator> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Separator
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="sidebar-separator"
|
|
16
|
+
data-sidebar="separator"
|
|
17
|
+
class={cn('bg-sidebar-border', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from '@lib/components/ui/button/index.js';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
import PanelLeftIcon from '@lucide/svelte/icons/panel-left';
|
|
5
|
+
import type { ComponentProps } from 'svelte';
|
|
6
|
+
import { useSidebar } from './context.svelte.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
class: className,
|
|
11
|
+
onclick,
|
|
12
|
+
...restProps
|
|
13
|
+
}: ComponentProps<typeof Button> & {
|
|
14
|
+
onclick?: (e: MouseEvent) => void;
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const sidebar = useSidebar();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Button
|
|
21
|
+
data-sidebar="trigger"
|
|
22
|
+
data-slot="sidebar-trigger"
|
|
23
|
+
variant="ghost"
|
|
24
|
+
size="icon"
|
|
25
|
+
class={cn('size-7', className)}
|
|
26
|
+
type="button"
|
|
27
|
+
onclick={(e) => {
|
|
28
|
+
onclick?.(e);
|
|
29
|
+
sidebar.toggle();
|
|
30
|
+
}}
|
|
31
|
+
{...restProps}
|
|
32
|
+
>
|
|
33
|
+
<PanelLeftIcon />
|
|
34
|
+
<span class="sr-only">Toggle Sidebar</span>
|
|
35
|
+
</Button>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Sheet from '@lib/components/ui/sheet/index.js';
|
|
3
|
+
import { cn, type WithElementRef } from '@lib/utils.js';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import { SIDEBAR_WIDTH_MOBILE } from './constants.js';
|
|
6
|
+
import { useSidebar } from './context.svelte.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
side = 'left',
|
|
11
|
+
variant = 'sidebar',
|
|
12
|
+
collapsible = 'offcanvas',
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
...restProps
|
|
16
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
17
|
+
side?: 'left' | 'right';
|
|
18
|
+
variant?: 'sidebar' | 'floating' | 'inset';
|
|
19
|
+
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
20
|
+
} = $props();
|
|
21
|
+
|
|
22
|
+
const sidebar = useSidebar();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if collapsible === 'none'}
|
|
26
|
+
<div
|
|
27
|
+
class={cn(
|
|
28
|
+
'bg-sidebar text-sidebar-foreground w-(--sidebar-width) flex h-full flex-col',
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
bind:this={ref}
|
|
32
|
+
{...restProps}
|
|
33
|
+
>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</div>
|
|
36
|
+
{:else if sidebar.isMobile}
|
|
37
|
+
<Sheet.Root bind:open={() => sidebar.openMobile, (v) => sidebar.setOpenMobile(v)} {...restProps}>
|
|
38
|
+
<Sheet.Content
|
|
39
|
+
data-sidebar="sidebar"
|
|
40
|
+
data-slot="sidebar"
|
|
41
|
+
data-mobile="true"
|
|
42
|
+
class="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
|
|
43
|
+
style="--sidebar-width: {SIDEBAR_WIDTH_MOBILE};"
|
|
44
|
+
{side}
|
|
45
|
+
>
|
|
46
|
+
<Sheet.Header class="sr-only">
|
|
47
|
+
<Sheet.Title>Sidebar</Sheet.Title>
|
|
48
|
+
<Sheet.Description>Displays the mobile sidebar.</Sheet.Description>
|
|
49
|
+
</Sheet.Header>
|
|
50
|
+
<div class="flex h-full w-full flex-col">
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</div>
|
|
53
|
+
</Sheet.Content>
|
|
54
|
+
</Sheet.Root>
|
|
55
|
+
{:else}
|
|
56
|
+
<div
|
|
57
|
+
bind:this={ref}
|
|
58
|
+
class="text-sidebar-foreground group peer hidden md:block"
|
|
59
|
+
data-state={sidebar.state}
|
|
60
|
+
data-collapsible={sidebar.state === 'collapsed' ? collapsible : ''}
|
|
61
|
+
data-variant={variant}
|
|
62
|
+
data-side={side}
|
|
63
|
+
data-slot="sidebar"
|
|
64
|
+
>
|
|
65
|
+
<!-- This is what handles the sidebar gap on desktop -->
|
|
66
|
+
<div
|
|
67
|
+
data-slot="sidebar-gap"
|
|
68
|
+
class={cn(
|
|
69
|
+
'w-(--sidebar-width) relative bg-transparent transition-[width] duration-200 ease-linear',
|
|
70
|
+
'group-data-[collapsible=offcanvas]:w-0',
|
|
71
|
+
'group-data-[side=right]:rotate-180',
|
|
72
|
+
variant === 'floating' || variant === 'inset'
|
|
73
|
+
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
74
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'
|
|
75
|
+
)}
|
|
76
|
+
></div>
|
|
77
|
+
<div
|
|
78
|
+
data-slot="sidebar-container"
|
|
79
|
+
class={cn(
|
|
80
|
+
'w-(--sidebar-width) fixed inset-y-0 z-10 hidden h-svh transition-[left,right,width] duration-200 ease-linear md:flex',
|
|
81
|
+
side === 'left'
|
|
82
|
+
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
83
|
+
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
84
|
+
// Adjust the padding for floating and inset variants.
|
|
85
|
+
variant === 'floating' || variant === 'inset'
|
|
86
|
+
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
87
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...restProps}
|
|
91
|
+
>
|
|
92
|
+
<div
|
|
93
|
+
data-sidebar="sidebar"
|
|
94
|
+
data-slot="sidebar-inner"
|
|
95
|
+
class="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
|
|
96
|
+
>
|
|
97
|
+
{@render children?.()}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef, type WithoutChildren } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
bind:this={ref}
|
|
14
|
+
data-slot="skeleton"
|
|
15
|
+
class={cn('bg-accent animate-pulse rounded-md', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
></div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Root from './tabs.svelte';
|
|
2
|
+
import Content from './tabs-content.svelte';
|
|
3
|
+
import List from './tabs-list.svelte';
|
|
4
|
+
import Trigger from './tabs-trigger.svelte';
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
Root,
|
|
8
|
+
Content,
|
|
9
|
+
List,
|
|
10
|
+
Trigger,
|
|
11
|
+
//
|
|
12
|
+
Root as Tabs,
|
|
13
|
+
Content as TabsContent,
|
|
14
|
+
List as TabsList,
|
|
15
|
+
Trigger as TabsTrigger
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: TabsPrimitive.ContentProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<TabsPrimitive.Content
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="tabs-content"
|
|
15
|
+
class={cn('flex-1 outline-none', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let { ref = $bindable(null), class: className, ...restProps }: TabsPrimitive.ListProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<TabsPrimitive.List
|
|
9
|
+
bind:ref
|
|
10
|
+
data-slot="tabs-list"
|
|
11
|
+
class={cn(
|
|
12
|
+
'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: TabsPrimitive.TriggerProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<TabsPrimitive.Trigger
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="tabs-trigger"
|
|
15
|
+
class={cn(
|
|
16
|
+
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(''),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: TabsPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<TabsPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
bind:value
|
|
16
|
+
data-slot="tabs"
|
|
17
|
+
class={cn('flex flex-col gap-2', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef, type WithoutChildren } from '@lib/utils.js';
|
|
3
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<textarea
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="textarea"
|
|
16
|
+
class={cn(
|
|
17
|
+
'border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 field-sizing-content shadow-xs flex min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
bind:value
|
|
21
|
+
{...restProps}
|
|
22
|
+
></textarea>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from 'bits-ui';
|
|
2
|
+
import Trigger from './tooltip-trigger.svelte';
|
|
3
|
+
import Content from './tooltip-content.svelte';
|
|
4
|
+
|
|
5
|
+
const Root = TooltipPrimitive.Root;
|
|
6
|
+
const Provider = TooltipPrimitive.Provider;
|
|
7
|
+
const Portal = TooltipPrimitive.Portal;
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
Root,
|
|
11
|
+
Trigger,
|
|
12
|
+
Content,
|
|
13
|
+
Provider,
|
|
14
|
+
Portal,
|
|
15
|
+
//
|
|
16
|
+
Root as Tooltip,
|
|
17
|
+
Content as TooltipContent,
|
|
18
|
+
Trigger as TooltipTrigger,
|
|
19
|
+
Provider as TooltipProvider,
|
|
20
|
+
Portal as TooltipPortal
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
sideOffset = 0,
|
|
9
|
+
side = 'top',
|
|
10
|
+
children,
|
|
11
|
+
arrowClasses,
|
|
12
|
+
...restProps
|
|
13
|
+
}: TooltipPrimitive.ContentProps & {
|
|
14
|
+
arrowClasses?: string;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<TooltipPrimitive.Portal>
|
|
19
|
+
<TooltipPrimitive.Content
|
|
20
|
+
bind:ref
|
|
21
|
+
data-slot="tooltip-content"
|
|
22
|
+
{sideOffset}
|
|
23
|
+
{side}
|
|
24
|
+
class={cn(
|
|
25
|
+
'bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--bits-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
<TooltipPrimitive.Arrow>
|
|
32
|
+
{#snippet child({ props })}
|
|
33
|
+
<div
|
|
34
|
+
class={cn(
|
|
35
|
+
'bg-primary z-50 size-2.5 rotate-45 rounded-[2px]',
|
|
36
|
+
'data-[side=top]:translate-x-1/2 data-[side=top]:translate-y-[calc(-50%_+_2px)]',
|
|
37
|
+
'data-[side=bottom]:-translate-x-1/2 data-[side=bottom]:-translate-y-[calc(-50%_+_1px)]',
|
|
38
|
+
'data-[side=right]:translate-x-[calc(50%_+_2px)] data-[side=right]:translate-y-1/2',
|
|
39
|
+
'data-[side=left]:-translate-y-[calc(50%_-_3px)]',
|
|
40
|
+
arrowClasses
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
></div>
|
|
44
|
+
{/snippet}
|
|
45
|
+
</TooltipPrimitive.Arrow>
|
|
46
|
+
</TooltipPrimitive.Content>
|
|
47
|
+
</TooltipPrimitive.Portal>
|
package/src/lib/utils.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { clsx, type ClassValue } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
export function cn(...inputs: ClassValue[]) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T;
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T;
|
|
12
|
+
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
|
|
13
|
+
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
|