@krizaka/ui 3.18.2 → 3.20.0

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 (186) hide show
  1. package/dist/avatar/defaults.js +6 -1
  2. package/dist/avatar/defaults.js.map +1 -1
  3. package/dist/avatar.js +6 -1
  4. package/dist/avatar.js.map +1 -1
  5. package/dist/blocks.css +11 -0
  6. package/dist/card-grid.d.ts +14 -1
  7. package/dist/card-grid.js +29 -6
  8. package/dist/card-grid.js.map +1 -1
  9. package/dist/chat.d.ts +51 -3
  10. package/dist/chat.js +64 -32
  11. package/dist/chat.js.map +1 -1
  12. package/dist/{chunk-276PTQMQ.js → chunk-3BC4XQ6C.js} +2 -1
  13. package/dist/{chunk-YIBKJ36L.js → chunk-KB7OLYIJ.js} +7 -2
  14. package/dist/{chunk-YIBKJ36L.js.map → chunk-KB7OLYIJ.js.map} +1 -1
  15. package/dist/data-table.js +1 -1
  16. package/dist/file-upload.js +2 -2
  17. package/dist/file-upload.js.map +1 -1
  18. package/dist/match-dialog.js +2 -2
  19. package/dist/media-grid.d.ts +66 -3
  20. package/dist/media-grid.js +312 -65
  21. package/dist/media-grid.js.map +1 -1
  22. package/dist/native.js +6 -1
  23. package/dist/native.js.map +1 -1
  24. package/dist/progress.js +2 -2
  25. package/dist/progress.js.map +1 -1
  26. package/dist/vertical-video.d.ts +7 -1
  27. package/dist/vertical-video.js +7 -5
  28. package/dist/vertical-video.js.map +1 -1
  29. package/package.json +8 -8
  30. package/registry/achievement.json +16 -2
  31. package/registry/action-bar.json +16 -2
  32. package/registry/action-sheet.json +15 -0
  33. package/registry/activity-feed.json +13 -2
  34. package/registry/alert.json +15 -2
  35. package/registry/app-shell.json +15 -2
  36. package/registry/argument-card.json +16 -2
  37. package/registry/audio-player.json +15 -2
  38. package/registry/auth-layout.json +15 -2
  39. package/registry/avatar.json +14 -3
  40. package/registry/badge.json +13 -2
  41. package/registry/button.json +13 -2
  42. package/registry/card-grid.json +69 -4
  43. package/registry/card.json +13 -2
  44. package/registry/catalogue-page.json +15 -2
  45. package/registry/changelog-page.json +15 -2
  46. package/registry/chat.json +115 -10
  47. package/registry/checkbox.json +13 -2
  48. package/registry/chip-link.json +15 -2
  49. package/registry/chip.json +13 -2
  50. package/registry/choice-grid.json +16 -2
  51. package/registry/cn.json +12 -0
  52. package/registry/code-block.json +15 -2
  53. package/registry/combobox.json +13 -2
  54. package/registry/command.json +15 -2
  55. package/registry/component-page.json +15 -2
  56. package/registry/confirm-button.json +15 -2
  57. package/registry/contact-page.json +15 -2
  58. package/registry/continue-prompt.json +16 -2
  59. package/registry/countdown.json +13 -2
  60. package/registry/cta-panel.json +16 -2
  61. package/registry/dashboard-layout.json +15 -2
  62. package/registry/data-table.json +15 -2
  63. package/registry/date-picker.json +13 -2
  64. package/registry/decision-list.json +16 -2
  65. package/registry/description-list.json +13 -2
  66. package/registry/detail-layout.json +15 -2
  67. package/registry/dialog.json +13 -2
  68. package/registry/docs-article-page.json +15 -2
  69. package/registry/docs-hub-page.json +15 -2
  70. package/registry/docs-layout.json +15 -2
  71. package/registry/document-viewer.json +15 -2
  72. package/registry/dropdown-menu.json +15 -2
  73. package/registry/empty-state.json +13 -2
  74. package/registry/error-page.json +14 -2
  75. package/registry/examples/card-grid/foundation.d.ts +4 -0
  76. package/registry/examples/card-grid/foundation.js +38 -0
  77. package/registry/examples/card-grid/foundation.tsx +35 -0
  78. package/registry/examples/chat/conversation.js +2 -2
  79. package/registry/examples/chat/conversation.tsx +4 -3
  80. package/registry/examples/chat/pill-composer.d.ts +4 -0
  81. package/registry/examples/chat/pill-composer.js +34 -0
  82. package/registry/examples/chat/pill-composer.tsx +39 -0
  83. package/registry/examples/glow-card/plans.js +9 -12
  84. package/registry/examples/glow-card/plans.tsx +18 -14
  85. package/registry/examples/media-grid/loading.d.ts +4 -0
  86. package/registry/examples/media-grid/loading.js +28 -0
  87. package/registry/examples/media-grid/loading.tsx +25 -0
  88. package/registry/examples/vertical-video/rail.js +3 -2
  89. package/registry/examples/vertical-video/rail.tsx +4 -3
  90. package/registry/fab.json +15 -0
  91. package/registry/field.json +13 -2
  92. package/registry/file-upload.json +15 -2
  93. package/registry/filter-bar.json +15 -2
  94. package/registry/form.json +13 -2
  95. package/registry/gallery-page.json +15 -2
  96. package/registry/glow-card.json +18 -4
  97. package/registry/goal-gauge.json +13 -2
  98. package/registry/header.json +15 -0
  99. package/registry/how-it-works-page.json +15 -2
  100. package/registry/image-cropper.json +15 -2
  101. package/registry/image-viewer.json +15 -0
  102. package/registry/index.json +1773 -10
  103. package/registry/iso.json +15 -2
  104. package/registry/kanban.json +15 -2
  105. package/registry/kbd.json +14 -2
  106. package/registry/landing-page.json +15 -2
  107. package/registry/landscape.json +15 -2
  108. package/registry/legal-page.json +15 -2
  109. package/registry/link-card.json +16 -2
  110. package/registry/list.json +13 -2
  111. package/registry/loader.json +13 -2
  112. package/registry/longform-page.json +15 -2
  113. package/registry/map.json +14 -3
  114. package/registry/markdown.json +13 -2
  115. package/registry/marketing-layout.json +15 -2
  116. package/registry/marquee.json +15 -2
  117. package/registry/mascot-quote.json +16 -2
  118. package/registry/mascot-state.json +13 -2
  119. package/registry/mascots.json +13 -2
  120. package/registry/match-dialog.json +13 -2
  121. package/registry/media-capture.json +13 -2
  122. package/registry/media-grid.json +341 -13
  123. package/registry/media-picker.json +15 -0
  124. package/registry/meter.json +13 -2
  125. package/registry/nav-bar.json +17 -3
  126. package/registry/number-ticker.json +13 -2
  127. package/registry/onboarding.json +15 -0
  128. package/registry/otp-input.json +15 -0
  129. package/registry/page-header.json +15 -2
  130. package/registry/page-hero.json +16 -2
  131. package/registry/page.json +16 -2
  132. package/registry/pagination.json +13 -2
  133. package/registry/permission-prompt.json +15 -0
  134. package/registry/photo-grid.json +13 -2
  135. package/registry/pointer-light.json +15 -2
  136. package/registry/popover.json +15 -2
  137. package/registry/pricing-page.json +15 -2
  138. package/registry/product-page.json +15 -2
  139. package/registry/profile-card.json +13 -2
  140. package/registry/progress.json +14 -3
  141. package/registry/promise-card.json +16 -2
  142. package/registry/pull-to-refresh.json +15 -0
  143. package/registry/radio-group.json +13 -2
  144. package/registry/recipes.json +14 -2
  145. package/registry/screen.json +15 -0
  146. package/registry/scroll-stage.json +15 -2
  147. package/registry/search-field.json +13 -2
  148. package/registry/section-backdrop.json +15 -2
  149. package/registry/segmented.json +15 -0
  150. package/registry/separator.json +15 -2
  151. package/registry/settings-layout.json +15 -2
  152. package/registry/showcase.json +13 -2
  153. package/registry/site-footer.json +16 -3
  154. package/registry/sites.json +15 -2
  155. package/registry/skeleton.json +13 -2
  156. package/registry/skip-link.json +14 -2
  157. package/registry/slider.json +13 -2
  158. package/registry/slot.json +14 -2
  159. package/registry/spinner.json +13 -2
  160. package/registry/splash-handoff.json +15 -0
  161. package/registry/split-view.json +15 -2
  162. package/registry/stage-banner.json +15 -2
  163. package/registry/stat.json +15 -2
  164. package/registry/status-page.json +15 -2
  165. package/registry/step-progress.json +13 -2
  166. package/registry/stepper.json +13 -2
  167. package/registry/swipe-deck.json +13 -2
  168. package/registry/swipeable-row.json +15 -0
  169. package/registry/switch.json +13 -2
  170. package/registry/tab-bar.json +15 -0
  171. package/registry/tabs.json +13 -2
  172. package/registry/tag-input.json +15 -2
  173. package/registry/tag-selector.json +13 -2
  174. package/registry/terminal-replay.json +15 -2
  175. package/registry/theme.json +13 -2
  176. package/registry/toast.json +13 -2
  177. package/registry/toc.json +15 -2
  178. package/registry/tooltip.json +14 -2
  179. package/registry/tree-view.json +15 -2
  180. package/registry/txt.json +13 -0
  181. package/registry/verified-badge.json +13 -2
  182. package/registry/vertical-video.json +32 -6
  183. package/registry/video-player.json +13 -2
  184. package/registry/video-trimmer.json +15 -2
  185. package/registry/virtual.json +15 -2
  186. /package/dist/{chunk-276PTQMQ.js.map → chunk-3BC4XQ6C.js.map} +0 -0
