@tabelhadev/tabelhawebui 0.28.4
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 +661 -0
- package/README.md +222 -0
- package/README.pt-BR.md +217 -0
- package/dist/actions/click-outside.d.ts +3 -0
- package/dist/actions/click-outside.js +12 -0
- package/dist/actions/combobox-keyboard-nav.d.ts +9 -0
- package/dist/actions/combobox-keyboard-nav.js +28 -0
- package/dist/actions/focus-trap.d.ts +1 -0
- package/dist/actions/focus-trap.js +34 -0
- package/dist/actions/scroll-lock.d.ts +1 -0
- package/dist/actions/scroll-lock.js +17 -0
- package/dist/components/actions/Button.svelte +169 -0
- package/dist/components/actions/Button.svelte.d.ts +19 -0
- package/dist/components/appshell/AppShell.svelte +50 -0
- package/dist/components/appshell/AppShell.svelte.d.ts +19 -0
- package/dist/components/appshell/AppShellBottomNav.svelte +67 -0
- package/dist/components/appshell/AppShellBottomNav.svelte.d.ts +9 -0
- package/dist/components/appshell/AppShellContent.svelte +38 -0
- package/dist/components/appshell/AppShellContent.svelte.d.ts +10 -0
- package/dist/components/appshell/AppShellSidebar.svelte +196 -0
- package/dist/components/appshell/AppShellSidebar.svelte.d.ts +15 -0
- package/dist/components/appshell/types.d.ts +6 -0
- package/dist/components/appshell/types.js +1 -0
- package/dist/components/appshell/utils.d.ts +1 -0
- package/dist/components/appshell/utils.js +3 -0
- package/dist/components/card/Card.svelte +31 -0
- package/dist/components/card/Card.svelte.d.ts +9 -0
- package/dist/components/card/CardAction.svelte +57 -0
- package/dist/components/card/CardAction.svelte.d.ts +10 -0
- package/dist/components/card/CardContent.svelte +25 -0
- package/dist/components/card/CardContent.svelte.d.ts +8 -0
- package/dist/components/card/CardDescription.svelte +24 -0
- package/dist/components/card/CardDescription.svelte.d.ts +8 -0
- package/dist/components/card/CardFooter.svelte +25 -0
- package/dist/components/card/CardFooter.svelte.d.ts +8 -0
- package/dist/components/card/CardHeader.svelte +54 -0
- package/dist/components/card/CardHeader.svelte.d.ts +10 -0
- package/dist/components/card/CardTitle.svelte +25 -0
- package/dist/components/card/CardTitle.svelte.d.ts +8 -0
- package/dist/components/chat/ChatMessage.svelte +104 -0
- package/dist/components/chat/ChatMessage.svelte.d.ts +10 -0
- package/dist/components/choice/Listbox.svelte +183 -0
- package/dist/components/choice/Listbox.svelte.d.ts +15 -0
- package/dist/components/choice/MultiSelect.svelte +278 -0
- package/dist/components/choice/MultiSelect.svelte.d.ts +18 -0
- package/dist/components/choice/Rating.svelte +91 -0
- package/dist/components/choice/Rating.svelte.d.ts +12 -0
- package/dist/components/choice/Toggle.svelte +112 -0
- package/dist/components/choice/Toggle.svelte.d.ts +12 -0
- package/dist/components/feedback/Badge.svelte +66 -0
- package/dist/components/feedback/Badge.svelte.d.ts +9 -0
- package/dist/components/feedback/ErrorPage.svelte +99 -0
- package/dist/components/feedback/ErrorPage.svelte.d.ts +13 -0
- package/dist/components/feedback/Message.svelte +130 -0
- package/dist/components/feedback/Message.svelte.d.ts +14 -0
- package/dist/components/feedback/ProgressBar.svelte +69 -0
- package/dist/components/feedback/ProgressBar.svelte.d.ts +8 -0
- package/dist/components/feedback/Skeleton.svelte +47 -0
- package/dist/components/feedback/Skeleton.svelte.d.ts +9 -0
- package/dist/components/feedback/Status.svelte +75 -0
- package/dist/components/feedback/Status.svelte.d.ts +10 -0
- package/dist/components/feedback/StatusPill.svelte +94 -0
- package/dist/components/feedback/StatusPill.svelte.d.ts +13 -0
- package/dist/components/feedback/Toaster.svelte +122 -0
- package/dist/components/feedback/Toaster.svelte.d.ts +7 -0
- package/dist/components/feedback/Tooltip.svelte +126 -0
- package/dist/components/feedback/Tooltip.svelte.d.ts +10 -0
- package/dist/components/feedback/toast.svelte.d.ts +27 -0
- package/dist/components/feedback/toast.svelte.js +23 -0
- package/dist/components/forms/Checkbox.svelte +96 -0
- package/dist/components/forms/Checkbox.svelte.d.ts +11 -0
- package/dist/components/forms/DatePicker.svelte +372 -0
- package/dist/components/forms/DatePicker.svelte.d.ts +21 -0
- package/dist/components/forms/Field.svelte +47 -0
- package/dist/components/forms/Field.svelte.d.ts +11 -0
- package/dist/components/forms/FileUpload.svelte +504 -0
- package/dist/components/forms/FileUpload.svelte.d.ts +43 -0
- package/dist/components/forms/Input.svelte +93 -0
- package/dist/components/forms/Input.svelte.d.ts +9 -0
- package/dist/components/forms/Label.svelte +30 -0
- package/dist/components/forms/Label.svelte.d.ts +10 -0
- package/dist/components/forms/Radio.svelte +80 -0
- package/dist/components/forms/Radio.svelte.d.ts +11 -0
- package/dist/components/forms/Select.svelte +322 -0
- package/dist/components/forms/Select.svelte.d.ts +22 -0
- package/dist/components/forms/TagInput.svelte +336 -0
- package/dist/components/forms/TagInput.svelte.d.ts +16 -0
- package/dist/components/forms/Textarea.svelte +64 -0
- package/dist/components/forms/Textarea.svelte.d.ts +9 -0
- package/dist/components/landing/Landing.svelte +47 -0
- package/dist/components/landing/Landing.svelte.d.ts +8 -0
- package/dist/components/landing/LandingFeatures.svelte +92 -0
- package/dist/components/landing/LandingFeatures.svelte.d.ts +15 -0
- package/dist/components/landing/LandingHero.svelte +92 -0
- package/dist/components/landing/LandingHero.svelte.d.ts +13 -0
- package/dist/components/landing/LandingRoadmap.svelte +42 -0
- package/dist/components/landing/LandingRoadmap.svelte.d.ts +11 -0
- package/dist/components/landing/LandingSection.svelte +25 -0
- package/dist/components/landing/LandingSection.svelte.d.ts +9 -0
- package/dist/components/landing/LandingSectionHeading.svelte +19 -0
- package/dist/components/landing/LandingSectionHeading.svelte.d.ts +10 -0
- package/dist/components/landing/LandingSteps.svelte +100 -0
- package/dist/components/landing/LandingSteps.svelte.d.ts +13 -0
- package/dist/components/layout/BracketLink.svelte +41 -0
- package/dist/components/layout/BracketLink.svelte.d.ts +9 -0
- package/dist/components/layout/Divider.svelte +70 -0
- package/dist/components/layout/Divider.svelte.d.ts +9 -0
- package/dist/components/layout/Eyebrow.svelte +24 -0
- package/dist/components/layout/Eyebrow.svelte.d.ts +8 -0
- package/dist/components/layout/PageHeader.svelte +106 -0
- package/dist/components/layout/PageHeader.svelte.d.ts +15 -0
- package/dist/components/layout/PageSeo.svelte +34 -0
- package/dist/components/layout/PageSeo.svelte.d.ts +10 -0
- package/dist/components/layout/PageShell.svelte +25 -0
- package/dist/components/layout/PageShell.svelte.d.ts +8 -0
- package/dist/components/layout/Panel.svelte +105 -0
- package/dist/components/layout/Panel.svelte.d.ts +12 -0
- package/dist/components/layout/Prose.svelte +101 -0
- package/dist/components/layout/Prose.svelte.d.ts +7 -0
- package/dist/components/layout/RuleCard.svelte +63 -0
- package/dist/components/layout/RuleCard.svelte.d.ts +13 -0
- package/dist/components/layout/SectionHeading.svelte +57 -0
- package/dist/components/layout/SectionHeading.svelte.d.ts +10 -0
- package/dist/components/layout/StatTile.svelte +76 -0
- package/dist/components/layout/StatTile.svelte.d.ts +12 -0
- package/dist/components/layout/TerminalWindow.svelte +81 -0
- package/dist/components/layout/TerminalWindow.svelte.d.ts +9 -0
- package/dist/components/layout/Wordmark.svelte +26 -0
- package/dist/components/layout/Wordmark.svelte.d.ts +8 -0
- package/dist/components/list/List.svelte +40 -0
- package/dist/components/list/List.svelte.d.ts +13 -0
- package/dist/components/list/ListItem.svelte +81 -0
- package/dist/components/list/ListItem.svelte.d.ts +13 -0
- package/dist/components/marketing/MarketingShell.svelte +170 -0
- package/dist/components/marketing/MarketingShell.svelte.d.ts +23 -0
- package/dist/components/marketing/MarketingShellFooter.svelte +92 -0
- package/dist/components/marketing/MarketingShellFooter.svelte.d.ts +14 -0
- package/dist/components/navigation/Accordion.svelte +110 -0
- package/dist/components/navigation/Accordion.svelte.d.ts +15 -0
- package/dist/components/navigation/Carousel.svelte +115 -0
- package/dist/components/navigation/Carousel.svelte.d.ts +12 -0
- package/dist/components/navigation/InstructionStep.svelte +115 -0
- package/dist/components/navigation/InstructionStep.svelte.d.ts +10 -0
- package/dist/components/navigation/InstructionSteps.svelte +39 -0
- package/dist/components/navigation/InstructionSteps.svelte.d.ts +8 -0
- package/dist/components/navigation/Nav.svelte +102 -0
- package/dist/components/navigation/Nav.svelte.d.ts +14 -0
- package/dist/components/navigation/Stepper.svelte +112 -0
- package/dist/components/navigation/Stepper.svelte.d.ts +12 -0
- package/dist/components/navigation/TabCard.svelte +62 -0
- package/dist/components/navigation/TabCard.svelte.d.ts +10 -0
- package/dist/components/navigation/Tabs.svelte +83 -0
- package/dist/components/navigation/Tabs.svelte.d.ts +12 -0
- package/dist/components/navigation/ThemeToggle.svelte +118 -0
- package/dist/components/navigation/ThemeToggle.svelte.d.ts +20 -0
- package/dist/components/overlay/Dialog.svelte +200 -0
- package/dist/components/overlay/Dialog.svelte.d.ts +19 -0
- package/dist/components/overlay/DialogActions.svelte +50 -0
- package/dist/components/overlay/DialogActions.svelte.d.ts +9 -0
- package/dist/components/overlay/Dropdown.svelte +110 -0
- package/dist/components/overlay/Dropdown.svelte.d.ts +10 -0
- package/dist/components/overlay/FloatingActionPill.svelte +96 -0
- package/dist/components/overlay/FloatingActionPill.svelte.d.ts +14 -0
- package/dist/components/overlay/Sidebar.svelte +258 -0
- package/dist/components/overlay/Sidebar.svelte.d.ts +18 -0
- package/dist/components/table/Table.svelte +550 -0
- package/dist/components/table/Table.svelte.d.ts +42 -0
- package/dist/components/timeline/Timeline.svelte +25 -0
- package/dist/components/timeline/Timeline.svelte.d.ts +8 -0
- package/dist/components/timeline/TimelineItem.svelte +220 -0
- package/dist/components/timeline/TimelineItem.svelte.d.ts +18 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +149 -0
- package/dist/theme/theme.css +348 -0
- package/package.json +52 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
navigate = false,
|
|
7
|
+
class: className = ''
|
|
8
|
+
}: {
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
/** When true (and no children), render a default right-arrow affordance. */
|
|
11
|
+
navigate?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
} = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class="twui-card-action {className}">
|
|
17
|
+
{#if navigate && !children}
|
|
18
|
+
<svg
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
viewBox="0 0 24 24"
|
|
21
|
+
fill="none"
|
|
22
|
+
stroke="currentColor"
|
|
23
|
+
stroke-width="2"
|
|
24
|
+
stroke-linecap="round"
|
|
25
|
+
stroke-linejoin="round"
|
|
26
|
+
class="twui-card-action-nav"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
>
|
|
29
|
+
<path d="M5 12h14" />
|
|
30
|
+
<path d="m13 5 7 7-7 7" />
|
|
31
|
+
</svg>
|
|
32
|
+
{:else if children}
|
|
33
|
+
{@render children()}
|
|
34
|
+
{/if}
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
.twui-card-action {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 8px;
|
|
42
|
+
padding: 12px 16px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:global(.twui-card-header) > .twui-card-action {
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
align-items: flex-end;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
padding: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.twui-card-action-nav {
|
|
53
|
+
width: 16px;
|
|
54
|
+
height: 16px;
|
|
55
|
+
color: var(--twui-accent);
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children?: Snippet;
|
|
4
|
+
/** When true (and no children), render a default right-arrow affordance. */
|
|
5
|
+
navigate?: boolean;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const CardAction: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type CardAction = ReturnType<typeof CardAction>;
|
|
10
|
+
export default CardAction;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = ''
|
|
7
|
+
}: {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class="twui-card-content {className}">
|
|
14
|
+
{@render children()}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.twui-card-content {
|
|
19
|
+
flex: 1 1 auto;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
padding: 16px;
|
|
23
|
+
min-height: 0;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const CardContent: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type CardContent = ReturnType<typeof CardContent>;
|
|
8
|
+
export default CardContent;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = ''
|
|
7
|
+
}: {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<p class="twui-card-description {className}">
|
|
14
|
+
{@render children()}
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.twui-card-description {
|
|
19
|
+
margin: 0;
|
|
20
|
+
font-family: var(--twui-font-mono);
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
color: var(--twui-ink-soft);
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const CardDescription: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type CardDescription = ReturnType<typeof CardDescription>;
|
|
8
|
+
export default CardDescription;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = ''
|
|
7
|
+
}: {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class="twui-card-footer {className}">
|
|
14
|
+
{@render children()}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.twui-card-footer {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
padding: 12px 16px;
|
|
23
|
+
border-top: 1px solid var(--twui-rule);
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const CardFooter: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type CardFooter = ReturnType<typeof CardFooter>;
|
|
8
|
+
export default CardFooter;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
title,
|
|
7
|
+
description,
|
|
8
|
+
class: className = ''
|
|
9
|
+
}: {
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
title?: Snippet;
|
|
12
|
+
description?: Snippet;
|
|
13
|
+
class?: string;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="twui-card-header {className}">
|
|
18
|
+
{#if title || description}
|
|
19
|
+
<div class="twui-card-header-main">
|
|
20
|
+
{#if title}{@render title()}{/if}
|
|
21
|
+
{#if description}{@render description()}{/if}
|
|
22
|
+
</div>
|
|
23
|
+
{#if children}
|
|
24
|
+
<div class="twui-card-header-side">
|
|
25
|
+
{@render children()}
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
{:else if children}
|
|
29
|
+
{@render children()}
|
|
30
|
+
{/if}
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.twui-card-header {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 16px;
|
|
40
|
+
padding: 12px 16px;
|
|
41
|
+
border-bottom: 1px solid var(--twui-rule);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.twui-card-header-main {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: 2px;
|
|
48
|
+
min-width: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.twui-card-header-side {
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children?: Snippet;
|
|
4
|
+
title?: Snippet;
|
|
5
|
+
description?: Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const CardHeader: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type CardHeader = ReturnType<typeof CardHeader>;
|
|
10
|
+
export default CardHeader;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = ''
|
|
7
|
+
}: {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<h2 class="twui-card-title {className}">
|
|
14
|
+
{@render children()}
|
|
15
|
+
</h2>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.twui-card-title {
|
|
19
|
+
margin: 0;
|
|
20
|
+
font-family: var(--twui-font-mono);
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
color: var(--twui-ink);
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const CardTitle: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type CardTitle = ReturnType<typeof CardTitle>;
|
|
8
|
+
export default CardTitle;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
role,
|
|
4
|
+
content = '',
|
|
5
|
+
streaming = false,
|
|
6
|
+
name,
|
|
7
|
+
class: className = ''
|
|
8
|
+
}: {
|
|
9
|
+
role: 'user' | 'assistant';
|
|
10
|
+
content?: string;
|
|
11
|
+
streaming?: boolean;
|
|
12
|
+
name?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
} = $props();
|
|
15
|
+
|
|
16
|
+
const defaultNames = { user: 'Você', assistant: 'IA' };
|
|
17
|
+
const label = $derived(name ?? defaultNames[role]);
|
|
18
|
+
const showTyping = $derived(streaming && content === '');
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class="twui-chat-message twui-chat-message-{role} {showTyping ? 'twui-chat-message-typing' : ''} {className}"
|
|
23
|
+
role="status"
|
|
24
|
+
aria-label={showTyping ? `${label} está digitando` : `${label}`}
|
|
25
|
+
>
|
|
26
|
+
{#if !showTyping}
|
|
27
|
+
<span class="twui-chat-message-bubble">{content}</span>
|
|
28
|
+
{:else}
|
|
29
|
+
<span class="twui-chat-message-bubble twui-chat-message-bubble-typing" aria-hidden="true">
|
|
30
|
+
<span class="twui-chat-message-dot"></span>
|
|
31
|
+
<span class="twui-chat-message-dot"></span>
|
|
32
|
+
<span class="twui-chat-message-dot"></span>
|
|
33
|
+
</span>
|
|
34
|
+
{/if}
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
.twui-chat-message {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
gap: 4px;
|
|
43
|
+
max-width: 85%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.twui-chat-message-user {
|
|
47
|
+
align-items: flex-end;
|
|
48
|
+
align-self: flex-end;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.twui-chat-message-bubble {
|
|
52
|
+
padding: 8px 12px;
|
|
53
|
+
border: 1px solid var(--twui-rule);
|
|
54
|
+
font-family: var(--twui-font-serif, Georgia, serif);
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
line-height: 1.5;
|
|
57
|
+
color: var(--twui-ink);
|
|
58
|
+
box-shadow: var(--twui-shadow-offset, 3px 3px 0 0 var(--twui-rule));
|
|
59
|
+
white-space: pre-wrap;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.twui-chat-message-user .twui-chat-message-bubble {
|
|
63
|
+
background: var(--twui-accent-soft);
|
|
64
|
+
border-color: var(--twui-accent);
|
|
65
|
+
color: var(--twui-accent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.twui-chat-message-assistant .twui-chat-message-bubble {
|
|
69
|
+
background: var(--twui-paper-raised);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.twui-chat-message-bubble-typing {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.twui-chat-message-dot {
|
|
79
|
+
width: 5px;
|
|
80
|
+
height: 5px;
|
|
81
|
+
border-radius: 9999px;
|
|
82
|
+
background: currentColor;
|
|
83
|
+
opacity: 0.35;
|
|
84
|
+
animation: twui-chat-message-blink 1.2s ease-in-out infinite;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.twui-chat-message-dot:nth-child(2) {
|
|
88
|
+
animation-delay: 0.2s;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.twui-chat-message-dot:nth-child(3) {
|
|
92
|
+
animation-delay: 0.4s;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes twui-chat-message-blink {
|
|
96
|
+
0%,
|
|
97
|
+
100% {
|
|
98
|
+
opacity: 0.35;
|
|
99
|
+
}
|
|
100
|
+
50% {
|
|
101
|
+
opacity: 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
role: 'user' | 'assistant';
|
|
3
|
+
content?: string;
|
|
4
|
+
streaming?: boolean;
|
|
5
|
+
name?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const ChatMessage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type ChatMessage = ReturnType<typeof ChatMessage>;
|
|
10
|
+
export default ChatMessage;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SelectOption } from '../forms/Select.svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
options = [],
|
|
6
|
+
multiple = false,
|
|
7
|
+
value = $bindable(multiple ? ([] as string[]) : ''),
|
|
8
|
+
disabled = false,
|
|
9
|
+
filter = false,
|
|
10
|
+
filterPlaceholder = 'Buscar...',
|
|
11
|
+
checkmark = true,
|
|
12
|
+
'aria-label': ariaLabel,
|
|
13
|
+
class: className = ''
|
|
14
|
+
}: {
|
|
15
|
+
options?: SelectOption[];
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
value?: string | string[];
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
filter?: boolean;
|
|
20
|
+
filterPlaceholder?: string;
|
|
21
|
+
checkmark?: boolean;
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
class?: string;
|
|
24
|
+
} = $props();
|
|
25
|
+
|
|
26
|
+
let query = $state('');
|
|
27
|
+
|
|
28
|
+
const visibleOptions = $derived(
|
|
29
|
+
filter && query.trim()
|
|
30
|
+
? options.filter((o) => o.label.toLowerCase().includes(query.trim().toLowerCase()))
|
|
31
|
+
: options
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
function isSelected(option: SelectOption): boolean {
|
|
35
|
+
return multiple ? (value as string[]).includes(option.value) : value === option.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function select(option: SelectOption) {
|
|
39
|
+
if (option.disabled || disabled) return;
|
|
40
|
+
if (multiple) {
|
|
41
|
+
const arr = value as string[];
|
|
42
|
+
value = arr.includes(option.value)
|
|
43
|
+
? arr.filter((v) => v !== option.value)
|
|
44
|
+
: [...arr, option.value];
|
|
45
|
+
} else {
|
|
46
|
+
value = option.value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<div class="twui-listbox {className}">
|
|
52
|
+
{#if filter}
|
|
53
|
+
<div class="twui-listbox-filter">
|
|
54
|
+
<input
|
|
55
|
+
type="text"
|
|
56
|
+
class="twui-listbox-filter-input"
|
|
57
|
+
placeholder={filterPlaceholder}
|
|
58
|
+
bind:value={query}
|
|
59
|
+
aria-label={filterPlaceholder}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
{/if}
|
|
63
|
+
<div
|
|
64
|
+
class="twui-listbox-list"
|
|
65
|
+
role="listbox"
|
|
66
|
+
aria-label={ariaLabel}
|
|
67
|
+
aria-multiselectable={multiple || undefined}
|
|
68
|
+
>
|
|
69
|
+
{#if visibleOptions.length > 0}
|
|
70
|
+
{#each visibleOptions as option (option.value)}
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
role="option"
|
|
74
|
+
aria-selected={isSelected(option)}
|
|
75
|
+
disabled={option.disabled || disabled}
|
|
76
|
+
class="twui-listbox-option {isSelected(option) ? 'twui-listbox-option-selected' : ''}"
|
|
77
|
+
onclick={() => select(option)}
|
|
78
|
+
>
|
|
79
|
+
{#if checkmark && multiple}
|
|
80
|
+
<span class="twui-listbox-check" aria-hidden="true">{isSelected(option) ? '✓' : ''}</span>
|
|
81
|
+
{/if}
|
|
82
|
+
{option.label}
|
|
83
|
+
</button>
|
|
84
|
+
{/each}
|
|
85
|
+
{:else}
|
|
86
|
+
<div class="twui-listbox-empty">Nenhum resultado</div>
|
|
87
|
+
{/if}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<style>
|
|
92
|
+
.twui-listbox {
|
|
93
|
+
border: 1px solid var(--twui-rule);
|
|
94
|
+
background: var(--twui-paper-raised);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.twui-listbox-filter {
|
|
98
|
+
padding: 8px;
|
|
99
|
+
border-bottom: 1px solid var(--twui-rule);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.twui-listbox-filter-input {
|
|
103
|
+
width: 100%;
|
|
104
|
+
padding: 6px 8px;
|
|
105
|
+
border: 1px solid var(--twui-rule);
|
|
106
|
+
background: var(--twui-paper);
|
|
107
|
+
font-family: var(--twui-font-mono);
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
color: var(--twui-ink);
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.twui-listbox-filter-input::placeholder {
|
|
114
|
+
color: var(--twui-ink-faint);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.twui-listbox-filter-input:focus-visible {
|
|
118
|
+
border-color: var(--twui-accent);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.twui-listbox-list {
|
|
122
|
+
max-height: 240px;
|
|
123
|
+
overflow-y: auto;
|
|
124
|
+
padding: 4px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.twui-listbox-option {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 8px;
|
|
131
|
+
width: 100%;
|
|
132
|
+
padding: 6px 10px;
|
|
133
|
+
border: none;
|
|
134
|
+
background: transparent;
|
|
135
|
+
font-family: var(--twui-font-mono);
|
|
136
|
+
font-size: 13px;
|
|
137
|
+
text-align: left;
|
|
138
|
+
color: var(--twui-ink);
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.twui-listbox-option:hover:not(:disabled) {
|
|
143
|
+
background: var(--twui-accent-soft);
|
|
144
|
+
color: var(--twui-accent);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.twui-listbox-option-selected {
|
|
148
|
+
background: var(--twui-accent-soft);
|
|
149
|
+
color: var(--twui-accent);
|
|
150
|
+
font-weight: 500;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.twui-listbox-option:disabled {
|
|
154
|
+
opacity: 0.4;
|
|
155
|
+
cursor: not-allowed;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.twui-listbox-check {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
width: 14px;
|
|
163
|
+
height: 14px;
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
border: 1px solid var(--twui-rule);
|
|
166
|
+
border-radius: 2px;
|
|
167
|
+
font-size: 10px;
|
|
168
|
+
line-height: 1;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.twui-listbox-option-selected .twui-listbox-check {
|
|
172
|
+
border-color: var(--twui-accent);
|
|
173
|
+
background: var(--twui-accent);
|
|
174
|
+
color: var(--twui-paper);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.twui-listbox-empty {
|
|
178
|
+
padding: 12px 10px;
|
|
179
|
+
font-family: var(--twui-font-mono);
|
|
180
|
+
font-size: 13px;
|
|
181
|
+
color: var(--twui-ink-faint);
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SelectOption } from '../forms/Select.svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
options?: SelectOption[];
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
value?: string | string[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
filter?: boolean;
|
|
8
|
+
filterPlaceholder?: string;
|
|
9
|
+
checkmark?: boolean;
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const Listbox: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
14
|
+
type Listbox = ReturnType<typeof Listbox>;
|
|
15
|
+
export default Listbox;
|