@gram-ai/elements 1.20.0 → 1.20.1

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,5 +1,6 @@
1
1
  import { Chat } from '..'
2
- import type { Meta, StoryFn } from '@storybook/react-vite'
2
+ import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite'
3
+ import { ThreadList } from '@/components/assistant-ui/thread-list'
3
4
 
4
5
  const meta: Meta<typeof Chat> = {
5
6
  title: 'Chat/Variants',
@@ -33,6 +34,32 @@ Standalone.decorators = [
33
34
  ),
34
35
  ]
35
36
 
37
+ export const StandaloneWithHistory: StoryObj<typeof Chat> = {
38
+ name: 'Standalone with History',
39
+ args: {},
40
+ render: () => (
41
+ <div className="bg-background flex h-10/12 max-h-[800px] w-1/2 flex-row gap-4 overflow-hidden rounded-lg border shadow-xl sm:w-3/4">
42
+ <ThreadList className="w-56 flex-none shrink-0 border-r" />
43
+ <Chat className="flex-3 grow" />
44
+ </div>
45
+ ),
46
+ }
47
+ StandaloneWithHistory.decorators = [
48
+ (Story) => (
49
+ <div className="m-auto flex h-screen w-full items-center justify-center border bg-linear-to-r from-violet-600 to-indigo-800">
50
+ <Story />
51
+ </div>
52
+ ),
53
+ ]
54
+ StandaloneWithHistory.parameters = {
55
+ elements: {
56
+ config: {
57
+ variant: 'standalone',
58
+ history: { enabled: true, showThreadList: true },
59
+ },
60
+ },
61
+ }
62
+
36
63
  export const Sidecar: Story = () => (
37
64
  <div className="mr-[400px] p-10">
38
65
  <h1 className="text-2xl font-bold">Sidecar Variant</h1>
@@ -35,7 +35,11 @@ type Dimensions = {
35
35
  maxHeight?: string | number | `${number}%`
36
36
  }
37
37
 
38
- export const AssistantModal: FC = () => {
38
+ interface AssistantModalProps {
39
+ className?: string
40
+ }
41
+
42
+ export const AssistantModal: FC<AssistantModalProps> = ({ className }) => {
39
43
  const { config } = useElements()
40
44
  const themeProps = useThemeProps()
41
45
  const r = useRadius()
@@ -93,7 +97,8 @@ export const AssistantModal: FC = () => {
93
97
  anchorPositionClass,
94
98
  themeProps.className,
95
99
  r('lg'),
96
- isOpen && 'shadow-xl'
100
+ isOpen && 'shadow-xl',
101
+ className
97
102
  )}
98
103
  >
99
104
  <AnimatePresence mode="wait">
@@ -14,7 +14,11 @@ import * as m from 'motion/react-m'
14
14
  import { EASE_OUT_QUINT } from '@/lib/easing'
15
15
  import { useAssistantState } from '@assistant-ui/react'
16
16
 
17
- export const AssistantSidecar: FC = () => {
17
+ interface AssistantSidecarProps {
18
+ className?: string
19
+ }
20
+
21
+ export const AssistantSidecar: FC<AssistantSidecarProps> = ({ className }) => {
18
22
  const { config } = useElements()
19
23
  const themeProps = useThemeProps()
20
24
  const sidecarConfig = config.sidecar ?? {}
@@ -47,7 +51,8 @@ export const AssistantSidecar: FC = () => {
47
51
  transition={{ duration: 0.3, ease: EASE_OUT_QUINT }}
48
52
  className={cn(
49
53
  'aui-root aui-sidecar bg-popover text-popover-foreground fixed top-0 right-0 border-l',
50
- themeProps.className
54
+ themeProps.className,
55
+ className
51
56
  )}
52
57
  >
53
58
  {/* Header */}
@@ -12,13 +12,18 @@ import { useRadius } from '@/hooks/useRadius'
12
12
  import { cn } from '@/lib/utils'
13
13
  import { useDensity } from '@/hooks/useDensity'
14
14
 
15
- export const ThreadList: FC = () => {
15
+ interface ThreadListProps {
16
+ className?: string
17
+ }
18
+
19
+ export const ThreadList: FC<ThreadListProps> = ({ className }) => {
16
20
  const d = useDensity()
17
21
  return (
18
22
  <ThreadListPrimitive.Root
19
23
  className={cn(
20
- 'aui-root aui-thread-list-root flex flex-col items-stretch',
21
- d('gap-sm')
24
+ 'aui-root aui-thread-list-root bg-background flex flex-col items-stretch',
25
+ d('gap-sm'),
26
+ className
22
27
  )}
23
28
  >
24
29
  <div
@@ -68,7 +68,11 @@ const ApiKeyWarning = () => (
68
68
  </div>
69
69
  )
70
70
 
71
- export const Thread: FC = () => {
71
+ interface ThreadProps {
72
+ className?: string
73
+ }
74
+
75
+ export const Thread: FC<ThreadProps> = ({ className }) => {
72
76
  const themeProps = useThemeProps()
73
77
  const d = useDensity()
74
78
  const { config } = useElements()
@@ -81,7 +85,8 @@ export const Thread: FC = () => {
81
85
  <ThreadPrimitive.Root
82
86
  className={cn(
83
87
  'aui-root aui-thread-root bg-background @container flex h-full flex-col',
84
- themeProps.className
88
+ themeProps.className,
89
+ className
85
90
  )}
86
91
  >
87
92
  <ThreadPrimitive.Viewport