@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,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '@lib/utils.js';
|
|
3
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
sideOffset = 4,
|
|
9
|
+
align = 'center',
|
|
10
|
+
portalProps,
|
|
11
|
+
...restProps
|
|
12
|
+
}: PopoverPrimitive.ContentProps & {
|
|
13
|
+
portalProps?: PopoverPrimitive.PortalProps;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<PopoverPrimitive.Portal {...portalProps}>
|
|
18
|
+
<PopoverPrimitive.Content
|
|
19
|
+
bind:ref
|
|
20
|
+
data-slot="popover-content"
|
|
21
|
+
{sideOffset}
|
|
22
|
+
{align}
|
|
23
|
+
class={cn(
|
|
24
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...restProps}
|
|
28
|
+
/>
|
|
29
|
+
</PopoverPrimitive.Portal>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '@lib/utils.js';
|
|
3
|
+
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: PopoverPrimitive.TriggerProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<PopoverPrimitive.Trigger
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="popover-trigger"
|
|
15
|
+
class={cn('', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
2
|
+
|
|
3
|
+
import Group from './select-group.svelte';
|
|
4
|
+
import Label from './select-label.svelte';
|
|
5
|
+
import Item from './select-item.svelte';
|
|
6
|
+
import Content from './select-content.svelte';
|
|
7
|
+
import Trigger from './select-trigger.svelte';
|
|
8
|
+
import Separator from './select-separator.svelte';
|
|
9
|
+
import ScrollDownButton from './select-scroll-down-button.svelte';
|
|
10
|
+
import ScrollUpButton from './select-scroll-up-button.svelte';
|
|
11
|
+
import GroupHeading from './select-group-heading.svelte';
|
|
12
|
+
|
|
13
|
+
const Root = SelectPrimitive.Root;
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
Root,
|
|
17
|
+
Group,
|
|
18
|
+
Label,
|
|
19
|
+
Item,
|
|
20
|
+
Content,
|
|
21
|
+
Trigger,
|
|
22
|
+
Separator,
|
|
23
|
+
ScrollDownButton,
|
|
24
|
+
ScrollUpButton,
|
|
25
|
+
GroupHeading,
|
|
26
|
+
//
|
|
27
|
+
Root as Select,
|
|
28
|
+
Group as SelectGroup,
|
|
29
|
+
Label as SelectLabel,
|
|
30
|
+
Item as SelectItem,
|
|
31
|
+
Content as SelectContent,
|
|
32
|
+
Trigger as SelectTrigger,
|
|
33
|
+
Separator as SelectSeparator,
|
|
34
|
+
ScrollDownButton as SelectScrollDownButton,
|
|
35
|
+
ScrollUpButton as SelectScrollUpButton,
|
|
36
|
+
GroupHeading as SelectGroupHeading
|
|
37
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import SelectScrollUpButton from './select-scroll-up-button.svelte';
|
|
4
|
+
import SelectScrollDownButton from './select-scroll-down-button.svelte';
|
|
5
|
+
import { cn, type WithoutChild } from '@lib/utils.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
sideOffset = 4,
|
|
11
|
+
portalProps,
|
|
12
|
+
children,
|
|
13
|
+
...restProps
|
|
14
|
+
}: WithoutChild<SelectPrimitive.ContentProps> & {
|
|
15
|
+
portalProps?: SelectPrimitive.PortalProps;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<SelectPrimitive.Portal {...portalProps}>
|
|
20
|
+
<SelectPrimitive.Content
|
|
21
|
+
bind:ref
|
|
22
|
+
{sideOffset}
|
|
23
|
+
data-slot="select-content"
|
|
24
|
+
class={cn(
|
|
25
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 max-h-(--bits-select-content-available-height) origin-(--bits-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
30
|
+
<SelectScrollUpButton />
|
|
31
|
+
<SelectPrimitive.Viewport
|
|
32
|
+
class={cn(
|
|
33
|
+
'h-(--bits-select-anchor-height) min-w-(--bits-select-anchor-width) w-full scroll-my-1 p-1'
|
|
34
|
+
)}
|
|
35
|
+
>
|
|
36
|
+
{@render children?.()}
|
|
37
|
+
</SelectPrimitive.Viewport>
|
|
38
|
+
<SelectScrollDownButton />
|
|
39
|
+
</SelectPrimitive.Content>
|
|
40
|
+
</SelectPrimitive.Portal>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: ComponentProps<typeof SelectPrimitive.GroupHeading> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<SelectPrimitive.GroupHeading
|
|
15
|
+
bind:ref
|
|
16
|
+
data-slot="select-group-heading"
|
|
17
|
+
class={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</SelectPrimitive.GroupHeading>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CheckIcon from '@lucide/svelte/icons/check';
|
|
3
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
4
|
+
import { cn, type WithoutChild } from '@lib/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value,
|
|
10
|
+
label,
|
|
11
|
+
children: childrenProp,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithoutChild<SelectPrimitive.ItemProps> = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<SelectPrimitive.Item
|
|
17
|
+
bind:ref
|
|
18
|
+
{value}
|
|
19
|
+
data-slot="select-item"
|
|
20
|
+
class={cn(
|
|
21
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...restProps}
|
|
25
|
+
>
|
|
26
|
+
{#snippet children({ selected, highlighted })}
|
|
27
|
+
<span class="absolute right-2 flex size-3.5 items-center justify-center">
|
|
28
|
+
{#if selected}
|
|
29
|
+
<CheckIcon class="size-4" />
|
|
30
|
+
{/if}
|
|
31
|
+
</span>
|
|
32
|
+
{#if childrenProp}
|
|
33
|
+
{@render childrenProp({ selected, highlighted })}
|
|
34
|
+
{:else}
|
|
35
|
+
{label || value}
|
|
36
|
+
{/if}
|
|
37
|
+
{/snippet}
|
|
38
|
+
</SelectPrimitive.Item>
|
|
@@ -0,0 +1,20 @@
|
|
|
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="select-label"
|
|
16
|
+
class={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
3
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
4
|
+
import { cn, type WithoutChildrenOrChild } from '@lib/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChildrenOrChild<SelectPrimitive.ScrollDownButtonProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SelectPrimitive.ScrollDownButton
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="select-scroll-down-button"
|
|
16
|
+
class={cn('flex cursor-default items-center justify-center py-1', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
<ChevronDownIcon class="size-4" />
|
|
20
|
+
</SelectPrimitive.ScrollDownButton>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
|
|
3
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
4
|
+
import { cn, type WithoutChildrenOrChild } from '@lib/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChildrenOrChild<SelectPrimitive.ScrollUpButtonProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SelectPrimitive.ScrollUpButton
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="select-scroll-up-button"
|
|
16
|
+
class={cn('flex cursor-default items-center justify-center py-1', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
<ChevronUpIcon class="size-4" />
|
|
20
|
+
</SelectPrimitive.ScrollUpButton>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Separator as SeparatorPrimitive } from 'bits-ui';
|
|
3
|
+
import { Separator } from '@lib/components/ui/separator/index.js';
|
|
4
|
+
import { cn } from '@lib/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: SeparatorPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Separator
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="select-separator"
|
|
16
|
+
class={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
/>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
4
|
+
import { cn, type WithoutChild } from '@lib/utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
size = 'default',
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChild<SelectPrimitive.TriggerProps> & {
|
|
13
|
+
size?: 'sm' | 'default';
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<SelectPrimitive.Trigger
|
|
18
|
+
bind:ref
|
|
19
|
+
data-slot="select-trigger"
|
|
20
|
+
data-size={size}
|
|
21
|
+
class={cn(
|
|
22
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]: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 dark:hover:bg-input/50 shadow-xs flex w-fit select-none items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...restProps}
|
|
26
|
+
>
|
|
27
|
+
{@render children?.()}
|
|
28
|
+
<ChevronDownIcon class="size-4 opacity-50" />
|
|
29
|
+
</SelectPrimitive.Trigger>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Separator as SeparatorPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
'data-slot': dataSlot = 'separator',
|
|
9
|
+
...restProps
|
|
10
|
+
}: SeparatorPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot={dataSlot}
|
|
16
|
+
class={cn(
|
|
17
|
+
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
/>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Dialog as SheetPrimitive } from 'bits-ui';
|
|
2
|
+
import Trigger from './sheet-trigger.svelte';
|
|
3
|
+
import Close from './sheet-close.svelte';
|
|
4
|
+
import Overlay from './sheet-overlay.svelte';
|
|
5
|
+
import Content from './sheet-content.svelte';
|
|
6
|
+
import Header from './sheet-header.svelte';
|
|
7
|
+
import Footer from './sheet-footer.svelte';
|
|
8
|
+
import Title from './sheet-title.svelte';
|
|
9
|
+
import Description from './sheet-description.svelte';
|
|
10
|
+
|
|
11
|
+
const Root = SheetPrimitive.Root;
|
|
12
|
+
const Portal = SheetPrimitive.Portal;
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
Root,
|
|
16
|
+
Close,
|
|
17
|
+
Trigger,
|
|
18
|
+
Portal,
|
|
19
|
+
Overlay,
|
|
20
|
+
Content,
|
|
21
|
+
Header,
|
|
22
|
+
Footer,
|
|
23
|
+
Title,
|
|
24
|
+
Description,
|
|
25
|
+
//
|
|
26
|
+
Root as Sheet,
|
|
27
|
+
Close as SheetClose,
|
|
28
|
+
Trigger as SheetTrigger,
|
|
29
|
+
Portal as SheetPortal,
|
|
30
|
+
Overlay as SheetOverlay,
|
|
31
|
+
Content as SheetContent,
|
|
32
|
+
Header as SheetHeader,
|
|
33
|
+
Footer as SheetFooter,
|
|
34
|
+
Title as SheetTitle,
|
|
35
|
+
Description as SheetDescription
|
|
36
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
export const sheetVariants = tv({
|
|
4
|
+
base: 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
5
|
+
variants: {
|
|
6
|
+
side: {
|
|
7
|
+
top: 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
8
|
+
bottom:
|
|
9
|
+
'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
10
|
+
left: 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
|
|
11
|
+
right:
|
|
12
|
+
'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
side: 'right'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Side = VariantProps<typeof sheetVariants>['side'];
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { Dialog as SheetPrimitive } from 'bits-ui';
|
|
25
|
+
import XIcon from '@lucide/svelte/icons/x';
|
|
26
|
+
import type { Snippet } from 'svelte';
|
|
27
|
+
import SheetOverlay from './sheet-overlay.svelte';
|
|
28
|
+
import { cn, type WithoutChildrenOrChild } from '@lib/utils.js';
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
ref = $bindable(null),
|
|
32
|
+
class: className,
|
|
33
|
+
side = 'right',
|
|
34
|
+
portalProps,
|
|
35
|
+
children,
|
|
36
|
+
...restProps
|
|
37
|
+
}: WithoutChildrenOrChild<SheetPrimitive.ContentProps> & {
|
|
38
|
+
portalProps?: SheetPrimitive.PortalProps;
|
|
39
|
+
side?: Side;
|
|
40
|
+
children: Snippet;
|
|
41
|
+
} = $props();
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<SheetPrimitive.Portal {...portalProps}>
|
|
45
|
+
<SheetOverlay />
|
|
46
|
+
<SheetPrimitive.Content
|
|
47
|
+
bind:ref
|
|
48
|
+
data-slot="sheet-content"
|
|
49
|
+
class={cn(sheetVariants({ side }), className)}
|
|
50
|
+
{...restProps}
|
|
51
|
+
>
|
|
52
|
+
{@render children?.()}
|
|
53
|
+
<SheetPrimitive.Close
|
|
54
|
+
class="ring-offset-background focus-visible:ring-ring rounded-xs focus-visible:outline-hidden absolute right-4 top-4 opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none"
|
|
55
|
+
>
|
|
56
|
+
<XIcon class="size-4" />
|
|
57
|
+
<span class="sr-only">Close</span>
|
|
58
|
+
</SheetPrimitive.Close>
|
|
59
|
+
</SheetPrimitive.Content>
|
|
60
|
+
</SheetPrimitive.Portal>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as SheetPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/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-muted-foreground text-sm', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
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="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,20 @@
|
|
|
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<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,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as SheetPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '@lib/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
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
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 '@lib/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-semibold', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SIDEBAR_COOKIE_NAME = 'sidebar:state';
|
|
2
|
+
export const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
3
|
+
export const SIDEBAR_WIDTH = '16rem';
|
|
4
|
+
export const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
5
|
+
export const SIDEBAR_WIDTH_ICON = '3rem';
|
|
6
|
+
export const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { IsMobile } from '@lib/hooks/is-mobile.svelte.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
import { SIDEBAR_KEYBOARD_SHORTCUT } from './constants.js';
|
|
4
|
+
|
|
5
|
+
type Getter<T> = () => T;
|
|
6
|
+
|
|
7
|
+
export type SidebarStateProps = {
|
|
8
|
+
/**
|
|
9
|
+
* A getter function that returns the current open state of the sidebar.
|
|
10
|
+
* We use a getter function here to support `bind:open` on the `Sidebar.Provider`
|
|
11
|
+
* component.
|
|
12
|
+
*/
|
|
13
|
+
open: Getter<boolean>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A function that sets the open state of the sidebar. To support `bind:open`, we need
|
|
17
|
+
* a source of truth for changing the open state to ensure it will be synced throughout
|
|
18
|
+
* the sub-components and any `bind:` references.
|
|
19
|
+
*/
|
|
20
|
+
setOpen: (open: boolean) => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
class SidebarState {
|
|
24
|
+
readonly props: SidebarStateProps;
|
|
25
|
+
open = $derived.by(() => this.props.open());
|
|
26
|
+
openMobile = $state(false);
|
|
27
|
+
setOpen: SidebarStateProps['setOpen'];
|
|
28
|
+
#isMobile: IsMobile;
|
|
29
|
+
state = $derived.by(() => (this.open ? 'expanded' : 'collapsed'));
|
|
30
|
+
|
|
31
|
+
constructor(props: SidebarStateProps) {
|
|
32
|
+
this.setOpen = props.setOpen;
|
|
33
|
+
this.#isMobile = new IsMobile();
|
|
34
|
+
this.props = props;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Convenience getter for checking if the sidebar is mobile
|
|
38
|
+
// without this, we would need to use `sidebar.isMobile.current` everywhere
|
|
39
|
+
get isMobile() {
|
|
40
|
+
return this.#isMobile.current;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Event handler to apply to the `<svelte:window>`
|
|
44
|
+
handleShortcutKeydown = (e: KeyboardEvent) => {
|
|
45
|
+
if (e.key === SIDEBAR_KEYBOARD_SHORTCUT && (e.metaKey || e.ctrlKey)) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
this.toggle();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
setOpenMobile = (value: boolean) => {
|
|
52
|
+
this.openMobile = value;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
toggle = () => {
|
|
56
|
+
return this.#isMobile.current ? (this.openMobile = !this.openMobile) : this.setOpen(!this.open);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const SYMBOL_KEY = 'scn-sidebar';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Instantiates a new `SidebarState` instance and sets it in the context.
|
|
64
|
+
*
|
|
65
|
+
* @param props The constructor props for the `SidebarState` class.
|
|
66
|
+
* @returns The `SidebarState` instance.
|
|
67
|
+
*/
|
|
68
|
+
export function setSidebar(props: SidebarStateProps): SidebarState {
|
|
69
|
+
return setContext(Symbol.for(SYMBOL_KEY), new SidebarState(props));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves the `SidebarState` instance from the context. This is a class instance,
|
|
74
|
+
* so you cannot destructure it.
|
|
75
|
+
* @returns The `SidebarState` instance.
|
|
76
|
+
*/
|
|
77
|
+
export function useSidebar(): SidebarState {
|
|
78
|
+
return getContext(Symbol.for(SYMBOL_KEY));
|
|
79
|
+
}
|