@nucel/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/README.md +235 -0
- package/package.json +88 -0
- package/src/lib/components/ui/Backdrop.svelte +19 -0
- package/src/lib/components/ui/CountBadge.svelte +40 -0
- package/src/lib/components/ui/EmptyState.svelte +68 -0
- package/src/lib/components/ui/KbdShortcut.svelte +20 -0
- package/src/lib/components/ui/MarkdownRenderer.svelte +85 -0
- package/src/lib/components/ui/ProgressRing.svelte +61 -0
- package/src/lib/components/ui/ProviderIcon.svelte +57 -0
- package/src/lib/components/ui/ReviewBadge.svelte +54 -0
- package/src/lib/components/ui/Sparkline.svelte +61 -0
- package/src/lib/components/ui/StatusBadge.svelte +32 -0
- package/src/lib/components/ui/StatusDot.svelte +65 -0
- package/src/lib/components/ui/TabBar.svelte +127 -0
- package/src/lib/components/ui/VerticalSeparator.svelte +9 -0
- package/src/lib/components/ui/accordion/accordion-content.svelte +22 -0
- package/src/lib/components/ui/accordion/accordion-item.svelte +17 -0
- package/src/lib/components/ui/accordion/accordion-trigger.svelte +32 -0
- package/src/lib/components/ui/accordion/accordion.svelte +16 -0
- package/src/lib/components/ui/accordion/index.ts +16 -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/dialog/dialog-close.svelte +7 -0
- package/src/lib/components/ui/dialog/dialog-content.svelte +45 -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-portal.svelte +7 -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/dialog.svelte +7 -0
- package/src/lib/components/ui/dialog/index.ts +34 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -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 +29 -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-portal.svelte +7 -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-sub.svelte +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
- package/src/lib/components/ui/dropdown-menu/index.ts +54 -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/navigation-menu/index.ts +28 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-content.svelte +21 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-indicator.svelte +22 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-item.svelte +17 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-link.svelte +20 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-list.svelte +17 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-trigger.svelte +34 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu-viewport.svelte +22 -0
- package/src/lib/components/ui/navigation-menu/navigation-menu.svelte +32 -0
- package/src/lib/components/ui/progress/index.ts +1 -0
- package/src/lib/components/ui/progress/progress.svelte +33 -0
- package/src/lib/components/ui/scroll-area/index.ts +10 -0
- package/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
- package/src/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
- package/src/lib/components/ui/select/index.ts +37 -0
- package/src/lib/components/ui/select/select-content.svelte +45 -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-portal.svelte +7 -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/select/select.svelte +11 -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 +34 -0
- package/src/lib/components/ui/sheet/sheet-close.svelte +7 -0
- package/src/lib/components/ui/sheet/sheet-content.svelte +62 -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-portal.svelte +7 -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/sheet/sheet.svelte +7 -0
- package/src/lib/components/ui/skeleton/index.ts +1 -0
- package/src/lib/components/ui/skeleton/skeleton.svelte +17 -0
- package/src/lib/components/ui/sonner/index.ts +1 -0
- package/src/lib/components/ui/sonner/sonner.svelte +10 -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 +23 -0
- package/src/lib/components/ui/toggle/index.ts +13 -0
- package/src/lib/components/ui/toggle/toggle.svelte +52 -0
- package/src/lib/components/ui/toggle-group/index.ts +10 -0
- package/src/lib/components/ui/toggle-group/toggle-group-item.svelte +35 -0
- package/src/lib/components/ui/toggle-group/toggle-group.svelte +65 -0
- package/src/lib/components/ui/tooltip/index.ts +19 -0
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +52 -0
- package/src/lib/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/src/lib/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/src/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/src/lib/components/ui/tooltip/tooltip.svelte +7 -0
- package/src/lib/index.ts +244 -0
- package/src/lib/utils/cn.test.ts +993 -0
- package/src/lib/utils/cn.ts +6 -0
- package/src/lib/utils.ts +12 -0
- package/src/styles.css +127 -0
|
@@ -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,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,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
|
+
'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 '../../../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 @@
|
|
|
1
|
+
export { default as Skeleton } from './skeleton.svelte';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
...restProps
|
|
9
|
+
}: 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 @@
|
|
|
1
|
+
export { default as Toaster } from './sonner.svelte';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Toaster as SonnerToaster } from 'svelte-sonner';
|
|
3
|
+
import type { ComponentProps } from 'svelte';
|
|
4
|
+
type ToasterProps = ComponentProps<typeof SonnerToaster>;
|
|
5
|
+
import { cn } from '../../../utils.js';
|
|
6
|
+
|
|
7
|
+
let { class: className, ...restProps }: ToasterProps & { class?: string } = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<SonnerToaster class={cn('toaster group', className)} theme="dark" closeButton {...restProps} />
|
|
@@ -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 '../../../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 '../../../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 '../../../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 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
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 '../../../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,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef, type WithoutChildren } from '../../../utils.js';
|
|
3
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
'data-slot': dataSlot = 'textarea',
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<textarea
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
data-slot={dataSlot}
|
|
17
|
+
class={cn(
|
|
18
|
+
'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 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
></textarea>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const toggleVariants = tv({
|
|
5
|
+
base: "hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-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 inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-transparent',
|
|
9
|
+
outline:
|
|
10
|
+
'border-input hover:bg-accent hover:text-accent-foreground border bg-transparent shadow-xs',
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
default: 'h-9 min-w-9 px-2',
|
|
14
|
+
sm: 'h-8 min-w-8 px-1.5',
|
|
15
|
+
lg: 'h-10 min-w-10 px-2.5',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
size: 'default',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type ToggleVariant = VariantProps<typeof toggleVariants>['variant'];
|
|
25
|
+
export type ToggleSize = VariantProps<typeof toggleVariants>['size'];
|
|
26
|
+
export type ToggleVariants = VariantProps<typeof toggleVariants>;
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { Toggle as TogglePrimitive } from 'bits-ui';
|
|
31
|
+
import { cn } from '../../../utils.js';
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
ref = $bindable(null),
|
|
35
|
+
pressed = $bindable(false),
|
|
36
|
+
class: className,
|
|
37
|
+
size = 'default',
|
|
38
|
+
variant = 'default',
|
|
39
|
+
...restProps
|
|
40
|
+
}: TogglePrimitive.RootProps & {
|
|
41
|
+
variant?: ToggleVariant;
|
|
42
|
+
size?: ToggleSize;
|
|
43
|
+
} = $props();
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<TogglePrimitive.Root
|
|
47
|
+
bind:ref
|
|
48
|
+
bind:pressed
|
|
49
|
+
data-slot="toggle"
|
|
50
|
+
class={cn(toggleVariants({ variant, size }), className)}
|
|
51
|
+
{...restProps}
|
|
52
|
+
/>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ToggleGroup as ToggleGroupPrimitive } from 'bits-ui';
|
|
3
|
+
import { getToggleGroupCtx } from './toggle-group.svelte';
|
|
4
|
+
import { cn } from '../../../utils.js';
|
|
5
|
+
import { type ToggleVariants, toggleVariants } from '../toggle/index.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
value = $bindable(),
|
|
10
|
+
class: className,
|
|
11
|
+
size,
|
|
12
|
+
variant,
|
|
13
|
+
...restProps
|
|
14
|
+
}: ToggleGroupPrimitive.ItemProps & ToggleVariants = $props();
|
|
15
|
+
|
|
16
|
+
const ctx = getToggleGroupCtx();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<ToggleGroupPrimitive.Item
|
|
20
|
+
bind:ref
|
|
21
|
+
data-slot="toggle-group-item"
|
|
22
|
+
data-variant={ctx.variant || variant}
|
|
23
|
+
data-size={ctx.size || size}
|
|
24
|
+
data-spacing={ctx.spacing}
|
|
25
|
+
class={cn(
|
|
26
|
+
toggleVariants({
|
|
27
|
+
variant: ctx.variant || variant,
|
|
28
|
+
size: ctx.size || size,
|
|
29
|
+
}),
|
|
30
|
+
'w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10 data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{value}
|
|
34
|
+
{...restProps}
|
|
35
|
+
/>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
import { toggleVariants } from '../toggle/index.js';
|
|
5
|
+
|
|
6
|
+
type ToggleVariants = VariantProps<typeof toggleVariants>;
|
|
7
|
+
|
|
8
|
+
interface ToggleGroupContext extends ToggleVariants {
|
|
9
|
+
spacing?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function setToggleGroupCtx(props: ToggleGroupContext) {
|
|
13
|
+
setContext('toggleGroup', props);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getToggleGroupCtx() {
|
|
17
|
+
return getContext<Required<ToggleGroupContext>>('toggleGroup');
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { ToggleGroup as ToggleGroupPrimitive } from 'bits-ui';
|
|
23
|
+
import { cn } from '../../../utils.js';
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
ref = $bindable(null),
|
|
27
|
+
value = $bindable(),
|
|
28
|
+
class: className,
|
|
29
|
+
size = 'default',
|
|
30
|
+
spacing = 0,
|
|
31
|
+
variant = 'default',
|
|
32
|
+
...restProps
|
|
33
|
+
}: ToggleGroupPrimitive.RootProps & ToggleVariants & { spacing?: number } = $props();
|
|
34
|
+
|
|
35
|
+
setToggleGroupCtx({
|
|
36
|
+
get variant() {
|
|
37
|
+
return variant;
|
|
38
|
+
},
|
|
39
|
+
get size() {
|
|
40
|
+
return size;
|
|
41
|
+
},
|
|
42
|
+
get spacing() {
|
|
43
|
+
return spacing;
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<!--
|
|
49
|
+
Discriminated Unions + Destructing (required for bindable) do not
|
|
50
|
+
get along, so we shut typescript up by casting `value` to `never`.
|
|
51
|
+
-->
|
|
52
|
+
<ToggleGroupPrimitive.Root
|
|
53
|
+
bind:value={value as never}
|
|
54
|
+
bind:ref
|
|
55
|
+
data-slot="toggle-group"
|
|
56
|
+
data-variant={variant}
|
|
57
|
+
data-size={size}
|
|
58
|
+
data-spacing={spacing}
|
|
59
|
+
style={`--gap: ${spacing}`}
|
|
60
|
+
class={cn(
|
|
61
|
+
'group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs',
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
{...restProps}
|
|
65
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Root from './tooltip.svelte';
|
|
2
|
+
import Trigger from './tooltip-trigger.svelte';
|
|
3
|
+
import Content from './tooltip-content.svelte';
|
|
4
|
+
import Provider from './tooltip-provider.svelte';
|
|
5
|
+
import Portal from './tooltip-portal.svelte';
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
Root,
|
|
9
|
+
Trigger,
|
|
10
|
+
Content,
|
|
11
|
+
Provider,
|
|
12
|
+
Portal,
|
|
13
|
+
//
|
|
14
|
+
Root as Tooltip,
|
|
15
|
+
Content as TooltipContent,
|
|
16
|
+
Trigger as TooltipTrigger,
|
|
17
|
+
Provider as TooltipProvider,
|
|
18
|
+
Portal as TooltipPortal,
|
|
19
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
import TooltipPortal from './tooltip-portal.svelte';
|
|
5
|
+
import type { ComponentProps } from 'svelte';
|
|
6
|
+
import type { WithoutChildrenOrChild } from '../../../utils.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
class: className,
|
|
11
|
+
sideOffset = 0,
|
|
12
|
+
side = 'top',
|
|
13
|
+
children,
|
|
14
|
+
arrowClasses,
|
|
15
|
+
portalProps,
|
|
16
|
+
...restProps
|
|
17
|
+
}: TooltipPrimitive.ContentProps & {
|
|
18
|
+
arrowClasses?: string;
|
|
19
|
+
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof TooltipPortal>>;
|
|
20
|
+
} = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<TooltipPortal {...portalProps}>
|
|
24
|
+
<TooltipPrimitive.Content
|
|
25
|
+
bind:ref
|
|
26
|
+
data-slot="tooltip-content"
|
|
27
|
+
{sideOffset}
|
|
28
|
+
{side}
|
|
29
|
+
class={cn(
|
|
30
|
+
'bg-foreground text-background 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-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--bits-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...restProps}
|
|
34
|
+
>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
<TooltipPrimitive.Arrow>
|
|
37
|
+
{#snippet child({ props })}
|
|
38
|
+
<div
|
|
39
|
+
class={cn(
|
|
40
|
+
'bg-foreground z-50 size-2.5 rotate-45 rounded-[2px]',
|
|
41
|
+
'data-[side=top]:translate-x-1/2 data-[side=top]:translate-y-[calc(-50%_+_2px)]',
|
|
42
|
+
'data-[side=bottom]:-translate-x-1/2 data-[side=bottom]:-translate-y-[calc(-50%_+_1px)]',
|
|
43
|
+
'data-[side=right]:translate-x-[calc(50%_+_2px)] data-[side=right]:translate-y-1/2',
|
|
44
|
+
'data-[side=left]:-translate-y-[calc(50%_-_3px)]',
|
|
45
|
+
arrowClasses,
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
></div>
|
|
49
|
+
{/snippet}
|
|
50
|
+
</TooltipPrimitive.Arrow>
|
|
51
|
+
</TooltipPrimitive.Content>
|
|
52
|
+
</TooltipPortal>
|