solid-tom-ui 1.0.11 → 1.0.14

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.
Files changed (118) hide show
  1. package/README.md +246 -246
  2. package/dist/README.md +246 -246
  3. package/dist/components/avatar/avatar.js.map +1 -1
  4. package/dist/components/badge/badge.js.map +1 -1
  5. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  6. package/dist/components/button/button.js.map +1 -1
  7. package/dist/components/carousel/carousel.js.map +1 -1
  8. package/dist/components/chat-bubble/chatBubble.js.map +1 -1
  9. package/dist/components/checkbox/checkbox.js.map +1 -1
  10. package/dist/components/collapse/collapse.js.map +1 -1
  11. package/dist/components/context-menu/context-menu.js.map +1 -1
  12. package/dist/components/context-menu/context-menu.store.js.map +1 -1
  13. package/dist/components/divider/divider.js.map +1 -1
  14. package/dist/components/dropdown/dropdown.js.map +1 -1
  15. package/dist/components/dropdown/dropdown.store.js.map +1 -1
  16. package/dist/components/float-button/float-button.js.map +1 -1
  17. package/dist/components/hover-3d-image/hover-3d-image.js.map +1 -1
  18. package/dist/components/image-preview/image-preview.js.map +1 -1
  19. package/dist/components/input/input.js.map +1 -1
  20. package/dist/components/input/input.utils.js.map +1 -1
  21. package/dist/components/input/variants/input-color.js.map +1 -1
  22. package/dist/components/input/variants/input-date.js.map +1 -1
  23. package/dist/components/input/variants/input-number.d.ts.map +1 -1
  24. package/dist/components/input/variants/input-number.js +1 -1
  25. package/dist/components/input/variants/input-number.js.map +1 -1
  26. package/dist/components/input/variants/input-otp.js.map +1 -1
  27. package/dist/components/input/variants/input-password.js.map +1 -1
  28. package/dist/components/input/variants/input-radio.js.map +1 -1
  29. package/dist/components/input/variants/input-range.js.map +1 -1
  30. package/dist/components/input/variants/input-text.d.ts.map +1 -1
  31. package/dist/components/input/variants/input-text.js +1 -1
  32. package/dist/components/input/variants/input-text.js.map +1 -1
  33. package/dist/components/input/variants/input-textarea.js.map +1 -1
  34. package/dist/components/loading/loading.js.map +1 -1
  35. package/dist/components/mansory/mansory.js.map +1 -1
  36. package/dist/components/menu/menu.js.map +1 -1
  37. package/dist/components/modal/modal.js.map +1 -1
  38. package/dist/components/modal/modalContext.js.map +1 -1
  39. package/dist/components/pagination/pagination.js.map +1 -1
  40. package/dist/components/progress-bar/progress-bar.js.map +1 -1
  41. package/dist/components/qr-code/qr-code.js.map +1 -1
  42. package/dist/components/select/select.js.map +1 -1
  43. package/dist/components/select-zone/select-zone.js.map +1 -1
  44. package/dist/components/skeleton/skeleton.js.map +1 -1
  45. package/dist/components/slider/slider.js.map +1 -1
  46. package/dist/components/splitter/splitter.js.map +1 -1
  47. package/dist/components/steps/steps.js.map +1 -1
  48. package/dist/components/swap/swap.js.map +1 -1
  49. package/dist/components/switch/switch.js.map +1 -1
  50. package/dist/components/tab/tab.js.map +1 -1
  51. package/dist/components/table/table.js.map +1 -1
  52. package/dist/components/timeline/timeline.js.map +1 -1
  53. package/dist/components/toast/icons/ErrorIcon.js.map +1 -1
  54. package/dist/components/toast/icons/IconCircle.js.map +1 -1
  55. package/dist/components/toast/icons/InfoIcon.js.map +1 -1
  56. package/dist/components/toast/icons/LoaderIcon.js.map +1 -1
  57. package/dist/components/toast/icons/SuccessIcon.js.map +1 -1
  58. package/dist/components/toast/icons/WarningIcon.js.map +1 -1
  59. package/dist/components/toast/toast.js.map +1 -1
  60. package/dist/components/toast/toast.store.js.map +1 -1
  61. package/dist/components/tooltip/tooltip.js.map +1 -1
  62. package/dist/components/tour/tour.js.map +1 -1
  63. package/dist/components/upload/upload.js.map +1 -1
  64. package/dist/components/z-index/z-index.context.js.map +1 -1
  65. package/dist/components/z-index/z-index.js.map +1 -1
  66. package/dist/components/z-index/z-index.store.js.map +1 -1
  67. package/dist/components/z-index/z-index.types.js.map +1 -1
  68. package/dist/package.json +1 -1
  69. package/dist/skill/avatar.skill.md.txt +255 -255
  70. package/dist/skill/badge.skill.md.txt +223 -223
  71. package/dist/skill/breadcrumb.skill.md.txt +177 -177
  72. package/dist/skill/button.skill.md.txt +198 -198
  73. package/dist/skill/carousel.skill.md.txt +406 -406
  74. package/dist/skill/chat-bubble.skill.md.txt +342 -342
  75. package/dist/skill/checkbox.skill.md.txt +326 -326
  76. package/dist/skill/code-preview.skill.md.txt +240 -240
  77. package/dist/skill/collapse.skill.md.txt +329 -329
  78. package/dist/skill/context-menu.skill.md.txt +233 -233
  79. package/dist/skill/diff.skill.md.txt +244 -244
  80. package/dist/skill/divider.skill.md.txt +151 -151
  81. package/dist/skill/doc.skill.md.txt +191 -191
  82. package/dist/skill/drawer.skill.md.txt +157 -157
  83. package/dist/skill/dropdown.skill.md.txt +198 -198
  84. package/dist/skill/float-button.skill.md.txt +315 -315
  85. package/dist/skill/hover-3d-image.skill.md.txt +120 -120
  86. package/dist/skill/iframe.skill.md.txt +114 -114
  87. package/dist/skill/image-preview.skill.md.txt +162 -162
  88. package/dist/skill/indicator.skill.md.txt +60 -60
  89. package/dist/skill/input.skill.md.txt +489 -489
  90. package/dist/skill/loading.skill.md.txt +127 -127
  91. package/dist/skill/menu.skill.md.txt +476 -476
  92. package/dist/skill/modal.skill.md.txt +359 -359
  93. package/dist/skill/pagination.skill.md.txt +405 -405
  94. package/dist/skill/progress-bar.skill.md.txt +207 -207
  95. package/dist/skill/qr-code.skill.md.txt +136 -136
  96. package/dist/skill/rating.skill.md.txt +167 -167
  97. package/dist/skill/select-zone.skill.md.txt +93 -93
  98. package/dist/skill/select.skill.md.txt +663 -663
  99. package/dist/skill/skeleton.skill.md.txt +192 -192
  100. package/dist/skill/slider.skill.md.txt +404 -404
  101. package/dist/skill/splitter.skill.md.txt +411 -411
  102. package/dist/skill/steps.skill.md.txt +264 -264
  103. package/dist/skill/swap.skill.md.txt +139 -139
  104. package/dist/skill/switch.skill.md.txt +191 -191
  105. package/dist/skill/tab.skill.md.txt +484 -484
  106. package/dist/skill/table.example.header.md.txt +666 -666
  107. package/dist/skill/table.skill.md.txt +1407 -1407
  108. package/dist/skill/text-rotate.skill.md.txt +186 -186
  109. package/dist/skill/timeline.skill.md.txt +247 -247
  110. package/dist/skill/toast.skill.md.txt +531 -531
  111. package/dist/skill/tooltip.skill.md.txt +222 -222
  112. package/dist/skill/tour.skill.md.txt +156 -156
  113. package/dist/skill/upload.skill.md.txt +358 -358
  114. package/dist/utils/cn.js.map +1 -1
  115. package/dist/utils/element-tracker.js.map +1 -1
  116. package/dist/utils/helper.js.map +1 -1
  117. package/dist/utils/hoc.js.map +1 -1
  118. package/package.json +132 -133