@@ -8,6 +8,17 @@
8
8
  "deprecated": null,
9
9
  "category": "data-display",
10
10
  "platforms": "both",
11
+ "parity": {
12
+ "web": {
13
+ "state": "yes"
14
+ },
15
+ "native": {
16
+ "state": "yes"
17
+ },
18
+ "desktop": {
19
+ "state": "yes"
20
+ }
21
+ },
11
22
  "whenToUse": [
12
23
  "Orochia's Messages, a dating app's chats, support threads.",
13
24
  "An inbox of conversations with presence and unread counts."
@@ -25,7 +36,8 @@
25
36
  "bestPractices": [
26
37
  "Group the runs of one sender (`grouped`); show the receipt under the last message of yours only.",
27
38
  "Keep the server's order and merge (the app's), the bubble only draws.",
28
- "The composer never clears itself: clear the draft once the message is sent."
39
+ "The composer never clears itself: clear the draft once the message is sent.",
40
+ "`variant=\"pill\"` for a chat page: put the mode/model chip and attach in `leading`, privacy and cost in `status`, and pass `busy` while an answer streams — the field's box does not move."
29
41
  ],
30
42
  "accessibility": {
31
43
  "keyboard": [
@@ -36,6 +48,7 @@
36
48
  ],
37
49
  "notes": [
38
50
  "Each bubble is read with its time; a failed one says so and offers a retry.",
51
+ "The `pill` status line is a polite live region; a busy composer holds the send (`aria-busy`) and says nothing else.",
39
52
  "The typing dots are announced politely by their words.",
40
53
  "A conversation row reads name, presence, last message, time and unread count."
41
54
  ]
@@ -217,7 +230,7 @@
217
230
  },
218
231
  {
219
232
  "component": "MessageComposer",
220
- "description": "Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button.",
233
+ "description": "Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button. The `pill` variant is the one-field look of the Krizaka chat card.",
221
234
  "props": [
222
235
  {
223
236
  "name": "onSend",
@@ -254,6 +267,20 @@
254
267
  "description": "The draft (controlled).",
255
268
  "required": true
256
269
  },
270
+ {
271
+ "name": "busy",
272
+ "type": "boolean",
273
+ "default": "false",
274
+ "description": "An answer is on its way: the send is held (and `aria-busy` is set) while the field stays where it is, size included.",
275
+ "required": false
276
+ },
277
+ {
278
+ "name": "canSend",
279
+ "type": "boolean",
280
+ "default": null,
281
+ "description": "Overrides “the draft has text” — e.g. an attachment alone can be sent. A busy composer never sends.",
282
+ "required": false
283
+ },
257
284
  {
258
285
  "name": "className",
259
286
  "type": "string",
@@ -268,11 +295,18 @@
268
295
  "description": "Cannot write: the reason in its place.",
269
296
  "required": false
270
297
  },
298
+ {
299
+ "name": "inputProps",
300
+ "type": "Omit<Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, \"ref\">, \"className\" | ... 4 more ... | \"rows\">",
301
+ "default": null,
302
+ "description": "Attributes (`data-testid`, `autoFocus`, `id`…) forwarded to the textarea.",
303
+ "required": false
304
+ },
271
305
  {
272
306
  "name": "leading",
273
307
  "type": "ReactNode",
274
308
  "default": null,
275
- "description": "Before the input: an attach button.",
309
+ "description": "Before the input: an attach button (`bar`), or the mode/model chip and attach, inside the field (`pill`).",
276
310
  "required": false
277
311
  },
278
312
  {
@@ -281,6 +315,27 @@
281
315
  "default": "4000",
282
316
  "description": "The longest message. Default 4000.",
283
317
  "required": false
318
+ },
319
+ {
320
+ "name": "sendProps",
321
+ "type": "Omit<Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, \"ref\">, \"className\" | ... 2 more ... | \"disabled\">",
322
+ "default": null,
323
+ "description": "Attributes forwarded to the send button.",
324
+ "required": false
325
+ },
326
+ {
327
+ "name": "status",
328
+ "type": "ReactNode",
329
+ "default": null,
330
+ "description": "`pill`: the quiet line under the field (privacy, cost estimate). Its row is always reserved, so a changing line never moves the field. Read politely.",
331
+ "required": false
332
+ },
333
+ {
334
+ "name": "variant",
335
+ "type": "\"bar\" | \"pill\"",
336
+ "default": "bar",
337
+ "description": "`bar`: a docked bar with a square-ish field. `pill`: one rounded field holding `leading`, the text and a round send button — no inner border. Default `bar`.",
338
+ "required": false
284
339
  }
285
340
  ]
286
341
  },
@@ -319,7 +374,7 @@
319
374
  "description": "Grouped runs, a read receipt, typing, the composer.",
320
375
  "path": "examples/chat/conversation.tsx",
321
376
  "module": "@krizaka/ui/registry/examples/chat/conversation",
322
- "code": "\"use client\";\n\nimport { MessageBubble, MessageComposer, TypingIndicator } from \"@krizaka/ui/chat\";\nimport { useState } from \"react\";\n\n// A conversation: runs grouped, the time inside, the receipt under the last of yours, typing, the composer.\nexport default function ChatConversation() {\n const [draft, setDraft] = useState(\"\");\n return (\n <div className=\"flex max-w-md flex-col overflow-hidden rounded-xl border border-border-default bg-surface-0\">\n <div className=\"flex flex-col gap-1 p-3\">\n <MessageBubble text=\"Hey! Loved your sunset photo 🌅\" time=\"19:02\" grouped=\"first\" />\n <MessageBubble text=\"Was it Cabo da Roca?\" time=\"19:02\" grouped=\"last\" />\n <MessageBubble mine text=\"It was! Have you been?\" time=\"19:05\" grouped=\"first\" />\n <MessageBubble mine text=\"We should go this weekend\" time=\"19:05\" grouped=\"last\" status=\"read\" showStatus />\n <TypingIndicator label=\"Elena is typing\" />\n </div>\n <MessageComposer value={draft} onValueChange={setDraft} onSend={() => setDraft(\"\")} placeholder=\"Message\" sendLabel=\"Send\" />\n </div>\n );\n}\n"
377
+ "code": "\"use client\";\n\nimport { MessageBubble, MessageComposer, TypingIndicator } from \"@krizaka/ui/chat\";\nimport { useState } from \"react\";\n\n// A conversation: runs grouped, the time inside, the receipt under the last of yours, typing, the composer. Given a\n// height (a panel, a tile), the messages sit on the composer and the room above is the conversation's, as in an app.\nexport default function ChatConversation() {\n const [draft, setDraft] = useState(\"\");\n return (\n <div className=\"flex h-full max-w-md flex-col overflow-hidden rounded-xl border border-border-default bg-surface-0\">\n <div className=\"flex flex-1 flex-col justify-end gap-1 p-3\">\n <MessageBubble text=\"Hey! Loved your sunset photo 🌅\" time=\"19:02\" grouped=\"first\" />\n <MessageBubble text=\"Was it Cabo da Roca?\" time=\"19:02\" grouped=\"last\" />\n <MessageBubble mine text=\"It was! Have you been?\" time=\"19:05\" grouped=\"first\" />\n <MessageBubble mine text=\"We should go this weekend\" time=\"19:05\" grouped=\"last\" status=\"read\" showStatus />\n <TypingIndicator label=\"Elena is typing\" />\n </div>\n <MessageComposer value={draft} onValueChange={setDraft} onSend={() => setDraft(\"\")} placeholder=\"Message\" sendLabel=\"Send\" />\n </div>\n );\n}\n"
323
378
  },
