@flamingo-stack/openframe-frontend-core 0.0.825 → 0.0.826
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/build/export-map.json +1 -1
- package/dist/{case-study-card-IZBMHA6R.cjs → case-study-card-O4IQCJAX.cjs} +5 -5
- package/dist/{chunk-QOAA7ZHB.cjs → chunk-2HQNXX2K.cjs} +2 -2
- package/dist/{chunk-2U7GXE3T.cjs → chunk-2TQJSB62.cjs} +2157 -811
- package/dist/{chunk-NONMZ5WJ.cjs → chunk-2VLPXUQK.cjs} +14 -83
- package/dist/{chunk-7DJWIVQC.cjs → chunk-37OYBX7W.cjs} +36 -36
- package/dist/{chunk-OBQ5WUNG.cjs → chunk-3B6ZE4EZ.cjs} +29 -29
- package/dist/{chunk-AO6YVNAH.cjs → chunk-5AQKXEMI.cjs} +979 -1357
- package/dist/{chunk-25HBH4J6.cjs → chunk-5BM7X4GA.cjs} +2 -2
- package/dist/{chunk-47SHKOCY.cjs → chunk-63T2KKDZ.cjs} +86 -86
- package/dist/{chunk-MHR4C465.cjs → chunk-6G4WRMEM.cjs} +3 -3
- package/dist/{chunk-AUBR3FGY.cjs → chunk-74GWFGH2.cjs} +28 -28
- package/dist/{chunk-467T3LCG.cjs → chunk-7PZQ7SHB.cjs} +49 -32
- package/dist/{chunk-6LVJKPR3.cjs → chunk-AJM4YZTW.cjs} +8 -8
- package/dist/{chunk-2XLPRW7V.cjs → chunk-BIG3O33P.cjs} +6 -2
- package/dist/chunk-BMQLM2NU.cjs +40 -0
- package/dist/{chunk-DVHSYPDB.cjs → chunk-DAKGX2WF.cjs} +2 -2
- package/dist/{chunk-2IWAHBCC.cjs → chunk-DRSFR5AC.cjs} +159 -159
- package/dist/{chunk-IJCSQFLD.cjs → chunk-DU6AF77X.cjs} +83 -121
- package/dist/{chunk-NL34HKLS.cjs → chunk-EJNDTSKY.cjs} +91 -91
- package/dist/{chunk-SBFBNOKU.cjs → chunk-ENMPSEEQ.cjs} +4 -4
- package/dist/{chunk-ZECG6GU5.cjs → chunk-F2J5WN6U.cjs} +2 -2
- package/dist/{chunk-BOS7OIC4.cjs → chunk-GRHF5SWL.cjs} +5 -2
- package/dist/{chunk-Z7BLMJEI.cjs → chunk-GZAPOCKS.cjs} +54 -54
- package/dist/{chunk-5S2GW6YG.cjs → chunk-HJAPXKWK.cjs} +17 -17
- package/dist/{chunk-P25RVNGX.cjs → chunk-HQ4FKHOO.cjs} +249 -108
- package/dist/{chunk-ZRDVFADQ.cjs → chunk-IBD2FPSX.cjs} +75 -9
- package/dist/{chunk-T266OITJ.cjs → chunk-IKWQW3YJ.cjs} +45 -45
- package/dist/{chunk-B7NSH7IK.cjs → chunk-IWQ2LJGW.cjs} +5 -5
- package/dist/{chunk-MALCUN2G.cjs → chunk-JDR72QFU.cjs} +12 -14
- package/dist/{chunk-EHANO6UE.cjs → chunk-K34TTZAE.cjs} +9 -129
- package/dist/{chunk-QDDBOCG3.cjs → chunk-KPGKTEEB.cjs} +2 -2
- package/dist/{chunk-4IY5FKYL.cjs → chunk-MDEOCOIE.cjs} +23 -23
- package/dist/chunk-OEP5KAT6.cjs +56 -0
- package/dist/chunk-OT6P57ZS.cjs +94 -0
- package/dist/{chunk-QQT23JJ7.cjs → chunk-PBHP3FHO.cjs} +4 -4
- package/dist/{chunk-IMMTH3F3.cjs → chunk-PJY3SYCS.cjs} +29 -27
- package/dist/{chunk-N7IDLF2G.cjs → chunk-PWAKRRRO.cjs} +1283 -268
- package/dist/{chunk-UEULXVW2.cjs → chunk-QS6AKUUL.cjs} +22 -22
- package/dist/{chunk-BN7QENV7.cjs → chunk-QYJZDEG7.cjs} +6 -6
- package/dist/{chunk-NPNZAAOB.cjs → chunk-S6UJEW4G.cjs} +2 -2
- package/dist/{chunk-XJMLZ63Y.cjs → chunk-TJG2BJ5J.cjs} +4 -4
- package/dist/{chunk-QOOMUGF2.cjs → chunk-TYJ73DHW.cjs} +15 -15
- package/dist/{chunk-A34UNP5V.cjs → chunk-W4VEDSAX.cjs} +80 -11
- package/dist/{chunk-DNZCSPMU.cjs → chunk-WGMU45NV.cjs} +20 -20
- package/dist/{chunk-APTFXX2C.cjs → chunk-XDHQC4XH.cjs} +46 -46
- package/dist/{cloud-tenants-M4VFFN33.cjs → cloud-tenants-F67KQ5GC.cjs} +108 -106
- package/dist/components/case-studies/index.cjs +124 -122
- package/dist/components/chat/approval-batch-message.d.ts.map +1 -1
- package/dist/components/chat/approval-batch-message.js +2 -2
- package/dist/components/chat/chat-archive-page.d.ts +7 -0
- package/dist/components/chat/chat-archive-page.d.ts.map +1 -1
- package/dist/components/chat/chat-archive-page.js +9 -0
- package/dist/components/chat/chat-composer.d.ts +24 -4
- package/dist/components/chat/chat-composer.d.ts.map +1 -1
- package/dist/components/chat/chat-composer.js +90 -48
- package/dist/components/chat/chat-context-memory-bar.d.ts +4 -1
- package/dist/components/chat/chat-context-memory-bar.d.ts.map +1 -1
- package/dist/components/chat/chat-context-memory-bar.js +8 -5
- package/dist/components/chat/chat-context-picker.d.ts +8 -1
- package/dist/components/chat/chat-context-picker.d.ts.map +1 -1
- package/dist/components/chat/chat-context-picker.js +32 -9
- package/dist/components/chat/chat-header-rename-field.d.ts +18 -0
- package/dist/components/chat/chat-header-rename-field.d.ts.map +1 -0
- package/dist/components/chat/chat-header-rename-field.js +49 -0
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-input.js +5 -0
- package/dist/components/chat/composer-sheet.d.ts +44 -0
- package/dist/components/chat/composer-sheet.d.ts.map +1 -0
- package/dist/components/chat/composer-sheet.js +140 -0
- package/dist/components/chat/embeddable-chat.d.ts +114 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +328 -215
- package/dist/components/chat/index.cjs +118 -103
- package/dist/components/chat/index.d.ts +6 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +9 -0
- package/dist/components/chat/mingo-chat-day-groups.d.ts +18 -0
- package/dist/components/chat/mingo-chat-day-groups.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-day-groups.js +45 -0
- package/dist/components/chat/mingo-chat-header.d.ts +34 -6
- package/dist/components/chat/mingo-chat-header.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-header.js +44 -7
- package/dist/components/chat/mingo-chat-history-section.d.ts +30 -0
- package/dist/components/chat/mingo-chat-history-section.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-history-section.js +500 -0
- package/dist/components/chat/mingo-chat-history.d.ts +5 -2
- package/dist/components/chat/mingo-chat-history.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-history.js +26 -30
- package/dist/components/chat/mingo-chat-list-shared.d.ts +136 -0
- package/dist/components/chat/mingo-chat-list-shared.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-list-shared.js +76 -0
- package/dist/components/chat/mingo-chat-rail.d.ts +19 -51
- package/dist/components/chat/mingo-chat-rail.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-rail.js +23 -45
- package/dist/components/chat/mingo-edge-light.d.ts +13 -0
- package/dist/components/chat/mingo-edge-light.d.ts.map +1 -0
- package/dist/components/chat/mingo-edge-light.js +17 -0
- package/dist/components/chat/mingo-history-rail.d.ts +5 -4
- package/dist/components/chat/mingo-history-rail.d.ts.map +1 -1
- package/dist/components/chat/mingo-history-rail.js +5 -10
- package/dist/components/chat/mingo-quick-action-wall.d.ts +27 -0
- package/dist/components/chat/mingo-quick-action-wall.d.ts.map +1 -0
- package/dist/components/chat/mingo-quick-action-wall.js +41 -0
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/chat/mingo-welcome.js +6 -20
- package/dist/components/chat/model-display.d.ts.map +1 -1
- package/dist/components/chat/model-display.js +38 -9
- package/dist/components/chat/tool-execution-display.d.ts.map +1 -1
- package/dist/components/chat/tool-execution-display.js +15 -1
- package/dist/components/chat/types/component.types.d.ts +13 -1
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-day-label.d.ts +8 -0
- package/dist/components/chat/utils/chat-day-label.d.ts.map +1 -0
- package/dist/components/chat/utils/chat-day-label.js +21 -0
- package/dist/components/contact/index.cjs +109 -107
- package/dist/components/docs/index.cjs +112 -110
- package/dist/components/embeds/index.cjs +109 -107
- package/dist/components/faq/index.cjs +110 -108
- package/dist/components/features/board/board-column.d.ts +3 -1
- package/dist/components/features/board/board-column.d.ts.map +1 -1
- package/dist/components/features/board/board-column.js +6 -2
- package/dist/components/features/board/board.d.ts +6 -0
- package/dist/components/features/board/board.d.ts.map +1 -1
- package/dist/components/features/board/board.js +14 -3
- package/dist/components/features/board/touch-board.d.ts +1 -1
- package/dist/components/features/board/touch-board.d.ts.map +1 -1
- package/dist/components/features/board/touch-board.js +3 -1
- package/dist/components/features/index.cjs +108 -106
- package/dist/components/features/notifications/approval-request-notification-tile.d.ts +7 -1
- package/dist/components/features/notifications/approval-request-notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/approval-request-notification-tile.js +1 -1
- package/dist/components/features/notifications/notification-drawer.d.ts +6 -1
- package/dist/components/features/notifications/notification-drawer.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-drawer.js +3 -2
- package/dist/components/features/notifications/notification-tile.d.ts +4 -1
- package/dist/components/features/notifications/notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-tile.js +9 -7
- package/dist/components/features/time-tracker/time-tracker-header-button.d.ts +18 -1
- package/dist/components/features/time-tracker/time-tracker-header-button.d.ts.map +1 -1
- package/dist/components/features/time-tracker/time-tracker-header-button.js +31 -7
- package/dist/components/help-center-pages/index.cjs +217 -215
- package/dist/components/icons-v2-generated/icon-loaders.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/icon-loaders.js +1 -0
- package/dist/components/icons-v2-generated/icon-names.js +1 -1
- package/dist/components/icons-v2-generated/index.cjs +90 -86
- package/dist/components/icons-v2-generated/loaders/dots-loader-icon.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/loaders/dots-loader-icon.js +21 -24
- package/dist/components/icons-v2-generated/logos/index.d.ts +1 -0
- package/dist/components/icons-v2-generated/logos/index.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/logos/index.js +2 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.d.ts +9 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.d.ts.map +1 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.js +36 -0
- package/dist/components/index.cjs +215 -182
- package/dist/components/meeting-scheduler/index.cjs +182 -180
- package/dist/components/navigation/account-popover.d.ts +62 -0
- package/dist/components/navigation/account-popover.d.ts.map +1 -0
- package/dist/components/navigation/account-popover.js +138 -0
- package/dist/components/navigation/app-header.d.ts +36 -2
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/app-header.js +28 -24
- package/dist/components/navigation/app-layout-context.d.ts +17 -0
- package/dist/components/navigation/app-layout-context.d.ts.map +1 -1
- package/dist/components/navigation/app-layout-context.js +9 -1
- package/dist/components/navigation/app-layout.d.ts +93 -1
- package/dist/components/navigation/app-layout.d.ts.map +1 -1
- package/dist/components/navigation/app-layout.js +149 -30
- package/dist/components/navigation/header-button.d.ts +11 -1
- package/dist/components/navigation/header-button.d.ts.map +1 -1
- package/dist/components/navigation/header-button.js +16 -5
- package/dist/components/navigation/header-mingo-button.d.ts.map +1 -1
- package/dist/components/navigation/header-mingo-button.js +6 -5
- package/dist/components/navigation/index.cjs +120 -109
- package/dist/components/navigation/index.d.ts +10 -1
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +8 -0
- package/dist/components/navigation/mingo-ai-button.d.ts.map +1 -1
- package/dist/components/navigation/mingo-ai-button.js +2 -1
- package/dist/components/navigation/mobile-burger-menu.d.ts.map +1 -1
- package/dist/components/navigation/mobile-burger-menu.js +155 -39
- package/dist/components/navigation/navigation-sidebar-grouped.d.ts +57 -0
- package/dist/components/navigation/navigation-sidebar-grouped.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-grouped.js +365 -0
- package/dist/components/navigation/navigation-sidebar-match.d.ts +37 -0
- package/dist/components/navigation/navigation-sidebar-match.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-match.js +85 -0
- package/dist/components/navigation/navigation-sidebar-slot.d.ts +7 -0
- package/dist/components/navigation/navigation-sidebar-slot.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-slot.js +11 -0
- package/dist/components/navigation/navigation-sidebar-toggle.d.ts +7 -1
- package/dist/components/navigation/navigation-sidebar-toggle.d.ts.map +1 -1
- package/dist/components/navigation/navigation-sidebar-toggle.js +52 -23
- package/dist/components/navigation/navigation-sidebar.d.ts +13 -1
- package/dist/components/navigation/navigation-sidebar.d.ts.map +1 -1
- package/dist/components/navigation/navigation-sidebar.js +188 -52
- package/dist/components/navigation/notifications-bell-button.d.ts +28 -0
- package/dist/components/navigation/notifications-bell-button.d.ts.map +1 -0
- package/dist/components/navigation/notifications-bell-button.js +44 -0
- package/dist/components/navigation/ticket-alerts-button.d.ts +7 -1
- package/dist/components/navigation/ticket-alerts-button.d.ts.map +1 -1
- package/dist/components/navigation/ticket-alerts-button.js +3 -2
- package/dist/components/onboarding-guides/index.cjs +111 -109
- package/dist/components/product-demo/index.cjs +119 -117
- package/dist/components/related-content/index.cjs +13 -13
- package/dist/components/tickets/index.cjs +115 -113
- package/dist/components/ui/actions-menu.d.ts +6 -1
- package/dist/components/ui/actions-menu.d.ts.map +1 -1
- package/dist/components/ui/actions-menu.js +6 -2
- package/dist/components/ui/fade-preview.d.ts +8 -0
- package/dist/components/ui/fade-preview.d.ts.map +1 -1
- package/dist/components/ui/fade-preview.js +7 -5
- package/dist/components/ui/index.cjs +136 -111
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/mobile-action-bar.d.ts +14 -0
- package/dist/components/ui/mobile-action-bar.d.ts.map +1 -0
- package/dist/components/ui/mobile-action-bar.js +68 -0
- package/dist/components/ui/no-data/no-data-styles.d.ts +1 -1
- package/dist/components/ui/no-data/no-data-styles.d.ts.map +1 -1
- package/dist/components/ui/no-data/no-data-styles.js +1 -1
- package/dist/components/ui/page-actions.d.ts.map +1 -1
- package/dist/components/ui/page-actions.js +24 -8
- package/dist/components/ui/panel-resize-handle.d.ts +6 -2
- package/dist/components/ui/panel-resize-handle.d.ts.map +1 -1
- package/dist/components/ui/panel-resize-handle.js +6 -3
- package/dist/components/ui/square-avatar.d.ts.map +1 -1
- package/dist/components/ui/square-avatar.js +5 -2
- package/dist/{devices-DW5NDXMD.cjs → devices-SJORCARH.cjs} +109 -107
- package/dist/dots-loader-icon-5JXWD6FB.cjs +7 -0
- package/dist/{embeddable-chat-NBJMXEXB.cjs → embeddable-chat-7Z4CEZJL.cjs} +513 -398
- package/dist/hooks/index.cjs +15 -16
- package/dist/hooks/ui/use-content-breakpoint.d.ts +4 -2
- package/dist/hooks/ui/use-content-breakpoint.d.ts.map +1 -1
- package/dist/{icon-loaders-OLGJZGRP.cjs → icon-loaders-SUPEKMBJ.cjs} +2 -1
- package/dist/index.cjs +154 -121
- package/dist/{knowledge-EYJG2TNW.cjs → knowledge-QXILUVEM.cjs} +109 -107
- package/dist/{logs-2LV7DTSL.cjs → logs-E3KQQQD6.cjs} +118 -115
- package/dist/mingo-logo-icon-WGPBSDTF.cjs +7 -0
- package/dist/{policies-HSDYIQBX.cjs → policies-IOYQY6TF.cjs} +112 -110
- package/dist/{remote-session-BQMTIQTU.cjs → remote-session-QGFG5WAL.cjs} +99 -97
- package/dist/{scripts-UI6V7ANQ.cjs → scripts-E5TWWUNP.cjs} +115 -113
- package/dist/{software-update-WMLY7VHH.cjs → software-update-QZGYG4TD.cjs} +112 -110
- package/dist/{tickets-board-TRXOX77R.cjs → tickets-board-KCH6ITUV.cjs} +95 -94
- package/dist/types/navigation.d.ts +131 -0
- package/dist/types/navigation.d.ts.map +1 -1
- package/dist/utils/index.cjs +65 -25
- package/package.json +1 -1
- package/src/components/chat/approval-batch-message.tsx +3 -2
- package/src/components/chat/chat-archive-page.tsx +16 -0
- package/src/components/chat/chat-composer.tsx +131 -61
- package/src/components/chat/chat-context-memory-bar.tsx +27 -17
- package/src/components/chat/chat-context-picker.tsx +45 -11
- package/src/components/chat/chat-header-rename-field.tsx +68 -0
- package/src/components/chat/chat-input.tsx +9 -1
- package/src/components/chat/composer-sheet.tsx +196 -0
- package/src/components/chat/embeddable-chat.tsx +636 -319
- package/src/components/chat/index.ts +6 -0
- package/src/components/chat/mingo-chat-day-groups.ts +62 -0
- package/src/components/chat/mingo-chat-header.tsx +99 -23
- package/src/components/chat/mingo-chat-history-section.tsx +670 -0
- package/src/components/chat/mingo-chat-history.tsx +31 -45
- package/src/components/chat/mingo-chat-list-shared.tsx +244 -0
- package/src/components/chat/mingo-chat-rail.tsx +45 -97
- package/src/components/chat/mingo-edge-light.tsx +25 -0
- package/src/components/chat/mingo-history-rail.tsx +7 -17
- package/src/components/chat/mingo-quick-action-wall.tsx +64 -0
- package/src/components/chat/mingo-welcome.tsx +5 -19
- package/src/components/chat/model-display.tsx +66 -14
- package/src/components/chat/tool-execution-display.tsx +9 -1
- package/src/components/chat/types/component.types.ts +13 -1
- package/src/components/chat/utils/chat-day-label.ts +24 -0
- package/src/components/features/board/board-column.tsx +8 -0
- package/src/components/features/board/board.tsx +16 -2
- package/src/components/features/board/touch-board.tsx +2 -0
- package/src/components/features/notifications/approval-request-notification-tile.tsx +8 -2
- package/src/components/features/notifications/notification-drawer.tsx +7 -1
- package/src/components/features/notifications/notification-tile.tsx +17 -9
- package/src/components/features/time-tracker/time-tracker-header-button.tsx +53 -6
- package/src/components/icons-v2/icon-colors.json +4 -0
- package/src/components/icons-v2-generated/icon-loaders.ts +1 -0
- package/src/components/icons-v2-generated/icon-names.ts +1 -1
- package/src/components/icons-v2-generated/loaders/dots-loader-icon.tsx +18 -27
- package/src/components/icons-v2-generated/logos/index.ts +1 -0
- package/src/components/icons-v2-generated/logos/mingo-logo-icon.tsx +35 -0
- package/src/components/navigation/account-popover.tsx +198 -0
- package/src/components/navigation/app-header.tsx +74 -33
- package/src/components/navigation/app-layout-context.ts +22 -0
- package/src/components/navigation/app-layout.tsx +290 -24
- package/src/components/navigation/header-button.tsx +27 -5
- package/src/components/navigation/header-mingo-button.tsx +6 -5
- package/src/components/navigation/index.ts +19 -0
- package/src/components/navigation/mingo-ai-button.tsx +2 -3
- package/src/components/navigation/mobile-burger-menu.tsx +219 -53
- package/src/components/navigation/navigation-sidebar-grouped.tsx +554 -0
- package/src/components/navigation/navigation-sidebar-match.ts +152 -0
- package/src/components/navigation/navigation-sidebar-slot.ts +12 -0
- package/src/components/navigation/navigation-sidebar-toggle.tsx +39 -6
- package/src/components/navigation/navigation-sidebar.tsx +278 -61
- package/src/components/navigation/notifications-bell-button.tsx +70 -0
- package/src/components/navigation/ticket-alerts-button.tsx +9 -2
- package/src/components/ui/actions-menu.tsx +19 -3
- package/src/components/ui/fade-preview.tsx +13 -6
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/mobile-action-bar.ts +87 -0
- package/src/components/ui/no-data/no-data-styles.ts +5 -2
- package/src/components/ui/page-actions.tsx +38 -11
- package/src/components/ui/panel-resize-handle.tsx +14 -5
- package/src/components/ui/square-avatar.tsx +5 -2
- package/src/hooks/ui/use-content-breakpoint.ts +4 -2
- package/src/styles/ods-interaction-states.css +68 -0
- package/src/types/navigation.ts +140 -0
- package/dist/chunk-C7GIHB3V.cjs +0 -59
- package/dist/dots-loader-icon-RBLX46X7.cjs +0 -7
- package/dist/{chunk-ZOZR3QI2.cjs → chunk-46547WQW.cjs} +0 -0
- package/dist/{video-file-player-IAMWBKEQ.cjs → video-file-player-IHO66P2Q.cjs} +1 -1
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
4
|
+
import { type ReactNode, useEffect, useId, useRef, useState } from 'react';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { useDebounce } from '../../hooks/ui/use-debounce';
|
|
7
|
+
import { useVisitorOs } from '../../hooks/ui/use-visitor-os';
|
|
8
|
+
import { cn } from '../../utils/cn';
|
|
9
|
+
import { shortcutLabel, usesCommandKey } from '../../utils/visitor-os';
|
|
10
|
+
import {
|
|
11
|
+
ChatsIcon,
|
|
12
|
+
Ellipsis01Icon,
|
|
13
|
+
Filter01Icon,
|
|
14
|
+
MessagesIcon,
|
|
15
|
+
QuestionCircleIcon,
|
|
16
|
+
SearchIcon,
|
|
17
|
+
SearchXmarkIcon,
|
|
18
|
+
} from '../icons-v2-generated';
|
|
19
|
+
import { LoadingRegion } from '../loading/loading-region';
|
|
20
|
+
import { UnifiedSkeleton } from '../loading/unified-skeleton';
|
|
21
|
+
import { ActionsMenuDropdown, type ActionsMenuItem } from '../ui/actions-menu';
|
|
22
|
+
import { Button } from '../ui/button';
|
|
23
|
+
import { useLoadingScope } from '../ui/loading-scope';
|
|
24
|
+
import { ModalV2, ModalV2Header, ModalV2Title } from '../ui/modal-v2';
|
|
25
|
+
import { SearchInput } from '../ui/search-input';
|
|
26
|
+
import { SquareAvatar } from '../ui/square-avatar';
|
|
27
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
|
28
|
+
import { chatDialogMenuItems, chatMenuIconClassName } from './chat-dialog-menu-items';
|
|
29
|
+
import { ChatListEmptyState } from './chat-list-empty-state';
|
|
30
|
+
import { ChatListItem } from './chat-nav-sidebar';
|
|
31
|
+
import { groupDialogsByDay } from './mingo-chat-day-groups';
|
|
32
|
+
import {
|
|
33
|
+
ChatListLoadError,
|
|
34
|
+
dialogOwnedByOther,
|
|
35
|
+
MINGO_DIALOG_STATUS_GLYPHS,
|
|
36
|
+
type MingoChatListProps,
|
|
37
|
+
type MingoDialogStatus,
|
|
38
|
+
mingoDialogStatusOf,
|
|
39
|
+
useLoadMoreSentinel,
|
|
40
|
+
} from './mingo-chat-list-shared';
|
|
41
|
+
import type { DialogItem } from './types/component.types';
|
|
42
|
+
|
|
43
|
+
/** A row of the section before the backend has named the chat. */
|
|
44
|
+
const UNTITLED = 'New Chat';
|
|
45
|
+
|
|
46
|
+
/** The caption's icon buttons: plain glyphs that turn white on hover, no hover wash. */
|
|
47
|
+
const ICON_BUTTON_CLASS =
|
|
48
|
+
'size-6 p-0 text-ods-text-secondary transition-colors hover:bg-transparent hover:text-ods-text-primary active:bg-transparent md:size-6';
|
|
49
|
+
|
|
50
|
+
/** Title widths for the placeholder rows: a list of titles, not a column of bars. */
|
|
51
|
+
const SKELETON_TITLE_WIDTHS = ['w-4/5', 'w-3/5', 'w-11/12', 'w-2/3', 'w-3/4', 'w-1/2'];
|
|
52
|
+
|
|
53
|
+
/** Placeholder chat rows in the `ChatListItem` geometry: 40px, an 18px title. */
|
|
54
|
+
function SkeletonRows({ count, offset = 0 }: { count: number; offset?: number }) {
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
{Array.from({ length: count }, (_, i) => (
|
|
58
|
+
<div key={i} className="flex h-10 shrink-0 items-center px-[var(--spacing-system-xs)]" aria-hidden>
|
|
59
|
+
<UnifiedSkeleton
|
|
60
|
+
className={cn('h-4 rounded', SKELETON_TITLE_WIDTHS[(i + offset) % SKELETON_TITLE_WIDTHS.length])}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
))}
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The first load: two days of chats, each with its label. */
|
|
69
|
+
function HistorySkeleton() {
|
|
70
|
+
return (
|
|
71
|
+
<LoadingRegion label="Loading chats" className="flex flex-col gap-[var(--spacing-system-xs)]">
|
|
72
|
+
{[5, 4].map((rows, group) => (
|
|
73
|
+
<div key={rows} className="flex flex-col">
|
|
74
|
+
<div className="flex h-7 items-center px-[var(--spacing-system-xs)]" aria-hidden>
|
|
75
|
+
<UnifiedSkeleton className="h-3.5 w-16 rounded" />
|
|
76
|
+
</div>
|
|
77
|
+
<SkeletonRows count={rows} offset={group * 2} />
|
|
78
|
+
</div>
|
|
79
|
+
))}
|
|
80
|
+
</LoadingRegion>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface HistoryListProps extends Pick<
|
|
85
|
+
MingoChatListProps,
|
|
86
|
+
| 'dialogs'
|
|
87
|
+
| 'activeDialogId'
|
|
88
|
+
| 'draftTitle'
|
|
89
|
+
| 'statusOf'
|
|
90
|
+
| 'ownedByOther'
|
|
91
|
+
| 'currentUserId'
|
|
92
|
+
| 'hasMore'
|
|
93
|
+
| 'isLoadingMore'
|
|
94
|
+
| 'onLoadMore'
|
|
95
|
+
| 'isLoadingHistory'
|
|
96
|
+
| 'loadError'
|
|
97
|
+
| 'onRetry'
|
|
98
|
+
> {
|
|
99
|
+
onSelect?: (id: string) => void;
|
|
100
|
+
/** How the next page loads (`MingoChatListProps.loadMore`). Default `'scroll'`. */
|
|
101
|
+
loadMore?: 'scroll' | 'button';
|
|
102
|
+
/** Each row's ⋯ (Rename, Copy link, Compact, Archive); none in the search results. */
|
|
103
|
+
menuFor?: (dialog: DialogItem) => ActionsMenuItem[];
|
|
104
|
+
hasSearch: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** The chats grouped by day, or what stands in for them: loading, empty, failed. */
|
|
108
|
+
function HistoryList({
|
|
109
|
+
dialogs,
|
|
110
|
+
activeDialogId,
|
|
111
|
+
draftTitle,
|
|
112
|
+
statusOf,
|
|
113
|
+
ownedByOther,
|
|
114
|
+
currentUserId,
|
|
115
|
+
hasMore = false,
|
|
116
|
+
isLoadingMore = false,
|
|
117
|
+
onLoadMore,
|
|
118
|
+
isLoadingHistory = false,
|
|
119
|
+
loadError = false,
|
|
120
|
+
onRetry,
|
|
121
|
+
onSelect,
|
|
122
|
+
loadMore = 'scroll',
|
|
123
|
+
menuFor,
|
|
124
|
+
hasSearch,
|
|
125
|
+
}: HistoryListProps) {
|
|
126
|
+
// The viewport root: whatever scrolls the list (the sidebar body, the search
|
|
127
|
+
// modal) clips the sentinel, and the viewport sees nothing in a closed drawer
|
|
128
|
+
// or a collapsed rail.
|
|
129
|
+
const onScroll = loadMore === 'scroll';
|
|
130
|
+
const sentinelRef = useLoadMoreSentinel({
|
|
131
|
+
hasMore: hasMore && onScroll,
|
|
132
|
+
isLoadingMore,
|
|
133
|
+
onLoadMore,
|
|
134
|
+
itemCount: dialogs.length,
|
|
135
|
+
});
|
|
136
|
+
// The page's loading state draws the list's own, as the first page loading does.
|
|
137
|
+
const loading = useLoadingScope() || isLoadingHistory;
|
|
138
|
+
|
|
139
|
+
if (loadError) {
|
|
140
|
+
return <ChatListLoadError onRetry={onRetry} className="justify-center p-[var(--spacing-system-l)]" />;
|
|
141
|
+
}
|
|
142
|
+
if (loading) return <HistorySkeleton />;
|
|
143
|
+
if (dialogs.length === 0 && !draftTitle) {
|
|
144
|
+
return hasSearch ? (
|
|
145
|
+
<ChatListEmptyState
|
|
146
|
+
icon={<SearchXmarkIcon size={24} />}
|
|
147
|
+
title="No chats found"
|
|
148
|
+
description="Try another search term"
|
|
149
|
+
/>
|
|
150
|
+
) : (
|
|
151
|
+
<ChatListEmptyState
|
|
152
|
+
icon={<ChatsIcon size={24} />}
|
|
153
|
+
title="No Current Chats"
|
|
154
|
+
description="Previous Mingo sessions will show here"
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const groups = groupDialogsByDay(dialogs);
|
|
160
|
+
// The chat being started is today's, on top.
|
|
161
|
+
const draftInToday = !!draftTitle && groups[0]?.key === 'today';
|
|
162
|
+
return (
|
|
163
|
+
<div className="flex flex-col gap-[var(--spacing-system-xs)]">
|
|
164
|
+
{draftTitle && !draftInToday && (
|
|
165
|
+
<DayGroup label="Today">
|
|
166
|
+
<SectionRow title={draftTitle} active />
|
|
167
|
+
</DayGroup>
|
|
168
|
+
)}
|
|
169
|
+
{groups.map((group, index) => (
|
|
170
|
+
<DayGroup key={group.key} label={group.label}>
|
|
171
|
+
{index === 0 && draftInToday && <SectionRow title={draftTitle} active />}
|
|
172
|
+
{group.items.map(dialog => (
|
|
173
|
+
<SectionRow
|
|
174
|
+
key={dialog.id}
|
|
175
|
+
dialog={dialog}
|
|
176
|
+
title={dialog.title || UNTITLED}
|
|
177
|
+
active={dialog.id === activeDialogId}
|
|
178
|
+
status={mingoDialogStatusOf(dialog, statusOf)}
|
|
179
|
+
ownerName={
|
|
180
|
+
dialogOwnedByOther(dialog, ownedByOther, currentUserId) ? dialog.owner?.name || undefined : undefined
|
|
181
|
+
}
|
|
182
|
+
ownerAvatarUrl={dialog.owner?.avatarUrl || undefined}
|
|
183
|
+
onSelect={onSelect}
|
|
184
|
+
menuItems={menuFor?.(dialog)}
|
|
185
|
+
/>
|
|
186
|
+
))}
|
|
187
|
+
</DayGroup>
|
|
188
|
+
))}
|
|
189
|
+
{isLoadingMore && (
|
|
190
|
+
<LoadingRegion label="Loading more chats" className="flex flex-col">
|
|
191
|
+
<SkeletonRows count={3} />
|
|
192
|
+
</LoadingRegion>
|
|
193
|
+
)}
|
|
194
|
+
{hasMore && onScroll && <div ref={sentinelRef} className="h-px shrink-0" aria-hidden />}
|
|
195
|
+
{hasMore && !onScroll && !isLoadingMore && onLoadMore && (
|
|
196
|
+
<Button
|
|
197
|
+
variant="link"
|
|
198
|
+
size="compact"
|
|
199
|
+
type="button"
|
|
200
|
+
data-tone="neutral"
|
|
201
|
+
onClick={onLoadMore}
|
|
202
|
+
className="self-start px-[var(--spacing-system-xs)]"
|
|
203
|
+
>
|
|
204
|
+
Show more
|
|
205
|
+
</Button>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The chat history block of a host's main navigation sidebar (`MingoChatRail`
|
|
213
|
+
* `variant="section"`): a "Chat history" caption with three icon buttons —
|
|
214
|
+
* Search (a modal over the page, ⌘K), the My chats / All chats filter (lit while
|
|
215
|
+
* all chats show) and ⋯ (Chat archive, the host's own items) — then the chats grouped by day. It is
|
|
216
|
+
* drawn at its full height and does not scroll: the sidebar body scrolls it with
|
|
217
|
+
* the tree above it. The sidebar owns the width, the background and the borders;
|
|
218
|
+
* the colours are the tenant's accent, as everywhere in the sidebar.
|
|
219
|
+
*/
|
|
220
|
+
export function MingoChatHistorySection({
|
|
221
|
+
dialogs,
|
|
222
|
+
activeDialogId,
|
|
223
|
+
onSelectDialog,
|
|
224
|
+
draftTitle,
|
|
225
|
+
onOpenArchive,
|
|
226
|
+
onWhatToAsk,
|
|
227
|
+
moreMenuItems = [],
|
|
228
|
+
statusOf,
|
|
229
|
+
onRequestRename,
|
|
230
|
+
onRequestArchive,
|
|
231
|
+
onRequestCopyLink,
|
|
232
|
+
onRequestCompact,
|
|
233
|
+
scope,
|
|
234
|
+
onScopeChange,
|
|
235
|
+
searchQuery,
|
|
236
|
+
onSearchChange,
|
|
237
|
+
searchOpen: searchOpenProp,
|
|
238
|
+
onSearchOpenChange,
|
|
239
|
+
hasMore = false,
|
|
240
|
+
isLoadingMore = false,
|
|
241
|
+
onLoadMore,
|
|
242
|
+
loadMore = 'scroll',
|
|
243
|
+
isLoadingHistory = false,
|
|
244
|
+
loadError = false,
|
|
245
|
+
onRetry,
|
|
246
|
+
ownedByOther,
|
|
247
|
+
currentUserId,
|
|
248
|
+
className,
|
|
249
|
+
}: MingoChatListProps) {
|
|
250
|
+
const captionId = useId();
|
|
251
|
+
const visitor = useVisitorOs();
|
|
252
|
+
const [searchOpen, setSearchOpen] = useControllableState({
|
|
253
|
+
prop: searchOpenProp,
|
|
254
|
+
defaultProp: false,
|
|
255
|
+
onChange: onSearchOpenChange,
|
|
256
|
+
});
|
|
257
|
+
const hasSearch = !!searchQuery?.trim();
|
|
258
|
+
const showSearch = searchOpen && !!onSearchChange;
|
|
259
|
+
const shortcut = visitor.known ? shortcutLabel(visitor.os, 'K') : null;
|
|
260
|
+
|
|
261
|
+
const listProps = {
|
|
262
|
+
dialogs,
|
|
263
|
+
activeDialogId,
|
|
264
|
+
statusOf,
|
|
265
|
+
ownedByOther,
|
|
266
|
+
currentUserId,
|
|
267
|
+
hasMore,
|
|
268
|
+
isLoadingMore,
|
|
269
|
+
onLoadMore,
|
|
270
|
+
isLoadingHistory,
|
|
271
|
+
loadError,
|
|
272
|
+
onRetry,
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const moreMenu: ActionsMenuItem[] = [
|
|
276
|
+
...(onOpenArchive
|
|
277
|
+
? [
|
|
278
|
+
{
|
|
279
|
+
id: 'archive',
|
|
280
|
+
label: 'Chat archive',
|
|
281
|
+
icon: <MessagesIcon className={chatMenuIconClassName} />,
|
|
282
|
+
onClick: onOpenArchive,
|
|
283
|
+
},
|
|
284
|
+
]
|
|
285
|
+
: []),
|
|
286
|
+
...(onWhatToAsk
|
|
287
|
+
? [
|
|
288
|
+
{
|
|
289
|
+
id: 'what-to-ask',
|
|
290
|
+
label: 'What to ask Mingo?',
|
|
291
|
+
icon: <QuestionCircleIcon className={chatMenuIconClassName} />,
|
|
292
|
+
onClick: onWhatToAsk,
|
|
293
|
+
},
|
|
294
|
+
]
|
|
295
|
+
: []),
|
|
296
|
+
...moreMenuItems,
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
// The scope as a filter, not a control of its own: a choice of two (radio
|
|
300
|
+
// items, the menu closes on a pick), the trigger lit while it is the wider
|
|
301
|
+
// one. Not over a failed load, where Try again is the only thing to do.
|
|
302
|
+
const scopeMenu: ActionsMenuItem[] =
|
|
303
|
+
scope && onScopeChange && !loadError
|
|
304
|
+
? [
|
|
305
|
+
{
|
|
306
|
+
id: 'my',
|
|
307
|
+
label: 'My chats',
|
|
308
|
+
type: 'radio',
|
|
309
|
+
checked: scope === 'my',
|
|
310
|
+
onClick: () => onScopeChange('my'),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
id: 'all',
|
|
314
|
+
label: 'All chats',
|
|
315
|
+
type: 'radio',
|
|
316
|
+
checked: scope === 'all',
|
|
317
|
+
onClick: () => onScopeChange('all'),
|
|
318
|
+
},
|
|
319
|
+
]
|
|
320
|
+
: [];
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<TooltipProvider delayDuration={300}>
|
|
324
|
+
<section
|
|
325
|
+
aria-labelledby={captionId}
|
|
326
|
+
className={cn('flex w-full min-w-0 flex-col gap-[var(--spacing-system-xs)]', className)}
|
|
327
|
+
>
|
|
328
|
+
<div className="flex shrink-0 items-center gap-[var(--spacing-system-xs)] px-[var(--spacing-system-xs)]">
|
|
329
|
+
<h2 id={captionId} className="min-w-0 flex-1 truncate text-ods-text-secondary text-h5">
|
|
330
|
+
Chat history
|
|
331
|
+
</h2>
|
|
332
|
+
{onSearchChange && (
|
|
333
|
+
<Tooltip>
|
|
334
|
+
<TooltipTrigger asChild>
|
|
335
|
+
<Button
|
|
336
|
+
variant="transparent"
|
|
337
|
+
size="icon"
|
|
338
|
+
aria-label="Search chats"
|
|
339
|
+
aria-keyshortcuts={shortcut ? (usesCommandKey(visitor.os) ? 'Meta+K' : 'Control+K') : undefined}
|
|
340
|
+
onClick={() => setSearchOpen(true)}
|
|
341
|
+
className={ICON_BUTTON_CLASS}
|
|
342
|
+
>
|
|
343
|
+
<SearchIcon size={20} />
|
|
344
|
+
</Button>
|
|
345
|
+
</TooltipTrigger>
|
|
346
|
+
<TooltipContent side="bottom">{shortcut ? `Search chats · ${shortcut}` : 'Search chats'}</TooltipContent>
|
|
347
|
+
</Tooltip>
|
|
348
|
+
)}
|
|
349
|
+
{scopeMenu.length > 0 && (
|
|
350
|
+
<Tooltip>
|
|
351
|
+
<ActionsMenuDropdown
|
|
352
|
+
triggerAriaLabel="Filter chats"
|
|
353
|
+
groups={[{ items: scopeMenu }]}
|
|
354
|
+
onCloseAutoFocus={e => e.preventDefault()}
|
|
355
|
+
customTrigger={
|
|
356
|
+
<TooltipTrigger asChild>
|
|
357
|
+
<Button
|
|
358
|
+
variant="transparent"
|
|
359
|
+
size="icon"
|
|
360
|
+
aria-label="Filter chats"
|
|
361
|
+
className={cn(ICON_BUTTON_CLASS, scope === 'all' && 'text-ods-accent')}
|
|
362
|
+
>
|
|
363
|
+
<Filter01Icon size={20} />
|
|
364
|
+
</Button>
|
|
365
|
+
</TooltipTrigger>
|
|
366
|
+
}
|
|
367
|
+
/>
|
|
368
|
+
<TooltipContent side="bottom">
|
|
369
|
+
{scope === 'all' ? 'Showing all chats' : 'Showing my chats'}
|
|
370
|
+
</TooltipContent>
|
|
371
|
+
</Tooltip>
|
|
372
|
+
)}
|
|
373
|
+
{moreMenu.length > 0 && (
|
|
374
|
+
<Tooltip>
|
|
375
|
+
<ActionsMenuDropdown
|
|
376
|
+
triggerAriaLabel="More"
|
|
377
|
+
groups={[{ items: moreMenu }]}
|
|
378
|
+
onCloseAutoFocus={e => e.preventDefault()}
|
|
379
|
+
customTrigger={
|
|
380
|
+
<TooltipTrigger asChild>
|
|
381
|
+
<Button variant="transparent" size="icon" aria-label="More" className={ICON_BUTTON_CLASS}>
|
|
382
|
+
<Ellipsis01Icon size={20} />
|
|
383
|
+
</Button>
|
|
384
|
+
</TooltipTrigger>
|
|
385
|
+
}
|
|
386
|
+
/>
|
|
387
|
+
<TooltipContent side="bottom">More</TooltipContent>
|
|
388
|
+
</Tooltip>
|
|
389
|
+
)}
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<HistoryList
|
|
393
|
+
{...listProps}
|
|
394
|
+
hasSearch={hasSearch}
|
|
395
|
+
draftTitle={draftTitle}
|
|
396
|
+
onSelect={onSelectDialog}
|
|
397
|
+
loadMore={loadMore}
|
|
398
|
+
menuFor={dialog =>
|
|
399
|
+
chatDialogMenuItems({
|
|
400
|
+
onCopyLink: onRequestCopyLink && (() => onRequestCopyLink(dialog)),
|
|
401
|
+
onRename: onRequestRename && (() => onRequestRename(dialog)),
|
|
402
|
+
onCompact: onRequestCompact && (() => onRequestCompact(dialog)),
|
|
403
|
+
onArchive: onRequestArchive && (() => onRequestArchive(dialog)),
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
/>
|
|
407
|
+
</section>
|
|
408
|
+
|
|
409
|
+
{/* Uncontrolled only. A host that controls `searchOpen` renders
|
|
410
|
+
`MingoChatSearchModal` once itself: a sidebar section is drawn twice
|
|
411
|
+
(the sidebar and the phone drawer), and each would open its own. */}
|
|
412
|
+
{searchOpenProp === undefined && onSearchChange && (
|
|
413
|
+
<MingoChatSearchModal
|
|
414
|
+
{...listProps}
|
|
415
|
+
open={showSearch}
|
|
416
|
+
onOpenChange={setSearchOpen}
|
|
417
|
+
searchQuery={searchQuery}
|
|
418
|
+
onSearchChange={onSearchChange}
|
|
419
|
+
onSelectDialog={onSelectDialog}
|
|
420
|
+
/>
|
|
421
|
+
)}
|
|
422
|
+
</TooltipProvider>
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface MingoChatSearchModalProps extends Pick<
|
|
427
|
+
MingoChatListProps,
|
|
428
|
+
| 'dialogs'
|
|
429
|
+
| 'activeDialogId'
|
|
430
|
+
| 'statusOf'
|
|
431
|
+
| 'ownedByOther'
|
|
432
|
+
| 'currentUserId'
|
|
433
|
+
| 'hasMore'
|
|
434
|
+
| 'isLoadingMore'
|
|
435
|
+
| 'onLoadMore'
|
|
436
|
+
| 'isLoadingHistory'
|
|
437
|
+
| 'loadError'
|
|
438
|
+
| 'onRetry'
|
|
439
|
+
| 'searchQuery'
|
|
440
|
+
| 'onSelectDialog'
|
|
441
|
+
> {
|
|
442
|
+
open: boolean;
|
|
443
|
+
onOpenChange: (open: boolean) => void;
|
|
444
|
+
onSearchChange: (term: string) => void;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* The chat search of the sidebar's history: the design system's modal with its
|
|
449
|
+
* `SearchInput`, focused on open, and the host's list under it — filtered by the
|
|
450
|
+
* term, which goes to the host 300ms after typing stops (at once on Enter or when
|
|
451
|
+
* emptied). Picking a chat opens it and closes the search; Escape and × close it.
|
|
452
|
+
* Closing clears the term, so the sidebar never stays filtered behind it.
|
|
453
|
+
*
|
|
454
|
+
* Over the window (portalled to `<body>`): the phone drawer slides the sidebar
|
|
455
|
+
* in with a transform, which would hold a fixed modal inside it. Render it once
|
|
456
|
+
* per page — `MingoChatRail variant="section"` renders its own only while it
|
|
457
|
+
* keeps the search state itself.
|
|
458
|
+
*/
|
|
459
|
+
export function MingoChatSearchModal({
|
|
460
|
+
open,
|
|
461
|
+
onOpenChange,
|
|
462
|
+
searchQuery,
|
|
463
|
+
onSearchChange,
|
|
464
|
+
onSelectDialog,
|
|
465
|
+
...listProps
|
|
466
|
+
}: MingoChatSearchModalProps) {
|
|
467
|
+
if (!open || typeof document === 'undefined') return null;
|
|
468
|
+
return createPortal(
|
|
469
|
+
<SearchModalContent initialValue={searchQuery} onSearchChange={onSearchChange} onClose={() => onOpenChange(false)}>
|
|
470
|
+
<HistoryList
|
|
471
|
+
{...listProps}
|
|
472
|
+
hasSearch={!!searchQuery?.trim()}
|
|
473
|
+
onSelect={id => {
|
|
474
|
+
onOpenChange(false);
|
|
475
|
+
if (searchQuery?.trim()) onSearchChange('');
|
|
476
|
+
onSelectDialog?.(id);
|
|
477
|
+
}}
|
|
478
|
+
/>
|
|
479
|
+
</SearchModalContent>,
|
|
480
|
+
document.body,
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
interface SearchModalContentProps {
|
|
485
|
+
initialValue?: string;
|
|
486
|
+
onSearchChange: (term: string) => void;
|
|
487
|
+
onClose: () => void;
|
|
488
|
+
children: ReactNode;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
function SearchModalContent({ initialValue, onSearchChange, onClose, children }: SearchModalContentProps) {
|
|
492
|
+
const [value, setValue] = useState(initialValue ?? '');
|
|
493
|
+
const debounced = useDebounce(value, 300);
|
|
494
|
+
const lastSent = useRef(initialValue ?? '');
|
|
495
|
+
const fieldRef = useRef<HTMLDivElement>(null);
|
|
496
|
+
|
|
497
|
+
const send = (term: string) => {
|
|
498
|
+
if (term === lastSent.current) return;
|
|
499
|
+
lastSent.current = term;
|
|
500
|
+
onSearchChange(term);
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
useEffect(() => {
|
|
504
|
+
if (debounced === lastSent.current) return;
|
|
505
|
+
lastSent.current = debounced;
|
|
506
|
+
onSearchChange(debounced);
|
|
507
|
+
}, [debounced, onSearchChange]);
|
|
508
|
+
|
|
509
|
+
// Opened on an explicit click or ⌘K: the field is what the user asked for. A
|
|
510
|
+
// frame late, after the modal has taken focus into its panel.
|
|
511
|
+
useEffect(() => {
|
|
512
|
+
const frame = requestAnimationFrame(() => fieldRef.current?.querySelector('input')?.focus());
|
|
513
|
+
return () => cancelAnimationFrame(frame);
|
|
514
|
+
}, []);
|
|
515
|
+
|
|
516
|
+
const close = () => {
|
|
517
|
+
send('');
|
|
518
|
+
onClose();
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
return (
|
|
522
|
+
<ModalV2 isOpen onClose={close} className="md:max-w-[600px]">
|
|
523
|
+
<ModalV2Header>
|
|
524
|
+
<ModalV2Title>Search chats</ModalV2Title>
|
|
525
|
+
</ModalV2Header>
|
|
526
|
+
<div ref={fieldRef} role="search" aria-label="Search chats" className="w-full">
|
|
527
|
+
<SearchInput
|
|
528
|
+
value={value}
|
|
529
|
+
onChange={setValue}
|
|
530
|
+
onSubmit={send}
|
|
531
|
+
placeholder="Search for Chats"
|
|
532
|
+
showDropdown={false}
|
|
533
|
+
/>
|
|
534
|
+
</div>
|
|
535
|
+
<div className="max-h-[min(480px,55vh)] w-full overflow-y-auto">{children}</div>
|
|
536
|
+
</ModalV2>
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function DayGroup({ label, children }: { label: string; children: ReactNode }) {
|
|
541
|
+
const labelId = useId();
|
|
542
|
+
return (
|
|
543
|
+
// A day that arrives with a page (or replaces the placeholder) fades in rather than popping.
|
|
544
|
+
<div
|
|
545
|
+
role="group"
|
|
546
|
+
aria-labelledby={labelId}
|
|
547
|
+
className="flex shrink-0 flex-col duration-300 animate-in fade-in motion-reduce:animate-none"
|
|
548
|
+
>
|
|
549
|
+
<p
|
|
550
|
+
id={labelId}
|
|
551
|
+
className="px-[var(--spacing-system-xs)] py-[var(--spacing-system-xxs)] text-ods-text-secondary text-h6"
|
|
552
|
+
>
|
|
553
|
+
{label}
|
|
554
|
+
</p>
|
|
555
|
+
{children}
|
|
556
|
+
</div>
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
interface SectionRowProps {
|
|
561
|
+
/** Absent for the draft row (a chat not saved yet): no actions, no select. */
|
|
562
|
+
dialog?: DialogItem;
|
|
563
|
+
title: string;
|
|
564
|
+
active: boolean;
|
|
565
|
+
status?: MingoDialogStatus;
|
|
566
|
+
/** Set only when the chat is someone else's. */
|
|
567
|
+
ownerName?: string;
|
|
568
|
+
ownerAvatarUrl?: string;
|
|
569
|
+
onSelect?: (id: string) => void;
|
|
570
|
+
menuItems?: ActionsMenuItem[];
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* One chat: the design system's `ChatListItem` (Figma `chat-list-item`, the v2
|
|
575
|
+
* rail's row) — the title, then what the row has to say at its end: the status
|
|
576
|
+
* glyph and, for someone else's chat, the owner's avatar. The ⋯ menu takes that
|
|
577
|
+
* place on hover or keyboard focus, so the title never reflows.
|
|
578
|
+
*/
|
|
579
|
+
function SectionRow({
|
|
580
|
+
dialog,
|
|
581
|
+
title,
|
|
582
|
+
active,
|
|
583
|
+
status,
|
|
584
|
+
ownerName,
|
|
585
|
+
ownerAvatarUrl,
|
|
586
|
+
onSelect,
|
|
587
|
+
menuItems = [],
|
|
588
|
+
}: SectionRowProps) {
|
|
589
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
590
|
+
const hasMenu = menuItems.length > 0;
|
|
591
|
+
const glyph = status ? MINGO_DIALOG_STATUS_GLYPHS[status] : undefined;
|
|
592
|
+
|
|
593
|
+
return (
|
|
594
|
+
// A row that lands in a day already on screen (the next page) fades in too.
|
|
595
|
+
<div className="group/row relative shrink-0 duration-300 animate-in fade-in motion-reduce:animate-none">
|
|
596
|
+
<ChatListItem
|
|
597
|
+
active={active}
|
|
598
|
+
title={title}
|
|
599
|
+
tabIndex={dialog ? undefined : -1}
|
|
600
|
+
onClick={dialog ? () => onSelect?.(dialog.id) : undefined}
|
|
601
|
+
className={cn(
|
|
602
|
+
'transition-colors duration-150',
|
|
603
|
+
!active && 'hover:bg-ods-bg-hover',
|
|
604
|
+
!dialog && 'cursor-default',
|
|
605
|
+
)}
|
|
606
|
+
// Held for the ⋯ even when empty, so a title never runs under it.
|
|
607
|
+
trailing={
|
|
608
|
+
glyph || ownerName || hasMenu ? (
|
|
609
|
+
<span
|
|
610
|
+
className={cn(
|
|
611
|
+
'flex min-w-6 items-center justify-end gap-[var(--spacing-system-xxs)] transition-opacity',
|
|
612
|
+
hasMenu && 'group-hover/row:opacity-0 group-has-[:focus-visible]/row:opacity-0',
|
|
613
|
+
menuOpen && 'opacity-0',
|
|
614
|
+
)}
|
|
615
|
+
>
|
|
616
|
+
{glyph && (
|
|
617
|
+
<span role="img" aria-label={glyph.label} className="flex">
|
|
618
|
+
{glyph.icon}
|
|
619
|
+
</span>
|
|
620
|
+
)}
|
|
621
|
+
{ownerName && (
|
|
622
|
+
<SquareAvatar
|
|
623
|
+
role="img"
|
|
624
|
+
aria-label={`Owner: ${ownerName}`}
|
|
625
|
+
title={ownerName}
|
|
626
|
+
variant="round"
|
|
627
|
+
sizePx={24}
|
|
628
|
+
src={ownerAvatarUrl}
|
|
629
|
+
alt={ownerName}
|
|
630
|
+
fallback={ownerName}
|
|
631
|
+
initialsClassName="text-ods-text-secondary text-badge"
|
|
632
|
+
/>
|
|
633
|
+
)}
|
|
634
|
+
</span>
|
|
635
|
+
) : undefined
|
|
636
|
+
}
|
|
637
|
+
/>
|
|
638
|
+
{hasMenu && (
|
|
639
|
+
// Revealed on hover or keyboard focus in the row (not a click's focus, which
|
|
640
|
+
// would keep it over the status), and kept while its menu is open.
|
|
641
|
+
<span
|
|
642
|
+
className={cn(
|
|
643
|
+
'absolute inset-y-0 right-[var(--spacing-system-xs)] flex items-center transition-opacity',
|
|
644
|
+
menuOpen
|
|
645
|
+
? 'opacity-100'
|
|
646
|
+
: 'opacity-0 group-hover/row:opacity-100 group-has-[:focus-visible]/row:opacity-100',
|
|
647
|
+
)}
|
|
648
|
+
>
|
|
649
|
+
<ActionsMenuDropdown
|
|
650
|
+
triggerAriaLabel={`Actions for ${title}`}
|
|
651
|
+
groups={[{ items: menuItems }]}
|
|
652
|
+
open={menuOpen}
|
|
653
|
+
onOpenChange={setMenuOpen}
|
|
654
|
+
onCloseAutoFocus={e => e.preventDefault()}
|
|
655
|
+
customTrigger={
|
|
656
|
+
<Button
|
|
657
|
+
variant="transparent"
|
|
658
|
+
size="icon"
|
|
659
|
+
aria-label={`Actions for ${title}`}
|
|
660
|
+
className="size-6 p-0 text-ods-text-secondary hover:text-ods-text-primary md:size-6"
|
|
661
|
+
>
|
|
662
|
+
<Ellipsis01Icon size={20} />
|
|
663
|
+
</Button>
|
|
664
|
+
}
|
|
665
|
+
/>
|
|
666
|
+
</span>
|
|
667
|
+
)}
|
|
668
|
+
</div>
|
|
669
|
+
);
|
|
670
|
+
}
|