@cossistant/react 0.0.28 → 0.0.30

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 (301) hide show
  1. package/README.md +1 -1
  2. package/_virtual/rolldown_runtime.js +9 -23
  3. package/hooks/index.d.ts +3 -3
  4. package/hooks/private/store/use-conversations-store.d.ts +2 -0
  5. package/hooks/private/store/use-conversations-store.d.ts.map +1 -1
  6. package/hooks/private/store/use-conversations-store.js +15 -8
  7. package/hooks/private/store/use-conversations-store.js.map +1 -1
  8. package/hooks/private/store/use-store-selector.d.ts +3 -0
  9. package/hooks/private/store/use-store-selector.d.ts.map +1 -1
  10. package/hooks/private/store/use-store-selector.js +4 -8
  11. package/hooks/private/store/use-store-selector.js.map +1 -1
  12. package/hooks/private/store/use-website-store.d.ts +3 -1
  13. package/hooks/private/store/use-website-store.d.ts.map +1 -1
  14. package/hooks/private/store/use-website-store.js +14 -6
  15. package/hooks/private/store/use-website-store.js.map +1 -1
  16. package/hooks/private/use-client-query.d.ts +1 -1
  17. package/hooks/private/use-client-query.d.ts.map +1 -1
  18. package/hooks/private/use-client-query.js +1 -0
  19. package/hooks/private/use-client-query.js.map +1 -1
  20. package/hooks/private/use-default-messages.d.ts +1 -1
  21. package/hooks/private/use-grouped-messages.d.ts +10 -7
  22. package/hooks/private/use-grouped-messages.d.ts.map +1 -1
  23. package/hooks/private/use-grouped-messages.js +44 -11
  24. package/hooks/private/use-grouped-messages.js.map +1 -1
  25. package/hooks/private/use-rest-client.d.ts +13 -3
  26. package/hooks/private/use-rest-client.d.ts.map +1 -1
  27. package/hooks/private/use-rest-client.js +49 -22
  28. package/hooks/private/use-rest-client.js.map +1 -1
  29. package/hooks/private/use-visitor-typing-reporter.d.ts +1 -1
  30. package/hooks/use-conversation-auto-seen.d.ts +1 -1
  31. package/hooks/use-conversation-page.d.ts +1 -1
  32. package/hooks/use-conversation-page.d.ts.map +1 -1
  33. package/hooks/use-conversation-page.js +10 -3
  34. package/hooks/use-conversation-page.js.map +1 -1
  35. package/hooks/use-conversation-preview.d.ts +3 -1
  36. package/hooks/use-conversation-preview.d.ts.map +1 -1
  37. package/hooks/use-conversation-preview.js +6 -3
  38. package/hooks/use-conversation-preview.js.map +1 -1
  39. package/hooks/use-conversation-seen.d.ts +1 -1
  40. package/hooks/use-conversation-seen.js +1 -1
  41. package/hooks/use-conversation-seen.js.map +1 -1
  42. package/hooks/use-conversation-timeline-items.d.ts +1 -1
  43. package/hooks/use-conversation-timeline-items.js +2 -3
  44. package/hooks/use-conversation-timeline-items.js.map +1 -1
  45. package/hooks/use-conversation-timeline.d.ts +1 -1
  46. package/hooks/use-conversation-timeline.d.ts.map +1 -1
  47. package/hooks/use-conversation-timeline.js +1 -3
  48. package/hooks/use-conversation-timeline.js.map +1 -1
  49. package/hooks/use-conversation.d.ts +1 -1
  50. package/hooks/use-conversation.js +2 -3
  51. package/hooks/use-conversation.js.map +1 -1
  52. package/hooks/use-conversations.d.ts +1 -1
  53. package/hooks/use-conversations.js +5 -3
  54. package/hooks/use-conversations.js.map +1 -1
  55. package/hooks/use-create-conversation.d.ts +3 -3
  56. package/hooks/use-create-conversation.js +1 -0
  57. package/hooks/use-create-conversation.js.map +1 -1
  58. package/hooks/use-file-upload.d.ts +1 -1
  59. package/hooks/use-file-upload.js +3 -3
  60. package/hooks/use-file-upload.js.map +1 -1
  61. package/hooks/use-home-page.js +3 -3
  62. package/hooks/use-home-page.js.map +1 -1
  63. package/hooks/use-message-composer.d.ts +10 -3
  64. package/hooks/use-message-composer.d.ts.map +1 -1
  65. package/hooks/use-message-composer.js +5 -2
  66. package/hooks/use-message-composer.js.map +1 -1
  67. package/hooks/use-realtime-support.d.ts +1 -1
  68. package/hooks/use-send-message.d.ts +8 -2
  69. package/hooks/use-send-message.d.ts.map +1 -1
  70. package/hooks/use-send-message.js +5 -3
  71. package/hooks/use-send-message.js.map +1 -1
  72. package/hooks/use-visitor.js +2 -2
  73. package/hooks/use-visitor.js.map +1 -1
  74. package/identify-visitor.d.ts.map +1 -1
  75. package/identify-visitor.js +15 -1
  76. package/identify-visitor.js.map +1 -1
  77. package/index.d.ts +3 -3
  78. package/index.js +1 -1
  79. package/package.json +5 -3
  80. package/{conversation.d.ts → packages/types/src/api/conversation.d.ts} +368 -64
  81. package/packages/types/src/api/conversation.d.ts.map +1 -0
  82. package/packages/types/src/api/timeline-item.d.ts +460 -0
  83. package/packages/types/src/api/timeline-item.d.ts.map +1 -0
  84. package/packages/types/src/realtime-events.d.ts +1004 -0
  85. package/packages/types/src/realtime-events.d.ts.map +1 -0
  86. package/{schemas3.d.ts → packages/types/src/schemas.d.ts} +95 -19
  87. package/packages/types/src/schemas.d.ts.map +1 -0
  88. package/primitives/avatar/avatar.js +1 -1
  89. package/primitives/avatar/avatar.js.map +1 -1
  90. package/primitives/avatar/fallback.d.ts.map +1 -1
  91. package/primitives/avatar/fallback.js +2 -2
  92. package/primitives/avatar/fallback.js.map +1 -1
  93. package/primitives/avatar/image.d.ts +1 -1
  94. package/primitives/avatar/image.js +1 -1
  95. package/primitives/avatar/image.js.map +1 -1
  96. package/primitives/button.js +1 -1
  97. package/primitives/button.js.map +1 -1
  98. package/primitives/conversation-timeline.d.ts +1 -1
  99. package/primitives/conversation-timeline.js +4 -4
  100. package/primitives/conversation-timeline.js.map +1 -1
  101. package/primitives/day-separator.d.ts +76 -0
  102. package/primitives/day-separator.d.ts.map +1 -0
  103. package/primitives/day-separator.js +111 -0
  104. package/primitives/day-separator.js.map +1 -0
  105. package/primitives/index.d.ts +3 -2
  106. package/primitives/index.js +6 -1
  107. package/primitives/index.parts.d.ts +2 -1
  108. package/primitives/index.parts.js +2 -1
  109. package/primitives/multimodal-input.d.ts +2 -2
  110. package/primitives/multimodal-input.d.ts.map +1 -1
  111. package/primitives/multimodal-input.js +2 -2
  112. package/primitives/multimodal-input.js.map +1 -1
  113. package/primitives/timeline-item-attachments.d.ts +1 -1
  114. package/primitives/timeline-item-attachments.js +6 -7
  115. package/primitives/timeline-item-attachments.js.map +1 -1
  116. package/primitives/timeline-item-group.d.ts +1 -1
  117. package/primitives/timeline-item-group.d.ts.map +1 -1
  118. package/primitives/timeline-item-group.js +8 -8
  119. package/primitives/timeline-item-group.js.map +1 -1
  120. package/primitives/timeline-item.d.ts +1 -1
  121. package/primitives/timeline-item.d.ts.map +1 -1
  122. package/primitives/timeline-item.js +33 -8
  123. package/primitives/timeline-item.js.map +1 -1
  124. package/primitives/trigger.js +1 -1
  125. package/primitives/trigger.js.map +1 -1
  126. package/primitives/window.js +1 -1
  127. package/primitives/window.js.map +1 -1
  128. package/provider.d.ts +4 -2
  129. package/provider.d.ts.map +1 -1
  130. package/provider.js +56 -8
  131. package/provider.js.map +1 -1
  132. package/realtime/event-filter.d.ts +4 -1
  133. package/realtime/event-filter.d.ts.map +1 -1
  134. package/realtime/event-filter.js +14 -0
  135. package/realtime/event-filter.js.map +1 -1
  136. package/realtime/provider.d.ts +1 -1
  137. package/realtime/provider.d.ts.map +1 -1
  138. package/realtime/provider.js +1 -2
  139. package/realtime/provider.js.map +1 -1
  140. package/realtime/seen-store.d.ts +2 -2
  141. package/realtime/support-provider.js +6 -1
  142. package/realtime/support-provider.js.map +1 -1
  143. package/realtime/typing-store.d.ts +1 -1
  144. package/realtime/use-realtime.d.ts +1 -1
  145. package/support/components/avatar-stack.d.ts.map +1 -1
  146. package/support/components/avatar-stack.js +32 -12
  147. package/support/components/avatar-stack.js.map +1 -1
  148. package/support/components/avatar.d.ts +34 -3
  149. package/support/components/avatar.d.ts.map +1 -1
  150. package/support/components/avatar.js +61 -8
  151. package/support/components/avatar.js.map +1 -1
  152. package/support/components/button.d.ts +4 -2
  153. package/support/components/button.d.ts.map +1 -1
  154. package/support/components/button.js +3 -3
  155. package/support/components/button.js.map +1 -1
  156. package/support/components/configuration-error.d.ts +16 -0
  157. package/support/components/configuration-error.d.ts.map +1 -0
  158. package/support/components/configuration-error.js +162 -0
  159. package/support/components/configuration-error.js.map +1 -0
  160. package/support/components/content.js +1 -2
  161. package/support/components/content.js.map +1 -1
  162. package/support/components/conversation-button-link.js +18 -23
  163. package/support/components/conversation-button-link.js.map +1 -1
  164. package/support/components/conversation-event.d.ts.map +1 -1
  165. package/support/components/conversation-event.js +7 -5
  166. package/support/components/conversation-event.js.map +1 -1
  167. package/support/components/conversation-timeline.d.ts +6 -1
  168. package/support/components/conversation-timeline.d.ts.map +1 -1
  169. package/support/components/conversation-timeline.js +22 -2
  170. package/support/components/conversation-timeline.js.map +1 -1
  171. package/support/components/header.js +1 -1
  172. package/support/components/image-lightbox.d.ts +1 -1
  173. package/support/components/image-lightbox.js +1 -2
  174. package/support/components/image-lightbox.js.map +1 -1
  175. package/support/components/index.js +1 -1
  176. package/support/components/multimodal-input.js +0 -1
  177. package/support/components/multimodal-input.js.map +1 -1
  178. package/support/components/navigation-tab.js +1 -1
  179. package/support/components/online-indicator.d.ts +50 -0
  180. package/support/components/online-indicator.d.ts.map +1 -0
  181. package/support/components/online-indicator.js +65 -0
  182. package/support/components/online-indicator.js.map +1 -0
  183. package/support/components/root.js +0 -1
  184. package/support/components/root.js.map +1 -1
  185. package/support/components/timeline-identification-tool.js +4 -4
  186. package/support/components/timeline-identification-tool.js.map +1 -1
  187. package/support/components/timeline-message-group.d.ts +1 -1
  188. package/support/components/timeline-message-group.d.ts.map +1 -1
  189. package/support/components/timeline-message-group.js +6 -4
  190. package/support/components/timeline-message-group.js.map +1 -1
  191. package/support/components/timeline-message-item.d.ts +1 -1
  192. package/support/components/timeline-message-item.js +4 -4
  193. package/support/components/timeline-message-item.js.map +1 -1
  194. package/support/components/trigger.js +1 -2
  195. package/support/components/trigger.js.map +1 -1
  196. package/support/components/typing-indicator.js +1 -1
  197. package/support/components/typing-indicator.js.map +1 -1
  198. package/support/context/controlled-state.js +0 -1
  199. package/support/context/controlled-state.js.map +1 -1
  200. package/support/context/events.d.ts +1 -1
  201. package/support/context/events.js +0 -1
  202. package/support/context/events.js.map +1 -1
  203. package/support/context/handle.js +0 -1
  204. package/support/context/handle.js.map +1 -1
  205. package/support/context/identification.d.ts +33 -0
  206. package/support/context/identification.d.ts.map +1 -0
  207. package/support/context/identification.js +34 -0
  208. package/support/context/identification.js.map +1 -0
  209. package/support/context/positioning.js +0 -1
  210. package/support/context/positioning.js.map +1 -1
  211. package/support/context/slots.js +0 -1
  212. package/support/context/slots.js.map +1 -1
  213. package/support/context/websocket.d.ts +1 -1
  214. package/support/context/websocket.js +0 -1
  215. package/support/context/websocket.js.map +1 -1
  216. package/support/index.d.ts.map +1 -1
  217. package/support/index.js +51 -18
  218. package/support/index.js.map +1 -1
  219. package/support/pages/conversation-history.js +2 -1
  220. package/support/pages/conversation-history.js.map +1 -1
  221. package/support/pages/conversation.d.ts +1 -1
  222. package/support/pages/conversation.js +1 -1
  223. package/support/pages/conversation.js.map +1 -1
  224. package/support/pages/home.js +5 -3
  225. package/support/pages/home.js.map +1 -1
  226. package/support/router.d.ts.map +1 -1
  227. package/support/router.js +4 -0
  228. package/support/router.js.map +1 -1
  229. package/support/store/support-store.js +0 -1
  230. package/support/store/support-store.js.map +1 -1
  231. package/support/{support-C7Xaw-N6.css → support-DmViRaga.css} +2 -2
  232. package/support/{support-C7Xaw-N6.css.map → support-DmViRaga.css.map} +1 -1
  233. package/support/text/index.d.ts +1 -1
  234. package/support/text/index.d.ts.map +1 -1
  235. package/support/text/index.js +1 -1
  236. package/support/text/index.js.map +1 -1
  237. package/support/text/locales/en.js +1 -1
  238. package/support/text/locales/en.js.map +1 -1
  239. package/support/text/locales/es.js +1 -1
  240. package/support/text/locales/es.js.map +1 -1
  241. package/support/text/locales/fr.js +1 -1
  242. package/support/text/locales/fr.js.map +1 -1
  243. package/support/utils/index.d.ts +1 -1
  244. package/support-config.js +0 -1
  245. package/support-config.js.map +1 -1
  246. package/support.css +1 -1
  247. package/tailwind.css +1 -1
  248. package/utils/conversation.d.ts.map +1 -1
  249. package/utils/conversation.js +1 -3
  250. package/utils/conversation.js.map +1 -1
  251. package/utils/use-render-element.d.ts.map +1 -1
  252. package/utils/use-render-element.js +20 -5
  253. package/utils/use-render-element.js.map +1 -1
  254. package/api.d.ts +0 -71
  255. package/api.d.ts.map +0 -1
  256. package/checks.d.ts +0 -189
  257. package/checks.d.ts.map +0 -1
  258. package/clsx.d.ts +0 -7
  259. package/clsx.d.ts.map +0 -1
  260. package/coerce.d.ts +0 -9
  261. package/coerce.d.ts.map +0 -1
  262. package/conversation.d.ts.map +0 -1
  263. package/core.d.ts +0 -35
  264. package/core.d.ts.map +0 -1
  265. package/errors.d.ts +0 -121
  266. package/errors.d.ts.map +0 -1
  267. package/errors2.d.ts +0 -24
  268. package/errors2.d.ts.map +0 -1
  269. package/index2.d.ts +0 -4
  270. package/index3.d.ts +0 -1
  271. package/metadata.d.ts +0 -1
  272. package/openapi-generator.d.ts +0 -1
  273. package/openapi-generator2.d.ts +0 -1
  274. package/openapi-generator3.d.ts +0 -1
  275. package/openapi30.d.ts +0 -125
  276. package/openapi30.d.ts.map +0 -1
  277. package/openapi31.d.ts +0 -131
  278. package/openapi31.d.ts.map +0 -1
  279. package/parse.d.ts +0 -17
  280. package/parse.d.ts.map +0 -1
  281. package/realtime-events.d.ts +0 -482
  282. package/realtime-events.d.ts.map +0 -1
  283. package/registries.d.ts +0 -32
  284. package/registries.d.ts.map +0 -1
  285. package/schemas.d.ts +0 -673
  286. package/schemas.d.ts.map +0 -1
  287. package/schemas2.d.ts +0 -320
  288. package/schemas2.d.ts.map +0 -1
  289. package/schemas3.d.ts.map +0 -1
  290. package/specification-extension.d.ts +0 -9
  291. package/specification-extension.d.ts.map +0 -1
  292. package/standard-schema.d.ts +0 -59
  293. package/standard-schema.d.ts.map +0 -1
  294. package/timeline-item.d.ts +0 -227
  295. package/timeline-item.d.ts.map +0 -1
  296. package/util.d.ts +0 -41
  297. package/util.d.ts.map +0 -1
  298. package/versions.d.ts +0 -9
  299. package/versions.d.ts.map +0 -1
  300. package/zod-extensions.d.ts +0 -39
  301. package/zod-ext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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8VD,iBAAA,gBAAiC;KAEjC,+BAA+B,qBAAqB,eACvD,gBAAgB;KAGb,wBAAwB;QAC7B;WACG,qBAAqB;;KAGnB,gBAAA,WACL,oBAAoB,cAAc,KACvC;KAEU,4BAA4B,qBACvC,qBAAqB"}