324
379
  {
325
380
  "name": "inbox",
@@ -328,6 +383,14 @@
328
383
  "path": "examples/chat/inbox.tsx",
329
384
  "module": "@krizaka/ui/registry/examples/chat/inbox",
330
385
  "code": "import { ConversationItem } from \"@krizaka/ui/chat\";\n\n// The inbox: online, the last message or “typing…”, the time, the unread count.\nexport default function ChatInbox() {\n return (\n <div className=\"flex max-w-md flex-col rounded-xl border border-border-default bg-surface-0 py-1\">\n <ConversationItem name=\"Elena\" online onlineLabel=\"online\" preview=\"typing…\" typing time=\"19:06\" unread={2} unreadLabel=\"2 unread\" href=\"#/chats/elena\" />\n <ConversationItem name=\"Noah\" preview=\"See you Saturday then!\" time=\"Mon\" href=\"#/chats/noah\" />\n <ConversationItem name=\"Mina\" preview=\"You: haha same\" time=\"Sun\" href=\"#/chats/mina\" />\n </div>\n );\n}\n"
386
+ },
387
+ {
388
+ "name": "pill-composer",
389
+ "title": "Pill composer",
390
+ "description": "One rounded field: chip and attach inside, round send inside, a status line under it.",
391
+ "path": "examples/chat/pill-composer.tsx",
392
+ "module": "@krizaka/ui/registry/examples/chat/pill-composer",
393
+ "code": "\"use client\";\n\nimport { MessageComposer } from \"@krizaka/ui/chat\";\nimport { useState } from \"react\";\n\n// The chat card's composer: one rounded field — the mode chip and attach inside on the left, the round send inside on\n// the right — and a quiet status line under it (privacy, cost). The field keeps its box while an answer streams.\nexport default function ChatPillComposer() {\n const [draft, setDraft] = useState(\"\");\n const [busy, setBusy] = useState(false);\n return (\n <div className=\"mx-auto w-full max-w-xl\">\n <MessageComposer\n variant=\"pill\"\n value={draft}\n busy={busy}\n onValueChange={setDraft}\n onSend={() => {\n setDraft(\"\");\n setBusy(true);\n setTimeout(() => setBusy(false), 1500);\n }}\n placeholder=\"Ask your private AI…\"\n sendLabel=\"Send\"\n leading={\n <>\n <button type=\"button\" className=\"h-8 rounded-full border border-border-default px-3 text-xs font-medium text-fg-secondary\">\n Chat\n </button>\n <button type=\"button\" aria-label=\"Attach a file\" className=\"grid h-8 w-8 place-items-center rounded-full text-fg-secondary hover:bg-surface-2\">\n +\n </button>\n </>\n }\n status={busy ? \"Answering…\" : \"Runs locally · nothing leaves your network · ~30 credits\"}\n />\n </div>\n );\n}\n"
331
394
  }
332
395
  ]
333
396
  },
