@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.
Files changed (147) hide show
  1. package/README.md +235 -0
  2. package/package.json +88 -0
  3. package/src/lib/components/ui/Backdrop.svelte +19 -0
  4. package/src/lib/components/ui/CountBadge.svelte +40 -0
  5. package/src/lib/components/ui/EmptyState.svelte +68 -0
  6. package/src/lib/components/ui/KbdShortcut.svelte +20 -0
  7. package/src/lib/components/ui/MarkdownRenderer.svelte +85 -0
  8. package/src/lib/components/ui/ProgressRing.svelte +61 -0
  9. package/src/lib/components/ui/ProviderIcon.svelte +57 -0
  10. package/src/lib/components/ui/ReviewBadge.svelte +54 -0
  11. package/src/lib/components/ui/Sparkline.svelte +61 -0
  12. package/src/lib/components/ui/StatusBadge.svelte +32 -0
  13. package/src/lib/components/ui/StatusDot.svelte +65 -0
  14. package/src/lib/components/ui/TabBar.svelte +127 -0
  15. package/src/lib/components/ui/VerticalSeparator.svelte +9 -0
  16. package/src/lib/components/ui/accordion/accordion-content.svelte +22 -0
  17. package/src/lib/components/ui/accordion/accordion-item.svelte +17 -0
  18. package/src/lib/components/ui/accordion/accordion-trigger.svelte +32 -0
  19. package/src/lib/components/ui/accordion/accordion.svelte +16 -0
  20. package/src/lib/components/ui/accordion/index.ts +16 -0
  21. package/src/lib/components/ui/avatar/avatar-fallback.svelte +17 -0
  22. package/src/lib/components/ui/avatar/avatar-image.svelte +17 -0
  23. package/src/lib/components/ui/avatar/avatar.svelte +19 -0
  24. package/src/lib/components/ui/avatar/index.ts +13 -0
  25. package/src/lib/components/ui/badge/badge.svelte +49 -0
  26. package/src/lib/components/ui/badge/index.ts +2 -0
  27. package/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +23 -0
  28. package/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte +20 -0
  29. package/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte +31 -0
  30. package/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte +23 -0
  31. package/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte +23 -0
  32. package/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte +27 -0
  33. package/src/lib/components/ui/breadcrumb/breadcrumb.svelte +21 -0
  34. package/src/lib/components/ui/breadcrumb/index.ts +25 -0
  35. package/src/lib/components/ui/button/button.svelte +82 -0
  36. package/src/lib/components/ui/button/index.ts +17 -0
  37. package/src/lib/components/ui/card/card-action.svelte +20 -0
  38. package/src/lib/components/ui/card/card-content.svelte +15 -0
  39. package/src/lib/components/ui/card/card-description.svelte +20 -0
  40. package/src/lib/components/ui/card/card-footer.svelte +20 -0
  41. package/src/lib/components/ui/card/card-header.svelte +23 -0
  42. package/src/lib/components/ui/card/card-title.svelte +20 -0
  43. package/src/lib/components/ui/card/card.svelte +23 -0
  44. package/src/lib/components/ui/card/index.ts +25 -0
  45. package/src/lib/components/ui/collapsible/collapsible-content.svelte +7 -0
  46. package/src/lib/components/ui/collapsible/collapsible-trigger.svelte +7 -0
  47. package/src/lib/components/ui/collapsible/collapsible.svelte +11 -0
  48. package/src/lib/components/ui/collapsible/index.ts +13 -0
  49. package/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
  50. package/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
  51. package/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
  52. package/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
  53. package/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
  54. package/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
  55. package/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
  56. package/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
  57. package/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
  58. package/src/lib/components/ui/dialog/dialog.svelte +7 -0
  59. package/src/lib/components/ui/dialog/index.ts +34 -0
  60. package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -0
  61. package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +41 -0
  62. package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +29 -0
  63. package/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
  64. package/src/lib/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
  65. package/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
  66. package/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
  67. package/src/lib/components/ui/dropdown-menu/dropdown-menu-portal.svelte +7 -0
  68. package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
  69. package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +31 -0
  70. package/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
  71. package/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
  72. package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +20 -0
  73. package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
  74. package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub.svelte +7 -0
  75. package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
  76. package/src/lib/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
  77. package/src/lib/components/ui/dropdown-menu/index.ts +54 -0
  78. package/src/lib/components/ui/input/index.ts +7 -0
  79. package/src/lib/components/ui/input/input.svelte +52 -0
  80. package/src/lib/components/ui/label/index.ts +7 -0
  81. package/src/lib/components/ui/label/label.svelte +20 -0
  82. package/src/lib/components/ui/navigation-menu/index.ts +28 -0
  83. package/src/lib/components/ui/navigation-menu/navigation-menu-content.svelte +21 -0
  84. package/src/lib/components/ui/navigation-menu/navigation-menu-indicator.svelte +22 -0
  85. package/src/lib/components/ui/navigation-menu/navigation-menu-item.svelte +17 -0
  86. package/src/lib/components/ui/navigation-menu/navigation-menu-link.svelte +20 -0
  87. package/src/lib/components/ui/navigation-menu/navigation-menu-list.svelte +17 -0
  88. package/src/lib/components/ui/navigation-menu/navigation-menu-trigger.svelte +34 -0
  89. package/src/lib/components/ui/navigation-menu/navigation-menu-viewport.svelte +22 -0
  90. package/src/lib/components/ui/navigation-menu/navigation-menu.svelte +32 -0
  91. package/src/lib/components/ui/progress/index.ts +1 -0
  92. package/src/lib/components/ui/progress/progress.svelte +33 -0
  93. package/src/lib/components/ui/scroll-area/index.ts +10 -0
  94. package/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
  95. package/src/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
  96. package/src/lib/components/ui/select/index.ts +37 -0
  97. package/src/lib/components/ui/select/select-content.svelte +45 -0
  98. package/src/lib/components/ui/select/select-group-heading.svelte +21 -0
  99. package/src/lib/components/ui/select/select-group.svelte +7 -0
  100. package/src/lib/components/ui/select/select-item.svelte +38 -0
  101. package/src/lib/components/ui/select/select-label.svelte +20 -0
  102. package/src/lib/components/ui/select/select-portal.svelte +7 -0
  103. package/src/lib/components/ui/select/select-scroll-down-button.svelte +20 -0
  104. package/src/lib/components/ui/select/select-scroll-up-button.svelte +20 -0
  105. package/src/lib/components/ui/select/select-separator.svelte +18 -0
  106. package/src/lib/components/ui/select/select-trigger.svelte +29 -0
  107. package/src/lib/components/ui/select/select.svelte +11 -0
  108. package/src/lib/components/ui/separator/index.ts +7 -0
  109. package/src/lib/components/ui/separator/separator.svelte +21 -0
  110. package/src/lib/components/ui/sheet/index.ts +34 -0
  111. package/src/lib/components/ui/sheet/sheet-close.svelte +7 -0
  112. package/src/lib/components/ui/sheet/sheet-content.svelte +62 -0
  113. package/src/lib/components/ui/sheet/sheet-description.svelte +17 -0
  114. package/src/lib/components/ui/sheet/sheet-footer.svelte +20 -0
  115. package/src/lib/components/ui/sheet/sheet-header.svelte +20 -0
  116. package/src/lib/components/ui/sheet/sheet-overlay.svelte +20 -0
  117. package/src/lib/components/ui/sheet/sheet-portal.svelte +7 -0
  118. package/src/lib/components/ui/sheet/sheet-title.svelte +17 -0
  119. package/src/lib/components/ui/sheet/sheet-trigger.svelte +7 -0
  120. package/src/lib/components/ui/sheet/sheet.svelte +7 -0
  121. package/src/lib/components/ui/skeleton/index.ts +1 -0
  122. package/src/lib/components/ui/skeleton/skeleton.svelte +17 -0
  123. package/src/lib/components/ui/sonner/index.ts +1 -0
  124. package/src/lib/components/ui/sonner/sonner.svelte +10 -0
  125. package/src/lib/components/ui/tabs/index.ts +16 -0
  126. package/src/lib/components/ui/tabs/tabs-content.svelte +17 -0
  127. package/src/lib/components/ui/tabs/tabs-list.svelte +16 -0
  128. package/src/lib/components/ui/tabs/tabs-trigger.svelte +20 -0
  129. package/src/lib/components/ui/tabs/tabs.svelte +19 -0
  130. package/src/lib/components/ui/textarea/index.ts +7 -0
  131. package/src/lib/components/ui/textarea/textarea.svelte +23 -0
  132. package/src/lib/components/ui/toggle/index.ts +13 -0
  133. package/src/lib/components/ui/toggle/toggle.svelte +52 -0
  134. package/src/lib/components/ui/toggle-group/index.ts +10 -0
  135. package/src/lib/components/ui/toggle-group/toggle-group-item.svelte +35 -0
  136. package/src/lib/components/ui/toggle-group/toggle-group.svelte +65 -0
  137. package/src/lib/components/ui/tooltip/index.ts +19 -0
  138. package/src/lib/components/ui/tooltip/tooltip-content.svelte +52 -0
  139. package/src/lib/components/ui/tooltip/tooltip-portal.svelte +7 -0
  140. package/src/lib/components/ui/tooltip/tooltip-provider.svelte +7 -0
  141. package/src/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
  142. package/src/lib/components/ui/tooltip/tooltip.svelte +7 -0
  143. package/src/lib/index.ts +244 -0
  144. package/src/lib/utils/cn.test.ts +993 -0
  145. package/src/lib/utils/cn.ts +6 -0
  146. package/src/lib/utils.ts +12 -0
  147. package/src/styles.css +127 -0
