@widgetic/design-system 0.5.28 → 0.5.29
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/dist/components/chat/ChatHeader.svelte +29 -3
- package/dist/components/chat/ChatHeader.svelte.d.ts +5 -0
- package/dist/components/chat/Composer.svelte +58 -1
- package/dist/components/chat/Composer.svelte.d.ts +8 -0
- package/dist/components/chat/MessageCheckpointRow.svelte +87 -0
- package/dist/components/chat/MessageCheckpointRow.svelte.d.ts +21 -0
- package/dist/components/chat/MessageRatingActions.svelte +157 -0
- package/dist/components/chat/MessageRatingActions.svelte.d.ts +26 -0
- package/dist/components/chat/chatHeaderLogic.d.ts +8 -0
- package/dist/components/chat/chatHeaderLogic.js +14 -0
- package/dist/components/chat/composerModelMenuLogic.d.ts +9 -0
- package/dist/components/chat/composerModelMenuLogic.js +12 -0
- package/dist/components/chat/index.d.ts +10 -0
- package/dist/components/chat/index.js +8 -0
- package/dist/components/chat/messageRatingActionsLogic.d.ts +11 -0
- package/dist/components/chat/messageRatingActionsLogic.js +17 -0
- package/dist/components/chat/messageRatingTypes.d.ts +2 -0
- package/dist/components/chat/messageRatingTypes.js +1 -0
- package/dist/components/shell/ErrorState.svelte +5 -2
- package/dist/components/shell/ErrorState.svelte.d.ts +2 -1
- package/dist/components/shell/SettingsDialog.svelte +65 -4
- package/dist/components/shell/WidgetRow.svelte +6 -6
- package/dist/components/shell/WidgetRow.svelte.d.ts +2 -2
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
import IconMessagePlus from '@tabler/icons-svelte/icons/message-plus';
|
|
8
8
|
import IconMessages from '@tabler/icons-svelte/icons/messages';
|
|
9
9
|
import IconPin from '@tabler/icons-svelte/icons/pin';
|
|
10
|
+
import IconTerminal2 from '@tabler/icons-svelte/icons/terminal-2';
|
|
10
11
|
import IconX from '@tabler/icons-svelte/icons/x';
|
|
12
|
+
import { shouldShowConsoleButton, shouldShowPinButton } from './chatHeaderLogic.js';
|
|
11
13
|
import { Button } from '../ui/button';
|
|
12
14
|
import { IconButton } from '../ui/icon-button';
|
|
13
15
|
import { cn } from '../../utils.js';
|
|
@@ -18,6 +20,7 @@
|
|
|
18
20
|
newChat: string;
|
|
19
21
|
history: string;
|
|
20
22
|
pin: string;
|
|
23
|
+
console: string;
|
|
21
24
|
close: string;
|
|
22
25
|
openHistory: string;
|
|
23
26
|
};
|
|
@@ -26,6 +29,7 @@
|
|
|
26
29
|
newChat: 'New chat',
|
|
27
30
|
history: 'Chat history',
|
|
28
31
|
pin: 'Pin chat',
|
|
32
|
+
console: 'Console',
|
|
29
33
|
close: 'Close chat',
|
|
30
34
|
openHistory: 'Open chat history'
|
|
31
35
|
};
|
|
@@ -37,11 +41,15 @@
|
|
|
37
41
|
title?: string;
|
|
38
42
|
status?: string;
|
|
39
43
|
showClose?: boolean;
|
|
44
|
+
/** When true with `onToggleConsole`, the header shows the debug console icon instead of pin. */
|
|
45
|
+
showConsole?: boolean;
|
|
46
|
+
consoleOpen?: boolean;
|
|
40
47
|
messages?: Partial<ChatHeaderMessages>;
|
|
41
48
|
onTitleClick?: () => void;
|
|
42
49
|
onNewChat?: () => void;
|
|
43
50
|
onHistory?: () => void;
|
|
44
51
|
onPin?: () => void;
|
|
52
|
+
onToggleConsole?: () => void;
|
|
45
53
|
onClose?: () => void;
|
|
46
54
|
};
|
|
47
55
|
|
|
@@ -52,17 +60,22 @@
|
|
|
52
60
|
title,
|
|
53
61
|
status,
|
|
54
62
|
showClose = false,
|
|
63
|
+
showConsole = false,
|
|
64
|
+
consoleOpen = false,
|
|
55
65
|
messages: messagesProp,
|
|
56
66
|
onTitleClick,
|
|
57
67
|
onNewChat,
|
|
58
68
|
onHistory,
|
|
59
69
|
onPin,
|
|
70
|
+
onToggleConsole,
|
|
60
71
|
onClose,
|
|
61
72
|
...restProps
|
|
62
73
|
}: Props = $props();
|
|
63
74
|
|
|
64
75
|
const messages = $derived({ ...defaultMessages, ...messagesProp });
|
|
65
76
|
const displayTitle = $derived(title?.trim() || messages.newChat);
|
|
77
|
+
const consoleVisible = $derived(shouldShowConsoleButton(showConsole, onToggleConsole));
|
|
78
|
+
const pinVisible = $derived(shouldShowPinButton(showConsole, onToggleConsole, onPin));
|
|
66
79
|
</script>
|
|
67
80
|
|
|
68
81
|
<header
|
|
@@ -92,13 +105,26 @@
|
|
|
92
105
|
|
|
93
106
|
<span class="min-w-0 flex-1" aria-hidden="true"></span>
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
108
|
+
{#if consoleVisible}
|
|
109
|
+
<IconButton
|
|
110
|
+
variant="ghost"
|
|
111
|
+
label={messages.console}
|
|
112
|
+
aria-pressed={consoleOpen}
|
|
113
|
+
onclick={onToggleConsole}
|
|
114
|
+
>
|
|
115
|
+
<IconTerminal2 class="stroke-2" />
|
|
116
|
+
</IconButton>
|
|
117
|
+
{:else if pinVisible}
|
|
118
|
+
<IconButton variant="ghost" label={messages.pin} onclick={onPin}>
|
|
119
|
+
<IconPin class="stroke-2" />
|
|
120
|
+
</IconButton>
|
|
121
|
+
{/if}
|
|
98
122
|
|
|
123
|
+
{#if onNewChat}
|
|
99
124
|
<IconButton variant="ghost" label={messages.newChat} onclick={onNewChat}>
|
|
100
125
|
<IconMessagePlus class="stroke-2" />
|
|
101
126
|
</IconButton>
|
|
127
|
+
{/if}
|
|
102
128
|
|
|
103
129
|
{#if onHistory}
|
|
104
130
|
<IconButton variant="ghost" label={messages.history} onclick={onHistory}>
|
|
@@ -4,6 +4,7 @@ export type ChatHeaderMessages = {
|
|
|
4
4
|
newChat: string;
|
|
5
5
|
history: string;
|
|
6
6
|
pin: string;
|
|
7
|
+
console: string;
|
|
7
8
|
close: string;
|
|
8
9
|
openHistory: string;
|
|
9
10
|
};
|
|
@@ -14,11 +15,15 @@ type Props = HTMLAttributes<HTMLElement> & {
|
|
|
14
15
|
title?: string;
|
|
15
16
|
status?: string;
|
|
16
17
|
showClose?: boolean;
|
|
18
|
+
/** When true with `onToggleConsole`, the header shows the debug console icon instead of pin. */
|
|
19
|
+
showConsole?: boolean;
|
|
20
|
+
consoleOpen?: boolean;
|
|
17
21
|
messages?: Partial<ChatHeaderMessages>;
|
|
18
22
|
onTitleClick?: () => void;
|
|
19
23
|
onNewChat?: () => void;
|
|
20
24
|
onHistory?: () => void;
|
|
21
25
|
onPin?: () => void;
|
|
26
|
+
onToggleConsole?: () => void;
|
|
22
27
|
onClose?: () => void;
|
|
23
28
|
};
|
|
24
29
|
declare const ChatHeader: import("svelte").Component<Props, {}, "ref">;
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
characterLimit: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
export type ComposerModelOption = {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
15
20
|
export type ComposerProps = HTMLAttributes<HTMLDivElement> & {
|
|
16
21
|
ref?: HTMLDivElement | null;
|
|
17
22
|
class?: string;
|
|
@@ -21,6 +26,10 @@
|
|
|
21
26
|
disabled?: boolean;
|
|
22
27
|
maxLength?: number;
|
|
23
28
|
allowEmpty?: boolean;
|
|
29
|
+
assistantLabel?: string;
|
|
30
|
+
models?: ComposerModelOption[];
|
|
31
|
+
selectedModelId?: string | null;
|
|
32
|
+
onSelectModel?: (modelId: string) => void;
|
|
24
33
|
messages?: Partial<ComposerMessages>;
|
|
25
34
|
onSend?: (text: string) => void;
|
|
26
35
|
onStop?: () => void;
|
|
@@ -31,11 +40,19 @@
|
|
|
31
40
|
</script>
|
|
32
41
|
|
|
33
42
|
<script lang="ts">
|
|
43
|
+
import IconCheck from '@tabler/icons-svelte/icons/check';
|
|
44
|
+
import IconChevronDown from '@tabler/icons-svelte/icons/chevron-down';
|
|
34
45
|
import IconPlayerStop from '@tabler/icons-svelte/icons/player-stop';
|
|
35
46
|
import IconSend from '@tabler/icons-svelte/icons/send';
|
|
36
47
|
import { cn } from '../../utils.js';
|
|
48
|
+
import { Button } from '../ui/button/index.js';
|
|
37
49
|
import { IconButton } from '../ui/icon-button/index.js';
|
|
50
|
+
import * as DropdownMenu from '../ui/dropdown-menu';
|
|
38
51
|
import { canSendText, clampTextareaHeight, shouldSendOnKeyDown } from './composerLogic.js';
|
|
52
|
+
import {
|
|
53
|
+
selectedModelLabel,
|
|
54
|
+
shouldShowComposerModelMenu
|
|
55
|
+
} from './composerModelMenuLogic.js';
|
|
39
56
|
|
|
40
57
|
const defaultMessages: ComposerMessages = {
|
|
41
58
|
send: 'Send message',
|
|
@@ -53,6 +70,10 @@
|
|
|
53
70
|
disabled = false,
|
|
54
71
|
maxLength,
|
|
55
72
|
allowEmpty = false,
|
|
73
|
+
assistantLabel = 'Assistant',
|
|
74
|
+
models = [],
|
|
75
|
+
selectedModelId = null,
|
|
76
|
+
onSelectModel,
|
|
56
77
|
messages: messagesProp,
|
|
57
78
|
onSend,
|
|
58
79
|
onStop,
|
|
@@ -63,6 +84,9 @@
|
|
|
63
84
|
}: ComposerProps = $props();
|
|
64
85
|
|
|
65
86
|
const messages = $derived({ ...defaultMessages, ...messagesProp });
|
|
87
|
+
const modelMenuVisible = $derived(shouldShowComposerModelMenu(models));
|
|
88
|
+
const modelMenuLabel = $derived(selectedModelLabel(models, selectedModelId, assistantLabel));
|
|
89
|
+
let modelMenuOpen = $state(false);
|
|
66
90
|
|
|
67
91
|
let textareaRef = $state<HTMLTextAreaElement | null>(null);
|
|
68
92
|
let isComposing = $state(false);
|
|
@@ -148,10 +172,43 @@
|
|
|
148
172
|
</div>
|
|
149
173
|
|
|
150
174
|
<div class="flex items-center gap-2">
|
|
151
|
-
<div class="flex min-w-0 flex-1 items-center gap-1">
|
|
175
|
+
<div class="relative flex min-w-0 flex-1 items-center gap-1">
|
|
176
|
+
<!-- Figma toolbar order: the host's controls first (attach), then the model menu (mode). -->
|
|
152
177
|
{#if leading}
|
|
153
178
|
{@render leading()}
|
|
154
179
|
{/if}
|
|
180
|
+
{#if modelMenuVisible}
|
|
181
|
+
<!-- The DS dropdown handles outside click, Escape, arrow keys and focus return; the menu opens upwards because the composer sits at the bottom edge. -->
|
|
182
|
+
<DropdownMenu.Root bind:open={modelMenuOpen}>
|
|
183
|
+
<DropdownMenu.Trigger>
|
|
184
|
+
{#snippet child({ props }: { props: Record<string, unknown> })}
|
|
185
|
+
<Button
|
|
186
|
+
{...props}
|
|
187
|
+
variant="ghost"
|
|
188
|
+
size="sm"
|
|
189
|
+
class="max-w-[11rem] shrink-0 gap-1 px-2"
|
|
190
|
+
disabled={busy || disabled}
|
|
191
|
+
>
|
|
192
|
+
<span class="truncate">{modelMenuLabel}</span>
|
|
193
|
+
<IconChevronDown class="size-4 shrink-0 stroke-2" aria-hidden="true" />
|
|
194
|
+
</Button>
|
|
195
|
+
{/snippet}
|
|
196
|
+
</DropdownMenu.Trigger>
|
|
197
|
+
<DropdownMenu.Content side="top" align="start" class="max-h-48 w-56 overflow-y-auto">
|
|
198
|
+
{#each models as model (model.id)}
|
|
199
|
+
<DropdownMenu.Item
|
|
200
|
+
class="justify-between gap-2"
|
|
201
|
+
onSelect={() => onSelectModel?.(model.id)}
|
|
202
|
+
>
|
|
203
|
+
<span class="truncate">{model.label}</span>
|
|
204
|
+
{#if model.id === selectedModelId}
|
|
205
|
+
<IconCheck class="size-4 shrink-0 stroke-2" aria-hidden="true" />
|
|
206
|
+
{/if}
|
|
207
|
+
</DropdownMenu.Item>
|
|
208
|
+
{/each}
|
|
209
|
+
</DropdownMenu.Content>
|
|
210
|
+
</DropdownMenu.Root>
|
|
211
|
+
{/if}
|
|
155
212
|
</div>
|
|
156
213
|
{#if trailing}
|
|
157
214
|
{@render trailing()}
|
|
@@ -6,6 +6,10 @@ export type ComposerMessages = {
|
|
|
6
6
|
attach: string;
|
|
7
7
|
characterLimit: string;
|
|
8
8
|
};
|
|
9
|
+
export type ComposerModelOption = {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
};
|
|
9
13
|
export type ComposerProps = HTMLAttributes<HTMLDivElement> & {
|
|
10
14
|
ref?: HTMLDivElement | null;
|
|
11
15
|
class?: string;
|
|
@@ -15,6 +19,10 @@ export type ComposerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
15
19
|
disabled?: boolean;
|
|
16
20
|
maxLength?: number;
|
|
17
21
|
allowEmpty?: boolean;
|
|
22
|
+
assistantLabel?: string;
|
|
23
|
+
models?: ComposerModelOption[];
|
|
24
|
+
selectedModelId?: string | null;
|
|
25
|
+
onSelectModel?: (modelId: string) => void;
|
|
18
26
|
messages?: Partial<ComposerMessages>;
|
|
19
27
|
onSend?: (text: string) => void;
|
|
20
28
|
onStop?: () => void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Figma: checkpoint row under a user turn (version label, restore, redo).
|
|
3
|
+
-->
|
|
4
|
+
<script lang="ts" module>
|
|
5
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
+
|
|
7
|
+
export type MessageCheckpointRowMessages = {
|
|
8
|
+
version: string;
|
|
9
|
+
restore: string;
|
|
10
|
+
redo: string;
|
|
11
|
+
restored: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type MessageCheckpointRowProps = HTMLAttributes<HTMLDivElement> & {
|
|
15
|
+
ref?: HTMLDivElement | null;
|
|
16
|
+
class?: string;
|
|
17
|
+
versionLabel?: string | null;
|
|
18
|
+
showRestore?: boolean;
|
|
19
|
+
showRedo?: boolean;
|
|
20
|
+
restoredToVersion?: string | null;
|
|
21
|
+
messages?: Partial<MessageCheckpointRowMessages>;
|
|
22
|
+
onRestore?: () => void;
|
|
23
|
+
onRedo?: () => void;
|
|
24
|
+
};
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script lang="ts">
|
|
28
|
+
import IconHistory from '@tabler/icons-svelte/icons/history';
|
|
29
|
+
import IconArrowBackUp from '@tabler/icons-svelte/icons/arrow-back-up';
|
|
30
|
+
import { cn } from '../../utils.js';
|
|
31
|
+
import { Button } from '../ui/button/index.js';
|
|
32
|
+
|
|
33
|
+
const defaultMessages: MessageCheckpointRowMessages = {
|
|
34
|
+
version: 'Version {n}',
|
|
35
|
+
restore: 'Restore',
|
|
36
|
+
redo: 'Redo',
|
|
37
|
+
restored: 'Restored to version {n}'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
let {
|
|
41
|
+
ref = $bindable(null),
|
|
42
|
+
class: className,
|
|
43
|
+
versionLabel = null,
|
|
44
|
+
showRestore = false,
|
|
45
|
+
showRedo = false,
|
|
46
|
+
restoredToVersion = null,
|
|
47
|
+
messages: messagesProp,
|
|
48
|
+
onRestore,
|
|
49
|
+
onRedo,
|
|
50
|
+
...restProps
|
|
51
|
+
}: MessageCheckpointRowProps = $props();
|
|
52
|
+
|
|
53
|
+
const messages = $derived({ ...defaultMessages, ...messagesProp });
|
|
54
|
+
const restoredText = $derived(
|
|
55
|
+
restoredToVersion
|
|
56
|
+
? messages.restored.replace('{n}', restoredToVersion)
|
|
57
|
+
: ''
|
|
58
|
+
);
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
bind:this={ref}
|
|
63
|
+
class={cn('flex w-full min-w-0 items-center justify-between gap-2', className)}
|
|
64
|
+
{...restProps}
|
|
65
|
+
>
|
|
66
|
+
<div class="flex min-w-0 items-center gap-2">
|
|
67
|
+
{#if restoredText}
|
|
68
|
+
<span class="text-caption text-muted-foreground truncate">{restoredText}</span>
|
|
69
|
+
{:else if versionLabel}
|
|
70
|
+
<span class="text-caption text-muted-foreground truncate">{versionLabel}</span>
|
|
71
|
+
{/if}
|
|
72
|
+
</div>
|
|
73
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
74
|
+
{#if showRestore && onRestore}
|
|
75
|
+
<Button variant="ghost" size="sm" onclick={onRestore}>
|
|
76
|
+
<IconArrowBackUp class="size-4 stroke-2" aria-hidden="true" />
|
|
77
|
+
{messages.restore}
|
|
78
|
+
</Button>
|
|
79
|
+
{/if}
|
|
80
|
+
{#if showRedo && onRedo}
|
|
81
|
+
<Button variant="ghost" size="sm" onclick={onRedo}>
|
|
82
|
+
<IconHistory class="size-4 stroke-2" aria-hidden="true" />
|
|
83
|
+
{messages.redo}
|
|
84
|
+
</Button>
|
|
85
|
+
{/if}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
export type MessageCheckpointRowMessages = {
|
|
3
|
+
version: string;
|
|
4
|
+
restore: string;
|
|
5
|
+
redo: string;
|
|
6
|
+
restored: string;
|
|
7
|
+
};
|
|
8
|
+
export type MessageCheckpointRowProps = HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
ref?: HTMLDivElement | null;
|
|
10
|
+
class?: string;
|
|
11
|
+
versionLabel?: string | null;
|
|
12
|
+
showRestore?: boolean;
|
|
13
|
+
showRedo?: boolean;
|
|
14
|
+
restoredToVersion?: string | null;
|
|
15
|
+
messages?: Partial<MessageCheckpointRowMessages>;
|
|
16
|
+
onRestore?: () => void;
|
|
17
|
+
onRedo?: () => void;
|
|
18
|
+
};
|
|
19
|
+
declare const MessageCheckpointRow: import("svelte").Component<MessageCheckpointRowProps, {}, "ref">;
|
|
20
|
+
type MessageCheckpointRow = ReturnType<typeof MessageCheckpointRow>;
|
|
21
|
+
export default MessageCheckpointRow;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Figma: Message actions row (copy, regenerate, thumbs) on assistant turns.
|
|
3
|
+
-->
|
|
4
|
+
<script lang="ts" module>
|
|
5
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
+
import type { VersionRatingKind } from './messageRatingTypes.js';
|
|
7
|
+
import type { VersionThumb } from './messageRatingActionsLogic.js';
|
|
8
|
+
|
|
9
|
+
export type MessageRatingActionsMessages = {
|
|
10
|
+
copy: string;
|
|
11
|
+
copied: string;
|
|
12
|
+
regenerate: string;
|
|
13
|
+
rateGroup: string;
|
|
14
|
+
rateUp: string;
|
|
15
|
+
rateDown: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type MessageRatingActionsProps = HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
ref?: HTMLDivElement | null;
|
|
20
|
+
class?: string;
|
|
21
|
+
copyText?: string;
|
|
22
|
+
canRegenerate?: boolean;
|
|
23
|
+
ratedMessageId?: string | null;
|
|
24
|
+
rating?: VersionRatingKind;
|
|
25
|
+
messages?: Partial<MessageRatingActionsMessages>;
|
|
26
|
+
onCopy?: () => void | Promise<void>;
|
|
27
|
+
onRegenerate?: () => void;
|
|
28
|
+
onRate?: (messageId: string, pressed: VersionThumb) => void;
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
import IconCopy from '@tabler/icons-svelte/icons/copy';
|
|
34
|
+
import IconRefresh from '@tabler/icons-svelte/icons/refresh';
|
|
35
|
+
import IconThumbDown from '@tabler/icons-svelte/icons/thumb-down';
|
|
36
|
+
import IconThumbUp from '@tabler/icons-svelte/icons/thumb-up';
|
|
37
|
+
import IconCheck from '@tabler/icons-svelte/icons/check';
|
|
38
|
+
import { cn } from '../../utils.js';
|
|
39
|
+
import { IconButton } from '../ui/icon-button/index.js';
|
|
40
|
+
import {
|
|
41
|
+
shouldRenderMessageRatingBar,
|
|
42
|
+
shouldShowCopyAction,
|
|
43
|
+
shouldShowRatingActions,
|
|
44
|
+
shouldShowRegenerateAction,
|
|
45
|
+
thumbIsPressed
|
|
46
|
+
} from './messageRatingActionsLogic.js';
|
|
47
|
+
|
|
48
|
+
const defaultMessages: MessageRatingActionsMessages = {
|
|
49
|
+
copy: 'Copy message',
|
|
50
|
+
copied: 'Copied',
|
|
51
|
+
regenerate: 'Regenerate response',
|
|
52
|
+
rateGroup: 'Rate this version',
|
|
53
|
+
rateUp: 'Good result',
|
|
54
|
+
rateDown: 'Poor result'
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
let {
|
|
58
|
+
ref = $bindable(null),
|
|
59
|
+
class: className,
|
|
60
|
+
copyText = '',
|
|
61
|
+
canRegenerate = false,
|
|
62
|
+
ratedMessageId = null,
|
|
63
|
+
rating = 'none',
|
|
64
|
+
messages: messagesProp,
|
|
65
|
+
onCopy,
|
|
66
|
+
onRegenerate,
|
|
67
|
+
onRate,
|
|
68
|
+
...restProps
|
|
69
|
+
}: MessageRatingActionsProps = $props();
|
|
70
|
+
|
|
71
|
+
const messages = $derived({ ...defaultMessages, ...messagesProp });
|
|
72
|
+
const visible = $derived(
|
|
73
|
+
shouldRenderMessageRatingBar({ copyText, canRegenerate, ratedMessageId })
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
let copied = $state(false);
|
|
77
|
+
let copiedTimer: ReturnType<typeof setTimeout> | null = null;
|
|
78
|
+
|
|
79
|
+
async function handleCopy(event: MouseEvent) {
|
|
80
|
+
const button = event.currentTarget instanceof HTMLElement ? event.currentTarget : null;
|
|
81
|
+
try {
|
|
82
|
+
await onCopy?.();
|
|
83
|
+
copied = true;
|
|
84
|
+
if (copiedTimer) clearTimeout(copiedTimer);
|
|
85
|
+
copiedTimer = setTimeout(() => {
|
|
86
|
+
copied = false;
|
|
87
|
+
copiedTimer = null;
|
|
88
|
+
}, 2000);
|
|
89
|
+
button?.focus({ preventScroll: true });
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error('[MessageRatingActions] Copy failed:', error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$effect(() => {
|
|
96
|
+
return () => {
|
|
97
|
+
if (copiedTimer) clearTimeout(copiedTimer);
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
{#if visible}
|
|
103
|
+
<div
|
|
104
|
+
bind:this={ref}
|
|
105
|
+
class={cn('flex min-h-8 flex-wrap items-center gap-1', className)}
|
|
106
|
+
role="group"
|
|
107
|
+
aria-label={messages.rateGroup}
|
|
108
|
+
{...restProps}
|
|
109
|
+
>
|
|
110
|
+
{#if shouldShowCopyAction(copyText) && onCopy}
|
|
111
|
+
<IconButton variant="ghost" label={copied ? messages.copied : messages.copy} onclick={handleCopy}>
|
|
112
|
+
{#if copied}
|
|
113
|
+
<IconCheck class="size-4 stroke-2" aria-hidden="true" />
|
|
114
|
+
{:else}
|
|
115
|
+
<IconCopy class="size-4 stroke-2" aria-hidden="true" />
|
|
116
|
+
{/if}
|
|
117
|
+
</IconButton>
|
|
118
|
+
{/if}
|
|
119
|
+
|
|
120
|
+
{#if shouldShowRegenerateAction(canRegenerate) && onRegenerate}
|
|
121
|
+
<IconButton variant="ghost" label={messages.regenerate} onclick={onRegenerate}>
|
|
122
|
+
<IconRefresh class="size-4 stroke-2" aria-hidden="true" />
|
|
123
|
+
</IconButton>
|
|
124
|
+
{/if}
|
|
125
|
+
|
|
126
|
+
{#if shouldShowRatingActions(ratedMessageId) && onRate && ratedMessageId}
|
|
127
|
+
<span class="inline-flex items-center gap-0.5" role="group" aria-label={messages.rateGroup}>
|
|
128
|
+
<IconButton
|
|
129
|
+
variant="ghost"
|
|
130
|
+
label={messages.rateUp}
|
|
131
|
+
aria-pressed={thumbIsPressed(rating, 'up')}
|
|
132
|
+
onclick={() => onRate(ratedMessageId, 'up')}
|
|
133
|
+
>
|
|
134
|
+
<IconThumbUp
|
|
135
|
+
class="size-4 stroke-2"
|
|
136
|
+
fill={thumbIsPressed(rating, 'up') ? 'currentColor' : 'none'}
|
|
137
|
+
aria-hidden="true"
|
|
138
|
+
/>
|
|
139
|
+
</IconButton>
|
|
140
|
+
<IconButton
|
|
141
|
+
variant="ghost"
|
|
142
|
+
label={messages.rateDown}
|
|
143
|
+
aria-pressed={thumbIsPressed(rating, 'down')}
|
|
144
|
+
onclick={() => onRate(ratedMessageId, 'down')}
|
|
145
|
+
>
|
|
146
|
+
<IconThumbDown
|
|
147
|
+
class="size-4 stroke-2"
|
|
148
|
+
fill={thumbIsPressed(rating, 'down') ? 'currentColor' : 'none'}
|
|
149
|
+
aria-hidden="true"
|
|
150
|
+
/>
|
|
151
|
+
</IconButton>
|
|
152
|
+
</span>
|
|
153
|
+
{/if}
|
|
154
|
+
|
|
155
|
+
<span class="sr-only" aria-live="polite">{copied ? messages.copied : ''}</span>
|
|
156
|
+
</div>
|
|
157
|
+
{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { VersionRatingKind } from './messageRatingTypes.js';
|
|
3
|
+
import type { VersionThumb } from './messageRatingActionsLogic.js';
|
|
4
|
+
export type MessageRatingActionsMessages = {
|
|
5
|
+
copy: string;
|
|
6
|
+
copied: string;
|
|
7
|
+
regenerate: string;
|
|
8
|
+
rateGroup: string;
|
|
9
|
+
rateUp: string;
|
|
10
|
+
rateDown: string;
|
|
11
|
+
};
|
|
12
|
+
export type MessageRatingActionsProps = HTMLAttributes<HTMLDivElement> & {
|
|
13
|
+
ref?: HTMLDivElement | null;
|
|
14
|
+
class?: string;
|
|
15
|
+
copyText?: string;
|
|
16
|
+
canRegenerate?: boolean;
|
|
17
|
+
ratedMessageId?: string | null;
|
|
18
|
+
rating?: VersionRatingKind;
|
|
19
|
+
messages?: Partial<MessageRatingActionsMessages>;
|
|
20
|
+
onCopy?: () => void | Promise<void>;
|
|
21
|
+
onRegenerate?: () => void;
|
|
22
|
+
onRate?: (messageId: string, pressed: VersionThumb) => void;
|
|
23
|
+
};
|
|
24
|
+
declare const MessageRatingActions: import("svelte").Component<MessageRatingActionsProps, {}, "ref">;
|
|
25
|
+
type MessageRatingActions = ReturnType<typeof MessageRatingActions>;
|
|
26
|
+
export default MessageRatingActions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the chat header shows the debug console control instead of the pin control.
|
|
3
|
+
*/
|
|
4
|
+
export declare function shouldShowConsoleButton(showConsole: boolean, onToggleConsole?: (() => void) | null): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Pin stays available for hosts that still use it; hidden when the console control is shown.
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldShowPinButton(showConsole: boolean, onToggleConsole?: (() => void) | null, onPin?: (() => void) | null): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the chat header shows the debug console control instead of the pin control.
|
|
3
|
+
*/
|
|
4
|
+
export function shouldShowConsoleButton(showConsole, onToggleConsole) {
|
|
5
|
+
return showConsole && typeof onToggleConsole === 'function';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Pin stays available for hosts that still use it; hidden when the console control is shown.
|
|
9
|
+
*/
|
|
10
|
+
export function shouldShowPinButton(showConsole, onToggleConsole, onPin) {
|
|
11
|
+
if (shouldShowConsoleButton(showConsole, onToggleConsole))
|
|
12
|
+
return false;
|
|
13
|
+
return typeof onPin === 'function';
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ComposerModelOption = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The Assistant menu is shown only when the host offers at least one model.
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldShowComposerModelMenu(models: ComposerModelOption[] | null | undefined): boolean;
|
|
9
|
+
export declare function selectedModelLabel(models: ComposerModelOption[], selectedModelId: string | null | undefined, fallbackLabel: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Assistant menu is shown only when the host offers at least one model.
|
|
3
|
+
*/
|
|
4
|
+
export function shouldShowComposerModelMenu(models) {
|
|
5
|
+
return Array.isArray(models) && models.length > 0;
|
|
6
|
+
}
|
|
7
|
+
export function selectedModelLabel(models, selectedModelId, fallbackLabel) {
|
|
8
|
+
if (!selectedModelId)
|
|
9
|
+
return fallbackLabel;
|
|
10
|
+
const match = models.find((model) => model.id === selectedModelId);
|
|
11
|
+
return match?.label?.trim() || fallbackLabel;
|
|
12
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { Chip } from '../ui/chip';
|
|
2
|
+
export { IconButton } from '../ui/icon-button';
|
|
1
3
|
export { default as Composer, type ComposerMessages, type ComposerProps } from './Composer.svelte';
|
|
2
4
|
export { default as Message, type MessageMessages, type MessageProps, type MessageRole } from './Message.svelte';
|
|
3
5
|
export { default as ActivityRow, type ActivityRowProps, type ActivityRowStatus } from './ActivityRow.svelte';
|
|
@@ -14,3 +16,11 @@ export type { QuestionCardMessages, QuestionItem, QuestionOption } from './Quest
|
|
|
14
16
|
export { canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption } from './questionCardLogic.js';
|
|
15
17
|
export { default as SuggestionCard } from './SuggestionCard.svelte';
|
|
16
18
|
export type { SuggestionCardMessages } from './SuggestionCard.svelte';
|
|
19
|
+
export { default as MessageRatingActions } from './MessageRatingActions.svelte';
|
|
20
|
+
export type { MessageRatingActionsMessages, MessageRatingActionsProps } from './MessageRatingActions.svelte';
|
|
21
|
+
export { default as MessageCheckpointRow } from './MessageCheckpointRow.svelte';
|
|
22
|
+
export type { MessageCheckpointRowMessages, MessageCheckpointRowProps } from './MessageCheckpointRow.svelte';
|
|
23
|
+
export { shouldShowConsoleButton, shouldShowPinButton } from './chatHeaderLogic.js';
|
|
24
|
+
export { shouldRenderMessageRatingBar, shouldShowCopyAction, shouldShowRatingActions, shouldShowRegenerateAction, thumbIsPressed, type VersionThumb } from './messageRatingActionsLogic.js';
|
|
25
|
+
export type { VersionRatingKind } from './messageRatingTypes.js';
|
|
26
|
+
export { selectedModelLabel, shouldShowComposerModelMenu, type ComposerModelOption } from './composerModelMenuLogic.js';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Chat components (composer, messages, plan and question cards) built from the Figma design system.
|
|
2
2
|
// Each component is exported here by the agent that owns src/lib/components/chat.
|
|
3
3
|
// [C1 exports]
|
|
4
|
+
export { Chip } from '../ui/chip';
|
|
5
|
+
// The chat's composer draws its attach "+" with the same icon button (the chat imports only this barrel).
|
|
6
|
+
export { IconButton } from '../ui/icon-button';
|
|
4
7
|
export { default as Composer } from './Composer.svelte';
|
|
5
8
|
export { default as Message } from './Message.svelte';
|
|
6
9
|
export { default as ActivityRow } from './ActivityRow.svelte';
|
|
@@ -14,3 +17,8 @@ export { default as PlanCard } from './PlanCard.svelte';
|
|
|
14
17
|
export { default as QuestionCard } from './QuestionCard.svelte';
|
|
15
18
|
export { canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption } from './questionCardLogic.js';
|
|
16
19
|
export { default as SuggestionCard } from './SuggestionCard.svelte';
|
|
20
|
+
export { default as MessageRatingActions } from './MessageRatingActions.svelte';
|
|
21
|
+
export { default as MessageCheckpointRow } from './MessageCheckpointRow.svelte';
|
|
22
|
+
export { shouldShowConsoleButton, shouldShowPinButton } from './chatHeaderLogic.js';
|
|
23
|
+
export { shouldRenderMessageRatingBar, shouldShowCopyAction, shouldShowRatingActions, shouldShowRegenerateAction, thumbIsPressed } from './messageRatingActionsLogic.js';
|
|
24
|
+
export { selectedModelLabel, shouldShowComposerModelMenu } from './composerModelMenuLogic.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { VersionRatingKind } from './messageRatingTypes.js';
|
|
2
|
+
export type VersionThumb = 'up' | 'down';
|
|
3
|
+
export declare function shouldShowCopyAction(copyText: string): boolean;
|
|
4
|
+
export declare function shouldShowRegenerateAction(canRegenerate: boolean): boolean;
|
|
5
|
+
export declare function shouldShowRatingActions(ratedMessageId: string | null | undefined): boolean;
|
|
6
|
+
export declare function shouldRenderMessageRatingBar(input: {
|
|
7
|
+
copyText: string;
|
|
8
|
+
canRegenerate: boolean;
|
|
9
|
+
ratedMessageId: string | null | undefined;
|
|
10
|
+
}): boolean;
|
|
11
|
+
export declare function thumbIsPressed(rating: VersionRatingKind | undefined, thumb: VersionThumb): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function shouldShowCopyAction(copyText) {
|
|
2
|
+
return copyText.trim().length > 0;
|
|
3
|
+
}
|
|
4
|
+
export function shouldShowRegenerateAction(canRegenerate) {
|
|
5
|
+
return canRegenerate;
|
|
6
|
+
}
|
|
7
|
+
export function shouldShowRatingActions(ratedMessageId) {
|
|
8
|
+
return typeof ratedMessageId === 'string' && ratedMessageId.length > 0;
|
|
9
|
+
}
|
|
10
|
+
export function shouldRenderMessageRatingBar(input) {
|
|
11
|
+
return (shouldShowCopyAction(input.copyText) ||
|
|
12
|
+
shouldShowRegenerateAction(input.canRegenerate) ||
|
|
13
|
+
shouldShowRatingActions(input.ratedMessageId));
|
|
14
|
+
}
|
|
15
|
+
export function thumbIsPressed(rating, thumb) {
|
|
16
|
+
return rating === thumb;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!-- Figma: Error State (component set 139:2, node 139:2). -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
5
|
import IconAlertTriangle from '@tabler/icons-svelte/icons/alert-triangle';
|
|
5
6
|
import IconRefresh from '@tabler/icons-svelte/icons/refresh';
|
|
6
7
|
import { cn } from '../../utils.js';
|
|
@@ -12,8 +13,9 @@
|
|
|
12
13
|
messages = defaultErrorStateMessages,
|
|
13
14
|
onRetry,
|
|
14
15
|
onSupport,
|
|
15
|
-
actions
|
|
16
|
-
|
|
16
|
+
actions,
|
|
17
|
+
...restProps
|
|
18
|
+
}: HTMLAttributes<HTMLDivElement> & {
|
|
17
19
|
class?: string;
|
|
18
20
|
messages?: ErrorStateMessages;
|
|
19
21
|
onRetry?: () => void;
|
|
@@ -31,6 +33,7 @@
|
|
|
31
33
|
className
|
|
32
34
|
)}
|
|
33
35
|
role="alert"
|
|
36
|
+
{...restProps}
|
|
34
37
|
>
|
|
35
38
|
<div class="relative flex size-12 items-center justify-center overflow-hidden rounded-xl">
|
|
36
39
|
<span class="bg-destructive absolute inset-0 rounded-xl opacity-10" aria-hidden="true"></span>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
import { type ErrorStateMessages } from './error-state-messages.js';
|
|
3
|
-
type $$ComponentProps = {
|
|
4
|
+
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
5
|
class?: string;
|
|
5
6
|
messages?: ErrorStateMessages;
|
|
6
7
|
onRetry?: () => void;
|
|
@@ -75,6 +75,37 @@
|
|
|
75
75
|
})
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
// Parent keeps pe-8 (32px). A native bar always sits against the content box, so when the page scrolls we
|
|
80
|
+
// (1) pull the scroll area into that padding and (2) add matching padding-right so the cards stay on the
|
|
81
|
+
// pe-8 line and the bar is centred in the leftover space between the cards and the dialog edge.
|
|
82
|
+
const PANE_RIGHT_PADDING_PX = 32;
|
|
83
|
+
let paneScrollStyle = $state('');
|
|
84
|
+
|
|
85
|
+
function overlayScrollbar(node: HTMLElement) {
|
|
86
|
+
function check() {
|
|
87
|
+
const overflows = node.scrollHeight > node.clientHeight;
|
|
88
|
+
if (!overflows) {
|
|
89
|
+
paneScrollStyle = '';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Read the real bar width (often ~14px in Chromium, 8px when thin styles apply).
|
|
93
|
+
const barWidth = Math.max(node.offsetWidth - node.clientWidth, 8);
|
|
94
|
+
const outerGap = Math.max((PANE_RIGHT_PADDING_PX - barWidth) / 2, 0);
|
|
95
|
+
const pull = PANE_RIGHT_PADDING_PX - outerGap;
|
|
96
|
+
// End side, not the right: the bar sits at the inline end of the page, so a dialog read right to left mirrors it
|
|
97
|
+
// (tests/rtl/sourcePlacement.test.ts fails on a physical side). Left to right, this is margin-right/padding-right.
|
|
98
|
+
paneScrollStyle = `margin-inline-end: -${pull}px; padding-inline-end: ${outerGap}px`;
|
|
99
|
+
}
|
|
100
|
+
const resizeObserver = new ResizeObserver(check);
|
|
101
|
+
resizeObserver.observe(node);
|
|
102
|
+
check();
|
|
103
|
+
return {
|
|
104
|
+
destroy() {
|
|
105
|
+
resizeObserver.disconnect();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
78
109
|
</script>
|
|
79
110
|
|
|
80
111
|
<Dialog.Root bind:open={() => open, requestOpenChange}>
|
|
@@ -102,8 +133,8 @@
|
|
|
102
133
|
>
|
|
103
134
|
<SettingsNav {groups} {activeId} {onSelect} class="flex-1" />
|
|
104
135
|
</aside>
|
|
105
|
-
<div class="flex min-h-0 min-w-0 flex-1 flex-col gap-6 overflow-
|
|
106
|
-
<header class="flex flex-col gap-1 pe-10">
|
|
136
|
+
<div class="settings-dialog-main-ct flex min-h-0 min-w-0 flex-1 flex-col gap-6 overflow-hidden pe-8 pt-8">
|
|
137
|
+
<header class="settings-dialog-header flex shrink-0 flex-col gap-1 ps-8 pe-10">
|
|
107
138
|
<DialogPrimitive.Title class="text-heading-page text-foreground"
|
|
108
139
|
>{title}</DialogPrimitive.Title
|
|
109
140
|
>
|
|
@@ -123,11 +154,18 @@
|
|
|
123
154
|
</DialogPrimitive.Description>
|
|
124
155
|
{/if}
|
|
125
156
|
</header>
|
|
126
|
-
|
|
157
|
+
<!-- Only the page under the title scrolls. When it overflows, margin+padding centre the bar in the parent's pe-8. -->
|
|
158
|
+
<div
|
|
159
|
+
class="settings-dialog-pane-scroll flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto overflow-x-hidden ps-8 pb-8"
|
|
160
|
+
use:overlayScrollbar
|
|
161
|
+
style={paneScrollStyle}
|
|
162
|
+
>
|
|
163
|
+
{@render children()}
|
|
164
|
+
</div>
|
|
127
165
|
</div>
|
|
128
166
|
</div>
|
|
129
167
|
<DialogPrimitive.Close
|
|
130
|
-
class="text-foreground hover:bg-accent duration-fast focus-visible:ring-ring focus-visible:ring-offset-background absolute end-
|
|
168
|
+
class="text-foreground hover:bg-accent duration-fast focus-visible:ring-ring focus-visible:ring-offset-background absolute end-2 top-2 inline-flex size-8 items-center justify-center rounded-lg transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
|
|
131
169
|
>
|
|
132
170
|
<IconX class="size-4 stroke-2" aria-hidden="true" />
|
|
133
171
|
<span class="sr-only">{closeLabel}</span>
|
|
@@ -135,3 +173,26 @@
|
|
|
135
173
|
</DialogPrimitive.Content>
|
|
136
174
|
</Dialog.Portal>
|
|
137
175
|
</Dialog.Root>
|
|
176
|
+
|
|
177
|
+
<style>
|
|
178
|
+
/* Transparent track; thumb overlays the parent's right padding via the conditional negative margin above. */
|
|
179
|
+
.settings-dialog-pane-scroll {
|
|
180
|
+
scrollbar-width: thin;
|
|
181
|
+
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
|
|
182
|
+
}
|
|
183
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar {
|
|
184
|
+
width: 8px;
|
|
185
|
+
height: 8px;
|
|
186
|
+
background: transparent;
|
|
187
|
+
}
|
|
188
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-track {
|
|
189
|
+
background: transparent;
|
|
190
|
+
}
|
|
191
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-thumb {
|
|
192
|
+
background: rgba(0, 0, 0, 0.2);
|
|
193
|
+
border-radius: 4px;
|
|
194
|
+
}
|
|
195
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-thumb:hover {
|
|
196
|
+
background: rgba(0, 0, 0, 0.35);
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!-- Figma: Widget Row (component set 54:5, node 54:5). -->
|
|
1
|
+
<!-- Figma: Widget Row (component set 54:5, node 54:5). The row fills its container (1120px on the desktop dashboard, 720px on tablet, 374px on phones): the page sets the width, the row sets no maximum. -->
|
|
2
2
|
<script lang="ts" module>
|
|
3
3
|
import type { VariantProps } from 'tailwind-variants';
|
|
4
4
|
|
|
5
5
|
export const widgetRowVariants = tv({
|
|
6
|
-
base: 'group/widget-row flex
|
|
6
|
+
base: 'group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden',
|
|
7
7
|
variants: {
|
|
8
8
|
selected: {
|
|
9
9
|
true: 'bg-brand-subtle ring-2 ring-brand',
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
{#if isLoading}
|
|
68
68
|
<div
|
|
69
69
|
class={cn(
|
|
70
|
-
'
|
|
70
|
+
'flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4',
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
role="status"
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
{/if}
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
|
-
<div class="min-w-0 flex-1 flex-col gap-0 overflow-hidden">
|
|
105
|
-
<span class="text-body-medium text-foreground block truncate">{title}</span>
|
|
104
|
+
<div class="flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-0 overflow-hidden">
|
|
105
|
+
<span class="text-body-medium text-foreground block h-5 truncate leading-5">{title}</span>
|
|
106
106
|
{#if meta}
|
|
107
|
-
<span class="text-caption text-muted-foreground block truncate">{meta}</span>
|
|
107
|
+
<span class="text-caption text-muted-foreground block h-4 truncate leading-4">{meta}</span>
|
|
108
108
|
{/if}
|
|
109
109
|
</div>
|
|
110
110
|
|
|
@@ -7,7 +7,7 @@ export declare const widgetRowVariants: import("tailwind-variants").TVReturnType
|
|
|
7
7
|
true: string;
|
|
8
8
|
false: string;
|
|
9
9
|
};
|
|
10
|
-
}, undefined, "group/widget-row flex
|
|
10
|
+
}, undefined, "group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden", {
|
|
11
11
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
12
12
|
selected?: boolean | (string | number | symbol)[] | undefined;
|
|
13
13
|
loading?: boolean | (string | number | symbol)[] | undefined;
|
|
@@ -38,7 +38,7 @@ export declare const widgetRowVariants: import("tailwind-variants").TVReturnType
|
|
|
38
38
|
true: string;
|
|
39
39
|
false: string;
|
|
40
40
|
};
|
|
41
|
-
}, undefined, "group/widget-row flex
|
|
41
|
+
}, undefined, "group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
42
42
|
selected: {
|
|
43
43
|
true: string;
|
|
44
44
|
false: string;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
bind:ref
|
|
20
20
|
{orientation}
|
|
21
21
|
class={cn(
|
|
22
|
-
"flex touch-none select-none transition-colors",
|
|
22
|
+
"z-10 flex touch-none select-none transition-colors",
|
|
23
23
|
orientation === "vertical" && "h-full w-2.5 border-s border-s-transparent p-px",
|
|
24
24
|
orientation === "horizontal" && "h-2.5 w-full border-t border-t-transparent p-px",
|
|
25
25
|
className
|