@@ -626,7 +689,7 @@
626
689
  "files": [
627
690
  {
628
691
  "path": "chat/chat.tsx",
629
- "content": "// Client (the composer's draft). A conversation's parts — the bubble with its time and receipt, the typing dots, the\n// composer, a conversation in a list — the same API as React Native. Words are props.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Avatar } from \"../avatar\";\n\nexport const chat = tv({\n slots: {\n row: \"flex flex-col gap-0.5\",\n bubble: \"max-w-[80%] rounded-2xl px-3 py-2 text-sm leading-snug\",\n context: \"mb-0.5 block text-xs opacity-85\",\n time: \"mt-0.5 block text-right text-[11px] tabular-nums\",\n status: \"flex items-center gap-1 text-xs text-fg-secondary data-[status=failed]:text-fg-danger [&>svg]:h-3.5 [&>svg]:w-3.5\",\n typing: \"inline-flex items-center gap-1 self-start rounded-2xl bg-surface-2 px-3.5 py-3\",\n dot: \"h-[7px] w-[7px] rounded-full bg-fg-secondary motion-safe:animate-[kz-typing_1.2s_ease-in-out_infinite]\",\n composer: \"flex items-end gap-2 border-t border-border-subtle bg-surface-0 px-3 py-2\",\n input:\n \"max-h-32 min-h-10 flex-1 resize-none rounded-2xl border border-border-default bg-surface-1 px-3.5 py-2.5 text-sm text-fg placeholder:text-fg-muted \" +\n \"focus-visible:border-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n send:\n \"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-accent text-on-accent hover:bg-accent-hover focus-visible:outline-hidden \" +\n \"focus-visible:ring-2 focus-visible:ring-ring disabled:bg-surface-3 disabled:text-fg-muted [&>svg]:h-[18px] [&>svg]:w-[18px]\",\n item: \"flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-surface-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n count: \"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-xs font-extrabold text-on-accent\",\n },\n});\n\nexport type MessageStatus = \"sending\" | \"sent\" | \"delivered\" | \"read\" | \"failed\";\n\nexport type MessageBubbleLabels = {\n /** The words of each status, shown under the last message of yours. */\n status?: Partial<Record<MessageStatus, string>>;\n /** A failed message's retry button (“Retry”). */\n retry?: string;\n};\n\nconst STATUS: Record<MessageStatus, string> = { sending: \"Sending\", sent: \"Sent\", delivered: \"Delivered\", read: \"Read\", failed: \"Not sent\" };\n\nexport type MessageBubbleProps = {\n /** The text. */\n text: string;\n /** Yours (right, in the accent) or theirs (left). */\n mine?: boolean;\n /** The time, written by the app (“14:02”). */\n time?: string;\n /** Where a message of yours stands; shown when `showStatus`. */\n status?: MessageStatus;\n /** Show the status under the bubble (the last message of yours). */\n showStatus?: boolean;\n /** A line above the text: what it answers. */\n context?: string;\n /** Sends a failed message again (a button under it). */\n onRetry?: () => void;\n /** Part of a run of the same sender: the corner towards the next one is tighter. */\n grouped?: \"first\" | \"middle\" | \"last\" | \"single\";\n /** The words, passed translated. */\n labels?: MessageBubbleLabels;\n /** Classes merged on the row. */\n className?: string;\n};\n\nconst CORNERS = {\n mine: { first: \"rounded-br-md\", middle: \"rounded-r-md\", last: \"rounded-tr-md\", single: \"\" },\n theirs: { first: \"rounded-bl-md\", middle: \"rounded-l-md\", last: \"rounded-tl-md\", single: \"\" },\n} as const;\n\n/** A message: yours in the accent on the right, theirs on the left, the time inside, the receipt under the last of yours. */\nexport function MessageBubble({ text, mine, time, status, showStatus, context, onRetry, grouped = \"single\", labels, className }: MessageBubbleProps) {\n const s = chat();\n const words = { ...STATUS, ...labels?.status };\n return (\n <div className={s.row({ className: [mine ? \"items-end\" : \"items-start\", className].filter(Boolean).join(\" \") })}>\n <p\n className={s.bubble({\n className: [mine ? \"bg-accent text-on-accent\" : \"bg-surface-2 text-fg\", CORNERS[mine ? \"mine\" : \"theirs\"][grouped], status === \"failed\" ? \"ring-2 ring-danger\" : \"\", status === \"sending\" ? \"opacity-70\" : \"\"].join(\" \"),\n })}\n >\n {context ? <span className={s.context()}>{context}</span> : null}\n {text}\n {time ? <span className={s.time()}>{time}</span> : null}\n </p>\n {showStatus && status ? (\n <p className={s.status()} data-status={status}>\n {status === \"sent\" || status === \"delivered\" || status === \"read\" ? (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className={status === \"read\" ? \"stroke-accent\" : \"stroke-fg-secondary\"}>\n <path d={status === \"sent\" ? \"M5 12.5l4.5 4.5L19 7.5\" : \"M2 12.5l4.5 4.5L16 7.5M9 15l2 2 9.5-9.5\"} />\n </svg>\n ) : null}\n {words[status]}\n {status === \"failed\" && onRetry ? (\n <button type=\"button\" onClick={onRetry} className=\"ml-1 font-semibold text-fg underline underline-offset-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\">\n {labels?.retry ?? \"Retry\"}\n </button>\n ) : null}\n </p>\n ) : null}\n </div>\n );\n}\n\nexport type TypingIndicatorProps = {\n /** What is read and shown beside the dots (“Elena is typing”) — passed translated. */\n label: string;\n /** Show the words beside the dots. */\n showLabel?: boolean;\n /** Classes merged on the root. */\n className?: string;\n};\n\n/** Three dots that breathe while the other person types, announced politely; still under reduced motion. */\nexport function TypingIndicator({ label, showLabel, className }: TypingIndicatorProps) {\n const s = chat();\n return (\n <div role=\"status\" className={[\"flex items-center gap-2\", className].filter(Boolean).join(\" \")}>\n <style href=\"krizaka-typing\" precedence=\"default\">{\"@keyframes kz-typing{0%,60%,100%{opacity:.35;transform:none}30%{opacity:1;transform:translateY(-2px)}}\"}</style>\n <span className={s.typing()} aria-hidden>\n {[0, 1, 2].map((i) => (\n <span key={i} className={s.dot()} style={{ animationDelay: `${i * 0.18}s` }} />\n ))}\n </span>\n <span className={showLabel ? \"text-xs text-fg-secondary\" : \"sr-only\"}>{label}</span>\n </div>\n );\n}\n\nexport type MessageComposerProps = {\n /** The draft (controlled). */\n value: string;\n /** Called on every key. */\n onValueChange: (text: string) => void;\n /** Sends the draft (Enter, or the button); Shift+Enter adds a line. */\n onSend: () => void;\n /** The input's name and placeholder (“Message”). */\n placeholder: string;\n /** The send button's name (“Send”). */\n sendLabel: string;\n /** Before the input: an attach button. */\n leading?: React.ReactNode;\n /** Cannot write: the reason in its place. */\n disabledReason?: string;\n /** The longest message. Default 4000. */\n maxLength?: number;\n /** Classes merged on the root. */\n className?: string;\n};\n\n/** Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button. */\nexport function MessageComposer({ value, onValueChange, onSend, placeholder, sendLabel, leading, disabledReason, maxLength = 4000, className }: MessageComposerProps) {\n const s = chat();\n const ready = value.trim().length > 0;\n return (\n <form\n className={s.composer({ className })}\n onSubmit={(e) => {\n e.preventDefault();\n if (ready) onSend();\n }}\n >\n {disabledReason ? (\n <p className=\"m-0 flex-1 py-2 text-sm text-fg-secondary\">{disabledReason}</p>\n ) : (\n <>\n {leading}\n <textarea\n aria-label={placeholder}\n placeholder={placeholder}\n rows={1}\n maxLength={maxLength}\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && !e.shiftKey && !e.nativeEvent.isComposing) {\n e.preventDefault();\n if (ready) onSend();\n }\n }}\n className={s.input()}\n style={{ fieldSizing: \"content\" } as React.CSSProperties}\n />\n <button type=\"submit\" aria-label={sendLabel} disabled={!ready} className={s.send()}>\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <path d=\"M4 12l16-8-6 16-2.5-6.5L4 12z\" />\n </svg>\n </button>\n </>\n )}\n </form>\n );\n}\n\nexport type ConversationItemProps = {\n /** The other person's name. */\n name: string;\n /** Their avatar's URL. */\n avatar?: string | null;\n /** The last message, or “typing…”. */\n preview: string;\n /** The preview is the typing signal: in the accent. */\n typing?: boolean;\n /** When (“14:02”, “Mon”). */\n time?: string;\n /** Unread messages: a count, the name in bold. */\n unread?: number;\n /** The unread count in words (“3 unread”). */\n unreadLabel?: string;\n /** Before the name: a presence dot (online). */\n online?: boolean;\n /** The presence in words (“online”). */\n onlineLabel?: string;\n /** Opens the conversation (a link). */\n href?: string;\n /** Opens the conversation (a button). */\n onSelect?: () => void;\n /** Classes merged on the row. */\n className?: string;\n};\n\n/** A conversation in the list: avatar, name, the last message or typing, the time, the unread count. */\nexport function ConversationItem({ name, avatar, preview, typing, time, unread = 0, unreadLabel, online, onlineLabel, href, onSelect, className }: ConversationItemProps) {\n const s = chat();\n const body = (\n <>\n <span className=\"relative shrink-0\">\n <Avatar src={avatar ?? null} alt=\"\" fallback={name.charAt(0)} size=\"lg\" />\n {online ? <span aria-hidden className=\"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-success ring-2 ring-surface-0\" /> : null}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex items-center gap-2\">\n <span className={[\"min-w-0 flex-1 truncate text-sm text-fg\", unread > 0 ? \"font-extrabold\" : \"font-semibold\"].join(\" \")}>\n {name}\n {online && onlineLabel ? <span className=\"sr-only\">{`, ${onlineLabel}`}</span> : null}\n </span>\n {time ? <span className={[\"shrink-0 text-xs tabular-nums\", unread > 0 ? \"text-fg-accent\" : \"text-fg-secondary\"].join(\" \")}>{time}</span> : null}\n </span>\n <span className=\"flex items-center gap-2\">\n <span className={[\"min-w-0 flex-1 truncate text-xs\", typing ? \"text-fg-accent\" : unread > 0 ? \"text-fg\" : \"text-fg-secondary\"].join(\" \")}>{preview}</span>\n {unread > 0 ? (\n <span className={s.count()}>\n <span aria-hidden>{unread > 99 ? \"99+\" : unread}</span>\n <span className=\"sr-only\">{unreadLabel ?? String(unread)}</span>\n </span>\n ) : null}\n </span>\n </span>\n </>\n );\n return href ? (\n <a href={href} className={s.item({ className })}>\n {body}\n </a>\n ) : (\n <button type=\"button\" onClick={onSelect} className={s.item({ className })}>\n {body}\n </button>\n );\n}\n"
692
+ "content": "// Client (the composer's draft). A conversation's parts — the bubble with its time and receipt, the typing dots, the\n// composer, a conversation in a list — the same API as React Native. Words are props.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Avatar } from \"../avatar\";\n\nexport const chat = tv({\n slots: {\n row: \"flex flex-col gap-0.5\",\n bubble: \"max-w-[80%] rounded-2xl px-3 py-2 text-sm leading-snug\",\n context: \"mb-0.5 block text-xs opacity-85\",\n time: \"mt-0.5 block text-right text-[11px] tabular-nums\",\n status: \"flex items-center gap-1 text-xs text-fg-secondary data-[status=failed]:text-fg-danger [&>svg]:h-3.5 [&>svg]:w-3.5\",\n typing: \"inline-flex items-center gap-1 self-start rounded-2xl bg-surface-2 px-3.5 py-3\",\n dot: \"h-[7px] w-[7px] rounded-full bg-fg-secondary motion-safe:animate-[kz-typing_1.2s_ease-in-out_infinite]\",\n composer: \"flex items-end gap-2 border-t border-border-subtle bg-surface-0 px-3 py-2\",\n input:\n \"max-h-32 min-h-10 flex-1 resize-none rounded-2xl border border-border-default bg-surface-1 px-3.5 py-2.5 text-sm text-fg placeholder:text-fg-muted \" +\n \"focus-visible:border-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n send:\n \"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-accent text-on-accent hover:bg-accent-hover focus-visible:outline-hidden \" +\n \"focus-visible:ring-2 focus-visible:ring-ring disabled:bg-surface-3 disabled:text-fg-muted [&>svg]:h-[18px] [&>svg]:w-[18px]\",\n pillRoot: \"flex w-full flex-col gap-2\",\n pill:\n \"flex items-end gap-1.5 rounded-[1.75rem] border border-border-default bg-surface-1 py-1.5 pl-2 pr-1.5 transition-colors \" +\n \"focus-within:border-accent focus-within:ring-2 focus-within:ring-ring\",\n pillLeading: \"flex min-h-9 shrink-0 items-center gap-1 self-end\",\n pillInput:\n \"max-h-32 min-h-9 min-w-0 flex-1 resize-none border-0 bg-transparent px-1.5 py-[7px] text-sm leading-snug text-fg placeholder:text-fg-muted \" +\n \"focus:outline-hidden focus-visible:outline-hidden\",\n pillSend:\n \"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-accent text-on-accent shadow-sm transition-colors hover:bg-accent-hover \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-1 \" +\n \"disabled:cursor-not-allowed disabled:bg-surface-3 disabled:text-fg-muted disabled:shadow-none [&>svg]:h-4 [&>svg]:w-4\",\n pillStatus: \"m-0 flex min-h-5 items-center gap-1.5 px-3 text-xs text-fg-secondary [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0\",\n item: \"flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-surface-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n count: \"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-xs font-extrabold text-on-accent\",\n },\n});\n\nexport type MessageStatus = \"sending\" | \"sent\" | \"delivered\" | \"read\" | \"failed\";\n\nexport type MessageBubbleLabels = {\n /** The words of each status, shown under the last message of yours. */\n status?: Partial<Record<MessageStatus, string>>;\n /** A failed message's retry button (“Retry”). */\n retry?: string;\n};\n\nconst STATUS: Record<MessageStatus, string> = { sending: \"Sending\", sent: \"Sent\", delivered: \"Delivered\", read: \"Read\", failed: \"Not sent\" };\n\nexport type MessageBubbleProps = {\n /** The text. */\n text: string;\n /** Yours (right, in the accent) or theirs (left). */\n mine?: boolean;\n /** The time, written by the app (“14:02”). */\n time?: string;\n /** Where a message of yours stands; shown when `showStatus`. */\n status?: MessageStatus;\n /** Show the status under the bubble (the last message of yours). */\n showStatus?: boolean;\n /** A line above the text: what it answers. */\n context?: string;\n /** Sends a failed message again (a button under it). */\n onRetry?: () => void;\n /** Part of a run of the same sender: the corner towards the next one is tighter. */\n grouped?: \"first\" | \"middle\" | \"last\" | \"single\";\n /** The words, passed translated. */\n labels?: MessageBubbleLabels;\n /** Classes merged on the row. */\n className?: string;\n};\n\nconst CORNERS = {\n mine: { first: \"rounded-br-md\", middle: \"rounded-r-md\", last: \"rounded-tr-md\", single: \"\" },\n theirs: { first: \"rounded-bl-md\", middle: \"rounded-l-md\", last: \"rounded-tl-md\", single: \"\" },\n} as const;\n\n/** A message: yours in the accent on the right, theirs on the left, the time inside, the receipt under the last of yours. */\nexport function MessageBubble({ text, mine, time, status, showStatus, context, onRetry, grouped = \"single\", labels, className }: MessageBubbleProps) {\n const s = chat();\n const words = { ...STATUS, ...labels?.status };\n return (\n <div className={s.row({ className: [mine ? \"items-end\" : \"items-start\", className].filter(Boolean).join(\" \") })}>\n <p\n className={s.bubble({\n className: [mine ? \"bg-accent text-on-accent\" : \"bg-surface-2 text-fg\", CORNERS[mine ? \"mine\" : \"theirs\"][grouped], status === \"failed\" ? \"ring-2 ring-danger\" : \"\", status === \"sending\" ? \"opacity-70\" : \"\"].join(\" \"),\n })}\n >\n {context ? <span className={s.context()}>{context}</span> : null}\n {text}\n {time ? <span className={s.time()}>{time}</span> : null}\n </p>\n {showStatus && status ? (\n <p className={s.status()} data-status={status}>\n {status === \"sent\" || status === \"delivered\" || status === \"read\" ? (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className={status === \"read\" ? \"stroke-accent\" : \"stroke-fg-secondary\"}>\n <path d={status === \"sent\" ? \"M5 12.5l4.5 4.5L19 7.5\" : \"M2 12.5l4.5 4.5L16 7.5M9 15l2 2 9.5-9.5\"} />\n </svg>\n ) : null}\n {words[status]}\n {status === \"failed\" && onRetry ? (\n <button type=\"button\" onClick={onRetry} className=\"ml-1 font-semibold text-fg underline underline-offset-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\">\n {labels?.retry ?? \"Retry\"}\n </button>\n ) : null}\n </p>\n ) : null}\n </div>\n );\n}\n\nexport type TypingIndicatorProps = {\n /** What is read and shown beside the dots (“Elena is typing”) — passed translated. */\n label: string;\n /** Show the words beside the dots. */\n showLabel?: boolean;\n /** Classes merged on the root. */\n className?: string;\n};\n\n/** Three dots that breathe while the other person types, announced politely; still under reduced motion. */\nexport function TypingIndicator({ label, showLabel, className }: TypingIndicatorProps) {\n const s = chat();\n return (\n <div role=\"status\" className={[\"flex items-center gap-2\", className].filter(Boolean).join(\" \")}>\n <style href=\"krizaka-typing\" precedence=\"default\">{\"@keyframes kz-typing{0%,60%,100%{opacity:.35;transform:none}30%{opacity:1;transform:translateY(-2px)}}\"}</style>\n <span className={s.typing()} aria-hidden>\n {[0, 1, 2].map((i) => (\n <span key={i} className={s.dot()} style={{ animationDelay: `${i * 0.18}s` }} />\n ))}\n </span>\n <span className={showLabel ? \"text-xs text-fg-secondary\" : \"sr-only\"}>{label}</span>\n </div>\n );\n}\n\nexport type MessageComposerProps = {\n /** The draft (controlled). */\n value: string;\n /** Called on every key. */\n onValueChange: (text: string) => void;\n /** Sends the draft (Enter, or the button); Shift+Enter adds a line. */\n onSend: () => void;\n /** The input's name and placeholder (“Message”). */\n placeholder: string;\n /** The send button's name (“Send”). */\n sendLabel: string;\n /** Before the input: an attach button (`bar`), or the mode/model chip and attach, inside the field (`pill`). */\n leading?: React.ReactNode;\n /** Cannot write: the reason in its place. */\n disabledReason?: string;\n /** The longest message. Default 4000. */\n maxLength?: number;\n /** `bar`: a docked bar with a square-ish field. `pill`: one rounded field holding `leading`, the text and a round send button — no inner border. Default `bar`. */\n variant?: \"bar\" | \"pill\";\n /** `pill`: the quiet line under the field (privacy, cost estimate). Its row is always reserved, so a changing line never moves the field. Read politely. */\n status?: React.ReactNode;\n /** An answer is on its way: the send is held (and `aria-busy` is set) while the field stays where it is, size included. */\n busy?: boolean;\n /** Overrides “the draft has text” — e.g. an attachment alone can be sent. A busy composer never sends. */\n canSend?: boolean;\n /** Attributes (`data-testid`, `autoFocus`, `id`…) forwarded to the textarea. */\n inputProps?: Omit<React.ComponentPropsWithoutRef<\"textarea\">, \"value\" | \"onChange\" | \"placeholder\" | \"maxLength\" | \"className\" | \"rows\">;\n /** Attributes forwarded to the send button. */\n sendProps?: Omit<React.ComponentPropsWithoutRef<\"button\">, \"type\" | \"disabled\" | \"className\" | \"aria-label\">;\n /** Classes merged on the root. */\n className?: string;\n};\n\n/** Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button. The `pill` variant is the one-field look of the Krizaka chat card. */\nexport function MessageComposer({\n value,\n onValueChange,\n onSend,\n placeholder,\n sendLabel,\n leading,\n disabledReason,\n maxLength = 4000,\n variant = \"bar\",\n status,\n busy = false,\n canSend,\n inputProps,\n sendProps,\n className,\n}: MessageComposerProps) {\n const s = chat();\n const pill = variant === \"pill\";\n const ready = !busy && (canSend ?? value.trim().length > 0);\n const textarea = (\n <textarea\n aria-label={placeholder}\n placeholder={placeholder}\n rows={1}\n maxLength={maxLength}\n {...inputProps}\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n onKeyDown={(e) => {\n inputProps?.onKeyDown?.(e);\n if (e.defaultPrevented) return;\n if (e.key === \"Enter\" && !e.shiftKey && !e.nativeEvent.isComposing) {\n e.preventDefault();\n if (ready) onSend();\n }\n }}\n className={pill ? s.pillInput() : s.input()}\n style={{ fieldSizing: \"content\" } as React.CSSProperties}\n />\n );\n const send = (\n <button type=\"submit\" aria-label={sendLabel} {...sendProps} disabled={!ready} className={pill ? s.pillSend() : s.send()}>\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <path d=\"M4 12l16-8-6 16-2.5-6.5L4 12z\" />\n </svg>\n </button>\n );\n const submit = (e: React.FormEvent) => {\n e.preventDefault();\n if (ready) onSend();\n };\n if (pill) {\n return (\n <form className={s.pillRoot({ className })} onSubmit={submit} aria-busy={busy || undefined}>\n {disabledReason ? (\n <p className=\"m-0 rounded-[1.75rem] border border-border-default bg-surface-1 px-4 py-2.5 text-sm text-fg-secondary\">{disabledReason}</p>\n ) : (\n <div className={s.pill()}>\n {leading ? <div className={s.pillLeading()}>{leading}</div> : null}\n {textarea}\n {send}\n </div>\n )}\n <p role=\"status\" aria-live=\"polite\" className={s.pillStatus()}>\n {status}\n </p>\n </form>\n );\n }\n return (\n <form className={s.composer({ className })} onSubmit={submit} aria-busy={busy || undefined}>\n {disabledReason ? (\n <p className=\"m-0 flex-1 py-2 text-sm text-fg-secondary\">{disabledReason}</p>\n ) : (\n <>\n {leading}\n {textarea}\n {send}\n </>\n )}\n </form>\n );\n}\n\nexport type ConversationItemProps = {\n /** The other person's name. */\n name: string;\n /** Their avatar's URL. */\n avatar?: string | null;\n /** The last message, or “typing…”. */\n preview: string;\n /** The preview is the typing signal: in the accent. */\n typing?: boolean;\n /** When (“14:02”, “Mon”). */\n time?: string;\n /** Unread messages: a count, the name in bold. */\n unread?: number;\n /** The unread count in words (“3 unread”). */\n unreadLabel?: string;\n /** Before the name: a presence dot (online). */\n online?: boolean;\n /** The presence in words (“online”). */\n onlineLabel?: string;\n /** Opens the conversation (a link). */\n href?: string;\n /** Opens the conversation (a button). */\n onSelect?: () => void;\n /** Classes merged on the row. */\n className?: string;\n};\n\n/** A conversation in the list: avatar, name, the last message or typing, the time, the unread count. */\nexport function ConversationItem({ name, avatar, preview, typing, time, unread = 0, unreadLabel, online, onlineLabel, href, onSelect, className }: ConversationItemProps) {\n const s = chat();\n const body = (\n <>\n <span className=\"relative shrink-0\">\n <Avatar src={avatar ?? null} alt=\"\" fallback={name.charAt(0)} size=\"lg\" />\n {online ? <span aria-hidden className=\"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-success ring-2 ring-surface-0\" /> : null}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex items-center gap-2\">\n <span className={[\"min-w-0 flex-1 truncate text-sm text-fg\", unread > 0 ? \"font-extrabold\" : \"font-semibold\"].join(\" \")}>\n {name}\n {online && onlineLabel ? <span className=\"sr-only\">{`, ${onlineLabel}`}</span> : null}\n </span>\n {time ? <span className={[\"shrink-0 text-xs tabular-nums\", unread > 0 ? \"text-fg-accent\" : \"text-fg-secondary\"].join(\" \")}>{time}</span> : null}\n </span>\n <span className=\"flex items-center gap-2\">\n <span className={[\"min-w-0 flex-1 truncate text-xs\", typing ? \"text-fg-accent\" : unread > 0 ? \"text-fg\" : \"text-fg-secondary\"].join(\" \")}>{preview}</span>\n {unread > 0 ? (\n <span className={s.count()}>\n <span aria-hidden>{unread > 99 ? \"99+\" : unread}</span>\n <span className=\"sr-only\">{unreadLabel ?? String(unread)}</span>\n </span>\n ) : null}\n </span>\n </span>\n </>\n );\n return href ? (\n <a href={href} className={s.item({ className })}>\n {body}\n </a>\n ) : (\n <button type=\"button\" onClick={onSelect} className={s.item({ className })}>\n {body}\n </button>\n );\n}\n"
630
693
  },
631
694
  {
632
695
  "path": "chat/index.ts",
@@ -634,11 +697,11 @@
634
697
  },
635
698
  {
636
699
  "path": "chat/meta.ts",
637
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Chat\",\n summary: \"A conversation's parts — `MessageBubble` (time, receipt, retry), `TypingIndicator`, `MessageComposer`, `ConversationItem` — the same API on the web and React Native.\",\n status: \"beta\",\n category: \"data-display\",\n platforms: \"both\",\n whenToUse: [\"Orochia's Messages, a dating app's chats, support threads.\", \"An inbox of conversations with presence and unread counts.\"],\n whenNotToUse: [\n { when: \"For a comments thread under a post.\", use: \"list\" },\n { when: \"For notifications.\", use: \"toast\" },\n ],\n bestPractices: [\"Group the runs of one sender (`grouped`); show the receipt under the last message of yours only.\", \"Keep the server's order and merge (the app's), the bubble only draws.\", \"The composer never clears itself: clear the draft once the message is sent.\"],\n accessibility: {\n keyboard: [{ keys: \"Enter / Shift+Enter\", action: \"In the web composer: send, or a new line.\" }],\n notes: [\"Each bubble is read with its time; a failed one says so and offers a retry.\", \"The typing dots are announced politely by their words.\", \"A conversation row reads name, presence, last message, time and unread count.\"],\n },\n related: [\"avatar\", \"list\", \"toast\"],\n web: {\n imports: [\"MessageBubble\", \"TypingIndicator\", \"MessageComposer\", \"ConversationItem\"],\n examples: [\n { name: \"conversation\", title: \"Conversation\", description: \"Grouped runs, a read receipt, typing, the composer.\" },\n { name: \"inbox\", title: \"Inbox\", description: \"Online, typing, unread counts.\" },\n ],\n },\n native: {\n imports: [\"MessageBubble\", \"TypingIndicator\", \"MessageComposer\", \"ConversationItem\"],\n differences: [\"The composer keeps clear of the home indicator; the send button plays a light tap.\", \"A failed bubble is itself the retry button.\", \"`ConversationItem` takes `presence` (a dot on the avatar) instead of `online`.\"],\n examples: [\n { name: \"conversation\", title: \"Conversation\", description: \"Grouped runs, a read receipt, typing, the composer.\" },\n { name: \"inbox\", title: \"Inbox\", description: \"Presence, typing, unread counts.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
700
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Chat\",\n summary: \"A conversation's parts — `MessageBubble` (time, receipt, retry), `TypingIndicator`, `MessageComposer`, `ConversationItem` — the same API on the web and React Native.\",\n status: \"beta\",\n category: \"data-display\",\n platforms: \"both\",\n parity: { desktop: \"web\" },\n whenToUse: [\"Orochia's Messages, a dating app's chats, support threads.\", \"An inbox of conversations with presence and unread counts.\"],\n whenNotToUse: [\n { when: \"For a comments thread under a post.\", use: \"list\" },\n { when: \"For notifications.\", use: \"toast\" },\n ],\n bestPractices: [\"Group the runs of one sender (`grouped`); show the receipt under the last message of yours only.\", \"Keep the server's order and merge (the app's), the bubble only draws.\", \"The composer never clears itself: clear the draft once the message is sent.\", \"`variant=\\\"pill\\\"` for a chat page: put the mode/model chip and attach in `leading`, privacy and cost in `status`, and pass `busy` while an answer streams — the field's box does not move.\"],\n accessibility: {\n keyboard: [{ keys: \"Enter / Shift+Enter\", action: \"In the web composer: send, or a new line.\" }],\n notes: [\"Each bubble is read with its time; a failed one says so and offers a retry.\", \"The `pill` status line is a polite live region; a busy composer holds the send (`aria-busy`) and says nothing else.\", \"The typing dots are announced politely by their words.\", \"A conversation row reads name, presence, last message, time and unread count.\"],\n },\n related: [\"avatar\", \"list\", \"toast\"],\n web: {\n imports: [\"MessageBubble\", \"TypingIndicator\", \"MessageComposer\", \"ConversationItem\"],\n examples: [\n { name: \"conversation\", title: \"Conversation\", description: \"Grouped runs, a read receipt, typing, the composer.\" },\n { name: \"inbox\", title: \"Inbox\", description: \"Online, typing, unread counts.\" },\n { name: \"pill-composer\", title: \"Pill composer\", description: \"One rounded field: chip and attach inside, round send inside, a status line under it.\" },\n ],\n },\n native: {\n imports: [\"MessageBubble\", \"TypingIndicator\", \"MessageComposer\", \"ConversationItem\"],\n differences: [\"The composer keeps clear of the home indicator; the send button plays a light tap.\", \"A failed bubble is itself the retry button.\", \"`ConversationItem` takes `presence` (a dot on the avatar) instead of `online`.\"],\n examples: [\n { name: \"conversation\", title: \"Conversation\", description: \"Grouped runs, a read receipt, typing, the composer.\" },\n { name: \"inbox\", title: \"Inbox\", description: \"Presence, typing, unread counts.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
638
701
  },
639
702
  {
640
703
  "path": "meta.ts",
641
- "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"achievement\"\n | \"action-bar\"\n | \"activity-feed\"\n | \"action-sheet\"\n | \"alert\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"form\"\n | \"gallery-page\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"document-viewer\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"map\"\n | \"markdown\"\n | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"radio-group\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\n | \"showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"split-view\"\n | \"splash-handoff\"\n | \"stage-banner\"\n | \"stat\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
704
+ "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"achievement\"\n | \"action-bar\"\n | \"activity-feed\"\n | \"action-sheet\"\n | \"alert\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"form\"\n | \"gallery-page\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"document-viewer\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"map\"\n | \"markdown\"\n | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"radio-group\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\n | \"showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"split-view\"\n | \"splash-handoff\"\n | \"stage-banner\"\n | \"stat\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
642
705
  }
643
706
  ],
