@istmx/ui 0.1.10 → 0.1.11

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.
@@ -1,71 +0,0 @@
1
- import type { ReactNode } from 'react'
2
-
3
- export type ChatAttachmentKind = 'image' | 'video' | 'audio' | 'file'
4
-
5
- export type ChatAttachment = {
6
- id: string
7
- name: string
8
- kind: ChatAttachmentKind
9
- size: number
10
- file: File
11
- url?: string
12
- }
13
-
14
- export type AttachmentOption = {
15
- id: string
16
- label: string
17
- description?: string
18
- icon?: ReactNode
19
- accept: string
20
- multiple?: boolean
21
- capture?: 'user' | 'environment'
22
- disabled?: boolean
23
- onSelect?: () => void
24
- }
25
-
26
- export type ChatTurn = {
27
- id: string
28
- role: 'user' | 'assistant'
29
- content: string
30
-
31
- streamingDelta?: string
32
- attachments?: ChatAttachment[]
33
- status?: 'streaming' | 'complete' | 'error'
34
- error?: {
35
- message: string
36
- retryAfterMs?: number
37
- retryAt?: number
38
- }
39
- thinking?: string
40
- thinkingStatus?: 'thinking' | 'complete'
41
- }
42
-
43
- export type ChatThread = {
44
- id: string
45
- title: string
46
- messages: readonly ChatTurn[]
47
- pinned?: boolean
48
- archived?: boolean
49
- }
50
-
51
- export type ChatRequest = {
52
- message: string
53
- attachments: readonly ChatAttachment[]
54
- signal: AbortSignal
55
- }
56
-
57
- export type ChatStreamChunk =
58
- | string
59
- | {
60
- content?: unknown
61
- text?: unknown
62
- delta?: unknown
63
- type?: 'text-delta' | 'thinking-delta' | 'reasoning-delta'
64
- }
65
- | readonly unknown[]
66
-
67
- export type ChatResponse = string | AsyncIterable<ChatStreamChunk>
68
-
69
- export type ChatSendError = Error & {
70
- retryAfterMs?: number
71
- }
@@ -1,6 +0,0 @@
1
- import { clsx, type ClassValue } from 'clsx'
2
- import { twMerge } from 'tailwind-merge'
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
6
- }
@@ -1,66 +0,0 @@
1
- 'use client'
2
-
3
- import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
4
- import { IconMicrophone, IconPlayerStop } from '@tabler/icons-react'
5
-
6
- export type VoiceButtonProps = {
7
- listening: boolean
8
- disabled?: boolean
9
- onClick: () => void
10
- startLabel?: string
11
- stopLabel?: string
12
- }
13
-
14
- export default function VoiceButton({
15
- listening,
16
- disabled = false,
17
- onClick,
18
- startLabel = 'Start voice input',
19
- stopLabel = 'Stop voice input',
20
- }: VoiceButtonProps) {
21
- const reduceMotion = useReducedMotion()
22
-
23
- return (
24
- <motion.button
25
- type="button"
26
- onClick={onClick}
27
- aria-pressed={listening}
28
- aria-label={listening ? stopLabel : startLabel}
29
- title={listening ? stopLabel : startLabel}
30
- disabled={disabled}
31
- whileTap={reduceMotion ? undefined : { scale: 0.9 }}
32
- whileHover={reduceMotion ? undefined : { y: -1 }}
33
- className={`focus-visible:outline-foreground relative flex size-8 shrink-0 cursor-pointer items-center justify-center overflow-visible rounded-xl border transition-colors duration-200 focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:size-9 ${
34
- listening
35
- ? 'border-[var(--chat-accent,var(--foreground))] bg-[var(--chat-accent,var(--foreground))] text-white'
36
- : 'border-border/70 bg-surface/40 text-muted hover:border-foreground/40 hover:text-foreground'
37
- }`}
38
- >
39
- {listening && !reduceMotion ? (
40
- <motion.span
41
- aria-hidden="true"
42
- className="border-[var(--chat-accent,var(--foreground))] pointer-events-none absolute inset-0 rounded-[inherit] border"
43
- initial={{ opacity: 0.5, scale: 1 }}
44
- animate={{ opacity: 0, scale: 1.55 }}
45
- transition={{ repeat: Infinity, duration: 1.5, ease: 'easeOut' }}
46
- />
47
- ) : null}
48
- <AnimatePresence mode="wait" initial={false}>
49
- <motion.span
50
- key={listening ? 'on' : 'off'}
51
- initial={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, rotate: -35 }}
52
- animate={{ opacity: 1, scale: 1, rotate: 0 }}
53
- exit={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, rotate: 35 }}
54
- transition={{ duration: reduceMotion ? 0 : 0.16 }}
55
- className="relative flex items-center justify-center"
56
- >
57
- {listening ? (
58
- <IconPlayerStop size={13} stroke={1.6} aria-hidden="true" />
59
- ) : (
60
- <IconMicrophone size={17} stroke={1.7} aria-hidden="true" />
61
- )}
62
- </motion.span>
63
- </AnimatePresence>
64
- </motion.button>
65
- )
66
- }