@@ -1,6 +1,6 @@
1
- import { $strip } from "./schemas.js";
2
- import { output } from "./core.js";
3
- import { ZodArray, ZodDefault, ZodEnum, ZodLiteral, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodString, ZodUnion } from "./schemas2.js";
1
+ import { $loose, $strip } from "../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/schemas.js";
2
+ import { output } from "../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/core.js";
3
+ import { ZodArray, ZodDefault, ZodEnum, ZodLiteral, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRecord, ZodString, ZodUnion, ZodUnknown } from "../../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
4
4
 
5
5
  //#region ../types/src/schemas.d.ts
6
6
 
@@ -12,8 +12,8 @@ declare const conversationSchema: ZodObject<{
12
12
  visitorId: ZodString;
13
13
  websiteId: ZodString;
14
14
  status: ZodDefault<ZodEnum<{
15
- resolved: "resolved";
16
15
  open: "open";
16
+ resolved: "resolved";
17
17
  spam: "spam";
18
18
  }>>;
19
19
  deletedAt: ZodDefault<ZodNullable<ZodString>>;
@@ -36,6 +36,96 @@ declare const conversationSchema: ZodObject<{
36
36
  parts: ZodArray<ZodUnion<readonly [ZodObject<{
37
37
  type: ZodLiteral<"text">;
38
38
  text: ZodString;
39
+ state: ZodOptional<ZodEnum<{
40
+ done: "done";
41
+ streaming: "streaming";
42
+ }>>;
43
+ }, $strip>, ZodObject<{
44
+ type: ZodLiteral<"reasoning">;
45
+ text: ZodString;
46
+ state: ZodOptional<ZodEnum<{
47
+ done: "done";
48
+ streaming: "streaming";
49
+ }>>;
50
+ providerMetadata: ZodOptional<ZodObject<{
51
+ cossistant: ZodOptional<ZodObject<{
52
+ visibility: ZodOptional<ZodEnum<{
53
+ public: "public";
54
+ private: "private";
55
+ }>>;
56
+ progressMessage: ZodOptional<ZodString>;
57
+ knowledgeId: ZodOptional<ZodString>;
58
+ }, $strip>>;
59
+ }, $loose>>;
60
+ }, $strip>, ZodObject<{
61
+ type: ZodString;
62
+ toolCallId: ZodString;
63
+ toolName: ZodString;
64
+ input: ZodRecord<ZodString, ZodUnknown>;
65
+ output: ZodOptional<ZodUnknown>;
66
+ state: ZodEnum<{
67
+ error: "error";
68
+ result: "result";
69
+ partial: "partial";
70
+ }>;
71
+ errorText: ZodOptional<ZodString>;
72
+ providerMetadata: ZodOptional<ZodObject<{
73
+ cossistant: ZodOptional<ZodObject<{
74
+ visibility: ZodOptional<ZodEnum<{
75
+ public: "public";
76
+ private: "private";
77
+ }>>;
78
+ progressMessage: ZodOptional<ZodString>;
79
+ knowledgeId: ZodOptional<ZodString>;
80
+ }, $strip>>;
81
+ }, $loose>>;
82
+ }, $strip>, ZodObject<{
83
+ type: ZodLiteral<"source-url">;
84
+ sourceId: ZodString;
85
+ url: ZodString;
86
+ title: ZodOptional<ZodString>;
87
+ providerMetadata: ZodOptional<ZodObject<{
88
+ cossistant: ZodOptional<ZodObject<{
89
+ visibility: ZodOptional<ZodEnum<{
90
+ public: "public";
91
+ private: "private";
92
+ }>>;
93
+ progressMessage: ZodOptional<ZodString>;
94
+ knowledgeId: ZodOptional<ZodString>;
95
+ }, $strip>>;
96
+ }, $loose>>;
97
+ }, $strip>, ZodObject<{
98
+ type: ZodLiteral<"source-document">;
99
+ sourceId: ZodString;
100
+ mediaType: ZodString;
101
+ title: ZodString;
102
+ filename: ZodOptional<ZodString>;
103
+ providerMetadata: ZodOptional<ZodObject<{
104
+ cossistant: ZodOptional<ZodObject<{
105
+ visibility: ZodOptional<ZodEnum<{
106
+ public: "public";
107
+ private: "private";
108
+ }>>;
109
+ progressMessage: ZodOptional<ZodString>;
110
+ knowledgeId: ZodOptional<ZodString>;
111
+ }, $strip>>;
112
+ }, $loose>>;
113
+ }, $strip>, ZodObject<{
114
+ type: ZodLiteral<"step-start">;
115
+ }, $strip>, ZodObject<{
116
+ type: ZodLiteral<"file">;
117
+ url: ZodString;
118
+ mediaType: ZodString;
119
+ filename: ZodOptional<ZodString>;
120
+ size: ZodOptional<ZodNumber>;
121
+ }, $strip>, ZodObject<{
122
+ type: ZodLiteral<"image">;
123
+ url: ZodString;
124
+ mediaType: ZodString;
125
+ filename: ZodOptional<ZodString>;
126
+ size: ZodOptional<ZodNumber>;
127
+ width: ZodOptional<ZodNumber>;
128
+ height: ZodOptional<ZodNumber>;
39
129
  }, $strip>, ZodObject<{
40
130
  type: ZodLiteral<"event">;
41
131
  eventType: ZodEnum<{
@@ -59,20 +149,6 @@ declare const conversationSchema: ZodObject<{
59
149
  targetUserId: ZodNullable<ZodString>;
60
150
  targetAiAgentId: ZodNullable<ZodString>;
61
151
  message: ZodOptional<ZodNullable<ZodString>>;
62
- }, $strip>, ZodObject<{
63
- type: ZodLiteral<"image">;
64
- url: ZodString;
65
- mediaType: ZodString;
66
- fileName: ZodOptional<ZodString>;
67
- size: ZodOptional<ZodNumber>;
68
- width: ZodOptional<ZodNumber>;
69
- height: ZodOptional<ZodNumber>;
70
- }, $strip>, ZodObject<{
71
- type: ZodLiteral<"file">;
72
- url: ZodString;
73
- mediaType: ZodString;
74
- fileName: ZodOptional<ZodString>;
75
- size: ZodOptional<ZodNumber>;
76
152
  }, $strip>, ZodObject<{
77
153
  type: ZodLiteral<"metadata">;
78
154
  source: ZodEnum<{
@@ -103,4 +179,4 @@ declare const conversationSeenSchema: ZodObject<{
103
179
  type ConversationSeen = output<typeof conversationSeenSchema>;
104
180
  //#endregion
105
181
  export { Conversation, ConversationSeen };
106
- //# sourceMappingURL=schemas3.d.ts.map
182
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","names":[],"sources":["../../../../../types/src/schemas.ts"],"sourcesContent":[],"mappings":";;;;;;cAkBa,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBnB,YAAA,GAAe,cAAe;cAE7B,wBAAsB;;;;;;EArBJ,UAAA,WAAA;EAAA,SAAA,WAAA;EAmBnB,SAAA,WAAY;EAEX,SAAA,aAAA,UAUX,CAAA;;KAEU,gBAAA,GAAmB,cAAe"}
@@ -18,7 +18,7 @@ const useAvatarContext = () => {
18
18
  * children so consumers can compose initials, images and status rings.
19
19
  */
20
20
  const Avatar = (() => {
21
- const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => {
21
+ const Component = React$1.forwardRef(({ children, className, asChild = false, ...props }, ref) => {
22
22
  const [imageLoadingStatus, setImageLoadingStatus] = React$1.useState("idle");
23
23
  const contextValue = React$1.useMemo(() => ({
24
24
  imageLoadingStatus,
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","names":["React","contextValue: AvatarContextValue","state: AvatarState"],"sources":["../../../src/primitives/avatar/avatar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../../utils/use-render-element\";\n\ntype AvatarState = {\n\timageLoadingStatus: \"idle\" | \"loading\" | \"loaded\" | \"error\";\n};\n\nexport type AvatarProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\nexport interface AvatarContextValue extends AvatarState {\n\tonImageLoadingStatusChange: (\n\t\tstatus: AvatarState[\"imageLoadingStatus\"]\n\t) => void;\n}\n\nconst AvatarContext = React.createContext<AvatarContextValue | null>(null);\n\n/**\n * Consumer hook for the `Avatar` compound components. Throws when components are\n * rendered outside of the `Avatar` tree to surface integration errors early.\n */\nexport const useAvatarContext = () => {\n\tconst context = React.useContext(AvatarContext);\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t\"Avatar compound components cannot be rendered outside the Avatar component\"\n\t\t);\n\t}\n\treturn context;\n};\n\n/**\n * Root avatar wrapper that coordinates image loading state with fallback\n * children so consumers can compose initials, images and status rings.\n */\nexport const Avatar = (() => {\n\tconst Component = React.forwardRef<HTMLSpanElement, AvatarProps>(\n\t\t({ children, className, asChild = false, ...props }, ref) => {\n\t\t\tconst [imageLoadingStatus, setImageLoadingStatus] =\n\t\t\t\tReact.useState<AvatarState[\"imageLoadingStatus\"]>(\"idle\");\n\n\t\t\tconst contextValue: AvatarContextValue = React.useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\timageLoadingStatus,\n\t\t\t\t\tonImageLoadingStatusChange: setImageLoadingStatus,\n\t\t\t\t}),\n\t\t\t\t[imageLoadingStatus]\n\t\t\t);\n\n\t\t\tconst state: AvatarState = {\n\t\t\t\timageLoadingStatus,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<AvatarContext.Provider value={contextValue}>\n\t\t\t\t\t{useRenderElement(\n\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tasChild,\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t)}\n\t\t\t\t</AvatarContext.Provider>\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"Avatar\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAsBA,MAAM,gBAAgBA,QAAM,cAAyC,KAAK;;;;;AAM1E,MAAa,yBAAyB;CACrC,MAAM,UAAUA,QAAM,WAAW,cAAc;AAC/C,KAAI,CAAC,QACJ,OAAM,IAAI,MACT,6EACA;AAEF,QAAO;;;;;;AAOR,MAAa,gBAAgB;CAC5B,MAAM,YAAYA,QAAM,YACtB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QAAQ;EAC5D,MAAM,CAAC,oBAAoB,yBAC1BA,QAAM,SAA4C,OAAO;EAE1D,MAAMC,eAAmCD,QAAM,eACvC;GACN;GACA,4BAA4B;GAC5B,GACD,CAAC,mBAAmB,CACpB;EAED,MAAME,QAAqB,EAC1B,oBACA;AAED,SACC,oBAAC,cAAc;GAAS,OAAO;aAC7B,iBACA,OACA;IACC;IACA;IACA,EACD;IACC;IACA;IACA,OAAO;KACN,GAAG;KACH;KACA;IACD,CACD;IACuB;GAG3B;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"avatar.js","names":["React","contextValue: AvatarContextValue","state: AvatarState"],"sources":["../../../src/primitives/avatar/avatar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../../utils/use-render-element\";\n\ntype AvatarState = {\n\timageLoadingStatus: \"idle\" | \"loading\" | \"loaded\" | \"error\";\n};\n\nexport type AvatarProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\nexport interface AvatarContextValue extends AvatarState {\n\tonImageLoadingStatusChange: (\n\t\tstatus: AvatarState[\"imageLoadingStatus\"]\n\t) => void;\n}\n\nconst AvatarContext = React.createContext<AvatarContextValue | null>(null);\n\n/**\n * Consumer hook for the `Avatar` compound components. Throws when components are\n * rendered outside of the `Avatar` tree to surface integration errors early.\n */\nexport const useAvatarContext = () => {\n\tconst context = React.useContext(AvatarContext);\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t\"Avatar compound components cannot be rendered outside the Avatar component\"\n\t\t);\n\t}\n\treturn context;\n};\n\n/**\n * Root avatar wrapper that coordinates image loading state with fallback\n * children so consumers can compose initials, images and status rings.\n */\nexport const Avatar = (() => {\n\tconst Component = React.forwardRef<HTMLSpanElement, AvatarProps>(\n\t\t({ children, className, asChild = false, ...props }, ref) => {\n\t\t\tconst [imageLoadingStatus, setImageLoadingStatus] =\n\t\t\t\tReact.useState<AvatarState[\"imageLoadingStatus\"]>(\"idle\");\n\n\t\t\tconst contextValue: AvatarContextValue = React.useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\timageLoadingStatus,\n\t\t\t\t\tonImageLoadingStatusChange: setImageLoadingStatus,\n\t\t\t\t}),\n\t\t\t\t[imageLoadingStatus]\n\t\t\t);\n\n\t\t\tconst state: AvatarState = {\n\t\t\t\timageLoadingStatus,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<AvatarContext.Provider value={contextValue}>\n\t\t\t\t\t{useRenderElement(\n\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tasChild,\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t...props,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t)}\n\t\t\t\t</AvatarContext.Provider>\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"Avatar\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAsBA,MAAM,gBAAgBA,QAAM,cAAyC,KAAK;;;;;AAM1E,MAAa,yBAAyB;CACrC,MAAM,UAAUA,QAAM,WAAW,cAAc;AAC/C,KAAI,CAAC,QACJ,OAAM,IAAI,MACT,6EACA;AAEF,QAAO;;;;;;AAOR,MAAa,gBAAgB;CAC5B,MAAM,YAAYA,QAAM,YACtB,EAAE,UAAU,WAAW,UAAU,OAAO,GAAG,SAAS,QAAQ;EAC5D,MAAM,CAAC,oBAAoB,yBAC1BA,QAAM,SAA4C,OAAO;EAE1D,MAAMC,eAAmCD,QAAM,eACvC;GACN;GACA,4BAA4B;GAC5B,GACD,CAAC,mBAAmB,CACpB;EAED,MAAME,QAAqB,EAC1B,oBACA;AAED,SACC,oBAAC,cAAc;GAAS,OAAO;aAC7B,iBACA,OACA;IACC;IACA;IACA,EACD;IACC;IACA;IACA,OAAO;KACN,GAAG;KACH;KACA;IACD,CACD;IACuB;GAG3B;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"fallback.d.ts","names":[],"sources":["../../../src/primitives/avatar/fallback.tsx"],"sourcesContent":[],"mappings":";;;KASY,mBAAA,GAAsB,KACjC,OAAA,CAAM,eAAe;aAGV,OAAA,CAAM;EAJN,IAAA,CAAA,EAAA,MAAA;EACU,OAAA,CAAA,EAAA,MAAA;EAArB,OAAM,CAAA,EAAA,OAAA;EAD2B,SAAA,CAAA,EAAA,MAAA;CAItB;;AA4BZ;;;AAA2B,cAAd,cAAc,EAAA,OAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,OAAA,CAAA,cAAA,CAAA,eAAA,CAAA,EAAA,UAAA,CAAA,GAAA;EA5Bf,QAAM,CAAA,EAAN,OAAA,CAAM,SAAA;;;EA4BS,OAAA,CAAA,EAAA,OAAA;EAAA,SAAA,CAAA,EAAA,MAAA"}
1
+ {"version":3,"file":"fallback.d.ts","names":[],"sources":["../../../src/primitives/avatar/fallback.tsx"],"sourcesContent":[],"mappings":";;;KASY,mBAAA,GAAsB,KACjC,OAAA,CAAM,eAAe;aAGV,OAAA,CAAM;EAJN,IAAA,CAAA,EAAA,MAAA;EACU,OAAA,CAAA,EAAA,MAAA;EAArB,OAAM,CAAA,EAAA,OAAA;EAD2B,SAAA,CAAA,EAAA,MAAA;CAItB;;AA2BZ;;;AAA2B,cAAd,cAAc,EAAA,OAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,OAAA,CAAA,cAAA,CAAA,eAAA,CAAA,EAAA,UAAA,CAAA,GAAA;EA3Bf,QAAM,CAAA,EAAN,OAAA,CAAM,SAAA;;;EA2BS,OAAA,CAAA,EAAA,OAAA;EAAA,SAAA,CAAA,EAAA,MAAA"}
@@ -7,14 +7,14 @@ const getInitials = (name) => {
7
7
  const names = name.trim().split(" ");
8
8
  if (names.length === 0) return "";
9
9
  if (names.length === 1) return names[0]?.charAt(0).toUpperCase() || "";
10
- return ((names[0]?.charAt(0) || "") + (names[names.length - 1]?.charAt(0) || "")).toUpperCase();
10
+ return ((names[0]?.charAt(0) || "") + (names.at(-1)?.charAt(0) || "")).toUpperCase();
11
11
  };
12
12
  /**
13
13
  * Displays initials or custom content while the avatar image loads or fails.
14
14
  * Optional delay avoids flashes when images load instantly.
15
15
  */
16
16
  const AvatarFallback = (() => {
17
- const Component = React$1.forwardRef(({ children, name = "", delayMs = 0, className, asChild = false,...props }, ref) => {
17
+ const Component = React$1.forwardRef(({ children, name = "", delayMs = 0, className, asChild = false, ...props }, ref) => {
18
18
  const { imageLoadingStatus } = useAvatarContext();
19
19
  const [canRender, setCanRender] = React$1.useState(delayMs === 0);
20
20
  React$1.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"fallback.js","names":["React","state: FallbackState"],"sources":["../../../src/primitives/avatar/fallback.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../../utils/use-render-element\";\nimport { useAvatarContext } from \"./avatar\";\n\ntype FallbackState = {\n\timageLoadingStatus: \"idle\" | \"loading\" | \"loaded\" | \"error\";\n\tinitials?: string;\n};\n\nexport type AvatarFallbackProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tname?: string;\n\tdelayMs?: number;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\nconst getInitials = (name: string): string => {\n\tconst names = name.trim().split(\" \");\n\tif (names.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tif (names.length === 1) {\n\t\treturn names[0]?.charAt(0).toUpperCase() || \"\";\n\t}\n\n\tconst firstInitial = names[0]?.charAt(0) || \"\";\n\t// biome-ignore lint/style/useAtIndex: ok here\n\tconst lastInitial = names[names.length - 1]?.charAt(0) || \"\";\n\n\treturn (firstInitial + lastInitial).toUpperCase();\n};\n\n/**\n * Displays initials or custom content while the avatar image loads or fails.\n * Optional delay avoids flashes when images load instantly.\n */\nexport const AvatarFallback = (() => {\n\tconst Component = React.forwardRef<HTMLSpanElement, AvatarFallbackProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tname = \"\",\n\t\t\t\tdelayMs = 0,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { imageLoadingStatus } = useAvatarContext();\n\t\t\tconst [canRender, setCanRender] = React.useState(delayMs === 0);\n\n\t\t\tReact.useEffect(() => {\n\t\t\t\tif (delayMs > 0) {\n\t\t\t\t\tconst timerId = window.setTimeout(() => setCanRender(true), delayMs);\n\t\t\t\t\treturn () => window.clearTimeout(timerId);\n\t\t\t\t}\n\t\t\t}, [delayMs]);\n\n\t\t\tconst initials = React.useMemo(() => {\n\t\t\t\tif (name) {\n\t\t\t\t\treturn getInitials(name);\n\t\t\t\t}\n\t\t\t\treturn \"\";\n\t\t\t}, [name]);\n\n\t\t\tconst state: FallbackState = {\n\t\t\t\timageLoadingStatus,\n\t\t\t\tinitials,\n\t\t\t};\n\n\t\t\tconst shouldRender =\n\t\t\t\tcanRender &&\n\t\t\t\timageLoadingStatus !== \"loaded\" &&\n\t\t\t\timageLoadingStatus !== \"loading\";\n\n\t\t\tconst content = children || initials;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"span\",\n\t\t\t\t{\n\t\t\t\t\tasChild,\n\t\t\t\t\tclassName,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tstate,\n\t\t\t\t\tenabled: shouldRender,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"AvatarFallback\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAoBA,MAAM,eAAe,SAAyB;CAC7C,MAAM,QAAQ,KAAK,MAAM,CAAC,MAAM,IAAI;AACpC,KAAI,MAAM,WAAW,EACpB,QAAO;AAGR,KAAI,MAAM,WAAW,EACpB,QAAO,MAAM,IAAI,OAAO,EAAE,CAAC,aAAa,IAAI;AAO7C,UAJqB,MAAM,IAAI,OAAO,EAAE,IAAI,OAExB,MAAM,MAAM,SAAS,IAAI,OAAO,EAAE,IAAI,KAEtB,aAAa;;;;;;AAOlD,MAAa,wBAAwB;CACpC,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,OAAO,IACP,UAAU,GACV,WACA,UAAU,MACV,GAAG,SAEJ,QACI;EACJ,MAAM,EAAE,uBAAuB,kBAAkB;EACjD,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,YAAY,EAAE;AAE/D,UAAM,gBAAgB;AACrB,OAAI,UAAU,GAAG;IAChB,MAAM,UAAU,OAAO,iBAAiB,aAAa,KAAK,EAAE,QAAQ;AACpE,iBAAa,OAAO,aAAa,QAAQ;;KAExC,CAAC,QAAQ,CAAC;EAEb,MAAM,WAAWA,QAAM,cAAc;AACpC,OAAI,KACH,QAAO,YAAY,KAAK;AAEzB,UAAO;KACL,CAAC,KAAK,CAAC;EAEV,MAAMC,QAAuB;GAC5B;GACA;GACA;EAED,MAAM,eACL,aACA,uBAAuB,YACvB,uBAAuB;EAExB,MAAM,UAAU,YAAY;AAE5B,SAAO,iBACN,QACA;GACC;GACA;GACA,EACD;GACC;GACA;GACA,SAAS;GACT,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"fallback.js","names":["React","state: FallbackState"],"sources":["../../../src/primitives/avatar/fallback.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../../utils/use-render-element\";\nimport { useAvatarContext } from \"./avatar\";\n\ntype FallbackState = {\n\timageLoadingStatus: \"idle\" | \"loading\" | \"loaded\" | \"error\";\n\tinitials?: string;\n};\n\nexport type AvatarFallbackProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tname?: string;\n\tdelayMs?: number;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\nconst getInitials = (name: string): string => {\n\tconst names = name.trim().split(\" \");\n\tif (names.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tif (names.length === 1) {\n\t\treturn names[0]?.charAt(0).toUpperCase() || \"\";\n\t}\n\n\tconst firstInitial = names[0]?.charAt(0) || \"\";\n\tconst lastInitial = names.at(-1)?.charAt(0) || \"\";\n\n\treturn (firstInitial + lastInitial).toUpperCase();\n};\n\n/**\n * Displays initials or custom content while the avatar image loads or fails.\n * Optional delay avoids flashes when images load instantly.\n */\nexport const AvatarFallback = (() => {\n\tconst Component = React.forwardRef<HTMLSpanElement, AvatarFallbackProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tname = \"\",\n\t\t\t\tdelayMs = 0,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { imageLoadingStatus } = useAvatarContext();\n\t\t\tconst [canRender, setCanRender] = React.useState(delayMs === 0);\n\n\t\t\tReact.useEffect(() => {\n\t\t\t\tif (delayMs > 0) {\n\t\t\t\t\tconst timerId = window.setTimeout(() => setCanRender(true), delayMs);\n\t\t\t\t\treturn () => window.clearTimeout(timerId);\n\t\t\t\t}\n\t\t\t}, [delayMs]);\n\n\t\t\tconst initials = React.useMemo(() => {\n\t\t\t\tif (name) {\n\t\t\t\t\treturn getInitials(name);\n\t\t\t\t}\n\t\t\t\treturn \"\";\n\t\t\t}, [name]);\n\n\t\t\tconst state: FallbackState = {\n\t\t\t\timageLoadingStatus,\n\t\t\t\tinitials,\n\t\t\t};\n\n\t\t\tconst shouldRender =\n\t\t\t\tcanRender &&\n\t\t\t\timageLoadingStatus !== \"loaded\" &&\n\t\t\t\timageLoadingStatus !== \"loading\";\n\n\t\t\tconst content = children || initials;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"span\",\n\t\t\t\t{\n\t\t\t\t\tasChild,\n\t\t\t\t\tclassName,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tstate,\n\t\t\t\t\tenabled: shouldRender,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"AvatarFallback\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAoBA,MAAM,eAAe,SAAyB;CAC7C,MAAM,QAAQ,KAAK,MAAM,CAAC,MAAM,IAAI;AACpC,KAAI,MAAM,WAAW,EACpB,QAAO;AAGR,KAAI,MAAM,WAAW,EACpB,QAAO,MAAM,IAAI,OAAO,EAAE,CAAC,aAAa,IAAI;AAM7C,UAHqB,MAAM,IAAI,OAAO,EAAE,IAAI,OACxB,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,KAEX,aAAa;;;;;;AAOlD,MAAa,wBAAwB;CACpC,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,OAAO,IACP,UAAU,GACV,WACA,UAAU,OACV,GAAG,SAEJ,QACI;EACJ,MAAM,EAAE,uBAAuB,kBAAkB;EACjD,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,YAAY,EAAE;AAE/D,UAAM,gBAAgB;AACrB,OAAI,UAAU,GAAG;IAChB,MAAM,UAAU,OAAO,iBAAiB,aAAa,KAAK,EAAE,QAAQ;AACpE,iBAAa,OAAO,aAAa,QAAQ;;KAExC,CAAC,QAAQ,CAAC;EAEb,MAAM,WAAWA,QAAM,cAAc;AACpC,OAAI,KACH,QAAO,YAAY,KAAK;AAEzB,UAAO;KACL,CAAC,KAAK,CAAC;EAEV,MAAMC,QAAuB;GAC5B;GACA;GACA;EAED,MAAM,eACL,aACA,uBAAuB,YACvB,uBAAuB;EAExB,MAAM,UAAU,YAAY;AAE5B,SAAO,iBACN,QACA;GACC;GACA;GACA,EACD;GACC;GACA;GACA,SAAS;GACT,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -15,7 +15,7 @@ type AvatarImageProps = Omit<React$1.ImgHTMLAttributes<HTMLImageElement>, "src"
15
15
  * Controlled `<img>` that syncs its loading status back to the avatar context
16
16
  * so fallbacks know when to display.
17
17
  */
18
- declare const AvatarImage: React$1.ForwardRefExoticComponent<Omit<React$1.ImgHTMLAttributes<HTMLImageElement>, "src" | "alt"> & {
18
+ declare const AvatarImage: React$1.ForwardRefExoticComponent<Omit<React$1.ImgHTMLAttributes<HTMLImageElement>, "alt" | "src"> & {
19
19
  src: string;
20
20
  alt?: string;
21
21
  asChild?: boolean;
@@ -8,7 +8,7 @@ import * as React$1 from "react";
8
8
  * so fallbacks know when to display.
9
9
  */
10
10
  const AvatarImage = (() => {
11
- const Component = React$1.forwardRef(({ src, alt = "", className, asChild = false, onLoadingStatusChange,...props }, ref) => {
11
+ const Component = React$1.forwardRef(({ src, alt = "", className, asChild = false, onLoadingStatusChange, ...props }, ref) => {
12
12
  const { imageLoadingStatus, onImageLoadingStatusChange } = useAvatarContext();
13
13
  const imageRef = React$1.useRef(null);
14
14
  React$1.useImperativeHandle(ref, () => imageRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","names":["React"],"sources":["../../../src/primitives/avatar/image.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../../utils/use-render-element\";\nimport { useAvatarContext } from \"./avatar\";\n\ntype ImageState = {\n\timageLoadingStatus: \"idle\" | \"loading\" | \"loaded\" | \"error\";\n};\n\nexport type AvatarImageProps = Omit<\n\tReact.ImgHTMLAttributes<HTMLImageElement>,\n\t\"src\" | \"alt\"\n> & {\n\tsrc: string;\n\talt?: string;\n\tasChild?: boolean;\n\tclassName?: string;\n\tonLoadingStatusChange?: (status: ImageState[\"imageLoadingStatus\"]) => void;\n};\n\n/**\n * Controlled `<img>` that syncs its loading status back to the avatar context\n * so fallbacks know when to display.\n */\nexport const AvatarImage = (() => {\n\tconst Component = React.forwardRef<HTMLImageElement, AvatarImageProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tsrc,\n\t\t\t\talt = \"\",\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tonLoadingStatusChange,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { imageLoadingStatus, onImageLoadingStatusChange } =\n\t\t\t\tuseAvatarContext();\n\n\t\t\tconst imageRef = React.useRef<HTMLImageElement>(null);\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: ok\n\t\t\tReact.useImperativeHandle(ref, () => imageRef.current!);\n\n\t\t\tconst updateImageLoadingStatus = React.useCallback(\n\t\t\t\t(status: ImageState[\"imageLoadingStatus\"]) => {\n\t\t\t\t\tonImageLoadingStatusChange(status);\n\t\t\t\t\tonLoadingStatusChange?.(status);\n\t\t\t\t},\n\t\t\t\t[onImageLoadingStatusChange, onLoadingStatusChange]\n\t\t\t);\n\n\t\t\tReact.useLayoutEffect(() => {\n\t\t\t\tif (!src) {\n\t\t\t\t\tupdateImageLoadingStatus(\"error\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet isMounted = true;\n\t\t\t\tconst image = new Image();\n\n\t\t\t\tconst updateStatus = (status: ImageState[\"imageLoadingStatus\"]) => {\n\t\t\t\t\tif (!isMounted) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tupdateImageLoadingStatus(status);\n\t\t\t\t};\n\n\t\t\t\tupdateStatus(\"loading\");\n\n\t\t\t\timage.onload = () => updateStatus(\"loaded\");\n\t\t\t\timage.onerror = () => updateStatus(\"error\");\n\t\t\t\timage.src = src;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tisMounted = false;\n\t\t\t\t};\n\t\t\t}, [src, updateImageLoadingStatus]);\n\n\t\t\tconst state: ImageState = {\n\t\t\t\timageLoadingStatus,\n\t\t\t};\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"img\",\n\t\t\t\t{\n\t\t\t\t\tasChild,\n\t\t\t\t\tclassName,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: imageRef,\n\t\t\t\t\tstate,\n\t\t\t\t\tenabled: imageLoadingStatus === \"loaded\",\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tsrc,\n\t\t\t\t\t\talt,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"AvatarImage\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;AAuBA,MAAa,qBAAqB;CACjC,MAAM,YAAYA,QAAM,YAEtB,EACC,KACA,MAAM,IACN,WACA,UAAU,OACV,sBACA,GAAG,SAEJ,QACI;EACJ,MAAM,EAAE,oBAAoB,+BAC3B,kBAAkB;EAEnB,MAAM,WAAWA,QAAM,OAAyB,KAAK;AAErD,UAAM,oBAAoB,WAAW,SAAS,QAAS;EAEvD,MAAM,2BAA2BA,QAAM,aACrC,WAA6C;AAC7C,8BAA2B,OAAO;AAClC,2BAAwB,OAAO;KAEhC,CAAC,4BAA4B,sBAAsB,CACnD;AAED,UAAM,sBAAsB;AAC3B,OAAI,CAAC,KAAK;AACT,6BAAyB,QAAQ;AACjC;;GAGD,IAAI,YAAY;GAChB,MAAM,QAAQ,IAAI,OAAO;GAEzB,MAAM,gBAAgB,WAA6C;AAClE,QAAI,CAAC,UACJ;AAED,6BAAyB,OAAO;;AAGjC,gBAAa,UAAU;AAEvB,SAAM,eAAe,aAAa,SAAS;AAC3C,SAAM,gBAAgB,aAAa,QAAQ;AAC3C,SAAM,MAAM;AAEZ,gBAAa;AACZ,gBAAY;;KAEX,CAAC,KAAK,yBAAyB,CAAC;AAMnC,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC,KAAK;GACL,OAZwB,EACzB,oBACA;GAWC,SAAS,uBAAuB;GAChC,OAAO;IACN,GAAG;IACH;IACA;IACA;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"image.js","names":["React"],"sources":["../../../src/primitives/avatar/image.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../../utils/use-render-element\";\nimport { useAvatarContext } from \"./avatar\";\n\ntype ImageState = {\n\timageLoadingStatus: \"idle\" | \"loading\" | \"loaded\" | \"error\";\n};\n\nexport type AvatarImageProps = Omit<\n\tReact.ImgHTMLAttributes<HTMLImageElement>,\n\t\"src\" | \"alt\"\n> & {\n\tsrc: string;\n\talt?: string;\n\tasChild?: boolean;\n\tclassName?: string;\n\tonLoadingStatusChange?: (status: ImageState[\"imageLoadingStatus\"]) => void;\n};\n\n/**\n * Controlled `<img>` that syncs its loading status back to the avatar context\n * so fallbacks know when to display.\n */\nexport const AvatarImage = (() => {\n\tconst Component = React.forwardRef<HTMLImageElement, AvatarImageProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tsrc,\n\t\t\t\talt = \"\",\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tonLoadingStatusChange,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { imageLoadingStatus, onImageLoadingStatusChange } =\n\t\t\t\tuseAvatarContext();\n\n\t\t\tconst imageRef = React.useRef<HTMLImageElement>(null);\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: ok\n\t\t\tReact.useImperativeHandle(ref, () => imageRef.current!);\n\n\t\t\tconst updateImageLoadingStatus = React.useCallback(\n\t\t\t\t(status: ImageState[\"imageLoadingStatus\"]) => {\n\t\t\t\t\tonImageLoadingStatusChange(status);\n\t\t\t\t\tonLoadingStatusChange?.(status);\n\t\t\t\t},\n\t\t\t\t[onImageLoadingStatusChange, onLoadingStatusChange]\n\t\t\t);\n\n\t\t\tReact.useLayoutEffect(() => {\n\t\t\t\tif (!src) {\n\t\t\t\t\tupdateImageLoadingStatus(\"error\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet isMounted = true;\n\t\t\t\tconst image = new Image();\n\n\t\t\t\tconst updateStatus = (status: ImageState[\"imageLoadingStatus\"]) => {\n\t\t\t\t\tif (!isMounted) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tupdateImageLoadingStatus(status);\n\t\t\t\t};\n\n\t\t\t\tupdateStatus(\"loading\");\n\n\t\t\t\timage.onload = () => updateStatus(\"loaded\");\n\t\t\t\timage.onerror = () => updateStatus(\"error\");\n\t\t\t\timage.src = src;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tisMounted = false;\n\t\t\t\t};\n\t\t\t}, [src, updateImageLoadingStatus]);\n\n\t\t\tconst state: ImageState = {\n\t\t\t\timageLoadingStatus,\n\t\t\t};\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"img\",\n\t\t\t\t{\n\t\t\t\t\tasChild,\n\t\t\t\t\tclassName,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: imageRef,\n\t\t\t\t\tstate,\n\t\t\t\t\tenabled: imageLoadingStatus === \"loaded\",\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tsrc,\n\t\t\t\t\t\talt,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"AvatarImage\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;AAuBA,MAAa,qBAAqB;CACjC,MAAM,YAAYA,QAAM,YAEtB,EACC,KACA,MAAM,IACN,WACA,UAAU,OACV,uBACA,GAAG,SAEJ,QACI;EACJ,MAAM,EAAE,oBAAoB,+BAC3B,kBAAkB;EAEnB,MAAM,WAAWA,QAAM,OAAyB,KAAK;AAErD,UAAM,oBAAoB,WAAW,SAAS,QAAS;EAEvD,MAAM,2BAA2BA,QAAM,aACrC,WAA6C;AAC7C,8BAA2B,OAAO;AAClC,2BAAwB,OAAO;KAEhC,CAAC,4BAA4B,sBAAsB,CACnD;AAED,UAAM,sBAAsB;AAC3B,OAAI,CAAC,KAAK;AACT,6BAAyB,QAAQ;AACjC;;GAGD,IAAI,YAAY;GAChB,MAAM,QAAQ,IAAI,OAAO;GAEzB,MAAM,gBAAgB,WAA6C;AAClE,QAAI,CAAC,UACJ;AAED,6BAAyB,OAAO;;AAGjC,gBAAa,UAAU;AAEvB,SAAM,eAAe,aAAa,SAAS;AAC3C,SAAM,gBAAgB,aAAa,QAAQ;AAC3C,SAAM,MAAM;AAEZ,gBAAa;AACZ,gBAAY;;KAEX,CAAC,KAAK,yBAAyB,CAAC;AAMnC,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC,KAAK;GACL,OAZwB,EACzB,oBACA;GAWC,SAAS,uBAAuB;GAChC,OAAO;IACN,GAAG;IACH;IACA;IACA;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -8,7 +8,7 @@ import * as React$1 from "react";
8
8
  * semantics.
9
9
  */
10
10
  const Button = (() => {
11
- const Component = React$1.forwardRef(({ className, asChild = false,...props }, ref) => useRenderElement("button", {
11
+ const Component = React$1.forwardRef(({ className, asChild = false, ...props }, ref) => useRenderElement("button", {
12
12
  className,
13
13
  asChild
14
14
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":["React"],"sources":["../../src/primitives/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Thin wrapper over a `<button>` that supports `asChild` composition so the\n * primitives can be slotted into external design systems without losing\n * semantics.\n */\nexport const Button = (() => {\n\tconst Component = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t\t({ className, asChild = false, ...props }, ref) =>\n\t\t\tuseRenderElement(\n\t\t\t\t\"button\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\t...props,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t)\n\t);\n\n\tComponent.displayName = \"Button\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;AAaA,MAAa,gBAAgB;CAC5B,MAAM,YAAYA,QAAM,YACtB,EAAE,WAAW,UAAU,MAAO,GAAG,SAAS,QAC1C,iBACC,UACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,GAAG;GACH;EACD,CACD,CACF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"button.js","names":["React"],"sources":["../../src/primitives/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Thin wrapper over a `<button>` that supports `asChild` composition so the\n * primitives can be slotted into external design systems without losing\n * semantics.\n */\nexport const Button = (() => {\n\tconst Component = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t\t({ className, asChild = false, ...props }, ref) =>\n\t\t\tuseRenderElement(\n\t\t\t\t\"button\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\t...props,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t)\n\t);\n\n\tComponent.displayName = \"Button\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;AAaA,MAAa,gBAAgB;CAC5B,MAAM,YAAYA,QAAM,YACtB,EAAE,WAAW,UAAU,OAAO,GAAG,SAAS,QAC1C,iBACC,UACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,GAAG;GACH;EACD,CACD,CACF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -1,4 +1,4 @@
1
- import { TimelineItem } from "../timeline-item.js";
1
+ import { TimelineItem } from "../packages/types/src/api/timeline-item.js";
2
2
  import * as React$1 from "react";
3
3
 
4
4
  //#region src/primitives/conversation-timeline.d.ts
@@ -18,7 +18,7 @@ function getLastItemKey(items) {
18
18
  * pagination callbacks for displaying timeline items (messages, events, etc.).
19
19
  */
20
20
  const ConversationTimeline = (() => {
21
- const Component = React$1.forwardRef(({ children, className, asChild = false, items = [], isLoading = false, hasMore = false, autoScroll = true, onScrollEnd, onScrollStart,...props }, ref) => {
21
+ const Component = React$1.forwardRef(({ children, className, asChild = false, items = [], isLoading = false, hasMore = false, autoScroll = true, onScrollEnd, onScrollStart, ...props }, ref) => {
22
22
  const internalRef = React$1.useRef(null);
23
23
  const { ref: scrollMaskRef, style: scrollMaskStyle } = useScrollMask({
24
24
  maskHeight: "54px",
@@ -108,7 +108,7 @@ const ConversationTimeline = (() => {
108
108
  * padding, backgrounds or transitions without touching the core timeline logic.
109
109
  */
110
110
  const ConversationTimelineContainer = (() => {
111
- const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => useRenderElement("div", {
111
+ const Component = React$1.forwardRef(({ children, className, asChild = false, ...props }, ref) => useRenderElement("div", {
112
112
  className,
113
113
  asChild
114
114
  }, {
@@ -126,7 +126,7 @@ const ConversationTimelineContainer = (() => {
126
126
  * skeletons or shimmer states without reimplementing ARIA wiring.
127
127
  */
128
128
  const ConversationTimelineLoading = (() => {
129
- const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => useRenderElement("div", {
129
+ const Component = React$1.forwardRef(({ children, className, asChild = false, ...props }, ref) => useRenderElement("div", {
130
130
  className,
131
131
  asChild
132
132
  }, {
@@ -146,7 +146,7 @@ const ConversationTimelineLoading = (() => {
146
146
  * region so screen readers announce the empty state.
147
147
  */
148
148
  const ConversationTimelineEmpty = (() => {
149
- const Component = React$1.forwardRef(({ children, className, asChild = false,...props }, ref) => useRenderElement("div", {
149
+ const Component = React$1.forwardRef(({ children, className, asChild = false, ...props }, ref) => useRenderElement("div", {
150
150
  className,
151
151
  asChild
152
152
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-timeline.js","names":["React","renderProps: ConversationTimelineRenderProps"],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useScrollMask } from \"../hooks/use-scroll-mask\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * High-level state of the timeline handed to render-prop children so they can show\n * skeletons, empty states or pagination affordances.\n */\nexport type ConversationTimelineRenderProps = {\n\titemCount: number;\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tisEmpty: boolean;\n};\n\nexport type ConversationTimelineProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: ConversationTimelineRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems?: TimelineItemType[];\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tautoScroll?: boolean;\n\tonScrollEnd?: () => void;\n\tonScrollStart?: () => void;\n};\n\nconst BOTTOM_THRESHOLD_PX = 12;\nconst TOP_THRESHOLD_PX = 2;\n/** Grace period after mount where all scrolls are instant (avoids animation on first render) */\nconst INITIAL_SCROLL_GRACE_MS = 300;\n\nfunction getLastItemKey(items: TimelineItemType[]): string | number | null {\n\tif (items.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst lastItem = items.at(-1);\n\n\tif (lastItem?.id) {\n\t\treturn lastItem.id;\n\t}\n\n\treturn lastItem?.createdAt ?? null;\n}\n\n/**\n * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and\n * pagination callbacks for displaying timeline items (messages, events, etc.).\n */\nexport const ConversationTimeline = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, ConversationTimelineProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tisLoading = false,\n\t\t\t\thasMore = false,\n\t\t\t\tautoScroll = true,\n\t\t\t\tonScrollEnd,\n\t\t\t\tonScrollStart,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst internalRef = React.useRef<HTMLDivElement>(null);\n\t\t\tconst { ref: scrollMaskRef, style: scrollMaskStyle } = useScrollMask({\n\t\t\t\tmaskHeight: \"54px\",\n\t\t\t\tscrollbarWidth: \"8px\",\n\t\t\t\ttopThreshold: TOP_THRESHOLD_PX,\n\t\t\t\tbottomThreshold: BOTTOM_THRESHOLD_PX,\n\t\t\t});\n\n\t\t\tconst setRefs = React.useCallback(\n\t\t\t\t(node: HTMLDivElement | null) => {\n\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t(\n\t\t\t\t\t\tscrollMaskRef as React.MutableRefObject<HTMLDivElement | null>\n\t\t\t\t\t).current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t(ref as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\t\t\tnode;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[ref, scrollMaskRef]\n\t\t\t);\n\n\t\t\t// Track mount time for grace period (instant scroll during initial load)\n\t\t\tconst mountTimeRef = React.useRef(Date.now());\n\t\t\tconst previousItemCount = React.useRef(items.length);\n\t\t\tconst previousLastItemKey = React.useRef<string | number | null>(\n\t\t\t\tgetLastItemKey(items)\n\t\t\t);\n\t\t\tconst isPinnedToBottom = React.useRef(true);\n\t\t\tconst isAtTop = React.useRef(true);\n\n\t\t\tconst renderProps: ConversationTimelineRenderProps = {\n\t\t\t\titemCount: items.length,\n\t\t\t\tisLoading,\n\t\t\t\thasMore,\n\t\t\t\tisEmpty: items.length === 0,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\tconst lastItemKey = getLastItemKey(items);\n\n\t\t\t// Auto-scroll to bottom when new timeline items are added\n\t\t\tReact.useEffect(() => {\n\t\t\t\tconst element = internalRef.current;\n\n\t\t\t\tif (!(element && autoScroll)) {\n\t\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst hasNewItems = items.length > previousItemCount.current;\n\t\t\t\tconst itemsRemoved = items.length < previousItemCount.current;\n\t\t\t\tconst appendedNewItem =\n\t\t\t\t\thasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\t\t\t\tconst replacedLastItem =\n\t\t\t\t\t!hasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\n\t\t\t\tconst isWithinGracePeriod =\n\t\t\t\t\tDate.now() - mountTimeRef.current < INITIAL_SCROLL_GRACE_MS;\n\n\t\t\t\tconst shouldSnapToBottom =\n\t\t\t\t\tisWithinGracePeriod ||\n\t\t\t\t\t(itemsRemoved && isPinnedToBottom.current) ||\n\t\t\t\t\t(appendedNewItem && isPinnedToBottom.current) ||\n\t\t\t\t\t(replacedLastItem && isPinnedToBottom.current);\n\n\t\t\t\tif (shouldSnapToBottom) {\n\t\t\t\t\t// Instant scroll during grace period, smooth scroll after\n\t\t\t\t\tif (isWithinGracePeriod) {\n\t\t\t\t\t\telement.scrollTop = element.scrollHeight;\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.scrollTo({ top: element.scrollHeight, behavior: \"smooth\" });\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = true;\n\t\t\t\t\tisAtTop.current = false;\n\t\t\t\t}\n\n\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t}, [autoScroll, items.length, lastItemKey]);\n\n\t\t\t// Handle scroll events for infinite scrolling\n\t\t\tconst handleScroll = React.useCallback(\n\t\t\t\t(e: React.UIEvent<HTMLDivElement>) => {\n\t\t\t\t\tconst element = e.currentTarget;\n\t\t\t\t\tconst { scrollTop, scrollHeight, clientHeight } = element;\n\n\t\t\t\t\tconst distanceFromBottom = scrollHeight - scrollTop - clientHeight;\n\t\t\t\t\tconst pinnedNow = distanceFromBottom <= BOTTOM_THRESHOLD_PX;\n\t\t\t\t\tif (pinnedNow && !isPinnedToBottom.current) {\n\t\t\t\t\t\tonScrollEnd?.();\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = pinnedNow;\n\n\t\t\t\t\tconst atTop = scrollTop <= TOP_THRESHOLD_PX;\n\t\t\t\t\tif (atTop && !isAtTop.current) {\n\t\t\t\t\t\tonScrollStart?.();\n\t\t\t\t\t}\n\t\t\t\t\tisAtTop.current = atTop;\n\t\t\t\t},\n\t\t\t\t[onScrollStart, onScrollEnd]\n\t\t\t);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: setRefs,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"log\",\n\t\t\t\t\t\t\"aria-label\": \"Conversation timeline\",\n\t\t\t\t\t\t\"aria-live\": \"polite\",\n\t\t\t\t\t\t\"aria-relevant\": \"additions\",\n\t\t\t\t\t\tonScroll: handleScroll,\n\t\t\t\t\t\tstyle: scrollMaskStyle,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"ConversationTimeline\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineContainerProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Wrapper around the scrollable timeline giving consumers an easy hook to add\n * padding, backgrounds or transitions without touching the core timeline logic.\n */\nexport const ConversationTimelineContainer = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineContainerProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineContainer\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineLoadingProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Accessible status region for loading more timeline items. Lets host apps render\n * skeletons or shimmer states without reimplementing ARIA wiring.\n */\nexport const ConversationTimelineLoading = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineLoadingProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"Loading timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineLoading\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineEmptyProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Placeholder state rendered when no timeline items are present. Uses a polite status\n * region so screen readers announce the empty state.\n */\nexport const ConversationTimelineEmpty = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineEmptyProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"No timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineEmpty\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAiCA,MAAM,sBAAsB;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;EACA,OAAO;GACN,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,qCAAqC;CACjD,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,mCAAmC;CAC/C,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"conversation-timeline.js","names":["React","renderProps: ConversationTimelineRenderProps"],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useScrollMask } from \"../hooks/use-scroll-mask\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * High-level state of the timeline handed to render-prop children so they can show\n * skeletons, empty states or pagination affordances.\n */\nexport type ConversationTimelineRenderProps = {\n\titemCount: number;\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tisEmpty: boolean;\n};\n\nexport type ConversationTimelineProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: ConversationTimelineRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems?: TimelineItemType[];\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tautoScroll?: boolean;\n\tonScrollEnd?: () => void;\n\tonScrollStart?: () => void;\n};\n\nconst BOTTOM_THRESHOLD_PX = 12;\nconst TOP_THRESHOLD_PX = 2;\n/** Grace period after mount where all scrolls are instant (avoids animation on first render) */\nconst INITIAL_SCROLL_GRACE_MS = 300;\n\nfunction getLastItemKey(items: TimelineItemType[]): string | number | null {\n\tif (items.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst lastItem = items.at(-1);\n\n\tif (lastItem?.id) {\n\t\treturn lastItem.id;\n\t}\n\n\treturn lastItem?.createdAt ?? null;\n}\n\n/**\n * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and\n * pagination callbacks for displaying timeline items (messages, events, etc.).\n */\nexport const ConversationTimeline = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, ConversationTimelineProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tisLoading = false,\n\t\t\t\thasMore = false,\n\t\t\t\tautoScroll = true,\n\t\t\t\tonScrollEnd,\n\t\t\t\tonScrollStart,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst internalRef = React.useRef<HTMLDivElement>(null);\n\t\t\tconst { ref: scrollMaskRef, style: scrollMaskStyle } = useScrollMask({\n\t\t\t\tmaskHeight: \"54px\",\n\t\t\t\tscrollbarWidth: \"8px\",\n\t\t\t\ttopThreshold: TOP_THRESHOLD_PX,\n\t\t\t\tbottomThreshold: BOTTOM_THRESHOLD_PX,\n\t\t\t});\n\n\t\t\tconst setRefs = React.useCallback(\n\t\t\t\t(node: HTMLDivElement | null) => {\n\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t(\n\t\t\t\t\t\tscrollMaskRef as React.MutableRefObject<HTMLDivElement | null>\n\t\t\t\t\t).current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t(ref as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\t\t\tnode;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[ref, scrollMaskRef]\n\t\t\t);\n\n\t\t\t// Track mount time for grace period (instant scroll during initial load)\n\t\t\tconst mountTimeRef = React.useRef(Date.now());\n\t\t\tconst previousItemCount = React.useRef(items.length);\n\t\t\tconst previousLastItemKey = React.useRef<string | number | null>(\n\t\t\t\tgetLastItemKey(items)\n\t\t\t);\n\t\t\tconst isPinnedToBottom = React.useRef(true);\n\t\t\tconst isAtTop = React.useRef(true);\n\n\t\t\tconst renderProps: ConversationTimelineRenderProps = {\n\t\t\t\titemCount: items.length,\n\t\t\t\tisLoading,\n\t\t\t\thasMore,\n\t\t\t\tisEmpty: items.length === 0,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\tconst lastItemKey = getLastItemKey(items);\n\n\t\t\t// Auto-scroll to bottom when new timeline items are added\n\t\t\tReact.useEffect(() => {\n\t\t\t\tconst element = internalRef.current;\n\n\t\t\t\tif (!(element && autoScroll)) {\n\t\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst hasNewItems = items.length > previousItemCount.current;\n\t\t\t\tconst itemsRemoved = items.length < previousItemCount.current;\n\t\t\t\tconst appendedNewItem =\n\t\t\t\t\thasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\t\t\t\tconst replacedLastItem =\n\t\t\t\t\t!hasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\n\t\t\t\tconst isWithinGracePeriod =\n\t\t\t\t\tDate.now() - mountTimeRef.current < INITIAL_SCROLL_GRACE_MS;\n\n\t\t\t\tconst shouldSnapToBottom =\n\t\t\t\t\tisWithinGracePeriod ||\n\t\t\t\t\t(itemsRemoved && isPinnedToBottom.current) ||\n\t\t\t\t\t(appendedNewItem && isPinnedToBottom.current) ||\n\t\t\t\t\t(replacedLastItem && isPinnedToBottom.current);\n\n\t\t\t\tif (shouldSnapToBottom) {\n\t\t\t\t\t// Instant scroll during grace period, smooth scroll after\n\t\t\t\t\tif (isWithinGracePeriod) {\n\t\t\t\t\t\telement.scrollTop = element.scrollHeight;\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.scrollTo({ top: element.scrollHeight, behavior: \"smooth\" });\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = true;\n\t\t\t\t\tisAtTop.current = false;\n\t\t\t\t}\n\n\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t}, [autoScroll, items.length, lastItemKey]);\n\n\t\t\t// Handle scroll events for infinite scrolling\n\t\t\tconst handleScroll = React.useCallback(\n\t\t\t\t(e: React.UIEvent<HTMLDivElement>) => {\n\t\t\t\t\tconst element = e.currentTarget;\n\t\t\t\t\tconst { scrollTop, scrollHeight, clientHeight } = element;\n\n\t\t\t\t\tconst distanceFromBottom = scrollHeight - scrollTop - clientHeight;\n\t\t\t\t\tconst pinnedNow = distanceFromBottom <= BOTTOM_THRESHOLD_PX;\n\t\t\t\t\tif (pinnedNow && !isPinnedToBottom.current) {\n\t\t\t\t\t\tonScrollEnd?.();\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = pinnedNow;\n\n\t\t\t\t\tconst atTop = scrollTop <= TOP_THRESHOLD_PX;\n\t\t\t\t\tif (atTop && !isAtTop.current) {\n\t\t\t\t\t\tonScrollStart?.();\n\t\t\t\t\t}\n\t\t\t\t\tisAtTop.current = atTop;\n\t\t\t\t},\n\t\t\t\t[onScrollStart, onScrollEnd]\n\t\t\t);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: setRefs,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"log\",\n\t\t\t\t\t\t\"aria-label\": \"Conversation timeline\",\n\t\t\t\t\t\t\"aria-live\": \"polite\",\n\t\t\t\t\t\t\"aria-relevant\": \"additions\",\n\t\t\t\t\t\tonScroll: handleScroll,\n\t\t\t\t\t\tstyle: scrollMaskStyle,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"ConversationTimeline\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineContainerProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Wrapper around the scrollable timeline giving consumers an easy hook to add\n * padding, backgrounds or transitions without touching the core timeline logic.\n */\nexport const ConversationTimelineContainer = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineContainerProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineContainer\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineLoadingProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Accessible status region for loading more timeline items. Lets host apps render\n * skeletons or shimmer states without reimplementing ARIA wiring.\n */\nexport const ConversationTimelineLoading = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineLoadingProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"Loading timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineLoading\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineEmptyProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Placeholder state rendered when no timeline items are present. Uses a polite status\n * region so screen readers announce the empty state.\n */\nexport const ConversationTimelineEmpty = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineEmptyProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"No timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineEmpty\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAiCA,MAAM,sBAAsB;AAC5B,MAAM,mBAAmB;;AAEzB,MAAM,0BAA0B;AAEhC,SAAS,eAAe,OAAmD;AAC1E,KAAI,MAAM,WAAW,EACpB,QAAO;CA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jD,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,OAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,mCAAmC;CAC/C,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,OAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -0,0 +1,76 @@
1
+ import * as React$1 from "react";
2
+
3
+ //#region src/primitives/day-separator.d.ts
4
+
5
+ /**
6
+ * Default date formatter that returns "Today", "Yesterday", or a full date string
7
+ */
8
+ declare const defaultFormatDate: (date: Date) => string;
9
+ /**
10
+ * Shape returned to render-prop children describing the day separator state
11
+ */
12
+ type DaySeparatorRenderProps = {
13
+ date: Date;
14
+ dateString: string;
15
+ formattedDate: string;
16
+ isToday: boolean;
17
+ isYesterday: boolean;
18
+ };
19
+ type DaySeparatorProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
20
+ children?: React$1.ReactNode | ((props: DaySeparatorRenderProps) => React$1.ReactNode);
21
+ asChild?: boolean;
22
+ className?: string;
23
+ date: Date;
24
+ dateString: string;
25
+ formatDate?: (date: Date) => string;
26
+ };
27
+ /**
28
+ * Headless day separator component that marks the boundary between different days
29
+ * in a conversation timeline. Consumers can either render their own layout via
30
+ * a render prop or rely on slotted children.
31
+ */
32
+ declare const DaySeparator: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
33
+ children?: React$1.ReactNode | ((props: DaySeparatorRenderProps) => React$1.ReactNode);
34
+ asChild?: boolean;
35
+ className?: string;
36
+ date: Date;
37
+ dateString: string;
38
+ formatDate?: (date: Date) => string;
39
+ } & React$1.RefAttributes<HTMLDivElement>>;
40
+ type DaySeparatorLineProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
41
+ children?: React$1.ReactNode;
42
+ asChild?: boolean;
43
+ className?: string;
44
+ };
45
+ /**
46
+ * Decorative line element for the day separator.
47
+ * Typically rendered on either side of the label.
48
+ */
49
+ declare const DaySeparatorLine: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
50
+ children?: React$1.ReactNode;
51
+ asChild?: boolean;
52
+ className?: string;
53
+ } & React$1.RefAttributes<HTMLDivElement>>;
54
+ type DaySeparatorLabelProps = Omit<React$1.HTMLAttributes<HTMLSpanElement>, "children"> & {
55
+ children?: React$1.ReactNode | ((props: {
56
+ formattedDate: string;
57
+ }) => React$1.ReactNode);
58
+ asChild?: boolean;
59
+ className?: string;
60
+ formattedDate?: string;
61
+ };
62
+ /**
63
+ * Text label element for the day separator.
64
+ * Displays the formatted date string.
65
+ */
66
+ declare const DaySeparatorLabel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLSpanElement>, "children"> & {
67
+ children?: React$1.ReactNode | ((props: {
68
+ formattedDate: string;
69
+ }) => React$1.ReactNode);
70
+ asChild?: boolean;
71
+ className?: string;
72
+ formattedDate?: string;
73
+ } & React$1.RefAttributes<HTMLSpanElement>>;
74
+ //#endregion
75
+ export { DaySeparator, DaySeparatorLabel, DaySeparatorLabelProps, DaySeparatorLine, DaySeparatorLineProps, DaySeparatorProps, DaySeparatorRenderProps, defaultFormatDate };
76
+ //# sourceMappingURL=day-separator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"day-separator.d.ts","names":[],"sources":["../../src/primitives/day-separator.tsx"],"sourcesContent":[],"mappings":";;;;;;AA4BA;AAoBY,cApBC,iBAoBsB,EAAA,CAAA,IAC5B,EArBiC,IAqB7B,EAAA,GA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OAAA;;;;;AAiClB;;AACC,cAzBY,gBAyBN,EAzBsB,OAAA,CAAA,yBAyBtB,CAzBsB,IAyBtB,CAzBsB,OAAA,CAAA,cAyBtB,CAzBsB,cAyBtB,CAAA,EAAA,UAAA,CAAA,GAAA;EAD8B,QAAA,CAAA,EAjCzB,OAAA,CAAM,SAiCmB;EAKjC,OAAM,CAAA,EAAA,OAAA;EACiC,SAAM,CAAA,EAAA,MAAA;CAAS,wBAAA,eAAA,CAAA,CAAA;AAU7C,KAhBD,sBAAA,GAAyB,IA8CjC,CA7CH,OAAA,CAAM,cA6CH,CA7CkB,eA6ClB,CAAA,EAAA,UAAA,CAAA,GAAA;EA9B0B,QAAA,CAAA,EAX1B,OAAA,CAAM,SAWoB,GAAA,CAAA,CAAA,KAAA,EAAA;IAAA,aAAA,EAAA,MAAA;EAAA,CAAA,EAAA,GAVa,OAAA,CAAM,SAUnB,CAAA;EAX1B,OAAM,CAAA,EAAA,OAAA;EACiC,SAAM,CAAA,EAAA,MAAA;;;;;;;cAUpC,mBAAiB,OAAA,CAAA,0BAAA,KAAA,OAAA,CAAA,eAAA;aAX1B,OAAA,CAAM;;QACiC,OAAA,CAAM"}
@@ -0,0 +1,111 @@
1
+ import { useRenderElement } from "../utils/use-render-element.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/primitives/day-separator.tsx
5
+ /**
6
+ * Helper to check if a date is today
7
+ */
8
+ const isToday = (date) => {
9
+ const now = /* @__PURE__ */ new Date();
10
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
11
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() === today.getTime();
12
+ };
13
+ /**
14
+ * Helper to check if a date is yesterday
15
+ */
16
+ const isYesterday = (date) => {
17
+ const now = /* @__PURE__ */ new Date();
18
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
19
+ const yesterday = new Date(today);
20
+ yesterday.setDate(yesterday.getDate() - 1);
21
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() === yesterday.getTime();
22
+ };
23
+ /**
24
+ * Default date formatter that returns "Today", "Yesterday", or a full date string
25
+ */
26
+ const defaultFormatDate = (date) => {
27
+ if (isToday(date)) return "Today";
28
+ if (isYesterday(date)) return "Yesterday";
29
+ return date.toLocaleDateString(void 0, {
30
+ year: "numeric",
31
+ month: "long",
32
+ day: "numeric"
33
+ });
34
+ };
35
+ /**
36
+ * Headless day separator component that marks the boundary between different days
37
+ * in a conversation timeline. Consumers can either render their own layout via
38
+ * a render prop or rely on slotted children.
39
+ */
40
+ const DaySeparator = (() => {
41
+ const Component = React$1.forwardRef(({ children, className, asChild = false, date, dateString, formatDate = defaultFormatDate, ...restProps }, ref) => {
42
+ const formattedDate = formatDate(date);
43
+ const renderProps = {
44
+ date,
45
+ dateString,
46
+ formattedDate,
47
+ isToday: isToday(date),
48
+ isYesterday: isYesterday(date)
49
+ };
50
+ const content = typeof children === "function" ? children(renderProps) : children;
51
+ return useRenderElement("div", {
52
+ className,
53
+ asChild
54
+ }, {
55
+ ref,
56
+ state: renderProps,
57
+ props: {
58
+ role: "separator",
59
+ "aria-label": `Day separator: ${formattedDate}`,
60
+ ...restProps,
61
+ children: content
62
+ }
63
+ });
64
+ });
65
+ Component.displayName = "DaySeparator";
66
+ return Component;
67
+ })();
68
+ /**
69
+ * Decorative line element for the day separator.
70
+ * Typically rendered on either side of the label.
71
+ */
72
+ const DaySeparatorLine = (() => {
73
+ const Component = React$1.forwardRef(({ children, className, asChild = false, ...props }, ref) => useRenderElement("div", {
74
+ className,
75
+ asChild
76
+ }, {
77
+ ref,
78
+ props: {
79
+ "aria-hidden": true,
80
+ ...props,
81
+ children
82
+ }
83
+ }));
84
+ Component.displayName = "DaySeparatorLine";
85
+ return Component;
86
+ })();
87
+ /**
88
+ * Text label element for the day separator.
89
+ * Displays the formatted date string.
90
+ */
91
+ const DaySeparatorLabel = (() => {
92
+ const Component = React$1.forwardRef(({ children, className, asChild = false, formattedDate = "", ...props }, ref) => {
93
+ const content = typeof children === "function" ? children({ formattedDate }) : children ?? formattedDate;
94
+ return useRenderElement("span", {
95
+ className,
96
+ asChild
97
+ }, {
98
+ ref,
99
+ props: {
100
+ ...props,
101
+ children: content
102
+ }
103
+ });
104
+ });
105
+ Component.displayName = "DaySeparatorLabel";
106
+ return Component;
107
+ })();
108
+
109
+ //#endregion
110
+ export { DaySeparator, DaySeparatorLabel, DaySeparatorLine, defaultFormatDate };
111
+ //# sourceMappingURL=day-separator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"day-separator.js","names":["React","renderProps: DaySeparatorRenderProps"],"sources":["../../src/primitives/day-separator.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Helper to check if a date is today\n */\nconst isToday = (date: Date): boolean => {\n\tconst now = new Date();\n\tconst today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n\tconst itemDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());\n\treturn itemDay.getTime() === today.getTime();\n};\n\n/**\n * Helper to check if a date is yesterday\n */\nconst isYesterday = (date: Date): boolean => {\n\tconst now = new Date();\n\tconst today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n\tconst yesterday = new Date(today);\n\tyesterday.setDate(yesterday.getDate() - 1);\n\tconst itemDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());\n\treturn itemDay.getTime() === yesterday.getTime();\n};\n\n/**\n * Default date formatter that returns \"Today\", \"Yesterday\", or a full date string\n */\nexport const defaultFormatDate = (date: Date): string => {\n\tif (isToday(date)) {\n\t\treturn \"Today\";\n\t}\n\n\tif (isYesterday(date)) {\n\t\treturn \"Yesterday\";\n\t}\n\n\t// Format as \"January 15, 2024\"\n\treturn date.toLocaleDateString(undefined, {\n\t\tyear: \"numeric\",\n\t\tmonth: \"long\",\n\t\tday: \"numeric\",\n\t});\n};\n\n/**\n * Shape returned to render-prop children describing the day separator state\n */\nexport type DaySeparatorRenderProps = {\n\tdate: Date;\n\tdateString: string;\n\tformattedDate: string;\n\tisToday: boolean;\n\tisYesterday: boolean;\n};\n\nexport type DaySeparatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: DaySeparatorRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tdate: Date;\n\tdateString: string;\n\tformatDate?: (date: Date) => string;\n};\n\n/**\n * Headless day separator component that marks the boundary between different days\n * in a conversation timeline. Consumers can either render their own layout via\n * a render prop or rely on slotted children.\n */\nexport const DaySeparator = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, DaySeparatorProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tdate,\n\t\t\t\tdateString,\n\t\t\t\tformatDate = defaultFormatDate,\n\t\t\t\t...restProps\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst formattedDate = formatDate(date);\n\t\t\tconst isTodayValue = isToday(date);\n\t\t\tconst isYesterdayValue = isYesterday(date);\n\n\t\t\tconst renderProps: DaySeparatorRenderProps = {\n\t\t\t\tdate,\n\t\t\t\tdateString,\n\t\t\t\tformattedDate,\n\t\t\t\tisToday: isTodayValue,\n\t\t\t\tisYesterday: isYesterdayValue,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"separator\",\n\t\t\t\t\t\t\"aria-label\": `Day separator: ${formattedDate}`,\n\t\t\t\t\t\t...restProps,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"DaySeparator\";\n\treturn Component;\n})();\n\nexport type DaySeparatorLineProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Decorative line element for the day separator.\n * Typically rendered on either side of the label.\n */\nexport const DaySeparatorLine = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, DaySeparatorLineProps>(\n\t\t({ children, className, asChild = false, ...props }, ref) =>\n\t\t\tuseRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t\"aria-hidden\": true,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t)\n\t);\n\n\tComponent.displayName = \"DaySeparatorLine\";\n\treturn Component;\n})();\n\nexport type DaySeparatorLabelProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: { formattedDate: string }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tformattedDate?: string;\n};\n\n/**\n * Text label element for the day separator.\n * Displays the formatted date string.\n */\nexport const DaySeparatorLabel = (() => {\n\tconst Component = React.forwardRef<HTMLSpanElement, DaySeparatorLabelProps>(\n\t\t(\n\t\t\t{ children, className, asChild = false, formattedDate = \"\", ...props },\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ formattedDate })\n\t\t\t\t\t: (children ?? formattedDate);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"span\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t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