@foxui/core 0.4.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/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/components/accordion/accordion-content.svelte +22 -0
- package/dist/components/accordion/accordion-content.svelte.d.ts +4 -0
- package/dist/components/accordion/accordion-item.svelte +35 -0
- package/dist/components/accordion/accordion-item.svelte.d.ts +9 -0
- package/dist/components/accordion/accordion-trigger.svelte +40 -0
- package/dist/components/accordion/accordion-trigger.svelte.d.ts +7 -0
- package/dist/components/accordion/index.d.ts +6 -0
- package/dist/components/accordion/index.js +6 -0
- package/dist/components/alert/alert-description.svelte +16 -0
- package/dist/components/alert/alert-description.svelte.d.ts +5 -0
- package/dist/components/alert/alert-title.svelte +25 -0
- package/dist/components/alert/alert-title.svelte.d.ts +8 -0
- package/dist/components/alert/alert.svelte +122 -0
- package/dist/components/alert/alert.svelte.d.ts +79 -0
- package/dist/components/alert/index.d.ts +5 -0
- package/dist/components/alert/index.js +5 -0
- package/dist/components/avatar/Avatar.svelte +73 -0
- package/dist/components/avatar/Avatar.svelte.d.ts +14 -0
- package/dist/components/avatar/AvatarGroup.svelte +43 -0
- package/dist/components/avatar/AvatarGroup.svelte.d.ts +16 -0
- package/dist/components/avatar/index.d.ts +3 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/badge/Badge.svelte +80 -0
- package/dist/components/badge/Badge.svelte.d.ts +100 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/box/Box.svelte +23 -0
- package/dist/components/box/Box.svelte.d.ts +5 -0
- package/dist/components/box/index.d.ts +1 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/button/Button.svelte +103 -0
- package/dist/components/button/Button.svelte.d.ts +110 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/card/ImageCard.svelte +62 -0
- package/dist/components/card/ImageCard.svelte.d.ts +12 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/chat-bubble/ChatBubble.svelte +96 -0
- package/dist/components/chat-bubble/ChatBubble.svelte.d.ts +95 -0
- package/dist/components/chat-bubble/index.d.ts +1 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +91 -0
- package/dist/components/checkbox/checkbox.svelte.d.ts +42 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/copy-code-button/AddCopyCodeButtons.svelte +35 -0
- package/dist/components/copy-code-button/AddCopyCodeButtons.svelte.d.ts +6 -0
- package/dist/components/copy-code-button/CopyCodeButton.svelte +69 -0
- package/dist/components/copy-code-button/CopyCodeButton.svelte.d.ts +7 -0
- package/dist/components/copy-code-button/index.d.ts +2 -0
- package/dist/components/copy-code-button/index.js +2 -0
- package/dist/components/head/Head.svelte +49 -0
- package/dist/components/head/Head.svelte.d.ts +10 -0
- package/dist/components/head/index.d.ts +1 -0
- package/dist/components/head/index.js +1 -0
- package/dist/components/heading/Heading.svelte +24 -0
- package/dist/components/heading/Heading.svelte.d.ts +8 -0
- package/dist/components/heading/Subheading.svelte +24 -0
- package/dist/components/heading/Subheading.svelte.d.ts +8 -0
- package/dist/components/heading/index.d.ts +3 -0
- package/dist/components/heading/index.js +3 -0
- package/dist/components/image/Image.svelte +80 -0
- package/dist/components/image/Image.svelte.d.ts +12 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/image-container/ImageContainer.svelte +15 -0
- package/dist/components/image-container/ImageContainer.svelte.d.ts +4 -0
- package/dist/components/image-container/index.d.ts +1 -0
- package/dist/components/image-container/index.js +1 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/index.js +34 -0
- package/dist/components/input/Input.svelte +60 -0
- package/dist/components/input/Input.svelte.d.ts +46 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/label/Label.svelte +19 -0
- package/dist/components/label/Label.svelte.d.ts +4 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/modal/Modal.svelte +167 -0
- package/dist/components/modal/Modal.svelte.d.ts +33 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/navbar/Navbar.svelte +63 -0
- package/dist/components/navbar/Navbar.svelte.d.ts +8 -0
- package/dist/components/navbar/index.d.ts +1 -0
- package/dist/components/navbar/index.js +1 -0
- package/dist/components/number-input/NumberInput.svelte +201 -0
- package/dist/components/number-input/NumberInput.svelte.d.ts +98 -0
- package/dist/components/number-input/index.d.ts +2 -0
- package/dist/components/number-input/index.js +1 -0
- package/dist/components/paragraph/Paragraph.svelte +20 -0
- package/dist/components/paragraph/Paragraph.svelte.d.ts +5 -0
- package/dist/components/paragraph/index.d.ts +2 -0
- package/dist/components/paragraph/index.js +2 -0
- package/dist/components/popover/Popover.svelte +63 -0
- package/dist/components/popover/Popover.svelte.d.ts +14 -0
- package/dist/components/popover/index.d.ts +8 -0
- package/dist/components/popover/index.js +7 -0
- package/dist/components/popover/popover-content.svelte +28 -0
- package/dist/components/popover/popover-content.svelte.d.ts +7 -0
- package/dist/components/prose/Prose.svelte +107 -0
- package/dist/components/prose/Prose.svelte.d.ts +35 -0
- package/dist/components/prose/ProseCopyButton.svelte +12 -0
- package/dist/components/prose/ProseCopyButton.svelte.d.ts +8 -0
- package/dist/components/prose/index.d.ts +4 -0
- package/dist/components/prose/index.js +2 -0
- package/dist/components/scroll-area/BodyScrollArea.svelte +3 -0
- package/dist/components/scroll-area/BodyScrollArea.svelte.d.ts +19 -0
- package/dist/components/scroll-area/ScrollArea.svelte +71 -0
- package/dist/components/scroll-area/ScrollArea.svelte.d.ts +8 -0
- package/dist/components/scroll-area/index.d.ts +1 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-area/style.css +41 -0
- package/dist/components/select/Select.svelte +88 -0
- package/dist/components/select/Select.svelte.d.ts +13 -0
- package/dist/components/select/SelectChildren.svelte +29 -0
- package/dist/components/select/SelectChildren.svelte.d.ts +8 -0
- package/dist/components/select/SelectItem.svelte +31 -0
- package/dist/components/select/SelectItem.svelte.d.ts +4 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/select/index.js +3 -0
- package/dist/components/select-2/Select.svelte +46 -0
- package/dist/components/select-2/Select.svelte.d.ts +12 -0
- package/dist/components/select-2/index.d.ts +1 -0
- package/dist/components/select-2/index.js +1 -0
- package/dist/components/sidebar/Sidebar.svelte +69 -0
- package/dist/components/sidebar/Sidebar.svelte.d.ts +9 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/slider/Slider.svelte +65 -0
- package/dist/components/slider/Slider.svelte.d.ts +4 -0
- package/dist/components/slider/SliderNumber.svelte +40 -0
- package/dist/components/slider/SliderNumber.svelte.d.ts +4 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/components/sonner/Toaster.svelte +73 -0
- package/dist/components/sonner/Toaster.svelte.d.ts +10 -0
- package/dist/components/sonner/index.d.ts +2 -0
- package/dist/components/sonner/index.js +2 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/switch/switch.svelte +27 -0
- package/dist/components/switch/switch.svelte.d.ts +4 -0
- package/dist/components/tabs/TabItem.svelte +56 -0
- package/dist/components/tabs/TabItem.svelte.d.ts +9 -0
- package/dist/components/tabs/Tabs.svelte +29 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +12 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/index.d.ts +19 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/textarea/textarea.svelte +57 -0
- package/dist/components/textarea/textarea.svelte.d.ts +47 -0
- package/dist/components/theme-toggle/ThemeToggle.svelte +105 -0
- package/dist/components/theme-toggle/ThemeToggle.svelte.d.ts +7 -0
- package/dist/components/theme-toggle/index.d.ts +2 -0
- package/dist/components/theme-toggle/index.js +2 -0
- package/dist/components/toggle/index.d.ts +3 -0
- package/dist/components/toggle/index.js +3 -0
- package/dist/components/toggle/toggle.svelte +49 -0
- package/dist/components/toggle/toggle.svelte.d.ts +40 -0
- package/dist/components/toggle-group/index.d.ts +3 -0
- package/dist/components/toggle-group/index.js +3 -0
- package/dist/components/toggle-group/toggle-group-item.svelte +30 -0
- package/dist/components/toggle-group/toggle-group-item.svelte.d.ts +6 -0
- package/dist/components/toggle-group/toggle-group.svelte +41 -0
- package/dist/components/toggle-group/toggle-group.svelte.d.ts +8 -0
- package/dist/components/tooltip/index.d.ts +7 -0
- package/dist/components/tooltip/index.js +9 -0
- package/dist/components/tooltip/tooltip-content.svelte +21 -0
- package/dist/components/tooltip/tooltip-content.svelte.d.ts +4 -0
- package/dist/components/tooltip/tooltip.svelte +62 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +5 -0
- package/package.json +82 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type WithElementRef } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../utils';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
7
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
ref = $bindable(null),
|
|
12
|
+
orientation = 'vertical',
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
...restProps
|
|
16
|
+
}: Props = $props();
|
|
17
|
+
|
|
18
|
+
function getOrientationClasses() {
|
|
19
|
+
if (orientation === 'vertical') return 'overflow-y-scroll';
|
|
20
|
+
if (orientation === 'horizontal') return 'overflow-x-scroll';
|
|
21
|
+
return 'overflow-y-scroll overflow-x-scroll';
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class={cn('scrollbar', getOrientationClasses(), className)} {...restProps}>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.scrollbar::-webkit-scrollbar-track {
|
|
31
|
+
background-color: transparent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@supports (scrollbar-width: auto) {
|
|
35
|
+
.scrollbar {
|
|
36
|
+
scrollbar-color: var(--color-base-400) transparent;
|
|
37
|
+
scrollbar-width: thin;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:global(.dark .scrollbar) {
|
|
41
|
+
scrollbar-color: var(--color-base-800) transparent;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@supports not (scrollbar-width: auto) {
|
|
46
|
+
:global(.scrollbar::-webkit-scrollbar) {
|
|
47
|
+
width: 14px;
|
|
48
|
+
height: 14px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.scrollbar::-webkit-scrollbar-thumb {
|
|
53
|
+
background-color: var(--color-base-400);
|
|
54
|
+
border-radius: 20px;
|
|
55
|
+
border: 4px solid transparent;
|
|
56
|
+
background-clip: content-box;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.scrollbar::-webkit-scrollbar-thumb:hover {
|
|
60
|
+
background-color: var(--color-base-500);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Dark mode rules */
|
|
64
|
+
:global(.dark .scrollbar::-webkit-scrollbar-thumb) {
|
|
65
|
+
background-color: var(--color-base-800);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:global(.dark .scrollbar::-webkit-scrollbar-thumb:hover) {
|
|
69
|
+
background-color: var(--color-base-700);
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type WithElementRef } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
|
+
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
5
|
+
};
|
|
6
|
+
declare const ScrollArea: import("svelte").Component<Props, {}, "ref">;
|
|
7
|
+
type ScrollArea = ReturnType<typeof ScrollArea>;
|
|
8
|
+
export default ScrollArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ScrollArea } from './ScrollArea.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ScrollArea } from './ScrollArea.svelte';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.body::-webkit-scrollbar-track {
|
|
2
|
+
background-color: transparent;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@supports (scrollbar-width: auto) {
|
|
6
|
+
body {
|
|
7
|
+
scrollbar-color: var(--color-base-400) transparent;
|
|
8
|
+
scrollbar-width: thin;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dark body {
|
|
12
|
+
scrollbar-color: var(--color-base-800) transparent;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@supports not (scrollbar-width: auto) {
|
|
17
|
+
body::-webkit-scrollbar {
|
|
18
|
+
width: 14px;
|
|
19
|
+
height: 14px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
body::-webkit-scrollbar-thumb {
|
|
24
|
+
background-color: var(--color-base-400);
|
|
25
|
+
border-radius: 20px;
|
|
26
|
+
border: 4px solid transparent;
|
|
27
|
+
background-clip: content-box;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
body::-webkit-scrollbar-thumb:hover {
|
|
31
|
+
background-color: var(--color-base-500);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Dark mode rules */
|
|
35
|
+
.dark body::-webkit-scrollbar-thumb {
|
|
36
|
+
background-color: var(--color-base-800);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.dark body::-webkit-scrollbar-thumb:hover {
|
|
40
|
+
background-color: var(--color-base-700);
|
|
41
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import { Select, type WithoutChildren } from 'bits-ui';
|
|
4
|
+
|
|
5
|
+
type Props = WithoutChildren<Select.RootProps> & {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
items: { value: string; label: string; disabled?: boolean }[];
|
|
8
|
+
contentProps?: WithoutChildren<Select.ContentProps>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
let { value = $bindable(), items, contentProps, placeholder, ...restProps }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const selectedLabel = $derived(items.find((item) => item.value === value)?.label);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Select.Root bind:value={value as never} {...restProps}>
|
|
17
|
+
<Select.Trigger>
|
|
18
|
+
<div
|
|
19
|
+
class="bg-accent-500/10 border-accent-700/20 text-accent-800 dark:text-accent-300 inline-flex min-w-28 items-center justify-between gap-1 rounded-2xl border px-3 py-1 font-medium"
|
|
20
|
+
>
|
|
21
|
+
{selectedLabel ? selectedLabel : placeholder}
|
|
22
|
+
|
|
23
|
+
<svg
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
fill="none"
|
|
26
|
+
viewBox="0 0 24 24"
|
|
27
|
+
stroke-width="2.5"
|
|
28
|
+
stroke="currentColor"
|
|
29
|
+
class="size-4"
|
|
30
|
+
>
|
|
31
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
|
|
32
|
+
</svg>
|
|
33
|
+
</div>
|
|
34
|
+
</Select.Trigger>
|
|
35
|
+
<Select.Portal>
|
|
36
|
+
<Select.Content
|
|
37
|
+
{...contentProps}
|
|
38
|
+
class={cn(
|
|
39
|
+
'bg-base-50/50 border-base-500/20 overflow-hidden rounded-2xl border shadow-lg backdrop-blur-xl',
|
|
40
|
+
'dark:bg-base-900/50 dark:border-base-500/10',
|
|
41
|
+
'motion-safe:animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
42
|
+
contentProps?.class
|
|
43
|
+
)}
|
|
44
|
+
sideOffset={6}
|
|
45
|
+
>
|
|
46
|
+
<Select.ScrollUpButton>up</Select.ScrollUpButton>
|
|
47
|
+
<Select.Viewport class="divide-base-300 dark:divide-base-800 divide-y text-sm">
|
|
48
|
+
{#each items as { value, label, disabled } (value)}
|
|
49
|
+
<Select.Item {value} {label} {disabled}>
|
|
50
|
+
{#snippet children({ selected })}
|
|
51
|
+
<div
|
|
52
|
+
class={cn(
|
|
53
|
+
'text-base-900 dark:text-base-200 group relative isolate flex min-w-28 cursor-pointer items-center gap-1 px-1 py-2 font-medium',
|
|
54
|
+
selected ? 'text-accent-700' : ''
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
{#if selected}
|
|
58
|
+
<svg
|
|
59
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
60
|
+
fill="none"
|
|
61
|
+
viewBox="0 0 24 24"
|
|
62
|
+
stroke-width="2.5"
|
|
63
|
+
stroke="currentColor"
|
|
64
|
+
class="size-4"
|
|
65
|
+
>
|
|
66
|
+
<path
|
|
67
|
+
stroke-linecap="round"
|
|
68
|
+
stroke-linejoin="round"
|
|
69
|
+
d="m4.5 12.75 6 6 9-13.5"
|
|
70
|
+
/>
|
|
71
|
+
</svg>
|
|
72
|
+
{:else}
|
|
73
|
+
<div class="size-4"></div>
|
|
74
|
+
|
|
75
|
+
<div
|
|
76
|
+
class="group-hover:bg-base-300/20 dark:group-hover:bg-base-700/20 absolute inset-0 -z-10"
|
|
77
|
+
></div>
|
|
78
|
+
{/if}
|
|
79
|
+
{label}
|
|
80
|
+
</div>
|
|
81
|
+
{/snippet}
|
|
82
|
+
</Select.Item>
|
|
83
|
+
{/each}
|
|
84
|
+
</Select.Viewport>
|
|
85
|
+
<Select.ScrollDownButton>down</Select.ScrollDownButton>
|
|
86
|
+
</Select.Content>
|
|
87
|
+
</Select.Portal>
|
|
88
|
+
</Select.Root>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Select, type WithoutChildren } from 'bits-ui';
|
|
2
|
+
type Props = WithoutChildren<Select.RootProps> & {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
items: {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}[];
|
|
9
|
+
contentProps?: WithoutChildren<Select.ContentProps>;
|
|
10
|
+
};
|
|
11
|
+
declare const Select: import("svelte").Component<Props, {}, "value">;
|
|
12
|
+
type Select = ReturnType<typeof Select>;
|
|
13
|
+
export default Select;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select, type WithoutChildren } from "bits-ui";
|
|
3
|
+
|
|
4
|
+
type Props = Select.RootProps & {
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
contentProps?: WithoutChildren<Select.ContentProps>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
value = $bindable(),
|
|
11
|
+
placeholder,
|
|
12
|
+
contentProps,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: Props = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Select.Root bind:value={value as never} {...props}>
|
|
19
|
+
<Select.Trigger>
|
|
20
|
+
{value}
|
|
21
|
+
</Select.Trigger>
|
|
22
|
+
<Select.Portal>
|
|
23
|
+
<Select.Content {...contentProps}>
|
|
24
|
+
<Select.Viewport>
|
|
25
|
+
{children?.()}
|
|
26
|
+
</Select.Viewport>
|
|
27
|
+
</Select.Content>
|
|
28
|
+
</Select.Portal>
|
|
29
|
+
</Select.Root>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Select, type WithoutChildren } from "bits-ui";
|
|
2
|
+
type Props = Select.RootProps & {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
contentProps?: WithoutChildren<Select.ContentProps>;
|
|
5
|
+
};
|
|
6
|
+
declare const SelectChildren: import("svelte").Component<Props, {}, "value">;
|
|
7
|
+
type SelectChildren = ReturnType<typeof SelectChildren>;
|
|
8
|
+
export default SelectChildren;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import { Select } from 'bits-ui';
|
|
4
|
+
|
|
5
|
+
let { value = $bindable(), label, children: myChildren, ...props }: Select.ItemProps = $props();
|
|
6
|
+
|
|
7
|
+
console.log(value);
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Select.Item {value} {label} {...props}>
|
|
11
|
+
{#snippet children(props)}
|
|
12
|
+
{#if props.selected}
|
|
13
|
+
<svg
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
fill="none"
|
|
16
|
+
viewBox="0 0 24 24"
|
|
17
|
+
stroke-width="1.5"
|
|
18
|
+
stroke="currentColor"
|
|
19
|
+
class="size-6"
|
|
20
|
+
>
|
|
21
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" />
|
|
22
|
+
</svg>
|
|
23
|
+
{/if}
|
|
24
|
+
|
|
25
|
+
{#if myChildren}
|
|
26
|
+
{@render myChildren?.(props)}
|
|
27
|
+
{:else}
|
|
28
|
+
{label}
|
|
29
|
+
{/if}
|
|
30
|
+
{/snippet}
|
|
31
|
+
</Select.Item>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Toolbar, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
|
|
4
|
+
type Item =
|
|
5
|
+
| {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
| string;
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
ref = $bindable(null),
|
|
13
|
+
|
|
14
|
+
class: className,
|
|
15
|
+
items = $bindable([]),
|
|
16
|
+
selected = $bindable(),
|
|
17
|
+
|
|
18
|
+
...restProps
|
|
19
|
+
}: WithoutChildrenOrChild<Toolbar.RootProps> & {
|
|
20
|
+
selected?: string;
|
|
21
|
+
items: Item[];
|
|
22
|
+
} = $props();
|
|
23
|
+
|
|
24
|
+
if (!selected) {
|
|
25
|
+
selected = typeof items[0] === 'string' ? items[0] : items[0].value;
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<Toolbar.Root bind:ref class={className} {...restProps}>
|
|
30
|
+
<Toolbar.Group bind:value={selected} type="single" class="flex items-center gap-x-1 text-sm">
|
|
31
|
+
{#each items as item}
|
|
32
|
+
<Toolbar.GroupItem
|
|
33
|
+
aria-label="align left"
|
|
34
|
+
value={typeof item === 'string' ? item : item.value}
|
|
35
|
+
class={[
|
|
36
|
+
'inline-flex cursor-pointer items-center justify-center rounded-2xl p-1 px-2 transition-all',
|
|
37
|
+
'text-base-600 hover:text-accent-600 dark:text-base-300 dark:hover:text-accent-400 outline-accent-300',
|
|
38
|
+
'dark:outline-accent-500/30 data-[state=on]:text-accent-600 dark:data-[state=on]:text-accent-400',
|
|
39
|
+
'dark:data-[state=on]:bg-accent-700/10 data-[state=on]:bg-accent-500/10 data-[state=on]:outline'
|
|
40
|
+
]}
|
|
41
|
+
>
|
|
42
|
+
{typeof item === 'string' ? item : item.label}
|
|
43
|
+
</Toolbar.GroupItem>
|
|
44
|
+
{/each}
|
|
45
|
+
</Toolbar.Group>
|
|
46
|
+
</Toolbar.Root>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Toolbar, type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
|
+
type Item = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
} | string;
|
|
6
|
+
type $$ComponentProps = WithoutChildrenOrChild<Toolbar.RootProps> & {
|
|
7
|
+
selected?: string;
|
|
8
|
+
items: Item[];
|
|
9
|
+
};
|
|
10
|
+
declare const Select: import("svelte").Component<$$ComponentProps, {}, "ref" | "items" | "selected">;
|
|
11
|
+
type Select = ReturnType<typeof Select>;
|
|
12
|
+
export default Select;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Select } from './Select.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Select } from './Select.svelte';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
import { ScrollArea } from '../scroll-area';
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
class: className,
|
|
9
|
+
mobileClasses,
|
|
10
|
+
children,
|
|
11
|
+
mobileOnly = false,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
14
|
+
mobileClasses?: string;
|
|
15
|
+
mobileOnly?: boolean;
|
|
16
|
+
} = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div
|
|
20
|
+
popover="auto"
|
|
21
|
+
id="mobile-menu"
|
|
22
|
+
class={cn(
|
|
23
|
+
'mobileMenuPopover border-base-200 bg-white/70 dark:border-base-300/10 dark:bg-base-950/50 my-2 ml-2 overflow-y-hidden rounded-2xl',
|
|
24
|
+
'inset-auto left-0 top-0 block h-[calc(100dvh-1rem)] w-72 border shadow-lg lg:hidden backdrop-blur-xl',
|
|
25
|
+
className,
|
|
26
|
+
mobileClasses
|
|
27
|
+
)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
30
|
+
<ScrollArea orientation="vertical" class="h-screen">
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</ScrollArea>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
{#if !mobileOnly}
|
|
36
|
+
<div
|
|
37
|
+
class={cn(
|
|
38
|
+
'border-base-200 bg-base-50/50 dark:border-base-300/10 dark:bg-base-950/50 backdrop-blur-xl fixed my-1 ml-0.5 overflow-y-hidden rounded-2xl',
|
|
39
|
+
'inset-auto left-1 top-0 z-50 block h-[calc(100dvh-0.5rem)] w-72 border shadow-lg lg:hidden',
|
|
40
|
+
'hidden -translate-x-72 border lg:block lg:w-72 lg:translate-x-0',
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...restProps}
|
|
44
|
+
>
|
|
45
|
+
<ScrollArea orientation="vertical" class="h-screen overflow-y-scroll">
|
|
46
|
+
{@render children?.()}
|
|
47
|
+
</ScrollArea>
|
|
48
|
+
</div>
|
|
49
|
+
{/if}
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.mobileMenuPopover {
|
|
53
|
+
/* Closed state transformed off the screen */
|
|
54
|
+
transform: translateX(-110%);
|
|
55
|
+
transition:
|
|
56
|
+
transform 0.1s,
|
|
57
|
+
overlay 0.1s ease-out;
|
|
58
|
+
|
|
59
|
+
/* Styles while the menu is open */
|
|
60
|
+
&:popover-open {
|
|
61
|
+
transform: translateX(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Backdrop that overlays other content */
|
|
65
|
+
&::backdrop {
|
|
66
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WithElementRef } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
|
+
mobileClasses?: string;
|
|
5
|
+
mobileOnly?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const Sidebar: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Sidebar = ReturnType<typeof Sidebar>;
|
|
9
|
+
export default Sidebar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Sidebar } from './Sidebar.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Sidebar } from './Sidebar.svelte';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Slider as SliderPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../utils';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(),
|
|
8
|
+
orientation = 'horizontal',
|
|
9
|
+
class: className,
|
|
10
|
+
tabindex = undefined,
|
|
11
|
+
type = 'single',
|
|
12
|
+
min = 0,
|
|
13
|
+
max = 100,
|
|
14
|
+
...props
|
|
15
|
+
}: WithoutChildrenOrChild<SliderPrimitive.RootProps> = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<!--
|
|
19
|
+
Discriminated Unions + Destructing (required for bindable) do not
|
|
20
|
+
get along, so we shut typescript up by casting `value` to `never`.
|
|
21
|
+
-->
|
|
22
|
+
<SliderPrimitive.Root
|
|
23
|
+
bind:ref
|
|
24
|
+
bind:value={value}
|
|
25
|
+
{orientation}
|
|
26
|
+
class={cn(
|
|
27
|
+
"relative flex touch-none items-center select-none data-[orientation='horizontal']:w-full data-[orientation='vertical']:h-full",
|
|
28
|
+
"data-[orientation='vertical']:min-h-44 data-[orientation='vertical']:w-auto data-[orientation='vertical']:flex-col",
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{tabindex}
|
|
32
|
+
{type}
|
|
33
|
+
{min}
|
|
34
|
+
{max}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{#snippet children({ thumbs })}
|
|
38
|
+
<span
|
|
39
|
+
data-orientation={orientation}
|
|
40
|
+
class={[
|
|
41
|
+
"relative grow overflow-hidden rounded-full data-[orientation='horizontal']:h-2 data-[orientation='horizontal']:w-full",
|
|
42
|
+
"data-[orientation='vertical']:h-full data-[orientation='vertical']:w-2"
|
|
43
|
+
]}
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
class="bg-base-300/30 dark:bg-base-800 border-base-400/50 dark:border-base-700 absolute inset-0 rounded-full border"
|
|
47
|
+
></div>
|
|
48
|
+
|
|
49
|
+
<SliderPrimitive.Range
|
|
50
|
+
class="bg-accent-400 dark:bg-accent-600 absolute rounded-full data-[orientation='horizontal']:h-full data-[orientation='vertical']:w-full"
|
|
51
|
+
/>
|
|
52
|
+
</span>
|
|
53
|
+
{#each thumbs as thumb}
|
|
54
|
+
<SliderPrimitive.Thumb
|
|
55
|
+
index={thumb}
|
|
56
|
+
class={[
|
|
57
|
+
'border-accent-400 dark:border-accent-600 bg-accent-600 dark:bg-accent-800 focus-visible:outline-base-900',
|
|
58
|
+
'dark:focus-visible:outline-base-100 block size-6 rounded-full border-2 transition-colors focus-visible:outline-2 ',
|
|
59
|
+
'focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50'
|
|
60
|
+
]}
|
|
61
|
+
{tabindex}
|
|
62
|
+
/>
|
|
63
|
+
{/each}
|
|
64
|
+
{/snippet}
|
|
65
|
+
</SliderPrimitive.Root>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Slider as SliderPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
import { Slider } from '.';
|
|
4
|
+
import NumberFlow from '@number-flow/svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
orientation = 'horizontal',
|
|
10
|
+
class: className,
|
|
11
|
+
tabindex = undefined,
|
|
12
|
+
type = 'single',
|
|
13
|
+
min = 0,
|
|
14
|
+
max = 100,
|
|
15
|
+
...props
|
|
16
|
+
}: WithoutChildrenOrChild<SliderPrimitive.RootProps> = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div class="flex items-center gap-6">
|
|
20
|
+
<Slider
|
|
21
|
+
bind:value
|
|
22
|
+
bind:ref
|
|
23
|
+
{orientation}
|
|
24
|
+
class={className}
|
|
25
|
+
{tabindex}
|
|
26
|
+
{type}
|
|
27
|
+
{min}
|
|
28
|
+
{max}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<NumberFlow
|
|
33
|
+
{value}
|
|
34
|
+
locales="en-US"
|
|
35
|
+
format={{ useGrouping: false }}
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
class="text-base-900 dark:text-base-100 pointer-events-none min-w-6 text-right text-lg font-semibold"
|
|
38
|
+
willChange
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Slider as SliderPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
|
+
declare const SliderNumber: import("svelte").Component<WithoutChildrenOrChild<SliderPrimitive.RootProps>, {}, "ref" | "value">;
|
|
3
|
+
type SliderNumber = ReturnType<typeof SliderNumber>;
|
|
4
|
+
export default SliderNumber;
|