644
707
  "dependencies": [
@@ -649,7 +712,7 @@
649
712
  ],
650
713
  "demo": {
651
714
  "path": "examples/chat/conversation.tsx",
652
- "content": "\"use client\";\n\nimport { MessageBubble, MessageComposer, TypingIndicator } from \"@krizaka/ui/chat\";\nimport { useState } from \"react\";\n\n// A conversation: runs grouped, the time inside, the receipt under the last of yours, typing, the composer.\nexport default function ChatConversation() {\n const [draft, setDraft] = useState(\"\");\n return (\n <div className=\"flex max-w-md flex-col overflow-hidden rounded-xl border border-border-default bg-surface-0\">\n <div className=\"flex flex-col gap-1 p-3\">\n <MessageBubble text=\"Hey! Loved your sunset photo 🌅\" time=\"19:02\" grouped=\"first\" />\n <MessageBubble text=\"Was it Cabo da Roca?\" time=\"19:02\" grouped=\"last\" />\n <MessageBubble mine text=\"It was! Have you been?\" time=\"19:05\" grouped=\"first\" />\n <MessageBubble mine text=\"We should go this weekend\" time=\"19:05\" grouped=\"last\" status=\"read\" showStatus />\n <TypingIndicator label=\"Elena is typing\" />\n </div>\n <MessageComposer value={draft} onValueChange={setDraft} onSend={() => setDraft(\"\")} placeholder=\"Message\" sendLabel=\"Send\" />\n </div>\n );\n}\n"
715
+ "content": "\"use client\";\n\nimport { MessageBubble, MessageComposer, TypingIndicator } from \"@krizaka/ui/chat\";\nimport { useState } from \"react\";\n\n// A conversation: runs grouped, the time inside, the receipt under the last of yours, typing, the composer. Given a\n// height (a panel, a tile), the messages sit on the composer and the room above is the conversation's, as in an app.\nexport default function ChatConversation() {\n const [draft, setDraft] = useState(\"\");\n return (\n <div className=\"flex h-full max-w-md flex-col overflow-hidden rounded-xl border border-border-default bg-surface-0\">\n <div className=\"flex flex-1 flex-col justify-end gap-1 p-3\">\n <MessageBubble text=\"Hey! Loved your sunset photo 🌅\" time=\"19:02\" grouped=\"first\" />\n <MessageBubble text=\"Was it Cabo da Roca?\" time=\"19:02\" grouped=\"last\" />\n <MessageBubble mine text=\"It was! Have you been?\" time=\"19:05\" grouped=\"first\" />\n <MessageBubble mine text=\"We should go this weekend\" time=\"19:05\" grouped=\"last\" status=\"read\" showStatus />\n <TypingIndicator label=\"Elena is typing\" />\n </div>\n <MessageComposer value={draft} onValueChange={setDraft} onSend={() => setDraft(\"\")} placeholder=\"Message\" sendLabel=\"Send\" />\n </div>\n );\n}\n"
653
716
  },
