@krizaka/ui 3.4.0 → 3.6.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.
- package/README.md +1 -0
- package/dist/app-shell.d.ts +24 -22
- package/dist/app-shell.js +9 -3
- package/dist/app-shell.js.map +1 -1
- package/dist/argument-card.js +3 -3
- package/dist/chat.d.ts +187 -0
- package/dist/chat.js +132 -0
- package/dist/chat.js.map +1 -0
- package/dist/chunk-3GODX3D6.js +25 -0
- package/dist/chunk-3GODX3D6.js.map +1 -0
- package/dist/chunk-ECSCA3CN.js +128 -0
- package/dist/chunk-ECSCA3CN.js.map +1 -0
- package/dist/chunk-F2GKFIYK.js +47 -0
- package/dist/chunk-F2GKFIYK.js.map +1 -0
- package/dist/{chunk-R6SDS7JM.js → chunk-ND3L5VHT.js} +25 -2
- package/dist/chunk-ND3L5VHT.js.map +1 -0
- package/dist/command.js +1 -1
- package/dist/data-table.js +20 -134
- package/dist/data-table.js.map +1 -1
- package/dist/dialog.js +7 -3
- package/dist/dialog.js.map +1 -1
- package/dist/loader.d.ts +21 -1
- package/dist/loader.js +7 -3
- package/dist/loader.js.map +1 -1
- package/dist/map.js +7 -1
- package/dist/map.js.map +1 -1
- package/dist/marketing-layout.d.ts +3 -9
- package/dist/marketing-layout.js +24 -7
- package/dist/marketing-layout.js.map +1 -1
- package/dist/match-dialog.d.ts +32 -0
- package/dist/match-dialog.js +168 -0
- package/dist/match-dialog.js.map +1 -0
- package/dist/native.d.ts +484 -106
- package/dist/native.js +1967 -1323
- package/dist/native.js.map +1 -1
- package/dist/page-hero.js +3 -3
- package/dist/photo-grid.d.ts +122 -0
- package/dist/photo-grid.js +94 -0
- package/dist/photo-grid.js.map +1 -0
- package/dist/skip-link.d.ts +15 -0
- package/dist/skip-link.js +10 -0
- package/dist/skip-link.js.map +1 -0
- package/dist/step-progress.d.ts +20 -0
- package/dist/step-progress.js +17 -0
- package/dist/step-progress.js.map +1 -0
- package/dist/swipe-deck.d.ts +183 -0
- package/dist/swipe-deck.js +144 -0
- package/dist/swipe-deck.js.map +1 -0
- package/dist/tag-selector.d.ts +26 -0
- package/dist/tag-selector.js +21 -0
- package/dist/tag-selector.js.map +1 -0
- package/dist/tree-view.d.ts +2 -0
- package/dist/tree-view.js.map +1 -1
- package/dist/verified-badge.d.ts +16 -0
- package/dist/verified-badge.js +23 -0
- package/dist/verified-badge.js.map +1 -0
- package/package.json +120 -8
- package/registry/achievement.json +2 -1
- package/registry/action-bar.json +2 -1
- package/registry/action-sheet.json +1 -0
- package/registry/activity-feed.json +2 -1
- package/registry/alert.json +2 -1
- package/registry/app-shell.json +27 -5
- package/registry/argument-card.json +2 -1
- package/registry/audio-player.json +2 -1
- package/registry/auth-layout.json +7 -2
- package/registry/avatar.json +2 -1
- package/registry/badge.json +2 -1
- package/registry/button.json +2 -1
- package/registry/card-grid.json +2 -1
- package/registry/card.json +2 -1
- package/registry/catalogue-page.json +5 -2
- package/registry/changelog-page.json +5 -2
- package/registry/chat.json +918 -0
- package/registry/checkbox.json +2 -1
- package/registry/chip-link.json +2 -1
- package/registry/chip.json +2 -1
- package/registry/choice-grid.json +2 -1
- package/registry/cn.json +1 -0
- package/registry/code-block.json +2 -1
- package/registry/combobox.json +2 -1
- package/registry/command.json +2 -1
- package/registry/component-page.json +5 -2
- package/registry/confirm-button.json +2 -1
- package/registry/contact-page.json +5 -2
- package/registry/continue-prompt.json +2 -1
- package/registry/countdown.json +2 -1
- package/registry/cta-panel.json +2 -1
- package/registry/dashboard-layout.json +5 -2
- package/registry/data-table.json +2 -1
- package/registry/date-picker.json +3 -2
- package/registry/decision-list.json +2 -1
- package/registry/description-list.json +2 -1
- package/registry/detail-layout.json +16 -2
- package/registry/dialog.json +10 -4
- package/registry/docs-article-page.json +16 -2
- package/registry/docs-hub-page.json +5 -2
- package/registry/docs-layout.json +2 -1
- package/registry/dropdown-menu.json +2 -1
- package/registry/empty-state.json +14 -2
- package/registry/error-page.json +5 -2
- package/registry/examples/chat/conversation.d.ts +4 -0
- package/registry/examples/chat/conversation.js +22 -0
- package/registry/examples/chat/conversation.tsx +21 -0
- package/registry/examples/chat/inbox.d.ts +4 -0
- package/registry/examples/chat/inbox.js +15 -0
- package/registry/examples/chat/inbox.tsx +12 -0
- package/registry/examples/chat/native/conversation.d.ts +4 -0
- package/registry/examples/chat/native/conversation.dark.png +0 -0
- package/registry/examples/chat/native/conversation.js +23 -0
- package/registry/examples/chat/native/conversation.light.png +0 -0
- package/registry/examples/chat/native/conversation.tsx +20 -0
- package/registry/examples/chat/native/inbox.d.ts +4 -0
- package/registry/examples/chat/native/inbox.dark.png +0 -0
- package/registry/examples/chat/native/inbox.js +16 -0
- package/registry/examples/chat/native/inbox.light.png +0 -0
- package/registry/examples/chat/native/inbox.tsx +13 -0
- package/registry/examples/detail-layout/checkout.d.ts +4 -0
- package/registry/examples/detail-layout/checkout.js +37 -0
- package/registry/examples/detail-layout/checkout.tsx +44 -0
- package/registry/examples/docs-article-page/faq.d.ts +4 -0
- package/registry/examples/docs-article-page/faq.js +31 -0
- package/registry/examples/docs-article-page/faq.tsx +40 -0
- package/registry/examples/empty-state/library.d.ts +4 -0
- package/registry/examples/empty-state/library.js +25 -0
- package/registry/examples/empty-state/library.tsx +20 -0
- package/registry/examples/loader/branded.d.ts +4 -0
- package/registry/examples/loader/branded.js +12 -0
- package/registry/examples/loader/branded.tsx +7 -0
- package/registry/examples/loader/native/branded.d.ts +4 -0
- package/registry/examples/loader/native/branded.dark.png +0 -0
- package/registry/examples/loader/native/branded.js +12 -0
- package/registry/examples/loader/native/branded.light.png +0 -0
- package/registry/examples/loader/native/branded.tsx +11 -0
- package/registry/examples/longform-page/case-study.d.ts +4 -0
- package/registry/examples/longform-page/case-study.js +41 -0
- package/registry/examples/longform-page/case-study.tsx +40 -0
- package/registry/examples/match-dialog/its-a-match.d.ts +4 -0
- package/registry/examples/match-dialog/its-a-match.js +29 -0
- package/registry/examples/match-dialog/its-a-match.tsx +25 -0
- package/registry/examples/match-dialog/native/its-a-match.d.ts +4 -0
- package/registry/examples/match-dialog/native/its-a-match.dark.png +0 -0
- package/registry/examples/match-dialog/native/its-a-match.js +28 -0
- package/registry/examples/match-dialog/native/its-a-match.light.png +0 -0
- package/registry/examples/match-dialog/native/its-a-match.tsx +22 -0
- package/registry/examples/photo-grid/native/profile-photos.d.ts +4 -0
- package/registry/examples/photo-grid/native/profile-photos.dark.png +0 -0
- package/registry/examples/photo-grid/native/profile-photos.js +27 -0
- package/registry/examples/photo-grid/native/profile-photos.light.png +0 -0
- package/registry/examples/photo-grid/native/profile-photos.tsx +24 -0
- package/registry/examples/photo-grid/profile-photos.d.ts +4 -0
- package/registry/examples/photo-grid/profile-photos.js +28 -0
- package/registry/examples/photo-grid/profile-photos.tsx +25 -0
- package/registry/examples/pull-to-refresh/native/branded.d.ts +4 -0
- package/registry/examples/pull-to-refresh/native/branded.dark.png +0 -0
- package/registry/examples/pull-to-refresh/native/branded.js +14 -0
- package/registry/examples/pull-to-refresh/native/branded.light.png +0 -0
- package/registry/examples/pull-to-refresh/native/branded.tsx +23 -0
- package/registry/examples/screen/native/app-shell.d.ts +4 -0
- package/registry/examples/screen/native/app-shell.dark.png +0 -0
- package/registry/examples/screen/native/app-shell.js +25 -0
- package/registry/examples/screen/native/app-shell.light.png +0 -0
- package/registry/examples/screen/native/app-shell.tsx +33 -0
- package/registry/examples/screen/native/auth.d.ts +4 -0
- package/registry/examples/screen/native/auth.dark.png +0 -0
- package/registry/examples/screen/native/auth.js +24 -0
- package/registry/examples/screen/native/auth.light.png +0 -0
- package/registry/examples/screen/native/auth.tsx +20 -0
- package/registry/examples/screen/native/chat.d.ts +4 -0
- package/registry/examples/screen/native/chat.dark.png +0 -0
- package/registry/examples/screen/native/chat.js +27 -0
- package/registry/examples/screen/native/chat.light.png +0 -0
- package/registry/examples/screen/native/chat.tsx +22 -0
- package/registry/examples/screen/native/feed.d.ts +4 -0
- package/registry/examples/screen/native/feed.dark.png +0 -0
- package/registry/examples/screen/native/feed.js +24 -0
- package/registry/examples/screen/native/feed.light.png +0 -0
- package/registry/examples/screen/native/feed.tsx +34 -0
- package/registry/examples/screen/native/map.d.ts +4 -0
- package/registry/examples/screen/native/map.dark.png +0 -0
- package/registry/examples/screen/native/map.js +26 -0
- package/registry/examples/screen/native/map.light.png +0 -0
- package/registry/examples/screen/native/map.tsx +31 -0
- package/registry/examples/screen/native/notifications.d.ts +4 -0
- package/registry/examples/screen/native/notifications.dark.png +0 -0
- package/registry/examples/screen/native/notifications.js +21 -0
- package/registry/examples/screen/native/notifications.light.png +0 -0
- package/registry/examples/screen/native/notifications.tsx +21 -0
- package/registry/examples/screen/native/profile.d.ts +4 -0
- package/registry/examples/screen/native/profile.dark.png +0 -0
- package/registry/examples/screen/native/profile.js +29 -0
- package/registry/examples/screen/native/profile.light.png +0 -0
- package/registry/examples/screen/native/profile.tsx +27 -0
- package/registry/examples/screen/native/settings.d.ts +4 -0
- package/registry/examples/screen/native/settings.dark.png +0 -0
- package/registry/examples/screen/native/settings.js +20 -0
- package/registry/examples/screen/native/settings.light.png +0 -0
- package/registry/examples/screen/native/settings.tsx +19 -0
- package/registry/examples/skip-link/default.d.ts +4 -0
- package/registry/examples/skip-link/default.js +19 -0
- package/registry/examples/skip-link/default.tsx +12 -0
- package/registry/examples/splash-handoff/native/default.d.ts +4 -0
- package/registry/examples/splash-handoff/native/default.dark.png +0 -0
- package/registry/examples/splash-handoff/native/default.js +12 -0
- package/registry/examples/splash-handoff/native/default.light.png +0 -0
- package/registry/examples/splash-handoff/native/default.tsx +11 -0
- package/registry/examples/split-view/nearby.d.ts +4 -0
- package/registry/examples/split-view/nearby.js +33 -0
- package/registry/examples/split-view/nearby.tsx +45 -0
- package/registry/examples/split-view/notifications.d.ts +4 -0
- package/registry/examples/split-view/notifications.js +33 -0
- package/registry/examples/split-view/notifications.tsx +31 -0
- package/registry/examples/status-page/maintenance.d.ts +4 -0
- package/registry/examples/status-page/maintenance.js +29 -0
- package/registry/examples/status-page/maintenance.tsx +24 -0
- package/registry/examples/step-progress/native/sign-up.d.ts +4 -0
- package/registry/examples/step-progress/native/sign-up.dark.png +0 -0
- package/registry/examples/step-progress/native/sign-up.js +12 -0
- package/registry/examples/step-progress/native/sign-up.light.png +0 -0
- package/registry/examples/step-progress/native/sign-up.tsx +11 -0
- package/registry/examples/step-progress/sign-up.d.ts +4 -0
- package/registry/examples/step-progress/sign-up.js +22 -0
- package/registry/examples/step-progress/sign-up.tsx +16 -0
- package/registry/examples/swipe-deck/discover.d.ts +4 -0
- package/registry/examples/swipe-deck/discover.js +41 -0
- package/registry/examples/swipe-deck/discover.tsx +37 -0
- package/registry/examples/swipe-deck/native/discover.d.ts +4 -0
- package/registry/examples/swipe-deck/native/discover.dark.png +0 -0
- package/registry/examples/swipe-deck/native/discover.js +39 -0
- package/registry/examples/swipe-deck/native/discover.light.png +0 -0
- package/registry/examples/swipe-deck/native/discover.tsx +35 -0
- package/registry/examples/tag-selector/interests.d.ts +4 -0
- package/registry/examples/tag-selector/interests.js +14 -0
- package/registry/examples/tag-selector/interests.tsx +12 -0
- package/registry/examples/tag-selector/native/interests.d.ts +4 -0
- package/registry/examples/tag-selector/native/interests.dark.png +0 -0
- package/registry/examples/tag-selector/native/interests.js +15 -0
- package/registry/examples/tag-selector/native/interests.light.png +0 -0
- package/registry/examples/tag-selector/native/interests.tsx +15 -0
- package/registry/examples/verified-badge/native/verified.d.ts +4 -0
- package/registry/examples/verified-badge/native/verified.dark.png +0 -0
- package/registry/examples/verified-badge/native/verified.js +18 -0
- package/registry/examples/verified-badge/native/verified.light.png +0 -0
- package/registry/examples/verified-badge/native/verified.tsx +15 -0
- package/registry/examples/verified-badge/verified.d.ts +4 -0
- package/registry/examples/verified-badge/verified.js +17 -0
- package/registry/examples/verified-badge/verified.tsx +13 -0
- package/registry/fab.json +1 -0
- package/registry/field.json +2 -1
- package/registry/file-upload.json +3 -2
- package/registry/filter-bar.json +2 -1
- package/registry/form.json +3 -2
- package/registry/gallery-page.json +5 -2
- package/registry/glow-card.json +2 -1
- package/registry/goal-gauge.json +2 -1
- package/registry/header.json +1 -0
- package/registry/how-it-works-page.json +5 -2
- package/registry/image-cropper.json +2 -1
- package/registry/image-viewer.json +1 -0
- package/registry/index.json +608 -19
- package/registry/iso.json +2 -1
- package/registry/kanban.json +2 -1
- package/registry/kbd.json +2 -1
- package/registry/landing-page.json +5 -2
- package/registry/landscape.json +2 -1
- package/registry/legal-page.json +5 -2
- package/registry/link-card.json +2 -1
- package/registry/list.json +2 -1
- package/registry/loader.json +47 -3
- package/registry/longform-page.json +16 -2
- package/registry/map.json +4 -3
- package/registry/marketing-layout.json +13 -4
- package/registry/marquee.json +2 -1
- package/registry/mascot-quote.json +2 -1
- package/registry/mascot-state.json +2 -1
- package/registry/mascots.json +2 -1
- package/registry/match-dialog.json +315 -0
- package/registry/media-capture.json +2 -1
- package/registry/media-picker.json +1 -0
- package/registry/meter.json +2 -1
- package/registry/nav-bar.json +2 -1
- package/registry/number-ticker.json +2 -1
- package/registry/onboarding.json +1 -0
- package/registry/otp-input.json +1 -0
- package/registry/page-header.json +2 -1
- package/registry/page-hero.json +2 -1
- package/registry/page.json +2 -1
- package/registry/pagination.json +2 -1
- package/registry/permission-prompt.json +1 -0
- package/registry/photo-grid.json +303 -0
- package/registry/pointer-light.json +2 -1
- package/registry/popover.json +2 -1
- package/registry/pricing-page.json +5 -2
- package/registry/product-page.json +5 -2
- package/registry/profile-card.json +2 -1
- package/registry/progress.json +2 -1
- package/registry/promise-card.json +2 -1
- package/registry/pull-to-refresh.json +68 -4
- package/registry/radio-group.json +2 -1
- package/registry/screen.json +233 -0
- package/registry/scroll-stage.json +2 -1
- package/registry/search-field.json +2 -1
- package/registry/section-backdrop.json +2 -1
- package/registry/segmented.json +1 -0
- package/registry/separator.json +2 -1
- package/registry/settings-layout.json +5 -2
- package/registry/skeleton.json +2 -1
- package/registry/skip-link.json +122 -0
- package/registry/slider.json +2 -1
- package/registry/slot.json +2 -1
- package/registry/spinner.json +2 -1
- package/registry/splash-handoff.json +138 -0
- package/registry/split-view.json +27 -2
- package/registry/stage-banner.json +2 -1
- package/registry/stat.json +2 -1
- package/registry/status-page.json +18 -2
- package/registry/step-progress.json +256 -0
- package/registry/stepper.json +2 -1
- package/registry/swipe-deck.json +513 -0
- package/registry/swipeable-row.json +1 -0
- package/registry/switch.json +2 -1
- package/registry/tab-bar.json +1 -0
- package/registry/tabs.json +2 -1
- package/registry/tag-input.json +2 -1
- package/registry/tag-selector.json +277 -0
- package/registry/terminal-replay.json +2 -1
- package/registry/theme.json +2 -1
- package/registry/toast.json +2 -1
- package/registry/toc.json +2 -1
- package/registry/tooltip.json +2 -1
- package/registry/tree-view.json +10 -4
- package/registry/txt.json +1 -0
- package/registry/verified-badge.json +203 -0
- package/registry/video-player.json +2 -1
- package/registry/video-trimmer.json +2 -1
- package/registry/virtual.json +2 -1
- package/dist/chunk-R6SDS7JM.js.map +0 -1
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chat",
|
|
3
|
+
"type": "primitive",
|
|
4
|
+
"title": "Chat",
|
|
5
|
+
"summary": "A conversation's parts — `MessageBubble` (time, receipt, retry), `TypingIndicator`, `MessageComposer`, `ConversationItem` — the same API on the web and React Native.",
|
|
6
|
+
"description": "A conversation's parts — `MessageBubble` (time, receipt, retry), `TypingIndicator`, `MessageComposer`, `ConversationItem` — the same API on the web and React Native.",
|
|
7
|
+
"status": "beta",
|
|
8
|
+
"deprecated": null,
|
|
9
|
+
"category": "data-display",
|
|
10
|
+
"platforms": "both",
|
|
11
|
+
"whenToUse": [
|
|
12
|
+
"Orochia's Messages, a dating app's chats, support threads.",
|
|
13
|
+
"An inbox of conversations with presence and unread counts."
|
|
14
|
+
],
|
|
15
|
+
"whenNotToUse": [
|
|
16
|
+
{
|
|
17
|
+
"when": "For a comments thread under a post.",
|
|
18
|
+
"use": "list"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"when": "For notifications.",
|
|
22
|
+
"use": "toast"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"bestPractices": [
|
|
26
|
+
"Group the runs of one sender (`grouped`); show the receipt under the last message of yours only.",
|
|
27
|
+
"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."
|
|
29
|
+
],
|
|
30
|
+
"accessibility": {
|
|
31
|
+
"keyboard": [
|
|
32
|
+
{
|
|
33
|
+
"keys": "Enter / Shift+Enter",
|
|
34
|
+
"action": "In the web composer: send, or a new line."
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"notes": [
|
|
38
|
+
"Each bubble is read with its time; a failed one says so and offers a retry.",
|
|
39
|
+
"The typing dots are announced politely by their words.",
|
|
40
|
+
"A conversation row reads name, presence, last message, time and unread count."
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"related": [
|
|
44
|
+
"avatar",
|
|
45
|
+
"list",
|
|
46
|
+
"toast"
|
|
47
|
+
],
|
|
48
|
+
"web": {
|
|
49
|
+
"entry": "@krizaka/ui/chat",
|
|
50
|
+
"import": "import { MessageBubble, TypingIndicator, MessageComposer, ConversationItem } from \"@krizaka/ui/chat\";",
|
|
51
|
+
"props": [
|
|
52
|
+
{
|
|
53
|
+
"component": "ConversationItem",
|
|
54
|
+
"description": "A conversation in the list: avatar, name, the last message or typing, the time, the unread count.",
|
|
55
|
+
"props": [
|
|
56
|
+
{
|
|
57
|
+
"name": "name",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"default": null,
|
|
60
|
+
"description": "The other person's name.",
|
|
61
|
+
"required": true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "preview",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"default": null,
|
|
67
|
+
"description": "The last message, or “typing…”.",
|
|
68
|
+
"required": true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "avatar",
|
|
72
|
+
"type": "string | null",
|
|
73
|
+
"default": null,
|
|
74
|
+
"description": "Their avatar's URL.",
|
|
75
|
+
"required": false
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "className",
|
|
79
|
+
"type": "string",
|
|
80
|
+
"default": null,
|
|
81
|
+
"description": "Classes merged on the row.",
|
|
82
|
+
"required": false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "href",
|
|
86
|
+
"type": "string",
|
|
87
|
+
"default": null,
|
|
88
|
+
"description": "Opens the conversation (a link).",
|
|
89
|
+
"required": false
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "online",
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"default": null,
|
|
95
|
+
"description": "Before the name: a presence dot (online).",
|
|
96
|
+
"required": false
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "onlineLabel",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"default": null,
|
|
102
|
+
"description": "The presence in words (“online”).",
|
|
103
|
+
"required": false
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "onSelect",
|
|
107
|
+
"type": "(() => void)",
|
|
108
|
+
"default": null,
|
|
109
|
+
"description": "Opens the conversation (a button).",
|
|
110
|
+
"required": false
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "time",
|
|
114
|
+
"type": "string",
|
|
115
|
+
"default": null,
|
|
116
|
+
"description": "When (“14:02”, “Mon”).",
|
|
117
|
+
"required": false
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "typing",
|
|
121
|
+
"type": "boolean",
|
|
122
|
+
"default": null,
|
|
123
|
+
"description": "The preview is the typing signal: in the accent.",
|
|
124
|
+
"required": false
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "unread",
|
|
128
|
+
"type": "number",
|
|
129
|
+
"default": "0",
|
|
130
|
+
"description": "Unread messages: a count, the name in bold.",
|
|
131
|
+
"required": false
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "unreadLabel",
|
|
135
|
+
"type": "string",
|
|
136
|
+
"default": null,
|
|
137
|
+
"description": "The unread count in words (“3 unread”).",
|
|
138
|
+
"required": false
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"component": "MessageBubble",
|
|
144
|
+
"description": "A message: yours in the accent on the right, theirs on the left, the time inside, the receipt under the last of yours.",
|
|
145
|
+
"props": [
|
|
146
|
+
{
|
|
147
|
+
"name": "text",
|
|
148
|
+
"type": "string",
|
|
149
|
+
"default": null,
|
|
150
|
+
"description": "The text.",
|
|
151
|
+
"required": true
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "className",
|
|
155
|
+
"type": "string",
|
|
156
|
+
"default": null,
|
|
157
|
+
"description": "Classes merged on the row.",
|
|
158
|
+
"required": false
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "context",
|
|
162
|
+
"type": "string",
|
|
163
|
+
"default": null,
|
|
164
|
+
"description": "A line above the text: what it answers.",
|
|
165
|
+
"required": false
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "grouped",
|
|
169
|
+
"type": "\"middle\" | \"first\" | \"last\" | \"single\"",
|
|
170
|
+
"default": "single",
|
|
171
|
+
"description": "Part of a run of the same sender: the corner towards the next one is tighter.",
|
|
172
|
+
"required": false
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "labels",
|
|
176
|
+
"type": "MessageBubbleLabels",
|
|
177
|
+
"default": null,
|
|
178
|
+
"description": "The words, passed translated.",
|
|
179
|
+
"required": false
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "mine",
|
|
183
|
+
"type": "boolean",
|
|
184
|
+
"default": null,
|
|
185
|
+
"description": "Yours (right, in the accent) or theirs (left).",
|
|
186
|
+
"required": false
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "onRetry",
|
|
190
|
+
"type": "(() => void)",
|
|
191
|
+
"default": null,
|
|
192
|
+
"description": "Sends a failed message again (a button under it).",
|
|
193
|
+
"required": false
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "showStatus",
|
|
197
|
+
"type": "boolean",
|
|
198
|
+
"default": null,
|
|
199
|
+
"description": "Show the status under the bubble (the last message of yours).",
|
|
200
|
+
"required": false
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "status",
|
|
204
|
+
"type": "MessageStatus",
|
|
205
|
+
"default": null,
|
|
206
|
+
"description": "Where a message of yours stands; shown when `showStatus`.",
|
|
207
|
+
"required": false
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "time",
|
|
211
|
+
"type": "string",
|
|
212
|
+
"default": null,
|
|
213
|
+
"description": "The time, written by the app (“14:02”).",
|
|
214
|
+
"required": false
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"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.",
|
|
221
|
+
"props": [
|
|
222
|
+
{
|
|
223
|
+
"name": "onSend",
|
|
224
|
+
"type": "() => void",
|
|
225
|
+
"default": null,
|
|
226
|
+
"description": "Sends the draft (Enter, or the button); Shift+Enter adds a line.",
|
|
227
|
+
"required": true
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "onValueChange",
|
|
231
|
+
"type": "(text: string) => void",
|
|
232
|
+
"default": null,
|
|
233
|
+
"description": "Called on every key.",
|
|
234
|
+
"required": true
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "placeholder",
|
|
238
|
+
"type": "string",
|
|
239
|
+
"default": null,
|
|
240
|
+
"description": "The input's name and placeholder (“Message”).",
|
|
241
|
+
"required": true
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "sendLabel",
|
|
245
|
+
"type": "string",
|
|
246
|
+
"default": null,
|
|
247
|
+
"description": "The send button's name (“Send”).",
|
|
248
|
+
"required": true
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "value",
|
|
252
|
+
"type": "string",
|
|
253
|
+
"default": null,
|
|
254
|
+
"description": "The draft (controlled).",
|
|
255
|
+
"required": true
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "className",
|
|
259
|
+
"type": "string",
|
|
260
|
+
"default": null,
|
|
261
|
+
"description": "Classes merged on the root.",
|
|
262
|
+
"required": false
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "disabledReason",
|
|
266
|
+
"type": "string",
|
|
267
|
+
"default": null,
|
|
268
|
+
"description": "Cannot write: the reason in its place.",
|
|
269
|
+
"required": false
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"name": "leading",
|
|
273
|
+
"type": "ReactNode",
|
|
274
|
+
"default": null,
|
|
275
|
+
"description": "Before the input: an attach button.",
|
|
276
|
+
"required": false
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "maxLength",
|
|
280
|
+
"type": "number",
|
|
281
|
+
"default": "4000",
|
|
282
|
+
"description": "The longest message. Default 4000.",
|
|
283
|
+
"required": false
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"component": "TypingIndicator",
|
|
289
|
+
"description": "Three dots that breathe while the other person types, announced politely; still under reduced motion.",
|
|
290
|
+
"props": [
|
|
291
|
+
{
|
|
292
|
+
"name": "label",
|
|
293
|
+
"type": "string",
|
|
294
|
+
"default": null,
|
|
295
|
+
"description": "What is read and shown beside the dots (“Elena is typing”) — passed translated.",
|
|
296
|
+
"required": true
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"name": "className",
|
|
300
|
+
"type": "string",
|
|
301
|
+
"default": null,
|
|
302
|
+
"description": "Classes merged on the root.",
|
|
303
|
+
"required": false
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"name": "showLabel",
|
|
307
|
+
"type": "boolean",
|
|
308
|
+
"default": null,
|
|
309
|
+
"description": "Show the words beside the dots.",
|
|
310
|
+
"required": false
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"examples": [
|
|
316
|
+
{
|
|
317
|
+
"name": "conversation",
|
|
318
|
+
"title": "Conversation",
|
|
319
|
+
"description": "Grouped runs, a read receipt, typing, the composer.",
|
|
320
|
+
"path": "examples/chat/conversation.tsx",
|
|
321
|
+
"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"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"name": "inbox",
|
|
326
|
+
"title": "Inbox",
|
|
327
|
+
"description": "Online, typing, unread counts.",
|
|
328
|
+
"path": "examples/chat/inbox.tsx",
|
|
329
|
+
"module": "@krizaka/ui/registry/examples/chat/inbox",
|
|
330
|
+
"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"
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
"native": {
|
|
335
|
+
"entry": "@krizaka/ui/native",
|
|
336
|
+
"import": "import { MessageBubble, TypingIndicator, MessageComposer, ConversationItem } from \"@krizaka/ui/native\";",
|
|
337
|
+
"differences": [
|
|
338
|
+
"The composer keeps clear of the home indicator; the send button plays a light tap.",
|
|
339
|
+
"A failed bubble is itself the retry button.",
|
|
340
|
+
"`ConversationItem` takes `presence` (a dot on the avatar) instead of `online`."
|
|
341
|
+
],
|
|
342
|
+
"props": [
|
|
343
|
+
{
|
|
344
|
+
"component": "MessageBubble",
|
|
345
|
+
"description": "A message: yours in the accent on the right, theirs on the left, the time inside, the receipt under the last of yours.",
|
|
346
|
+
"props": [
|
|
347
|
+
{
|
|
348
|
+
"name": "text",
|
|
349
|
+
"type": "string",
|
|
350
|
+
"default": null,
|
|
351
|
+
"description": "The text.",
|
|
352
|
+
"required": true
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "context",
|
|
356
|
+
"type": "string",
|
|
357
|
+
"default": null,
|
|
358
|
+
"description": "A line above the text: what it answers (“Replied to your story”).",
|
|
359
|
+
"required": false
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"name": "grouped",
|
|
363
|
+
"type": "\"middle\" | \"first\" | \"last\" | \"single\"",
|
|
364
|
+
"default": "single",
|
|
365
|
+
"description": "Part of a run of the same sender: the corner towards the next one is tighter.",
|
|
366
|
+
"required": false
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"name": "labels",
|
|
370
|
+
"type": "MessageBubbleLabels",
|
|
371
|
+
"default": null,
|
|
372
|
+
"description": "The words, passed translated.",
|
|
373
|
+
"required": false
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"name": "mine",
|
|
377
|
+
"type": "boolean",
|
|
378
|
+
"default": null,
|
|
379
|
+
"description": "Yours (right, in the accent) or theirs (left).",
|
|
380
|
+
"required": false
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"name": "onRetry",
|
|
384
|
+
"type": "(() => void)",
|
|
385
|
+
"default": null,
|
|
386
|
+
"description": "Called when a failed message is pressed: send it again.",
|
|
387
|
+
"required": false
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"name": "showStatus",
|
|
391
|
+
"type": "boolean",
|
|
392
|
+
"default": null,
|
|
393
|
+
"description": "Show the status under the bubble (the last message of yours).",
|
|
394
|
+
"required": false
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"name": "status",
|
|
398
|
+
"type": "MessageStatus",
|
|
399
|
+
"default": null,
|
|
400
|
+
"description": "Where a message of yours stands; shown when `showStatus`.",
|
|
401
|
+
"required": false
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"name": "style",
|
|
405
|
+
"type": "StyleProp<ViewStyle>",
|
|
406
|
+
"default": null,
|
|
407
|
+
"description": "Styles merged last.",
|
|
408
|
+
"required": false
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"name": "time",
|
|
412
|
+
"type": "string",
|
|
413
|
+
"default": null,
|
|
414
|
+
"description": "The time, written by the app (“14:02”).",
|
|
415
|
+
"required": false
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"component": "TypingIndicator",
|
|
421
|
+
"description": "Three dots that breathe in a bubble while the other person types; still under reduced motion.",
|
|
422
|
+
"props": [
|
|
423
|
+
{
|
|
424
|
+
"name": "label",
|
|
425
|
+
"type": "string",
|
|
426
|
+
"default": null,
|
|
427
|
+
"description": "What is said to screen readers and shown beside the dots (“Elena is typing”) — passed translated.",
|
|
428
|
+
"required": true
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"name": "showLabel",
|
|
432
|
+
"type": "boolean",
|
|
433
|
+
"default": null,
|
|
434
|
+
"description": "Show the words beside the dots. Default false.",
|
|
435
|
+
"required": false
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"name": "style",
|
|
439
|
+
"type": "StyleProp<ViewStyle>",
|
|
440
|
+
"default": null,
|
|
441
|
+
"description": "Styles merged last.",
|
|
442
|
+
"required": false
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"component": "MessageComposer",
|
|
448
|
+
"description": "Where a message is written: a growing input, an attach slot, a send button that wakes when there is something to send.",
|
|
449
|
+
"props": [
|
|
450
|
+
{
|
|
451
|
+
"name": "onSend",
|
|
452
|
+
"type": "() => void",
|
|
453
|
+
"default": null,
|
|
454
|
+
"description": "Sends the draft; the composer does not clear it — the app does once sent.",
|
|
455
|
+
"required": true
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"name": "onValueChange",
|
|
459
|
+
"type": "(text: string) => void",
|
|
460
|
+
"default": null,
|
|
461
|
+
"description": "Called on every key (send the typing signal from here).",
|
|
462
|
+
"required": true
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"name": "placeholder",
|
|
466
|
+
"type": "string",
|
|
467
|
+
"default": null,
|
|
468
|
+
"description": "The input's name and placeholder (“Message”) — passed translated.",
|
|
469
|
+
"required": true
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"name": "sendLabel",
|
|
473
|
+
"type": "string",
|
|
474
|
+
"default": null,
|
|
475
|
+
"description": "The send button's name (“Send”).",
|
|
476
|
+
"required": true
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"name": "value",
|
|
480
|
+
"type": "string",
|
|
481
|
+
"default": null,
|
|
482
|
+
"description": "The draft (controlled).",
|
|
483
|
+
"required": true
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"name": "disabledReason",
|
|
487
|
+
"type": "string",
|
|
488
|
+
"default": null,
|
|
489
|
+
"description": "Cannot write (blocked, read-only): the reason in its place.",
|
|
490
|
+
"required": false
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"name": "leading",
|
|
494
|
+
"type": "ReactNode",
|
|
495
|
+
"default": null,
|
|
496
|
+
"description": "Before the input: an attach button.",
|
|
497
|
+
"required": false
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "maxLength",
|
|
501
|
+
"type": "number",
|
|
502
|
+
"default": "4000",
|
|
503
|
+
"description": "The longest message. Default 4000.",
|
|
504
|
+
"required": false
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"name": "style",
|
|
508
|
+
"type": "StyleProp<ViewStyle>",
|
|
509
|
+
"default": null,
|
|
510
|
+
"description": "Styles merged last.",
|
|
511
|
+
"required": false
|
|
512
|
+
}
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"component": "ConversationItem",
|
|
517
|
+
"description": "A conversation in the list: avatar and presence, name, the last message or typing, the time, the unread count.",
|
|
518
|
+
"props": [
|
|
519
|
+
{
|
|
520
|
+
"name": "name",
|
|
521
|
+
"type": "string",
|
|
522
|
+
"default": null,
|
|
523
|
+
"description": "The other person's name.",
|
|
524
|
+
"required": true
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"name": "preview",
|
|
528
|
+
"type": "string",
|
|
529
|
+
"default": null,
|
|
530
|
+
"description": "The last message, or “typing…”.",
|
|
531
|
+
"required": true
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"name": "avatar",
|
|
535
|
+
"type": "string | null",
|
|
536
|
+
"default": null,
|
|
537
|
+
"description": "Their avatar's URI.",
|
|
538
|
+
"required": false
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"name": "onPress",
|
|
542
|
+
"type": "(() => void)",
|
|
543
|
+
"default": null,
|
|
544
|
+
"description": "Opens the conversation.",
|
|
545
|
+
"required": false
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"name": "presence",
|
|
549
|
+
"type": "\"online\" | \"away\" | \"busy\" | \"offline\"",
|
|
550
|
+
"default": null,
|
|
551
|
+
"description": "Their presence (a dot on the avatar).",
|
|
552
|
+
"required": false
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"name": "presenceLabel",
|
|
556
|
+
"type": "string",
|
|
557
|
+
"default": null,
|
|
558
|
+
"description": "The presence in words (“online”).",
|
|
559
|
+
"required": false
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"name": "style",
|
|
563
|
+
"type": "StyleProp<ViewStyle>",
|
|
564
|
+
"default": null,
|
|
565
|
+
"description": "Styles merged last.",
|
|
566
|
+
"required": false
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"name": "time",
|
|
570
|
+
"type": "string",
|
|
571
|
+
"default": null,
|
|
572
|
+
"description": "When (“14:02”, “Mon”).",
|
|
573
|
+
"required": false
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"name": "typing",
|
|
577
|
+
"type": "boolean",
|
|
578
|
+
"default": null,
|
|
579
|
+
"description": "The preview is the typing signal: in the accent.",
|
|
580
|
+
"required": false
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"name": "unread",
|
|
584
|
+
"type": "number",
|
|
585
|
+
"default": "0",
|
|
586
|
+
"description": "Unread messages: a count in the accent, the name in bold.",
|
|
587
|
+
"required": false
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"name": "unreadLabel",
|
|
591
|
+
"type": "string",
|
|
592
|
+
"default": null,
|
|
593
|
+
"description": "The unread count in words (“3 unread”).",
|
|
594
|
+
"required": false
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
}
|
|
598
|
+
],
|
|
599
|
+
"examples": [
|
|
600
|
+
{
|
|
601
|
+
"name": "conversation",
|
|
602
|
+
"title": "Conversation",
|
|
603
|
+
"description": "Grouped runs, a read receipt, typing, the composer.",
|
|
604
|
+
"path": "examples/chat/native/conversation.tsx",
|
|
605
|
+
"module": "@krizaka/ui/registry/examples/chat/native/conversation",
|
|
606
|
+
"code": "import { MessageBubble, MessageComposer, TypingIndicator } from \"@krizaka/ui/native\";\nimport { useState } from \"react\";\nimport { View } from \"react-native\";\n\n// A conversation: runs grouped, the time inside, the receipt under the last of yours, the typing dots, the composer.\nexport default function NativeChatConversation() {\n const [draft, setDraft] = useState(\"\");\n return (\n <View style={{ width: 360, gap: 4 }}>\n <View style={{ padding: 12, gap: 4 }}>\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 labels={{ status: { read: \"Read\" } }} />\n <TypingIndicator label=\"Elena is typing\" />\n </View>\n <MessageComposer value={draft} onValueChange={setDraft} onSend={() => setDraft(\"\")} placeholder=\"Message\" sendLabel=\"Send\" />\n </View>\n );\n}\n",
|
|
607
|
+
"screenshots": {
|
|
608
|
+
"dark": "examples/chat/native/conversation.dark.png",
|
|
609
|
+
"light": "examples/chat/native/conversation.light.png"
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"name": "inbox",
|
|
614
|
+
"title": "Inbox",
|
|
615
|
+
"description": "Presence, typing, unread counts.",
|
|
616
|
+
"path": "examples/chat/native/inbox.tsx",
|
|
617
|
+
"module": "@krizaka/ui/registry/examples/chat/native/inbox",
|
|
618
|
+
"code": "import { ConversationItem } from \"@krizaka/ui/native\";\nimport { View } from \"react-native\";\n\n// The inbox: presence, the last message or “typing…”, the time, the unread count.\nexport default function NativeChatInbox() {\n return (\n <View style={{ width: 360 }}>\n <ConversationItem name=\"Elena\" presence=\"online\" presenceLabel=\"online\" preview=\"typing…\" typing time=\"19:06\" unread={2} unreadLabel=\"2 unread\" />\n <ConversationItem name=\"Noah\" presence=\"away\" presenceLabel=\"away\" preview=\"See you Saturday then!\" time=\"Mon\" />\n <ConversationItem name=\"Mina\" preview=\"You: haha same\" time=\"Sun\" />\n </View>\n );\n}\n",
|
|
619
|
+
"screenshots": {
|
|
620
|
+
"dark": "examples/chat/native/inbox.dark.png",
|
|
621
|
+
"light": "examples/chat/native/inbox.light.png"
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
]
|
|
625
|
+
},
|
|
626
|
+
"files": [
|
|
627
|
+
{
|
|
628
|
+
"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"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
"path": "chat/index.ts",
|
|
633
|
+
"content": "/** @krizaka/ui/chat — `MessageBubble`, `TypingIndicator`, `MessageComposer`, `ConversationItem`: a conversation's parts. */\nexport { chat, ConversationItem, type ConversationItemProps, MessageBubble, type MessageBubbleLabels, type MessageBubbleProps, MessageComposer, type MessageComposerProps, type MessageStatus, TypingIndicator, type TypingIndicatorProps } from \"./chat\";\n"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"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"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"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 krizaka.com renders as\n// /docs/ui/<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 | \"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 | \"longform-page\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\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 | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"settings-layout\"\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 | \"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 krizaka.com/docs/ui/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"
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
"dependencies": [
|
|
645
|
+
"tailwind-variants@^3.3.1"
|
|
646
|
+
],
|
|
647
|
+
"registryDependencies": [
|
|
648
|
+
"avatar"
|
|
649
|
+
],
|
|
650
|
+
"demo": {
|
|
651
|
+
"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"
|
|
653
|
+
},
|
|
654
|
+
"props": [
|
|
655
|
+
{
|
|
656
|
+
"component": "ConversationItem",
|
|
657
|
+
"description": "A conversation in the list: avatar, name, the last message or typing, the time, the unread count.",
|
|
658
|
+
"props": [
|
|
659
|
+
{
|
|
660
|
+
"name": "name",
|
|
661
|
+
"type": "string",
|
|
662
|
+
"default": null,
|
|
663
|
+
"description": "The other person's name.",
|
|
664
|
+
"required": true
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
"name": "preview",
|
|
668
|
+
"type": "string",
|
|
669
|
+
"default": null,
|
|
670
|
+
"description": "The last message, or “typing…”.",
|
|
671
|
+
"required": true
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"name": "avatar",
|
|
675
|
+
"type": "string | null",
|
|
676
|
+
"default": null,
|
|
677
|
+
"description": "Their avatar's URL.",
|
|
678
|
+
"required": false
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"name": "className",
|
|
682
|
+
"type": "string",
|
|
683
|
+
"default": null,
|
|
684
|
+
"description": "Classes merged on the row.",
|
|
685
|
+
"required": false
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"name": "href",
|
|
689
|
+
"type": "string",
|
|
690
|
+
"default": null,
|
|
691
|
+
"description": "Opens the conversation (a link).",
|
|
692
|
+
"required": false
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"name": "online",
|
|
696
|
+
"type": "boolean",
|
|
697
|
+
"default": null,
|
|
698
|
+
"description": "Before the name: a presence dot (online).",
|
|
699
|
+
"required": false
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
"name": "onlineLabel",
|
|
703
|
+
"type": "string",
|
|
704
|
+
"default": null,
|
|
705
|
+
"description": "The presence in words (“online”).",
|
|
706
|
+
"required": false
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"name": "onSelect",
|
|
710
|
+
"type": "(() => void)",
|
|
711
|
+
"default": null,
|
|
712
|
+
"description": "Opens the conversation (a button).",
|
|
713
|
+
"required": false
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"name": "time",
|
|
717
|
+
"type": "string",
|
|
718
|
+
"default": null,
|
|
719
|
+
"description": "When (“14:02”, “Mon”).",
|
|
720
|
+
"required": false
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
"name": "typing",
|
|
724
|
+
"type": "boolean",
|
|
725
|
+
"default": null,
|
|
726
|
+
"description": "The preview is the typing signal: in the accent.",
|
|
727
|
+
"required": false
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"name": "unread",
|
|
731
|
+
"type": "number",
|
|
732
|
+
"default": "0",
|
|
733
|
+
"description": "Unread messages: a count, the name in bold.",
|
|
734
|
+
"required": false
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"name": "unreadLabel",
|
|
738
|
+
"type": "string",
|
|
739
|
+
"default": null,
|
|
740
|
+
"description": "The unread count in words (“3 unread”).",
|
|
741
|
+
"required": false
|
|
742
|
+
}
|
|
743
|
+
]
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"component": "MessageBubble",
|
|
747
|
+
"description": "A message: yours in the accent on the right, theirs on the left, the time inside, the receipt under the last of yours.",
|
|
748
|
+
"props": [
|
|
749
|
+
{
|
|
750
|
+
"name": "text",
|
|
751
|
+
"type": "string",
|
|
752
|
+
"default": null,
|
|
753
|
+
"description": "The text.",
|
|
754
|
+
"required": true
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"name": "className",
|
|
758
|
+
"type": "string",
|
|
759
|
+
"default": null,
|
|
760
|
+
"description": "Classes merged on the row.",
|
|
761
|
+
"required": false
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"name": "context",
|
|
765
|
+
"type": "string",
|
|
766
|
+
"default": null,
|
|
767
|
+
"description": "A line above the text: what it answers.",
|
|
768
|
+
"required": false
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
"name": "grouped",
|
|
772
|
+
"type": "\"middle\" | \"first\" | \"last\" | \"single\"",
|
|
773
|
+
"default": "single",
|
|
774
|
+
"description": "Part of a run of the same sender: the corner towards the next one is tighter.",
|
|
775
|
+
"required": false
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
"name": "labels",
|
|
779
|
+
"type": "MessageBubbleLabels",
|
|
780
|
+
"default": null,
|
|
781
|
+
"description": "The words, passed translated.",
|
|
782
|
+
"required": false
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"name": "mine",
|
|
786
|
+
"type": "boolean",
|
|
787
|
+
"default": null,
|
|
788
|
+
"description": "Yours (right, in the accent) or theirs (left).",
|
|
789
|
+
"required": false
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
"name": "onRetry",
|
|
793
|
+
"type": "(() => void)",
|
|
794
|
+
"default": null,
|
|
795
|
+
"description": "Sends a failed message again (a button under it).",
|
|
796
|
+
"required": false
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"name": "showStatus",
|
|
800
|
+
"type": "boolean",
|
|
801
|
+
"default": null,
|
|
802
|
+
"description": "Show the status under the bubble (the last message of yours).",
|
|
803
|
+
"required": false
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"name": "status",
|
|
807
|
+
"type": "MessageStatus",
|
|
808
|
+
"default": null,
|
|
809
|
+
"description": "Where a message of yours stands; shown when `showStatus`.",
|
|
810
|
+
"required": false
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"name": "time",
|
|
814
|
+
"type": "string",
|
|
815
|
+
"default": null,
|
|
816
|
+
"description": "The time, written by the app (“14:02”).",
|
|
817
|
+
"required": false
|
|
818
|
+
}
|
|
819
|
+
]
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
"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.",
|
|
824
|
+
"props": [
|
|
825
|
+
{
|
|
826
|
+
"name": "onSend",
|
|
827
|
+
"type": "() => void",
|
|
828
|
+
"default": null,
|
|
829
|
+
"description": "Sends the draft (Enter, or the button); Shift+Enter adds a line.",
|
|
830
|
+
"required": true
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"name": "onValueChange",
|
|
834
|
+
"type": "(text: string) => void",
|
|
835
|
+
"default": null,
|
|
836
|
+
"description": "Called on every key.",
|
|
837
|
+
"required": true
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"name": "placeholder",
|
|
841
|
+
"type": "string",
|
|
842
|
+
"default": null,
|
|
843
|
+
"description": "The input's name and placeholder (“Message”).",
|
|
844
|
+
"required": true
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"name": "sendLabel",
|
|
848
|
+
"type": "string",
|
|
849
|
+
"default": null,
|
|
850
|
+
"description": "The send button's name (“Send”).",
|
|
851
|
+
"required": true
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
"name": "value",
|
|
855
|
+
"type": "string",
|
|
856
|
+
"default": null,
|
|
857
|
+
"description": "The draft (controlled).",
|
|
858
|
+
"required": true
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
"name": "className",
|
|
862
|
+
"type": "string",
|
|
863
|
+
"default": null,
|
|
864
|
+
"description": "Classes merged on the root.",
|
|
865
|
+
"required": false
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"name": "disabledReason",
|
|
869
|
+
"type": "string",
|
|
870
|
+
"default": null,
|
|
871
|
+
"description": "Cannot write: the reason in its place.",
|
|
872
|
+
"required": false
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"name": "leading",
|
|
876
|
+
"type": "ReactNode",
|
|
877
|
+
"default": null,
|
|
878
|
+
"description": "Before the input: an attach button.",
|
|
879
|
+
"required": false
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"name": "maxLength",
|
|
883
|
+
"type": "number",
|
|
884
|
+
"default": "4000",
|
|
885
|
+
"description": "The longest message. Default 4000.",
|
|
886
|
+
"required": false
|
|
887
|
+
}
|
|
888
|
+
]
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
"component": "TypingIndicator",
|
|
892
|
+
"description": "Three dots that breathe while the other person types, announced politely; still under reduced motion.",
|
|
893
|
+
"props": [
|
|
894
|
+
{
|
|
895
|
+
"name": "label",
|
|
896
|
+
"type": "string",
|
|
897
|
+
"default": null,
|
|
898
|
+
"description": "What is read and shown beside the dots (“Elena is typing”) — passed translated.",
|
|
899
|
+
"required": true
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
"name": "className",
|
|
903
|
+
"type": "string",
|
|
904
|
+
"default": null,
|
|
905
|
+
"description": "Classes merged on the root.",
|
|
906
|
+
"required": false
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"name": "showLabel",
|
|
910
|
+
"type": "boolean",
|
|
911
|
+
"default": null,
|
|
912
|
+
"description": "Show the words beside the dots.",
|
|
913
|
+
"required": false
|
|
914
|
+
}
|
|
915
|
+
]
|
|
916
|
+
}
|
|
917
|
+
]
|
|
918
|
+
}
|