@@ -0,0 +1,34 @@
1
+ <script lang="ts" module>
2
+ import { cn } from '../../../utils.js';
3
+ import { tv } from 'tailwind-variants';
4
+
5
+ export const navigationMenuTriggerStyle = tv({
6
+ base: 'bg-background hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 group inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50',
7
+ });
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import { NavigationMenu as NavigationMenuPrimitive } from 'bits-ui';
12
+ import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
13
+
14
+ let {
15
+ ref = $bindable(null),
16
+ class: className,
17
+ children,
18
+ ...restProps
19
+ }: NavigationMenuPrimitive.TriggerProps = $props();
20
+ </script>
21
+
22
+ <NavigationMenuPrimitive.Trigger
23
+ bind:ref
24
+ data-slot="navigation-menu-trigger"
25
+ class={cn(navigationMenuTriggerStyle(), 'group', className)}
26
+ {...restProps}
27
+ >
28
+ {@render children?.()}
29
+
30
+ <ChevronDownIcon
31
+ class="relative top-[1px] ms-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
32
+ aria-hidden="true"
33
+ />
34
+ </NavigationMenuPrimitive.Trigger>
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import { NavigationMenu as NavigationMenuPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../utils.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ ...restProps
9
+ }: NavigationMenuPrimitive.ViewportProps = $props();
10
+ </script>
11
+
12
+ <div class={cn('absolute start-0 top-full isolate z-50 flex justify-center')}>
13
+ <NavigationMenuPrimitive.Viewport
14
+ bind:ref
15
+ data-slot="navigation-menu-viewport"
16
+ class={cn(
17
+ 'origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--bits-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--bits-navigation-menu-viewport-width)]',
18
+ className,
19
+ )}
20
+ {...restProps}
21
+ />
22
+ </div>
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import { NavigationMenu as NavigationMenuPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../utils.js';
4
+ import NavigationMenuViewport from './navigation-menu-viewport.svelte';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ viewport = true,
10
+ children,
11
+ ...restProps
12
+ }: NavigationMenuPrimitive.RootProps & {
13
+ viewport?: boolean;
14
+ } = $props();
15
+ </script>
16
+
17
+ <NavigationMenuPrimitive.Root
18
+ bind:ref
19
+ data-slot="navigation-menu"
20
+ data-viewport={viewport}
21
+ class={cn(
22
+ 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',
23
+ className,
24
+ )}
25
+ {...restProps}
26
+ >
27
+ {@render children?.()}
28
+
29
+ {#if viewport}
30
+ <NavigationMenuViewport />
31
+ {/if}
32
+ </NavigationMenuPrimitive.Root>
@@ -0,0 +1 @@
1
+ export { default as Progress } from './progress.svelte';
@@ -0,0 +1,33 @@
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
+ value = 0,
9
+ max = 100,
10
+ ...restProps
11
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
12
+ value?: number;
13
+ max?: number;
14
+ } = $props();
15
+
16
+ const percentage = $derived(Math.min(100, Math.max(0, (value / max) * 100)));
17
+ </script>
18
+
19
+ <div
20
+ bind:this={ref}
21
+ data-slot="progress"
22
+ role="progressbar"
23
+ aria-valuenow={value}
24
+ aria-valuemin={0}
25
+ aria-valuemax={max}
26
+ class={cn('bg-accent relative h-2 w-full overflow-hidden rounded-full', className)}
27
+ {...restProps}
28
+ >
29
+ <div
30
+ class="bg-primary h-full transition-all duration-300 ease-in-out"
31
+ style="width: {percentage}%"
32
+ ></div>
33
+ </div>
@@ -0,0 +1,10 @@
1
+ import Scrollbar from './scroll-area-scrollbar.svelte';
2
+ import Root from './scroll-area.svelte';
3
+
4
+ export {
5
+ Root,
6
+ Scrollbar,
7
+ //,
8
+ Root as ScrollArea,
9
+ Scrollbar as ScrollAreaScrollbar,
10
+ };
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { ScrollArea as ScrollAreaPrimitive } from 'bits-ui';
3
+ import { cn, type WithoutChild } from '../../../utils.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ orientation = 'vertical',
9
+ children,
10
+ ...restProps
11
+ }: WithoutChild<ScrollAreaPrimitive.ScrollbarProps> = $props();
12
+ </script>
13
+
14
+ <ScrollAreaPrimitive.Scrollbar
15
+ bind:ref
16
+ data-slot="scroll-area-scrollbar"
17
+ {orientation}
18
+ class={cn(
19
+ 'flex touch-none p-px transition-colors select-none',
20
+ orientation === 'vertical' && 'h-full w-2.5 border-s border-s-transparent',
21
+ orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent',
22
+ className,
23
+ )}
24
+ {...restProps}
25
+ >
26
+ {@render children?.()}
27
+ <ScrollAreaPrimitive.Thumb
28
+ data-slot="scroll-area-thumb"
29
+ class="bg-border relative flex-1 rounded-full"
30
+ />
31
+ </ScrollAreaPrimitive.Scrollbar>
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import { ScrollArea as ScrollAreaPrimitive } from 'bits-ui';
3
+ import { Scrollbar } from './index.js';
4
+ import { cn, type WithoutChild } from '../../../utils.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ viewportRef = $bindable(null),
9
+ class: className,
10
+ orientation = 'vertical',
11
+ scrollbarXClasses = '',
12
+ scrollbarYClasses = '',
13
+ children,
14
+ ...restProps
15
+ }: WithoutChild<ScrollAreaPrimitive.RootProps> & {
16
+ orientation?: 'vertical' | 'horizontal' | 'both' | undefined;
17
+ scrollbarXClasses?: string | undefined;
18
+ scrollbarYClasses?: string | undefined;
19
+ viewportRef?: HTMLElement | null;
20
+ } = $props();
21
+ </script>
22
+
23
+ <ScrollAreaPrimitive.Root
24
+ bind:ref
25
+ data-slot="scroll-area"
26
+ class={cn('relative', className)}
27
+ {...restProps}
28
+ >
29
+ <ScrollAreaPrimitive.Viewport
30
+ bind:ref={viewportRef}
31
+ data-slot="scroll-area-viewport"
32
+ class="ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1"
33
+ >
34
+ {@render children?.()}
35
+ </ScrollAreaPrimitive.Viewport>
36
+ {#if orientation === 'vertical' || orientation === 'both'}
37
+ <Scrollbar orientation="vertical" class={scrollbarYClasses} />
38
+ {/if}
39
+ {#if orientation === 'horizontal' || orientation === 'both'}
40
+ <Scrollbar orientation="horizontal" class={scrollbarXClasses} />
41
+ {/if}
42
+ <ScrollAreaPrimitive.Corner />
43
+ </ScrollAreaPrimitive.Root>
@@ -0,0 +1,37 @@
1
+ import Root from './select.svelte';
2
+ import Group from './select-group.svelte';
3
+ import Label from './select-label.svelte';
4
+ import Item from './select-item.svelte';
5
+ import Content from './select-content.svelte';
6
+ import Trigger from './select-trigger.svelte';
7
+ import Separator from './select-separator.svelte';
8
+ import ScrollDownButton from './select-scroll-down-button.svelte';
9
+ import ScrollUpButton from './select-scroll-up-button.svelte';
10
+ import GroupHeading from './select-group-heading.svelte';
11
+ import Portal from './select-portal.svelte';
12
+
13
+ export {
14
+ Root,
15
+ Group,
16
+ Label,
17
+ Item,
18
+ Content,
19
+ Trigger,
20
+ Separator,
21
+ ScrollDownButton,
22
+ ScrollUpButton,
23
+ GroupHeading,
24
+ Portal,
25
+ //
26
+ Root as Select,
27
+ Group as SelectGroup,
28
+ Label as SelectLabel,
29
+ Item as SelectItem,
30
+ Content as SelectContent,
31
+ Trigger as SelectTrigger,
32
+ Separator as SelectSeparator,
33
+ ScrollDownButton as SelectScrollDownButton,
34
+ ScrollUpButton as SelectScrollUpButton,
35
+ GroupHeading as SelectGroupHeading,
36
+ Portal as SelectPortal,
37
+ };
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
+ import SelectPortal from './select-portal.svelte';
4
+ import SelectScrollUpButton from './select-scroll-up-button.svelte';
5
+ import SelectScrollDownButton from './select-scroll-down-button.svelte';
6
+ import { cn, type WithoutChild } from '../../../utils.js';
7
+ import type { ComponentProps } from 'svelte';
8
+ import type { WithoutChildrenOrChild } from '../../../utils.js';
9
+
10
+ let {
11
+ ref = $bindable(null),
12
+ class: className,
13
+ sideOffset = 4,
14
+ portalProps,
15
+ children,
16
+ preventScroll = true,
17
+ ...restProps
18
+ }: WithoutChild<SelectPrimitive.ContentProps> & {
19
+ portalProps?: WithoutChildrenOrChild<ComponentProps<typeof SelectPortal>>;
20
+ } = $props();
21
+ </script>
22
+
23
+ <SelectPortal {...portalProps}>
24
+ <SelectPrimitive.Content
25
+ bind:ref
26
+ {sideOffset}
27
+ {preventScroll}
28
+ data-slot="select-content"
29
+ class={cn(
30
+ '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-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--bits-select-content-available-height) min-w-[8rem] origin-(--bits-select-content-transform-origin) overflow-x-hidden overflow-y-auto 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',
31
+ className,
32
+ )}
33
+ {...restProps}
34
+ >
35
+ <SelectScrollUpButton />
36
+ <SelectPrimitive.Viewport
37
+ class={cn(
38
+ 'h-(--bits-select-anchor-height) w-full min-w-(--bits-select-anchor-width) scroll-my-1 p-1',
39
+ )}
40
+ >
41
+ {@render children?.()}
42
+ </SelectPrimitive.Viewport>
43
+ <SelectScrollDownButton />
44
+ </SelectPrimitive.Content>
45
+ </SelectPortal>
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../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,7 @@
1
+ <script lang="ts">
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
+
4
+ let { ref = $bindable(null), ...restProps }: SelectPrimitive.GroupProps = $props();
5
+ </script>
6
+
7
+ <SelectPrimitive.Group bind:ref data-slot="select-group" {...restProps} />
@@ -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 '../../../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 relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 ps-2 pe-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
22
+ className,
23
+ )}
24
+ {...restProps}
25
+ >
26
+ {#snippet children({ selected, highlighted })}
27
+ <span class="absolute end-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 '../../../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,7 @@
1
+ <script lang="ts">
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
+
4
+ let { ...restProps }: SelectPrimitive.PortalProps = $props();
5
+ </script>
6
+
7
+ <SelectPrimitive.Portal {...restProps} />
@@ -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 '../../../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 '../../../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 '../separator/index.js';
4
+ import { cn } from '../../../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 '../../../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 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none select-none 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]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
23
+ className,
24
+ )}
25
+ {...restProps}
26
+ >
27
+ {@render children?.()}
28
+ <ChevronDownIcon class="size-4 opacity-50" />
29
+ </SelectPrimitive.Trigger>
@@ -0,0 +1,11 @@
1
+ <script lang="ts">
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
+
4
+ let {
5
+ open = $bindable(false),
6
+ value = $bindable(),
7
+ ...restProps
8
+ }: SelectPrimitive.RootProps = $props();
9
+ </script>
10
+
11
+ <SelectPrimitive.Root bind:open bind:value={value as never} {...restProps} />
@@ -0,0 +1,7 @@
1
+ import Root from './separator.svelte';
2
+
3
+ export {
4
+ Root,
5
+ //
6
+ Root as Separator,
7
+ };
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import { Separator as SeparatorPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../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=horizontal]:w-full data-[orientation=vertical]:min-h-full data-[orientation=vertical]:w-px',
18
+ className,
19
+ )}
20
+ {...restProps}
21
+ />
@@ -0,0 +1,34 @@
1
+ import Root from './sheet.svelte';
2
+ import Portal from './sheet-portal.svelte';
3
+ import Trigger from './sheet-trigger.svelte';
4
+ import Close from './sheet-close.svelte';
5
+ import Overlay from './sheet-overlay.svelte';
6
+ import Content from './sheet-content.svelte';
7
+ import Header from './sheet-header.svelte';
8
+ import Footer from './sheet-footer.svelte';
9
+ import Title from './sheet-title.svelte';
10
+ import Description from './sheet-description.svelte';
11
+
12
+ export {
13
+ Root,
14
+ Close,
15
+ Trigger,
16
+ Portal,
17
+ Overlay,
18
+ Content,
19
+ Header,
20
+ Footer,
21
+ Title,
22
+ Description,
23
+ //
24
+ Root as Sheet,
25
+ Close as SheetClose,
26
+ Trigger as SheetTrigger,
27
+ Portal as SheetPortal,
28
+ Overlay as SheetOverlay,
29
+ Content as SheetContent,
30
+ Header as SheetHeader,
31
+ Footer as SheetFooter,
32
+ Title as SheetTitle,
33
+ Description as SheetDescription,
34
+ };
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { Dialog as SheetPrimitive } from 'bits-ui';
3
+
4
+ let { ref = $bindable(null), ...restProps }: SheetPrimitive.CloseProps = $props();
5
+ </script>
6
+
7
+ <SheetPrimitive.Close bind:ref data-slot="sheet-close" {...restProps} />
@@ -0,0 +1,62 @@
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-start data-[state=open]:slide-in-from-start inset-y-0 start-0 h-full w-3/4 border-e sm:max-w-sm',
11
+ right:
12
+ 'data-[state=closed]:slide-out-to-end data-[state=open]:slide-in-from-end inset-y-0 end-0 h-full w-3/4 border-s 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 SheetPortal from './sheet-portal.svelte';
28
+ import SheetOverlay from './sheet-overlay.svelte';
29
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
30
+ import type { ComponentProps } from 'svelte';
31
+
32
+ let {
33
+ ref = $bindable(null),
34
+ class: className,
35
+ side = 'right',
36
+ portalProps,
37
+ children,
38
+ ...restProps
39
+ }: WithoutChildrenOrChild<SheetPrimitive.ContentProps> & {
40
+ portalProps?: WithoutChildrenOrChild<ComponentProps<typeof SheetPortal>>;
41
+ side?: Side;
42
+ children: Snippet;
43
+ } = $props();
44
+ </script>
45
+
46
+ <SheetPortal {...portalProps}>
47
+ <SheetOverlay />
48
+ <SheetPrimitive.Content
49
+ bind:ref
50
+ data-slot="sheet-content"
51
+ class={cn(sheetVariants({ side }), className)}
52
+ {...restProps}
53
+ >
54
+ {@render children?.()}
55
+ <SheetPrimitive.Close
56
+ class="ring-offset-background focus-visible:ring-ring absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none"
57
+ >
58
+ <XIcon class="size-4" />
59
+ <span class="sr-only">Close</span>
60
+ </SheetPrimitive.Close>
61
+ </SheetPrimitive.Content>
62
+ </SheetPortal>
@@ -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-muted-foreground text-sm', className)}
16
+ {...restProps}
17
+ />