654
717
  "props": [
655
718
  {
@@ -820,7 +883,7 @@
820
883
  },
821
884
  {
822
885
  "component": "MessageComposer",
823
- "description": "Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button.",
886
+ "description": "Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button. The `pill` variant is the one-field look of the Krizaka chat card.",
824
887
  "props": [
825
888
  {
826
889
  "name": "onSend",
@@ -857,6 +920,20 @@
857
920
  "description": "The draft (controlled).",
858
921
  "required": true
859
922
  },
923
+ {
924
+ "name": "busy",
925
+ "type": "boolean",
926
+ "default": "false",
927
+ "description": "An answer is on its way: the send is held (and `aria-busy` is set) while the field stays where it is, size included.",
928
+ "required": false
929
+ },
930
+ {
931
+ "name": "canSend",
932
+ "type": "boolean",
933
+ "default": null,
934
+ "description": "Overrides “the draft has text” — e.g. an attachment alone can be sent. A busy composer never sends.",
935
+ "required": false
936
+ },
860
937
  {
861
938
  "name": "className",
862
939
  "type": "string",
@@ -871,11 +948,18 @@
871
948
  "description": "Cannot write: the reason in its place.",
872
949
  "required": false
873
950
  },
951
+ {
952
+ "name": "inputProps",
953
+ "type": "Omit<Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, \"ref\">, \"className\" | ... 4 more ... | \"rows\">",
954
+ "default": null,
955
+ "description": "Attributes (`data-testid`, `autoFocus`, `id`…) forwarded to the textarea.",
956
+ "required": false
957
+ },
874
958
  {
875
959
  "name": "leading",
876
960
  "type": "ReactNode",
877
961
  "default": null,
878
- "description": "Before the input: an attach button.",
962
+ "description": "Before the input: an attach button (`bar`), or the mode/model chip and attach, inside the field (`pill`).",
879
963
  "required": false
880
964
  },
881
965
  {
@@ -884,6 +968,27 @@
884
968
  "default": "4000",
885
969
  "description": "The longest message. Default 4000.",
886
970
  "required": false
971
+ },
972
+ {
973
+ "name": "sendProps",
974
+ "type": "Omit<Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, \"ref\">, \"className\" | ... 2 more ... | \"disabled\">",
975
+ "default": null,
976
+ "description": "Attributes forwarded to the send button.",
977
+ "required": false
978
+ },
979
+ {
980
+ "name": "status",
981
+ "type": "ReactNode",
982
+ "default": null,
983
+ "description": "`pill`: the quiet line under the field (privacy, cost estimate). Its row is always reserved, so a changing line never moves the field. Read politely.",
984
+ "required": false
985
+ },
986
+ {
987
+ "name": "variant",
988
+ "type": "\"bar\" | \"pill\"",
989
+ "default": "bar",
990
+ "description": "`bar`: a docked bar with a square-ish field. `pill`: one rounded field holding `leading`, the text and a round send button — no inner border. Default `bar`.",
991
+ "required": false
887
992
  }
888
993
  ]
889
994
  },
@@ -8,6 +8,17 @@
8
8
  "deprecated": null,
9
9
  "category": "forms",
10
10
  "platforms": "both",
11
+ "parity": {
12
+ "web": {
13
+ "state": "yes"
14
+ },
15
+ "native": {
16
+ "state": "yes"
17
+ },
18
+ "desktop": {
19
+ "state": "yes"
20
+ }
21
+ },
11
22
  "whenToUse": [
12
23
  "In a form, for a choice that is submitted with it: accept the terms, subscribe to a list.",
13
24
  "For several independent options in a list, and “select all” (indeterminate when some are)."
@@ -215,11 +226,11 @@
215
226
  },
216
227
  {
217
228
  "path": "checkbox/meta.ts",
218
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Checkbox\",\n summary: \"A box to check: checked, unchecked or indeterminate, with its words as one clickable label.\",\n status: \"beta\",\n category: \"forms\",\n platforms: \"both\",\n whenToUse: [\n \"In a form, for a choice that is submitted with it: accept the terms, subscribe to a list.\",\n \"For several independent options in a list, and “select all” (indeterminate when some are).\",\n ],\n whenNotToUse: [\n { when: \"For a setting that applies at once, without a submit.\", use: \"switch\" },\n { when: \"To choose one option among several.\", use: \"radio-group\" },\n { when: \"To filter a list with a few options shown as pills.\", use: \"chip\" },\n ],\n bestPractices: [\n \"Say what checking does, in the positive: “Email me the receipts”, not “Don't email me”.\",\n \"Pass the words as children: the whole line is the label and the click target.\",\n \"In a `Field`, set `invalid` and point `aria-describedby` at the `Field.Error`.\",\n ],\n accessibility: {\n keyboard: [{ keys: \"Space\", action: \"Toggles the box.\" }],\n notes: [\n \"Radix Checkbox: `role=\\\"checkbox\\\"` with `aria-checked` true, false or mixed.\",\n \"The children are its label; without children, give it `aria-label` or a `Field.Label htmlFor`.\",\n \"`invalid` sets `aria-invalid`; the error is read through `aria-describedby`.\",\n ],\n },\n related: [\"switch\", \"radio-group\", \"field\", \"chip\"],\n web: {\n imports: [\"Checkbox\"],\n examples: [\n { name: \"unchecked\", title: \"Unchecked\", description: \"Its words as children: one clickable label.\" },\n { name: \"checked\", title: \"Checked\", description: \"`defaultChecked` (or `checked` + `onCheckedChange`).\" },\n { name: \"indeterminate\", title: \"Indeterminate\", description: \"`checked=\\\"indeterminate\\\"`: some of a list.\" },\n { name: \"disabled\", title: \"Disabled\", description: \"Not available, checked or not.\" },\n { name: \"invalid\", title: \"Invalid\", description: \"In a `Field`, with its error.\" },\n ],\n },\n native: {\n imports: [\"Checkbox\"],\n differences: [\n \"Always a 44-pt row: the box and its words, pressed as one; `error` shows under it (no `Field` around it).\",\n \"`checked` is `true` or `false` (no `indeterminate`); `label` names it when the words are a sentence with links.\",\n ],\n examples: [\n { name: \"terms\", title: \"Terms to accept\", description: \"Two boxes of a sign-up: the second with links inside, and its error until it is ticked.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
229
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Checkbox\",\n summary: \"A box to check: checked, unchecked or indeterminate, with its words as one clickable label.\",\n status: \"beta\",\n category: \"forms\",\n platforms: \"both\",\n parity: { desktop: \"web\" },\n whenToUse: [\n \"In a form, for a choice that is submitted with it: accept the terms, subscribe to a list.\",\n \"For several independent options in a list, and “select all” (indeterminate when some are).\",\n ],\n whenNotToUse: [\n { when: \"For a setting that applies at once, without a submit.\", use: \"switch\" },\n { when: \"To choose one option among several.\", use: \"radio-group\" },\n { when: \"To filter a list with a few options shown as pills.\", use: \"chip\" },\n ],\n bestPractices: [\n \"Say what checking does, in the positive: “Email me the receipts”, not “Don't email me”.\",\n \"Pass the words as children: the whole line is the label and the click target.\",\n \"In a `Field`, set `invalid` and point `aria-describedby` at the `Field.Error`.\",\n ],\n accessibility: {\n keyboard: [{ keys: \"Space\", action: \"Toggles the box.\" }],\n notes: [\n \"Radix Checkbox: `role=\\\"checkbox\\\"` with `aria-checked` true, false or mixed.\",\n \"The children are its label; without children, give it `aria-label` or a `Field.Label htmlFor`.\",\n \"`invalid` sets `aria-invalid`; the error is read through `aria-describedby`.\",\n ],\n },\n related: [\"switch\", \"radio-group\", \"field\", \"chip\"],\n web: {\n imports: [\"Checkbox\"],\n examples: [\n { name: \"unchecked\", title: \"Unchecked\", description: \"Its words as children: one clickable label.\" },\n { name: \"checked\", title: \"Checked\", description: \"`defaultChecked` (or `checked` + `onCheckedChange`).\" },\n { name: \"indeterminate\", title: \"Indeterminate\", description: \"`checked=\\\"indeterminate\\\"`: some of a list.\" },\n { name: \"disabled\", title: \"Disabled\", description: \"Not available, checked or not.\" },\n { name: \"invalid\", title: \"Invalid\", description: \"In a `Field`, with its error.\" },\n ],\n },\n native: {\n imports: [\"Checkbox\"],\n differences: [\n \"Always a 44-pt row: the box and its words, pressed as one; `error` shows under it (no `Field` around it).\",\n \"`checked` is `true` or `false` (no `indeterminate`); `label` names it when the words are a sentence with links.\",\n ],\n examples: [\n { name: \"terms\", title: \"Terms to accept\", description: \"Two boxes of a sign-up: the second with links inside, and its error until it is ticked.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
219
230
  },
220
231
  {
221
232
  "path": "meta.ts",
222
- "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"achievement\"\n | \"action-bar\"\n | \"activity-feed\"\n | \"action-sheet\"\n | \"alert\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"form\"\n | \"gallery-page\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"document-viewer\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"map\"\n | \"markdown\"\n | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"radio-group\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\n | \"showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"split-view\"\n | \"splash-handoff\"\n | \"stage-banner\"\n | \"stat\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
233
+ "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"achievement\"\n | \"action-bar\"\n | \"activity-feed\"\n | \"action-sheet\"\n | \"alert\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"form\"\n | \"gallery-page\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"document-viewer\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"map\"\n | \"markdown\"\n | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"radio-group\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\n | \"showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot\"\n | \"spinner\"\n | \"split-view\"\n | \"splash-handoff\"\n | \"stage-banner\"\n | \"stat\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
223
234
  }
224
235
  ],
225
236
  "dependencies": [