@slotted/react 0.1.0-beta.42 → 0.1.0-beta.44
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/action-sheet-q1UXXruJ.js +360 -0
- package/dist/action-sheet.js +1 -1
- package/dist/{app-shell-D54YkU7E.js → app-shell-BBPY0_KK.js} +217 -195
- package/dist/app-shell.js +1 -1
- package/dist/attachment-DJDXJrCx.js +300 -0
- package/dist/attachment.js +2 -2
- package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
- package/dist/avatar-group.js +1 -1
- package/dist/{button-BMRInd-t.js → button-DS_HpPy0.js} +1 -1
- package/dist/button.js +2 -2
- package/dist/{calendar-YQ784o4d.js → calendar-BO5teotM.js} +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{cascader-fq8fNWSr.js → cascader-BbhADVGt.js} +134 -131
- package/dist/cascader.js +1 -1
- package/dist/{chart-vedR0BDN.js → chart-C4uPgUW8.js} +2 -2
- package/dist/chart.js +1 -1
- package/dist/{checkbox-DsJhlB5c.js → checkbox-D8HZG0be.js} +3 -3
- package/dist/{checkbox-group-pvX9R_yS.js → checkbox-group-5zuE2Kd1.js} +2 -2
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{clock-DzkQa57Q.js → clock-DeJgwYbZ.js} +1 -1
- package/dist/clock.js +1 -1
- package/dist/{code-block-Cy548yk7.js → code-block-H0lmVVnY.js} +1 -1
- package/dist/code-block.js +1 -1
- package/dist/{color-picker-i-MJ5VVs.js → color-picker-fiLSUBjj.js} +23 -18
- package/dist/color-picker.js +1 -1
- package/dist/{column-manager-D028QbfO.js → column-manager-Cc72e1j-.js} +143 -143
- package/dist/column-manager.js +1 -1
- package/dist/{combobox-599heRN_.js → combobox-DMtXrMYE.js} +1 -1
- package/dist/combobox.js +1 -1
- package/dist/{command-palette-C90CzfQi.js → command-palette-DwjkexvN.js} +174 -162
- package/dist/command-palette.js +1 -1
- package/dist/{context-menu-WM_tT9hz.js → context-menu-CRRp-PhP.js} +12 -6
- package/dist/context-menu.js +1 -1
- package/dist/{currency-field-rS36pjCO.js → currency-field-Cxr8MT75.js} +1 -1
- package/dist/currency-field.js +1 -1
- package/dist/{dashboard-grid-Dh2Q3IQv.js → dashboard-grid-_3H4G0dP.js} +339 -333
- package/dist/dashboard-grid.js +1 -1
- package/dist/{data-grid-D106baPp.js → data-grid-BlElqHOU.js} +19 -19
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-BA0xrySM.js → data-list-5zvM-DUz.js} +19 -18
- package/dist/data-list.js +1 -1
- package/dist/{date-field-BZ5JcvXJ.js → date-field-CjlOWVRA.js} +1 -1
- package/dist/date-field.js +1 -1
- package/dist/{date-picker-BvEbsbJC.js → date-picker-BoIHK8_U.js} +4 -4
- package/dist/date-picker.js +2 -2
- package/dist/{date-range-picker-uIr-yReE.js → date-range-picker-DzuuvudX.js} +5 -5
- package/dist/date-range-picker.js +1 -1
- package/dist/{datetime-field-DDs3mV9Z.js → datetime-field-PSEOgzfN.js} +1 -1
- package/dist/datetime-field.js +1 -1
- package/dist/{datetime-picker-DDYXqrjm.js → datetime-picker-BUhSr8yp.js} +7 -7
- package/dist/datetime-picker.js +1 -1
- package/dist/{datetime-range-picker-CFTHW771.js → datetime-range-picker-DXllehEN.js} +7 -7
- package/dist/datetime-range-picker.js +1 -1
- package/dist/{description-list-D8iTzgC0.js → description-list-1USVlDj3.js} +5 -1
- package/dist/description-list.js +1 -1
- package/dist/detail-panel-Czs05E_D.js +344 -0
- package/dist/detail-panel.js +2 -2
- package/dist/docs/action-bar.examples.md +768 -0
- package/dist/docs/action-bar.json +74 -50
- package/dist/docs/action-bar.md +49 -311
- package/dist/docs/action-sheet.examples.md +1 -1
- package/dist/docs/action-sheet.json +3 -3
- package/dist/docs/action-sheet.md +2 -2
- package/dist/docs/app-shell.examples.md +1273 -64
- package/dist/docs/app-shell.json +93 -60
- package/dist/docs/app-shell.md +98 -58
- package/dist/docs/attachment.examples.md +689 -0
- package/dist/docs/attachment.json +69 -37
- package/dist/docs/attachment.md +44 -203
- package/dist/docs/avatar-group.examples.md +790 -0
- package/dist/docs/avatar-group.json +111 -23
- package/dist/docs/avatar-group.md +46 -86
- package/dist/docs/avatar.json +6 -6
- package/dist/docs/avatar.md +43 -10
- package/dist/docs/badge.json +1 -1
- package/dist/docs/badge.md +15 -3
- package/dist/docs/button-group.json +98 -2
- package/dist/docs/button-group.md +411 -8
- package/dist/docs/button.json +2 -0
- package/dist/docs/button.md +1 -1
- package/dist/docs/calendar.examples.md +512 -0
- package/dist/docs/calendar.json +72 -25
- package/dist/docs/calendar.md +19 -148
- package/dist/docs/carousel.examples.md +868 -0
- package/dist/docs/carousel.json +60 -50
- package/dist/docs/carousel.md +67 -301
- package/dist/docs/cascader.examples.md +1269 -0
- package/dist/docs/cascader.json +72 -16
- package/dist/docs/cascader.md +78 -154
- package/dist/docs/chart.examples.md +734 -24
- package/dist/docs/chart.json +93 -13
- package/dist/docs/chart.md +28 -7
- package/dist/docs/clock.json +75 -19
- package/dist/docs/clock.md +328 -23
- package/dist/docs/code-block.json +79 -55
- package/dist/docs/code-block.md +417 -74
- package/dist/docs/collapsible.json +10 -1
- package/dist/docs/collapsible.md +1 -1
- package/dist/docs/color-picker.json +74 -13
- package/dist/docs/color-picker.md +247 -23
- package/dist/docs/column-manager.examples.md +764 -0
- package/dist/docs/column-manager.json +68 -12
- package/dist/docs/column-manager.md +44 -203
- package/dist/docs/command-palette.examples.md +747 -0
- package/dist/docs/command-palette.json +48 -24
- package/dist/docs/command-palette.md +60 -339
- package/dist/docs/currency-field.examples.md +355 -73
- package/dist/docs/currency-field.json +96 -64
- package/dist/docs/currency-field.md +57 -50
- package/dist/docs/dashboard-grid.examples.md +629 -0
- package/dist/docs/dashboard-grid.json +64 -16
- package/dist/docs/dashboard-grid.md +34 -152
- package/dist/docs/data-list.examples.md +1556 -0
- package/dist/docs/data-list.json +58 -18
- package/dist/docs/data-list.md +139 -224
- package/dist/docs/date-field.examples.md +543 -0
- package/dist/docs/date-field.json +64 -24
- package/dist/docs/date-field.md +22 -168
- package/dist/docs/datetime-field.examples.md +699 -0
- package/dist/docs/datetime-field.json +79 -31
- package/dist/docs/datetime-field.md +24 -269
- package/dist/docs/datetime-range-picker.examples.md +682 -0
- package/dist/docs/datetime-range-picker.json +117 -61
- package/dist/docs/datetime-range-picker.md +59 -224
- package/dist/docs/description-list.examples.md +652 -0
- package/dist/docs/description-list.json +56 -25
- package/dist/docs/description-list.md +34 -188
- package/dist/docs/detail-panel.examples.md +1177 -0
- package/dist/docs/detail-panel.json +69 -53
- package/dist/docs/detail-panel.md +114 -324
- package/dist/docs/drawer.examples.md +1 -1
- package/dist/docs/drawer.json +4 -4
- package/dist/docs/entity-picker.examples.md +1160 -0
- package/dist/docs/entity-picker.json +66 -18
- package/dist/docs/entity-picker.md +72 -247
- package/dist/docs/event-calendar.examples.md +749 -49
- package/dist/docs/event-calendar.json +53 -22
- package/dist/docs/event-calendar.md +82 -11
- package/dist/docs/field-group.examples.md +554 -0
- package/dist/docs/field-group.json +98 -34
- package/dist/docs/field-group.md +55 -133
- package/dist/docs/filter-bar.examples.md +772 -0
- package/dist/docs/filter-bar.json +42 -25
- package/dist/docs/filter-bar.md +43 -247
- package/dist/docs/floating-panel.json +7 -3
- package/dist/docs/floating-panel.md +23 -5
- package/dist/docs/form.examples.md +579 -0
- package/dist/docs/form.json +87 -39
- package/dist/docs/form.md +53 -177
- package/dist/docs/fullscreen.examples.md +558 -0
- package/dist/docs/fullscreen.json +58 -18
- package/dist/docs/fullscreen.md +50 -169
- package/dist/docs/highlight.json +57 -25
- package/dist/docs/highlight.md +402 -50
- package/dist/docs/hover-card.json +8 -1
- package/dist/docs/hover-card.md +5 -1
- package/dist/docs/icon.json +85 -5
- package/dist/docs/icon.md +401 -10
- package/dist/docs/image.examples.md +670 -0
- package/dist/docs/image.json +44 -28
- package/dist/docs/image.md +24 -176
- package/dist/docs/import-export-center.examples.md +1280 -0
- package/dist/docs/import-export-center.json +69 -39
- package/dist/docs/import-export-center.md +123 -229
- package/dist/docs/inline-message.json +8 -8
- package/dist/docs/inline-message.md +37 -31
- package/dist/docs/inline.json +1 -1
- package/dist/docs/inline.md +4 -1
- package/dist/docs/list-item.examples.md +769 -0
- package/dist/docs/list-item.json +113 -38
- package/dist/docs/list-item.md +85 -202
- package/dist/docs/listbox.examples.md +858 -0
- package/dist/docs/listbox.json +76 -28
- package/dist/docs/listbox.md +41 -263
- package/dist/docs/markdown.json +79 -55
- package/dist/docs/markdown.md +585 -85
- package/dist/docs/media-viewer.examples.md +1038 -0
- package/dist/docs/media-viewer.json +70 -15
- package/dist/docs/media-viewer.md +84 -135
- package/dist/docs/menu.examples.md +14 -2
- package/dist/docs/menu.json +1 -1
- package/dist/docs/message-scroller.examples.md +1359 -0
- package/dist/docs/message-scroller.json +41 -17
- package/dist/docs/message-scroller.md +93 -134
- package/dist/docs/message.examples.md +954 -0
- package/dist/docs/message.json +68 -18
- package/dist/docs/message.md +39 -327
- package/dist/docs/meter.json +58 -26
- package/dist/docs/meter.md +312 -32
- package/dist/docs/navigation-menu.examples.md +1116 -0
- package/dist/docs/navigation-menu.json +57 -41
- package/dist/docs/navigation-menu.md +105 -298
- package/dist/docs/notification-center.examples.md +1045 -0
- package/dist/docs/notification-center.json +71 -15
- package/dist/docs/notification-center.md +76 -266
- package/dist/docs/otp-input.examples.md +490 -0
- package/dist/docs/otp-input.json +65 -25
- package/dist/docs/otp-input.md +20 -191
- package/dist/docs/page-header.examples.md +1062 -0
- package/dist/docs/page-header.json +83 -43
- package/dist/docs/page-header.md +80 -292
- package/dist/docs/page.examples.md +651 -0
- package/dist/docs/page.json +48 -16
- package/dist/docs/page.md +62 -129
- package/dist/docs/popover.json +17 -2
- package/dist/docs/popover.md +2 -0
- package/dist/docs/progress-indicator.json +10 -1
- package/dist/docs/progress-indicator.md +2 -1
- package/dist/docs/prompt-composer.examples.md +630 -0
- package/dist/docs/prompt-composer.json +66 -18
- package/dist/docs/prompt-composer.md +35 -161
- package/dist/docs/prose.json +69 -37
- package/dist/docs/prose.md +393 -75
- package/dist/docs/rating.examples.md +525 -0
- package/dist/docs/rating.json +92 -28
- package/dist/docs/rating.md +27 -241
- package/dist/docs/saved-views.examples.md +1097 -0
- package/dist/docs/saved-views.json +53 -21
- package/dist/docs/saved-views.md +85 -171
- package/dist/docs/scroll-area.examples.md +837 -0
- package/dist/docs/scroll-area.json +64 -24
- package/dist/docs/scroll-area.md +57 -140
- package/dist/docs/section.examples.md +679 -0
- package/dist/docs/section.json +68 -20
- package/dist/docs/section.md +39 -162
- package/dist/docs/segmented-control.examples.md +480 -0
- package/dist/docs/segmented-control.json +78 -28
- package/dist/docs/segmented-control.md +21 -192
- package/dist/docs/side-navigation.examples.md +1473 -0
- package/dist/docs/side-navigation.json +53 -53
- package/dist/docs/side-navigation.md +79 -354
- package/dist/docs/skeleton.json +2 -2
- package/dist/docs/skeleton.md +2 -2
- package/dist/docs/slider.examples.md +505 -0
- package/dist/docs/slider.json +91 -51
- package/dist/docs/slider.md +47 -212
- package/dist/docs/sparkline.json +60 -36
- package/dist/docs/sparkline.md +447 -71
- package/dist/docs/split-button.examples.md +509 -0
- package/dist/docs/split-button.json +73 -41
- package/dist/docs/split-button.md +64 -194
- package/dist/docs/splitter.examples.md +921 -0
- package/dist/docs/splitter.json +94 -46
- package/dist/docs/splitter.md +75 -182
- package/dist/docs/stat-card.examples.md +725 -0
- package/dist/docs/stat-card.json +89 -41
- package/dist/docs/stat-card.md +55 -227
- package/dist/docs/status-indicator.json +80 -33
- package/dist/docs/status-indicator.md +410 -66
- package/dist/docs/stepper.json +53 -21
- package/dist/docs/stepper.md +363 -48
- package/dist/docs/table-of-contents.examples.md +550 -0
- package/dist/docs/table-of-contents.json +60 -28
- package/dist/docs/table-of-contents.md +70 -205
- package/dist/docs/table.json +2 -1
- package/dist/docs/table.md +2 -2
- package/dist/docs/tabs.examples.md +6 -4
- package/dist/docs/tabs.json +7 -5
- package/dist/docs/tabs.md +2 -2
- package/dist/docs/tags-input.examples.md +541 -0
- package/dist/docs/tags-input.json +64 -16
- package/dist/docs/tags-input.md +15 -262
- package/dist/docs/time-field.examples.md +587 -0
- package/dist/docs/time-field.json +69 -29
- package/dist/docs/time-field.md +21 -223
- package/dist/docs/time-picker.json +117 -53
- package/dist/docs/time-picker.md +499 -54
- package/dist/docs/time-range-picker.examples.md +750 -0
- package/dist/docs/time-range-picker.json +139 -75
- package/dist/docs/time-range-picker.md +63 -225
- package/dist/docs/timeline.examples.md +622 -0
- package/dist/docs/timeline.json +44 -28
- package/dist/docs/timeline.md +34 -208
- package/dist/docs/toggle-group.json +2 -0
- package/dist/docs/toggle-group.md +1 -1
- package/dist/docs/toggle.json +2 -0
- package/dist/docs/toggle.md +1 -1
- package/dist/docs/tokens.md +8 -0
- package/dist/docs/toolbar.examples.md +529 -0
- package/dist/docs/toolbar.json +58 -18
- package/dist/docs/toolbar.md +36 -171
- package/dist/docs/tooltip.examples.md +46 -0
- package/dist/docs/tooltip.json +23 -0
- package/dist/docs/tooltip.md +2 -0
- package/dist/docs/top-navigation.examples.md +1308 -140
- package/dist/docs/top-navigation.json +49 -33
- package/dist/docs/top-navigation.md +92 -36
- package/dist/docs/tour.examples.md +960 -0
- package/dist/docs/tour.json +57 -25
- package/dist/docs/tour.md +60 -244
- package/dist/docs/transfer.examples.md +631 -0
- package/dist/docs/transfer.json +80 -16
- package/dist/docs/transfer.md +41 -170
- package/dist/docs/tree.examples.md +5 -2
- package/dist/docs/tree.json +2 -2
- package/dist/docs/typography.json +96 -0
- package/dist/docs/typography.md +365 -4
- package/dist/docs/upload.examples.md +555 -53
- package/dist/docs/upload.json +62 -30
- package/dist/docs/upload.md +46 -11
- package/dist/docs/visually-hidden.json +3 -3
- package/dist/docs/visually-hidden.md +68 -41
- package/dist/docs/wizard.examples.md +1389 -0
- package/dist/docs/wizard.json +90 -49
- package/dist/docs/wizard.md +123 -264
- package/dist/drawer-JP3p-QZB.js +879 -0
- package/dist/drawer.js +1 -1
- package/dist/{entity-picker-CC4VoC3p.js → entity-picker-BWpuo-mp.js} +341 -334
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CjmF_e0H.js → event-calendar-Bxx8eoGK.js} +10 -6
- package/dist/event-calendar.js +1 -1
- package/dist/{field-C-HRhke0.js → field-N0TiMbaI.js} +2 -2
- package/dist/{field-group-CU0PasvW.js → field-group-BrnE6FvP.js} +1 -1
- package/dist/field-group.js +1 -1
- package/dist/field.js +1 -1
- package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-nQH58RVl.js} +361 -347
- package/dist/filter-bar.js +1 -1
- package/dist/{hover-card-CTItbEfH.js → hover-card-D9-rb9ts.js} +67 -63
- package/dist/hover-card.js +1 -1
- package/dist/{icon-button-N8Madx6i.js → icon-button-DzPkQamc.js} +0 -1
- package/dist/import-export-center-BpGga5jr.js +869 -0
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +105 -105
- package/dist/{listbox-ZqiJ2yer.js → listbox-3XVusnCr.js} +1 -1
- package/dist/listbox.js +1 -1
- package/dist/{loading-overlay-BxIktMtQ.js → loading-overlay-BzycGqQA.js} +1 -1
- package/dist/loading-overlay.js +1 -1
- package/dist/{markdown-BdskE4-L.js → markdown-BMda5ino.js} +15 -15
- package/dist/markdown.js +1 -1
- package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
- package/dist/media-viewer.js +2 -2
- package/dist/message-P91bEGyV.js +455 -0
- package/dist/message.js +2 -2
- package/dist/{multi-select-Dc2d6dDB.js → multi-select-IpsZvoQ2.js} +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/{navigation-menu-parts-CRLmigjy.js → navigation-menu-parts-D-vsDdEF.js} +5 -1
- package/dist/navigation-menu.js +1 -1
- package/dist/{notification-center-BngAw_kt.js → notification-center-CTSfrh9K.js} +3 -3
- package/dist/notification-center.js +1 -1
- package/dist/{number-field-BQ54hXmk.js → number-field-Cp33JMGB.js} +1 -1
- package/dist/number-field.js +1 -1
- package/dist/{otp-input-DRooqa3f.js → otp-input-CEP60HOi.js} +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/{page-header-DmwBGwlm.js → page-header-DK896DGD.js} +105 -110
- package/dist/page-header.js +1 -1
- package/dist/{picker-frame-B6sPCP5Y.js → picker-frame-C3Fhjfaj.js} +1 -1
- package/dist/popover-DED1MTi-.js +615 -0
- package/dist/popover.js +1 -1
- package/dist/{progress-indicator-DRr0Gj6w.js → progress-indicator-Co8e7M5K.js} +6 -3
- package/dist/progress-indicator.js +1 -1
- package/dist/{prompt-composer-tYIs39rn.js → prompt-composer-CwjvdgBR.js} +1 -1
- package/dist/prompt-composer.js +1 -1
- package/dist/{radio-group-AW3xcYYh.js → radio-group-D6bOV_ea.js} +2 -2
- package/dist/radio-group.js +1 -1
- package/dist/{rating-h3qdHLNi.js → rating-D8BvDdjM.js} +1 -1
- package/dist/rating.js +1 -1
- package/dist/{saved-views-nqn0SDXn.js → saved-views-D-CP7JIE.js} +8 -5
- package/dist/saved-views.js +1 -1
- package/dist/section-CVTQdWBl.js +216 -0
- package/dist/section.js +2 -2
- package/dist/{segmented-control-CbK7SurB.js → segmented-control-BLcGhQ4J.js} +3 -3
- package/dist/segmented-control.js +1 -1
- package/dist/{select-d448Wkzb.js → select-Dbc3ng0M.js} +2 -2
- package/dist/{select-tags-3792weoq.js → select-tags-D0SMDPBX.js} +25 -24
- package/dist/select.js +1 -1
- package/dist/{side-navigation-CKRETc8E.js → side-navigation-Dw3-P12f.js} +181 -181
- package/dist/side-navigation.js +1 -1
- package/dist/{skeleton-DeEOmm1y.js → skeleton-DTqt2GEv.js} +27 -20
- package/dist/skeleton.js +1 -1
- package/dist/{slider-DQ2CnxTO.js → slider-COLWTaxi.js} +1 -1
- package/dist/slider.js +1 -1
- package/dist/{split-button-D4MPKSB2.js → split-button-Czr2D3HP.js} +1 -1
- package/dist/split-button.js +1 -1
- package/dist/{stat-card-CL3Xe6pV.js → stat-card-D6NMjkZM.js} +13 -15
- package/dist/stat-card.js +1 -1
- package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
- package/dist/stepper.js +2 -2
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/action-bar.css +2 -2
- package/dist/styles/action-sheet.css +5 -3
- package/dist/styles/app-shell.css +3 -3
- package/dist/styles/attachment.css +3 -3
- package/dist/styles/avatar-group.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/button.css +2 -2
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/cascader.css +7 -7
- package/dist/styles/chart.css +6 -4
- package/dist/styles/checkbox-group.css +6 -2
- package/dist/styles/checkbox.css +7 -3
- package/dist/styles/clock.css +1 -1
- package/dist/styles/code-block.css +2 -2
- package/dist/styles/collapsible.css +2 -2
- package/dist/styles/color-picker.css +9 -5
- package/dist/styles/column-manager.css +9 -9
- package/dist/styles/combobox.css +7 -3
- package/dist/styles/command-palette.css +5 -5
- package/dist/styles/context-menu.css +1 -1
- package/dist/styles/currency-field.css +7 -3
- package/dist/styles/dashboard-grid.css +6 -6
- package/dist/styles/data-grid.css +19 -19
- package/dist/styles/data-list.css +9 -9
- package/dist/styles/date-field.css +7 -3
- package/dist/styles/date-picker.css +8 -4
- package/dist/styles/date-range-picker.css +8 -4
- package/dist/styles/datetime-field.css +7 -3
- package/dist/styles/datetime-picker.css +10 -6
- package/dist/styles/datetime-range-picker.css +9 -5
- package/dist/styles/description-list.css +1 -1
- package/dist/styles/detail-panel.css +7 -7
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +5 -1
- package/dist/styles/entity-picker.css +10 -8
- package/dist/styles/event-calendar.css +12 -8
- package/dist/styles/field-group.css +6 -2
- package/dist/styles/field.css +6 -2
- package/dist/styles/filter-bar.css +20 -20
- package/dist/styles/floating-panel.css +1 -1
- package/dist/styles/hover-card.css +5 -1
- package/dist/styles/import-export-center.css +24 -24
- package/dist/styles/index.css +87 -85
- package/dist/styles/inline.css +1 -1
- package/dist/styles/kbd.css +1 -1
- package/dist/styles/list-item.css +1 -1
- package/dist/styles/listbox.css +7 -3
- package/dist/styles/loading-overlay.css +3 -3
- package/dist/styles/markdown.css +8 -8
- package/dist/styles/media-viewer.css +2 -2
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +2 -2
- package/dist/styles/message-scroller.css +1 -1
- package/dist/styles/message.css +1 -1
- package/dist/styles/multi-select.css +9 -7
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/notification-center.css +5 -5
- package/dist/styles/number-field.css +7 -3
- package/dist/styles/otp-input.css +7 -3
- package/dist/styles/page-header.css +4 -4
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/popover.css +5 -1
- package/dist/styles/progress-indicator.css +2 -2
- package/dist/styles/prompt-composer.css +6 -4
- package/dist/styles/radio-group.css +7 -3
- package/dist/styles/rating.css +7 -3
- package/dist/styles/saved-views.css +8 -6
- package/dist/styles/section.css +1 -1
- package/dist/styles/segmented-control.css +7 -3
- package/dist/styles/select.css +8 -4
- package/dist/styles/side-navigation.css +4 -4
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/slider.css +6 -2
- package/dist/styles/split-button.css +3 -3
- package/dist/styles/stat-card.css +1 -1
- package/dist/styles/status-indicator.css +1 -1
- package/dist/styles/stepper.css +1 -1
- package/dist/styles/switch.css +6 -6
- package/dist/styles/table-of-contents.css +1 -1
- package/dist/styles/table.css +18 -18
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/tag.css +1 -1
- package/dist/styles/tags-input.css +8 -4
- package/dist/styles/text-field.css +7 -3
- package/dist/styles/textarea.css +7 -3
- package/dist/styles/time-field.css +7 -3
- package/dist/styles/time-picker.css +8 -4
- package/dist/styles/time-range-picker.css +8 -4
- package/dist/styles/timeline.css +2 -2
- package/dist/styles/toast.css +3 -3
- package/dist/styles/toggle-group.css +7 -3
- package/dist/styles/toggle.css +1 -1
- package/dist/styles/toolbar.css +2 -2
- package/dist/styles/top-navigation.css +5 -5
- package/dist/styles/tour.css +3 -3
- package/dist/styles/transfer.css +9 -9
- package/dist/styles/tree.css +1 -1
- package/dist/styles/upload.css +10 -6
- package/dist/styles/wizard.css +8 -8
- package/dist/styles.css +1 -1
- package/dist/{switch-DxMukg7F.js → switch-CEbZkLlX.js} +2 -2
- package/dist/switch.js +1 -1
- package/dist/{table-BecApjeD.js → table-BU7XsbQX.js} +169 -162
- package/dist/{table-of-contents-kFr_3Dzs.js → table-of-contents-C410GoEC.js} +1 -1
- package/dist/table-of-contents.js +1 -1
- package/dist/table.js +1 -1
- package/dist/{tags-input-CqCeLtk-.js → tags-input-BdjkB19P.js} +260 -257
- package/dist/tags-input.js +1 -1
- package/dist/{text-field-CMOkJ9Z6.js → text-field-QJnu-rln.js} +1 -1
- package/dist/text-field.js +1 -1
- package/dist/{textarea-DfqPfXTr.js → textarea-DsrXI3xB.js} +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{time-field-GyLQsxcc.js → time-field-DlZdMsNw.js} +1 -1
- package/dist/time-field.js +1 -1
- package/dist/{time-picker-CGHPnust.js → time-picker-WmeCIySv.js} +5 -5
- package/dist/time-picker.js +1 -1
- package/dist/{time-range-picker-BMRtAqPy.js → time-range-picker-CwSbsJPt.js} +6 -6
- package/dist/time-range-picker.js +1 -1
- package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
- package/dist/timeline.js +1 -1
- package/dist/{toast-aM_ga1mc.js → toast-C3xLEFDE.js} +1 -1
- package/dist/toast.js +1 -1
- package/dist/{toggle-group-DZEWkVRo.js → toggle-group-SP_W-yeh.js} +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/toolbar-BniP4i1C.js +249 -0
- package/dist/toolbar.js +1 -1
- package/dist/tooltip-UPICnTij.js +418 -0
- package/dist/tooltip.js +1 -1
- package/dist/top-navigation--OcOpGCy.js +744 -0
- package/dist/top-navigation.js +2 -2
- package/dist/{tour-ALH5CYMY.js → tour-7-TXdrMv.js} +2 -2
- package/dist/tour.js +1 -1
- package/dist/{transfer-sKUvmEKe.js → transfer-DX6umI2M.js} +6 -6
- package/dist/transfer.js +1 -1
- package/dist/types/action-sheet/action-sheet-parts.d.ts.map +1 -1
- package/dist/types/app-shell/app-shell.d.ts.map +1 -1
- package/dist/types/attachment/attachment-parts.d.ts +24 -11
- package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
- package/dist/types/attachment/attachment.d.ts +3 -3
- package/dist/types/attachment/attachment.d.ts.map +1 -1
- package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/types/carousel/carousel-parts.d.ts +2 -2
- package/dist/types/cascader/cascader-surface.d.ts +6 -1
- package/dist/types/cascader/cascader-surface.d.ts.map +1 -1
- package/dist/types/cascader/cascader.d.ts.map +1 -1
- package/dist/types/clock/clock.types.d.ts +5 -2
- package/dist/types/clock/clock.types.d.ts.map +1 -1
- package/dist/types/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/column-manager/column-manager.d.ts.map +1 -1
- package/dist/types/command-palette/command-palette.d.ts.map +1 -1
- package/dist/types/context-menu/context-menu.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.types.d.ts +2 -1
- package/dist/types/dashboard-grid/dashboard-grid.types.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-widget.d.ts.map +1 -1
- package/dist/types/data-list/data-list.d.ts.map +1 -1
- package/dist/types/description-list/description-list-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
- package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
- package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
- package/dist/types/drawer/drawer-parts.d.ts +8 -3
- package/dist/types/drawer/drawer-parts.d.ts.map +1 -1
- package/dist/types/drawer/drawer.types.d.ts +2 -1
- package/dist/types/drawer/drawer.types.d.ts.map +1 -1
- package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
- package/dist/types/event-calendar/event-calendar.d.ts.map +1 -1
- package/dist/types/filter-bar/filter-bar-rules.d.ts.map +1 -1
- package/dist/types/hover-card/hover-card.d.ts.map +1 -1
- package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
- package/dist/types/media-viewer/index.d.ts +2 -2
- package/dist/types/media-viewer/index.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
- package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
- package/dist/types/message/message-parts.d.ts +7 -0
- package/dist/types/message/message-parts.d.ts.map +1 -1
- package/dist/types/message/message.d.ts.map +1 -1
- package/dist/types/navigation-menu/navigation-menu-parts.d.ts.map +1 -1
- package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
- package/dist/types/popover/index.d.ts +1 -1
- package/dist/types/popover/index.d.ts.map +1 -1
- package/dist/types/popover/popover-defaults.d.ts.map +1 -1
- package/dist/types/popover/popover-parts.d.ts +2 -1
- package/dist/types/popover/popover-parts.d.ts.map +1 -1
- package/dist/types/popover/popover.d.ts +1 -1
- package/dist/types/popover/popover.d.ts.map +1 -1
- package/dist/types/popover/popover.types.d.ts +20 -0
- package/dist/types/popover/popover.types.d.ts.map +1 -1
- package/dist/types/progress-indicator/progress-bar.d.ts.map +1 -1
- package/dist/types/saved-views/saved-views.d.ts +1 -0
- package/dist/types/saved-views/saved-views.d.ts.map +1 -1
- package/dist/types/section/section-parts.d.ts +16 -8
- package/dist/types/section/section-parts.d.ts.map +1 -1
- package/dist/types/section/section.d.ts.map +1 -1
- package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
- package/dist/types/select/select-tags.d.ts.map +1 -1
- package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
- package/dist/types/skeleton/skeleton-region-context.d.ts +2 -0
- package/dist/types/skeleton/skeleton-region-context.d.ts.map +1 -1
- package/dist/types/skeleton/skeleton-region.d.ts.map +1 -1
- package/dist/types/skeleton/skeleton-text.d.ts.map +1 -1
- package/dist/types/skeleton/skeleton.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
- package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper-parts.d.ts +11 -2
- package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper.d.ts.map +1 -1
- package/dist/types/table/table-parts.d.ts.map +1 -1
- package/dist/types/tags-input/tags-input.d.ts.map +1 -1
- package/dist/types/time-picker/time-picker.d.ts.map +1 -1
- package/dist/types/time-range-picker/time-range-picker.d.ts.map +1 -1
- package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
- package/dist/types/toolbar/toolbar.d.ts.map +1 -1
- package/dist/types/toolbar/toolbar.types.d.ts +1 -1
- package/dist/types/toolbar/toolbar.types.d.ts.map +1 -1
- package/dist/types/tooltip/tooltip-defaults.d.ts.map +1 -1
- package/dist/types/tooltip/tooltip-parts.d.ts.map +1 -1
- package/dist/types/tooltip/tooltip.d.ts +1 -1
- package/dist/types/tooltip/tooltip.d.ts.map +1 -1
- package/dist/types/tooltip/tooltip.types.d.ts +17 -0
- package/dist/types/tooltip/tooltip.types.d.ts.map +1 -1
- package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
- package/dist/types/tour/tour.d.ts.map +1 -1
- package/dist/{upload-CuMOaPK3.js → upload-BtD1nLHa.js} +2 -2
- package/dist/upload.js +1 -1
- package/dist/{use-date-picker-DdSX3RE4.js → use-date-picker-CwH791Jm.js} +2 -2
- package/dist/{use-picker-draft-I_pxqYsc.js → use-picker-draft-BnLS4lDY.js} +1 -1
- package/dist/wizard-6PTtBoi4.js +838 -0
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/action-sheet-BouG2qh_.js +0 -360
- package/dist/attachment-MqczA38F.js +0 -292
- package/dist/detail-panel-EImAtksY.js +0 -327
- package/dist/drawer-CQagePr_.js +0 -830
- package/dist/import-export-center-CW8YVZev.js +0 -867
- package/dist/message-D1Dd6Y2k.js +0 -452
- package/dist/popover-1DlOu95x.js +0 -576
- package/dist/section-D_qOfdxR.js +0 -213
- package/dist/toolbar-BP7ka6lN.js +0 -243
- package/dist/tooltip-DrFiRlH8.js +0 -411
- package/dist/top-navigation-D8IHPOmm.js +0 -744
- package/dist/wizard-4c0X7Bx_.js +0 -838
|
@@ -0,0 +1,1359 @@
|
|
|
1
|
+
<!-- index: ./index.md -->
|
|
2
|
+
# message-scroller
|
|
3
|
+
|
|
4
|
+
`data-ui="message-scroller"` · Scrolling log of messages that follows new ones.
|
|
5
|
+
|
|
6
|
+
## Examples
|
|
7
|
+
|
|
8
|
+
### Playground
|
|
9
|
+
|
|
10
|
+
A conversation in a frame 22 rem tall with follow, the opening position and the peek on the controls. Scroll up and the jump control arrives; press it and it leaves.
|
|
11
|
+
|
|
12
|
+
Excerpt — not a complete module
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<MessageScroller follow>
|
|
16
|
+
<MessageScrollerViewport>
|
|
17
|
+
<MessageScrollerContent>
|
|
18
|
+
{messages.map((message) => (
|
|
19
|
+
<MessageScrollerItem key={message.id} messageId={message.id} anchor={message.own}>
|
|
20
|
+
<Message align={message.own ? 'end' : 'start'}>…</Message>
|
|
21
|
+
</MessageScrollerItem>
|
|
22
|
+
))}
|
|
23
|
+
</MessageScrollerContent>
|
|
24
|
+
</MessageScrollerViewport>
|
|
25
|
+
<MessageScrollerJump />
|
|
26
|
+
</MessageScroller>;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Where a saved conversation opens
|
|
30
|
+
|
|
31
|
+
last-anchor opens at the reader’s last question with the answer under it; end at the last line; start at the first. None of them shows the oldest rows first and then jumps.
|
|
32
|
+
|
|
33
|
+
Excerpt — not a complete module
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<MessageScroller defaultPosition="last-anchor">…</MessageScroller>;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Following a reply, and letting go
|
|
40
|
+
|
|
41
|
+
With follow the view keeps the streaming reply in sight while the reader is at the end. Scroll up, select a word or press an arrow and it stops pulling; the jump control resumes it.
|
|
42
|
+
|
|
43
|
+
Example
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { useEffect, useState } from 'react';
|
|
47
|
+
|
|
48
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
49
|
+
import { Button } from '@slotted/react/button';
|
|
50
|
+
import {
|
|
51
|
+
Bubble,
|
|
52
|
+
BubbleCaret,
|
|
53
|
+
BubbleContent,
|
|
54
|
+
BubbleStream,
|
|
55
|
+
Message,
|
|
56
|
+
MessageAuthor,
|
|
57
|
+
MessageBody,
|
|
58
|
+
MessageHeader,
|
|
59
|
+
} from '@slotted/react/message';
|
|
60
|
+
import {
|
|
61
|
+
MessageScroller,
|
|
62
|
+
MessageScrollerContent,
|
|
63
|
+
MessageScrollerItem,
|
|
64
|
+
MessageScrollerJump,
|
|
65
|
+
MessageScrollerViewport,
|
|
66
|
+
} from '@slotted/react/message-scroller';
|
|
67
|
+
import { Stack } from '@slotted/react/stack';
|
|
68
|
+
|
|
69
|
+
const REPLY =
|
|
70
|
+
'Pallet P-7731 reached the Rotterdam hub at 19:48. The temperature log stayed between -19 and -18 degrees C for the whole trip, so no quality hold is needed. The receiving team can release the pallet to the cold room.';
|
|
71
|
+
|
|
72
|
+
const ROWS = [
|
|
73
|
+
{
|
|
74
|
+
id: 'q1',
|
|
75
|
+
own: true,
|
|
76
|
+
author: 'Dana Reyes',
|
|
77
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'a1',
|
|
81
|
+
own: false,
|
|
82
|
+
author: 'Dispatch assistant',
|
|
83
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'q2',
|
|
87
|
+
own: true,
|
|
88
|
+
author: 'Dana Reyes',
|
|
89
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'a2',
|
|
93
|
+
own: false,
|
|
94
|
+
author: 'Dispatch assistant',
|
|
95
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
96
|
+
},
|
|
97
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
98
|
+
{
|
|
99
|
+
id: 'a3',
|
|
100
|
+
own: false,
|
|
101
|
+
author: 'Dispatch assistant',
|
|
102
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'q4',
|
|
106
|
+
own: true,
|
|
107
|
+
author: 'Dana Reyes',
|
|
108
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'a4',
|
|
112
|
+
own: false,
|
|
113
|
+
author: 'Dispatch assistant',
|
|
114
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
export default function MessageScrollerFollowExample() {
|
|
119
|
+
const [length, setLength] = useState<number | null>(null);
|
|
120
|
+
const streaming = length !== null && length < REPLY.length;
|
|
121
|
+
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (!streaming) return undefined;
|
|
124
|
+
const timer = window.setTimeout(() => setLength((value) => (value ?? 0) + 8), 60);
|
|
125
|
+
return () => window.clearTimeout(timer);
|
|
126
|
+
}, [streaming, length]);
|
|
127
|
+
|
|
128
|
+
function handleStream() {
|
|
129
|
+
setLength(8);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Stack gap={3}>
|
|
134
|
+
<Button size="sm" disabled={streaming} onClick={handleStream}>
|
|
135
|
+
Stream a reply
|
|
136
|
+
</Button>
|
|
137
|
+
|
|
138
|
+
<AspectRatio ratio="square">
|
|
139
|
+
<MessageScroller follow defaultPosition="end">
|
|
140
|
+
<MessageScrollerViewport>
|
|
141
|
+
<MessageScrollerContent>
|
|
142
|
+
{ROWS.map((row) => (
|
|
143
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
144
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
145
|
+
<MessageBody>
|
|
146
|
+
<MessageHeader>
|
|
147
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
148
|
+
</MessageHeader>
|
|
149
|
+
<Bubble>
|
|
150
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
151
|
+
</Bubble>
|
|
152
|
+
</MessageBody>
|
|
153
|
+
</Message>
|
|
154
|
+
</MessageScrollerItem>
|
|
155
|
+
))}
|
|
156
|
+
{length === null ? null : (
|
|
157
|
+
<MessageScrollerItem messageId="live">
|
|
158
|
+
<Message status={streaming ? 'streaming' : undefined}>
|
|
159
|
+
<MessageBody>
|
|
160
|
+
<MessageHeader>
|
|
161
|
+
<MessageAuthor>Dispatch assistant</MessageAuthor>
|
|
162
|
+
</MessageHeader>
|
|
163
|
+
<Bubble>
|
|
164
|
+
<BubbleContent>
|
|
165
|
+
<BubbleStream text={REPLY.slice(0, length)} />
|
|
166
|
+
{streaming ? <BubbleCaret /> : null}
|
|
167
|
+
</BubbleContent>
|
|
168
|
+
</Bubble>
|
|
169
|
+
</MessageBody>
|
|
170
|
+
</Message>
|
|
171
|
+
</MessageScrollerItem>
|
|
172
|
+
)}
|
|
173
|
+
</MessageScrollerContent>
|
|
174
|
+
</MessageScrollerViewport>
|
|
175
|
+
<MessageScrollerJump />
|
|
176
|
+
</MessageScroller>
|
|
177
|
+
</AspectRatio>
|
|
178
|
+
</Stack>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### A question lifted to the top
|
|
184
|
+
|
|
185
|
+
An item with anchor that arrives is brought to the top with a peek of the row above it, and room is kept below so it can stand there while the answer is still short.
|
|
186
|
+
|
|
187
|
+
Example
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
import { useState } from 'react';
|
|
191
|
+
|
|
192
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
193
|
+
import { Button } from '@slotted/react/button';
|
|
194
|
+
import {
|
|
195
|
+
Bubble,
|
|
196
|
+
BubbleContent,
|
|
197
|
+
Message,
|
|
198
|
+
MessageAuthor,
|
|
199
|
+
MessageBody,
|
|
200
|
+
MessageHeader,
|
|
201
|
+
} from '@slotted/react/message';
|
|
202
|
+
import {
|
|
203
|
+
MessageScroller,
|
|
204
|
+
MessageScrollerContent,
|
|
205
|
+
MessageScrollerItem,
|
|
206
|
+
MessageScrollerJump,
|
|
207
|
+
MessageScrollerViewport,
|
|
208
|
+
} from '@slotted/react/message-scroller';
|
|
209
|
+
import { Stack } from '@slotted/react/stack';
|
|
210
|
+
|
|
211
|
+
const FOLLOW_UPS = [
|
|
212
|
+
{
|
|
213
|
+
id: 'q5',
|
|
214
|
+
own: true,
|
|
215
|
+
author: 'Dana Reyes',
|
|
216
|
+
text: 'Which warehouse holds the replacement stock?',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: 'a5',
|
|
220
|
+
own: false,
|
|
221
|
+
author: 'Dispatch assistant',
|
|
222
|
+
text: 'Rotterdam holds 40 units. Antwerp holds 12 and can ship by 06:00.',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: 'q6',
|
|
226
|
+
own: true,
|
|
227
|
+
author: 'Dana Reyes',
|
|
228
|
+
text: 'Reserve the 40 units for order NW-20418.',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: 'a6',
|
|
232
|
+
own: false,
|
|
233
|
+
author: 'Dispatch assistant',
|
|
234
|
+
text: 'Reserved. The pick list prints at 05:30.',
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
const ROWS = [
|
|
239
|
+
{
|
|
240
|
+
id: 'q1',
|
|
241
|
+
own: true,
|
|
242
|
+
author: 'Dana Reyes',
|
|
243
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 'a1',
|
|
247
|
+
own: false,
|
|
248
|
+
author: 'Dispatch assistant',
|
|
249
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: 'q2',
|
|
253
|
+
own: true,
|
|
254
|
+
author: 'Dana Reyes',
|
|
255
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: 'a2',
|
|
259
|
+
own: false,
|
|
260
|
+
author: 'Dispatch assistant',
|
|
261
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
262
|
+
},
|
|
263
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
264
|
+
{
|
|
265
|
+
id: 'a3',
|
|
266
|
+
own: false,
|
|
267
|
+
author: 'Dispatch assistant',
|
|
268
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'q4',
|
|
272
|
+
own: true,
|
|
273
|
+
author: 'Dana Reyes',
|
|
274
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: 'a4',
|
|
278
|
+
own: false,
|
|
279
|
+
author: 'Dispatch assistant',
|
|
280
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
281
|
+
},
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
export default function MessageScrollerAnchorExample() {
|
|
285
|
+
const [sent, setSent] = useState(0);
|
|
286
|
+
const rows = [...ROWS, ...FOLLOW_UPS.slice(0, sent * 2)];
|
|
287
|
+
|
|
288
|
+
function handleSend() {
|
|
289
|
+
setSent((value) => value + 1);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<Stack gap={3}>
|
|
294
|
+
<Button size="sm" disabled={sent === 2} onClick={handleSend}>
|
|
295
|
+
Send the next question
|
|
296
|
+
</Button>
|
|
297
|
+
|
|
298
|
+
<AspectRatio ratio="square">
|
|
299
|
+
<MessageScroller peek={48} scrollMargin={8}>
|
|
300
|
+
<MessageScrollerViewport>
|
|
301
|
+
<MessageScrollerContent>
|
|
302
|
+
{rows.map((row) => (
|
|
303
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
304
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
305
|
+
<MessageBody>
|
|
306
|
+
<MessageHeader>
|
|
307
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
308
|
+
</MessageHeader>
|
|
309
|
+
<Bubble>
|
|
310
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
311
|
+
</Bubble>
|
|
312
|
+
</MessageBody>
|
|
313
|
+
</Message>
|
|
314
|
+
</MessageScrollerItem>
|
|
315
|
+
))}
|
|
316
|
+
</MessageScrollerContent>
|
|
317
|
+
</MessageScrollerViewport>
|
|
318
|
+
<MessageScrollerJump />
|
|
319
|
+
</MessageScroller>
|
|
320
|
+
</AspectRatio>
|
|
321
|
+
</Stack>
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Older messages without a jump
|
|
327
|
+
|
|
328
|
+
Reach the top and onReachStart asks for more; the rows arrive above and the one the reader was on stays exactly where it was. The loader holds the head while they travel.
|
|
329
|
+
|
|
330
|
+
Example
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
import { useEffect, useState } from 'react';
|
|
334
|
+
|
|
335
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
336
|
+
import {
|
|
337
|
+
Bubble,
|
|
338
|
+
BubbleContent,
|
|
339
|
+
Message,
|
|
340
|
+
MessageAuthor,
|
|
341
|
+
MessageBody,
|
|
342
|
+
MessageHeader,
|
|
343
|
+
} from '@slotted/react/message';
|
|
344
|
+
import {
|
|
345
|
+
MessageScroller,
|
|
346
|
+
MessageScrollerContent,
|
|
347
|
+
MessageScrollerItem,
|
|
348
|
+
MessageScrollerJump,
|
|
349
|
+
MessageScrollerLoader,
|
|
350
|
+
MessageScrollerViewport,
|
|
351
|
+
} from '@slotted/react/message-scroller';
|
|
352
|
+
import { Stack } from '@slotted/react/stack';
|
|
353
|
+
import { Text } from '@slotted/react/typography';
|
|
354
|
+
|
|
355
|
+
const OLDER = [
|
|
356
|
+
[
|
|
357
|
+
{
|
|
358
|
+
id: 'o1',
|
|
359
|
+
own: true,
|
|
360
|
+
author: 'Dana Reyes',
|
|
361
|
+
text: 'Ticket 4821: exports come back empty for one customer.',
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
id: 'o2',
|
|
365
|
+
own: false,
|
|
366
|
+
author: 'Dispatch assistant',
|
|
367
|
+
text: 'Each job finished with zero rows. Only workspace ws-3311 shows the pattern.',
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
[
|
|
371
|
+
{
|
|
372
|
+
id: 'p1',
|
|
373
|
+
own: true,
|
|
374
|
+
author: 'Dana Reyes',
|
|
375
|
+
text: 'Did the carrier change its pickup window this month?',
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: 'p2',
|
|
379
|
+
own: false,
|
|
380
|
+
author: 'Dispatch assistant',
|
|
381
|
+
text: 'Yes. Harbor Freight moved the Rotterdam pickup from 18:00 to 17:30 on the 3rd.',
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
];
|
|
385
|
+
|
|
386
|
+
const ROWS = [
|
|
387
|
+
{
|
|
388
|
+
id: 'q1',
|
|
389
|
+
own: true,
|
|
390
|
+
author: 'Dana Reyes',
|
|
391
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: 'a1',
|
|
395
|
+
own: false,
|
|
396
|
+
author: 'Dispatch assistant',
|
|
397
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
id: 'q2',
|
|
401
|
+
own: true,
|
|
402
|
+
author: 'Dana Reyes',
|
|
403
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
id: 'a2',
|
|
407
|
+
own: false,
|
|
408
|
+
author: 'Dispatch assistant',
|
|
409
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
410
|
+
},
|
|
411
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
412
|
+
{
|
|
413
|
+
id: 'a3',
|
|
414
|
+
own: false,
|
|
415
|
+
author: 'Dispatch assistant',
|
|
416
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
id: 'q4',
|
|
420
|
+
own: true,
|
|
421
|
+
author: 'Dana Reyes',
|
|
422
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
id: 'a4',
|
|
426
|
+
own: false,
|
|
427
|
+
author: 'Dispatch assistant',
|
|
428
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
429
|
+
},
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
export default function MessageScrollerHistoryExample() {
|
|
433
|
+
const [loaded, setLoaded] = useState(0);
|
|
434
|
+
const [loading, setLoading] = useState(false);
|
|
435
|
+
const rows = [...OLDER.slice(0, loaded).reverse().flat(), ...ROWS];
|
|
436
|
+
|
|
437
|
+
useEffect(() => {
|
|
438
|
+
if (!loading) return undefined;
|
|
439
|
+
const timer = window.setTimeout(() => {
|
|
440
|
+
setLoaded((value) => value + 1);
|
|
441
|
+
setLoading(false);
|
|
442
|
+
}, 1200);
|
|
443
|
+
return () => window.clearTimeout(timer);
|
|
444
|
+
}, [loading]);
|
|
445
|
+
|
|
446
|
+
function handleReachStart() {
|
|
447
|
+
if (!loading && loaded < OLDER.length) setLoading(true);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
return (
|
|
451
|
+
<Stack gap={3}>
|
|
452
|
+
<Text size="sm" tone="muted">
|
|
453
|
+
Earlier messages loaded: {loaded} of {OLDER.length}
|
|
454
|
+
</Text>
|
|
455
|
+
|
|
456
|
+
<AspectRatio ratio="square">
|
|
457
|
+
<MessageScroller defaultPosition="end" onReachStart={handleReachStart}>
|
|
458
|
+
<MessageScrollerViewport>
|
|
459
|
+
<MessageScrollerContent>
|
|
460
|
+
{loading ? <MessageScrollerLoader /> : null}
|
|
461
|
+
{rows.map((row) => (
|
|
462
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
463
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
464
|
+
<MessageBody>
|
|
465
|
+
<MessageHeader>
|
|
466
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
467
|
+
</MessageHeader>
|
|
468
|
+
<Bubble>
|
|
469
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
470
|
+
</Bubble>
|
|
471
|
+
</MessageBody>
|
|
472
|
+
</Message>
|
|
473
|
+
</MessageScrollerItem>
|
|
474
|
+
))}
|
|
475
|
+
</MessageScrollerContent>
|
|
476
|
+
</MessageScrollerViewport>
|
|
477
|
+
<MessageScrollerJump />
|
|
478
|
+
</MessageScroller>
|
|
479
|
+
</AspectRatio>
|
|
480
|
+
</Stack>
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Back to the latest, with a count
|
|
486
|
+
|
|
487
|
+
Scroll up and send two messages from the other side: the control widens to say how many arrived out of view. It arrives on the enter curve and leaves faster than it came.
|
|
488
|
+
|
|
489
|
+
Example
|
|
490
|
+
|
|
491
|
+
```tsx
|
|
492
|
+
import { useState } from 'react';
|
|
493
|
+
|
|
494
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
495
|
+
import { Button } from '@slotted/react/button';
|
|
496
|
+
import {
|
|
497
|
+
Bubble,
|
|
498
|
+
BubbleContent,
|
|
499
|
+
Message,
|
|
500
|
+
MessageAuthor,
|
|
501
|
+
MessageBody,
|
|
502
|
+
MessageHeader,
|
|
503
|
+
} from '@slotted/react/message';
|
|
504
|
+
import {
|
|
505
|
+
MessageScroller,
|
|
506
|
+
MessageScrollerContent,
|
|
507
|
+
MessageScrollerItem,
|
|
508
|
+
MessageScrollerJump,
|
|
509
|
+
MessageScrollerViewport,
|
|
510
|
+
} from '@slotted/react/message-scroller';
|
|
511
|
+
import { Stack } from '@slotted/react/stack';
|
|
512
|
+
|
|
513
|
+
const INCOMING = [
|
|
514
|
+
{
|
|
515
|
+
id: 'a5',
|
|
516
|
+
own: false,
|
|
517
|
+
author: 'Dispatch assistant',
|
|
518
|
+
text: 'Harbor Freight confirmed the 19:00 pickup.',
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
id: 'a6',
|
|
522
|
+
own: false,
|
|
523
|
+
author: 'Dispatch assistant',
|
|
524
|
+
text: 'The Rotterdam dock released door 4 at 18:40.',
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
id: 'a7',
|
|
528
|
+
own: false,
|
|
529
|
+
author: 'Dispatch assistant',
|
|
530
|
+
text: 'Pallet P-7731 was loaded at 18:55.',
|
|
531
|
+
},
|
|
532
|
+
];
|
|
533
|
+
|
|
534
|
+
const ROWS = [
|
|
535
|
+
{
|
|
536
|
+
id: 'q1',
|
|
537
|
+
own: true,
|
|
538
|
+
author: 'Dana Reyes',
|
|
539
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
id: 'a1',
|
|
543
|
+
own: false,
|
|
544
|
+
author: 'Dispatch assistant',
|
|
545
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
id: 'q2',
|
|
549
|
+
own: true,
|
|
550
|
+
author: 'Dana Reyes',
|
|
551
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
id: 'a2',
|
|
555
|
+
own: false,
|
|
556
|
+
author: 'Dispatch assistant',
|
|
557
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
558
|
+
},
|
|
559
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
560
|
+
{
|
|
561
|
+
id: 'a3',
|
|
562
|
+
own: false,
|
|
563
|
+
author: 'Dispatch assistant',
|
|
564
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
id: 'q4',
|
|
568
|
+
own: true,
|
|
569
|
+
author: 'Dana Reyes',
|
|
570
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
id: 'a4',
|
|
574
|
+
own: false,
|
|
575
|
+
author: 'Dispatch assistant',
|
|
576
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
577
|
+
},
|
|
578
|
+
];
|
|
579
|
+
|
|
580
|
+
export default function MessageScrollerJumpExample() {
|
|
581
|
+
const [received, setReceived] = useState(0);
|
|
582
|
+
const rows = [...ROWS, ...INCOMING.slice(0, received)];
|
|
583
|
+
|
|
584
|
+
function handleReceive() {
|
|
585
|
+
setReceived((value) => value + 1);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return (
|
|
589
|
+
<Stack gap={3}>
|
|
590
|
+
<Button size="sm" disabled={received === INCOMING.length} onClick={handleReceive}>
|
|
591
|
+
Receive a message
|
|
592
|
+
</Button>
|
|
593
|
+
|
|
594
|
+
<AspectRatio ratio="square">
|
|
595
|
+
<MessageScroller defaultPosition="end">
|
|
596
|
+
<MessageScrollerViewport>
|
|
597
|
+
<MessageScrollerContent>
|
|
598
|
+
{rows.map((row) => (
|
|
599
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
600
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
601
|
+
<MessageBody>
|
|
602
|
+
<MessageHeader>
|
|
603
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
604
|
+
</MessageHeader>
|
|
605
|
+
<Bubble>
|
|
606
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
607
|
+
</Bubble>
|
|
608
|
+
</MessageBody>
|
|
609
|
+
</Message>
|
|
610
|
+
</MessageScrollerItem>
|
|
611
|
+
))}
|
|
612
|
+
</MessageScrollerContent>
|
|
613
|
+
</MessageScrollerViewport>
|
|
614
|
+
<MessageScrollerJump direction="start" behavior="instant" />
|
|
615
|
+
<MessageScrollerJump />
|
|
616
|
+
</MessageScroller>
|
|
617
|
+
</AspectRatio>
|
|
618
|
+
</Stack>
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### Jumping to a turn from outside
|
|
624
|
+
|
|
625
|
+
A footer outside the frame reads onAnchorChange and drives ref.current.scrollToMessage with highlight: the landed row glows in the accent’s tint and loses it slowly.
|
|
626
|
+
|
|
627
|
+
Example
|
|
628
|
+
|
|
629
|
+
```tsx
|
|
630
|
+
import { useRef, useState } from 'react';
|
|
631
|
+
|
|
632
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
633
|
+
import { Button } from '@slotted/react/button';
|
|
634
|
+
import { Inline } from '@slotted/react/inline';
|
|
635
|
+
import {
|
|
636
|
+
Bubble,
|
|
637
|
+
BubbleContent,
|
|
638
|
+
Message,
|
|
639
|
+
MessageAuthor,
|
|
640
|
+
MessageBody,
|
|
641
|
+
MessageHeader,
|
|
642
|
+
} from '@slotted/react/message';
|
|
643
|
+
import {
|
|
644
|
+
MessageScroller,
|
|
645
|
+
MessageScrollerContent,
|
|
646
|
+
MessageScrollerItem,
|
|
647
|
+
MessageScrollerJump,
|
|
648
|
+
MessageScrollerViewport,
|
|
649
|
+
} from '@slotted/react/message-scroller';
|
|
650
|
+
import type { MessageScrollerHandle } from '@slotted/react/message-scroller';
|
|
651
|
+
import { Stack } from '@slotted/react/stack';
|
|
652
|
+
|
|
653
|
+
const TURNS = [
|
|
654
|
+
{ id: 'q1', label: 'Pickup' },
|
|
655
|
+
{ id: 'q2', label: 'Cold chain' },
|
|
656
|
+
{ id: 'q3', label: 'Rebooking' },
|
|
657
|
+
{ id: 'q4', label: 'Customer' },
|
|
658
|
+
];
|
|
659
|
+
|
|
660
|
+
const ROWS = [
|
|
661
|
+
{
|
|
662
|
+
id: 'q1',
|
|
663
|
+
own: true,
|
|
664
|
+
author: 'Dana Reyes',
|
|
665
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
id: 'a1',
|
|
669
|
+
own: false,
|
|
670
|
+
author: 'Dispatch assistant',
|
|
671
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
id: 'q2',
|
|
675
|
+
own: true,
|
|
676
|
+
author: 'Dana Reyes',
|
|
677
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
id: 'a2',
|
|
681
|
+
own: false,
|
|
682
|
+
author: 'Dispatch assistant',
|
|
683
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
684
|
+
},
|
|
685
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
686
|
+
{
|
|
687
|
+
id: 'a3',
|
|
688
|
+
own: false,
|
|
689
|
+
author: 'Dispatch assistant',
|
|
690
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
id: 'q4',
|
|
694
|
+
own: true,
|
|
695
|
+
author: 'Dana Reyes',
|
|
696
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
id: 'a4',
|
|
700
|
+
own: false,
|
|
701
|
+
author: 'Dispatch assistant',
|
|
702
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
703
|
+
},
|
|
704
|
+
];
|
|
705
|
+
|
|
706
|
+
export default function MessageScrollerNavigatorExample() {
|
|
707
|
+
const scroller = useRef<MessageScrollerHandle>(null);
|
|
708
|
+
const [current, setCurrent] = useState<string | null>(null);
|
|
709
|
+
|
|
710
|
+
function handleGo(id: string) {
|
|
711
|
+
scroller.current?.scrollToMessage(id, { highlight: true });
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
return (
|
|
715
|
+
<Stack gap={3}>
|
|
716
|
+
<Inline gap={2}>
|
|
717
|
+
{TURNS.map((turn) => (
|
|
718
|
+
<Button
|
|
719
|
+
key={turn.id}
|
|
720
|
+
size="sm"
|
|
721
|
+
variant={turn.id === current ? 'solid' : 'outline'}
|
|
722
|
+
onClick={() => handleGo(turn.id)}
|
|
723
|
+
>
|
|
724
|
+
{turn.label}
|
|
725
|
+
</Button>
|
|
726
|
+
))}
|
|
727
|
+
</Inline>
|
|
728
|
+
|
|
729
|
+
<AspectRatio ratio="square">
|
|
730
|
+
<MessageScroller
|
|
731
|
+
ref={scroller}
|
|
732
|
+
defaultPosition="start"
|
|
733
|
+
onAnchorChange={(id) => setCurrent(id)}
|
|
734
|
+
>
|
|
735
|
+
<MessageScrollerViewport>
|
|
736
|
+
<MessageScrollerContent>
|
|
737
|
+
{ROWS.map((row) => (
|
|
738
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
739
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
740
|
+
<MessageBody>
|
|
741
|
+
<MessageHeader>
|
|
742
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
743
|
+
</MessageHeader>
|
|
744
|
+
<Bubble>
|
|
745
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
746
|
+
</Bubble>
|
|
747
|
+
</MessageBody>
|
|
748
|
+
</Message>
|
|
749
|
+
</MessageScrollerItem>
|
|
750
|
+
))}
|
|
751
|
+
</MessageScrollerContent>
|
|
752
|
+
</MessageScrollerViewport>
|
|
753
|
+
<MessageScrollerJump />
|
|
754
|
+
</MessageScroller>
|
|
755
|
+
</AspectRatio>
|
|
756
|
+
</Stack>
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
### Days that stay at the top
|
|
762
|
+
|
|
763
|
+
A sticky separator is a pill that stays at the top while its day is in view and gives way to the next day as it arrives; a separator that is not sticky keeps its rules.
|
|
764
|
+
|
|
765
|
+
Example
|
|
766
|
+
|
|
767
|
+
```tsx
|
|
768
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
769
|
+
import {
|
|
770
|
+
Bubble,
|
|
771
|
+
BubbleContent,
|
|
772
|
+
Message,
|
|
773
|
+
MessageAuthor,
|
|
774
|
+
MessageBody,
|
|
775
|
+
MessageHeader,
|
|
776
|
+
} from '@slotted/react/message';
|
|
777
|
+
import {
|
|
778
|
+
MessageScroller,
|
|
779
|
+
MessageScrollerContent,
|
|
780
|
+
MessageScrollerItem,
|
|
781
|
+
MessageScrollerJump,
|
|
782
|
+
MessageScrollerSeparator,
|
|
783
|
+
MessageScrollerViewport,
|
|
784
|
+
} from '@slotted/react/message-scroller';
|
|
785
|
+
|
|
786
|
+
const ITEMS = [
|
|
787
|
+
{ id: 's1', kind: 'day', text: 'Yesterday' },
|
|
788
|
+
{
|
|
789
|
+
id: 'm1',
|
|
790
|
+
kind: 'message',
|
|
791
|
+
author: 'Dana Reyes',
|
|
792
|
+
text: 'Count the returns bay before the shift ends.',
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
id: 'm2',
|
|
796
|
+
kind: 'message',
|
|
797
|
+
author: 'Dispatch assistant',
|
|
798
|
+
text: 'The count finished at 21:10. Two cartons carry no label.',
|
|
799
|
+
},
|
|
800
|
+
{ id: 'm3', kind: 'message', author: 'Dana Reyes', text: 'Hold both cartons for inspection.' },
|
|
801
|
+
{
|
|
802
|
+
id: 'm4',
|
|
803
|
+
kind: 'message',
|
|
804
|
+
author: 'Dispatch assistant',
|
|
805
|
+
text: 'Both cartons moved to the quarantine rack in aisle 9.',
|
|
806
|
+
},
|
|
807
|
+
{ id: 's2', kind: 'note', text: 'Night shift took over at 22:00' },
|
|
808
|
+
{
|
|
809
|
+
id: 'm5',
|
|
810
|
+
kind: 'message',
|
|
811
|
+
author: 'Dispatch assistant',
|
|
812
|
+
text: 'Night shift confirmed the quarantine rack is sealed.',
|
|
813
|
+
},
|
|
814
|
+
{ id: 's3', kind: 'day', text: 'Today' },
|
|
815
|
+
{
|
|
816
|
+
id: 'm6',
|
|
817
|
+
kind: 'message',
|
|
818
|
+
author: 'Dana Reyes',
|
|
819
|
+
text: 'Open the inspection for the two cartons.',
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
id: 'm7',
|
|
823
|
+
kind: 'message',
|
|
824
|
+
author: 'Dispatch assistant',
|
|
825
|
+
text: 'Inspection INS-3302 opened at 07:45.',
|
|
826
|
+
},
|
|
827
|
+
{ id: 'm8', kind: 'message', author: 'Dana Reyes', text: 'Assign it to the quality team.' },
|
|
828
|
+
{
|
|
829
|
+
id: 'm9',
|
|
830
|
+
kind: 'message',
|
|
831
|
+
author: 'Dispatch assistant',
|
|
832
|
+
text: 'Assigned to the quality team, due at 12:00.',
|
|
833
|
+
},
|
|
834
|
+
];
|
|
835
|
+
|
|
836
|
+
export default function MessageScrollerSeparatorsExample() {
|
|
837
|
+
return (
|
|
838
|
+
<AspectRatio ratio="square">
|
|
839
|
+
<MessageScroller defaultPosition="start">
|
|
840
|
+
<MessageScrollerViewport>
|
|
841
|
+
<MessageScrollerContent>
|
|
842
|
+
{ITEMS.map((item) => (
|
|
843
|
+
<MessageScrollerItem key={item.id}>
|
|
844
|
+
{item.kind === 'message' ? (
|
|
845
|
+
<>
|
|
846
|
+
<Message>
|
|
847
|
+
<MessageBody>
|
|
848
|
+
<MessageHeader>
|
|
849
|
+
<MessageAuthor>{item.author}</MessageAuthor>
|
|
850
|
+
</MessageHeader>
|
|
851
|
+
<Bubble>
|
|
852
|
+
<BubbleContent>{item.text}</BubbleContent>
|
|
853
|
+
</Bubble>
|
|
854
|
+
</MessageBody>
|
|
855
|
+
</Message>
|
|
856
|
+
</>
|
|
857
|
+
) : (
|
|
858
|
+
<MessageScrollerSeparator sticky={item.kind === 'day'}>
|
|
859
|
+
{item.text}
|
|
860
|
+
</MessageScrollerSeparator>
|
|
861
|
+
)}
|
|
862
|
+
</MessageScrollerItem>
|
|
863
|
+
))}
|
|
864
|
+
</MessageScrollerContent>
|
|
865
|
+
</MessageScrollerViewport>
|
|
866
|
+
<MessageScrollerJump />
|
|
867
|
+
</MessageScroller>
|
|
868
|
+
</AspectRatio>
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### Where the reader stopped reading
|
|
874
|
+
|
|
875
|
+
The unread line is a row like any other, in the accent, above the first message the reader has not seen; it is text in the flow, so it is read in order.
|
|
876
|
+
|
|
877
|
+
Example
|
|
878
|
+
|
|
879
|
+
```tsx
|
|
880
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
881
|
+
import {
|
|
882
|
+
Bubble,
|
|
883
|
+
BubbleContent,
|
|
884
|
+
Message,
|
|
885
|
+
MessageAuthor,
|
|
886
|
+
MessageBody,
|
|
887
|
+
MessageHeader,
|
|
888
|
+
} from '@slotted/react/message';
|
|
889
|
+
import {
|
|
890
|
+
MessageScroller,
|
|
891
|
+
MessageScrollerContent,
|
|
892
|
+
MessageScrollerItem,
|
|
893
|
+
MessageScrollerJump,
|
|
894
|
+
MessageScrollerUnread,
|
|
895
|
+
MessageScrollerViewport,
|
|
896
|
+
} from '@slotted/react/message-scroller';
|
|
897
|
+
|
|
898
|
+
const READ = [
|
|
899
|
+
{ id: 'r1', author: 'Dana Reyes', text: 'Is the Antwerp transfer on track?' },
|
|
900
|
+
{ id: 'r2', author: 'Dispatch assistant', text: 'Yes. The truck left at 14:10.' },
|
|
901
|
+
{ id: 'r3', author: 'Dana Reyes', text: 'Tell me when it docks.' },
|
|
902
|
+
];
|
|
903
|
+
|
|
904
|
+
const UNREAD = [
|
|
905
|
+
{ id: 'u1', author: 'Dispatch assistant', text: 'The truck docked at door 2 at 16:25.' },
|
|
906
|
+
{ id: 'u2', author: 'Dispatch assistant', text: 'Receiving counted 18 of 18 pallets.' },
|
|
907
|
+
];
|
|
908
|
+
|
|
909
|
+
export default function MessageScrollerUnreadExample() {
|
|
910
|
+
return (
|
|
911
|
+
<AspectRatio ratio="landscape">
|
|
912
|
+
<MessageScroller defaultPosition="start">
|
|
913
|
+
<MessageScrollerViewport>
|
|
914
|
+
<MessageScrollerContent>
|
|
915
|
+
{READ.map((row) => (
|
|
916
|
+
<MessageScrollerItem key={row.id} messageId={row.id}>
|
|
917
|
+
<Message>
|
|
918
|
+
<MessageBody>
|
|
919
|
+
<MessageHeader>
|
|
920
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
921
|
+
</MessageHeader>
|
|
922
|
+
<Bubble>
|
|
923
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
924
|
+
</Bubble>
|
|
925
|
+
</MessageBody>
|
|
926
|
+
</Message>
|
|
927
|
+
</MessageScrollerItem>
|
|
928
|
+
))}
|
|
929
|
+
|
|
930
|
+
<MessageScrollerItem>
|
|
931
|
+
<MessageScrollerUnread>2 new since 15:00</MessageScrollerUnread>
|
|
932
|
+
</MessageScrollerItem>
|
|
933
|
+
|
|
934
|
+
{UNREAD.map((row) => (
|
|
935
|
+
<MessageScrollerItem key={row.id} messageId={row.id}>
|
|
936
|
+
<Message>
|
|
937
|
+
<MessageBody>
|
|
938
|
+
<MessageHeader>
|
|
939
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
940
|
+
</MessageHeader>
|
|
941
|
+
<Bubble>
|
|
942
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
943
|
+
</Bubble>
|
|
944
|
+
</MessageBody>
|
|
945
|
+
</Message>
|
|
946
|
+
</MessageScrollerItem>
|
|
947
|
+
))}
|
|
948
|
+
</MessageScrollerContent>
|
|
949
|
+
</MessageScrollerViewport>
|
|
950
|
+
<MessageScrollerJump />
|
|
951
|
+
</MessageScroller>
|
|
952
|
+
</AspectRatio>
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
### Announcing a reply once
|
|
958
|
+
|
|
959
|
+
While busy the log holds its announcements back; the change is said once each way — Responding, then Response complete — never word by word.
|
|
960
|
+
|
|
961
|
+
Example
|
|
962
|
+
|
|
963
|
+
```tsx
|
|
964
|
+
import { useEffect, useState } from 'react';
|
|
965
|
+
|
|
966
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
967
|
+
import { Button } from '@slotted/react/button';
|
|
968
|
+
import {
|
|
969
|
+
Bubble,
|
|
970
|
+
BubbleCaret,
|
|
971
|
+
BubbleContent,
|
|
972
|
+
BubbleStream,
|
|
973
|
+
Message,
|
|
974
|
+
MessageAuthor,
|
|
975
|
+
MessageBody,
|
|
976
|
+
MessageHeader,
|
|
977
|
+
} from '@slotted/react/message';
|
|
978
|
+
import {
|
|
979
|
+
MessageScroller,
|
|
980
|
+
MessageScrollerContent,
|
|
981
|
+
MessageScrollerItem,
|
|
982
|
+
MessageScrollerJump,
|
|
983
|
+
MessageScrollerViewport,
|
|
984
|
+
} from '@slotted/react/message-scroller';
|
|
985
|
+
import { Stack } from '@slotted/react/stack';
|
|
986
|
+
import { Text } from '@slotted/react/typography';
|
|
987
|
+
|
|
988
|
+
const REPLY =
|
|
989
|
+
'Pallet P-7731 reached the Rotterdam hub at 19:48. The temperature log stayed between -19 and -18 degrees C for the whole trip, so no quality hold is needed.';
|
|
990
|
+
|
|
991
|
+
const ROWS = [
|
|
992
|
+
{
|
|
993
|
+
id: 'q1',
|
|
994
|
+
own: true,
|
|
995
|
+
author: 'Dana Reyes',
|
|
996
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
id: 'a1',
|
|
1000
|
+
own: false,
|
|
1001
|
+
author: 'Dispatch assistant',
|
|
1002
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
id: 'q2',
|
|
1006
|
+
own: true,
|
|
1007
|
+
author: 'Dana Reyes',
|
|
1008
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
id: 'a2',
|
|
1012
|
+
own: false,
|
|
1013
|
+
author: 'Dispatch assistant',
|
|
1014
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
1015
|
+
},
|
|
1016
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
1017
|
+
{
|
|
1018
|
+
id: 'a3',
|
|
1019
|
+
own: false,
|
|
1020
|
+
author: 'Dispatch assistant',
|
|
1021
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
id: 'q4',
|
|
1025
|
+
own: true,
|
|
1026
|
+
author: 'Dana Reyes',
|
|
1027
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
id: 'a4',
|
|
1031
|
+
own: false,
|
|
1032
|
+
author: 'Dispatch assistant',
|
|
1033
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
1034
|
+
},
|
|
1035
|
+
];
|
|
1036
|
+
|
|
1037
|
+
export default function MessageScrollerBusyExample() {
|
|
1038
|
+
const [length, setLength] = useState<number | null>(null);
|
|
1039
|
+
const streaming = length !== null && length < REPLY.length;
|
|
1040
|
+
|
|
1041
|
+
useEffect(() => {
|
|
1042
|
+
if (!streaming) return undefined;
|
|
1043
|
+
const timer = window.setTimeout(() => setLength((value) => (value ?? 0) + 8), 80);
|
|
1044
|
+
return () => window.clearTimeout(timer);
|
|
1045
|
+
}, [streaming, length]);
|
|
1046
|
+
|
|
1047
|
+
function handleStream() {
|
|
1048
|
+
setLength(8);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
return (
|
|
1052
|
+
<Stack gap={3}>
|
|
1053
|
+
<Button size="sm" disabled={streaming} onClick={handleStream}>
|
|
1054
|
+
Stream a reply
|
|
1055
|
+
</Button>
|
|
1056
|
+
|
|
1057
|
+
<Text size="sm" tone="muted">
|
|
1058
|
+
aria-busy on the log: {String(streaming)}
|
|
1059
|
+
</Text>
|
|
1060
|
+
|
|
1061
|
+
<AspectRatio ratio="square">
|
|
1062
|
+
<MessageScroller
|
|
1063
|
+
follow
|
|
1064
|
+
defaultPosition="end"
|
|
1065
|
+
busy={streaming}
|
|
1066
|
+
messages={{
|
|
1067
|
+
busy: 'The dispatch assistant is replying',
|
|
1068
|
+
idle: 'The dispatch assistant finished replying',
|
|
1069
|
+
label: 'Dispatch conversation',
|
|
1070
|
+
}}
|
|
1071
|
+
>
|
|
1072
|
+
<MessageScrollerViewport>
|
|
1073
|
+
<MessageScrollerContent>
|
|
1074
|
+
{ROWS.map((row) => (
|
|
1075
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
1076
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
1077
|
+
<MessageBody>
|
|
1078
|
+
<MessageHeader>
|
|
1079
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
1080
|
+
</MessageHeader>
|
|
1081
|
+
<Bubble>
|
|
1082
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
1083
|
+
</Bubble>
|
|
1084
|
+
</MessageBody>
|
|
1085
|
+
</Message>
|
|
1086
|
+
</MessageScrollerItem>
|
|
1087
|
+
))}
|
|
1088
|
+
{length === null ? null : (
|
|
1089
|
+
<MessageScrollerItem messageId="live">
|
|
1090
|
+
<Message status={streaming ? 'streaming' : undefined}>
|
|
1091
|
+
<MessageBody>
|
|
1092
|
+
<MessageHeader>
|
|
1093
|
+
<MessageAuthor>Dispatch assistant</MessageAuthor>
|
|
1094
|
+
</MessageHeader>
|
|
1095
|
+
<Bubble>
|
|
1096
|
+
<BubbleContent>
|
|
1097
|
+
<BubbleStream text={REPLY.slice(0, length)} />
|
|
1098
|
+
{streaming ? <BubbleCaret /> : null}
|
|
1099
|
+
</BubbleContent>
|
|
1100
|
+
</Bubble>
|
|
1101
|
+
</MessageBody>
|
|
1102
|
+
</Message>
|
|
1103
|
+
</MessageScrollerItem>
|
|
1104
|
+
)}
|
|
1105
|
+
</MessageScrollerContent>
|
|
1106
|
+
</MessageScrollerViewport>
|
|
1107
|
+
<MessageScrollerJump />
|
|
1108
|
+
</MessageScroller>
|
|
1109
|
+
</AspectRatio>
|
|
1110
|
+
</Stack>
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
### defaults.tsx
|
|
1116
|
+
|
|
1117
|
+
Example
|
|
1118
|
+
|
|
1119
|
+
```tsx
|
|
1120
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
1121
|
+
import {
|
|
1122
|
+
Bubble,
|
|
1123
|
+
BubbleContent,
|
|
1124
|
+
Message,
|
|
1125
|
+
MessageAuthor,
|
|
1126
|
+
MessageBody,
|
|
1127
|
+
MessageHeader,
|
|
1128
|
+
} from '@slotted/react/message';
|
|
1129
|
+
import {
|
|
1130
|
+
MessageScroller,
|
|
1131
|
+
MessageScrollerContent,
|
|
1132
|
+
MessageScrollerDefaultsProvider,
|
|
1133
|
+
MessageScrollerItem,
|
|
1134
|
+
MessageScrollerViewport,
|
|
1135
|
+
} from '@slotted/react/message-scroller';
|
|
1136
|
+
import { Stack } from '@slotted/react/stack';
|
|
1137
|
+
|
|
1138
|
+
const ROWS = [
|
|
1139
|
+
{
|
|
1140
|
+
id: 'q1',
|
|
1141
|
+
own: true,
|
|
1142
|
+
author: 'Dana Reyes',
|
|
1143
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
id: 'a1',
|
|
1147
|
+
own: false,
|
|
1148
|
+
author: 'Dispatch assistant',
|
|
1149
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
id: 'q2',
|
|
1153
|
+
own: true,
|
|
1154
|
+
author: 'Dana Reyes',
|
|
1155
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
id: 'a2',
|
|
1159
|
+
own: false,
|
|
1160
|
+
author: 'Dispatch assistant',
|
|
1161
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
1162
|
+
},
|
|
1163
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
1164
|
+
{
|
|
1165
|
+
id: 'a3',
|
|
1166
|
+
own: false,
|
|
1167
|
+
author: 'Dispatch assistant',
|
|
1168
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
id: 'q4',
|
|
1172
|
+
own: true,
|
|
1173
|
+
author: 'Dana Reyes',
|
|
1174
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
id: 'a4',
|
|
1178
|
+
own: false,
|
|
1179
|
+
author: 'Dispatch assistant',
|
|
1180
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
1181
|
+
},
|
|
1182
|
+
];
|
|
1183
|
+
|
|
1184
|
+
export default function MessageScrollerDefaultsExample() {
|
|
1185
|
+
return (
|
|
1186
|
+
<MessageScrollerDefaultsProvider defaultPosition="end">
|
|
1187
|
+
<Stack gap={3}>
|
|
1188
|
+
<AspectRatio ratio="landscape">
|
|
1189
|
+
<MessageScroller>
|
|
1190
|
+
<MessageScrollerViewport aria-label="Opens at the end">
|
|
1191
|
+
<MessageScrollerContent>
|
|
1192
|
+
{ROWS.map((row) => (
|
|
1193
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
1194
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
1195
|
+
<MessageBody>
|
|
1196
|
+
<MessageHeader>
|
|
1197
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
1198
|
+
</MessageHeader>
|
|
1199
|
+
<Bubble>
|
|
1200
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
1201
|
+
</Bubble>
|
|
1202
|
+
</MessageBody>
|
|
1203
|
+
</Message>
|
|
1204
|
+
</MessageScrollerItem>
|
|
1205
|
+
))}
|
|
1206
|
+
</MessageScrollerContent>
|
|
1207
|
+
</MessageScrollerViewport>
|
|
1208
|
+
</MessageScroller>
|
|
1209
|
+
</AspectRatio>
|
|
1210
|
+
|
|
1211
|
+
<AspectRatio ratio="landscape">
|
|
1212
|
+
<MessageScroller defaultPosition="start">
|
|
1213
|
+
<MessageScrollerViewport aria-label="Opens at the start">
|
|
1214
|
+
<MessageScrollerContent>
|
|
1215
|
+
{ROWS.map((row) => (
|
|
1216
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
1217
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
1218
|
+
<MessageBody>
|
|
1219
|
+
<MessageHeader>
|
|
1220
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
1221
|
+
</MessageHeader>
|
|
1222
|
+
<Bubble>
|
|
1223
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
1224
|
+
</Bubble>
|
|
1225
|
+
</MessageBody>
|
|
1226
|
+
</Message>
|
|
1227
|
+
</MessageScrollerItem>
|
|
1228
|
+
))}
|
|
1229
|
+
</MessageScrollerContent>
|
|
1230
|
+
</MessageScrollerViewport>
|
|
1231
|
+
</MessageScroller>
|
|
1232
|
+
</AspectRatio>
|
|
1233
|
+
</Stack>
|
|
1234
|
+
</MessageScrollerDefaultsProvider>
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
### position.tsx
|
|
1240
|
+
|
|
1241
|
+
Example
|
|
1242
|
+
|
|
1243
|
+
```tsx
|
|
1244
|
+
import { useState } from 'react';
|
|
1245
|
+
|
|
1246
|
+
import { AspectRatio } from '@slotted/react/aspect-ratio';
|
|
1247
|
+
import { Button } from '@slotted/react/button';
|
|
1248
|
+
import { Inline } from '@slotted/react/inline';
|
|
1249
|
+
import {
|
|
1250
|
+
Bubble,
|
|
1251
|
+
BubbleContent,
|
|
1252
|
+
Message,
|
|
1253
|
+
MessageAuthor,
|
|
1254
|
+
MessageBody,
|
|
1255
|
+
MessageHeader,
|
|
1256
|
+
} from '@slotted/react/message';
|
|
1257
|
+
import {
|
|
1258
|
+
MessageScroller,
|
|
1259
|
+
MessageScrollerContent,
|
|
1260
|
+
MessageScrollerItem,
|
|
1261
|
+
MessageScrollerJump,
|
|
1262
|
+
MessageScrollerViewport,
|
|
1263
|
+
} from '@slotted/react/message-scroller';
|
|
1264
|
+
import type { MessageScrollerPosition } from '@slotted/react/message-scroller';
|
|
1265
|
+
import { Stack } from '@slotted/react/stack';
|
|
1266
|
+
|
|
1267
|
+
const POSITIONS: MessageScrollerPosition[] = ['start', 'end', 'last-anchor'];
|
|
1268
|
+
|
|
1269
|
+
const ROWS = [
|
|
1270
|
+
{
|
|
1271
|
+
id: 'q1',
|
|
1272
|
+
own: true,
|
|
1273
|
+
author: 'Dana Reyes',
|
|
1274
|
+
text: 'Which carrier missed the 17:30 pickup at the Rotterdam dock?',
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
id: 'a1',
|
|
1278
|
+
own: false,
|
|
1279
|
+
author: 'Dispatch assistant',
|
|
1280
|
+
text: 'Harbor Freight. Three pallets for order NW-20418 were still on the dock at 17:42.',
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
id: 'q2',
|
|
1284
|
+
own: true,
|
|
1285
|
+
author: 'Dana Reyes',
|
|
1286
|
+
text: 'Is the cold-chain pallet part of that group?',
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
id: 'a2',
|
|
1290
|
+
own: false,
|
|
1291
|
+
author: 'Dispatch assistant',
|
|
1292
|
+
text: 'Yes. Pallet P-7731 holds frozen goods and left the cold room at 16:55, so it has 90 minutes of margin.',
|
|
1293
|
+
},
|
|
1294
|
+
{ id: 'q3', own: true, author: 'Dana Reyes', text: 'Rebook it on the 19:00 truck.' },
|
|
1295
|
+
{
|
|
1296
|
+
id: 'a3',
|
|
1297
|
+
own: false,
|
|
1298
|
+
author: 'Dispatch assistant',
|
|
1299
|
+
text: 'Booked on the 19:00 truck under reference BK-5509. The carrier confirmed by email at 18:12.',
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
id: 'q4',
|
|
1303
|
+
own: true,
|
|
1304
|
+
author: 'Dana Reyes',
|
|
1305
|
+
text: 'Tell the customer the delivery moves to tomorrow.',
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
id: 'a4',
|
|
1309
|
+
own: false,
|
|
1310
|
+
author: 'Dispatch assistant',
|
|
1311
|
+
text: 'Alder Market was notified at 18:15. The new delivery window is 09:00 to 11:00.',
|
|
1312
|
+
},
|
|
1313
|
+
];
|
|
1314
|
+
|
|
1315
|
+
export default function MessageScrollerPositionExample() {
|
|
1316
|
+
const [position, setPosition] = useState<MessageScrollerPosition>('last-anchor');
|
|
1317
|
+
|
|
1318
|
+
return (
|
|
1319
|
+
<Stack gap={3}>
|
|
1320
|
+
<Inline gap={2}>
|
|
1321
|
+
{POSITIONS.map((value) => (
|
|
1322
|
+
<Button
|
|
1323
|
+
key={value}
|
|
1324
|
+
size="sm"
|
|
1325
|
+
variant={value === position ? 'solid' : 'outline'}
|
|
1326
|
+
onClick={() => setPosition(value)}
|
|
1327
|
+
>
|
|
1328
|
+
{value}
|
|
1329
|
+
</Button>
|
|
1330
|
+
))}
|
|
1331
|
+
</Inline>
|
|
1332
|
+
|
|
1333
|
+
<AspectRatio ratio="square">
|
|
1334
|
+
<MessageScroller key={position} defaultPosition={position}>
|
|
1335
|
+
<MessageScrollerViewport>
|
|
1336
|
+
<MessageScrollerContent>
|
|
1337
|
+
{ROWS.map((row) => (
|
|
1338
|
+
<MessageScrollerItem key={row.id} messageId={row.id} anchor={row.own}>
|
|
1339
|
+
<Message align={row.own ? 'end' : 'start'}>
|
|
1340
|
+
<MessageBody>
|
|
1341
|
+
<MessageHeader>
|
|
1342
|
+
<MessageAuthor>{row.author}</MessageAuthor>
|
|
1343
|
+
</MessageHeader>
|
|
1344
|
+
<Bubble>
|
|
1345
|
+
<BubbleContent>{row.text}</BubbleContent>
|
|
1346
|
+
</Bubble>
|
|
1347
|
+
</MessageBody>
|
|
1348
|
+
</Message>
|
|
1349
|
+
</MessageScrollerItem>
|
|
1350
|
+
))}
|
|
1351
|
+
</MessageScrollerContent>
|
|
1352
|
+
</MessageScrollerViewport>
|
|
1353
|
+
<MessageScrollerJump />
|
|
1354
|
+
</MessageScroller>
|
|
1355
|
+
</AspectRatio>
|
|
1356
|
+
</Stack>
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
```
|