@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License Copyright (c) 2025 flo-bit
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of
|
|
4
|
+
charge, to any person obtaining a copy of this software and associated
|
|
5
|
+
documentation files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use, copy, modify, merge,
|
|
7
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice
|
|
12
|
+
(including the next paragraph) shall be included in all copies or substantial
|
|
13
|
+
portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
18
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
19
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 🦊 fox ui
|
|
2
|
+
|
|
3
|
+
This package has been moved to `@foxui/core`.
|
|
4
|
+
|
|
5
|
+
svelte 5 + tailwind 4 ui kit, base components
|
|
6
|
+
|
|
7
|
+
- [Accordion](https://flo-bit.dev/ui-kit/components/base/accordion)
|
|
8
|
+
- [Alert](https://flo-bit.dev/ui-kit/components/base/alert)
|
|
9
|
+
- [Avatar](https://flo-bit.dev/ui-kit/components/base/avatar)
|
|
10
|
+
- [Badge](https://flo-bit.dev/ui-kit/components/base/badge)
|
|
11
|
+
- [Box](https://flo-bit.dev/ui-kit/components/base/box)
|
|
12
|
+
- [Button](https://flo-bit.dev/ui-kit/components/base/button)
|
|
13
|
+
- [Card](https://flo-bit.dev/ui-kit/components/base/cards)
|
|
14
|
+
- [Chat Bubble](https://flo-bit.dev/ui-kit/components/base/chat-bubble)
|
|
15
|
+
- [Checkbox](https://flo-bit.dev/ui-kit/components/base/checkbox)
|
|
16
|
+
- [Head](https://flo-bit.dev/ui-kit/components/base/head)
|
|
17
|
+
- [Heading](https://flo-bit.dev/ui-kit/components/base/image)
|
|
18
|
+
- [Modals](https://flo-bit.dev/ui-kit/components/base/modal)
|
|
19
|
+
- [Number Input](https://flo-bit.dev/ui-kit/components/base/number-input)
|
|
20
|
+
- [Popover](https://flo-bit.dev/ui-kit/components/base/popover)
|
|
21
|
+
- [Prose](https://flo-bit.dev/ui-kit/components/base/prose)
|
|
22
|
+
- [Scroll Area](https://flo-bit.dev/ui-kit/components/base/scroll-area)
|
|
23
|
+
- [Select](https://flo-bit.dev/ui-kit/components/base/select)
|
|
24
|
+
- [Sidebar](https://flo-bit.dev/ui-kit/components/base/sidebar)
|
|
25
|
+
- [Slider](https://flo-bit.dev/ui-kit/components/base/slider)
|
|
26
|
+
- [Sonner](https://flo-bit.dev/ui-kit/components/base/sonner)
|
|
27
|
+
- [Switch](https://flo-bit.dev/ui-kit/components/base/switch)
|
|
28
|
+
- [Tabs](https://flo-bit.dev/ui-kit/components/base/tabs)
|
|
29
|
+
- [Textarea](https://flo-bit.dev/ui-kit/components/base/textarea)
|
|
30
|
+
- [Toggle](https://flo-bit.dev/ui-kit/components/base/toggle)
|
|
31
|
+
- [Toggle Group](https://flo-bit.dev/ui-kit/components/base/toggle-group)
|
|
32
|
+
- [Tooltip](https://flo-bit.dev/ui-kit/components/base/tooltip)
|
|
33
|
+
|
|
34
|
+
> **This is a public alpha release. Expect bugs and breaking changes.**
|
|
35
|
+
|
|
36
|
+
[See all components here](https://flo-bit.dev/ui-kit)
|
|
37
|
+
|
|
38
|
+
For a guide on how to use this ui kit, see the [Quickstart Guide](https://flo-bit.dev/ui-kit/docs/quick-start).
|
|
39
|
+
|
|
40
|
+
Read more about [the philosophy/aim of this project here](https://flo-bit.dev/ui-kit/docs/philosophy).
|
|
41
|
+
|
|
42
|
+
For more information about development, contributing and the like, see the main [README](https://github.com/flo-bit/ui-kit/blob/main/README.md).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive, type WithoutChild } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../utils';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChild<AccordionPrimitive.ContentProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AccordionPrimitive.Content
|
|
14
|
+
bind:ref
|
|
15
|
+
class={cn(
|
|
16
|
+
'text-base-800 dark:text-base-200 overflow-hidden pt-2 pb-4 text-sm transition-all',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</AccordionPrimitive.Content>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
2
|
+
declare const AccordionContent: import("svelte").Component<Omit<AccordionPrimitive.ContentProps, "child">, {}, "ref">;
|
|
3
|
+
type AccordionContent = ReturnType<typeof AccordionContent>;
|
|
4
|
+
export default AccordionContent;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
3
|
+
import AccordionContent from './accordion-content.svelte';
|
|
4
|
+
import { AccordionTrigger } from '.';
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
title,
|
|
11
|
+
children,
|
|
12
|
+
contentClasses,
|
|
13
|
+
triggerClasses,
|
|
14
|
+
...restProps
|
|
15
|
+
}: AccordionPrimitive.ItemProps & {
|
|
16
|
+
title?: string;
|
|
17
|
+
contentClasses?: string;
|
|
18
|
+
triggerClasses?: string;
|
|
19
|
+
} = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<AccordionPrimitive.Item
|
|
23
|
+
bind:ref
|
|
24
|
+
class={cn('border-base-200 dark:border-base-900 border-b', className)}
|
|
25
|
+
{...restProps}
|
|
26
|
+
>
|
|
27
|
+
{#if title}
|
|
28
|
+
<AccordionTrigger class={triggerClasses}>{title}</AccordionTrigger>
|
|
29
|
+
<AccordionContent class={contentClasses}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</AccordionContent>
|
|
32
|
+
{:else}
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
{/if}
|
|
35
|
+
</AccordionPrimitive.Item>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
2
|
+
type $$ComponentProps = AccordionPrimitive.ItemProps & {
|
|
3
|
+
title?: string;
|
|
4
|
+
contentClasses?: string;
|
|
5
|
+
triggerClasses?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const AccordionItem: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
8
|
+
type AccordionItem = ReturnType<typeof AccordionItem>;
|
|
9
|
+
export default AccordionItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive, type WithoutChild } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../utils';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
level = 3,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChild<AccordionPrimitive.TriggerProps> & {
|
|
12
|
+
level?: AccordionPrimitive.HeaderProps['level'];
|
|
13
|
+
} = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<AccordionPrimitive.Header {level} class="flex w-full">
|
|
17
|
+
<AccordionPrimitive.Trigger
|
|
18
|
+
bind:ref
|
|
19
|
+
class={cn(
|
|
20
|
+
'focus-visible:outline-base-900 dark:focus-visible:outline-base-50 text-base-950 dark:text-base-50 hover:text-accent-600 dark:hover:text-accent-400 my-2 flex w-full flex-1 cursor-pointer items-center justify-between gap-2 rounded-2xl py-2 font-medium transition-all focus-visible:outline-2 focus-visible:outline-offset-2 [&[data-state=open]>svg]:rotate-180',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...restProps}
|
|
24
|
+
>
|
|
25
|
+
{@render children?.()}
|
|
26
|
+
|
|
27
|
+
<svg
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
viewBox="0 0 24 24"
|
|
30
|
+
fill="currentColor"
|
|
31
|
+
class="size-4 shrink-0 transition-transform duration-200"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
fill-rule="evenodd"
|
|
35
|
+
d="M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z"
|
|
36
|
+
clip-rule="evenodd"
|
|
37
|
+
/>
|
|
38
|
+
</svg>
|
|
39
|
+
</AccordionPrimitive.Trigger>
|
|
40
|
+
</AccordionPrimitive.Header>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive, type WithoutChild } from 'bits-ui';
|
|
2
|
+
type $$ComponentProps = WithoutChild<AccordionPrimitive.TriggerProps> & {
|
|
3
|
+
level?: AccordionPrimitive.HeaderProps['level'];
|
|
4
|
+
};
|
|
5
|
+
declare const AccordionTrigger: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
6
|
+
type AccordionTrigger = ReturnType<typeof AccordionTrigger>;
|
|
7
|
+
export default AccordionTrigger;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
2
|
+
import Content from './accordion-content.svelte';
|
|
3
|
+
import Item from './accordion-item.svelte';
|
|
4
|
+
import Trigger from './accordion-trigger.svelte';
|
|
5
|
+
declare const Root: import("svelte").Component<AccordionPrimitive.RootProps, {}, "ref" | "value">;
|
|
6
|
+
export { Root as Accordion, Content as AccordionContent, Item as AccordionItem, Trigger as AccordionTrigger };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from 'bits-ui';
|
|
2
|
+
import Content from './accordion-content.svelte';
|
|
3
|
+
import Item from './accordion-item.svelte';
|
|
4
|
+
import Trigger from './accordion-trigger.svelte';
|
|
5
|
+
const Root = AccordionPrimitive.Root;
|
|
6
|
+
export { Root as Accordion, Content as AccordionContent, Item as AccordionItem, Trigger as AccordionTrigger };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import type { WithElementRef } from 'bits-ui';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div bind:this={ref} class={cn('text-xs', className)} {...restProps}>
|
|
15
|
+
{@render children?.()}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WithElementRef } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const AlertDescription: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type AlertDescription = ReturnType<typeof AlertDescription>;
|
|
5
|
+
export default AlertDescription;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { WithElementRef } from 'bits-ui';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
level = 5,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
13
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
role="heading"
|
|
19
|
+
aria-level={level}
|
|
20
|
+
bind:this={ref}
|
|
21
|
+
class={cn('mb-2 text-sm leading-none font-medium last:mb-0', className)}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
};
|
|
6
|
+
declare const AlertTitle: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
7
|
+
type AlertTitle = ReturnType<typeof AlertTitle>;
|
|
8
|
+
export default AlertTitle;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const alertVariants = tv({
|
|
5
|
+
base: 'text-xs relative w-full rounded-2xl border p-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:size-4 [&>svg~*]:pl-7 ',
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default:
|
|
9
|
+
'bg-accent-500/10 [&>div:first-of-type]:text-accent-700 [&>svg]:text-accent-600 dark:[&>svg]:text-accent-500 dark:[&>div:first-of-type]:text-accent-400 dark:bg-accent-500/5 text-accent-600 dark:text-accent-400 border-accent-500/20 dark:border-accent-500/10',
|
|
10
|
+
secondary:
|
|
11
|
+
'bg-base-500/10 [&>div:first-of-type]:text-base-700 [&>svg]:text-base-600 dark:[&>svg]:text-base-400 dark:[&>div:first-of-type]:text-base-300 dark:bg-base-500/5 text-base-600 dark:text-base-400 border-base-500/20 dark:border-base-500/10',
|
|
12
|
+
red: 'bg-red-500/10 [&>div:first-of-type]:text-red-700 [&>svg]:text-red-600 dark:[&>svg]:text-red-500 dark:[&>div:first-of-type]:text-red-400 dark:bg-red-500/5 text-red-600 dark:text-red-400 border-red-500/20 dark:border-red-500/10',
|
|
13
|
+
orange:
|
|
14
|
+
'bg-orange-500/10 [&>div:first-of-type]:text-orange-700 [&>svg]:text-orange-600 dark:[&>svg]:text-orange-500 dark:[&>div:first-of-type]:text-orange-400 dark:bg-orange-500/5 text-orange-600 dark:text-orange-400 border-orange-500/20 dark:border-orange-500/10',
|
|
15
|
+
amber:
|
|
16
|
+
'bg-amber-500/10 [&>div:first-of-type]:text-amber-700 [&>svg]:text-amber-600 dark:[&>svg]:text-amber-500 dark:[&>div:first-of-type]:text-amber-400 dark:bg-amber-500/5 text-amber-600 dark:text-amber-400 border-amber-500/20 dark:border-amber-500/10',
|
|
17
|
+
yellow:
|
|
18
|
+
'bg-yellow-500/10 [&>div:first-of-type]:text-yellow-700 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-500 dark:[&>div:first-of-type]:text-yellow-400 dark:bg-yellow-500/5 text-yellow-600 dark:text-yellow-400 border-yellow-500/20 dark:border-yellow-500/10',
|
|
19
|
+
lime: 'bg-lime-500/10 [&>div:first-of-type]:text-lime-700 [&>svg]:text-lime-600 dark:[&>svg]:text-lime-500 dark:[&>div:first-of-type]:text-lime-400 dark:bg-lime-500/5 text-lime-600 dark:text-lime-400 border-lime-500/20 dark:border-lime-500/10',
|
|
20
|
+
green:
|
|
21
|
+
'bg-green-500/10 [&>div:first-of-type]:text-green-700 [&>svg]:text-green-600 dark:[&>svg]:text-green-500 dark:[&>div:first-of-type]:text-green-400 dark:bg-green-500/5 text-green-600 dark:text-green-400 border-green-500/20 dark:border-green-500/10',
|
|
22
|
+
emerald:
|
|
23
|
+
'bg-emerald-500/10 [&>div:first-of-type]:text-emerald-700 [&>svg]:text-emerald-600 dark:[&>svg]:text-emerald-500 dark:[&>div:first-of-type]:text-emerald-400 dark:bg-emerald-500/5 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 dark:border-emerald-500/10',
|
|
24
|
+
teal: 'bg-teal-500/10 [&>div:first-of-type]:text-teal-700 [&>svg]:text-teal-600 dark:[&>svg]:text-teal-500 dark:[&>div:first-of-type]:text-teal-400 dark:bg-teal-500/5 text-teal-600 dark:text-teal-400 border-teal-500/20 dark:border-teal-500/10',
|
|
25
|
+
cyan: 'bg-cyan-500/10 [&>div:first-of-type]:text-cyan-700 [&>svg]:text-cyan-600 dark:[&>svg]:text-cyan-500 dark:[&>div:first-of-type]:text-cyan-400 dark:bg-cyan-500/5 text-cyan-600 dark:text-cyan-400 border-cyan-500/20 dark:border-cyan-500/10',
|
|
26
|
+
sky: 'bg-sky-500/10 [&>div:first-of-type]:text-sky-700 [&>svg]:text-sky-600 dark:[&>svg]:text-sky-500 dark:[&>div:first-of-type]:text-sky-400 dark:bg-sky-500/5 text-sky-600 dark:text-sky-400 border-sky-500/20 dark:border-sky-500/10',
|
|
27
|
+
blue: 'bg-blue-500/10 [&>div:first-of-type]:text-blue-700 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-500 dark:[&>div:first-of-type]:text-blue-400 dark:bg-blue-500/5 text-blue-600 dark:text-blue-400 border-blue-500/20 dark:border-blue-500/10',
|
|
28
|
+
indigo:
|
|
29
|
+
'bg-indigo-500/10 [&>div:first-of-type]:text-indigo-700 [&>svg]:text-indigo-600 dark:[&>svg]:text-indigo-500 dark:[&>div:first-of-type]:text-indigo-400 dark:bg-indigo-500/5 text-indigo-600 dark:text-indigo-400 border-indigo-500/20 dark:border-indigo-500/10',
|
|
30
|
+
violet:
|
|
31
|
+
'bg-violet-500/10 [&>div:first-of-type]:text-violet-700 [&>svg]:text-violet-600 dark:[&>svg]:text-violet-500 dark:[&>div:first-of-type]:text-violet-400 dark:bg-violet-500/5 text-violet-600 dark:text-violet-400 border-violet-500/20 dark:border-violet-500/10',
|
|
32
|
+
purple:
|
|
33
|
+
'bg-purple-500/10 [&>div:first-of-type]:text-purple-700 [&>svg]:text-purple-600 dark:[&>svg]:text-purple-500 dark:[&>div:first-of-type]:text-purple-400 dark:bg-purple-500/5 text-purple-600 dark:text-purple-400 border-purple-500/20 dark:border-purple-500/10',
|
|
34
|
+
fuchsia:
|
|
35
|
+
'bg-fuchsia-500/10 [&>div:first-of-type]:text-fuchsia-700 [&>svg]:text-fuchsia-600 dark:[&>svg]:text-fuchsia-500 dark:[&>div:first-of-type]:text-fuchsia-400 dark:bg-fuchsia-500/5 text-fuchsia-600 dark:text-fuchsia-400 border-fuchsia-500/20 dark:border-fuchsia-500/10',
|
|
36
|
+
pink: 'bg-pink-500/10 [&>div:first-of-type]:text-pink-700 [&>svg]:text-pink-600 dark:[&>svg]:text-pink-500 dark:[&>div:first-of-type]:text-pink-400 dark:bg-pink-500/5 text-pink-600 dark:text-pink-400 border-pink-500/20 dark:border-pink-500/10',
|
|
37
|
+
rose: 'bg-rose-500/10 [&>div:first-of-type]:text-rose-700 [&>svg]:text-rose-600 dark:[&>svg]:text-rose-500 dark:[&>div:first-of-type]:text-rose-400 dark:bg-rose-500/5 text-rose-600 dark:text-rose-400 border-rose-500/20 dark:border-rose-500/10'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
variant: 'default'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type AlertVariant = VariantProps<typeof alertVariants>['variant'];
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<script lang="ts">
|
|
49
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
50
|
+
import type { WithElementRef } from 'bits-ui';
|
|
51
|
+
import { AlertTitle } from '.';
|
|
52
|
+
import { cn } from '../../utils';
|
|
53
|
+
|
|
54
|
+
let {
|
|
55
|
+
ref = $bindable(null),
|
|
56
|
+
class: className,
|
|
57
|
+
variant = undefined,
|
|
58
|
+
title,
|
|
59
|
+
type,
|
|
60
|
+
children,
|
|
61
|
+
...restProps
|
|
62
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
63
|
+
variant?: AlertVariant;
|
|
64
|
+
title?: string;
|
|
65
|
+
type?: 'info' | 'warning' | 'success' | 'error';
|
|
66
|
+
} = $props();
|
|
67
|
+
|
|
68
|
+
if (type === 'warning' && variant === undefined) {
|
|
69
|
+
variant = 'amber';
|
|
70
|
+
} else if (type === 'error' && variant === undefined) {
|
|
71
|
+
variant = 'red';
|
|
72
|
+
} else if (type === 'success' && variant === undefined) {
|
|
73
|
+
variant = 'green';
|
|
74
|
+
} else if (type === 'info' && variant === undefined) {
|
|
75
|
+
variant = 'sky';
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<div
|
|
80
|
+
bind:this={ref}
|
|
81
|
+
class={cn(alertVariants({ variant: variant ?? 'default' }), className)}
|
|
82
|
+
{...restProps}
|
|
83
|
+
role="alert"
|
|
84
|
+
>
|
|
85
|
+
{#if type === 'warning'}
|
|
86
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
|
87
|
+
<path
|
|
88
|
+
fill-rule="evenodd"
|
|
89
|
+
d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z"
|
|
90
|
+
clip-rule="evenodd"
|
|
91
|
+
/>
|
|
92
|
+
</svg>
|
|
93
|
+
{:else if type === 'success'}
|
|
94
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
|
95
|
+
<path
|
|
96
|
+
fill-rule="evenodd"
|
|
97
|
+
d="M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z"
|
|
98
|
+
clip-rule="evenodd"
|
|
99
|
+
/>
|
|
100
|
+
</svg>
|
|
101
|
+
{:else if type === 'info'}
|
|
102
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
|
103
|
+
<path
|
|
104
|
+
fill-rule="evenodd"
|
|
105
|
+
d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z"
|
|
106
|
+
clip-rule="evenodd"
|
|
107
|
+
/>
|
|
108
|
+
</svg>
|
|
109
|
+
{:else if type === 'error'}
|
|
110
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
|
|
111
|
+
<path
|
|
112
|
+
fill-rule="evenodd"
|
|
113
|
+
d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z"
|
|
114
|
+
clip-rule="evenodd"
|
|
115
|
+
/>
|
|
116
|
+
</svg>
|
|
117
|
+
{/if}
|
|
118
|
+
{#if title}
|
|
119
|
+
<AlertTitle>{title}</AlertTitle>
|
|
120
|
+
{/if}
|
|
121
|
+
{@render children?.()}
|
|
122
|
+
</div>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const alertVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
variant: {
|
|
4
|
+
default: string;
|
|
5
|
+
secondary: string;
|
|
6
|
+
red: string;
|
|
7
|
+
orange: string;
|
|
8
|
+
amber: string;
|
|
9
|
+
yellow: string;
|
|
10
|
+
lime: string;
|
|
11
|
+
green: string;
|
|
12
|
+
emerald: string;
|
|
13
|
+
teal: string;
|
|
14
|
+
cyan: string;
|
|
15
|
+
sky: string;
|
|
16
|
+
blue: string;
|
|
17
|
+
indigo: string;
|
|
18
|
+
violet: string;
|
|
19
|
+
purple: string;
|
|
20
|
+
fuchsia: string;
|
|
21
|
+
pink: string;
|
|
22
|
+
rose: string;
|
|
23
|
+
};
|
|
24
|
+
}, undefined, "text-xs relative w-full rounded-2xl border p-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:size-4 [&>svg~*]:pl-7 ", {
|
|
25
|
+
variant: {
|
|
26
|
+
default: string;
|
|
27
|
+
secondary: string;
|
|
28
|
+
red: string;
|
|
29
|
+
orange: string;
|
|
30
|
+
amber: string;
|
|
31
|
+
yellow: string;
|
|
32
|
+
lime: string;
|
|
33
|
+
green: string;
|
|
34
|
+
emerald: string;
|
|
35
|
+
teal: string;
|
|
36
|
+
cyan: string;
|
|
37
|
+
sky: string;
|
|
38
|
+
blue: string;
|
|
39
|
+
indigo: string;
|
|
40
|
+
violet: string;
|
|
41
|
+
purple: string;
|
|
42
|
+
fuchsia: string;
|
|
43
|
+
pink: string;
|
|
44
|
+
rose: string;
|
|
45
|
+
};
|
|
46
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
47
|
+
variant: {
|
|
48
|
+
default: string;
|
|
49
|
+
secondary: string;
|
|
50
|
+
red: string;
|
|
51
|
+
orange: string;
|
|
52
|
+
amber: string;
|
|
53
|
+
yellow: string;
|
|
54
|
+
lime: string;
|
|
55
|
+
green: string;
|
|
56
|
+
emerald: string;
|
|
57
|
+
teal: string;
|
|
58
|
+
cyan: string;
|
|
59
|
+
sky: string;
|
|
60
|
+
blue: string;
|
|
61
|
+
indigo: string;
|
|
62
|
+
violet: string;
|
|
63
|
+
purple: string;
|
|
64
|
+
fuchsia: string;
|
|
65
|
+
pink: string;
|
|
66
|
+
rose: string;
|
|
67
|
+
};
|
|
68
|
+
}, undefined, "text-xs relative w-full rounded-2xl border p-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:size-4 [&>svg~*]:pl-7 ", unknown, unknown, undefined>>;
|
|
69
|
+
export type AlertVariant = VariantProps<typeof alertVariants>['variant'];
|
|
70
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
71
|
+
import type { WithElementRef } from 'bits-ui';
|
|
72
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
73
|
+
variant?: AlertVariant;
|
|
74
|
+
title?: string;
|
|
75
|
+
type?: 'info' | 'warning' | 'success' | 'error';
|
|
76
|
+
};
|
|
77
|
+
declare const Alert: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
78
|
+
type Alert = ReturnType<typeof Alert>;
|
|
79
|
+
export default Alert;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from './alert.svelte';
|
|
2
|
+
import Description from './alert-description.svelte';
|
|
3
|
+
import Title from './alert-title.svelte';
|
|
4
|
+
export { alertVariants, type AlertVariant } from './alert.svelte';
|
|
5
|
+
export { Root as Alert, Description as AlertDescription, Title as AlertTitle };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import { Avatar as AvatarPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
4
|
+
import { Image } from '../image';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
src,
|
|
8
|
+
alt,
|
|
9
|
+
fallback,
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
|
|
12
|
+
imageRef = $bindable(null),
|
|
13
|
+
imageClass,
|
|
14
|
+
|
|
15
|
+
fallbackRef = $bindable(null),
|
|
16
|
+
fallbackClass,
|
|
17
|
+
|
|
18
|
+
useThemeColor = false,
|
|
19
|
+
|
|
20
|
+
class: className,
|
|
21
|
+
...restProps
|
|
22
|
+
}: WithoutChildrenOrChild<AvatarPrimitive.RootProps> & {
|
|
23
|
+
fallback?: string;
|
|
24
|
+
imageRef?: HTMLImageElement | null;
|
|
25
|
+
imageClass?: string;
|
|
26
|
+
fallbackRef?: HTMLElement | null;
|
|
27
|
+
fallbackClass?: string;
|
|
28
|
+
|
|
29
|
+
src?: string;
|
|
30
|
+
alt?: string;
|
|
31
|
+
|
|
32
|
+
useThemeColor?: boolean;
|
|
33
|
+
} = $props();
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div
|
|
37
|
+
class={cn(
|
|
38
|
+
'border-base-300 bg-base-200 text-base-900 dark:border-base-800 dark:bg-base-900 dark:text-base-50 relative isolate flex size-10 shrink-0 overflow-hidden rounded-full border',
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...restProps}
|
|
42
|
+
bind:this={ref}
|
|
43
|
+
>
|
|
44
|
+
{#if fallback}
|
|
45
|
+
<span class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 font-medium"
|
|
46
|
+
>{fallback}</span
|
|
47
|
+
>
|
|
48
|
+
{:else}
|
|
49
|
+
<svg
|
|
50
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
+
viewBox="0 0 24 24"
|
|
52
|
+
fill="currentColor"
|
|
53
|
+
class="text-base-400 dark:text-base-600 absolute top-1/2 left-1/2 mt-[15%] size-full -translate-x-1/2 -translate-y-1/2"
|
|
54
|
+
>
|
|
55
|
+
<path
|
|
56
|
+
fill-rule="evenodd"
|
|
57
|
+
d="M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z"
|
|
58
|
+
clip-rule="evenodd"
|
|
59
|
+
/>
|
|
60
|
+
</svg>
|
|
61
|
+
{/if}
|
|
62
|
+
{#if src}
|
|
63
|
+
<Image
|
|
64
|
+
{src}
|
|
65
|
+
alt={alt ?? ''}
|
|
66
|
+
{useThemeColor}
|
|
67
|
+
class="z-10 aspect-square size-full object-cover"
|
|
68
|
+
onerror={() => {
|
|
69
|
+
imageRef?.classList.add('hidden');
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Avatar as AvatarPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
|
+
type $$ComponentProps = WithoutChildrenOrChild<AvatarPrimitive.RootProps> & {
|
|
3
|
+
fallback?: string;
|
|
4
|
+
imageRef?: HTMLImageElement | null;
|
|
5
|
+
imageClass?: string;
|
|
6
|
+
fallbackRef?: HTMLElement | null;
|
|
7
|
+
fallbackClass?: string;
|
|
8
|
+
src?: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
useThemeColor?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const Avatar: import("svelte").Component<$$ComponentProps, {}, "ref" | "imageRef" | "fallbackRef">;
|
|
13
|
+
type Avatar = ReturnType<typeof Avatar>;
|
|
14
|
+
export default Avatar;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { Avatar } from '.';
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
users,
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
|
|
11
|
+
avatarClass,
|
|
12
|
+
imageClass,
|
|
13
|
+
fallbackClass,
|
|
14
|
+
|
|
15
|
+
class: className,
|
|
16
|
+
...restProps
|
|
17
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
18
|
+
avatarClass?: string;
|
|
19
|
+
imageClass?: string;
|
|
20
|
+
fallbackClass?: string;
|
|
21
|
+
|
|
22
|
+
users: {
|
|
23
|
+
src?: string;
|
|
24
|
+
alt?: string;
|
|
25
|
+
fallback?: string;
|
|
26
|
+
}[];
|
|
27
|
+
|
|
28
|
+
class?: string;
|
|
29
|
+
} = $props();
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div class={cn('flex -space-x-2 overflow-hidden', className)} bind:this={ref} {...restProps}>
|
|
33
|
+
{#each users as user}
|
|
34
|
+
<Avatar
|
|
35
|
+
src={user.src}
|
|
36
|
+
alt={user.alt}
|
|
37
|
+
fallback={user.fallback}
|
|
38
|
+
class={cn('border-base-50 dark:border-base-950 border-2', avatarClass)}
|
|
39
|
+
{imageClass}
|
|
40
|
+
{fallbackClass}
|
|
41
|
+
/>
|
|
42
|
+
{/each}
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WithElementRef } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
|
+
avatarClass?: string;
|
|
5
|
+
imageClass?: string;
|
|
6
|
+
fallbackClass?: string;
|
|
7
|
+
users: {
|
|
8
|
+
src?: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
fallback?: string;
|
|
11
|
+
}[];
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const AvatarGroup: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
15
|
+
type AvatarGroup = ReturnType<typeof AvatarGroup>;
|
|
16
|
+
export default AvatarGroup;
|