@orbitcommerce/constellation-docs 1.0.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BvxQWBTy.js +403 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CXZ3V1d4.js +1612 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-hg7txTc3.js +1381 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/{installation-DpsX8G_n.js → installation-DRUWNVHP.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/{logo-BfGF1Pq9.js → logo-D3a3QGKJ.js} +13 -13
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-BSfEqHY8.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-BCPvtP8J.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-CbiibLwn.js} +581 -18
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-CNR7zpf7.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-DYBCY7jm.js} +4 -1
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-mq_pNXza.js +3232 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Cf4MZ8Fq.js} +257 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +10989 -1108
- package/package.json +3 -3
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section$1, i as DocPage, m as ThemePair, o as Example, p as SubSection, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { n as DESK_PHOTO, r as LAMP_PHOTO, t as CHAIR_PHOTO } from "./_conversation-samples-Bq7cn-4d.js";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Button, MessageBubble, MessageDayLine, MessageThread, ReplyFeedback, TypingIndicator } from "@orbitcommerce/constellation";
|
|
8
|
+
import { PackageIcon, SparkleIcon } from "@orbitcommerce/constellation/icons";
|
|
9
|
+
//#region src/pages/components/message-thread.tsx
|
|
10
|
+
/** The assistant's face, drawn here as a small sparkle: the real one (Nebula's orb) is the page's. */
|
|
11
|
+
function Face() {
|
|
12
|
+
return /* @__PURE__ */ jsx("span", {
|
|
13
|
+
className: "thread-face",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: /* @__PURE__ */ jsx(SparkleIcon, { weight: "fill" })
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
var CHAIR = {
|
|
19
|
+
id: "chair",
|
|
20
|
+
url: CHAIR_PHOTO,
|
|
21
|
+
name: "arden-chair-scratch.jpg",
|
|
22
|
+
mimeType: "image/svg+xml",
|
|
23
|
+
kind: "image"
|
|
24
|
+
};
|
|
25
|
+
var TERMS = {
|
|
26
|
+
id: "terms",
|
|
27
|
+
url: "#attachments",
|
|
28
|
+
name: "returns-label.pdf",
|
|
29
|
+
mimeType: "application/pdf",
|
|
30
|
+
size: 84200
|
|
31
|
+
};
|
|
32
|
+
var OPENING = [
|
|
33
|
+
{
|
|
34
|
+
id: "l1",
|
|
35
|
+
kind: "system",
|
|
36
|
+
text: "Priya Shah started a chat from the Arden chair page",
|
|
37
|
+
time: "10:38"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "l2",
|
|
41
|
+
kind: "incoming",
|
|
42
|
+
name: "Priya Shah",
|
|
43
|
+
text: "Hello, my Arden chair arrived with a scratch on the base.",
|
|
44
|
+
time: "10:39",
|
|
45
|
+
attachments: [CHAIR]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "l3",
|
|
49
|
+
kind: "bot",
|
|
50
|
+
text: "I am sorry to hear that. I have let the team know, and someone will be with you in a moment.",
|
|
51
|
+
time: "10:39"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "l4",
|
|
55
|
+
kind: "note",
|
|
56
|
+
name: "Sean Hughes",
|
|
57
|
+
text: "Second scratch this week from the same batch. Flag to the supplier.",
|
|
58
|
+
time: "10:41"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "l5",
|
|
62
|
+
kind: "outgoing",
|
|
63
|
+
name: "Sean Hughes",
|
|
64
|
+
text: "Hi Priya, sorry about that. I have sent you a returns label, and a replacement goes out today.\nIt should reach you by Thursday.",
|
|
65
|
+
time: "10:42",
|
|
66
|
+
attachments: [TERMS],
|
|
67
|
+
delivery: true
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
var REPLIES = [
|
|
71
|
+
"Thank you, that is great.",
|
|
72
|
+
"Do I need to keep the box?",
|
|
73
|
+
"Perfect, thanks Sean!"
|
|
74
|
+
];
|
|
75
|
+
/** A live chat: a visitor writes, an agent replies, notes and the assistant join in. */
|
|
76
|
+
function LiveChatDemo() {
|
|
77
|
+
const [lines, setLines] = useState(OPENING);
|
|
78
|
+
const [typing, setTyping] = useState(false);
|
|
79
|
+
const next = useRef(0);
|
|
80
|
+
const timer = useRef(void 0);
|
|
81
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
82
|
+
const receive = () => {
|
|
83
|
+
setTyping(true);
|
|
84
|
+
clearTimeout(timer.current);
|
|
85
|
+
timer.current = setTimeout(() => {
|
|
86
|
+
setTyping(false);
|
|
87
|
+
const text = REPLIES[next.current % REPLIES.length];
|
|
88
|
+
next.current += 1;
|
|
89
|
+
setLines((all) => [...all, {
|
|
90
|
+
id: `r${all.length}`,
|
|
91
|
+
kind: "incoming",
|
|
92
|
+
name: "Priya Shah",
|
|
93
|
+
text,
|
|
94
|
+
time: "10:44"
|
|
95
|
+
}]);
|
|
96
|
+
}, 1400);
|
|
97
|
+
};
|
|
98
|
+
const reply = () => setLines((all) => [...all, {
|
|
99
|
+
id: `s${all.length}`,
|
|
100
|
+
kind: "outgoing",
|
|
101
|
+
name: "Sean Hughes",
|
|
102
|
+
text: "You are welcome. Anything else I can help with?",
|
|
103
|
+
time: "10:45"
|
|
104
|
+
}]);
|
|
105
|
+
const [loading, setLoading] = useState(false);
|
|
106
|
+
const [earlier, setEarlier] = useState(false);
|
|
107
|
+
const loadEarlier = () => {
|
|
108
|
+
setLoading(true);
|
|
109
|
+
clearTimeout(timer.current);
|
|
110
|
+
timer.current = setTimeout(() => {
|
|
111
|
+
setLines((all) => [
|
|
112
|
+
{
|
|
113
|
+
id: "e1",
|
|
114
|
+
kind: "incoming",
|
|
115
|
+
name: "Priya Shah",
|
|
116
|
+
text: "Hi, is the Arden chair back in stock yet?",
|
|
117
|
+
time: "Mon 09:12"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "e2",
|
|
121
|
+
kind: "outgoing",
|
|
122
|
+
name: "Grace Liu",
|
|
123
|
+
text: "It is. Your order goes out today.",
|
|
124
|
+
time: "Mon 09:20"
|
|
125
|
+
},
|
|
126
|
+
...all
|
|
127
|
+
]);
|
|
128
|
+
setEarlier(true);
|
|
129
|
+
setLoading(false);
|
|
130
|
+
}, 600);
|
|
131
|
+
};
|
|
132
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
133
|
+
className: "thread-demo",
|
|
134
|
+
children: [/* @__PURE__ */ jsxs(MessageThread, {
|
|
135
|
+
className: "thread-box",
|
|
136
|
+
label: "Conversation with Priya Shah",
|
|
137
|
+
typing: typing ? /* @__PURE__ */ jsx(TypingIndicator, { label: "Priya is typing" }) : null,
|
|
138
|
+
children: [
|
|
139
|
+
earlier ? /* @__PURE__ */ jsx(MessageDayLine, { children: "Monday" }) : null,
|
|
140
|
+
earlier ? lines.slice(0, 2).map((line) => /* @__PURE__ */ jsx(MessageBubble, {
|
|
141
|
+
kind: line.kind,
|
|
142
|
+
name: line.kind === "incoming" ? void 0 : line.name,
|
|
143
|
+
time: line.time,
|
|
144
|
+
children: line.text
|
|
145
|
+
}, line.id)) : null,
|
|
146
|
+
/* @__PURE__ */ jsx(MessageDayLine, { children: "Today" }),
|
|
147
|
+
(earlier ? lines.slice(2) : lines).map((line) => /* @__PURE__ */ jsx(MessageBubble, {
|
|
148
|
+
kind: line.kind,
|
|
149
|
+
name: line.kind === "incoming" ? void 0 : line.name,
|
|
150
|
+
avatar: line.kind === "bot" ? /* @__PURE__ */ jsx(Face, {}) : void 0,
|
|
151
|
+
time: line.time,
|
|
152
|
+
attachments: line.attachments,
|
|
153
|
+
delivery: line.delivery ? "Emailed" : void 0,
|
|
154
|
+
deliveryDetail: line.delivery ? "Also sent to priya@harbourdesk.co.uk, as she has left the chat" : void 0,
|
|
155
|
+
children: line.text
|
|
156
|
+
}, line.id))
|
|
157
|
+
]
|
|
158
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
159
|
+
className: "thread-actions",
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx(Button, {
|
|
162
|
+
size: "sm",
|
|
163
|
+
onClick: receive,
|
|
164
|
+
children: "Priya writes"
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ jsx(Button, {
|
|
167
|
+
size: "sm",
|
|
168
|
+
variant: "secondary",
|
|
169
|
+
onClick: reply,
|
|
170
|
+
children: "Sean replies"
|
|
171
|
+
}),
|
|
172
|
+
!earlier ? /* @__PURE__ */ jsx(Button, {
|
|
173
|
+
size: "sm",
|
|
174
|
+
variant: "ghost",
|
|
175
|
+
loading,
|
|
176
|
+
onClick: loadEarlier,
|
|
177
|
+
children: "Load earlier messages"
|
|
178
|
+
}) : null
|
|
179
|
+
]
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
var ANSWER = "Three orders are waiting on stock:\n\n- **#10482** and **#10491**, the Arden chair\n- **#10503**, the Harbour desk\n\nThe next delivery is due on **Thursday**. [See the delivery](/orders)";
|
|
184
|
+
/** The demo's links stay on this page: a real thread hands a path in the app to its router (`renderLink`). */
|
|
185
|
+
var renderDemoLink = ({ children }) => /* @__PURE__ */ jsx(DocLink, {
|
|
186
|
+
to: "/components/message-thread#markdown",
|
|
187
|
+
children
|
|
188
|
+
});
|
|
189
|
+
/** The assistant: a prompt with pictures, a reply that streams in Markdown, its cards, feedback and chips. */
|
|
190
|
+
function AssistantDemo() {
|
|
191
|
+
const [streamed, setStreamed] = useState(182);
|
|
192
|
+
const [stopped, setStopped] = useState(false);
|
|
193
|
+
const timer = useRef(void 0);
|
|
194
|
+
const streaming = streamed < 182 && !stopped;
|
|
195
|
+
const stop = () => {
|
|
196
|
+
clearInterval(timer.current);
|
|
197
|
+
setStopped(true);
|
|
198
|
+
};
|
|
199
|
+
const ask = () => {
|
|
200
|
+
clearInterval(timer.current);
|
|
201
|
+
setStopped(false);
|
|
202
|
+
setStreamed(0);
|
|
203
|
+
let at = 0;
|
|
204
|
+
timer.current = setInterval(() => {
|
|
205
|
+
at += 4;
|
|
206
|
+
setStreamed(Math.min(at, 182));
|
|
207
|
+
if (at >= 182) clearInterval(timer.current);
|
|
208
|
+
}, 40);
|
|
209
|
+
};
|
|
210
|
+
useEffect(() => () => clearInterval(timer.current), []);
|
|
211
|
+
const text = ANSWER.slice(0, streamed);
|
|
212
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
213
|
+
className: "thread-demo",
|
|
214
|
+
children: [/* @__PURE__ */ jsxs(MessageThread, {
|
|
215
|
+
className: "thread-box",
|
|
216
|
+
label: "Nebula",
|
|
217
|
+
renderLink: renderDemoLink,
|
|
218
|
+
children: [/* @__PURE__ */ jsx(MessageBubble, {
|
|
219
|
+
kind: "outgoing",
|
|
220
|
+
attachmentSize: "sm",
|
|
221
|
+
attachments: [
|
|
222
|
+
{
|
|
223
|
+
id: "a",
|
|
224
|
+
url: LAMP_PHOTO,
|
|
225
|
+
name: "lamp.png",
|
|
226
|
+
kind: "image"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: "b",
|
|
230
|
+
url: DESK_PHOTO,
|
|
231
|
+
name: "desk.png",
|
|
232
|
+
kind: "image"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "c",
|
|
236
|
+
url: "#assistant",
|
|
237
|
+
name: "stock-count-october.pdf",
|
|
238
|
+
mimeType: "application/pdf"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
children: "Which orders are waiting on stock?"
|
|
242
|
+
}), /* @__PURE__ */ jsx(MessageBubble, {
|
|
243
|
+
kind: "assistant",
|
|
244
|
+
markdown: stopped && text.length < 182 ? `${text}…` : text,
|
|
245
|
+
streaming,
|
|
246
|
+
onStop: streaming ? stop : void 0,
|
|
247
|
+
actions: !streaming && streamed > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
248
|
+
className: "thread-card",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsx(PackageIcon, {
|
|
251
|
+
className: "thread-card__icon",
|
|
252
|
+
"aria-hidden": "true"
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ jsxs("span", {
|
|
255
|
+
className: "thread-card__text",
|
|
256
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
257
|
+
className: "thread-card__title",
|
|
258
|
+
children: "3 orders waiting"
|
|
259
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
260
|
+
className: "thread-card__line",
|
|
261
|
+
children: "Arden chair 2, Harbour desk 1"
|
|
262
|
+
})]
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsx(Button, {
|
|
265
|
+
size: "xs",
|
|
266
|
+
variant: "secondary",
|
|
267
|
+
children: "Open"
|
|
268
|
+
})
|
|
269
|
+
]
|
|
270
|
+
}) : null,
|
|
271
|
+
feedback: /* @__PURE__ */ jsx(ReplyFeedback, { onRate: () => {} }),
|
|
272
|
+
options: !streaming && streamed > 0 ? ["Email the customers", "Show the delivery"] : void 0,
|
|
273
|
+
onSelectOption: () => {}
|
|
274
|
+
})]
|
|
275
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
276
|
+
className: "thread-actions",
|
|
277
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
278
|
+
size: "sm",
|
|
279
|
+
onClick: ask,
|
|
280
|
+
children: "Ask again"
|
|
281
|
+
})
|
|
282
|
+
})]
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function Specimen({ children }) {
|
|
286
|
+
return /* @__PURE__ */ jsx("div", {
|
|
287
|
+
className: "thread-specimen",
|
|
288
|
+
children
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function Preview() {
|
|
292
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
293
|
+
className: "thread-preview",
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ jsx(MessageBubble, {
|
|
296
|
+
kind: "incoming",
|
|
297
|
+
children: "Is the Arden chair in stock?"
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ jsx(MessageBubble, {
|
|
300
|
+
kind: "outgoing",
|
|
301
|
+
children: "It is. Shall I reserve one?"
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ jsx(TypingIndicator, {})
|
|
304
|
+
]
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function Page() {
|
|
308
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
309
|
+
title: "Message thread",
|
|
310
|
+
status: "new",
|
|
311
|
+
importNames: [
|
|
312
|
+
"MessageThread",
|
|
313
|
+
"MessageBubble",
|
|
314
|
+
"MessageDayLine"
|
|
315
|
+
],
|
|
316
|
+
lead: "A conversation: the scrolling thread and the bubbles in it, drawn by who sent each message, for a live chat with customers and for an assistant's replies.",
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
319
|
+
id: "live-chat",
|
|
320
|
+
title: "A live chat",
|
|
321
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
322
|
+
/* @__PURE__ */ jsx("code", { children: "MessageThread" }),
|
|
323
|
+
" is the scrolling column. It opens at the newest message and stays there while it is there: a new message, a reply growing as it streams, a picture loading or the typing indicator keep it at the bottom. Scroll back to read and a message that arrives leaves you where you are, with a \"New messages\" pill to jump down; a message of your own always brings you down. A message from the other side is said politely as it arrives. Only a message that arrives as the last one counts: older pages put in at the top (\"Load earlier messages\") are history, neither announced nor jumped to, and the history a thread opens with loads under ",
|
|
324
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
325
|
+
", which takes the thread to the newest as it clears. Give the thread the conversation as its ",
|
|
326
|
+
/* @__PURE__ */ jsx("code", { children: "key" }),
|
|
327
|
+
", so switching conversation opens the next one afresh at its newest. Press \"Priya writes\", then try it scrolled back."
|
|
328
|
+
] }),
|
|
329
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
330
|
+
align: "fill",
|
|
331
|
+
code: `<MessageThread
|
|
332
|
+
key={conversation.id}
|
|
333
|
+
label="Conversation with Priya Shah"
|
|
334
|
+
loading={messages.isLoading}
|
|
335
|
+
typing={visitorTyping && <TypingIndicator label="Priya is typing" />}
|
|
336
|
+
>
|
|
337
|
+
<MessageDayLine>Today</MessageDayLine>
|
|
338
|
+
{messages.map((m) => (
|
|
339
|
+
<MessageBubble key={m.id} kind={m.kind} name={m.senderName} time={formatTime(m.createdAt)} attachments={m.attachments}>
|
|
340
|
+
{m.body}
|
|
341
|
+
</MessageBubble>
|
|
342
|
+
))}
|
|
343
|
+
</MessageThread>`,
|
|
344
|
+
children: /* @__PURE__ */ jsx(LiveChatDemo, {})
|
|
345
|
+
})
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
348
|
+
id: "assistant",
|
|
349
|
+
title: "An assistant",
|
|
350
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
351
|
+
"The assistant's reply is ",
|
|
352
|
+
/* @__PURE__ */ jsx("code", { children: "kind=\"assistant\"" }),
|
|
353
|
+
": unboxed, the full width, with its action cards (",
|
|
354
|
+
/* @__PURE__ */ jsx("code", { children: "actions" }),
|
|
355
|
+
"), its ",
|
|
356
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
357
|
+
to: "/components/reply-feedback",
|
|
358
|
+
children: "feedback"
|
|
359
|
+
}),
|
|
360
|
+
", a link pill and option chips that send. While it ",
|
|
361
|
+
/* @__PURE__ */ jsx("code", { children: "streaming" }),
|
|
362
|
+
" it grows with a soft caret at its end (three dots until the first words), its feedback hidden, and ",
|
|
363
|
+
/* @__PURE__ */ jsx("code", { children: "onStop" }),
|
|
364
|
+
" adds a stop pill; it is said once it has finished. The prompt carries its pictures as small thumbs inside the bubble (",
|
|
365
|
+
/* @__PURE__ */ jsx("code", { children: "attachmentSize=\"sm\"" }),
|
|
366
|
+
")."
|
|
367
|
+
] }),
|
|
368
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
369
|
+
align: "fill",
|
|
370
|
+
code: `<MessageBubble kind="outgoing" attachmentSize="sm" attachments={files}>Which orders are waiting on stock?</MessageBubble>
|
|
371
|
+
<MessageBubble
|
|
372
|
+
kind="assistant"
|
|
373
|
+
streaming={streaming}
|
|
374
|
+
onStop={streaming ? stop : undefined}
|
|
375
|
+
actions={<ActionCard … />}
|
|
376
|
+
feedback={<ReplyFeedback onRate={rate} />}
|
|
377
|
+
options={['Email the customers', 'Show the delivery']}
|
|
378
|
+
onSelectOption={send}
|
|
379
|
+
>
|
|
380
|
+
{reply}
|
|
381
|
+
</MessageBubble>`,
|
|
382
|
+
children: /* @__PURE__ */ jsx(AssistantDemo, {})
|
|
383
|
+
})
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
386
|
+
id: "markdown",
|
|
387
|
+
title: "Markdown",
|
|
388
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
389
|
+
"Give a reply as ",
|
|
390
|
+
/* @__PURE__ */ jsx("code", { children: "markdown" }),
|
|
391
|
+
" and it is drawn as the small prose of a chat bubble by the kit's",
|
|
392
|
+
" ",
|
|
393
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
394
|
+
to: "/components/markdown",
|
|
395
|
+
children: "Markdown"
|
|
396
|
+
}),
|
|
397
|
+
": headings from h3, lists, bold, code, tables and links. Nothing in it is ever drawn as markup, and a link that is not a web address, a path in the app, an anchor or an email stays as its words. Images are drawn only from the app's own origin unless",
|
|
398
|
+
" ",
|
|
399
|
+
/* @__PURE__ */ jsx("code", { children: "imageSrc" }),
|
|
400
|
+
" allows more: an assistant's thread should pass an allow-list of the hosts its images come from, since an image in a model's reply is fetched as it is drawn. Give ",
|
|
401
|
+
/* @__PURE__ */ jsx("code", { children: "imageSrc" }),
|
|
402
|
+
" and",
|
|
403
|
+
" ",
|
|
404
|
+
/* @__PURE__ */ jsx("code", { children: "renderLink" }),
|
|
405
|
+
" (a router's link) to the thread for every message, or to one message. While it streams, three dots sit under the words."
|
|
406
|
+
] }),
|
|
407
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
408
|
+
align: "fill",
|
|
409
|
+
code: `<MessageThread label="Nebula" imageSrc={(src) => (src.startsWith('https://cdn.orbit.example/') ? src : null)} renderLink={RouterLink}>
|
|
410
|
+
<MessageBubble kind="assistant" markdown={reply.content} streaming={reply.streaming} />
|
|
411
|
+
</MessageThread>`,
|
|
412
|
+
children: /* @__PURE__ */ jsxs(Specimen, { children: [/* @__PURE__ */ jsx(MessageBubble, {
|
|
413
|
+
kind: "assistant",
|
|
414
|
+
markdown: "# Weekly report\n\nSales were up **12%** on last week.\n\n| Product | Sold |\n| --- | ---: |\n| Arden chair | 48 |\n| Harbour desk | 21 |\n\nA link that is not safe stays as words: [open](javascript:alert(1)). An image from another host: "
|
|
415
|
+
}), /* @__PURE__ */ jsx(MessageBubble, {
|
|
416
|
+
kind: "outgoing",
|
|
417
|
+
variant: "solid",
|
|
418
|
+
markdown: "Thanks, can you **email** it to Priya?"
|
|
419
|
+
})] })
|
|
420
|
+
})
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
423
|
+
id: "senders",
|
|
424
|
+
title: "Senders",
|
|
425
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
426
|
+
"Each ",
|
|
427
|
+
/* @__PURE__ */ jsx("code", { children: "kind" }),
|
|
428
|
+
" has its side and its look."
|
|
429
|
+
] }),
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
432
|
+
columns: [
|
|
433
|
+
"kind",
|
|
434
|
+
"Side",
|
|
435
|
+
"Look"
|
|
436
|
+
],
|
|
437
|
+
rows: [
|
|
438
|
+
[
|
|
439
|
+
/* @__PURE__ */ jsx("code", { children: "incoming" }),
|
|
440
|
+
"Start",
|
|
441
|
+
"Outlined on the canvas; solid, the sunken grey"
|
|
442
|
+
],
|
|
443
|
+
[
|
|
444
|
+
/* @__PURE__ */ jsx("code", { children: "outgoing" }),
|
|
445
|
+
"End",
|
|
446
|
+
"The muted fill, the sender’s name over it; solid, the accent"
|
|
447
|
+
],
|
|
448
|
+
[
|
|
449
|
+
/* @__PURE__ */ jsx("code", { children: "bot" }),
|
|
450
|
+
"End",
|
|
451
|
+
"Outlined in the accent line, its face, its name and an AI tag"
|
|
452
|
+
],
|
|
453
|
+
[
|
|
454
|
+
/* @__PURE__ */ jsx("code", { children: "assistant" }),
|
|
455
|
+
"Start",
|
|
456
|
+
"Unboxed, the full width"
|
|
457
|
+
],
|
|
458
|
+
[
|
|
459
|
+
/* @__PURE__ */ jsx("code", { children: "note" }),
|
|
460
|
+
"End",
|
|
461
|
+
"The warning wash, headed \"Internal note · name\""
|
|
462
|
+
],
|
|
463
|
+
[
|
|
464
|
+
/* @__PURE__ */ jsx("code", { children: "system" }),
|
|
465
|
+
"Centre",
|
|
466
|
+
"A quiet line"
|
|
467
|
+
]
|
|
468
|
+
]
|
|
469
|
+
}),
|
|
470
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
471
|
+
title: "Solid",
|
|
472
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
473
|
+
align: "fill",
|
|
474
|
+
code: `<MessageBubble kind="incoming" variant="solid">…</MessageBubble>
|
|
475
|
+
<MessageBubble kind="outgoing" variant="solid">…</MessageBubble>`,
|
|
476
|
+
children: /* @__PURE__ */ jsxs(Specimen, { children: [/* @__PURE__ */ jsx(MessageBubble, {
|
|
477
|
+
kind: "incoming",
|
|
478
|
+
variant: "solid",
|
|
479
|
+
time: "09:12",
|
|
480
|
+
children: "Could I collect it from the showroom instead?"
|
|
481
|
+
}), /* @__PURE__ */ jsx(MessageBubble, {
|
|
482
|
+
kind: "outgoing",
|
|
483
|
+
variant: "solid",
|
|
484
|
+
name: "Grace Liu",
|
|
485
|
+
time: "09:14",
|
|
486
|
+
children: "Of course. It will be ready from midday."
|
|
487
|
+
})] })
|
|
488
|
+
})
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
491
|
+
title: "A reply that failed",
|
|
492
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
493
|
+
align: "fill",
|
|
494
|
+
code: `<MessageBubble kind="assistant" errorTitle="You have used this month's allowance" error={<>It resets on 1 November. <Link href="/settings/nebula">See usage</Link></>} />`,
|
|
495
|
+
children: /* @__PURE__ */ jsxs(Specimen, { children: [/* @__PURE__ */ jsx(MessageBubble, {
|
|
496
|
+
kind: "assistant",
|
|
497
|
+
errorTitle: "You have used this month's allowance",
|
|
498
|
+
error: "It resets on 1 November, or upgrade for more."
|
|
499
|
+
}), /* @__PURE__ */ jsx(MessageBubble, {
|
|
500
|
+
kind: "assistant",
|
|
501
|
+
streaming: true
|
|
502
|
+
})] })
|
|
503
|
+
})
|
|
504
|
+
})
|
|
505
|
+
]
|
|
506
|
+
}),
|
|
507
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
508
|
+
id: "attachments",
|
|
509
|
+
title: "Attachments",
|
|
510
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
511
|
+
"Images are thumbs that open full size (in a new tab, or in your viewer through ",
|
|
512
|
+
/* @__PURE__ */ jsx("code", { children: "onOpenAttachment" }),
|
|
513
|
+
"), videos play inline and other files are cards with their name and size. An address that is not a web address, a path in the app or an object URL is never linked or drawn; ",
|
|
514
|
+
/* @__PURE__ */ jsx("code", { children: "resolveUrl" }),
|
|
515
|
+
" on the thread rewrites an API's relative paths first."
|
|
516
|
+
] }),
|
|
517
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
518
|
+
align: "fill",
|
|
519
|
+
code: `<MessageBubble kind="incoming" attachments={[{ id, url, name, mimeType: 'image/jpeg' }, { id, url, name, mimeType: 'application/pdf', size }]} />`,
|
|
520
|
+
children: /* @__PURE__ */ jsx(Specimen, { children: /* @__PURE__ */ jsx(MessageBubble, {
|
|
521
|
+
kind: "incoming",
|
|
522
|
+
time: "11:02",
|
|
523
|
+
attachments: [{
|
|
524
|
+
...CHAIR,
|
|
525
|
+
id: "c2"
|
|
526
|
+
}, TERMS],
|
|
527
|
+
children: "Here is the scratch, and the label you sent."
|
|
528
|
+
}) })
|
|
529
|
+
})
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
532
|
+
id: "both-themes",
|
|
533
|
+
title: "In both themes",
|
|
534
|
+
children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsxs(Specimen, { children: [
|
|
535
|
+
/* @__PURE__ */ jsx(MessageDayLine, { children: "Today" }),
|
|
536
|
+
/* @__PURE__ */ jsx(MessageBubble, {
|
|
537
|
+
kind: "incoming",
|
|
538
|
+
time: "10:39",
|
|
539
|
+
children: "My chair arrived with a scratch."
|
|
540
|
+
}),
|
|
541
|
+
/* @__PURE__ */ jsx(MessageBubble, {
|
|
542
|
+
kind: "bot",
|
|
543
|
+
avatar: /* @__PURE__ */ jsx(Face, {}),
|
|
544
|
+
time: "10:39",
|
|
545
|
+
children: "Sorry to hear that. Someone will be with you shortly."
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ jsx(MessageBubble, {
|
|
548
|
+
kind: "note",
|
|
549
|
+
name: "Sean Hughes",
|
|
550
|
+
children: "Flag to the supplier."
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ jsx(MessageBubble, {
|
|
553
|
+
kind: "outgoing",
|
|
554
|
+
name: "Sean Hughes",
|
|
555
|
+
time: "10:42",
|
|
556
|
+
delivery: "Emailed",
|
|
557
|
+
deliveryDetail: "Sent to priya@harbourdesk.co.uk",
|
|
558
|
+
children: "A replacement goes out today."
|
|
559
|
+
}),
|
|
560
|
+
/* @__PURE__ */ jsx(TypingIndicator, {})
|
|
561
|
+
] }) })
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
564
|
+
id: "guidelines",
|
|
565
|
+
title: "Guidelines",
|
|
566
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
567
|
+
"Pass the body as text or as markdown, never raw HTML from a message. For an assistant, give the thread an imageSrc allow-list.",
|
|
568
|
+
"Name the thread for who the conversation is with, so a screen reader knows where it is.",
|
|
569
|
+
"Keep the typing indicator in the typing slot, so the thread holds it at the end and follows it.",
|
|
570
|
+
"Use internal notes for the team only, and the system line for what happened, not for messages."
|
|
571
|
+
] })
|
|
572
|
+
}),
|
|
573
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
574
|
+
id: "accessibility",
|
|
575
|
+
title: "Accessibility",
|
|
576
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
577
|
+
"The thread is a named region that takes focus, so it scrolls from the keyboard; its focus ring sits inside it.",
|
|
578
|
+
"A message from the other side, the bot or the assistant is said politely as it arrives (\"Priya Shah: Is it in stock?\"), a streamed reply once it has finished; the ones it opened with and our own are not.",
|
|
579
|
+
"A streaming reply is aria-busy. Its feedback waits until it has finished.",
|
|
580
|
+
"When a control that held focus goes with its message (an option chip once answered), focus moves to the thread, never to the page.",
|
|
581
|
+
"Pictures in a message are links named for the file; the delivery note is a button whose detail is its description and its tooltip."
|
|
582
|
+
] })
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
585
|
+
id: "props",
|
|
586
|
+
title: "Props",
|
|
587
|
+
children: [/* @__PURE__ */ jsx(PropsTable, {
|
|
588
|
+
title: "MessageThread",
|
|
589
|
+
rows: [
|
|
590
|
+
{
|
|
591
|
+
name: "label",
|
|
592
|
+
type: "string",
|
|
593
|
+
description: "Names the region. Or pass aria-labelledby."
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: "typing",
|
|
597
|
+
type: "ReactNode",
|
|
598
|
+
description: "The typing indicator, kept at the end."
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
name: "loading",
|
|
602
|
+
type: "boolean",
|
|
603
|
+
default: "false",
|
|
604
|
+
description: "History is loading: messages that mount meanwhile are not arrivals. As it clears the thread goes to the newest."
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
name: "resolveUrl",
|
|
608
|
+
type: "(url: string) => string",
|
|
609
|
+
description: "Rewrites attachment addresses before they are drawn."
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "imageSrc, renderLink",
|
|
613
|
+
type: "MarkdownProps",
|
|
614
|
+
description: "For every Markdown body in the thread: the images allowed (default the app’s own origin only) and how links are drawn."
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
name: "labels",
|
|
618
|
+
type: "Partial<MessageThreadLabels>",
|
|
619
|
+
description: "jump."
|
|
620
|
+
}
|
|
621
|
+
]
|
|
622
|
+
}), /* @__PURE__ */ jsx(PropsTable, {
|
|
623
|
+
title: "MessageBubble",
|
|
624
|
+
rows: [
|
|
625
|
+
{
|
|
626
|
+
name: "kind",
|
|
627
|
+
type: "'incoming' | 'outgoing' | 'bot' | 'assistant' | 'note' | 'system'",
|
|
628
|
+
required: true,
|
|
629
|
+
description: "Who sent it."
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "children",
|
|
633
|
+
type: "ReactNode",
|
|
634
|
+
description: "The body: text (line breaks kept) or safe rich content."
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: "markdown",
|
|
638
|
+
type: "string",
|
|
639
|
+
description: "The body as Markdown, the small prose of a bubble. It takes the place of children."
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
name: "imageSrc, renderLink",
|
|
643
|
+
type: "MarkdownProps",
|
|
644
|
+
description: "Which images the Markdown draws, and how its links are drawn. Default the thread’s."
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: "name, avatar, tag",
|
|
648
|
+
type: "ReactNode",
|
|
649
|
+
description: "The sender’s name, face, and the bot’s tag (default \"AI\")."
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "time, delivery, deliveryDetail",
|
|
653
|
+
type: "ReactNode",
|
|
654
|
+
description: "Under it: when, and how it was delivered with its detail in a tooltip."
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: "variant",
|
|
658
|
+
type: "'soft' | 'solid'",
|
|
659
|
+
default: "'soft'",
|
|
660
|
+
description: "Incoming outlined or grey; outgoing muted or the accent."
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: "attachments",
|
|
664
|
+
type: "MessageAttachment[]",
|
|
665
|
+
description: "{ id, url, name?, kind?, mimeType?, size?, thumbnail? }."
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: "attachmentSize",
|
|
669
|
+
type: "'lg' | 'sm'",
|
|
670
|
+
default: "'lg'",
|
|
671
|
+
description: "Under the bubble, or small inside it."
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: "onOpenAttachment",
|
|
675
|
+
type: "(attachment, event) => void",
|
|
676
|
+
description: "Opens an image in your viewer."
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: "streaming",
|
|
680
|
+
type: "boolean",
|
|
681
|
+
default: "false",
|
|
682
|
+
description: "Still arriving: it grows, busy, with a caret."
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
name: "error, errorTitle",
|
|
686
|
+
type: "ReactNode",
|
|
687
|
+
description: "An error card in place of the reply."
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
name: "onStop, stopLabel",
|
|
691
|
+
type: "() => void, string",
|
|
692
|
+
description: "A stop pill under the reply."
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
name: "link",
|
|
696
|
+
type: "{ label, href }",
|
|
697
|
+
description: "A link pill, drawn only for a safe address."
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
name: "options, onSelectOption",
|
|
701
|
+
type: "string[], (option) => void",
|
|
702
|
+
description: "Answers as chips that send."
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "actions",
|
|
706
|
+
type: "ReactNode",
|
|
707
|
+
description: "Action cards under an assistant’s reply."
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "feedback",
|
|
711
|
+
type: "ReactNode",
|
|
712
|
+
description: "ReplyFeedback, hidden while streaming or failed."
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
name: "announce",
|
|
716
|
+
type: "boolean",
|
|
717
|
+
description: "Say it politely as it arrives. Default for incoming, bot and assistant."
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "labels",
|
|
721
|
+
type: "Partial<MessageBubbleLabels>",
|
|
722
|
+
description: "aiTag, assistant, internalNote, image, file, stop, options, attachments."
|
|
723
|
+
}
|
|
724
|
+
]
|
|
725
|
+
})]
|
|
726
|
+
})
|
|
727
|
+
]
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
//#endregion
|
|
731
|
+
export { Page, Preview };
|