@@ -1,342 +1,342 @@
1
- ## COMPONENT IDENTITY
2
- - **Import**: `import { ChatBubble } from 'solid-tom-ui';`
3
- - **Export**: `ChatBubble` (named export)
4
- - **Framework**: SolidJS
5
- - **Purpose**: Chat message bubble — NOT a `ParentComponent`; all content passed via props
6
-
7
- ---
8
-
9
- ## TYPE SIGNATURE
10
-
11
- ```ts
12
- type ChatBubbleProps = {
13
- bubble: SolidComponent; // REQUIRED — main message content
14
- align?: 'start' | 'end'; // message side; no default applied in component
15
- color?: BaseColorProps; // bubble background color
16
- avatar?: SolidComponent; // avatar displayed beside the bubble
17
- header?: SolidComponent; // content above the bubble (name, timestamp, etc.)
18
- footer?: SolidComponent; // intended for status below bubble — see BUG note
19
- class?: {
20
- avatar?: string; // extra classes on .chat-image wrapper
21
- bubble?: string; // extra classes on .chat-bubble wrapper
22
- header?: string; // extra classes on .chat-header wrapper
23
- footer?: string; // extra classes on .chat-footer wrapper
24
- };
25
- };
26
-
27
- // BaseColorProps:
28
- type BaseColorProps =
29
- | 'default' | 'neutral' | 'primary' | 'secondary' | 'accent'
30
- | 'info' | 'success' | 'warning' | 'error';
31
- ```
32
-
33
- ---
34
-
35
- ## PROP REFERENCE
36
-
37
- | Prop | Type | Required | Description |
38
- |----------------|------------------|----------|-----------------------------------------------------------------------------------------------|
39
- | `bubble` | `SolidComponent` | ✅ YES | Main message body — rendered inside `.chat-bubble` div |
40
- | `align` | `'start' \| 'end'` | ❌ NO | `'start'` = left side (received); `'end'` = right side (sent). No default — omitting applies no alignment class |
41
- | `color` | `BaseColorProps` | ❌ NO | Background color of the bubble |
42
- | `avatar` | `SolidComponent` | ❌ NO | Rendered inside `.chat-image` — only shown when truthy (via `<Show>`) |
43
- | `header` | `SolidComponent` | ❌ NO | Rendered inside `.chat-header` above the bubble — only shown when truthy |
44
- | `footer` | `SolidComponent` | ❌ NO | **⚠️ BUG**: renders `bubble` content instead of `footer` — see bug section below |
45
- | `class.avatar` | `string` | ❌ NO | Extra classes on `.chat-image` wrapper div |
46
- | `class.bubble` | `string` | ❌ NO | Extra classes on `.chat-bubble` wrapper div |
47
- | `class.header` | `string` | ❌ NO | Extra classes on `.chat-header` wrapper div |
48
- | `class.footer` | `string` | ❌ NO | Extra classes on `.chat-footer` wrapper div |
49
-
50
- ---
51
-
52
- ## ⚠️ KNOWN BUG — `footer` renders `bubble` content
53
-
54
- In the current source (`chatBubble.tsx` line 43), the `.chat-footer` div renders `props.bubble` instead of `props.footer`:
55
-
56
- ```tsx
57
- // Source code (line 43) — BUG:
58
- <div class={cn('chat-footer', props.class?.footer)}>{props.bubble as Element}</div>
59
- // ^^^^^^ should be props.footer
60
- ```
61
-
62
- **Impact for agents:**
63
- - The `footer` prop controls **visibility only** (via `<Show when={props.footer}>`) — if `footer` is truthy, the `.chat-footer` div renders with `bubble` content inside
64
- - The actual `footer` JSX value is **never rendered**
65
- - Do NOT rely on `footer` prop to display delivery status, timestamps, or any footer-specific content — it will show the bubble text instead
66
- - Until fixed, avoid using `footer` for any meaningful content
67
-
68
- ---
69
-
70
- ## COLOR REFERENCE
71
-
72
- | Value | DaisyUI class |
73
- |---------------|---------------------------|
74
- | `'default'` | *(no class)* |
75
- | `'neutral'` | `chat-bubble-neutral` |
76
- | `'primary'` | `chat-bubble-primary` |
77
- | `'secondary'` | `chat-bubble-secondary` |
78
- | `'accent'` | `chat-bubble-accent` |
79
- | `'info'` | `chat-bubble-info` |
80
- | `'success'` | `chat-bubble-success` |
81
- | `'warning'` | `chat-bubble-warning` |
82
- | `'error'` | `chat-bubble-error` |
83
-
84
- ---
85
-
86
- ## INTERNAL DOM STRUCTURE
87
-
88
- ```
89
- <div class="chat chat-start|chat-end">
90
-
91
- ├── <Show when={avatar}>
92
- │ <div class="chat-image [class.avatar]">
93
- │ {avatar}
94
- │ </div>
95
- │ </Show>
96
-
97
- ├── <Show when={header}>
98
- │ <div class="chat-header [class.header]">
99
- │ {header}
100
- │ </div>
101
- │ </Show>
102
-
103
- ├── <Show when={bubble}>
104
- │ <div class="chat-bubble chat-bubble-{color} [class.bubble]">
105
- │ {bubble}
106
- │ </div>
107
- │ </Show>
108
-
109
- └── <Show when={footer}>
110
- <div class="chat-footer [class.footer]">
111
- {bubble} ← ⚠️ BUG: renders bubble, not footer
112
- </div>
113
- </Show>
114
- ```
115
-
116
- All four sections (`avatar`, `header`, `bubble`, `footer`) are independently conditional via `<Show>`.
117
-
118
- ---
119
-
120
- ## ALIGN BEHAVIOR
121
-
122
- | `align` | DaisyUI class | Visual placement | Typical use |
123
- |-------------|----------------|------------------------|--------------------------|
124
- | `'start'` | `chat-start` | Left side of container | Received / incoming msg |
125
- | `'end'` | `chat-end` | Right side of container | Sent / outgoing msg |
126
- | *(omitted)* | *(none)* | Browser default | Avoid — renders unstyled |
127
-
128
- Always pass `align` explicitly. Omitting it leaves the chat div without a positioning class.
129
-
130
- ---
131
-
132
- ## AVATAR INTEGRATION
133
-
134
- `avatar` accepts any `SolidComponent`. Typically used with the `Avatar` component from `@/components/avatar/avatar`:
135
-
136
- ```tsx
137
- import { Avatar } from 'solid-tom-ui';
138
-
139
- // Image avatar
140
- <ChatBubble
141
- align="start"
142
- avatar={<Avatar image="/profile.webp" width={40} />}
143
- bubble={<span>Hello!</span>}
144
- />
145
-
146
- // Placeholder avatar (initials)
147
- <ChatBubble
148
- align="end"
149
- avatar={
150
- <Avatar
151
- width={36}
152
- placeholder={
153
- <div class="bg-primary text-primary-content flex h-9 w-9 items-center justify-center rounded-full">
154
- <span class="text-sm font-bold">JD</span>
155
- </div>
156
- }
157
- />
158
- }
159
- bubble={<span>Message from JD</span>}
160
- />
161
- ```
162
-
163
- ---
164
-
165
- ## USAGE PATTERNS
166
-
167
- ### Pattern 1 — Minimal (bubble only)
168
- ```tsx
169
- <ChatBubble
170
- align="start"
171
- color="neutral"
172
- bubble={<span>Hi there!</span>}
173
- />
174
- ```
175
-
176
- ### Pattern 2 — With avatar
177
- ```tsx
178
- <ChatBubble
179
- align="start"
180
- color="neutral"
181
- avatar={<Avatar image="/user.webp" width={40} />}
182
- bubble={<span>Hello! How can I help?</span>}
183
- />
184
- ```
185
-
186
- ### Pattern 3 — With header (name + timestamp)
187
- ```tsx
188
- <ChatBubble
189
- align="start"
190
- color="info"
191
- avatar={<Avatar image="/user.webp" width={40} />}
192
- header={
193
- <div class="flex items-center gap-2">
194
- <span class="font-bold">Alice</span>
195
- <time class="text-xs opacity-50">12:45</time>
196
- </div>
197
- }
198
- bubble={<span>Did you see the latest update?</span>}
199
- />
200
- ```
201
-
202
- ### Pattern 4 — Rich bubble content (multiline)
203
- ```tsx
204
- <ChatBubble
205
- align="end"
206
- color="primary"
207
- bubble={
208
- <div>
209
- <p>Good morning!</p>
210
- <p class="mt-1">Sure, I'll take a look right now.</p>
211
- </div>
212
- }
213
- />
214
- ```
215
-
216
- ### Pattern 5 — Full conversation layout
217
- ```tsx
218
- <div class="bg-base-200 max-w-xl space-y-2 rounded-lg p-4">
219
- <ChatBubble
220
- align="start"
221
- color="neutral"
222
- avatar={<Avatar image="/customer.webp" width={36} />}
223
- header={<span class="text-sm font-bold">Customer</span>}
224
- bubble={<span>Hi, I have a question about my order.</span>}
225
- />
226
- <ChatBubble
227
- align="end"
228
- color="info"
229
- avatar={
230
- <Avatar
231
- width={36}
232
- placeholder={
233
- <div class="bg-info text-info-content flex h-9 w-9 items-center justify-center rounded-full">
234
- <span class="text-sm">CS</span>
235
- </div>
236
- }
237
- />
238
- }
239
- header={<span class="text-sm font-bold">Support</span>}
240
- bubble={<span>Hello! What's your order number?</span>}
241
- />
242
- </div>
243
- ```
244
-
245
- ### Pattern 6 — Rendering a list of messages from data
246
- ```tsx
247
- type Message = {
248
- id: string;
249
- text: string;
250
- sender: 'me' | 'other';
251
- senderName: string;
252
- time: string;
253
- };
254
-
255
- <For each={messages()}>
256
- {msg => (
257
- <ChatBubble
258
- align={msg.sender === 'me' ? 'end' : 'start'}
259
- color={msg.sender === 'me' ? 'primary' : 'neutral'}
260
- header={
261
- <div class="flex items-center gap-2">
262
- <span class="font-bold">{msg.senderName}</span>
263
- <time class="text-xs opacity-50">{msg.time}</time>
264
- </div>
265
- }
266
- bubble={<span>{msg.text}</span>}
267
- />
268
- )}
269
- </For>
270
- ```
271
-
272
- ---
273
-
274
- ## BEHAVIOR NOTES FOR AGENTS
275
-
276
- 1. **`bubble` is the only required prop** — but always pass `align` explicitly to control message side. Without `align`, the bubble renders without a positioning class.
277
-
278
- 2. **All optional sections are independently conditional** — `avatar`, `header`, `footer` each use `<Show when={prop}>`. Falsy values (`undefined`, `null`, `false`, empty string) cause their section to be unmounted entirely.
279
-
280
- 3. **`bubble` accepts any JSX** — string, `<span>`, `<div>` with multiline content, images, etc. The `.chat-bubble` div wraps whatever is passed.
281
-
282
- 4. **`footer` prop is broken** — see bug section. The footer visibility toggle works (via `<Show>`), but the content rendered is `bubble`, not `footer`. Do not use `footer` in production UI until fixed.
283
-
284
- 5. **Component renders inside a `<>` fragment** — the root `<div class="chat">` is not the component root; it's wrapped in a fragment. This has no practical impact but means the component emits no additional wrapper element.
285
-
286
- 6. **Convention for conversation UIs** — wrap multiple `ChatBubble` components in a `<div class="space-y-2">` container. Use `max-w-xl` or similar to constrain chat width.
287
-
288
- ---
289
-
290
- ## COMMON MISTAKES TO AVOID
291
-
292
- | Mistake | Correct approach |
293
- |---|---|
294
- | Omitting `align` prop | Always pass `align="start"` or `align="end"` explicitly |
295
- | Using `footer` prop expecting custom footer content | `footer` has a bug — it renders `bubble` content instead; avoid until fixed |
296
- | Passing `align` as a reactive signal without accessor | Pass signal accessor: `align={message.isOwn ? 'end' : 'start'}` |
297
- | Putting children inside `<ChatBubble>` | Component is NOT a `ParentComponent` — use `bubble` prop instead |
298
- | Omitting `color` and expecting styled bubble | Without `color`, bubble uses DaisyUI default (no color class) |
299
- | Forgetting `space-y-2` wrapper for conversation | Multiple bubbles need spacing — wrap in `<div class="space-y-2">` |
300
-
301
- ---
302
-
303
- ## FULL EXAMPLE — Complete chat UI
304
-
305
- ```tsx
306
- import { ChatBubble } from 'solid-tom-ui';
307
- import { Avatar } from 'solid-tom-ui';
308
- import { For } from 'solid-js';
309
-
310
- const messages = [
311
- { id: '1', sender: 'other', name: 'Alice', time: '12:44', text: 'Hey! Are you free today?' },
312
- { id: '2', sender: 'me', name: 'You', time: '12:45', text: 'Yes, what's up?' },
313
- { id: '3', sender: 'other', name: 'Alice', time: '12:45', text: 'Want to grab lunch?' },
314
- { id: '4', sender: 'me', name: 'You', time: '12:46', text: 'Sure! Where do you want to go?' },
315
- ];
316
-
317
- <div class="bg-base-200 max-w-xl space-y-2 rounded-xl p-4">
318
- <For each={messages}>
319
- {msg => (
320
- <ChatBubble
321
- align={msg.sender === 'me' ? 'end' : 'start'}
322
- color={msg.sender === 'me' ? 'primary' : 'neutral'}
323
- avatar={<Avatar image="/avatar.webp" width={36} />}
324
- header={
325
- <div class="flex items-center gap-2">
326
- <span class="font-bold text-sm">{msg.name}</span>
327
- <time class="text-xs opacity-50">{msg.time}</time>
328
- </div>
329
- }
330
- bubble={<span>{msg.text}</span>}
331
- />
332
- )}
333
- </For>
334
- </div>
335
- ```
336
- ---
337
-
338
- ## Component Conventions
339
-
340
- > **CSS encoding**: internal CSS classes use short encoded names (e.g. `cb01`, `cb02`) per project convention.
341
-
342
- > **Unique IDs**: if this component needs to generate HTML `id` attributes, always use `createUniqueId()` from `solid-js` — never `Math.random()` or `Date.now()`.
1
+ ## COMPONENT IDENTITY
2
+ - **Import**: `import { ChatBubble } from 'solid-tom-ui';`
3
+ - **Export**: `ChatBubble` (named export)
4
+ - **Framework**: SolidJS
5
+ - **Purpose**: Chat message bubble — NOT a `ParentComponent`; all content passed via props
6
+
7
+ ---
8
+
9
+ ## TYPE SIGNATURE
10
+
11
+ ```ts
12
+ type ChatBubbleProps = {
13
+ bubble: SolidComponent; // REQUIRED — main message content
14
+ align?: 'start' | 'end'; // message side; no default applied in component
15
+ color?: BaseColorProps; // bubble background color
16
+ avatar?: SolidComponent; // avatar displayed beside the bubble
17
+ header?: SolidComponent; // content above the bubble (name, timestamp, etc.)
18
+ footer?: SolidComponent; // intended for status below bubble — see BUG note
19
+ class?: {
20
+ avatar?: string; // extra classes on .chat-image wrapper
21
+ bubble?: string; // extra classes on .chat-bubble wrapper
22
+ header?: string; // extra classes on .chat-header wrapper
23
+ footer?: string; // extra classes on .chat-footer wrapper
24
+ };
25
+ };
26
+
27
+ // BaseColorProps:
28
+ type BaseColorProps =
29
+ | 'default' | 'neutral' | 'primary' | 'secondary' | 'accent'
30
+ | 'info' | 'success' | 'warning' | 'error';
31
+ ```
32
+
33
+ ---
34
+
35
+ ## PROP REFERENCE
36
+
37
+ | Prop | Type | Required | Description |
38
+ |----------------|------------------|----------|-----------------------------------------------------------------------------------------------|
39
+ | `bubble` | `SolidComponent` | ✅ YES | Main message body — rendered inside `.chat-bubble` div |
40
+ | `align` | `'start' \| 'end'` | ❌ NO | `'start'` = left side (received); `'end'` = right side (sent). No default — omitting applies no alignment class |
41
+ | `color` | `BaseColorProps` | ❌ NO | Background color of the bubble |
42
+ | `avatar` | `SolidComponent` | ❌ NO | Rendered inside `.chat-image` — only shown when truthy (via `<Show>`) |
43
+ | `header` | `SolidComponent` | ❌ NO | Rendered inside `.chat-header` above the bubble — only shown when truthy |
44
+ | `footer` | `SolidComponent` | ❌ NO | **⚠️ BUG**: renders `bubble` content instead of `footer` — see bug section below |
45
+ | `class.avatar` | `string` | ❌ NO | Extra classes on `.chat-image` wrapper div |
46
+ | `class.bubble` | `string` | ❌ NO | Extra classes on `.chat-bubble` wrapper div |
47
+ | `class.header` | `string` | ❌ NO | Extra classes on `.chat-header` wrapper div |
48
+ | `class.footer` | `string` | ❌ NO | Extra classes on `.chat-footer` wrapper div |
49
+
50
+ ---
51
+
52
+ ## ⚠️ KNOWN BUG — `footer` renders `bubble` content
53
+
54
+ In the current source (`chatBubble.tsx` line 43), the `.chat-footer` div renders `props.bubble` instead of `props.footer`:
55
+
56
+ ```tsx
57
+ // Source code (line 43) — BUG:
58
+ <div class={cn('chat-footer', props.class?.footer)}>{props.bubble as Element}</div>
59
+ // ^^^^^^ should be props.footer
60
+ ```
61
+
62
+ **Impact for agents:**
63
+ - The `footer` prop controls **visibility only** (via `<Show when={props.footer}>`) — if `footer` is truthy, the `.chat-footer` div renders with `bubble` content inside
64
+ - The actual `footer` JSX value is **never rendered**
65
+ - Do NOT rely on `footer` prop to display delivery status, timestamps, or any footer-specific content — it will show the bubble text instead
66
+ - Until fixed, avoid using `footer` for any meaningful content
67
+
68
+ ---
69
+
70
+ ## COLOR REFERENCE
71
+
72
+ | Value | DaisyUI class |
73
+ |---------------|---------------------------|
74
+ | `'default'` | *(no class)* |
75
+ | `'neutral'` | `chat-bubble-neutral` |
76
+ | `'primary'` | `chat-bubble-primary` |
77
+ | `'secondary'` | `chat-bubble-secondary` |
78
+ | `'accent'` | `chat-bubble-accent` |
79
+ | `'info'` | `chat-bubble-info` |
80
+ | `'success'` | `chat-bubble-success` |
81
+ | `'warning'` | `chat-bubble-warning` |
82
+ | `'error'` | `chat-bubble-error` |
83
+
84
+ ---
85
+
86
+ ## INTERNAL DOM STRUCTURE
87
+
88
+ ```
89
+ <div class="chat chat-start|chat-end">
90
+
91
+ ├── <Show when={avatar}>
92
+ │ <div class="chat-image [class.avatar]">
93
+ │ {avatar}
94
+ │ </div>
95
+ │ </Show>
96
+
97
+ ├── <Show when={header}>
98
+ │ <div class="chat-header [class.header]">
99
+ │ {header}
100
+ │ </div>
101
+ │ </Show>
102
+
103
+ ├── <Show when={bubble}>
104
+ │ <div class="chat-bubble chat-bubble-{color} [class.bubble]">
105
+ │ {bubble}
106
+ │ </div>
107
+ │ </Show>
108
+
109
+ └── <Show when={footer}>
110
+ <div class="chat-footer [class.footer]">
111
+ {bubble} ← ⚠️ BUG: renders bubble, not footer
112
+ </div>
113
+ </Show>
114
+ ```
115
+
116
+ All four sections (`avatar`, `header`, `bubble`, `footer`) are independently conditional via `<Show>`.
117
+
118
+ ---
119
+
120
+ ## ALIGN BEHAVIOR
121
+
122
+ | `align` | DaisyUI class | Visual placement | Typical use |
123
+ |-------------|----------------|------------------------|--------------------------|
124
+ | `'start'` | `chat-start` | Left side of container | Received / incoming msg |
125
+ | `'end'` | `chat-end` | Right side of container | Sent / outgoing msg |
126
+ | *(omitted)* | *(none)* | Browser default | Avoid — renders unstyled |
127
+
128
+ Always pass `align` explicitly. Omitting it leaves the chat div without a positioning class.
129
+
130
+ ---
131
+
132
+ ## AVATAR INTEGRATION
133
+
134
+ `avatar` accepts any `SolidComponent`. Typically used with the `Avatar` component from `@/components/avatar/avatar`:
135
+
136
+ ```tsx
137
+ import { Avatar } from 'solid-tom-ui';
138
+
139
+ // Image avatar
140
+ <ChatBubble
141
+ align="start"
142
+ avatar={<Avatar image="/profile.webp" width={40} />}
143
+ bubble={<span>Hello!</span>}
144
+ />
145
+
146
+ // Placeholder avatar (initials)
147
+ <ChatBubble
148
+ align="end"
149
+ avatar={
150
+ <Avatar
151
+ width={36}
152
+ placeholder={
153
+ <div class="bg-primary text-primary-content flex h-9 w-9 items-center justify-center rounded-full">
154
+ <span class="text-sm font-bold">JD</span>
155
+ </div>
156
+ }
157
+ />
158
+ }
159
+ bubble={<span>Message from JD</span>}
160
+ />
161
+ ```
162
+
163
+ ---
164
+
165
+ ## USAGE PATTERNS
166
+
167
+ ### Pattern 1 — Minimal (bubble only)
168
+ ```tsx
169
+ <ChatBubble
170
+ align="start"
171
+ color="neutral"
172
+ bubble={<span>Hi there!</span>}
173
+ />
174
+ ```
175
+
176
+ ### Pattern 2 — With avatar
177
+ ```tsx
178
+ <ChatBubble
179
+ align="start"
180
+ color="neutral"
181
+ avatar={<Avatar image="/user.webp" width={40} />}
182
+ bubble={<span>Hello! How can I help?</span>}
183
+ />
184
+ ```
185
+
186
+ ### Pattern 3 — With header (name + timestamp)
187
+ ```tsx
188
+ <ChatBubble
189
+ align="start"
190
+ color="info"
191
+ avatar={<Avatar image="/user.webp" width={40} />}
192
+ header={
193
+ <div class="flex items-center gap-2">
194
+ <span class="font-bold">Alice</span>
195
+ <time class="text-xs opacity-50">12:45</time>
196
+ </div>
197
+ }
198
+ bubble={<span>Did you see the latest update?</span>}
199
+ />
200
+ ```
201
+
202
+ ### Pattern 4 — Rich bubble content (multiline)
203
+ ```tsx
204
+ <ChatBubble
205
+ align="end"
206
+ color="primary"
207
+ bubble={
208
+ <div>
209
+ <p>Good morning!</p>
210
+ <p class="mt-1">Sure, I'll take a look right now.</p>
211
+ </div>
212
+ }
213
+ />
214
+ ```
215
+
216
+ ### Pattern 5 — Full conversation layout
217
+ ```tsx
218
+ <div class="bg-base-200 max-w-xl space-y-2 rounded-lg p-4">
219
+ <ChatBubble
220
+ align="start"
221
+ color="neutral"
222
+ avatar={<Avatar image="/customer.webp" width={36} />}
223
+ header={<span class="text-sm font-bold">Customer</span>}
224
+ bubble={<span>Hi, I have a question about my order.</span>}
225
+ />
226
+ <ChatBubble
227
+ align="end"
228
+ color="info"
229
+ avatar={
230
+ <Avatar
231
+ width={36}
232
+ placeholder={
233
+ <div class="bg-info text-info-content flex h-9 w-9 items-center justify-center rounded-full">
234
+ <span class="text-sm">CS</span>
235
+ </div>
236
+ }
237
+ />
238
+ }
239
+ header={<span class="text-sm font-bold">Support</span>}
240
+ bubble={<span>Hello! What's your order number?</span>}
241
+ />
242
+ </div>
243
+ ```
244
+
245
+ ### Pattern 6 — Rendering a list of messages from data
246
+ ```tsx
247
+ type Message = {
248
+ id: string;
249
+ text: string;
250
+ sender: 'me' | 'other';
251
+ senderName: string;
252
+ time: string;
253
+ };
254
+
255
+ <For each={messages()}>
256
+ {msg => (
257
+ <ChatBubble
258
+ align={msg.sender === 'me' ? 'end' : 'start'}
259
+ color={msg.sender === 'me' ? 'primary' : 'neutral'}
260
+ header={
261
+ <div class="flex items-center gap-2">
262
+ <span class="font-bold">{msg.senderName}</span>
263
+ <time class="text-xs opacity-50">{msg.time}</time>
264
+ </div>
265
+ }
266
+ bubble={<span>{msg.text}</span>}
267
+ />
268
+ )}
269
+ </For>
270
+ ```
271
+
272
+ ---
273
+
274
+ ## BEHAVIOR NOTES FOR AGENTS
275
+
276
+ 1. **`bubble` is the only required prop** — but always pass `align` explicitly to control message side. Without `align`, the bubble renders without a positioning class.
277
+
278
+ 2. **All optional sections are independently conditional** — `avatar`, `header`, `footer` each use `<Show when={prop}>`. Falsy values (`undefined`, `null`, `false`, empty string) cause their section to be unmounted entirely.
279
+
280
+ 3. **`bubble` accepts any JSX** — string, `<span>`, `<div>` with multiline content, images, etc. The `.chat-bubble` div wraps whatever is passed.
281
+
282
+ 4. **`footer` prop is broken** — see bug section. The footer visibility toggle works (via `<Show>`), but the content rendered is `bubble`, not `footer`. Do not use `footer` in production UI until fixed.
283
+
284
+ 5. **Component renders inside a `<>` fragment** — the root `<div class="chat">` is not the component root; it's wrapped in a fragment. This has no practical impact but means the component emits no additional wrapper element.
285
+
286
+ 6. **Convention for conversation UIs** — wrap multiple `ChatBubble` components in a `<div class="space-y-2">` container. Use `max-w-xl` or similar to constrain chat width.
287
+
288
+ ---
289
+
290
+ ## COMMON MISTAKES TO AVOID
291
+
292
+ | Mistake | Correct approach |
293
+ |---|---|
294
+ | Omitting `align` prop | Always pass `align="start"` or `align="end"` explicitly |
295
+ | Using `footer` prop expecting custom footer content | `footer` has a bug — it renders `bubble` content instead; avoid until fixed |
296
+ | Passing `align` as a reactive signal without accessor | Pass signal accessor: `align={message.isOwn ? 'end' : 'start'}` |
297
+ | Putting children inside `<ChatBubble>` | Component is NOT a `ParentComponent` — use `bubble` prop instead |
298
+ | Omitting `color` and expecting styled bubble | Without `color`, bubble uses DaisyUI default (no color class) |
299
+ | Forgetting `space-y-2` wrapper for conversation | Multiple bubbles need spacing — wrap in `<div class="space-y-2">` |
300
+
301
+ ---
302
+
303
+ ## FULL EXAMPLE — Complete chat UI
304
+
305
+ ```tsx
306
+ import { ChatBubble } from 'solid-tom-ui';
307
+ import { Avatar } from 'solid-tom-ui';
308
+ import { For } from 'solid-js';
309
+
310
+ const messages = [
311
+ { id: '1', sender: 'other', name: 'Alice', time: '12:44', text: 'Hey! Are you free today?' },
312
+ { id: '2', sender: 'me', name: 'You', time: '12:45', text: 'Yes, what's up?' },
313
+ { id: '3', sender: 'other', name: 'Alice', time: '12:45', text: 'Want to grab lunch?' },
314
+ { id: '4', sender: 'me', name: 'You', time: '12:46', text: 'Sure! Where do you want to go?' },
315
+ ];
316
+
317
+ <div class="bg-base-200 max-w-xl space-y-2 rounded-xl p-4">
318
+ <For each={messages}>
319
+ {msg => (
320
+ <ChatBubble
321
+ align={msg.sender === 'me' ? 'end' : 'start'}
322
+ color={msg.sender === 'me' ? 'primary' : 'neutral'}
323
+ avatar={<Avatar image="/avatar.webp" width={36} />}
324
+ header={
325
+ <div class="flex items-center gap-2">
326
+ <span class="font-bold text-sm">{msg.name}</span>
327
+ <time class="text-xs opacity-50">{msg.time}</time>
328
+ </div>
329
+ }
330
+ bubble={<span>{msg.text}</span>}
331
+ />
332
+ )}
333
+ </For>
334
+ </div>
335
+ ```
336
+ ---
337
+
338
+ ## Component Conventions
339
+
340
+ > **CSS encoding**: internal CSS classes use short encoded names (e.g. `cb01`, `cb02`) per project convention.
341
+
342
+ > **Unique IDs**: if this component needs to generate HTML `id` attributes, always use `createUniqueId()` from `solid-js` — never `Math.random()` or `Date.now()`.